dimcode 0.0.64 → 0.0.65

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 (3) hide show
  1. package/README.md +400 -77
  2. package/dist/cli.mjs +493 -493
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,128 +1,451 @@
1
1
  # Dimcode
2
2
 
3
- AI 编程助手 CLI。支持交互式 TUI、单次执行、多会话管理、MCP 扩展、多家主流大模型提供商。
3
+ AI coding agent CLI with an interactive terminal UI, one-shot execution, session history, MCP connectors, plugins, skills, and built-in model provider management.
4
4
 
5
- ## 安装
5
+ ## Installation
6
6
 
7
7
  ```bash
8
8
  npm install -g dimcode
9
9
  ```
10
10
 
11
- 安装后可通过 `dim` `dimcode` 运行。
11
+ After installation, run the CLI with either binary:
12
12
 
13
- ## 快速开始
13
+ ```bash
14
+ dim
15
+ dimcode
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ Start the interactive TUI:
21
+
22
+ ```bash
23
+ dim
24
+ ```
25
+
26
+ Inside the TUI:
27
+
28
+ ```text
29
+ /connect connect a model provider
30
+ /models select the active model
31
+ hello start chatting
32
+ ```
33
+
34
+ ## One-shot Execution
35
+
36
+ Run a prompt and exit:
37
+
38
+ ```bash
39
+ dim "Run the tests and fix any failures"
40
+ ```
41
+
42
+ Run from a specific project directory:
43
+
44
+ ```bash
45
+ dim --cwd ./my-project --no-interaction "Refactor the auth middleware"
46
+ ```
47
+
48
+ Read the prompt from stdin:
49
+
50
+ ```bash
51
+ printf "Summarize this repository" | dim --no-interaction
52
+ ```
53
+
54
+ Reuse a known session id:
55
+
56
+ ```bash
57
+ dim --session my-session "Continue the previous task"
58
+ ```
59
+
60
+ One-shot mode auto-approves tools and prints the final answer to stdout. `--no-interaction` disables follow-up questions and runs in agent mode.
61
+
62
+ ## Interactive Commands
63
+
64
+ Type `/` in the TUI to open command suggestions. Press `Ctrl+P` for the command palette and `F1` for help.
65
+
66
+ | Command | Action |
67
+ | -------------------- | ------------------------------------------------ |
68
+ | `/sessions` | List, switch, or delete saved sessions |
69
+ | `/new` | Start a new session |
70
+ | `/timeline` or `/tl` | Jump to a user message in the current session |
71
+ | `/resume` | Resume a paused queue |
72
+ | `/compact` | Compact the current session context |
73
+ | `/redo` | Redo after reverting messages |
74
+ | `/rename <title>` | Rename the current session |
75
+ | `/connect` | Connect or switch model providers |
76
+ | `/models` | Select the active model |
77
+ | `/settings` | Edit custom provider settings |
78
+ | `/approvals` | Configure tool approval mode |
79
+ | `/mcp` | Manage MCP connectors |
80
+ | `/plugins` | Manage plugins |
81
+ | `/debug` | Configure SDK observability JSONL logs |
82
+ | `/language` | Switch UI language |
83
+ | `/theme` | Switch the UI theme |
84
+ | `/skills` | View and activate loaded skills |
85
+ | `/review` | Ask Dimcode to review current code changes |
86
+ | `/init` | Ask Dimcode to initialize or improve `AGENTS.md` |
87
+ | `/exit` | Exit the application |
88
+
89
+ ## CLI Commands
90
+
91
+ ```bash
92
+ dim version # Print version info
93
+ dim upgrade [version] # Upgrade the CLI
94
+ dim acp # Start the ACP server for editor integrations
95
+ ```
96
+
97
+ Auto-update checks run by default. Set `DIMCODE_DISABLE_AUTOUPDATE=1` to disable them.
98
+
99
+ `dim upgrade` tracks the current release channel. Pass an explicit npm version to switch channels:
100
+
101
+ ```bash
102
+ npm install -g dimcode@1.2.0-beta.3
103
+ ```
104
+
105
+ ## Options
106
+
107
+ ```text
108
+ Usage:
109
+ dim Interactive TUI
110
+ dim [--cwd dir] [--session id] [--debug dir] [--no-interaction] "prompt"
111
+ One-shot execution
112
+ dim version
113
+ dim upgrade [version]
114
+ dim acp
115
+
116
+ Options:
117
+ --approvals auto|normal|strict Tool approval mode for the TUI
118
+ --auto-approve, --yes, -y Shorthand for --approvals auto
119
+ --cwd, -c, -cwd, --chdir <dir> Working directory for one-shot execution
120
+ --session, -s <id> Session id for one-shot execution
121
+ --no-interaction One-shot mode with follow-up questions disabled
122
+ --debug <dir> Write SDK observability logs for this run
123
+ -h, --help Show CLI help
124
+ ```
125
+
126
+ The interactive TUI starts with `normal` approvals. One-shot execution sets tool approvals to `auto`.
127
+
128
+ ## Configuration
129
+
130
+ Dimcode stores user data under `~/.dimcode` by default:
131
+
132
+ | Path | Purpose |
133
+ | ------------------------------- | --------------------------------------------- |
134
+ | `~/.dimcode/config.json` | Provider, model, and custom provider settings |
135
+ | `~/.dimcode/tools.json` | Tool-specific settings such as WebSearch |
136
+ | `~/.dimcode/mcp.json` | MCP server settings |
137
+ | `~/.dimcode/dimcode/cache.json` | UI cache and recent settings |
138
+ | `~/.dimcode/state/` | Session state, uploads, and runtime artifacts |
139
+
140
+ Move the whole config home with:
141
+
142
+ ```bash
143
+ export DIMCODE_HOME=/path/to/dimcode-home
144
+ ```
145
+
146
+ Move runtime state only with:
147
+
148
+ ```bash
149
+ export DIMCODE_STATE_DIR=/path/to/state
150
+ ```
151
+
152
+ Daily configuration is available in the TUI:
153
+
154
+ | Entry | Purpose |
155
+ | ------------ | ------------------------------------------------------- |
156
+ | `/connect` | Configure provider API keys and editable base URLs |
157
+ | `/models` | Select the model for the active provider |
158
+ | `/settings` | Manage custom providers and advanced model parameters |
159
+ | `/mcp` | Edit and load MCP connectors |
160
+ | `/approvals` | Choose `auto`, `normal`, or `strict` tool approvals |
161
+ | `/debug` | Choose `Off`, `On`, or `Auto` SDK observability logging |
162
+
163
+ Debug logs are written as JSONL files at `<debug-dir>/<session-id>.jsonl`.
164
+
165
+ ## Model Providers
166
+
167
+ Built-in providers include OpenAI, DimCode OAuth, OpenRouter, Aihubmix, Model Studio Coding Plan, ZhipuAI, Z.AI, DeepSeek, ZenMux, Moonshot, Kimi For Coding, Google, Anthropic, SiliconFlow, PPInfra, Ark Code, Ollama, LM Studio, xAI, Xiaomi Token Plan, and MiniMax variants.
168
+
169
+ Custom providers support OpenAI-compatible, OpenAI Responses, Gemini, and Anthropic adapters. Built-in base URLs are editable for OpenAI, Anthropic, Google, Ollama, and LM Studio.
170
+
171
+ ## MCP, Plugins, and Skills
172
+
173
+ `/mcp` manages stdio, HTTP, and SSE MCP servers from `~/.dimcode/mcp.json`.
174
+
175
+ `/plugins` manages installed plugins.
176
+
177
+ The command palette also includes Tool Settings for the WebSearch API key.
178
+
179
+ `/skills` lists loaded skills. Mention a skill with `$skill-name` in the prompt to force it for that turn.
14
180
 
15
- ### 启动交互式 TUI
181
+ ## Keyboard Shortcuts
182
+
183
+ | Shortcut | Action |
184
+ | ------------------------ | ------------------------------------- |
185
+ | `F1` | Open help |
186
+ | `Ctrl+P` | Open command palette |
187
+ | `Ctrl+K` | Open settings |
188
+ | `Ctrl+O` | Expand or collapse tools and thinking |
189
+ | `Tab` | Switch mode or focus |
190
+ | `Shift+Enter` / `Ctrl+J` | Insert a newline |
191
+ | `Cmd+Delete` / `Ctrl+W` | Clear input |
192
+ | `Ctrl+Click` | Open files or links |
193
+ | `Esc` | Cancel the current dialog or action |
194
+
195
+ The command palette, timeline, and new session shortcuts can be customized in settings.
196
+
197
+ ## Editor Integration
198
+
199
+ Start the ACP server:
200
+
201
+ ```bash
202
+ dim acp
203
+ ```
204
+
205
+ Example Zed settings:
206
+
207
+ ```json
208
+ {
209
+ "agent_servers": {
210
+ "dimcode": {
211
+ "command": "dim",
212
+ "args": ["acp"]
213
+ }
214
+ }
215
+ }
216
+ ```
217
+
218
+ ## Help
219
+
220
+ ```bash
221
+ dim --help
222
+ ```
223
+
224
+ Inside the TUI, press `F1`.
225
+
226
+ ---
227
+
228
+ # Dimcode 中文版
229
+
230
+ Dimcode 是一个 AI 编程助手 CLI,提供交互式终端 UI、单次执行、会话历史、MCP 连接器、插件、Skills,以及内置模型提供方管理。
231
+
232
+ ## 安装
233
+
234
+ ```bash
235
+ npm install -g dimcode
236
+ ```
237
+
238
+ 安装后可使用任一命令运行:
16
239
 
17
240
  ```bash
