@stupidloud/codegraph 0.7.14 → 0.7.20
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 +44 -10
- package/README.zh-CN.md +3 -8
- package/dist/bin/codegraph.js +102 -24
- package/dist/bin/codegraph.js.map +1 -1
- package/dist/bin/node-version-check.d.ts +3 -0
- package/dist/bin/node-version-check.d.ts.map +1 -1
- package/dist/bin/node-version-check.js +5 -2
- package/dist/bin/node-version-check.js.map +1 -1
- package/dist/bin/uninstall.d.ts +7 -7
- package/dist/bin/uninstall.d.ts.map +1 -1
- package/dist/bin/uninstall.js +23 -135
- package/dist/bin/uninstall.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -2
- package/dist/config.js.map +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +4 -2
- package/dist/context/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +22 -8
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +7 -1
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +0 -1
- package/dist/extraction/index.d.ts +1 -1
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/installer/claude-md-template.d.ts +10 -6
- package/dist/installer/claude-md-template.d.ts.map +1 -1
- package/dist/installer/claude-md-template.js +15 -40
- package/dist/installer/claude-md-template.js.map +1 -1
- package/dist/installer/config-writer.d.ts +17 -24
- package/dist/installer/config-writer.d.ts.map +1 -1
- package/dist/installer/config-writer.js +44 -239
- package/dist/installer/config-writer.js.map +1 -1
- package/dist/installer/index.d.ts +45 -4
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +216 -79
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/instructions-template.d.ts +28 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +63 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +27 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +246 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/codex.d.ts.map +1 -0
- package/dist/installer/targets/codex.js +185 -0
- package/dist/installer/targets/codex.js.map +1 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/cursor.d.ts.map +1 -0
- package/dist/installer/targets/cursor.js +229 -0
- package/dist/installer/targets/cursor.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts +30 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +235 -0
- package/dist/installer/targets/opencode.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +83 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +77 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +246 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/toml.d.ts.map +1 -0
- package/dist/installer/targets/toml.js +147 -0
- package/dist/installer/targets/toml.js.map +1 -0
- package/dist/installer/targets/types.d.ts +116 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +16 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +34 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +6 -6
- package/dist/mcp/tools.d.ts +61 -5
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +389 -81
- package/dist/mcp/tools.js.map +1 -1
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +29 -26
- package/dist/search/query-utils.js.map +1 -1
- package/dist/semantic-config-prompt.d.ts.map +1 -1
- package/dist/semantic-config-prompt.js +2 -3
- package/dist/semantic-config-prompt.js.map +1 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +78 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/shimmer-progress.d.ts +1 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.js +7 -0
- package/dist/ui/shimmer-progress.js.map +1 -1
- package/dist/ui/shimmer-worker.js +20 -11
- package/dist/ui/shimmer-worker.js.map +1 -1
- package/dist/ui/types.d.ts +1 -0
- package/dist/ui/types.d.ts.map +1 -1
- package/dist/vectors/embedder.d.ts +15 -8
- package/dist/vectors/embedder.d.ts.map +1 -1
- package/dist/vectors/embedder.js +81 -53
- package/dist/vectors/embedder.js.map +1 -1
- package/dist/vectors/index.d.ts +1 -1
- package/dist/vectors/index.d.ts.map +1 -1
- package/dist/vectors/index.js.map +1 -1
- package/dist/vectors/manager.d.ts +5 -1
- package/dist/vectors/manager.d.ts.map +1 -1
- package/dist/vectors/manager.js +47 -28
- package/dist/vectors/manager.js.map +1 -1
- package/dist/vectors/search.d.ts +1 -1
- package/dist/vectors/search.d.ts.map +1 -1
- package/dist/vectors/search.js +9 -16
- package/dist/vectors/search.js.map +1 -1
- package/package.json +3 -2
- package/scripts/agent-eval/itrun.sh +107 -0
- package/scripts/agent-eval/parse-run.mjs +45 -0
- package/scripts/agent-eval/parse-session.mjs +93 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/release.sh +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/installer/targets/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAElE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;KAChF,CAAC,CAAC;IACH;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzC,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,eAAe,CAAC;IACvC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,GAAG,WAAW,CAAC;IAC1D;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC;IACtC;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC;IACnC,oEAAoE;IACpE,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,EAAE,CAAC;IACvC;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CAAC,IAAI,WAAW,CAAC;CACrC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent target abstraction for the installer.
|
|
4
|
+
*
|
|
5
|
+
* Each MCP-capable agent (Claude Code, Cursor, Codex CLI, opencode, ...)
|
|
6
|
+
* implements this interface so the installer orchestrator can write the
|
|
7
|
+
* right MCP-server config + instructions file + permissions for that
|
|
8
|
+
* agent without baking client-specific paths into core code. Adding a
|
|
9
|
+
* new agent = one new file in `targets/` + one entry in `registry.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Closes the Claude-locked installer issue (upstream #137). The
|
|
12
|
+
* runtime MCP server is already agent-agnostic; this brings the
|
|
13
|
+
* installer to the same surface.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/installer/targets/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG"}
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare class MCPServer {
|
|
|
25
25
|
private cg;
|
|
26
26
|
private toolHandler;
|
|
27
27
|
private projectPath;
|
|
28
|
+
private initPromise;
|
|
28
29
|
constructor(projectPath?: string);
|
|
29
30
|
/**
|
|
30
31
|
* Start the MCP server
|
|
@@ -49,6 +50,9 @@ export declare class MCPServer {
|
|
|
49
50
|
* Called lazily on tool calls that need the default project.
|
|
50
51
|
* Re-walks parent directories each time so it picks up projects
|
|
51
52
|
* initialized after the MCP server started.
|
|
53
|
+
*
|
|
54
|
+
* Awaits any in-flight background init (kicked off by handleInitialize) so
|
|
55
|
+
* we never open the SQLite file twice concurrently.
|
|
52
56
|
*/
|
|
53
57
|
private retryInitIfNeeded;
|
|
54
58
|
/**
|
package/dist/mcp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwCH;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAgB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwCH;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAgB;IAGnC,OAAO,CAAC,WAAW,CAA8B;gBAErC,WAAW,CAAC,EAAE,MAAM;IAOhC;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;;;;;;;;OASG;YACW,oBAAoB;IAsBlC;;;;;;;;OAQG;YACW,iBAAiB;IA6B/B;;;OAGG;IACH,OAAO,CAAC,aAAa;IAqBrB;;OAEG;IACH,IAAI,IAAI,IAAI;IAYZ;;OAEG;YACW,aAAa;IA6C3B;;OAEG;YACW,gBAAgB;IAiD9B;;OAEG;YACW,eAAe;IAO7B;;OAEG;YACW,eAAe;CAqC9B;AAGD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -96,6 +96,9 @@ class MCPServer {
|
|
|
96
96
|
cg = null;
|
|
97
97
|
toolHandler;
|
|
98
98
|
projectPath;
|
|
99
|
+
// In-flight background init kicked off from handleInitialize. Tracked so the
|
|
100
|
+
// sync retry path doesn't race against it (double-opening the SQLite file).
|
|
101
|
+
initPromise = null;
|
|
99
102
|
constructor(projectPath) {
|
|
100
103
|
this.projectPath = projectPath || null;
|
|
101
104
|
this.transport = new transport_1.StdioTransport();
|
|
@@ -154,8 +157,18 @@ class MCPServer {
|
|
|
154
157
|
* Called lazily on tool calls that need the default project.
|
|
155
158
|
* Re-walks parent directories each time so it picks up projects
|
|
156
159
|
* initialized after the MCP server started.
|
|
160
|
+
*
|
|
161
|
+
* Awaits any in-flight background init (kicked off by handleInitialize) so
|
|
162
|
+
* we never open the SQLite file twice concurrently.
|
|
157
163
|
*/
|
|
158
|
-
retryInitIfNeeded() {
|
|
164
|
+
async retryInitIfNeeded() {
|
|
165
|
+
// Wait for the background init started during handleInitialize, if any.
|
|
166
|
+
if (this.initPromise) {
|
|
167
|
+
try {
|
|
168
|
+
await this.initPromise;
|
|
169
|
+
}
|
|
170
|
+
catch { /* errored init falls through to retry */ }
|
|
171
|
+
}
|
|
159
172
|
// Already initialized successfully
|
|
160
173
|
if (this.toolHandler.hasDefaultCodeGraph())
|
|
161
174
|
return;
|
|
@@ -272,12 +285,17 @@ class MCPServer {
|
|
|
272
285
|
if (!projectPath) {
|
|
273
286
|
projectPath = process.cwd();
|
|
274
287
|
}
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
//
|
|
288
|
+
// Respond to the handshake BEFORE doing any heavy initialization. Loading
|
|
289
|
+
// the SQLite DB and the tree-sitter WASM runtime can take many seconds on
|
|
290
|
+
// slow filesystems (Docker Desktop VirtioFS on macOS, WSL2). Clients like
|
|
291
|
+
// Claude Code time out the handshake at ~30s, which manifested as
|
|
292
|
+
// "MCP tools never appear" — the child was alive and had received the
|
|
293
|
+
// initialize but was still awaiting initGrammars(). See issue #172.
|
|
294
|
+
//
|
|
295
|
+
// We accept the client's protocol version but respond with our supported
|
|
296
|
+
// version. The `instructions` field is surfaced by MCP clients in the
|
|
297
|
+
// agent's system prompt automatically — it's the right place for the
|
|
298
|
+
// universal tool-selection playbook, ahead of individual tool descriptions.
|
|
281
299
|
this.transport.sendResult(request.id, {
|
|
282
300
|
protocolVersion: PROTOCOL_VERSION,
|
|
283
301
|
capabilities: {
|
|
@@ -286,12 +304,19 @@ class MCPServer {
|
|
|
286
304
|
serverInfo: SERVER_INFO,
|
|
287
305
|
instructions: server_instructions_1.SERVER_INSTRUCTIONS,
|
|
288
306
|
});
|
|
307
|
+
// Kick off the default-project init in the background. Tool calls that
|
|
308
|
+
// arrive before it finishes will see the "not initialized yet" path and
|
|
309
|
+
// fall through to `retryInitIfNeeded`, which now waits for this promise
|
|
310
|
+
// rather than racing against it with a second open.
|
|
311
|
+
this.initPromise = this.tryInitializeDefault(projectPath).finally(() => {
|
|
312
|
+
this.initPromise = null;
|
|
313
|
+
});
|
|
289
314
|
}
|
|
290
315
|
/**
|
|
291
316
|
* Handle tools/list request
|
|
292
317
|
*/
|
|
293
318
|
async handleToolsList(request) {
|
|
294
|
-
this.retryInitIfNeeded();
|
|
319
|
+
await this.retryInitIfNeeded();
|
|
295
320
|
this.transport.sendResult(request.id, {
|
|
296
321
|
tools: this.toolHandler.getTools(),
|
|
297
322
|
});
|
|
@@ -315,7 +340,7 @@ class MCPServer {
|
|
|
315
340
|
}
|
|
316
341
|
// If the default project isn't initialized yet, retry in case it was
|
|
317
342
|
// initialized after the MCP server started (e.g. user ran codegraph init)
|
|
318
|
-
this.retryInitIfNeeded();
|
|
343
|
+
await this.retryInitIfNeeded();
|
|
319
344
|
const result = await this.toolHandler.execute(toolName, toolArgs);
|
|
320
345
|
this.transport.sendResult(request.id, result);
|
|
321
346
|
}
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -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,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,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;QACjC,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC;;;;;GAKG;AACH,MAAa,SAAS;IACZ,SAAS,CAAiB;IAC1B,E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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;AAzSD,8BAySC;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## Tool selection by intent\n\n- **\"What is the symbol named X?\"** \u2192 `codegraph_search
|
|
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## Tool selection by intent\n\n- **\"How does X work? / trace X end to end / explain the Y system / architecture?\"** \u2192 `codegraph_explore` (PRIMARY for understanding \u2014 seed it with the key symbol names, read its output, don't grep+Read your way there)\n- **\"What is the symbol named X? / where is X defined?\"** \u2192 `codegraph_search` (pinpoint lookups)\n- **\"What's the deal with this task / feature / area?\"** \u2192 `codegraph_context` (lighter composed view of search + node + callers + callees)\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- **\"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- **Understanding / onboarding**: feed `codegraph_explore` the key symbol/file names and read its output (line-numbered source from many files in one call). If the question names nothing concrete, do ONE quick `codegraph_search` / `codegraph_context` to surface the names, then explore with them. Fill remaining gaps with `codegraph_node` / Read \u2014 don't drop back to grep+Read for the whole topic.\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 search-then-Read your way through an understanding question** \u2014 feed the names you find into `codegraph_explore` instead of Reading the files one by one; it does that whole loop in one call and returns line numbers you can cite directly.\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 reach for `codegraph_explore` on a pinpoint \"where is X defined\" lookup** \u2014 `codegraph_search` is one cheap call.\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,07FAqC/B,CAAC"}
|
|
@@ -27,27 +27,27 @@ editing code, not during.
|
|
|
27
27
|
|
|
28
28
|
## Tool selection by intent
|
|
29
29
|
|
|
30
|
-
- **"
|
|
31
|
-
- **"What
|
|
30
|
+
- **"How does X work? / trace X end to end / explain the Y system / architecture?"** → \`codegraph_explore\` (PRIMARY for understanding — seed it with the key symbol names, read its output, don't grep+Read your way there)
|
|
31
|
+
- **"What is the symbol named X? / where is X defined?"** → \`codegraph_search\` (pinpoint lookups)
|
|
32
|
+
- **"What's the deal with this task / feature / area?"** → \`codegraph_context\` (lighter composed view of search + node + callers + callees)
|
|
32
33
|
- **"What calls this?"** → \`codegraph_callers\`
|
|
33
34
|
- **"What does this call?"** → \`codegraph_callees\`
|
|
34
35
|
- **"What would changing this break?"** → \`codegraph_impact\`
|
|
35
36
|
- **"Show me this symbol's source / signature / docstring."** → \`codegraph_node\`
|
|
36
|
-
- **"Survey an unfamiliar topic / pattern / module."** → \`codegraph_explore\` (heavier; deep dive)
|
|
37
37
|
- **"What's in directory X?"** → \`codegraph_files\`
|
|
38
38
|
- **"Is the index ready / what's its size?"** → \`codegraph_status\`
|
|
39
39
|
|
|
40
40
|
## Common chains
|
|
41
41
|
|
|
42
|
-
- **
|
|
42
|
+
- **Understanding / onboarding**: feed \`codegraph_explore\` the key symbol/file names and read its output (line-numbered source from many files in one call). If the question names nothing concrete, do ONE quick \`codegraph_search\` / \`codegraph_context\` to surface the names, then explore with them. Fill remaining gaps with \`codegraph_node\` / Read — don't drop back to grep+Read for the whole topic.
|
|
43
43
|
- **Refactor planning**: \`codegraph_search\` → \`codegraph_callers\` → \`codegraph_impact\`. The blast-radius answer comes from impact, not from walking callers manually.
|
|
44
44
|
- **Debugging a regression**: \`codegraph_callers\` of the suspected symbol; widen with \`codegraph_impact\` if an unexpected call appears.
|
|
45
45
|
|
|
46
46
|
## Anti-patterns
|
|
47
47
|
|
|
48
|
+
- **Don't search-then-Read your way through an understanding question** — feed the names you find into \`codegraph_explore\` instead of Reading the files one by one; it does that whole loop in one call and returns line numbers you can cite directly.
|
|
48
49
|
- **Don't grep first** when looking up a symbol by name — \`codegraph_search\` is faster and returns kind + location + signature.
|
|
49
|
-
- **Don't
|
|
50
|
-
- **Don't use \`codegraph_explore\` for narrow questions** — it's a multi-call deep dive, expensive in tokens. Save it for genuine "I'm new here" surveys.
|
|
50
|
+
- **Don't reach for \`codegraph_explore\` on a pinpoint "where is X defined" lookup** — \`codegraph_search\` is one cheap call.
|
|
51
51
|
- **Don't query the index immediately after editing a file** — the watcher needs ~500ms to debounce + sync. Wait for the next turn.
|
|
52
52
|
|
|
53
53
|
## Limitations
|
package/dist/mcp/tools.d.ts
CHANGED
|
@@ -10,6 +10,47 @@ import CodeGraph from '../index';
|
|
|
10
10
|
* but smaller ones should use fewer to avoid unnecessary overhead.
|
|
11
11
|
*/
|
|
12
12
|
export declare function getExploreBudget(fileCount: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Adaptive output budget for `codegraph_explore`, scaled to project size.
|
|
15
|
+
*
|
|
16
|
+
* Smaller codebases get a tighter total cap, fewer default files, smaller
|
|
17
|
+
* per-file cap, and tighter clustering — so a focused query on a 100-file
|
|
18
|
+
* project doesn't dump a whole file's worth of source into the agent's
|
|
19
|
+
* context. Larger codebases keep the generous defaults because the
|
|
20
|
+
* agent's native discovery cost (grep + find + many Reads) genuinely
|
|
21
|
+
* dwarfs a fat explore call at that scale.
|
|
22
|
+
*
|
|
23
|
+
* Meta-text (relationships map, "additional relevant files" list,
|
|
24
|
+
* completeness signal, budget note) is gated off for tiny projects
|
|
25
|
+
* where one rich call is the whole story and the extra prose is just
|
|
26
|
+
* overhead.
|
|
27
|
+
*
|
|
28
|
+
* Tier breakpoints mirror `getExploreBudget` so a project sits in the
|
|
29
|
+
* same tier across both knobs.
|
|
30
|
+
*/
|
|
31
|
+
export interface ExploreOutputBudget {
|
|
32
|
+
/** Hard cap on total output characters. */
|
|
33
|
+
maxOutputChars: number;
|
|
34
|
+
/** Default `maxFiles` when the caller didn't specify one. */
|
|
35
|
+
defaultMaxFiles: number;
|
|
36
|
+
/** Cap on contiguous source returned per file (across all its clusters). */
|
|
37
|
+
maxCharsPerFile: number;
|
|
38
|
+
/** Cluster gap threshold in lines — tighter clustering on small projects. */
|
|
39
|
+
gapThreshold: number;
|
|
40
|
+
/** Max symbols listed in the per-file header (`#### path — sym(kind), ...`). */
|
|
41
|
+
maxSymbolsInFileHeader: number;
|
|
42
|
+
/** Max edges shown per relationship kind in the Relationships section. */
|
|
43
|
+
maxEdgesPerRelationshipKind: number;
|
|
44
|
+
/** Include the "Relationships" section. */
|
|
45
|
+
includeRelationships: boolean;
|
|
46
|
+
/** Include the "Additional relevant files (not shown)" trailing list. */
|
|
47
|
+
includeAdditionalFiles: boolean;
|
|
48
|
+
/** Include the "Complete source code is included above…" reminder. */
|
|
49
|
+
includeCompletenessSignal: boolean;
|
|
50
|
+
/** Include the explore-budget reminder at the end. */
|
|
51
|
+
includeBudgetNote: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function getExploreOutputBudget(fileCount: number): ExploreOutputBudget;
|
|
13
54
|
/**
|
|
14
55
|
* MCP Tool definition
|
|
15
56
|
*/
|
|
@@ -117,14 +158,16 @@ export declare class ToolHandler {
|
|
|
117
158
|
* Handle codegraph_impact
|
|
118
159
|
*/
|
|
119
160
|
private handleImpact;
|
|
120
|
-
/** Maximum output for explore tool — sized to stay under MCP client token limits (~10k tokens) */
|
|
121
|
-
private static readonly EXPLORE_MAX_OUTPUT;
|
|
122
161
|
/**
|
|
123
162
|
* Handle codegraph_explore — deep exploration in a single call
|
|
124
163
|
*
|
|
125
164
|
* Strategy: find relevant symbols via graph traversal, group by file,
|
|
126
165
|
* then read contiguous file sections covering all symbols per file.
|
|
127
166
|
* This replaces multiple codegraph_node + Read calls.
|
|
167
|
+
*
|
|
168
|
+
* Output size is adaptive to project file count via
|
|
169
|
+
* `getExploreOutputBudget` — see #185 for why a fixed 35k cap was a
|
|
170
|
+
* tax on small projects while earning its keep on large ones.
|
|
128
171
|
*/
|
|
129
172
|
private handleExplore;
|
|
130
173
|
/**
|
|
@@ -160,9 +203,22 @@ export declare class ToolHandler {
|
|
|
160
203
|
* Returns the best match and a note about alternatives if any.
|
|
161
204
|
*/
|
|
162
205
|
/**
|
|
163
|
-
* Check if a node matches a symbol query
|
|
164
|
-
*
|
|
165
|
-
*
|
|
206
|
+
* Check if a node matches a symbol query.
|
|
207
|
+
*
|
|
208
|
+
* Accepts simple names (`run`) and three flavors of qualifier:
|
|
209
|
+
* - dotted `Session.request` (TS/JS/Python)
|
|
210
|
+
* - colon-pair `stage_apply::run` (Rust, C++, Ruby)
|
|
211
|
+
* - slash `configurator/stage_apply` (path-ish)
|
|
212
|
+
*
|
|
213
|
+
* Multi-level qualifiers compose: `crate::configurator::stage_apply::run`
|
|
214
|
+
* works. Rust path prefixes (`crate`, `super`, `self`) are stripped so
|
|
215
|
+
* the canonical `crate::module::symbol` form resolves.
|
|
216
|
+
*
|
|
217
|
+
* Resolution order, last part must always equal `node.name`:
|
|
218
|
+
* 1. Suffix-match against `qualifiedName` (handles class-scoped methods
|
|
219
|
+
* where the extractor builds the qualified name from the AST stack)
|
|
220
|
+
* 2. File-path containment (handles file-derived modules in Rust/
|
|
221
|
+
* Python — `stage_apply::run` matches a `run` in `stage_apply.rs`)
|
|
166
222
|
*/
|
|
167
223
|
private matchesSymbol;
|
|
168
224
|
private findSymbol;
|
package/dist/mcp/tools.d.ts.map
CHANGED
|
@@ -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;AA2B/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;IACtE,yBAAyB,EAAE,OAAO,CAAC;IACnC,sDA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