codemini-cli 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OPERATIONS.md +18 -0
- package/README.md +194 -151
- package/package.json +1 -1
- package/src/commands/chat.js +24 -0
- package/src/commands/run.js +4 -4
- package/src/core/agent-loop.js +11 -1
- package/src/core/chat-runtime.js +239 -79
- package/src/core/plan-state.js +32 -0
- package/src/core/session-store.js +3 -19
- package/src/core/shell-profile.js +1 -0
- package/src/core/tools.js +158 -1
- package/src/tui/chat-app.js +265 -19
package/OPERATIONS.md
CHANGED
|
@@ -120,6 +120,9 @@ Use this when you want to separate:
|
|
|
120
120
|
/spec <topic>
|
|
121
121
|
/plan <goal>
|
|
122
122
|
/plan auto <goal>
|
|
123
|
+
/yes
|
|
124
|
+
/edit <feedback>
|
|
125
|
+
/reject
|
|
123
126
|
/plan from-spec <path?>
|
|
124
127
|
/agents list
|
|
125
128
|
/agents run <role> <task>
|
|
@@ -130,6 +133,7 @@ Use this when you want to separate:
|
|
|
130
133
|
Note:
|
|
131
134
|
- The old manual `/tasks` board has been removed.
|
|
132
135
|
- For complex single-task work, the assistant now maintains an internal session todo checklist automatically and shows it in the TUI.
|
|
136
|
+
- `/plan auto run` is deprecated. Use `/plan auto <goal>` then `/yes`, `/edit <feedback>`, or `/reject`.
|
|
133
137
|
|
|
134
138
|
Available sub-agent roles:
|
|
135
139
|
|
|
@@ -171,6 +175,20 @@ Then continue with:
|
|
|
171
175
|
Execute this plan step by step.
|
|
172
176
|
```
|
|
173
177
|
|
|
178
|
+
For auto plan approval flow:
|
|
179
|
+
|
|
180
|
+
```text
|
|
181
|
+
/plan auto <goal>
|
|
182
|
+
/yes
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
or revise/discard before execution:
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
/edit <feedback>
|
|
189
|
+
/reject
|
|
190
|
+
```
|
|
191
|
+
|
|
174
192
|
### Session recovery
|
|
175
193
|
|
|
176
194
|
```text
|
package/README.md
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
# CodeMini CLI
|
|
1
|
+
# [CodeMini CLI](https://github.com/havingautism/Codemini-CLI)
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/codemini-cli)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
3
6
|
[](#english)
|
|
4
7
|
[](#简体中文)
|
|
5
8
|
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<a id="english"></a>
|
|
12
|
+
|
|
6
13
|
## English
|
|
7
14
|
|
|
8
15
|
CodeMini CLI is a terminal coding assistant built for teams that want a sharper, more controllable, and model-agnostic agent experience.
|
|
9
16
|
|
|
10
17
|
It is designed around a deliberate idea: most coding workflows do not need a huge default tool surface or unrestricted shell behavior. Instead, CodeMini starts with a compact core, loads advanced tools on demand, and keeps the agent grounded in structured code operations, session todos, lightweight project indexing, and shell-aware safety rules.
|
|
11
18
|
|
|
19
|
+
**Contents** — [Why CodeMini CLI](#why-codemini-cli) · [Installation](#installation) · [Quick Start](#quick-start) · [Commands](#commands) · [Personalities (Souls)](#personalities-souls) · [Tool Model](#how-the-tool-model-works) · [Core Capabilities](#core-capabilities) · [Project Index](#project-index) · [Good Fit](#good-fit) · [Documentation](#documentation) · [Development](#development) · [License](#license)
|
|
20
|
+
|
|
12
21
|
### Why CodeMini CLI
|
|
13
22
|
|
|
14
23
|
- Built for practical coding workflows across both frontier-scale and smaller/internal models
|
|
@@ -17,89 +26,65 @@ It is designed around a deliberate idea: most coding workflows do not need a hug
|
|
|
17
26
|
- Prefers structured file and code tools over noisy shell fallbacks
|
|
18
27
|
- Supports planning, execution, todo tracking, and sub-agent workflows without forcing a bloated interface
|
|
19
28
|
|
|
20
|
-
###
|
|
29
|
+
### Installation
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
- A tool surface that is easier to audit and reason about
|
|
24
|
-
- A TUI that makes execution visible instead of hiding agent state
|
|
25
|
-
- A workflow that stays reliable across both large and small models
|
|
31
|
+
Requires **Node.js ≥ 22**.
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
```bash
|
|
34
|
+
# Install globally
|
|
35
|
+
npm install -g codemini-cli
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- `list`
|
|
33
|
-
- `query_project_index`
|
|
34
|
-
- `edit`
|
|
35
|
-
- `write`
|
|
36
|
-
- `update_todos`
|
|
37
|
-
- `run`
|
|
38
|
-
- `tool_search`
|
|
39
|
-
- On-demand tools for advanced workflows:
|
|
40
|
-
- `glob`
|
|
41
|
-
- AST tools: `ast_query`, `read_ast_node`
|
|
42
|
-
- diff tools: `generate_diff`, `patch`
|
|
43
|
-
- background task management tools
|
|
44
|
-
- persistent memory tools
|
|
45
|
-
- Session-scoped todo tracking through `update_todos`, rendered directly in the TUI
|
|
46
|
-
- Unified shell execution model:
|
|
47
|
-
- one-shot commands through `run`
|
|
48
|
-
- long-running commands through `run` with `run_in_background=true`
|
|
49
|
-
- background task inspection through deferred tools when needed
|
|
50
|
-
- Lightweight project index in `.codemini-project/` for repository-aware prompting
|
|
51
|
-
- Tree-sitter-assisted structural editing for function/class/method scoped work
|
|
52
|
-
- Sub-agent support for planning, coding, review, and testing workflows
|
|
53
|
-
- Reply language control through `ui.reply_language`
|
|
54
|
-
- Tone presets through `soul`, without changing planning or code behavior
|
|
55
|
-
|
|
56
|
-
### Workflow Highlights
|
|
57
|
-
|
|
58
|
-
- `update_todos` is used for complex single-task work and rendered as a native checklist in the TUI
|
|
59
|
-
- `plan auto` is oriented toward task decomposition and execution sequencing
|
|
60
|
-
- `task`-level execution tracking is separated from `plan` and handled through the internal todo checklist
|
|
61
|
-
- The shell workflow is unified: the assistant no longer has to switch mental models between one-shot commands and long-running service tools
|
|
62
|
-
- The prompt explicitly teaches the model that the visible default tools are not the full tool universe; it should use `tool_search` when it needs more capability
|
|
63
|
-
- Slash completion includes prioritization, paging, and inline descriptions
|
|
64
|
-
- Safe mode is enabled by default
|
|
37
|
+
# Or run without installing
|
|
38
|
+
npx codemini-cli
|
|
39
|
+
```
|
|
65
40
|
|
|
66
41
|
### Quick Start
|
|
67
42
|
|
|
68
43
|
```bash
|
|
44
|
+
# 1. Configure your gateway and model
|
|
69
45
|
codemini config set gateway.base_url http://your-internal-gateway/v1
|
|
70
46
|
codemini config set gateway.api_key your_token
|
|
71
47
|
codemini config set model.name your-preferred-model
|
|
72
|
-
|
|
48
|
+
|
|
49
|
+
# 2. Set shell (PowerShell for Windows, bash for macOS/Linux)
|
|
50
|
+
codemini config set shell.default powershell # Windows
|
|
51
|
+
codemini config set shell.default bash # macOS / Linux
|
|
52
|
+
|
|
53
|
+
# 3. Optional: set reply language and run diagnostics
|
|
73
54
|
codemini config set ui.reply_language zh
|
|
74
55
|
codemini doctor
|
|
56
|
+
|
|
57
|
+
# 4. Start an interactive coding session
|
|
75
58
|
codemini
|
|
76
59
|
```
|
|
77
60
|
|
|
78
|
-
|
|
61
|
+
### Commands
|
|
79
62
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
63
|
+
| Command | Description |
|
|
64
|
+
|---------|-------------|
|
|
65
|
+
| `codemini [prompt]` | Start an interactive coding session with an optional initial prompt |
|
|
66
|
+
| `codemini chat [prompt]` | Chat mode — single-turn or multi-turn conversation |
|
|
67
|
+
| `codemini run <task>` | Run a task non-interactively (e.g. `codemini run "fix the login bug"`) |
|
|
68
|
+
| `codemini config set\|get\|list <key> [value]` | Manage configuration (gateway, model, shell, UI, soul, etc.) |
|
|
69
|
+
| `codemini doctor` | Run environment diagnostics and validate configuration |
|
|
70
|
+
| `codemini skill list\|install\|enable\|disable\|inspect\|reindex` | Manage skills — list, install, toggle, or inspect bundled/third-party skills |
|
|
83
71
|
|
|
84
|
-
###
|
|
72
|
+
### Personalities (Souls)
|
|
85
73
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
codemini
|
|
92
|
-
codemini skill list|install|enable|disable|inspect|reindex
|
|
74
|
+
CodeMini CLI supports swappable "soul" personalities that change tone and expression style without altering plan logic or code behavior.
|
|
75
|
+
|
|
76
|
+
Built-in souls: `default`, `professional`, `ceo`, `playful`, `anime`, `caveman`, `pirate`
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
codemini config set soul.preset playful
|
|
93
80
|
```
|
|
94
81
|
|
|
95
82
|
### How The Tool Model Works
|
|
96
83
|
|
|
97
84
|
CodeMini CLI intentionally separates tools into two layers:
|
|
98
85
|
|
|
99
|
-
- Default tools
|
|
100
|
-
|
|
101
|
-
- Deferred tools:
|
|
102
|
-
loaded only when needed through `tool_search`
|
|
86
|
+
- **Default tools** — always visible, optimized for the most common coding path
|
|
87
|
+
- **Deferred tools** — loaded only when needed through `tool_search`
|
|
103
88
|
|
|
104
89
|
This keeps the main interface smaller and makes the agent's first-choice behavior more predictable.
|
|
105
90
|
|
|
@@ -112,18 +97,37 @@ Typical flow:
|
|
|
112
97
|
5. `update_todos` to keep complex work legible
|
|
113
98
|
6. `tool_search` only when a more specialized capability is needed
|
|
114
99
|
|
|
100
|
+
### Core Capabilities
|
|
101
|
+
|
|
102
|
+
- Compact default tools for daily work:
|
|
103
|
+
- `read`, `grep`, `glob`, `list`, `query_project_index`
|
|
104
|
+
- `edit`, `write`
|
|
105
|
+
- `read_plan`, `update_plan`, `update_todos`
|
|
106
|
+
- `run`, `tool_search`
|
|
107
|
+
- On-demand tools for advanced workflows:
|
|
108
|
+
- AST tools: `ast_query`, `read_ast_node`
|
|
109
|
+
- background task management tools
|
|
110
|
+
- persistent memory tools
|
|
111
|
+
- Session-level todo checklists via `update_todos`, rendered natively in the TUI
|
|
112
|
+
- Unified shell execution model:
|
|
113
|
+
- one-off commands via `run`
|
|
114
|
+
- long-running commands via `run` with `run_in_background=true`
|
|
115
|
+
- Lightweight project index under `.codemini-project/`
|
|
116
|
+
- Tree-sitter based structured editing for function, class, and method-level changes
|
|
117
|
+
- Reply language control via `ui.reply_language`
|
|
118
|
+
- Safe mode enabled by default
|
|
119
|
+
|
|
115
120
|
### Project Index
|
|
116
121
|
|
|
117
122
|
CodeMini CLI maintains a lightweight project index inside `.codemini-project/`:
|
|
118
123
|
|
|
119
|
-
- `project-map.json`
|
|
120
|
-
|
|
121
|
-
- `file-index.json`
|
|
122
|
-
per-file structure such as imports, exports, functions, classes, and lightweight symbol hints
|
|
124
|
+
- `project-map.json` — high-level repository facts such as languages, source roots, test roots, and entry candidates
|
|
125
|
+
- `file-index.json` — per-file structure such as imports, exports, functions, classes, and lightweight symbol hints
|
|
123
126
|
|
|
124
127
|
The index is initialized when entering a project and refreshed incrementally after edits, writes, and patches. It is intended to be factual, compact, and inexpensive to keep current.
|
|
125
128
|
|
|
126
|
-
|
|
129
|
+
<details>
|
|
130
|
+
<summary>Data Layout & Config Paths</summary>
|
|
127
131
|
|
|
128
132
|
- Global session state: `<base-config-dir>/sessions/`
|
|
129
133
|
- Project workspace state: `.codemini/`
|
|
@@ -134,17 +138,15 @@ The index is initialized when entering a project and refreshed incrementally aft
|
|
|
134
138
|
|
|
135
139
|
Base config directory resolution order:
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
| Platform | Path |
|
|
142
|
+
|----------|------|
|
|
143
|
+
| `CODEMINI_GLOBAL_DIR` env | `$CODEMINI_GLOBAL_DIR` (highest priority) |
|
|
144
|
+
| Windows | `%APPDATA%\codemini-global\` |
|
|
145
|
+
| macOS | `~/Library/Preferences/codemini-global` |
|
|
146
|
+
| Linux / XDG | `$XDG_CONFIG_HOME/codemini-global` |
|
|
147
|
+
| Restricted fallback | `.codemini-global/` |
|
|
142
148
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
- Operator guide and workflow notes: [OPERATIONS.md](./OPERATIONS.md)
|
|
146
|
-
- Packaging and deployment: [deployment.md](./deployment.md)
|
|
147
|
-
- Release process: [RELEASE_CHECKLIST.md](./RELEASE_CHECKLIST.md)
|
|
149
|
+
</details>
|
|
148
150
|
|
|
149
151
|
### Good Fit
|
|
150
152
|
|
|
@@ -156,11 +158,36 @@ CodeMini CLI is a strong fit if you want:
|
|
|
156
158
|
- a TUI that shows plans, todos, tools, and progress clearly
|
|
157
159
|
- a code assistant that prefers structured operations over shell noise
|
|
158
160
|
|
|
161
|
+
### Documentation
|
|
162
|
+
|
|
163
|
+
- Operator guide and workflow notes: [OPERATIONS.md](./OPERATIONS.md)
|
|
164
|
+
- Packaging and deployment: [deployment.md](./deployment.md)
|
|
165
|
+
- Changelog: [Releases](https://github.com/havingautism/Codemini-CLI/releases)
|
|
166
|
+
|
|
167
|
+
### Development
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Install dependencies
|
|
171
|
+
npm install
|
|
172
|
+
|
|
173
|
+
# Run tests
|
|
174
|
+
npm test
|
|
175
|
+
|
|
176
|
+
# Start locally
|
|
177
|
+
npm start
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### License
|
|
181
|
+
|
|
182
|
+
[MIT](LICENSE)
|
|
183
|
+
|
|
159
184
|
---
|
|
160
185
|
|
|
186
|
+
<a id="简体中文"></a>
|
|
187
|
+
|
|
161
188
|
## 简体中文
|
|
162
189
|
|
|
163
|
-
CodeMini CLI
|
|
190
|
+
CodeMini CLI 是一个面向真实开发环境的终端代码助手,目标不是"把所有能力都塞进默认界面",而是做一个更克制、更清晰、更容易掌控的 coding agent CLI。
|
|
164
191
|
|
|
165
192
|
它围绕一个很明确的原则来设计:默认工具面尽量小,常用路径尽量顺,复杂能力按需加载。这样可以同时兼顾大模型与小模型,也适合团队在内部环境里做稳定、可控的日常开发协作。
|
|
166
193
|
|
|
@@ -172,93 +199,69 @@ CodeMini CLI 是一个面向真实开发环境的终端代码助手,目标不
|
|
|
172
199
|
- 优先走结构化代码工具,而不是让模型长期泡在嘈杂 shell 输出里
|
|
173
200
|
- 同时支持规划、执行、待办追踪和 sub-agent 协作,但不把界面做得臃肿
|
|
174
201
|
|
|
175
|
-
###
|
|
176
|
-
|
|
177
|
-
- 更容易 steer 的 coding CLI
|
|
178
|
-
- 更容易审计和理解的工具面
|
|
179
|
-
- 更强调执行可视化的 TUI
|
|
180
|
-
- 即使模型不是 frontier 级别,也依然能稳定工作
|
|
202
|
+
### 安装
|
|
181
203
|
|
|
182
|
-
|
|
204
|
+
需要 **Node.js ≥ 22**。
|
|
183
205
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
- `list`
|
|
188
|
-
- `query_project_index`
|
|
189
|
-
- `edit`
|
|
190
|
-
- `write`
|
|
191
|
-
- `update_todos`
|
|
192
|
-
- `run`
|
|
193
|
-
- `tool_search`
|
|
194
|
-
- 更专业的能力按需加载:
|
|
195
|
-
- `glob`
|
|
196
|
-
- AST 工具:`ast_query`、`read_ast_node`
|
|
197
|
-
- diff 工具:`generate_diff`、`patch`
|
|
198
|
-
- 后台任务管理工具
|
|
199
|
-
- 持久 memory 工具
|
|
200
|
-
- 通过 `update_todos` 维护复杂单任务的会话级待办清单,并直接渲染在 TUI 中
|
|
201
|
-
- 统一的 shell 执行模型:
|
|
202
|
-
- 一次性命令直接 `run`
|
|
203
|
-
- 长运行命令通过 `run` + `run_in_background=true`
|
|
204
|
-
- 需要时再加载后台任务管理工具
|
|
205
|
-
- 在 `.codemini-project/` 下维护轻量项目索引,帮助模型更快理解仓库
|
|
206
|
-
- 基于 Tree-sitter 的结构化编辑能力,适合函数级、类级、方法级改动
|
|
207
|
-
- 支持 planner、coder、reviewer、tester 等 sub-agent 协作
|
|
208
|
-
- 支持通过 `ui.reply_language` 控制回复语言
|
|
209
|
-
- `soul` 只影响语气和表达,不改变计划或代码行为
|
|
210
|
-
|
|
211
|
-
### 工作流亮点
|
|
206
|
+
```bash
|
|
207
|
+
# 全局安装
|
|
208
|
+
npm install -g codemini-cli
|
|
212
209
|
|
|
213
|
-
|
|
214
|
-
-
|
|
215
|
-
|
|
216
|
-
- shell 模型已经统一,不再需要在“一次性命令”和“长运行服务工具”之间切换心智
|
|
217
|
-
- prompt 会明确告诉模型:默认看到的工具不是全部工具,缺能力时先 `tool_search`
|
|
218
|
-
- slash 补全支持优先级、分页和简短说明
|
|
219
|
-
- safe mode 默认开启
|
|
210
|
+
# 或不安装直接运行
|
|
211
|
+
npx codemini-cli
|
|
212
|
+
```
|
|
220
213
|
|
|
221
214
|
### 快速开始
|
|
222
215
|
|
|
223
216
|
```bash
|
|
217
|
+
# 1. 配置网关和模型
|
|
224
218
|
codemini config set gateway.base_url http://your-internal-gateway/v1
|
|
225
219
|
codemini config set gateway.api_key your_token
|
|
226
220
|
codemini config set model.name your-preferred-model
|
|
227
|
-
|
|
221
|
+
|
|
222
|
+
# 2. 设置 shell(Windows 用 PowerShell,macOS/Linux 用 bash)
|
|
223
|
+
codemini config set shell.default powershell # Windows
|
|
224
|
+
codemini config set shell.default bash # macOS / Linux
|
|
225
|
+
|
|
226
|
+
# 3. 可选:设置回复语言,运行诊断
|
|
228
227
|
codemini config set ui.reply_language zh
|
|
229
228
|
codemini doctor
|
|
229
|
+
|
|
230
|
+
# 4. 启动交互式编码会话
|
|
230
231
|
codemini
|
|
231
232
|
```
|
|
232
233
|
|
|
233
|
-
|
|
234
|
+
### 命令概览
|
|
234
235
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
| 命令 | 说明 |
|
|
237
|
+
|------|------|
|
|
238
|
+
| `codemini [prompt]` | 启动交互式编码会话,可附带初始提示 |
|
|
239
|
+
| `codemini chat [prompt]` | 对话模式——单轮或多轮 |
|
|
240
|
+
| `codemini run <task>` | 非交互式执行任务(如 `codemini run "修复登录 bug"`) |
|
|
241
|
+
| `codemini config set\|get\|list <key> [value]` | 管理配置(网关、模型、shell、UI、soul 等) |
|
|
242
|
+
| `codemini doctor` | 运行环境诊断并验证配置 |
|
|
243
|
+
| `codemini skill list\|install\|enable\|disable\|inspect\|reindex` | 管理 skill——列表、安装、启用/禁用、检查 |
|
|
238
244
|
|
|
239
|
-
###
|
|
245
|
+
### 个性人格(Souls)
|
|
240
246
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
codemini
|
|
247
|
-
codemini skill list|install|enable|disable|inspect|reindex
|
|
247
|
+
CodeMini CLI 支持可切换的 "soul" 人格,仅改变语气和表达风格,不影响计划逻辑或代码行为。
|
|
248
|
+
|
|
249
|
+
内置人格:`default`、`professional`、`ceo`、`playful`、`anime`、`caveman`、`pirate`
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
codemini config set soul.preset playful
|
|
248
253
|
```
|
|
249
254
|
|
|
250
255
|
### 工具模型怎么设计
|
|
251
256
|
|
|
252
257
|
CodeMini CLI 把工具分成两层:
|
|
253
258
|
|
|
254
|
-
-
|
|
255
|
-
|
|
256
|
-
- 延迟工具
|
|
257
|
-
只有在需要时才通过 `tool_search` 加载
|
|
259
|
+
- **默认工具** — 永远可见,覆盖最常见的编码主路径
|
|
260
|
+
- **延迟工具** — 只有在需要时才通过 `tool_search` 加载
|
|
258
261
|
|
|
259
262
|
这样做的目标,是让主界面更小、更稳,也让模型在第一反应时更容易走对路径。
|
|
260
263
|
|
|
261
|
-
|
|
264
|
+
典型流程:
|
|
262
265
|
|
|
263
266
|
1. `query_project_index` 或 `list` 做定位
|
|
264
267
|
2. `read` 和 `grep` 做理解
|
|
@@ -267,18 +270,37 @@ CodeMini CLI 把工具分成两层:
|
|
|
267
270
|
5. `update_todos` 追踪复杂任务
|
|
268
271
|
6. 真的需要专门能力时,再 `tool_search`
|
|
269
272
|
|
|
273
|
+
### 核心能力
|
|
274
|
+
|
|
275
|
+
- 默认主工具保持在高频主路径:
|
|
276
|
+
- `read`、`grep`、`glob`、`list`、`query_project_index`
|
|
277
|
+
- `edit`、`write`
|
|
278
|
+
- `read_plan`、`update_plan`、`update_todos`
|
|
279
|
+
- `run`、`tool_search`
|
|
280
|
+
- 更专业的能力按需加载:
|
|
281
|
+
- AST 工具:`ast_query`、`read_ast_node`
|
|
282
|
+
- 后台任务管理工具
|
|
283
|
+
- 持久 memory 工具
|
|
284
|
+
- 通过 `update_todos` 维护复杂单任务的会话级待办清单,并直接渲染在 TUI 中
|
|
285
|
+
- 统一的 shell 执行模型:
|
|
286
|
+
- 一次性命令直接 `run`
|
|
287
|
+
- 长运行命令通过 `run` + `run_in_background=true`
|
|
288
|
+
- 在 `.codemini-project/` 下维护轻量项目索引,帮助模型更快理解仓库
|
|
289
|
+
- 基于 Tree-sitter 的结构化编辑能力,适合函数级、类级、方法级改动
|
|
290
|
+
- 支持通过 `ui.reply_language` 控制回复语言
|
|
291
|
+
- safe mode 默认开启
|
|
292
|
+
|
|
270
293
|
### 项目索引
|
|
271
294
|
|
|
272
295
|
CodeMini CLI 会在 `.codemini-project/` 下维护一份轻量项目索引:
|
|
273
296
|
|
|
274
|
-
- `project-map.json`
|
|
275
|
-
|
|
276
|
-
- `file-index.json`
|
|
277
|
-
记录文件级结构信息,比如 imports、exports、functions、classes 和轻量 symbol 提示
|
|
297
|
+
- `project-map.json` — 记录仓库的高层结构事实,比如语言、源码目录、测试目录、入口候选
|
|
298
|
+
- `file-index.json` — 记录文件级结构信息,比如 imports、exports、functions、classes 和轻量 symbol 提示
|
|
278
299
|
|
|
279
300
|
这份索引会在进入项目时初始化,在 `edit`、`write`、`patch` 后做增量刷新。它的目标是轻量、可靠、低噪声,而不是生成一份很长的 AI 报告。
|
|
280
301
|
|
|
281
|
-
|
|
302
|
+
<details>
|
|
303
|
+
<summary>数据目录与配置路径</summary>
|
|
282
304
|
|
|
283
305
|
- 全局会话状态:`<base-config-dir>/sessions/`
|
|
284
306
|
- 项目工作区状态:`.codemini/`
|
|
@@ -289,17 +311,15 @@ CodeMini CLI 会在 `.codemini-project/` 下维护一份轻量项目索引:
|
|
|
289
311
|
|
|
290
312
|
`base-config-dir` 的解析顺序:
|
|
291
313
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
314
|
+
| 平台 | 路径 |
|
|
315
|
+
|------|------|
|
|
316
|
+
| `CODEMINI_GLOBAL_DIR` 环境变量 | `$CODEMINI_GLOBAL_DIR`(最高优先级) |
|
|
317
|
+
| Windows | `%APPDATA%\codemini-global\` |
|
|
318
|
+
| macOS | `~/Library/Preferences/codemini-global` |
|
|
319
|
+
| Linux / XDG | `$XDG_CONFIG_HOME/codemini-global` |
|
|
320
|
+
| 受限环境回退 | `.codemini-global/` |
|
|
297
321
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
- 操作手册与工作流说明:[OPERATIONS.md](./OPERATIONS.md)
|
|
301
|
-
- 打包与部署文档:[deployment.md](./deployment.md)
|
|
302
|
-
- 发布流程:[RELEASE_CHECKLIST.md](./RELEASE_CHECKLIST.md)
|
|
322
|
+
</details>
|
|
303
323
|
|
|
304
324
|
### 适合谁
|
|
305
325
|
|
|
@@ -310,3 +330,26 @@ CodeMini CLI 会在 `.codemini-project/` 下维护一份轻量项目索引:
|
|
|
310
330
|
- 真正重视 Windows / PowerShell 体验的终端工作流
|
|
311
331
|
- 能把计划、待办、工具调用和执行状态展示清楚的 TUI
|
|
312
332
|
- 更偏结构化操作、而不是大量 shell 噪声的代码助手
|
|
333
|
+
|
|
334
|
+
### 文档入口
|
|
335
|
+
|
|
336
|
+
- 操作手册与工作流说明:[OPERATIONS.md](./OPERATIONS.md)
|
|
337
|
+
- 打包与部署文档:[deployment.md](./deployment.md)
|
|
338
|
+
- 更新日志:[Releases](https://github.com/havingautism/Codemini-CLI/releases)
|
|
339
|
+
|
|
340
|
+
### 开发
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
# 安装依赖
|
|
344
|
+
npm install
|
|
345
|
+
|
|
346
|
+
# 运行测试
|
|
347
|
+
npm test
|
|
348
|
+
|
|
349
|
+
# 本地启动
|
|
350
|
+
npm start
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### 许可证
|
|
354
|
+
|
|
355
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
package/src/commands/chat.js
CHANGED
|
@@ -106,5 +106,29 @@ export async function handleChat(args) {
|
|
|
106
106
|
})
|
|
107
107
|
);
|
|
108
108
|
|
|
109
|
+
// Patch Ink's renderInteractiveFrame to never use clearTerminal.
|
|
110
|
+
// Ink calls clearTerminal (ESC[2J + ESC[H]) when the output frame exceeds
|
|
111
|
+
// the terminal viewport height, which resets the scroll position to the top
|
|
112
|
+
// and prevents the user from scrolling freely during streaming.
|
|
113
|
+
// By always using incremental logUpdate updates instead, old content scrolls
|
|
114
|
+
// into the terminal's scrollback naturally and the user can scroll freely.
|
|
115
|
+
const origRenderFrame = instance.renderInteractiveFrame;
|
|
116
|
+
instance.renderInteractiveFrame = function (output, outputHeight, staticOutput) {
|
|
117
|
+
const hasStaticOutput = staticOutput !== '';
|
|
118
|
+
const outputToRender = output + '\n';
|
|
119
|
+
|
|
120
|
+
if (hasStaticOutput) {
|
|
121
|
+
this.fullStaticOutput += staticOutput;
|
|
122
|
+
this.log.clear();
|
|
123
|
+
this.options.stdout.write(staticOutput);
|
|
124
|
+
this.log(outputToRender);
|
|
125
|
+
} else if (output !== this.lastOutput || this.log.isCursorDirty()) {
|
|
126
|
+
this.throttledLog(outputToRender);
|
|
127
|
+
}
|
|
128
|
+
this.lastOutput = output;
|
|
129
|
+
this.lastOutputToRender = outputToRender;
|
|
130
|
+
this.lastOutputHeight = outputHeight;
|
|
131
|
+
};
|
|
132
|
+
|
|
109
133
|
await instance.waitUntilExit();
|
|
110
134
|
}
|
package/src/commands/run.js
CHANGED
|
@@ -10,10 +10,10 @@ import fs from 'node:fs/promises';
|
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
|
|
12
12
|
const ROLE_TOOL_POLICY = {
|
|
13
|
-
planner: ['read', 'grep', 'list', 'query_project_index', 'tool_search', 'glob', 'ast_query', 'read_ast_node'],
|
|
14
|
-
coder: ['read', 'grep', 'list', 'edit', 'write', 'run', 'ast_query', 'read_ast_node', 'glob', 'tool_search', 'update_todos'],
|
|
15
|
-
reviewer: ['read', 'grep', 'list', 'glob', 'tool_search', 'ast_query', 'read_ast_node'],
|
|
16
|
-
tester: ['read', 'grep', 'list', 'run', 'glob', 'tool_search']
|
|
13
|
+
planner: ['read', 'grep', 'list', 'query_project_index', 'tool_search', 'glob', 'ast_query', 'read_ast_node', 'read_plan', 'update_plan'],
|
|
14
|
+
coder: ['read', 'grep', 'list', 'edit', 'write', 'run', 'ast_query', 'read_ast_node', 'glob', 'tool_search', 'update_todos', 'read_plan', 'update_plan'],
|
|
15
|
+
reviewer: ['read', 'grep', 'list', 'glob', 'tool_search', 'ast_query', 'read_ast_node', 'read_plan'],
|
|
16
|
+
tester: ['read', 'grep', 'list', 'run', 'glob', 'tool_search', 'read_plan']
|
|
17
17
|
};
|
|
18
18
|
const HARNESS_ROLES = Object.keys(ROLE_TOOL_POLICY);
|
|
19
19
|
|
package/src/core/agent-loop.js
CHANGED
|
@@ -247,6 +247,9 @@ function compactToolResult(result, toolName, args, maxChars = 12000) {
|
|
|
247
247
|
if ('newTodos' in obj && Array.isArray(obj.newTodos)) {
|
|
248
248
|
return obj.newTodos.length > 0 ? `updated ${obj.newTodos.length} todo item(s)` : 'cleared todo list';
|
|
249
249
|
}
|
|
250
|
+
if ('newPlan' in obj) {
|
|
251
|
+
return obj.newPlan ? `updated plan state (${String(obj.newPlan.status || 'draft')})` : 'cleared plan state';
|
|
252
|
+
}
|
|
250
253
|
|
|
251
254
|
// Fallback: clip with reduced limit
|
|
252
255
|
return clipToolResult(obj, Math.min(maxChars, 4000));
|
|
@@ -358,7 +361,8 @@ export function checkReadDedup(filePath, startLine, endLine, mtimeMs) {
|
|
|
358
361
|
const READ_ONLY_TOOLS = new Set([
|
|
359
362
|
'read', 'grep', 'glob', 'list',
|
|
360
363
|
'ast_query', 'read_ast_node',
|
|
361
|
-
'list_background_tasks', 'get_background_task'
|
|
364
|
+
'list_background_tasks', 'get_background_task',
|
|
365
|
+
'read_plan'
|
|
362
366
|
]);
|
|
363
367
|
|
|
364
368
|
// ─── Exported helpers ────────────────────────────────────────────────
|
|
@@ -456,6 +460,9 @@ export function summarizeToolResult(result) {
|
|
|
456
460
|
if ('newTodos' in obj && Array.isArray(obj.newTodos)) {
|
|
457
461
|
return obj.newTodos.length > 0 ? `updated ${obj.newTodos.length} todo item(s)` : 'cleared todo list';
|
|
458
462
|
}
|
|
463
|
+
if ('newPlan' in obj) {
|
|
464
|
+
return obj.newPlan ? `updated plan state (${String(obj.newPlan.status || 'draft')})` : 'cleared plan state';
|
|
465
|
+
}
|
|
459
466
|
const keys = Object.keys(obj);
|
|
460
467
|
return keys.length > 0 ? `keys: ${keys.slice(0, 5).join(',')}` : 'object';
|
|
461
468
|
}
|
|
@@ -659,6 +666,9 @@ function formatToolDisplayName(name, args) {
|
|
|
659
666
|
if (name === 'update_todos') {
|
|
660
667
|
return 'update_todos';
|
|
661
668
|
}
|
|
669
|
+
if (name === 'read_plan' || name === 'update_plan') {
|
|
670
|
+
return name;
|
|
671
|
+
}
|
|
662
672
|
if (name === 'list_background_tasks') {
|
|
663
673
|
return name;
|
|
664
674
|
}
|