18
241
  dim
242
+ dimcode
19
243
  ```
20
244
 
21
- 进入 TUI 后,直接输入任务或问题即可开始对话。
245
+ ## 快速开始
22
246
 
23
- ### 执行单次命令
247
+ 启动交互式 TUI:
24
248
 
25
249
  ```bash
26
- dim "帮我写一个 Python 函数,计算斐波那契数列"
250
+ dim
251
+ ```
252
+
253
+ 进入 TUI 后:
254
+
255
+ ```text
256
+ /connect 连接模型提供方
257
+ /models 选择当前模型
258
+ hello 开始对话
27
259
  ```
28
260
 
261
+ ## 单次执行
262
+
263
+ 执行提示词并退出:
264
+
29
265
  ```bash
30
- dim --cwd ./my-project --no-interaction "运行测试并修复报错"
266
+ dim "Run the tests and fix any failures"
31
267
  ```
32
268
 
33
- 单次执行模式下工具会自动批准,执行完成后自动退出。配合 `--no-interaction` 可在 CI/脚本中使用。
269
+ 在指定项目目录运行:
34
270
 
35
- ## 常用交互命令
271
+ ```bash
272
+ dim --cwd ./my-project --no-interaction "Refactor the auth middleware"
273
+ ```
36
274
 
37
- TUI 中输入以下命令(以 `/` 开头)可快速操作:
275
+ stdin 读取提示词:
38
276
 
39
- | 命令 | 说明 |
40
- | -------------------- | --------------------------------------------- |
41
- | `/new` | 开始新会话 |
42
- | `/sessions` | 列出或切换会话 |
43
- | `/connect` | 连接大模型提供商(配置 API Key / Base URL) |
44
- | `/models` | 选择当前使用的模型 |
45
- | `/approvals` | 设置工具审批模式(auto / normal / strict) |
46
- | `/mcp` | 配置 MCP 服务器与扩展 |
47
- | `/settings` | 自定义提供商参数 |
48
- | `/language` | 切换界面语言 |
49
- | `/theme` | 切换界面主题(浅色 / 深色) |
50
- | `/timeline` 或 `/tl` | 跳转到指定用户消息 |
51
- | `/compact` | 压缩会话上下文,节省 Token |
52
- | `/rename <名称>` | 重命名当前会话 |
53
- | `/resume` | 恢复已暂停的队列 |
54
- | `/retry` | 重试上一条用户消息 |
55
- | `/redo` | 基于当前消息重做 |
56
- | `/pin` / `/pins` | 置顶上一条消息 / 打开置顶列表 |
57
- | `/status` | 切换状态栏详情 |
58
- | `/skills` | 查看已加载的 Skills |
59
- | `/plugins` | 管理插件 |
60
- | `/debug` | 管理 SDK observability JSONL 日志与 Auto 模式 |
61
- | `/toolsettings` | 管理工具级设置 |
62
- | `/review` | 审查当前代码变更 |
63
- | `/init` | 初始化或改进 AGENTS.md |
64
- | `/help` | 查看帮助与快捷键 |
65
- | `/exit` | 退出程序 |
277
+ ```bash
278
+ printf "Summarize this repository" | dim --no-interaction
279
+ ```
66
280
 
67
- 在聊天中选中某条消息后,可按回车复制消息文本到剪贴板。
281
+ 复用指定会话 id:
68
282
 
69
- ## 子命令
283
+ ```bash
284
+ dim --session my-session "Continue the previous task"
285
+ ```
70
286
 
71
- 除交互式 TUI 外,还支持以下子命令:
287
+ 单次执行模式会自动批准工具调用,并将最终回答输出到 stdout。`--no-interaction` 会关闭追问并使用 agent 模式。
288
+
289
+ ## 交互命令
290
+
291
+ 在 TUI 中输入 `/` 可打开命令建议。按 `Ctrl+P` 打开命令面板,按 `F1` 打开帮助。
292
+
293
+ | 命令 | 功能 |
294
+ | -------------------- | ----------------------------------- |
295
+ | `/sessions` | 列出、切换或删除已保存会话 |
296
+ | `/new` | 开始新会话 |
297
+ | `/timeline` 或 `/tl` | 跳转到当前会话中的用户消息 |
298
+ | `/resume` | 恢复已暂停队列 |
299
+ | `/compact` | 压缩当前会话上下文 |
300
+ | `/redo` | 在消息回退后重做 |
301
+ | `/rename <title>` | 重命名当前会话 |
302
+ | `/connect` | 连接或切换模型提供方 |
303
+ | `/models` | 选择当前模型 |
304
+ | `/settings` | 编辑自定义提供方设置 |
305
+ | `/approvals` | 配置工具审批模式 |
306
+ | `/mcp` | 管理 MCP 连接器 |
307
+ | `/plugins` | 管理插件 |
308
+ | `/debug` | 配置 SDK observability JSONL 日志 |
309
+ | `/language` | 切换界面语言 |
310
+ | `/theme` | 切换界面主题 |
311
+ | `/skills` | 查看并启用已加载 Skills |
312
+ | `/review` | 让 Dimcode 审查当前代码变更 |
313
+ | `/init` | 让 Dimcode 初始化或改进 `AGENTS.md` |
314
+ | `/exit` | 退出应用 |
315
+
316
+ ## CLI 命令
72
317
 
73
318
  ```bash
