Skip to content

Commit ca1fe7e

Browse files
author
liwangping
committed
merge: expand README feature guide
2 parents c90dabd + d6e224a commit ca1fe7e

2 files changed

Lines changed: 119 additions & 27 deletions

File tree

README.md

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,21 @@ do-code
5252
## What it does
5353

5454
- **Works in real repositories** — read and attach files, edit code, run shell commands, inspect Git diffs, and run tests.
55-
- **Uses your model provider** — built-in setup for Ark, Bailian, DeepSeek, MiniMax, Z.AI, and ModelScope, plus OpenAI-compatible, Anthropic, and Gemini services.
56-
- **Keeps execution controlled** — planning and permission modes are independent, and every edit gets a local checkpoint for inspection or recovery.
55+
- **Uses your model provider** — built-in setup for Volcengine Ark, Alibaba ModelStudio, DeepSeek, MiniMax, Z.AI, and ModelScope; Custom Provider supports OpenAI-compatible, Anthropic, and Gemini APIs.
56+
- **Keeps execution controlled** — planning and permission modes are independent, and built-in file edits and patches receive local checkpoints for inspection or recovery.
5757

5858
Type `/` to browse commands and `@` to attach workspace files:
5959

6060
```text
61-
/plan Explore and propose a plan in read-only mode
62-
/permissions Choose Ask / Auto / Full Access
63-
/model View or switch model presets
64-
/resume Restore a previous session
61+
/plan · /permissions · /model · /resume
62+
/status · /stats · /compact · /diff
63+
/memory · /rewind · /export · /language
6564
@src/app.ts Add a file to the current context
6665
!npm test Run a command under the current permission mode
6766
```
6867

68+
Use `/thinking` and `/effort` to tune reasoning during a session; add `--persist` to save the choice as the default for future sessions. The interface supports English, Simplified Chinese, Japanese, Korean, Spanish, and French through `--language` or `/language`.
69+
6970
## Run it your way
7071

7172
### Interactive terminal
@@ -76,31 +77,71 @@ do-code --continue
7677
do-code resume <session-id>
7778
```
7879

80+
### Sessions and context
81+
82+
Continue the latest project session with `do-code --continue`, or choose one with `resume` and `/resume`:
83+
84+
```bash
85+
do-code sessions list
86+
do-code sessions search "authentication"
87+
do-code sessions rename <session-id> "Auth cleanup"
88+
do-code sessions delete <session-id>
89+
do-code sessions export <session-id> md ./session.md
90+
```
91+
92+
Use `/stats` to inspect context use and `/compact` to compact it on demand. Near the context limit, do-code compacts automatically while retaining important paths, commands, decisions, and verification state.
93+
94+
### Project instructions and isolation
95+
96+
Layered `AGENTS.md` instructions follow the workspace hierarchy; inspect or reload them with `/memory`. Start an isolated Git worktree with `do-code --worktree` or `do-code --worktree=<name>`, and inspect do-code worktrees with `do-code worktrees`.
97+
98+
### Profiles and extensions
99+
100+
Agent profiles can select a model, approval mode, instructions, step limit, and tool allow/deny lists. Inspect them with `do-code agents` and select one with `do-code --agent <name>`. Browse Markdown commands and skills with `/extensions`; use `do-code extensions` for a summary of commands, skills, and configured MCP servers.
101+
79102
### Scripts and CI
80103

81-
`run` produces stable JSON or JSONL output for automation:
104+
`run` produces stable JSON or JSONL output for automation. Tasks can come from an argument or `--task-file`; `--max-steps` and `--timeout` set execution budgets. `--artifact-dir` stores the frozen configuration, event stream, result, and patch artifacts.
82105

83106
```bash
84-
do-code run --yes --output-format stream-json "Fix the failing test and verify it"
107+
do-code run --yes --output-format stream-json \
108+
--task-file task.txt --artifact-dir ./artifacts \
109+
--max-steps 40 --timeout 600
85110
```
86111

87-
Use `do-code acp` for the ACP standard input/output protocol. See the [Headless / JSONL protocol](docs/headless-protocol.md).
112+
Use `do-code acp` for the ACP standard input/output protocol. See the [Headless / JSONL protocol](docs/headless-protocol.md) for the supported automation contract.
88113

89114
### Image input
90115

91-
Attach up to four PNG, JPEG, GIF, or WebP images with repeated `--image` in headless mode:
116+
Attach up to four PNG, JPEG, GIF, or WebP images with repeated `--image` in headless mode. The selected model must support image input.
92117

93118
```bash
94119
do-code run --image screenshots/bug.png --image screenshots/diagram.webp "Describe these images"
95120
```
96121

97122
In the interactive TUI, type `@path/to/image.png` or use `/paste-image` to import an image from the system clipboard. Use `/remove-image <index|name>` to remove a pending attachment. Each image is limited to 10 MB and the prompt total is limited to 20 MB. Imported files are copied to `~/.local/share/do-code/projects/<project-key>/sessions/<session-id>/attachments/`; persisted messages contain only relative references such as `attachments/image_xxx.png`, never Base64 data or the original absolute path. Set `DO_CODE_DATA_DIR` to override the global data root. Existing project-local `.do-code` data is migrated to the user-managed project directory when the project is next accessed.
98123

124+
### Useful CLI commands
125+
126+
```bash
127+
do-code config show # Inspect effective model configuration
128+
do-code doctor # Check model, workspace, and local tools
129+
do-code sessions list # List project sessions
130+
do-code extensions # Inspect commands, skills, and MCP configuration
131+
do-code agents # List agent profiles
132+
do-code worktrees # List isolated worktrees
133+
do-code errors list # List recent error reports
134+
```
135+
99136
## Safety and data
100137

101138
The default **Ask** mode requests confirmation for high-risk actions. **Auto** handles ordinary workspace changes automatically. **Full Access** is intended only for trusted workspaces or CI.
102139

103-
Sessions, checkpoints, error reports, and credentials stay on your machine by default. To inspect a failure:
140+
Configuration is stored under `~/.config/do-code/`; project sessions, attachments, checkpoints, and error reports are stored under `~/.local/share/do-code/projects/<project-key>/`. `DO_CODE_DATA_DIR` overrides the data root. Credentials and project data stay on your machine by default.
141+
142+
Sandbox settings can use local execution, macOS Seatbelt, or a container, depending on configuration and host support. Permission mode and sandbox configuration are separate controls.
143+
144+
To inspect a failure:
104145

105146
```bash
106147
do-code errors list
@@ -113,16 +154,16 @@ do-code errors show <error-id>
113154
- [Bad case feedback and diagnostics](docs/bad-case-feedback.md)
114155
- [Headless / JSONL protocol](docs/headless-protocol.md)
115156
- [Architecture](docs/architecture.md)
157+
- [Local development](docs/local-development.md)
116158
- [Personal release process](docs/releasing.md)
117159

