@sdsrs/code-graph 0.5.30 → 0.5.31
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/claude-plugin/.mcp.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/**
|
|
4
|
+
* MCP server launcher — resolves binary via find-binary.js, auto-installs
|
|
5
|
+
* if missing, then spawns with stdio forwarding for JSON-RPC.
|
|
6
|
+
*
|
|
7
|
+
* Used by .mcp.json so the plugin controls binary discovery instead of
|
|
8
|
+
* relying on the binary being in PATH.
|
|
9
|
+
*/
|
|
10
|
+
const { spawn, execFileSync } = require('child_process');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
|
|
14
|
+
// Set plugin root so find-binary.js can locate bundled/dev binaries
|
|
15
|
+
process.env._FIND_BINARY_ROOT = process.env.CLAUDE_PLUGIN_ROOT || path.resolve(__dirname, '..');
|
|
16
|
+
|
|
17
|
+
const { findBinary, clearCache } = require('./find-binary');
|
|
18
|
+
|
|
19
|
+
let binary = findBinary();
|
|
20
|
+
|
|
21
|
+
// Auto-install binary if not found (first-time install)
|
|
22
|
+
if (!binary) {
|
|
23
|
+
let version = 'latest';
|
|
24
|
+
try {
|
|
25
|
+
const pj = path.join(__dirname, '..', '.claude-plugin', 'plugin.json');
|
|
26
|
+
version = JSON.parse(fs.readFileSync(pj, 'utf8')).version || 'latest';
|
|
27
|
+
} catch { /* use latest */ }
|
|
28
|
+
|
|
29
|
+
process.stderr.write(`[code-graph] Binary not found, installing @sdsrs/code-graph@${version}...\n`);
|
|
30
|
+
try {
|
|
31
|
+
execFileSync('npm', ['install', '-g', `@sdsrs/code-graph@${version}`], {
|
|
32
|
+
timeout: 60000, stdio: 'pipe',
|
|
33
|
+
});
|
|
34
|
+
clearCache();
|
|
35
|
+
binary = findBinary();
|
|
36
|
+
if (binary) {
|
|
37
|
+
process.stderr.write(`[code-graph] Installed at ${binary}\n`);
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
process.stderr.write('[code-graph] npm install failed. Trying direct download...\n');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Fallback: direct binary download from GitHub release
|
|
44
|
+
if (!binary) {
|
|
45
|
+
try {
|
|
46
|
+
const { downloadBinarySync } = require('./auto-update');
|
|
47
|
+
if (typeof downloadBinarySync === 'function') {
|
|
48
|
+
downloadBinarySync(version);
|
|
49
|
+
clearCache();
|
|
50
|
+
binary = findBinary();
|
|
51
|
+
}
|
|
52
|
+
} catch { /* not available */ }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!binary) {
|
|
57
|
+
process.stderr.write(
|
|
58
|
+
'[code-graph] Binary not found. Install manually:\n' +
|
|
59
|
+
' npm install -g @sdsrs/code-graph\n'
|
|
60
|
+
);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Spawn binary with stdio inheritance for MCP JSON-RPC
|
|
65
|
+
const child = spawn(binary, ['serve'], {
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
env: process.env,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
child.on('error', (err) => {
|
|
71
|
+
process.stderr.write(`[code-graph] Failed to start: ${err.message}\n`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
child.on('exit', (code, signal) => {
|
|
76
|
+
if (signal) {
|
|
77
|
+
process.kill(process.pid, signal);
|
|
78
|
+
} else {
|
|
79
|
+
process.exit(code ?? 1);
|
|
80
|
+
}
|
|
81
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.31",
|
|
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": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"node": ">=16"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@sdsrs/code-graph-linux-x64": "0.5.
|
|
37
|
-
"@sdsrs/code-graph-linux-arm64": "0.5.
|
|
38
|
-
"@sdsrs/code-graph-darwin-x64": "0.5.
|
|
39
|
-
"@sdsrs/code-graph-darwin-arm64": "0.5.
|
|
40
|
-
"@sdsrs/code-graph-win32-x64": "0.5.
|
|
36
|
+
"@sdsrs/code-graph-linux-x64": "0.5.31",
|
|
37
|
+
"@sdsrs/code-graph-linux-arm64": "0.5.31",
|
|
38
|
+
"@sdsrs/code-graph-darwin-x64": "0.5.31",
|
|
39
|
+
"@sdsrs/code-graph-darwin-arm64": "0.5.31",
|
|
40
|
+
"@sdsrs/code-graph-win32-x64": "0.5.31"
|
|
41
41
|
}
|
|
42
42
|
}
|