74
- dim version # 查看版本信息
75
- dim upgrade [version] # 升级 CLI
76
- dim acp # 启动 ACP Server(供编辑器集成,如 Zed)
319
+ dim version # Print version info
320
+ dim upgrade [version] # Upgrade the CLI
321
+ dim acp # Start the ACP server for editor integrations
77
322
  ```
78
323
 
79
- ## 配置说明
324
+ 自动更新检查默认开启。设置 `DIMCODE_DISABLE_AUTOUPDATE=1` 可关闭。
80
325
 
81
- Dimcode 的数据默认保存在 `~/.dimcode/` 目录下。你可以通过设置环境变量修改存储位置:
326
+ `dim upgrade` 会跟随当前发布通道。传入明确 npm 版本可切换通道:
82
327
 
83
328
  ```bash
84
- export DIMCODE_HOME=/path/to/config
329
+ npm install -g dimcode@1.2.0-beta.3
85
330
  ```
86
331
 
87
- **日常配置不需要手动编辑文件**。在 TUI 中使用以下入口即可图形化配置:
332
+ ## 选项
333
+
334
+ ```text
335
+ Usage:
336
+ dim Interactive TUI
337
+ dim [--cwd dir] [--session id] [--debug dir] [--no-interaction] "prompt"
338
+ One-shot execution
339
+ dim version
340
+ dim upgrade [version]
341
+ dim acp
342
+
343
+ Options:
344
+ --approvals auto|normal|strict Tool approval mode for the TUI
345
+ --auto-approve, --yes, -y Shorthand for --approvals auto
346
+ --cwd, -c, -cwd, --chdir <dir> Working directory for one-shot execution
347
+ --session, -s <id> Session id for one-shot execution
348
+ --no-interaction One-shot mode with follow-up questions disabled
349
+ --debug <dir> Write SDK observability logs for this run
350
+ -h, --help Show CLI help
351
+ ```
352
+
353
+ 交互式 TUI 默认使用 `normal` 审批模式。单次执行会将工具审批设为 `auto`。
88
354
 
89
- - `/connect` — 添加或切换提供商,输入 API Key 与 Base URL
90
- - `/models` — 选择当前会话使用的模型
91
- - `/settings` — 调整上下文窗口、温度、最大 Token 等高级参数
92
- - `/mcp` — 编辑 `mcp.json` 并加载 MCP 工具
93
- - `/debug` — 选择 Off / On / Auto,并配置 Auto 使用的日志目录;文件按会话写入 `<目录>/<session-id>.jsonl`
355
+ ## 配置
94
356
 
95
- 配置、会话历史、用户缓存会自动保存。
357
+ Dimcode 默认将用户数据保存到 `~/.dimcode`:
96
358
 
97
- ## 命令行选项
359
+ | 路径 | 用途 |
360
+ | ------------------------------- | ------------------------------ |
361
+ | `~/.dimcode/config.json` | 提供方、模型、自定义提供方设置 |
362
+ | `~/.dimcode/tools.json` | WebSearch 等工具级设置 |
363
+ | `~/.dimcode/mcp.json` | MCP server 设置 |
364
+ | `~/.dimcode/dimcode/cache.json` | UI 缓存和最近设置 |
365
+ | `~/.dimcode/state/` | 会话状态、上传文件、运行时产物 |
366
+
367
+ 移动完整配置目录:
98
368
 
99
369
  ```bash
