@codeledger/cli 0.10.22 → 0.10.24
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 +19 -5
- package/bin/codeledger.js +53 -7
- package/package.json +3 -2
- package/scripts/postinstall.js +11 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @codeledger/cli — CodeLedger
|
|
1
|
+
# @codeledger/cli — ContextECF CodeLedger
|
|
2
2
|
|
|
3
3
|
**Deterministic, bounded context selection for AI coding agents.**
|
|
4
4
|
Published by [Intelligent Context AI, Inc.](https://codeledger.dev).
|
|
@@ -8,9 +8,9 @@ Published by [Intelligent Context AI, Inc.](https://codeledger.dev).
|
|
|
8
8
|
- Source: https://github.com/codeledgerECF/codeledger
|
|
9
9
|
- npm: [`@codeledger/cli`](https://www.npmjs.com/package/@codeledger/cli)
|
|
10
10
|
|
|
11
|
-
> **Installing?** Make sure you use the scope: `npm install -g @codeledger/cli`.
|
|
11
|
+
> **Installing ContextECF CodeLedger?** Make sure you use the scope: `npm install -g @codeledger/cli`.
|
|
12
12
|
> There is an unrelated unscoped `codeledger` package on npm by a different
|
|
13
|
-
> author. The real CodeLedger package is published under the
|
|
13
|
+
> author. The real ContextECF CodeLedger package is published under the
|
|
14
14
|
> `@codeledger` scope.
|
|
15
15
|
|
|
16
16
|
## Install
|
|
@@ -42,8 +42,9 @@ release. Intel Mac users can build from source or wait for the
|
|
|
42
42
|
runner situation to stabilize in a later release.
|
|
43
43
|
|
|
44
44
|
Other platforms fall through `postinstall` softly — `npm install`
|
|
45
|
-
succeeds, but running `codeledger` will
|
|
46
|
-
|
|
45
|
+
succeeds, but running `codeledger` will either use a repo-local vendored
|
|
46
|
+
runtime if the current repo has `.codeledger/bin/`, or print a clear
|
|
47
|
+
recovery message pointing at the manual download page.
|
|
47
48
|
|
|
48
49
|
## Usage
|
|
49
50
|
|
|
@@ -70,6 +71,16 @@ codeledger vendor
|
|
|
70
71
|
All arguments, environment variables, stdin, and exit codes pass
|
|
71
72
|
straight through to the hardened binary.
|
|
72
73
|
|
|
74
|
+
If the global hardened binary is missing but the repo already has a
|
|
75
|
+
vendored runtime, the npm shim automatically falls back to:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
./.codeledger/bin/codeledger <command>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This keeps existing repos usable after a skipped postinstall, air-gapped
|
|
82
|
+
install, or unsupported global platform.
|
|
83
|
+
|
|
73
84
|
## Version parity
|
|
74
85
|
|
|
75
86
|
When you run a globally installed `codeledger` inside a repo that has a
|
|
@@ -104,6 +115,9 @@ CODELEDGER_SKIP_POSTINSTALL=1 npm install -g @codeledger/cli@latest
|
|
|
104
115
|
# then place the hardened binary at:
|
|
105
116
|
# ~/.cache/codeledger/bin/codeledger-hardened-v<version>
|
|
106
117
|
# and chmod +x it.
|
|
118
|
+
|
|
119
|
+
# If this repo is already initialized, use the committed vendored runtime:
|
|
120
|
+
./.codeledger/bin/codeledger ready
|
|
107
121
|
```
|
|
108
122
|
|
|
109
123
|
Download the binary + `SHA256SUMS` from the GitHub Release matching the
|
package/bin/codeledger.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
const { spawnSync } = require('node:child_process');
|
|
17
17
|
const { existsSync } = require('node:fs');
|
|
18
|
-
const { join } = require('node:path');
|
|
18
|
+
const { dirname, join, resolve } = require('node:path');
|
|
19
19
|
const { homedir, platform } = require('node:os');
|
|
20
20
|
|
|
21
21
|
const { version } = require('../package.json');
|
|
@@ -36,7 +36,50 @@ function die(msg, code = 1) {
|
|
|
36
36
|
process.exit(code);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function findRepoLocalRuntime(startDir) {
|
|
40
|
+
if (process.env.CODELEDGER_GLOBAL_VERSION_PROBE === '1') return null;
|
|
41
|
+
let current = resolve(startDir);
|
|
42
|
+
while (true) {
|
|
43
|
+
const wrapper = join(current, '.codeledger', 'bin', 'codeledger');
|
|
44
|
+
const standalone = join(current, '.codeledger', 'bin', 'codeledger-standalone.cjs');
|
|
45
|
+
if (existsSync(wrapper)) return { kind: 'wrapper', path: wrapper, repoRoot: current };
|
|
46
|
+
if (existsSync(standalone)) return { kind: 'standalone', path: standalone, repoRoot: current };
|
|
47
|
+
const parent = dirname(current);
|
|
48
|
+
if (parent === current) return null;
|
|
49
|
+
current = parent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function runRepoLocal(runtime) {
|
|
54
|
+
process.stderr.write(
|
|
55
|
+
[
|
|
56
|
+
`codeledger: ContextECF CodeLedger hardened binary for v${version} is not installed in the global cache.`,
|
|
57
|
+
`codeledger: using repo-local runtime at ${runtime.path}`,
|
|
58
|
+
'',
|
|
59
|
+
].join('\n'),
|
|
60
|
+
);
|
|
61
|
+
const command = runtime.kind === 'standalone' ? process.execPath : runtime.path;
|
|
62
|
+
const args = runtime.kind === 'standalone'
|
|
63
|
+
? [runtime.path, ...process.argv.slice(2)]
|
|
64
|
+
: process.argv.slice(2);
|
|
65
|
+
const result = spawnSync(command, args, {
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
cwd: runtime.repoRoot,
|
|
68
|
+
env: { ...process.env, CODELEDGER_DELEGATED: '1' },
|
|
69
|
+
shell: runtime.kind === 'wrapper',
|
|
70
|
+
});
|
|
71
|
+
if (result.error) {
|
|
72
|
+
die(`failed to spawn repo-local runtime: ${result.error.message}`);
|
|
73
|
+
}
|
|
74
|
+
process.exit(result.status ?? 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
39
77
|
if (!existsSync(BINARY_PATH)) {
|
|
78
|
+
const repoLocal = findRepoLocalRuntime(process.cwd());
|
|
79
|
+
if (repoLocal) {
|
|
80
|
+
runRepoLocal(repoLocal);
|
|
81
|
+
}
|
|
82
|
+
|
|
40
83
|
const { arch } = require('node:os');
|
|
41
84
|
const platformKey = `${platform()}-${arch()}`;
|
|
42
85
|
const installerPath = join(__dirname, '..', 'scripts', 'postinstall.js');
|
|
@@ -44,7 +87,7 @@ if (!existsSync(BINARY_PATH)) {
|
|
|
44
87
|
if (platformKey === 'darwin-x64') {
|
|
45
88
|
die(
|
|
46
89
|
[
|
|
47
|
-
`hardened binary for v${version} not found at ${BINARY_PATH}.`,
|
|
90
|
+
`ContextECF CodeLedger hardened binary for v${version} not found at ${BINARY_PATH}.`,
|
|
48
91
|
'',
|
|
49
92
|
'You are on an Intel Mac (darwin-x64). Pre-built binaries are',
|
|
50
93
|
'available for Apple Silicon (darwin-arm64) only.',
|
|
@@ -52,10 +95,9 @@ if (!existsSync(BINARY_PATH)) {
|
|
|
52
95
|
'Options:',
|
|
53
96
|
' 1. Use Rosetta 2 (recommended):',
|
|
54
97
|
' arch -arm64 npm install -g @codeledger/cli@latest',
|
|
55
|
-
' 2.
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
' ./.codeledger/bin/codeledger --version',
|
|
98
|
+
' 2. If this repo was already initialized, use the vendored CLI:',
|
|
99
|
+
' ./.codeledger/bin/codeledger ready',
|
|
100
|
+
' node .codeledger/bin/codeledger-standalone.cjs ready',
|
|
59
101
|
' 3. Download a binary manually from:',
|
|
60
102
|
` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`,
|
|
61
103
|
].join('\n'),
|
|
@@ -63,14 +105,18 @@ if (!existsSync(BINARY_PATH)) {
|
|
|
63
105
|
} else {
|
|
64
106
|
die(
|
|
65
107
|
[
|
|
66
|
-
`hardened binary for v${version} not found at ${BINARY_PATH}.`,
|
|
108
|
+
`ContextECF CodeLedger hardened binary for v${version} not found at ${BINARY_PATH}.`,
|
|
67
109
|
'',
|
|
68
110
|
'The postinstall step may have been skipped (e.g. --ignore-scripts).',
|
|
111
|
+
'Confirm the official scoped package is installed: @codeledger/cli.',
|
|
112
|
+
'Avoid the unrelated unscoped npm package: codeledger.',
|
|
113
|
+
'',
|
|
69
114
|
'Recover with one of:',
|
|
70
115
|
` 1. Upgrade: npm install -g @codeledger/cli@latest`,
|
|
71
116
|
` 2. Retry this install: npm rebuild @codeledger/cli`,
|
|
72
117
|
` 3. node "${installerPath}"`,
|
|
73
118
|
` 4. Re-run the install without --ignore-scripts`,
|
|
119
|
+
` 5. In an initialized repo, use: ./.codeledger/bin/codeledger ready`,
|
|
74
120
|
'',
|
|
75
121
|
'Or download the binary manually from:',
|
|
76
122
|
` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeledger/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.24",
|
|
4
4
|
"mcpName": "io.github.codeledgerECF/codeledger",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Official ContextECF CodeLedger CLI wrapper. Installs the hardened binary from GitHub Releases; zero engine code ships in this package.",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|
|
8
8
|
"codeledger": "./bin/codeledger.js"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"license": "SEE LICENSE IN LICENSE",
|
|
28
28
|
"keywords": [
|
|
29
29
|
"codeledger",
|
|
30
|
+
"contextecf",
|
|
30
31
|
"context",
|
|
31
32
|
"ai",
|
|
32
33
|
"claude",
|
package/scripts/postinstall.js
CHANGED
|
@@ -41,7 +41,7 @@ const { version } = require('../package.json');
|
|
|
41
41
|
|
|
42
42
|
if (process.env.CODELEDGER_SKIP_POSTINSTALL === '1') {
|
|
43
43
|
console.log(
|
|
44
|
-
'codeledger: CODELEDGER_SKIP_POSTINSTALL=1 set, skipping hardened binary download.',
|
|
44
|
+
'codeledger: CODELEDGER_SKIP_POSTINSTALL=1 set, skipping ContextECF CodeLedger hardened binary download.',
|
|
45
45
|
);
|
|
46
46
|
process.exit(0);
|
|
47
47
|
}
|
|
@@ -56,7 +56,7 @@ try {
|
|
|
56
56
|
const workspaceRoot = path.resolve(__dirname, '..', '..', '..');
|
|
57
57
|
if (fs.existsSync(path.join(workspaceRoot, 'pnpm-workspace.yaml'))) {
|
|
58
58
|
console.log(
|
|
59
|
-
'codeledger: in-workspace dev install detected, skipping hardened binary download.',
|
|
59
|
+
'codeledger: in-workspace dev install detected, skipping ContextECF CodeLedger hardened binary download.',
|
|
60
60
|
);
|
|
61
61
|
process.exit(0);
|
|
62
62
|
}
|
|
@@ -80,16 +80,18 @@ const platformSuffix = PLATFORM_MAP[platformKey];
|
|
|
80
80
|
if (!platformSuffix) {
|
|
81
81
|
if (platformKey === 'darwin-x64') {
|
|
82
82
|
console.log('');
|
|
83
|
-
console.log('codeledger: Intel Mac (darwin-x64) detected.');
|
|
83
|
+
console.log('codeledger: ContextECF CodeLedger Intel Mac (darwin-x64) detected.');
|
|
84
84
|
console.log('codeledger: Pre-built binaries are available for Apple Silicon (darwin-arm64) only.');
|
|
85
85
|
console.log('');
|
|
86
86
|
console.log('Options:');
|
|
87
|
+
console.log(' Official package: @codeledger/cli. Avoid unrelated unscoped package: codeledger.');
|
|
87
88
|
console.log(' 1. Use Rosetta 2 (recommended):');
|
|
88
89
|
console.log(' arch -arm64 npm install -g @codeledger/cli@latest');
|
|
89
|
-
console.log(' 2.
|
|
90
|
-
console.log('
|
|
91
|
-
console.log('
|
|
92
|
-
console.log(' 3.
|
|
90
|
+
console.log(' 2. If this repo was already initialized, use the vendored CLI:');
|
|
91
|
+
console.log(' ./.codeledger/bin/codeledger ready');
|
|
92
|
+
console.log(' node .codeledger/bin/codeledger-standalone.cjs ready');
|
|
93
|
+
console.log(' 3. For a new repo without a vendored CLI, use a supported platform or Docker.');
|
|
94
|
+
console.log(' 4. Download a binary manually from:');
|
|
93
95
|
console.log(` https://github.com/codeledgerECF/codeledger/releases/tag/v${version}`);
|
|
94
96
|
console.log('');
|
|
95
97
|
} else {
|
|
@@ -98,6 +100,7 @@ if (!platformSuffix) {
|
|
|
98
100
|
PLATFORM_MAP,
|
|
99
101
|
).join(', ')}`,
|
|
100
102
|
);
|
|
103
|
+
console.error('codeledger: this installer is for ContextECF CodeLedger (@codeledger/cli).');
|
|
101
104
|
console.error(
|
|
102
105
|
`codeledger: v${version} does not provide a hardened binary for ${platformKey}.`,
|
|
103
106
|
);
|
|
@@ -281,6 +284,7 @@ if (require.main === module) {
|
|
|
281
284
|
console.error(' CODELEDGER_SKIP_POSTINSTALL=1 npm install -g @codeledger/cli@latest');
|
|
282
285
|
console.error(' then manually place the binary at:');
|
|
283
286
|
console.error(` ${BINARY_LOCAL_PATH}`);
|
|
287
|
+
console.error(' or, in an initialized repo, use: ./.codeledger/bin/codeledger ready');
|
|
284
288
|
console.error(' 4. Use a mirror:');
|
|
285
289
|
console.error(' CODELEDGER_BINARY_URL=https://your-mirror/path npm install -g @codeledger/cli@latest');
|
|
286
290
|
console.error('');
|