@deepseekcode/cli 1.0.29 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +159 -99
  2. package/dist/cli.js +1480 -1477
  3. package/package.json +1 -1
  4. package/web/dist/assets/AutomationView-Y4qkPsrX.js +1 -0
  5. package/web/dist/assets/{ChannelConfigView-DG4_15oh.js → ChannelConfigView-BqEclPUB.js} +3 -3
  6. package/web/dist/assets/{ConnectorsView-ByedXSa-.js → ConnectorsView-Cz4uqSmh.js} +1 -1
  7. package/web/dist/assets/{FileTreeView-DPA2dhx_.js → FileTreeView-BWPOqGPh.js} +1 -1
  8. package/web/dist/assets/{HookConfigView-BJnvqm3N.js → HookConfigView-japq3zFX.js} +1 -1
  9. package/web/dist/assets/{ModelsView-BBbmRxwR.js → ModelsView-Dbo4GErV.js} +1 -1
  10. package/web/dist/assets/{PluginsView-DxIWxsB-.js → PluginsView-C1BPNAQx.js} +1 -1
  11. package/web/dist/assets/SessionGrid-BGpz0-op.css +1 -0
  12. package/web/dist/assets/SessionGrid-F23LrdJ2.js +42 -0
  13. package/web/dist/assets/{SettingsPanel-ivpxRR6O.js → SettingsPanel-CGJbV37j.js} +3 -3
  14. package/web/dist/assets/{SkillsView-Cpr_kpor.js → SkillsView-CecX9sxV.js} +1 -1
  15. package/web/dist/assets/{TemplatesTab-Cvyxqayr.js → TemplatesTab-BtbjQDQk.js} +1 -1
  16. package/web/dist/assets/{TerminalView-DTN8hmcS.js → TerminalView-6U_87hSL.js} +1 -1
  17. package/web/dist/assets/{ThreeScene-CukEnQe-.js → ThreeScene-Zhjwe9nT.js} +1 -1
  18. package/web/dist/assets/{ToolsView-D_FET-NB.js → ToolsView-DO0_61eJ.js} +1 -1
  19. package/web/dist/assets/{icons-Cu8fYt4q.js → icons-Di-qMB6n.js} +124 -109
  20. package/web/dist/assets/index-BbLAiXis.css +1 -0
  21. package/web/dist/assets/index-Dkxsd1Rx.js +484 -0
  22. package/web/dist/assets/{markdown-Bym7wmT0.js → markdown-D-c9V8Xq.js} +1 -1
  23. package/web/dist/assets/{panels-BEKHl5l-.js → panels-CpHTincc.js} +1 -1
  24. package/web/dist/assets/{react-vendor-D76F8wnc.js → react-vendor-DU8XgZt2.js} +1 -1
  25. package/web/dist/assets/{state-CZakZ3-m.js → state-D2vcUGVk.js} +1 -1
  26. package/web/dist/index.html +7 -7
  27. package/web/dist/assets/AutomationView-BJSLQ2Ka.js +0 -1
  28. package/web/dist/assets/SessionGrid-D-1XpCZg.js +0 -39
  29. package/web/dist/assets/index-C7rIgpwO.js +0 -484
  30. package/web/dist/assets/index-CYAcRfnc.css +0 -1
package/README.md CHANGED
@@ -1,123 +1,150 @@
1
1
  # @deepseekcode/cli
2
2
 