100
- dim [选项] [命令或提示]
370
+ export DIMCODE_HOME=/path/to/dimcode-home
371
+ ```
101
372
 
102
- 选项:
103
- --approvals auto|normal|strict 工具审批模式(默认 normal)
104
- --auto-approve, --yes, -y 等价于 --approvals auto
105
- --no-interaction 单次执行时禁用交互式追问
106
- --cwd <dir> 指定工作目录(单次执行)
107
- --session <id> 指定会话 ID(单次执行)
108
- --debug <dir> 本次执行启用 SDK observability,写入 <dir>/<session-id>.jsonl
109
- -h, --help 显示帮助
373
+ 单独移动运行时状态目录:
374
+
375
+ ```bash
376
+ export DIMCODE_STATE_DIR=/path/to/state
110
377
  ```
111
378
 
379
+ 日常配置可在 TUI 中完成:
380
+
381
+ | 入口 | 用途 |
382
+ | ------------ | ------------------------------------------------- |
383
+ | `/connect` | 配置提供方 API key 和可编辑 base URL |
384
+ | `/models` | 为当前提供方选择模型 |
385
+ | `/settings` | 管理自定义提供方和高级模型参数 |
386
+ | `/mcp` | 编辑并加载 MCP 连接器 |
387
+ | `/approvals` | 选择 `auto`、`normal` 或 `strict` 工具审批 |
388
+ | `/debug` | 选择 `Off`、`On` 或 `Auto` SDK observability 日志 |
389
+
390
+ Debug 日志会以 JSONL 写入 `<debug-dir>/<session-id>.jsonl`。
391
+
392
+ ## 模型提供方
393
+
394
+ 内置提供方包括 OpenAI、DimCode OAuth、OpenRouter、Aihubmix、Model Studio Coding Plan、ZhipuAI、Z.AI、DeepSeek、ZenMux、Moonshot、Kimi For Coding、Google、Anthropic、SiliconFlow、PPInfra、Ark Code、Ollama、LM Studio、xAI、Xiaomi Token Plan、MiniMax 等变体。
395
+
396
+ 自定义提供方支持 OpenAI-compatible、OpenAI Responses、Gemini、Anthropic adapters。OpenAI、Anthropic、Google、Ollama、LM Studio 的内置 base URL 可编辑。
397
+
398
+ ## MCP、插件与 Skills
399
+
400
+ `/mcp` 会从 `~/.dimcode/mcp.json` 管理 stdio、HTTP、SSE MCP servers。
401
+
402
+ `/plugins` 用于管理已安装插件。
403
+
404
+ 命令面板中的 Tool Settings 可配置 WebSearch API key。
405
+
406
+ `/skills` 用于查看已加载 Skills。在提示词中使用 `$skill-name` 可为当前轮次指定 Skill。
407
+
112
408
  ## 快捷键
113
409
 
114
- | 快捷键 | 功能 |
115
- | ------------------------ | --------------------------- |
116
- | `Ctrl+C` / `Esc` | 取消当前操作 / 退出 |
117
- | `Ctrl+P` | 打开命令面板 |
118
- | `F1` | 打开帮助 |
119
- | `Tab` | 切换模式或焦点 |
120
- | `↑/↓` | 浏览历史输入或列表 |
121
- | `Ctrl+O` | 展开/收起工具输出与思考过程 |
122
- | `Ctrl+K` | 打开设置 |
123
- | `Shift+Enter` / `Ctrl+J` | 输入框换行 |
410
+ | 快捷键 | 功能 |
411
+ | ------------------------ | ------------------------- |
412
+ | `F1` | 打开帮助 |
413
+ | `Ctrl+P` | 打开命令面板 |
414
+ | `Ctrl+K` | 打开设置 |
415
+ | `Ctrl+O` | 展开或收起工具与 thinking |
416
+ | `Tab` | 切换模式或焦点 |
417
+ | `Shift+Enter` / `Ctrl+J` | 输入换行 |
418
+ | `Cmd+Delete` / `Ctrl+W` | 清空输入 |
419
+ | `Ctrl+Click` | 打开文件或链接 |
420
+ | `Esc` | 取消当前对话框或操作 |
421
+
422
+ 命令面板、时间线、新会话快捷键可在设置中自定义。
423
+
424
+ ## 编辑器集成
425
+
426
+ 启动 ACP server:
427
+
428
+ ```bash
429
+ dim acp
430
+ ```
431
+
432
+ Zed 配置示例:
433
+
434
+ ```json
435
+ {
436
+ "agent_servers": {
437
+ "dimcode": {
438
+ "command": "dim",
439
+ "args": ["acp"]
440
+ }
441
+ }
442
+ }
443
+ ```
124
444
 
125
445
  ## 获取帮助
126
446
 
127
- - 在 TUI 中输入 `/help`
128
- - 运行 `dim --help`
447
+ ```bash
448
+ dim --help
449
+ ```
450
+
451
+ 在 TUI 内按 `F1`。