dimcode 0.2.8-beta.1 → 0.2.8

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 +159 -157
  2. package/README.zh.md +304 -0
  3. package/package.json +8 -7
package/README.md CHANGED
@@ -1,33 +1,35 @@
1
1
  # dimcode
2
2
 
3
- > 你的终端 AI 伙伴。在命令行里聊聊天、跑任务、让工作流自动化一点。
3
+ > An AI coding agent for your terminal. Chat, run tasks, and automate development work from the command line.
4
4
 
5
- `dimcode` 是一个 AI coding agent CLI,提供交互式 TUI 界面和一次性任务执行模式。
5
+ `dimcode` is an AI coding agent CLI with an interactive terminal UI and a headless execution mode for one-off tasks.
6
+
7
+ [Chinese](./README.zh.md)
6
8
 
7
9
  ---
8
10
 
9
- ## 安装
11
+ ## Installation
10
12
 
11
13
  ```bash
12
- # beta channel(当前推荐)
14
+ # beta channel (recommended for now)
13
15
  npm i -g dimcode@beta
14
16
 
15
- # 或者用 bun / pnpm
17
+ # or use bun / pnpm
16
18
  bun add -g dimcode@beta
17
19
  pnpm add -g dimcode@beta
18
20
  ```
19
21
 
20
- 安装完成后会得到两个等价命令:`dim` `dimcode`。
22
+ The package installs two equivalent commands: `dim` and `dimcode`.
21
23
 
22
24
  ```bash
23
25
  dim --version
24
26
  ```
25
27
 
26
- > 安装时 npm 会根据当前平台自动拉取对应的二进制子包(`dimcode-darwin-arm64`、`dimcode-linux-x64` 等),不需要手动选择。
28
+ > During installation, npm automatically selects the matching platform binary package, such as `dimcode-darwin-arm64` or `dimcode-linux-x64`. You do not need to choose one manually.
27
29
 
28
- ### 支持的平台
30
+ ### Supported Platforms
29
31
 
30
- | 平台 | 子包 |
32
+ | Platform | Binary package |
31
33
  |---|---|
32
34
  | macOS (Apple Silicon) | `dimcode-darwin-arm64` |
33
35
  | macOS (Intel) | `dimcode-darwin-x64` |
@@ -37,251 +39,251 @@ dim --version
37
39
 
38
40
  ---
39
41
 
40
- ## 快速开始
42
+ ## Quick Start
41
43
 
42
44
  ```bash
43
- # 启动交互式界面,和 AI 聊聊天
45
+ # Start the interactive terminal UI
44
46
  dim
45
47
 
46
- # 一次性执行,不用进界面
47
- dim exec " auth 模块重构为 JWT 方案"
48
+ # Run a one-off task without opening the UI
49
+ dim exec "refactor the auth module to use JWT"
48
50
 
49
- # 查看版本
51
+ # Show the installed version
50
52
  dim --version
51
53
 
52
- # 查看帮助
54
+ # Show help
53
55
  dim --help
54
56
  ```
55
57
 
56
- 第一次启动会引导你连接一个模型提供商(OpenAIAnthropic 或自定义 endpoint)。
58
+ On first launch, `dimcode` guides you through connecting a model provider such as OpenAI, Anthropic, or a custom endpoint.
57
59
 
58
60
  ---
59
61
 
60
- ## 命令速查
62
+ ## Command Reference
61
63
 
62
- | 命令 | 说明 |
64
+ | Command | Description |
63
65
  |---|---|
64
- | `dim` | 启动交互式 TUI 界面(默认) |
65
- | `dim exec "<提示词>"` | 在后台执行单条提示,不用进界面 |
66
- | `dim session list` | 列出已保存的会话 |
67
- | `dim session rm <id>` | 删除指定会话 |
68
- | `dim provider list` | 查看已配置的模型提供商 |
69
- | `dim provider add <id> --api-key <密钥>` | 添加提供商(如 `openai`) |
70
- | `dim provider switch <id>` | 切换当前使用的提供商 |
71
- | `dim provider refresh-models` | 从提供商刷新模型列表 |
72
- | `dim mcp list` | 查看 MCP 服务器列表 |
73
- | `dim auth login` | 登录云端功能 |
74
- | `dim upgrade` | 检查更新 |
75
- | `dim --help` | 显示帮助信息 |
76
- | `dim --version` | 显示版本号 |
66
+ | `dim` | Start the interactive terminal UI (default) |
67
+ | `dim exec "<prompt>"` | Run a single prompt in headless mode |
68
+ | `dim session list` | List saved sessions |
69
+ | `dim session rm <id>` | Delete a saved session |
70
+ | `dim provider list` | Show configured model providers |
71
+ | `dim provider add <id> --api-key <key>` | Add a provider, such as `openai` |
72
+ | `dim provider switch <id>` | Switch the active provider |
73
+ | `dim provider refresh-models` | Refresh model lists from providers |
74
+ | `dim mcp list` | List MCP servers |
75
+ | `dim auth login` | Log in for cloud features |
76
+ | `dim upgrade` | Check for updates |
77
+ | `dim --help` | Show help |
78
+ | `dim --version` | Show the version |
77
79
 
