From 89dbbf5fcd07f51c5b692165f6deed102d2ebb61 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 4 Jun 2026 23:41:59 +0800 Subject: [PATCH] feat(cli): add /upgrade and /privacy-settings slash commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two more Claude-Code parity slash commands (both ๐Ÿ”„ in BEHAVIOR_PARITY): - /upgrade โ€” prints the current version (core VERSION) + the update command `npm i -g deepcode-cli@latest` (mirrors the `deepcode upgrade` subcommand; notes the macOS app auto-updates). - /privacy-settings โ€” read-only summary of where data lives (creds at 0600 or OS keychain, local sessions/snapshots) and what's sent to the DeepSeek API. Grounded in docs/security-model.md โ€” no invented privacy claims. Tests in parity-commands.test.ts (2 cases). cli 137. Flips both rows โ†’ โœ…. Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/cli/src/commands.ts | 31 ++++++++++++++++++++++++++++ apps/cli/src/parity-commands.test.ts | 20 ++++++++++++++++++ docs/BEHAVIOR_PARITY.md | 4 ++-- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/apps/cli/src/commands.ts b/apps/cli/src/commands.ts index 3f45a59..0fa5c6c 100644 --- a/apps/cli/src/commands.ts +++ b/apps/cli/src/commands.ts @@ -16,6 +16,7 @@ import { estimateCost, redact, EFFORT_PARAMS, + VERSION, type Credentials, type Effort, } from '@deepcode/core'; @@ -1023,6 +1024,34 @@ export const PrCommentsCommand: SlashCommand = { }, }; +export const UpgradeCommand: SlashCommand = { + name: '/upgrade', + description: 'Show the current version and how to update.', + run() { + return [ + `DeepCode CLI v${VERSION}`, + 'Update the CLI: npm i -g deepcode-cli@latest', + 'The macOS desktop app auto-updates via GitHub Releases.', + ]; + }, +}; + +export const PrivacySettingsCommand: SlashCommand = { + name: '/privacy-settings', + description: 'Show where your data lives and what is sent to DeepSeek.', + run(_args, ctx) { + const base = ctx.creds?.baseURL || 'https://api.deepseek.com'; + return [ + 'Privacy โ€” DeepCode is local-first:', + ' โ€ข Credentials: ~/.deepcode/credentials.json (chmod 600), or an OS keychain via apiKeyHelper.', + ' โ€ข Sessions, history & snapshots: ~/.deepcode/sessions/ โ€” local files on this machine.', + ` โ€ข Prompts, file contents & tool output are sent to the DeepSeek API (${base}) to generate responses, handled per DeepSeek's policy.`, + ' โ€ข Plugin / hook subprocesses run with DeepSeek credentials stripped from their env.', + ' โ€ข Full threat model: docs/security-model.md.', + ]; + }, +}; + export const BUILTIN_COMMANDS: SlashCommand[] = [ HelpCommand, ClearCommand, @@ -1056,6 +1085,8 @@ export const BUILTIN_COMMANDS: SlashCommand[] = [ LoginCommand, LogoutCommand, PrCommentsCommand, + UpgradeCommand, + PrivacySettingsCommand, ]; // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ diff --git a/apps/cli/src/parity-commands.test.ts b/apps/cli/src/parity-commands.test.ts index ec6c948..4e9a790 100644 --- a/apps/cli/src/parity-commands.test.ts +++ b/apps/cli/src/parity-commands.test.ts @@ -134,3 +134,23 @@ describe('/pr_comments', () => { expect(out).toMatch(/no open pull request|needs the github cli|failed/i); }); }); + +describe('/upgrade + /privacy-settings', () => { + it('/upgrade shows the version + update instructions', async () => { + const out = (await reg.match('/upgrade')!.cmd.run([], ctx())).join('\n'); + expect(out).toMatch(/DeepCode CLI v\d/); + expect(out).toMatch(/npm i -g deepcode-cli@latest/); + }); + + it('/privacy-settings shows data locations + the DeepSeek endpoint', async () => { + const out = ( + await reg + .match('/privacy-settings')! + .cmd.run([], ctx({ creds: { apiKey: 'x', baseURL: 'https://api.deepseek.com/v1' } })) + ).join('\n'); + expect(out).toMatch(/credentials\.json/); + expect(out).toMatch(/sessions/); + expect(out).toMatch(/api\.deepseek\.com/); + expect(out).toMatch(/security-model\.md/); + }); +}); diff --git a/docs/BEHAVIOR_PARITY.md b/docs/BEHAVIOR_PARITY.md index 92547a7..ebf4333 100644 --- a/docs/BEHAVIOR_PARITY.md +++ b/docs/BEHAVIOR_PARITY.md @@ -53,7 +53,7 @@ Legend: `โœ…` matches ยท `๐ŸŸก` matches with caveats ยท `๐Ÿ”„` deferred ยท `โš  | `/login` / `/logout` | โœ“ | โœ“ | โœ… โ€” /logout clears creds + exits; /login stores a new key (next launch) | | `/export` | โœ“ | โœ“ | โœ… โ€” writes the conversation to a markdown file | | `/bug` (alias `/feedback`) | โœ“ | โœ“ | โœ… โ€” prints a prefilled GitHub issue link (model/mode/effort in the body) | -| `/upgrade` | โœ“ | โœ— | ๐Ÿ”„ โ€” no slash command; the `deepcode upgrade` CLI subcommand prints an upgrade hint | +| `/upgrade` | โœ“ | โœ“ | โœ… โ€” prints version + `npm i -g deepcode-cli@latest` (also the `deepcode upgrade` subcommand) | | `/pr_comments` | โœ“ | โœ“ | โœ… โ€” `gh pr view` comments for the current branch's PR | | `/review` | โœ“ | โœ— (skill avail) | ๐ŸŸก โ€” via Skill tool | | `/security-review` | โœ“ | โœ— (skill avail) | ๐ŸŸก โ€” via Skill tool | @@ -66,7 +66,7 @@ Legend: `โœ…` matches ยท `๐ŸŸก` matches with caveats ยท `๐Ÿ”„` deferred ยท `โš  | `/hooks` | โœ“ | โœ“ | โœ… โ€” lists hooks configured in settings.json | | `/skills` | โœ“ | โœ“ | โœ… โ€” lists built-in + user + project skills | | `/permissions` | โœ“ | โœ“ (read-only) | ๐ŸŸก โ€” shows rules + default mode (interactive editor deferred) | -| `/privacy-settings` | โœ“ | โœ— | ๐Ÿ”„ | +| `/privacy-settings` | โœ“ | โœ“ | โœ… โ€” summarizes local data locations + what's sent to the DeepSeek API (read-only) | | `/migrate-installer` | โœ“ | โœ— | ๐Ÿ”„ | | `/release-notes` | โœ“ | โœ“ | โœ… โ€” prints the latest `CHANGELOG.md` entry |