@aroman22/codegraph-vba-darwin-arm64 1.5.1 → 1.6.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/bin/codegraph +5 -0
- package/lib/dist/bin/codegraph.d.ts +1 -1
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +307 -81
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +38 -1
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +22 -3
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/db/index.d.ts +84 -5
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +209 -12
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +80 -3
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +127 -4
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +317 -7
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +43 -1
- package/lib/dist/db/wal-valve.d.ts +106 -0
- package/lib/dist/db/wal-valve.d.ts.map +1 -0
- package/lib/dist/db/wal-valve.js +208 -0
- package/lib/dist/db/wal-valve.js.map +1 -0
- package/lib/dist/directory.d.ts +9 -5
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +210 -19
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/cfml-extractor.js +494 -0
- package/lib/dist/extraction/cfml-extractor.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +25 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +177 -23
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +47 -2
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +568 -51
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/arkts.d.ts +3 -0
- package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/lib/dist/extraction/languages/arkts.js +127 -0
- package/lib/dist/extraction/languages/arkts.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +98 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +563 -1
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
- package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfquery.js +28 -0
- package/lib/dist/extraction/languages/cfquery.js.map +1 -0
- package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfscript.js +73 -0
- package/lib/dist/extraction/languages/cfscript.js.map +1 -0
- package/lib/dist/extraction/languages/cobol.d.ts +33 -0
- package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cobol.js +499 -0
- package/lib/dist/extraction/languages/cobol.js.map +1 -0
- package/lib/dist/extraction/languages/erlang.d.ts +3 -0
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/lib/dist/extraction/languages/erlang.js +350 -0
- package/lib/dist/extraction/languages/erlang.js.map +1 -0
- package/lib/dist/extraction/languages/index.d.ts.map +1 -1
- package/lib/dist/extraction/languages/index.js +18 -0
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/nix.d.ts +3 -0
- package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
- package/lib/dist/extraction/languages/nix.js +294 -0
- package/lib/dist/extraction/languages/nix.js.map +1 -0
- package/lib/dist/extraction/languages/solidity.d.ts +3 -0
- package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/lib/dist/extraction/languages/solidity.js +293 -0
- package/lib/dist/extraction/languages/solidity.js.map +1 -0
- package/lib/dist/extraction/languages/terraform.d.ts +3 -0
- package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/lib/dist/extraction/languages/terraform.js +641 -0
- package/lib/dist/extraction/languages/terraform.js.map +1 -0
- package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/lib/dist/extraction/languages/vbnet.js +141 -0
- package/lib/dist/extraction/languages/vbnet.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +140 -38
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +28 -1
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +76 -7
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +11 -4
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +20 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +60 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +905 -20
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +3 -0
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -0
- package/lib/dist/extraction/vba/call-sweep.js +206 -0
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -0
- package/lib/dist/extraction/vba/calls.d.ts +55 -0
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/calls.js +439 -0
- package/lib/dist/extraction/vba/calls.js.map +1 -0
- package/lib/dist/extraction/vba/constants.d.ts +42 -0
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -0
- package/lib/dist/extraction/vba/constants.js +112 -0
- package/lib/dist/extraction/vba/constants.js.map +1 -0
- package/lib/dist/extraction/vba/context.d.ts +175 -0
- package/lib/dist/extraction/vba/context.d.ts.map +1 -0
- package/lib/dist/extraction/vba/context.js +268 -0
- package/lib/dist/extraction/vba/context.js.map +1 -0
- package/lib/dist/extraction/vba/controls.d.ts +24 -0
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/controls.js +89 -0
- package/lib/dist/extraction/vba/controls.js.map +1 -0
- package/lib/dist/extraction/vba/declarations.d.ts +3 -0
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -0
- package/lib/dist/extraction/vba/declarations.js +154 -0
- package/lib/dist/extraction/vba/declarations.js.map +1 -0
- package/lib/dist/extraction/vba/dims.d.ts +3 -0
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -0
- package/lib/dist/extraction/vba/dims.js +186 -0
- package/lib/dist/extraction/vba/dims.js.map +1 -0
- package/lib/dist/extraction/vba/docmd.d.ts +16 -0
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -0
- package/lib/dist/extraction/vba/docmd.js +179 -0
- package/lib/dist/extraction/vba/docmd.js.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts +15 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.js +178 -0
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +3 -0
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/implements.js +52 -0
- package/lib/dist/extraction/vba/implements.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +3 -0
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -0
- package/lib/dist/extraction/vba/procedures.js +239 -0
- package/lib/dist/extraction/vba/procedures.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +17 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.js +212 -0
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -0
- package/lib/dist/extraction/vba/tempvars.d.ts +10 -0
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/tempvars.js +138 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -0
- package/lib/dist/extraction/vba/text-utils.d.ts +73 -0
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -0
- package/lib/dist/extraction/vba/text-utils.js +195 -0
- package/lib/dist/extraction/vba/text-utils.js.map +1 -0
- package/lib/dist/extraction/vba-extractor.d.ts +3 -951
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +46 -2934
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +300 -88
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +76 -17
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +81 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +467 -10
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +42 -0
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +97 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +35 -3
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +101 -9
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +2 -1
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/early-ppid.d.ts +26 -0
- package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
- package/lib/dist/mcp/early-ppid.js +29 -0
- package/lib/dist/mcp/early-ppid.js.map +1 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +29 -4
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +73 -13
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +30 -4
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +14 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +18 -0
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +14 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +28 -1
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +44 -0
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/lib/dist/mcp/startup-handshake.js +73 -0
- package/lib/dist/mcp/startup-handshake.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +22 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +289 -23
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +18 -0
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/project-config.d.ts +44 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +151 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +170 -146
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1109 -97
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +42 -0
- package/lib/dist/resolution/cooperative-yield.js.map +1 -0
- package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cics.js +90 -0
- package/lib/dist/resolution/frameworks/cics.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +6 -0
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +14 -6
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.js +277 -0
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.js +8 -3
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +7 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +129 -4
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +85 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +535 -58
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +22 -3
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +613 -39
- 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 +49 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +29 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts +10 -0
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +142 -4
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +60 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -0
- package/lib/dist/search/identifier-segments.js +176 -0
- package/lib/dist/search/identifier-segments.js.map +1 -0
- package/lib/dist/sync/git-hooks.d.ts.map +1 -1
- package/lib/dist/sync/git-hooks.js +2 -0
- package/lib/dist/sync/git-hooks.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +10 -5
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +51 -14
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +9 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +45 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/types.d.ts +25 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +10 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +32 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +163 -14
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/upgrade/remove-binary.d.ts +87 -0
- package/lib/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/lib/dist/upgrade/remove-binary.js +289 -0
- package/lib/dist/upgrade/remove-binary.js.map +1 -0
- package/lib/dist/upgrade/update-check.d.ts +92 -0
- package/lib/dist/upgrade/update-check.d.ts.map +1 -0
- package/lib/dist/upgrade/update-check.js +258 -0
- package/lib/dist/upgrade/update-check.js.map +1 -0
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/lib/dist/reasoning/config.d.ts +0 -45
- package/lib/dist/reasoning/config.d.ts.map +0 -1
- package/lib/dist/reasoning/config.js +0 -171
- package/lib/dist/reasoning/config.js.map +0 -1
- package/lib/dist/reasoning/credentials.d.ts +0 -5
- package/lib/dist/reasoning/credentials.d.ts.map +0 -1
- package/lib/dist/reasoning/credentials.js +0 -83
- package/lib/dist/reasoning/credentials.js.map +0 -1
- package/lib/dist/reasoning/login.d.ts +0 -21
- package/lib/dist/reasoning/login.d.ts.map +0 -1
- package/lib/dist/reasoning/login.js +0 -85
- package/lib/dist/reasoning/login.js.map +0 -1
- package/lib/dist/reasoning/reasoner.d.ts +0 -43
- package/lib/dist/reasoning/reasoner.d.ts.map +0 -1
- package/lib/dist/reasoning/reasoner.js +0 -308
- package/lib/dist/reasoning/reasoner.js.map +0 -1
package/bin/codegraph
CHANGED
|
@@ -10,5 +10,10 @@ while [ -L "$SELF" ]; do
|
|
|
10
10
|
esac
|
|
11
11
|
done
|
|
12
12
|
DIR="$(cd "$(dirname "$SELF")/.." && pwd)"
|
|
13
|
+
# Thread the MCP host's pid to the server's orphan watchdog (issue #1185).
|
|
14
|
+
# $PPID is our parent — the host itself when it launched this script directly;
|
|
15
|
+
# an already-threaded value (the npm shim sets the true host pid) wins.
|
|
16
|
+
CODEGRAPH_HOST_PPID="${CODEGRAPH_HOST_PPID:-$PPID}"
|
|
17
|
+
export CODEGRAPH_HOST_PPID
|
|
13
18
|
# --liftoff-only: avoid the V8 turboshaft WASM Zone OOM (issues #293/#298).
|
|
14
19
|
exec "$DIR/node" --liftoff-only "$DIR/lib/dist/bin/codegraph.js" "$@"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegraph.d.ts","sourceRoot":"","sources":["../../src/bin/codegraph.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
|
1
|
+
{"version":3,"file":"codegraph.d.ts","sourceRoot":"","sources":["../../src/bin/codegraph.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,mBAAmB,CAAC"}
|
|
@@ -57,10 +57,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
57
57
|
};
|
|
58
58
|
})();
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
// FIRST import, before anything else loads: capture process.ppid while our
|
|
61
|
+
// launcher is (almost certainly) still alive. A launcher killed mid-startup
|
|
62
|
+
// otherwise blinds the PPID watchdog forever (#1185) — see early-ppid.ts.
|
|
63
|
+
require("../mcp/early-ppid");
|
|
60
64
|
const commander_1 = require("commander");
|
|
61
65
|
const path = __importStar(require("path"));
|
|
62
66
|
const fs = __importStar(require("fs"));
|
|
63
67
|
const directory_1 = require("../directory");
|
|
68
|
+
const identifier_segments_1 = require("../search/identifier-segments");
|
|
64
69
|
const worktree_1 = require("../sync/worktree");
|
|
65
70
|
const shimmer_progress_1 = require("../ui/shimmer-progress");
|
|
66
71
|
const glyphs_1 = require("../ui/glyphs");
|
|
@@ -339,6 +344,14 @@ function main() {
|
|
|
339
344
|
clack.log.success(`Indexed ${formatNumber(result.filesIndexed)} files`);
|
|
340
345
|
}
|
|
341
346
|
clack.log.info(`${formatNumber(result.nodesCreated)} nodes, ${formatNumber(result.edgesCreated)} edges in ${formatDuration(result.durationMs)}`);
|
|
347
|
+
// A PARTIAL index (files silently dropped mid-pipeline) must not pass
|
|
348
|
+
// as a clean run — it's the difference between "indexed the repo" and
|
|
349
|
+
// "indexed most of the repo, quietly". Only the completeness
|
|
350
|
+
// reconciliation warning; per-file extractor warnings stay in the
|
|
351
|
+
// error-code summary below.
|
|
352
|
+
for (const w of result.errors.filter((e) => e.code === 'index_partial')) {
|
|
353
|
+
clack.log.warn(w.message);
|
|
354
|
+
}
|
|
342
355
|
}
|
|
343
356
|
else if (hasErrors) {
|
|
344
357
|
clack.log.error(`Indexing failed ${(0, glyphs_1.getGlyphs)().dash} all ${formatNumber(result.filesErrored)} files had errors`);
|
|
@@ -381,6 +394,68 @@ function main() {
|
|
|
381
394
|
}
|
|
382
395
|
}
|
|
383
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* When an `init`/`index` produced an EMPTY graph and the reason is that the
|
|
399
|
+
* project's own `.gitignore` excludes nested git repositories — the "super-repo
|
|
400
|
+
* gitignores its child repos" layout (#1156), where `init` at the parent
|
|
401
|
+
* correctly indexes ~nothing while `init` inside each child works — name those
|
|
402
|
+
* repos and offer to index them. An interactive terminal gets a yes/no prompt
|
|
403
|
+
* that writes `includeIgnored` to codegraph.json and re-indexes; a
|
|
404
|
+
* non-interactive run just prints the one-line opt-in snippet. The caller gates
|
|
405
|
+
* this on `nodesCreated === 0`, so a project that DID index real content is
|
|
406
|
+
* never nagged about the gitignored reference clones it deliberately keeps out
|
|
407
|
+
* (#970, #1065). Best-effort throughout: detection never breaks the command.
|
|
408
|
+
*/
|
|
409
|
+
async function offerIndexIgnoredRepos(clack, projectPath, reindex, opts) {
|
|
410
|
+
let repos;
|
|
411
|
+
try {
|
|
412
|
+
const { findUnindexedIgnoredRepos } = await Promise.resolve().then(() => __importStar(require('../extraction')));
|
|
413
|
+
repos = findUnindexedIgnoredRepos(projectPath);
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
return; // detection is advisory — never let it break the command
|
|
417
|
+
}
|
|
418
|
+
if (repos.length === 0)
|
|
419
|
+
return;
|
|
420
|
+
const { PROJECT_CONFIG_FILENAME } = await Promise.resolve().then(() => __importStar(require('../project-config')));
|
|
421
|
+
const isOne = repos.length === 1;
|
|
422
|
+
const SHOWN = 6;
|
|
423
|
+
const names = repos.slice(0, SHOWN).map((r) => r.replace(/\/$/, ''));
|
|
424
|
+
const extra = repos.length > SHOWN ? ` (+${formatNumber(repos.length - SHOWN)} more)` : '';
|
|
425
|
+
const snippet = `{ "includeIgnored": [${repos.map((p) => JSON.stringify(p)).join(', ')}] }`;
|
|
426
|
+
clack.log.warn(`Your .gitignore excludes ${isOne ? 'a nested git repository' : `${formatNumber(repos.length)} nested git repositories`} here, ` +
|
|
427
|
+
`so ${isOne ? 'it was' : 'they were'} not indexed: ${names.join(', ')}${extra}.`);
|
|
428
|
+
const manualHint = () => {
|
|
429
|
+
clack.log.info(`If ${isOne ? "it's" : "they're"} your code, add ${isOne ? 'it' : 'them'} to ${PROJECT_CONFIG_FILENAME} and re-index:`);
|
|
430
|
+
clack.log.info(` ${snippet}`);
|
|
431
|
+
};
|
|
432
|
+
if (!opts.interactive || !process.stdin.isTTY) {
|
|
433
|
+
manualHint();
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const yes = await clack.confirm({
|
|
437
|
+
message: `Index ${isOne ? 'it' : `these ${formatNumber(repos.length)}`} now? Adds ${isOne ? 'it' : 'them'} to ${PROJECT_CONFIG_FILENAME}.`,
|
|
438
|
+
initialValue: true,
|
|
439
|
+
});
|
|
440
|
+
if (clack.isCancel(yes) || !yes) {
|
|
441
|
+
manualHint();
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
let added;
|
|
445
|
+
try {
|
|
446
|
+
const { addIncludeIgnoredPatterns } = await Promise.resolve().then(() => __importStar(require('../project-config')));
|
|
447
|
+
added = addIncludeIgnoredPatterns(projectPath, repos);
|
|
448
|
+
}
|
|
449
|
+
catch (err) {
|
|
450
|
+
clack.log.error(`Could not update ${PROJECT_CONFIG_FILENAME}: ${err instanceof Error ? err.message : String(err)}`);
|
|
451
|
+
manualHint();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
clack.log.success(`Added ${formatNumber(added)} ${added === 1 ? 'entry' : 'entries'} to ${PROJECT_CONFIG_FILENAME} ${(0, glyphs_1.getGlyphs)().dash} re-indexing…`);
|
|
455
|
+
const result = await reindex();
|
|
456
|
+
printIndexResult(clack, result, projectPath);
|
|
457
|
+
return result;
|
|
458
|
+
}
|
|
384
459
|
/**
|
|
385
460
|
* Write detailed error log to .codegraph/errors.log
|
|
386
461
|
*/
|
|
@@ -470,36 +545,43 @@ function main() {
|
|
|
470
545
|
clack.outro('');
|
|
471
546
|
return;
|
|
472
547
|
}
|
|
473
|
-
const { default: CodeGraph } = await loadCodeGraph();
|
|
548
|
+
const { default: CodeGraph, getDatabasePath } = await loadCodeGraph();
|
|
474
549
|
const cg = await CodeGraph.init(projectPath, { index: false });
|
|
475
550
|
clack.log.success(`Initialized in ${projectPath}`);
|
|
476
551
|
// Indexing runs by default now. The legacy -i/--index flag is still
|
|
477
552
|
// accepted (so existing muscle memory and scripts don't break) but is a
|
|
478
553
|
// no-op — initializing always builds the initial index.
|
|
479
554
|
// Supervise the index: self-terminate if orphaned or wedged (#999).
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
555
|
+
// The DB + WAL paths let the liveness watchdog tell a slow store on
|
|
556
|
+
// degraded storage from a true wedge (#1231).
|
|
557
|
+
// A closure so we can re-run the exact same supervised, progress-rendered
|
|
558
|
+
// index if the user opts gitignored child repos in below (#1156).
|
|
559
|
+
const dbPath = getDatabasePath(projectPath);
|
|
560
|
+
const runIndex = async () => {
|
|
561
|
+
const supervision = (0, command_supervision_1.installCommandSupervision)('init', { progressPaths: [dbPath, `${dbPath}-wal`] });
|
|
562
|
+
try {
|
|
563
|
+
if (options.verbose) {
|
|
564
|
+
return await cg.indexAll({ onProgress: createVerboseProgress(), verbose: true });
|
|
565
|
+
}
|
|
490
566
|
process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
|
|
491
567
|
const progress = (0, shimmer_progress_1.createShimmerProgress)();
|
|
492
|
-
|
|
493
|
-
onProgress: progress.onProgress,
|
|
494
|
-
});
|
|
568
|
+
const r = await cg.indexAll({ onProgress: progress.onProgress });
|
|
495
569
|
await progress.stop();
|
|
570
|
+
return r;
|
|
496
571
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
572
|
+
finally {
|
|
573
|
+
supervision.stop();
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
const result = await runIndex();
|
|
501
577
|
printIndexResult(clack, result, projectPath);
|
|
502
578
|
await recordIndexTelemetry(cg, result);
|
|
579
|
+
// An empty graph at a git super-repo usually means `.gitignore` excludes
|
|
580
|
+
// the child repos that hold the code — surface them and offer to opt in
|
|
581
|
+
// rather than leaving the user with a silent 0-node "Done". (#1156)
|
|
582
|
+
if (result.nodesCreated === 0) {
|
|
583
|
+
await offerIndexIgnoredRepos(clack, projectPath, runIndex, { interactive: true });
|
|
584
|
+
}
|
|
503
585
|
try {
|
|
504
586
|
const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
|
|
505
587
|
await offerWatchFallback(clack, projectPath);
|
|
@@ -590,16 +672,26 @@ function main() {
|
|
|
590
672
|
info('Run "codegraph init" first');
|
|
591
673
|
process.exit(1);
|
|
592
674
|
}
|
|
593
|
-
const { default: CodeGraph } = await loadCodeGraph();
|
|
594
|
-
|
|
675
|
+
const { default: CodeGraph, getDatabasePath } = await loadCodeGraph();
|
|
676
|
+
// `index` is a FULL re-index — identical to a fresh `init`. RECREATE the
|
|
677
|
+
// database from scratch (discard .codegraph/codegraph.db + its WAL) rather
|
|
678
|
+
// than opening the old graph and DELETE-ing every row. The clear-then-index
|
|
679
|
+
// approach reported "0 nodes" without the clear (#874); the recreate keeps
|
|
680
|
+
// that fixed AND avoids the failure mode where, on a large or pre-fix
|
|
681
|
+
// poisoned index, the per-row FTS delete churn wedged the main thread long
|
|
682
|
+
// enough to trip the liveness watchdog before scanning even began (#1067).
|
|
683
|
+
// recreate() hands back a fresh, empty instance — no clear() needed. For
|
|
684
|
+
// fast incremental updates use `sync`.
|
|
685
|
+
const cg = await CodeGraph.recreate(projectPath);
|
|
595
686
|
// Supervise the indexer: self-terminate if orphaned (parent shim killed)
|
|
596
687
|
// or if the main thread wedges — neither was guarded on this path (#999).
|
|
597
|
-
|
|
688
|
+
// The DB + WAL paths let the liveness watchdog tell a slow store on
|
|
689
|
+
// degraded storage from a true wedge (#1231).
|
|
690
|
+
const dbPath = getDatabasePath(projectPath);
|
|
691
|
+
const supervision = (0, command_supervision_1.installCommandSupervision)('index', { progressPaths: [dbPath, `${dbPath}-wal`] });
|
|
598
692
|
try {
|
|
599
693
|
if (options.quiet) {
|
|
600
|
-
// Quiet mode: no UI, just run
|
|
601
|
-
// existing graph and rebuild from scratch (see the note below — #874).
|
|
602
|
-
cg.clear();
|
|
694
|
+
// Quiet mode: no UI, just run against the freshly-recreated graph.
|
|
603
695
|
const result = await cg.indexAll();
|
|
604
696
|
if (!result.success)
|
|
605
697
|
process.exit(1);
|
|
@@ -608,30 +700,28 @@ function main() {
|
|
|
608
700
|
}
|
|
609
701
|
const clack = await importESM('@clack/prompts');
|
|
610
702
|
clack.intro('Indexing project');
|
|
611
|
-
//
|
|
612
|
-
//
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
let result;
|
|
618
|
-
if (options.verbose) {
|
|
619
|
-
result = await cg.indexAll({
|
|
620
|
-
onProgress: createVerboseProgress(),
|
|
621
|
-
verbose: true,
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
703
|
+
// A closure so a re-index (after opting gitignored child repos in, #1156)
|
|
704
|
+
// renders identically. Supervision already wraps the whole command.
|
|
705
|
+
const renderIndex = async () => {
|
|
706
|
+
if (options.verbose) {
|
|
707
|
+
return await cg.indexAll({ onProgress: createVerboseProgress(), verbose: true });
|
|
708
|
+
}
|
|
625
709
|
process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
|
|
626
710
|
const progress = (0, shimmer_progress_1.createShimmerProgress)();
|
|
627
|
-
|
|
628
|
-
onProgress: progress.onProgress,
|
|
629
|
-
});
|
|
711
|
+
const r = await cg.indexAll({ onProgress: progress.onProgress });
|
|
630
712
|
await progress.stop();
|
|
631
|
-
|
|
713
|
+
return r;
|
|
714
|
+
};
|
|
715
|
+
const result = await renderIndex();
|
|
632
716
|
printIndexResult(clack, result, projectPath);
|
|
633
717
|
await recordIndexTelemetry(cg, result);
|
|
634
|
-
|
|
718
|
+
// Empty graph at a git super-repo → likely `.gitignore`d child repos;
|
|
719
|
+
// name them and offer to opt in instead of a silent 0-node result (#1156).
|
|
720
|
+
let finalResult = result;
|
|
721
|
+
if (result.nodesCreated === 0) {
|
|
722
|
+
finalResult = (await offerIndexIgnoredRepos(clack, projectPath, renderIndex, { interactive: true })) ?? result;
|
|
723
|
+
}
|
|
724
|
+
if (!finalResult.success) {
|
|
635
725
|
process.exit(1);
|
|
636
726
|
}
|
|
637
727
|
clack.outro('Done');
|
|
@@ -742,6 +832,10 @@ function main() {
|
|
|
742
832
|
const journalMode = cg.getJournalMode();
|
|
743
833
|
const buildInfo = cg.getIndexBuildInfo();
|
|
744
834
|
const reindexRecommended = cg.isIndexStale();
|
|
835
|
+
const indexState = cg.getIndexState();
|
|
836
|
+
// Zero on a healthy index; non-zero at rest means a resolution pass was
|
|
837
|
+
// interrupted, so some files' call edges are missing (#1187).
|
|
838
|
+
const pendingRefs = cg.getPendingReferenceCount();
|
|
745
839
|
// JSON output mode
|
|
746
840
|
if (options.json) {
|
|
747
841
|
const lastIndexedMs = cg.getLastIndexedAt();
|
|
@@ -772,6 +866,14 @@ function main() {
|
|
|
772
866
|
builtWithExtractionVersion: buildInfo.extractionVersion,
|
|
773
867
|
currentExtractionVersion: extraction_version_1.EXTRACTION_VERSION,
|
|
774
868
|
reindexRecommended,
|
|
869
|
+
// 'complete' | 'partial' (files silently dropped) | 'indexing'
|
|
870
|
+
// (a run was killed mid-index — the index is truncated) |
|
|
871
|
+
// 'failed' | null (predates the marker).
|
|
872
|
+
state: indexState,
|
|
873
|
+
// References awaiting resolution. Non-zero at rest means an
|
|
874
|
+
// interrupted resolution pass left edges missing; the next
|
|
875
|
+
// sync sweeps them (#1187).
|
|
876
|
+
pendingRefs,
|
|
775
877
|
},
|
|
776
878
|
}));
|
|
777
879
|
cg.destroy();
|
|
@@ -783,6 +885,18 @@ function main() {
|
|
|
783
885
|
if (worktreeMismatch) {
|
|
784
886
|
warn((0, worktree_1.worktreeMismatchWarning)(worktreeMismatch));
|
|
785
887
|
}
|
|
888
|
+
if (indexState === 'indexing') {
|
|
889
|
+
warn('The last index run never finished (killed mid-index?) — the index is truncated. Re-run "codegraph index".');
|
|
890
|
+
}
|
|
891
|
+
else if (indexState === 'partial') {
|
|
892
|
+
warn('The last index run silently dropped files — the index is partial. Re-run "codegraph index".');
|
|
893
|
+
}
|
|
894
|
+
else if (indexState === 'failed') {
|
|
895
|
+
warn('The last index run failed — results may be incomplete. Re-run "codegraph index".');
|
|
896
|
+
}
|
|
897
|
+
if (pendingRefs > 0) {
|
|
898
|
+
warn(`${formatNumber(pendingRefs)} references from an interrupted run are awaiting resolution — some callers/impact edges are missing. Run "codegraph sync" to resolve them.`);
|
|
899
|
+
}
|
|
786
900
|
console.log();
|
|
787
901
|
// Index stats
|
|
788
902
|
console.log(chalk.bold('Index Statistics:'));
|
|
@@ -897,13 +1011,16 @@ function main() {
|
|
|
897
1011
|
}
|
|
898
1012
|
else {
|
|
899
1013
|
console.log(chalk.bold(`\nSearch Results for "${search}":\n`));
|
|
1014
|
+
// Results arrive already ranked by relevance, so the order conveys
|
|
1015
|
+
// it. We don't print the raw score: it's an unbounded BM25/FTS value
|
|
1016
|
+
// (relative-ranking only), and the old `(score * 100)%` rendered it
|
|
1017
|
+
// as nonsensical percentages like "12042%" (#1045). The MCP search
|
|
1018
|
+
// tool likewise shows no score. Raw `score` stays in --json output.
|
|
900
1019
|
for (const result of results) {
|
|
901
1020
|
const node = result.node;
|
|
902
1021
|
const location = `${node.filePath}:${node.startLine}`;
|
|
903
|
-
const score = chalk.dim(`(${(result.score * 100).toFixed(0)}%)`);
|
|
904
1022
|
console.log(chalk.cyan(node.kind.padEnd(12)) +
|
|
905
|
-
chalk.white(node.qualifiedName || node.name)
|
|
906
|
-
' ' + score);
|
|
1023
|
+
chalk.white(node.qualifiedName || node.name));
|
|
907
1024
|
console.log(chalk.dim(` ${location}`));
|
|
908
1025
|
if (node.signature) {
|
|
909
1026
|
console.log(chalk.dim(` ${node.signature}`));
|
|
@@ -998,16 +1115,35 @@ function main() {
|
|
|
998
1115
|
return;
|
|
999
1116
|
}
|
|
1000
1117
|
const prompt = String(input.prompt || '');
|
|
1001
|
-
// Gate:
|
|
1002
|
-
//
|
|
1003
|
-
//
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1118
|
+
// Gate telemetry: how often each tier fires vs. no-ops — counter names
|
|
1119
|
+
// only, NEVER prompt content (see TELEMETRY.md). This is the data that
|
|
1120
|
+
// turns "is the gate any good" from vibes into a measured recall rate.
|
|
1121
|
+
const gate = (outcome) => {
|
|
1122
|
+
try {
|
|
1123
|
+
(0, telemetry_1.getTelemetry)().recordUsage('cli_command', `prompt-hook-gate-${outcome}`, true);
|
|
1124
|
+
}
|
|
1125
|
+
catch { /* never break the hook */ }
|
|
1126
|
+
};
|
|
1127
|
+
// Gate, tiered by confidence (#994, #1126):
|
|
1128
|
+
// HIGH — a structural keyword (any covered language), or a code-shaped
|
|
1129
|
+
// token verified in the index → full explore injection.
|
|
1130
|
+
// MEDIUM — no keyword/token, but prose words match indexed symbol-name
|
|
1131
|
+
// SEGMENTS ("state machine" → OrderStateMachine, in any
|
|
1132
|
+
// language): inject a short list of the matching symbols and
|
|
1133
|
+
// let the AGENT write the explore query — the graph-derived
|
|
1134
|
+
// tier, no vocabulary involved.
|
|
1135
|
+
// silent — nothing verified. Every other prompt ("fix this typo")
|
|
1136
|
+
// stays a zero-cost no-op.
|
|
1137
|
+
// Keywords fire on their own; a token or prose word is only a CANDIDATE
|
|
1138
|
+
// verified against the graph below, so a tech brand ("JavaScript") that
|
|
1139
|
+
// merely looks like code doesn't inject spurious context.
|
|
1007
1140
|
const keyworded = (0, directory_1.hasStructuralKeyword)(prompt);
|
|
1008
1141
|
const codeTokens = keyworded ? [] : (0, directory_1.extractCodeTokens)(prompt);
|
|
1009
|
-
|
|
1142
|
+
const proseWords = keyworded ? [] : (0, identifier_segments_1.extractProseCandidates)(prompt);
|
|
1143
|
+
if (!keyworded && codeTokens.length === 0 && proseWords.length === 0) {
|
|
1144
|
+
gate('noop-shape');
|
|
1010
1145
|
return;
|
|
1146
|
+
}
|
|
1011
1147
|
// Decide what to inject, shaped by WHERE the index(es) are: the nearest
|
|
1012
1148
|
// indexed ancestor of cwd, or — when cwd is an un-indexed workspace root
|
|
1013
1149
|
// whose indexed project(s) live in sub-dirs (the monorepo case, #964) —
|
|
@@ -1016,8 +1152,10 @@ function main() {
|
|
|
1016
1152
|
// root (it only walked up), so the validated adoption lever never fired
|
|
1017
1153
|
// exactly where the agent most needs it.
|
|
1018
1154
|
const plan = (0, directory_1.planFrontload)(String(input.cwd || process.cwd()), prompt);
|
|
1019
|
-
if (!plan.exploreRoot && plan.nudgeProjects.length === 0)
|
|
1020
|
-
|
|
1155
|
+
if (!plan.exploreRoot && plan.nudgeProjects.length === 0) {
|
|
1156
|
+
gate('noop-no-index');
|
|
1157
|
+
return;
|
|
1158
|
+
} // nothing reachable — the agent's normal tools apply
|
|
1021
1159
|
// A "pass projectPath" line for indexed sub-projects we did NOT front-load.
|
|
1022
1160
|
// Follow-up codegraph_explore calls against a sub-project (cwd isn't its
|
|
1023
1161
|
// index root) need an explicit projectPath, so spell it out.
|
|
@@ -1026,30 +1164,72 @@ function main() {
|
|
|
1026
1164
|
const { default: CodeGraph } = await loadCodeGraph();
|
|
1027
1165
|
const cg = await CodeGraph.open(plan.exploreRoot);
|
|
1028
1166
|
try {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
//
|
|
1033
|
-
//
|
|
1034
|
-
|
|
1167
|
+
const others = plan.nudgeProjects.length
|
|
1168
|
+
? `\n${nudge(plan.nudgeProjects, 'Other indexed projects in this workspace — pass projectPath to query them:')}`
|
|
1169
|
+
: '';
|
|
1170
|
+
// Tier decision against THIS index (issue #994 follow-up: candidates
|
|
1171
|
+
// must be real here — a brand name or prose about another domain
|
|
1172
|
+
// must not inject). Keyword-bearing prompts skip verification — the
|
|
1173
|
+
// keyword is signal enough.
|
|
1174
|
+
const tokenVerified = !keyworded && codeTokens.some((t) => cg.getNodesByName(t).length > 0);
|
|
1175
|
+
if (keyworded || tokenVerified) {
|
|
1176
|
+
const { ToolHandler } = await Promise.resolve().then(() => __importStar(require('../mcp/tools')));
|
|
1177
|
+
const handler = new ToolHandler(cg);
|
|
1178
|
+
const result = await handler.execute('codegraph_explore', { query: prompt });
|
|
1179
|
+
const text = result.content[0]?.text ?? '';
|
|
1180
|
+
if (!result.isError && text.trim()) {
|
|
1181
|
+
// Cap the injection so a large-repo explore can't flood the prompt.
|
|
1182
|
+
const MAX = 16000;
|
|
1183
|
+
const body = text.length > MAX ? `${text.slice(0, MAX)}\n…(truncated; call codegraph_explore for the rest)` : text;
|
|
1184
|
+
// For a front-loaded SUB-project, a follow-up explore needs its path.
|
|
1185
|
+
const more = plan.viaSubScan
|
|
1186
|
+
? `call codegraph_explore with projectPath: "${plan.exploreRoot}" for more`
|
|
1187
|
+
: 'call codegraph_explore for more';
|
|
1188
|
+
process.stdout.write(`<codegraph_context note="Structural context from CodeGraph for this prompt — treat returned source as already read; ${more}.">\n${body}${others}\n</codegraph_context>\n`);
|
|
1189
|
+
gate(keyworded ? 'high-keyword' : 'high-token');
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
// A high-* outcome must mean context was actually delivered —
|
|
1193
|
+
// the funnel's noop-vs-high split is how gate recall is
|
|
1194
|
+
// measured (#1143). An explore error or empty result is a
|
|
1195
|
+
// delivery failure, not a gate success.
|
|
1196
|
+
gate(keyworded ? 'noop-explore-keyword' : 'noop-explore-token');
|
|
1197
|
+
}
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
// MEDIUM: prose words → symbol-name segments, co-occurrence/rarity
|
|
1201
|
+
// scored, each hit re-verified to exist (see getSegmentMatches). The
|
|
1202
|
+
// payload names the symbols but does NOT run explore — the agent owns
|
|
1203
|
+
// the query where the hook's confidence is only "these are related".
|
|
1204
|
+
//
|
|
1205
|
+
// A database indexed before the vocab table existed starts with it
|
|
1206
|
+
// EMPTY, and only sync() backfills it — which this hook never runs
|
|
1207
|
+
// (#1142). Heal it here: on a populated vocab this is one SELECT;
|
|
1208
|
+
// the actual backfill is a one-time batched pass whose cost the MCP
|
|
1209
|
+
// server's own catch-up sync usually pays first (it runs at every
|
|
1210
|
+
// session start). A distinct noop outcome keeps a dormant vocab
|
|
1211
|
+
// from polluting the noop-unverified recall signal.
|
|
1212
|
+
const vocabReady = await cg.healSegmentVocabIfEmpty().catch(() => false);
|
|
1213
|
+
if (!vocabReady) {
|
|
1214
|
+
gate('noop-vocab-empty');
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
const related = cg.getSegmentMatches(proseWords);
|
|
1218
|
+
if (related.length === 0) {
|
|
1219
|
+
gate('noop-unverified');
|
|
1035
1220
|
return;
|
|
1036
|
-
const { ToolHandler } = await Promise.resolve().then(() => __importStar(require('../mcp/tools')));
|
|
1037
|
-
const handler = new ToolHandler(cg);
|
|
1038
|
-
const result = await handler.execute('codegraph_explore', { query: prompt });
|
|
1039
|
-
const text = result.content[0]?.text ?? '';
|
|
1040
|
-
if (!result.isError && text.trim()) {
|
|
1041
|
-
// Cap the injection so a large-repo explore can't flood the prompt.
|
|
1042
|
-
const MAX = 16000;
|
|
1043
|
-
const body = text.length > MAX ? `${text.slice(0, MAX)}\n…(truncated; call codegraph_explore for the rest)` : text;
|
|
1044
|
-
// For a front-loaded SUB-project, a follow-up explore needs its path.
|
|
1045
|
-
const more = plan.viaSubScan
|
|
1046
|
-
? `call codegraph_explore with projectPath: "${plan.exploreRoot}" for more`
|
|
1047
|
-
: 'call codegraph_explore for more';
|
|
1048
|
-
const others = plan.nudgeProjects.length
|
|
1049
|
-
? `\n${nudge(plan.nudgeProjects, 'Other indexed projects in this workspace — pass projectPath to query them:')}`
|
|
1050
|
-
: '';
|
|
1051
|
-
process.stdout.write(`<codegraph_context note="Structural context from CodeGraph for this prompt — treat returned source as already read; ${more}.">\n${body}${others}\n</codegraph_context>\n`);
|
|
1052
1221
|
}
|
|
1222
|
+
const lines = related
|
|
1223
|
+
.map((m) => ` - ${m.name} (${m.kind} — ${m.filePath}:${m.startLine})`)
|
|
1224
|
+
.join('\n');
|
|
1225
|
+
const exampleQuery = related.slice(0, 3).map((m) => m.name).join(' ');
|
|
1226
|
+
const projectHint = plan.viaSubScan ? ` with projectPath: "${plan.exploreRoot}"` : '';
|
|
1227
|
+
process.stdout.write(`<codegraph_context note="CodeGraph found indexed symbols matching this prompt — query the graph before searching files.">\n` +
|
|
1228
|
+
`This project's CodeGraph index contains symbols matching this request:\n${lines}\n` +
|
|
1229
|
+
`Call codegraph_explore ONCE${projectHint} with the relevant names in one query (e.g. "${exampleQuery}") ` +
|
|
1230
|
+
`to get their source, call paths, and blast radius — cheaper and more complete than Read/Grep.\n${others}` +
|
|
1231
|
+
`</codegraph_context>\n`);
|
|
1232
|
+
gate('medium-segment');
|
|
1053
1233
|
}
|
|
1054
1234
|
finally {
|
|
1055
1235
|
cg.destroy();
|
|
@@ -1061,6 +1241,7 @@ function main() {
|
|
|
1061
1241
|
process.stdout.write(`<codegraph_context note="CodeGraph is available for this workspace's indexed sub-projects — query one by passing projectPath to codegraph_explore.">\n` +
|
|
1062
1242
|
nudge(plan.nudgeProjects, "This workspace's CodeGraph indexes live in sub-projects. To use CodeGraph, call codegraph_explore with the projectPath of the relevant one:") +
|
|
1063
1243
|
`</codegraph_context>\n`);
|
|
1244
|
+
gate('nudge-projects');
|
|
1064
1245
|
}
|
|
1065
1246
|
}
|
|
1066
1247
|
catch {
|
|
@@ -1068,14 +1249,17 @@ function main() {
|
|
|
1068
1249
|
}
|
|
1069
1250
|
});
|
|
1070
1251
|
/**
|
|
1071
|
-
* codegraph node
|
|
1252
|
+
* codegraph node [name]
|
|
1072
1253
|
*
|
|
1073
1254
|
* The CLI face of the MCP codegraph_node tool: one symbol's source +
|
|
1074
1255
|
* caller/callee trail, or a whole file with line numbers + dependents
|
|
1075
1256
|
* (Read-parity). Same subagent/non-MCP rationale as `explore`.
|
|
1257
|
+
*
|
|
1258
|
+
* `name` is OPTIONAL because `--file` (file-read mode) carries no symbol —
|
|
1259
|
+
* a required `<name>` made `codegraph node -f <file>` unreachable (#1044).
|
|
1076
1260
|
*/
|
|
1077
1261
|
program
|
|
1078
|
-
.command('node
|
|
1262
|
+
.command('node [name]')
|
|
1079
1263
|
.description('One symbol\'s source + caller/callee trail, or read a file with line numbers + dependents (same output as the codegraph_node MCP tool)')
|
|
1080
1264
|
.option('-p, --path <path>', 'Project path')
|
|
1081
1265
|
.option('-f, --file <file>', 'Treat as file mode (or disambiguate a symbol to this file)')
|
|
@@ -1083,6 +1267,13 @@ function main() {
|
|
|
1083
1267
|
.option('--limit <number>', 'File mode: maximum lines')
|
|
1084
1268
|
.option('--symbols-only', 'File mode: just the symbol map + dependents')
|
|
1085
1269
|
.action(async (name, options) => {
|
|
1270
|
+
// Need a symbol (positional) OR a file (--file / a path-like positional).
|
|
1271
|
+
// With [name] optional, a bare `codegraph node` reaches here with neither
|
|
1272
|
+
// and must be told what to pass, rather than crashing downstream.
|
|
1273
|
+
if (!name && !options.file) {
|
|
1274
|
+
error("Pass a symbol name (e.g. 'codegraph node parseToken') or a file (e.g. 'codegraph node -f src/auth.ts', or 'codegraph node src/auth.ts').");
|
|
1275
|
+
process.exit(1);
|
|
1276
|
+
}
|
|
1086
1277
|
const projectPath = resolveProjectPath(options.path);
|
|
1087
1278
|
try {
|
|
1088
1279
|
if (!(0, directory_1.isInitialized)(projectPath)) {
|
|
@@ -1104,10 +1295,10 @@ function main() {
|
|
|
1104
1295
|
if (name && name !== options.file)
|
|
1105
1296
|
args.symbol = name;
|
|
1106
1297
|
}
|
|
1107
|
-
else if (name.includes('/') || name.includes('\\')) {
|
|
1298
|
+
else if (name && (name.includes('/') || name.includes('\\'))) {
|
|
1108
1299
|
args.file = name.replace(/\\/g, '/');
|
|
1109
1300
|
}
|
|
1110
|
-
else {
|
|
1301
|
+
else if (name) {
|
|
1111
1302
|
args.symbol = name;
|
|
1112
1303
|
args.includeCode = true;
|
|
1113
1304
|
}
|
|
@@ -1851,6 +2042,7 @@ function main() {
|
|
|
1851
2042
|
.option('-y, --yes', 'Non-interactive: defaults to --location=global --target=auto, auto-allow on')
|
|
1852
2043
|
.option('--no-permissions', 'Skip writing the auto-allow permissions list (Claude Code only)')
|
|
1853
2044
|
.option('--print-config <id>', 'Print MCP config snippet for the named agent and exit (no file writes)')
|
|
2045
|
+
.option('--refresh', 'Rewrite what previous installs configured, for already-configured agents only (never adds new ones). Run automatically by `codegraph upgrade`')
|
|
1854
2046
|
.action(async (opts) => {
|
|
1855
2047
|
if (opts.printConfig) {
|
|
1856
2048
|
const { getTarget, listTargetIds } = await Promise.resolve().then(() => __importStar(require('../installer/targets/registry')));
|
|
@@ -1864,6 +2056,36 @@ function main() {
|
|
|
1864
2056
|
process.stdout.write(target.printConfig(loc));
|
|
1865
2057
|
return;
|
|
1866
2058
|
}
|
|
2059
|
+
// --refresh: non-interactive sweep that re-writes what previous
|
|
2060
|
+
// installs configured (instructions section, MCP entry, legacy-hook
|
|
2061
|
+
// cleanups) for already-configured agents, so those surfaces match
|
|
2062
|
+
// THIS binary's templates. Skips everything else — never a first
|
|
2063
|
+
// install, never touches permissions or the prompt hook. Sweeps both
|
|
2064
|
+
// locations unless --location narrows it.
|
|
2065
|
+
if (opts.refresh) {
|
|
2066
|
+
const { refreshTargets } = await Promise.resolve().then(() => __importStar(require('../installer')));
|
|
2067
|
+
const { ALL_TARGETS } = await Promise.resolve().then(() => __importStar(require('../installer/targets/registry')));
|
|
2068
|
+
if (opts.location && opts.location !== 'global' && opts.location !== 'local') {
|
|
2069
|
+
error(`--location must be "global" or "local" (got "${opts.location}").`);
|
|
2070
|
+
process.exit(1);
|
|
2071
|
+
}
|
|
2072
|
+
const locs = opts.location
|
|
2073
|
+
? [opts.location]
|
|
2074
|
+
: ['global', 'local'];
|
|
2075
|
+
let changed = 0;
|
|
2076
|
+
for (const loc of locs) {
|
|
2077
|
+
for (const report of refreshTargets(ALL_TARGETS, loc)) {
|
|
2078
|
+
for (const p of report.changedPaths) {
|
|
2079
|
+
changed += 1;
|
|
2080
|
+
console.log(` ${report.displayName}: refreshed ${p}`);
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
if (changed === 0) {
|
|
2085
|
+
console.log('All configured agent surfaces are already current.');
|
|
2086
|
+
}
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
1867
2089
|
const { runInstallerWithOptions } = await Promise.resolve().then(() => __importStar(require('../installer')));
|
|
1868
2090
|
if (opts.location && opts.location !== 'global' && opts.location !== 'local') {
|
|
1869
2091
|
error(`--location must be "global" or "local" (got "${opts.location}").`);
|
|
@@ -1908,6 +2130,7 @@ function main() {
|
|
|
1908
2130
|
.option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "all". Default: all')
|
|
1909
2131
|
.option('-l, --location <where>', 'Uninstall location: "global" or "local". Default: prompt')
|
|
1910
2132
|
.option('-y, --yes', 'Non-interactive: defaults to --location=global --target=all')
|
|
2133
|
+
.option('--keep-cli', 'Remove agent configs only — leave the codegraph CLI installed')
|
|
1911
2134
|
.action(async (opts) => {
|
|
1912
2135
|
const { runUninstaller } = await Promise.resolve().then(() => __importStar(require('../installer')));
|
|
1913
2136
|
if (opts.location && opts.location !== 'global' && opts.location !== 'local') {
|
|
@@ -1919,6 +2142,8 @@ function main() {
|
|
|
1919
2142
|
target: opts.target,
|
|
1920
2143
|
location: opts.location,
|
|
1921
2144
|
yes: opts.yes,
|
|
2145
|
+
keepCli: opts.keepCli,
|
|
2146
|
+
cliFilename: __filename,
|
|
1922
2147
|
});
|
|
1923
2148
|
}
|
|
1924
2149
|
catch (err) {
|
|
@@ -1990,6 +2215,7 @@ function main() {
|
|
|
1990
2215
|
method,
|
|
1991
2216
|
resolveLatest: () => up.resolveLatestVersion(),
|
|
1992
2217
|
run: up.defaultRun,
|
|
2218
|
+
capture: up.defaultCapture,
|
|
1993
2219
|
hasCommand: up.hasCommand,
|
|
1994
2220
|
log: (m) => console.log(m),
|
|
1995
2221
|
warn: (m) => warn(m),
|