78
80
  ---
79
81
 
80
- ## 交互式界面(TUI)
81
-
82
- 直接运行 `dim` 就进终端交互界面了,长这样:
83
-
84
- ```
85
- ┌────────────────────────────────────────────────────────────────────────────┐
86
- 会话标题 ~/workspace/repo 12 条消息 | 42k | vdev
87
- ├────────────────────────────────────────────────────────────────────────────┤
88
-
89
- 对话记录 │
90
- - 用户消息 │
91
- - 助手回复 │
92
- - 工具调用 │
93
- - 思考过程 │
94
-
95
- ├────────────────────────────────────────────────────────────────────────────┤
96
- ┌────────────────────────────────────────────────────────────────────────┐
97
- 输入问题... │
98
- 代理模式 就绪 42% 上下文模型名称 │
99
- └────────────────────────────────────────────────────────────────────────┘
100
- ├────────────────────────────────────────────────────────────────────────────┤
101
- 拖拽选择文本 清空输入 Tab: 切换模式 Ctrl+P: 命令面板 │
102
- └────────────────────────────────────────────────────────────────────────────┘
82
+ ## Interactive Terminal UI
83
+
84
+ Run `dim` to open the terminal UI:
85
+
86
+ ```text
87
+ +----------------------------------------------------------------------------+
88
+ | Session title ~/workspace/repo 12 messages | 42k | vdev |
89
+ +----------------------------------------------------------------------------+
90
+ | |
91
+ | Conversation |
92
+ | - User messages |
93
+ | - Assistant replies |
94
+ | - Tool calls |
95
+ | - Reasoning |
96
+ | |
97
+ +----------------------------------------------------------------------------+
98
+ | +------------------------------------------------------------------------+ |
99
+ | | Ask anything... | |
100
+ | | Agent mode Ready 42% contextModel name | |
101
+ | +------------------------------------------------------------------------+ |
102
+ +----------------------------------------------------------------------------+
103
+ | Select text Clear input Tab: switch mode Ctrl+P: commands |
104
+ +----------------------------------------------------------------------------+
103
105
  ```
104
106
 
105
- 界面分四块:
107
+ The UI has four main areas:
106
108
 
107
- 1. **顶部标题栏** 会话名、当前目录、消息数、Token 用量、版本号
108
- 2. **对话记录区** 你和 AI 的聊天记录,包括工具执行结果
109
- 3. **输入框** 打字的地方,支持多行,也能贴图片
110
- 4. **底部状态栏** 快捷键提示和当前状态
109
+ 1. **Header** - session title, current directory, message count, token usage, and version
110
+ 2. **Conversation** - messages, assistant replies, tool output, and reasoning
111
+ 3. **Composer** - multiline input with image paste support
112
+ 4. **Status bar** - shortcuts and current state
111
113
 
112
- ### 常用快捷键
114
+ ### Common Shortcuts
113
115
 
114
- | 按键 | 做什么 |
116
+ | Shortcut | Action |
115
117
  |---|---|
116
- | `Enter` | 发送消息 |
117
- | `Shift+Enter` / `Ctrl+J` | 输入换行 |
118
- | `Tab` | 切换「代理模式」/「计划模式」 |
119
- | `Ctrl+P` | 打开命令面板 |
120
- | `Cmd+T`(Mac)/ `Ctrl+T`(其他) | 打开时间线 |
121
- | `Cmd+N`(Mac)/ `Ctrl+N`(其他) | 新建会话 / 回首页 |
122
- | `/` | 打开命令面板并过滤 |
123
- | `@` | 打开技能引用面板 |
124
- | `Esc` | 打断正在跑的 AI 任务 |
125
- | `Ctrl+C` | 关弹窗 清空输入 退出确认 |
126
- | `Ctrl+V` | 粘贴剪贴板图片 |
127
- | `↑` / `↓` | 翻输入历史(单行时) |
128
-
129
- ### 斜杠命令
130
-
131
- 在输入框里打 `/` 就能打开命令面板:
132
-
133
- | 命令 | 干嘛的 |
118
+ | `Enter` | Send message |
119
+ | `Shift+Enter` / `Ctrl+J` | Insert a newline |
120
+ | `Tab` | Switch between agent mode and plan mode |
121
+ | `Ctrl+P` | Open the command palette |
122
+ | `Cmd+T` (Mac) / `Ctrl+T` (other platforms) | Open the timeline |
123
+ | `Cmd+N` (Mac) / `Ctrl+N` (other platforms) | Create a new session / return home |
124
+ | `/` | Open and filter the command palette |
125
+ | `@` | Open the skill picker |
126
+ | `Esc` | Interrupt the current AI turn |
127
+ | `Ctrl+C` | Close modal -> clear input -> confirm exit |
128
+ | `Ctrl+V` | Paste an image from the clipboard |
129
+ | `Up` / `Down` | Browse input history when the composer is single-line |
130
+
131
+ ### Slash Commands
132
+
133
+ Type `/` in the composer to open the command palette:
134
+
135
+ | Command | Action |
134
136
  |---|---|
135
- | `/new` | 开一个新会话 |
136
- | `/timeline` | 看看这个会话的时间线 |
137
- | `/skills` | 浏览可用的技能 |
138
- | `/resume` | 打开之前保存的会话 |
139
- | `/compact` | 压缩一下上下文,省点 Token |
140
- | `/approvals` | 调整工具授权设置 |
141
- | `/connect` | 连接模型提供商 |
142
- | `/models` | 换个模型用 |
143
- | `/mcp` | 管理 MCP 服务器 |
144
- | `/plugins` | 看看装了哪些插件 |
145
- | `/theme` | 换个主题 |
146
- | `/settings` | 打开设置 |
147
- | `/language` | 切换界面语言 |
148
- | `/exit` | 退出 |
149
-
150
- ### 运行中的交互
151
-
152
- AI 干活的时候可能会弹窗问你:
153
-
154
- - **工具授权** AI 想跑命令或读文件时问你。按 `Y` 允许一次,`N` 拒绝
155
- - **用户询问** AI 有不清楚的地方,回答完它继续
156
- - **退出确认** `Ctrl+C` 时弹出来,防止手滑关掉
137
+ | `/new` | Create a new session |
138
+ | `/timeline` | Show the current session timeline |
139
+ | `/skills` | Browse available skills |
140
+ | `/resume` | Open a saved session |
141
+ | `/compact` | Compact context to save tokens |
142
+ | `/approvals` | Adjust tool approval settings |
143
+ | `/connect` | Connect a model provider |
144
+ | `/models` | Switch models |
145
+ | `/mcp` | Manage MCP servers |
146
+ | `/plugins` | Show installed plugins |
147
+ | `/theme` | Switch theme |
148
+ | `/settings` | Open settings |
149
+ | `/language` | Change UI language |
150
+ | `/exit` | Exit |
151
+
152
+ ### Runtime Prompts
153
+
154
+ While the agent is working, `dimcode` may ask for input:
155
+
156
+ - **Tool approval** - approve or deny a command or file access request with `Y` or `N`
157
+ - **User question** - answer a clarification question and the agent continues
158
+ - **Exit confirmation** - confirm before closing with `Ctrl+C`
157
159
 
158
160
  ---
159
161
 
160
- ## 配置
162
+ ## Configuration
161
163
 
162
- 所有配置保存在 `~/.dimcode/` 目录下(SQLite 数据库 + JSON 文件)。
164
+ Configuration is stored under `~/.dimcode/` as a SQLite database and JSON files.
163
165
 
164
- ### 添加模型提供商
166
+ ### Add A Model Provider
165
167
 
166
168
  ```bash
