@sdsrs/code-graph 0.170.1 → 0.171.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/README.md +13 -8
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/scripts/doctor.js +25 -8
- package/claude-plugin/scripts/pre-edit-guide.js +10 -0
- package/claude-plugin/scripts/project-root.js +18 -1
- package/claude-plugin/scripts/session-init.js +30 -11
- package/claude-plugin/scripts/statusline.js +8 -1
- package/claude-plugin/scripts/subagent-start.js +4 -1
- package/claude-plugin/scripts/user-prompt-context.js +25 -3
- package/claude-plugin/templates/code-graph-snapshot.yml +12 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ A high-performance code knowledge graph server implementing the [Model Context P
|
|
|
17
17
|
- **HTTP route tracing** — Map route paths to backend handler functions (Express, Flask/FastAPI, Go `net/http`, Rust axum)
|
|
18
18
|
- **Dead code detection** — Find unreferenced symbols with smart Orphan/Exported-Unused classification
|
|
19
19
|
- **Impact analysis** — Determine the blast radius of code changes by tracing all dependents
|
|
20
|
-
- **Incremental indexing** — Merkle tree change detection with file system watcher
|
|
20
|
+
- **Incremental indexing** — Merkle tree change detection with a file system watcher; changed files are re-indexed when the next MCP query tool call arrives (`get_index_status` does not count). Smart event filtering skips metadata-only changes (chmod, xattr)
|
|
21
21
|
- **Context compression** — Token-aware snippet extraction for LLM context windows (L0→full code, L1→summaries, L2→file groups, L3→directory overview). Every MCP tool except `ast_search` takes `compact: true`, which drops code bodies from the response; what else it trims is per-tool (`get_ast_node` keeps the signature, `module_overview` drops it), and how much it saves depends on the tool and the repo, so no fixed figure is quoted here
|
|
22
22
|
- **Embedding model** — Optional local embedding via Candle (feature-gated `embed-model`). Context reordered to prioritize structural relations over code for better embedding quality
|
|
23
23
|
- **Self-healing** — Automatic SQLite corruption recovery with rebuild. Startup repair for incomplete indexing (Phase 3 failures)
|
|
@@ -200,7 +200,7 @@ What you get:
|
|
|
200
200
|
- **MCP Server** — All code-graph tools available to Claude
|
|
201
201
|
- **Skills** — `explore` (structure-first navigation before reading files) and `index` (health-check / re-index / full rebuild); see [Plugin Skills](#plugin-skills)
|
|
202
202
|
- **Code Explorer Agent** — Deep code understanding expert via `code-explorer`
|
|
203
|
-
- **Auto-indexing
|
|
203
|
+
- **Auto-indexing** — The MCP server's file watcher records edited files, and the next code-graph MCP query (`get_call_graph`, `find_references`, … — not `get_index_status`) re-indexes them before it answers; a PostToolUse hook that re-indexes per edit is off by default (`CODE_GRAPH_HOOK_INDEX=on` turns it on for CLI-only use)
|
|
204
204
|
- **StatusLine** — Real-time health display (nodes, files, watch status) and what code-graph did in this session (`5 answers · 2 calls`: answers its grep, edit, read, subagent and Stop hooks delivered to Claude, code-graph queries Claude ran) — compatible with other plugins' StatusLine via composite multiplexer
|
|
205
205
|
- **Auto-update** — Checks for a new version at session start (throttled to at most one check every 2 minutes). Between forced checks the re-check interval is 30 minutes after an "up to date" answer and 6 hours while an update is already pending. Updates install silently.
|
|
206
206
|
|
|
@@ -244,7 +244,7 @@ By default, every user prompt the plugin deems code-related gets a small context
|
|
|
244
244
|
"env": { "CODE_GRAPH_QUIET_HOOKS": "1" }
|
|
245
245
|
}
|
|
246
246
|
```
|
|
247
|
-
3. Restart Claude Code.
|
|
247
|
+
3. Restart Claude Code. The hooks inject nothing (the grep, read, edit, prompt, subagent and Stop hooks stay silent, and session startup skips the project-map injection), and the MCP `instructions` shrink to a one-line command pointer.
|
|
248
248
|
|
|
249
249
|
### Option 2: Claude Code MCP Server Only
|
|
250
250
|
|
|
@@ -503,8 +503,10 @@ marker, so a manually filled copy is treated as not-current and re-downloaded.
|
|
|
503
503
|
# (the archive has no wrapping folder: model.safetensors, tokenizer.json, config.json).
|
|
504
504
|
curl -sL -o models.tar.gz \
|
|
505
505
|
https://github.com/sdsrss/code-graph-mcp/releases/download/v<version>/models.tar.gz
|
|
506
|
-
curl -sL
|
|
507
|
-
|
|
506
|
+
curl -sL -o models.tar.gz.sha256 \
|
|
507
|
+
https://github.com/sdsrss/code-graph-mcp/releases/download/v<version>/models.tar.gz.sha256
|
|
508
|
+
# The .sha256 file holds the bare hash; sha256sum -c wants "<hash> <file>".
|
|
509
|
+
echo "$(cat models.tar.gz.sha256) models.tar.gz" | sha256sum -c -
|
|
508
510
|
mkdir -p ~/.cache/code-graph/models-manual
|
|
509
511
|
tar -xzf models.tar.gz -C ~/.cache/code-graph/models-manual
|
|
510
512
|
export CODE_GRAPH_MODEL_DIR=~/.cache/code-graph/models-manual
|
|
@@ -548,12 +550,12 @@ defaults are what you get by doing nothing.
|
|
|
548
550
|
| `CODE_GRAPH_NO_AUTO_ADOPT=1` | Skip SessionStart's adoption check: no cleanup of this plugin's legacy memory-dir files and no notice about an out-of-date steering block. SessionStart never writes `CLAUDE.md` itself; `code-graph-mcp adopt` does. |
|
|
549
551
|
| `CODE_GRAPH_NO_TEMPLATE_REFRESH=1` | Do not report a steering block that has drifted from the current template (SessionStart only reports it; `code-graph-mcp adopt` refreshes it). |
|
|
550
552
|
| `CODE_GRAPH_NO_GITIGNORE=1` | Do not write the `.code-graph/` ignore rule. It goes to the repository's local `.git/info/exclude`, never to the tracked `.gitignore`, and only when neither file names the directory already. |
|
|
551
|
-
| `CODE_GRAPH_QUIET_HOOKS=1` |
|
|
553
|
+
| `CODE_GRAPH_QUIET_HOOKS=1` | The hooks inject nothing (grep, read, edit, prompt, subagent and Stop stay silent), and the MCP `instructions` shrink to a one-line pointer to the full decision table. |
|
|
552
554
|
| `CODE_GRAPH_VERBOSE_HOOKS=1` | The opposite: opt into the noisy form. |
|
|
553
555
|
| `CODE_GRAPH_NO_BLOCK_GREP=1` | Never turn a `grep` hint into a block — prefix a single command with it to get past one. |
|
|
554
556
|
| `CODE_GRAPH_NO_INJECT=1` | No post-tool AST context injection. |
|
|
555
557
|
| `CODE_GRAPH_STATUSLINE_COUNTS=0` | Drop the session counts (`5 answers · 2 calls`) from the statusline. |
|
|
556
|
-
| `CODE_GRAPH_HOOK_INDEX=on\|off` |
|
|
558
|
+
| `CODE_GRAPH_HOOK_INDEX=on\|off` | Turn the per-edit incremental-index hook on (it is off by default; the MCP server's watcher re-indexes edits at its next query tool call) or keep it off. |
|
|
557
559
|
| `CODE_GRAPH_MODEL_DIR=<dir>` | Load the embedding model from here (air-gapped installs). |
|
|
558
560
|
| `CODE_GRAPH_DISABLE_MODEL_DOWNLOAD=1` | Never fetch the model; fail instead. |
|
|
559
561
|
| `CODE_GRAPH_REQUIRE_MODEL=1` | Test-only: make the embedding tests FAIL when no model can be loaded instead of self-skipping. Set by the release gate and the cache-warm cron, which supply pinned weights — without it those tests pass by doing nothing on any runner with no cached model. |
|
|
@@ -574,7 +576,10 @@ defaults are what you get by doing nothing.
|
|
|
574
576
|
code-graph claims Claude Code's single `statusLine` slot and runs a **composite**
|
|
575
577
|
that calls each registered provider in turn, so other plugins keep their segment
|
|
576
578
|
instead of losing the slot. Whatever occupied it at install time is captured
|
|
577
|
-
automatically as the `_previous` provider and restored on uninstall
|
|
579
|
+
automatically as the `_previous` provider and restored on uninstall, unless
|
|
580
|
+
another plugin has registered a segment through code-graph: then the slot goes
|
|
581
|
+
to that plugin, so its segment keeps rendering, and your previous command stays
|
|
582
|
+
listed in `~/.claude/statusline-providers.json` for you to put back.
|
|
578
583
|
|
|
579
584
|
A third-party plugin registers itself through the shipped CLI:
|
|
580
585
|
|
|
@@ -160,6 +160,17 @@ function classifyHealthReport(hc) {
|
|
|
160
160
|
// the action. Broken, so not advisory: every command refuses this project.
|
|
161
161
|
// Its repair arm only says what to do (the link may be the user's own), so it
|
|
162
162
|
// stays unresolved, and doctor exits 1, until `.code-graph` is fixed.
|
|
163
|
+
// The last index run died (killed or failed) and left the index short of what
|
|
164
|
+
// it was writing, which read as `Index ✅` (E2E 2026-10-16 round 2). The
|
|
165
|
+
// index-empty repair runs incremental-index, which re-indexes in full then.
|
|
166
|
+
if (hc.reason === 'interrupted') {
|
|
167
|
+
return [
|
|
168
|
+
{ name: 'Schema', status: 'ok', detail: `v${hc.schema_version}` },
|
|
169
|
+
{ name: 'Index', status: 'error', detail: String(hc.issue || 'last index run did not finish'), fixId: 'index-empty' },
|
|
170
|
+
classifyEmbeddings(hc),
|
|
171
|
+
classifyIntegrity(hc),
|
|
172
|
+
];
|
|
173
|
+
}
|
|
163
174
|
if (hc.reason === 'refused') {
|
|
164
175
|
return [
|
|
165
176
|
{ name: 'Schema', status: 'skip', detail: 'index not read' },
|
|
@@ -1047,6 +1058,12 @@ function runRepairs(results, {
|
|
|
1047
1058
|
rebuildIndex = rebuildIndexInPlace,
|
|
1048
1059
|
binaryUsable = binaryBrokenResolved,
|
|
1049
1060
|
buildBinary = buildBinaryFromSource,
|
|
1061
|
+
locateBinary = findBinary,
|
|
1062
|
+
runIndexer = (binary, args) => execFileSync(binary, args, hidden({
|
|
1063
|
+
cwd: process.cwd(),
|
|
1064
|
+
stdio: 'inherit',
|
|
1065
|
+
timeout: 120000,
|
|
1066
|
+
})),
|
|
1050
1067
|
} = {}) {
|
|
1051
1068
|
const fixable = results.filter(r => r.fixId);
|
|
1052
1069
|
if (fixable.length === 0) return 0;
|
|
@@ -1200,17 +1217,17 @@ function runRepairs(results, {
|
|
|
1200
1217
|
}
|
|
1201
1218
|
|
|
1202
1219
|
case 'index-empty': {
|
|
1203
|
-
const binary =
|
|
1220
|
+
const binary = locateBinary();
|
|
1204
1221
|
if (binary) {
|
|
1205
1222
|
console.log('\n Rebuilding index...');
|
|
1206
|
-
console.log(' \u2192 code-graph-mcp incremental-index');
|
|
1223
|
+
console.log(' \u2192 code-graph-mcp incremental-index --no-embed');
|
|
1224
|
+
// `--no-embed`: the structural index is what this repairs. With the
|
|
1225
|
+
// model installed, embedding hono's 502 files took 357 s, so a
|
|
1226
|
+
// 120 s run on flask timed out and reported failure for an index it
|
|
1227
|
+
// had built (E2E 2026-10-16). The MCP server embeds in the background.
|
|
1207
1228
|
try {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
stdio: 'inherit',
|
|
1211
|
-
timeout: 120000,
|
|
1212
|
-
}));
|
|
1213
|
-
console.log(' \u2705 Index rebuilt');
|
|
1229
|
+
runIndexer(binary, ['incremental-index', '--no-embed']);
|
|
1230
|
+
console.log(' \u2705 Index rebuilt (embeddings are added in the background by the MCP server)');
|
|
1214
1231
|
fixed++;
|
|
1215
1232
|
} catch (e) {
|
|
1216
1233
|
console.log(` \u274c Index rebuild failed${silentFailureReason(e)}`);
|
|
@@ -301,6 +301,16 @@ summary += ` ${directCallers} direct callers, ${totalCallers} total across ${af
|
|
|
301
301
|
if (routeCount > 0) summary += `, ${routeCount} routes affected`;
|
|
302
302
|
if (testCount > 0) summary += ` (${testCount} tests)`;
|
|
303
303
|
summary += '\n';
|
|
304
|
+
// The counts above are what `impact` could resolve, and it says when that is a
|
|
305
|
+
// floor; the CLI prints both caveats, so the model must get them too. Without
|
|
306
|
+
// them, flask's `url_for` read as 7 callers with 32 more excluded.
|
|
307
|
+
const ambiguous = jsonResult.ambiguous_callers_excluded || 0;
|
|
308
|
+
if (ambiguous > 0) {
|
|
309
|
+
summary += ` ⚠ ${ambiguous} more call edge(s) matched only by name were not counted; the blast radius may be larger\n`;
|
|
310
|
+
}
|
|
311
|
+
if (jsonResult.callers_truncated) {
|
|
312
|
+
summary += ' ⚠ the caller traversal stopped early, so these counts are a floor, not a total\n';
|
|
313
|
+
}
|
|
304
314
|
|
|
305
315
|
// List direct callers compactly
|
|
306
316
|
const callers = (jsonResult.callers || []).filter(c => c.depth === 1);
|
|
@@ -140,10 +140,27 @@ function indexBuildInProgress(root, now = Date.now()) {
|
|
|
140
140
|
try {
|
|
141
141
|
if (now - fs.statSync(file).mtimeMs >= INDEXING_STALE_MS) return false;
|
|
142
142
|
const p = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
143
|
+
// A killed server leaves its last status behind; it names its pid.
|
|
144
|
+
if (!writerAlive(p)) return false;
|
|
145
|
+
// "starting": written before the server's tree walk, no file count yet.
|
|
146
|
+
if (p.s === 'starting') return true;
|
|
143
147
|
return (p.s === 'indexing' || p.s === 'finalizing') && p.t > 0;
|
|
144
148
|
} catch {
|
|
145
149
|
return false;
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
|
|
153
|
+
// Whether the status file's writer is still running. A file with no pid (an
|
|
154
|
+
// older server) counts as live, as before. Signal 0 only checks: ESRCH is gone,
|
|
155
|
+
// EPERM is alive under another user.
|
|
156
|
+
function writerAlive(p) {
|
|
157
|
+
if (!p || !Number.isInteger(p.pid) || p.pid <= 0) return true;
|
|
158
|
+
try {
|
|
159
|
+
process.kill(p.pid, 0);
|
|
160
|
+
return true;
|
|
161
|
+
} catch (e) {
|
|
162
|
+
return e && e.code === 'EPERM';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
module.exports = { resolveProjectRoot, indexBuildInProgress, writerAlive, INDEXING_STALE_MS };
|
|
@@ -316,6 +316,10 @@ function indexNeedsRevalidation(bin, cwd) {
|
|
|
316
316
|
// caller must start one — before this it read as "not stale" and every
|
|
317
317
|
// hook stayed dark with no word to the user (hook audit 2026-09-28 P1-7).
|
|
318
318
|
if (report.reason === 'corrupt') return 'corrupt';
|
|
319
|
+
// reason "interrupted" (a run died) starts nothing here: the MCP server's
|
|
320
|
+
// own startup run re-indexes in full and clears it, and a CLI run started
|
|
321
|
+
// beside it raced its writes and failed both, 4 of 4 (E2E 2026-10-16
|
|
322
|
+
// round 3).
|
|
319
323
|
return report.index_version_stale === true;
|
|
320
324
|
} catch {
|
|
321
325
|
return false;
|
|
@@ -334,10 +338,13 @@ function indexNeedsRevalidation(bin, cwd) {
|
|
|
334
338
|
* Returns 'fresh' | 'refreshing' | 'skipped' | 'unknown', where 'unknown' means
|
|
335
339
|
* the SessionStart budget ran out before either trigger could be evaluated —
|
|
336
340
|
* distinct from 'fresh' (both triggers asked and neither fired) and from
|
|
337
|
-
* 'skipped' (no binary / no index, so there was nothing to ask).
|
|
341
|
+
* 'skipped' (no binary / no index, so there was nothing to ask). 'refreshing'
|
|
342
|
+
* also when the MCP server's own build is in progress and no refresh is
|
|
343
|
+
* started. `deps` replaces `findBinary` and `spawn` in tests.
|
|
338
344
|
*/
|
|
339
|
-
function ensureIndexFresh() {
|
|
340
|
-
const
|
|
345
|
+
function ensureIndexFresh(deps = {}) {
|
|
346
|
+
const findBinary = deps.findBinary || require('./find-binary').findBinary;
|
|
347
|
+
const spawnRefresh = deps.spawn || spawn;
|
|
341
348
|
const bin = findBinary();
|
|
342
349
|
if (!bin) return 'skipped';
|
|
343
350
|
|
|
@@ -381,12 +388,19 @@ function ensureIndexFresh() {
|
|
|
381
388
|
// from looking again.
|
|
382
389
|
if (!needsRefresh) return unprobed ? 'unknown' : 'fresh';
|
|
383
390
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (
|
|
391
|
+
// The MCP server's startup run is already indexing (its status file names a
|
|
392
|
+
// live writer) and covers what this refresh would. A CLI run started beside
|
|
393
|
+
// it raced its writes and failed it: django, the server first and this hook
|
|
394
|
+
// 50 ms later, 3 of 3, and the server's watcher never started (E2E
|
|
395
|
+
// 2026-10-16 round 4).
|
|
396
|
+
if (!require('./project-root').indexBuildInProgress(cwd)) {
|
|
397
|
+
const child = spawnRefresh(bin, ['incremental-index', '--quiet'], hidden({
|
|
398
|
+
cwd,
|
|
399
|
+
detached: true,
|
|
400
|
+
stdio: 'ignore',
|
|
401
|
+
}));
|
|
402
|
+
if (child && typeof child.unref === 'function') child.unref();
|
|
403
|
+
}
|
|
390
404
|
if (corrupt) {
|
|
391
405
|
notices.push(
|
|
392
406
|
'[code-graph] The index at .code-graph/index.db was corrupt, so every hook had nothing to say.\n' +
|
|
@@ -413,9 +427,14 @@ function ensureIndexFresh() {
|
|
|
413
427
|
* are testable without a binary-less machine.
|
|
414
428
|
*/
|
|
415
429
|
function missingBinaryMessage(env = process.env) {
|
|
430
|
+
// CODE_GRAPH_NO_AUTO_UPDATE=1 stops updates, not the install of a missing
|
|
431
|
+
// binary: the MCP launcher installs it either way (README, Environment
|
|
432
|
+
// variables). Telling this user to install by hand was false while the
|
|
433
|
+
// launcher's install was already running (E2E 2026-10-16).
|
|
416
434
|
if (env.CODE_GRAPH_NO_AUTO_UPDATE === '1') {
|
|
417
|
-
return '[code-graph] Binary not found
|
|
418
|
-
'
|
|
435
|
+
return '[code-graph] Binary not found — installing it in the background (~40MB, first run only).\n' +
|
|
436
|
+
' CODE_GRAPH_NO_AUTO_UPDATE=1 stops updates, not this install.\n' +
|
|
437
|
+
' Still missing next session? Install it yourself: npm install -g @sdsrs/code-graph\n';
|
|
419
438
|
}
|
|
420
439
|
return '[code-graph] Binary not found — fetching it in the background (~40MB, first run only).\n' +
|
|
421
440
|
' Tools appear as soon as it lands; no restart needed.\n' +
|
|
@@ -111,7 +111,14 @@ try {
|
|
|
111
111
|
// src/indexer/pipeline/mod.rs, which drives server/CLI-side stale cleanup.)
|
|
112
112
|
const INDEXING_STALE_MS = 120000;
|
|
113
113
|
const fresh = (Date.now() - fs.statSync(progressFile).mtimeMs) < INDEXING_STALE_MS;
|
|
114
|
-
|
|
114
|
+
let p = fresh ? JSON.parse(fs.readFileSync(progressFile, 'utf8')) : null;
|
|
115
|
+
// A killed server's last write names its pid: ignore it at once rather than
|
|
116
|
+
// pinning "finalizing N/M" for the stale window.
|
|
117
|
+
if (p && !require('./project-root').writerAlive(p)) p = null;
|
|
118
|
+
if (p && p.s === 'starting') {
|
|
119
|
+
process.stdout.write('code-graph: \u21BB indexing\u2026');
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
115
122
|
if (p && p.s === 'indexing' && p.t > 0) {
|
|
116
123
|
// floor, not round: skipped files (parse errors, oversized) keep d below t
|
|
117
124
|
// even in the terminal progress write, and rounding displayed that state as
|
|
@@ -63,9 +63,12 @@ function runMain() {
|
|
|
63
63
|
const input = readStdinJson();
|
|
64
64
|
if (!input) return;
|
|
65
65
|
|
|
66
|
-
const { resolveProjectRoot } = require('./project-root');
|
|
66
|
+
const { resolveProjectRoot, indexBuildInProgress } = require('./project-root');
|
|
67
67
|
const root = resolveProjectRoot(typeof input.cwd === 'string' && input.cwd ? input.cwd : process.cwd());
|
|
68
68
|
if (root === null) return;
|
|
69
|
+
// A partial index's counts are no facts, and the commands below would refuse
|
|
70
|
+
// while it is built (D5, as every other hook; E2E 2026-10-16 round 2).
|
|
71
|
+
if (indexBuildInProgress(root)) return;
|
|
69
72
|
|
|
70
73
|
const binary = require('./find-binary').findBinary();
|
|
71
74
|
if (!binary) return;
|
|
@@ -600,13 +600,35 @@ function runMain() {
|
|
|
600
600
|
// for a file path and a preview.
|
|
601
601
|
process.stdout.write(capContext(`${PREFIXES[query.type]}\n${result.trim()}\n`));
|
|
602
602
|
}
|
|
603
|
-
} catch {
|
|
604
|
-
|
|
603
|
+
} catch (e) {
|
|
604
|
+
// A name defined in more than one place makes impact / callgraph refuse.
|
|
605
|
+
// Swallowed, that was silence for 5 of 8 prompts naming a real flask or
|
|
606
|
+
// hono symbol (E2E 2026-10-16); the refusal lists where each definition
|
|
607
|
+
// is, which is worth knowing before an edit.
|
|
608
|
+
const text = ambiguityContext(e && e.stderr);
|
|
609
|
+
if (text) process.stdout.write(capContext(text));
|
|
605
610
|
}
|
|
606
611
|
}
|
|
607
612
|
|
|
613
|
+
// The CLI's ambiguity refusal (stderr, exit 1) → context naming each
|
|
614
|
+
// definition, or '' for any other failure. The refusal's first line is passed
|
|
615
|
+
// on after its "Ambiguous symbol 'X':" lead: it carries the advice that fits
|
|
616
|
+
// (`--file` across files, `--node-id` within one) and the "Showing the first
|
|
617
|
+
// 5 of 9" note when the list is cut (E2E 2026-10-16 round 2).
|
|
618
|
+
function ambiguityContext(stderr) {
|
|
619
|
+
const lines = String(stderr || '').split('\n');
|
|
620
|
+
const head = lines.findIndex((l) => /^\[code-graph\] Ambiguous symbol '/.test(l));
|
|
621
|
+
if (head === -1) return '';
|
|
622
|
+
const defs = lines.slice(head + 1).filter((l) => /^ {2}\S.* in \S/.test(l));
|
|
623
|
+
if (defs.length === 0) return '';
|
|
624
|
+
const m = /Ambiguous symbol '([^']+)':\s*(.*)$/.exec(lines[head]);
|
|
625
|
+
if (!m) return '';
|
|
626
|
+
return `[code-graph:definitions] '${m[1]}' is defined in more than one place — ${m[2]}\n` +
|
|
627
|
+
defs.join('\n') + '\n';
|
|
628
|
+
}
|
|
629
|
+
|
|
608
630
|
if (require.main === module) {
|
|
609
631
|
runMain();
|
|
610
632
|
}
|
|
611
633
|
|
|
612
|
-
module.exports = { COOLDOWNS, shouldSkip, extractFilePaths, extractSymbols, detectIntents, scoreIntent, INTENT_PATTERNS, INTENT_THRESHOLD, determineQueryType, computeQuietHooks, STOP_WORDS, PLAIN_WORD_EXCLUDE, hasSymptom, SYMPTOM_PATTERNS, buildRunEnv, childBudgetMs, CHILD_TIMEOUT_MS };
|
|
634
|
+
module.exports = { ambiguityContext, COOLDOWNS, shouldSkip, extractFilePaths, extractSymbols, detectIntents, scoreIntent, INTENT_PATTERNS, INTENT_THRESHOLD, determineQueryType, computeQuietHooks, STOP_WORDS, PLAIN_WORD_EXCLUDE, hasSymptom, SYMPTOM_PATTERNS, buildRunEnv, childBudgetMs, CHILD_TIMEOUT_MS };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# Copy this file into .github/workflows/ in your project to publish a
|
|
2
2
|
# code-graph snapshot alongside each GitHub release. The snapshot is a
|
|
3
|
-
#
|
|
4
|
-
# clones of your repo skip the initial full code-graph index.
|
|
3
|
+
# zstd-compressed SQLite database (1.6 MB for click, 25 MB for django) that
|
|
4
|
+
# lets first-time clones of your repo skip the initial full code-graph index.
|
|
5
|
+
# Install refuses one that is over 100 MB uncompressed (django's is 156 MB).
|
|
5
6
|
#
|
|
6
|
-
# Requires: @sdsrs/code-graph >= 0.
|
|
7
|
+
# Requires: @sdsrs/code-graph >= 0.36.0, the first `snapshot create` that
|
|
8
|
+
# writes the `.blake3` checksum this workflow uploads (installs since 0.94.0
|
|
9
|
+
# refuse a snapshot without one). The step below pins a newer version.
|
|
7
10
|
#
|
|
8
11
|
# The package name is `@sdsrs/code-graph` (the `code-graph-mcp` binary lives
|
|
9
12
|
# inside it). Do NOT shorten this to `npx -y code-graph-mcp` — that unscoped
|
|
@@ -33,14 +36,16 @@ jobs:
|
|
|
33
36
|
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
34
37
|
with:
|
|
35
38
|
node-version: '20'
|
|
39
|
+
# `--out <name>.db.zst` makes create compress the snapshot itself and write
|
|
40
|
+
# its checksum beside it as `<name>.db.zst.blake3`. Upload both: install
|
|
41
|
+
# refuses a snapshot that has no checksum sidecar.
|
|
36
42
|
- name: Build snapshot
|
|
37
43
|
run: |
|
|
38
|
-
npx -y -p @sdsrs/code-graph@0.
|
|
39
|
-
zstd -9 snapshot.db -o snapshot.db.zst
|
|
40
|
-
mv snapshot.db.zst "code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
|
|
44
|
+
npx -y -p @sdsrs/code-graph@0.171.0 code-graph-mcp snapshot create --out "code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
|
|
41
45
|
- name: Upload to release
|
|
42
46
|
env:
|
|
43
47
|
GH_TOKEN: ${{ github.token }}
|
|
44
48
|
run: |
|
|
45
49
|
gh release upload "${{ github.event.release.tag_name }}" \
|
|
46
|
-
"code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst"
|
|
50
|
+
"code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst" \
|
|
51
|
+
"code-graph-snapshot-${GITHUB_SHA:0:7}.db.zst.blake3"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.171.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": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"node": ">=16"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@sdsrs/code-graph-linux-x64": "0.
|
|
39
|
-
"@sdsrs/code-graph-linux-arm64": "0.
|
|
40
|
-
"@sdsrs/code-graph-darwin-x64": "0.
|
|
41
|
-
"@sdsrs/code-graph-darwin-arm64": "0.
|
|
42
|
-
"@sdsrs/code-graph-win32-x64": "0.
|
|
38
|
+
"@sdsrs/code-graph-linux-x64": "0.171.0",
|
|
39
|
+
"@sdsrs/code-graph-linux-arm64": "0.171.0",
|
|
40
|
+
"@sdsrs/code-graph-darwin-x64": "0.171.0",
|
|
41
|
+
"@sdsrs/code-graph-darwin-arm64": "0.171.0",
|
|
42
|
+
"@sdsrs/code-graph-win32-x64": "0.171.0"
|
|
43
43
|
}
|
|
44
44
|
}
|