118160
## Contributing
119161

120162
Issues and pull requests are welcome. Please read the [contributing guide](CONTRIBUTING.md) and [security policy](SECURITY.md) before submitting a change.
121163

122164
```bash
123-
npm test
124-
npm run typecheck
125-
npm run build
165+
npm run verify:local
166+
npm run build:agent
126167
```
127168

128169
## License

README.zh-CN.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,21 @@ do-code
5252
## 用 do-code 做什么
5353

5454
- **在真实工作区完成任务**:读取和引用文件、修改代码、执行 Shell 命令、查看 Git Diff、运行测试。
55-
- **接入自己的模型**内置火山方舟、百炼、DeepSeek、MiniMax、智谱、ModelScope,也支持 OpenAI-compatible、Anthropic 与 Gemini 服务
56-
- **保持执行可控**:计划模式与权限模式彼此独立;每次编辑会创建本地检查点,方便检查或恢复。
55+
- **接入自己的模型服务**内置 Volcengine Ark、Alibaba ModelStudio、DeepSeek、MiniMax、Z.AI 和 ModelScope;Custom Provider 支持 OpenAI-compatible、Anthropic 与 Gemini API
56+
- **保持执行可控**:计划模式与权限模式彼此独立;内置文件编辑和补丁会创建本地检查点,方便检查或恢复。
5757

5858
输入 `/` 浏览命令,输入 `@` 引用工作区文件:
5959

6060
```text
61-
/plan 在只读模式下探索并提出计划
62-
/permissions 选择 Ask / Auto / Full Access
63-
/model 查看或切换模型预设
64-
/resume 恢复历史会话
61+
/plan · /permissions · /model · /resume
62+
/status · /stats · /compact · /diff
63+
/memory · /rewind · /export · /language
6564
@src/app.ts 将文件加入当前上下文
6665
!npm test 运行命令(遵循当前权限)
6766
```
6867

68+
使用 `/thinking``/effort` 可在会话中调整推理设置;添加 `--persist` 可保存为未来会话的默认值。界面支持 English、Simplified Chinese、Japanese、Korean、Spanish 和 French,可通过 `--language``/language` 切换。
69+
6970
## 运行方式
7071