167
169
  # OpenAI
168
170
  dim provider add openai --api-key sk-xxxxxxxx
169
171
 
170
- # 自定义本地模型
172
+ # Custom local model endpoint
171
173
  dim provider add mylocal --base-url http://127.0.0.1:11434 --model llama3
172
174
 
173
- # 切换当前使用的提供商
175
+ # Switch active provider
174
176
  dim provider switch openai
175
177
 
176
- # 刷新模型列表
178
+ # Refresh models
177
179
  dim provider refresh-models openai
178
180
  ```
179
181
 
180
- ### 环境变量
182
+ ### Environment Variables
181
183
 
182
- | 变量 | 说明 |
184
+ | Variable | Description |
183
185
  |---|---|
184
- | `DIMCODE_LOG` | 开启诊断日志,记录到 `~/.dimcode/logs/` |
185
- | `DIMCODE_DEBUG` | 打印 wrapper 启动调试信息(定位平台二进制问题) |
186
- | `DIMCODE_BIN_PATH` | 指定自定义二进制路径(开发/调试用) |
187
- | `NO_COLOR` | 禁用彩色输出 |
188
- | `HTTPS_PROXY` | 设置 HTTPS 代理 |
186
+ | `DIMCODE_LOG` | Enable diagnostic logs under `~/.dimcode/logs/` |
187
+ | `DIMCODE_DEBUG` | Print wrapper startup diagnostics for platform binary issues |
188
+ | `DIMCODE_BIN_PATH` | Use a custom binary path for development or debugging |
189
+ | `NO_COLOR` | Disable colored output |
190
+ | `HTTPS_PROXY` | Configure an HTTPS proxy |
189
191
 
190
192
  ---
191
193
 
192
- ## 后台执行(无需界面)
194
+ ## Headless Execution
193
195
 
194
- 适合脚本和自动化场景:
196
+ Use `dim exec` for scripts and automation:
195
197
 
196
198
  ```bash
