deepv-code 1.0.182
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.
- package/LICENSE +202 -0
- package/README.md +3 -0
- package/bundle/assets/help/README.md +113 -0
- package/bundle/assets/help/cli-help-knowledge.md +1382 -0
- package/bundle/assets/sounds/README.md +74 -0
- package/bundle/assets/sounds/confirmation-required.wav +0 -0
- package/bundle/assets/sounds/response-complete.wav +0 -0
- package/bundle/assets/sounds/selection-made.wav +0 -0
- package/bundle/dvcode.js +4442 -0
- package/bundle/fix-binary-permissions.js +215 -0
- package/bundle/login/templates/authSelectPage.html +870 -0
- package/bundle/login/templates/deepv.ico +0 -0
- package/bundle/login/templates/feishu.ico +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/darwin-arm64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/darwin-x64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/linux-arm-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/linux-arm64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/linux-x64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/win32-arm64-rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/win32-ia32-rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/win32-x64-rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/download.js +357 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/index.d.ts +1 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/index.js +42 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/postinstall.js +121 -0
- package/bundle/node_modules/@vscode/ripgrep/package.json +24 -0
- package/bundle/node_modules/undici/LICENSE +21 -0
- package/bundle/node_modules/undici/README.md +472 -0
- package/bundle/node_modules/undici/docs/docs/api/Agent.md +83 -0
- package/bundle/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/bundle/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/bundle/node_modules/undici/docs/docs/api/CacheStore.md +151 -0
- package/bundle/node_modules/undici/docs/docs/api/Client.md +281 -0
- package/bundle/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/bundle/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/bundle/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/bundle/node_modules/undici/docs/docs/api/Cookies.md +101 -0
- package/bundle/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/bundle/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +204 -0
- package/bundle/node_modules/undici/docs/docs/api/Dispatcher.md +1200 -0
- package/bundle/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/bundle/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/bundle/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/bundle/node_modules/undici/docs/docs/api/Fetch.md +52 -0
- package/bundle/node_modules/undici/docs/docs/api/H2CClient.md +262 -0
- package/bundle/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/bundle/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/bundle/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/bundle/node_modules/undici/docs/docs/api/MockClient.md +77 -0
- package/bundle/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/bundle/node_modules/undici/docs/docs/api/MockPool.md +548 -0
- package/bundle/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/bundle/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/bundle/node_modules/undici/docs/docs/api/ProxyAgent.md +227 -0
- package/bundle/node_modules/undici/docs/docs/api/RedirectHandler.md +96 -0
- package/bundle/node_modules/undici/docs/docs/api/RetryAgent.md +45 -0
- package/bundle/node_modules/undici/docs/docs/api/RetryHandler.md +117 -0
- package/bundle/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/bundle/node_modules/undici/docs/docs/api/WebSocket.md +85 -0
- package/bundle/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/writing-tests.md +20 -0
- package/bundle/node_modules/undici/index-fetch.js +35 -0
- package/bundle/node_modules/undici/index.d.ts +3 -0
- package/bundle/node_modules/undici/index.js +183 -0
- package/bundle/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/bundle/node_modules/undici/lib/api/api-connect.js +110 -0
- package/bundle/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/bundle/node_modules/undici/lib/api/api-request.js +199 -0
- package/bundle/node_modules/undici/lib/api/api-stream.js +209 -0
- package/bundle/node_modules/undici/lib/api/api-upgrade.js +110 -0
- package/bundle/node_modules/undici/lib/api/index.js +7 -0
- package/bundle/node_modules/undici/lib/api/readable.js +558 -0
- package/bundle/node_modules/undici/lib/api/util.js +95 -0
- package/bundle/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
- package/bundle/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
- package/bundle/node_modules/undici/lib/core/connect.js +164 -0
- package/bundle/node_modules/undici/lib/core/constants.js +143 -0
- package/bundle/node_modules/undici/lib/core/diagnostics.js +196 -0
- package/bundle/node_modules/undici/lib/core/errors.js +244 -0
- package/bundle/node_modules/undici/lib/core/request.js +397 -0
- package/bundle/node_modules/undici/lib/core/symbols.js +68 -0
- package/bundle/node_modules/undici/lib/core/tree.js +160 -0
- package/bundle/node_modules/undici/lib/core/util.js +988 -0
- package/bundle/node_modules/undici/lib/dispatcher/agent.js +135 -0
- package/bundle/node_modules/undici/lib/dispatcher/balanced-pool.js +206 -0
- package/bundle/node_modules/undici/lib/dispatcher/client-h1.js +1615 -0
- package/bundle/node_modules/undici/lib/dispatcher/client-h2.js +798 -0
- package/bundle/node_modules/undici/lib/dispatcher/client.js +614 -0
- package/bundle/node_modules/undici/lib/dispatcher/dispatcher-base.js +161 -0
- package/bundle/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/bundle/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +151 -0
- package/bundle/node_modules/undici/lib/dispatcher/fixed-queue.js +159 -0
- package/bundle/node_modules/undici/lib/dispatcher/h2c-client.js +122 -0
- package/bundle/node_modules/undici/lib/dispatcher/pool-base.js +191 -0
- package/bundle/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/bundle/node_modules/undici/lib/dispatcher/proxy-agent.js +275 -0
- package/bundle/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/bundle/node_modules/undici/lib/global.js +32 -0
- package/bundle/node_modules/undici/lib/handler/cache-handler.js +448 -0
- package/bundle/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/bundle/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/bundle/node_modules/undici/lib/handler/redirect-handler.js +227 -0
- package/bundle/node_modules/undici/lib/handler/retry-handler.js +342 -0
- package/bundle/node_modules/undici/lib/handler/unwrap-handler.js +96 -0
- package/bundle/node_modules/undici/lib/handler/wrap-handler.js +95 -0
- package/bundle/node_modules/undici/lib/interceptor/cache.js +372 -0
- package/bundle/node_modules/undici/lib/interceptor/dns.js +432 -0
- package/bundle/node_modules/undici/lib/interceptor/dump.js +111 -0
- package/bundle/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/bundle/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/bundle/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/bundle/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/bundle/node_modules/undici/lib/llhttp/constants.d.ts +97 -0
- package/bundle/node_modules/undici/lib/llhttp/constants.js +498 -0
- package/bundle/node_modules/undici/lib/llhttp/constants.js.map +1 -0
- package/bundle/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/bundle/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/bundle/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/bundle/node_modules/undici/lib/llhttp/utils.js +15 -0
- package/bundle/node_modules/undici/lib/llhttp/utils.js.map +1 -0
- package/bundle/node_modules/undici/lib/mock/mock-agent.js +224 -0
- package/bundle/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/bundle/node_modules/undici/lib/mock/mock-client.js +64 -0
- package/bundle/node_modules/undici/lib/mock/mock-errors.js +19 -0
- package/bundle/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/bundle/node_modules/undici/lib/mock/mock-pool.js +64 -0
- package/bundle/node_modules/undici/lib/mock/mock-symbols.js +31 -0
- package/bundle/node_modules/undici/lib/mock/mock-utils.js +433 -0
- package/bundle/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/bundle/node_modules/undici/lib/util/cache.js +368 -0
- package/bundle/node_modules/undici/lib/util/date.js +259 -0
- package/bundle/node_modules/undici/lib/util/stats.js +32 -0
- package/bundle/node_modules/undici/lib/util/timers.js +423 -0
- package/bundle/node_modules/undici/lib/web/cache/cache.js +862 -0
- package/bundle/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/bundle/node_modules/undici/lib/web/cache/util.js +45 -0
- package/bundle/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/bundle/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/bundle/node_modules/undici/lib/web/cookies/parse.js +322 -0
- package/bundle/node_modules/undici/lib/web/cookies/util.js +282 -0
- package/bundle/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
- package/bundle/node_modules/undici/lib/web/eventsource/eventsource.js +484 -0
- package/bundle/node_modules/undici/lib/web/eventsource/util.js +37 -0
- package/bundle/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/bundle/node_modules/undici/lib/web/fetch/body.js +532 -0
- package/bundle/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/bundle/node_modules/undici/lib/web/fetch/data-url.js +744 -0
- package/bundle/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
- package/bundle/node_modules/undici/lib/web/fetch/formdata-parser.js +501 -0
- package/bundle/node_modules/undici/lib/web/fetch/formdata.js +263 -0
- package/bundle/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/bundle/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/bundle/node_modules/undici/lib/web/fetch/index.js +2258 -0
- package/bundle/node_modules/undici/lib/web/fetch/request.js +1099 -0
- package/bundle/node_modules/undici/lib/web/fetch/response.js +636 -0
- package/bundle/node_modules/undici/lib/web/fetch/util.js +1782 -0
- package/bundle/node_modules/undici/lib/web/fetch/webidl.js +740 -0
- package/bundle/node_modules/undici/lib/web/websocket/connection.js +325 -0
- package/bundle/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/bundle/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/bundle/node_modules/undici/lib/web/websocket/frame.js +138 -0
- package/bundle/node_modules/undici/lib/web/websocket/permessage-deflate.js +70 -0
- package/bundle/node_modules/undici/lib/web/websocket/receiver.js +454 -0
- package/bundle/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/bundle/node_modules/undici/lib/web/websocket/stream/websocketerror.js +83 -0
- package/bundle/node_modules/undici/lib/web/websocket/stream/websocketstream.js +485 -0
- package/bundle/node_modules/undici/lib/web/websocket/util.js +338 -0
- package/bundle/node_modules/undici/lib/web/websocket/websocket.js +686 -0
- package/bundle/node_modules/undici/package.json +149 -0
- package/bundle/node_modules/undici/scripts/strip-comments.js +10 -0
- package/bundle/node_modules/undici/types/README.md +6 -0
- package/bundle/node_modules/undici/types/agent.d.ts +35 -0
- package/bundle/node_modules/undici/types/api.d.ts +43 -0
- package/bundle/node_modules/undici/types/balanced-pool.d.ts +29 -0
- package/bundle/node_modules/undici/types/cache-interceptor.d.ts +172 -0
- package/bundle/node_modules/undici/types/cache.d.ts +36 -0
- package/bundle/node_modules/undici/types/client-stats.d.ts +15 -0
- package/bundle/node_modules/undici/types/client.d.ts +110 -0
- package/bundle/node_modules/undici/types/connector.d.ts +34 -0
- package/bundle/node_modules/undici/types/content-type.d.ts +21 -0
- package/bundle/node_modules/undici/types/cookies.d.ts +30 -0
- package/bundle/node_modules/undici/types/diagnostics-channel.d.ts +66 -0
- package/bundle/node_modules/undici/types/dispatcher.d.ts +281 -0
- package/bundle/node_modules/undici/types/env-http-proxy-agent.d.ts +21 -0
- package/bundle/node_modules/undici/types/errors.d.ts +171 -0
- package/bundle/node_modules/undici/types/eventsource.d.ts +61 -0
- package/bundle/node_modules/undici/types/fetch.d.ts +210 -0
- package/bundle/node_modules/undici/types/formdata.d.ts +108 -0
- package/bundle/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/bundle/node_modules/undici/types/global-origin.d.ts +7 -0
- package/bundle/node_modules/undici/types/h2c-client.d.ts +75 -0
- package/bundle/node_modules/undici/types/handlers.d.ts +15 -0
- package/bundle/node_modules/undici/types/header.d.ts +160 -0
- package/bundle/node_modules/undici/types/index.d.ts +75 -0
- package/bundle/node_modules/undici/types/interceptors.d.ts +34 -0
- package/bundle/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/bundle/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/bundle/node_modules/undici/types/mock-client.d.ts +25 -0
- package/bundle/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/bundle/node_modules/undici/types/mock-interceptor.d.ts +93 -0
- package/bundle/node_modules/undici/types/mock-pool.d.ts +25 -0
- package/bundle/node_modules/undici/types/patch.d.ts +29 -0
- package/bundle/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/bundle/node_modules/undici/types/pool.d.ts +41 -0
- package/bundle/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/bundle/node_modules/undici/types/readable.d.ts +68 -0
- package/bundle/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/bundle/node_modules/undici/types/retry-handler.d.ts +116 -0
- package/bundle/node_modules/undici/types/util.d.ts +18 -0
- package/bundle/node_modules/undici/types/utility.d.ts +7 -0
- package/bundle/node_modules/undici/types/webidl.d.ts +266 -0
- package/bundle/node_modules/undici/types/websocket.d.ts +184 -0
- package/bundle/sandbox-macos-permissive-closed.sb +26 -0
- package/bundle/sandbox-macos-permissive-open.sb +19 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +31 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +87 -0
- package/bundle/sandbox-macos-restrictive-open.sb +90 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +92 -0
- package/package.json +137 -0
|
@@ -0,0 +1,1382 @@
|
|
|
1
|
+
# DeepV Code CLI 帮助知识库
|
|
2
|
+
|
|
3
|
+
> 本知识库包含 DeepV Code CLI 的所有命令和功能详细说明,供智能帮助系统使用。
|
|
4
|
+
|
|
5
|
+
## 📌 常见问题快速索引
|
|
6
|
+
|
|
7
|
+
### Q1: 如何切换 AI 模型?
|
|
8
|
+
**A:** 使用 `/model` 命令进行交互式切换:
|
|
9
|
+
1. 输入 `/model` 后按空格
|
|
10
|
+
2. 会显示可用模型列表
|
|
11
|
+
3. 使用方向键选择目标模型
|
|
12
|
+
4. 按回车确认切换,或者直接输入可用的模型名称后按回车
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### Q2: 如何回滚到某个代码检查点?
|
|
19
|
+
**A:** 使用 `/restore` 命令:
|
|
20
|
+
1. 直接输入 `/restore` 后按空格,你可以用方向键查看所有可恢复的检查点
|
|
21
|
+
2. 输入 `/restore <检查点ID>` 回滚到指定检查点(在创建检查点时屏幕上会显示)
|
|
22
|
+
**用途:**
|
|
23
|
+
- 撤销文件编辑、回滚代码变更
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### Q3: 如何保存和恢复会话?
|
|
30
|
+
**A:** 使用 `/session` 命令的子命令:
|
|
31
|
+
- **恢复会话:** `/chat select <ID>`
|
|
32
|
+
- 示例:`/chat select 1`
|
|
33
|
+
- **查看所有会话详情:** `/session list`
|
|
34
|
+
- **新建干净的会话:** `/session new`
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### Q4: 如何升级 DeepV Code CLI?
|
|
40
|
+
**A:** 使用 `dvcode -u` 命令进行升级。
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Q5: 如何让 CLI 感知 VS Code 中打开的文件或选中的代码?
|
|
46
|
+
**A:** DeepV Code CLI 可以通过 VS Code 扩展与编辑器进行深度集成。
|
|
47
|
+
1. **安装扩展:** 在 VS Code 扩展市场搜索并安装 `DeepV Code Companion` 扩展。
|
|
48
|
+
2. **启动 CLI:** 在 VS Code 的内置终端中启动 DeepV Code CLI。
|
|
49
|
+
3. **确认连接:** 当 CLI 成功启动后,你会在 VS Code 右下角看到一个绿色的指示器,显示 `IDE 已连接`。这表示 CLI 已成功与 VS Code 建立连接,可以感知你打开的文件和选中的代码。
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Q6: 如何添加自定义斜杠命令?
|
|
55
|
+
**A:** 创建 TOML 格式的命令定义文件:
|
|
56
|
+
|
|
57
|
+
**位置选择:**
|
|
58
|
+
- 全局命令:`~/.deepv/commands/`(所有项目可用)
|
|
59
|
+
- 项目命令:`<项目根目录>/.deepvcode/commands/`(仅当前项目)
|
|
60
|
+
|
|
61
|
+
**文件格式示例:**
|
|
62
|
+
```toml
|
|
63
|
+
# 文件:~/.deepv/commands/git/commit.toml
|
|
64
|
+
# 命令名:/git:commit
|
|
65
|
+
|
|
66
|
+
description = "生成符合规范的 git commit 消息"
|
|
67
|
+
prompt = """
|
|
68
|
+
请分析当前的 git staged 变更,生成一条符合 Conventional Commits 规范的 commit 消息。
|
|
69
|
+
|
|
70
|
+
格式要求:
|
|
71
|
+
- type(scope): subject
|
|
72
|
+
- type 可以是:feat、fix、docs、style、refactor、test、chore
|
|
73
|
+
- subject 简洁明确,不超过 50 字符
|
|
74
|
+
"""
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**使用参数:**
|
|
78
|
+
```toml
|
|
79
|
+
prompt = "请重构以下代码为纯函数:{{args}}"
|
|
80
|
+
```
|
|
81
|
+
调用:`/refactor:pure some code here`
|
|
82
|
+
|
|
83
|
+
**相关文档:** 查看 `docs/cli/commands.md` 的 "Custom Commands" 章节
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### Q7: 如何配置 MCP 服务器?
|
|
88
|
+
**A:** 在 `settings.json` 中配置 `mcpServers` 字段:
|
|
89
|
+
|
|
90
|
+
**位置选择:**
|
|
91
|
+
- 全局命令:`~/.deepv/`(所有项目可用)
|
|
92
|
+
- 项目命令:`<项目根目录>/.deepv/`(仅当前项目)
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"myPythonServer": {
|
|
98
|
+
"command": "python",
|
|
99
|
+
"args": ["mcp_server.py", "--port", "8080"],
|
|
100
|
+
"cwd": "./mcp_tools/python",
|
|
101
|
+
"timeout": 5000,
|
|
102
|
+
"includeTools": ["safe_tool", "file_reader"]
|
|
103
|
+
},
|
|
104
|
+
"myNodeServer": {
|
|
105
|
+
"command": "node",
|
|
106
|
+
"args": ["mcp_server.js"],
|
|
107
|
+
"excludeTools": ["dangerous_tool"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**字段说明:**
|
|
114
|
+
- `command`(必需):启动服务器的命令
|
|
115
|
+
- `args`(可选):命令参数数组
|
|
116
|
+
- `env`(可选):环境变量对象
|
|
117
|
+
- `cwd`(可选):工作目录
|
|
118
|
+
- `timeout`(可选):请求超时(毫秒)
|
|
119
|
+
- `trust`(可选):信任服务器,跳过确认
|
|
120
|
+
- `includeTools`(可选):白名单,仅启用指定工具
|
|
121
|
+
- `excludeTools`(可选):黑名单,排除指定工具
|
|
122
|
+
|
|
123
|
+
**查看 MCP 状态:** `/mcp` 或 `/mcp desc`
|
|
124
|
+
|
|
125
|
+
**快捷键:** `Ctrl+T` 切换工具描述显示
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Q8: 如何切换主题?
|
|
130
|
+
**A:** 使用 `/theme` 命令:
|
|
131
|
+
1. 输入 `/theme` 打开主题选择对话框
|
|
132
|
+
2. 浏览可用主题
|
|
133
|
+
3. 选择并应用
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Q9: 有没有在 VSCode 中使用的图形化界面版/扩展/插件/GUI 版?
|
|
138
|
+
**A:** 是的,DeepV Code 也支持 VSCode 扩展!
|
|
139
|
+
你可以在 VSCode 扩展市场中搜索 **DeepV Code for VSCode** 在线安装,即可在 VSCode 中使用图形化界面版本。
|
|
140
|
+
|
|
141
|
+
**安装方式:**
|
|
142
|
+
1. 打开 VSCode
|
|
143
|
+
2. 进入扩展市场(快捷键:`Ctrl+Shift+X` 或 `Cmd+Shift+X`)
|
|
144
|
+
3. 搜索 `DeepV Code for VSCode`
|
|
145
|
+
4. 点击安装
|
|
146
|
+
|
|
147
|
+
**特点:**
|
|
148
|
+
- 图形化界面操作,更直观便捷
|
|
149
|
+
- 与 VSCode 深度集成
|
|
150
|
+
- 支持文件感知、代码选中等 IDE 功能
|
|
151
|
+
- 与 CLI 版本功能互补,可根据需求选择使用
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 📖 斜杠命令完整列表 (Slash Commands `/`)
|
|
156
|
+
1. 输入斜杠则可以看到所有支持的斜杠命令
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### `/clear` - 清空屏幕
|
|
162
|
+
清空终端显示,包括可见的会话历史和滚动缓冲区。
|
|
163
|
+
|
|
164
|
+
**用法:** `/clear`
|
|
165
|
+
|
|
166
|
+
**快捷键:** `Ctrl+L`
|
|
167
|
+
|
|
168
|
+
**注意:** 上下文数据会保留,仅清除视觉显示。
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### `/compress` - 压缩上下文
|
|
173
|
+
用摘要替换整个聊天上下文,节省 token 用量。
|
|
174
|
+
当上下文不足 20% 时,CLI也会自动执行压缩。
|
|
175
|
+
|
|
176
|
+
**用法:** `/compress`
|
|
177
|
+
|
|
178
|
+
**作用:**
|
|
179
|
+
- 保留高层次摘要
|
|
180
|
+
- 大幅减少 token 消耗
|
|
181
|
+
- 适用于长时间会话
|
|
182
|
+
|
|
183
|
+
**注意:** 会丢失详细的历史记录,不可逆操作。
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### `/copy` - 复制最后输出
|
|
188
|
+
将 AI 的最后一条输出复制到剪贴板。
|
|
189
|
+
|
|
190
|
+
**用法:** `/copy`
|
|
191
|
+
|
|
192
|
+
**使用场景:**
|
|
193
|
+
- 快速复制生成的代码
|
|
194
|
+
- 分享 AI 的回答
|
|
195
|
+
- 保存重要输出
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### `/editor` - 选择编辑器
|
|
200
|
+
打开编辑器选择对话框,用于查看 diff。
|
|
201
|
+
|
|
202
|
+
**用法:** `/editor`
|
|
203
|
+
|
|
204
|
+
**支持的编辑器:**
|
|
205
|
+
- VSCode
|
|
206
|
+
- Sublime Text
|
|
207
|
+
- Vim
|
|
208
|
+
- 其他...
|
|
209
|
+
|
|
210
|
+
**配置:** 在 `settings.json` 中设置 `preferredEditor`
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### `/help` 或 `/?` - 显示帮助
|
|
215
|
+
显示传统的命令列表帮助对话框。
|
|
216
|
+
|
|
217
|
+
**用法:** `/help` 或 `/?`
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### `/help-ask` - AI 智能帮助助手
|
|
222
|
+
**(你现在正在使用的功能!)**
|
|
223
|
+
|
|
224
|
+
启动 AI 智能帮助系统,可以询问任何关于 CLI 功能的问题。
|
|
225
|
+
|
|
226
|
+
**用法:** `/help-ask`
|
|
227
|
+
|
|
228
|
+
**特点:**
|
|
229
|
+
- 基于完整的 CLI 知识库回答问题
|
|
230
|
+
- 使用 Auto 模型(会消耗 token)
|
|
231
|
+
- 支持中英文问答
|
|
232
|
+
- 按 Esc 键退出帮助模式
|
|
233
|
+
|
|
234
|
+
**退出帮助:** 按 `Esc` 键
|
|
235
|
+
|
|
236
|
+
**注意:** 此功能会消耗 API token,如果只想查看命令列表,请使用 `/help`
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### `/init` - 初始化项目上下文
|
|
241
|
+
自动分析项目并生成 `DEEPV.md` 文件,提供项目上下文。
|
|
242
|
+
|
|
243
|
+
**用法:** `/init`
|
|
244
|
+
|
|
245
|
+
**功能:**
|
|
246
|
+
1. 分析项目结构
|
|
247
|
+
2. 识别项目类型(代码项目 vs 非代码项目)
|
|
248
|
+
3. 生成包含以下内容的 `DEEPV.md`:
|
|
249
|
+
- 项目概述
|
|
250
|
+
- 主要技术栈
|
|
251
|
+
- 构建/运行命令
|
|
252
|
+
- 开发规范
|
|
253
|
+
- 特殊配置
|
|
254
|
+
|
|
255
|
+
**注意:** 如果 `DEEPV.md` 已存在,此命令则无法执行。
|
|
256
|
+
|
|
257
|
+
**相关:** `/memory refresh`
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### `/mcp` - MCP 服务器管理
|
|
262
|
+
列出配置的 Model Context Protocol (MCP) 服务器及其工具。
|
|
263
|
+
|
|
264
|
+
**用法:** `/mcp [子命令]`
|
|
265
|
+
|
|
266
|
+
**子命令:**
|
|
267
|
+
- `desc` / `descriptions`:显示详细的工具描述
|
|
268
|
+
- `nodesc` / `nodescriptions`:隐藏工具描述,仅显示名称
|
|
269
|
+
- `schema`:显示工具参数的完整 JSON schema
|
|
270
|
+
|
|
271
|
+
**快捷键:** `Ctrl+T` - 切换工具描述显示
|
|
272
|
+
|
|
273
|
+
**配置:** 参见 Q5 或 `docs/cli/configuration.md`
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
### `/memory` - 记忆管理
|
|
278
|
+
管理 AI 的指令上下文(从 `DEEPV.md` 文件加载)。
|
|
279
|
+
|
|
280
|
+
**子命令:**
|
|
281
|
+
- `add <text>` - 添加文本到 AI 记忆
|
|
282
|
+
- `show` - 显示当前加载的完整分层记忆
|
|
283
|
+
- `refresh` - 重新加载所有 `DEEPV.md` 文件
|
|
284
|
+
|
|
285
|
+
**用法示例:**
|
|
286
|
+
```
|
|
287
|
+
/memory add 使用 TypeScript strict 模式
|
|
288
|
+
/memory show
|
|
289
|
+
/memory refresh
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**记忆文件层次(优先级递增):**
|
|
293
|
+
1. 全局:`~/.deepv/DEEPV.md`
|
|
294
|
+
2. 项目根及父目录:`<项目路径>/DEEPV.md`
|
|
295
|
+
3. 子目录:项目内各子目录的 `DEEPV.md`
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### `/model` - 切换模型
|
|
302
|
+
交互式选择 AI 模型。
|
|
303
|
+
|
|
304
|
+
**用法:** `/model [模型名]`
|
|
305
|
+
|
|
306
|
+
**交互式:**
|
|
307
|
+
1. 输入 `/model` 后按空格
|
|
308
|
+
2. 显示可用模型列表
|
|
309
|
+
3. 方向键选择
|
|
310
|
+
4. 回车确认
|
|
311
|
+
|
|
312
|
+
**直接指定:** `/model Claude-Sonnet-4.5`
|
|
313
|
+
|
|
314
|
+
**查看统计:** `/stats model`
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
### `/quit` 或 `/exit` - 退出 CLI
|
|
319
|
+
退出 DeepV Code CLI。
|
|
320
|
+
|
|
321
|
+
**用法:** `/quit` 或 `/exit`
|
|
322
|
+
|
|
323
|
+
**注意:** 未保存的会话状态将丢失
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
### `/restore` - 恢复检查点
|
|
328
|
+
将项目文件恢复到某个工具执行前的状态。
|
|
329
|
+
|
|
330
|
+
**用法:** `/restore [checkpoint_id]`
|
|
331
|
+
|
|
332
|
+
**无参数:** 列出所有可用的检查点
|
|
333
|
+
|
|
334
|
+
**指定 ID:** 恢复到指定检查点
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
**用途:**
|
|
338
|
+
- 撤销文件编辑
|
|
339
|
+
- 回滚代码变更
|
|
340
|
+
- 恢复删除的文件
|
|
341
|
+
|
|
342
|
+
**相关文档:** `docs/checkpointing.md`
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
### `/stats` - 统计信息
|
|
347
|
+
显示当前会话的详细统计信息。
|
|
348
|
+
|
|
349
|
+
**用法:** `/stats [子命令]`
|
|
350
|
+
|
|
351
|
+
**子命令:**
|
|
352
|
+
- 无参数:显示总体统计(token 用量、缓存节省、会话时长)
|
|
353
|
+
- `model [模型名]`:显示模型统计(支持 Tab 补全)
|
|
354
|
+
- `tools`:显示工具使用统计
|
|
355
|
+
|
|
356
|
+
**示例:**
|
|
357
|
+
```
|
|
358
|
+
/stats
|
|
359
|
+
/stats model gemini-2.0-flash-exp
|
|
360
|
+
/stats tools
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**注意:** 缓存 token 信息仅在使用 API key 认证时显示。
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
### `/theme` - 切换主题
|
|
368
|
+
打开主题选择对话框。
|
|
369
|
+
|
|
370
|
+
**用法:** `/theme`
|
|
371
|
+
|
|
372
|
+
**配置:**
|
|
373
|
+
```json
|
|
374
|
+
{
|
|
375
|
+
"theme": "GitHub"
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**自定义主题:**
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"customThemes": {
|
|
383
|
+
"MyTheme": {
|
|
384
|
+
"primary": "#00FF00",
|
|
385
|
+
"background": "#000000"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**相关文档:** `docs/cli/themes.md`
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
### `/auth` - 认证设置
|
|
396
|
+
打开认证对话框,用于重新登录认证。
|
|
397
|
+
|
|
398
|
+
**用法:** `/auth`
|
|
399
|
+
|
|
400
|
+
**支持的认证方式:**
|
|
401
|
+
- 根据您所在的组织会有不同的认证支持,具体看界面引导即可。
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
### `/tools` - 工具列表
|
|
406
|
+
显示当前可用的所有工具(内置 + MCP)。
|
|
407
|
+
|
|
408
|
+
**用法:** `/tools [子命令]`
|
|
409
|
+
|
|
410
|
+
**子命令:**
|
|
411
|
+
- 默认:显示工具名称和描述
|
|
412
|
+
- `nodesc` / `nodescriptions`:仅显示工具名称
|
|
413
|
+
- `desc` / `descriptions`:显示详细描述(旧版,现为默认)
|
|
414
|
+
|
|
415
|
+
**示例:**
|
|
416
|
+
```
|
|
417
|
+
/tools
|
|
418
|
+
/tools nodesc
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**相关:** `/mcp`、`/mcp schema`
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
### `/vim` - Vim 模式
|
|
426
|
+
切换 vim 模式。
|
|
427
|
+
|
|
428
|
+
**用法:** `/vim`
|
|
429
|
+
|
|
430
|
+
**功能:**
|
|
431
|
+
- **NORMAL 模式:** `h`、`j`、`k`、`l` 导航;`w`、`b`、`e` 跳词;`0`、`# DeepV Code CLI 帮助知识库
|
|
432
|
+
|
|
433
|
+
> 本知识库包含 DeepV Code CLI 的所有命令和功能详细说明,供智能帮助系统使用。
|
|
434
|
+
|
|
435
|
+
## 📌 常见问题快速索引
|
|
436
|
+
|
|
437
|
+
### Q1: 如何切换 AI 模型?
|
|
438
|
+
**A:** 使用 `/model` 命令进行交互式切换:
|
|
439
|
+
1. 输入 `/model` 后按空格
|
|
440
|
+
2. 会显示可用模型列表
|
|
441
|
+
3. 使用方向键选择目标模型
|
|
442
|
+
4. 按回车确认切换,或者直接输入可用的模型名称后按回车
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
### Q2: 如何回滚到某个代码检查点?
|
|
449
|
+
**A:** 使用 `/restore` 命令:
|
|
450
|
+
1. 直接输入 `/restore` 后按空格,你可以用方向键查看所有可恢复的检查点
|
|
451
|
+
2. 输入 `/restore <检查点ID>` 回滚到指定检查点(在创建检查点时屏幕上会显示)
|
|
452
|
+
**用途:**
|
|
453
|
+
- 撤销文件编辑、回滚代码变更
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
### Q3: 如何保存和恢复会话?
|
|
460
|
+
**A:** 使用 `/session` 命令的子命令:
|
|
461
|
+
- **恢复会话:** `/chat select <ID>`
|
|
462
|
+
- 示例:`/chat select 1`
|
|
463
|
+
- **查看所有会话详情:** `/session list`
|
|
464
|
+
- **新建干净的会话:** `/session new`
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
### Q4: 如何升级 DeepV Code CLI?
|
|
470
|
+
**A:** 使用 `dvcode -u` 命令进行升级。
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
### Q5: 如何让 CLI 感知 VS Code 中打开的文件或选中的代码?
|
|
476
|
+
**A:** DeepV Code CLI 可以通过 VS Code 扩展与编辑器进行深度集成。
|
|
477
|
+
1. **安装扩展:** 在 VS Code 扩展市场搜索并安装 `DeepV Code Companion` 扩展。
|
|
478
|
+
2. **启动 CLI:** 在 VS Code 的内置终端中启动 DeepV Code CLI。
|
|
479
|
+
3. **确认连接:** 当 CLI 成功启动后,你会在 VS Code 右下角看到一个绿色的指示器,显示 `IDE 已连接`。这表示 CLI 已成功与 VS Code 建立连接,可以感知你打开的文件和选中的代码。
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
### Q6: 如何添加自定义斜杠命令?
|
|
485
|
+
**A:** 创建 TOML 格式的命令定义文件:
|
|
486
|
+
|
|
487
|
+
**位置选择:**
|
|
488
|
+
- 全局命令:`~/.deepv/commands/`(所有项目可用)
|
|
489
|
+
- 项目命令:`<项目根目录>/.deepvcode/commands/`(仅当前项目)
|
|
490
|
+
|
|
491
|
+
**文件格式示例:**
|
|
492
|
+
```toml
|
|
493
|
+
# 文件:~/.deepv/commands/git/commit.toml
|
|
494
|
+
# 命令名:/git:commit
|
|
495
|
+
|
|
496
|
+
description = "生成符合规范的 git commit 消息"
|
|
497
|
+
prompt = """
|
|
498
|
+
请分析当前的 git staged 变更,生成一条符合 Conventional Commits 规范的 commit 消息。
|
|
499
|
+
|
|
500
|
+
格式要求:
|
|
501
|
+
- type(scope): subject
|
|
502
|
+
- type 可以是:feat、fix、docs、style、refactor、test、chore
|
|
503
|
+
- subject 简洁明确,不超过 50 字符
|
|
504
|
+
"""
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
**使用参数:**
|
|
508
|
+
```toml
|
|
509
|
+
prompt = "请重构以下代码为纯函数:{{args}}"
|
|
510
|
+
```
|
|
511
|
+
调用:`/refactor:pure some code here`
|
|
512
|
+
|
|
513
|
+
**相关文档:** 查看 `docs/cli/commands.md` 的 "Custom Commands" 章节
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
### Q7: 如何配置 MCP 服务器?
|
|
518
|
+
**A:** 在 `settings.json` 中配置 `mcpServers` 字段:
|
|
519
|
+
|
|
520
|
+
**位置选择:**
|
|
521
|
+
- 全局命令:`~/.deepv/`(所有项目可用)
|
|
522
|
+
- 项目命令:`<项目根目录>/.deepv/`(仅当前项目)
|
|
523
|
+
|
|
524
|
+
```json
|
|
525
|
+
{
|
|
526
|
+
"mcpServers": {
|
|
527
|
+
"myPythonServer": {
|
|
528
|
+
"command": "python",
|
|
529
|
+
"args": ["mcp_server.py", "--port", "8080"],
|
|
530
|
+
"cwd": "./mcp_tools/python",
|
|
531
|
+
"timeout": 5000,
|
|
532
|
+
"includeTools": ["safe_tool", "file_reader"]
|
|
533
|
+
},
|
|
534
|
+
"myNodeServer": {
|
|
535
|
+
"command": "node",
|
|
536
|
+
"args": ["mcp_server.js"],
|
|
537
|
+
"excludeTools": ["dangerous_tool"]
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
**字段说明:**
|
|
544
|
+
- `command`(必需):启动服务器的命令
|
|
545
|
+
- `args`(可选):命令参数数组
|
|
546
|
+
- `env`(可选):环境变量对象
|
|
547
|
+
- `cwd`(可选):工作目录
|
|
548
|
+
- `timeout`(可选):请求超时(毫秒)
|
|
549
|
+
- `trust`(可选):信任服务器,跳过确认
|
|
550
|
+
- `includeTools`(可选):白名单,仅启用指定工具
|
|
551
|
+
- `excludeTools`(可选):黑名单,排除指定工具
|
|
552
|
+
|
|
553
|
+
**查看 MCP 状态:** `/mcp` 或 `/mcp desc`
|
|
554
|
+
|
|
555
|
+
**快捷键:** `Ctrl+T` 切换工具描述显示
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
### Q8: 如何切换主题?
|
|
560
|
+
**A:** 使用 `/theme` 命令:
|
|
561
|
+
1. 输入 `/theme` 打开主题选择对话框
|
|
562
|
+
2. 浏览可用主题
|
|
563
|
+
3. 选择并应用
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
### Q9: 有没有在 VSCode 中使用的图形化界面版/扩展/插件/GUI 版?
|
|
568
|
+
**A:** 是的,DeepV Code 也支持 VSCode 扩展!
|
|
569
|
+
你可以在 VSCode 扩展市场中搜索 **DeepV Code for VSCode** 在线安装,即可在 VSCode 中使用图形化界面版本。
|
|
570
|
+
|
|
571
|
+
**安装方式:**
|
|
572
|
+
1. 打开 VSCode
|
|
573
|
+
2. 进入扩展市场(快捷键:`Ctrl+Shift+X` 或 `Cmd+Shift+X`)
|
|
574
|
+
3. 搜索 `DeepV Code for VSCode`
|
|
575
|
+
4. 点击安装
|
|
576
|
+
|
|
577
|
+
**特点:**
|
|
578
|
+
- 图形化界面操作,更直观便捷
|
|
579
|
+
- 与 VSCode 深度集成
|
|
580
|
+
- 支持文件感知、代码选中等 IDE 功能
|
|
581
|
+
- 与 CLI 版本功能互补,可根据需求选择使用
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## 📖 斜杠命令完整列表 (Slash Commands `/`)
|
|
586
|
+
1. 输入斜杠则可以看到所有支持的斜杠命令
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
### `/clear` - 清空屏幕
|
|
592
|
+
清空终端显示,包括可见的会话历史和滚动缓冲区。
|
|
593
|
+
|
|
594
|
+
**用法:** `/clear`
|
|
595
|
+
|
|
596
|
+
**快捷键:** `Ctrl+L`
|
|
597
|
+
|
|
598
|
+
**注意:** 上下文数据会保留,仅清除视觉显示。
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### `/compress` - 压缩上下文
|
|
603
|
+
用摘要替换整个聊天上下文,节省 token 用量。
|
|
604
|
+
当上下文不足 20% 时,CLI也会自动执行压缩。
|
|
605
|
+
|
|
606
|
+
**用法:** `/compress`
|
|
607
|
+
|
|
608
|
+
**作用:**
|
|
609
|
+
- 保留高层次摘要
|
|
610
|
+
- 大幅减少 token 消耗
|
|
611
|
+
- 适用于长时间会话
|
|
612
|
+
|
|
613
|
+
**注意:** 会丢失详细的历史记录,不可逆操作。
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
### `/copy` - 复制最后输出
|
|
618
|
+
将 AI 的最后一条输出复制到剪贴板。
|
|
619
|
+
|
|
620
|
+
**用法:** `/copy`
|
|
621
|
+
|
|
622
|
+
**使用场景:**
|
|
623
|
+
- 快速复制生成的代码
|
|
624
|
+
- 分享 AI 的回答
|
|
625
|
+
- 保存重要输出
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
### `/editor` - 选择编辑器
|
|
630
|
+
打开编辑器选择对话框,用于查看 diff。
|
|
631
|
+
|
|
632
|
+
**用法:** `/editor`
|
|
633
|
+
|
|
634
|
+
**支持的编辑器:**
|
|
635
|
+
- VSCode
|
|
636
|
+
- Sublime Text
|
|
637
|
+
- Vim
|
|
638
|
+
- 其他...
|
|
639
|
+
|
|
640
|
+
**配置:** 在 `settings.json` 中设置 `preferredEditor`
|
|
641
|
+
|
|
642
|
+
---
|
|
643
|
+
|
|
644
|
+
### `/help` 或 `/?` - 显示帮助
|
|
645
|
+
显示传统的命令列表帮助对话框。
|
|
646
|
+
|
|
647
|
+
**用法:** `/help` 或 `/?`
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
### `/help-ask` - AI 智能帮助助手
|
|
652
|
+
**(你现在正在使用的功能!)**
|
|
653
|
+
|
|
654
|
+
启动 AI 智能帮助系统,可以询问任何关于 CLI 功能的问题。
|
|
655
|
+
|
|
656
|
+
**用法:** `/help-ask`
|
|
657
|
+
|
|
658
|
+
**特点:**
|
|
659
|
+
- 基于完整的 CLI 知识库回答问题
|
|
660
|
+
- 使用 Auto 模型(会消耗 token)
|
|
661
|
+
- 支持中英文问答
|
|
662
|
+
- 按 Esc 键退出帮助模式
|
|
663
|
+
|
|
664
|
+
**退出帮助:** 按 `Esc` 键
|
|
665
|
+
|
|
666
|
+
**注意:** 此功能会消耗 API token,如果只想查看命令列表,请使用 `/help`
|
|
667
|
+
|
|
668
|
+
---
|
|
669
|
+
|
|
670
|
+
### `/init` - 初始化项目上下文
|
|
671
|
+
自动分析项目并生成 `DEEPV.md` 文件,提供项目上下文。
|
|
672
|
+
|
|
673
|
+
**用法:** `/init`
|
|
674
|
+
|
|
675
|
+
**功能:**
|
|
676
|
+
1. 分析项目结构
|
|
677
|
+
2. 识别项目类型(代码项目 vs 非代码项目)
|
|
678
|
+
3. 生成包含以下内容的 `DEEPV.md`:
|
|
679
|
+
- 项目概述
|
|
680
|
+
- 主要技术栈
|
|
681
|
+
- 构建/运行命令
|
|
682
|
+
- 开发规范
|
|
683
|
+
- 特殊配置
|
|
684
|
+
|
|
685
|
+
**注意:** 如果 `DEEPV.md` 已存在,此命令则无法执行。
|
|
686
|
+
|
|
687
|
+
**相关:** `/memory refresh`
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
### `/mcp` - MCP 服务器管理
|
|
692
|
+
列出配置的 Model Context Protocol (MCP) 服务器及其工具。
|
|
693
|
+
|
|
694
|
+
**用法:** `/mcp [子命令]`
|
|
695
|
+
|
|
696
|
+
**子命令:**
|
|
697
|
+
- `desc` / `descriptions`:显示详细的工具描述
|
|
698
|
+
- `nodesc` / `nodescriptions`:隐藏工具描述,仅显示名称
|
|
699
|
+
- `schema`:显示工具参数的完整 JSON schema
|
|
700
|
+
|
|
701
|
+
**快捷键:** `Ctrl+T` - 切换工具描述显示
|
|
702
|
+
|
|
703
|
+
**配置:** 参见 Q5 或 `docs/cli/configuration.md`
|
|
704
|
+
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
### `/memory` - 记忆管理
|
|
708
|
+
管理 AI 的指令上下文(从 `DEEPV.md` 文件加载)。
|
|
709
|
+
|
|
710
|
+
**子命令:**
|
|
711
|
+
- `add <text>` - 添加文本到 AI 记忆
|
|
712
|
+
- `show` - 显示当前加载的完整分层记忆
|
|
713
|
+
- `refresh` - 重新加载所有 `DEEPV.md` 文件
|
|
714
|
+
|
|
715
|
+
**用法示例:**
|
|
716
|
+
```
|
|
717
|
+
/memory add 使用 TypeScript strict 模式
|
|
718
|
+
/memory show
|
|
719
|
+
/memory refresh
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
**记忆文件层次(优先级递增):**
|
|
723
|
+
1. 全局:`~/.deepv/DEEPV.md`
|
|
724
|
+
2. 项目根及父目录:`<项目路径>/DEEPV.md`
|
|
725
|
+
3. 子目录:项目内各子目录的 `DEEPV.md`
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
### `/model` - 切换模型
|
|
732
|
+
交互式选择 AI 模型。
|
|
733
|
+
|
|
734
|
+
**用法:** `/model [模型名]`
|
|
735
|
+
|
|
736
|
+
**交互式:**
|
|
737
|
+
1. 输入 `/model` 后按空格
|
|
738
|
+
2. 显示可用模型列表
|
|
739
|
+
3. 方向键选择
|
|
740
|
+
4. 回车确认
|
|
741
|
+
|
|
742
|
+
**直接指定:** `/model Claude-Sonnet-4.5`
|
|
743
|
+
|
|
744
|
+
**查看统计:** `/stats model`
|
|
745
|
+
|
|
746
|
+
---
|
|
747
|
+
|
|
748
|
+
### `/quit` 或 `/exit` - 退出 CLI
|
|
749
|
+
退出 DeepV Code CLI。
|
|
750
|
+
|
|
751
|
+
**用法:** `/quit` 或 `/exit`
|
|
752
|
+
|
|
753
|
+
**注意:** 未保存的会话状态将丢失
|
|
754
|
+
|
|
755
|
+
---
|
|
756
|
+
|
|
757
|
+
### `/restore` - 恢复检查点
|
|
758
|
+
将项目文件恢复到某个工具执行前的状态。
|
|
759
|
+
|
|
760
|
+
**用法:** `/restore [checkpoint_id]`
|
|
761
|
+
|
|
762
|
+
**无参数:** 列出所有可用的检查点
|
|
763
|
+
|
|
764
|
+
**指定 ID:** 恢复到指定检查点
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
**用途:**
|
|
768
|
+
- 撤销文件编辑
|
|
769
|
+
- 回滚代码变更
|
|
770
|
+
- 恢复删除的文件
|
|
771
|
+
|
|
772
|
+
**相关文档:** `docs/checkpointing.md`
|
|
773
|
+
|
|
774
|
+
---
|
|
775
|
+
|
|
776
|
+
### `/stats` - 统计信息
|
|
777
|
+
显示当前会话的详细统计信息。
|
|
778
|
+
|
|
779
|
+
**用法:** `/stats [子命令]`
|
|
780
|
+
|
|
781
|
+
**子命令:**
|
|
782
|
+
- 无参数:显示总体统计(token 用量、缓存节省、会话时长)
|
|
783
|
+
- `model [模型名]`:显示模型统计(支持 Tab 补全)
|
|
784
|
+
- `tools`:显示工具使用统计
|
|
785
|
+
|
|
786
|
+
**示例:**
|
|
787
|
+
```
|
|
788
|
+
/stats
|
|
789
|
+
/stats model gemini-2.0-flash-exp
|
|
790
|
+
/stats tools
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
**注意:** 缓存 token 信息仅在使用 API key 认证时显示。
|
|
794
|
+
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
### `/theme` - 切换主题
|
|
798
|
+
打开主题选择对话框。
|
|
799
|
+
|
|
800
|
+
**用法:** `/theme`
|
|
801
|
+
|
|
802
|
+
**配置:**
|
|
803
|
+
```json
|
|
804
|
+
{
|
|
805
|
+
"theme": "GitHub"
|
|
806
|
+
}
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
**自定义主题:**
|
|
810
|
+
```json
|
|
811
|
+
{
|
|
812
|
+
"customThemes": {
|
|
813
|
+
"MyTheme": {
|
|
814
|
+
"primary": "#00FF00",
|
|
815
|
+
"background": "#000000"
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
**相关文档:** `docs/cli/themes.md`
|
|
822
|
+
|
|
823
|
+
---
|
|
824
|
+
|
|
825
|
+
### `/auth` - 认证设置
|
|
826
|
+
打开认证对话框,用于重新登录认证。
|
|
827
|
+
|
|
828
|
+
**用法:** `/auth`
|
|
829
|
+
|
|
830
|
+
**支持的认证方式:**
|
|
831
|
+
- 根据您所在的组织会有不同的认证支持,具体看界面引导即可。
|
|
832
|
+
|
|
833
|
+
---
|
|
834
|
+
|
|
835
|
+
### `/tools` - 工具列表
|
|
836
|
+
显示当前可用的所有工具(内置 + MCP)。
|
|
837
|
+
|
|
838
|
+
**用法:** `/tools [子命令]`
|
|
839
|
+
|
|
840
|
+
**子命令:**
|
|
841
|
+
- 默认:显示工具名称和描述
|
|
842
|
+
- `nodesc` / `nodescriptions`:仅显示工具名称
|
|
843
|
+
- `desc` / `descriptions`:显示详细描述(旧版,现为默认)
|
|
844
|
+
|
|
845
|
+
**示例:**
|
|
846
|
+
```
|
|
847
|
+
/tools
|
|
848
|
+
/tools nodesc
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
**相关:** `/mcp`、`/mcp schema`
|
|
852
|
+
|
|
853
|
+
---
|
|
854
|
+
|
|
855
|
+
、`^` 行首尾;`G`、`gg` 跳行
|
|
856
|
+
- **INSERT 模式:** 标准输入,`Esc` 返回 NORMAL
|
|
857
|
+
- **编辑:** `x`(删除)、`d`(删除)、`c`(修改)、`i`、`a`、`o`、`O`(插入)
|
|
858
|
+
- **复合:** `dd`、`cc`、`dw`、`cw`
|
|
859
|
+
- **计数:** `3h`、`5w`、`10G`
|
|
860
|
+
- **重复:** `.` 重复上次编辑
|
|
861
|
+
|
|
862
|
+
**状态指示:** 页脚显示 `[NORMAL]` 或 `[INSERT]`
|
|
863
|
+
|
|
864
|
+
**持久化:** 偏好保存到 `~/.deepv/settings.json`
|
|
865
|
+
|
|
866
|
+
**配置:**
|
|
867
|
+
```json
|
|
868
|
+
{
|
|
869
|
+
"vimMode": true
|
|
870
|
+
}
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
---
|
|
874
|
+
|
|
875
|
+
### `/plan` - 计划模式(只读分析)
|
|
876
|
+
启用计划模式,让 AI 只能读取和分析代码,不能执行修改操作。
|
|
877
|
+
|
|
878
|
+
**用法:** `/plan [子命令]`
|
|
879
|
+
|
|
880
|
+
**子命令:**
|
|
881
|
+
- `/plan` 或 `/plan on` - 启用计划模式
|
|
882
|
+
- `/plan off` - 退出计划模式
|
|
883
|
+
- `/plan status` - 查看当前状态
|
|
884
|
+
|
|
885
|
+
**适用场景:**
|
|
886
|
+
- 项目初期的需求讨论和架构规划
|
|
887
|
+
- 纯代码审查和分析
|
|
888
|
+
- 担心 AI 误修改代码时使用
|
|
889
|
+
- 想让 AI "先动脑不动手"的场景
|
|
890
|
+
|
|
891
|
+
**计划模式特性:**
|
|
892
|
+
- ✅ **允许使用读取类工具:** `read_file`、`read_many_files`、`list_directory`、`glob`、`search_file_content`、`task` 等
|
|
893
|
+
- 🚫 **禁用修改类工具:** `write_file`、`replace`、`run_shell_command`、`lint_fix`、`delete_file` 等
|
|
894
|
+
- 💡 **专注于:** 需求理解、方案讨论、架构设计、代码分析
|
|
895
|
+
- 🎨 **界面提示:** 显示绿色边框指示器 "📋 plan mode - read only"
|
|
896
|
+
- 📝 **输入提示:** "计划模式:可读取代码分析,禁止修改 (/plan off 退出)"
|
|
897
|
+
|
|
898
|
+
**典型使用流程:**
|
|
899
|
+
```
|
|
900
|
+
你: /plan on
|
|
901
|
+
系统: 📋 已进入计划模式(只读分析)
|
|
902
|
+
|
|
903
|
+
你: 帮我分析这个项目的认证模块设计
|
|
904
|
+
AI: [使用 read_file、search_file_content 等工具分析代码]
|
|
905
|
+
AI: [给出架构分析和改进建议]
|
|
906
|
+
|
|
907
|
+
你: /plan off
|
|
908
|
+
系统: [向 AI 发送退出通知]
|
|
909
|
+
|
|
910
|
+
你: 按照刚才的建议帮我重构认证模块
|
|
911
|
+
AI: [使用 write_file、replace 等工具执行修改]
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
**注意事项:**
|
|
915
|
+
- 启用计划模式后,AI 会在每条消息前收到模式提示
|
|
916
|
+
- 退出计划模式时,系统会自动通知 AI 恢复正常权限
|
|
917
|
+
- 计划模式不影响对话历史记录
|
|
918
|
+
|
|
919
|
+
**配置:**
|
|
920
|
+
计划模式状态会自动保存到配置中,重启 CLI 后会保持。
|
|
921
|
+
|
|
922
|
+
**一句话总结:** 让 AI 先动脑不动手,确认方案后再让它干活!
|
|
923
|
+
|
|
924
|
+
---
|
|
925
|
+
|
|
926
|
+
### Q9: 自定义命令
|
|
927
|
+
用户可创建自定义斜杠命令。
|
|
928
|
+
|
|
929
|
+
---
|
|
930
|
+
|
|
931
|
+
**位置:**
|
|
932
|
+
- 全局:`~/.deepv/commands/`
|
|
933
|
+
- 项目:`<项目根>/.deepvcode/commands/`
|
|
934
|
+
|
|
935
|
+
#### 文件格式:TOML(`.toml` 扩展名)
|
|
936
|
+
|
|
937
|
+
#### 命名:文件路径决定命令名
|
|
938
|
+
- `~/.deepv/commands/test.toml` → `/test`
|
|
939
|
+
- `<项目>/.deepv/commands/git/commit.toml` → `/git:commit`
|
|
940
|
+
|
|
941
|
+
#### 必需字段:
|
|
942
|
+
- `prompt`(字符串):发送给模型的 prompt
|
|
943
|
+
|
|
944
|
+
#### 可选字段:
|
|
945
|
+
- `description`(字符串):命令描述(显示在帮助中)
|
|
946
|
+
|
|
947
|
+
#### 参数处理:
|
|
948
|
+
1. **简写注入 `{{args}}`**
|
|
949
|
+
```toml
|
|
950
|
+
prompt = "分析代码并修复:{{args}}"
|
|
951
|
+
```
|
|
952
|
+
调用:`/fix TypeError in line 42`
|
|
953
|
+
|
|
954
|
+
2. **默认追加**(无 `{{args}}`)
|
|
955
|
+
- 有参数:追加到 prompt 末尾(两个换行分隔)
|
|
956
|
+
- 无参数:原样发送 prompt
|
|
957
|
+
|
|
958
|
+
**示例:**
|
|
959
|
+
```toml
|
|
960
|
+
# ~/.deepv/commands/changelog.toml
|
|
961
|
+
description = "添加新条目到 CHANGELOG.md"
|
|
962
|
+
prompt = """
|
|
963
|
+
请将用户提供的变更添加到 CHANGELOG.md。
|
|
964
|
+
格式:/changelog <version> <type> <message>
|
|
965
|
+
type 可以是:added、changed、fixed、removed
|
|
966
|
+
"""
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
**相关文档:** `docs/cli/commands.md` 的 "Custom Commands" 章节
|
|
970
|
+
|
|
971
|
+
---
|
|
972
|
+
|
|
973
|
+
## 📄 At 命令 (File Inclusion `@`)
|
|
974
|
+
|
|
975
|
+
### `@<路径>` - 包含文件内容
|
|
976
|
+
将文件或目录内容注入到 prompt 中。支持多种文件格式,包括代码文件、文档文件等。
|
|
977
|
+
|
|
978
|
+
**支持的文件格式:**
|
|
979
|
+
- **代码文件:** `.ts`, `.js`, `.py`, `.java`, `.cpp` 等所有文本文件
|
|
980
|
+
- **文档文件:** `.pdf`, `.docx` (Word), `.xlsx` / `.xls` (Excel)
|
|
981
|
+
- **图片文件:** `.png`, `.jpg`, `.gif`, `.webp`, `.svg`, `.bmp`
|
|
982
|
+
- **Markdown:** `.md`
|
|
983
|
+
|
|
984
|
+
**用法:**
|
|
985
|
+
- `@path/to/file.txt` - 单个文件
|
|
986
|
+
- `@src/components/` - 整个目录
|
|
987
|
+
- `@README.md 解释这个文件` - 结合问题
|
|
988
|
+
- `@report.pdf` - PDF 文档
|
|
989
|
+
- `@data.xlsx` - Excel 表格
|
|
990
|
+
- `@document.docx` - Word 文档
|
|
991
|
+
|
|
992
|
+
**示例:**
|
|
993
|
+
```
|
|
994
|
+
@src/utils/helper.ts 重构这个文件
|
|
995
|
+
@docs/ 总结这个目录的文档
|
|
996
|
+
解释这段代码 @main.py
|
|
997
|
+
@项目报告.pdf 总结这份报告的关键内容
|
|
998
|
+
@数据统计.xlsx 分析这个表格中的数据趋势
|
|
999
|
+
@需求文档.docx 提取功能需求列表
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
**智能文件识别:**
|
|
1003
|
+
- AI 会根据文件扩展名自动识别文件类型
|
|
1004
|
+
- 无需特殊语法,像读取代码文件一样使用 `@` 命令即可
|
|
1005
|
+
- AI 也可以在认为有必要时主动读取这些文档文件
|
|
1006
|
+
|
|
1007
|
+
### `@` - 粘贴剪贴板中的截图
|
|
1008
|
+
使用 `@` 符号可以将剪贴板中的截图或图片内容粘贴到对话中。
|
|
1009
|
+
|
|
1010
|
+
**用法:**
|
|
1011
|
+
1. 输入 `@` 符号
|
|
1012
|
+
2. 系统会弹出选项菜单
|
|
1013
|
+
3. 选择 `clipboardPaste clipboard content` 选项
|
|
1014
|
+
4. 剪贴板中的截图会被插入到对话中
|
|
1015
|
+
|
|
1016
|
+
**快捷键(直接粘贴,无需菜单):**
|
|
1017
|
+
- **macOS/Linux:** `Ctrl+V` - 直接粘贴剪贴板中的截图
|
|
1018
|
+
- **Windows:** `Ctrl+G` - 直接粘贴剪贴板中的截图
|
|
1019
|
+
|
|
1020
|
+
**示例:**
|
|
1021
|
+
```
|
|
1022
|
+
# 方法一:使用快捷键(推荐)
|
|
1023
|
+
截取屏幕截图后:
|
|
1024
|
+
Ctrl+V # macOS/Linux 下直接粘贴
|
|
1025
|
+
Ctrl+G # Windows 下直接粘贴
|
|
1026
|
+
|
|
1027
|
+
# 方法二:使用 @ 符号
|
|
1028
|
+
@ # 输入 @ 符号
|
|
1029
|
+
# 在弹出的菜单中选择 "clipboardPaste clipboard content"
|
|
1030
|
+
|
|
1031
|
+
# 截图插入后,继续输入问题
|
|
1032
|
+
分析这个截图中的错误信息
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
**注意:**
|
|
1036
|
+
- 快捷键可以直接粘贴,无需选择菜单
|
|
1037
|
+
- 如果快捷键不起作用,使用 `@` 符号通过菜单选择是可靠的备用方案
|
|
1038
|
+
- 支持的图片格式取决于你的操作系统剪贴板
|
|
1039
|
+
|
|
1040
|
+
**特性:**
|
|
1041
|
+
- **Git 感知:** 默认排除 `.gitignore` 文件(如 `node_modules/`、`dist/`、`.env`)
|
|
1042
|
+
- **路径空格:** 使用反斜杠转义:`@My\ Documents/file.txt`
|
|
1043
|
+
- **工具调用:** 内部使用 `read_many_files` 工具
|
|
1044
|
+
|
|
1045
|
+
**配置:**
|
|
1046
|
+
```json
|
|
1047
|
+
{
|
|
1048
|
+
"fileFiltering": {
|
|
1049
|
+
"respectGitIgnore": true,
|
|
1050
|
+
"enableRecursiveFileSearch": true
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
**错误处理:**
|
|
1056
|
+
- 路径不存在:显示错误,不发送 query
|
|
1057
|
+
- 权限问题:报告错误
|
|
1058
|
+
|
|
1059
|
+
### `@` - 纯 @ 符号
|
|
1060
|
+
单独的 `@` 会原样传递给模型(不作为命令处理)。
|
|
1061
|
+
|
|
1062
|
+
---
|
|
1063
|
+
|
|
1064
|
+
## 🖥️ Shell 模式 (Shell Commands `!`)
|
|
1065
|
+
|
|
1066
|
+
### `!<命令>` - 执行 Shell 命令
|
|
1067
|
+
在 CLI 内直接执行 shell 命令。
|
|
1068
|
+
|
|
1069
|
+
**用法:** `!<shell_command>`
|
|
1070
|
+
|
|
1071
|
+
**示例:**
|
|
1072
|
+
```
|
|
1073
|
+
!ls -la
|
|
1074
|
+
!git status
|
|
1075
|
+
!npm install
|
|
1076
|
+
!python script.py
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
**平台:**
|
|
1080
|
+
- Linux/macOS:使用 `bash`
|
|
1081
|
+
- Windows:使用 `cmd.exe`
|
|
1082
|
+
|
|
1083
|
+
**环境变量:** 执行时自动设置 `GEMINI_CLI=1`
|
|
1084
|
+
|
|
1085
|
+
**注意:** 命令具有与终端相同的权限和影响。
|
|
1086
|
+
|
|
1087
|
+
### `!` - 切换 Shell 模式
|
|
1088
|
+
单独的 `!` 切换 shell 模式。
|
|
1089
|
+
|
|
1090
|
+
**用法:** `!`
|
|
1091
|
+
|
|
1092
|
+
**Shell 模式特性:**
|
|
1093
|
+
- 不同的颜色提示
|
|
1094
|
+
- Shell 模式指示器
|
|
1095
|
+
- 输入直接作为 shell 命令执行
|
|
1096
|
+
- 再次输入 `!` 退出 shell 模式
|
|
1097
|
+
|
|
1098
|
+
**使用场景:**
|
|
1099
|
+
- 需要执行多个连续 shell 命令
|
|
1100
|
+
- 临时进入 shell 环境
|
|
1101
|
+
|
|
1102
|
+
---
|
|
1103
|
+
|
|
1104
|
+
## ⚙️ 配置系统
|
|
1105
|
+
|
|
1106
|
+
### 配置层次(优先级递增)
|
|
1107
|
+
1. **默认值**:硬编码默认值
|
|
1108
|
+
2. **用户设置**:`~/.deepv/settings.json`(全局)
|
|
1109
|
+
3. **项目设置**:`<项目根>/.deepv/settings.json`(项目专用)
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
### 环境变量
|
|
1113
|
+
|
|
1114
|
+
#### 从 `.env` 文件加载
|
|
1115
|
+
CLI 自动加载 `.env` 文件,搜索顺序:
|
|
1116
|
+
1. 当前工作目录
|
|
1117
|
+
2. 父目录(直到项目根或用户主目录)
|
|
1118
|
+
3. 用户主目录 `~/.env`
|
|
1119
|
+
|
|
1120
|
+
#### 变量引用
|
|
1121
|
+
在 `settings.json` 中可引用环境变量:
|
|
1122
|
+
```json
|
|
1123
|
+
{
|
|
1124
|
+
"apiKey": "$MY_API_TOKEN"
|
|
1125
|
+
}
|
|
1126
|
+
```
|
|
1127
|
+
|
|
1128
|
+
或:
|
|
1129
|
+
```json
|
|
1130
|
+
{
|
|
1131
|
+
"apiKey": "${MY_API_TOKEN}"
|
|
1132
|
+
}
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
### 命令行参数
|
|
1138
|
+
|
|
1139
|
+
- `--model <name>` / `-m <name>`:指定模型
|
|
1140
|
+
- `--prompt <text>` / `-p <text>`:非交互模式 prompt
|
|
1141
|
+
- `--yolo`:自动批准所有工具调用
|
|
1142
|
+
- `--cloud-mode`:云模式,以便从Web上远程控制本机CLI工作
|
|
1143
|
+
|
|
1144
|
+
**示例:**
|
|
1145
|
+
```bash
|
|
1146
|
+
dvcode --model gemini-2.0-flash-exp --debug
|
|
1147
|
+
dvcode -p "解释 main.py" -a
|
|
1148
|
+
dvcode --checkpointing --sandbox
|
|
1149
|
+
dvcode -e my-extension -e another
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
---
|
|
1153
|
+
|
|
1154
|
+
## 🗂️ 上下文文件(分层记忆)
|
|
1155
|
+
|
|
1156
|
+
### 文件名
|
|
1157
|
+
默认:`GEMINI.md`
|
|
1158
|
+
|
|
1159
|
+
可通过 `contextFileName` 设置自定义:
|
|
1160
|
+
```json
|
|
1161
|
+
{
|
|
1162
|
+
"contextFileName": "DEEPV.md"
|
|
1163
|
+
}
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
### 作用
|
|
1167
|
+
向 AI 提供项目特定的指令、编码规范、背景信息。
|
|
1168
|
+
|
|
1169
|
+
### 层次结构(优先级递增)
|
|
1170
|
+
1. **全局:** `~/.deepv/GEMINI.md`(所有项目)
|
|
1171
|
+
2. **项目根及父目录:** 从当前目录向上搜索(直到项目根或主目录)
|
|
1172
|
+
3. **子目录:** 项目内的子目录(限制 200 个目录,可通过 `memoryDiscoveryMaxDirs` 配置)
|
|
1173
|
+
|
|
1174
|
+
### 内容示例
|
|
1175
|
+
```markdown
|
|
1176
|
+
# 项目:My TypeScript Library
|
|
1177
|
+
|
|
1178
|
+
## 通用指令
|
|
1179
|
+
- 遵循现有代码风格
|
|
1180
|
+
- 函数和类需要 JSDoc 注释
|
|
1181
|
+
- 优先使用函数式编程
|
|
1182
|
+
- 兼容 TypeScript 5.0 和 Node.js 20+
|
|
1183
|
+
|
|
1184
|
+
## 编码规范
|
|
1185
|
+
- 2 空格缩进
|
|
1186
|
+
- 接口名前缀 `I`(如 `IUserService`)
|
|
1187
|
+
- 私有成员前缀 `_`
|
|
1188
|
+
- 使用严格相等 `===` 和 `!==`
|
|
1189
|
+
|
|
1190
|
+
## 特定组件:src/api/client.ts
|
|
1191
|
+
- 处理所有出站 API 请求
|
|
1192
|
+
- 新增 API 函数需包含错误处理和日志
|
|
1193
|
+
- GET 请求使用 `fetchWithRetry` 工具
|
|
1194
|
+
|
|
1195
|
+
## 依赖
|
|
1196
|
+
- 避免引入新依赖(除非必要)
|
|
1197
|
+
- 如需新依赖,请说明原因
|
|
1198
|
+
```
|
|
1199
|
+
|
|
1200
|
+
### 管理命令
|
|
1201
|
+
- `/memory show`:查看当前加载的完整记忆
|
|
1202
|
+
- `/memory refresh`:重新加载所有上下文文件
|
|
1203
|
+
- `/memory add <text>`:添加临时记忆
|
|
1204
|
+
|
|
1205
|
+
### UI 指示
|
|
1206
|
+
页脚显示已加载的上下文文件数量。
|
|
1207
|
+
|
|
1208
|
+
---
|
|
1209
|
+
|
|
1210
|
+
## 🔒 沙箱模式
|
|
1211
|
+
|
|
1212
|
+
### 启用方式
|
|
1213
|
+
- 命令行:`dvcode --sandbox` 或 `dvcode -s`
|
|
1214
|
+
- 环境变量:`GEMINI_SANDBOX=true`
|
|
1215
|
+
- 配置:`{"sandbox": true}` 或 `{"sandbox": "docker"}`
|
|
1216
|
+
- YOLO 模式:默认启用沙箱
|
|
1217
|
+
|
|
1218
|
+
### 默认行为
|
|
1219
|
+
使用预构建的 `gemini-cli-sandbox` Docker 镜像。
|
|
1220
|
+
|
|
1221
|
+
### 自定义沙箱
|
|
1222
|
+
在项目根创建 `.deepv/sandbox.Dockerfile`:
|
|
1223
|
+
```dockerfile
|
|
1224
|
+
FROM gemini-cli-sandbox
|
|
1225
|
+
|
|
1226
|
+
RUN apt-get update && apt-get install -y some-package
|
|
1227
|
+
COPY ./my-config /app/my-config
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
构建并使用:
|
|
1231
|
+
```bash
|
|
1232
|
+
BUILD_SANDBOX=1 dvcode -s
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
### macOS Seatbelt
|
|
1236
|
+
使用 `SEATBELT_PROFILE` 环境变量:
|
|
1237
|
+
- `permissive-open`(默认):限制写入项目文件夹
|
|
1238
|
+
- `strict`:严格模式
|
|
1239
|
+
- `<profile_name>`:自定义 profile(`.deepv/sandbox-macos-<profile_name>.sb`)
|
|
1240
|
+
|
|
1241
|
+
---
|
|
1242
|
+
|
|
1243
|
+
## 📊 使用统计
|
|
1244
|
+
|
|
1245
|
+
### 收集内容
|
|
1246
|
+
- **工具调用:** 名称、成功/失败、耗时(不含参数和返回值)
|
|
1247
|
+
- **API 请求:** 模型、时长、成功状态(不含 prompt/response)
|
|
1248
|
+
- **会话信息:** 配置、启用工具、审批模式
|
|
1249
|
+
|
|
1250
|
+
### 不收集内容
|
|
1251
|
+
- 个人身份信息 (PII)
|
|
1252
|
+
- Prompt 和 Response 内容
|
|
1253
|
+
- 文件内容
|
|
1254
|
+
|
|
1255
|
+
### 关闭统计
|
|
1256
|
+
```json
|
|
1257
|
+
{
|
|
1258
|
+
"usageStatisticsEnabled": false
|
|
1259
|
+
}
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
---
|
|
1263
|
+
|
|
1264
|
+
## 🎓 常见使用场景
|
|
1265
|
+
|
|
1266
|
+
### 场景 1:开始新项目
|
|
1267
|
+
```bash
|
|
1268
|
+
cd my-new-project
|
|
1269
|
+
dvcode --init # 生成 DEEPV.md
|
|
1270
|
+
dvcode # 启动 CLI
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
CLI 内:
|
|
1274
|
+
```
|
|
1275
|
+
/memory show # 查看加载的上下文
|
|
1276
|
+
@src/ 分析这个项目的架构
|
|
1277
|
+
```
|
|
1278
|
+
|
|
1279
|
+
### 场景 2:调试代码
|
|
1280
|
+
```
|
|
1281
|
+
@src/buggy-file.ts 这里有个 TypeError,帮我找出原因
|
|
1282
|
+
|
|
1283
|
+
# AI 分析后给出修复建议
|
|
1284
|
+
|
|
1285
|
+
/chat save debug-session # 保存会话以便后续继续
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
### 场景 3:切换任务
|
|
1289
|
+
```
|
|
1290
|
+
/chat save feature-login # 保存当前任务
|
|
1291
|
+
/chat list # 查看所有保存的会话
|
|
1292
|
+
/chat resume feature-payment # 切换到支付功能任务
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
### 场景 4:配置 MCP 服务器
|
|
1296
|
+
编辑 `.deepv/settings.json`:
|
|
1297
|
+
```json
|
|
1298
|
+
{
|
|
1299
|
+
"mcpServers": {
|
|
1300
|
+
"database": {
|
|
1301
|
+
"command": "python",
|
|
1302
|
+
"args": ["db_mcp_server.py"],
|
|
1303
|
+
"env": {
|
|
1304
|
+
"DB_URL": "$DATABASE_URL"
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
重启 CLI,然后:
|
|
1312
|
+
```
|
|
1313
|
+
/mcp # 查看服务器状态
|
|
1314
|
+
/tools # 查看新增的数据库工具
|
|
1315
|
+
```
|
|
1316
|
+
|
|
1317
|
+
### 场景 5:创建自定义命令
|
|
1318
|
+
创建 `~/.deepv/commands/docs/generate.toml`:
|
|
1319
|
+
```toml
|
|
1320
|
+
description = "生成 API 文档"
|
|
1321
|
+
prompt = """
|
|
1322
|
+
请为以下代码生成详细的 API 文档:{{args}}
|
|
1323
|
+
|
|
1324
|
+
文档格式:
|
|
1325
|
+
- 函数签名
|
|
1326
|
+
- 参数说明
|
|
1327
|
+
- 返回值说明
|
|
1328
|
+
- 使用示例
|
|
1329
|
+
- 注意事项
|
|
1330
|
+
"""
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
使用:
|
|
1334
|
+
```
|
|
1335
|
+
/docs:generate @src/api/users.ts
|
|
1336
|
+
```
|
|
1337
|
+
|
|
1338
|
+
---
|
|
1339
|
+
|
|
1340
|
+
## 🚨 故障排查
|
|
1341
|
+
|
|
1342
|
+
### 问题:模型返回错误或无法连接
|
|
1343
|
+
**检查:**
|
|
1344
|
+
1. 是否有足够的额度
|
|
1345
|
+
2. 网络连接是否正常
|
|
1346
|
+
3. 是否登录已过期,可以尝试 `/auth` 重新登录
|
|
1347
|
+
4. 尝试切换模型:`/model`
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
### 问题:MCP 服务器无法连接
|
|
1351
|
+
**检查:**
|
|
1352
|
+
1. 服务器命令路径是否正确
|
|
1353
|
+
2. 环境变量是否设置
|
|
1354
|
+
3. 服务器日志(启用调试模式)
|
|
1355
|
+
4. 使用 `/mcp` 查看连接状态
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
### 问题:自定义命令不显示
|
|
1359
|
+
**检查:**
|
|
1360
|
+
1. 文件位置:`~/.deepv/commands/` 或 `<项目>/.deepv/commands/`
|
|
1361
|
+
2. 文件扩展名:必须是 `.toml`
|
|
1362
|
+
3. 文件格式:必须包含 `prompt` 字段
|
|
1363
|
+
4. 重启 CLI
|
|
1364
|
+
|
|
1365
|
+
### 问题:记忆文件未加载
|
|
1366
|
+
**检查:**
|
|
1367
|
+
1. 文件名是否正确(默认 `DEEPV.md`)
|
|
1368
|
+
2. 使用 `/memory show` 查看加载状态
|
|
1369
|
+
3. 使用 `/memory refresh` 重新加载
|
|
1370
|
+
4. 检查格式是否为合法的 markdown
|
|
1371
|
+
|
|
1372
|
+
---
|
|
1373
|
+
|
|
1374
|
+
## 🔚 结语
|
|
1375
|
+
|
|
1376
|
+
这份知识库涵盖了 DeepV Code CLI 的所有核心功能。如果你有任何问题,请随时询问!
|
|
1377
|
+
|
|
1378
|
+
**DeepV Code 出品方信息:**
|
|
1379
|
+
- 官网:https://dvcode.deepvlab.ai/
|
|
1380
|
+
- 出品公司:Deep X Corporation Limited
|
|
1381
|
+
|
|
1382
|
+
**退出智能帮助系统:** 按下ESC键
|