@codeledger/cli 0.10.7 → 0.10.10

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/codeledger.js CHANGED
@@ -37,21 +37,44 @@ function die(msg, code = 1) {
37
37
  }
38
38
 
39
39
  if (!existsSync(BINARY_PATH)) {
40
+ const { arch } = require('node:os');
41
+ const platformKey = `${platform()}-${arch()}`;
40
42
  const installerPath = join(__dirname, '..', 'scripts', 'postinstall.js');
41
- die(
42
- [
43
- `hardened binary for v${version} not found at ${BINARY_PATH}.`,
44
- '',
45
- 'The postinstall step may have been skipped (e.g. --ignore-scripts).',
46
- 'Recover with one of:',
47
- ` 1. npm rebuild @codeledger/cli`,
48
- ` 2. node "${installerPath}"`,
49
- ` 3. Re-run the install without --ignore-scripts`,
50
- '',
51
- 'Or download the binary manually from:',
52
- ` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`,
53
- ].join('\n'),
54
- );
43
+
44
+ if (platformKey === 'darwin-x64') {
45
+ die(
46
+ [
47
+ `hardened binary for v${version} not found at ${BINARY_PATH}.`,
48
+ '',
49
+ 'You are on an Intel Mac (darwin-x64). Pre-built binaries are',
50
+ 'available for Apple Silicon (darwin-arm64) only.',
51
+ '',
52
+ 'Options:',
53
+ ' 1. Use Rosetta 2 (recommended):',
54
+ ' arch -arm64 npm install -g @codeledger/cli',
55
+ ' 2. Use the vendored standalone CLI:',
56
+ ' codeledger init # in your repo, sets up vendored Node.js-based CLI',
57
+ ' ./.codeledger/bin/codeledger --version',
58
+ ' 3. Download a binary manually from:',
59
+ ` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`,
60
+ ].join('\n'),
61
+ );
62
+ } else {
63
+ die(
64
+ [
65
+ `hardened binary for v${version} not found at ${BINARY_PATH}.`,
66
+ '',
67
+ 'The postinstall step may have been skipped (e.g. --ignore-scripts).',
68
+ 'Recover with one of:',
69
+ ` 1. npm rebuild @codeledger/cli`,
70
+ ` 2. node "${installerPath}"`,
71
+ ` 3. Re-run the install without --ignore-scripts`,
72
+ '',
73
+ 'Or download the binary manually from:',
74
+ ` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`,
75
+ ].join('\n'),
76
+ );
77
+ }
55
78
  }
56
79
 
57
80
  const result = spawnSync(BINARY_PATH, process.argv.slice(2), {
package/package.json CHANGED
@@ -1,18 +1,12 @@
1
1
  {
2
2
  "name": "@codeledger/cli",
3
- "version": "0.10.7",
3
+ "version": "0.10.10",
4
4
  "mcpName": "io.github.codeledgerECF/codeledger",
5
5
  "description": "Thin npm wrapper that installs the hardened CodeLedger binary from GitHub Releases. Zero engine code ships in this package.",
6
6
  "type": "commonjs",
7
7
  "bin": {
8
8
  "codeledger": "./bin/codeledger.js"
9
9
  },
10
- "scripts": {
11
- "postinstall": "node scripts/postinstall.js",
12
- "test": "vitest run",
13
- "build": "echo 'no build — ships as-is'",
14
- "typecheck": "echo 'no ts — ships as-is'"
15
- },
16
10
  "files": [
17
11
  "bin/",
18
12
  "scripts/",
@@ -41,5 +35,11 @@
41
35
  ],
42
36
  "publishConfig": {
43
37
  "access": "public"
38
+ },
39
+ "scripts": {
40
+ "postinstall": "node scripts/postinstall.js",
41
+ "test": "vitest run",
42
+ "build": "echo 'no build — ships as-is'",
43
+ "typecheck": "echo 'no ts — ships as-is'"
44
44
  }
45
- }
45
+ }
@@ -80,17 +80,33 @@ const platformKey = `${platform()}-${arch()}`;
80
80
  const platformSuffix = PLATFORM_MAP[platformKey];
81
81
 
82
82
  if (!platformSuffix) {
83
- console.error(
84
- `codeledger: unsupported platform ${platformKey}. Supported: ${Object.keys(
85
- PLATFORM_MAP,
86
- ).join(', ')}`,
87
- );
88
- console.error(
89
- `codeledger: v${version} does not provide a hardened binary for ${platformKey}.`,
90
- );
91
- console.error(
92
- 'codeledger: you can still run from source by cloning the blackbox repo.',
93
- );
83
+ if (platformKey === 'darwin-x64') {
84
+ console.log('');
85
+ console.log('codeledger: Intel Mac (darwin-x64) detected.');
86
+ console.log('codeledger: Pre-built binaries are available for Apple Silicon (darwin-arm64) only.');
87
+ console.log('');
88
+ console.log('Options:');
89
+ console.log(' 1. Use Rosetta 2 (recommended):');
90
+ console.log(' arch -arm64 npm install -g @codeledger/cli');
91
+ console.log(' 2. Use the vendored standalone CLI after init:');
92
+ console.log(' CODELEDGER_SKIP_POSTINSTALL=1 npm install -g @codeledger/cli');
93
+ console.log(' codeledger init # sets up vendored Node.js-based CLI');
94
+ console.log(' 3. Download a binary manually from:');
95
+ console.log(` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`);
96
+ console.log('');
97
+ } else {
98
+ console.error(
99
+ `codeledger: unsupported platform ${platformKey}. Supported: ${Object.keys(
100
+ PLATFORM_MAP,
101
+ ).join(', ')}`,
102
+ );
103
+ console.error(
104
+ `codeledger: v${version} does not provide a hardened binary for ${platformKey}.`,
105
+ );
106
+ console.error(
107
+ 'codeledger: you can still run from source by cloning the blackbox repo.',
108
+ );
109
+ }
94
110
  // Fail softly: don't block `npm install` for unsupported platforms. The
95
111
  // bin shim will tell the user what happened when they first run `codeledger`.
96
112
  process.exit(0);
@@ -190,12 +206,17 @@ async function fetchBuffer(url) {
190
206
  if (i === backoffs.length) break;
191
207
  const wait = backoffs[i];
192
208
  console.log(
193
- `codeledger: 404 fetching ${url.split('/').pop()} — retrying in ${wait}s ` +
194
- `(attempt ${i + 1}/${backoffs.length + 1}, ride race window)`,
209
+ `codeledger: Binary pending — new release detected, retrying in ${wait}s ` +
210
+ `(attempt ${i + 1}/${backoffs.length + 1}). ` +
211
+ `This is normal for the first ~10 minutes after a release.`,
195
212
  );
196
213
  await new Promise((r) => setTimeout(r, wait * 1000));
197
214
  }
198
215
  }
216
+ console.log(
217
+ 'codeledger: Binary not yet available after all retries. ' +
218
+ 'You can retry later with: npx @codeledger/cli postinstall',
219
+ );
199
220
  throw lastErr;
200
221
  }
201
222