@go-hare/claude-code 2.7.19 → 2.7.21

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.
Files changed (4) hide show
  1. package/README.md +215 -213
  2. package/bin/claude.exe +11 -11
  3. package/install.cjs +250 -250
  4. package/package.json +9 -9
package/README.md CHANGED
@@ -1,213 +1,215 @@
1
- # Claude Code(go-hare)
2
-
3
- [English README](./README_EN.md)
4
-
5
- [![GitHub Stars](https://img.shields.io/github/stars/go-hare/claude-code-1?style=flat-square&logo=github&color=yellow)](https://github.com/go-hare/claude-code-1/stargazers)
6
- [![GitHub Issues](https://img.shields.io/github/issues/go-hare/claude-code-1?style=flat-square&color=orange)](https://github.com/go-hare/claude-code-1/issues)
7
- [![Last Commit](https://img.shields.io/github/last-commit/go-hare/claude-code-1?style=flat-square&color=blue)](https://github.com/go-hare/claude-code-1/commits/main)
8
- [![Bun](https://img.shields.io/badge/runtime-Bun-black?style=flat-square&logo=bun)](https://bun.sh/)
9
- [![npm](https://img.shields.io/npm/v/@go-hare/claude-code?style=flat-square&logo=npm)](https://www.npmjs.com/package/@go-hare/claude-code)
10
-
11
- 基于官方 Claude Code CLI 的**源码还原 / 工程化重建**项目。目标是在保留 Claude Code 终端交互体验的同时,补齐多模型接入、自托管 Remote Control、ACP、daemon / 后台会话、MCP、插件与本地自动化等能力。
12
-
13
- > 本仓库**不是** Anthropic 官方产品。商标与官方 Claude Code 权利归 [Anthropic](https://www.anthropic.com/) 所有;本项目仅供学习与研究。
14
-
15
- | 能力 | 说明 |
16
- | ---- | ---- |
17
- | **多模型** | `/login` 配置 Anthropic / OpenAI / Gemini / Grok 兼容端点 |
18
- | **Remote Control** | 自托管 RCS + Web UI;`claude remote-control` / bridge |
19
- | **ACP** | Agent Client Protocol,可对接 IDE / 代理宿主 |
20
- | **Agents / Daemon** | `claude agents` dashboard、daemon job、后台会话 resume / fork |
21
- | **Fullscreen** | 对齐 densable 滚轮、Jump-to-bottom、alt-screen 等交互 |
22
- | **Poor Mode** | `/poor` 穷鬼模式:跳过记忆提取 / 建议等,降 token |
23
- | **KAIROS / Buddy** | 常驻助手与终端 buddy(feature 可开关) |
24
- | **Computer Use / Chrome** | 截图键鼠、Chrome MCP(平台完整度不一) |
25
- | **Artifacts** | HTML 上传托管(独立 Cloudflare Worker 包) |
26
- | **Voice** | 语音输入(含豆包 ASR 路径) |
27
- | **Web Search** | 内置搜索工具 |
28
- | **Langfuse** | Agent loop 可观测(可选) |
29
-
30
- 部分能力由 **feature flag** 控制(见下方);Analytics / GrowthBook / Sentry 等为占位实现,**不要当成可用企业集成**。
31
-
32
- ---
33
-
34
- ## 项目定位
35
-
36
- 这是 **CLI-first** 的 Claude Code 兼容运行时:
37
-
38
- - 主交互宿主:`src/screens/REPL.tsx` + `src/main.tsx` / `src/entrypoints/cli.tsx`
39
- - 查询主链:`src/query.ts` / `src/QueryEngine.ts`
40
- - 工具:`packages/builtin-tools`(经 `@claude-code/builtin-tools` 导出)
41
- - 远程 / 守护:`src/bridge/`、`src/daemon/`、`packages/remote-control-server/`
42
- - ACP:`src/services/acp/`、`packages/acp-link/`
43
-
44
- 仓库里**没有**独立的 `src/core` / `src/hosts` / `src/runtime` 包级 Agent Core 分层;旧文档里的 `createAgent from 'claude/core'`、`./core` 子路径描述已过时,请勿依赖。
45
-
46
- 近期主线在对齐 **densable 2.1.211** 的 agent / 会话 / 队列 / inbox / daemon 行为(git tag `v2.8.5` 合入前、`v2.8.6` 合入后)。**npm 包版本以 `package.json` / npm 为准**(当前发布线 **2.7.19**),与 git tag 可能不同步。
47
-
48
- ### 近期更新(2.7.5 → 2.7.19)
49
-
50
- | 版本 | 要点 |
51
- | ---- | ---- |
52
- | **2.7.19** | **Provider 优先级修复**:`modelType=anthropic` 不再被残留 `USE_OPENAI` 等环境变量抢优先级。 |
53
- | **2.7.18** | **Chrome multi-browser 无 OAuth**:无 OAuth 时也暴露并支持本地 multi-browser 工具(对齐 densable 本地 Chrome MCP 能力)。 |
54
- | **2.7.17** | **Claude in Chrome 扩展链路**:默认放行 agent-extension fork ID、可追加扩展白名单;本地扩展下载改走 go-hare/agent-extension release;Install local 打开仓库页;`/chrome` 去掉 (Beta) 后缀。 |
55
- | **2.7.16** | **Host effort 元数据**:`get_settings.applied` 增加 `effortLevels` / `ultracodeOfferable`,桌面端可据此渲染可用 effort 档位与 ultracode 入口。 |
56
- | **2.7.15** | **Host Effort/Ultracode 链路**:densable Host `get_settings.ultracode` + `apply_flag` 直写;`eee` 剥 fence 再 parse,fenced JSON 不再刷 ERROR。 |
57
- | **2.7.14** | **贴图降级修复**:图片 resize 失败时降级为文本提示,不再整轮吞消息。 |
58
- | **2.7.13** | **贴图 Enter 抢键修复**:贴图时清 footer,避免两个 shell 同时响应 Enter 吞消息;Fable consent 拒绝时不再错误写入 sticky effort / N9。 |
59
- | **2.7.12** | **贴图后打字吞消息修复**:共享 live ref,避免贴图 pill 后被同 tick 键入冲掉;Enter 路径进一步对齐。 |
60
- | **2.7.11** | **Effort densable 对齐**:模型驱动 effort resolve、ultracode 会话模式、ModelPicker pin 约定、effort pin 落盘;粘性滚动白屏与 effort toast 同 key 刷新修复;文字+图片同 tick Enter 吞消息修复。 |
61
- | **2.7.10** | **Shell 对话框 hooks 崩溃修复**:打开 BackgroundTasksDialog 时 PromptInput 的 `onKeyDownBefore` useCallback 位于 early return 之后导致 "Rendered fewer hooks than expected";钩子上移 + onDoneEvent 延后触发。 |
62
- | **2.7.9** | 全平台二进制重编发布(含 2.7.8 Enter 吞消息修复等当前 main)。 |
63
- | **2.7.8** | **Enter 偶发吞消息修复**:对齐 densable Enter 路径(typeahead / history search / PromptInput),避免提交键在部分状态下丢输入。 |
64
- | **2.7.7** | **OpenAI 兼容流多 ● 修复**:坏代理对每个 chunk 重发全文并带 `finish_reason` 时,不再反复开闭 text block(`normalizeMessages` 一行一个 ●);累计全文 delta 只 emit 后缀;assemble 侧合并相邻相同 text block 作防御。 |
65
- | **2.7.6** | densable streaming 对齐:Esc 仅 salvage thinking;streaming / final 双 ● 渲染修复;daemon lifecycle 只 log 不写 stderr;agents handoff 期间 quiet daemon takeover。 |
66
- | **2.7.5** | densable FileEdit/FileWrite 结果渲染;spinner 用主线程队列长度(避免 subagent 假转);idle-return 不清草稿;OSe 剪枝不写 paste ref。 |
67
-
68
- ---
69
-
70
- ## 安装(npm)
71
-
72
- 发布包名:**`@go-hare/claude-code`**(平台二进制在 `@go-hare/claude-code-<os>-<arch>` optionalDependencies)。
73
-
74
- ```sh
75
- npm i -g @go-hare/claude-code
76
-
77
- # Windows 若 claude.exe 被占用导致 EBUSY,先结束占用进程再装
78
- # taskkill /F /IM claude.exe
79
-
80
- claude # 启动(postinstall 落到 bin/)
81
- claude --version
82
- claude agents # 后台会话 dashboard(需 daemon)
83
- claude update # 更新
84
-
85
- # 自托管 Remote Control 示例(按你的 RCS 改 URL / token)
86
- CLAUDE_BRIDGE_BASE_URL=https://your-rcs.example/ \
87
- CLAUDE_BRIDGE_OAUTH_TOKEN=your-token \
88
- claude --remote-control
89
- ```
90
-
91
- 安装失败时:`npm rm -g @go-hare/claude-code` 后再装 `@latest`(可钉版本 `@2.7.17`)。
92
- 旧文档里的全局包名 `claude-code` **不再**对应本仓库发布流。
93
-
94
- ---
95
-
96
- ## 源码开发
97
-
98
- ### 环境
99
-
100
- 需要较新的 [Bun](https://bun.sh/)(建议 ≥ 1.3.11):
101
-
102
- ```bash
103
- curl -fsSL https://bun.sh/install | bash # macOS / Linux
104
- # Windows: powershell -c "irm bun.sh/install.ps1 | iex"
105
- bun upgrade
106
- ```
107
-
108
- ### 安装与运行
109
-
110
- 在**仓库根目录**(含本 `package.json` 的目录):
111
-
112
- ```bash
113
- bun install
114
- bun run dev # 开发模式(MACRO.* 由 scripts/dev.ts 注入)
115
- bun run build # 代码分割产物 → dist/cli.js + chunks
116
- bun run precheck # typecheck + biome fix + 全量测试(改完请跑)
117
- ```
118
-
119
- 跨平台二进制与发布:
120
-
121
- ```bash
122
- bun run build:compile # 仅编译当前/指定平台二进制
123
- bun run scripts/publish.ts --build-only # 同上(publish 脚本路径)
124
- bun run scripts/publish.ts --dry-run # 构建 + npm publish --dry-run
125
- bun run scripts/publish.ts --with-main # 含主包 @go-hare/claude-code
126
- ```
127
-
128
- > 平台包内的 `claude` 二进制由 build 生成,**不应**长期提交进 git。
129
-
130
- ### `/login` 配置模型
131
-
132
- REPL 中 `/login` 可选 Anthropic Compatible / OpenAI / Gemini 等:
133
-
134
- | 字段 | 说明 | 示例 |
135
- | ---- | ---- | ---- |
136
- | Base URL | API 地址 | `https://api.example.com/v1` |
137
- | API Key | 密钥 | `sk-xxx` |
138
- | Haiku / Sonnet / Opus | 模型 ID 映射 | 按你的上游填写 |
139
-
140
- Tab / Shift+Tab 切字段,Enter 确认。
141
-
142
- ### Feature Flags
143
-
144
- ```bash
145
- FEATURE_BUDDY=1 bun run dev
146
- ```
147
-
148
- 构建默认会打开一批 flag(见 `build.ts` / `scripts/defines.ts`);**默认关闭**的包括 `LAN_PIPES`、`UDS_INBOX`、`FORK_SUBAGENT` 等。群控 / Pipe 相关能力需对应 flag,不要默认当成全开。
149
-
150
- ### VS Code 调试
151
-
152
- TUI 需真实终端,用 attach:
153
-
154
- ```bash
155
- bun run dev:inspect # 输出 ws://localhost:…
156
- ```
157
-
158
- VS Code F5 → **Attach to Bun (TUI debug)**。
159
-
160
- ### Teach Me
161
-
162
- ```text
163
- /teach-me Claude Code 架构
164
- /teach-me React Ink 终端渲染 --level beginner
165
- ```
166
-
167
- 进度在 `.claude/skills/teach-me/`(若已安装该 skill)。
168
-
169
- ---
170
-
171
- ## 仓库结构(精简)
172
-
173
- | 路径 | 作用 |
174
- | ---- | ---- |
175
- | `src/entrypoints/cli.tsx` | 真入口与快速路径 |
176
- | `src/main.tsx` | Commander CLI 与启动装配 |
177
- | `src/screens/REPL.tsx` | 交互 REPL |
178
- | `src/query.ts` / `QueryEngine.ts` | API 查询与 turn 编排 |
179
- | `packages/builtin-tools/` | 内置工具 |
180
- | `packages/@ant/ink/` | 终端 Ink 框架 |
181
- | `src/bridge/` / `packages/remote-control-server/` | Remote Control |
182
- | `src/daemon/` | 长驻 daemon |
183
- | `src/services/acp/` / `packages/acp-link/` | ACP |
184
- | `scripts/publish.ts` | 平台二进制编译与 npm 发布 |
185
- | `CLAUDE.md` | 给 agent / 贡献者的详细工程说明 |
186
-
187
- 更完整的架构与测试约定见 [`CLAUDE.md`](./CLAUDE.md)。
188
-
189
- ---
190
-
191
- ## Contributors
192
-
193
- <a href="https://github.com/go-hare/claude-code-1/graphs/contributors">
194
- <img src="contributors.svg" alt="Contributors" />
195
- </a>
196
-
197
- ## Star History
198
-
199
- <a href="https://www.star-history.com/?repos=go-hare%2Fclaude-code-1&type=date&legend=top-left">
200
- <picture>
201
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=go-hare/claude-code-1&type=date&theme=dark&legend=top-left" />
202
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=go-hare/claude-code-1&type=date&legend=top-left" />
203
- <img alt="Star History Chart" src="https://api.star-history.com/image?repos=go-hare/claude-code-1&type=date&legend=top-left" />
204
- </picture>
205
- </a>
206
-
207
- ## 致谢
208
-
209
- - [doubaoime-asr](https://github.com/starccy/doubaoime-asr) — 豆包 ASR,Voice Mode 可选路径
210
-
211
- ## 许可证
212
-
213
- 仅供学习研究。Claude Code 相关权利归 Anthropic。请遵守上游与依赖的许可条款。
1
+ # Claude Code(go-hare)
2
+
3
+ [English README](./README_EN.md)
4
+
5
+ [![GitHub Stars](https://img.shields.io/github/stars/go-hare/claude-code-1?style=flat-square&logo=github&color=yellow)](https://github.com/go-hare/claude-code-1/stargazers)
6
+ [![GitHub Issues](https://img.shields.io/github/issues/go-hare/claude-code-1?style=flat-square&color=orange)](https://github.com/go-hare/claude-code-1/issues)
7
+ [![Last Commit](https://img.shields.io/github/last-commit/go-hare/claude-code-1?style=flat-square&color=blue)](https://github.com/go-hare/claude-code-1/commits/main)
8
+ [![Bun](https://img.shields.io/badge/runtime-Bun-black?style=flat-square&logo=bun)](https://bun.sh/)
9
+ [![npm](https://img.shields.io/npm/v/@go-hare/claude-code?style=flat-square&logo=npm)](https://www.npmjs.com/package/@go-hare/claude-code)
10
+
11
+ 基于官方 Claude Code CLI 的**源码还原 / 工程化重建**项目。目标是在保留 Claude Code 终端交互体验的同时,补齐多模型接入、自托管 Remote Control、ACP、daemon / 后台会话、MCP、插件与本地自动化等能力。
12
+
13
+ > 本仓库**不是** Anthropic 官方产品。商标与官方 Claude Code 权利归 [Anthropic](https://www.anthropic.com/) 所有;本项目仅供学习与研究。
14
+
15
+ | 能力 | 说明 |
16
+ | ---- | ---- |
17
+ | **多模型** | `/login` 配置 Anthropic / OpenAI / Gemini / Grok 兼容端点 |
18
+ | **Remote Control** | 自托管 RCS + Web UI;`claude remote-control` / bridge |
19
+ | **ACP** | Agent Client Protocol,可对接 IDE / 代理宿主 |
20
+ | **Agents / Daemon** | `claude agents` dashboard、daemon job、后台会话 resume / fork |
21
+ | **Fullscreen** | 对齐 densable 滚轮、Jump-to-bottom、alt-screen 等交互 |
22
+ | **Poor Mode** | `/poor` 穷鬼模式:跳过记忆提取 / 建议等,降 token |
23
+ | **KAIROS / Buddy** | 常驻助手与终端 buddy(feature 可开关) |
24
+ | **Computer Use / Chrome** | 截图键鼠、Chrome MCP(平台完整度不一) |
25
+ | **Artifacts** | HTML 上传托管(独立 Cloudflare Worker 包) |
26
+ | **Voice** | 语音输入(含豆包 ASR 路径) |
27
+ | **Web Search** | 内置搜索工具 |
28
+ | **Langfuse** | Agent loop 可观测(可选) |
29
+
30
+ 部分能力由 **feature flag** 控制(见下方);Analytics / GrowthBook / Sentry 等为占位实现,**不要当成可用企业集成**。
31
+
32
+ ---
33
+
34
+ ## 项目定位
35
+
36
+ 这是 **CLI-first** 的 Claude Code 兼容运行时:
37
+
38
+ - 主交互宿主:`src/screens/REPL.tsx` + `src/main.tsx` / `src/entrypoints/cli.tsx`
39
+ - 查询主链:`src/query.ts` / `src/QueryEngine.ts`
40
+ - 工具:`packages/builtin-tools`(经 `@claude-code/builtin-tools` 导出)
41
+ - 远程 / 守护:`src/bridge/`、`src/daemon/`、`packages/remote-control-server/`
42
+ - ACP:`src/services/acp/`、`packages/acp-link/`
43
+
44
+ 仓库里**没有**独立的 `src/core` / `src/hosts` / `src/runtime` 包级 Agent Core 分层;旧文档里的 `createAgent from 'claude/core'`、`./core` 子路径描述已过时,请勿依赖。
45
+
46
+ 近期主线在对齐 **densable 2.1.211** 的 agent / 会话 / 队列 / inbox / daemon 行为(git tag `v2.8.5` 合入前、`v2.8.6` 合入后)。**npm 包版本以 `package.json` / npm 为准**(当前发布线 **2.7.21**),与 git tag 可能不同步。
47
+
48
+ ### 近期更新(2.7.5 → 2.7.21)
49
+
50
+ | 版本 | 要点 |
51
+ | ---- | ---- |
52
+ | **2.7.21** | **Workflow / ultracode densable 对齐**:完整 playbook 挂在 Workflow 工具 prompt(ONLY-call-when opt-in);`/ultracode` 改为 `disableModelInvocation` 用户只读,去掉宽 whenToUse 自举路径。 |
53
+ | **2.7.20** | **Workflow host densable 对齐**:`/workflows` 改为历史浏览器(GsK);live 监控走 Tasks `WorkflowDetailDialog`(fv_)+ `task.workflowProgress`;删除双栏 `WorkflowsPanel`;补 progress fold / SDK `task_progress` 桥接与 history 导航键位修复。 |
54
+ | **2.7.19** | **Provider 优先级修复**:`modelType=anthropic` 不再被残留 `USE_OPENAI` / `USE_GEMINI` / `USE_GROK` 等环境变量抢优先级。 |
55
+ | **2.7.18** | **Chrome multi-browser 无 OAuth**:无 OAuth 时也暴露并支持本地 multi-browser 工具(对齐 densable 本地 Chrome MCP 能力)。 |
56
+ | **2.7.17** | **Claude in Chrome 扩展链路**:默认放行 agent-extension fork ID、可追加扩展白名单;本地扩展下载改走 go-hare/agent-extension release;Install local 打开仓库页;`/chrome` 去掉 (Beta) 后缀。 |
57
+ | **2.7.16** | **Host effort 元数据**:`get_settings.applied` 增加 `effortLevels` / `ultracodeOfferable`,桌面端可据此渲染可用 effort 档位与 ultracode 入口。 |
58
+ | **2.7.15** | **Host Effort/Ultracode 链路**:densable Host `get_settings.ultracode` + `apply_flag` 直写;`eee` 剥 fence 再 parse,fenced JSON 不再刷 ERROR。 |
59
+ | **2.7.14** | **贴图降级修复**:图片 resize 失败时降级为文本提示,不再整轮吞消息。 |
60
+ | **2.7.13** | **贴图 Enter 抢键修复**:贴图时清 footer,避免两个 shell 同时响应 Enter 吞消息;Fable consent 拒绝时不再错误写入 sticky effort / N9。 |
61
+ | **2.7.12** | **贴图后打字吞消息修复**:共享 live ref,避免贴图 pill 后被同 tick 键入冲掉;Enter 路径进一步对齐。 |
62
+ | **2.7.11** | **Effort densable 对齐**:模型驱动 effort resolve、ultracode 会话模式、ModelPicker pin 约定、effort pin 落盘;粘性滚动白屏与 effort toast 同 key 刷新修复;文字+图片同 tick Enter 吞消息修复。 |
63
+ | **2.7.10** | **Shell 对话框 hooks 崩溃修复**:打开 BackgroundTasksDialog 时 PromptInput 的 `onKeyDownBefore` useCallback 位于 early return 之后导致 "Rendered fewer hooks than expected";钩子上移 + onDoneEvent 延后触发。 |
64
+ | **2.7.9** | 全平台二进制重编发布(含 2.7.8 Enter 吞消息修复等当前 main)。 |
65
+ | **2.7.8** | **Enter 偶发吞消息修复**:对齐 densable Enter 路径(typeahead / history search / PromptInput),避免提交键在部分状态下丢输入。 |
66
+ | **2.7.7** | **OpenAI 兼容流多 ● 修复**:坏代理对每个 chunk 重发全文并带 `finish_reason` 时,不再反复开闭 text block(`normalizeMessages` 一行一个 ●);累计全文 delta 只 emit 后缀;assemble 侧合并相邻相同 text block 作防御。 |
67
+ | **2.7.6** | densable streaming 对齐:Esc 仅 salvage thinking;streaming / final 双 ● 渲染修复;daemon lifecycle 只 log 不写 stderr;agents handoff 期间 quiet daemon takeover。 |
68
+ | **2.7.5** | densable FileEdit/FileWrite 结果渲染;spinner 用主线程队列长度(避免 subagent 假转);idle-return 不清草稿;OSe 剪枝不写 paste ref。 |
69
+
70
+ ---
71
+
72
+ ## 安装(npm)
73
+
74
+ 发布包名:**`@go-hare/claude-code`**(平台二进制在 `@go-hare/claude-code-<os>-<arch>` optionalDependencies)。
75
+
76
+ ```sh
77
+ npm i -g @go-hare/claude-code
78
+
79
+ # Windows 若 claude.exe 被占用导致 EBUSY,先结束占用进程再装
80
+ # taskkill /F /IM claude.exe
81
+
82
+ claude # 启动(postinstall 落到 bin/)
83
+ claude --version
84
+ claude agents # 后台会话 dashboard(需 daemon)
85
+ claude update # 更新
86
+
87
+ # 自托管 Remote Control 示例(按你的 RCS 改 URL / token)
88
+ CLAUDE_BRIDGE_BASE_URL=https://your-rcs.example/ \
89
+ CLAUDE_BRIDGE_OAUTH_TOKEN=your-token \
90
+ claude --remote-control
91
+ ```
92
+
93
+ 安装失败时:`npm rm -g @go-hare/claude-code` 后再装 `@latest`(可钉版本 `@2.7.17`)。
94
+ 旧文档里的全局包名 `claude-code` **不再**对应本仓库发布流。
95
+
96
+ ---
97
+
98
+ ## 源码开发
99
+
100
+ ### 环境
101
+
102
+ 需要较新的 [Bun](https://bun.sh/)(建议 ≥ 1.3.11):
103
+
104
+ ```bash
105
+ curl -fsSL https://bun.sh/install | bash # macOS / Linux
106
+ # Windows: powershell -c "irm bun.sh/install.ps1 | iex"
107
+ bun upgrade
108
+ ```
109
+
110
+ ### 安装与运行
111
+
112
+ 在**仓库根目录**(含本 `package.json` 的目录):
113
+
114
+ ```bash
115
+ bun install
116
+ bun run dev # 开发模式(MACRO.* 由 scripts/dev.ts 注入)
117
+ bun run build # 代码分割产物 → dist/cli.js + chunks
118
+ bun run precheck # typecheck + biome fix + 全量测试(改完请跑)
119
+ ```
120
+
121
+ 跨平台二进制与发布:
122
+
123
+ ```bash
124
+ bun run build:compile # 仅编译当前/指定平台二进制
125
+ bun run scripts/publish.ts --build-only # 同上(publish 脚本路径)
126
+ bun run scripts/publish.ts --dry-run # 构建 + npm publish --dry-run
127
+ bun run scripts/publish.ts --with-main # 含主包 @go-hare/claude-code
128
+ ```
129
+
130
+ > 平台包内的 `claude` 二进制由 build 生成,**不应**长期提交进 git。
131
+
132
+ ### `/login` 配置模型
133
+
134
+ REPL 中 `/login` 可选 Anthropic Compatible / OpenAI / Gemini 等:
135
+
136
+ | 字段 | 说明 | 示例 |
137
+ | ---- | ---- | ---- |
138
+ | Base URL | API 地址 | `https://api.example.com/v1` |
139
+ | API Key | 密钥 | `sk-xxx` |
140
+ | Haiku / Sonnet / Opus | 模型 ID 映射 | 按你的上游填写 |
141
+
142
+ Tab / Shift+Tab 切字段,Enter 确认。
143
+
144
+ ### Feature Flags
145
+
146
+ ```bash
147
+ FEATURE_BUDDY=1 bun run dev
148
+ ```
149
+
150
+ 构建默认会打开一批 flag(见 `build.ts` / `scripts/defines.ts`);**默认关闭**的包括 `LAN_PIPES`、`UDS_INBOX`、`FORK_SUBAGENT` 等。群控 / Pipe 相关能力需对应 flag,不要默认当成全开。
151
+
152
+ ### VS Code 调试
153
+
154
+ TUI 需真实终端,用 attach:
155
+
156
+ ```bash
157
+ bun run dev:inspect # 输出 ws://localhost:…
158
+ ```
159
+
160
+ VS Code F5 → **Attach to Bun (TUI debug)**。
161
+
162
+ ### Teach Me
163
+
164
+ ```text
165
+ /teach-me Claude Code 架构
166
+ /teach-me React Ink 终端渲染 --level beginner
167
+ ```
168
+
169
+ 进度在 `.claude/skills/teach-me/`(若已安装该 skill)。
170
+
171
+ ---
172
+
173
+ ## 仓库结构(精简)
174
+
175
+ | 路径 | 作用 |
176
+ | ---- | ---- |
177
+ | `src/entrypoints/cli.tsx` | 真入口与快速路径 |
178
+ | `src/main.tsx` | Commander CLI 与启动装配 |
179
+ | `src/screens/REPL.tsx` | 交互 REPL |
180
+ | `src/query.ts` / `QueryEngine.ts` | API 查询与 turn 编排 |
181
+ | `packages/builtin-tools/` | 内置工具 |
182
+ | `packages/@ant/ink/` | 终端 Ink 框架 |
183
+ | `src/bridge/` / `packages/remote-control-server/` | Remote Control |
184
+ | `src/daemon/` | 长驻 daemon |
185
+ | `src/services/acp/` / `packages/acp-link/` | ACP |
186
+ | `scripts/publish.ts` | 平台二进制编译与 npm 发布 |
187
+ | `CLAUDE.md` | 给 agent / 贡献者的详细工程说明 |
188
+
189
+ 更完整的架构与测试约定见 [`CLAUDE.md`](./CLAUDE.md)。
190
+
191
+ ---
192
+
193
+ ## Contributors
194
+
195
+ <a href="https://github.com/go-hare/claude-code-1/graphs/contributors">
196
+ <img src="contributors.svg" alt="Contributors" />
197
+ </a>
198
+
199
+ ## Star History
200
+
201
+ <a href="https://www.star-history.com/?repos=go-hare%2Fclaude-code-1&type=date&legend=top-left">
202
+ <picture>
203
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=go-hare/claude-code-1&type=date&theme=dark&legend=top-left" />
204
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=go-hare/claude-code-1&type=date&legend=top-left" />
205
+ <img alt="Star History Chart" src="https://api.star-history.com/image?repos=go-hare/claude-code-1&type=date&legend=top-left" />
206
+ </picture>
207
+ </a>
208
+
209
+ ## 致谢
210
+
211
+ - [doubaoime-asr](https://github.com/starccy/doubaoime-asr) — 豆包 ASR,Voice Mode 可选路径
212
+
213
+ ## 许可证
214
+
215
+ 仅供学习研究。Claude Code 相关权利归 Anthropic。请遵守上游与依赖的许可条款。
package/bin/claude.exe CHANGED
@@ -1,11 +1,11 @@
1
- echo "Error: claude native binary not installed." >&2
2
- echo "" >&2
3
- echo "Either postinstall did not run (--ignore-scripts, some pnpm configs)" >&2
4
- echo "or the platform-native optional dependency was not downloaded" >&2
5
- echo "(--omit=optional)." >&2
6
- echo "" >&2
7
- echo "Run the postinstall manually (adjust path for local vs global install):" >&2
8
- echo " node node_modules/@go-hare/claude-code/install.cjs" >&2
9
- echo "" >&2
10
- echo "Or reinstall without --ignore-scripts / --omit=optional." >&2
11
- exit 1
1
+ echo "Error: claude native binary not installed." >&2
2
+ echo "" >&2
3
+ echo "Either postinstall did not run (--ignore-scripts, some pnpm configs)" >&2
4
+ echo "or the platform-native optional dependency was not downloaded" >&2
5
+ echo "(--omit=optional)." >&2
6
+ echo "" >&2
7
+ echo "Run the postinstall manually (adjust path for local vs global install):" >&2
8
+ echo " node node_modules/@go-hare/claude-code/install.cjs" >&2
9
+ echo "" >&2
10
+ echo "Or reinstall without --ignore-scripts / --omit=optional." >&2
11
+ exit 1
package/install.cjs CHANGED
@@ -1,250 +1,250 @@
1
- #!/usr/bin/env node
2
- // Postinstall for the claude wrapper package.
3
- //
4
- // In development (monorepo with .git), delegates to the dev postinstall scripts.
5
- // In production (npm install from registry), copies the native binary from the
6
- // platform-specific optionalDependency into bin/claude.exe.
7
- //
8
- // Platform detection + PLATFORMS map is duplicated in cli-wrapper.cjs — keep in sync.
9
-
10
- const { spawnSync } = require('child_process')
11
- const {
12
- copyFileSync,
13
- cpSync,
14
- existsSync,
15
- linkSync,
16
- unlinkSync,
17
- chmodSync,
18
- readFileSync,
19
- writeFileSync,
20
- statSync,
21
- readdirSync,
22
- mkdirSync,
23
- } = require('fs')
24
- const { arch } = require('os')
25
- const path = require('path')
26
-
27
- // Dev environment detection: if .git exists at package root, we're in the monorepo
28
- if (existsSync(path.join(__dirname, '.git'))) {
29
- // densable Claude in Chrome uses @ant/claude-for-chrome-mcp + native host
30
- // (CLI --chrome / /chrome). Do not run hangye mcp-chrome-bridge setup.
31
- const r = spawnSync(
32
- 'node',
33
- ['scripts/run-parallel.mjs', 'scripts/postinstall.cjs'],
34
- { cwd: __dirname, stdio: 'inherit' },
35
- )
36
- process.exit(r.status ?? 0)
37
- }
38
-
39
- const PACKAGE_PREFIX = '@go-hare/claude-code'
40
- const BINARY_NAME = 'claude'
41
- const WRAPPER_NAME = require('./package.json').name
42
-
43
- const PLATFORMS = {
44
- 'darwin-arm64': { pkg: PACKAGE_PREFIX + '-darwin-arm64', bin: BINARY_NAME },
45
- 'darwin-x64': { pkg: PACKAGE_PREFIX + '-darwin-x64', bin: BINARY_NAME },
46
- 'linux-x64': { pkg: PACKAGE_PREFIX + '-linux-x64', bin: BINARY_NAME },
47
- 'linux-arm64': { pkg: PACKAGE_PREFIX + '-linux-arm64', bin: BINARY_NAME },
48
- 'linux-x64-musl': {
49
- pkg: PACKAGE_PREFIX + '-linux-x64-musl',
50
- bin: BINARY_NAME,
51
- },
52
- 'linux-arm64-musl': {
53
- pkg: PACKAGE_PREFIX + '-linux-arm64-musl',
54
- bin: BINARY_NAME,
55
- },
56
- 'linux-arm64-android': {
57
- pkg: PACKAGE_PREFIX + '-linux-arm64-android',
58
- bin: BINARY_NAME,
59
- },
60
- 'linux-x64-android': {
61
- pkg: PACKAGE_PREFIX + '-linux-x64-android',
62
- bin: BINARY_NAME,
63
- },
64
- 'freebsd-x64': { pkg: PACKAGE_PREFIX + '-freebsd-x64', bin: BINARY_NAME },
65
- 'freebsd-arm64': {
66
- pkg: PACKAGE_PREFIX + '-freebsd-arm64',
67
- bin: BINARY_NAME,
68
- },
69
- 'win32-x64': {
70
- pkg: PACKAGE_PREFIX + '-win32-x64',
71
- bin: BINARY_NAME + '.exe',
72
- },
73
- 'win32-arm64': {
74
- pkg: PACKAGE_PREFIX + '-win32-arm64',
75
- bin: BINARY_NAME + '.exe',
76
- },
77
- }
78
-
79
- function detectMusl() {
80
- if (process.platform !== 'linux') return false
81
- const report =
82
- typeof process.report?.getReport === 'function'
83
- ? process.report.getReport()
84
- : null
85
- return report != null && report.header?.glibcVersionRuntime === undefined
86
- }
87
-
88
- function getPlatformKey() {
89
- const platform = process.platform
90
- let cpu = arch()
91
- if (platform === 'android') return 'linux-' + cpu + '-android'
92
- if (platform === 'linux')
93
- return 'linux-' + cpu + (detectMusl() ? '-musl' : '')
94
- if (platform === 'darwin' && cpu === 'x64') {
95
- const r = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], {
96
- encoding: 'utf8',
97
- })
98
- if (r.stdout?.trim() === '1') cpu = 'arm64'
99
- }
100
- return platform + '-' + cpu
101
- }
102
-
103
- function placeBinary(src, dest) {
104
- try {
105
- linkSync(src, dest)
106
- } catch (err) {
107
- if (err.code === 'EEXIST') {
108
- const stub = statSync(dest).size < 4096 ? readFileSync(dest) : null
109
- unlinkSync(dest)
110
- try {
111
- linkSync(src, dest)
112
- } catch {
113
- try {
114
- copyFileSync(src, dest)
115
- } catch (copyErr) {
116
- if (stub) {
117
- try {
118
- writeFileSync(dest, stub, { mode: 0o755 })
119
- } catch {}
120
- }
121
- throw copyErr
122
- }
123
- }
124
- } else if (err.code === 'EXDEV' || err.code === 'EPERM') {
125
- copyFileSync(src, dest)
126
- } else {
127
- throw err
128
- }
129
- }
130
- if (process.platform !== 'win32') chmodSync(dest, 0o755)
131
- }
132
-
133
- // npm install may drop the executable bit on vendored helpers (clipboard-image,
134
- // ripgrep). Only the main binary was chmod'd before — restore +x under vendor/.
135
- function ensureVendorBinariesExecutable(pkgDir) {
136
- if (process.platform === 'win32') return
137
-
138
- const vendorDir = path.join(pkgDir, 'vendor')
139
- if (!existsSync(vendorDir)) return
140
-
141
- const stack = [vendorDir]
142
- while (stack.length > 0) {
143
- const dir = stack.pop()
144
- let entries
145
- try {
146
- entries = readdirSync(dir, { withFileTypes: true })
147
- } catch {
148
- continue
149
- }
150
- for (const entry of entries) {
151
- const full = path.join(dir, entry.name)
152
- if (entry.isDirectory()) {
153
- stack.push(full)
154
- continue
155
- }
156
- if (!entry.isFile()) continue
157
- try {
158
- chmodSync(full, 0o755)
159
- } catch {
160
- // Best-effort: missing write permission shouldn't fail install.
161
- }
162
- }
163
- }
164
- }
165
-
166
- function main() {
167
- const platformKey = getPlatformKey()
168
- const info = PLATFORMS[platformKey]
169
-
170
- if (!info) {
171
- console.error(
172
- `[${WRAPPER_NAME} postinstall] Unsupported platform: ${process.platform} ${arch()}`,
173
- )
174
- console.error(` Supported: ${Object.keys(PLATFORMS).join(', ')}`)
175
- return
176
- }
177
-
178
- const optionalDeps = require('./package.json').optionalDependencies || {}
179
- if (!optionalDeps[info.pkg]) {
180
- console.error(
181
- `[${WRAPPER_NAME} postinstall] Native binaries for ${platformKey} are not available on this release channel.`,
182
- )
183
- console.error(
184
- ` Available: ${Object.keys(optionalDeps)
185
- .map(p => p.replace(PACKAGE_PREFIX + '-', ''))
186
- .join(', ')}`,
187
- )
188
- return
189
- }
190
-
191
- let pkgDir
192
- let src
193
- try {
194
- pkgDir = path.dirname(require.resolve(info.pkg + '/package.json'))
195
- src = path.join(pkgDir, info.bin)
196
- } catch {
197
- console.error(
198
- `[${WRAPPER_NAME} postinstall] Native package "${info.pkg}" not found.`,
199
- )
200
- console.error(
201
- ' This happens with --omit=optional or when the download failed.',
202
- )
203
- console.error(
204
- ' The `claude` command will print instructions when invoked.',
205
- )
206
- console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
207
- return
208
- }
209
-
210
- const dest = path.join(__dirname, 'bin', 'claude.exe')
211
-
212
- try {
213
- placeBinary(src, dest)
214
- // Bundled claude.exe resolves vendored rg next to process.execPath
215
- // (bin/vendor/ripgrep/<platform>/rg[.exe]). Copy platform-package vendor
216
- // tree beside the placed binary so Grep/Glob work without system rg.
217
- copyVendorBesideBinary(pkgDir, dest)
218
- ensureVendorBinariesExecutable(pkgDir)
219
- ensureVendorBinariesExecutable(path.dirname(dest))
220
- } catch (err) {
221
- console.error(
222
- `[${WRAPPER_NAME} postinstall] Failed to place binary: ${err.message}`,
223
- )
224
- console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
225
- process.exitCode = 1
226
- }
227
- }
228
-
229
- /**
230
- * Copy platform package `vendor/` next to the installed native binary.
231
- * Required on Windows (and useful elsewhere) so builtin ripgrep is found at:
232
- * <dir of claude.exe>/vendor/ripgrep/<arch>-win32/rg.exe
233
- */
234
- function copyVendorBesideBinary(pkgDir, destBinary) {
235
- const srcVendor = path.join(pkgDir, 'vendor')
236
- if (!existsSync(srcVendor)) return
237
-
238
- const destVendor = path.join(path.dirname(destBinary), 'vendor')
239
- try {
240
- mkdirSync(path.dirname(destVendor), { recursive: true })
241
- cpSync(srcVendor, destVendor, { recursive: true, force: true })
242
- } catch (err) {
243
- console.error(
244
- `[${WRAPPER_NAME} postinstall] Warning: could not copy vendor helpers: ${err.message}`,
245
- )
246
- console.error(' Grep/Glob may fall back to system ripgrep if available.')
247
- }
248
- }
249
-
250
- main()
1
+ #!/usr/bin/env node
2
+ // Postinstall for the claude wrapper package.
3
+ //
4
+ // In development (monorepo with .git), delegates to the dev postinstall scripts.
5
+ // In production (npm install from registry), copies the native binary from the
6
+ // platform-specific optionalDependency into bin/claude.exe.
7
+ //
8
+ // Platform detection + PLATFORMS map is duplicated in cli-wrapper.cjs — keep in sync.
9
+
10
+ const { spawnSync } = require('child_process')
11
+ const {
12
+ copyFileSync,
13
+ cpSync,
14
+ existsSync,
15
+ linkSync,
16
+ unlinkSync,
17
+ chmodSync,
18
+ readFileSync,
19
+ writeFileSync,
20
+ statSync,
21
+ readdirSync,
22
+ mkdirSync,
23
+ } = require('fs')
24
+ const { arch } = require('os')
25
+ const path = require('path')
26
+
27
+ // Dev environment detection: if .git exists at package root, we're in the monorepo
28
+ if (existsSync(path.join(__dirname, '.git'))) {
29
+ // densable Claude in Chrome uses @ant/claude-for-chrome-mcp + native host
30
+ // (CLI --chrome / /chrome). Do not run hangye mcp-chrome-bridge setup.
31
+ const r = spawnSync(
32
+ 'node',
33
+ ['scripts/run-parallel.mjs', 'scripts/postinstall.cjs'],
34
+ { cwd: __dirname, stdio: 'inherit' },
35
+ )
36
+ process.exit(r.status ?? 0)
37
+ }
38
+
39
+ const PACKAGE_PREFIX = '@go-hare/claude-code'
40
+ const BINARY_NAME = 'claude'
41
+ const WRAPPER_NAME = require('./package.json').name
42
+
43
+ const PLATFORMS = {
44
+ 'darwin-arm64': { pkg: PACKAGE_PREFIX + '-darwin-arm64', bin: BINARY_NAME },
45
+ 'darwin-x64': { pkg: PACKAGE_PREFIX + '-darwin-x64', bin: BINARY_NAME },
46
+ 'linux-x64': { pkg: PACKAGE_PREFIX + '-linux-x64', bin: BINARY_NAME },
47
+ 'linux-arm64': { pkg: PACKAGE_PREFIX + '-linux-arm64', bin: BINARY_NAME },
48
+ 'linux-x64-musl': {
49
+ pkg: PACKAGE_PREFIX + '-linux-x64-musl',
50
+ bin: BINARY_NAME,
51
+ },
52
+ 'linux-arm64-musl': {
53
+ pkg: PACKAGE_PREFIX + '-linux-arm64-musl',
54
+ bin: BINARY_NAME,
55
+ },
56
+ 'linux-arm64-android': {
57
+ pkg: PACKAGE_PREFIX + '-linux-arm64-android',
58
+ bin: BINARY_NAME,
59
+ },
60
+ 'linux-x64-android': {
61
+ pkg: PACKAGE_PREFIX + '-linux-x64-android',
62
+ bin: BINARY_NAME,
63
+ },
64
+ 'freebsd-x64': { pkg: PACKAGE_PREFIX + '-freebsd-x64', bin: BINARY_NAME },
65
+ 'freebsd-arm64': {
66
+ pkg: PACKAGE_PREFIX + '-freebsd-arm64',
67
+ bin: BINARY_NAME,
68
+ },
69
+ 'win32-x64': {
70
+ pkg: PACKAGE_PREFIX + '-win32-x64',
71
+ bin: BINARY_NAME + '.exe',
72
+ },
73
+ 'win32-arm64': {
74
+ pkg: PACKAGE_PREFIX + '-win32-arm64',
75
+ bin: BINARY_NAME + '.exe',
76
+ },
77
+ }
78
+
79
+ function detectMusl() {
80
+ if (process.platform !== 'linux') return false
81
+ const report =
82
+ typeof process.report?.getReport === 'function'
83
+ ? process.report.getReport()
84
+ : null
85
+ return report != null && report.header?.glibcVersionRuntime === undefined
86
+ }
87
+
88
+ function getPlatformKey() {
89
+ const platform = process.platform
90
+ let cpu = arch()
91
+ if (platform === 'android') return 'linux-' + cpu + '-android'
92
+ if (platform === 'linux')
93
+ return 'linux-' + cpu + (detectMusl() ? '-musl' : '')
94
+ if (platform === 'darwin' && cpu === 'x64') {
95
+ const r = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], {
96
+ encoding: 'utf8',
97
+ })
98
+ if (r.stdout?.trim() === '1') cpu = 'arm64'
99
+ }
100
+ return platform + '-' + cpu
101
+ }
102
+
103
+ function placeBinary(src, dest) {
104
+ try {
105
+ linkSync(src, dest)
106
+ } catch (err) {
107
+ if (err.code === 'EEXIST') {
108
+ const stub = statSync(dest).size < 4096 ? readFileSync(dest) : null
109
+ unlinkSync(dest)
110
+ try {
111
+ linkSync(src, dest)
112
+ } catch {
113
+ try {
114
+ copyFileSync(src, dest)
115
+ } catch (copyErr) {
116
+ if (stub) {
117
+ try {
118
+ writeFileSync(dest, stub, { mode: 0o755 })
119
+ } catch {}
120
+ }
121
+ throw copyErr
122
+ }
123
+ }
124
+ } else if (err.code === 'EXDEV' || err.code === 'EPERM') {
125
+ copyFileSync(src, dest)
126
+ } else {
127
+ throw err
128
+ }
129
+ }
130
+ if (process.platform !== 'win32') chmodSync(dest, 0o755)
131
+ }
132
+
133
+ // npm install may drop the executable bit on vendored helpers (clipboard-image,
134
+ // ripgrep). Only the main binary was chmod'd before — restore +x under vendor/.
135
+ function ensureVendorBinariesExecutable(pkgDir) {
136
+ if (process.platform === 'win32') return
137
+
138
+ const vendorDir = path.join(pkgDir, 'vendor')
139
+ if (!existsSync(vendorDir)) return
140
+
141
+ const stack = [vendorDir]
142
+ while (stack.length > 0) {
143
+ const dir = stack.pop()
144
+ let entries
145
+ try {
146
+ entries = readdirSync(dir, { withFileTypes: true })
147
+ } catch {
148
+ continue
149
+ }
150
+ for (const entry of entries) {
151
+ const full = path.join(dir, entry.name)
152
+ if (entry.isDirectory()) {
153
+ stack.push(full)
154
+ continue
155
+ }
156
+ if (!entry.isFile()) continue
157
+ try {
158
+ chmodSync(full, 0o755)
159
+ } catch {
160
+ // Best-effort: missing write permission shouldn't fail install.
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ function main() {
167
+ const platformKey = getPlatformKey()
168
+ const info = PLATFORMS[platformKey]
169
+
170
+ if (!info) {
171
+ console.error(
172
+ `[${WRAPPER_NAME} postinstall] Unsupported platform: ${process.platform} ${arch()}`,
173
+ )
174
+ console.error(` Supported: ${Object.keys(PLATFORMS).join(', ')}`)
175
+ return
176
+ }
177
+
178
+ const optionalDeps = require('./package.json').optionalDependencies || {}
179
+ if (!optionalDeps[info.pkg]) {
180
+ console.error(
181
+ `[${WRAPPER_NAME} postinstall] Native binaries for ${platformKey} are not available on this release channel.`,
182
+ )
183
+ console.error(
184
+ ` Available: ${Object.keys(optionalDeps)
185
+ .map(p => p.replace(PACKAGE_PREFIX + '-', ''))
186
+ .join(', ')}`,
187
+ )
188
+ return
189
+ }
190
+
191
+ let pkgDir
192
+ let src
193
+ try {
194
+ pkgDir = path.dirname(require.resolve(info.pkg + '/package.json'))
195
+ src = path.join(pkgDir, info.bin)
196
+ } catch {
197
+ console.error(
198
+ `[${WRAPPER_NAME} postinstall] Native package "${info.pkg}" not found.`,
199
+ )
200
+ console.error(
201
+ ' This happens with --omit=optional or when the download failed.',
202
+ )
203
+ console.error(
204
+ ' The `claude` command will print instructions when invoked.',
205
+ )
206
+ console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
207
+ return
208
+ }
209
+
210
+ const dest = path.join(__dirname, 'bin', 'claude.exe')
211
+
212
+ try {
213
+ placeBinary(src, dest)
214
+ // Bundled claude.exe resolves vendored rg next to process.execPath
215
+ // (bin/vendor/ripgrep/<platform>/rg[.exe]). Copy platform-package vendor
216
+ // tree beside the placed binary so Grep/Glob work without system rg.
217
+ copyVendorBesideBinary(pkgDir, dest)
218
+ ensureVendorBinariesExecutable(pkgDir)
219
+ ensureVendorBinariesExecutable(path.dirname(dest))
220
+ } catch (err) {
221
+ console.error(
222
+ `[${WRAPPER_NAME} postinstall] Failed to place binary: ${err.message}`,
223
+ )
224
+ console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
225
+ process.exitCode = 1
226
+ }
227
+ }
228
+
229
+ /**
230
+ * Copy platform package `vendor/` next to the installed native binary.
231
+ * Required on Windows (and useful elsewhere) so builtin ripgrep is found at:
232
+ * <dir of claude.exe>/vendor/ripgrep/<arch>-win32/rg.exe
233
+ */
234
+ function copyVendorBesideBinary(pkgDir, destBinary) {
235
+ const srcVendor = path.join(pkgDir, 'vendor')
236
+ if (!existsSync(srcVendor)) return
237
+
238
+ const destVendor = path.join(path.dirname(destBinary), 'vendor')
239
+ try {
240
+ mkdirSync(path.dirname(destVendor), { recursive: true })
241
+ cpSync(srcVendor, destVendor, { recursive: true, force: true })
242
+ } catch (err) {
243
+ console.error(
244
+ `[${WRAPPER_NAME} postinstall] Warning: could not copy vendor helpers: ${err.message}`,
245
+ )
246
+ console.error(' Grep/Glob may fall back to system ripgrep if available.')
247
+ }
248
+ }
249
+
250
+ main()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-hare/claude-code",
3
- "version": "2.7.19",
3
+ "version": "2.7.21",
4
4
  "description": "Source restoration / engineering rebuild of Anthropic Claude Code CLI — multi-provider models, self-hosted Remote Control, ACP, daemon sessions, MCP, plugins, and terminal automation",
5
5
  "type": "module",
6
6
  "author": "DeQiang",
@@ -39,14 +39,14 @@
39
39
  "README.md"
40
40
  ],
41
41
  "optionalDependencies": {
42
- "@go-hare/claude-code-darwin-arm64": ">=2.7.19",
43
- "@go-hare/claude-code-darwin-x64": ">=2.7.19",
44
- "@go-hare/claude-code-linux-x64": ">=2.7.19",
45
- "@go-hare/claude-code-linux-arm64": ">=2.7.19",
46
- "@go-hare/claude-code-linux-x64-musl": ">=2.7.19",
47
- "@go-hare/claude-code-linux-arm64-musl": ">=2.7.19",
48
- "@go-hare/claude-code-win32-x64": ">=2.7.19",
49
- "@go-hare/claude-code-win32-arm64": ">=2.7.19",
42
+ "@go-hare/claude-code-darwin-arm64": ">=2.7.21",
43
+ "@go-hare/claude-code-darwin-x64": ">=2.7.21",
44
+ "@go-hare/claude-code-linux-x64": ">=2.7.21",
45
+ "@go-hare/claude-code-linux-arm64": ">=2.7.21",
46
+ "@go-hare/claude-code-linux-x64-musl": ">=2.7.21",
47
+ "@go-hare/claude-code-linux-arm64-musl": ">=2.7.21",
48
+ "@go-hare/claude-code-win32-x64": ">=2.7.21",
49
+ "@go-hare/claude-code-win32-arm64": ">=2.7.21",
50
50
  "doubaoime-asr": "^0.1.0"
51
51
  },
52
52
  "scripts": {