7172
### 交互式终端
@@ -76,21 +77,71 @@ do-code --continue
7677
do-code resume <session-id>
7778
```
7879

80+
### 会话与上下文
81+
82+
使用 `do-code --continue` 继续当前项目的最新会话,也可通过 `resume``/resume` 选择会话:
83+
84+
```bash
85+
do-code sessions list
86+
do-code sessions search "authentication"
87+
do-code sessions rename <session-id> "Auth cleanup"
88+
do-code sessions delete <session-id>
89+
do-code sessions export <session-id> md ./session.md
90+
```
91+
92+
使用 `/stats` 查看上下文用量,使用 `/compact` 手动压缩。接近上下文上限时,do-code 会自动压缩,并保留重要路径、命令、决策和验证状态。
93+
94+
### 项目指令与隔离
95+
96+
分层 `AGENTS.md` 指令遵循工作区层级,可通过 `/memory` 查看或重新加载。使用 `do-code --worktree``do-code --worktree=<name>` 在隔离 Git worktree 中运行,使用 `do-code worktrees` 查看 do-code worktree。
97+
98+
### 配置档与扩展
99+
100+
Agent profile 可选择 model、approval mode、instructions、step limit 和 tool allow/deny lists。使用 `do-code agents` 查看,通过 `do-code --agent <name>` 选择。使用 `/extensions` 浏览 Markdown commands 和 skills;使用 `do-code extensions` 汇总查看 commands、skills 与已配置的 MCP servers。
101+
79102
### 脚本与 CI
80103

81-
`run` 提供稳定的 JSON / JSONL 输出,适合外部自动化调用:
104+
`run` 提供稳定的 JSON / JSONL 输出,适合外部自动化调用。任务可来自命令参数或 `--task-file``--max-steps``--timeout` 控制执行预算。`--artifact-dir` 保存冻结配置、事件流、结果和补丁产物。
105+
106+
```bash
107+
do-code run --yes --output-format stream-json \
108+
--task-file task.txt --artifact-dir ./artifacts \
109+
--max-steps 40 --timeout 600
110+
```
111+
112+
也可通过 `do-code acp` 使用 ACP 标准输入/输出协议。其自动化契约详见 [Headless / JSONL 协议](docs/headless-protocol.md)
113+
114+
### 图片输入
115+
116+
在 headless 模式中重复使用 `--image`,最多可附加四张 PNG、JPEG、GIF 或 WebP 图片。所选模型必须支持图片输入。
82117

83118
```bash
84-
do-code run --yes --output-format stream-json "修复失败测试并验证"
119+
do-code run --image screenshots/bug.png --image screenshots/diagram.webp "描述这些图片"
85120
```
86121

87-
也可通过 `do-code acp` 使用 ACP 标准输入/输出协议。详见 [Headless / JSONL 协议](docs/headless-protocol.md)
122+
在交互式 TUI 中,输入 `@path/to/image.png`,或使用 `/paste-image` 从系统剪贴板导入图片。使用 `/remove-image <index|name>` 可移除待发送附件。每张图片最大 10 MB,单次提示中的图片总量最大 20 MB。导入的文件会复制到 `~/.local/share/do-code/projects/<project-key>/sessions/<session-id>/attachments/`;持久化消息只保存 `attachments/image_xxx.png` 这类相对引用,不保存 Base64 数据或原始绝对路径。设置 `DO_CODE_DATA_DIR` 可覆盖全局数据根目录。项目内已有的 `.do-code` 数据会在下次访问该项目时迁移到用户管理的项目目录。
123+
124+
### 常用 CLI 命令
125+
126+
```bash
127+
do-code config show # 查看生效的模型配置
128+
do-code doctor # 检查模型、工作区与本地工具
129+
do-code sessions list # 列出项目会话
130+
do-code extensions # 检查 commands、skills 与 MCP 配置
131+
do-code agents # 列出 agent profiles
132+
do-code worktrees # 列出隔离 worktrees
133+
do-code errors list # 列出近期错误报告
134+
```
88135

89136
## 安全与数据
90137

91138
默认的 **Ask** 模式会在高风险操作前请求确认;**Auto** 自动处理普通工作区改动;**Full Access** 仅适用于已信任的工作区或 CI。
92139

93-
会话、检查点、错误报告与凭据默认都留在本机。出现异常时:
140+
配置保存在 `~/.config/do-code/`;项目会话、附件、检查点和错误报告保存在 `~/.local/share/do-code/projects/<project-key>/``DO_CODE_DATA_DIR` 可覆盖数据根目录。凭据与项目数据默认都留在本机。
141+
142+
Sandbox 设置可使用 local execution、macOS Seatbelt 或 container,具体取决于配置和宿主支持。权限模式与 sandbox 配置是彼此独立的控制项。
143+
144+
出现异常时:
94145

95146
```bash
96147
do-code errors list
@@ -103,16 +154,16 @@ do-code errors show <error-id>
103154
- [Bad Case 回流与错误诊断](docs/bad-case-feedback.md)
104155
- [Headless / JSONL 协议](docs/headless-protocol.md)
105156
- [架构说明](docs/architecture.md)
157+
- [本地开发流程](docs/local-development.md)
106158
- [个人发布流程](docs/releasing.md)
107159

108160
## 参与贡献
109161

110162
欢迎提交 Issue 与 Pull Request。开始前请阅读 [贡献指南](CONTRIBUTING.md)[安全策略](SECURITY.md)
111163

112164
```bash
113-
npm test
114-
npm run typecheck
115-
npm run build
165+
npm run verify:local
166+
npm run build:agent
116167
```
117168

118169
## License

0 commit comments

Comments
 (0)