@go-hare/claude-code 2.6.36 → 2.6.37

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 (3) hide show
  1. package/README.md +2 -1
  2. package/install.cjs +224 -224
  3. package/package.json +9 -9
package/README.md CHANGED
@@ -79,6 +79,7 @@
79
79
 
80
80
  | 版本区间 | 要点 |
81
81
  | -------- | ---- |
82
+ | **2.6.37** | Windows taskkill 用 System32 绝对路径对齐 densable;Ctrl+C 退出前抢先关鼠标与 cleanup 避 move 残字(LOCAL) |
82
83
  | **2.6.36** | Windows taskkill/shell 探测 windowsHide,避免 Bash 中断与 /exit 闪窗(LOCAL) |
83
84
  | **2.6.35** | Windows 打包 rg.exe 主路径 spawn+windowsHide,避免 Grep/Glob 闪 conhost |
84
85
  | **2.6.34** | Jump-to-bottom 后立即恢复 spinner;agents 左箭头/daemon skew;CSI u 全角冒号等 |
@@ -162,7 +163,7 @@ CLAUDE_BRIDGE_OAUTH_TOKEN=test-my-key \
162
163
  claude --remote-control
163
164
  ```
164
165
 
165
- > **安装/更新失败?** 先 `npm rm -g @go-hare/claude-code` 清理旧版本,再 `npm i -g @go-hare/claude-code@latest`。仍失败可钉版本:`npm i -g @go-hare/claude-code@2.6.36`。
166
+ > **安装/更新失败?** 先 `npm rm -g @go-hare/claude-code` 清理旧版本,再 `npm i -g @go-hare/claude-code@latest`。仍失败可钉版本:`npm i -g @go-hare/claude-code@2.6.37`。
166
167
  >
167
168
  > 旧文档里的全局包名 `claude-code` 已不再对应本仓库发布流;请使用 `@go-hare/claude-code`。
168
169
 
package/install.cjs CHANGED
@@ -1,224 +1,224 @@
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
- existsSync,
14
- linkSync,
15
- unlinkSync,
16
- chmodSync,
17
- readFileSync,
18
- writeFileSync,
19
- statSync,
20
- readdirSync,
21
- } = require('fs')
22
- const { arch } = require('os')
23
- const path = require('path')
24
-
25
- // Dev environment detection: if .git exists at package root, we're in the monorepo
26
- if (existsSync(path.join(__dirname, '.git'))) {
27
- const r = spawnSync(
28
- 'node',
29
- [
30
- 'scripts/run-parallel.mjs',
31
- 'scripts/postinstall.cjs',
32
- 'scripts/setup-chrome-mcp.mjs',
33
- ],
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
- ensureVendorBinariesExecutable(pkgDir)
215
- } catch (err) {
216
- console.error(
217
- `[${WRAPPER_NAME} postinstall] Failed to place binary: ${err.message}`,
218
- )
219
- console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
220
- process.exitCode = 1
221
- }
222
- }
223
-
224
- 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
+ existsSync,
14
+ linkSync,
15
+ unlinkSync,
16
+ chmodSync,
17
+ readFileSync,
18
+ writeFileSync,
19
+ statSync,
20
+ readdirSync,
21
+ } = require('fs')
22
+ const { arch } = require('os')
23
+ const path = require('path')
24
+
25
+ // Dev environment detection: if .git exists at package root, we're in the monorepo
26
+ if (existsSync(path.join(__dirname, '.git'))) {
27
+ const r = spawnSync(
28
+ 'node',
29
+ [
30
+ 'scripts/run-parallel.mjs',
31
+ 'scripts/postinstall.cjs',
32
+ 'scripts/setup-chrome-mcp.mjs',
33
+ ],
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
+ ensureVendorBinariesExecutable(pkgDir)
215
+ } catch (err) {
216
+ console.error(
217
+ `[${WRAPPER_NAME} postinstall] Failed to place binary: ${err.message}`,
218
+ )
219
+ console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
220
+ process.exitCode = 1
221
+ }
222
+ }
223
+
224
+ main()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-hare/claude-code",
3
- "version": "2.6.36",
3
+ "version": "2.6.37",
4
4
  "description": "Reverse-engineered Anthropic Claude Code CLI — interactive AI coding assistant in the terminal",
5
5
  "type": "module",
6
6
  "author": "DeQiang",
@@ -39,14 +39,14 @@
39
39
  "cli-wrapper.cjs"
40
40
  ],
41
41
  "optionalDependencies": {
42
- "@go-hare/claude-code-darwin-arm64": ">=2.6.36",
43
- "@go-hare/claude-code-darwin-x64": ">=2.6.36",
44
- "@go-hare/claude-code-linux-x64": ">=2.6.36",
45
- "@go-hare/claude-code-linux-arm64": ">=2.6.36",
46
- "@go-hare/claude-code-linux-x64-musl": ">=2.6.36",
47
- "@go-hare/claude-code-linux-arm64-musl": ">=2.6.36",
48
- "@go-hare/claude-code-win32-x64": ">=2.6.36",
49
- "@go-hare/claude-code-win32-arm64": ">=2.6.36",
42
+ "@go-hare/claude-code-darwin-arm64": ">=2.6.37",
43
+ "@go-hare/claude-code-darwin-x64": ">=2.6.37",
44
+ "@go-hare/claude-code-linux-x64": ">=2.6.37",
45
+ "@go-hare/claude-code-linux-arm64": ">=2.6.37",
46
+ "@go-hare/claude-code-linux-x64-musl": ">=2.6.37",
47
+ "@go-hare/claude-code-linux-arm64-musl": ">=2.6.37",
48
+ "@go-hare/claude-code-win32-x64": ">=2.6.37",
49
+ "@go-hare/claude-code-win32-arm64": ">=2.6.37",
50
50
  "doubaoime-asr": "^0.1.0"
51
51
  },
52
52
  "scripts": {