@codeledger/cli 0.10.9 → 0.10.11

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 CHANGED
@@ -59,6 +59,24 @@ codeledger help
59
59
  All arguments, environment variables, stdin, and exit codes pass
60
60
  straight through to the hardened binary.
61
61
 
62
+ ## Version parity
63
+
64
+ When you run a globally installed `codeledger` inside a repo that has a
65
+ repo-local CodeLedger (`.codeledger/bin/`), the CLI detects whether the
66
+ running version differs from the repo-local version. If it does:
67
+
68
+ 1. A warning is printed to stderr showing both versions.
69
+ 2. The CLI automatically re-executes the command via the repo-local
70
+ binary so that command behavior matches what the repo expects.
71
+
72
+ This prevents a stale global install from silently producing different
73
+ results than the repo-local CLI. To avoid the delegation overhead,
74
+ invoke the repo-local wrapper directly:
75
+
76
+ ```bash
77
+ ./.codeledger/bin/codeledger <command>
78
+ ```
79
+
62
80
  ## Environment variables
63
81
 
64
82
  | Variable | Purpose |
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeledger/cli",
3
- "version": "0.10.9",
3
+ "version": "0.10.11",
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",
@@ -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