@aroman22/codegraph-vba-darwin-arm64 1.15.0 → 1.17.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 +13 -7
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/daemon-release.d.ts +7 -0
- package/lib/dist/bin/daemon-release.d.ts.map +1 -0
- package/lib/dist/bin/daemon-release.js +18 -0
- package/lib/dist/bin/daemon-release.js.map +1 -0
- package/lib/dist/db/queries.d.ts +41 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +78 -1
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/access-erd-extractor.d.ts +57 -0
- package/lib/dist/extraction/access-erd-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/access-erd-extractor.js +389 -0
- package/lib/dist/extraction/access-erd-extractor.js.map +1 -0
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/grammars.d.ts +20 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +34 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +1 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +371 -351
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +8 -3
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +1 -2
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +7 -6
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/sql-query-extractor.d.ts +16 -14
- package/lib/dist/extraction/sql-query-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/sql-query-extractor.js +43 -31
- package/lib/dist/extraction/sql-query-extractor.js.map +1 -1
- package/lib/dist/extraction/sql-table-scan.d.ts +184 -0
- package/lib/dist/extraction/sql-table-scan.d.ts.map +1 -0
- package/lib/dist/extraction/sql-table-scan.js +288 -0
- package/lib/dist/extraction/sql-table-scan.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts +10 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +34 -3
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +2 -7
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.js +144 -90
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -1
- package/lib/dist/extraction/vba/calls.d.ts +24 -4
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/calls.js +42 -12
- package/lib/dist/extraction/vba/calls.js.map +1 -1
- package/lib/dist/extraction/vba/constants.d.ts +7 -14
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -1
- package/lib/dist/extraction/vba/constants.js +8 -36
- package/lib/dist/extraction/vba/constants.js.map +1 -1
- package/lib/dist/extraction/vba/context.d.ts +443 -7
- package/lib/dist/extraction/vba/context.d.ts.map +1 -1
- package/lib/dist/extraction/vba/context.js +325 -29
- package/lib/dist/extraction/vba/context.js.map +1 -1
- package/lib/dist/extraction/vba/controls.d.ts +18 -1
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/controls.js +99 -27
- package/lib/dist/extraction/vba/controls.js.map +1 -1
- package/lib/dist/extraction/vba/declarations.d.ts +1 -6
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -1
- package/lib/dist/extraction/vba/declarations.js +5 -39
- package/lib/dist/extraction/vba/declarations.js.map +1 -1
- package/lib/dist/extraction/vba/dims.d.ts +11 -7
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -1
- package/lib/dist/extraction/vba/dims.js +265 -29
- package/lib/dist/extraction/vba/dims.js.map +1 -1
- package/lib/dist/extraction/vba/docmd.d.ts +29 -2
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -1
- package/lib/dist/extraction/vba/docmd.js +297 -18
- package/lib/dist/extraction/vba/docmd.js.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.d.ts +7 -14
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.js +11 -45
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -1
- package/lib/dist/extraction/vba/error-channel.d.ts +57 -0
- package/lib/dist/extraction/vba/error-channel.d.ts.map +1 -0
- package/lib/dist/extraction/vba/error-channel.js +128 -0
- package/lib/dist/extraction/vba/error-channel.js.map +1 -0
- package/lib/dist/extraction/vba/errors.d.ts +64 -0
- package/lib/dist/extraction/vba/errors.d.ts.map +1 -0
- package/lib/dist/extraction/vba/errors.js +775 -0
- package/lib/dist/extraction/vba/errors.js.map +1 -0
- package/lib/dist/extraction/vba/filesystem-statements.d.ts +23 -0
- package/lib/dist/extraction/vba/filesystem-statements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/filesystem-statements.js +70 -0
- package/lib/dist/extraction/vba/filesystem-statements.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +1 -6
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -1
- package/lib/dist/extraction/vba/implements.js +1 -22
- package/lib/dist/extraction/vba/implements.js.map +1 -1
- package/lib/dist/extraction/vba/labels.d.ts +26 -0
- package/lib/dist/extraction/vba/labels.d.ts.map +1 -0
- package/lib/dist/extraction/vba/labels.js +180 -0
- package/lib/dist/extraction/vba/labels.js.map +1 -0
- package/lib/dist/extraction/vba/module-vars.d.ts +36 -0
- package/lib/dist/extraction/vba/module-vars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/module-vars.js +145 -0
- package/lib/dist/extraction/vba/module-vars.js.map +1 -0
- package/lib/dist/extraction/vba/options.d.ts +88 -0
- package/lib/dist/extraction/vba/options.d.ts.map +1 -0
- package/lib/dist/extraction/vba/options.js +39 -0
- package/lib/dist/extraction/vba/options.js.map +1 -0
- package/lib/dist/extraction/vba/parameters.d.ts +35 -0
- package/lib/dist/extraction/vba/parameters.d.ts.map +1 -0
- package/lib/dist/extraction/vba/parameters.js +110 -0
- package/lib/dist/extraction/vba/parameters.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +1 -9
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -1
- package/lib/dist/extraction/vba/procedures.js +174 -112
- package/lib/dist/extraction/vba/procedures.js.map +1 -1
- package/lib/dist/extraction/vba/rules.d.ts +10 -5
- package/lib/dist/extraction/vba/rules.d.ts.map +1 -1
- package/lib/dist/extraction/vba/rules.js +19 -0
- package/lib/dist/extraction/vba/rules.js.map +1 -1
- package/lib/dist/extraction/vba/runtime-objects.d.ts +59 -0
- package/lib/dist/extraction/vba/runtime-objects.d.ts.map +1 -0
- package/lib/dist/extraction/vba/runtime-objects.js +106 -0
- package/lib/dist/extraction/vba/runtime-objects.js.map +1 -0
- package/lib/dist/extraction/vba/signature.d.ts +57 -0
- package/lib/dist/extraction/vba/signature.d.ts.map +1 -0
- package/lib/dist/extraction/vba/signature.js +164 -0
- package/lib/dist/extraction/vba/signature.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +76 -3
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -1
- package/lib/dist/extraction/vba/sql-wrapper.js +725 -151
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -1
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -1
- package/lib/dist/extraction/vba/tempvars.js +4 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -1
- package/lib/dist/extraction/vba/text-utils.d.ts +62 -2
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -1
- package/lib/dist/extraction/vba/text-utils.js +84 -6
- package/lib/dist/extraction/vba/text-utils.js.map +1 -1
- package/lib/dist/extraction/vba-extractor.d.ts +18 -1
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +111 -16
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.d.ts +28 -14
- package/lib/dist/extraction/vba-form-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.js +56 -21
- package/lib/dist/extraction/vba-form-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +89 -3
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +221 -57
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/vba-source.d.ts +0 -10
- package/lib/dist/extraction/vba-source.d.ts.map +1 -1
- package/lib/dist/extraction/vba-source.js +0 -13
- package/lib/dist/extraction/vba-source.js.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts +0 -6
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.js +0 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.js.map +1 -1
- package/lib/dist/graph/behavior-evidence.d.ts +162 -0
- package/lib/dist/graph/behavior-evidence.d.ts.map +1 -0
- package/lib/dist/graph/behavior-evidence.js +529 -0
- package/lib/dist/graph/behavior-evidence.js.map +1 -0
- package/lib/dist/index.d.ts +22 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +37 -1
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +7 -3
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +6 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +15 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +82 -7
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +557 -45
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.d.ts +12 -0
- package/lib/dist/mcp/daemon-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.js +37 -7
- package/lib/dist/mcp/daemon-watchdog.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +20 -1
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +123 -30
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +13 -2
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +32 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +163 -31
- 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 +26 -4
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +12 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +92 -1
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +43 -2
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +86 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +47 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +160 -5
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +25 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +59 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.d.ts +11 -11
- package/lib/dist/resolution/vba-runtime-objects.d.ts.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.js +18 -38
- package/lib/dist/resolution/vba-runtime-objects.js.map +1 -1
- package/lib/dist/types.d.ts +13 -5
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +17 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/utils/backtrace-helpers.d.ts +14 -2
- package/lib/dist/utils/backtrace-helpers.d.ts.map +1 -1
- package/lib/dist/utils/backtrace-helpers.js +81 -7
- package/lib/dist/utils/backtrace-helpers.js.map +1 -1
- package/lib/dist/utils/sql-impact-helpers.d.ts.map +1 -1
- package/lib/dist/utils/sql-impact-helpers.js +119 -30
- package/lib/dist/utils/sql-impact-helpers.js.map +1 -1
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +3 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* tools (node/search/callers/…) stay defined and are re-enablable via
|
|
18
18
|
* CODEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
|
|
19
19
|
*/
|
|
20
|
-
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 in\nthe workspace \u2014 pre-computed structure you would otherwise re-derive by\nreading files (cached intelligence: thousands of parse/trace decisions you\ndon't pay to re-reason each run). Reads are sub-millisecond; the index lags\nwrites by ~1s through the file watcher. Reach for it BEFORE *and* while\nwriting or editing code \u2014 not just for questions: one call returns the\nverbatim source PLUS who calls it and what it affects, so you edit with the\nblast radius in view. More accurate context, in far fewer tokens and\nround-trips than reading files yourself.\n\n## One tool: codegraph_explore \u2014 use it instead of reading files\n\nThere is a single tool, `codegraph_explore`, and it is Read-equivalent. It\ntakes either a natural-language question or a bag of symbol/file names and\nreturns the **verbatim, line-numbered source** of the relevant symbols\ngrouped by file \u2014 the same `<n>\\t<line>` shape `Read` gives you, safe to\n`Edit` from \u2014 PLUS the call path among them (including dynamic-dispatch hops\nlike callbacks, React re-render, and JSX children that grep can't follow) and\na blast-radius summary of what depends on them.\n\nWhether you're answering \"how does X work\" or implementing a change (fixing a\nbug, adding a feature), call `codegraph_explore` before you Read. ONE call\nusually answers the whole question. Codegraph IS the pre-built search index \u2014\nso running your own grep + read loop, or delegating the lookup to a separate\nfile-reading sub-task/agent, repeats work codegraph already did and costs more\nfor the same answer. A direct codegraph answer is typically one to a few\ncalls; a grep/read exploration is dozens.\n\n## How to query\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `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.\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.\n- **Reading or editing a file/symbol you can name** \u2192 put its name or file path in the `codegraph_explore` query \u2014 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.\n- **Need more?** Call `codegraph_explore` again with more specific names \u2014 treat the source it returns as already Read.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 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.\n- **Don't grep or Read first** to find or understand indexed code \u2014 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).\n- **Don't reconstruct a flow by hand** \u2014 name the endpoints in one `codegraph_explore` and it surfaces the path between them, dynamic-dispatch hops included.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner \u2014 \"\u26A0\uFE0F CodeGraph auto-sync is DISABLED\u2026\" \u2014 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.\n\n## Limitations\n\n- If a tool reports a project isn't indexed (no `.codegraph/`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision \u2014 mention they can run `codegraph init` if it comes up, but don't run it yourself.\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\n## Supported Languages\n\nThe indexer recognizes a fixed set of languages; if you ask about symbols in a\nfile with an unsupported extension, codegraph will report the project isn't\nindexed for that file and you should fall back to Read/Grep. The fork-specific\naddition beyond upstream codegraph is **VBA / Access** (Dysflow export\nformat):\n\n- **VBA / Access** - Dysflow exports Access/VBA source as `.bas`/`.cls`/\n `.form.txt`/`.report.txt`. Codegraph extracts `.bas`/`.cls` as `module`/\n `class`/`function` nodes with `calls`/`implements`/`references` edges\n (procedural-level; regex-based, not full AST). Cross-module calls, qualified\n `Dim As`, `WithEvents`, and SQL table references inside string literals\n emit synthesized edges tagged `metadata.synthesizedBy` (`vba-name-resolution`,\n `vba-withevents`, `vba-sql-table`). `.form.txt` and `.report.txt` are\n extracted as a `module` plus one `property` per Access control - **no**\n `function`/`sub`/`class` nodes come from form files; the canonical code\n lives in the sibling `.cls`, parsed by the same extractor on that file.\n Dysflow test manifests (`tests.*.json`) link each registered `Test_*`\n procedure to its manifest with a `references` edge tagged\n `vba-test-manifest` carrying the test name + tags, so `getCallers` of a\n production symbol reaches its covering test atoms with the manifest and tags\n to run.\n Pass `projectPath` to a codegraph index that includes VBA files.\n- **VBA unresolved refs carry syntactic shape** (v1.7+). `unresolved_refs.reference_kind` is no longer the literal string `\"references\"` \u2014 it reports what the syntactic shape actually was. Values: `call` (paren-form or statement-form call site), `qualified-call` (`obj.Foo(...)` with runtime receiver), `property-get` / `property-set` (`Me.Name`, `obj.Prop = value`), `bang-get` / `bang-set` (`Me!SubCtl`, `obj!Field = value`), `unqualified-ident` (bare identifier like `HayErrorEnRiesgo` in an `If` condition), `member-with` (`.Member` inside a `With` block), `dao-query` (`DoCmd.OpenQuery \"X\"` argument). The legacy value `references` is retained on any path the round did not reclassify, so older SQL filters that key on it keep working. To find real missing callees, filter `WHERE reference_kind IN ('call','qualified-call','unqualified-ident','member-with','bang-get')` \u2014 that set has <10% false positives (DAO-field accesses, form-property reads, and bang refs no longer pollute the bucket).\n- **Post-extraction stub resolver** (v1.7+). Edges with `metadata.synthesizedBy='vba-name-resolution'` start life pointing at a synthetic function node; the resolver at `src/resolution/index.ts:resolveVbaCallStubs` (invoked from `indexAll` and `sync`) walks them and repoints each `target` to the real `nodes.id` when one exists. Runtime-object calls (`DAO.*`, `fso.*`, `ListBox.*`, `Collection.*`, `err.*`, `VBA.*`, `Application.*`, `Screen.*`, `DoCmd.*`, `CurrentDb.*`, `Forms`, `Reports`, `Debug`, `Modules`, `References`, `CommandBars`, `SysCmd`, `CreateObject`, `GetObject`, `Fields`) are explicitly declined \u2014 they remain `stub:true` because they can never link to user code. Shadow user classes (e.g. a user class actually named `DAO` with an `Execute` method) are preserved and linked normally. Every stub edge carries `metadata.repointDecision` with one of `reponted-to-real` (linked to a real `nodes.id`), `declined-runtime` (runtime object \u2014 never user code, filter OUT), `declined-ambiguous` (multiple real candidates \u2014 investigate), or `declined-not-found` (genuinely missing callee \u2014 this is the actionable signal). Consumers detecting \"missing callees\" MUST filter on `repointDecision='declined-not-found'`, NOT on the raw `stub=true` count \u2014 the raw count is dominated by runtime-object noise. See `docs/vba-stub-repoint-decision.md` for the full contract.\n";
|
|
20
|
+
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 in\nthe workspace \u2014 pre-computed structure you would otherwise re-derive by\nreading files (cached intelligence: thousands of parse/trace decisions you\ndon't pay to re-reason each run). Reads are sub-millisecond; the index lags\nwrites by ~1s through the file watcher. Reach for it BEFORE *and* while\nwriting or editing code \u2014 not just for questions: one call returns the\nverbatim source PLUS who calls it and what it affects, so you edit with the\nblast radius in view. More accurate context, in far fewer tokens and\nround-trips than reading files yourself.\n\n## One tool: codegraph_explore \u2014 use it instead of reading files\n\nThere is a single tool, `codegraph_explore`, and it is Read-equivalent. It\ntakes either a natural-language question or a bag of symbol/file names and\nreturns the **verbatim, line-numbered source** of the relevant symbols\ngrouped by file \u2014 the same `<n>\\t<line>` shape `Read` gives you, safe to\n`Edit` from \u2014 PLUS the call path among them (including dynamic-dispatch hops\nlike callbacks, React re-render, and JSX children that grep can't follow) and\na blast-radius summary of what depends on them.\n\nWhether you're answering \"how does X work\" or implementing a change (fixing a\nbug, adding a feature), call `codegraph_explore` before you Read. ONE call\nusually answers the whole question. Codegraph IS the pre-built search index \u2014\nso running your own grep + read loop, or delegating the lookup to a separate\nfile-reading sub-task/agent, repeats work codegraph already did and costs more\nfor the same answer. A direct codegraph answer is typically one to a few\ncalls; a grep/read exploration is dozens.\n\n## How to query\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `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.\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.\n- **Reading or editing a file/symbol you can name** \u2192 put its name or file path in the `codegraph_explore` query \u2014 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.\n- **Need more?** Call `codegraph_explore` again with more specific names \u2014 treat the source it returns as already Read.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 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.\n- **Don't grep or Read first** to find or understand indexed code \u2014 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).\n- **Don't reconstruct a flow by hand** \u2014 name the endpoints in one `codegraph_explore` and it surfaces the path between them, dynamic-dispatch hops included.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner \u2014 \"\u26A0\uFE0F CodeGraph auto-sync is DISABLED\u2026\" \u2014 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.\n\n## Limitations\n\n- If a tool reports a project isn't indexed (no `.codegraph/`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision \u2014 mention they can run `codegraph init` if it comes up, but don't run it yourself.\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\n## Supported Languages\n\nThe indexer recognizes a fixed set of languages; if you ask about symbols in a\nfile with an unsupported extension, codegraph will report the project isn't\nindexed for that file and you should fall back to Read/Grep. The fork-specific\naddition beyond upstream codegraph is **VBA / Access** (Dysflow export\nformat):\n\n- **VBA / Access** - Dysflow exports Access/VBA source as `.bas`/`.cls`/\n `.form.txt`/`.report.txt`. Codegraph extracts `.bas`/`.cls` as `module`/\n `class`/`function` nodes with `calls`/`implements`/`references` edges\n (procedural-level; regex-based, not full AST). Cross-module calls, qualified\n `Dim As`, `WithEvents`, and SQL table references inside string literals\n emit synthesized edges tagged `metadata.synthesizedBy` (`vba-name-resolution`,\n `vba-withevents`, `vba-sql-table`). A `.form.txt` / `.report.txt` emits a\n `form-layout` / `report-layout` container, one\n `form-instance-control` per named control, a `property` node per control\n type, and a placeholder node per table/query it binds - but **no\n procedures**: no `function`/`sub` node, and no class node for the form's\n own code, comes from a layout file. The canonical code lives in the sibling\n `.cls`, parsed by the same extractor on that file.\n- **Access event wiring has ONE direction: handler -> control/layout.** The\n `event-handler` edge is stored from the handler procedure to the\n `form-instance-control` it is named for (`btnSave_Click` -> `btnSave`), or\n to the sibling layout node for a form/report lifecycle event\n (`Form_Load` -> `Form_Orders`, carrying `metadata.scope: 'form'`). An\n `=Expression()` event property resolves to the same direction, tagged\n `vba-expression-handler`. There is no reverse edge: to answer \"what runs on\n this control\", follow the edge BACKWARDS from the control. Scope every\n control lookup by its layout - the same control name usually exists on\n several forms, and a layout owns its controls through `contains`.\n- **A VBA call is not always a `calls` edge.** `Call Foo` and `Foo 1, 2` are\n `calls`; a bare `Foo` on its own line could also be a `Const` read, so it\n stays an ambiguous identifier and resolves to a `references` edge onto the\n procedure. That bare form is the dominant call style in Access code-behind,\n so a trace that follows only `calls` stops at the handler.\n- **Codegraph indexes the exported source tree, not the live `.accdb`.** It is\n static evidence: it never proves a handler ran, and it says nothing about\n whether the binary matches the export (Dysflow owns that round-trip). A\n missing edge is missing evidence, not proof of no runtime effect.\n Dysflow test manifests (`tests.*.json`) link each registered `Test_*`\n procedure to its manifest with a `references` edge tagged\n `vba-test-manifest` carrying the test name + tags, so `getCallers` of a\n production symbol reaches its covering test atoms with the manifest and tags\n to run.\n Pass `projectPath` to a codegraph index that includes VBA files.\n- **VBA unresolved refs carry syntactic shape** (v1.7+). `unresolved_refs.reference_kind` is no longer the literal string `\"references\"` \u2014 it reports what the syntactic shape actually was. Values: `call` (paren-form or statement-form call site), `qualified-call` (`obj.Foo(...)` with runtime receiver), `property-get` / `property-set` (`Me.Name`, `obj.Prop = value`), `bang-get` / `bang-set` (`Me!SubCtl`, `obj!Field = value`), `unqualified-ident` (bare identifier like `HayErrorEnRiesgo` in an `If` condition), `member-with` (`.Member` inside a `With` block), `dao-query` (`DoCmd.OpenQuery \"X\"` argument). The legacy value `references` is retained on any path the round did not reclassify, so older SQL filters that key on it keep working. To find real missing callees, filter `WHERE reference_kind IN ('call','qualified-call','unqualified-ident','member-with','bang-get')` \u2014 that set has <10% false positives (DAO-field accesses, form-property reads, and bang refs no longer pollute the bucket).\n- **Post-extraction stub resolver** (v1.7+). Edges with `metadata.synthesizedBy='vba-name-resolution'` start life pointing at a synthetic function node; the resolver at `src/resolution/index.ts:resolveVbaCallStubs` (invoked from `indexAll` and `sync`) walks them and repoints each `target` to the real `nodes.id` when one exists. Runtime-object calls (`DAO.*`, `fso.*`, `ListBox.*`, `Collection.*`, `err.*`, `VBA.*`, `Application.*`, `Screen.*`, `DoCmd.*`, `CurrentDb.*`, `Forms`, `Reports`, `Debug`, `Modules`, `References`, `CommandBars`, `SysCmd`, `CreateObject`, `GetObject`, `Fields`) are explicitly declined \u2014 they remain `stub:true` because they can never link to user code. Shadow user classes (e.g. a user class actually named `DAO` with an `Execute` method) are preserved and linked normally. Every stub edge carries `metadata.repointDecision` with one of `reponted-to-real` (linked to a real `nodes.id`), `declined-runtime` (runtime object \u2014 never user code, filter OUT), `declined-ambiguous` (multiple real candidates \u2014 investigate), or `declined-not-found` (genuinely missing callee \u2014 this is the actionable signal). Consumers detecting \"missing callees\" MUST filter on `repointDecision='declined-not-found'`, NOT on the raw `stub=true` count \u2014 the raw count is dominated by runtime-object noise. See `docs/vba-stub-repoint-decision.md` for the full contract.\n";
|
|
21
21
|
/**
|
|
22
22
|
* Instructions variant sent when the server's own root has NO codegraph index.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,0iUAmG/B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,4pCAmB7C,CAAC"}
|
|
@@ -85,10 +85,32 @@ format):
|
|
|
85
85
|
(procedural-level; regex-based, not full AST). Cross-module calls, qualified
|
|
86
86
|
\`Dim As\`, \`WithEvents\`, and SQL table references inside string literals
|
|
87
87
|
emit synthesized edges tagged \`metadata.synthesizedBy\` (\`vba-name-resolution\`,
|
|
88
|
-
\`vba-withevents\`, \`vba-sql-table\`). \`.form.txt\`
|
|
89
|
-
|
|
90
|
-
\`
|
|
91
|
-
|
|
88
|
+
\`vba-withevents\`, \`vba-sql-table\`). A \`.form.txt\` / \`.report.txt\` emits a
|
|
89
|
+
\`form-layout\` / \`report-layout\` container, one
|
|
90
|
+
\`form-instance-control\` per named control, a \`property\` node per control
|
|
91
|
+
type, and a placeholder node per table/query it binds - but **no
|
|
92
|
+
procedures**: no \`function\`/\`sub\` node, and no class node for the form's
|
|
93
|
+
own code, comes from a layout file. The canonical code lives in the sibling
|
|
94
|
+
\`.cls\`, parsed by the same extractor on that file.
|
|
95
|
+
- **Access event wiring has ONE direction: handler -> control/layout.** The
|
|
96
|
+
\`event-handler\` edge is stored from the handler procedure to the
|
|
97
|
+
\`form-instance-control\` it is named for (\`btnSave_Click\` -> \`btnSave\`), or
|
|
98
|
+
to the sibling layout node for a form/report lifecycle event
|
|
99
|
+
(\`Form_Load\` -> \`Form_Orders\`, carrying \`metadata.scope: 'form'\`). An
|
|
100
|
+
\`=Expression()\` event property resolves to the same direction, tagged
|
|
101
|
+
\`vba-expression-handler\`. There is no reverse edge: to answer "what runs on
|
|
102
|
+
this control", follow the edge BACKWARDS from the control. Scope every
|
|
103
|
+
control lookup by its layout - the same control name usually exists on
|
|
104
|
+
several forms, and a layout owns its controls through \`contains\`.
|
|
105
|
+
- **A VBA call is not always a \`calls\` edge.** \`Call Foo\` and \`Foo 1, 2\` are
|
|
106
|
+
\`calls\`; a bare \`Foo\` on its own line could also be a \`Const\` read, so it
|
|
107
|
+
stays an ambiguous identifier and resolves to a \`references\` edge onto the
|
|
108
|
+
procedure. That bare form is the dominant call style in Access code-behind,
|
|
109
|
+
so a trace that follows only \`calls\` stops at the handler.
|
|
110
|
+
- **Codegraph indexes the exported source tree, not the live \`.accdb\`.** It is
|
|
111
|
+
static evidence: it never proves a handler ran, and it says nothing about
|
|
112
|
+
whether the binary matches the export (Dysflow owns that round-trip). A
|
|
113
|
+
missing edge is missing evidence, not proof of no runtime effect.
|
|
92
114
|
Dysflow test manifests (\`tests.*.json\`) link each registered \`Test_*\`
|
|
93
115
|
procedure to its manifest with a \`references\` edge tagged
|
|
94
116
|
\`vba-test-manifest\` carrying the test name + tags, so \`getCallers\` of a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGlC,CAAC;AAEF;;;;;;;;;;;GAWG;AACU,QAAA,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;CAmBhD,CAAC"}
|
package/lib/dist/mcp/tools.d.ts
CHANGED
|
@@ -382,6 +382,18 @@ export declare class ToolHandler {
|
|
|
382
382
|
* NotIndexed/PathRefusal, which {@link executeReadTool} classifies.
|
|
383
383
|
*/
|
|
384
384
|
private dispatchTool;
|
|
385
|
+
/**
|
|
386
|
+
* Access/VBA behavior evidence (issue #299) — a thin adapter over
|
|
387
|
+
* {@link CodeGraph.getBehaviorEvidence}. The assembly lives in
|
|
388
|
+
* `src/graph/behavior-evidence.ts`; this only validates argument shapes and
|
|
389
|
+
* serializes the typed result, so the MCP surface and a library consumer
|
|
390
|
+
* can never drift into two different answers.
|
|
391
|
+
*
|
|
392
|
+
* A request with no selector is NOT an error: the payload comes back with
|
|
393
|
+
* `MISSING_TARGET_SELECTOR` in `context.notes`, the same success-shaped
|
|
394
|
+
* guidance every other recoverable condition uses here.
|
|
395
|
+
*/
|
|
396
|
+
private handleBehaviorEvidence;
|
|
385
397
|
/** Run the CLI-only query command and preserve its JSON stdout verbatim. */
|
|
386
398
|
private handleQuery;
|
|
387
399
|
/**
|
|
@@ -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;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAe9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,SAAS,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAe9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAS3C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1C,gEAAgE;AAChE,eAAO,MAAM,UAAU;;CAAgB,CAAC;AAExC;;;;;;;;;;GAUG;AAC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O,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA4EvB;;;OAGG;IACH;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,aAAa;IAqCrB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA+CzB;;;OAGG;IACH,OAAO,CAAC,cAAc;IA0DtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,cAAc;IAgBtB;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,YAAY;IA4BpB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;CAMpB"}
|
package/lib/dist/mcp/tools.js
CHANGED
|
@@ -28,6 +28,7 @@ const utils_1 = require("../utils");
|
|
|
28
28
|
const generated_detection_1 = require("../extraction/generated-detection");
|
|
29
29
|
const dynamic_boundaries_1 = require("./dynamic-boundaries");
|
|
30
30
|
const update_check_1 = require("../upgrade/update-check");
|
|
31
|
+
const daemon_registry_1 = require("./daemon-registry");
|
|
31
32
|
/** Narrow subprocess seam for testing CLI-only MCP wrappers. */
|
|
32
33
|
exports.cliProcess = { spawnSync: child_process_1.spawnSync };
|
|
33
34
|
/**
|
|
@@ -403,6 +404,26 @@ const READ_ONLY_ANNOTATIONS = {
|
|
|
403
404
|
* All tools support cross-project queries via the optional `projectPath` parameter.
|
|
404
405
|
*/
|
|
405
406
|
exports.tools = [
|
|
407
|
+
{
|
|
408
|
+
name: 'codegraph_release',
|
|
409
|
+
description: 'Destructively release CodeGraph resources for one explicit project root before deleting that worktree. Disabled by default; enable with CODEGRAPH_MCP_TOOLS=explore,release. Release only the selected root, never all Node or CodeGraph processes. This tool does not remove the worktree.',
|
|
410
|
+
inputSchema: {
|
|
411
|
+
type: 'object',
|
|
412
|
+
properties: {
|
|
413
|
+
path: {
|
|
414
|
+
type: 'string',
|
|
415
|
+
description: 'Required worktree or project root to release. The path is canonicalized before daemon lookup.',
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
required: ['path'],
|
|
419
|
+
},
|
|
420
|
+
annotations: {
|
|
421
|
+
readOnlyHint: false,
|
|
422
|
+
destructiveHint: true,
|
|
423
|
+
idempotentHint: true,
|
|
424
|
+
openWorldHint: false,
|
|
425
|
+
},
|
|
426
|
+
},
|
|
406
427
|
{
|
|
407
428
|
name: 'codegraph_affected',
|
|
408
429
|
description: 'Map changed source files to affected tests via the codegraph CLI. Read-only and disabled unless explicitly enabled via CODEGRAPH_MCP_TOOLS.',
|
|
@@ -676,6 +697,40 @@ exports.tools = [
|
|
|
676
697
|
},
|
|
677
698
|
annotations: READ_ONLY_ANNOTATIONS,
|
|
678
699
|
},
|
|
700
|
+
{
|
|
701
|
+
name: 'codegraph_behavior_evidence',
|
|
702
|
+
description: 'ACCESS/VBA ONLY — what does this control actually DO? Returns a typed, bounded behavior payload for one Access control, form/report layout or handler: the event binding, the call paths under it, and the tables and effects those procedures reach, assembled from indexed facts in one read. Identify the target by `nodeId` when you have one; a `name` needs `layout` as soon as it is not unique — an ambiguous name is REFUSED with the candidates listed, never narrowed to an arbitrary match. The answer is static evidence from exported source: an empty tables/effects list means the index holds no such fact, NOT that the code has no runtime effect — what could not be answered is reported in `context.unresolved` and `context.truncated`. For a human-readable trace use codegraph_explore instead.',
|
|
703
|
+
inputSchema: {
|
|
704
|
+
type: 'object',
|
|
705
|
+
properties: {
|
|
706
|
+
nodeId: {
|
|
707
|
+
type: 'string',
|
|
708
|
+
description: 'Stable node id of the control, layout or handler. The unambiguous form — prefer it whenever a previous call gave you one.',
|
|
709
|
+
},
|
|
710
|
+
name: {
|
|
711
|
+
type: 'string',
|
|
712
|
+
description: 'Control, layout or handler name (e.g. "btnSave", "Form_Orders", "btnSave_Click"). Pass `layout` with it unless the name is unique across the project.',
|
|
713
|
+
},
|
|
714
|
+
layout: {
|
|
715
|
+
type: 'string',
|
|
716
|
+
description: 'Form or report that scopes `name` — its name ("Form_Orders") or its layout file ("Form_Orders.form.txt"). Required in practice: the same control name usually exists on several forms.',
|
|
717
|
+
},
|
|
718
|
+
maxCallDepth: {
|
|
719
|
+
type: 'number',
|
|
720
|
+
description: 'Call-path depth budget (default: 5, clamped to 1..20). A path cut short sets context.truncated.callDepth.',
|
|
721
|
+
default: 5,
|
|
722
|
+
},
|
|
723
|
+
maxResults: {
|
|
724
|
+
type: 'number',
|
|
725
|
+
description: 'Maximum evidence entries (default: 50, clamped to 1..500). Dropped entries set context.truncated.results.',
|
|
726
|
+
default: 50,
|
|
727
|
+
},
|
|
728
|
+
projectPath: projectPathProperty,
|
|
729
|
+
},
|
|
730
|
+
required: [],
|
|
731
|
+
},
|
|
732
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
733
|
+
},
|
|
679
734
|
{
|
|
680
735
|
name: 'codegraph_sync',
|
|
681
736
|
description: 'Synchronize an existing CodeGraph index with filesystem changes.',
|
|
@@ -1002,7 +1057,7 @@ class ToolHandler {
|
|
|
1002
1057
|
return allow.has(shortName);
|
|
1003
1058
|
// Preserve backwards compatibility for direct read-only calls. Mutating
|
|
1004
1059
|
// lifecycle tools must be explicitly enabled even when tools/list is bypassed.
|
|
1005
|
-
return shortName !== 'init' && shortName !== 'sync' && shortName !== 'index' && shortName !== 'affected';
|
|
1060
|
+
return shortName !== 'init' && shortName !== 'sync' && shortName !== 'index' && shortName !== 'affected' && shortName !== 'release';
|
|
1006
1061
|
}
|
|
1007
1062
|
/**
|
|
1008
1063
|
* Get tool definitions with dynamic descriptions based on project size.
|
|
@@ -1431,6 +1486,13 @@ class ToolHandler {
|
|
|
1431
1486
|
if (toolName === 'codegraph_init') {
|
|
1432
1487
|
return this.executeMutatingTool('init', args);
|
|
1433
1488
|
}
|
|
1489
|
+
if (toolName === 'codegraph_release') {
|
|
1490
|
+
const target = this.validateString(args.path, 'path', MAX_PATH_LENGTH);
|
|
1491
|
+
if (typeof target !== 'string')
|
|
1492
|
+
return target;
|
|
1493
|
+
const result = await (0, daemon_registry_1.releaseDaemonAt)(target);
|
|
1494
|
+
return this.textResult(JSON.stringify(result));
|
|
1495
|
+
}
|
|
1434
1496
|
if (toolName === 'codegraph_index') {
|
|
1435
1497
|
return this.executeMutatingTool('index', args);
|
|
1436
1498
|
}
|
|
@@ -1690,9 +1752,38 @@ class ToolHandler {
|
|
|
1690
1752
|
case 'codegraph_explore': return await this.handleExplore(args);
|
|
1691
1753
|
case 'codegraph_node': return await this.handleNode(args);
|
|
1692
1754
|
case 'codegraph_files': return await this.handleFiles(args);
|
|
1755
|
+
case 'codegraph_behavior_evidence': return await this.handleBehaviorEvidence(args);
|
|
1693
1756
|
default: return this.errorResult(`Unknown tool: ${toolName}`);
|
|
1694
1757
|
}
|
|
1695
1758
|
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Access/VBA behavior evidence (issue #299) — a thin adapter over
|
|
1761
|
+
* {@link CodeGraph.getBehaviorEvidence}. The assembly lives in
|
|
1762
|
+
* `src/graph/behavior-evidence.ts`; this only validates argument shapes and
|
|
1763
|
+
* serializes the typed result, so the MCP surface and a library consumer
|
|
1764
|
+
* can never drift into two different answers.
|
|
1765
|
+
*
|
|
1766
|
+
* A request with no selector is NOT an error: the payload comes back with
|
|
1767
|
+
* `MISSING_TARGET_SELECTOR` in `context.notes`, the same success-shaped
|
|
1768
|
+
* guidance every other recoverable condition uses here.
|
|
1769
|
+
*/
|
|
1770
|
+
async handleBehaviorEvidence(args) {
|
|
1771
|
+
const cg = this.getCodeGraph(args.projectPath);
|
|
1772
|
+
const request = {};
|
|
1773
|
+
if (typeof args.nodeId === 'string' && args.nodeId.trim())
|
|
1774
|
+
request.nodeId = args.nodeId.trim();
|
|
1775
|
+
if (typeof args.name === 'string' && args.name.trim())
|
|
1776
|
+
request.name = args.name.trim();
|
|
1777
|
+
if (typeof args.layout === 'string' && args.layout.trim())
|
|
1778
|
+
request.layout = args.layout.trim();
|
|
1779
|
+
if (args.maxCallDepth !== undefined && Number.isFinite(Number(args.maxCallDepth))) {
|
|
1780
|
+
request.maxCallDepth = Number(args.maxCallDepth);
|
|
1781
|
+
}
|
|
1782
|
+
if (args.maxResults !== undefined && Number.isFinite(Number(args.maxResults))) {
|
|
1783
|
+
request.maxResults = Number(args.maxResults);
|
|
1784
|
+
}
|
|
1785
|
+
return this.textResult(JSON.stringify(cg.getBehaviorEvidence(request), null, 2));
|
|
1786
|
+
}
|
|
1696
1787
|
/** Run the CLI-only query command and preserve its JSON stdout verbatim. */
|
|
1697
1788
|
async handleQuery(args) {
|
|
1698
1789
|
const query = this.validateString(args.query, 'query');
|