@logicseek/hello-cc 0.1.4 → 0.1.6
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/CHANGELOG.md +126 -0
- package/bin/hcc.mjs +2739 -6482
- package/docs/README.md +2 -0
- package/docs/README.zh-CN.md +3 -1
- package/docs/architecture-split-review.md +217 -0
- package/docs/architecture.md +385 -0
- package/docs/architecture.zh-CN.md +364 -0
- package/docs/commands.md +21 -9
- package/docs/commands.zh-CN.md +19 -9
- package/docs/layout-split-stack-audit.md +298 -0
- package/lib/automation.mjs +8 -0
- package/lib/cli-args.mjs +89 -0
- package/lib/cli-runtime.mjs +44 -0
- package/lib/coordination-state.mjs +218 -0
- package/lib/core/coordination/automation.mjs +222 -0
- package/lib/core/coordination/locks.mjs +46 -0
- package/lib/core/coordination/messages.mjs +116 -0
- package/lib/core/coordination/tasks.mjs +224 -0
- package/lib/core/coordination/teams.mjs +73 -0
- package/lib/core/coordination/timeline.mjs +187 -0
- package/lib/core/peers/bindings.mjs +83 -0
- package/lib/core/peers/format.mjs +13 -0
- package/lib/core/peers/identity.mjs +53 -0
- package/lib/core/peers/liveness.mjs +90 -0
- package/lib/core/peers/reconcile.mjs +238 -0
- package/lib/core/peers/session.mjs +14 -0
- package/lib/core/sessions/launch.mjs +89 -0
- package/lib/db/schema.mjs +324 -0
- package/lib/db/stores/peers.mjs +231 -0
- package/lib/db-schema.mjs +7 -0
- package/lib/errors.mjs +1 -0
- package/lib/format.mjs +39 -0
- package/lib/guidance.mjs +10 -2
- package/lib/handoff.mjs +26 -0
- package/lib/help.mjs +3 -0
- package/lib/integrations/hooks.mjs +171 -0
- package/lib/integrations/peers/identity.mjs +208 -0
- package/lib/integrations/peers/processes.mjs +151 -0
- package/lib/integrations/providers.mjs +282 -0
- package/lib/integrations/shims/script.mjs +384 -0
- package/lib/integrations/shims.mjs +106 -0
- package/lib/json-file.mjs +1 -0
- package/lib/locks.mjs +10 -0
- package/lib/messages.mjs +3 -0
- package/lib/package-meta.mjs +6 -24
- package/lib/peer-bindings.mjs +14 -0
- package/lib/peer-format.mjs +4 -0
- package/lib/peer-identity.mjs +15 -0
- package/lib/project-context.mjs +6 -0
- package/lib/project-registry.mjs +7 -0
- package/lib/provider-commands.mjs +13 -0
- package/lib/release/package-meta.mjs +31 -0
- package/lib/release/release-notes.mjs +40 -0
- package/lib/release-notes.mjs +6 -40
- package/lib/runtime/client.mjs +42 -0
- package/lib/runtime/paths.mjs +45 -0
- package/lib/runtime/project-context.mjs +32 -0
- package/lib/runtime/projects.mjs +76 -0
- package/lib/runtime/state.mjs +128 -0
- package/lib/runtime-client.mjs +3 -0
- package/lib/runtime-paths.mjs +11 -0
- package/lib/runtime-state.mjs +11 -0
- package/lib/session-launch.mjs +17 -0
- package/lib/setup.mjs +18 -765
- package/lib/shared/errors.mjs +7 -0
- package/lib/shared/json-file.mjs +14 -0
- package/lib/shell-path.mjs +69 -0
- package/lib/shim-script.mjs +1 -0
- package/lib/state-render.mjs +5 -0
- package/lib/task-cli.mjs +45 -0
- package/lib/task-liveness.mjs +8 -0
- package/lib/task-store.mjs +3 -0
- package/lib/team-planning.mjs +7 -0
- package/lib/terminal/tmux.mjs +372 -0
- package/lib/timeline.mjs +12 -0
- package/lib/tmux.mjs +18 -0
- package/lib/ui/help.mjs +419 -0
- package/lib/ui/state-render.mjs +61 -0
- package/lib/web/http.mjs +55 -0
- package/lib/web/peer-actions.mjs +270 -0
- package/lib/web/runtime.mjs +154 -0
- package/lib/web/ui-template.mjs +2055 -0
- package/lib/web-http.mjs +7 -0
- package/lib/web-peer-actions.mjs +3 -0
- package/lib/web-runtime.mjs +17 -0
- package/lib/web-ui-template.mjs +3 -0
- package/package.json +1 -1
- package/scripts/github-release.mjs +2 -2
- package/scripts/regression.mjs +2738 -22
- package/scripts/release-notes.mjs +2 -2
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# hello-cc 架构设计
|
|
2
|
+
|
|
3
|
+
日期:2026-06-14
|
|
4
|
+
|
|
5
|
+
本文定义 hello-cc 的目标模块布局。它是后续重构的设计目标,不表示当前所有文件
|
|
6
|
+
都已经符合这个结构。
|
|
7
|
+
|
|
8
|
+
目标是停止按 helper 大小拆代码,改为按产品边界移动代码。薄 CLI、明确的核心
|
|
9
|
+
状态模型、独立 runtime 层、terminal adapter 和 Web server 边界,能让后续修改
|
|
10
|
+
更容易审查,也更不容易把无关行为混在一起。
|
|
11
|
+
|
|
12
|
+
## 参考结构
|
|
13
|
+
|
|
14
|
+
成熟的 agent CLI 项目通常采用类似分层:
|
|
15
|
+
|
|
16
|
+
- 入口文件保持很薄,只转发到 command 或 server 模块;
|
|
17
|
+
- 核心协作逻辑不依赖 HTTP、tmux 或进程启动细节;
|
|
18
|
+
- runtime 文件和 runtime client 独立于命令处理器;
|
|
19
|
+
- Web server routes、WebSocket transport、session lifecycle 是明确的 server
|
|
20
|
+
模块;
|
|
21
|
+
- provider 特有行为与通用 session/task 逻辑隔离;
|
|
22
|
+
- 测试按领域分组,而不是一直追加到一个巨大脚本里。
|
|
23
|
+
|
|
24
|
+
Codex 这类结构会把 `cli`、`core`、`app-server`、`protocol` 或 transport、state
|
|
25
|
+
store、hooks、config、execution adapter 分开。hello-cc 不需要 Rust crate,也
|
|
26
|
+
不需要同样规模,但应该采用同一个架构原则:按边界拆,不按顺手程度拆。
|
|
27
|
+
|
|
28
|
+
## 当前压力点
|
|
29
|
+
|
|
30
|
+
当前代码已经抽出了很多聚焦模块,例如 schema、runtime state、task/message
|
|
31
|
+
store、peer identity、provider command builder、tmux helper、Web HTTP helper
|
|
32
|
+
和 render helper。
|
|
33
|
+
|
|
34
|
+
剩余结构压力主要在:
|
|
35
|
+
|
|
36
|
+
- `bin/hcc.mjs` 仍包含 command dispatch、command handler、Web server setup、
|
|
37
|
+
HTTP routes、WebSocket terminal、tmux session 管理、PTY session 管理、
|
|
38
|
+
external buffer adoption 和 shutdown cleanup。
|
|
39
|
+
- `cmdWeb()` 是最大的混合边界。它应该被视为 Web runtime 子系统,而不是普通
|
|
40
|
+
CLI command body。
|
|
41
|
+
- `scripts/regression.mjs` 是有价值的全量回归入口,但后续应该变成一个调用领域
|
|
42
|
+
regression module 的 runner。
|
|
43
|
+
|
|
44
|
+
## 目标目录
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
bin/
|
|
48
|
+
hcc.mjs
|
|
49
|
+
|
|
50
|
+
lib/
|
|
51
|
+
cli/
|
|
52
|
+
dispatch.mjs
|
|
53
|
+
context.mjs
|
|
54
|
+
commands/
|
|
55
|
+
ask.mjs
|
|
56
|
+
broadcast.mjs
|
|
57
|
+
down.mjs
|
|
58
|
+
event.mjs
|
|
59
|
+
gc.mjs
|
|
60
|
+
handoff.mjs
|
|
61
|
+
hooks.mjs
|
|
62
|
+
init.mjs
|
|
63
|
+
inject.mjs
|
|
64
|
+
join.mjs
|
|
65
|
+
lock.mjs
|
|
66
|
+
msg.mjs
|
|
67
|
+
peer.mjs
|
|
68
|
+
prompt.mjs
|
|
69
|
+
run.mjs
|
|
70
|
+
scan.mjs
|
|
71
|
+
setup.mjs
|
|
72
|
+
shim.mjs
|
|
73
|
+
state.mjs
|
|
74
|
+
status.mjs
|
|
75
|
+
task.mjs
|
|
76
|
+
team.mjs
|
|
77
|
+
uninstall.mjs
|
|
78
|
+
update.mjs
|
|
79
|
+
up.mjs
|
|
80
|
+
web.mjs
|
|
81
|
+
|
|
82
|
+
core/
|
|
83
|
+
coordination/
|
|
84
|
+
automation.mjs
|
|
85
|
+
handoff.mjs
|
|
86
|
+
locks.mjs
|
|
87
|
+
messages.mjs
|
|
88
|
+
tasks.mjs
|
|
89
|
+
teams.mjs
|
|
90
|
+
timeline.mjs
|
|
91
|
+
peers/
|
|
92
|
+
bindings.mjs
|
|
93
|
+
format.mjs
|
|
94
|
+
identity.mjs
|
|
95
|
+
liveness.mjs
|
|
96
|
+
sessions/
|
|
97
|
+
launch.mjs
|
|
98
|
+
model.mjs
|
|
99
|
+
providers.mjs
|
|
100
|
+
serialization.mjs
|
|
101
|
+
|
|
102
|
+
db/
|
|
103
|
+
connection.mjs
|
|
104
|
+
migrations.mjs
|
|
105
|
+
schema.mjs
|
|
106
|
+
stores/
|
|
107
|
+
locks.mjs
|
|
108
|
+
messages.mjs
|
|
109
|
+
peers.mjs
|
|
110
|
+
tasks.mjs
|
|
111
|
+
|
|
112
|
+
runtime/
|
|
113
|
+
client.mjs
|
|
114
|
+
paths.mjs
|
|
115
|
+
projects.mjs
|
|
116
|
+
state.mjs
|
|
117
|
+
|
|
118
|
+
terminal/
|
|
119
|
+
external-buffer.mjs
|
|
120
|
+
pty.mjs
|
|
121
|
+
tmux-stream.mjs
|
|
122
|
+
tmux.mjs
|
|
123
|
+
|
|
124
|
+
web/
|
|
125
|
+
projects.mjs
|
|
126
|
+
routes.mjs
|
|
127
|
+
server.mjs
|
|
128
|
+
session-manager.mjs
|
|
129
|
+
websocket.mjs
|
|
130
|
+
http.mjs
|
|
131
|
+
ui-template.mjs
|
|
132
|
+
|
|
133
|
+
integrations/
|
|
134
|
+
hooks/
|
|
135
|
+
claude.mjs
|
|
136
|
+
codex.mjs
|
|
137
|
+
providers/
|
|
138
|
+
claude.mjs
|
|
139
|
+
codex.mjs
|
|
140
|
+
shell.mjs
|
|
141
|
+
shims/
|
|
142
|
+
setup.mjs
|
|
143
|
+
script.mjs
|
|
144
|
+
|
|
145
|
+
ui/
|
|
146
|
+
format.mjs
|
|
147
|
+
help.mjs
|
|
148
|
+
state-render.mjs
|
|
149
|
+
|
|
150
|
+
release/
|
|
151
|
+
package-meta.mjs
|
|
152
|
+
release-notes.mjs
|
|
153
|
+
|
|
154
|
+
shared/
|
|
155
|
+
errors.mjs
|
|
156
|
+
json-file.mjs
|
|
157
|
+
text.mjs
|
|
158
|
+
|
|
159
|
+
scripts/
|
|
160
|
+
regression.mjs
|
|
161
|
+
regression/
|
|
162
|
+
cli.mjs
|
|
163
|
+
coordination.mjs
|
|
164
|
+
db.mjs
|
|
165
|
+
release.mjs
|
|
166
|
+
runtime.mjs
|
|
167
|
+
sessions.mjs
|
|
168
|
+
web.mjs
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 边界规则
|
|
172
|
+
|
|
173
|
+
`bin/hcc.mjs` 应该变成很薄的入口。它可以解析全局参数、创建 root context、调用
|
|
174
|
+
dispatch,并把顶层错误转换为 CLI 输出。它不应该拥有 Web routing、DB schema、
|
|
175
|
+
tmux streaming、provider command construction 或 task state machine。
|
|
176
|
+
|
|
177
|
+
`lib/cli/` 负责命令解析和命令处理器。命令处理器可以打开数据库、调用 store 或
|
|
178
|
+
core service,并打印结果。当逻辑可以放进 `core`、`runtime`、`terminal`、`web`
|
|
179
|
+
或 `integrations` 时,不应该留在 command handler 里。
|
|
180
|
+
|
|
181
|
+
`lib/core/` 负责产品语义。task lifecycle、takeover readiness、message thread、
|
|
182
|
+
lock conflict rule、team planning、peer identity semantics 和 session identity
|
|
183
|
+
rule 属于这里。core module 不应该依赖 HTTP request、WebSocket、tmux command 或
|
|
184
|
+
process spawning。
|
|
185
|
+
|
|
186
|
+
`lib/db/` 负责 SQLite connection、schema、migration 和 data store。store module
|
|
187
|
+
应该暴露明确操作和事务边界。schema migration 必须能安全迁移每个注册项目数据库,
|
|
188
|
+
而不只是当前项目。
|
|
189
|
+
|
|
190
|
+
`lib/runtime/` 负责 runtime file、runtime discovery、runtime client request 和
|
|
191
|
+
project registry state。它不应该知道 Web route 如何渲染 UI,也不应该知道
|
|
192
|
+
terminal byte 如何传输。
|
|
193
|
+
|
|
194
|
+
`lib/terminal/` 负责 terminal adapter。tmux pane inspection、tmux stream setup、
|
|
195
|
+
tmux input、PTY spawn 和 external buffer adoption 属于这里。terminal adapter
|
|
196
|
+
可以发出 session event,但不应该决定 task ownership 或 message 行为。
|
|
197
|
+
|
|
198
|
+
`lib/web/` 负责 Web runtime。它应该组装 project context、session manager、HTTP
|
|
199
|
+
route、WebSocket terminal upgrade 和 shutdown cleanup。route handler 应该很薄,
|
|
200
|
+
并委托给 store、core service、runtime module 或 terminal/session manager。
|
|
201
|
+
|
|
202
|
+
`lib/integrations/` 负责 provider 特有行为。Claude、Codex、shell command
|
|
203
|
+
construction、hook installation details 和 shim script 不应混入通用 session 和
|
|
204
|
+
coordination module。
|
|
205
|
+
|
|
206
|
+
`lib/ui/` 负责 CLI 文本输出和 help。它可以格式化已经计算好的状态,但不应该读取
|
|
207
|
+
或修改项目状态。
|
|
208
|
+
|
|
209
|
+
`lib/release/` 负责 release metadata 和 release notes helper。release script 和
|
|
210
|
+
GitHub release 工具应共享这里的 helper。
|
|
211
|
+
|
|
212
|
+
`lib/shared/` 只放少量低依赖通用工具,不能变成新的杂物箱。
|
|
213
|
+
|
|
214
|
+
## 包发布面策略
|
|
215
|
+
|
|
216
|
+
受支持的公共接口是安装后的 CLI:`hcc` 和 `hello-cc`。`package.json` 包含
|
|
217
|
+
`lib/` 是因为 CLI 运行时会 import 这些文件,不表示每个 `lib/*` 路径都是稳定
|
|
218
|
+
library API。
|
|
219
|
+
|
|
220
|
+
不要在用户文档里新增 `@logicseek/hello-cc/lib/*` 这类导入用法。主实现应该放在
|
|
221
|
+
目标产品目录里;顶层 `lib/*.mjs` 文件只有在有明确兼容理由时,才作为
|
|
222
|
+
compatibility entrypoint 保留。
|
|
223
|
+
|
|
224
|
+
`@logicseek/hello-cc@0.1.5` 已经从 git head `4969100` 发布。这个已发布包因为
|
|
225
|
+
没有定义 `exports` map,已经暴露了一些顶层 `lib/*.mjs` helper 路径。常规 cleanup
|
|
226
|
+
提交里不要删除或重命名这些已发布路径;除非项目明确选择破坏性 package surface
|
|
227
|
+
变更,否则至少保留一个 release cycle,作为 compatibility re-export。
|
|
228
|
+
|
|
229
|
+
对于 `0.1.5` 之后的本地迁移提交,默认不要继续增加顶层 compatibility shim。如果
|
|
230
|
+
某个尚未发布的顶层 shim 要保留到下一版,需要在 release notes 里说明它只是
|
|
231
|
+
compatibility-only,并在再下一版前重新评估是否删除。不要让 compatibility shim
|
|
232
|
+
变成目标架构。
|
|
233
|
+
|
|
234
|
+
发行前,把顶层 `lib/*.mjs` 路径分成三类:
|
|
235
|
+
|
|
236
|
+
- A 类:已发布过,或 CLI 面向用户需要稳定的 helper 路径,本次发行必须保留。
|
|
237
|
+
- B 类:目录迁移产生的 compatibility path,只是 re-export 已移动实现;如确有
|
|
238
|
+
需要可保留一个版本,但 release notes 要说明它只是 compatibility-only 的
|
|
239
|
+
deep-import 路径。
|
|
240
|
+
- C 类:尚未发布、内部也不用、没有兼容价值的 shim,发布前删除。
|
|
241
|
+
|
|
242
|
+
因为 npm 上已经存在 `0.1.5`,任何包含 `4969100` 之后本地提交的发行都必须使用新
|
|
243
|
+
package 版本。不要尝试重新发布 `0.1.5`。
|
|
244
|
+
|
|
245
|
+
## 依赖方向
|
|
246
|
+
|
|
247
|
+
目标依赖方向:
|
|
248
|
+
|
|
249
|
+
```text
|
|
250
|
+
bin -> cli -> web/runtime/db/core/terminal/integrations/ui
|
|
251
|
+
web -> runtime/db/core/terminal/ui
|
|
252
|
+
terminal -> shared/core sessions only when needed
|
|
253
|
+
core -> shared
|
|
254
|
+
db -> shared
|
|
255
|
+
ui -> shared
|
|
256
|
+
release -> shared
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
避免以下依赖:
|
|
260
|
+
|
|
261
|
+
- `core` import `web`、`terminal`、`cli` 或 `integrations`;
|
|
262
|
+
- `db` import `cli` 或 `web`;
|
|
263
|
+
- `terminal` import Web route module;
|
|
264
|
+
- provider integration import command handler;
|
|
265
|
+
- `shared` import 产品特定模块。
|
|
266
|
+
|
|
267
|
+
这样大多数行为可以在没有 Web runtime 或 tmux process 的情况下测试。
|
|
268
|
+
|
|
269
|
+
## 迁移计划
|
|
270
|
+
|
|
271
|
+
重构必须小步进行,每一步都保持公共行为和 npm package 内容稳定,除非任务明确要
|
|
272
|
+
改行为。
|
|
273
|
+
|
|
274
|
+
1. 写下目标架构。
|
|
275
|
+
本文就是后续拆分的合同。
|
|
276
|
+
|
|
277
|
+
2. 把现有平铺模块移动到目标目录。
|
|
278
|
+
先做低风险迁移,例如 `runtime-*`、`web-*`、`task-store`、`messages`、`help`、
|
|
279
|
+
`state-render` 和 release helper。如果 import churn 太大,可以临时保留
|
|
280
|
+
compatibility re-export 文件。
|
|
281
|
+
|
|
282
|
+
3. 按子系统拆 Web runtime。
|
|
283
|
+
分提交从 `cmdWeb()` 抽出 project selection、session manager、Web routes、
|
|
284
|
+
WebSocket terminal、tmux stream、PTY session 和 external buffer adoption。
|
|
285
|
+
|
|
286
|
+
4. 让 `bin/hcc.mjs` 变成薄入口。
|
|
287
|
+
把 dispatch 和 command groups 移到 `lib/cli/commands/`。
|
|
288
|
+
|
|
289
|
+
5. 按领域拆 regression。
|
|
290
|
+
保持 `npm test` 是唯一全量回归命令,但让它调用 `scripts/regression/` 下的
|
|
291
|
+
领域模块。
|
|
292
|
+
|
|
293
|
+
## Web Runtime 目标
|
|
294
|
+
|
|
295
|
+
最有价值的 runtime 拆分如下:
|
|
296
|
+
|
|
297
|
+
```text
|
|
298
|
+
lib/web/server.mjs
|
|
299
|
+
createWebRuntime(ctx, opts, deps)
|
|
300
|
+
start/stop lifecycle
|
|
301
|
+
|
|
302
|
+
lib/web/projects.mjs
|
|
303
|
+
rememberProject()
|
|
304
|
+
knownProjects()
|
|
305
|
+
projectFromRequest()
|
|
306
|
+
|
|
307
|
+
lib/web/session-manager.mjs
|
|
308
|
+
sessions map
|
|
309
|
+
getSession()
|
|
310
|
+
serializeSession()
|
|
311
|
+
startSession()
|
|
312
|
+
stopSession()
|
|
313
|
+
restoreManagedSessions()
|
|
314
|
+
|
|
315
|
+
lib/web/routes.mjs
|
|
316
|
+
routeHttpRequest(req, res, env)
|
|
317
|
+
|
|
318
|
+
lib/web/websocket.mjs
|
|
319
|
+
handleTerminalUpgrade(req, socket, head, env)
|
|
320
|
+
|
|
321
|
+
lib/terminal/tmux-stream.mjs
|
|
322
|
+
startTmuxStream()
|
|
323
|
+
stopTmuxStream()
|
|
324
|
+
refreshTmuxSnapshot()
|
|
325
|
+
|
|
326
|
+
lib/terminal/external-buffer.mjs
|
|
327
|
+
adoptExternalSession()
|
|
328
|
+
scanExternalSessions()
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
这个拆分能让 Web 空白、stale session、tmux stream 和 provider binding 问题更
|
|
332
|
+
容易定位。
|
|
333
|
+
|
|
334
|
+
## 测试要求
|
|
335
|
+
|
|
336
|
+
每个结构迁移任务至少运行:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
git diff --check
|
|
340
|
+
node --check bin/hcc.mjs
|
|
341
|
+
node --check <changed modules>
|
|
342
|
+
npm test
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
涉及发行面的变更还要运行:
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
npm run release:check
|
|
349
|
+
npm run release:github:dry-run
|
|
350
|
+
npm pack --dry-run --json
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
新增 `lib/` 模块后,要确认 `npm pack --dry-run --json` 包含它们。
|
|
354
|
+
|
|
355
|
+
## 非目标
|
|
356
|
+
|
|
357
|
+
不要在本次布局迁移中引入 TypeScript、Rust、bundler 或 build step。这些都是单独
|
|
358
|
+
的产品决策,会影响 release 和安装成本。
|
|
359
|
+
|
|
360
|
+
不要在移动文件时重写已工作的行为。目录迁移提交应该很朴素:import 改了、模块
|
|
361
|
+
路径改了、regression guard 改了,但行为不变。
|
|
362
|
+
|
|
363
|
+
在没有单独 Web UI build 方案前,不要把 UI template asset 移到前端框架里。当前
|
|
364
|
+
npm 包安装后应继续可以直接运行。
|
package/docs/commands.md
CHANGED
|
@@ -36,7 +36,7 @@ want coordination without the Web console or shims.
|
|
|
36
36
|
```text
|
|
37
37
|
hcc peers
|
|
38
38
|
hcc status [--peer ID]
|
|
39
|
-
hcc state [--peer ID] [--resource PATH] [--intent work|stop|finish]
|
|
39
|
+
hcc state [--peer ID] [--resource PATH] [--scope SCOPE] [--intent read|review|work|write|stop|finish]
|
|
40
40
|
hcc scan [--register]
|
|
41
41
|
hcc prompt --peer ID [--kind codex|claude|shell|other] [--role ROLE]
|
|
42
42
|
hcc join --peer ID [--kind codex|claude|shell|other] [--role ROLE]
|
|
@@ -51,7 +51,9 @@ coordination actions such as acking messages, claiming tasks, acquiring locks, o
|
|
|
51
51
|
creating handoffs. It adds a unified collaboration timeline plus
|
|
52
52
|
`automation.next_action.argv`, a machine-readable next coordination command for
|
|
53
53
|
agents to execute explicitly. `automation.current_task` records the peer's active
|
|
54
|
-
task when one exists.
|
|
54
|
+
task when one exists. Use `--intent read` or `--intent review` for snapshot
|
|
55
|
+
inspection that should not acquire locks; use `--scope` with write/work intents
|
|
56
|
+
to coordinate one region of a larger shared resource.
|
|
55
57
|
|
|
56
58
|
## Browser-Controllable Terminals
|
|
57
59
|
|
|
@@ -92,8 +94,9 @@ sender by default. Use `msg thread` to inspect the full thread for one message.
|
|
|
92
94
|
```text
|
|
93
95
|
hcc task create --title TEXT [--body TEXT] [--from ID] [--to ID] [--priority N]
|
|
94
96
|
hcc task list [--status S] [--peer ID] [--all]
|
|
95
|
-
hcc task claim [--peer ID] --id N
|
|
96
|
-
hcc task
|
|
97
|
+
hcc task claim [--peer ID] --id N[,N] [--id N] [--ids N,N] [--force]
|
|
98
|
+
hcc task takeover [--peer ID] --id N --reason TEXT [--policy any|blocked|stale|blocked-or-stale] [--stale-after SECONDS]
|
|
99
|
+
hcc task next [--peer ID] [--force] [--count N]
|
|
97
100
|
hcc task create --title TEXT --parent N [--team-role ROLE]
|
|
98
101
|
hcc task update [--peer ID] --id N --status running|review|blocked|done|abandoned [--summary TEXT] [--body TEXT] [--to ID]
|
|
99
102
|
hcc task done [--peer ID] --id N --summary TEXT
|
|
@@ -102,7 +105,13 @@ hcc task done [--peer ID] --id N --summary TEXT
|
|
|
102
105
|
Tasks are shared project facts. They remain visible until marked `done` or
|
|
103
106
|
`abandoned`. `task next` returns your existing claimed/running/review/blocked
|
|
104
107
|
task before claiming a new pending task; use `--force` only when intentionally
|
|
105
|
-
taking
|
|
108
|
+
taking additional pending tasks, and combine it with `--count N` for explicit
|
|
109
|
+
batch claims. `task claim` also accepts repeated `--id` values and comma-separated
|
|
110
|
+
`--id` or `--ids` lists. Use `task takeover` when explicitly taking a
|
|
111
|
+
non-complete task from another owner; it records the previous owner, requires a
|
|
112
|
+
reason, and notifies them. Add `--policy blocked`, `stale`, or `blocked-or-stale`
|
|
113
|
+
when takeover should only proceed under that auditable precondition. The default
|
|
114
|
+
policy is `any` for compatibility.
|
|
106
115
|
|
|
107
116
|
## Teams
|
|
108
117
|
|
|
@@ -121,9 +130,9 @@ explicit peer IDs or kind counts such as `codex:2,claude:1`.
|
|
|
121
130
|
## Locks, Handoffs, And Events
|
|
122
131
|
|
|
123
132
|
```text
|
|
124
|
-
hcc lock acquire [--peer ID] --resource PATH [--task N] [--ttl SEC] [--reason TEXT]
|
|
125
|
-
hcc lock renew [--peer ID] --resource PATH [--ttl SEC]
|
|
126
|
-
hcc lock release [--peer ID] --resource PATH [--force]
|
|
133
|
+
hcc lock acquire [--peer ID] --resource PATH [--scope SCOPE] [--task N] [--ttl SEC] [--reason TEXT]
|
|
134
|
+
hcc lock renew [--peer ID] --resource PATH [--scope SCOPE] [--ttl SEC]
|
|
135
|
+
hcc lock release [--peer ID] --resource PATH [--scope SCOPE] [--force]
|
|
127
136
|
hcc lock list [--all]
|
|
128
137
|
hcc handoff create [--from ID] --summary TEXT [--task N] [--to ID] [--changed-files JSON_OR_CSV] [--tests TEXT] [--risks TEXT]
|
|
129
138
|
hcc handoff list [--task N] [--limit N]
|
|
@@ -131,5 +140,8 @@ hcc event tail [--limit N]
|
|
|
131
140
|
hcc gc [--older-than DAYS] [--yes]
|
|
132
141
|
```
|
|
133
142
|
|
|
134
|
-
Locks are advisory coordination locks with TTLs.
|
|
143
|
+
Locks are advisory coordination locks with TTLs. Omitting `--scope` locks the
|
|
144
|
+
whole resource. Different scopes on the same resource can be held concurrently,
|
|
145
|
+
for example `--resource bin/hcc.mjs --scope db-schema` and `--scope web-ui`, but
|
|
146
|
+
a whole-resource lock conflicts with every scope. Handoffs preserve the result,
|
|
135
147
|
tests, changed files, and remaining risks when work moves between peers.
|
package/docs/commands.zh-CN.md
CHANGED
|
@@ -33,7 +33,7 @@ URL token;首次使用时自动生成并保存。用 `--local` 可只绑定 `1
|
|
|
33
33
|
```text
|
|
34
34
|
hcc peers
|
|
35
35
|
hcc status [--peer ID]
|
|
36
|
-
hcc state [--peer ID] [--resource PATH] [--intent work|stop|finish]
|
|
36
|
+
hcc state [--peer ID] [--resource PATH] [--scope SCOPE] [--intent read|review|work|write|stop|finish]
|
|
37
37
|
hcc scan [--register]
|
|
38
38
|
hcc prompt --peer ID [--kind codex|claude|shell|other] [--role ROLE]
|
|
39
39
|
hcc join --peer ID [--kind codex|claude|shell|other] [--role ROLE]
|
|
@@ -47,6 +47,8 @@ hcc run --peer ID --kind codex|claude|shell --role ROLE -- COMMAND [ARGS...]
|
|
|
47
47
|
创建 handoff 这类协作动作;它会返回统一协作时间线,以及
|
|
48
48
|
`automation.next_action.argv` 这种机器可读的下一步协作命令,供 agent 显式执行
|
|
49
49
|
并留下审计记录。`automation.current_task` 会记录当前 peer 已经拥有的活动任务。
|
|
50
|
+
使用 `--intent read` 或 `--intent review` 表示只做快照检查,不应获取文件锁;
|
|
51
|
+
写入/工作意图下可用 `--scope` 协调同一个大资源中的某个区域。
|
|
50
52
|
|
|
51
53
|
## Web 可控终端
|
|
52
54
|
|
|
@@ -85,8 +87,9 @@ hcc broadcast MESSAGE [--from ID] [--task N] [--inject]
|
|
|
85
87
|
```text
|
|
86
88
|
hcc task create --title TEXT [--body TEXT] [--from ID] [--to ID] [--priority N]
|
|
87
89
|
hcc task list [--status S] [--peer ID] [--all]
|
|
88
|
-
hcc task claim [--peer ID] --id N
|
|
89
|
-
hcc task
|
|
90
|
+
hcc task claim [--peer ID] --id N[,N] [--id N] [--ids N,N] [--force]
|
|
91
|
+
hcc task takeover [--peer ID] --id N --reason TEXT [--policy any|blocked|stale|blocked-or-stale] [--stale-after SECONDS]
|
|
92
|
+
hcc task next [--peer ID] [--force] [--count N]
|
|
90
93
|
hcc task create --title TEXT --parent N [--team-role ROLE]
|
|
91
94
|
hcc task update [--peer ID] --id N --status running|review|blocked|done|abandoned [--summary TEXT] [--body TEXT] [--to ID]
|
|
92
95
|
hcc task done [--peer ID] --id N --summary TEXT
|
|
@@ -94,7 +97,12 @@ hcc task done [--peer ID] --id N --summary TEXT
|
|
|
94
97
|
|
|
95
98
|
任务是项目共享事实。任务会一直可见,直到被标记为 `done` 或 `abandoned`。
|
|
96
99
|
`task next` 会优先返回当前 peer 已经认领、运行、审查或阻塞中的任务;只有明确
|
|
97
|
-
|
|
100
|
+
要再接 pending 任务时才使用 `--force`,并可结合 `--count N` 做显式批量认领。
|
|
101
|
+
`task claim` 也支持重复 `--id`、逗号分隔的 `--id` 或 `--ids` 列表。明确要从
|
|
102
|
+
其他 owner 手里接管未完成任务时,使用 `task takeover`;它要求填写 reason,会
|
|
103
|
+
记录原 owner 并通知对方。需要更保守时,可加 `--policy blocked`、`stale` 或
|
|
104
|
+
`blocked-or-stale`,要求任务符合可审计的阻塞/陈旧条件后才允许接管。默认 policy
|
|
105
|
+
仍是 `any`,以保持兼容。
|
|
98
106
|
|
|
99
107
|
## 团队
|
|
100
108
|
|
|
@@ -112,9 +120,9 @@ hcc team status --task N
|
|
|
112
120
|
## 锁、交接和事件
|
|
113
121
|
|
|
114
122
|
```text
|
|
115
|
-
hcc lock acquire [--peer ID] --resource PATH [--task N] [--ttl SEC] [--reason TEXT]
|
|
116
|
-
hcc lock renew [--peer ID] --resource PATH [--ttl SEC]
|
|
117
|
-
hcc lock release [--peer ID] --resource PATH [--force]
|
|
123
|
+
hcc lock acquire [--peer ID] --resource PATH [--scope SCOPE] [--task N] [--ttl SEC] [--reason TEXT]
|
|
124
|
+
hcc lock renew [--peer ID] --resource PATH [--scope SCOPE] [--ttl SEC]
|
|
125
|
+
hcc lock release [--peer ID] --resource PATH [--scope SCOPE] [--force]
|
|
118
126
|
hcc lock list [--all]
|
|
119
127
|
hcc handoff create [--from ID] --summary TEXT [--task N] [--to ID] [--changed-files JSON_OR_CSV] [--tests TEXT] [--risks TEXT]
|
|
120
128
|
hcc handoff list [--task N] [--limit N]
|
|
@@ -122,5 +130,7 @@ hcc event tail [--limit N]
|
|
|
122
130
|
hcc gc [--older-than DAYS] [--yes]
|
|
123
131
|
```
|
|
124
132
|
|
|
125
|
-
锁是带 TTL 的协作式 advisory lock
|
|
126
|
-
|
|
133
|
+
锁是带 TTL 的协作式 advisory lock。不传 `--scope` 表示锁住整个资源。同一个
|
|
134
|
+
资源的不同 scope 可以并行持有,例如 `--resource bin/hcc.mjs --scope db-schema`
|
|
135
|
+
和 `--scope web-ui`;但整资源锁会和所有 scope 冲突。交接记录用于保存结果、
|
|
136
|
+
测试、变更文件和剩余风险,方便工作在多个 peer 之间继续。
|