@go-hare/claude-code 2.6.7

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/bin/claude.exe ADDED
Binary file
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require('child_process')
3
+ const { arch, constants } = require('os')
4
+ const path = require('path')
5
+
6
+ const PACKAGE_PREFIX = '@go-hare/claude-code'
7
+ const BINARY_NAME = 'claude'
8
+
9
+ const PLATFORMS = {
10
+ 'darwin-arm64': { pkg: PACKAGE_PREFIX + '-darwin-arm64', bin: BINARY_NAME },
11
+ 'darwin-x64': { pkg: PACKAGE_PREFIX + '-darwin-x64', bin: BINARY_NAME },
12
+ 'linux-x64': { pkg: PACKAGE_PREFIX + '-linux-x64', bin: BINARY_NAME },
13
+ 'linux-arm64': { pkg: PACKAGE_PREFIX + '-linux-arm64', bin: BINARY_NAME },
14
+ 'win32-x64': { pkg: PACKAGE_PREFIX + '-win32-x64', bin: BINARY_NAME + '.exe' },
15
+ 'win32-arm64': { pkg: PACKAGE_PREFIX + '-win32-arm64', bin: BINARY_NAME + '.exe' },
16
+ }
17
+
18
+ function getPlatformKey() {
19
+ const platform = process.platform
20
+ let cpu = arch()
21
+ if (platform === 'darwin' && cpu === 'x64') {
22
+ const r = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], { encoding: 'utf8' })
23
+ if (r.stdout?.trim() === '1') cpu = 'arm64'
24
+ }
25
+ return platform + '-' + cpu
26
+ }
27
+
28
+ function main() {
29
+ const platformKey = getPlatformKey()
30
+ const info = PLATFORMS[platformKey]
31
+ if (!info) { console.error('Unsupported platform: ' + platformKey); process.exit(1) }
32
+ let binaryPath
33
+ try {
34
+ const pkgDir = path.dirname(require.resolve(info.pkg + '/package.json'))
35
+ binaryPath = path.join(pkgDir, info.bin)
36
+ } catch { console.error('Native package not found: ' + info.pkg); process.exit(1) }
37
+ const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' })
38
+ if (result.signal) process.exit(128 + (constants.signals[result.signal] ?? 0))
39
+ else process.exit(result.status ?? 1)
40
+ }
41
+
42
+ main()
package/install.cjs ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require('child_process')
3
+ const { copyFileSync, linkSync, unlinkSync, chmodSync, readFileSync, writeFileSync, statSync } = require('fs')
4
+ const { arch } = require('os')
5
+ const path = require('path')
6
+
7
+ const PACKAGE_PREFIX = '@go-hare/claude-code'
8
+ const BINARY_NAME = 'claude'
9
+ const WRAPPER_NAME = require('./package.json').name
10
+
11
+ const PLATFORMS = {
12
+ 'darwin-arm64': { pkg: PACKAGE_PREFIX + '-darwin-arm64', bin: BINARY_NAME },
13
+ 'darwin-x64': { pkg: PACKAGE_PREFIX + '-darwin-x64', bin: BINARY_NAME },
14
+ 'linux-x64': { pkg: PACKAGE_PREFIX + '-linux-x64', bin: BINARY_NAME },
15
+ 'linux-arm64': { pkg: PACKAGE_PREFIX + '-linux-arm64', bin: BINARY_NAME },
16
+ 'win32-x64': { pkg: PACKAGE_PREFIX + '-win32-x64', bin: BINARY_NAME + '.exe' },
17
+ 'win32-arm64': { pkg: PACKAGE_PREFIX + '-win32-arm64', bin: BINARY_NAME + '.exe' },
18
+ }
19
+
20
+ function getPlatformKey() {
21
+ const platform = process.platform
22
+ let cpu = arch()
23
+ if (platform === 'darwin' && cpu === 'x64') {
24
+ const r = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], { encoding: 'utf8' })
25
+ if (r.stdout?.trim() === '1') cpu = 'arm64'
26
+ }
27
+ return platform + '-' + cpu
28
+ }
29
+
30
+ function main() {
31
+ const platformKey = getPlatformKey()
32
+ const info = PLATFORMS[platformKey]
33
+ if (!info) {
34
+ console.error(`[${WRAPPER_NAME} postinstall] Unsupported platform: ${process.platform} ${arch()}`)
35
+ return
36
+ }
37
+ let src
38
+ try {
39
+ const pkgDir = path.dirname(require.resolve(info.pkg + '/package.json'))
40
+ src = path.join(pkgDir, info.bin)
41
+ } catch {
42
+ console.error(`[${WRAPPER_NAME} postinstall] Native package "${info.pkg}" not found.`)
43
+ console.error(' This happens with --omit=optional. Fallback: node cli-wrapper.cjs')
44
+ return
45
+ }
46
+ const dest = path.join(__dirname, 'bin', 'claude.exe')
47
+ try {
48
+ try { unlinkSync(dest) } catch {}
49
+ try { linkSync(src, dest) } catch { copyFileSync(src, dest) }
50
+ if (process.platform !== 'win32') chmodSync(dest, 0o755)
51
+ } catch (err) {
52
+ console.error(`[${WRAPPER_NAME} postinstall] Failed: ${err.message}`)
53
+ }
54
+ }
55
+
56
+ main()
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@go-hare/claude-code",
3
+ "version": "2.6.7",
4
+ "description": "Reverse-engineered Anthropic Claude Code CLI — interactive AI coding assistant",
5
+ "type": "module",
6
+ "author": "DeQiang",
7
+ "license": "MIT",
8
+ "bin": {
9
+ "claude": "bin/claude.exe"
10
+ },
11
+ "scripts": {
12
+ "postinstall": "node install.cjs"
13
+ },
14
+ "engines": {
15
+ "node": ">=18.0.0"
16
+ },
17
+ "homepage": "https://github.com/go-hare/claude-code-1",
18
+ "bugs": {
19
+ "url": "https://github.com/go-hare/claude-code-1/issues"
20
+ },
21
+ "optionalDependencies": {
22
+ "@go-hare/claude-code-darwin-arm64": "2.6.7"
23
+ },
24
+ "files": [
25
+ "bin/claude.exe",
26
+ "install.cjs",
27
+ "cli-wrapper.cjs"
28
+ ]
29
+ }