@colbymchenry/codegraph-darwin-x64 0.9.7 → 0.9.9
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.js +19 -56
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/context/index.d.ts +9 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +95 -6
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/context/markers.d.ts +19 -0
- package/lib/dist/context/markers.d.ts.map +1 -0
- package/lib/dist/context/markers.js +22 -0
- package/lib/dist/context/markers.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +10 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +13 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +17 -2
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +26 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +140 -20
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/index.d.ts +9 -2
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +17 -2
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +3 -2
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +12 -38
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/index.d.ts +7 -4
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +46 -39
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +35 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +223 -0
- package/lib/dist/mcp/proxy.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 +18 -19
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +10 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +7 -5
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +49 -52
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +922 -908
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +2 -2
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +239 -2
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/search/query-utils.d.ts +18 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +30 -0
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/types.d.ts +8 -0
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/lib/dist/mcp/tools.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Defines the tools exposed by the CodeGraph MCP server.
|
|
5
5
|
*/
|
|
6
|
-
import CodeGraph from '../index';
|
|
6
|
+
import type CodeGraph from '../index';
|
|
7
7
|
import type { PendingFile } from '../sync';
|
|
8
8
|
/**
|
|
9
9
|
* Calculate the recommended number of codegraph_explore calls based on project size.
|
|
@@ -105,12 +105,20 @@ export interface ToolResult {
|
|
|
105
105
|
/**
|
|
106
106
|
* All CodeGraph MCP tools
|
|
107
107
|
*
|
|
108
|
-
* Designed for minimal context usage - use
|
|
109
|
-
* and only use other tools for
|
|
108
|
+
* Designed for minimal context usage - use codegraph_explore as the primary tool
|
|
109
|
+
* (one call usually answers the whole question), and only use other tools for
|
|
110
|
+
* targeted follow-up queries.
|
|
110
111
|
*
|
|
111
112
|
* All tools support cross-project queries via the optional `projectPath` parameter.
|
|
112
113
|
*/
|
|
113
114
|
export declare const tools: ToolDefinition[];
|
|
115
|
+
/**
|
|
116
|
+
* Allowlist-filtered tool definitions WITHOUT an engine — the static surface the
|
|
117
|
+
* proxy answers `tools/list` with before any project is open. Mirrors
|
|
118
|
+
* `ToolHandler.getTools()` in the no-CodeGraph case (the dynamic per-repo budget
|
|
119
|
+
* note in a description only adds once `cg` is loaded; the schemas are static).
|
|
120
|
+
*/
|
|
121
|
+
export declare function getStaticTools(): ToolDefinition[];
|
|
114
122
|
/**
|
|
115
123
|
* Tool handler that executes tools against a CodeGraph instance
|
|
116
124
|
*
|
|
@@ -151,7 +159,7 @@ export declare class ToolHandler {
|
|
|
151
159
|
* Unset/empty → every tool is exposed. Lets an operator (or an A/B harness)
|
|
152
160
|
* trim the tool surface without rebuilding the client config; the ablated
|
|
153
161
|
* tool is then truly absent from ListTools rather than merely denied on call.
|
|
154
|
-
* Matching is on the short form, so "
|
|
162
|
+
* Matching is on the short form, so "node" and "codegraph_node" both work.
|
|
155
163
|
*/
|
|
156
164
|
private toolAllowlist;
|
|
157
165
|
/** Whether a tool name passes the CODEGRAPH_MCP_TOOLS allowlist (if any). */
|
|
@@ -233,27 +241,6 @@ export declare class ToolHandler {
|
|
|
233
241
|
* Handle codegraph_search
|
|
234
242
|
*/
|
|
235
243
|
private handleSearch;
|
|
236
|
-
/**
|
|
237
|
-
* Handle codegraph_context
|
|
238
|
-
*/
|
|
239
|
-
private handleContext;
|
|
240
|
-
/**
|
|
241
|
-
* Detect a flow-style task ("how does X reach Y", "trace the path from A to B")
|
|
242
|
-
* and pre-run trace between the most likely endpoints, returning the trace
|
|
243
|
-
* body to splice into the context response. Returns '' for non-flow queries
|
|
244
|
-
* or when no plausible endpoint pair can be extracted.
|
|
245
|
-
*
|
|
246
|
-
* Conservative by design: only fires when the task has both a clear flow
|
|
247
|
-
* keyword AND at least two distinct PascalCase / camelCase identifiers.
|
|
248
|
-
* False positives waste a graph query; false negatives just fall back to
|
|
249
|
-
* the agent calling trace itself (existing path-proximity wiring handles
|
|
250
|
-
* disambiguation either way).
|
|
251
|
-
*/
|
|
252
|
-
private maybeInlineFlowTrace;
|
|
253
|
-
/**
|
|
254
|
-
* Heuristic to detect if a query looks like a feature request
|
|
255
|
-
*/
|
|
256
|
-
private looksLikeFeatureRequest;
|
|
257
244
|
/**
|
|
258
245
|
* Handle codegraph_callers
|
|
259
246
|
*/
|
|
@@ -266,18 +253,6 @@ export declare class ToolHandler {
|
|
|
266
253
|
* Handle codegraph_impact
|
|
267
254
|
*/
|
|
268
255
|
private handleImpact;
|
|
269
|
-
/**
|
|
270
|
-
* Handle codegraph_trace — shortest CALL PATH between two symbols.
|
|
271
|
-
*
|
|
272
|
-
* Exposes GraphTraverser.findPath: the chain of functions from `from` to `to`,
|
|
273
|
-
* each hop annotated with file:line and the call-site line. This is the
|
|
274
|
-
* capability grep/Read structurally cannot provide. When no static path
|
|
275
|
-
* exists, the chain has almost certainly broken at dynamic dispatch
|
|
276
|
-
* (callbacks, descriptors, metaclasses) — we say so and surface the start
|
|
277
|
-
* symbol's outgoing calls so the agent bridges the one missing hop with
|
|
278
|
-
* codegraph_node rather than blindly reading.
|
|
279
|
-
*/
|
|
280
|
-
private handleTrace;
|
|
281
256
|
/**
|
|
282
257
|
* Describe a synthesized (dynamic-dispatch) edge for human output: how the
|
|
283
258
|
* callback was wired up — the bridge static parsing can't see. Returns null
|
|
@@ -285,19 +260,6 @@ export declare class ToolHandler {
|
|
|
285
260
|
* hop reads as "registered via onUpdate at App.tsx:3148", not a bare arrow.
|
|
286
261
|
*/
|
|
287
262
|
private synthEdgeNote;
|
|
288
|
-
/**
|
|
289
|
-
* Read one trimmed source line at "relpath:line" (relative to the project
|
|
290
|
-
* root). `cache` holds split file contents so a multi-hop trace reads each
|
|
291
|
-
* file at most once. Returns null if the file/line can't be resolved.
|
|
292
|
-
*/
|
|
293
|
-
private sourceLineAt;
|
|
294
|
-
/**
|
|
295
|
-
* Read a hop's body — filePath lines [startLine..endLine] — for inlining into
|
|
296
|
-
* a trace, capped (lines + chars) so the whole path stays path-scoped even on
|
|
297
|
-
* a 7-hop chain. Dedents to the body's own indentation and marks truncation.
|
|
298
|
-
* Shares `cache` with sourceLineAt so each file is read at most once per trace.
|
|
299
|
-
*/
|
|
300
|
-
private sourceRangeAt;
|
|
301
263
|
/**
|
|
302
264
|
* Flow-from-named-symbols: an agent's codegraph_explore query is a bag of
|
|
303
265
|
* symbol names that usually spans the flow it's investigating (e.g.
|
|
@@ -313,6 +275,32 @@ export declare class ToolHandler {
|
|
|
313
275
|
* dropping unrelated `OmsOrderService::list`.
|
|
314
276
|
*/
|
|
315
277
|
private buildFlowFromNamedSymbols;
|
|
278
|
+
/**
|
|
279
|
+
* Compact "blast radius" for the entry symbols of an explore result: who
|
|
280
|
+
* depends on each (callers) and which test files cover it — LOCATIONS ONLY,
|
|
281
|
+
* no source, so the agent knows what to update / re-verify before editing
|
|
282
|
+
* without reaching for a separate impact call. Always-on, but skips symbols
|
|
283
|
+
* that have no dependents (nothing to warn about), and returns '' when none
|
|
284
|
+
* qualify so a leaf-only exploration stays clean.
|
|
285
|
+
*/
|
|
286
|
+
private buildBlastRadiusSection;
|
|
287
|
+
/**
|
|
288
|
+
* Graph-connectivity relevance via Random-Walk-with-Restart (personalized
|
|
289
|
+
* PageRank) from the query's matched SEED nodes over the call/reference graph.
|
|
290
|
+
*
|
|
291
|
+
* This is the ranking signal text search (FTS/bm25) CANNOT provide, and it's
|
|
292
|
+
* codegraph's home turf: relevance by STRUCTURE, not words. A file whose
|
|
293
|
+
* symbols are call-connected to the matched cluster accrues walk mass and
|
|
294
|
+
* ranks high; a lone TEXT match — e.g. `LensSwitcher.swift` matched the word
|
|
295
|
+
* "switch" from `switchOrganization`, but calls none of `setUser`/`fetchUser`
|
|
296
|
+
* — gets only its own restart probability and ranks ~0. Immune to the
|
|
297
|
+
* tokenization trap that fools term matching, deterministic, no embeddings.
|
|
298
|
+
*
|
|
299
|
+
* Undirected adjacency (reachability both ways), restart α=0.25 to the seeds,
|
|
300
|
+
* power iteration to convergence. Bounded to the already-relevant subgraph, so
|
|
301
|
+
* it's a few hundred nodes × ~25 iterations — negligible cost.
|
|
302
|
+
*/
|
|
303
|
+
private computeGraphRelevance;
|
|
316
304
|
/**
|
|
317
305
|
* Handle codegraph_explore — deep exploration in a single call
|
|
318
306
|
*
|
|
@@ -329,6 +317,8 @@ export declare class ToolHandler {
|
|
|
329
317
|
* Handle codegraph_node
|
|
330
318
|
*/
|
|
331
319
|
private handleNode;
|
|
320
|
+
/** Render one symbol: details + (optional) body/outline + its caller/callee trail. */
|
|
321
|
+
private renderNodeSection;
|
|
332
322
|
/**
|
|
333
323
|
* Build the "trail" for a symbol: its direct callees (what it calls) and
|
|
334
324
|
* callers (what calls it), each with file:line — so codegraph_node doubles as
|
|
@@ -386,7 +376,15 @@ export declare class ToolHandler {
|
|
|
386
376
|
* Python — `stage_apply::run` matches a `run` in `stage_apply.rs`)
|
|
387
377
|
*/
|
|
388
378
|
private matchesSymbol;
|
|
389
|
-
|
|
379
|
+
/**
|
|
380
|
+
* Find ALL definitions matching a name, ranked, so codegraph_node can return
|
|
381
|
+
* every overload instead of guessing one (the wrong guess → a Read). Keepers
|
|
382
|
+
* rank before generated stubs (.pb.go etc.); stable within a group preserves
|
|
383
|
+
* FTS order. Returns [] when nothing matches; a qualified lookup that finds no
|
|
384
|
+
* exact match returns [] rather than a misleading fuzzy file hit (#173); a
|
|
385
|
+
* bare name with no exact match falls back to the single top fuzzy result.
|
|
386
|
+
*/
|
|
387
|
+
private findSymbolMatches;
|
|
390
388
|
/**
|
|
391
389
|
* Find ALL symbols matching a name. Used by callers/callees/impact to aggregate
|
|
392
390
|
* results across all matching symbols (e.g., multiple classes with an `execute` method).
|
|
@@ -408,7 +406,6 @@ export declare class ToolHandler {
|
|
|
408
406
|
*/
|
|
409
407
|
private buildContainerOutline;
|
|
410
408
|
private formatNodeDetails;
|
|
411
|
-
private formatTaskContext;
|
|
412
409
|
private textResult;
|
|
413
410
|
private errorResult;
|
|
414
411
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,SAAS,MAAM,UAAU,CAAC;AAetC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAuD3C;;;;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,sDAAsD;IACtD,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AA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