@colbymchenry/codegraph-darwin-x64 1.0.1 → 1.1.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/lib/dist/bin/codegraph.js +111 -11
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/db/index.d.ts +22 -1
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +46 -1
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/queries.d.ts +14 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +25 -0
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/directory.d.ts +43 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +121 -0
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +11 -3
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +14 -5
- 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 +161 -34
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +47 -2
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +20 -0
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +22 -0
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/java.d.ts.map +1 -1
- package/lib/dist/extraction/languages/java.js +213 -9
- package/lib/dist/extraction/languages/java.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +51 -0
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
- package/lib/dist/extraction/languages/scala.js +19 -9
- package/lib/dist/extraction/languages/scala.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +4 -1
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +13 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +119 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +890 -11
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/index.d.ts +33 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +68 -7
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +33 -67
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +3 -3
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +4 -4
- package/lib/dist/installer/targets/claude.d.ts +18 -12
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +78 -6
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +12 -2
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +13 -12
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +7 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +8 -0
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +18 -14
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +57 -52
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +23 -18
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +51 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +585 -151
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +19 -0
- package/lib/dist/project-config.d.ts.map +1 -0
- package/lib/dist/project-config.js +180 -0
- package/lib/dist/project-config.js.map +1 -0
- package/lib/dist/reasoning/config.d.ts +45 -0
- package/lib/dist/reasoning/config.d.ts.map +1 -0
- package/lib/dist/reasoning/config.js +171 -0
- package/lib/dist/reasoning/config.js.map +1 -0
- package/lib/dist/reasoning/credentials.d.ts +5 -0
- package/lib/dist/reasoning/credentials.d.ts.map +1 -0
- package/lib/dist/reasoning/credentials.js +83 -0
- package/lib/dist/reasoning/credentials.js.map +1 -0
- package/lib/dist/reasoning/login.d.ts +21 -0
- package/lib/dist/reasoning/login.d.ts.map +1 -0
- package/lib/dist/reasoning/login.js +85 -0
- package/lib/dist/reasoning/login.js.map +1 -0
- package/lib/dist/reasoning/reasoner.d.ts +43 -0
- package/lib/dist/reasoning/reasoner.d.ts.map +1 -0
- package/lib/dist/reasoning/reasoner.js +308 -0
- package/lib/dist/reasoning/reasoner.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +33 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.js +352 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +6 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1109 -1
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/lib/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/goframe.js +112 -0
- package/lib/dist/resolution/frameworks/goframe.js.map +1 -0
- 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/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +17 -60
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts +28 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.js +158 -0
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +48 -8
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +1 -1
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +2 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +68 -1
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +212 -14
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts +0 -3
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +4 -7
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +40 -4
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/utils.d.ts +14 -1
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +20 -2
- package/lib/dist/utils.js.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Server-level instructions emitted in the MCP `initialize` response.
|
|
6
6
|
*
|
|
@@ -10,13 +10,15 @@ exports.SERVER_INSTRUCTIONS_UNINDEXED = exports.SERVER_INSTRUCTIONS = void 0;
|
|
|
10
10
|
* before it sees individual tool descriptions.
|
|
11
11
|
*
|
|
12
12
|
* Goals when editing this:
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* - Anti-patterns (don't grep
|
|
13
|
+
* - Lead the agent to codegraph_explore for any structural/flow question
|
|
14
|
+
* - Reinforce "explore instead of Read/Grep" for indexed code
|
|
15
|
+
* - Anti-patterns (don't re-verify with grep; don't hand-reconstruct flows)
|
|
16
16
|
*
|
|
17
17
|
* Keep it tight. The agent reads this every session — long instructions
|
|
18
|
-
* burn tokens.
|
|
19
|
-
*
|
|
18
|
+
* burn tokens. The DEFAULT MCP surface is `codegraph_explore` ALONE (see
|
|
19
|
+
* DEFAULT_MCP_TOOLS in tools.ts) — reference only that tool here. The other
|
|
20
|
+
* tools (node/search/callers/…) stay defined and are re-enablable via
|
|
21
|
+
* CODEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
|
|
20
22
|
*/
|
|
21
23
|
exports.SERVER_INSTRUCTIONS = `# Codegraph — code intelligence over an indexed knowledge graph
|
|
22
24
|
|
|
@@ -30,46 +32,37 @@ verbatim source PLUS who calls it and what it affects, so you edit with the
|
|
|
30
32
|
blast radius in view. More accurate context, in far fewer tokens and
|
|
31
33
|
round-trips than reading files yourself.
|
|
32
34
|
|
|
33
|
-
##
|
|
35
|
+
## One tool: codegraph_explore — use it instead of reading files
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
delegating the lookup to a separate file-reading sub-task/agent, or
|
|
43
|
-
running your own grep + read loop, repeats work codegraph already did and
|
|
44
|
-
costs more for the same answer. Reach for raw Read/Grep only to confirm a
|
|
45
|
-
specific detail codegraph didn't cover. A direct codegraph answer is
|
|
46
|
-
typically one to a few calls; a grep/read exploration is dozens.
|
|
37
|
+
There is a single tool, \`codegraph_explore\`, and it is Read-equivalent. It
|
|
38
|
+
takes either a natural-language question or a bag of symbol/file names and
|
|
39
|
+
returns the **verbatim, line-numbered source** of the relevant symbols
|
|
40
|
+
grouped by file — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to
|
|
41
|
+
\`Edit\` from — PLUS the call path among them (including dynamic-dispatch hops
|
|
42
|
+
like callbacks, React re-render, and JSX children that grep can't follow) and
|
|
43
|
+
a blast-radius summary of what depends on them.
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
Whether you're answering "how does X work" or implementing a change (fixing a
|
|
46
|
+
bug, adding a feature), call \`codegraph_explore\` before you Read. ONE call
|
|
47
|
+
usually answers the whole question. Codegraph IS the pre-built search index —
|
|
48
|
+
so running your own grep + read loop, or delegating the lookup to a separate
|
|
49
|
+
file-reading sub-task/agent, repeats work codegraph already did and costs more
|
|
50
|
+
for the same answer. A direct codegraph answer is typically one to a few
|
|
51
|
+
calls; a grep/read exploration is dozens.
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
- **"How does X reach/become Y? / the flow / the path from X to Y"** → \`codegraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, including dynamic-dispatch hops (callbacks, React re-render, JSX children) grep can't follow
|
|
52
|
-
- **"What is the symbol named X?" (just its location)** → \`codegraph_search\`
|
|
53
|
-
- **"What calls this?" / "What would changing this break?"** → \`codegraph_callers\` — EVERY call site with file:line, including where a function is **registered as a callback** (passed as an argument, assigned to a function pointer/field, listed in a handler table) — labeled "via callback registration" — so a function with no direct calls is NOT dead if it's wired up somewhere. When several UNRELATED symbols share a name (one \`UserService\` per monorepo app), it reports **one section per definition** (never a merged list) — pass \`file\` to focus the definition you mean. The wider blast radius arrives automatically on \`codegraph_explore\` (its "Blast radius" section) and \`codegraph_node\` (the dependents note)
|
|
54
|
-
- **"What does this call?"** → \`codegraph_node\` with that symbol and \`includeCode: true\` — the body IS the callee list, and the caller/callee trail comes with it
|
|
55
|
-
- **Reading a source FILE (any time you'd use the \`Read\` tool)** → \`codegraph_node\` with a \`file\` path and no \`symbol\`. It returns the file's **current source with line numbers — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to \`Edit\` from** — narrowable with \`offset\`/\`limit\` exactly like \`Read\`, PLUS a one-line note of which files depend on it. Same bytes as \`Read\`, faster (served from the index), with the blast radius attached. Use it **instead of \`Read\`** for indexed source files; fall back to \`Read\` only for what codegraph doesn't index (configs, docs). Pass \`symbolsOnly: true\` for just the file's structure.
|
|
56
|
-
- **About to read or edit a symbol you can name** → \`codegraph_node\` with that \`symbol\` (SECONDARY — the after-explore depth tool): the verbatim source (\`includeCode: true\`) PLUS its caller/callee trail, so before changing it you see what calls it and what your edit would break. For an OVERLOADED name it returns EVERY matching definition's body in one call, so you never Read a file to find the right overload
|
|
53
|
+
## How to query
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- **
|
|
61
|
-
- **
|
|
62
|
-
- **Refactor planning**: \`codegraph_callers\` for the complete call-site list to update; the wider blast radius is already attached to \`codegraph_explore\` / \`codegraph_node\` output.
|
|
63
|
-
- **Debugging a regression**: \`codegraph_callers\` of the suspected symbol; \`codegraph_node\` on anything unexpected that appears.
|
|
55
|
+
- **Almost any question — "how does X work", architecture, a bug, "what/where is X", or surveying an area** → \`codegraph_explore\` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.
|
|
56
|
+
- **"How does X reach/become Y? / the flow / the path from X to Y"** → \`codegraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.
|
|
57
|
+
- **Reading or editing a file/symbol you can name** → put its name or file path in the \`codegraph_explore\` query — it returns that current line-numbered source (safe to \`Edit\` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.
|
|
58
|
+
- **Need more?** Call \`codegraph_explore\` again with more specific names — treat the source it returns as already Read.
|
|
64
59
|
|
|
65
60
|
## Anti-patterns
|
|
66
61
|
|
|
67
62
|
- **Trust codegraph's results — don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.
|
|
68
|
-
- **Don't grep first**
|
|
69
|
-
- **Don't
|
|
70
|
-
- **
|
|
71
|
-
- **Don't reach for the \`Read\` tool on an indexed source file** — \`codegraph_node\` with a \`file\` reads it for you (same \`<n>\\t<line>\` source, \`offset\`/\`limit\` like Read, faster, with its blast radius), and with a \`symbol\` it returns the source plus the caller/callee trail. Reach for raw \`Read\` only for what codegraph doesn't index (configs, docs) or when the staleness banner flags a file as pending re-index.
|
|
72
|
-
- **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index — Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph.
|
|
63
|
+
- **Don't grep or Read first** to find or understand indexed code — ONE \`codegraph_explore\` returns the relevant symbols' source together in a single round-trip. Reach for raw \`Read\`/\`Grep\` only to confirm a specific detail codegraph didn't cover, or for what codegraph doesn't index (configs, docs).
|
|
64
|
+
- **Don't reconstruct a flow by hand** — name the endpoints in one \`codegraph_explore\` and it surfaces the path between them, dynamic-dispatch hops included.
|
|
65
|
+
- **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index — Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner — "⚠️ CodeGraph auto-sync is DISABLED…" — means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.
|
|
73
66
|
|
|
74
67
|
## Limitations
|
|
75
68
|
|
|
@@ -79,23 +72,35 @@ typically one to a few calls; a grep/read exploration is dozens.
|
|
|
79
72
|
- No live correctness validation — that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.
|
|
80
73
|
`;
|
|
81
74
|
/**
|
|
82
|
-
* Instructions variant sent when the
|
|
75
|
+
* Instructions variant sent when the server's own root has NO codegraph index.
|
|
83
76
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
77
|
+
* The tools are still exposed (gating tool availability on whether `./` has an
|
|
78
|
+
* index is the bug behind #964: it breaks monorepos where only sub-projects are
|
|
79
|
+
* indexed, and a server that started before `codegraph init` never surfaces the
|
|
80
|
+
* tools afterward). Instead of an "inactive" note, this variant tells the agent
|
|
81
|
+
* codegraph works **per project**: there's no default project to query, so pass
|
|
82
|
+
* a `projectPath` to any project that HAS a `.codegraph/`. The full single-
|
|
83
|
+
* project playbook ({@link SERVER_INSTRUCTIONS}) is sent instead when the root
|
|
84
|
+
* IS indexed, so the common case stays tight.
|
|
90
85
|
*/
|
|
91
|
-
exports.
|
|
86
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# Codegraph — available (per-project; pass projectPath)
|
|
87
|
+
|
|
88
|
+
Codegraph is a SQLite knowledge graph of a codebase's symbols, edges, and
|
|
89
|
+
files: one \`codegraph_explore\` call returns the verbatim, line-numbered source
|
|
90
|
+
of the relevant symbols PLUS the call paths between them and a blast-radius
|
|
91
|
+
summary — replacing a grep + Read loop with one round-trip.
|
|
92
92
|
|
|
93
|
-
This
|
|
94
|
-
|
|
95
|
-
usual.
|
|
93
|
+
This server started somewhere with no \`.codegraph/\` of its own, so there is no
|
|
94
|
+
default project — but the tools are available and work **per project**:
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
- To query a project that HAS a \`.codegraph/\` index (e.g. a service inside a
|
|
97
|
+
monorepo, or a second repo), pass its path as \`projectPath\` to
|
|
98
|
+
\`codegraph_explore\` (and any other codegraph tool). Codegraph resolves the
|
|
99
|
+
nearest \`.codegraph/\` at or above that path and answers from it — for as many
|
|
100
|
+
projects as you like in one session.
|
|
101
|
+
- For a project with no \`.codegraph/\`, use your built-in tools (Read/Grep/Glob)
|
|
102
|
+
for that project. Indexing is the user's decision — don't run it yourself, but
|
|
103
|
+
if it comes up they can run \`codegraph init\` in a project to enable codegraph
|
|
104
|
+
there (a new index is picked up live, no restart).
|
|
100
105
|
`;
|
|
101
106
|
//# sourceMappingURL=server-instructions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDlC,CAAC;AAEF;;;;;;;;;;;GAWG;AACU,QAAA,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;CAmBhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAuC,gBAAgB,EAAc,MAAM,aAAa,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAOrC;;;GAGG;AAGH,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAmC7C,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mB,CAAgB;gBAGjC,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,SAAS,EACzB,IAAI,GAAE,iBAAsB;IAK9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAIZ,kEAAkE;IAClE,YAAY,IAAI,gBAAgB;YAIlB,aAAa;YA0Cb,gBAAgB;YA0DhB,eAAe;YAkBf,eAAe;IAiC7B;;;;;;;OAOG;YACW,iBAAiB;IAyB/B;;;OAGG;YACW,aAAa;CAgB5B"}
|
package/lib/dist/mcp/session.js
CHANGED
|
@@ -203,23 +203,24 @@ class MCPSession {
|
|
|
203
203
|
else if (this.explicitProjectPath) {
|
|
204
204
|
explicitPath = this.explicitProjectPath;
|
|
205
205
|
}
|
|
206
|
-
// Pick the instructions variant by the
|
|
206
|
+
// Pick the instructions variant by the root's index state — a cheap
|
|
207
207
|
// synchronous walk-up (existsSync loop only, no DB open, so the #172
|
|
208
|
-
// respond-fast contract holds).
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
208
|
+
// respond-fast contract holds). When the root IS indexed, send the full
|
|
209
|
+
// single-project playbook. When it ISN'T, send the per-project variant
|
|
210
|
+
// (tools are still exposed — see handleToolsList): it tells the agent there
|
|
211
|
+
// is no default project and to pass `projectPath` to any project that has a
|
|
212
|
+
// `.codegraph/`. Gating tool AVAILABILITY on whether `./` is indexed was the
|
|
213
|
+
// #964 bug — it broke monorepos (only sub-projects indexed) and never
|
|
214
|
+
// surfaced the tools after a mid-session `codegraph init`. When no explicit
|
|
215
|
+
// path is known yet (roots/list dance pending), cwd is the best predictor of
|
|
216
|
+
// where the default project will resolve.
|
|
216
217
|
const indexed = (0, directory_1.findNearestCodeGraphRoot)(explicitPath ?? process.cwd()) !== null;
|
|
217
218
|
// Respond to the handshake BEFORE doing any heavy init — see issue #172.
|
|
218
219
|
this.transport.sendResult(request.id, {
|
|
219
220
|
protocolVersion: exports.PROTOCOL_VERSION,
|
|
220
221
|
capabilities: { tools: {} },
|
|
221
222
|
serverInfo: exports.SERVER_INFO,
|
|
222
|
-
instructions: indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.
|
|
223
|
+
instructions: indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.SERVER_INSTRUCTIONS_NO_ROOT_INDEX,
|
|
223
224
|
});
|
|
224
225
|
if (explicitPath) {
|
|
225
226
|
// Kick off engine init in the background. If another session in the
|
|
@@ -230,15 +231,19 @@ class MCPSession {
|
|
|
230
231
|
}
|
|
231
232
|
async handleToolsList(request) {
|
|
232
233
|
await this.retryInitIfNeeded();
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
//
|
|
234
|
+
// Always expose the tools — even when the server root has no index. Gating
|
|
235
|
+
// availability on whether `./` is indexed (the old behavior) breaks the
|
|
236
|
+
// monorepo case where only sub-projects carry a `.codegraph/` (the agent
|
|
237
|
+
// saw zero tools and couldn't even reach an indexed sub-project by
|
|
238
|
+
// `projectPath`), and it hides the tools from a session that started before
|
|
239
|
+
// the user ran `codegraph init` (most hosts request the list once, so the
|
|
240
|
+
// freshly-built index never surfaces). #964. The not-indexed case is still
|
|
241
|
+
// safe: a call against an un-indexed path returns SUCCESS-shaped guidance
|
|
242
|
+
// ("pass projectPath / run codegraph init"), never `isError`, so it can't
|
|
243
|
+
// teach the agent to abandon codegraph. `getTools()` returns the default
|
|
244
|
+
// surface even before a project is open.
|
|
240
245
|
this.transport.sendResult(request.id, {
|
|
241
|
-
tools: this.engine.
|
|
246
|
+
tools: this.engine.getToolHandler().getTools(),
|
|
242
247
|
});
|
|
243
248
|
}
|
|
244
249
|
async handleToolsCall(request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2CAAgG;AAEhG,mCAAgC;AAChC,+
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2CAAgG;AAEhG,mCAAgC;AAChC,+DAA+F;AAC/F,uCAAoD;AACpD,4CAAwD;AACxD,4CAAwD;AAExD;;;GAGG;AACH,2EAA2E;AAC3E,4EAA4E;AAC/D,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,iCAAuB;CACjC,CAAC;AAEF,uDAAuD;AAC1C,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;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,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,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,SAAS,aAAa,CAAC,MAAe;IACpC,IAAI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,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8CAA8C,GAAG,mCAAmC,CAAC,CAAC;QAC7G,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AAjPD,gCAiPC"}
|
package/lib/dist/mcp/tools.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface ExploreOutputBudget {
|
|
|
57
57
|
maxCharsPerFile: number;
|
|
58
58
|
/** Cluster gap threshold in lines — tighter clustering on small projects. */
|
|
59
59
|
gapThreshold: number;
|
|
60
|
-
/** Max symbols listed in the per-file header (
|
|
60
|
+
/** Max symbols listed in the per-file header (``**`path`** — sym(kind), ...``). */
|
|
61
61
|
maxSymbolsInFileHeader: number;
|
|
62
62
|
/** Max edges shown per relationship kind in the Relationships section. */
|
|
63
63
|
maxEdgesPerRelationshipKind: number;
|
|
@@ -93,6 +93,15 @@ export declare function formatStaleBanner(stale: PendingFile[]): string;
|
|
|
93
93
|
* without bloating the main banner.
|
|
94
94
|
*/
|
|
95
95
|
export declare function formatStaleFooter(stale: PendingFile[]): string;
|
|
96
|
+
/**
|
|
97
|
+
* Whole-index degradation banner (issue #876). Emitted at the top of a read
|
|
98
|
+
* tool response when live watching has permanently stopped — at which point
|
|
99
|
+
* `getPendingFiles()` is empty, so the per-file banner above can't fire even
|
|
100
|
+
* though the index is now FROZEN and silently drifting stale. Leads with the
|
|
101
|
+
* agent-actionable instruction (Read directly) and carries the reason, which
|
|
102
|
+
* already names the operator remedy (`codegraph sync` / git hooks).
|
|
103
|
+
*/
|
|
104
|
+
export declare function formatDegradedBanner(reason: string | null): string;
|
|
96
105
|
/**
|
|
97
106
|
* MCP Tool definition
|
|
98
107
|
*/
|
|
@@ -163,6 +172,16 @@ export declare class ToolHandler {
|
|
|
163
172
|
* stale data, which is what would have happened without the gate.
|
|
164
173
|
*/
|
|
165
174
|
setCatchUpGate(p: Promise<void> | null): void;
|
|
175
|
+
/**
|
|
176
|
+
* Await the catch-up gate, but no longer than the configured timeout (#905).
|
|
177
|
+
* If the reconcile settles first, we got the fully-reconciled answer. If the
|
|
178
|
+
* timeout wins, we serve the call now and let the reconcile finish in the
|
|
179
|
+
* background — it yields to the event loop (see SYNC_RECONCILE_YIELD_INTERVAL),
|
|
180
|
+
* so a concurrent read still runs against the same connection. Never throws:
|
|
181
|
+
* a failed reconcile is logged by the engine, and we serve best-effort over
|
|
182
|
+
* the same potentially-stale data the un-gated path would have.
|
|
183
|
+
*/
|
|
184
|
+
private awaitCatchUpGate;
|
|
166
185
|
/**
|
|
167
186
|
* Record the directory the server tried to resolve the default project from.
|
|
168
187
|
* Used only to make the "no default project" error actionable.
|
|
@@ -200,6 +219,17 @@ export declare class ToolHandler {
|
|
|
200
219
|
* similar to how git finds .git/ directories.
|
|
201
220
|
*/
|
|
202
221
|
private getCodeGraph;
|
|
222
|
+
/**
|
|
223
|
+
* Heal a long-lived connection whose `.codegraph/` was removed and recreated
|
|
224
|
+
* at the same path (a worktree recreated, or `rm -rf .codegraph` + re-init)
|
|
225
|
+
* before handing it to a tool. Otherwise the daemon keeps serving the
|
|
226
|
+
* pre-removal snapshot from its now-unlinked file handle until restart — and
|
|
227
|
+
* because the daemon registry is keyed by path, a same-path recreate routes
|
|
228
|
+
* new clients straight back to this same stale daemon (#925). The check is one
|
|
229
|
+
* stat() and a no-op unless the inode actually changed; it never throws into a
|
|
230
|
+
* tool call.
|
|
231
|
+
*/
|
|
232
|
+
private freshen;
|
|
203
233
|
/**
|
|
204
234
|
* Close all cached project connections
|
|
205
235
|
*/
|
|
@@ -316,6 +346,26 @@ export declare class ToolHandler {
|
|
|
316
346
|
* connected flow never reaches this method.
|
|
317
347
|
*/
|
|
318
348
|
private buildDynamicBoundaries;
|
|
349
|
+
/**
|
|
350
|
+
* Interface/registry-dispatch announcement — #687 extended to GRAPH-visible
|
|
351
|
+
* polymorphism (the body-scan can't see it: `nodeType.execute()` is textually
|
|
352
|
+
* an ordinary call; the polymorphism lives in the `implements`/`extends` edges).
|
|
353
|
+
*
|
|
354
|
+
* A method the agent named that resolves to a large same-name family whose
|
|
355
|
+
* definers overwhelmingly implement/extend ONE supertype is a runtime dispatch:
|
|
356
|
+
* the concrete target is chosen at runtime from N implementations, so no single
|
|
357
|
+
* static edge is "the answer" — the implementations ARE the continuations. We
|
|
358
|
+
* announce the supertype, its TRUE implementer count, and a few concrete targets,
|
|
359
|
+
* then steer to codegraph_explore. Graph-only, query-time, zero mutation; the
|
|
360
|
+
* caller fires it ONLY for an UNCOVERED named token, so a connected flow is silent.
|
|
361
|
+
*
|
|
362
|
+
* Robust to FTS sampling bias: the same-name family is a capped FTS sample that
|
|
363
|
+
* over-represents whatever FTS ranks first (n8n: DB `TableOperation.execute`
|
|
364
|
+
* outnumbered `INodeType.execute` in the sample 7:6 even though INodeType has
|
|
365
|
+
* 611 implementers vs a handful). So candidate supertypes are ranked by their
|
|
366
|
+
* TRUE graph-wide implementer count, NOT their frequency in the sample.
|
|
367
|
+
*/
|
|
368
|
+
private buildPolymorphicBoundaries;
|
|
319
369
|
/**
|
|
320
370
|
* Shortlist candidate runtime targets for a dispatch key surfaced by
|
|
321
371
|
* {@link buildDynamicBoundaries}. Exact conventional names first (`save` →
|
|
@@ -1 +1 @@
|
|
|
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;AAW3C;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;GAGG;AACH,qBA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