@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/db/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,QAAQ,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/db/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AA4KlB;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAiB;IAM3B,OAAO,CAAC,iBAAiB,CAA0B;IAGnD,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IAGrC,OAAO,CAAC,KAAK,CAsCN;IAMP,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CA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;;OAEG;IACH,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI;IAcrD;;;OAGG;IACH,gCAAgC,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI;IAazH;;;;;;;;OAQG;IACH,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI;IAa7G;;;;;;;;OAQG;IACH,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,cAAc,GAAE,MAAY,GAAG,mBAAmB,EAAE;IA0ClG;;;OAGG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAkBlD;;;;;;OAMG;IACH,mBAAmB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAMvD;;OAEG;IACH,QAAQ,IAAI,UAAU;IAiDtB;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKvC;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAM7C;;OAEG;IACH,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IASxC;;OAEG;IACH,KAAK,IAAI,IAAI;CASd"}
|
package/lib/dist/db/queries.js
CHANGED
|
@@ -10,6 +10,7 @@ const utils_1 = require("../utils");
|
|
|
10
10
|
const query_utils_1 = require("../search/query-utils");
|
|
11
11
|
const query_parser_1 = require("../search/query-parser");
|
|
12
12
|
const generated_detection_1 = require("../extraction/generated-detection");
|
|
13
|
+
const identifier_segments_1 = require("../search/identifier-segments");
|
|
13
14
|
/**
|
|
14
15
|
* Path-only heuristic for files that should not be candidates for
|
|
15
16
|
* "dominant file" detection: test/spec files and tool-generated files.
|
|
@@ -33,6 +34,17 @@ function isLowValueFile(filePath) {
|
|
|
33
34
|
(0, generated_detection_1.isGeneratedFile)(filePath));
|
|
34
35
|
}
|
|
35
36
|
const SQLITE_PARAM_CHUNK_SIZE = 500;
|
|
37
|
+
/**
|
|
38
|
+
* Last segment of a (possibly dotted/qualified) reference name — the part a
|
|
39
|
+
* new symbol's plain node name could match: 'util.greet' → 'greet',
|
|
40
|
+
* 'mod::fn' → 'fn', 'greet' → 'greet'. Written to unresolved_refs.name_tail
|
|
41
|
+
* when a ref is marked failed, so the #1240 retry lookup can match dotted
|
|
42
|
+
* refs against newly-added node names.
|
|
43
|
+
*/
|
|
44
|
+
function referenceNameTail(referenceName) {
|
|
45
|
+
const idx = Math.max(referenceName.lastIndexOf('.'), referenceName.lastIndexOf(':'));
|
|
46
|
+
return idx >= 0 ? referenceName.slice(idx + 1) : referenceName;
|
|
47
|
+
}
|
|
36
48
|
/**
|
|
37
49
|
* Convert database row to Node object
|
|
38
50
|
*/
|
|
@@ -107,6 +119,12 @@ class QueryBuilder {
|
|
|
107
119
|
maxCacheSize = 1000;
|
|
108
120
|
// Prepared statements (lazily initialized)
|
|
109
121
|
stmts = {};
|
|
122
|
+
// Names whose segments were already written this session — skips re-splitting
|
|
123
|
+
// and re-inserting for the same-named nodes that repeat across files ("get",
|
|
124
|
+
// "render", …). Purely a write-path fast path; INSERT OR IGNORE is the
|
|
125
|
+
// correctness backstop. Bounded so a pathological repo can't grow it forever.
|
|
126
|
+
segmentedNames = new Set();
|
|
127
|
+
static MAX_SEGMENTED_NAMES = 65536;
|
|
110
128
|
constructor(db) {
|
|
111
129
|
this.db = db;
|
|
112
130
|
}
|
|
@@ -183,6 +201,39 @@ class QueryBuilder {
|
|
|
183
201
|
metadata: node.metadata ? JSON.stringify(node.metadata) : null,
|
|
184
202
|
updatedAt: node.updatedAt ?? Date.now(),
|
|
185
203
|
});
|
|
204
|
+
// Segment vocabulary rides the same write path (and transaction) so it can
|
|
205
|
+
// never drift ahead of the nodes it describes. Deletes intentionally leave
|
|
206
|
+
// orphans behind — vocab rows are proposals re-verified against nodes
|
|
207
|
+
// before use, and a full index clears the table at its start. File nodes
|
|
208
|
+
// are excluded: a file's basename duplicates the symbols inside it
|
|
209
|
+
// (state-machine.ts / OrderStateMachine), which double-counts every
|
|
210
|
+
// concept and defeats the singleton-vs-cluster rarity statistics. Import
|
|
211
|
+
// nodes are excluded too (#1144): they're named after module specifiers
|
|
212
|
+
// ("external-unindexed-pkg", "./utils/helpers"), not symbols — an
|
|
213
|
+
// import-only name can never be surfaced (getSegmentMatches requires a
|
|
214
|
+
// real definition), so its rows would only inflate the rarity statistics.
|
|
215
|
+
if (this.isSegmentableKind(node.kind))
|
|
216
|
+
this.insertNameSegments(node.name);
|
|
217
|
+
}
|
|
218
|
+
/** Which node kinds contribute their name to the segment vocabulary — the
|
|
219
|
+
* single gate shared by insertNode, updateNode, and the rebuild page query
|
|
220
|
+
* (getDistinctNodeNames), so the write paths can't drift apart. */
|
|
221
|
+
isSegmentableKind(kind) {
|
|
222
|
+
return kind !== 'file' && kind !== 'import';
|
|
223
|
+
}
|
|
224
|
+
/** Write `name`'s segments into name_segment_vocab (idempotent). */
|
|
225
|
+
insertNameSegments(name) {
|
|
226
|
+
if (this.segmentedNames.has(name))
|
|
227
|
+
return;
|
|
228
|
+
if (this.segmentedNames.size >= QueryBuilder.MAX_SEGMENTED_NAMES)
|
|
229
|
+
this.segmentedNames.clear();
|
|
230
|
+
this.segmentedNames.add(name);
|
|
231
|
+
if (!this.stmts.insertNameSegment) {
|
|
232
|
+
this.stmts.insertNameSegment = this.db.prepare('INSERT OR IGNORE INTO name_segment_vocab (segment, name) VALUES (?, ?)');
|
|
233
|
+
}
|
|
234
|
+
for (const segment of (0, identifier_segments_1.splitIdentifierSegments)(name)) {
|
|
235
|
+
this.stmts.insertNameSegment.run(segment, name);
|
|
236
|
+
}
|
|
186
237
|
}
|
|
187
238
|
/**
|
|
188
239
|
* Insert multiple nodes in a transaction
|
|
@@ -256,6 +307,16 @@ class QueryBuilder {
|
|
|
256
307
|
metadata: node.metadata ? JSON.stringify(node.metadata) : null,
|
|
257
308
|
updatedAt: node.updatedAt ?? Date.now(),
|
|
258
309
|
});
|
|
310
|
+
// updateNode is a second real write path to `nodes` — framework
|
|
311
|
+
// post-extract passes rewrite names through it (NestJS route prefixing),
|
|
312
|
+
// and a renamed node's new name must reach the segment vocabulary just
|
|
313
|
+
// like an inserted one's (#1141). Without this the rename left the new
|
|
314
|
+
// name permanently unsearchable: the old name's rows became honest-gate
|
|
315
|
+
// orphans and the only backfill is gated on the vocab being EMPTY.
|
|
316
|
+
// insertNameSegments is idempotent (in-memory set + INSERT OR IGNORE),
|
|
317
|
+
// so no name-changed check is needed.
|
|
318
|
+
if (this.isSegmentableKind(node.kind))
|
|
319
|
+
this.insertNameSegments(node.name);
|
|
259
320
|
}
|
|
260
321
|
/**
|
|
261
322
|
* Delete a node by ID
|
|
@@ -283,6 +344,86 @@ class QueryBuilder {
|
|
|
283
344
|
}
|
|
284
345
|
this.stmts.deleteNodesByFile.run(filePath);
|
|
285
346
|
}
|
|
347
|
+
// ===========================================================================
|
|
348
|
+
// Name-segment vocabulary (prompt-hook graph-derived gate)
|
|
349
|
+
// ===========================================================================
|
|
350
|
+
/** Wipe the segment vocabulary. A full index calls this at its start; the
|
|
351
|
+
* node write path repopulates it as files (re-)index, so the end state is
|
|
352
|
+
* exactly the current names with no orphan rows. */
|
|
353
|
+
clearNameSegmentVocab() {
|
|
354
|
+
this.db.exec('DELETE FROM name_segment_vocab');
|
|
355
|
+
this.segmentedNames.clear();
|
|
356
|
+
}
|
|
357
|
+
/** True when the vocab has no rows — an index built before the table existed.
|
|
358
|
+
* `sync` uses this to heal such databases (see rebuildNameSegmentVocabFrom). */
|
|
359
|
+
isNameSegmentVocabEmpty() {
|
|
360
|
+
const row = this.db.prepare('SELECT 1 FROM name_segment_vocab LIMIT 1').get();
|
|
361
|
+
return row === undefined;
|
|
362
|
+
}
|
|
363
|
+
/** One page of distinct segmentable node names, for batched vocab rebuilds
|
|
364
|
+
* (file basenames and import specifiers are excluded from the vocab — see
|
|
365
|
+
* insertNode). */
|
|
366
|
+
getDistinctNodeNames(limit, offset) {
|
|
367
|
+
const rows = this.db
|
|
368
|
+
.prepare("SELECT DISTINCT name FROM nodes WHERE kind NOT IN ('file', 'import') ORDER BY name LIMIT ? OFFSET ?")
|
|
369
|
+
.all(limit, offset);
|
|
370
|
+
return rows.map((r) => r.name);
|
|
371
|
+
}
|
|
372
|
+
/** Insert segments for a batch of names in one transaction (vocab heal path). */
|
|
373
|
+
insertNameSegmentsBatch(names) {
|
|
374
|
+
this.db.transaction(() => {
|
|
375
|
+
for (const name of names)
|
|
376
|
+
this.insertNameSegments(name);
|
|
377
|
+
})();
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Names whose segments cover at least `minWords` distinct PROMPT WORDS —
|
|
381
|
+
* the co-occurrence probe behind the prompt hook's medium tier: the words
|
|
382
|
+
* "state" and "machine" both being segments of `OrderStateMachine` is strong
|
|
383
|
+
* evidence the prompt names that symbol in prose. Ordered by coverage.
|
|
384
|
+
*
|
|
385
|
+
* Takes (segment variant → original word) pairs and folds variants back to
|
|
386
|
+
* their word INSIDE the SQL: a name matching both `service` and `services`
|
|
387
|
+
* counts ONE word, not two. Counting raw variants let plural-variant pairs
|
|
388
|
+
* of a single word tie with genuine two-word matches and — because ORDER
|
|
389
|
+
* BY/LIMIT run here, before any JS-side re-check — crowd a real match past
|
|
390
|
+
* the LIMIT on vocab-heavy repos (#1146).
|
|
391
|
+
*/
|
|
392
|
+
getSegmentCoOccurrence(variants, minWords, limit) {
|
|
393
|
+
if (variants.length === 0)
|
|
394
|
+
return [];
|
|
395
|
+
const placeholders = variants.map(() => '?').join(', ');
|
|
396
|
+
const whens = variants.map(() => 'WHEN ? THEN ?').join(' ');
|
|
397
|
+
const rows = this.db
|
|
398
|
+
.prepare(`SELECT name, COUNT(DISTINCT CASE segment ${whens} END) AS matches
|
|
399
|
+
FROM name_segment_vocab
|
|
400
|
+
WHERE segment IN (${placeholders})
|
|
401
|
+
GROUP BY name
|
|
402
|
+
HAVING matches >= ?
|
|
403
|
+
ORDER BY matches DESC, length(name) ASC
|
|
404
|
+
LIMIT ?`)
|
|
405
|
+
.all(...variants.flatMap((v) => [v.segment, v.word]), ...variants.map((v) => v.segment), minWords, limit);
|
|
406
|
+
return rows;
|
|
407
|
+
}
|
|
408
|
+
/** How many distinct names each segment appears in — the rarity signal that
|
|
409
|
+
* separates a discriminative word ("checkout") from a ubiquitous one ("state"). */
|
|
410
|
+
getSegmentNameCounts(segments) {
|
|
411
|
+
if (segments.length === 0)
|
|
412
|
+
return new Map();
|
|
413
|
+
const placeholders = segments.map(() => '?').join(', ');
|
|
414
|
+
const rows = this.db
|
|
415
|
+
.prepare(`SELECT segment, COUNT(*) AS n FROM name_segment_vocab
|
|
416
|
+
WHERE segment IN (${placeholders}) GROUP BY segment`)
|
|
417
|
+
.all(...segments);
|
|
418
|
+
return new Map(rows.map((r) => [r.segment, r.n]));
|
|
419
|
+
}
|
|
420
|
+
/** Names containing the given segment (rare-single-word tier). */
|
|
421
|
+
getNamesForSegment(segment, limit) {
|
|
422
|
+
const rows = this.db
|
|
423
|
+
.prepare('SELECT name FROM name_segment_vocab WHERE segment = ? ORDER BY length(name) ASC LIMIT ?')
|
|
424
|
+
.all(segment, limit);
|
|
425
|
+
return rows.map((r) => r.name);
|
|
426
|
+
}
|
|
286
427
|
/**
|
|
287
428
|
* Get a node by ID
|
|
288
429
|
*/
|
|
@@ -583,6 +724,33 @@ class QueryBuilder {
|
|
|
583
724
|
const rows = this.db.prepare('SELECT * FROM nodes').all();
|
|
584
725
|
return rows.map(rowToNode);
|
|
585
726
|
}
|
|
727
|
+
/**
|
|
728
|
+
* Stream nodes of one language whose `decorators` JSON array contains
|
|
729
|
+
* `decorator`. The LIKE on the JSON text is a cheap index-free pre-filter
|
|
730
|
+
* (a decorator name can appear as a substring of another), so callers must
|
|
731
|
+
* still exact-check `node.decorators.includes(decorator)`. Exists so the
|
|
732
|
+
* kotlin expect/actual synthesizer never materializes the whole node table
|
|
733
|
+
* the way `getAllNodes().filter(...)` did — that array alone OOM'd Node's
|
|
734
|
+
* default heap on a 2M-node graph (#1212).
|
|
735
|
+
*/
|
|
736
|
+
*iterateNodesByLanguageWithDecorator(language, decorator) {
|
|
737
|
+
// Fresh statement per call — an iterator holds an open cursor (see
|
|
738
|
+
// iterateNodesByKind).
|
|
739
|
+
const stmt = this.db.prepare("SELECT * FROM nodes WHERE language = ? AND decorators LIKE '%' || ? || '%'");
|
|
740
|
+
for (const row of stmt.iterate(language, `"${decorator}"`)) {
|
|
741
|
+
yield rowToNode(row);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Distinct languages present in the files table. One indexed aggregate —
|
|
746
|
+
* lets the dynamic-edge synthesizers skip passes for languages the project
|
|
747
|
+
* doesn't contain at all (a Kotlin pass has no work on a pure-C repo), so
|
|
748
|
+
* their cost is zero rather than a full-graph scan that finds nothing (#1212).
|
|
749
|
+
*/
|
|
750
|
+
getDistinctFileLanguages() {
|
|
751
|
+
const rows = this.db.prepare('SELECT DISTINCT language FROM files').all();
|
|
752
|
+
return new Set(rows.map((r) => r.language));
|
|
753
|
+
}
|
|
586
754
|
/**
|
|
587
755
|
* Get nodes by exact name match (uses idx_nodes_name index)
|
|
588
756
|
*/
|
|
@@ -593,6 +761,17 @@ class QueryBuilder {
|
|
|
593
761
|
const rows = this.stmts.getNodesByName.all(name);
|
|
594
762
|
return rows.map(rowToNode);
|
|
595
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* Nodes whose name starts with `prefix`, by index range scan (a LIKE would
|
|
766
|
+
* skip idx_nodes_name under SQLite's default case-insensitive LIKE).
|
|
767
|
+
*/
|
|
768
|
+
getNodesByNamePrefix(prefix, limit = 20) {
|
|
769
|
+
if (!this.stmts.getNodesByNamePrefix) {
|
|
770
|
+
this.stmts.getNodesByNamePrefix = this.db.prepare('SELECT * FROM nodes WHERE name >= ? AND name < ? ORDER BY name LIMIT ?');
|
|
771
|
+
}
|
|
772
|
+
const rows = this.stmts.getNodesByNamePrefix.all(prefix, prefix + '', limit);
|
|
773
|
+
return rows.map(rowToNode);
|
|
774
|
+
}
|
|
596
775
|
/**
|
|
597
776
|
* Get nodes by exact qualified name match (uses idx_nodes_qualified_name index)
|
|
598
777
|
*/
|
|
@@ -1178,6 +1357,29 @@ class QueryBuilder {
|
|
|
1178
1357
|
.all();
|
|
1179
1358
|
return rows.map(rowToNode);
|
|
1180
1359
|
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Find VBA reference-stub candidate nodes for `resolveVbaReferenceStubs`
|
|
1362
|
+
* (issue #78).
|
|
1363
|
+
*
|
|
1364
|
+
* A VBA reference-stub is a `class` node whose `metadata.synthesizedBy`
|
|
1365
|
+
* starts with `vba-` and is targeted by a `references` edge from a VBA
|
|
1366
|
+
* module. These synthetic nodes are created by the extractor for
|
|
1367
|
+
* cross-file type references (`Dim x As MyEnum`) but may not have been
|
|
1368
|
+
* resolved to the real type node during the main resolution pass.
|
|
1369
|
+
*/
|
|
1370
|
+
getVbaReferenceStubs() {
|
|
1371
|
+
const rows = this.db
|
|
1372
|
+
.prepare(`SELECT DISTINCT n.* FROM nodes n
|
|
1373
|
+
JOIN edges e ON e.target = n.id
|
|
1374
|
+
WHERE n.kind = 'class' AND n.language = 'vba'
|
|
1375
|
+
AND e.kind = 'references'
|
|
1376
|
+
AND EXISTS (
|
|
1377
|
+
SELECT 1 FROM nodes src
|
|
1378
|
+
WHERE src.id = e.source AND src.language = 'vba'
|
|
1379
|
+
)`)
|
|
1380
|
+
.all();
|
|
1381
|
+
return rows.map(rowToNode);
|
|
1382
|
+
}
|
|
1181
1383
|
/**
|
|
1182
1384
|
* Repoint an edge's `target` + `metadata` in place, leaving all other
|
|
1183
1385
|
* columns (source, kind, line, col, provenance) untouched. Used by
|
|
@@ -1288,7 +1490,8 @@ class QueryBuilder {
|
|
|
1288
1490
|
* {@link getDependentFilePaths}: all kinds except `contains`.
|
|
1289
1491
|
*/
|
|
1290
1492
|
getCrossFileIncomingEdgesWithTarget(filePath) {
|
|
1291
|
-
const sql = `SELECT e.*, tgt.name AS target_name, tgt.kind AS target_kind
|
|
1493
|
+
const sql = `SELECT e.*, tgt.name AS target_name, tgt.kind AS target_kind,
|
|
1494
|
+
src.file_path AS source_file_path, src.language AS source_language
|
|
1292
1495
|
FROM edges e
|
|
1293
1496
|
JOIN nodes tgt ON tgt.id = e.target
|
|
1294
1497
|
JOIN nodes src ON src.id = e.source
|
|
@@ -1300,6 +1503,8 @@ class QueryBuilder {
|
|
|
1300
1503
|
...rowToEdge(row),
|
|
1301
1504
|
targetName: row.target_name,
|
|
1302
1505
|
targetKind: row.target_kind,
|
|
1506
|
+
sourceFilePath: row.source_file_path,
|
|
1507
|
+
sourceLanguage: row.source_language,
|
|
1303
1508
|
}));
|
|
1304
1509
|
}
|
|
1305
1510
|
// ===========================================================================
|
|
@@ -1468,22 +1673,28 @@ class QueryBuilder {
|
|
|
1468
1673
|
}));
|
|
1469
1674
|
}
|
|
1470
1675
|
/**
|
|
1471
|
-
* Get the count of
|
|
1676
|
+
* Get the count of PENDING (never-attempted) references without loading
|
|
1677
|
+
* them into memory. Rows marked status='failed' — attempted by a completed
|
|
1678
|
+
* pass, no match — are excluded: they are not outstanding work, only retry
|
|
1679
|
+
* candidates for the #1240 sweep, so they must not trip the #1187 orphan
|
|
1680
|
+
* sweep or the `status` pending-refs warning.
|
|
1472
1681
|
*/
|
|
1473
1682
|
getUnresolvedReferencesCount() {
|
|
1474
1683
|
if (!this.stmts.getUnresolvedCount) {
|
|
1475
|
-
this.stmts.getUnresolvedCount = this.db.prepare(
|
|
1684
|
+
this.stmts.getUnresolvedCount = this.db.prepare("SELECT COUNT(*) as count FROM unresolved_refs WHERE status = 'pending'");
|
|
1476
1685
|
}
|
|
1477
1686
|
const row = this.stmts.getUnresolvedCount.get();
|
|
1478
1687
|
return row.count;
|
|
1479
1688
|
}
|
|
1480
1689
|
/**
|
|
1481
|
-
* Get a batch of unresolved references using LIMIT/OFFSET
|
|
1482
|
-
* Used to process references in bounded memory chunks
|
|
1690
|
+
* Get a batch of PENDING unresolved references using LIMIT/OFFSET
|
|
1691
|
+
* pagination. Used to process references in bounded memory chunks; failed
|
|
1692
|
+
* rows are excluded so the batched drain loop terminates once every row
|
|
1693
|
+
* has been attempted.
|
|
1483
1694
|
*/
|
|
1484
1695
|
getUnresolvedReferencesBatch(offset, limit) {
|
|
1485
1696
|
if (!this.stmts.getUnresolvedBatch) {
|
|
1486
|
-
this.stmts.getUnresolvedBatch = this.db.prepare(
|
|
1697
|
+
this.stmts.getUnresolvedBatch = this.db.prepare("SELECT * FROM unresolved_refs WHERE status = 'pending' LIMIT ? OFFSET ?");
|
|
1487
1698
|
}
|
|
1488
1699
|
const rows = this.stmts.getUnresolvedBatch.all(limit, offset);
|
|
1489
1700
|
return rows.map((row) => ({
|
|
@@ -1517,6 +1728,18 @@ class QueryBuilder {
|
|
|
1517
1728
|
const rows = this.stmts.getAllNodeNames.all();
|
|
1518
1729
|
return rows.map((r) => r.name);
|
|
1519
1730
|
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Stream the distinct node names one row at a time — the incremental
|
|
1733
|
+
* counterpart to {@link getAllNodeNames} for callers that need to yield
|
|
1734
|
+
* to the event loop mid-scan (resolver cache warm-up on multi-million-node
|
|
1735
|
+
* indexes). Fresh statement per call: the iterator holds an open cursor.
|
|
1736
|
+
*/
|
|
1737
|
+
*iterateNodeNames() {
|
|
1738
|
+
const stmt = this.db.prepare('SELECT DISTINCT name FROM nodes');
|
|
1739
|
+
for (const row of stmt.iterate()) {
|
|
1740
|
+
yield row.name;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1520
1743
|
/**
|
|
1521
1744
|
* Get unresolved references scoped to specific file paths.
|
|
1522
1745
|
* Uses the idx_unresolved_file_path index for efficient lookup.
|
|
@@ -1533,7 +1756,7 @@ class QueryBuilder {
|
|
|
1533
1756
|
const chunk = filePaths.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
|
|
1534
1757
|
const placeholders = chunk.map(() => '?').join(',');
|
|
1535
1758
|
const chunkRows = this.db
|
|
1536
|
-
.prepare(`SELECT * FROM unresolved_refs WHERE file_path IN (${placeholders})`)
|
|
1759
|
+
.prepare(`SELECT * FROM unresolved_refs WHERE status = 'pending' AND file_path IN (${placeholders})`)
|
|
1537
1760
|
.all(...chunk);
|
|
1538
1761
|
rows.push(...chunkRows);
|
|
1539
1762
|
}
|
|
@@ -1586,6 +1809,93 @@ class QueryBuilder {
|
|
|
1586
1809
|
});
|
|
1587
1810
|
deleteMany(refs);
|
|
1588
1811
|
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Mark refs a completed resolution pass could not resolve as status='failed'
|
|
1814
|
+
* instead of deleting them (#1240). Failed rows are invisible to the pending
|
|
1815
|
+
* count/batch readers (so drain loops and the #1187 orphan sweep still
|
|
1816
|
+
* terminate) but stay queryable by name_tail so a later sync can retry them
|
|
1817
|
+
* when a changed file introduces a symbol that could satisfy them. name_tail
|
|
1818
|
+
* is (re)written here so rows inserted before the v8 migration get their
|
|
1819
|
+
* tail the first time they're attempted.
|
|
1820
|
+
*/
|
|
1821
|
+
markReferencesFailed(refs) {
|
|
1822
|
+
if (refs.length === 0)
|
|
1823
|
+
return;
|
|
1824
|
+
const stmt = this.db.prepare("UPDATE unresolved_refs SET status = 'failed', name_tail = ? WHERE from_node_id = ? AND reference_name = ? AND reference_kind = ?");
|
|
1825
|
+
const markMany = this.db.transaction((items) => {
|
|
1826
|
+
for (const ref of items) {
|
|
1827
|
+
stmt.run(referenceNameTail(ref.referenceName), ref.fromNodeId, ref.referenceName, ref.referenceKind);
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
markMany(refs);
|
|
1831
|
+
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Failed refs whose name tail matches one of the given symbol names — the
|
|
1834
|
+
* candidates a sync should retry after files carrying those names changed
|
|
1835
|
+
* (#1240). Names matching more than `perNameCeiling` failed refs are
|
|
1836
|
+
* skipped entirely: at that population a name is external/builtin noise
|
|
1837
|
+
* (`get`, `map`, …) that one new definition won't resolve — the same
|
|
1838
|
+
* rationale as resolution's AMBIGUOUS_NAME_CEILING (#999) — and retrying an
|
|
1839
|
+
* arbitrary subset would be both wasted work and incoherent coverage.
|
|
1840
|
+
*/
|
|
1841
|
+
getRetryableFailedReferences(names, perNameCeiling = 500) {
|
|
1842
|
+
if (names.length === 0)
|
|
1843
|
+
return [];
|
|
1844
|
+
// Pass 1: per-tail counts, chunked under the SQLite parameter limit.
|
|
1845
|
+
const retryNames = [];
|
|
1846
|
+
for (let i = 0; i < names.length; i += SQLITE_PARAM_CHUNK_SIZE) {
|
|
1847
|
+
const chunk = names.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
|
|
1848
|
+
const placeholders = chunk.map(() => '?').join(',');
|
|
1849
|
+
const counts = this.db
|
|
1850
|
+
.prepare(`SELECT name_tail, COUNT(*) as count FROM unresolved_refs WHERE status = 'failed' AND name_tail IN (${placeholders}) GROUP BY name_tail`)
|
|
1851
|
+
.all(...chunk);
|
|
1852
|
+
for (const row of counts) {
|
|
1853
|
+
if (row.count <= perNameCeiling)
|
|
1854
|
+
retryNames.push(row.name_tail);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
if (retryNames.length === 0)
|
|
1858
|
+
return [];
|
|
1859
|
+
// Pass 2: load the surviving rows.
|
|
1860
|
+
const rows = [];
|
|
1861
|
+
for (let i = 0; i < retryNames.length; i += SQLITE_PARAM_CHUNK_SIZE) {
|
|
1862
|
+
const chunk = retryNames.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
|
|
1863
|
+
const placeholders = chunk.map(() => '?').join(',');
|
|
1864
|
+
const chunkRows = this.db
|
|
1865
|
+
.prepare(`SELECT * FROM unresolved_refs WHERE status = 'failed' AND name_tail IN (${placeholders})`)
|
|
1866
|
+
.all(...chunk);
|
|
1867
|
+
rows.push(...chunkRows);
|
|
1868
|
+
}
|
|
1869
|
+
return rows.map((row) => ({
|
|
1870
|
+
fromNodeId: row.from_node_id,
|
|
1871
|
+
referenceName: row.reference_name,
|
|
1872
|
+
referenceKind: row.reference_kind,
|
|
1873
|
+
line: row.line,
|
|
1874
|
+
column: row.col,
|
|
1875
|
+
candidates: row.candidates ? (0, utils_1.safeJsonParse)(row.candidates, undefined) : undefined,
|
|
1876
|
+
filePath: row.file_path,
|
|
1877
|
+
language: row.language,
|
|
1878
|
+
}));
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Distinct node names present in the given files — the symbol names a sync
|
|
1882
|
+
* pass uses to look up retryable failed refs after those files changed.
|
|
1883
|
+
*/
|
|
1884
|
+
getNodeNamesByFiles(filePaths) {
|
|
1885
|
+
if (filePaths.length === 0)
|
|
1886
|
+
return [];
|
|
1887
|
+
const names = new Set();
|
|
1888
|
+
for (let i = 0; i < filePaths.length; i += SQLITE_PARAM_CHUNK_SIZE) {
|
|
1889
|
+
const chunk = filePaths.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
|
|
1890
|
+
const placeholders = chunk.map(() => '?').join(',');
|
|
1891
|
+
const rows = this.db
|
|
1892
|
+
.prepare(`SELECT DISTINCT name FROM nodes WHERE file_path IN (${placeholders})`)
|
|
1893
|
+
.all(...chunk);
|
|
1894
|
+
for (const row of rows)
|
|
1895
|
+
names.add(row.name);
|
|
1896
|
+
}
|
|
1897
|
+
return [...names];
|
|
1898
|
+
}
|
|
1589
1899
|
// ===========================================================================
|
|
1590
1900
|
// Statistics
|
|
1591
1901
|
// ===========================================================================
|