197
- # 单条提示直接执行
198
- dim exec "写一个按列排序 CSV Python 脚本"
199
+ # Run one prompt directly
200
+ dim exec "write a Python script that sorts a CSV by column"
199
201
  ```
200
202
 
201
- ### 退出状态码
203
+ ### Exit Codes
202
204
 
203
- | 状态码 | 含义 |
205
+ | Code | Meaning |
204
206
  |---|---|
205
- | `0` | 执行成功 |
206
- | `1` | 运行时错误 |
207
- | `2` | 参数错误 |
208
- | `3` | 认证失败 |
207
+ | `0` | Success |
208
+ | `1` | Runtime error |
209
+ | `2` | Argument error |
210
+ | `3` | Authentication failed |
209
211
 
210
212
  ---
211
213
 
212
- ## 升级 & 卸载
214
+ ## Upgrade And Uninstall
213
215
 
214
216
  ```bash
215
- # 升级到最新 beta
217
+ # Upgrade to the latest beta
216
218
  npm i -g dimcode@beta
217
219
 
218
- # 卸载
220
+ # Uninstall
219
221
  npm uninstall -g dimcode
220
222
  ```
221
223
 
222
224
  ---
223
225
 
224
- ## 常见问题
226
+ ## FAQ
225
227
 
226
- **Q: 安装后提示找不到平台二进制?**
228
+ **Q: Installation succeeds, but the platform binary is missing.**
227
229
 
228
- 可能是 npm 跳过了 optionalDependencies。先用 debug 模式确认:
230
+ npm may have skipped optional dependencies. Check with debug output first:
229
231
 
230
232
  ```bash
231
233
  DIMCODE_DEBUG=1 dim --version
232
234
  ```
233
235
 
234
- 然后重装一次:
236
+ Then reinstall:
235
237
 
236
238
  ```bash
237
239
  npm uninstall -g dimcode && npm i -g dimcode@beta
238
240
  ```
239
241
 
240
- **Q: 启动后显示空白或乱码?**
242
+ **Q: The UI is blank or garbled.**
241
243
 
242
- 确保终端支持 256 色:
244
+ Make sure your terminal supports 256 colors:
243
245
 
244
246
  ```bash
245
247
  export TERM=xterm-256color
