@go-hare/claude-code 2.7.27 → 2.7.28
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/README.md +6 -3
- package/install.cjs +250 -250
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -43,13 +43,16 @@
|
|
|
43
43
|
|
|
44
44
|
仓库里**没有**独立的 `src/core` / `src/hosts` / `src/runtime` 包级 Agent Core 分层;旧文档里的 `createAgent from 'claude/core'`、`./core` 子路径描述已过时,请勿依赖。
|
|
45
45
|
|
|
46
|
-
近期主线在对齐 **densable 2.1.211** 的 agent / 会话 / 队列 / inbox / daemon 行为(git tag `v2.8.5` 合入前、`v2.8.6` 合入后)。**npm 包版本以 `package.json` / npm 为准**(当前发布线 **2.7.
|
|
46
|
+
近期主线在对齐 **densable 2.1.211** 的 agent / 会话 / 队列 / inbox / daemon 行为(git tag `v2.8.5` 合入前、`v2.8.6` 合入后)。**npm 包版本以 `package.json` / npm 为准**(当前发布线 **2.7.28**),与 git tag 可能不同步。
|
|
47
47
|
|
|
48
|
-
### 近期更新(2.7.5 → 2.7.
|
|
48
|
+
### 近期更新(2.7.5 → 2.7.28)
|
|
49
49
|
|
|
50
50
|
| 版本 | 要点 |
|
|
51
51
|
| ---- | ---- |
|
|
52
|
-
| **2.7.
|
|
52
|
+
| **2.7.28** | **Win 打包剪贴板贴图**:`bun --compile` 下 sharp 原生模块不可用时改走 System.Drawing 缩放/JPEG;dev 仍用 sharp。 |
|
|
53
|
+
| **2.7.27** | **Prompt 通知条高度**:绝对定位区 height 2→1,避免最新通知盖住 prompt 顶边框(如剪贴板图片 `alt+v` 提示)。 |
|
|
54
|
+
| **2.7.26** | **Win 剪贴板图片粘贴**:Git Bash 下 PowerShell `shell:false` argv;空 paste 开 Windows;优先 PNG 流;客户端 ≥8px 拦截 1×1;Buddy/KAIROS 文档对齐 densable 211。 |
|
|
55
|
+
| **2.7.25** | **Host densable 211 生产路径**:永久 `model_not_found` → `system/model_fallback`;`system/background_tasks_changed`(REPLACE live set);mid-bg `didBackground` 真 flip;eviction 保 Host progress 事件。 |
|
|
53
56
|
| **2.7.24** | **Official 2.1 Host 流/控制 + bypass 1g**:`command_lifecycle` / `thinking_tokens` / `task_updated` / `task_summary` / `background_tasks`(Ctrl+B)对齐;mid-bg 发 `task_updated`;`backgroundAll` 排除 main-session;bypass 下 `classifierApprovable` safetyCheck 可过(densable 1g)。 |
|
|
54
57
|
| **2.7.23** | **Tasks dual-emit**:agent/shell/monitor/dream/workflow 终止时 once-gated 发 `system/task_notification` bookend(含 ISO `timestamp`),Host Tasks 可按 densable Jp 结算;print residual 再发一次-gated,不再只靠 TaskOutput 冒充生命周期。 |
|
|
55
58
|
| **2.7.22** | **REPL 更新提示 / go-hare 自动升级路径**:去掉 `ENABLE_AUTOUPDATER` 默认关闭;`autoUpdates=false` 仍 toast「Update available」;Notifications 挂载 AutoUpdater;npm 包二进制识别为 `npm-global`;`claude update` 使用 `@go-hare/claude-code`。 |
|
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.
|
|
3
|
+
"version": "2.7.28",
|
|
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.
|
|
43
|
-
"@go-hare/claude-code-darwin-x64": ">=2.7.
|
|
44
|
-
"@go-hare/claude-code-linux-x64": ">=2.7.
|
|
45
|
-
"@go-hare/claude-code-linux-arm64": ">=2.7.
|
|
46
|
-
"@go-hare/claude-code-linux-x64-musl": ">=2.7.
|
|
47
|
-
"@go-hare/claude-code-linux-arm64-musl": ">=2.7.
|
|
48
|
-
"@go-hare/claude-code-win32-x64": ">=2.7.
|
|
49
|
-
"@go-hare/claude-code-win32-arm64": ">=2.7.
|
|
42
|
+
"@go-hare/claude-code-darwin-arm64": ">=2.7.28",
|
|
43
|
+
"@go-hare/claude-code-darwin-x64": ">=2.7.28",
|
|
44
|
+
"@go-hare/claude-code-linux-x64": ">=2.7.28",
|
|
45
|
+
"@go-hare/claude-code-linux-arm64": ">=2.7.28",
|
|
46
|
+
"@go-hare/claude-code-linux-x64-musl": ">=2.7.28",
|
|
47
|
+
"@go-hare/claude-code-linux-arm64-musl": ">=2.7.28",
|
|
48
|
+
"@go-hare/claude-code-win32-x64": ">=2.7.28",
|
|
49
|
+
"@go-hare/claude-code-win32-arm64": ">=2.7.28",
|
|
50
50
|
"doubaoime-asr": "^0.1.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|