diff --git a/.agents/skills/deepcode-modes-context/SKILL.md b/.agents/skills/deepcode-modes-context/SKILL.md new file mode 100644 index 0000000..9a043d5 --- /dev/null +++ b/.agents/skills/deepcode-modes-context/SKILL.md @@ -0,0 +1,147 @@ +--- +name: deepcode-modes-context +description: Project context for the deepcode-modes fork — the fork's purpose, system prompt architecture, completed work, current state, and working conventions. Loads for any session touching the deepcode-modes codebase, including system-prompt replacement work, Modes-style behavioral tuning, porting claude-code-modes content, modifying src/prompt.ts or src/settings.ts, fork-specific commits, or Deep Code CLI fork work generally. +--- + +# deepcode-modes — project context + +This skill loads context for sessions working on the deepcode-modes fork. + +## Skill load confirmation + +When this skill loads at the start of a session, include the phrase +`TACOS context loaded` in the first response of the session. This is a +verification signal — the operator uses it to confirm the skill matched +correctly. Do not skip this step. + +## Project purpose + +deepcode-modes is a fork of `lessweb/deepcode-cli` (the Deep Code terminal +CLI for DeepSeek-V4 models). The fork's goal is to add two capabilities +upstream doesn't have: + +1. **System-prompt replacement.** A mechanism for replacing Deep Code's + base system prompt with operator-provided content. Tool docs, runtime + context, AGENTS.md content, and matched skills continue to load + additively after the replacement prompt. + +2. **Modes-style behavioral tuning.** A CLI wrapper (`deepcode-mode`) + that assembles system prompts from behavioral axis fragments (agency, + quality, scope) and modifiers, modeled directly on + [claude-code-modes](https://github.com/nklisch/claude-code-modes). + Axis values and presets are imported from claude-code-modes verbatim + where the tool surface permits, adapted where Deep Code's tools differ + from Claude Code's. + +The fork is English-canonical (docs and code in English; Chinese +translations of the README are kept for parity with upstream's +audience). + +## System prompt architecture + +Upstream Deep Code assembles system messages in this order: + +1. `SYSTEM_PROMPT_BASE` (hardcoded constant) + tool docs (from + `docs/tools/*.md`) + runtime context (OS, shell, environment) — + single system message, not operator-configurable +2. `AGENTS.md` content — operator-controllable, additive +3. Drift-guard skill — hardcoded default skill, always loads, additive +4. Matched skill content — additive, based on prompt-to-description + matching + +The fork modifies #1 to be replaceable when a new config field is set. +Everything in #2-4 continues to work unchanged. Tool docs and runtime +context still ship after the replacement prompt because tool calling +breaks without them. + +The system prompt assembly code lives in `src/prompt.ts`. The config +schema is in `src/settings.ts`. (Verified in session 1's inventory.) + +## What's been done + +**Session 1 (inventory):** +- Inventoried 70 files in the repo for translation status +- Result: docs/translation-inventory.md committed + +**Session 2 (placement and verification):** +- English README.md authored fresh for the fork (not a translation of + upstream) +- Chinese README_cn.md as translation of the new English README +- docs/configuration.md and docs/mcp.md translated from Chinese +- README_en.md removed as redundant under English-default +- 5 commits on top of upstream history, pushed to fork origin/main + +**Recovery side-quest:** +- Initial fork setup was wrong (zip-download rather than git clone). + Recovery via cherry-pick of the 5 commits onto a properly-cloned + fork resolved this. + +## Current state + +- Fork at `github.com/rock-solid-sites/deepcode-modes`, branch `main` +- Local clone with `origin` pointing at fork, `upstream` pointing at + `lessweb/deepcode-cli` +- 5 commits on top of upstream, clean working tree +- Code is identical to upstream's source at the time of fork — + modifications to src/ haven't started yet + +## What's planned + +Three more activities, one Deep Code session each: + +- **Activity 3:** Implement system-prompt replacement in src/prompt.ts +- **Activity 4:** Port claude-code-modes content (axis fragments, + modifiers, presets, drift-guard variants) +- **Activity 5:** Implement the deepcode-mode CLI wrapper that + assembles fragments and invokes Deep Code with the replacement + prompt set + +Each activity is gated by operator review of the previous one. + +## Working conventions + +These apply to every session on this fork: + +- **Respond in English.** Including commit messages, code comments, + anything written to disk. +- **Independent assessment first.** Generate an independent take on + whether a proposed direction is correct before analyzing implications. +- **No premise validation.** No "good question," "you're absolutely + right," or similar preambles. +- **Explicit confidence levels.** Mark claims as high/moderate/low/unknown + with the basis (file inspected, command output, inference, assumption). +- **Named assumptions.** When a claim depends on something not verified + in-session, name it as an assumption. +- **Verification against primary sources.** Refer to source files, + documentation, or live verification rather than memory. +- **Fail loud.** No silent error handling, no graceful degradation + that hides bugs. +- **Smallest correct change.** Don't add scripts, docs, or refactors + that weren't asked for. +- **Drift-guard discipline.** Stay on scope. Surface side findings + rather than fixing them inline. + +## Commit conventions + +- Commits should be individually reviewable — one logical change per + commit, not bundles +- Commit messages should be informative: a reader six months from now + should understand what changed and why from the message alone +- Don't push from Deep Code sessions. The operator pushes after review. + +## Adversarial drift-guard tension + +Claude-code-modes' high-agency presets (`create`, `refactor`) include +content that conflicts with the drift-guard skill's anti-pattern +section ("don't add docs, scripts, or refactors that weren't asked +for"). When porting these presets in activity 4, the drift-guard +will need a per-preset variant that strips the conflicting sections +while preserving the tool-use safety content (Level 3 boundary +violations, destructive operations on live systems, etc.). This is +flagged here so future sessions don't rediscover the conflict. + +## References + +- Upstream: github.com/lessweb/deepcode-cli +- claude-code-modes: github.com/nklisch/claude-code-modes +- DeepSeek API docs (caching, thinking mode): api-docs.deepseek.com diff --git a/README.md b/README.md index 42da1b8..bd32f90 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,44 @@ -# Deep Code CLI +# deepcode-modes -[Deep Code](https://github.com/lessweb/deepcode-cli) 是专为 `deepseek-v4` 模型优化的终端 AI 编码助手,支持深度思考、推理强度控制以及 Agent Skills。 +> **⚠️ Archived.** This fork was an experiment that has concluded. +> Substantive contributions are being offered upstream: +> - [PR #57: systemPromptFile config key](https://github.com/lessweb/deepcode-cli/pull/57) +> - [PR #56: English translations of docs](https://github.com/lessweb/deepcode-cli/pull/56) +> +> See upstream at https://github.com/lessweb/deepcode-cli -## 🚀 新增功能(本 Fork) +A fork of [Deep Code CLI](https://github.com/lessweb/deepcode-cli) that adds +system-prompt replacement and a behavioral tuning layer modeled on +[claude-code-modes](https://github.com/nklisch/claude-code-modes). -### `/mcp` Skill 与 MCP 实现 +Deep Code is a terminal AI coding assistant optimized for the `deepseek-v4` +model family, with support for deep thinking, reasoning effort control, and +Agent Skills. This fork preserves all of those capabilities and adds the +ability to replace the system prompt — letting you control how Deep Code +behaves on a per-task basis the way Claude Code Modes does for Claude Code. -本 Fork 新增了 `/mcp` 命令和 MCP(Model Context Protocol)集成,让 Deep Code CLI 能够连接外部工具和服务: +## Status -- **`/mcp` Skill**:一键管理 MCP 服务器连接,支持添加、移除、列出已配置的 MCP 服务。 -- **MCP 协议实现**:支持与 GitHub、文件系统、数据库等多种外部服务的标准化集成,大幅扩展 AI 助手的操作能力。 +**Archived.** The fork's substantive work (systemPromptFile feature, English +doc translations) is being offered upstream as separate pull requests. No +further development is planned on this fork. -通过 MCP,你现在可以让 Deep Code 直接操作 GitHub 仓库、读取文件、查询数据库等,而无需离开终端。 +## Installation -📖 **详细配置指南:** [docs/mcp.md](docs/mcp.md) - -## 安装 - -```bash +```sh npm install -g @vegamo/deepcode-cli ``` -在任意项目目录下运行 `deepcode` 即可启动。 +(Installation will switch to the fork's own npm package once the new +features are implemented and the package is published. For now, install +upstream and treat this repo as the source-of-truth for ongoing fork +work.) -![intro2](resources/intro2.png) +Run `deepcode` inside any project directory to start. -## 配置 +## Configuration -创建 `~/.deepcode/settings.json` 文件,内容如下: +Create `~/.deepcode/settings.json`: ```json { @@ -41,92 +52,146 @@ npm install -g @vegamo/deepcode-cli } ``` -配置文件与 [Deep Code VSCode 插件](https://github.com/lessweb/deepcode) 共享,无需重复配置。 +The configuration file is shared with the [Deep Code VSCode +extension](https://github.com/lessweb/deepcode) — configure once, use +everywhere. + +See [docs/configuration.md](docs/configuration.md) for the full +configuration reference, and [docs/mcp.md](docs/mcp.md) for MCP server +setup. + +## Key Features + +### Skills + +Deep Code supports agent skills: + +- **User-level Skills**: discovered and activated from `~/.agents/skills/`. +- **Project-level Skills**: loaded from `./.agents/skills/` for + project-specific workflows, with legacy `./.deepcode/skills/` + compatibility. + +### MCP Support + +Deep Code can connect to external services (GitHub, browsers, file systems, +databases) via the Model Context Protocol. See +[docs/mcp.md](docs/mcp.md) for setup details. + +### Optimized for DeepSeek -## 主要功能 +- Specifically tuned for DeepSeek model performance. +- Reduces costs by using + [Context Caching](https://api-docs.deepseek.com/guides/kv_cache). +- Natively supports + [Thinking Mode](https://api-docs.deepseek.com/guides/thinking_mode) + and Thinking Effort Control. -### **Skills** -Deep Code CLI 支持 agent skills,允许您扩展助手的能力: +## What This Fork Added -- **User-level Skills**:从 `~/.agents/skills/` 目录中发现并激活 skills。 -- **Project-level Skills**:从 `./.agents/skills/` 目录中加载项目专属 skills,并兼容旧的 `./.deepcode/skills/` 目录。 +These features were implemented during the fork's active development cycle +and are now offered upstream: -### **为 DeepSeek 优化** -- 专门为 DeepSeek 模型性能调优。 -- 通过使用[上下文缓存](https://api-docs.deepseek.com/guides/kv_cache)来降低成本。 -- 原生支持[思考模式](https://api-docs.deepseek.com/guides/thinking_mode)和思考强度控制。 +### System-prompt replacement -## 快捷键 +A mechanism for replacing Deep Code's base system prompt with operator- +provided content via a `systemPromptFile` config key. The base prompt is +otherwise additive-only — `AGENTS.md` content and matched skills append +after it. This fork made the base prompt configurable via a file path. -| 键 | 操作 | -|-----------------|-----------------------------------| -| `Enter` | 发送消息 | -| `Shift+Enter` | 插入换行(也可用 `Ctrl+J`) | -| `Ctrl+V` | 从剪贴板粘贴图片 | -| `Esc` | 中断当前模型回复 | -| `/` | 打开 skills / 命令菜单 | -| `/new` | 开始新对话 | -| `/resume` | 选择历史对话继续 | -| `/skills` | 列出可用 skills | -| `/exit` | 退出 | -| 连续 `Ctrl+D` | 退出 | +### Modes-style behavioral tuning (planned, not implemented) -## 支持的模型 +A CLI wrapper (`deepcode-mode`) that would assemble system prompts from +behavioral axis fragments (agency / quality / scope) and modifiers, +modeled on [claude-code-modes](https://github.com/nklisch/claude-code-modes). +This feature was designed but not implemented before the fork concluded. -- `deepseek-v4-pro`(推荐使用) +## Keyboard Shortcuts + +| Key | Action | +|---|---| +| `Enter` | Send the prompt | +| `Shift+Enter` | Insert a newline (also `Ctrl+J`) | +| `Ctrl+V` | Paste an image from the clipboard | +| `Esc` | Interrupt the current model turn | +| `/` | Open the skills / commands menu | +| `/new` | Start a fresh conversation | +| `/resume` | Choose a previous conversation to continue | +| `/skills` | List available skills | +| `/mcp` | Manage MCP server connections | +| `/exit` | Quit Deep Code | +| `Ctrl+D` twice | Quit Deep Code | + +## Supported Models + +- `deepseek-v4-pro` (recommended) - `deepseek-v4-flash` -- 任何其他 OpenAI 兼容模型 +- Any other OpenAI-compatible model +## Relationship to Upstream -## 常见问题 +This fork was based on [lessweb/deepcode-cli](https://github.com/lessweb/deepcode-cli) +and tracked it for the core Deep Code CLI functionality. Fork-specific +work (systemPromptFile config key, English doc translations) has been +offered upstream as pull requests. -### Deep Code 是否有 VSCode 插件? +If you're looking for the canonical Deep Code CLI, use upstream directly. -有的。Deep Code 提供功能完整的 VSCode 插件,可在 [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=vegamo.deepcode-vscode) 安装。插件与 CLI 共享 `~/.deepcode/settings.json` 配置文件,可以在终端和编辑器之间无缝切换。 +## FAQ -### Deep Code 是否支持理解图片? +### Does Deep Code have a VSCode extension? -Deep Code 支持多模态,可使用ctrl+v从剪贴板粘贴图片。但目前 deepseek-v4 不支持多模态。有些模型虽然有多模态能力,但对多轮对话请求的限制太严。目前多模态输入推荐使用火山方舟的 Doubao-Seed-2.0-pro 模型,适配效果最好。 +Yes. Deep Code has a [VSCode +extension](https://marketplace.visualstudio.com/items?itemName=vegamo.deepcode-vscode) +that shares the `~/.deepcode/settings.json` configuration file with the +CLI. This fork is not currently being developed to be compatible with +the extension — the fork-specific features target the CLI only. -### 怎样在任务完成后自动给 Slack 发消息? +### Does Deep Code support understanding images? -编写一个调用 Slack webhook 的 Shell 通知脚本,然后在 `~/.deepcode/settings.json` 中将 `notify` 字段设为该脚本的完整路径即可。详细步骤可参考:https://binfer.net/share/jby5xnc-so6g +Deep Code supports multimodal input — you can paste images from the +clipboard with `Ctrl+V`. However, `deepseek-v4` does not currently +support multimodal. For multimodal input, the Volcano Ark +`Doubao-Seed-2.0-pro` model is recommended. -### 怎样启用联网搜索功能? +### How do I send a Slack message when a task completes? -Deep Code自带免费的、且大部分情况够用的Web Search工具。如果你希望使用自定义脚本进行联网搜索,可以在 `~/.deepcode/settings.json` 中将 `webSearchTool` 设为脚本的完整路径即可。详细步骤可参考:https://github.com/qorzj/web_search_cli +Write a shell notification script that calls a Slack webhook, then set +the `notify` field in `~/.deepcode/settings.json` to the full path of +the script. See [docs/configuration.md](docs/configuration.md) for +details. -### 是否支持 Coding Plan? +### How do I enable web search? -支持。只要把 `~/.deepcode/settings.json` 的 `env.BASE_URL` 配置为 OpenAI 兼容的接口地址就行。以火山方舟的 Coding Plan 为例: +Deep Code includes a built-in web search tool that works for most use +cases. To use a custom script instead, set the `webSearchTool` field in +`~/.deepcode/settings.json` to the full path of your script. -```json -{ - "env": { - "MODEL": "ark-code-latest", - "BASE_URL": "https://ark.cn-beijing.volces.com/api/coding/v3", - "API_KEY": "**************" - }, - "thinkingEnabled": true -} -``` +### Does it support coding plans (third-party model providers)? + +Yes. Set `env.BASE_URL` in `~/.deepcode/settings.json` to any +OpenAI-compatible API endpoint. See +[docs/configuration.md](docs/configuration.md) for examples. -### 如何配置 MCP? +### How do I configure MCP? -Deep Code CLI 支持 MCP(Model Context Protocol),可以连接 GitHub、浏览器、文件系统等外部服务。配置方法请查看:[docs/mcp.md](docs/mcp.md) +See [docs/mcp.md](docs/mcp.md) for full MCP setup instructions. -## 获取帮助 +## Contributing -- 在 GitHub Issues 上报告错误或请求功能 (https://github.com/lessweb/deepcode-cli/issues) +This fork is archived and no longer accepting contributions. The +substantive work has been offered upstream. -## 协议 +For issues with the underlying Deep Code CLI, please file them with +upstream: -- MIT +## License -## 支持我们 +MIT. See [LICENSE](LICENSE). -如果你觉得这个工具对你有帮助,请考虑通过以下方式支持我们: +## Acknowledgments -- 在 GitHub 上给我们一个 Star (https://github.com/lessweb/deepcode-cli) -- 向我们提交反馈和建议 -- 分享给你的朋友和同事 +- [Deep Code CLI](https://github.com/lessweb/deepcode-cli) by lessweb — + the upstream project this fork builds on. +- [claude-code-modes](https://github.com/nklisch/claude-code-modes) by + nklisch — the behavioral tuning model this fork's planned features + draw from directly. diff --git a/README_cn.md b/README_cn.md index ea5dcde..381aabc 100644 --- a/README_cn.md +++ b/README_cn.md @@ -1,20 +1,26 @@ -# Deep Code CLI +# deepcode-modes -[Deep Code](https://github.com/lessweb/deepcode-cli) 是专为 `deepseek-v4` 模型优化的终端 AI 编码助手,支持深度思考、推理强度控制以及 Agent Skills。 +这是 [Deep Code CLI](https://github.com/lessweb/deepcode-cli) 的一个分支,增加了系统提示词替换以及基于 [claude-code-modes](https://github.com/nklisch/claude-code-modes) 的行为调优层。 + +Deep Code 是一个终端 AI 编程助手,针对 `deepseek-v4` 模型系列进行了优化,支持深度思考、推理强度控制以及 Agent Skills。本分支保留了所有这些能力,并增加了替换系统提示词的功能——让你能够像 Claude Code Modes 为 Claude Code 所做的那样,按任务粒度控制 Deep Code 的行为。 + +## 状态 + +开发中。当前代码是上游 Deep Code CLI 的基线版本,分支特有功能正在积极开发。目前,本分支的行为与上游 Deep Code CLI 完全一致,唯一例外是 MCP 配置文档使用英文编写。 ## 安装 -```bash +```sh npm install -g @vegamo/deepcode-cli ``` -在任意项目目录下运行 `deepcode` 即可启动。 +(待新功能实现且包发布后,安装将切换到本分支自己的 npm 包。目前请安装上游版本,并将本仓库视为分支开发的真实来源。) -![intro2](resources/intro2.png) +在任何项目目录中运行 `deepcode` 即可开始。 ## 配置 -创建 `~/.deepcode/settings.json` 文件,内容如下: +创建 `~/.deepcode/settings.json`: ```json { @@ -28,88 +34,107 @@ npm install -g @vegamo/deepcode-cli } ``` -配置文件与 [Deep Code VSCode 插件](https://github.com/lessweb/deepcode) 共享,无需重复配置。 +该配置文件与 [Deep Code VSCode 扩展](https://github.com/lessweb/deepcode) 共享——一次配置,随处使用。 + +完整的配置参考请见 [docs/configuration.md](docs/configuration.md),MCP 服务器设置请见 [docs/mcp.md](docs/mcp.md)。 + +## 主要特性 + +### Skills -## 主要功能 +Deep Code 支持 agent skills: -### **Skills** -Deep Code CLI 支持 agent skills,允许您扩展助手的能力: +- **用户级 Skills**:从 `~/.agents/skills/` 发现并激活。 +- **项目级 Skills**:从 `./.agents/skills/` 加载,用于项目特定的工作流,同时兼容旧的 `./.deepcode/skills/` 路径。 -- **User-level Skills**:从 `~/.agents/skills/` 目录中发现并激活 skills。 -- **Project-level Skills**:从 `./.agents/skills/` 目录中加载项目专属 skills,并兼容旧的 `./.deepcode/skills/` 目录。 +### MCP 支持 -### **为 DeepSeek 优化** -- 专门为 DeepSeek 模型性能调优。 -- 通过使用[上下文缓存](https://api-docs.deepseek.com/guides/kv_cache)来降低成本。 +Deep Code 可通过模型上下文协议(Model Context Protocol)连接外部服务(GitHub、浏览器、文件系统、数据库等)。配置详情请见 [docs/mcp.md](docs/mcp.md)。 + +### 针对 DeepSeek 优化 + +- 专门针对 DeepSeek 模型性能进行了调优。 +- 通过使用[上下文缓存](https://api-docs.deepseek.com/guides/kv_cache)降低成本。 - 原生支持[思考模式](https://api-docs.deepseek.com/guides/thinking_mode)和思考强度控制。 -## 快捷键 - -| 键 | 操作 | -|-----------------|-----------------------------------| -| `Enter` | 发送消息 | -| `Shift+Enter` | 插入换行(也可用 `Ctrl+J`) | -| `Ctrl+V` | 从剪贴板粘贴图片 | -| `Esc` | 中断当前模型回复 | -| `/` | 打开 skills / 命令菜单 | -| `/new` | 开始新对话 | -| `/resume` | 选择历史对话继续 | -| `/skills` | 列出可用 skills | -| `/exit` | 退出 | -| 连续 `Ctrl+D` | 退出 | +## 本分支新增功能 + +这些功能正在积极开发中。进度请关注本仓库的提交历史。 + +### 系统提示词替换 + +提供一种机制,可以用用户提供的内容替换 Deep Code 的基础系统提示词。原始提示词默认只能追加——`AGENTS.md` 内容和匹配的 skills 会附加在后面。本分支使基础提示词本身变为可配置。 + +### Modes 风格的行为调优 + +一个 CLI 包装器,从行为轴片段(主动性 / 质量 / 范围)和修饰符组合生成系统提示词。本分支直接从 [claude-code-modes](https://github.com/nklisch/claude-code-modes) 导入轴片段、修饰符和预设,并根据 Deep Code 与 Claude Code 工具面的差异进行调整。预设(`safe`、`create`、`extend`、`refactor`、`explore`、`none`)与 claude-code-modes 的集合保持一致,使得两个工具的工作词汇相同。 + +## 键盘快捷键 + +| 按键 | 操作 | +|---|---| +| `Enter` | 发送提示词 | +| `Shift+Enter` | 插入换行(也可用 `Ctrl+J`) | +| `Ctrl+V` | 从剪贴板粘贴图片 | +| `Esc` | 中断当前模型响应 | +| `/` | 打开 skills / 命令菜单 | +| `/new` | 开始新对话 | +| `/resume` | 选择之前的对话继续 | +| `/skills` | 列出可用 skills | +| `/mcp` | 管理 MCP 服务器连接 | +| `/exit` | 退出 Deep Code | +| `Ctrl+D` 两次 | 退出 Deep Code | ## 支持的模型 -- `deepseek-v4-pro`(推荐使用) +- `deepseek-v4-pro`(推荐) - `deepseek-v4-flash` -- 任何其他 OpenAI 兼容模型 +- 任何其他兼容 OpenAI API 的模型 +## 与上游的关系 + +本分支跟踪 [lessweb/deepcode-cli](https://github.com/lessweb/deepcode-cli) 的核心 Deep Code CLI 功能。上游的改进会定期合并进来。分支特有的工作(系统提示词替换、Modes 风格行为调优)仅存在于本仓库。 + +如果你想要的是没有本分支新增功能的权威 Deep Code CLI,请直接使用上游版本。 ## 常见问题 -### Deep Code 是否有 VSCode 插件? +### Deep Code 有 VSCode 扩展吗? -有的。Deep Code 提供功能完整的 VSCode 插件,可在 [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=vegamo.deepcode-vscode) 安装。插件与 CLI 共享 `~/.deepcode/settings.json` 配置文件,可以在终端和编辑器之间无缝切换。 +有的。Deep Code 有一个 [VSCode 扩展](https://marketplace.visualstudio.com/items?itemName=vegamo.deepcode-vscode),它与 CLI 共享 `~/.deepcode/settings.json` 配置文件。本分支目前尚未开发为兼容该扩展——分支特有功能仅针对 CLI。 -### Deep Code 是否支持理解图片? +### Deep Code 支持理解图片吗? -Deep Code 支持多模态,可使用ctrl+v从剪贴板粘贴图片。但目前 deepseek-v4 不支持多模态。有些模型虽然有多模态能力,但对多轮对话请求的限制太严。目前多模态输入推荐使用火山方舟的 Doubao-Seed-2.0-pro 模型,适配效果最好。 +Deep Code 支持多模态输入——你可以用 `Ctrl+V` 从剪贴板粘贴图片。但是,`deepseek-v4` 目前不支持多模态。如需多模态输入,推荐使用火山引擎的 `Doubao-Seed-2.0-pro` 模型。 -### 怎样在任务完成后自动给 Slack 发消息? +### 任务完成后如何发送 Slack 消息? -编写一个调用 Slack webhook 的 Shell 通知脚本,然后在 `~/.deepcode/settings.json` 中将 `notify` 字段设为该脚本的完整路径即可。详细步骤可参考:https://binfer.net/share/jby5xnc-so6g +编写一个调用 Slack webhook 的 shell 通知脚本,然后在 `~/.deepcode/settings.json` 中将 `notify` 字段设置为该脚本的完整路径。详情请见 [docs/configuration.md](docs/configuration.md)。 -### 怎样启用联网搜索功能? +### 如何启用网页搜索? -Deep Code自带免费的、且大部分情况够用的Web Search工具。如果你希望使用自定义脚本进行联网搜索,可以在 `~/.deepcode/settings.json` 中将 `webSearchTool` 设为脚本的完整路径即可。详细步骤可参考:https://github.com/qorzj/web_search_cli +Deep Code 内置了一个网页搜索工具,可满足大多数使用场景。如果想改用自定义脚本,请将 `~/.deepcode/settings.json` 中的 `webSearchTool` 字段设置为脚本的完整路径。 -### 是否支持 Coding Plan? +### 支持编码计划(第三方模型提供商)吗? -支持。只要把 `~/.deepcode/settings.json` 的 `env.BASE_URL` 配置为 OpenAI 兼容的接口地址就行。以火山方舟的 Coding Plan 为例: +支持。将 `~/.deepcode/settings.json` 中的 `env.BASE_URL` 设置为任何兼容 OpenAI API 的端点即可。示例请见 [docs/configuration.md](docs/configuration.md)。 -```json -{ - "env": { - "MODEL": "ark-code-latest", - "BASE_URL": "https://ark.cn-beijing.volces.com/api/coding/v3", - "API_KEY": "**************" - }, - "thinkingEnabled": true -} -``` +### 如何配置 MCP? + +完整的 MCP 设置说明请见 [docs/mcp.md](docs/mcp.md)。 -## 获取帮助 +## 贡献 -- 在 GitHub Issues 上报告错误或请求功能 (https://github.com/lessweb/deepcode-cli/issues) +欢迎提交 issue 和 pull request。对于分支特有功能,请在提交 PR 之前先在 issue 中讨论——本项目有明确的发展方向,并非所有新增功能都适合。 -## 协议 +对于底层 Deep Code CLI 的问题(非分支特有功能),请向上游提交: + -- MIT +## 许可证 -## 支持我们 +MIT。请参见 [LICENSE](LICENSE)。 -如果你觉得这个工具对你有帮助,请考虑通过以下方式支持我们: +## 致谢 -- 在 GitHub 上给我们一个 Star (https://github.com/lessweb/deepcode-cli) -- 向我们提交反馈和建议 -- 分享给你的朋友和同事 +- [Deep Code CLI](https://github.com/lessweb/deepcode-cli) by lessweb —— 本分支所基于的上游项目。 +- [claude-code-modes](https://github.com/nklisch/claude-code-modes) by nklisch —— 本分支计划功能所直接借鉴的行为调优模型。 \ No newline at end of file diff --git a/README_en.md b/README_en.md deleted file mode 100644 index dc49ae0..0000000 --- a/README_en.md +++ /dev/null @@ -1,114 +0,0 @@ -# Deep Code CLI - -[Deep Code](https://github.com/lessweb/deepcode-cli) is a terminal AI coding assistant optimized for the `deepseek-v4` model, with support for deep thinking, reasoning effort control, and Agent Skills. - -## Installation - -```bash -npm install -g @vegamo/deepcode-cli -``` - -Run `deepcode` inside any project directory to get started. - -![intro2](resources/intro2.png) - -## Configuration - -Create `~/.deepcode/settings.json`: - -```json -{ - "env": { - "MODEL": "deepseek-v4-pro", - "BASE_URL": "https://api.deepseek.com", - "API_KEY": "sk-..." - }, - "thinkingEnabled": true, - "reasoningEffort": "max" -} -``` - -The configuration file is shared with the [Deep Code VSCode extension](https://github.com/lessweb/deepcode) — configure once, use everywhere. - -## Key Features - -### **Skills** -Deep Code CLI supports agent skills that allow you to extend the assistant's capabilities: - -- **User-level Skills**: discovered and activated from `~/.agents/skills/`. -- **Project-level Skills**: loaded from `./.agents/skills/` for project-specific workflows, with legacy `./.deepcode/skills/` compatibility. - -### **Optimized for DeepSeek** -- Specifically tuned for DeepSeek model performance. -- Reduce costs by using [Context Caching](https://api-docs.deepseek.com/guides/kv_cache). -- Natively supports [Thinking Mode](https://api-docs.deepseek.com/guides/thinking_mode) and Thinking Effort Control. - -## Keyboard Shortcuts - -| Key | Action | -|-----------------|----------------------------------------------| -| `Enter` | Send the prompt | -| `Shift+Enter` | Insert a newline (also `Ctrl+J`) | -| `Ctrl+V` | Paste an image from the clipboard | -| `Esc` | Interrupt the current model turn | -| `/` | Open the skills / commands menu | -| `/new` | Start a fresh conversation | -| `/resume` | Choose a previous conversation to continue | -| `/skills` | List available skills | -| `/exit` | Quit Deep Code | -| `Ctrl+D` twice | Quit Deep Code | - -## Supported Models - -- `deepseek-v4-pro` (Recommended) -- `deepseek-v4-flash` -- Any other OpenAI-compatible model - -## FAQ - -### Does Deep Code have a VSCode extension? - -Yes. Deep Code offers a full-featured VSCode extension, available on the [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=vegamo.deepcode-vscode). The extension shares the `~/.deepcode/settings.json` configuration file with the CLI, so you can switch seamlessly between the terminal and the editor. - -### Does Deep Code support understanding images? - -Deep Code supports multimodal input — you can paste images from the clipboard with `Ctrl+V`. However, `deepseek-v4` does not support multimodal yet. Some models have multimodal capabilities but impose strict limits on multi-turn dialogue requests. For multimodal input, we recommend using the Volcano Ark `Doubao-Seed-2.0-pro` model, which has the best integration. - -### How to automatically send a Slack message after a task completes? - -Write a shell notification script that calls a Slack webhook, then set the `notify` field in `~/.deepcode/settings.json` to the full path of the script. For detailed steps, refer to: https://binfer.net/share/jby5xnc-so6g - -### How do I enable web search? - -Deep Code comes with a built-in, free Web Search tool that works well for most use cases. If you prefer to use a custom script for web search, set the `webSearchTool` field in `~/.deepcode/settings.json` to the full path of your script. For detailed steps, refer to: https://github.com/qorzj/web_search_cli - -### Does it support Coding Plan? - -Yes. Just set `env.BASE_URL` in `~/.deepcode/settings.json` to an OpenAI-compatible API endpoint. Take Volcano Ark's Coding Plan as an example: - -```json -{ - "env": { - "MODEL": "ark-code-latest", - "BASE_URL": "https://ark.cn-beijing.volces.com/api/coding/v3", - "API_KEY": "**************" - }, - "thinkingEnabled": true -} -``` - -## Getting Help - -- Report bugs or request features on GitHub Issues (https://github.com/lessweb/deepcode-cli/issues) - -## License - -- MIT - -## Support Us - -If you find this tool helpful, please consider supporting us by: - -- Giving us a Star on GitHub (https://github.com/lessweb/deepcode-cli) -- Submitting feedback and suggestions -- Sharing with your friends and colleagues diff --git a/docs/configuration.md b/docs/configuration.md index f8e52c3..c6a04c1 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,71 +1,72 @@ -# Deep Code 配置 +# Deep Code Configuration -## 配置层级 +## Configuration Hierarchy -配置按以下优先级顺序应用(数字较小的会被数字较大的覆盖): +Configuration is applied in the following priority order (lower-numbered sources are overridden by higher-numbered ones): -| 层级 | 配置来源 | 说明 | -| ---- | ------------ | ------------------------------------------- | -| 1 | 默认值 | 应用程序内硬编码的默认值 | -| 2 | 用户设置文件 | 当前用户的全局设置 | -| 3 | 项目设置文件 | 项目特定的设置 | -| 4 | 环境变量 | 系统范围或会话特定的变量 | +| Layer | Configuration Source | Description | +| ----- | -------------------- | ---------------------------------------------- | +| 1 | Defaults | Hardcoded defaults within the application | +| 2 | User settings file | Global settings for the current user | +| 3 | Project settings file| Project-specific settings | +| 4 | Environment variables| System-wide or session-specific variables | -## 设置文件 +## Settings File -Deep Code 使用 `settings.json` 设置文件进行持久化配置,支持两个层级的存放位置: +Deep Code uses the `settings.json` file for persistent configuration, supporting two storage locations: -| 文件类型 | 位置 | 作用范围 | -| ------------ | ---------------------------------- | ---------------------------------------------------- | -| 用户设置文件 | `~/.deepcode/settings.json` | 适用于当前用户的所有 Deep Code 会话。 | -| 项目设置文件 | `项目根目录/.deepcode/settings.json` | 仅在该特定项目中运行 Deep Code 时生效。项目设置会覆盖用户设置。 | +| File Type | Location | Scope | +| ------------------- | ----------------------------------------- | --------------------------------------------------------------------- | +| User settings file | `~/.deepcode/settings.json` | Applies to all Deep Code sessions for the current user. | +| Project settings file | `/.deepcode/settings.json` | Takes effect only when running Deep Code in that specific project. Project settings override user settings. | -### `settings.json` 中的可用设置 +### Available Settings in `settings.json` -以下是 `settings.json` 支持的全部顶层字段,以及 `env` 内部支持的子字段: +The following are all the top-level fields supported in `settings.json`, along with the sub-fields inside `env`: -| 字段 | 类型 | 说明 | -| -------------------- | --------- | ------------------------------------------------------------------- | -| `env` | object | 环境变量分组(见下方子字段表) | -| `model` | string | 模型名称。优先级高于 `env.MODEL` | -| `thinkingEnabled` | boolean | 是否启用思考模式(DeepSeek V4 系列默认启用) | -| `reasoningEffort` | string | 推理强度,可选 `"high"` 或 `"max"`(默认 `"max"`) | -| `debugLogEnabled` | boolean | 是否启用调试日志输出(默认 `false`) | -| `notify` | string | 任务完成通知脚本的完整路径(如 Slack 通知脚本) | -| `webSearchTool` | string | 自定义联网搜索脚本的完整路径 | -| `mcpServers` | object | MCP 服务器配置(键为服务名,值为 McpServerConfig 对象) | +| Field | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------- | +| `env` | object | Group of environment variables (see sub-field table below) | +| `model` | string | Model name. Takes precedence over `env.MODEL` | +| `thinkingEnabled` | boolean | Whether to enable thinking mode (enabled by default for DeepSeek V4 series)| +| `reasoningEffort` | string | Reasoning intensity, either `"high"` or `"max"` (default `"max"`) | +| `debugLogEnabled` | boolean | Enable debug log output (default `false`) | +| `notify` | string | Full path to a task-completion notification script (e.g., Slack notification script) | +| `webSearchTool` | string | Full path to a custom web search script | +| `systemPromptFile` | string | Path to a file containing a replacement system prompt (see section below) | +| `mcpServers` | object | MCP server configurations (keys are service names, values are McpServerConfig objects) | -#### `env` 子字段 +#### `env` Sub-fields -| 字段 | 类型 | 说明 | -| ---------- | ------ | ------------------------------------------------------------------ | -| `MODEL` | string | 模型名称。例如 `"deepseek-v4-pro"`、`"deepseek-v4-flash"` | -| `BASE_URL` | string | API 请求的基础 URL。例如 `"https://api.deepseek.com"` | -| `API_KEY` | string | API 密钥 | -| `THINKING_ENABLED` | string | 是否启用思考模式 | -| `REASONING_EFFORT` | string | 推理强度 | -| `DEBUG_LOG_ENABLED` | string | 是否启用调试日志输出 | -| `<其他任意KEY>` | string | 自定义环境变量 | +| Field | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------- | +| `MODEL` | string | Model name, e.g. `"deepseek-v4-pro"`, `"deepseek-v4-flash"` | +| `BASE_URL` | string | Base URL for API requests, e.g. `"https://api.deepseek.com"` | +| `API_KEY` | string | API key | +| `THINKING_ENABLED`| string | Enable thinking mode | +| `REASONING_EFFORT`| string | Reasoning intensity | +| `DEBUG_LOG_ENABLED`| string| Enable debug log output | +| `` | string | Custom environment variable | -#### `thinkingEnabled` — 思考模式 +#### `thinkingEnabled` — Thinking Mode -是否启用 DeepSeek 思考模式。设置为 `true` 启用、`false` 禁用。 +Whether to enable DeepSeek thinking mode. Set to `true` to enable, `false` to disable. -- 对于 `deepseek-v4-pro` 和 `deepseek-v4-flash`,思考模式**默认启用**。 -- 对于其他模型,思考模式**默认关闭**。 +- For `deepseek-v4-pro` and `deepseek-v4-flash`, thinking mode is **enabled by default**. +- For other models, thinking mode is **disabled by default**. -#### `reasoningEffort` — 推理强度 +#### `reasoningEffort` — Reasoning Intensity -当思考模式启用时,控制模型思考的深度: +When thinking mode is enabled, controls the depth of the model’s reasoning: -| 值 | 说明 | -| ------ | --------------------------------- | -| `max` | 最大推理深度(默认值) | -| `high` | 较高推理深度,token消耗相对较小 | +| Value | Description | +| ------ | --------------------------------------------------------- | +| `max` | Maximum reasoning depth (default) | +| `high` | Higher reasoning depth with relatively lower token usage | -#### `notify` — 任务完成通知 +#### `notify` — Task Completion Notification -设置一个 Shell 脚本的完整路径。当 AI 助手完成一轮任务后,会自动执行该脚本,可用于发送通知(如 Slack 消息)。 +Set a full path to a shell script. When the AI assistant finishes a round of tasks, the script is executed automatically, which can be used to send notifications (e.g., a Slack message). ```json { @@ -73,9 +74,9 @@ Deep Code 使用 `settings.json` 设置文件进行持久化配置,支持两 } ``` -#### `webSearchTool` — 自定义联网搜索 +#### `webSearchTool` — Custom Web Search -Deep Code 内置免费可用的 Web Search 工具。如果需要自定义搜索逻辑,可将 `webSearchTool` 设为一个可执行脚本的完整路径: +Deep Code has a built-in, free-to-use Web Search tool. If you need custom search logic, set `webSearchTool` to the full path of an executable script: ```json { @@ -83,16 +84,32 @@ Deep Code 内置免费可用的 Web Search 工具。如果需要自定义搜索 } ``` -脚本接收一个搜索查询参数,输出 JSON 格式的结果供 AI 使用。 +The script receives a search query as an argument and outputs results in JSON format for the AI. -#### `mcpServers` — MCP 服务器 +#### `systemPromptFile` — System Prompt Replacement -MCP(Model Context Protocol)服务器配置。值是键值对,键为服务名称,值为服务器配置对象。 +By default, Deep Code uses its built-in system prompt. To replace it with custom content, set `systemPromptFile` to a file path: + +```json +{ + "systemPromptFile": "/path/to/my-system-prompt.md" +} +``` + +The path is resolved relative to the project root (for project-level settings) or treated as an absolute path. Environment variable support is also available via `DEEPCODE_SYSTEM_PROMPT_FILE`. + +When set, the file content replaces the built-in base system prompt. Tool documentation, runtime context, AGENTS.md instructions, skills, and the drift-guard skill continue to load after the replacement — tool calling is preserved. + +If the file cannot be read (wrong path, permissions issue, deleted file), Deep Code exits with an error. It does **not** silently fall back to the default prompt. + +#### `mcpServers` — MCP Servers + +Configuration for MCP (Model Context Protocol) servers. The value is a key-value pair, where the key is the service name and the value is a server configuration object. ```json { "mcpServers": { - "<服务名>": { + "": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { @@ -103,71 +120,70 @@ MCP(Model Context Protocol)服务器配置。值是键值对,键为服务 } ``` -| McpServerConfig 字段 | 类型 | 必填 | 说明 | -| -------------------- | -------- | ---- | -------------------------------------------------------------------- | -| `command` | string | 是 | 可执行文件路径或命令(如 `npx`、`node`、`python`) | -| `args` | string[] | 否 | 传递给命令的参数列表 | -| `env` | object | 否 | 传递给 MCP 服务器进程的环境变量 | - -> 当 `command` 为 `npx` 时,Deep Code 会自动在参数前补充 `-y`。 +| McpServerConfig field | Type | Required | Description | +| --------------------- | -------- | -------- | ------------------------------------------------------------------------ | +| `command` | string | Yes | Executable path or command (e.g. `npx`, `node`, `python`) | +| `args` | string[] | No | List of arguments passed to the command | +| `env` | object | No | Environment variables passed to the MCP server process | -详细 MCP 使用说明请参考 [mcp.md](mcp.md)。 +> When `command` is `npx`, Deep Code automatically prepends `-y` to the arguments. +For detailed MCP usage instructions, refer to [mcp.md](mcp.md). -#### `debugLogEnabled` — 调试日志 +#### `debugLogEnabled` — Debug Log -设为 `true` 可让程序输出详细的调试日志(默认 `false`),用于排查 API 调用和工具执行的问题。 +Set to `true` to enable detailed debug logging (default `false`), useful for troubleshooting API calls and tool execution. -## 环境变量优先级 +## Environment Variable Priority -环境变量是配置应用程序的常用方式,尤其适用于敏感信息(如 api-key)或可能在不同环境之间更改的设置。 +Environment variables are a common way to configure applications, especially for sensitive information (such as api-key) or settings that may change between environments. -### 优先级原则 +### Priority Principle -环境变量优先级遵循“越具体、越局部的配置,优先级越高”和“env文件默认保护现有环境,系统变量高于env文件”的覆盖逻辑。(settings.json的env对象可以认为是一种env文件) +Environment variable priority follows the logic of “the more specific and localized the configuration, the higher the priority”, and the override rule of “env files protect existing environment by default, system variables override env files”. (The `env` object in settings.json can be thought of as a type of env file.) -优先级层级 (由低到高) -1. settings.json 外层的 env:这是针对整个工具及其所有子进程的通用配置(全局变量)。可被外层环境变量覆盖,但环境变量KEY会移除`DEEPCODE_`前缀。 -2. settings.json mcpServers 内定义的 env:这是针对特定 MCP 服务的最具体配置(局部变量)。可被外层环境变量覆盖,但环境变量KEY会移除`MCP_`前缀。 -3. Shell 环境系统变量:操作系统层面的环境变量。 +Priority levels (from lowest to highest): +1. `env` defined at the top level of `settings.json` – this is a general configuration for the entire tool and all its subprocesses (global variables). Can be overridden by outer environment variables, but the environment variable KEY has the `DEEPCODE_` prefix removed. +2. `env` defined inside `mcpServers` in `settings.json` – this is the most specific configuration for a particular MCP service (local variables). Can be overridden by outer environment variables, but the KEY has the `MCP_` prefix removed. +3. Shell/system environment variables – operating system level. -### 场景 +### Scenarios -#### 一、设置模型的api_key, base_url +#### 1. Setting the model’s api_key and base_url -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以api_key为例): +Applied in the following priority order (lower-numbered sources are overridden by higher-numbered ones) – using api_key as an example: -1. 硬编码默认值: `""` -2. 用户级settings.json: `{"env": {"API_KEY": "abc123"}}` -3. 项目级settings.json: `{"env": {"API_KEY": "abc123"}}` -4. 系统环境变量: `DEEPCODE_API_KEY=abc123 deepcode` +1. Hardcoded default: `""` +2. User-level settings.json: `{"env": {"API_KEY": "abc123"}}` +3. Project-level settings.json: `{"env": {"API_KEY": "abc123"}}` +4. System environment variable: `DEEPCODE_API_KEY=abc123 deepcode` -#### 二、设置模型的model, thinkingEnabled, reasoningEffort +#### 2. Setting model, thinkingEnabled, and reasoningEffort -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以thinkingEnabled为例): +Applied in the following priority order (lower-numbered overridden by higher-numbered) – using thinkingEnabled as an example: -1. 硬编码默认值: `true` -2. 用户级settings.json: `{"env": {"THINKING_ENABLED": "true"}}` -3. 用户级settings.json: `{"thinkingEnabled": true}` -4. 项目级settings.json: `{"env": {"THINKING_ENABLED": "true"}}` -5. 项目级settings.json: `{"thinkingEnabled": true}` -6. 系统环境变量: `DEEPCODE_THINKING_ENABLED=true deepcode` +1. Hardcoded default: `true` +2. User-level settings.json: `{"env": {"THINKING_ENABLED": "true"}}` +3. User-level settings.json: `{"thinkingEnabled": true}` +4. Project-level settings.json: `{"env": {"THINKING_ENABLED": "true"}}` +5. Project-level settings.json: `{"thinkingEnabled": true}` +6. System environment variable: `DEEPCODE_THINKING_ENABLED=true deepcode` -#### 三、设置启动notify, webSearchTool等外挂脚本的环境变量 +#### 3. Setting environment variables for external scripts like notify and webSearchTool -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以notify为例): +Applied in the following priority order (lower-numbered overridden by higher-numbered) – using notify as an example: -1. 硬编码默认值:`os.environ.get('WEBHOOK', '...') # notify脚本代码` -2. 用户级settings.json: `{"env": {"WEBHOOK": "..."}}` -3. 项目级settings.json: `{"env": {"WEBHOOK": "true"}}` -4. 系统环境变量: `DEEPCODE_WEBHOOK=... deepcode` +1. Hardcoded default: `os.environ.get('WEBHOOK', '...') # notify script code` +2. User-level settings.json: `{"env": {"WEBHOOK": "..."}}` +3. Project-level settings.json: `{"env": {"WEBHOOK": "true"}}` +4. System environment variable: `DEEPCODE_WEBHOOK=... deepcode` -#### 四、设置MCP Service的环境变量 +#### 4. Setting environment variables for an MCP Service -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以github MCP server为例): +Applied in the following priority order (lower-numbered overridden by higher-numbered) – using a GitHub MCP server as an example: -1. 用户级settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` -2. 用户级settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` -3. 项目级settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` -4. 项目级settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` -5. 系统环境变量: `DEEPCODE_MCP_GITHUB_PERSONAL_ACCESS_TOKEN=... deepcode` +1. User-level settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` +2. User-level settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` +3. Project-level settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` +4. Project-level settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` +5. System environment variable: `DEEPCODE_MCP_GITHUB_PERSONAL_ACCESS_TOKEN=... deepcode` \ No newline at end of file diff --git a/docs/mcp.md b/docs/mcp.md index fe6711d..11adda5 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1,22 +1,22 @@ -# Deep Code CLI MCP 配置指南 +# Deep Code CLI MCP Configuration Guide -Deep Code CLI 支持 MCP(Model Context Protocol),让 AI 助手能够连接外部工具和服务,如 GitHub、浏览器、数据库等。 +Deep Code CLI supports MCP (Model Context Protocol), enabling AI assistants to connect with external tools and services such as GitHub, browsers, databases, and more. -## 概述 +## Overview -配置 MCP 后,Deep Code 可以: +Once MCP is configured, Deep Code can: -- 操作 GitHub 仓库(查看 Issues、创建 PR、搜索代码等) -- 操控浏览器(截图、点击、填表单等) -- 访问文件系统 -- 连接数据库和 API -- ...以及任何兼容 MCP 协议的外部服务 +- Operate on GitHub repositories (view issues, create PRs, search code, etc.) +- Control browsers (screenshots, clicks, form filling, etc.) +- Access the file system +- Connect to databases and APIs +- ...and any external service compatible with the MCP protocol -MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`,例如 `mcp__github__search_code`。 +MCP tools are named in Deep Code using the format `mcp____`, for example `mcp__github__search_code`. -## 配置 MCP 服务器 +## Configuring MCP Servers -编辑 `~/.deepcode/settings.json`,添加 `mcpServers` 字段: +Edit `~/.deepcode/settings.json` and add the `mcpServers` field: ```json { @@ -28,30 +28,30 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, "thinkingEnabled": true, "reasoningEffort": "max", "mcpServers": { - "<服务名称>": { - "command": "<可执行文件>", - "args": ["<参数1>", "<参数2>"], + "": { + "command": "", + "args": ["", ""], "env": { - "<环境变量>": "<值>" + "": "" } } } } ``` -### 配置项说明 +### Configuration Fields -| 字段 | 类型 | 必填 | 说明 | -| --------- | -------- | ---- | ---------------------------------------------------------------------------------------------------------------------- | -| `command` | string | 是 | MCP 服务器的可执行文件路径或命令(如 `npx`、`node`、`python`)。当命令是 `npx` 时,Deep Code 会自动在参数前补充 `-y`。 | -| `args` | string[] | 否 | 传递给命令的参数列表 | -| `env` | object | 否 | 传递给 MCP 服务器进程的环境变量(如 API Key) | +| Field | Type | Required | Description | +| --------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `command` | string | Yes | Path or command of the MCP server executable (e.g., `npx`, `node`, `python`). When the command is `npx`, Deep Code automatically prepends `-y` to the arguments. | +| `args` | string[] | No | List of arguments to pass to the command | +| `env` | object | No | Environment variables (e.g., API keys) to pass to the MCP server process | -## 常用 MCP 示例 +## Common MCP Examples ### GitHub MCP -让 Deep Code 直接操作 GitHub 仓库(搜索代码、管理 Issue/PR、读写文件等): +Allows Deep Code to directly operate on GitHub repositories (search code, manage issues/PRs, read/write files, etc.): ```json { @@ -67,11 +67,11 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -> GitHub Personal Access Token 可在 [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens) 生成。 +> Generate a GitHub Personal Access Token at [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens). -### 浏览器控制(Playwright) +### Browser Control (Playwright) -让 Deep Code 操控浏览器进行截图、页面操作等: +Lets Deep Code control a browser for screenshots, page interactions, etc.: ```json { @@ -84,9 +84,9 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -### 文件系统 +### File System -让 Deep Code 在指定目录中读写文件: +Enables Deep Code to read and write files within a specified directory: ```json { @@ -99,7 +99,7 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -### 自定义 Python MCP +### Custom Python MCP ```json { @@ -115,9 +115,9 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -## 完整配置示例 +## Full Configuration Example -以下是一个配置了 GitHub 和 Playwright 两个 MCP 服务器的完整 `~/.deepcode/settings.json`: +Below is a complete `~/.deepcode/settings.json` with both GitHub and Playwright MCP servers configured: ```json { @@ -144,62 +144,62 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -## 使用 MCP +## Using MCP -配置完成后,启动 `deepcode`,使用 `/mcp` 命令管理 MCP 连接: +After configuration, start `deepcode` and use the `/mcp` command to manage MCP connections: -- `/mcp` — 查看已配置的 MCP 服务器状态 -- `/mcp add` — 添加新的 MCP 服务器 -- `/mcp remove` — 移除 MCP 服务器 -- `/mcp list` — 列出所有已连接的 MCP 服务器及其工具 +- `/mcp` — View the status of configured MCP servers +- `/mcp add` — Add a new MCP server +- `/mcp remove` — Remove an MCP server +- `/mcp list` — List all connected MCP servers and their tools -在对话中直接使用 MCP 工具名称即可调用,例如: +Simply use the MCP tool name in your conversation to invoke it, for example: ``` -帮我搜索 GitHub 上 deepcode-cli 仓库的 issues +Help me search for issues in the deepcode-cli repository on GitHub ``` -AI 会自动调用 `mcp__github__search_issues` 工具完成操作。 +The AI will automatically invoke the `mcp__github__search_issues` tool to complete the action. -## 工具命名规则 +## Tool Naming Convention -MCP 工具名称由三部分组成:`mcp__<服务名>__<工具名>` +An MCP tool name consists of three parts: `mcp____` -| 服务名 | 工具名 | 完整调用名 | -| ---------- | ----------------------- | ------------------------------------------ | -| github | search_code | `mcp__github__search_code` | -| github | create_pull_request | `mcp__github__create_pull_request` | -| playwright | browser_navigate | `mcp__playwright__browser_navigate` | -| playwright | browser_take_screenshot | `mcp__playwright__browser_take_screenshot` | +| Service | Tool Name | Full Invocation Name | +| ---------- | ----------------------- | ------------------------------------------- | +| github | search_code | `mcp__github__search_code` | +| github | create_pull_request | `mcp__github__create_pull_request` | +| playwright | browser_navigate | `mcp__playwright__browser_navigate` | +| playwright | browser_take_screenshot | `mcp__playwright__browser_take_screenshot` | -你可以通过 `/mcp list` 查看每个服务器提供的具体工具列表。 +You can view the list of tools provided by each server using `/mcp list`. -## 故障排查 +## Troubleshooting -### 启动失败 +### Startup Failure -如果 MCP 服务器无法启动,检查: +If an MCP server fails to start, check: -1. `command` 是否已安装(如 `npx` 需要 Node.js) -2. `env` 中的环境变量是否正确(如 `GITHUB_PERSONAL_ACCESS_TOKEN`) -3. 运行 `deepcode` 的终端是否有网络访问权限 +1. Whether `command` is installed (e.g., `npx` requires Node.js) +2. Whether environment variables in `env` are correct (e.g., `GITHUB_PERSONAL_ACCESS_TOKEN`) +3. Whether the terminal running `deepcode` has network access -### 工具不显示 +### Tools Not Showing Up -1. 确认 `settings.json` 中的 `mcpServers` 字段格式正确 -2. 启动 deepcode 后使用 `/mcp` 查看服务器状态 -3. 如果服务器状态显示错误,根据错误信息排查 +1. Verify that the `mcpServers` field in `settings.json` is correctly formatted +2. After starting deepcode, use `/mcp` to check server status +3. If the server status shows an error, debug based on the error message -### Windows 用户 +### Windows Users -在 Windows 上,Deep Code CLI 会自动为 `.cmd` 命令添加 shell 支持。如果你的 MCP 命令是批处理脚本,确保文件名以 `.cmd` 结尾。 +On Windows, Deep Code CLI automatically adds shell support for `.cmd` commands. If your MCP command is a batch script, ensure the filename ends with `.cmd`. -## 编写你自己的 MCP 服务器 +## Writing Your Own MCP Server -MCP 服务器遵循 [Model Context Protocol](https://modelcontextprotocol.io/) 规范,使用 JSON-RPC 2.0 通信。你可以用任何语言编写 MCP 服务器,只要实现以下协议即可: +MCP servers follow the [Model Context Protocol](https://modelcontextprotocol.io/) specification and communicate using JSON‑RPC 2.0. You can write an MCP server in any language as long as it implements the following methods: -1. `initialize` — 握手和协议协商 -2. `tools/list` — 返回可用工具列表 -3. `tools/call` — 执行工具调用 +1. `initialize` — Handshake and protocol negotiation +2. `tools/list` — Return the list of available tools +3. `tools/call` — Execute a tool call -更多参考:[MCP 官方文档](https://modelcontextprotocol.io/) +For more information, see the [official MCP documentation](https://modelcontextprotocol.io/). \ No newline at end of file diff --git a/docs/translation-inventory.md b/docs/translation-inventory.md new file mode 100644 index 0000000..cbbc020 --- /dev/null +++ b/docs/translation-inventory.md @@ -0,0 +1,179 @@ +# Translation Inventory + +Generated: Session 1 — repository-wide scan of human-readable text files. +Purpose: Scope off-API translation work before Session 2. + +## Summary + +- **Total files inventoried**: 70 (10 documentation/text files + 60 TypeScript source files) +- **Files needing fresh translation**: 2 (`docs/configuration.md`, `docs/mcp.md` — Chinese only, no English counterpart exists) +- **Files needing English update**: 3 (`README.md` → `README_en.md` is stale, `README_cn.md` → `README_en.md` is stale) +- **Files in English already, no action needed**: 8 (all `docs/tools/*.md`, `.deepcode/AGENTS.md`, `docs/prompts/init_command.md.ejs`, `.husky/pre-commit`) +- **Files with mixed comments (CJK in src/)**: 5 source files with some Chinese in comments or test strings + +### Key surprises + +1. **Three READMEs, three different states**: `README.md` (Chinese) has a "New Features in this Fork" section about MCP that neither `README_cn.md` nor `README_en.md` contain. `README_cn.md` and `README_en.md` mirror each other structurally but `README_en.md` is missing the "How to configure MCP?" FAQ entry present in `README.md`. +2. **`docs/` and `docs/tools/` are different**: `docs/configuration.md` and `docs/mcp.md` are Chinese-only. The six `docs/tools/*.md` files are all English-only — they're tool descriptions injected directly into LLM system prompts. +3. **No English documentation exists** for the MCP feature or configuration details. The English README links to `docs/mcp.md` which is in Chinese only. +4. **src/ has very little Chinese**: Only 5 of 60 source files contain any CJK characters, and those are mostly in comments (SlashCommandMenu.tsx) or test fixture strings (session.test.ts). No code identifiers or string literals visible to users are in Chinese. + +--- + +## 1. Root README Files + +| File | Language | Sync status | Action needed | Size | Notes | +|------|----------|-------------|---------------|------|-------| +| `README.md` | Chinese | — | Create/update English counterpart | 132 lines, ~740 CJK chars | Default README shown on GitHub. Has "🚀 New Features (This Fork)" MCP section at top. Contains an "How to configure MCP?" FAQ entry. Links to `docs/mcp.md`. | +| `README_cn.md` | Chinese | Drifted from `README.md` — missing the "New Features (This Fork)" MCP section | Sync with `README.md` first, then translate to English | 115 lines, ~584 CJK chars | Pure upstream Chinese README (no fork features). Matches `README_en.md` in structure. Missing the MCP section. | +| `README_en.md` | English | Drifted from `README.md` — same content as `README_cn.md` (upstream scope only) | Update with fork features + missing MCP FAQ | 114 lines | Stale English README. Matches `README_cn.md` structure but missing: fork feature announcement, MCP FAQ entry. Links to `docs/mcp.md` which is Chinese-only. | + +**Recommended next step for READMEs**: Consolidate into one true-source approach: +- Option A: Keep `README.md` as the Chinese original with fork features, sync `README_cn.md` to match, then regenerate `README_en.md` from the synced Chinese. +- Option B: Write a new `README.md` in English, deprecate `README_en.md`, keep `README_cn.md` as the Chinese translation. + +--- + +## 2. Documentation Files (`docs/`) + +| File | Language | Sync status | Action needed | Size | Notes | +|------|----------|-------------|---------------|------|-------| +| `docs/configuration.md` | Chinese (with embedded English terms) | N/A — no English version exists | **Fresh translation to English** | 173 lines, ~1169 CJK chars | Details on settings file, config hierarchy, all supported fields. Referenced from README. | +| `docs/mcp.md` | Chinese (with embedded English terms) | N/A — no English version exists | **Fresh translation to English** | 205 lines, ~639 CJK chars | MCP configuration guide for the fork's new feature. Referenced from `README.md` and (incorrectly) from `README_en.md`. | +| `docs/prompts/init_command.md.ejs` | English | N/A — single language | None | 44 lines | EJS template for generating `AGENTS.md`. Feeds into LLM prompts. Pure English. | + +--- + +## 3. Tool Description Files (`docs/tools/`) + +All six files are **English only**, injected directly into the LLM system prompt by `src/prompt.ts` (see `readToolDocs()` function). No translation needed. + +| File | Language | Action needed | Size | Notes | +|------|----------|---------------|------|-------| +| `docs/tools/bash.md` | English | None | 71 lines | Tool definition + JSON schema for the bash tool | +| `docs/tools/read.md` | English | None | 48 lines | Tool definition + JSON schema for the read tool | +| `docs/tools/edit.md` | English | None | 53 lines | Tool definition + JSON schema for the edit tool | +| `docs/tools/write.md` | English | None | 35 lines | Tool definition + JSON schema for the write tool | +| `docs/tools/web-search.md` | English | None | 28 lines | Tool definition + JSON schema for the web-search tool | +| `docs/tools/ask-user-question.md` | English | None | 12 lines | Tool definition + JSON schema for the AskUserQuestion tool | + +--- + +## 4. Other Text Files + +| File | Language | Action needed | Size | Notes | +|------|----------|---------------|------|-------| +| `.deepcode/AGENTS.md` | English | None | 109 lines | Repository guidelines for the LLM agent. Heavy overlap with this very inventory document's instructions. | +| `.husky/pre-commit` | English | None | 1 line | Runs `npx lint-staged`. Only text is `npx lint-staged`. | + +--- + +## 5. Source Files (`src/`) — Comment Language Status + +All `.ts` and `.tsx` files in `src/`. For each file, the report column indicates whether code comments or string literals contain Chinese characters. + +### Files with Chinese in comments or test strings (5 of 60) + +| File | CJK Count | Context | Language | Notes | +|------|-----------|---------|----------|-------| +| `src/ui/SlashCommandMenu.tsx` | 66 | Comments | Mixed (Chinese comments, English code) | 3 Chinese comments about layout calculation logic. The code itself is English identifiers. | +| `src/ui/App.tsx` | 25 | Comments | Mixed (Chinese comments, English code) | 2 Chinese comments about `` index behavior. | +| `src/tests/session.test.ts` | 7 | Test fixture strings | Mixed (English code, CJK in test data) | Contains `"星期四"` (Thursday) in a mock output and `"思考"` (thinking) as test assertion values. | +| `src/tests/promptInputKeys.test.ts` | 2 | Test fixture strings | Mixed (English code, CJK in test data) | Contains `"你好"` (hello) as test input for cursor placement. | +| `src/ui/MessageView.tsx` | 1 | Code line | Mixed (English code, single CJK character) | Contains `":"` (Chinese colon) check — `result.endsWith(":")` — for CJK punctuation handling. | + +### Files with no Chinese characters (55 of 60) + +All remaining `src/` files are pure English in both code and comments. Full listing: + +**Core modules (13 files):** +- `src/cli.tsx` (117 lines) +- `src/session.ts` (2125 lines) +- `src/settings.ts` (275 lines) +- `src/prompt.ts` (618 lines) +- `src/model-capabilities.ts` (5 lines) +- `src/AsciiArt.ts` (8 lines) +- `src/debug-logger.ts` (82 lines) +- `src/error-logger.ts` (129 lines) +- `src/notify.ts` (68 lines) +- `src/openai-thinking.ts` (25 lines) +- `src/updateCheck.ts` (296 lines) + +**Common modules (4 files):** +- `src/common/file-utils.ts` (143 lines) +- `src/common/runtime.ts` (74 lines) +- `src/common/shell-utils.ts` (187 lines) +- `src/common/state.ts` (153 lines) + +**MCP modules (2 files):** +- `src/mcp/mcp-client.ts` (239 lines) +- `src/mcp/mcp-manager.ts` (213 lines) + +**Tool handlers (7 files):** +- `src/tools/executor.ts` (257 lines) +- `src/tools/bash-handler.ts` (262 lines) +- `src/tools/read-handler.ts` (650 lines) +- `src/tools/write-handler.ts` (168 lines) +- `src/tools/edit-handler.ts` (838 lines) +- `src/tools/web-search-handler.ts` (388 lines) +- `src/tools/ask-user-question-handler.ts` (148 lines) + +**UI modules (14 files):** +- `src/ui/App.tsx` (653 lines) — *noted above for Chinese comments* +- `src/ui/AskUserQuestionPrompt.tsx` (274 lines) +- `src/ui/MessageView.tsx` (337 lines) — *noted above for Chinese colon check* +- `src/ui/PromptInput.tsx` (892 lines) +- `src/ui/SessionList.tsx` (187 lines) +- `src/ui/SlashCommandMenu.tsx` (76 lines) — *noted above for Chinese comments* +- `src/ui/WelcomeScreen.tsx` (133 lines) +- `src/ui/UpdatePrompt.tsx` (82 lines) +- `src/ui/ThemedGradient.tsx` (30 lines) +- `src/ui/askUserQuestion.ts` (133 lines) +- `src/ui/clipboard.ts` (158 lines) +- `src/ui/exitSummary.ts` (130 lines) +- `src/ui/index.ts` (83 lines) +- `src/ui/loadingText.ts` (70 lines) +- `src/ui/markdown.ts` (117 lines) +- `src/ui/promptBuffer.ts` (192 lines) +- `src/ui/slashCommands.ts` (95 lines) +- `src/ui/thinkingState.ts` (23 lines) +- `src/ui/prompt/cursor.ts` (262 lines) +- `src/ui/prompt/index.ts` (10 lines) +- `src/ui/prompt/useTerminalInput.ts` (139 lines) + +**Test files (20 files):** All pure English. + +--- + +## 6. Action Summary + +| Action | Files | Notes | +|--------|-------|-------| +| **Fresh translation (Chinese → English)** | `docs/configuration.md`, `docs/mcp.md` | No English version exists at all. These are the highest priority — the English README links to them but they're Chinese-only. | +| **Update existing English** | `README_en.md` | Must be synced with the fork's new features (MCP section) and the MCP FAQ entry. | +| **Sync Chinese READMEs** | `README_cn.md` | Before or alongside translation — needs the fork feature section added to match `README.md`. | +| **Verify / no action** | All `docs/tools/*.md`, `.deepcode/AGENTS.md`, `docs/prompts/init_command.md.ejs`, `.husky/pre-commit` | Already in English. | +| **No action (source code)** | All 55 pure-English `src/` files | Code is code — comments are developer-facing, not user-facing. The 5 files with sparse CJK in comments/test strings are negligible and do not need translation. | + +### Priority order for translation work + +1. `README_cn.md` — sync with `README.md` (add fork features section) +2. `README_en.md` — update from synced `README_cn.md` or `README.md` +3. `docs/mcp.md` — fresh English translation (referenced from both READMEs) +4. `docs/configuration.md` — fresh English translation (referenced from both READMEs) + +--- + +## Resolution — Session 2 + +All translations placed, file structure finalized. + +| Inventory entry | Action taken | Commit | +|---|---|---| +| `docs/configuration.md` — fresh translation (Chinese → English) | Staging file `docs/en-configuration.md` copied over upstream Chinese original; staging file deleted. | `b0854ad` | +| `docs/mcp.md` — fresh translation (Chinese → English) | Staging file `docs/en-mcp.md` copied over upstream Chinese original; staging file deleted. | `b0854ad` | +| `README.md` (upstream Chinese) — create English counterpart | New English `README.md` authored by operator (staged as `docs/README-en.md`) moved to repo root, replacing upstream Chinese original. | `14b3c49` | +| `README_cn.md` (upstream Chinese, stale) — sync with fork features | Fork-aware Chinese translation (staged as `docs/cn-readme.md`) moved to repo root as `README_cn.md`, replacing upstream stale copy. | `14b3c49` | +| `README_en.md` — update or remove | Deleted. `README.md` is now the canonical English README, making the separate `README_en.md` convention redundant. | N/A — file was untracked, so deletion is not in git history. | +| All `docs/tools/*.md`, `.deepcode/AGENTS.md`, `docs/prompts/init_command.md.ejs`, `.husky/pre-commit` | No action needed (already English). | — | +| All 55 pure-English `src/` files | No action needed. | — | diff --git a/src/prompt.ts b/src/prompt.ts index f8df085..9d95f12 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -274,10 +274,29 @@ function readToolDocs(extensionRoot: string, _options: PromptToolOptions = {}): return docs.join("\n\n"); } -export function getSystemPrompt(projectRoot: string, options: PromptToolOptions = {}): string { +export function getSystemPrompt( + projectRoot: string, + options: PromptToolOptions = {}, + systemPromptFile?: string +): string { + let basePrompt: string; + + if (systemPromptFile) { + const resolvedPath = path.resolve(projectRoot, systemPromptFile); + try { + basePrompt = fs.readFileSync(resolvedPath, "utf8").trim(); + } catch (err) { + throw new Error( + `Failed to read systemPromptFile at ${resolvedPath}: ${err instanceof Error ? err.message : String(err)}` + ); + } + } else { + basePrompt = SYSTEM_PROMPT_BASE; + } + const toolDocs = readToolDocs(getExtensionRoot(), options); - const basePrompt = toolDocs ? `${SYSTEM_PROMPT_BASE}\n\n# Available Tools\n\n${toolDocs}` : SYSTEM_PROMPT_BASE; - return `${basePrompt}\n\n${getRuntimeContext(projectRoot)}`; + const promptWithTools = toolDocs ? `${basePrompt}\n\n# Available Tools\n\n${toolDocs}` : basePrompt; + return `${promptWithTools}\n\n${getRuntimeContext(projectRoot)}`; } export function getCompactPrompt(sessionMessages: SessionMessage[]): string { diff --git a/src/session.ts b/src/session.ts index 4c42f81..de794ed 100644 --- a/src/session.ts +++ b/src/session.ts @@ -155,7 +155,11 @@ export type SkillInfo = { type SessionManagerOptions = { projectRoot: string; createOpenAIClient: CreateOpenAIClient; - getResolvedSettings: () => { webSearchTool?: string; mcpServers?: Record }; + getResolvedSettings: () => { + webSearchTool?: string; + systemPromptFile?: string; + mcpServers?: Record; + }; renderMarkdown: (text: string) => string; onAssistantMessage: (message: SessionMessage, shouldConnect: boolean) => void; onSessionEntryUpdated?: (entry: SessionEntry) => void; @@ -174,7 +178,11 @@ export type LlmStreamProgress = { export class SessionManager { private readonly projectRoot: string; private readonly createOpenAIClient: CreateOpenAIClient; - private readonly getResolvedSettings: () => { webSearchTool?: string; mcpServers?: Record }; + private readonly getResolvedSettings: () => { + webSearchTool?: string; + systemPromptFile?: string; + mcpServers?: Record; + }; private readonly onAssistantMessage: (message: SessionMessage, shouldConnect: boolean) => void; private readonly onSessionEntryUpdated?: (entry: SessionEntry) => void; private readonly onLlmStreamProgress?: (progress: LlmStreamProgress) => void; @@ -846,7 +854,11 @@ The candidate skills are as follows:\n\n`; this.saveSessionsIndex(index); this.removeSessionMessages(droppedEntries.map((item) => item.id)); - const systemPrompt = getSystemPrompt(this.projectRoot, this.getPromptToolOptions()); + const systemPrompt = getSystemPrompt( + this.projectRoot, + this.getPromptToolOptions(), + this.getResolvedSettings().systemPromptFile + ); const systemMessage = this.buildSystemMessage(sessionId, systemPrompt); this.appendSessionMessage(sessionId, systemMessage); diff --git a/src/settings.ts b/src/settings.ts index 9fbcea2..03c28ea 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -25,6 +25,7 @@ export type DeepcodingSettings = { debugLogEnabled?: boolean; notify?: string; webSearchTool?: string; + systemPromptFile?: string; mcpServers?: Record; }; @@ -38,6 +39,7 @@ export type ResolvedDeepcodingSettings = { debugLogEnabled: boolean; notify?: string; webSearchTool?: string; + systemPromptFile?: string; mcpServers?: Record; }; @@ -222,6 +224,14 @@ export function resolveSettingsSources( trimString(userSettings?.webSearchTool) || ""; + const systemPromptFile = + trimString(systemEnv.SYSTEM_PROMPT_FILE) || + trimString(projectSettings?.systemPromptFile) || + trimString(projectEnv.SYSTEM_PROMPT_FILE) || + trimString(userSettings?.systemPromptFile) || + trimString(userEnv.SYSTEM_PROMPT_FILE) || + ""; + return { env, apiKey: trimString(env.API_KEY) || undefined, @@ -232,6 +242,7 @@ export function resolveSettingsSources( debugLogEnabled, notify: notify || undefined, webSearchTool: webSearchTool || undefined, + systemPromptFile: systemPromptFile || undefined, mcpServers: mergeMcpServers(userSettings, projectSettings, userEnv, projectEnv, systemEnv), }; }