246
248
  ```
247
249
 
248
- **Q: 如何中断正在执行的任务?**
250
+ **Q: How do I interrupt a running task?**
249
251
 
250
- `Esc` 键即可中断当前 AI 的执行回合。
252
+ Press `Esc` to interrupt the current AI turn.
251
253
 
252
- **Q: 图片怎么发送给 AI?**
254
+ **Q: How do I send an image to the AI?**
253
255
 
254
- 直接 `Ctrl+V` 粘贴剪贴板中的图片,或在输入框中粘贴图片路径。
256
+ Paste an image from the clipboard with `Ctrl+V`, or paste an image path into the composer.
255
257
 
256
- **Q: 会话数据存在哪里?**
258
+ **Q: Where is session data stored?**
257
259
 
258
- 所有本地数据放在 `~/.dimcode/v2/`,会话存在其中的 SQLite 数据库 `dimcode.sqlite` 里(表:`sessions`、`session_states`、`session_relations`、`session_blobs`),不会上传到云端。
260
+ Local data lives under `~/.dimcode/v2/`. Sessions are stored in the SQLite database `dimcode.sqlite` in tables such as `sessions`, `session_states`, `session_relations`, and `session_blobs`. Session data is not uploaded to the cloud.
259
261
 
260
- 目录布局大致是:
262
+ The directory is roughly:
261
263
 
262
- ```
264
+ ```text
263
265
  ~/.dimcode/v2/
264
- ├── config.json 全局配置
265
- ├── providers.json 模型提供商
266
- ├── auth.json 登录态
267
- ├── mcp.json MCP 服务器
268
- ├── dimcode.sqlite 会话 / 消息 / 状态
269
- ├── dimcode.sqlite-wal
270
- ├── dimcode.sqlite-shm
271
- ├── data/ blob 数据
272
- └── logs/ 诊断日志
266
+ |-- config.json global config
267
+ |-- providers.json model providers
268
+ |-- auth.json login state
269
+ |-- mcp.json MCP servers
270
+ |-- dimcode.sqlite sessions / messages / state
271
+ |-- dimcode.sqlite-wal
272
+ |-- dimcode.sqlite-shm
273
+ |-- data/ blob data
274
+ `-- logs/ diagnostic logs
273
275
  ```
274
276
 
275
- **Q: 如何删除单个会话?**
277
+ **Q: How do I delete one session?**
276
278
 
277
279
  ```bash
278
- dim session list # 找到要删的 id
280
+ dim session list # find the session id
279
281
  dim session rm <id>
280
282
  ```
281
283
 
282
- **Q: 如何清空所有历史会话?**
284
+ **Q: How do I clear all session history?**
283
285
 
284
- 最稳的做法是删 SQLite 数据库文件(保留 `config.json`、`providers.json` 等配置):
286
+ The safest reset is to delete the SQLite database files while keeping `config.json`, `providers.json`, and other configuration:
285
287
 
286
288
  ```bash
287
289
  rm -f ~/.dimcode/v2/dimcode.sqlite \
@@ -289,16 +291,16 @@ rm -f ~/.dimcode/v2/dimcode.sqlite \
289
291
  ~/.dimcode/v2/dimcode.sqlite-shm
290
292
  ```
291
293
 
292
- 如果想彻底重置(含配置、登录态、MCP 列表),删整个 v2 目录:
294
+ To reset everything, including config, login state, and MCP servers, delete the whole v2 directory:
293
295
 
294
296
  ```bash
295
297
  rm -rf ~/.dimcode/v2
