mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 21:05:51 +00:00
* feat: 适配 zed acp 协议 * docs: 完善 acp 文档 * feat: integrate feature branches + daemon/job 命令层级化 + 跨平台后台引擎 Cherry-picked from origin/lint/preview (637c908), excluding lint-only changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: correct detectMimeFromBase64 to decode raw bytes from base64 Cherry-picked from origin/lint/preview (ee36954). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: daemon 子进程 spawn 跨平台修复 + CliLaunchSpec 集中化重构 Cherry-picked from origin/lint/preview (c5f52cd), excluding lint-only formatting changes. - 新建 src/utils/cliLaunch.ts: 集中化 CLI 子进程启动层 - 修复 --daemon-worker=kind 等号格式解析 - 修复 daemon/bg fast path 缺少 setShellIfWindows() - 修复 checkPathExists 用 existsSync 替代 execSync('dir') - 7 个 spawn 站点迁移到 CliLaunchSpec Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: merge tsconfig.base.json into tsconfig.json with full compiler options The cherry-pick from637c908dropped jsx/strict/etc settings when removing tsconfig.base.json. This commit restores them in a single tsconfig.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: merge tsconfig.base.json into tsconfig.json with full compiler options The cherry-pick from637c908dropped jsx/strict/etc settings when removing tsconfig.base.json. This commit restores them in a single tsconfig.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
Task 001: daemon status / stop
来源: stub-recovery-design-1-4.md 第 1 项 优先级: P0 (首选实现项) 工作量: 小 状态: DONE
目标
让 claude daemon status 和 claude daemon stop 在任意 CLI 进程中都能正确工作,不依赖 TUI 内存态。
背景
start路径已有完整 supervisor + worker 生命周期 (src/daemon/main.ts,src/daemon/workerRegistry.ts)status/stop目前只是占位输出 (src/daemon/main.ts:49)/remote-control-server有自己的命令内 UI 状态,但只维护当前进程内的daemonProcess,不适合跨进程管理
实现方案
新增文件
| 文件 | 说明 |
|---|---|
src/daemon/state.ts |
daemon 状态文件读写模块 |
修改文件
| 文件 | 改动 |
|---|---|
src/daemon/main.ts |
start 写入状态文件;status/stop 调用 state 模块 |
src/commands/remoteControlServer/remoteControlServer.tsx |
读取同一份状态文件(轻量改动) |
状态文件
路径: ~/.claude/daemon/remote-control.json
{
"pid": 12345,
"cwd": "/path/to/project",
"startedAt": "2026-04-12T10:00:00Z",
"workerKinds": ["bridge", "rcs"],
"lastStatus": "running"
}
status 逻辑
- 读取状态文件
- 用进程探测验证 pid 是否存活
- 输出
running/stopped/stale - stale 时自动清理状态文件
stop 逻辑
- 读取 pid
- 发送
SIGTERM - 等待退出(超时兜底)
- 超时后
SIGKILL - 清理状态文件
验证步骤
claude daemon start正常启动并写入状态文件- 新开终端执行
claude daemon status,显示running - 执行
claude daemon stop,daemon 正常退出 - 再次执行
claude daemon status,返回stopped或stale cleaned - Windows 下 stop 超时兜底正常工作
风险
- Windows 信号模型和 Unix 不同,
stop需要超时兜底 - 当前设计默认单 supervisor,不处理多实例并发
依赖
无外部依赖,可独立实施。