@logicseek/hello-cc 0.1.0 → 0.1.2
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 +81 -0
- package/README.md +69 -378
- package/README.zh-CN.md +49 -325
- package/assets/logo.svg +84 -0
- package/bin/hcc.mjs +106 -11
- package/docs/README.md +22 -0
- package/docs/README.zh-CN.md +22 -0
- package/docs/commands.md +104 -0
- package/docs/commands.zh-CN.md +101 -0
- package/docs/guide.md +339 -0
- package/docs/guide.zh-CN.md +292 -0
- package/package.json +6 -2
- package/scripts/regression.mjs +78 -3
- package/scripts/release-notes.mjs +112 -0
package/docs/guide.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# hello-cc User Guide
|
|
2
|
+
|
|
3
|
+
This guide covers the practical workflow for installing, starting, and using
|
|
4
|
+
hello-cc. For a compact command list, use the [Command Reference](commands.md).
|
|
5
|
+
|
|
6
|
+
## Install, Update, And Uninstall
|
|
7
|
+
|
|
8
|
+
Install hello-cc globally:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @logicseek/hello-cc
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Update an existing global install:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
hcc update
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`hcc update` runs `npm install -g @logicseek/hello-cc@latest`. Use
|
|
21
|
+
`hcc update --help` to see the available update options. `hcc task update`
|
|
22
|
+
updates a coordination task, not the installed package.
|
|
23
|
+
|
|
24
|
+
Remove hooks and shims from this machine:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
hcc uninstall
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Remove the current project's `.hello-cc` data and guidance blocks too:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
hcc uninstall --purge --yes
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Remove the global npm package:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm uninstall -g @logicseek/hello-cc
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Default Entry
|
|
43
|
+
|
|
44
|
+
Run one command in the project directory:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
cd /path/to/project
|
|
48
|
+
hcc web
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`hcc web` automatically:
|
|
52
|
+
|
|
53
|
+
1. Initializes `.hello-cc/mesh.db` in the current directory
|
|
54
|
+
2. Writes bounded guidance blocks: `.hello-cc/HCC.md`, `CLAUDE.md`, `AGENTS.md`
|
|
55
|
+
3. Installs or refreshes Claude Code hooks: `~/.claude/settings.json`
|
|
56
|
+
4. Installs or refreshes Codex hooks: `~/.codex/hooks.json`
|
|
57
|
+
5. Installs `~/.hcc-shims/claude` and `~/.hcc-shims/codex`
|
|
58
|
+
6. Adds `~/.hcc-shims` to the shell PATH
|
|
59
|
+
7. Ensures `tmux` is available, with best-effort automatic install and a clear
|
|
60
|
+
install command if that fails
|
|
61
|
+
8. Starts or reuses the global web console, registers the current project,
|
|
62
|
+
prints URL/PID/runtime/log, then returns the terminal to you
|
|
63
|
+
|
|
64
|
+
Example output:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
hello-cc web started in background
|
|
68
|
+
pid: 12345
|
|
69
|
+
project: /path/to/project
|
|
70
|
+
database: /path/to/project/.hello-cc/mesh.db
|
|
71
|
+
runtime: /path/to/project/.hello-cc/runtime.json
|
|
72
|
+
log: /path/to/project/.hello-cc/web.log
|
|
73
|
+
open: http://<machine-ip>:8787/?project=%2Fpath%2Fto%2Fproject
|
|
74
|
+
local: http://127.0.0.1:8787/?project=%2Fpath%2Fto%2Fproject
|
|
75
|
+
shims: installed claude, codex
|
|
76
|
+
PATH updated in ~/.bashrc; open a new terminal or source it
|
|
77
|
+
stop: hcc down
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`hcc web` uses a single global web runtime. Running `hcc web` again from
|
|
81
|
+
another project directory does not open another port; it registers that project
|
|
82
|
+
with the same web console. The frontend Project selector switches between
|
|
83
|
+
registered roots. Each project still keeps its own `.hello-cc/mesh.db`, so
|
|
84
|
+
tasks, messages, locks, and peers stay isolated.
|
|
85
|
+
|
|
86
|
+
After the first shim install, open a new terminal or run:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
source ~/.bashrc
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then direct project-local commands are wrapped automatically:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
claude
|
|
96
|
+
codex
|
|
97
|
+
claude --resume <session-id>
|
|
98
|
+
codex resume <session-id>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The wrappers create or reuse local persistent tmux terminals:
|
|
102
|
+
|
|
103
|
+
- The local terminal attaches to the same tmux session and remains usable.
|
|
104
|
+
- The web console controls the same tmux pane, not a temporary browser-only
|
|
105
|
+
terminal.
|
|
106
|
+
- `hcc down` stops only the web runtime. It does not kill tmux sessions.
|
|
107
|
+
- Running `hcc web` again reattaches live recorded tmux panes.
|
|
108
|
+
|
|
109
|
+
For local coordination without Web or shims, use:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
hcc up
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Most users should start with `hcc web`.
|
|
116
|
+
|
|
117
|
+
## Project Boundary
|
|
118
|
+
|
|
119
|
+
By default, the project boundary is the current working directory. If the
|
|
120
|
+
current directory has no `.hello-cc/mesh.db`, hello-cc creates one on first use:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
/repo-a/.hello-cc/mesh.db
|
|
124
|
+
/repo-a/subdir/.hello-cc/mesh.db
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Those are two different projects by default. Sessions communicate naturally
|
|
128
|
+
when they start from the same project path.
|
|
129
|
+
|
|
130
|
+
To share one bus across paths or worktrees, opt in explicitly:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
hcc --root /path/to/project web
|
|
134
|
+
export HCC_ROOT=/path/to/project
|
|
135
|
+
export HCC_DB=/path/to/project/.hello-cc/mesh.db
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
hello-cc does not automatically inherit a parent directory's bus. That avoids
|
|
139
|
+
subdirectory sessions joining a broader project by accident.
|
|
140
|
+
|
|
141
|
+
## Communication Model
|
|
142
|
+
|
|
143
|
+
hello-cc is not point-to-point CLI messaging and does not require MCP. The core
|
|
144
|
+
is a project-local SQLite WAL bus:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
Claude/Codex/plain shell
|
|
148
|
+
-> hooks / hcc commands / web runtime
|
|
149
|
+
-> .hello-cc/mesh.db
|
|
150
|
+
-> peers / tasks / messages / locks / handoffs / events
|
|
151
|
+
-> tmux-backed terminal control
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Tasks and messages have different read semantics:
|
|
155
|
+
|
|
156
|
+
- Tasks are project facts. Every peer sees tasks until they become `done` or
|
|
157
|
+
`abandoned`.
|
|
158
|
+
- Messages are addressed mailbox items. `hcc msg inbox` defaults to unread
|
|
159
|
+
messages for the current peer, and `hcc msg ack` records per-peer read state.
|
|
160
|
+
- `ask` and `broadcast` write durable messages. With `--inject`, they also send
|
|
161
|
+
live input to runtime-attached terminals.
|
|
162
|
+
- Locks use SQLite transactions and TTLs. They are coordination locks, not a
|
|
163
|
+
filesystem sandbox.
|
|
164
|
+
|
|
165
|
+
## How Claude/Codex Knows Other Sessions
|
|
166
|
+
|
|
167
|
+
The primary path is hook injection, not `CLAUDE.md`.
|
|
168
|
+
|
|
169
|
+
`hcc web` installs Claude Code and Codex hooks. On session start, user prompt
|
|
170
|
+
submit, tool events, and idle events, hooks inject the current hello-cc snapshot
|
|
171
|
+
into the model context:
|
|
172
|
+
|
|
173
|
+
- current peer identity
|
|
174
|
+
- active peer list
|
|
175
|
+
- open tasks
|
|
176
|
+
- unread messages for the current peer
|
|
177
|
+
- active locks
|
|
178
|
+
- suggested commands such as `hcc status`, `hcc peers`, `hcc task list`,
|
|
179
|
+
`hcc msg inbox`, and `hcc lock list`
|
|
180
|
+
|
|
181
|
+
When an attached Claude/Codex session is asked what other sessions are doing,
|
|
182
|
+
it should answer from the latest hello-cc state instead of generic isolation
|
|
183
|
+
knowledge.
|
|
184
|
+
|
|
185
|
+
If a session still says it cannot know, likely causes are:
|
|
186
|
+
|
|
187
|
+
- `hcc web` has not been run in the project directory
|
|
188
|
+
- the terminal has not loaded `~/.hcc-shims` into PATH
|
|
189
|
+
- Codex hooks are not enabled or the installed hook has not been trusted in
|
|
190
|
+
Codex's hook review flow
|
|
191
|
+
- the CLI was started in a different project directory
|
|
192
|
+
- the session was an already-open raw terminal before hello-cc was installed
|
|
193
|
+
- the provider CLI version did not fire the expected hook
|
|
194
|
+
|
|
195
|
+
To verify Claude Code hook injection directly, run a one-shot debug call from
|
|
196
|
+
the same project:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
claude -p 'Do you see hello-cc open tasks?' --debug hooks --debug-file /tmp/hcc-claude-hooks.log
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The debug log should contain `Hook UserPromptSubmit ... provided
|
|
203
|
+
additionalContext` and the `hello-cc coordination` block.
|
|
204
|
+
|
|
205
|
+
## Web Console
|
|
206
|
+
|
|
207
|
+
Start local and LAN-visible control:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
hcc web
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Use a token only when you want one:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
HCC_WEB_TOKEN='choose-a-long-token' hcc web --host 0.0.0.0 --port 8787
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Open from another machine on the same network:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
http://<machine-ip>:8787/
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The web console can:
|
|
226
|
+
|
|
227
|
+
- switch between multiple registered project roots on one port
|
|
228
|
+
- register another project path from the browser
|
|
229
|
+
- show project state: peers, tasks, messages, locks, handoffs, events
|
|
230
|
+
- operate local terminals: start Claude/Codex/shell, send keyboard input, view
|
|
231
|
+
output, detach runtime control
|
|
232
|
+
|
|
233
|
+
Browser-controlled sessions are local tmux terminals:
|
|
234
|
+
|
|
235
|
+
- sessions started by the web form
|
|
236
|
+
- sessions started by `hcc peer start`
|
|
237
|
+
- direct `claude` / `codex` sessions started through shims
|
|
238
|
+
- existing tmux panes attached with `hcc peer attach`
|
|
239
|
+
|
|
240
|
+
Already-open raw terminals cannot be captured or controlled unconditionally
|
|
241
|
+
unless they started under tmux, screen, or a hello-cc shim. They can still
|
|
242
|
+
participate in tasks, messages, and locks through hooks and `hcc` commands.
|
|
243
|
+
|
|
244
|
+
## Command Reference
|
|
245
|
+
|
|
246
|
+
Use `hcc --help` for the command list and `hcc <command> --help` for a specific
|
|
247
|
+
command. The maintained summary lives in the [Command Reference](commands.md).
|
|
248
|
+
|
|
249
|
+
## Stable Peer Identity
|
|
250
|
+
|
|
251
|
+
hello-cc tries to keep peer IDs stable across resumed sessions:
|
|
252
|
+
|
|
253
|
+
| Launch pattern | Peer ID |
|
|
254
|
+
|---|---|
|
|
255
|
+
| `claude --resume abc12345...` | `claude-abc12345` |
|
|
256
|
+
| `claude --session-id abc12345...` | `claude-abc12345` |
|
|
257
|
+
| `claude --continue` | terminal-derived ID first, then hooks record real session metadata |
|
|
258
|
+
| `claude --fork-session --resume abc12345...` | terminal-derived ID first, then hooks record new session metadata |
|
|
259
|
+
| `codex resume abc12345...` | `codex-abc12345` |
|
|
260
|
+
| `codex resume --last` | terminal-derived ID first, then discovery records real session metadata |
|
|
261
|
+
| plain shell | `shell-<terminal>` |
|
|
262
|
+
| manual `HCC_PEER=xxx` | uses `xxx` |
|
|
263
|
+
|
|
264
|
+
Known resume IDs keep the same peer ID after restart. Launch modes that do not
|
|
265
|
+
expose the real provider session ID before startup use a terminal-derived ID
|
|
266
|
+
first, then record provider metadata after hooks or discovery run.
|
|
267
|
+
|
|
268
|
+
## Typical Workflow
|
|
269
|
+
|
|
270
|
+
Create a task:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
hcc task create --title "Refactor router diagnostics" \
|
|
274
|
+
--body "Keep changes scoped." --priority 20
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Claim and lock:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
hcc task next
|
|
281
|
+
hcc lock acquire --resource vllm/router --ttl 900 --reason "implement diagnostics"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Message or inject:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
hcc msg send --to claude-a --body "Implementation is ready for review."
|
|
288
|
+
hcc ask claude-a "Please review the current implementation." --inject
|
|
289
|
+
hcc broadcast "Pause edits under vllm/router until this task finishes." --inject
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Finish with a handoff:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
hcc handoff create --to claude-a \
|
|
296
|
+
--summary "Implemented router diagnostics changes." \
|
|
297
|
+
--tests "pytest tests/router" \
|
|
298
|
+
--risks "Full benchmark not run"
|
|
299
|
+
|
|
300
|
+
hcc task done --id 1 --summary "Done and handed off."
|
|
301
|
+
hcc lock release --resource vllm/router
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Environment Variables
|
|
305
|
+
|
|
306
|
+
| Variable | Purpose |
|
|
307
|
+
|---|---|
|
|
308
|
+
| `HCC_PEER` | default peer identity |
|
|
309
|
+
| `HCC_ROOT` | override project root |
|
|
310
|
+
| `HCC_DB` | override database path |
|
|
311
|
+
| `HCC_WEB_TOKEN` | optional token for web access |
|
|
312
|
+
| `HCC_RUNTIME_URL` | direct runtime URL |
|
|
313
|
+
| `HCC_NO_AUTO_INSTALL_TMUX=1` | disable tmux auto-install, mainly for tests |
|
|
314
|
+
|
|
315
|
+
The `claude` / `codex` shims and `hcc peer start` create tmux-backed sessions
|
|
316
|
+
from the environment of the local terminal that launched them, not from the
|
|
317
|
+
older environment of the background web runtime. This lets you open a new
|
|
318
|
+
terminal, export provider variables such as `ANTHROPIC_*` or
|
|
319
|
+
`CLAUDE_CODE_*`, then run `claude` / `codex`.
|
|
320
|
+
|
|
321
|
+
An already-running CLI process cannot have its environment changed in place by
|
|
322
|
+
the operating system. The `claude` / `codex` shims call `hcc peer start` with
|
|
323
|
+
`--restart-env`, so hello-cc records a launch environment fingerprint for the
|
|
324
|
+
same resume/session peer. If you start that peer again from a new terminal and
|
|
325
|
+
the environment changed, hello-cc automatically restarts the tmux session with
|
|
326
|
+
the new environment when there are no attached tmux clients or Web clients. If
|
|
327
|
+
the session is actively attached, hello-cc asks you to detach/close Web clients
|
|
328
|
+
or run `hcc peer stop <peer>` before starting it again.
|
|
329
|
+
|
|
330
|
+
When you call `hcc peer start` directly, add `--restart-env` if you want the
|
|
331
|
+
same restart-on-environment-change behavior.
|
|
332
|
+
|
|
333
|
+
The shims only manage interactive terminal sessions. Metadata and maintenance
|
|
334
|
+
commands pass through to the real provider CLI, including `claude --help`,
|
|
335
|
+
`claude --version`, `claude --print`, `claude --bare`, `claude --safe-mode`,
|
|
336
|
+
`codex --help`, `codex --version`, and non-interactive Codex subcommands such as
|
|
337
|
+
`codex exec`, `codex review`, `codex doctor`, and `codex mcp`. Interactive
|
|
338
|
+
`claude`, `claude --resume ...`, `codex`, `codex resume ...`, and `codex fork
|
|
339
|
+
...` are tmux-backed and visible in the Web console.
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# hello-cc 用户指南
|
|
2
|
+
|
|
3
|
+
这份文档说明安装、启动和日常使用流程。紧凑命令清单见
|
|
4
|
+
[命令参考](commands.zh-CN.md)。
|
|
5
|
+
|
|
6
|
+
## 安装、更新和卸载
|
|
7
|
+
|
|
8
|
+
全局安装 hello-cc:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @logicseek/hello-cc
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
更新已有的全局安装:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
hcc update
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`hcc update` 会执行 `npm install -g @logicseek/hello-cc@latest`。使用
|
|
21
|
+
`hcc update --help` 可以查看更新选项。`hcc task update` 更新的是协作任务状态,不是安装包版本。
|
|
22
|
+
|
|
23
|
+
移除本机 hooks 和 shims:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
hcc uninstall
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
同时移除当前项目的 `.hello-cc` 数据和指导块:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
hcc uninstall --purge --yes
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
移除全局 npm 包:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm uninstall -g @logicseek/hello-cc
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 默认入口
|
|
42
|
+
|
|
43
|
+
在项目目录运行:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cd /path/to/project
|
|
47
|
+
hcc web
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`hcc web` 会自动完成:
|
|
51
|
+
|
|
52
|
+
1. 在当前目录初始化 `.hello-cc/mesh.db`
|
|
53
|
+
2. 写入受控项目指导块:`.hello-cc/HCC.md`、`CLAUDE.md`、`AGENTS.md`
|
|
54
|
+
3. 安装或刷新 Claude Code hooks:`~/.claude/settings.json`
|
|
55
|
+
4. 安装或刷新 Codex hooks:`~/.codex/hooks.json`
|
|
56
|
+
5. 安装 `~/.hcc-shims/claude` 和 `~/.hcc-shims/codex`
|
|
57
|
+
6. 将 `~/.hcc-shims` 加入 shell PATH
|
|
58
|
+
7. 检查 `tmux`,缺失时尽量自动安装;安装失败会打印明确的系统安装命令
|
|
59
|
+
8. 后台启动或复用全局 Web 控制台,注册当前项目,打印 URL、PID、runtime 文件和日志文件,然后把当前终端还给用户
|
|
60
|
+
|
|
61
|
+
输出示例:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
hello-cc web started in background
|
|
65
|
+
pid: 12345
|
|
66
|
+
project: /path/to/project
|
|
67
|
+
database: /path/to/project/.hello-cc/mesh.db
|
|
68
|
+
runtime: /path/to/project/.hello-cc/runtime.json
|
|
69
|
+
log: /path/to/project/.hello-cc/web.log
|
|
70
|
+
open: http://<machine-ip>:8787/?project=%2Fpath%2Fto%2Fproject
|
|
71
|
+
local: http://127.0.0.1:8787/?project=%2Fpath%2Fto%2Fproject
|
|
72
|
+
shims: installed claude, codex
|
|
73
|
+
PATH updated in ~/.bashrc; open a new terminal or source it
|
|
74
|
+
stop: hcc down
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`hcc web` 使用单个全局 Web runtime。你在另一个项目目录再次运行 `hcc web` 时,不会再开一个端口,而是把那个项目注册到同一个 Web 控制台。前端 Project 下拉框可以在不同项目 root 之间切换;每个项目仍然使用自己的 `.hello-cc/mesh.db`,任务、消息、锁和 peers 不会混在一起。
|
|
78
|
+
|
|
79
|
+
第一次安装 shim 后,需要打开一个新终端,或执行:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
source ~/.bashrc
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
之后在这个项目目录中直接输入:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
claude
|
|
89
|
+
codex
|
|
90
|
+
claude --resume <session-id>
|
|
91
|
+
codex resume <session-id>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
这些命令会被 hello-cc shim 包装为本机 tmux 常驻终端:
|
|
95
|
+
|
|
96
|
+
- 本地终端会 attach 到同一个 tmux 会话,仍然可以像普通 Claude/Codex 一样交互。
|
|
97
|
+
- Web 控制台看到并操作的是同一个 tmux pane,不是浏览器里临时创建的假终端。
|
|
98
|
+
- `hcc down` 只停止 Web runtime,不会杀掉这些 tmux 会话。
|
|
99
|
+
- 重新运行 `hcc web` 后,只要 tmux pane 还活着,Web 会重新接管。
|
|
100
|
+
|
|
101
|
+
如果只想初始化本地通信、不启动 Web、不安装 shim,可使用:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
hcc up
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
普通用户优先使用 `hcc web`。
|
|
108
|
+
|
|
109
|
+
## 项目边界
|
|
110
|
+
|
|
111
|
+
默认项目边界就是当前工作目录。如果当前目录没有 `.hello-cc/mesh.db`,hello-cc 会在首次使用时创建:
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
/repo-a/.hello-cc/mesh.db
|
|
115
|
+
/repo-a/subdir/.hello-cc/mesh.db
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
这两个目录默认是两个不同项目,不会互相看到任务和消息。想让多个终端自然通信,就在同一个项目目录启动它们。
|
|
119
|
+
|
|
120
|
+
如果确实要让多个路径或 worktree 共用一个总线,需要显式指定:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
hcc --root /path/to/project web
|
|
124
|
+
export HCC_ROOT=/path/to/project
|
|
125
|
+
export HCC_DB=/path/to/project/.hello-cc/mesh.db
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
hello-cc 不会自动向父目录继承项目边界,这样可以避免子目录会话误加入上层项目。
|
|
129
|
+
|
|
130
|
+
## 通信模型
|
|
131
|
+
|
|
132
|
+
hello-cc 的通信不是 CLI 之间点对点互发,也不是必须依赖 MCP。核心是项目本地 SQLite WAL 总线:
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
Claude/Codex/普通 shell
|
|
136
|
+
-> hooks / hcc 命令 / Web runtime
|
|
137
|
+
-> .hello-cc/mesh.db
|
|
138
|
+
-> peers / tasks / messages / locks / handoffs / events
|
|
139
|
+
-> tmux-backed terminal control
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
任务和消息的读取规则不同:
|
|
143
|
+
|
|
144
|
+
- 任务是项目事实。所有 peer 默认都能看到未 `done` 且未 `abandoned` 的任务。
|
|
145
|
+
- 消息是带收件人的邮箱消息。`hcc msg inbox` 默认读取当前 peer 的未读消息,`hcc msg ack` 记录每个 peer 的已读状态。
|
|
146
|
+
- `ask` 和 `broadcast` 会写入持久消息;加 `--inject` 时,还会把内容实时注入到 Web runtime 已接管的终端。
|
|
147
|
+
- 锁使用 SQLite 事务和 TTL,是协作式冲突避免,不是文件系统强制沙箱。
|
|
148
|
+
|
|
149
|
+
## Claude/Codex 如何知道其他会话状态
|
|
150
|
+
|
|
151
|
+
主链路是 hooks 注入,不是依赖 `CLAUDE.md`。
|
|
152
|
+
|
|
153
|
+
`hcc web` 会安装 Claude Code 和 Codex hooks。在会话启动、用户提交 prompt、工具调用前后、会话空闲等事件中,hooks 会把 hello-cc 当前快照注入给模型,包括:
|
|
154
|
+
|
|
155
|
+
- 当前 peer 身份
|
|
156
|
+
- 活跃 peer 列表
|
|
157
|
+
- 未完成任务
|
|
158
|
+
- 当前 peer 的未读消息
|
|
159
|
+
- 活跃锁
|
|
160
|
+
- 建议执行的 `hcc status`、`hcc peers`、`hcc task list`、`hcc msg inbox`、`hcc lock list`
|
|
161
|
+
|
|
162
|
+
因此,当你在已接入的 Claude/Codex 里问“其他会话在做什么”,模型应该基于 hello-cc 注入的最新状态回答,而不是回答“我无法知道其他会话”。
|
|
163
|
+
|
|
164
|
+
如果仍然回答不知道,通常是这些原因:
|
|
165
|
+
|
|
166
|
+
- 没有先在项目目录运行 `hcc web`
|
|
167
|
+
- 当前终端还没有加载 `~/.hcc-shims` PATH
|
|
168
|
+
- Codex hooks 没有开启,或安装后的 hook 还没有在 Codex 的 hook review 流程里信任
|
|
169
|
+
- Claude/Codex 是在不同项目目录启动的
|
|
170
|
+
- 当前会话是 `hcc web` 之前打开的 raw 终端,只能靠下一次 hook 事件加入通信,不能被 Web 视觉接管
|
|
171
|
+
- 对应 CLI 版本没有触发预期 hook
|
|
172
|
+
|
|
173
|
+
可以在同一个项目目录用一次性 debug 调用确认 Claude Code 是否真实注入:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
claude -p 'Do you see hello-cc open tasks?' --debug hooks --debug-file /tmp/hcc-claude-hooks.log
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
debug 日志里应该出现 `Hook UserPromptSubmit ... provided additionalContext`,并包含 `hello-cc coordination` 块。
|
|
180
|
+
|
|
181
|
+
## Web 控制台
|
|
182
|
+
|
|
183
|
+
默认本机和内网访问:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
hcc web
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
需要令牌时再显式开启:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
HCC_WEB_TOKEN='choose-a-long-token' hcc web --host 0.0.0.0 --port 8787
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
同一内网机器打开:
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
http://<machine-ip>:8787/
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Web 控制台能做这些事:
|
|
202
|
+
|
|
203
|
+
- 在一个端口里切换多个已注册项目 root
|
|
204
|
+
- 直接在浏览器里注册新的项目路径
|
|
205
|
+
- 查看项目状态:peers、tasks、messages、locks、handoffs、events
|
|
206
|
+
- 操作本地终端:启动 Claude/Codex/shell、发送键盘输入、查看输出、停止接管
|
|
207
|
+
|
|
208
|
+
Web 操作的是 hello-cc 管理的本机 tmux 终端:
|
|
209
|
+
|
|
210
|
+
- 通过 Web 表单启动的新会话
|
|
211
|
+
- 通过 `hcc peer start` 启动的新会话
|
|
212
|
+
- 通过 shim 直接输入 `claude` / `codex` 启动的新会话
|
|
213
|
+
- 通过 `hcc peer attach` 接入的已有 tmux pane
|
|
214
|
+
|
|
215
|
+
已经打开的普通 raw 终端不能被无条件捕获或控制,除非它原本就在 tmux、screen 或 hello-cc shim 之下。它仍然可以通过 hooks 和 `hcc` 命令参与任务、消息和锁。
|
|
216
|
+
|
|
217
|
+
## 命令参考
|
|
218
|
+
|
|
219
|
+
使用 `hcc --help` 查看命令列表,使用 `hcc <command> --help` 查看单个命令。
|
|
220
|
+
维护中的命令摘要见 [命令参考](commands.zh-CN.md)。
|
|
221
|
+
|
|
222
|
+
## 稳定 peer 身份
|
|
223
|
+
|
|
224
|
+
hello-cc 会尽量让恢复会话复用稳定 peer ID:
|
|
225
|
+
|
|
226
|
+
| 启动方式 | peer ID |
|
|
227
|
+
|---|---|
|
|
228
|
+
| `claude --resume abc12345...` | `claude-abc12345` |
|
|
229
|
+
| `claude --session-id abc12345...` | `claude-abc12345` |
|
|
230
|
+
| `claude --continue` | 先使用终端派生 ID,随后 hooks 记录真实 session 元数据 |
|
|
231
|
+
| `claude --fork-session --resume abc12345...` | 先使用终端派生 ID,随后 hooks 记录新 session 元数据 |
|
|
232
|
+
| `codex resume abc12345...` | `codex-abc12345` |
|
|
233
|
+
| `codex resume --last` | 先使用终端派生 ID,随后 discovery 记录真实 session 元数据 |
|
|
234
|
+
| 普通 shell | `shell-<terminal>` |
|
|
235
|
+
| 手动 `HCC_PEER=xxx` | 使用 `xxx` |
|
|
236
|
+
|
|
237
|
+
已知 resume ID 的会话重启后会保持同一个 peer ID。启动前不知道真实 provider session ID 的模式,会先用终端派生 ID,启动后再记录真实 provider session 元数据。
|
|
238
|
+
|
|
239
|
+
## 典型工作流
|
|
240
|
+
|
|
241
|
+
创建任务:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
hcc task create --title "重构路由诊断" \
|
|
245
|
+
--body "保持变更范围小。" --priority 20
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
认领并加锁:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
hcc task next
|
|
252
|
+
hcc lock acquire --resource vllm/router --ttl 900 --reason "实现路由诊断"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
发消息或实时注入:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
hcc msg send --to claude-a --body "实现已准备好供审查。"
|
|
259
|
+
hcc ask claude-a "请审查当前实现。" --inject
|
|
260
|
+
hcc broadcast "暂停编辑 vllm/router,等待任务完成。" --inject
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
完成并交接:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
hcc handoff create --to claude-a \
|
|
267
|
+
--summary "已实现路由诊断变更。" \
|
|
268
|
+
--tests "pytest tests/router" \
|
|
269
|
+
--risks "未跑完整基准"
|
|
270
|
+
|
|
271
|
+
hcc task done --id 1 --summary "已完成并交接。"
|
|
272
|
+
hcc lock release --resource vllm/router
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## 环境变量
|
|
276
|
+
|
|
277
|
+
| 变量 | 用途 |
|
|
278
|
+
|---|---|
|
|
279
|
+
| `HCC_PEER` | 默认 peer 身份 |
|
|
280
|
+
| `HCC_ROOT` | 覆盖项目根目录 |
|
|
281
|
+
| `HCC_DB` | 覆盖数据库路径 |
|
|
282
|
+
| `HCC_WEB_TOKEN` | 可选 Web 访问令牌 |
|
|
283
|
+
| `HCC_RUNTIME_URL` | 直接指定 runtime URL |
|
|
284
|
+
| `HCC_NO_AUTO_INSTALL_TMUX=1` | 禁用 tmux 自动安装,主要用于测试 |
|
|
285
|
+
|
|
286
|
+
`claude` / `codex` shim 和 `hcc peer start` 会使用当前启动终端的环境变量创建 tmux-backed 会话,不使用后台 Web runtime 启动时的旧环境。这样你可以在新终端里先 `export ANTHROPIC_*`、`CLAUDE_CODE_*` 或其他 provider 变量,再运行 `claude` / `codex`。
|
|
287
|
+
|
|
288
|
+
已经运行的 CLI 进程不能被操作系统原地修改环境变量。`claude` / `codex` shim 会用 `--restart-env` 调用 `hcc peer start`,因此 hello-cc 会为同一个 resume/session peer 记录启动环境指纹。当你从新终端再次启动它且环境已变化时,如果对应 tmux 会话没有本地 tmux client 或 Web client 正在连接,hello-cc 会自动重启这个 tmux 会话并应用新环境。如果会话正在被操作,会提示先 detach/关闭 Web 连接,或运行 `hcc peer stop <peer>` 后再启动。
|
|
289
|
+
|
|
290
|
+
如果直接调用 `hcc peer start`,需要加 `--restart-env` 才会启用同样的环境变化自动重启行为。
|
|
291
|
+
|
|
292
|
+
shim 只接管交互式终端会话。元命令和维护命令会直通真实 provider CLI,例如 `claude --help`、`claude --version`、`claude --print`、`claude --bare`、`claude --safe-mode`、`codex --help`、`codex --version`,以及 `codex exec`、`codex review`、`codex doctor`、`codex mcp` 等非交互 Codex 子命令。交互式的 `claude`、`claude --resume ...`、`codex`、`codex resume ...`、`codex fork ...` 会走 tmux-backed,会出现在 Web 控制台里。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicseek/hello-cc",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Local control plane for coordinating Claude Code, Codex, and other coding CLI sessions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"hcc": "bin/hcc.mjs",
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
"bin/",
|
|
12
12
|
"lib/",
|
|
13
13
|
"scripts/",
|
|
14
|
+
"assets/",
|
|
14
15
|
"README.md",
|
|
15
16
|
"README.zh-CN.md",
|
|
17
|
+
"CHANGELOG.md",
|
|
16
18
|
"LICENSE",
|
|
17
19
|
"docs/"
|
|
18
20
|
],
|
|
@@ -20,6 +22,8 @@
|
|
|
20
22
|
"node": ">=24.0.0"
|
|
21
23
|
},
|
|
22
24
|
"scripts": {
|
|
25
|
+
"release:notes": "node ./scripts/release-notes.mjs",
|
|
26
|
+
"release:check": "node ./scripts/release-notes.mjs --check",
|
|
23
27
|
"smoke": "node ./bin/hcc.mjs --help",
|
|
24
28
|
"test": "node ./scripts/regression.mjs",
|
|
25
29
|
"test:regression": "node ./scripts/regression.mjs"
|