296
298
  ```
297
299
 
298
- > 注意:`~/.dimcode/` 下的其它目录(`sessions/`、`dimcode/` 等)是早期版本残留,对 v2 没有作用。
300
+ > Other directories under `~/.dimcode/`, such as `sessions/` and `dimcode/`, are leftovers from earlier versions and are not used by v2.
299
301
 
300
302
  ---
301
303
 
302
304
  ## License
303
305
 
304
- 见仓库根目录 LICENSE 文件。
306
+ See the repository root LICENSE file.
package/README.zh.md ADDED
@@ -0,0 +1,304 @@
1
+ # dimcode
2
+
3
+ > 你的终端 AI 伙伴。在命令行里聊聊天、跑任务、让工作流自动化一点。
4
+
5
+ `dimcode` 是一个 AI coding agent CLI,提供交互式 TUI 界面和一次性任务执行模式。
6
+
7
+ ---
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ # beta channel(当前推荐)
13
+ npm i -g dimcode@beta
14
+
15
+ # 或者用 bun / pnpm
16
+ bun add -g dimcode@beta
17
+ pnpm add -g dimcode@beta
18
+ ```
19
+
20
+ 安装完成后会得到两个等价命令:`dim` 和 `dimcode`。
21
+
22
+ ```bash
23
+ dim --version
24
+ ```
25
+
26
+ > 安装时 npm 会根据当前平台自动拉取对应的二进制子包(`dimcode-darwin-arm64`、`dimcode-linux-x64` 等),不需要手动选择。
27
+
28
+ ### 支持的平台
29
+
30
+ | 平台 | 子包 |
31
+ |---|---|
32
+ | macOS (Apple Silicon) | `dimcode-darwin-arm64` |
33
+ | macOS (Intel) | `dimcode-darwin-x64` |
34
+ | Linux (x64) | `dimcode-linux-x64` |
35
+ | Linux (ARM64) | `dimcode-linux-arm64` |
36
+ | Windows (x64) | `dimcode-windows-x64` |
37
+
38
+ ---
39
+
40
+ ## 快速开始
41
+
42
+ ```bash
43
+ # 启动交互式界面,和 AI 聊聊天
44
+ dim
45
+
46
+ # 一次性执行,不用进界面
47
+ dim exec "把 auth 模块重构为 JWT 方案"
48
+
49
+ # 查看版本
50
+ dim --version
51
+
52
+ # 查看帮助
53
+ dim --help
54
+ ```
55
+
56
+ 第一次启动会引导你连接一个模型提供商(OpenAI、Anthropic 或自定义 endpoint)。
57
+
58
+ ---
59
+
60
+ ## 命令速查
61
+
62
+ | 命令 | 说明 |
63
+ |---|---|
64
+ | `dim` | 启动交互式 TUI 界面(默认) |
65
+ | `dim exec "<提示词>"` | 在后台执行单条提示,不用进界面 |
66
+ | `dim session list` | 列出已保存的会话 |
67
+ | `dim session rm <id>` | 删除指定会话 |
68
+ | `dim provider list` | 查看已配置的模型提供商 |
69
+ | `dim provider add <id> --api-key <密钥>` | 添加提供商(如 `openai`) |
70
+ | `dim provider switch <id>` | 切换当前使用的提供商 |
71
+ | `dim provider refresh-models` | 从提供商刷新模型列表 |
72
+ | `dim mcp list` | 查看 MCP 服务器列表 |
73
+ | `dim auth login` | 登录云端功能 |
74
+ | `dim upgrade` | 检查更新 |
75
+ | `dim --help` | 显示帮助信息 |
76
+ | `dim --version` | 显示版本号 |
77
+
78
+ ---
79
+
80
+ ## 交互式界面(TUI)
81
+
82
+ 直接运行 `dim` 就进终端交互界面了,长这样:
83
+
84
+ ```
85
+ ┌────────────────────────────────────────────────────────────────────────────┐
86
+ │ 会话标题 ~/workspace/repo 12 条消息 | 42k | vdev │
87
+ ├────────────────────────────────────────────────────────────────────────────┤
88
+ │ │
89
+ │ 对话记录 │
90
+ │ - 用户消息 │
91
+ │ - 助手回复 │
92
+ │ - 工具调用 │
93
+ │ - 思考过程 │
94
+ │ │
95
+ ├────────────────────────────────────────────────────────────────────────────┤
96
+ │ ┌────────────────────────────────────────────────────────────────────────┐ │
97
+ │ │ 输入问题... │ │
98
+ │ │ 代理模式 就绪 42% 上下文 ■ 模型名称 │ │
99
+ │ └────────────────────────────────────────────────────────────────────────┘ │
100
+ ├────────────────────────────────────────────────────────────────────────────┤
101
+ │ 拖拽选择文本 清空输入 Tab: 切换模式 Ctrl+P: 命令面板 │
102
+ └────────────────────────────────────────────────────────────────────────────┘
103
+ ```
104
+
105
+ 界面分四块:
106
+
107
+ 1. **顶部标题栏** — 会话名、当前目录、消息数、Token 用量、版本号
108
+ 2. **对话记录区** — 你和 AI 的聊天记录,包括工具执行结果
109
+ 3. **输入框** — 打字的地方,支持多行,也能贴图片
110
+ 4. **底部状态栏** — 快捷键提示和当前状态
111
+
112
+ ### 常用快捷键
113
+
114
+ | 按键 | 做什么 |
115
+ |---|---|
116
+ | `Enter` | 发送消息 |
117
+ | `Shift+Enter` / `Ctrl+J` | 输入换行 |
118
+ | `Tab` | 切换「代理模式」/「计划模式」 |
119
+ | `Ctrl+P` | 打开命令面板 |
120
+ | `Cmd+T`(Mac)/ `Ctrl+T`(其他) | 打开时间线 |
121
+ | `Cmd+N`(Mac)/ `Ctrl+N`(其他) | 新建会话 / 回首页 |
122
+ | `/` | 打开命令面板并过滤 |
123
+ | `@` | 打开技能引用面板 |
124
+ | `Esc` | 打断正在跑的 AI 任务 |
125
+ | `Ctrl+C` | 关弹窗 → 清空输入 → 退出确认 |
126
+ | `Ctrl+V` | 粘贴剪贴板图片 |
127
+ | `↑` / `↓` | 翻输入历史(单行时) |
128
+
129
+ ### 斜杠命令
130
+
131
+ 在输入框里打 `/` 就能打开命令面板:
132
+
133
+ | 命令 | 干嘛的 |
134
+ |---|---|
135
+ | `/new` | 开一个新会话 |
136
+ | `/timeline` | 看看这个会话的时间线 |
137
+ | `/skills` | 浏览可用的技能 |
138
+ | `/resume` | 打开之前保存的会话 |
139
+ | `/compact` | 压缩一下上下文,省点 Token |
140
+ | `/approvals` | 调整工具授权设置 |
141
+ | `/connect` | 连接模型提供商 |
142
+ | `/models` | 换个模型用 |
143
+ | `/mcp` | 管理 MCP 服务器 |
144
+ | `/plugins` | 看看装了哪些插件 |
145
+ | `/theme` | 换个主题 |
146
+ | `/settings` | 打开设置 |
147
+ | `/language` | 切换界面语言 |
148
+ | `/exit` | 退出 |
149
+
150
+ ### 运行中的交互
151
+
152
+ AI 干活的时候可能会弹窗问你:
153
+
154
+ - **工具授权** — AI 想跑命令或读文件时问你。按 `Y` 允许一次,`N` 拒绝
155
+ - **用户询问** — AI 有不清楚的地方,回答完它继续
156
+ - **退出确认** — 按 `Ctrl+C` 时弹出来,防止手滑关掉
157
+
158
+ ---
159
+
160
+ ## 配置
161
+
162
+ 所有配置保存在 `~/.dimcode/` 目录下(SQLite 数据库 + JSON 文件)。
163
+
164
+ ### 添加模型提供商
165
+
166
+ ```bash
167
+ # OpenAI
168
+ dim provider add openai --api-key sk-xxxxxxxx
169
+
170
+ # 自定义本地模型
171
+ dim provider add mylocal --base-url http://127.0.0.1:11434 --model llama3
172
+
173
+ # 切换当前使用的提供商
174
+ dim provider switch openai
175
+
176
+ # 刷新模型列表
177
+ dim provider refresh-models openai
178
+ ```
179
+
180
+ ### 环境变量
181
+
182
+ | 变量 | 说明 |
183
+ |---|---|
184
+ | `DIMCODE_LOG` | 开启诊断日志,记录到 `~/.dimcode/logs/` |
185
+ | `DIMCODE_DEBUG` | 打印 wrapper 启动调试信息(定位平台二进制问题) |
186
+ | `DIMCODE_BIN_PATH` | 指定自定义二进制路径(开发/调试用) |
187
+ | `NO_COLOR` | 禁用彩色输出 |
188
+ | `HTTPS_PROXY` | 设置 HTTPS 代理 |
189
+
190
+ ---
191
+
192
+ ## 后台执行(无需界面)
193
+
194
+ 适合脚本和自动化场景:
195
+
196
+ ```bash
197
+ # 单条提示直接执行
198
+ dim exec "写一个按列排序 CSV 的 Python 脚本"
199
+ ```
200
+
201
+ ### 退出状态码
202
+
203
+ | 状态码 | 含义 |
204
+ |---|---|
205
+ | `0` | 执行成功 |
206
+ | `1` | 运行时错误 |
207
+ | `2` | 参数错误 |
208
+ | `3` | 认证失败 |
209
+
210
+ ---
211
+
212
+ ## 升级 & 卸载
213
+
214
+ ```bash
215
+ # 升级到最新 beta
216
+ npm i -g dimcode@beta
217
+
218
+ # 卸载
219
+ npm uninstall -g dimcode
220
+ ```
221
+
222
+ ---
223
+
224
+ ## 常见问题
225
+
226
+ **Q: 安装后提示找不到平台二进制?**
227
+
228
+ 可能是 npm 跳过了 optionalDependencies。先用 debug 模式确认:
229
+
230
+ ```bash
231
+ DIMCODE_DEBUG=1 dim --version
232
+ ```
233
+
234
+ 然后重装一次:
235
+
236
+ ```bash
237
+ npm uninstall -g dimcode && npm i -g dimcode@beta
238
+ ```
239
+
240
+ **Q: 启动后显示空白或乱码?**
241
+
242
+ 确保终端支持 256 色:
243
+
244
+ ```bash
245
+ export TERM=xterm-256color
246
+ ```
247
+
248
+ **Q: 如何中断正在执行的任务?**
249
+
250
+ 按 `Esc` 键即可中断当前 AI 的执行回合。
251
+
252
+ **Q: 图片怎么发送给 AI?**
253
+
254
+ 直接 `Ctrl+V` 粘贴剪贴板中的图片,或在输入框中粘贴图片路径。
255
+
256
+ **Q: 会话数据存在哪里?**
257
+
258
+ 所有本地数据放在 `~/.dimcode/v2/`,会话存在其中的 SQLite 数据库 `dimcode.sqlite` 里(表:`sessions`、`session_states`、`session_relations`、`session_blobs`),不会上传到云端。
259
+
260
+ 目录布局大致是:
261
+
262
+ ```
263
+ ~/.dimcode/v2/
264
+ ├── config.json 全局配置
265
+ ├── providers.json 模型提供商
266
+ ├── auth.json 登录态
267
+ ├── mcp.json MCP 服务器
268
+ ├── dimcode.sqlite 会话 / 消息 / 状态
269
+ ├── dimcode.sqlite-wal
270
+ ├── dimcode.sqlite-shm
271
+ ├── data/ blob 数据
272
+ └── logs/ 诊断日志
273
+ ```
274
+
275
+ **Q: 如何删除单个会话?**
276
+
277
+ ```bash
278
+ dim session list # 找到要删的 id
279
+ dim session rm <id>
280
+ ```
281
+
282
+ **Q: 如何清空所有历史会话?**
283
+
284
+ 最稳的做法是删 SQLite 数据库文件(保留 `config.json`、`providers.json` 等配置):
285
+
286
+ ```bash
287
+ rm -f ~/.dimcode/v2/dimcode.sqlite \
288
+ ~/.dimcode/v2/dimcode.sqlite-wal \
289
+ ~/.dimcode/v2/dimcode.sqlite-shm
290
+ ```
291
+
292
+ 如果想彻底重置(含配置、登录态、MCP 列表),删整个 v2 目录:
293
+
294
+ ```bash
295
+ rm -rf ~/.dimcode/v2
296
+ ```
297
+
298
+ > 注意:`~/.dimcode/` 下的其它目录(`sessions/`、`dimcode/` 等)是早期版本残留,对 v2 没有作用。
299
+
300
+ ---
301
+
302
+ ## License
303
+
304
+ 见仓库根目录 LICENSE 文件。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dimcode",
3
- "version": "0.2.8-beta.1",
3
+ "version": "0.2.8",
4
4
  "description": "AI coding agent CLI and terminal coding assistant with an interactive TUI (beta channel)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,13 +8,14 @@
8
8
  "dimcode": "./bin/dim.mjs"
9
9
  },
10
10
  "files": [
11
- "bin"
11
+ "bin",
12
+ "README.zh.md"
12
13
  ],
13
14
  "optionalDependencies": {
14
- "dimcode-darwin-arm64": "0.2.8-beta.1",
15
- "dimcode-darwin-x64": "0.2.8-beta.1",
16
- "dimcode-linux-arm64": "0.2.8-beta.1",
17
- "dimcode-linux-x64": "0.2.8-beta.1",
18
- "dimcode-windows-x64": "0.2.8-beta.1"
15
+ "dimcode-darwin-arm64": "0.2.8",
16
+ "dimcode-darwin-x64": "0.2.8",
17
+ "dimcode-linux-arm64": "0.2.8",
18
+ "dimcode-linux-x64": "0.2.8",
19
+ "dimcode-windows-x64": "0.2.8"
19
20
  }
20
21
  }