@colbymchenry/codegraph-darwin-x64 0.9.3 → 0.9.4
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/lib/dist/bin/codegraph.d.ts +3 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +238 -0
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/context/index.d.ts +13 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +120 -1
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +18 -0
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +31 -0
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/queries.d.ts +16 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +80 -27
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +6 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +17 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +73 -4
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +12 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +14 -2
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +71 -36
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +9 -0
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +2 -2
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +2 -1
- package/lib/dist/installer/instructions-template.js.map +1 -1
- package/lib/dist/mcp/index.d.ts +4 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +97 -0
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +2 -0
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +81 -2
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +664 -24
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +9 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.js +576 -0
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +36 -8
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/drupal.js +44 -12
- package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +102 -19
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +6 -3
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +5 -1
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +70 -12
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.js +17 -8
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/play.d.ts +19 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/play.js +111 -0
- package/lib/dist/resolution/frameworks/play.js.map +1 -0
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +134 -16
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +96 -3
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +106 -2
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/rust.js +102 -5
- package/lib/dist/resolution/frameworks/rust.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +30 -6
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +61 -9
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/lru-cache.d.ts +24 -0
- package/lib/dist/resolution/lru-cache.d.ts.map +1 -0
- package/lib/dist/resolution/lru-cache.js +62 -0
- package/lib/dist/resolution/lru-cache.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +8 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/utils.js +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/lib/dist/mcp/index.js
CHANGED
|
@@ -56,6 +56,7 @@ const sync_1 = require("../sync");
|
|
|
56
56
|
const transport_1 = require("./transport");
|
|
57
57
|
const tools_1 = require("./tools");
|
|
58
58
|
const server_instructions_1 = require("./server-instructions");
|
|
59
|
+
const wasm_runtime_flags_1 = require("../extraction/wasm-runtime-flags");
|
|
59
60
|
/**
|
|
60
61
|
* Convert a file:// URI to a filesystem path.
|
|
61
62
|
* Handles URL encoding and Windows drive letter paths.
|
|
@@ -91,6 +92,53 @@ const PROTOCOL_VERSION = '2024-11-05';
|
|
|
91
92
|
* and falling back to the process cwd.
|
|
92
93
|
*/
|
|
93
94
|
const ROOTS_LIST_TIMEOUT_MS = 5000;
|
|
95
|
+
/**
|
|
96
|
+
* How often to poll `process.ppid` to detect parent process death (see #277).
|
|
97
|
+
* 5s is a deliberate trade-off: the failure mode being guarded against is rare
|
|
98
|
+
* (parent SIGKILL'd), and longer poll = less wakeup overhead while idle.
|
|
99
|
+
*/
|
|
100
|
+
const DEFAULT_PPID_POLL_MS = 5000;
|
|
101
|
+
/**
|
|
102
|
+
* Resolve the PPID watchdog poll interval from an env override. A value of
|
|
103
|
+
* `0` disables the watchdog entirely (escape hatch for embedded scenarios
|
|
104
|
+
* where the parent legitimately re-parents the server on purpose). Anything
|
|
105
|
+
* non-numeric or negative falls back to the default.
|
|
106
|
+
*/
|
|
107
|
+
function parsePpidPollMs(raw) {
|
|
108
|
+
if (raw === undefined || raw === '')
|
|
109
|
+
return DEFAULT_PPID_POLL_MS;
|
|
110
|
+
const parsed = Number(raw);
|
|
111
|
+
if (!Number.isFinite(parsed))
|
|
112
|
+
return DEFAULT_PPID_POLL_MS;
|
|
113
|
+
if (parsed < 0)
|
|
114
|
+
return DEFAULT_PPID_POLL_MS;
|
|
115
|
+
return Math.floor(parsed);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Parse the host PID propagated across the `--liftoff-only` re-exec
|
|
119
|
+
* ({@link HOST_PPID_ENV}). Returns a positive integer PID, or null when
|
|
120
|
+
* unset/invalid — the direct-launch path, where the watchdog falls back to
|
|
121
|
+
* `process.ppid` divergence. PIDs of 0/1 are rejected (0 = unknown, 1 = init,
|
|
122
|
+
* i.e. already orphaned), so the watchdog doesn't latch onto init.
|
|
123
|
+
*/
|
|
124
|
+
function parseHostPpid(raw) {
|
|
125
|
+
if (raw === undefined || raw === '')
|
|
126
|
+
return null;
|
|
127
|
+
const parsed = Number(raw);
|
|
128
|
+
if (!Number.isInteger(parsed) || parsed <= 1)
|
|
129
|
+
return null;
|
|
130
|
+
return parsed;
|
|
131
|
+
}
|
|
132
|
+
/** True if a process with `pid` currently exists (signal-0 probe). */
|
|
133
|
+
function isProcessAlive(pid) {
|
|
134
|
+
try {
|
|
135
|
+
process.kill(pid, 0);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
94
142
|
/**
|
|
95
143
|
* Extract the first usable filesystem path from a `roots/list` result.
|
|
96
144
|
* Shape per MCP spec: `{ roots: [{ uri: "file:///path", name?: string }] }`.
|
|
@@ -128,6 +176,19 @@ class MCPServer {
|
|
|
128
176
|
// Guards the one-shot deferred resolution (roots/list or cwd) so we don't
|
|
129
177
|
// re-issue roots/list on every tool call.
|
|
130
178
|
rootsAttempted = false;
|
|
179
|
+
// PPID watchdog — see start(). Captured at construction so we always have a
|
|
180
|
+
// baseline, even if start() runs after a fork-style reparent.
|
|
181
|
+
originalPpid = process.ppid;
|
|
182
|
+
// The MCP host's PID, propagated across the `--liftoff-only` re-exec (see
|
|
183
|
+
// HOST_PPID_ENV). When set, the watchdog polls it directly: the re-exec
|
|
184
|
+
// inserts an intermediate process whose *death* — not just our reparenting —
|
|
185
|
+
// is what we'd otherwise miss. null on the direct (bundled) launch path.
|
|
186
|
+
hostPpid = parseHostPpid(process.env[wasm_runtime_flags_1.HOST_PPID_ENV]);
|
|
187
|
+
ppidWatchdog = null;
|
|
188
|
+
// Idempotency guard for stop(). Without it, the watchdog can race with the
|
|
189
|
+
// stdin `end`/`close` handlers (or SIGTERM/SIGINT) and double-close cg and
|
|
190
|
+
// the transport before process.exit() lands.
|
|
191
|
+
stopped = false;
|
|
131
192
|
constructor(projectPath) {
|
|
132
193
|
this.projectPath = projectPath || null;
|
|
133
194
|
this.transport = new transport_1.StdioTransport();
|
|
@@ -151,6 +212,35 @@ class MCPServer {
|
|
|
151
212
|
// Detect this and shut down gracefully to prevent orphaned processes.
|
|
152
213
|
process.stdin.on('end', () => this.stop());
|
|
153
214
|
process.stdin.on('close', () => this.stop());
|
|
215
|
+
// PPID watchdog (#277). Linux doesn't propagate parent death to children,
|
|
216
|
+
// so when the MCP host (Claude Code, opencode, …) is SIGKILL'd by the OOM
|
|
217
|
+
// killer / a force-quit / a container teardown, the child is reparented to
|
|
218
|
+
// init/systemd and the stdin `end`/`close` events don't always fire. The
|
|
219
|
+
// server would then linger indefinitely, holding inotify watches, file
|
|
220
|
+
// descriptors, and the SQLite WAL. Poll `process.ppid` and shut down the
|
|
221
|
+
// moment it changes from what we observed at startup. Cross-platform:
|
|
222
|
+
// reparenting changes ppid on Linux *and* macOS; on Windows the value can
|
|
223
|
+
// also drop to 0 once the parent is gone. When the CLI re-execs itself for
|
|
224
|
+
// `--liftoff-only`, an intermediate process sits between us and the host and
|
|
225
|
+
// outlives it, so our own ppid wouldn't change — in that case we poll the
|
|
226
|
+
// host PID (propagated via HOST_PPID_ENV) for liveness instead. The watchdog
|
|
227
|
+
// is `.unref()`'d so it never holds the event loop open on its own.
|
|
228
|
+
const pollMs = parsePpidPollMs(process.env.CODEGRAPH_PPID_POLL_MS);
|
|
229
|
+
if (pollMs > 0) {
|
|
230
|
+
this.ppidWatchdog = setInterval(() => {
|
|
231
|
+
const current = process.ppid;
|
|
232
|
+
const ppidChanged = current !== this.originalPpid;
|
|
233
|
+
const hostGone = this.hostPpid !== null && !isProcessAlive(this.hostPpid);
|
|
234
|
+
if (ppidChanged || hostGone) {
|
|
235
|
+
const reason = ppidChanged
|
|
236
|
+
? `ppid ${this.originalPpid} -> ${current}`
|
|
237
|
+
: `host pid ${this.hostPpid} exited`;
|
|
238
|
+
process.stderr.write(`[CodeGraph MCP] Parent process exited (${reason}); shutting down.\n`);
|
|
239
|
+
this.stop();
|
|
240
|
+
}
|
|
241
|
+
}, pollMs);
|
|
242
|
+
this.ppidWatchdog.unref();
|
|
243
|
+
}
|
|
154
244
|
}
|
|
155
245
|
/**
|
|
156
246
|
* Try to initialize CodeGraph for the default project.
|
|
@@ -306,6 +396,13 @@ class MCPServer {
|
|
|
306
396
|
* Stop the server
|
|
307
397
|
*/
|
|
308
398
|
stop() {
|
|
399
|
+
if (this.stopped)
|
|
400
|
+
return;
|
|
401
|
+
this.stopped = true;
|
|
402
|
+
if (this.ppidWatchdog) {
|
|
403
|
+
clearInterval(this.ppidWatchdog);
|
|
404
|
+
this.ppidWatchdog = null;
|
|
405
|
+
}
|
|
309
406
|
// Close all cached cross-project connections first
|
|
310
407
|
this.toolHandler.closeAll();
|
|
311
408
|
// Close the main CodeGraph instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,kDAA+D;AAC/D,kCAA8C;AAC9C,2CAA8F;AAC9F,mCAA6C;AAC7C,+DAA4D;AAE5D;;;GAGG;AACH,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAChD,2EAA2E;QAC3E,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClE,QAAQ,GAAG,QAAQ,CAAC,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IACK,KAAK,CAAC,eAAe,CAAC,OAAuB;QACnD,MAAM,MAAM,GAAG,OAAO,CAAC,MAGtB,CAAC;QAEF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,CAAC,SAAS,CACtB,OAAO,CAAC,EAAE,EACV,sBAAU,CAAC,aAAa,EACxB,mBAAmB,CACpB,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QAExC,uBAAuB;QACvB,MAAM,IAAI,GAAG,aAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,SAAS,CAAC,SAAS,CACtB,OAAO,CAAC,EAAE,EACV,sBAAU,CAAC,aAAa,EACxB,iBAAiB,QAAQ,EAAE,CAC5B,CAAC;YACF,OAAO;QACT,CAAC;QAED,qEAAqE;QACrE,0EAA0E;QAC1E,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAElE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AA3aD,8BA2aC;AAED,wBAAwB;AACxB,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,iCAA6C;AAApC,8FAAA,KAAK,OAAA;AAAE,oGAAA,WAAW,OAAA"}
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* burn tokens. Reference only tools that exist on `main`; gate any
|
|
16
16
|
* conditional tools behind feature checks if/when they ship.
|
|
17
17
|
*/
|
|
18
|
-
export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file\nin the workspace. Reads are sub-millisecond; the index lags writes by\nabout a second through the file watcher. Consult it BEFORE writing or\nediting code, not during.\n\n## Answer directly \u2014 don't delegate exploration\n\nFor \"how does X work\", architecture, trace, or where-is-X questions,\nanswer DIRECTLY using 2-3 codegraph calls: `codegraph_context` first,\nthen ONE `codegraph_explore` for the source of the symbols it surfaces.\nCodegraph IS the pre-built search index \u2014 so delegating the lookup to a\nseparate file-reading sub-task/agent, or running your own grep + read\nloop, repeats work codegraph already did and costs more for the same\nanswer. Reach for raw Read/Grep only to confirm a specific detail\ncodegraph didn't cover. A direct codegraph answer is typically a handful\nof calls; a grep/read exploration is dozens.\n\n## Tool selection by intent\n\n- **\"What is the symbol named X?\"** \u2192 `codegraph_search`\n- **\"What's the deal with this task / feature / area?\"** \u2192 `codegraph_context` (PRIMARY \u2014 composes search + node + callers + callees in one call)\n- **\"What calls this?\"** \u2192 `codegraph_callers`\n- **\"What does this call?\"** \u2192 `codegraph_callees`\n- **\"What would changing this break?\"** \u2192 `codegraph_impact`\n- **\"Show me this symbol's source / signature / docstring.\"** \u2192 `codegraph_node`\n- **\"Show me several related symbols' source / survey an area.\"** \u2192 `codegraph_explore` (ONE capped call; prefer over many codegraph_node/Read)\n- **\"What's in directory X?\"** \u2192 `codegraph_files`\n- **\"Is the index ready / what's its size?\"** \u2192 `codegraph_status`\n\n## Common chains\n\n- **Onboarding**: `codegraph_context` first. If still unclear, `codegraph_explore` for breadth, then `codegraph_node` on specific symbols.\n- **Refactor planning**: `codegraph_search` \u2192 `codegraph_callers` \u2192 `codegraph_impact`. The blast-radius answer comes from impact, not from walking callers manually.\n- **Debugging a regression**: `codegraph_callers` of the suspected symbol; widen with `codegraph_impact` if an unexpected call appears.\n\n## Anti-patterns\n\n- **Don't grep first** when looking up a symbol by name \u2014 `codegraph_search` is faster and returns kind + location + signature.\n- **Don't chain `codegraph_search` + `codegraph_node`** when you just want context \u2014 `codegraph_context` is one round-trip.\n- **Don't loop `codegraph_node` over many symbols** \u2014 one `codegraph_explore` call returns them all grouped by file, while each separate call re-reads the whole context and costs far more. Use `codegraph_node` for a single symbol.\n- **Don't query the index immediately after editing a file** \u2014 the watcher needs ~500ms to debounce + sync. Wait for the next turn.\n\n## Limitations\n\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n";
|
|
18
|
+
export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file\nin the workspace. Reads are sub-millisecond; the index lags writes by\nabout a second through the file watcher. Consult it BEFORE writing or\nediting code, not during.\n\n## Answer directly \u2014 don't delegate exploration\n\nFor \"how does X work\", architecture, trace, or where-is-X questions,\nanswer DIRECTLY using 2-3 codegraph calls: `codegraph_context` first,\nthen ONE `codegraph_explore` for the source of the symbols it surfaces.\nCodegraph IS the pre-built search index \u2014 so delegating the lookup to a\nseparate file-reading sub-task/agent, or running your own grep + read\nloop, repeats work codegraph already did and costs more for the same\nanswer. Reach for raw Read/Grep only to confirm a specific detail\ncodegraph didn't cover. A direct codegraph answer is typically a handful\nof calls; a grep/read exploration is dozens.\n\n## Tool selection by intent\n\n- **\"What is the symbol named X?\"** \u2192 `codegraph_search`\n- **\"What's the deal with this task / feature / area?\"** \u2192 `codegraph_context` (PRIMARY \u2014 composes search + node + callers + callees in one call)\n- **\"How does X reach/become Y? / trace the flow / the path from X to Y\"** \u2192 `codegraph_trace` (ONE call returns the whole call path, including dynamic-dispatch hops \u2014 callbacks, React re-render, JSX children \u2014 that grep can't follow)\n- **\"What calls this?\"** \u2192 `codegraph_callers`\n- **\"What does this call?\"** \u2192 `codegraph_callees`\n- **\"What would changing this break?\"** \u2192 `codegraph_impact`\n- **\"Show me this symbol's source / signature / docstring.\"** \u2192 `codegraph_node`\n- **\"Show me several related symbols' source / survey an area.\"** \u2192 `codegraph_explore` (ONE capped call; prefer over many codegraph_node/Read)\n- **\"What's in directory X?\"** \u2192 `codegraph_files`\n- **\"Is the index ready / what's its size?\"** \u2192 `codegraph_status`\n\n## Common chains\n\n- **Flow / \"how does X reach Y\"**: `codegraph_trace` from\u2192to FIRST \u2014 one call returns the entire path with dynamic-dispatch hops bridged. Then ONE `codegraph_explore` for the hop bodies if you need them. Do NOT reconstruct the path with `codegraph_search` + `codegraph_callers` \u2014 that's exactly what trace does in a single call.\n- **Onboarding**: `codegraph_context` first. If still unclear, `codegraph_explore` for breadth, then `codegraph_node` on specific symbols.\n- **Refactor planning**: `codegraph_search` \u2192 `codegraph_callers` \u2192 `codegraph_impact`. The blast-radius answer comes from impact, not from walking callers manually.\n- **Debugging a regression**: `codegraph_callers` of the suspected symbol; widen with `codegraph_impact` if an unexpected call appears.\n\n## Anti-patterns\n\n- **Don't grep first** when looking up a symbol by name \u2014 `codegraph_search` is faster and returns kind + location + signature.\n- **Don't chain `codegraph_search` + `codegraph_node`** when you just want context \u2014 `codegraph_context` is one round-trip.\n- **Don't loop `codegraph_node` over many symbols** \u2014 one `codegraph_explore` call returns them all grouped by file, while each separate call re-reads the whole context and costs far more. Use `codegraph_node` for a single symbol.\n- **Don't query the index immediately after editing a file** \u2014 the watcher needs ~500ms to debounce + sync. Wait for the next turn.\n\n## Limitations\n\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n";
|
|
19
19
|
//# sourceMappingURL=server-instructions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,gzHAmD/B,CAAC"}
|
|
@@ -41,6 +41,7 @@ of calls; a grep/read exploration is dozens.
|
|
|
41
41
|
|
|
42
42
|
- **"What is the symbol named X?"** → \`codegraph_search\`
|
|
43
43
|
- **"What's the deal with this task / feature / area?"** → \`codegraph_context\` (PRIMARY — composes search + node + callers + callees in one call)
|
|
44
|
+
- **"How does X reach/become Y? / trace the flow / the path from X to Y"** → \`codegraph_trace\` (ONE call returns the whole call path, including dynamic-dispatch hops — callbacks, React re-render, JSX children — that grep can't follow)
|
|
44
45
|
- **"What calls this?"** → \`codegraph_callers\`
|
|
45
46
|
- **"What does this call?"** → \`codegraph_callees\`
|
|
46
47
|
- **"What would changing this break?"** → \`codegraph_impact\`
|
|
@@ -51,6 +52,7 @@ of calls; a grep/read exploration is dozens.
|
|
|
51
52
|
|
|
52
53
|
## Common chains
|
|
53
54
|
|
|
55
|
+
- **Flow / "how does X reach Y"**: \`codegraph_trace\` from→to FIRST — one call returns the entire path with dynamic-dispatch hops bridged. Then ONE \`codegraph_explore\` for the hop bodies if you need them. Do NOT reconstruct the path with \`codegraph_search\` + \`codegraph_callers\` — that's exactly what trace does in a single call.
|
|
54
56
|
- **Onboarding**: \`codegraph_context\` first. If still unclear, \`codegraph_explore\` for breadth, then \`codegraph_node\` on specific symbols.
|
|
55
57
|
- **Refactor planning**: \`codegraph_search\` → \`codegraph_callers\` → \`codegraph_impact\`. The blast-radius answer comes from impact, not from walking callers manually.
|
|
56
58
|
- **Debugging a regression**: \`codegraph_callers\` of the suspected symbol; widen with \`codegraph_impact\` if an unexpected call appears.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDlC,CAAC"}
|
package/lib/dist/mcp/tools.d.ts
CHANGED
|
@@ -112,10 +112,22 @@ export declare class ToolHandler {
|
|
|
112
112
|
* Whether a default CodeGraph instance is available
|
|
113
113
|
*/
|
|
114
114
|
hasDefaultCodeGraph(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Optional allowlist of exposed tools, parsed from the CODEGRAPH_MCP_TOOLS
|
|
117
|
+
* env var (comma-separated short names, e.g. "trace,search,node,context").
|
|
118
|
+
* Unset/empty → every tool is exposed. Lets an operator (or an A/B harness)
|
|
119
|
+
* trim the tool surface without rebuilding the client config; the ablated
|
|
120
|
+
* tool is then truly absent from ListTools rather than merely denied on call.
|
|
121
|
+
* Matching is on the short form, so "trace" and "codegraph_trace" both work.
|
|
122
|
+
*/
|
|
123
|
+
private toolAllowlist;
|
|
124
|
+
/** Whether a tool name passes the CODEGRAPH_MCP_TOOLS allowlist (if any). */
|
|
125
|
+
private isToolAllowed;
|
|
115
126
|
/**
|
|
116
127
|
* Get tool definitions with dynamic descriptions based on project size.
|
|
117
128
|
* The codegraph_explore tool description includes a budget recommendation
|
|
118
|
-
* scaled to the number of indexed files.
|
|
129
|
+
* scaled to the number of indexed files. Honors the CODEGRAPH_MCP_TOOLS
|
|
130
|
+
* allowlist so a trimmed surface is reflected in ListTools.
|
|
119
131
|
*/
|
|
120
132
|
getTools(): ToolDefinition[];
|
|
121
133
|
/**
|
|
@@ -133,9 +145,19 @@ export declare class ToolHandler {
|
|
|
133
145
|
*/
|
|
134
146
|
closeAll(): void;
|
|
135
147
|
/**
|
|
136
|
-
* Validate that a value is a non-empty string
|
|
148
|
+
* Validate that a value is a non-empty string within length bounds.
|
|
149
|
+
*
|
|
150
|
+
* The `maxLength` cap protects against MCP clients that ship huge
|
|
151
|
+
* payloads (10MB+ query strings either by accident or maliciously).
|
|
152
|
+
* Without this, a single oversized input can pin the FTS5 index or
|
|
153
|
+
* exhaust memory before any real work runs.
|
|
137
154
|
*/
|
|
138
155
|
private validateString;
|
|
156
|
+
/**
|
|
157
|
+
* Validate an optional path-like string input. Returns the value if
|
|
158
|
+
* valid (or undefined), or a ToolResult with the error.
|
|
159
|
+
*/
|
|
160
|
+
private validateOptionalPath;
|
|
139
161
|
/**
|
|
140
162
|
* Execute a tool by name
|
|
141
163
|
*/
|
|
@@ -164,6 +186,53 @@ export declare class ToolHandler {
|
|
|
164
186
|
* Handle codegraph_impact
|
|
165
187
|
*/
|
|
166
188
|
private handleImpact;
|
|
189
|
+
/**
|
|
190
|
+
* Handle codegraph_trace — shortest CALL PATH between two symbols.
|
|
191
|
+
*
|
|
192
|
+
* Exposes GraphTraverser.findPath: the chain of functions from `from` to `to`,
|
|
193
|
+
* each hop annotated with file:line and the call-site line. This is the
|
|
194
|
+
* capability grep/Read structurally cannot provide. When no static path
|
|
195
|
+
* exists, the chain has almost certainly broken at dynamic dispatch
|
|
196
|
+
* (callbacks, descriptors, metaclasses) — we say so and surface the start
|
|
197
|
+
* symbol's outgoing calls so the agent bridges the one missing hop with
|
|
198
|
+
* codegraph_node rather than blindly reading.
|
|
199
|
+
*/
|
|
200
|
+
private handleTrace;
|
|
201
|
+
/**
|
|
202
|
+
* Describe a synthesized (dynamic-dispatch) edge for human output: how the
|
|
203
|
+
* callback was wired up — the bridge static parsing can't see. Returns null
|
|
204
|
+
* for ordinary static edges. Used by trace + the node trail so a synthesized
|
|
205
|
+
* hop reads as "registered via onUpdate at App.tsx:3148", not a bare arrow.
|
|
206
|
+
*/
|
|
207
|
+
private synthEdgeNote;
|
|
208
|
+
/**
|
|
209
|
+
* Read one trimmed source line at "relpath:line" (relative to the project
|
|
210
|
+
* root). `cache` holds split file contents so a multi-hop trace reads each
|
|
211
|
+
* file at most once. Returns null if the file/line can't be resolved.
|
|
212
|
+
*/
|
|
213
|
+
private sourceLineAt;
|
|
214
|
+
/**
|
|
215
|
+
* Read a hop's body — filePath lines [startLine..endLine] — for inlining into
|
|
216
|
+
* a trace, capped (lines + chars) so the whole path stays path-scoped even on
|
|
217
|
+
* a 7-hop chain. Dedents to the body's own indentation and marks truncation.
|
|
218
|
+
* Shares `cache` with sourceLineAt so each file is read at most once per trace.
|
|
219
|
+
*/
|
|
220
|
+
private sourceRangeAt;
|
|
221
|
+
/**
|
|
222
|
+
* Flow-from-named-symbols: an agent's codegraph_explore query is a bag of
|
|
223
|
+
* symbol names that usually spans the flow it's investigating (e.g.
|
|
224
|
+
* "PmsProductController getList PmsProductService list PmsProductServiceImpl").
|
|
225
|
+
* Surface the longest call chain AMONG those named symbols — scoped to what the
|
|
226
|
+
* agent explicitly named, so (unlike a fuzzy relevance set) there's no
|
|
227
|
+
* wrong-feature wandering. Rides synthesized edges, so controller→service-
|
|
228
|
+
* interface→impl shows up. Returns '' if no chain of >=3 nodes exists.
|
|
229
|
+
*
|
|
230
|
+
* Ambiguous tokens (Java `list` → dozens of nodes) are disambiguated by
|
|
231
|
+
* CO-NAMING: the agent names the class too, so we keep only `list` candidates
|
|
232
|
+
* whose qualifiedName contains another named token (`PmsProductServiceImpl::list`),
|
|
233
|
+
* dropping unrelated `OmsOrderService::list`.
|
|
234
|
+
*/
|
|
235
|
+
private buildFlowFromNamedSymbols;
|
|
167
236
|
/**
|
|
168
237
|
* Handle codegraph_explore — deep exploration in a single call
|
|
169
238
|
*
|
|
@@ -180,6 +249,16 @@ export declare class ToolHandler {
|
|
|
180
249
|
* Handle codegraph_node
|
|
181
250
|
*/
|
|
182
251
|
private handleNode;
|
|
252
|
+
/**
|
|
253
|
+
* Build the "trail" for a symbol: its direct callees (what it calls) and
|
|
254
|
+
* callers (what calls it), each with file:line — so codegraph_node doubles as
|
|
255
|
+
* the structural Grep→Read→expand primitive: a spot PLUS where to go next.
|
|
256
|
+
* Capped to stay cheap. Walk the graph by calling codegraph_node on a trail
|
|
257
|
+
* entry; no Read needed for covered hops. Empty edges on a non-leaf often mean
|
|
258
|
+
* dynamic dispatch the static graph couldn't resolve — that absence is itself
|
|
259
|
+
* a signal (read that one hop) rather than a dead end.
|
|
260
|
+
*/
|
|
261
|
+
private formatTrail;
|
|
183
262
|
/**
|
|
184
263
|
* Handle codegraph_status
|
|
185
264
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAuC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAuC,MAAM,UAAU,CAAC;AA4D/D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,2BAA2B,EAAE,MAAM,CAAC;IACpC,2CAA2C;IAC3C,oBAAoB,EAAE,OAAO,CAAC;IAC9B,yEAAyE;IACzE,sBAAsB,EAAE,OAAO,CAAC;IAChC,sEAAsE;I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