@sdsrs/code-graph 0.101.0 → 0.103.0
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/LICENSE +21 -0
- package/bin/cli.js +31 -8
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/scripts/adopt.js +46 -3
- package/claude-plugin/scripts/auto-update.js +143 -24
- package/claude-plugin/scripts/doctor.js +32 -0
- package/claude-plugin/scripts/find-binary.js +114 -53
- package/claude-plugin/scripts/install-lock.js +48 -0
- package/claude-plugin/scripts/launcher-install.js +146 -0
- package/claude-plugin/scripts/lifecycle.js +189 -28
- package/claude-plugin/scripts/mcp-launcher.js +75 -62
- package/claude-plugin/scripts/mcp-stub.js +25 -3
- package/claude-plugin/scripts/npm-exec.js +15 -0
- package/claude-plugin/scripts/session-init.js +15 -6
- package/claude-plugin/scripts/statusline.js +29 -5
- package/claude-plugin/scripts/version-utils.js +42 -3
- package/package.json +6 -6
|
@@ -3,12 +3,20 @@ const { execFileSync } = require('child_process');
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Tolerant match: the version line anywhere in the output (m flag), optional
|
|
7
|
+
// "v" prefix, and anything after the numeric triple (build-metadata suffixes
|
|
8
|
+
// like "1.2.3 (abc123)" or "-dev"). The old fully-anchored /^...$/ turned ANY
|
|
9
|
+
// deviation into null, which upstream reads as "broken binary" → judged
|
|
10
|
+
// permanently stale → re-download every session, with the fresh download
|
|
11
|
+
// rejected by the same parse: a self-sustaining loop.
|
|
12
|
+
const VERSION_OUTPUT_RE = /^code-graph-mcp\s+v?(\d+\.\d+\.\d+)/m;
|
|
7
13
|
|
|
8
14
|
function readBinaryVersion(binaryPath) {
|
|
9
15
|
try {
|
|
10
16
|
const out = execFileSync(binaryPath, ['--version'], {
|
|
11
|
-
|
|
17
|
+
// 5s: a cold exec of a freshly-written ~40MB binary (page-in, Windows AV
|
|
18
|
+
// scan) regularly exceeded the old 2s, misclassifying a good binary.
|
|
19
|
+
timeout: 5000,
|
|
12
20
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
13
21
|
}).toString().trim();
|
|
14
22
|
const match = out.match(VERSION_OUTPUT_RE);
|
|
@@ -18,6 +26,37 @@ function readBinaryVersion(binaryPath) {
|
|
|
18
26
|
}
|
|
19
27
|
}
|
|
20
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Compare semver-ish version strings; returns -1, 0, or 1. Numeric triple
|
|
31
|
+
* compared ordinally (missing/non-numeric parts → 0); a pre-release suffix
|
|
32
|
+
* sorts BELOW its release ("1.2.3-rc1" < "1.2.3"), two pre-releases compare
|
|
33
|
+
* as plain strings. Single canonical implementation — auto-update.js and
|
|
34
|
+
* find-binary.js each carried a divergent copy whose pre-release semantics
|
|
35
|
+
* disagreed (Number("4-rc1")→NaN→0 vs parseInt("3-rc1")→3), a silent
|
|
36
|
+
* mis-ordering trap if release tags ever adopt "-rc" suffixes.
|
|
37
|
+
*/
|
|
38
|
+
function compareVersions(a, b) {
|
|
39
|
+
const parse = (v) => {
|
|
40
|
+
const s = String(v);
|
|
41
|
+
const dash = s.indexOf('-');
|
|
42
|
+
const core = dash === -1 ? s : s.slice(0, dash);
|
|
43
|
+
return {
|
|
44
|
+
nums: core.split('.').map((x) => parseInt(x, 10)),
|
|
45
|
+
pre: dash === -1 ? null : s.slice(dash + 1),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const pa = parse(a), pb = parse(b);
|
|
49
|
+
for (let i = 0; i < 3; i++) {
|
|
50
|
+
const x = Number.isFinite(pa.nums[i]) ? pa.nums[i] : 0;
|
|
51
|
+
const y = Number.isFinite(pb.nums[i]) ? pb.nums[i] : 0;
|
|
52
|
+
if (x !== y) return x < y ? -1 : 1;
|
|
53
|
+
}
|
|
54
|
+
if (pa.pre && !pb.pre) return -1;
|
|
55
|
+
if (!pa.pre && pb.pre) return 1;
|
|
56
|
+
if (pa.pre && pb.pre && pa.pre !== pb.pre) return pa.pre < pb.pre ? -1 : 1;
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
21
60
|
function isDevMode(pluginRoot = path.resolve(__dirname, '..')) {
|
|
22
61
|
// Explicit opt-in always wins (also lets users force dev mode in any layout)
|
|
23
62
|
if (process.env.CODE_GRAPH_DEV === '1') return true;
|
|
@@ -55,4 +94,4 @@ function getNewestMtime(dir, ext = '.rs') {
|
|
|
55
94
|
return newest;
|
|
56
95
|
}
|
|
57
96
|
|
|
58
|
-
module.exports = { readBinaryVersion, isDevMode, getNewestMtime, VERSION_OUTPUT_RE };
|
|
97
|
+
module.exports = { readBinaryVersion, compareVersions, isDevMode, getNewestMtime, VERSION_OUTPUT_RE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.103.0",
|
|
4
4
|
"description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"node": ">=16"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@sdsrs/code-graph-linux-x64": "0.
|
|
40
|
-
"@sdsrs/code-graph-linux-arm64": "0.
|
|
41
|
-
"@sdsrs/code-graph-darwin-x64": "0.
|
|
42
|
-
"@sdsrs/code-graph-darwin-arm64": "0.
|
|
43
|
-
"@sdsrs/code-graph-win32-x64": "0.
|
|
39
|
+
"@sdsrs/code-graph-linux-x64": "0.103.0",
|
|
40
|
+
"@sdsrs/code-graph-linux-arm64": "0.103.0",
|
|
41
|
+
"@sdsrs/code-graph-darwin-x64": "0.103.0",
|
|
42
|
+
"@sdsrs/code-graph-darwin-arm64": "0.103.0",
|
|
43
|
+
"@sdsrs/code-graph-win32-x64": "0.103.0"
|
|
44
44
|
}
|
|
45
45
|
}
|