3
- Terminal UI (TUI) for the DeepSeekCode TypeScript runtime. Built on [Ink](https://github.com/vadimdemedes/ink) (React-for-terminal).
3
+ [![npm version](https://img.shields.io/npm/v/@deepseekcode/cli.svg)](https://www.npmjs.com/package/@deepseekcode/cli)
4
+ [![License](https://img.shields.io/npm/l/@deepseekcode/cli.svg)](https://www.npmjs.com/package/@deepseekcode/cli)
5
+ [![Node version](https://img.shields.io/node/v/@deepseekcode/cli.svg)](https://nodejs.org)
4
6
 
5
- ## Usage
7
+ **DeepSeekCode CLI** — a TypeScript-first AI coding agent with an interactive terminal UI, a built-in web UI, and a local HTTP/WS runtime. It starts a full agent core in-process, opens an [Ink](https://github.com/vadimdemedes/ink) (React-for-terminal) interface in your terminal, and serves a companion web UI you can use for configuration and remote access.
6
8
 
7
- ```bash
8
- bun --filter @deepseekcode/cli build
9
- node packages/cli/dist/cli.js run # Connect to remote server
10
- node packages/cli/dist/cli.js start # Start local in-process runtime
11
- node packages/cli/dist/cli.js exec <cmd> # Non-interactive execution
12
- node packages/cli/dist/cli.js codeview # AI code review
13
- node packages/cli/dist/cli.js --resume # Resume last session
14
- ```
9
+ - **TUI** — interactive, keyboard-first coding agent in your terminal
10
+ - **Local runtime** — spins up an in-process server (HTTP + WebSocket), no separate install needed
11
+ - **Web UI** configuration & model management at `http://localhost:8080`
12
+ - **Non-interactive modes** `exec`, `codeview`, `test-fix` for scripts & CI
13
+ - **Multi-theme** — dark / light / nord / dracula / monokai / one-dark / tokyo-night
15
14
 
16
- ## Architecture
15
+ Requires **Node.js >= 18**.
17
16
 
18
- ```
19
- packages/cli/src/
20
- main.ts # Entry point — CLI arg parser, startup lifecycle
21
- App.tsx # Root React component (connected gating, animation clock control)
22
- client.ts # WebSocket client (DeepSeekCodeClient)
23
- localClient.ts # In-process runtime client (LocalRuntimeClient)
24
- store.ts # Microtask-batched state store
25
- ink/ # Forked Ink renderer (frame budget, Yoga caching)
26
- hooks/ # React hooks for state, animation, WebSocket, mouse, keyboard
27
- components/ # UI components (ChatArea, StatusLine, TextInput, etc.)
28
- tui/ # Interaction primitives (selection, navigation, search)
29
- commands/ # Slash command registry and handlers
30
- utils/ # Utilities (session persistence, logging, config)
17
+ ---
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install -g @deepseekcode/cli
31
23
  ```
32
24
 
33
- ## Performance: OOM Prevention
25
+ Or with your favorite package manager:
34
26
 
35
- The Ink renderer + React reconciler creates significant memory pressure per rendered frame. The following measures prevent OOM in large/heavy sessions:
27
+ ```bash
28
+ # pnpm
29
+ pnpm add -g @deepseekcode/cli
36
30
 
37
- ### Animation Clock Governance
38
- - **Global gate**: `setAnimationsEnabled(false)` pauses ALL animation subscribers during startup. Animations only activate after WebSocket `connected`.
39
- - **Dynamic tick rate**: idle (2fps) → active (5fps) → streaming (10fps). Default changed from 50ms/20fps to 200ms/5fps.
40
- - **Auto-stop**: Clock stops entirely when last subscriber unsubscribes.
31
+ # yarn
32
+ yarn global add @deepseekcode/cli
41
33
 
42
- ### Frame Budget Control
43
- - Ink's `onRender` measures frame generation time; if a frame completes faster than 100ms since the last, it's skipped (up to 3 consecutive skips before force-render).
44
- - Combined with `FRAME_INTERVAL_MS=500` throttle on the render scheduler.
34
+ # bun
35
+ bun add -g @deepseekcode/cli
36
+ ```
45
37
 
46
- ### Yoga Layout Versioning
47
- - `onComputeLayout` tracks a `layoutVersion` counter; if no DOM mutations happened since last computation, `calculateLayout()` (the most expensive per-frame operation) is skipped entirely.
38
+ This installs two commands: **`dscode`** (short) and **`deepseekcode`** (full name).
48
39
 
49
- ### Lazy Hook Mounting
50
- - Interaction hooks (mouse wheel, text selection, keyboard selection, message navigation) only mount after `connected === true`.
51
- - Startup state updates are batched into a single `updateAppState()` call (from 3-5 sequential calls).
40
+ ## Quick Start
52
41
 
53
- ## Theme System
42
+ ```bash
43
+ dscode
44
+ ```
54
45
 
55
- The CLI supports **multi-theme** with dynamic switching, a `t` Proxy for live access, and JSON file loading compatible with MiMo-Code / opencode format.
46
+ That's it. The CLI starts the local agent runtime and opens the interactive terminal. On first run (no provider configured) it prints a link to the web UI where you can set up your LLM provider and model:
56
47
 
57
- ### Built-in Themes
48
+ ```bash
49
+ # model/provider setup page (also served by the CLI)
50
+ # → http://localhost:8080/#models
51
+ ```
58
52
 
59
- | Theme | Env Value | Style |
60
- |-------|-----------|-------|
61
- | Dark (default) | `dark` | ANSI named colors, broad compat |
62
- | Light | `light` | Light terminal variant |
63
- | Nord | `nord` | ❄️ Arctic blue-grey palette |
64
- | Dracula | `dracula` | 🧛 Dark purple-vibrant |
65
- | Monokai | `monokai` | 🎨 Classic code editor |
66
- | One Dark | `one-dark` | 🌙 Atom's iconic dark |
67
- | Tokyo Night | `tokyo-night` | 🌃 Deep navy + vibrant accents |
53
+ If your terminal's stdin isn't a TTY (e.g. a script or CI pipeline), the CLI skips the TUI and runs **headless** — the web UI stays available at the printed URL.
68
54
 
69
- ### Usage
55
+ Connect to an **existing** backend instead of starting a local one:
70
56
 
71
57
  ```bash
72
- # Via environment variable
73
- DEEPSEEKCODE_THEME=nord node packages/cli/dist/cli.js run
74
- DEEPSEEKCODE_THEME=dracula node packages/cli/dist/cli.js start
75
- DEEPSEEKCODE_THEME=/path/to/my-theme.json node packages/cli/dist/cli.js run
76
-
77
- # Custom color overrides (partial merge on current theme)
78
- DEEPSEEKCODE_THEME_COLORS='{"primary":"#ff0000"}' node packages/cli/dist/cli.js run
58
+ dscode run --backend http://localhost:8080
79
59
  ```
80
60
 
81
- ### Programmatic API
61
+ Resume your last session (or a specific one):
82
62
 
83
- ```typescript
84
- import { t, setTheme, getTheme, registerTheme, listThemes } from './theme.js'
63
+ ```bash
64
+ dscode --resume # last session
65
+ dscode --resume <id> # specific session
66
+ ```
85
67
 
86
- // Components always use the live theme via Proxy
87
- <Text color={t.primary}>Brand</Text>
88
- <Text color={t.error}>Error</Text>
89
- <Text backgroundColor={t.success}>Success</Text>
68
+ ## CLI Commands
90
69
 
91
- // Switch at runtime
92
- setTheme('nord')
70
+ | Command | Description |
71
+ |---------|-------------|
72
+ | `dscode` / `dscode start` | Start local runtime + interactive TUI (also serves Web UI + API) |
73
+ | `dscode start --auto` | Start with auto-approval mode enabled |
74
+ | `dscode run --backend URL` | Connect to an existing backend instead of starting one |
75
+ | `dscode exec <command>` | Execute a command non-interactively (JSONL output) |
76
+ | `dscode exec --file <path>` | Read the command from a file |
77
+ | `dscode codeview` | AI code review — bugs + unwired features (JSON output) |
78
+ | `dscode review` | Review current code changes (legacy) |
79
+ | `dscode test-fix` | Run the auto-fix test loop |
80
+ | `dscode --resume [id]` | Resume the last session, or a specific one |
81
+ | `dscode version` | Print version |
93
82
 
94
- // Register a custom theme
95
- registerTheme('my-theme', { primary: '#ff6600', bg: '#1a1a2e', ... })
96
- setTheme('my-theme')
83
+ Run `dscode --help` (or `-h`) for the full list.
97
84
 
98
- // Enumerate all registered themes
99
- listThemes() // ['dark', 'dracula', 'light', 'monokai', ...]
100
- ```
85
+ ### Non-interactive examples
101
86
 
102
- ### Architecture
87
+ ```bash
88
+ # Execute a command, get JSONL results
89
+ dscode exec "fix the failing test in src/utils"
103
90
 
104
- ```
105
- src/theme/
106
- ├── types.ts # ThemeColors interface (60+ color keys)
107
- ├── registry.ts # Theme registry + t Proxy
108
- ├── detect.ts # Terminal background detection (OSC 11)
109
- ├── loader.ts # JSON theme file loader
110
- └── builtins/ # Built-in theme factories
111
- ├── index.ts, dark.ts, light.ts,
112
- ├── nord.ts, dracula.ts, monokai.ts,
113
- ├── one-dark.ts, tokyo-night.ts
114
- ```
91
+ # Plain text output, command from file
92
+ dscode exec --file ./task.txt --text
115
93
 
116
- The `t` Proxy (`src/theme/registry.ts`) forwards every property access to the active theme via `getTheme()`, so `t.primary` always returns the current theme's primary color even after `setTheme()` — no re-import needed.
94
+ # AI code review focused on security, write report to file
95
+ dscode codeview --focus security --output review.json
117
96
 
118
- ## Config
97
+ # Auto-fix test loop (max 5 retries, analyze only)
98
+ dscode test-fix --packages packages/cli --retries 5 --dry-run
99
+ ```
119
100
 
120
- The CLI reads `~/.agent/config.yaml`.
101
+ ## Interactive Commands
102
+
103
+ Inside the TUI, use `/help` for the full list (most commands have Chinese aliases). Highlights:
104
+
105
+ | Command | Action |
106
+ |---------|--------|
107
+ | `/help` | Show all commands |
108
+ | `/model [name]` | Open model picker or switch model directly |
109
+ | `/theme [name]` | Show or change terminal theme |
110
+ | `/plan` | Toggle plan mode (review before executing) |
111
+ | `/auto` | Toggle auto-approval mode |
112
+ | `/mode <mode>` | Cycle/set mode: act · auto-act · plan · auto-plan · goal · auto-goal |
113
+ | `/goal` | Set goal-directed mode |
114
+ | `/thinking` | Toggle think mode on/off |
115
+ | `/context` | Show current conversation state |
116
+ | `/sessions [id]` / `/resume [id]` | List history / switch session |
117
+ | `/tasks` | Toggle sub-task output panel |
118
+ | `/undo [list]` | Undo the most recent file change |
119
+ | `/clear` | Clear local conversation messages |
120
+ | `/mcp <action>` | Manage MCP servers |
121
+ | `/skills` | Insert a skill |
122
+ | `/trace <traceId>` | Query a trace by id |
123
+ | `/stop` `/pause` `/continue` | Control AI generation |
124
+ | `/exit` | Exit |
125
+
126
+ ## Options
127
+
128
+ | Option | Description |
129
+ |--------|-------------|
130
+ | `-p, --port <port>` | HTTP port (default: first available from 8080) |
131
+ | `--ws-port <port>` | WebSocket port (default: HTTP port + 1) |
132
+ | `-w, --workspace <dir>` | Workspace directory (default: current directory) |
133
+ | `-F, --force` | Kill an existing process on the target port before starting |
134
+ | `-b, --backend <url>` | Backend URL for `run` mode |
135
+ | `--ws <url>` | Override WebSocket URL |
136
+ | `--provider <name>` | Provider to use (exec/review) |
137
+ | `--model <name>` | Model to use (exec/review) |
138
+ | `--theme <name\|path>` | Theme name or JSON theme file path |
139
+ | `--prompt-version <ver>` | Prompt template version |
140
+ | `--timeout <ms>` | Per-attempt LLM timeout (default: 300000 = 5 min) |
141
+ | `--stall-threshold <ms>` | Stream stall detection threshold (default: 240000 = 4 min) |
142
+ | `--no-update-check` | Disable the startup new-version notice |
143
+ | `--no-auto-update` | Disable background auto-update (notice still shown) |
144
+
145
+ ## Configuration
146
+
147
+ The CLI reads `~/.agent/config.yaml`:
121
148
 
122
149
  ```yaml
123
150
  backend_url: http://localhost:8080
@@ -125,20 +152,53 @@ ws_url: ws://localhost:8081/ws
125
152
  workspace_dir: /path/to/workspace
126
153
  ```
127
154
 
128
- ## Auto-Update
155
+ Provider / model settings are managed through the web UI at `http://localhost:8080/#models`.
129
156
 
130
- `dscode` 每次启动会异步查询 npm 上的最新版本(不阻塞启动)。当发现新版本时,
131
- 默认会在**后台自动重装全局包**(`npm install -g @deepseekcode/cli@latest`),
132
- 新版本在下次启动时生效,升级结果会在下一次启动时报告。
157
+ ## Themes
133
158
 
134
- - 仅对「全局 npm 安装」生效;源码开发环境、`npx`/`bunx` 临时缓存不会误升级。
135
- - 关闭自动安装(保留版本提示):`DEEPSEEKCODE_NO_AUTO_UPDATE=1` 或 `--no-auto-update`
136
- - 连版本检查一起关闭:`DEEPSEEKCODE_NO_UPDATE_CHECK=1` 或 `--no-update-check`
159
+ Set the theme at startup via the `DEEPSEEKCODE_THEME` env var (or `--theme`):
137
160
 
138
- ## Development
161
+ | Theme | Env Value | Style |
162
+ |-------|-----------|-------|
163
+ | Dark (default) | `dark` | ANSI named colors, broad compat |
164
+ | Light | `light` | Light terminal variant |
165
+ | Nord | `nord` | Arctic blue-grey palette |
166
+ | Dracula | `dracula` | Dark purple-vibrant |
167
+ | Monokai | `monokai` | Classic code editor |
168
+ | One Dark | `one-dark` | Atom's iconic dark |
169
+ | Tokyo Night | `tokyo-night` | Deep navy + vibrant accents |
139
170
 
140
171
  ```bash
141
- bun --filter @deepseekcode/cli typecheck
142
- bun --filter @deepseekcode/cli build
143
- bun --filter @deepseekcode/cli test
172
+ DEEPSEEKCODE_THEME=nord dscode
173
+ DEEPSEEKCODE_THEME=/path/to/my-theme.json dscode
174
+
175
+ # Partial overrides on the current theme (JSON)
176
+ DEEPSEEKCODE_THEME_COLORS='{"primary":"#ff0000"}' dscode
144
177
  ```
178
+
179
+ Switch themes at runtime with `/theme [name]`.
180
+
181
+ ## Auto-Update
182
+
183
+ On startup, `dscode` checks npm for the latest version asynchronously (non-blocking). When a newer version is found, the CLI **automatically reinstalls the global package** in the background (`npm install -g @deepseekcode/cli@latest`); the new version takes effect on the next launch.
184
+
185
+ - Only affects **global npm installs** — source builds and `npx`/`bunx` caches are never touched.
186
+ - Disable auto-install (keep the version notice): `DEEPSEEKCODE_NO_AUTO_UPDATE=1` or `--no-auto-update`
187
+ - Disable the check entirely: `DEEPSEEKCODE_NO_UPDATE_CHECK=1` or `--no-update-check`
188
+
189
+ ## Environment Variables
190
+
191
+ | Variable | Description |
192
+ |----------|-------------|
193
+ | `DEEPSEEKCODE_THEME` | Theme name or JSON theme file |
194
+ | `DEEPSEEKCODE_THEME_COLORS` | JSON partial color overrides |
195
+ | `DEEPSEEKCODE_HTTP_PORT` / `DEEPSEEKCODE_WS_PORT` | Default HTTP / WebSocket ports |
196
+ | `DEEPSEEKCODE_QUIET=1` | Suppress non-fatal startup warnings |
197
+ | `DEEPSEEKCODE_NO_AUTO_UPDATE=1` | Disable background auto-update |
198
+ | `DEEPSEEKCODE_NO_UPDATE_CHECK=1` | Disable the version check |
199
+ | `DEEPSEEKCODE_FORCE_UTF8=0` | Skip forcing the Windows console to UTF-8 |
200
+ | `DSC_HEAP_LIMIT_MB` | Node heap limit hint for large sessions (default: 8192) |
201
+
202
+ ## License
203
+
204
+ [Apache-2.0](https://www.npmjs.com/package/@deepseekcode/cli)