@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.4
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 +1 -1
- package/bin/codegraph.cmd +1 -1
- package/lib/dist/.test-build-engine.json +1 -1
- package/lib/dist/.test-build-viewer.json +1 -1
- package/lib/dist/bin/codegraph.d.ts +3 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +507 -702
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.js +1 -57
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/bin/fatal-handler.js +0 -46
- package/lib/dist/bin/fatal-handler.js.map +1 -1
- package/lib/dist/bin/node-version-check.js +0 -33
- package/lib/dist/bin/node-version-check.js.map +1 -1
- package/lib/dist/bin/uninstall.js +0 -19
- package/lib/dist/bin/uninstall.js.map +1 -1
- package/lib/dist/bin/viewer-gate.js +0 -14
- package/lib/dist/bin/viewer-gate.js.map +1 -1
- package/lib/dist/compile-cache.d.ts +2 -0
- package/lib/dist/compile-cache.d.ts.map +1 -0
- package/lib/dist/compile-cache.js +45 -0
- package/lib/dist/compile-cache.js.map +1 -0
- package/lib/dist/context/formatter.js +3 -66
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +44 -1
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +123 -430
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/context/markers.js +0 -17
- package/lib/dist/context/markers.js.map +1 -1
- package/lib/dist/db/index.d.ts +44 -1
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +123 -395
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +11 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +71 -79
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/name-substring-index.d.ts +63 -0
- package/lib/dist/db/name-substring-index.d.ts.map +1 -0
- package/lib/dist/db/name-substring-index.js +151 -0
- package/lib/dist/db/name-substring-index.js.map +1 -0
- package/lib/dist/db/node-sqlite.d.ts +19 -0
- package/lib/dist/db/node-sqlite.d.ts.map +1 -0
- package/lib/dist/db/node-sqlite.js +23 -0
- package/lib/dist/db/node-sqlite.js.map +1 -0
- package/lib/dist/db/open-error.d.ts +36 -0
- package/lib/dist/db/open-error.d.ts.map +1 -0
- package/lib/dist/db/open-error.js +63 -0
- package/lib/dist/db/open-error.js.map +1 -0
- package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
- package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
- package/lib/dist/db/parameter-flow-queries.js +168 -0
- package/lib/dist/db/parameter-flow-queries.js.map +1 -0
- package/lib/dist/db/queries.d.ts +654 -34
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1466 -1470
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/reference-tail.d.ts +83 -0
- package/lib/dist/db/reference-tail.d.ts.map +1 -0
- package/lib/dist/db/reference-tail.js +68 -0
- package/lib/dist/db/reference-tail.js.map +1 -0
- package/lib/dist/db/schema.sql +18 -2
- package/lib/dist/db/sqlite-adapter.d.ts +18 -1
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +12 -62
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
- package/lib/dist/db/synthesis-stage.js +2 -6
- package/lib/dist/db/synthesis-stage.js.map +1 -1
- package/lib/dist/db/wal-valve.js +1 -153
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/db/wsl-shared-index.js +0 -37
- package/lib/dist/db/wsl-shared-index.js.map +1 -1
- package/lib/dist/directory.d.ts +51 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +76 -530
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/engine.d.ts +15 -0
- package/lib/dist/engine.d.ts.map +1 -0
- package/lib/dist/engine.js +35 -0
- package/lib/dist/engine.js.map +1 -0
- package/lib/dist/errors.d.ts +10 -0
- package/lib/dist/errors.d.ts.map +1 -1
- package/lib/dist/errors.js +8 -101
- package/lib/dist/errors.js.map +1 -1
- package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/astro-extractor.js +11 -101
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +27 -1
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +70 -206
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/commonjs-requires.js +0 -31
- package/lib/dist/extraction/commonjs-requires.js.map +1 -1
- package/lib/dist/extraction/dfm-extractor.js +0 -21
- package/lib/dist/extraction/dfm-extractor.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -24
- package/lib/dist/extraction/extraction-version.js.map +1 -1
- package/lib/dist/extraction/function-ref.d.ts +40 -0
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +157 -207
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.js +0 -165
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +73 -4
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +160 -431
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +208 -7
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +594 -1383
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/decode.js +0 -16
- package/lib/dist/extraction/kernel/decode.js.map +1 -1
- package/lib/dist/extraction/kernel/index.d.ts +3 -1
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/index.js +48 -135
- package/lib/dist/extraction/kernel/index.js.map +1 -1
- package/lib/dist/extraction/kernel/layout.js +42 -76
- package/lib/dist/extraction/kernel/layout.js.map +1 -1
- package/lib/dist/extraction/kernel/loader.d.ts +5 -1
- package/lib/dist/extraction/kernel/loader.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/loader.js +0 -37
- package/lib/dist/extraction/kernel/loader.js.map +1 -1
- package/lib/dist/extraction/languages/arkts.js +0 -59
- package/lib/dist/extraction/languages/arkts.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +125 -28
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +789 -856
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/cfquery.js +0 -9
- package/lib/dist/extraction/languages/cfquery.js.map +1 -1
- package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/cfscript.js +80 -9
- package/lib/dist/extraction/languages/cfscript.js.map +1 -1
- package/lib/dist/extraction/languages/cobol.js +0 -114
- package/lib/dist/extraction/languages/cobol.js.map +1 -1
- package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
- package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
- package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
- package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
- package/lib/dist/extraction/languages/csharp.js +3 -55
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts +129 -0
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +517 -162
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +15 -102
- package/lib/dist/extraction/languages/erlang.js.map +1 -1
- package/lib/dist/extraction/languages/go.d.ts +48 -0
- package/lib/dist/extraction/languages/go.d.ts.map +1 -1
- package/lib/dist/extraction/languages/go.js +102 -31
- package/lib/dist/extraction/languages/go.js.map +1 -1
- package/lib/dist/extraction/languages/index.js +0 -6
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/java.d.ts.map +1 -1
- package/lib/dist/extraction/languages/java.js +67 -78
- package/lib/dist/extraction/languages/java.js.map +1 -1
- package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/javascript.js +2 -12
- package/lib/dist/extraction/languages/javascript.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts +11 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +43 -197
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/lua.js +2 -39
- package/lib/dist/extraction/languages/lua.js.map +1 -1
- package/lib/dist/extraction/languages/luau.js +0 -14
- package/lib/dist/extraction/languages/luau.js.map +1 -1
- package/lib/dist/extraction/languages/nix.js +0 -16
- package/lib/dist/extraction/languages/nix.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +5 -16
- package/lib/dist/extraction/languages/objc.js.map +1 -1
- package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
- package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
- package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
- package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
- package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
- package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
- package/lib/dist/extraction/languages/pascal-system.js +23 -0
- package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
- package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
- package/lib/dist/extraction/languages/pascal.js +3 -4
- package/lib/dist/extraction/languages/pascal.js.map +1 -1
- package/lib/dist/extraction/languages/php.d.ts +9 -0
- package/lib/dist/extraction/languages/php.d.ts.map +1 -1
- package/lib/dist/extraction/languages/php.js +207 -44
- package/lib/dist/extraction/languages/php.js.map +1 -1
- package/lib/dist/extraction/languages/python.js +2 -20
- package/lib/dist/extraction/languages/python.js.map +1 -1
- package/lib/dist/extraction/languages/r.js +8 -78
- package/lib/dist/extraction/languages/r.js.map +1 -1
- package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
- package/lib/dist/extraction/languages/ruby.js +17 -25
- package/lib/dist/extraction/languages/ruby.js.map +1 -1
- package/lib/dist/extraction/languages/rust-macro-calls.d.ts +32 -0
- package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
- package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
- package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
- package/lib/dist/extraction/languages/rust.d.ts +10 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +15 -47
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/languages/scala.js +5 -41
- package/lib/dist/extraction/languages/scala.js.map +1 -1
- package/lib/dist/extraction/languages/solidity.js +1 -82
- package/lib/dist/extraction/languages/solidity.js.map +1 -1
- package/lib/dist/extraction/languages/swift.js +3 -47
- package/lib/dist/extraction/languages/swift.js.map +1 -1
- package/lib/dist/extraction/languages/terraform.js +6 -152
- package/lib/dist/extraction/languages/terraform.js.map +1 -1
- package/lib/dist/extraction/languages/typescript.d.ts +64 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +73 -49
- package/lib/dist/extraction/languages/typescript.js.map +1 -1
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
- package/lib/dist/extraction/languages/vbnet.js +9 -42
- package/lib/dist/extraction/languages/vbnet.js.map +1 -1
- package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
- package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
- package/lib/dist/extraction/lazy-frameworks.js +8 -0
- package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
- package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/liquid-extractor.js +89 -148
- package/lib/dist/extraction/liquid-extractor.js.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +0 -78
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-budget.d.ts +42 -7
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
- package/lib/dist/extraction/parse-budget.js +39 -15
- package/lib/dist/extraction/parse-budget.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +29 -17
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +49 -193
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.d.ts +1 -1
- package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
- package/lib/dist/extraction/parse-worker.js +5 -58
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/razor-extractor.d.ts +9 -0
- package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/razor-extractor.js +45 -69
- package/lib/dist/extraction/razor-extractor.js.map +1 -1
- package/lib/dist/extraction/razor-script.d.ts +23 -0
- package/lib/dist/extraction/razor-script.d.ts.map +1 -0
- package/lib/dist/extraction/razor-script.js +244 -0
- package/lib/dist/extraction/razor-script.js.map +1 -0
- package/lib/dist/extraction/sfc-script.d.ts +42 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
- package/lib/dist/extraction/sfc-script.js +32 -31
- package/lib/dist/extraction/sfc-script.js.map +1 -1
- package/lib/dist/extraction/store-worker.d.ts +1 -1
- package/lib/dist/extraction/store-worker.d.ts.map +1 -1
- package/lib/dist/extraction/store-worker.js +1 -38
- package/lib/dist/extraction/store-worker.js.map +1 -1
- package/lib/dist/extraction/store-writer.js +2 -34
- package/lib/dist/extraction/store-writer.js.map +1 -1
- package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/svelte-extractor.js +11 -87
- package/lib/dist/extraction/svelte-extractor.js.map +1 -1
- package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
- package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
- package/lib/dist/extraction/syntax-tokens.js +4 -152
- package/lib/dist/extraction/syntax-tokens.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.js +0 -7
- package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +518 -10
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +2118 -2554
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +13 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +52 -92
- package/lib/dist/extraction/vue-extractor.js.map +1 -1
- package/lib/dist/extraction/vue-options-api.js +0 -32
- package/lib/dist/extraction/vue-options-api.js.map +1 -1
- package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
- package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
- package/lib/dist/extraction/vue-template-calls.js +497 -0
- package/lib/dist/extraction/vue-template-calls.js.map +1 -0
- package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +18 -89
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/lib/dist/file-limits.d.ts +8 -0
- package/lib/dist/file-limits.d.ts.map +1 -1
- package/lib/dist/file-limits.js +13 -28
- package/lib/dist/file-limits.js.map +1 -1
- package/lib/dist/graph/branch-guards.d.ts.map +1 -1
- package/lib/dist/graph/branch-guards.js +4 -251
- package/lib/dist/graph/branch-guards.js.map +1 -1
- package/lib/dist/graph/call-sites.d.ts +12 -0
- package/lib/dist/graph/call-sites.d.ts.map +1 -0
- package/lib/dist/graph/call-sites.js +17 -0
- package/lib/dist/graph/call-sites.js.map +1 -0
- package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
- package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
- package/lib/dist/graph/cobol-copybooks.js +45 -0
- package/lib/dist/graph/cobol-copybooks.js.map +1 -0
- package/lib/dist/graph/dead-code.d.ts +26 -4
- package/lib/dist/graph/dead-code.d.ts.map +1 -1
- package/lib/dist/graph/dead-code.js +157 -311
- package/lib/dist/graph/dead-code.js.map +1 -1
- package/lib/dist/graph/dynamic-boundary-report.js +1 -88
- package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
- package/lib/dist/graph/file-cycles.d.ts +20 -0
- package/lib/dist/graph/file-cycles.d.ts.map +1 -0
- package/lib/dist/graph/file-cycles.js +79 -0
- package/lib/dist/graph/file-cycles.js.map +1 -0
- package/lib/dist/graph/file-drift.d.ts +35 -0
- package/lib/dist/graph/file-drift.d.ts.map +1 -0
- package/lib/dist/graph/file-drift.js +46 -0
- package/lib/dist/graph/file-drift.js.map +1 -0
- package/lib/dist/graph/go-package.d.ts +27 -0
- package/lib/dist/graph/go-package.d.ts.map +1 -0
- package/lib/dist/graph/go-package.js +49 -0
- package/lib/dist/graph/go-package.js.map +1 -0
- package/lib/dist/graph/index.d.ts +2 -0
- package/lib/dist/graph/index.d.ts.map +1 -1
- package/lib/dist/graph/index.js +4 -6
- package/lib/dist/graph/index.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
- package/lib/dist/graph/named-symbol-flow.js +82 -223
- package/lib/dist/graph/named-symbol-flow.js.map +1 -1
- package/lib/dist/graph/owning-package.d.ts +59 -0
- package/lib/dist/graph/owning-package.d.ts.map +1 -0
- package/lib/dist/graph/owning-package.js +120 -0
- package/lib/dist/graph/owning-package.js.map +1 -0
- package/lib/dist/graph/queries.d.ts +6 -3
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +4 -137
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/symbol-lookup.d.ts +15 -3
- package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
- package/lib/dist/graph/symbol-lookup.js +47 -89
- package/lib/dist/graph/symbol-lookup.js.map +1 -1
- package/lib/dist/graph/symbol-references.d.ts +86 -0
- package/lib/dist/graph/symbol-references.d.ts.map +1 -0
- package/lib/dist/graph/symbol-references.js +304 -0
- package/lib/dist/graph/symbol-references.js.map +1 -0
- package/lib/dist/graph/synthesized-hop.d.ts +37 -0
- package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
- package/lib/dist/graph/synthesized-hop.js +62 -0
- package/lib/dist/graph/synthesized-hop.js.map +1 -0
- package/lib/dist/graph/test-code.d.ts +33 -0
- package/lib/dist/graph/test-code.d.ts.map +1 -0
- package/lib/dist/graph/test-code.js +104 -0
- package/lib/dist/graph/test-code.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +31 -2
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +96 -226
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/graph/type-hierarchy.js +0 -138
- package/lib/dist/graph/type-hierarchy.js.map +1 -1
- package/lib/dist/index.d.ts +214 -26
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +736 -1112
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/beta-signup.js +0 -39
- package/lib/dist/installer/beta-signup.js.map +1 -1
- package/lib/dist/installer/config-writer.js +0 -24
- package/lib/dist/installer/config-writer.js.map +1 -1
- package/lib/dist/installer/index.d.ts +13 -6
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +27 -160
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +16 -1
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +10 -38
- package/lib/dist/installer/instructions-template.js.map +1 -1
- package/lib/dist/installer/targets/antigravity.js +0 -113
- package/lib/dist/installer/targets/antigravity.js.map +1 -1
- package/lib/dist/installer/targets/bob.d.ts +20 -0
- package/lib/dist/installer/targets/bob.d.ts.map +1 -0
- package/lib/dist/installer/targets/bob.js +83 -0
- package/lib/dist/installer/targets/bob.js.map +1 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +1 -185
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +17 -109
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.js +2 -54
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
- package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
- package/lib/dist/installer/targets/copilot-vscode.js +0 -58
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
- package/lib/dist/installer/targets/cursor.js +7 -88
- package/lib/dist/installer/targets/cursor.js.map +1 -1
- package/lib/dist/installer/targets/droid.d.ts +18 -0
- package/lib/dist/installer/targets/droid.d.ts.map +1 -0
- package/lib/dist/installer/targets/droid.js +92 -0
- package/lib/dist/installer/targets/droid.js.map +1 -0
- package/lib/dist/installer/targets/dsh.d.ts +35 -0
- package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
- package/lib/dist/installer/targets/dsh.js +267 -0
- package/lib/dist/installer/targets/dsh.js.map +1 -0
- package/lib/dist/installer/targets/gemini.js +0 -37
- package/lib/dist/installer/targets/gemini.js.map +1 -1
- package/lib/dist/installer/targets/grok.d.ts +25 -0
- package/lib/dist/installer/targets/grok.d.ts.map +1 -0
- package/lib/dist/installer/targets/grok.js +96 -0
- package/lib/dist/installer/targets/grok.js.map +1 -0
- package/lib/dist/installer/targets/hermes.d.ts +19 -7
- package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
- package/lib/dist/installer/targets/hermes.js +218 -214
- package/lib/dist/installer/targets/hermes.js.map +1 -1
- package/lib/dist/installer/targets/json-config.d.ts +45 -0
- package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
- package/lib/dist/installer/targets/json-config.js +128 -0
- package/lib/dist/installer/targets/json-config.js.map +1 -0
- package/lib/dist/installer/targets/kimi.d.ts +21 -0
- package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
- package/lib/dist/installer/targets/kimi.js +97 -0
- package/lib/dist/installer/targets/kimi.js.map +1 -0
- package/lib/dist/installer/targets/kiro.js +1 -41
- package/lib/dist/installer/targets/kiro.js.map +1 -1
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +1 -103
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/pi.d.ts +24 -0
- package/lib/dist/installer/targets/pi.d.ts.map +1 -0
- package/lib/dist/installer/targets/pi.js +100 -0
- package/lib/dist/installer/targets/pi.js.map +1 -0
- package/lib/dist/installer/targets/qoder.d.ts +23 -0
- package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
- package/lib/dist/installer/targets/qoder.js +83 -0
- package/lib/dist/installer/targets/qoder.js.map +1 -0
- package/lib/dist/installer/targets/qwen.d.ts +21 -0
- package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
- package/lib/dist/installer/targets/qwen.js +115 -0
- package/lib/dist/installer/targets/qwen.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +18 -25
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +83 -13
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +201 -131
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/toml.d.ts +82 -6
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +318 -112
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +1 -1
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/installer/targets/types.js +0 -13
- package/lib/dist/installer/targets/types.js.map +1 -1
- package/lib/dist/installer/targets/windsurf.d.ts +22 -0
- package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
- package/lib/dist/installer/targets/windsurf.js +90 -0
- package/lib/dist/installer/targets/windsurf.js.map +1 -0
- package/lib/dist/lazy-engine.d.ts +22 -0
- package/lib/dist/lazy-engine.d.ts.map +1 -0
- package/lib/dist/lazy-engine.js +16 -0
- package/lib/dist/lazy-engine.js.map +1 -0
- package/lib/dist/mcp/answer-freshness.js +0 -6
- package/lib/dist/mcp/answer-freshness.js.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +2 -23
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +2 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +9 -85
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-proof.d.ts +19 -0
- package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-proof.js +126 -0
- package/lib/dist/mcp/daemon-proof.js.map +1 -0
- package/lib/dist/mcp/daemon-registry.d.ts +47 -2
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +188 -139
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +69 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +186 -376
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +4 -78
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/early-ppid.js +0 -24
- package/lib/dist/mcp/early-ppid.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +24 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +47 -152
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.js +0 -108
- package/lib/dist/mcp/explore-dedup.js.map +1 -1
- package/lib/dist/mcp/explore-diagnostics.d.ts +6 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
- package/lib/dist/mcp/explore-diagnostics.js +8 -116
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
- package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
- package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
- package/lib/dist/mcp/explore-one-symbol.js +431 -0
- package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +0 -129
- package/lib/dist/mcp/explore-session-state.js.map +1 -1
- package/lib/dist/mcp/hook-client.d.ts +44 -0
- package/lib/dist/mcp/hook-client.d.ts.map +1 -0
- package/lib/dist/mcp/hook-client.js +202 -0
- package/lib/dist/mcp/hook-client.js.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.js +1 -6
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
- package/lib/dist/mcp/index-freshness.js +0 -15
- package/lib/dist/mcp/index-freshness.js.map +1 -1
- package/lib/dist/mcp/index-version-warning.d.ts +21 -0
- package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
- package/lib/dist/mcp/index-version-warning.js +38 -0
- package/lib/dist/mcp/index-version-warning.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +29 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +131 -300
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +106 -121
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/opencode-tool-names.d.ts +32 -0
- package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
- package/lib/dist/mcp/opencode-tool-names.js +24 -0
- package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
- package/lib/dist/mcp/ppid-watchdog.js +0 -24
- package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
- package/lib/dist/mcp/process-identity.d.ts +42 -0
- package/lib/dist/mcp/process-identity.d.ts.map +1 -0
- package/lib/dist/mcp/process-identity.js +130 -0
- package/lib/dist/mcp/process-identity.js.map +1 -0
- package/lib/dist/mcp/project-lifecycle.d.ts +6 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
- package/lib/dist/mcp/project-lifecycle.js +70 -19
- package/lib/dist/mcp/project-lifecycle.js.map +1 -1
- package/lib/dist/mcp/prompt-explore.d.ts +19 -0
- package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
- package/lib/dist/mcp/prompt-explore.js +6 -0
- package/lib/dist/mcp/prompt-explore.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +25 -7
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +145 -274
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +52 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +114 -123
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/query-worker.js +24 -36
- package/lib/dist/mcp/query-worker.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +18 -0
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +12 -32
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +46 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +70 -132
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.js +1 -48
- package/lib/dist/mcp/startup-handshake.js.map +1 -1
- package/lib/dist/mcp/stdin-teardown.js +0 -28
- package/lib/dist/mcp/stdin-teardown.js.map +1 -1
- package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
- package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
- package/lib/dist/mcp/stdout-teardown.js +20 -0
- package/lib/dist/mcp/stdout-teardown.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +157 -18
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +797 -3621
- 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 +4 -96
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/mcp/version.d.ts +13 -1
- package/lib/dist/mcp/version.d.ts.map +1 -1
- package/lib/dist/mcp/version.js +19 -21
- package/lib/dist/mcp/version.js.map +1 -1
- package/lib/dist/mcp/writer-lock.d.ts +11 -0
- package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
- package/lib/dist/mcp/writer-lock.js +49 -46
- package/lib/dist/mcp/writer-lock.js.map +1 -1
- package/lib/dist/project-config.d.ts +20 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +31 -140
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/alias-binding.d.ts +7 -0
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
- package/lib/dist/resolution/alias-binding.js +7 -56
- package/lib/dist/resolution/alias-binding.js.map +1 -1
- package/lib/dist/resolution/ambient-modules.d.ts +185 -0
- package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
- package/lib/dist/resolution/ambient-modules.js +732 -0
- package/lib/dist/resolution/ambient-modules.js.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts +48 -1
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
- package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
- package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
- package/lib/dist/resolution/c-feature-variants.js +249 -0
- package/lib/dist/resolution/c-feature-variants.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
- package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
- package/lib/dist/resolution/c-macro-renames.js +95 -0
- package/lib/dist/resolution/c-macro-renames.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +19 -5
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1395 -1343
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
- package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
- package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +0 -27
- package/lib/dist/resolution/cooperative-yield.js.map +1 -1
- package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
- package/lib/dist/resolution/cpp-constructor.js +15 -17
- package/lib/dist/resolution/cpp-constructor.js.map +1 -1
- package/lib/dist/resolution/cpp-includers.d.ts +46 -0
- package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-includers.js +153 -0
- package/lib/dist/resolution/cpp-includers.js.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
- package/lib/dist/resolution/cpp-macro-visibility.js +17 -68
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
- package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
- package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-namespaces.js +151 -0
- package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
- package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
- package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-raw-strings.js +167 -0
- package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
- package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
- package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-supertypes.js +322 -0
- package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
- package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
- package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
- package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
- package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
- package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-type-aliases.js +648 -0
- package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
- package/lib/dist/resolution/dart-libraries.d.ts +75 -0
- package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
- package/lib/dist/resolution/dart-libraries.js +721 -0
- package/lib/dist/resolution/dart-libraries.js.map +1 -0
- package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
- package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
- package/lib/dist/resolution/dart-local-scope.js +565 -0
- package/lib/dist/resolution/dart-local-scope.js.map +1 -0
- package/lib/dist/resolution/event-emitter-synthesizer.d.ts +39 -0
- package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
- package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
- package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/angular-router.js +41 -208
- package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
- package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/astro.js +4 -60
- package/lib/dist/resolution/frameworks/astro.js.map +1 -1
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
- package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/cics.js +7 -33
- package/lib/dist/resolution/frameworks/cics.js.map +1 -1
- package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
- package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
- package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
- package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
- package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/component-folder.js +11 -0
- package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +85 -102
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
- package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/drupal.js +377 -142
- package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
- package/lib/dist/resolution/frameworks/elysia.d.ts +38 -0
- package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/elysia.js +683 -0
- package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.js +9 -190
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/express.d.ts +48 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +193 -199
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.js +1 -104
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +14 -43
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/goframe.js +1 -55
- package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +14 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +16 -50
- 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 +203 -129
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.js +71 -136
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
- package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +2 -199
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
- package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
- package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.js +10 -66
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/object-literal.js +0 -21
- package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
- package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
- package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/package-deps.js +35 -26
- package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
- package/lib/dist/resolution/frameworks/page-component.js +0 -14
- package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/play.js +26 -34
- package/lib/dist/resolution/frameworks/play.js.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +5 -102
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.js +1 -166
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +13 -4
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.js +10 -82
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/react.d.ts +57 -0
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +1449 -191
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +1 -61
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/rust.js +35 -56
- package/lib/dist/resolution/frameworks/rust.js.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.js +7 -75
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
- package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
- package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +0 -97
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
- package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/terraform.js +1 -85
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.js +11 -134
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue.js +42 -114
- package/lib/dist/resolution/frameworks/vue.js.map +1 -1
- package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
- package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
- package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
- package/lib/dist/resolution/go-module.d.ts +23 -7
- package/lib/dist/resolution/go-module.d.ts.map +1 -1
- package/lib/dist/resolution/go-module.js +21 -24
- package/lib/dist/resolution/go-module.js.map +1 -1
- package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
- package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
- package/lib/dist/resolution/go-stdlib-methods.js +224 -0
- package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.js +2 -53
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +278 -29
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +1825 -1396
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +517 -6
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +1604 -1042
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +23 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
- package/lib/dist/resolution/js-builtins.js +34 -14
- package/lib/dist/resolution/js-builtins.js.map +1 -1
- package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
- package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
- package/lib/dist/resolution/js-class-expressions.js +25 -0
- package/lib/dist/resolution/js-class-expressions.js.map +1 -0
- package/lib/dist/resolution/js-super-calls.d.ts +18 -0
- package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
- package/lib/dist/resolution/js-super-calls.js +94 -0
- package/lib/dist/resolution/js-super-calls.js.map +1 -0
- package/lib/dist/resolution/jsx-code.d.ts +28 -0
- package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
- package/lib/dist/resolution/jsx-code.js +459 -0
- package/lib/dist/resolution/jsx-code.js.map +1 -0
- package/lib/dist/resolution/lru-cache.d.ts +5 -13
- package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
- package/lib/dist/resolution/lru-cache.js +43 -32
- package/lib/dist/resolution/lru-cache.js.map +1 -1
- package/lib/dist/resolution/memory-budget.js +0 -52
- package/lib/dist/resolution/memory-budget.js.map +1 -1
- package/lib/dist/resolution/module-importers.d.ts +210 -0
- package/lib/dist/resolution/module-importers.d.ts.map +1 -0
- package/lib/dist/resolution/module-importers.js +673 -0
- package/lib/dist/resolution/module-importers.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +986 -7
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +24176 -6745
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
- package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.js +46 -28
- package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/override-parameters.d.ts +40 -0
- package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/override-parameters.js +339 -0
- package/lib/dist/resolution/override-parameters.js.map +1 -0
- package/lib/dist/resolution/parameter-flow.d.ts +218 -0
- package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
- package/lib/dist/resolution/parameter-flow.js +474 -0
- package/lib/dist/resolution/parameter-flow.js.map +1 -0
- package/lib/dist/resolution/pascal-scope.d.ts +91 -0
- package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
- package/lib/dist/resolution/pascal-scope.js +961 -0
- package/lib/dist/resolution/pascal-scope.js.map +1 -0
- package/lib/dist/resolution/path-aliases.d.ts +32 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +43 -110
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/resolution/php-web-root.d.ts +39 -0
- package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
- package/lib/dist/resolution/php-web-root.js +141 -0
- package/lib/dist/resolution/php-web-root.js.map +1 -0
- package/lib/dist/resolution/project-scans.d.ts +38 -0
- package/lib/dist/resolution/project-scans.d.ts.map +1 -0
- package/lib/dist/resolution/project-scans.js +30 -0
- package/lib/dist/resolution/project-scans.js.map +1 -0
- package/lib/dist/resolution/python-overloads.d.ts +10 -0
- package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
- package/lib/dist/resolution/python-overloads.js +75 -0
- package/lib/dist/resolution/python-overloads.js.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.js +3 -55
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +23 -2
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +43 -111
- package/lib/dist/resolution/resolver-pool.js.map +1 -1
- package/lib/dist/resolution/resolver-worker.d.ts +1 -1
- package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-worker.js +8 -37
- package/lib/dist/resolution/resolver-worker.js.map +1 -1
- package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
- package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
- package/lib/dist/resolution/resurrect-ref.js +19 -0
- package/lib/dist/resolution/resurrect-ref.js.map +1 -0
- package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
- package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
- package/lib/dist/resolution/ruby-constant-paths.js +255 -0
- package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
- package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
- package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
- package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
- package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
- package/lib/dist/resolution/rust-scopes.d.ts +120 -0
- package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
- package/lib/dist/resolution/rust-scopes.js +730 -0
- package/lib/dist/resolution/rust-scopes.js.map +1 -0
- package/lib/dist/resolution/shopify-themes.d.ts +10 -0
- package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
- package/lib/dist/resolution/shopify-themes.js +19 -0
- package/lib/dist/resolution/shopify-themes.js.map +1 -0
- package/lib/dist/resolution/strip-comments.d.ts +20 -1
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +164 -119
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
- package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
- package/lib/dist/resolution/swift-objc-bridge.js +0 -160
- package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
- package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
- package/lib/dist/resolution/swift-type-visibility.js +62 -104
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
- package/lib/dist/resolution/synth-utils.js +1 -22
- package/lib/dist/resolution/synth-utils.js.map +1 -1
- package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
- package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
- package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
- package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.js +35 -177
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
- package/lib/dist/resolution/type-parameters.d.ts +23 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
- package/lib/dist/resolution/type-parameters.js +52 -54
- package/lib/dist/resolution/type-parameters.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +192 -11
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js +0 -47
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
- package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
- package/lib/dist/resolution/vbnet-receivers.js +1482 -0
- package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
- package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
- package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts +206 -15
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +573 -152
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/dist/search/identifier-segments.js +2 -93
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-parser.js +0 -54
- package/lib/dist/search/query-parser.js.map +1 -1
- package/lib/dist/search/query-paths.js +0 -167
- package/lib/dist/search/query-paths.js.map +1 -1
- package/lib/dist/search/query-utils.d.ts +44 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +120 -198
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/git-hooks.d.ts +14 -5
- package/lib/dist/sync/git-hooks.d.ts.map +1 -1
- package/lib/dist/sync/git-hooks.js +118 -65
- package/lib/dist/sync/git-hooks.js.map +1 -1
- package/lib/dist/sync/index.js +0 -14
- package/lib/dist/sync/index.js.map +1 -1
- package/lib/dist/sync/watch-policy.js +0 -45
- package/lib/dist/sync/watch-policy.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +29 -11
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +83 -487
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +7 -2
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +24 -97
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +15 -135
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +46 -0
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +15 -44
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui/color.js +0 -19
- package/lib/dist/ui/color.js.map +1 -1
- package/lib/dist/ui/glyphs.js +2 -45
- package/lib/dist/ui/glyphs.js.map +1 -1
- package/lib/dist/ui/shimmer-progress.js +0 -21
- package/lib/dist/ui/shimmer-progress.js.map +1 -1
- package/lib/dist/ui/shimmer-worker.js +0 -22
- package/lib/dist/ui/shimmer-worker.js.map +1 -1
- package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
- package/lib/dist/ui-server/api/deadcode.js +2 -31
- package/lib/dist/ui-server/api/deadcode.js.map +1 -1
- package/lib/dist/ui-server/api/effects.js +0 -111
- package/lib/dist/ui-server/api/effects.js.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.js +0 -142
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
- package/lib/dist/ui-server/api/events.js +0 -145
- package/lib/dist/ui-server/api/events.js.map +1 -1
- package/lib/dist/ui-server/api/file.js +0 -80
- package/lib/dist/ui-server/api/file.js.map +1 -1
- package/lib/dist/ui-server/api/filecode.js +0 -95
- package/lib/dist/ui-server/api/filecode.js.map +1 -1
- package/lib/dist/ui-server/api/flow.js +0 -149
- package/lib/dist/ui-server/api/flow.js.map +1 -1
- package/lib/dist/ui-server/api/hierarchy.js +0 -28
- package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
- package/lib/dist/ui-server/api/index.js +0 -88
- package/lib/dist/ui-server/api/index.js.map +1 -1
- package/lib/dist/ui-server/api/map.d.ts.map +1 -1
- package/lib/dist/ui-server/api/map.js +4 -317
- package/lib/dist/ui-server/api/map.js.map +1 -1
- package/lib/dist/ui-server/api/node.js +0 -111
- package/lib/dist/ui-server/api/node.js.map +1 -1
- package/lib/dist/ui-server/api/nodes.js +0 -16
- package/lib/dist/ui-server/api/nodes.js.map +1 -1
- package/lib/dist/ui-server/api/program.js +0 -90
- package/lib/dist/ui-server/api/program.js.map +1 -1
- package/lib/dist/ui-server/api/respond.js +0 -60
- package/lib/dist/ui-server/api/respond.js.map +1 -1
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
- package/lib/dist/ui-server/api/route-roots.js +2 -44
- package/lib/dist/ui-server/api/route-roots.js.map +1 -1
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
- package/lib/dist/ui-server/api/routes.js +4 -60
- package/lib/dist/ui-server/api/routes.js.map +1 -1
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
- package/lib/dist/ui-server/api/screens.js +4 -174
- package/lib/dist/ui-server/api/screens.js.map +1 -1
- package/lib/dist/ui-server/api/search.js +0 -62
- package/lib/dist/ui-server/api/search.js.map +1 -1
- package/lib/dist/ui-server/api/session.js +0 -58
- package/lib/dist/ui-server/api/session.js.map +1 -1
- package/lib/dist/ui-server/api/source.d.ts.map +1 -1
- package/lib/dist/ui-server/api/source.js +0 -161
- package/lib/dist/ui-server/api/source.js.map +1 -1
- package/lib/dist/ui-server/api/stats.js +0 -58
- package/lib/dist/ui-server/api/stats.js.map +1 -1
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
- package/lib/dist/ui-server/api/steps.js +5 -381
- package/lib/dist/ui-server/api/steps.js.map +1 -1
- package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
- package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
- package/lib/dist/ui-server/api/trail-store.js +24 -106
- package/lib/dist/ui-server/api/trail-store.js.map +1 -1
- package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
- package/lib/dist/ui-server/api/trails.js +19 -94
- package/lib/dist/ui-server/api/trails.js.map +1 -1
- package/lib/dist/ui-server/api/when.js +0 -36
- package/lib/dist/ui-server/api/when.js.map +1 -1
- package/lib/dist/ui-server/api/wire.js +0 -58
- package/lib/dist/ui-server/api/wire.js.map +1 -1
- package/lib/dist/ui-server/assets.js +0 -35
- package/lib/dist/ui-server/assets.js.map +1 -1
- package/lib/dist/ui-server/constants.js +0 -26
- package/lib/dist/ui-server/constants.js.map +1 -1
- package/lib/dist/ui-server/highlight/bounded-tokenize.js +0 -25
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
- package/lib/dist/ui-server/highlight/index.js +1 -132
- package/lib/dist/ui-server/highlight/index.js.map +1 -1
- package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
- package/lib/dist/ui-server/highlight/languages.js +0 -31
- package/lib/dist/ui-server/highlight/languages.js.map +1 -1
- package/lib/dist/ui-server/highlight/tokenize-worker.js +0 -5
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
- package/lib/dist/ui-server/index.d.ts +25 -0
- package/lib/dist/ui-server/index.d.ts.map +1 -1
- package/lib/dist/ui-server/index.js +35 -103
- package/lib/dist/ui-server/index.js.map +1 -1
- package/lib/dist/ui-server/open-browser.js +0 -34
- package/lib/dist/ui-server/open-browser.js.map +1 -1
- package/lib/dist/ui-server/security.d.ts +5 -0
- package/lib/dist/ui-server/security.d.ts.map +1 -1
- package/lib/dist/ui-server/security.js +11 -147
- package/lib/dist/ui-server/security.js.map +1 -1
- package/lib/dist/ui-server/static.js +0 -41
- package/lib/dist/ui-server/static.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +18 -5
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +73 -229
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/upgrade/remove-binary.js +2 -67
- package/lib/dist/upgrade/remove-binary.js.map +1 -1
- package/lib/dist/upgrade/update-check.js +1 -81
- package/lib/dist/upgrade/update-check.js.map +1 -1
- package/lib/dist/utils.d.ts +69 -1
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +224 -266
- package/lib/dist/utils.js.map +1 -1
- package/lib/dist/worker-teardown.js +0 -47
- package/lib/dist/worker-teardown.js.map +1 -1
- package/lib/kernel/codegraph-kernel.node +2 -2
- package/lib/node_modules/.package-lock.json +4 -4
- package/lib/node_modules/ignore/README.md +138 -8
- package/lib/node_modules/ignore/index.d.ts +56 -20
- package/lib/node_modules/ignore/index.js +1033 -221
- package/lib/node_modules/ignore/legacy.js +871 -178
- package/lib/node_modules/ignore/package.json +10 -4
- package/lib/package.json +14 -8
- package/node.exe +2 -2
- package/package.json +1 -1
package/lib/dist/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CodeGraph
|
|
4
|
-
*
|
|
5
|
-
* A local-first code intelligence system that builds a semantic
|
|
6
|
-
* knowledge graph from any codebase.
|
|
7
|
-
*/
|
|
8
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
3
|
if (k2 === undefined) k2 = k;
|
|
10
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -45,20 +39,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
40
|
};
|
|
47
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.CodeGraph = exports.MCPServer = exports.
|
|
42
|
+
exports.CodeGraph = exports.MCPServer = exports.FileWatcher = exports.MemoryMonitor = exports.throttle = exports.debounce = exports.processInBatches = exports.FileLock = exports.Mutex = exports.LockUnavailableError = exports.defaultLogger = exports.silentLogger = exports.getLogger = exports.setLogger = exports.ConfigError = exports.VectorError = exports.SearchError = exports.DatabaseError = exports.ParseError = exports.FileError = exports.CodeGraphError = exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.detectLanguage = exports.CODEGRAPH_DIR = exports.findNearestCodeGraphRoot = exports.isInitialized = exports.getCodeGraphDir = exports.QueryBuilder = exports.DatabaseConnection = exports.getDatabasePath = void 0;
|
|
43
|
+
exports.parseSynthMinIntervalEnv = parseSynthMinIntervalEnv;
|
|
49
44
|
const fs = __importStar(require("fs"));
|
|
50
45
|
const path = __importStar(require("path"));
|
|
51
46
|
const db_1 = require("./db");
|
|
52
47
|
const wal_valve_1 = require("./db/wal-valve");
|
|
48
|
+
const errors_1 = require("./errors");
|
|
53
49
|
const queries_1 = require("./db/queries");
|
|
50
|
+
const reference_tail_1 = require("./db/reference-tail");
|
|
54
51
|
const directory_1 = require("./directory");
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const callback_synthesizer_1 = require("./resolution/callback-synthesizer");
|
|
52
|
+
const grammars_1 = require("./extraction/grammars");
|
|
53
|
+
const lazy_engine_1 = require("./lazy-engine");
|
|
58
54
|
const graph_1 = require("./graph");
|
|
55
|
+
const cobol_copybooks_1 = require("./graph/cobol-copybooks");
|
|
59
56
|
const context_1 = require("./context");
|
|
60
57
|
const utils_1 = require("./utils");
|
|
61
|
-
const
|
|
58
|
+
const errors_2 = require("./errors");
|
|
62
59
|
const extraction_version_1 = require("./extraction/extraction-version");
|
|
63
60
|
const directory_2 = require("./directory");
|
|
64
61
|
const query_utils_1 = require("./search/query-utils");
|
|
@@ -68,12 +65,7 @@ const version_1 = require("./mcp/version");
|
|
|
68
65
|
const identifier_segments_1 = require("./search/identifier-segments");
|
|
69
66
|
const cooperative_yield_1 = require("./resolution/cooperative-yield");
|
|
70
67
|
const resolver_pool_1 = require("./resolution/resolver-pool");
|
|
71
|
-
// Re-export types for consumers
|
|
72
68
|
__exportStar(require("./types"), exports);
|
|
73
|
-
// Storage building blocks for embedded/SDK consumers that drive the graph
|
|
74
|
-
// directly (open a DB, run prepared queries) rather than through the CodeGraph
|
|
75
|
-
// facade. Exposed from the package entry so they no longer require deep imports
|
|
76
|
-
// into dist/ (issue #354).
|
|
77
69
|
var db_2 = require("./db");
|
|
78
70
|
Object.defineProperty(exports, "getDatabasePath", { enumerable: true, get: function () { return db_2.getDatabasePath; } });
|
|
79
71
|
Object.defineProperty(exports, "DatabaseConnection", { enumerable: true, get: function () { return db_2.DatabaseConnection; } });
|
|
@@ -84,26 +76,27 @@ Object.defineProperty(exports, "getCodeGraphDir", { enumerable: true, get: funct
|
|
|
84
76
|
Object.defineProperty(exports, "isInitialized", { enumerable: true, get: function () { return directory_3.isInitialized; } });
|
|
85
77
|
Object.defineProperty(exports, "findNearestCodeGraphRoot", { enumerable: true, get: function () { return directory_3.findNearestCodeGraphRoot; } });
|
|
86
78
|
Object.defineProperty(exports, "CODEGRAPH_DIR", { enumerable: true, get: function () { return directory_3.CODEGRAPH_DIR; } });
|
|
87
|
-
var
|
|
88
|
-
Object.defineProperty(exports, "detectLanguage", { enumerable: true, get: function () { return
|
|
89
|
-
Object.defineProperty(exports, "isLanguageSupported", { enumerable: true, get: function () { return
|
|
90
|
-
Object.defineProperty(exports, "isGrammarLoaded", { enumerable: true, get: function () { return
|
|
91
|
-
Object.defineProperty(exports, "getSupportedLanguages", { enumerable: true, get: function () { return
|
|
92
|
-
Object.defineProperty(exports, "initGrammars", { enumerable: true, get: function () { return
|
|
93
|
-
Object.defineProperty(exports, "loadGrammarsForLanguages", { enumerable: true, get: function () { return
|
|
94
|
-
Object.defineProperty(exports, "loadAllGrammars", { enumerable: true, get: function () { return
|
|
95
|
-
var
|
|
96
|
-
Object.defineProperty(exports, "CodeGraphError", { enumerable: true, get: function () { return
|
|
97
|
-
Object.defineProperty(exports, "FileError", { enumerable: true, get: function () { return
|
|
98
|
-
Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return
|
|
99
|
-
Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function () { return
|
|
100
|
-
Object.defineProperty(exports, "SearchError", { enumerable: true, get: function () { return
|
|
101
|
-
Object.defineProperty(exports, "VectorError", { enumerable: true, get: function () { return
|
|
102
|
-
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return
|
|
103
|
-
Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return
|
|
104
|
-
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return
|
|
105
|
-
Object.defineProperty(exports, "silentLogger", { enumerable: true, get: function () { return
|
|
106
|
-
Object.defineProperty(exports, "defaultLogger", { enumerable: true, get: function () { return
|
|
79
|
+
var grammars_2 = require("./extraction/grammars");
|
|
80
|
+
Object.defineProperty(exports, "detectLanguage", { enumerable: true, get: function () { return grammars_2.detectLanguage; } });
|
|
81
|
+
Object.defineProperty(exports, "isLanguageSupported", { enumerable: true, get: function () { return grammars_2.isLanguageSupported; } });
|
|
82
|
+
Object.defineProperty(exports, "isGrammarLoaded", { enumerable: true, get: function () { return grammars_2.isGrammarLoaded; } });
|
|
83
|
+
Object.defineProperty(exports, "getSupportedLanguages", { enumerable: true, get: function () { return grammars_2.getSupportedLanguages; } });
|
|
84
|
+
Object.defineProperty(exports, "initGrammars", { enumerable: true, get: function () { return grammars_2.initGrammars; } });
|
|
85
|
+
Object.defineProperty(exports, "loadGrammarsForLanguages", { enumerable: true, get: function () { return grammars_2.loadGrammarsForLanguages; } });
|
|
86
|
+
Object.defineProperty(exports, "loadAllGrammars", { enumerable: true, get: function () { return grammars_2.loadAllGrammars; } });
|
|
87
|
+
var errors_3 = require("./errors");
|
|
88
|
+
Object.defineProperty(exports, "CodeGraphError", { enumerable: true, get: function () { return errors_3.CodeGraphError; } });
|
|
89
|
+
Object.defineProperty(exports, "FileError", { enumerable: true, get: function () { return errors_3.FileError; } });
|
|
90
|
+
Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return errors_3.ParseError; } });
|
|
91
|
+
Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function () { return errors_3.DatabaseError; } });
|
|
92
|
+
Object.defineProperty(exports, "SearchError", { enumerable: true, get: function () { return errors_3.SearchError; } });
|
|
93
|
+
Object.defineProperty(exports, "VectorError", { enumerable: true, get: function () { return errors_3.VectorError; } });
|
|
94
|
+
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return errors_3.ConfigError; } });
|
|
95
|
+
Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return errors_3.setLogger; } });
|
|
96
|
+
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return errors_3.getLogger; } });
|
|
97
|
+
Object.defineProperty(exports, "silentLogger", { enumerable: true, get: function () { return errors_3.silentLogger; } });
|
|
98
|
+
Object.defineProperty(exports, "defaultLogger", { enumerable: true, get: function () { return errors_3.defaultLogger; } });
|
|
99
|
+
Object.defineProperty(exports, "LockUnavailableError", { enumerable: true, get: function () { return errors_3.LockUnavailableError; } });
|
|
107
100
|
var utils_2 = require("./utils");
|
|
108
101
|
Object.defineProperty(exports, "Mutex", { enumerable: true, get: function () { return utils_2.Mutex; } });
|
|
109
102
|
Object.defineProperty(exports, "FileLock", { enumerable: true, get: function () { return utils_2.FileLock; } });
|
|
@@ -111,34 +104,48 @@ Object.defineProperty(exports, "processInBatches", { enumerable: true, get: func
|
|
|
111
104
|
Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return utils_2.debounce; } });
|
|
112
105
|
Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return utils_2.throttle; } });
|
|
113
106
|
Object.defineProperty(exports, "MemoryMonitor", { enumerable: true, get: function () { return utils_2.MemoryMonitor; } });
|
|
114
|
-
var
|
|
115
|
-
Object.defineProperty(exports, "FileWatcher", { enumerable: true, get: function () { return
|
|
116
|
-
Object.defineProperty(exports, "
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
var lazy_engine_2 = require("./lazy-engine");
|
|
108
|
+
Object.defineProperty(exports, "FileWatcher", { enumerable: true, get: function () { return lazy_engine_2.FileWatcher; } });
|
|
109
|
+
Object.defineProperty(exports, "MCPServer", { enumerable: true, get: function () { return lazy_engine_2.MCPServer; } });
|
|
110
|
+
const PYTHON_ROOTS_METADATA_KEY = 'python_root_fingerprint';
|
|
111
|
+
const PHP_WEB_ROOTS_METADATA_KEY = 'php_web_roots';
|
|
112
|
+
const WORKSPACE_METADATA_KEY = 'js_workspace_fingerprint';
|
|
113
|
+
const WORKSPACE_MANIFESTS_METADATA_KEY = 'js_workspace_manifests';
|
|
114
|
+
const MODULE_CONFIG_METADATA_KEY = 'module_config_snapshot';
|
|
115
|
+
const FRAMEWORKS_AT_INDEX_KEY = 'frameworks_at_index';
|
|
116
|
+
const FRAMEWORKS_SINCE_INDEX_KEY = 'frameworks_since_index';
|
|
117
|
+
const RESOLVER_FRAMEWORKS_AT_INDEX_KEY = 'resolver_frameworks_at_index';
|
|
118
|
+
function parseNameList(value) {
|
|
119
|
+
if (!value)
|
|
120
|
+
return null;
|
|
121
|
+
try {
|
|
122
|
+
const parsed = JSON.parse(value);
|
|
123
|
+
return Array.isArray(parsed) && parsed.every((n) => typeof n === 'string') ? parsed : null;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function parseSynthMinIntervalEnv(raw) {
|
|
130
|
+
if (!raw || !raw.trim())
|
|
131
|
+
return undefined;
|
|
132
|
+
const n = Number(raw);
|
|
133
|
+
if (!Number.isInteger(n) || n < 1000 || n > 86_400_000)
|
|
134
|
+
return undefined;
|
|
135
|
+
return n;
|
|
136
|
+
}
|
|
124
137
|
class CodeGraph {
|
|
125
138
|
db;
|
|
126
139
|
queries;
|
|
127
140
|
projectRoot;
|
|
128
|
-
// Assigned via wireLayers() from the constructor (and again on reopen) — the
|
|
129
|
-
// `!` tells TS these are definitely set even though the assignment is one
|
|
130
|
-
// method call away from the constructor body.
|
|
131
|
-
orchestrator;
|
|
132
|
-
resolver;
|
|
133
141
|
graphManager;
|
|
134
142
|
traverser;
|
|
135
143
|
contextBuilder;
|
|
136
|
-
// Mutex for preventing concurrent indexing operations (in-process)
|
|
137
144
|
indexMutex = new utils_1.Mutex();
|
|
138
|
-
// File lock for preventing concurrent writes across processes (CLI, MCP, git hooks)
|
|
139
145
|
fileLock;
|
|
140
|
-
// File watcher for auto-sync on file changes
|
|
141
146
|
watcher = null;
|
|
147
|
+
lastSynthesisAt = 0;
|
|
148
|
+
deferredSynthesisTimer = null;
|
|
142
149
|
constructor(db, queries, projectRoot) {
|
|
143
150
|
this.db = db;
|
|
144
151
|
this.queries = queries;
|
|
@@ -146,71 +153,85 @@ class CodeGraph {
|
|
|
146
153
|
this.fileLock = new utils_1.FileLock(path.join((0, directory_2.getCodeGraphDir)(projectRoot), 'codegraph.lock'));
|
|
147
154
|
this.wireLayers();
|
|
148
155
|
}
|
|
149
|
-
/**
|
|
150
|
-
* (Re)build the query/extraction/graph layers over the current `this.queries`
|
|
151
|
-
* (which wraps `this.db`). Factored out of the constructor so `reopenIfReplaced`
|
|
152
|
-
* can rebuild them against a fresh connection without duplicating the wiring.
|
|
153
|
-
* The path-based `fileLock` is independent of the DB handle, so it stays put.
|
|
154
|
-
*/
|
|
155
156
|
wireLayers() {
|
|
156
|
-
// Down-weight the project name as a query term in search ranking — it names
|
|
157
|
-
// the whole repo, not a symbol, so it has no discriminative value (#720).
|
|
158
157
|
try {
|
|
159
158
|
this.queries.setProjectNameTokens((0, query_utils_1.deriveProjectNameTokens)(this.projectRoot));
|
|
160
159
|
}
|
|
161
160
|
catch {
|
|
162
|
-
// Best-effort: ranking still works without it.
|
|
163
161
|
}
|
|
164
|
-
// Down-weight the peripheral trees the project named in `codegraph.json`
|
|
165
|
-
// `deprioritize` — indexed and findable, but never outranking real code
|
|
166
|
-
// (#982). Ranking-only, so a bad pattern costs relevance, never recall.
|
|
167
|
-
//
|
|
168
|
-
// Read LAZILY, not once here: `wireLayers` runs from the constructor and
|
|
169
|
-
// from `reopenIfReplaced`, so a matcher built here would freeze at whatever
|
|
170
|
-
// the config said when the project opened. The MCP server caches one
|
|
171
|
-
// CodeGraph per root for its whole lifetime, so editing `codegraph.json`
|
|
172
|
-
// would appear to do nothing until the process restarted — `exclude` and
|
|
173
|
-
// `include` do not behave that way. `loadDeprioritizePatterns` is
|
|
174
|
-
// mtime-cached, so this costs one `stat`; the compiled matcher is memoized
|
|
175
|
-
// on the pattern array's identity, which the cache keeps stable.
|
|
176
162
|
let cachedPatterns;
|
|
177
163
|
let cachedMatcher;
|
|
178
|
-
|
|
164
|
+
const currentMatcher = () => {
|
|
165
|
+
const patterns = (0, project_config_1.loadDeprioritizePatterns)(this.projectRoot);
|
|
166
|
+
if (patterns.length === 0)
|
|
167
|
+
return null;
|
|
168
|
+
if (patterns !== cachedPatterns) {
|
|
169
|
+
cachedPatterns = patterns;
|
|
170
|
+
cachedMatcher = (0, ignore_1.default)().add(patterns);
|
|
171
|
+
}
|
|
172
|
+
return cachedMatcher;
|
|
173
|
+
};
|
|
174
|
+
const matches = (matcher, filePath) => {
|
|
175
|
+
if (!matcher)
|
|
176
|
+
return false;
|
|
177
|
+
const rel = path.isAbsolute(filePath)
|
|
178
|
+
? path.relative(this.projectRoot, filePath)
|
|
179
|
+
: filePath;
|
|
180
|
+
if (!rel || (0, utils_1.escapesRoot)(rel))
|
|
181
|
+
return false;
|
|
182
|
+
return matcher.ignores(rel.split(path.sep).join('/'));
|
|
183
|
+
};
|
|
184
|
+
const deprioritized = (filePath) => {
|
|
179
185
|
try {
|
|
180
|
-
|
|
181
|
-
if (patterns.length === 0)
|
|
182
|
-
return false;
|
|
183
|
-
if (patterns !== cachedPatterns) {
|
|
184
|
-
cachedPatterns = patterns;
|
|
185
|
-
cachedMatcher = (0, ignore_1.default)().add(patterns);
|
|
186
|
-
}
|
|
187
|
-
const rel = path.isAbsolute(filePath)
|
|
188
|
-
? path.relative(this.projectRoot, filePath)
|
|
189
|
-
: filePath;
|
|
190
|
-
if (!rel || rel.startsWith('..'))
|
|
191
|
-
return false;
|
|
192
|
-
return cachedMatcher.ignores(rel.split(path.sep).join('/'));
|
|
186
|
+
return matches(currentMatcher(), filePath);
|
|
193
187
|
}
|
|
194
188
|
catch {
|
|
195
|
-
// Ranking must never take the search down with it.
|
|
196
189
|
return false;
|
|
197
190
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
};
|
|
192
|
+
deprioritized.snapshot = () => {
|
|
193
|
+
let matcher = null;
|
|
194
|
+
try {
|
|
195
|
+
matcher = currentMatcher();
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
matcher = null;
|
|
199
|
+
}
|
|
200
|
+
return (filePath) => {
|
|
201
|
+
try {
|
|
202
|
+
return matches(matcher, filePath);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
this.queries.setDeprioritizedPathMatcher(deprioritized);
|
|
210
|
+
this.builtOrchestrator = null;
|
|
211
|
+
this.builtResolver = null;
|
|
212
|
+
if (!this.db.readOnly) {
|
|
213
|
+
void this.orchestrator;
|
|
214
|
+
void this.resolver;
|
|
215
|
+
}
|
|
201
216
|
this.graphManager = new graph_1.GraphQueryManager(this.queries);
|
|
202
217
|
this.traverser = new graph_1.GraphTraverser(this.queries);
|
|
203
218
|
this.contextBuilder = (0, context_1.createContextBuilder)(this.projectRoot, this.queries, this.traverser);
|
|
204
219
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
220
|
+
builtOrchestrator = null;
|
|
221
|
+
builtResolver = null;
|
|
222
|
+
get orchestrator() {
|
|
223
|
+
if (!this.builtOrchestrator) {
|
|
224
|
+
this.builtOrchestrator = new ((0, lazy_engine_1.engine)().ExtractionOrchestrator)(this.projectRoot, this.queries);
|
|
225
|
+
if (this.watcher)
|
|
226
|
+
this.builtOrchestrator.setKeepDetectionContents(true);
|
|
227
|
+
}
|
|
228
|
+
return this.builtOrchestrator;
|
|
229
|
+
}
|
|
230
|
+
get resolver() {
|
|
231
|
+
return (this.builtResolver ??= (0, lazy_engine_1.engine)().createResolver(this.projectRoot, this.queries));
|
|
232
|
+
}
|
|
210
233
|
pendingFullReconcile = false;
|
|
211
|
-
/** How long a recreated, not-yet-indexed database is treated as a rebuild in progress. */
|
|
212
234
|
static RECREATE_GRACE_MS = 120_000;
|
|
213
|
-
/** The database file at the path was written within the recreate grace window. */
|
|
214
235
|
isFreshlyRecreated() {
|
|
215
236
|
try {
|
|
216
237
|
return Date.now() - fs.statSync((0, db_1.getDatabasePath)(this.projectRoot)).mtimeMs < CodeGraph.RECREATE_GRACE_MS;
|
|
@@ -219,128 +240,75 @@ class CodeGraph {
|
|
|
219
240
|
return false;
|
|
220
241
|
}
|
|
221
242
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Heal a stale database handle in place. If `.codegraph/` was removed and
|
|
224
|
-
* recreated at the SAME path while this instance held the DB open — a git
|
|
225
|
-
* worktree removed and re-added, or `rm -rf .codegraph` + `codegraph init` —
|
|
226
|
-
* our open fd points at the now-unlinked inode and can never see the new
|
|
227
|
-
* index, so every query returns the pre-removal snapshot until the process
|
|
228
|
-
* restarts (#925). When that's detected, open the live file at the same path,
|
|
229
|
-
* rebuild the query layers, and swap them IN PLACE, so every holder of this
|
|
230
|
-
* instance (the MCP daemon's default project, cached projectPath connections)
|
|
231
|
-
* heals without a restart. Returns true iff it reopened.
|
|
232
|
-
*
|
|
233
|
-
* POSIX-only in practice: `isReplacedOnDisk` never fires on Windows (an open
|
|
234
|
-
* file can't be unlinked there, and st_ino is unreliable).
|
|
235
|
-
*
|
|
236
|
-
* Refuses (returns false) while an index/sync holds the index mutex: closing
|
|
237
|
-
* the handle that run is writing through would break it mid-flight. `sync()`
|
|
238
|
-
* performs the same check itself once it holds the mutex (#1902), so the
|
|
239
|
-
* replaced file is still picked up — by that sync, or by the caller's retry.
|
|
240
|
-
*/
|
|
241
243
|
reopenIfReplaced() {
|
|
242
244
|
if (this.indexMutex.isLocked())
|
|
243
245
|
return false;
|
|
244
246
|
return this.reopenReplacedDatabase();
|
|
245
247
|
}
|
|
246
|
-
/** The body of {@link reopenIfReplaced}, without the in-flight-sync guard. */
|
|
247
248
|
reopenReplacedDatabase() {
|
|
248
249
|
if (!this.db.isReplacedOnDisk())
|
|
249
250
|
return false;
|
|
250
251
|
const dbPath = this.db.getPath();
|
|
251
|
-
// Open the live file FIRST — if that throws (e.g. mid-recreate), the old
|
|
252
|
-
// handle stays in place and the caller retries on the next query, rather
|
|
253
|
-
// than leaving this instance with no connection at all.
|
|
254
252
|
const fresh = db_1.DatabaseConnection.open(dbPath, { readOnly: this.db.readOnly });
|
|
255
253
|
const stale = this.db;
|
|
256
254
|
this.db = fresh;
|
|
257
255
|
this.queries = new queries_1.QueryBuilder(fresh.getDb());
|
|
258
256
|
this.wireLayers();
|
|
259
|
-
// Whoever reopened — a sync, or a tool call's self-heal — the next sync
|
|
260
|
-
// must reconcile the whole tree (#1902).
|
|
261
257
|
this.pendingFullReconcile = true;
|
|
262
|
-
// Releasing the dead handle also frees the leaked db/-wal/-shm fds that were
|
|
263
|
-
// pinning the unlinked inode (#925).
|
|
264
258
|
try {
|
|
265
259
|
stale.close();
|
|
266
260
|
}
|
|
267
|
-
catch {
|
|
261
|
+
catch { }
|
|
268
262
|
return true;
|
|
269
263
|
}
|
|
270
|
-
// ===========================================================================
|
|
271
|
-
// Lifecycle Methods
|
|
272
|
-
// ===========================================================================
|
|
273
|
-
/**
|
|
274
|
-
* Initialize a new CodeGraph project
|
|
275
|
-
*
|
|
276
|
-
* Creates the .CodeGraph directory, database, and configuration.
|
|
277
|
-
*
|
|
278
|
-
* @param projectRoot - Path to the project root directory
|
|
279
|
-
* @param options - Initialization options
|
|
280
|
-
* @returns A new CodeGraph instance
|
|
281
|
-
*/
|
|
282
264
|
static async init(projectRoot, options = {}) {
|
|
283
|
-
await (0,
|
|
265
|
+
await (0, grammars_1.initGrammars)();
|
|
284
266
|
const resolvedRoot = path.resolve(projectRoot);
|
|
285
|
-
// Check if already initialized
|
|
286
267
|
if ((0, directory_1.isInitialized)(resolvedRoot)) {
|
|
287
268
|
throw new Error(`CodeGraph already initialized in ${resolvedRoot}`);
|
|
288
269
|
}
|
|
289
|
-
// Create directory structure
|
|
290
270
|
(0, directory_1.createDirectory)(resolvedRoot);
|
|
291
|
-
// Initialize database
|
|
292
271
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
293
272
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
294
273
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
295
274
|
const instance = new CodeGraph(db, queries, resolvedRoot);
|
|
296
|
-
// Run initial indexing if requested
|
|
297
275
|
if (options.index) {
|
|
298
276
|
await instance.indexAll({ onProgress: options.onProgress });
|
|
299
277
|
}
|
|
300
278
|
return instance;
|
|
301
279
|
}
|
|
302
|
-
/**
|
|
303
|
-
* Initialize synchronously (without indexing)
|
|
304
|
-
*/
|
|
305
280
|
static initSync(projectRoot) {
|
|
306
281
|
const resolvedRoot = path.resolve(projectRoot);
|
|
307
|
-
// Check if already initialized
|
|
308
282
|
if ((0, directory_1.isInitialized)(resolvedRoot)) {
|
|
309
283
|
throw new Error(`CodeGraph already initialized in ${resolvedRoot}`);
|
|
310
284
|
}
|
|
311
|
-
// Create directory structure
|
|
312
285
|
(0, directory_1.createDirectory)(resolvedRoot);
|
|
313
|
-
// Initialize database
|
|
314
286
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
315
287
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
316
288
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
317
289
|
return new CodeGraph(db, queries, resolvedRoot);
|
|
318
290
|
}
|
|
319
|
-
/**
|
|
320
|
-
* Open an existing CodeGraph project
|
|
321
|
-
*
|
|
322
|
-
* @param projectRoot - Path to the project root directory
|
|
323
|
-
* @param options - Open options
|
|
324
|
-
* @returns A CodeGraph instance
|
|
325
|
-
*/
|
|
326
291
|
static async open(projectRoot, options = {}) {
|
|
327
|
-
await (0,
|
|
292
|
+
await (0, grammars_1.initGrammars)();
|
|
328
293
|
const resolvedRoot = path.resolve(projectRoot);
|
|
329
|
-
// Check if initialized
|
|
330
294
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
331
295
|
throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
|
|
332
296
|
}
|
|
333
|
-
// Validate directory structure
|
|
334
297
|
const validation = (0, directory_1.validateDirectory)(resolvedRoot);
|
|
335
298
|
if (!validation.valid) {
|
|
336
299
|
throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
|
|
337
300
|
}
|
|
338
|
-
// Open database
|
|
339
301
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
340
|
-
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly });
|
|
302
|
+
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly, deferIndexRecovery: true });
|
|
303
|
+
try {
|
|
304
|
+
await db.recoverIndexesOffThread();
|
|
305
|
+
}
|
|
306
|
+
catch (err) {
|
|
307
|
+
db.close();
|
|
308
|
+
throw err;
|
|
309
|
+
}
|
|
341
310
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
342
311
|
const instance = new CodeGraph(db, queries, resolvedRoot);
|
|
343
|
-
// Sync if requested
|
|
344
312
|
if (options.sync && !options.readOnly) {
|
|
345
313
|
try {
|
|
346
314
|
await instance.sync();
|
|
@@ -352,27 +320,9 @@ class CodeGraph {
|
|
|
352
320
|
}
|
|
353
321
|
return instance;
|
|
354
322
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Rebuild the project's database from scratch and return a fresh, empty
|
|
357
|
-
* instance — the "same result as a fresh init" semantics that `codegraph
|
|
358
|
-
* index` documents.
|
|
359
|
-
*
|
|
360
|
-
* Unlike `open()` followed by `clear()`, this DISCARDS the existing
|
|
361
|
-
* `.codegraph/codegraph.db` (and its `-wal`/`-shm` sidecars) before
|
|
362
|
-
* re-initializing, instead of opening the old database and DELETE-ing every
|
|
363
|
-
* row. On a large or pre-fix poisoned index — e.g. an old graph that scanned
|
|
364
|
-
* an ignored gitlink corpus (#1065) into ~1.6M nodes with a multi-GB WAL —
|
|
365
|
-
* the per-row `nodes_fts` delete-trigger churn blocks the main thread long
|
|
366
|
-
* enough to trip the #850 liveness watchdog before indexing even starts, so a
|
|
367
|
-
* full re-index could never recover the bad state (#1067). Discarding the
|
|
368
|
-
* files is O(1) regardless of size, reclaims the disk, and sidesteps opening
|
|
369
|
-
* (and running migrations against) the poisoned database entirely.
|
|
370
|
-
*/
|
|
371
323
|
static async recreate(projectRoot) {
|
|
372
|
-
await (0,
|
|
324
|
+
await (0, grammars_1.initGrammars)();
|
|
373
325
|
const resolvedRoot = path.resolve(projectRoot);
|
|
374
|
-
// Check if initialized — recreate REBUILDS an existing project; it is not a
|
|
375
|
-
// first-time `init`.
|
|
376
326
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
377
327
|
throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
|
|
378
328
|
}
|
|
@@ -381,91 +331,62 @@ class CodeGraph {
|
|
|
381
331
|
(0, db_1.removeDatabaseFiles)(dbPath);
|
|
382
332
|
}
|
|
383
333
|
catch (err) {
|
|
384
|
-
// POSIX unlinks an open file fine; this fires mainly on Windows when a
|
|
385
|
-
// live daemon/MCP server still holds the database. Turn the raw EBUSY into
|
|
386
|
-
// an actionable instruction instead of a generic failure.
|
|
387
334
|
const reason = err instanceof Error ? err.message : String(err);
|
|
388
335
|
throw new Error(`Could not rebuild the index — the database file is in use (${reason}). ` +
|
|
389
336
|
`Stop any running CodeGraph MCP server/daemon for this project and retry, ` +
|
|
390
337
|
`or remove the ${(0, directory_2.getCodeGraphDir)(resolvedRoot)} directory and run "codegraph init".`);
|
|
391
338
|
}
|
|
392
|
-
// Re-create an empty, freshly-schema'd database at the same path.
|
|
393
339
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
394
340
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
395
341
|
return new CodeGraph(db, queries, resolvedRoot);
|
|
396
342
|
}
|
|
397
|
-
/**
|
|
398
|
-
* Open synchronously (without sync)
|
|
399
|
-
*/
|
|
400
343
|
static openSync(projectRoot, options = {}) {
|
|
401
344
|
const resolvedRoot = path.resolve(projectRoot);
|
|
402
|
-
// Check if initialized
|
|
403
345
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
404
346
|
throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
|
|
405
347
|
}
|
|
406
|
-
// Validate directory structure
|
|
407
348
|
const validation = (0, directory_1.validateDirectory)(resolvedRoot);
|
|
408
349
|
if (!validation.valid) {
|
|
409
350
|
throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
|
|
410
351
|
}
|
|
411
|
-
// Open database
|
|
412
352
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
413
|
-
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly });
|
|
353
|
+
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly, deferIndexRecovery: options.deferIndexRecovery });
|
|
414
354
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
415
355
|
return new CodeGraph(db, queries, resolvedRoot);
|
|
416
356
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
357
|
+
recoverIndexes() {
|
|
358
|
+
return this.db.recoverIndexesOffThread();
|
|
359
|
+
}
|
|
360
|
+
hasPendingIndexRecovery() {
|
|
361
|
+
return this.db.hasDeferredIndexRecovery();
|
|
362
|
+
}
|
|
420
363
|
static isInitialized(projectRoot) {
|
|
421
364
|
return (0, directory_1.isInitialized)(path.resolve(projectRoot));
|
|
422
365
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
366
|
+
releaseMemory() {
|
|
367
|
+
this.db.releaseMemory();
|
|
368
|
+
}
|
|
426
369
|
close() {
|
|
427
370
|
this.unwatch();
|
|
428
|
-
|
|
371
|
+
if (this.deferredSynthesisTimer) {
|
|
372
|
+
clearTimeout(this.deferredSynthesisTimer);
|
|
373
|
+
this.deferredSynthesisTimer = null;
|
|
374
|
+
}
|
|
429
375
|
this.fileLock.release();
|
|
430
376
|
this.db.close();
|
|
431
377
|
}
|
|
432
|
-
/**
|
|
433
|
-
* Get the project root directory
|
|
434
|
-
*/
|
|
435
378
|
getProjectRoot() {
|
|
436
379
|
return this.projectRoot;
|
|
437
380
|
}
|
|
438
|
-
// ===========================================================================
|
|
439
|
-
// Indexing
|
|
440
|
-
// ===========================================================================
|
|
441
|
-
/**
|
|
442
|
-
* Index all files in the project
|
|
443
|
-
*
|
|
444
|
-
* Uses a mutex to prevent concurrent indexing operations.
|
|
445
|
-
*/
|
|
446
381
|
async indexAll(options = {}) {
|
|
447
382
|
return this.indexMutex.withLock(async () => {
|
|
383
|
+
const startedAt = Date.now();
|
|
448
384
|
try {
|
|
449
385
|
this.fileLock.acquire();
|
|
450
386
|
}
|
|
451
387
|
catch {
|
|
452
388
|
return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' }], durationMs: 0 };
|
|
453
389
|
}
|
|
454
|
-
// Defer WAL auto-checkpointing for the whole bulk run (#1231): the
|
|
455
|
-
// default 1000-page interval re-writes hot pages into the main DB file
|
|
456
|
-
// over and over — ~95% of all disk I/O during a bulk index, and a
|
|
457
|
-
// 19+min → 45s difference on HDD-class storage. The valve bounds WAL
|
|
458
|
-
// growth by backfilling PASSIVEly on a worker thread (never blocking
|
|
459
|
-
// the writer or the #850 watchdog heartbeat); runMaintenance below does
|
|
460
|
-
// the final fold-up before the interval is restored in the finally.
|
|
461
|
-
// Kill switch: CODEGRAPH_NO_WAL_DEFER=1. Non-WAL journal modes (some
|
|
462
|
-
// network filesystems) have no WAL to defer — skip.
|
|
463
|
-
// Fast-init: on a COMPLETELY fresh DB, trade crash-durability for speed
|
|
464
|
-
// during the bulk build (journal in memory, no fsync). Safe because the
|
|
465
|
-
// DB is disposable until the index completes — index_state stays
|
|
466
|
-
// 'indexing' and a crashed init is re-run from scratch; existing DBs
|
|
467
|
-
// (re-index/sync) never take this path. Kill switch:
|
|
468
|
-
// CODEGRAPH_NO_FAST_INIT=1 (same pattern as CODEGRAPH_NO_WAL_DEFER).
|
|
469
390
|
const freshDb = this.queries.getNodeAndEdgeCount().nodes === 0;
|
|
470
391
|
const fastInit = process.env.CODEGRAPH_NO_FAST_INIT !== '1' && freshDb;
|
|
471
392
|
if (fastInit) {
|
|
@@ -473,13 +394,11 @@ class CodeGraph {
|
|
|
473
394
|
this.db.getDb().pragma('journal_mode = MEMORY');
|
|
474
395
|
this.db.getDb().pragma('synchronous = OFF');
|
|
475
396
|
}
|
|
476
|
-
catch {
|
|
397
|
+
catch { }
|
|
477
398
|
}
|
|
478
399
|
const deferWal = !fastInit && process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
479
400
|
let walValve = null;
|
|
480
401
|
let priorAutocheckpoint = 1000;
|
|
481
|
-
// Set when the fastInit+pool path below defers autocheckpointing, so the
|
|
482
|
-
// finally knows to restore the interval on that path too.
|
|
483
402
|
let restoreAutocheckpoint = false;
|
|
484
403
|
if (deferWal) {
|
|
485
404
|
priorAutocheckpoint = this.db.getWalAutocheckpoint();
|
|
@@ -490,38 +409,22 @@ class CodeGraph {
|
|
|
490
409
|
try {
|
|
491
410
|
const gitState = this.orchestrator.beginGitIndexState(true);
|
|
492
411
|
const before = this.queries.getNodeAndEdgeCount();
|
|
493
|
-
// Mark the index as in-flight BEFORE any writes: a run killed
|
|
494
|
-
// mid-index (OOM, SIGKILL, the #850 liveness watchdog) leaves this
|
|
495
|
-
// marker behind, so `codegraph status` can tell a truncated index
|
|
496
|
-
// from a completed one instead of silently serving partial results.
|
|
497
412
|
try {
|
|
498
413
|
this.queries.setMetadata('index_state', 'indexing');
|
|
499
414
|
}
|
|
500
|
-
catch {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
415
|
+
catch { }
|
|
416
|
+
if (freshDb) {
|
|
417
|
+
try {
|
|
418
|
+
this.queries.clearNameSegmentVocab();
|
|
419
|
+
}
|
|
420
|
+
catch { }
|
|
506
421
|
}
|
|
507
|
-
catch { /* vocab is advisory — never fail an index over it */ }
|
|
508
|
-
// Bulk FTS mode for the mass-insert phase: drop the per-row FTS sync
|
|
509
|
-
// triggers, rebuild nodes_fts once from the nodes table afterwards.
|
|
510
|
-
// Crash inside the window is healed on the next DatabaseConnection.open.
|
|
511
422
|
this.db.beginBulkNodeLoad();
|
|
512
|
-
// Fresh-init only: also drop the parse-lane secondary indexes for the
|
|
513
|
-
// mass insert (the store-writer's B-tree-maintenance floor, plan §4d)
|
|
514
|
-
// and rebuild each in one scan afterwards. Incremental runs keep them
|
|
515
|
-
// — they delete per-file rows mid-phase through the file_path indexes.
|
|
516
423
|
if (freshDb)
|
|
517
424
|
this.db.beginBulkParseLoad();
|
|
518
425
|
let result;
|
|
519
426
|
try {
|
|
520
|
-
result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose, walValve ? () => walValve.backpressure() : undefined,
|
|
521
|
-
// Store-writer offload is fresh-DB-only: with any pre-existing
|
|
522
|
-
// data the store path must read (existing-file checks, cross-file
|
|
523
|
-
// edge snapshots) and delete, which belongs on one thread.
|
|
524
|
-
freshDb ? { dbPath: this.db.getPath(), fastInit } : null);
|
|
427
|
+
result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose, walValve ? () => walValve.backpressure() : undefined, freshDb ? { dbPath: this.db.getPath(), fastInit } : null);
|
|
525
428
|
}
|
|
526
429
|
finally {
|
|
527
430
|
if (freshDb) {
|
|
@@ -535,58 +438,28 @@ class CodeGraph {
|
|
|
535
438
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
536
439
|
console.error(`[phase-timing] fts-rebuild: ${Date.now() - tFts}ms`);
|
|
537
440
|
}
|
|
538
|
-
// Fold the parse phase's WAL BEFORE the first post-parse reads
|
|
539
|
-
// (resolver re-init and resolution both read on the main thread):
|
|
540
|
-
// paging a bulk-write-sized WAL there is what blew the #850
|
|
541
|
-
// watchdog's 60s window in the #1231 repro. Off-thread + awaited,
|
|
542
|
-
// so the event loop keeps turning.
|
|
543
441
|
if (walValve)
|
|
544
442
|
await walValve.foldNow();
|
|
545
|
-
// Re-detect frameworks now that the index is populated. The resolver
|
|
546
|
-
// is constructed with createResolver() before any files exist, so
|
|
547
|
-
// framework resolvers whose detect() consults the indexed file list
|
|
548
|
-
// (e.g. UIKit/SwiftUI scanning for imports, swift-objc-bridge looking
|
|
549
|
-
// for both Swift and ObjC files) all return false on that initial pass
|
|
550
|
-
// and silently drop themselves. Re-initializing here gives them a
|
|
551
|
-
// chance to see the actual project before resolution runs.
|
|
552
443
|
if (result.success && result.filesIndexed > 0) {
|
|
553
444
|
const tReinit = Date.now();
|
|
554
445
|
this.resolver.initialize();
|
|
555
|
-
// Cross-file finalization (e.g. NestJS RouterModule prefixes). Runs
|
|
556
|
-
// before resolution so updated names show up in subsequent reads.
|
|
557
446
|
this.resolver.runPostExtract();
|
|
558
447
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
559
448
|
console.error(`[phase-timing] resolver-reinit: ${Date.now() - tReinit}ms`);
|
|
560
449
|
}
|
|
561
|
-
// Resolve references to create call/import/extends edges
|
|
562
450
|
if (result.success && result.filesIndexed > 0) {
|
|
563
|
-
// Get count without loading all refs into memory
|
|
564
451
|
const unresolvedCount = this.queries.getUnresolvedReferencesCount();
|
|
565
|
-
// Fast-init leaves the DB in memory-journal (rollback) mode, where
|
|
566
|
-
// the parallel resolver pool's read connections would contend with
|
|
567
|
-
// the main writer's exclusive commits. When the pool will actually
|
|
568
|
-
// run (enough pending refs), restore WAL BEFORE resolution so
|
|
569
|
-
// readers never block the writer; otherwise stay in the fast mode
|
|
570
|
-
// until the finally — sequential resolution has no readers.
|
|
571
452
|
if (fastInit && unresolvedCount >= (0, resolver_pool_1.minRefsForPool)()) {
|
|
572
453
|
try {
|
|
573
454
|
this.db.getDb().pragma('synchronous = NORMAL');
|
|
574
455
|
this.db.getDb().pragma('journal_mode = WAL');
|
|
575
|
-
// Defer auto-checkpointing for the resolution phase, same
|
|
576
|
-
// rationale as the deferWal path above: at the default 1000-page
|
|
577
|
-
// interval, the persist loop's edge inserts + ref deletes make
|
|
578
|
-
// SQLite re-write hot B-tree pages into the main DB file inline
|
|
579
|
-
// on the writer over and over (#1231's pathology — measured as
|
|
580
|
-
// ~58% of the resolution phase on a 255k-ref repo). The valve
|
|
581
|
-
// bounds WAL growth off-thread; runMaintenance does the final
|
|
582
|
-
// fold and the finally restores the interval.
|
|
583
456
|
priorAutocheckpoint = this.db.getWalAutocheckpoint();
|
|
584
457
|
this.db.setWalAutocheckpoint(0);
|
|
585
458
|
restoreAutocheckpoint = true;
|
|
586
459
|
walValve = new wal_valve_1.WalCheckpointValve(this.db, undefined, undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
|
|
587
460
|
walValve.start();
|
|
588
461
|
}
|
|
589
|
-
catch {
|
|
462
|
+
catch { }
|
|
590
463
|
}
|
|
591
464
|
options.onProgress?.({
|
|
592
465
|
phase: 'resolving',
|
|
@@ -606,33 +479,31 @@ class CodeGraph {
|
|
|
606
479
|
current: done,
|
|
607
480
|
total: totalPasses,
|
|
608
481
|
});
|
|
609
|
-
}, walValve ? () => walValve.backpressure() : undefined);
|
|
482
|
+
}, walValve ? () => walValve.backpressure() : undefined, true, true);
|
|
610
483
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
611
484
|
console.error(`[phase-timing] resolution: ${Date.now() - tResolve}ms`);
|
|
612
|
-
|
|
613
|
-
// receiver conforms to (protocol-extension / inherited / default-
|
|
614
|
-
// interface). Needs the implements/extends edges the main pass just
|
|
615
|
-
// built, so it runs after resolution (#750).
|
|
485
|
+
this.lastSynthesisAt = Date.now();
|
|
616
486
|
const tChained = Date.now();
|
|
617
487
|
await this.resolver.resolveChainedCallsViaConformance();
|
|
618
488
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
619
489
|
console.error(`[synth-timing] chainedConformance: ${Date.now() - tChained}ms`);
|
|
620
|
-
// Same lifecycle for `this.<member>` callback registrations whose
|
|
621
|
-
// member is inherited from a supertype (#808).
|
|
622
490
|
const tDeferred = Date.now();
|
|
623
491
|
await this.resolver.resolveDeferredThisMemberRefs();
|
|
624
492
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
625
493
|
console.error(`[synth-timing] deferredThisMember: ${Date.now() - tDeferred}ms`);
|
|
494
|
+
await this.resolver.resolveParameterFlows();
|
|
495
|
+
}
|
|
496
|
+
if (!freshDb && result.success && !options.signal?.aborted) {
|
|
497
|
+
const tPrune = Date.now();
|
|
498
|
+
try {
|
|
499
|
+
this.queries.pruneNameSegmentVocab();
|
|
500
|
+
}
|
|
501
|
+
catch { }
|
|
502
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
503
|
+
console.error(`[phase-timing] vocab-prune: ${Date.now() - tPrune}ms`);
|
|
626
504
|
}
|
|
627
|
-
// Refresh planner stats + checkpoint the WAL after bulk writes.
|
|
628
|
-
// Off-thread (worker connection): on a multi-GB index this is minutes
|
|
629
|
-
// of IO, and inline it starved the #850 watchdog AFTER a fully
|
|
630
|
-
// successful index. Never load-bearing for correctness.
|
|
631
505
|
if (result.success && result.filesIndexed > 0) {
|
|
632
506
|
const tMaint = Date.now();
|
|
633
|
-
// Quiesce the valve first so its in-flight checkpoint and the
|
|
634
|
-
// maintenance checkpoint don't contend for the checkpointer lock
|
|
635
|
-
// (the loser would silently no-op and leave the WAL unfolded).
|
|
636
507
|
if (walValve) {
|
|
637
508
|
walValve.stop();
|
|
638
509
|
await walValve.drain();
|
|
@@ -641,9 +512,6 @@ class CodeGraph {
|
|
|
641
512
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
642
513
|
console.error(`[phase-timing] maintenance: ${Date.now() - tMaint}ms`);
|
|
643
514
|
}
|
|
644
|
-
// The orchestrator only sees extraction-phase counts; resolution and
|
|
645
|
-
// synthesizer edges (often >50% of the graph on JVM repos) come later.
|
|
646
|
-
// Recompute against the DB so the CLI summary reports the true totals.
|
|
647
515
|
if (result.success && result.filesIndexed > 0) {
|
|
648
516
|
const tCount = Date.now();
|
|
649
517
|
const after = this.queries.getNodeAndEdgeCount();
|
|
@@ -652,27 +520,29 @@ class CodeGraph {
|
|
|
652
520
|
result.nodesCreated = after.nodes - before.nodes;
|
|
653
521
|
result.edgesCreated = after.edges - before.edges;
|
|
654
522
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
523
|
+
if (result.success)
|
|
524
|
+
this.stampPythonRootFingerprint();
|
|
525
|
+
if (result.success)
|
|
526
|
+
this.stampPhpWebRoots();
|
|
527
|
+
if (result.success)
|
|
528
|
+
this.stampWorkspaceFingerprint();
|
|
529
|
+
if (result.success)
|
|
530
|
+
this.stampWorkspaceManifests(this.orchestrator.takeManifestEvidence());
|
|
531
|
+
if (result.success)
|
|
532
|
+
this.stampModuleConfigSnapshot();
|
|
533
|
+
if (result.success)
|
|
534
|
+
this.stampIndexedFrameworks();
|
|
660
535
|
if (result.success && result.filesIndexed > 0) {
|
|
661
536
|
try {
|
|
662
537
|
this.queries.setMetadata('indexed_with_version', version_1.CodeGraphPackageVersion);
|
|
663
538
|
this.queries.setMetadata('indexed_with_extraction_version', String(extraction_version_1.EXTRACTION_VERSION));
|
|
664
539
|
}
|
|
665
|
-
catch {
|
|
540
|
+
catch { }
|
|
666
541
|
}
|
|
667
542
|
if (result.success && result.filesErrored === 0 &&
|
|
668
543
|
(result.filesDiscovered === undefined || result.filesIndexed + result.filesSkipped >= result.filesDiscovered)) {
|
|
669
544
|
this.orchestrator.finishGitIndexState(gitState, true);
|
|
670
545
|
}
|
|
671
|
-
// Reconcile the scan's ground truth against what the pipeline
|
|
672
|
-
// accounted for. A shortfall means files were silently dropped
|
|
673
|
-
// (observed in the wild: a run under heavy load came up 37 files
|
|
674
|
-
// short with no error) — record it and tell the user, don't let the
|
|
675
|
-
// index pass as complete.
|
|
676
546
|
try {
|
|
677
547
|
if (!result.success) {
|
|
678
548
|
this.queries.setMetadata('index_state', 'failed');
|
|
@@ -700,15 +570,11 @@ class CodeGraph {
|
|
|
700
570
|
}
|
|
701
571
|
}
|
|
702
572
|
}
|
|
703
|
-
catch {
|
|
573
|
+
catch { }
|
|
574
|
+
result.durationMs = Date.now() - startedAt;
|
|
704
575
|
return result;
|
|
705
576
|
}
|
|
706
577
|
finally {
|
|
707
|
-
// Restore the auto-checkpoint interval AFTER the fold-up above so the
|
|
708
|
-
// next ordinary write doesn't inherit a giant inline checkpoint. On
|
|
709
|
-
// the error path the WAL may still be large; correctness is unchanged
|
|
710
|
-
// (SQLite replays the WAL on the next open) and the follow-up write
|
|
711
|
-
// that folds it is the known cost of a failed run.
|
|
712
578
|
if (walValve) {
|
|
713
579
|
walValve.stop();
|
|
714
580
|
await walValve.drain();
|
|
@@ -717,26 +583,19 @@ class CodeGraph {
|
|
|
717
583
|
try {
|
|
718
584
|
this.db.setWalAutocheckpoint(priorAutocheckpoint);
|
|
719
585
|
}
|
|
720
|
-
catch {
|
|
586
|
+
catch { }
|
|
721
587
|
}
|
|
722
588
|
if (fastInit) {
|
|
723
|
-
// Back to the durable defaults; journal_mode=WAL folds the MEMORY
|
|
724
|
-
// journal state into a normal WAL-mode database file.
|
|
725
589
|
try {
|
|
726
590
|
this.db.getDb().pragma('synchronous = NORMAL');
|
|
727
591
|
this.db.getDb().pragma('journal_mode = WAL');
|
|
728
592
|
}
|
|
729
|
-
catch {
|
|
593
|
+
catch { }
|
|
730
594
|
}
|
|
731
595
|
this.fileLock.release();
|
|
732
596
|
}
|
|
733
597
|
});
|
|
734
598
|
}
|
|
735
|
-
/**
|
|
736
|
-
* Index specific files
|
|
737
|
-
*
|
|
738
|
-
* Uses a mutex to prevent concurrent indexing operations.
|
|
739
|
-
*/
|
|
740
599
|
async indexFiles(filePaths) {
|
|
741
600
|
return this.indexMutex.withLock(async () => {
|
|
742
601
|
try {
|
|
@@ -746,70 +605,143 @@ class CodeGraph {
|
|
|
746
605
|
return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' }], durationMs: 0 };
|
|
747
606
|
}
|
|
748
607
|
try {
|
|
749
|
-
return this.orchestrator.indexFiles(filePaths);
|
|
608
|
+
return await this.orchestrator.indexFiles(filePaths).finally(() => this.resolver.clearCaches());
|
|
750
609
|
}
|
|
751
610
|
finally {
|
|
752
611
|
this.fileLock.release();
|
|
753
612
|
}
|
|
754
613
|
});
|
|
755
614
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
615
|
+
pythonFilePaths() {
|
|
616
|
+
return new Set(this.queries.getAllFilePaths().filter((f) => f.endsWith('.py')));
|
|
617
|
+
}
|
|
618
|
+
stampPythonRootFingerprint(fingerprint = this.resolver.getPythonRootFingerprint()) {
|
|
619
|
+
try {
|
|
620
|
+
this.queries.setMetadata(PYTHON_ROOTS_METADATA_KEY, fingerprint);
|
|
621
|
+
}
|
|
622
|
+
catch { }
|
|
623
|
+
}
|
|
624
|
+
stampPhpWebRoots(snapshot = this.resolver.getPhpWebRootSnapshot()) {
|
|
625
|
+
try {
|
|
626
|
+
this.queries.setMetadata(PHP_WEB_ROOTS_METADATA_KEY, snapshot);
|
|
627
|
+
}
|
|
628
|
+
catch { }
|
|
629
|
+
}
|
|
630
|
+
stampModuleConfigSnapshot() {
|
|
631
|
+
try {
|
|
632
|
+
const stored = this.queries.getMetadata(MODULE_CONFIG_METADATA_KEY);
|
|
633
|
+
this.queries.setMetadata(MODULE_CONFIG_METADATA_KEY, JSON.stringify(this.resolver.getModuleConfigSnapshot(stored, true)));
|
|
634
|
+
}
|
|
635
|
+
catch { }
|
|
636
|
+
}
|
|
637
|
+
stampModuleConfigSnapshotIfMoved() {
|
|
638
|
+
try {
|
|
639
|
+
const stored = this.queries.getMetadata(MODULE_CONFIG_METADATA_KEY);
|
|
640
|
+
const now = JSON.stringify(this.resolver.getModuleConfigSnapshot(stored));
|
|
641
|
+
if (now !== stored)
|
|
642
|
+
this.queries.setMetadata(MODULE_CONFIG_METADATA_KEY, now);
|
|
643
|
+
}
|
|
644
|
+
catch { }
|
|
645
|
+
}
|
|
646
|
+
stampWorkspaceFingerprint(fingerprint = this.resolver.getWorkspaceFingerprint()) {
|
|
647
|
+
try {
|
|
648
|
+
this.queries.setMetadata(WORKSPACE_METADATA_KEY, fingerprint);
|
|
649
|
+
}
|
|
650
|
+
catch { }
|
|
651
|
+
}
|
|
652
|
+
stampWorkspaceManifests(evidence) {
|
|
653
|
+
try {
|
|
654
|
+
const discovery = this.resolver.getWorkspaceDiscovery();
|
|
655
|
+
const stamp = discovery ? (0, lazy_engine_1.engine)().manifestStamp(evidence, discovery) : null;
|
|
656
|
+
const value = stamp ? JSON.stringify(stamp) : '';
|
|
657
|
+
if (this.queries.getMetadata(WORKSPACE_MANIFESTS_METADATA_KEY) !== value)
|
|
658
|
+
this.queries.setMetadata(WORKSPACE_MANIFESTS_METADATA_KEY, value);
|
|
659
|
+
}
|
|
660
|
+
catch { }
|
|
661
|
+
}
|
|
662
|
+
stampIndexedFrameworks() {
|
|
663
|
+
const names = this.orchestrator.getDetectedFrameworkNames();
|
|
664
|
+
if (names === null)
|
|
665
|
+
return;
|
|
666
|
+
try {
|
|
667
|
+
this.queries.setMetadata(FRAMEWORKS_AT_INDEX_KEY, JSON.stringify([...names].sort()));
|
|
668
|
+
this.queries.setMetadata(FRAMEWORKS_SINCE_INDEX_KEY, '');
|
|
669
|
+
this.queries.setMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY, JSON.stringify([...this.resolver.getDetectedFrameworks()].sort()));
|
|
670
|
+
}
|
|
671
|
+
catch { }
|
|
672
|
+
}
|
|
673
|
+
followDetectedFrameworks(detected) {
|
|
674
|
+
const now = [...detected].sort();
|
|
675
|
+
const resolverNow = [...this.resolver.getDetectedFrameworks()].sort();
|
|
676
|
+
if (now.join('\0') !== resolverNow.join('\0'))
|
|
677
|
+
this.resolver.initialize();
|
|
678
|
+
try {
|
|
679
|
+
const atIndex = parseNameList(this.queries.getMetadata(FRAMEWORKS_AT_INDEX_KEY));
|
|
680
|
+
if (!atIndex)
|
|
681
|
+
return;
|
|
682
|
+
const added = now.filter((name) => !atIndex.includes(name));
|
|
683
|
+
const removed = atIndex.filter((name) => !now.includes(name));
|
|
684
|
+
const value = added.length > 0 || removed.length > 0 ? JSON.stringify({ added, removed }) : '';
|
|
685
|
+
if ((this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY) ?? '') !== value) {
|
|
686
|
+
this.queries.setMetadata(FRAMEWORKS_SINCE_INDEX_KEY, value);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
catch { }
|
|
690
|
+
}
|
|
691
|
+
getFrameworkChangesSinceIndex() {
|
|
692
|
+
const names = (list) => (Array.isArray(list) ? list.filter((n) => typeof n === 'string') : []);
|
|
693
|
+
const added = new Set();
|
|
694
|
+
const removed = new Set();
|
|
695
|
+
try {
|
|
696
|
+
const value = this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY);
|
|
697
|
+
if (value) {
|
|
698
|
+
const parsed = JSON.parse(value);
|
|
699
|
+
for (const name of names(parsed.added))
|
|
700
|
+
added.add(name);
|
|
701
|
+
for (const name of names(parsed.removed))
|
|
702
|
+
removed.add(name);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
catch { }
|
|
706
|
+
try {
|
|
707
|
+
const atIndex = parseNameList(this.queries.getMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY));
|
|
708
|
+
if (atIndex) {
|
|
709
|
+
const now = this.resolver.getDetectedFrameworks();
|
|
710
|
+
for (const name of now)
|
|
711
|
+
if (!atIndex.includes(name))
|
|
712
|
+
added.add(name);
|
|
713
|
+
for (const name of atIndex)
|
|
714
|
+
if (!now.includes(name))
|
|
715
|
+
removed.add(name);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
catch { }
|
|
719
|
+
return added.size > 0 || removed.size > 0 ? { added: [...added].sort(), removed: [...removed].sort() } : null;
|
|
720
|
+
}
|
|
762
721
|
async sync(options = {}) {
|
|
722
|
+
const { ESM_IMPORT_LANGUAGES, aliasMayName, changedModuleConfigs, changedRoutes, createImportReader, hasSynthesisPattern, isJsxChildCandidate, moduleConfigLanguages, parseManifestStamp, parseModuleConfigSnapshot, reopenNameMatchedImports, reopenReferencesThroughAddedFiles, reopenReferencesThroughBarrels, reopenReferencesThroughChangedDefaults, reopenReferencesThroughDeclaredPackages, reopenReferencesThroughObjectMembers, reopenReferencesThroughRetargetedModules, trustedManifestList, } = (0, lazy_engine_1.engine)();
|
|
763
723
|
return this.indexMutex.withLock(async () => {
|
|
724
|
+
const startedAt = Date.now();
|
|
764
725
|
try {
|
|
765
726
|
this.fileLock.acquire();
|
|
766
727
|
}
|
|
767
728
|
catch (err) {
|
|
768
|
-
throw new
|
|
729
|
+
throw new errors_2.LockUnavailableError(`Sync could not acquire the file lock; retry when the index is available. ${err instanceof Error ? err.message : String(err)}`);
|
|
769
730
|
}
|
|
770
|
-
// A full rebuild in another process (`codegraph index` → recreate)
|
|
771
|
-
// unlinks the database and creates a new file at the same path. A
|
|
772
|
-
// long-lived instance — the MCP daemon's watcher — would otherwise keep
|
|
773
|
-
// "syncing" into the dead inode, and nothing it wrote there is visible
|
|
774
|
-
// to anyone (#1902). Follow the path before writing (one stat), and
|
|
775
|
-
// widen a scoped sync to a full one: whatever the old handle absorbed
|
|
776
|
-
// since the rebuild is gone, so the new file has to be reconciled whole.
|
|
777
|
-
// If the reopen fails (the rebuild is mid-way), report lock contention
|
|
778
|
-
// so the watcher keeps its pending files and retries.
|
|
779
731
|
try {
|
|
780
732
|
this.reopenReplacedDatabase();
|
|
781
733
|
}
|
|
782
734
|
catch (err) {
|
|
783
735
|
this.fileLock.release();
|
|
784
|
-
throw new
|
|
736
|
+
throw new errors_2.LockUnavailableError(`Sync could not open the rebuilt index yet; retry when the rebuild finishes. ${err instanceof Error ? err.message : String(err)}`);
|
|
785
737
|
}
|
|
786
738
|
if (this.pendingFullReconcile) {
|
|
787
|
-
// `codegraph index` recreates the file, THEN takes the write lock in
|
|
788
|
-
// indexAll. A sync landing in that gap would otherwise run a full
|
|
789
|
-
// reconcile of the empty file and hold the lock the rebuild is about
|
|
790
|
-
// to ask for. A fresh file with no index_state yet is that rebuild:
|
|
791
|
-
// step aside (lock contention, the watcher retries) and reconcile in
|
|
792
|
-
// full once it is done. Bounded, so a rebuild that died before
|
|
793
|
-
// indexing does not park the watcher forever.
|
|
794
739
|
if (this.getIndexState() === null && this.isFreshlyRecreated()) {
|
|
795
740
|
this.fileLock.release();
|
|
796
|
-
throw new
|
|
741
|
+
throw new errors_2.LockUnavailableError('A rebuild of this index is in progress; retry when it finishes.');
|
|
797
742
|
}
|
|
798
|
-
// Cleared only once this run completes (below): a sync that throws
|
|
799
|
-
// must leave the full catch-up for the next one.
|
|
800
743
|
options = { ...options, paths: undefined };
|
|
801
744
|
}
|
|
802
|
-
// Defer WAL auto-checkpointing for the whole incremental run, exactly
|
|
803
|
-
// as indexAll does for the bulk path (#1231): sync's store loop and its
|
|
804
|
-
// resolution passes churn the same FTS + secondary-index hot pages, and
|
|
805
|
-
// at the default 1000-page cadence the inline checkpoints re-write them
|
|
806
|
-
// over and over — on HDD-class storage a 7-file sync took 2 minutes at
|
|
807
|
-
// 0-2% CPU (#1248). The cost scales with the EXISTING database size,
|
|
808
|
-
// not the change size, so small syncs on big indexes hurt most. The
|
|
809
|
-
// valve bounds WAL growth off-thread; runMaintenance at the end does
|
|
810
|
-
// the final fold-up before the interval is restored in the finally.
|
|
811
|
-
// Same kill switch as indexAll: CODEGRAPH_NO_WAL_DEFER=1. Idle valve
|
|
812
|
-
// cost is one timer, so watcher-frequency syncs stay cheap.
|
|
813
745
|
const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
814
746
|
let walValve = null;
|
|
815
747
|
let priorAutocheckpoint = 1000;
|
|
@@ -820,10 +752,6 @@ class CodeGraph {
|
|
|
820
752
|
walValve.start();
|
|
821
753
|
}
|
|
822
754
|
try {
|
|
823
|
-
// Captured BEFORE the sync runs: the sync's own incremental writes
|
|
824
|
-
// populate vocab rows for the files it touches, so an end-of-sync
|
|
825
|
-
// emptiness check would see "non-empty" and skip the backfill forever,
|
|
826
|
-
// leaving every unchanged file's names unsegmented.
|
|
827
755
|
const vocabWasEmpty = (() => {
|
|
828
756
|
try {
|
|
829
757
|
return this.queries.isNameSegmentVocabEmpty();
|
|
@@ -832,55 +760,101 @@ class CodeGraph {
|
|
|
832
760
|
return false;
|
|
833
761
|
}
|
|
834
762
|
})();
|
|
835
|
-
// Writer-side backstop for deferred WAL checkpointing (#1539): sync
|
|
836
|
-
// previously armed the valve but never called backpressure(), so the
|
|
837
|
-
// hard/file caps were never enforced during daemon catch-up — only
|
|
838
|
-
// timer-driven PASSIVE checkpoints ran, and a query-pool reader could
|
|
839
|
-
// pin frames while the WAL grew without a bound.
|
|
840
763
|
const backpressure = walValve ? () => walValve.backpressure() : undefined;
|
|
841
764
|
const fullReconcile = !options.paths || options.paths.length === 0;
|
|
842
765
|
const gitState = this.orchestrator.beginGitIndexState(fullReconcile);
|
|
843
|
-
|
|
844
|
-
// resolution/synthesis. Detect those orphans BEFORE this sync adds refs.
|
|
766
|
+
const pythonFilesBefore = this.pythonFilePaths();
|
|
845
767
|
let refreshSynthesis = this.queries.getMetadata('synthesis_pending') === '1' ||
|
|
846
768
|
this.queries.getUnresolvedReferencesCount() > 0;
|
|
847
769
|
if (refreshSynthesis)
|
|
848
770
|
this.queries.setMetadata('synthesis_pending', '1');
|
|
771
|
+
const watchRoutes = this.resolver.hasNavigationRouters();
|
|
772
|
+
let routesBefore = null;
|
|
773
|
+
const flowChange = this.resolver.trackParameterFlows();
|
|
849
774
|
const result = await this.orchestrator.sync(options.onProgress, options.paths, backpressure, (filePath, content) => {
|
|
775
|
+
flowChange.before(filePath);
|
|
776
|
+
if (watchRoutes && routesBefore === null)
|
|
777
|
+
routesBefore = this.queries.getNodesByKind('route');
|
|
850
778
|
if (!refreshSynthesis && (this.queries.hasSynthesizedEdgesTouchingFile(filePath) ||
|
|
851
779
|
this.queries.wasSynthesisInput(filePath) ||
|
|
852
|
-
(content !== undefined &&
|
|
780
|
+
(content !== undefined && hasSynthesisPattern(filePath, content)))) {
|
|
853
781
|
refreshSynthesis = true;
|
|
854
782
|
this.queries.setMetadata('synthesis_pending', '1');
|
|
855
783
|
}
|
|
856
784
|
});
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
785
|
+
if (result.detectedFrameworks)
|
|
786
|
+
this.followDetectedFrameworks(result.detectedFrameworks);
|
|
787
|
+
if (!refreshSynthesis && result.definitionDelta && result.changedFilePaths) {
|
|
788
|
+
const delta = new Set(result.definitionDelta);
|
|
789
|
+
const defined = this.queries.getNodesByFiles(result.changedFilePaths).filter((n) => delta.has(n.name));
|
|
790
|
+
if (defined.some(isJsxChildCandidate) || aliasMayName(this.queries, defined)) {
|
|
791
|
+
refreshSynthesis = true;
|
|
792
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
793
|
+
}
|
|
794
|
+
}
|
|
860
795
|
if (walValve)
|
|
861
796
|
await walValve.foldNow();
|
|
862
|
-
|
|
863
|
-
// every sync that touched files so edits to `app.module.ts` propagate
|
|
864
|
-
// to controllers in unchanged files. The pass is idempotent and cheap
|
|
865
|
-
// (regex over *.module.ts only).
|
|
866
|
-
if (result.filesAdded > 0 || result.filesModified > 0) {
|
|
797
|
+
if (result.filesAdded > 0 || result.filesModified > 0 || result.filesRemoved > 0) {
|
|
867
798
|
this.resolver.runPostExtract();
|
|
868
799
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
800
|
+
if (routesBefore) {
|
|
801
|
+
const tNav = Date.now();
|
|
802
|
+
const routes = changedRoutes(routesBefore, this.queries.getNodesByKind('route'));
|
|
803
|
+
const reopened = this.resolver.reopenNavigationsFor(routes, result.changedFilePaths ?? []);
|
|
804
|
+
if (routes.length > 0 && !refreshSynthesis) {
|
|
805
|
+
refreshSynthesis = true;
|
|
806
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
807
|
+
}
|
|
808
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
809
|
+
console.error(`[phase-timing] sync-navigation-retry: ${Date.now() - tNav}ms (${routes.length} routes changed, ${reopened} refs re-opened)`);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
{
|
|
813
|
+
const tConfig = Date.now();
|
|
814
|
+
const stored = this.queries.getMetadata(MODULE_CONFIG_METADATA_KEY);
|
|
815
|
+
const snapshot = this.resolver.getModuleConfigSnapshot(stored, result.filesAdded > 0 || result.filesRemoved > 0);
|
|
816
|
+
const changed = stored === null ? [] : changedModuleConfigs(parseModuleConfigSnapshot(stored), snapshot);
|
|
817
|
+
if (changed.length > 0) {
|
|
818
|
+
this.resolver.resetModuleConfig();
|
|
819
|
+
let reopened = 0;
|
|
820
|
+
for (const language of moduleConfigLanguages(changed))
|
|
821
|
+
reopened += this.orchestrator.resurrectResolutionEdgesForLanguage(language);
|
|
822
|
+
refreshSynthesis = true;
|
|
823
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
824
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
825
|
+
console.error(`[phase-timing] sync-module-config: ${Date.now() - tConfig}ms (${changed.join(', ')} changed, ${reopened} refs re-opened)`);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
if (fullReconcile) {
|
|
830
|
+
const tWorkspace = Date.now();
|
|
831
|
+
const before = this.queries.getMetadata(WORKSPACE_METADATA_KEY);
|
|
832
|
+
const evidence = this.orchestrator.takeManifestEvidence();
|
|
833
|
+
const known = before === null ? null : trustedManifestList(this.projectRoot, parseManifestStamp(this.queries.getMetadata(WORKSPACE_MANIFESTS_METADATA_KEY)), evidence);
|
|
834
|
+
const now = this.resolver.refreshWorkspacePackages(known ?? undefined);
|
|
835
|
+
if (!known)
|
|
836
|
+
this.stampWorkspaceManifests(evidence);
|
|
837
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
838
|
+
console.error(`[phase-timing] sync-workspace-manifests: ${Date.now() - tWorkspace}ms (${known ? `${known.length} read where the last walk found them` : 'walked'})`);
|
|
839
|
+
}
|
|
840
|
+
if (before !== null && before !== now) {
|
|
841
|
+
let reopened = 0;
|
|
842
|
+
for (const language of ESM_IMPORT_LANGUAGES)
|
|
843
|
+
reopened += this.orchestrator.resurrectResolutionEdgesForLanguage(language);
|
|
844
|
+
refreshSynthesis = true;
|
|
845
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
846
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
847
|
+
console.error(`[phase-timing] sync-workspace-packages: ${Date.now() - tWorkspace}ms (${reopened} refs re-opened)`);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (before !== now)
|
|
851
|
+
this.stampWorkspaceFingerprint(now);
|
|
878
852
|
}
|
|
879
|
-
// Resolve references if files were updated
|
|
880
853
|
const filesChanged = result.filesAdded > 0 || result.filesModified > 0;
|
|
854
|
+
let edgesBeforeRetry;
|
|
855
|
+
const edgesBeforeResolution = this.queries.getMaxEdgeId();
|
|
881
856
|
if (filesChanged) {
|
|
882
857
|
if (result.changedFilePaths) {
|
|
883
|
-
// Scope resolution to changed files (git fast path — bounded set)
|
|
884
858
|
const tRefLoad = Date.now();
|
|
885
859
|
const unresolvedRefs = this.queries.getUnresolvedReferencesByFiles(result.changedFilePaths);
|
|
886
860
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
@@ -897,17 +871,32 @@ class CodeGraph {
|
|
|
897
871
|
total,
|
|
898
872
|
});
|
|
899
873
|
});
|
|
900
|
-
// Retry previously-failed refs the changed files may now satisfy
|
|
901
|
-
// (#1240). Scoped resolution above only re-resolves refs FROM the
|
|
902
|
-
// changed files — but when a changed file gains an export/symbol,
|
|
903
|
-
// refs in UNCHANGED files that failed against the old graph can
|
|
904
|
-
// now resolve, and nothing else ever revisits them (their rows
|
|
905
|
-
// were parked as status='failed' by an earlier completed pass).
|
|
906
|
-
// Look them up by the symbol names the changed files now carry
|
|
907
|
-
// and re-resolve just that set. On a sync where no failed ref
|
|
908
|
-
// matches, this is one indexed lookup.
|
|
909
874
|
const tRetry = Date.now();
|
|
910
|
-
|
|
875
|
+
edgesBeforeRetry = this.queries.getMaxEdgeId();
|
|
876
|
+
const retryable = this.queries.getRetryableFailedReferences([...new Set([
|
|
877
|
+
...this.queries.getNodeNamesByFiles(result.changedFilePaths),
|
|
878
|
+
...result.changedFilePaths.flatMap(reference_tail_1.moduleReferenceKeys),
|
|
879
|
+
])]);
|
|
880
|
+
const addedFiles = new Set(result.addedFilePaths ?? []);
|
|
881
|
+
const resolvesToAdded = (specifier, fromFile, language) => {
|
|
882
|
+
const file = this.resolver.resolveModuleFile(specifier, fromFile, language);
|
|
883
|
+
return file !== null && addedFiles.has(file);
|
|
884
|
+
};
|
|
885
|
+
const resolvedModules = addedFiles.size === 0 ? [] : this.queries.getFailedScopedImports()
|
|
886
|
+
.filter((s) => resolvesToAdded(s.name, s.filePath, s.language))
|
|
887
|
+
.map((s) => s.name);
|
|
888
|
+
const folderImports = addedFiles.size === 0 ? [] : this.queries.getFailedFolderImports()
|
|
889
|
+
.filter((ref) => ref.filePath !== undefined && ref.language !== undefined &&
|
|
890
|
+
resolvesToAdded(ref.referenceName, ref.filePath, ref.language));
|
|
891
|
+
const retryRows = new Set(retryable.map((ref) => ref.rowId));
|
|
892
|
+
const importRetry = this.queries.getRetryableFailedImports((result.addedFilePaths ?? []).flatMap(reference_tail_1.importPathKeys), this.queries.getNodeNamesByFiles(result.changedFilePaths, ['namespace', 'module']), undefined, resolvedModules, undefined, this.resolver.couldNameAnyOf([...addedFiles]));
|
|
893
|
+
for (const ref of [...importRetry, ...folderImports]) {
|
|
894
|
+
if (!retryRows.has(ref.rowId)) {
|
|
895
|
+
retryable.push(ref);
|
|
896
|
+
retryRows.add(ref.rowId);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
retryable.sort((a, b) => (a.rowId ?? 0) - (b.rowId ?? 0));
|
|
911
900
|
if (retryable.length > 0) {
|
|
912
901
|
options.onProgress?.({
|
|
913
902
|
phase: 'resolving',
|
|
@@ -923,9 +912,70 @@ class CodeGraph {
|
|
|
923
912
|
}
|
|
924
913
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
925
914
|
console.error(`[phase-timing] sync-failed-ref-retry: ${Date.now() - tRetry}ms (${retryable.length} refs)`);
|
|
915
|
+
const importReader = createImportReader(this.projectRoot);
|
|
916
|
+
const added = (result.addedFilePaths ?? []).flatMap((filePath) => {
|
|
917
|
+
const file = this.queries.getFileByPath(filePath);
|
|
918
|
+
return file ? [{ path: filePath, language: file.language }] : [];
|
|
919
|
+
});
|
|
920
|
+
if (added.length > 0) {
|
|
921
|
+
const tAdded = Date.now();
|
|
922
|
+
const reopened = reopenReferencesThroughAddedFiles(this.queries, importReader, added, edgesBeforeResolution, (specifier, fromFile, language) => this.resolver.resolveModuleFile(specifier, fromFile, language), (file) => this.resolver.workspacePackageDirOf(file));
|
|
923
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
924
|
+
console.error(`[phase-timing] sync-added-module-importers: ${Date.now() - tAdded}ms (${reopened} refs re-opened)`);
|
|
925
|
+
}
|
|
926
|
+
const tBarrels = Date.now();
|
|
927
|
+
const delta = new Set(result.definitionDelta ?? []);
|
|
928
|
+
const seeds = new Map(added.map((file) => [file.path, file.language]));
|
|
929
|
+
const modified = result.changedFilePaths.filter((filePath) => !seeds.has(filePath));
|
|
930
|
+
if (delta.size > 0 && modified.length > 0) {
|
|
931
|
+
for (const node of this.queries.getNodesByFiles(modified)) {
|
|
932
|
+
if (delta.has(node.name))
|
|
933
|
+
seeds.set(node.filePath, node.language);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
const throughBarrels = reopenReferencesThroughBarrels(this.queries, importReader, [...seeds].map(([path, language]) => ({ path, language })), edgesBeforeResolution);
|
|
937
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
938
|
+
console.error(`[phase-timing] sync-barrel-modules: ${Date.now() - tBarrels}ms (${throughBarrels} refs re-opened)`);
|
|
939
|
+
const declared = reopenReferencesThroughDeclaredPackages(this.queries, importReader, this.projectRoot, result.changedFilePaths, edgesBeforeResolution);
|
|
940
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS && declared > 0)
|
|
941
|
+
console.error(`[phase-timing] sync-declared-packages: ${declared} refs re-opened`);
|
|
942
|
+
const tDefaults = Date.now();
|
|
943
|
+
const movedDefaults = this.resolver.changedDefaultExports(modified, result.changedFilePaths, edgesBeforeResolution);
|
|
944
|
+
const throughDefaults = movedDefaults.length === 0 ? 0
|
|
945
|
+
: reopenReferencesThroughChangedDefaults(this.queries, importReader, movedDefaults, edgesBeforeResolution);
|
|
946
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
947
|
+
console.error(`[phase-timing] sync-default-exports: ${Date.now() - tDefaults}ms (${movedDefaults.length} defaults moved, ${throughDefaults} refs re-opened)`);
|
|
948
|
+
const tNamed = Date.now();
|
|
949
|
+
const editedModules = modified.flatMap((filePath) => {
|
|
950
|
+
const file = this.queries.getFileByPath(filePath);
|
|
951
|
+
return file ? [{ path: filePath, language: file.language }] : [];
|
|
952
|
+
});
|
|
953
|
+
const nameMatched = reopenNameMatchedImports(this.queries, importReader, editedModules, edgesBeforeResolution, (specifier, fromFile, language) => this.resolver.resolveModuleFile(specifier, fromFile, language), (ref) => this.resolver.resolveNow(ref));
|
|
954
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
955
|
+
console.error(`[phase-timing] sync-name-matched-imports: ${Date.now() - tNamed}ms (${nameMatched} refs re-opened)`);
|
|
956
|
+
const tRetargeted = Date.now();
|
|
957
|
+
const retargeted = (result.reExportsChangedFilePaths ?? []).flatMap((filePath) => {
|
|
958
|
+
const file = this.queries.getFileByPath(filePath);
|
|
959
|
+
return file ? [{ path: filePath, language: file.language }] : [];
|
|
960
|
+
});
|
|
961
|
+
const throughRetargeted = retargeted.length === 0 ? 0
|
|
962
|
+
: reopenReferencesThroughRetargetedModules(this.queries, importReader, retargeted);
|
|
963
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
964
|
+
console.error(`[phase-timing] sync-retargeted-modules: ${Date.now() - tRetargeted}ms (${throughRetargeted} refs re-opened)`);
|
|
965
|
+
const tMembers = Date.now();
|
|
966
|
+
const throughMembers = editedModules.length === 0 || process.env.CODEGRAPH_NO_REBIND === '1' ? 0
|
|
967
|
+
: reopenReferencesThroughObjectMembers(this.queries, importReader, editedModules, (filePath) => {
|
|
968
|
+
try {
|
|
969
|
+
return fs.readFileSync(path.join(this.projectRoot, filePath), 'utf-8').split('\n');
|
|
970
|
+
}
|
|
971
|
+
catch {
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
976
|
+
console.error(`[phase-timing] sync-object-members: ${Date.now() - tMembers}ms (${throughMembers} refs re-opened)`);
|
|
926
977
|
}
|
|
927
978
|
else {
|
|
928
|
-
// No git info — use batched resolution to avoid OOM
|
|
929
979
|
const unresolvedCount = this.queries.getUnresolvedReferencesCount();
|
|
930
980
|
options.onProgress?.({
|
|
931
981
|
phase: 'resolving',
|
|
@@ -947,39 +997,77 @@ class CodeGraph {
|
|
|
947
997
|
}, backpressure, false);
|
|
948
998
|
}
|
|
949
999
|
}
|
|
950
|
-
// Re-open resolution edges this sync may have invalidated ELSEWHERE in
|
|
951
|
-
// the repo (CG-33). Everything above re-resolves references in the
|
|
952
|
-
// changed files; this covers the opposite direction — references in
|
|
953
|
-
// files the sync never touched whose answer depended on a definition
|
|
954
|
-
// that just appeared or disappeared. Without it a synced index never
|
|
955
|
-
// converges to a full rebuild: measured at 4.3% of distinct edges wrong
|
|
956
|
-
// on codegraph's own index, in both directions, mostly `calls`. The
|
|
957
|
-
// resurrected refs are pending rows, so the orphan sweep immediately
|
|
958
|
-
// below is what resolves them — batched, yielding, multi-pass, exactly
|
|
959
|
-
// as a full index resolves.
|
|
960
|
-
//
|
|
961
|
-
// `definitionDelta` is empty for a body-only edit, so the overwhelmingly
|
|
962
|
-
// common sync pays one branch. CODEGRAPH_NO_REBIND=1 disables it.
|
|
963
1000
|
if (result.definitionDelta && process.env.CODEGRAPH_NO_REBIND !== '1') {
|
|
964
1001
|
const tRebind = Date.now();
|
|
965
|
-
const rebound = this.orchestrator.resurrectStaleResolutionEdges(result.definitionDelta, result.changedFilePaths ?? []);
|
|
1002
|
+
const rebound = this.orchestrator.resurrectStaleResolutionEdges(result.definitionDelta, result.changedFilePaths ?? [], edgesBeforeRetry);
|
|
1003
|
+
const reopenedFailed = this.queries.reopenFailedReferences(this.queries.getRetryableFailedReferences(result.definitionDelta).flatMap((ref) => (ref.rowId === undefined ? [] : [ref.rowId])));
|
|
1004
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
1005
|
+
console.error(`[phase-timing] sync-rebind: ${Date.now() - tRebind}ms (${result.definitionDelta.length} changed names, ${rebound} edges and ${reopenedFailed} failed refs re-opened)`);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
if (filesChanged && result.changedFilePaths) {
|
|
1009
|
+
const tModules = Date.now();
|
|
1010
|
+
const reopened = this.resolver.reopenRouteModuleReaders(result.changedFilePaths);
|
|
966
1011
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
967
|
-
console.error(`[phase-timing] sync-
|
|
1012
|
+
console.error(`[phase-timing] sync-route-modules: ${Date.now() - tModules}ms (${reopened} refs re-opened)`);
|
|
968
1013
|
}
|
|
969
1014
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1015
|
+
{
|
|
1016
|
+
const before = this.queries.getMetadata(PYTHON_ROOTS_METADATA_KEY);
|
|
1017
|
+
const now = this.resolver.getPythonRootFingerprint();
|
|
1018
|
+
if (before !== null && before !== now) {
|
|
1019
|
+
this.resolver.clearCaches();
|
|
1020
|
+
this.orchestrator.resurrectResolutionEdgesForLanguage('python');
|
|
1021
|
+
refreshSynthesis = true;
|
|
1022
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
1023
|
+
}
|
|
1024
|
+
else if (before !== null) {
|
|
1025
|
+
const after = this.pythonFilePaths();
|
|
1026
|
+
const moved = [...after].filter((f) => !pythonFilesBefore.has(f));
|
|
1027
|
+
for (const f of pythonFilesBefore)
|
|
1028
|
+
if (!after.has(f))
|
|
1029
|
+
moved.push(f);
|
|
1030
|
+
const reopened = new Set();
|
|
1031
|
+
if (moved.length > 0) {
|
|
1032
|
+
this.resolver.clearCaches();
|
|
1033
|
+
for (const f of this.orchestrator.resurrectResolutionEdgesTouching('python', this.resolver.getPythonReopenScope(moved)))
|
|
1034
|
+
reopened.add(f);
|
|
1035
|
+
}
|
|
1036
|
+
const editedInits = (result.changedFilePaths ?? []).filter((f) => pythonFilesBefore.has(f) && after.has(f) && /(?:^|[\\/])__init__\.py$/.test(f));
|
|
1037
|
+
if (editedInits.length > 0) {
|
|
1038
|
+
this.resolver.clearCaches();
|
|
1039
|
+
for (const f of this.orchestrator.resurrectPythonPackageImporters(this.resolver.getPythonPackageImporters(editedInits)))
|
|
1040
|
+
reopened.add(f);
|
|
1041
|
+
}
|
|
1042
|
+
const scriptModules = this.resolver.getPythonScriptModuleScope((result.changedFilePaths ?? []).filter((f) => pythonFilesBefore.has(f) && after.has(f)));
|
|
1043
|
+
if (scriptModules.targetFiles.length > 0) {
|
|
1044
|
+
this.resolver.clearCaches();
|
|
1045
|
+
for (const f of this.orchestrator.resurrectResolutionEdgesTouching('python', scriptModules))
|
|
1046
|
+
reopened.add(f);
|
|
1047
|
+
}
|
|
1048
|
+
if (reopened.size > 0) {
|
|
1049
|
+
this.resolver.resolveAndPersist(this.queries.getUnresolvedReferencesByFiles([...reopened]));
|
|
1050
|
+
if (!refreshSynthesis && [...reopened].some((f) => this.queries.hasSynthesizedEdgesTouchingFile(f) || this.queries.wasSynthesisInput(f))) {
|
|
1051
|
+
refreshSynthesis = true;
|
|
1052
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
if (before !== now)
|
|
1057
|
+
this.stampPythonRootFingerprint(now);
|
|
1058
|
+
}
|
|
1059
|
+
{
|
|
1060
|
+
const before = this.queries.getMetadata(PHP_WEB_ROOTS_METADATA_KEY);
|
|
1061
|
+
const now = this.resolver.getPhpWebRootSnapshot();
|
|
1062
|
+
if (before !== null && this.resolver.phpWebRootsMoved(before, now)) {
|
|
1063
|
+
this.resolver.clearCaches();
|
|
1064
|
+
this.orchestrator.resurrectResolutionEdgesForLanguage('php');
|
|
1065
|
+
refreshSynthesis = true;
|
|
1066
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
1067
|
+
}
|
|
1068
|
+
if (before !== now)
|
|
1069
|
+
this.stampPhpWebRoots(now);
|
|
1070
|
+
}
|
|
983
1071
|
result.pendingRefsProcessed = 0;
|
|
984
1072
|
result.pendingRefsResolved = 0;
|
|
985
1073
|
result.pendingRefsUnresolved = 0;
|
|
@@ -1007,57 +1095,67 @@ class CodeGraph {
|
|
|
1007
1095
|
result.pendingRefsResolved = recovery.stats.resolved;
|
|
1008
1096
|
result.pendingRefsUnresolved = recovery.stats.unresolved;
|
|
1009
1097
|
}
|
|
1098
|
+
if (process.env.CODEGRAPH_NO_REBIND !== '1') {
|
|
1099
|
+
const touched = [...(result.changedFilePaths ?? []), ...(result.removedFilePaths ?? [])];
|
|
1100
|
+
const touchedPy = touched.filter((p) => /\.pyi?$/.test(p));
|
|
1101
|
+
if (touched.length > 0) {
|
|
1102
|
+
const tTypes = Date.now();
|
|
1103
|
+
const reopenedFiles = this.orchestrator.resurrectTypeDependentEdges(touched, result.changedFilePaths ?? []);
|
|
1104
|
+
const ceiling = Number(process.env.CODEGRAPH_PY_ATTR_RETRY_CEILING ?? '') || 2000;
|
|
1105
|
+
const failed = touchedPy.length > 0 ? this.resolver.pythonAttrRetryCandidates(touchedPy, ceiling) : [];
|
|
1106
|
+
const retry = [...this.queries.getUnresolvedReferencesByFiles(reopenedFiles), ...(failed ?? [])];
|
|
1107
|
+
if (retry.length > 0)
|
|
1108
|
+
await this.resolver.resolveAndPersistListYielding(retry);
|
|
1109
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
1110
|
+
console.error(`[phase-timing] sync-type-rebind: ${Date.now() - tTypes}ms (${retry.length} refs${failed ? '' : ', failed-ref fan-in over ceiling'})`);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1010
1114
|
if (filesChanged || orphanCount > 0) {
|
|
1011
|
-
// Second pass: chained calls whose method lives on a supertype the
|
|
1012
|
-
// receiver conforms to (protocol-extension / inherited). Needs the
|
|
1013
|
-
// implements/extends edges built above (#750).
|
|
1014
1115
|
await this.resolver.resolveChainedCallsViaConformance();
|
|
1015
|
-
// Same lifecycle for `this.<member>` callback registrations whose
|
|
1016
|
-
// member is inherited from a supertype (#808).
|
|
1017
1116
|
await this.resolver.resolveDeferredThisMemberRefs();
|
|
1018
1117
|
}
|
|
1118
|
+
let synthesized = false;
|
|
1019
1119
|
if (refreshSynthesis) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1120
|
+
const hold = this.synthesisHoldMs();
|
|
1121
|
+
if (hold > 0) {
|
|
1122
|
+
this.armDeferredSynthesis(hold);
|
|
1123
|
+
}
|
|
1124
|
+
else {
|
|
1125
|
+
await this.resolver.refreshSynthesis(this.db.getPath(), (done, total) => {
|
|
1126
|
+
options.onProgress?.({ phase: 'linking', current: done, total });
|
|
1127
|
+
}, backpressure);
|
|
1128
|
+
this.queries.setMetadata('synthesis_pending', '0');
|
|
1129
|
+
this.lastSynthesisAt = Date.now();
|
|
1130
|
+
synthesized = true;
|
|
1131
|
+
}
|
|
1024
1132
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1133
|
+
if (filesChanged || result.filesRemoved > 0 || orphanCount > 0) {
|
|
1134
|
+
await this.resolver.resolveParameterFlows(flowChange);
|
|
1135
|
+
}
|
|
1136
|
+
if (filesChanged || result.filesRemoved > 0 || orphanCount > 0 || synthesized) {
|
|
1028
1137
|
await this.db.runMaintenance();
|
|
1029
1138
|
}
|
|
1030
|
-
// Heal the segment vocabulary on indexes built before the table
|
|
1031
|
-
// existed (upgrade path): incremental writes above only cover changed
|
|
1032
|
-
// files, so a vocab that was empty when this sync STARTED means the
|
|
1033
|
-
// bulk was never segmented — backfill it (INSERT OR IGNORE, so the
|
|
1034
|
-
// rows the sync just wrote are fine). Batched + yielding — sync can
|
|
1035
|
-
// run on the daemon's liveness-watchdog thread (#850/#1091).
|
|
1036
1139
|
try {
|
|
1037
1140
|
if (vocabWasEmpty && this.queries.getNodeAndEdgeCount().nodes > 0) {
|
|
1038
1141
|
await this.rebuildNameSegmentVocab();
|
|
1039
1142
|
}
|
|
1040
1143
|
}
|
|
1041
|
-
catch {
|
|
1042
|
-
// A killed full index leaves this marker at `indexing`. Sync repairs
|
|
1043
|
-
// missing files, pending refs, and (on open) dropped indexes, so a
|
|
1044
|
-
// successful recovery must also close the metadata state (#1556).
|
|
1144
|
+
catch { }
|
|
1045
1145
|
if (fullReconcile && this.getIndexState() === 'indexing') {
|
|
1046
1146
|
try {
|
|
1047
1147
|
this.queries.setMetadata('index_state', 'complete');
|
|
1048
1148
|
}
|
|
1049
|
-
catch {
|
|
1149
|
+
catch { }
|
|
1050
1150
|
}
|
|
1051
1151
|
this.orchestrator.finishGitIndexState(gitState, fullReconcile, result.failedFilePaths);
|
|
1052
1152
|
if (fullReconcile && result.filesChecked > 0)
|
|
1053
1153
|
this.pendingFullReconcile = false;
|
|
1154
|
+
this.stampModuleConfigSnapshotIfMoved();
|
|
1155
|
+
result.durationMs = Date.now() - startedAt;
|
|
1054
1156
|
return result;
|
|
1055
1157
|
}
|
|
1056
1158
|
finally {
|
|
1057
|
-
// Mirror indexAll's teardown: stop the valve, then restore the
|
|
1058
|
-
// auto-checkpoint interval (runMaintenance above already folded the
|
|
1059
|
-
// WAL on the success path; on the error path SQLite replays it on
|
|
1060
|
-
// the next open).
|
|
1061
1159
|
if (walValve) {
|
|
1062
1160
|
walValve.stop();
|
|
1063
1161
|
await walValve.drain();
|
|
@@ -1066,26 +1164,92 @@ class CodeGraph {
|
|
|
1066
1164
|
try {
|
|
1067
1165
|
this.db.setWalAutocheckpoint(priorAutocheckpoint);
|
|
1068
1166
|
}
|
|
1069
|
-
catch {
|
|
1167
|
+
catch { }
|
|
1070
1168
|
}
|
|
1071
1169
|
this.fileLock.release();
|
|
1072
1170
|
}
|
|
1073
1171
|
});
|
|
1074
1172
|
}
|
|
1075
|
-
/**
|
|
1076
|
-
* Check if an indexing operation is currently in progress
|
|
1077
|
-
*/
|
|
1078
1173
|
isIndexing() {
|
|
1079
1174
|
return this.indexMutex.isLocked();
|
|
1080
1175
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1176
|
+
synthesisHoldMs() {
|
|
1177
|
+
const interval = parseSynthMinIntervalEnv(process.env.CODEGRAPH_SYNTH_MIN_INTERVAL_MS);
|
|
1178
|
+
if (!interval || this.lastSynthesisAt === 0)
|
|
1179
|
+
return 0;
|
|
1180
|
+
return Math.max(0, this.lastSynthesisAt + interval - Date.now());
|
|
1181
|
+
}
|
|
1182
|
+
armDeferredSynthesis(delayMs) {
|
|
1183
|
+
if (this.deferredSynthesisTimer)
|
|
1184
|
+
return;
|
|
1185
|
+
this.deferredSynthesisTimer = setTimeout(() => {
|
|
1186
|
+
this.deferredSynthesisTimer = null;
|
|
1187
|
+
void this.runDeferredSynthesis();
|
|
1188
|
+
}, delayMs);
|
|
1189
|
+
this.deferredSynthesisTimer.unref?.();
|
|
1190
|
+
}
|
|
1191
|
+
async runDeferredSynthesis() {
|
|
1192
|
+
const retryLater = () => {
|
|
1193
|
+
if (!this.db.isOpen())
|
|
1194
|
+
return;
|
|
1195
|
+
this.armDeferredSynthesis(parseSynthMinIntervalEnv(process.env.CODEGRAPH_SYNTH_MIN_INTERVAL_MS) ?? 1000);
|
|
1196
|
+
};
|
|
1197
|
+
try {
|
|
1198
|
+
await this.indexMutex.withLock(async () => {
|
|
1199
|
+
if (this.queries.getMetadata('synthesis_pending') !== '1')
|
|
1200
|
+
return;
|
|
1201
|
+
try {
|
|
1202
|
+
this.fileLock.acquire();
|
|
1203
|
+
}
|
|
1204
|
+
catch {
|
|
1205
|
+
retryLater();
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
try {
|
|
1209
|
+
this.reopenReplacedDatabase();
|
|
1210
|
+
if (this.queries.getMetadata('synthesis_pending') !== '1')
|
|
1211
|
+
return;
|
|
1212
|
+
await this.synthesizeWithWalDeferred();
|
|
1213
|
+
}
|
|
1214
|
+
finally {
|
|
1215
|
+
this.fileLock.release();
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
catch (err) {
|
|
1220
|
+
(0, errors_1.logWarn)(`Put-off synthesis failed, trying again after the interval: ${err instanceof Error ? err.message : String(err)}`);
|
|
1221
|
+
retryLater();
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
async synthesizeWithWalDeferred() {
|
|
1225
|
+
const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
1226
|
+
let walValve = null;
|
|
1227
|
+
let priorAutocheckpoint = 1000;
|
|
1228
|
+
if (deferWal) {
|
|
1229
|
+
priorAutocheckpoint = this.db.getWalAutocheckpoint();
|
|
1230
|
+
this.db.setWalAutocheckpoint(0);
|
|
1231
|
+
walValve = new wal_valve_1.WalCheckpointValve(this.db, (0, wal_valve_1.resolveWalValveMb)(process.env.CODEGRAPH_WAL_VALVE_MB, this.db.getDbFileSizeBytes()));
|
|
1232
|
+
walValve.start();
|
|
1233
|
+
}
|
|
1234
|
+
try {
|
|
1235
|
+
await this.resolver.refreshSynthesis(this.db.getPath(), undefined, walValve ? () => walValve.backpressure() : undefined);
|
|
1236
|
+
this.queries.setMetadata('synthesis_pending', '0');
|
|
1237
|
+
this.lastSynthesisAt = Date.now();
|
|
1238
|
+
await this.db.runMaintenance();
|
|
1239
|
+
}
|
|
1240
|
+
finally {
|
|
1241
|
+
if (walValve) {
|
|
1242
|
+
walValve.stop();
|
|
1243
|
+
await walValve.drain();
|
|
1244
|
+
}
|
|
1245
|
+
if (deferWal) {
|
|
1246
|
+
try {
|
|
1247
|
+
this.db.setWalAutocheckpoint(priorAutocheckpoint);
|
|
1248
|
+
}
|
|
1249
|
+
catch { }
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1089
1253
|
isIndexedFileStateCurrent(filePath) {
|
|
1090
1254
|
const tracked = this.queries.getFileByPath(filePath);
|
|
1091
1255
|
if (!tracked)
|
|
@@ -1099,221 +1263,98 @@ class CodeGraph {
|
|
|
1099
1263
|
Math.floor(stat.mtimeMs) === Math.floor(tracked.modifiedAt));
|
|
1100
1264
|
}
|
|
1101
1265
|
catch {
|
|
1102
|
-
// Missing/inaccessible files must still reach sync so removals and
|
|
1103
|
-
// transient filesystem failures are reconciled rather than hidden.
|
|
1104
1266
|
return false;
|
|
1105
1267
|
}
|
|
1106
1268
|
}
|
|
1107
|
-
/**
|
|
1108
|
-
* Start watching for file changes and auto-syncing.
|
|
1109
|
-
*
|
|
1110
|
-
* Uses native OS file events (FSEvents on macOS, inotify on Linux 19+,
|
|
1111
|
-
* ReadDirectoryChangesW on Windows) with debouncing to avoid thrashing.
|
|
1112
|
-
*
|
|
1113
|
-
* @param options - Watch options (debounce delay, callbacks)
|
|
1114
|
-
* @returns true if watching started successfully
|
|
1115
|
-
*/
|
|
1116
1269
|
watch(options = {}) {
|
|
1117
1270
|
if (this.watcher?.isActive())
|
|
1118
1271
|
return true;
|
|
1119
|
-
this.watcher = new
|
|
1272
|
+
this.watcher = new ((0, lazy_engine_1.engine)().FileWatcher)(this.projectRoot, async (paths) => {
|
|
1120
1273
|
const result = await this.sync({ paths });
|
|
1121
1274
|
const filesChanged = result.filesAdded + result.filesModified + result.filesRemoved;
|
|
1122
1275
|
return { filesChanged, durationMs: result.durationMs };
|
|
1123
1276
|
}, options, process.platform === 'win32'
|
|
1124
1277
|
? (filePath) => this.isIndexedFileStateCurrent(filePath)
|
|
1125
1278
|
: undefined);
|
|
1126
|
-
|
|
1279
|
+
this.orchestrator.setKeepDetectionContents(true);
|
|
1280
|
+
const started = this.watcher.start();
|
|
1281
|
+
if (!started)
|
|
1282
|
+
this.orchestrator.setKeepDetectionContents(false);
|
|
1283
|
+
return started;
|
|
1127
1284
|
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Stop watching for file changes.
|
|
1130
|
-
*/
|
|
1131
1285
|
unwatch() {
|
|
1132
1286
|
if (this.watcher) {
|
|
1133
1287
|
this.watcher.stop();
|
|
1134
1288
|
this.watcher = null;
|
|
1135
1289
|
}
|
|
1290
|
+
if (this.builtOrchestrator)
|
|
1291
|
+
this.builtOrchestrator.setKeepDetectionContents(false);
|
|
1136
1292
|
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Check if the file watcher is active.
|
|
1139
|
-
*/
|
|
1140
1293
|
isWatching() {
|
|
1141
1294
|
return this.watcher?.isActive() ?? false;
|
|
1142
1295
|
}
|
|
1143
|
-
/**
|
|
1144
|
-
* True once live watching has degraded, or while a re-armed watcher has not
|
|
1145
|
-
* completed its full catch-up. Distinct from `!isWatching()`: a stopped or
|
|
1146
|
-
* never-started watcher is inactive but NOT degraded. MCP tools use this for
|
|
1147
|
-
* a whole-index stale notice, since pending files are lost when watching
|
|
1148
|
-
* stops (#876, #1959).
|
|
1149
|
-
*/
|
|
1150
1296
|
isWatcherDegraded() {
|
|
1151
1297
|
return this.watcher?.isDegraded() ?? false;
|
|
1152
1298
|
}
|
|
1153
|
-
/** The reason live watching degraded, or null if it is healthy (#876). */
|
|
1154
1299
|
getWatcherDegradedReason() {
|
|
1155
1300
|
return this.watcher?.getDegradedReason() ?? null;
|
|
1156
1301
|
}
|
|
1157
|
-
/** Re-arm a lock-degraded watcher; its stale state persists until a full sync. */
|
|
1158
1302
|
rearmWatcherAfterLockContention() {
|
|
1159
1303
|
return this.watcher?.rearmAfterLockContention() ?? false;
|
|
1160
1304
|
}
|
|
1161
|
-
/** True while a re-armed watcher owes a full reconcile of missed changes. */
|
|
1162
1305
|
isWatcherRecovering() {
|
|
1163
1306
|
return this.watcher?.isRecoveringFromLock() ?? false;
|
|
1164
1307
|
}
|
|
1165
|
-
/**
|
|
1166
|
-
* Files seen by the file watcher since the last successful sync —
|
|
1167
|
-
* the per-file "stale" signal MCP tools attach to responses so an agent
|
|
1168
|
-
* can fall back to {@link Read} for just the affected file without
|
|
1169
|
-
* waiting for a debounced sync to complete (issue #403).
|
|
1170
|
-
*
|
|
1171
|
-
* Returns an empty list when the watcher isn't active, or no events have
|
|
1172
|
-
* arrived. Each entry includes `firstSeenMs` and `lastSeenMs` (wall-clock
|
|
1173
|
-
* `Date.now()` values) so callers can render "edited Nms ago", plus an
|
|
1174
|
-
* `indexing` flag indicating whether the in-flight sync (if any) will
|
|
1175
|
-
* absorb that file.
|
|
1176
|
-
*/
|
|
1177
1308
|
getPendingFiles() {
|
|
1178
1309
|
return this.watcher?.getPendingFiles() ?? [];
|
|
1179
1310
|
}
|
|
1180
|
-
/**
|
|
1181
|
-
* Resolves once the file watcher has installed its watch set. Useful for
|
|
1182
|
-
* tests that need a deterministic boundary before asserting on
|
|
1183
|
-
* `getPendingFiles()`. Resolves immediately when no watcher is active.
|
|
1184
|
-
*/
|
|
1185
1311
|
waitUntilWatcherReady(timeoutMs) {
|
|
1186
1312
|
return this.watcher ? this.watcher.waitUntilReady(timeoutMs) : Promise.resolve();
|
|
1187
1313
|
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Get files that have changed since last index
|
|
1190
|
-
*/
|
|
1191
1314
|
getChangedFiles() {
|
|
1192
1315
|
return this.orchestrator.getChangedFiles();
|
|
1193
1316
|
}
|
|
1194
|
-
/**
|
|
1195
|
-
* Most recent index timestamp (ms since epoch) across all tracked files, or
|
|
1196
|
-
* null when nothing is indexed yet. Lets library consumers check index
|
|
1197
|
-
* freshness without shelling out to `codegraph status --json`. (#329)
|
|
1198
|
-
*/
|
|
1199
1317
|
getLastIndexedAt() {
|
|
1200
1318
|
return this.queries.getLastIndexedAt();
|
|
1201
1319
|
}
|
|
1202
|
-
/**
|
|
1203
|
-
* How far the last sync got and how many files it left behind — the cheapest
|
|
1204
|
-
* marker of "has this index moved". One query; safe to call on every
|
|
1205
|
-
* filesystem event a live viewer sees.
|
|
1206
|
-
*/
|
|
1207
1320
|
getIndexRevision() {
|
|
1208
1321
|
return this.queries.getIndexRevision();
|
|
1209
1322
|
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Files re-indexed strictly after `since`, newest first — what a sync just
|
|
1212
|
-
* picked up. `total` is the real count, `paths` is capped at `limit`.
|
|
1213
|
-
*/
|
|
1214
1323
|
getFilesIndexedSince(since, limit) {
|
|
1215
1324
|
return this.queries.getFilesIndexedSince(since, limit);
|
|
1216
1325
|
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Forget everything held in memory about rows another process may have
|
|
1219
|
-
* changed.
|
|
1220
|
-
*
|
|
1221
|
-
* The query layer keeps an LRU of nodes by id, invalidated by writes made
|
|
1222
|
-
* through THIS instance — which is exactly right for a process that owns the
|
|
1223
|
-
* index, and wrong for one that is only reading a database somebody else is
|
|
1224
|
-
* writing. A long-lived reader (the `codegraph ui` server, a daemon holding a
|
|
1225
|
-
* graph open across an agent's edits) will otherwise answer `getNode(id)`
|
|
1226
|
-
* with a row a sync deleted minutes ago, while every SQL-backed query beside
|
|
1227
|
-
* it reports the truth — a disagreement that reads as a bug in whichever
|
|
1228
|
-
* screen shows both.
|
|
1229
|
-
*
|
|
1230
|
-
* Cheap (clearing a bounded Map) and safe to call whenever the database file
|
|
1231
|
-
* looks like it moved.
|
|
1232
|
-
*/
|
|
1233
1326
|
dropReadCaches() {
|
|
1234
1327
|
this.queries.clearCache();
|
|
1235
1328
|
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Completeness of the last full index run. `'complete'` is the only good
|
|
1238
|
-
* state. `'indexing'` after the fact means a run was killed mid-index (OOM,
|
|
1239
|
-
* SIGKILL, liveness watchdog) and the on-disk index is truncated;
|
|
1240
|
-
* `'partial'` means the run finished but silently dropped files
|
|
1241
|
-
* (discovered > indexed+skipped+errored); `'failed'` means it reported
|
|
1242
|
-
* failure. `null` = index predates this marker. Surfaced by
|
|
1243
|
-
* `codegraph status`.
|
|
1244
|
-
*/
|
|
1245
1329
|
getIndexState() {
|
|
1246
1330
|
const raw = this.queries.getMetadata('index_state');
|
|
1247
1331
|
return raw === 'indexing' || raw === 'complete' || raw === 'partial' || raw === 'failed'
|
|
1248
1332
|
? raw
|
|
1249
1333
|
: null;
|
|
1250
1334
|
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Which engine built the current index: the package version + extraction
|
|
1253
|
-
* version stamped at the last full `indexAll`. Either field is null for an
|
|
1254
|
-
* index built before stamping existed (treated as stale). See
|
|
1255
|
-
* `extraction-version.ts` and `isIndexStale()`.
|
|
1256
|
-
*/
|
|
1257
1335
|
getIndexBuildInfo() {
|
|
1258
1336
|
const version = this.queries.getMetadata('indexed_with_version');
|
|
1259
1337
|
const ev = this.queries.getMetadata('indexed_with_extraction_version');
|
|
1260
1338
|
const parsed = ev != null ? parseInt(ev, 10) : NaN;
|
|
1261
1339
|
return { version, extractionVersion: Number.isFinite(parsed) ? parsed : null };
|
|
1262
1340
|
}
|
|
1263
|
-
/**
|
|
1264
|
-
* True when the on-disk index was built by an engine whose extraction is
|
|
1265
|
-
* older than the one now running — i.e. a re-index would add data a migration
|
|
1266
|
-
* can't backfill. False when there's no index yet (nothing to refresh) or the
|
|
1267
|
-
* stamp is current. This is the signal behind `codegraph status`'s re-index
|
|
1268
|
-
* hint and `codegraph upgrade`'s reminder.
|
|
1269
|
-
*/
|
|
1270
1341
|
isIndexStale() {
|
|
1271
1342
|
if (this.queries.getLastIndexedAt() == null)
|
|
1272
1343
|
return false;
|
|
1273
1344
|
const { extractionVersion } = this.getIndexBuildInfo();
|
|
1274
1345
|
return extractionVersion == null || extractionVersion < extraction_version_1.EXTRACTION_VERSION;
|
|
1275
1346
|
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Extract nodes and edges from source code (without storing)
|
|
1278
|
-
*/
|
|
1279
1347
|
extractFromSource(filePath, source) {
|
|
1280
|
-
return (0,
|
|
1281
|
-
}
|
|
1282
|
-
// ===========================================================================
|
|
1283
|
-
// Reference Resolution
|
|
1284
|
-
// ===========================================================================
|
|
1285
|
-
/**
|
|
1286
|
-
* Resolve unresolved references and create edges
|
|
1287
|
-
*
|
|
1288
|
-
* This method takes unresolved references from extraction and attempts
|
|
1289
|
-
* to resolve them using multiple strategies:
|
|
1290
|
-
* - Framework-specific patterns (React, Express, Laravel)
|
|
1291
|
-
* - Import-based resolution
|
|
1292
|
-
* - Name-based symbol matching
|
|
1293
|
-
*/
|
|
1348
|
+
return (0, lazy_engine_1.engine)().extractFromSource(filePath, source, (0, grammars_1.detectLanguage)(filePath, source, undefined, this.projectRoot));
|
|
1349
|
+
}
|
|
1294
1350
|
resolveReferences(onProgress) {
|
|
1295
|
-
// Get all unresolved references from the database
|
|
1296
1351
|
const unresolvedRefs = this.queries.getUnresolvedReferences();
|
|
1297
1352
|
return this.resolver.resolveAndPersist(unresolvedRefs, onProgress);
|
|
1298
1353
|
}
|
|
1299
|
-
|
|
1300
|
-
* Resolve references in batches to keep memory bounded on large codebases.
|
|
1301
|
-
* Processes chunks of unresolved refs, persisting results after each batch.
|
|
1302
|
-
*/
|
|
1303
|
-
async resolveReferencesBatched(onProgress, onSynthesisProgress,
|
|
1304
|
-
// The WAL valve's writer-side backstop, threaded into the batch loop's
|
|
1305
|
-
// pool-idle boundaries. Without it the valve's only lever during
|
|
1306
|
-
// resolution is timer-driven passive checkpoints, which the pool's
|
|
1307
|
-
// continuous reads keep perpetually partial — the WAL then accretes the
|
|
1308
|
-
// whole phase's write volume (22GB on a 4.6GB DB at kernel scale).
|
|
1309
|
-
backpressure, synthesize = true) {
|
|
1354
|
+
async resolveReferencesBatched(onProgress, onSynthesisProgress, backpressure, synthesize = true, frameworksCurrent = false) {
|
|
1310
1355
|
return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, {
|
|
1311
1356
|
dbPath: this.db.getPath(),
|
|
1312
|
-
|
|
1313
|
-
// edge indexes for the batch loop and recreates them before synthesis
|
|
1314
|
-
// (which reads kind-keyed). Concurrent readers (a daemon serving this
|
|
1315
|
-
// project mid-index) stay CORRECT during the window — target/kind reads
|
|
1316
|
-
// just degrade to scans until the recreate.
|
|
1357
|
+
shareFrameworks: frameworksCurrent,
|
|
1317
1358
|
bulkEdgeLoad: {
|
|
1318
1359
|
begin: () => this.db.beginBulkEdgeLoad(),
|
|
1319
1360
|
end: () => this.db.endBulkEdgeLoad({ deferSynthesisSite: true }),
|
|
@@ -1326,306 +1367,142 @@ class CodeGraph {
|
|
|
1326
1367
|
backpressure,
|
|
1327
1368
|
}, synthesize);
|
|
1328
1369
|
}
|
|
1329
|
-
/**
|
|
1330
|
-
* References extracted but never attempted by a resolution pass. Zero on a
|
|
1331
|
-
* healthy index — a completed pass consumes every pending row (resolving it
|
|
1332
|
-
* or parking it as failed, #1240). Non-zero at rest means a pass was
|
|
1333
|
-
* interrupted mid-run (killed indexer, crash — #1187), so some files' call
|
|
1334
|
-
* edges are missing; the next `sync` sweeps them.
|
|
1335
|
-
*/
|
|
1336
1370
|
getPendingReferenceCount() {
|
|
1337
1371
|
return this.queries.getUnresolvedReferencesCount();
|
|
1338
1372
|
}
|
|
1339
|
-
/**
|
|
1340
|
-
* Get detected frameworks in the project
|
|
1341
|
-
*/
|
|
1342
1373
|
getDetectedFrameworks() {
|
|
1343
1374
|
return this.resolver.getDetectedFrameworks();
|
|
1344
1375
|
}
|
|
1345
|
-
/**
|
|
1346
|
-
* Re-initialize the resolver (useful after adding new files)
|
|
1347
|
-
*/
|
|
1348
1376
|
reinitializeResolver() {
|
|
1349
1377
|
this.resolver.initialize();
|
|
1350
1378
|
}
|
|
1351
|
-
// ===========================================================================
|
|
1352
|
-
// Graph Statistics
|
|
1353
|
-
// ===========================================================================
|
|
1354
|
-
/**
|
|
1355
|
-
* Get statistics about the knowledge graph
|
|
1356
|
-
*/
|
|
1357
1379
|
getStats() {
|
|
1358
1380
|
const stats = this.queries.getStats();
|
|
1359
1381
|
stats.dbSizeBytes = this.db.getSize();
|
|
1360
1382
|
stats.walSizeBytes = this.db.getWalSizeBytes();
|
|
1361
1383
|
return stats;
|
|
1362
1384
|
}
|
|
1363
|
-
/**
|
|
1364
|
-
* Active SQLite backend for this project's connection (`node-sqlite` — Node's
|
|
1365
|
-
* built-in real-SQLite module). Surfaced via `codegraph status` and the
|
|
1366
|
-
* `codegraph_status` MCP tool alongside the effective journal mode.
|
|
1367
|
-
*/
|
|
1368
1385
|
getBackend() {
|
|
1369
1386
|
return this.db.getBackend();
|
|
1370
1387
|
}
|
|
1371
|
-
/**
|
|
1372
|
-
* The journal mode actually in effect ('wal', 'delete', …). 'wal' means
|
|
1373
|
-
* readers never block on a concurrent writer; anything else means they can,
|
|
1374
|
-
* which is the precondition for the "database is locked" failures in issue
|
|
1375
|
-
* #238. Surfaced via `codegraph status` and the `codegraph_status` MCP tool.
|
|
1376
|
-
*/
|
|
1377
1388
|
getJournalMode() {
|
|
1378
1389
|
return this.db.getJournalMode();
|
|
1379
1390
|
}
|
|
1380
|
-
// ===========================================================================
|
|
1381
|
-
// Node Operations
|
|
1382
|
-
// ===========================================================================
|
|
1383
|
-
/**
|
|
1384
|
-
* Get a node by ID
|
|
1385
|
-
*/
|
|
1386
1391
|
getNode(id) {
|
|
1387
1392
|
return this.queries.getNodeById(id);
|
|
1388
1393
|
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Get many nodes by id in ONE round-trip (LRU-cache aware).
|
|
1391
|
-
*
|
|
1392
|
-
* The batch form of {@link getNode}. Anything resolving a list of edges to
|
|
1393
|
-
* their endpoints — a caller list, a callee rail, an impact set — must use
|
|
1394
|
-
* this rather than a `getNode` per edge: a symbol with 500 callers is 500
|
|
1395
|
-
* queries otherwise. Ids that name nothing are simply absent from the map.
|
|
1396
|
-
*/
|
|
1397
1394
|
getNodesByIds(ids) {
|
|
1398
1395
|
return this.queries.getNodesByIds(ids);
|
|
1399
1396
|
}
|
|
1400
|
-
/**
|
|
1401
|
-
* Every symbol carrying an exact qualified name.
|
|
1402
|
-
*
|
|
1403
|
-
* The identity that survives a re-index. A node's id contains its start line,
|
|
1404
|
-
* so any edit ABOVE a symbol gives it a different id — anything that has to
|
|
1405
|
-
* name the same symbol across two indexes (a saved trail, a bookmark, a
|
|
1406
|
-
* review comment) has to key on this instead, and then disambiguate the
|
|
1407
|
-
* result by kind and file. Index-backed; unlike
|
|
1408
|
-
* {@link GraphQueryManager.findByQualifiedName} it takes no pattern and scans
|
|
1409
|
-
* nothing.
|
|
1410
|
-
*/
|
|
1411
1397
|
getNodesByQualifiedName(qualifiedName) {
|
|
1412
1398
|
return this.queries.getNodesByQualifiedNameExact(qualifiedName);
|
|
1413
1399
|
}
|
|
1414
|
-
/**
|
|
1415
|
-
* Outgoing edges for many source nodes at once — the batch form of
|
|
1416
|
-
* {@link getOutgoingEdges}. See {@link QueryBuilder.getOutgoingEdgesFrom}.
|
|
1417
|
-
*/
|
|
1418
1400
|
getOutgoingEdgesFrom(nodeIds, kinds) {
|
|
1419
1401
|
return this.queries.getOutgoingEdgesFrom(nodeIds, kinds);
|
|
1420
1402
|
}
|
|
1421
|
-
/**
|
|
1422
|
-
* Fan-in (incoming edge count) for many nodes at once — the "hub" signal,
|
|
1423
|
-
* without a query per node. See {@link QueryBuilder.countIncomingEdges}.
|
|
1424
|
-
*/
|
|
1425
1403
|
getFanIn(ids) {
|
|
1426
1404
|
return this.queries.countIncomingEdges(ids);
|
|
1427
1405
|
}
|
|
1428
|
-
/**
|
|
1429
|
-
* Incoming edges for many target nodes at once — the mirror of
|
|
1430
|
-
* {@link getOutgoingEdgesFrom}. See {@link QueryBuilder.getIncomingEdgesTo}.
|
|
1431
|
-
*/
|
|
1432
1406
|
getIncomingEdgesTo(nodeIds, kinds) {
|
|
1433
1407
|
return this.queries.getIncomingEdgesTo(nodeIds, kinds);
|
|
1434
1408
|
}
|
|
1435
|
-
/**
|
|
1436
|
-
* Fan-out (outgoing edge count) for many nodes at once — the mirror of
|
|
1437
|
-
* {@link getFanIn}. See {@link QueryBuilder.countOutgoingEdges}.
|
|
1438
|
-
*/
|
|
1439
1409
|
getFanOut(ids) {
|
|
1440
1410
|
return this.queries.countOutgoingEdges(ids);
|
|
1441
1411
|
}
|
|
1442
|
-
/**
|
|
1443
|
-
* Symbols nothing in the index points at, by kind — the candidate set the
|
|
1444
|
-
* dead code report (`src/graph/dead-code.ts`) applies its exclusions to.
|
|
1445
|
-
*
|
|
1446
|
-
* Every edge kind except `contains` counts as a reference, so a method is
|
|
1447
|
-
* not "reached" by the class that holds it. An unreferenced symbol is not
|
|
1448
|
-
* yet a dead one: see {@link buildDeadCodeReport}.
|
|
1449
|
-
*/
|
|
1450
1412
|
getUnreferencedNodes(kinds, limit) {
|
|
1451
1413
|
return this.queries.getUnreferencedNodes(kinds, limit);
|
|
1452
1414
|
}
|
|
1453
|
-
/**
|
|
1454
|
-
* Which of the given names are carried by more than one symbol, at least one
|
|
1455
|
-
* of which something references — the names a "nothing reaches this" claim
|
|
1456
|
-
* must not be made about, because the resolver may have picked the twin.
|
|
1457
|
-
*/
|
|
1458
1415
|
getAmbiguousReferencedNames(names) {
|
|
1459
1416
|
return this.queries.getAmbiguousReferencedNames(names);
|
|
1460
1417
|
}
|
|
1461
|
-
/**
|
|
1462
|
-
* Which of the given languages this index records an export marker for. A
|
|
1463
|
-
* language with none has no "reachable from outside" signal at all.
|
|
1464
|
-
*/
|
|
1465
1418
|
getLanguagesWithExports(languages) {
|
|
1466
1419
|
return this.queries.getLanguagesWithExports(languages);
|
|
1467
1420
|
}
|
|
1468
|
-
/**
|
|
1469
|
-
* Which of the given names the index holds an unresolved reference to — the
|
|
1470
|
-
* resolver saw the name and could not decide what it meant. A symbol with
|
|
1471
|
-
* such a name can never be called unreferenced.
|
|
1472
|
-
*/
|
|
1473
1421
|
getUnresolvedNamesAmong(names) {
|
|
1474
1422
|
return this.queries.getUnresolvedNamesAmong(names);
|
|
1475
1423
|
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Which of the given symbols extend or implement a type outside the index —
|
|
1478
|
-
* an ancestor the resolver could not follow, so it has no edge (#1973).
|
|
1479
|
-
*/
|
|
1480
1424
|
getUnresolvedSupertypeSourcesAmong(nodeIds) {
|
|
1481
1425
|
return this.queries.getUnresolvedSupertypeSourcesAmong(nodeIds);
|
|
1482
1426
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1427
|
+
getUnresolvedReferenceNamesFrom(nodeIds, kinds) {
|
|
1428
|
+
return this.queries.getUnresolvedReferenceNamesFrom(nodeIds, kinds);
|
|
1429
|
+
}
|
|
1430
|
+
getUnresolvedReferenceSourcesNamed(names, kinds) {
|
|
1431
|
+
return this.queries.getUnresolvedReferenceSourcesNamed(names, kinds);
|
|
1432
|
+
}
|
|
1433
|
+
getUnlinkedReferencesNamed(name, limit) {
|
|
1434
|
+
return this.queries.getFailedReferencesByTail(name, ['imports'], limit);
|
|
1435
|
+
}
|
|
1436
|
+
getUnlinkedReferencesWritten(names, limit) {
|
|
1437
|
+
return this.queries.getFailedReferencesByNames(names, limit);
|
|
1438
|
+
}
|
|
1488
1439
|
getTopDependedOn(limit) {
|
|
1489
1440
|
return this.queries.getTopDependedOn(limit);
|
|
1490
1441
|
}
|
|
1491
|
-
/**
|
|
1492
|
-
* The graph's executable roots — files that run something at module level (a
|
|
1493
|
-
* CLI, a worker entry, a script), ranked by calls x the number of other files
|
|
1494
|
-
* they reach. A statement at the top level of a file is recorded as an edge
|
|
1495
|
-
* out of the *file* node, which is what makes these visible at all.
|
|
1496
|
-
*/
|
|
1497
1442
|
getTopCallingFiles(limit) {
|
|
1498
1443
|
return this.queries.getTopCallingFiles(limit);
|
|
1499
1444
|
}
|
|
1500
|
-
/**
|
|
1501
|
-
* How many other files depend on each of the given files, counted through
|
|
1502
|
-
* their symbols (an `imports` edge points at the symbol, not the file).
|
|
1503
|
-
* A zero means nothing else in the index reaches into that file.
|
|
1504
|
-
*/
|
|
1505
1445
|
getFileDependentCounts(filePaths) {
|
|
1506
1446
|
return new Map(this.queries.getFileDependentCounts(filePaths).map((row) => [row.filePath, row.dependents]));
|
|
1507
1447
|
}
|
|
1508
|
-
/**
|
|
1509
|
-
* How far each of the given files reaches out: distinct other files their
|
|
1510
|
-
* symbols touch, and how many references that is. The mirror of
|
|
1511
|
-
* {@link getFileDependentCounts}; a test file's reach is what it exercises.
|
|
1512
|
-
*/
|
|
1513
1448
|
getFileReachCounts(filePaths) {
|
|
1514
1449
|
return new Map(this.queries
|
|
1515
1450
|
.getFileReachCounts(filePaths)
|
|
1516
1451
|
.map((row) => [row.filePath, { reaches: row.reaches, refs: row.refs }]));
|
|
1517
1452
|
}
|
|
1518
|
-
/** The `file` nodes for the given paths, in one query. */
|
|
1519
1453
|
getFileNodes(filePaths) {
|
|
1520
1454
|
return this.queries.getFileNodes(filePaths);
|
|
1521
1455
|
}
|
|
1522
|
-
/**
|
|
1523
|
-
* Roll the edge table up to module granularity, for a file → module
|
|
1524
|
-
* assignment the caller decides.
|
|
1525
|
-
*
|
|
1526
|
-
* The architecture map's single query: cross-module edge counts by kind,
|
|
1527
|
-
* the `declared` subset of each (see {@link QueryBuilder.aggregateModuleGraph}),
|
|
1528
|
-
* and the busiest symbol pairs behind each link. Read-only, and bounded by
|
|
1529
|
-
* the number of modules rather than the number of edges.
|
|
1530
|
-
*/
|
|
1531
1456
|
getModuleAggregation(assignments, options) {
|
|
1532
1457
|
return this.queries.aggregateModuleGraph(assignments, options);
|
|
1533
1458
|
}
|
|
1534
|
-
/**
|
|
1535
|
-
* Every ordered pair of files where one reaches into the other — the edge
|
|
1536
|
-
* list a cycle finder runs on. See {@link QueryBuilder.getCrossFileDependencyPairs}.
|
|
1537
|
-
*/
|
|
1538
1459
|
getFileDependencyPairs(minConfidence = 0) {
|
|
1539
1460
|
return this.queries.getCrossFileDependencyPairs(minConfidence);
|
|
1540
1461
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
* the call sites that have no callee row instead of implying there are none.
|
|
1545
|
-
*/
|
|
1462
|
+
getFileImportPairs() {
|
|
1463
|
+
return this.queries.getFileImportPairs();
|
|
1464
|
+
}
|
|
1546
1465
|
getUnresolvedReferencesFrom(nodeId) {
|
|
1547
1466
|
return this.queries.getUnresolvedReferencesFrom(nodeId);
|
|
1548
1467
|
}
|
|
1549
|
-
/**
|
|
1550
|
-
* The same, for every symbol in a FILE at once, in line order.
|
|
1551
|
-
*
|
|
1552
|
-
* One indexed lookup instead of one per symbol — the whole-file reader needs
|
|
1553
|
-
* it for every line it draws. See
|
|
1554
|
-
* {@link QueryBuilder.getUnresolvedReferencesInFile}.
|
|
1555
|
-
*/
|
|
1556
1468
|
getUnresolvedReferencesInFile(filePath, limit) {
|
|
1557
1469
|
return this.queries.getUnresolvedReferencesInFile(filePath, limit);
|
|
1558
1470
|
}
|
|
1559
|
-
/**
|
|
1560
|
-
* Get all nodes in a file
|
|
1561
|
-
*/
|
|
1562
1471
|
getNodesInFile(filePath) {
|
|
1563
1472
|
return this.queries.getNodesByFile(filePath);
|
|
1564
1473
|
}
|
|
1565
|
-
/**
|
|
1566
|
-
* Get all nodes in several files, in one batched query.
|
|
1567
|
-
*/
|
|
1568
1474
|
getNodesInFiles(filePaths) {
|
|
1569
1475
|
return this.queries.getNodesByFiles(filePaths);
|
|
1570
1476
|
}
|
|
1571
|
-
/**
|
|
1572
|
-
* Get all nodes of a specific kind
|
|
1573
|
-
*/
|
|
1574
1477
|
getNodesByKind(kind) {
|
|
1575
1478
|
return this.queries.getNodesByKind(kind);
|
|
1576
1479
|
}
|
|
1577
|
-
/**
|
|
1578
|
-
* Get ALL nodes with an exact name (direct index lookup, not FTS-ranked/capped).
|
|
1579
|
-
* Used to enumerate every overload of a heavily-overloaded name so the specific
|
|
1580
|
-
* definition the caller wants is never dropped below a search cut.
|
|
1581
|
-
*/
|
|
1582
1480
|
getNodesByName(name) {
|
|
1583
1481
|
return this.queries.getNodesByName(name);
|
|
1584
1482
|
}
|
|
1585
|
-
/** Nodes whose name starts with `prefix` (index range scan, capped). */
|
|
1586
1483
|
getNodesByNamePrefix(prefix, limit = 20) {
|
|
1587
1484
|
return this.queries.getNodesByNamePrefix(prefix, limit);
|
|
1588
1485
|
}
|
|
1589
|
-
/**
|
|
1590
|
-
* Nodes whose name CONTAINS `substring` (LIKE scan, ASCII-case-insensitive,
|
|
1591
|
-
* shortest-first). The camel-infix lookup FTS can't do — `profileInfo`
|
|
1592
|
-
* inside `getProfileInfoV2` is one FTS token (#1196).
|
|
1593
|
-
*/
|
|
1594
1486
|
getNodesByNameSubstring(substring, options = {}) {
|
|
1595
1487
|
return this.queries
|
|
1596
1488
|
.findNodesByNameSubstring(substring, options)
|
|
1597
1489
|
.map((r) => r.node);
|
|
1598
1490
|
}
|
|
1599
|
-
/**
|
|
1600
|
-
* Search nodes by text
|
|
1601
|
-
*/
|
|
1602
1491
|
searchNodes(query, options) {
|
|
1603
1492
|
return this.queries.searchNodes(query, options);
|
|
1604
1493
|
}
|
|
1605
|
-
/** Lexical evidence for an empty explore result; does not alter retrieval. */
|
|
1606
1494
|
getExploreMissDiagnostics(query) {
|
|
1607
1495
|
return this.queries.getExploreMissDiagnostics(query);
|
|
1608
1496
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
* Precision comes from the repo's own naming statistics, not vocabulary:
|
|
1616
|
-
* - CO-OCCURRENCE: ≥2 words that are segments of the SAME name ("state" +
|
|
1617
|
-
* "machine" → OrderStateMachine) is strong evidence and always qualifies.
|
|
1618
|
-
* - RARITY: a single matched word qualifies only when its segment is
|
|
1619
|
-
* discriminative here (≤ {@link SEGMENT_RARITY_CEILING} distinct names) —
|
|
1620
|
-
* "checkout" in a shop backend yes, "state" in a react app no.
|
|
1621
|
-
* Every candidate is re-verified against `nodes` before being returned
|
|
1622
|
-
* (vocab rows are proposals; deletions leave orphans by design), so a
|
|
1623
|
-
* returned symbol is guaranteed to exist right now.
|
|
1624
|
-
*/
|
|
1497
|
+
getUnseenNames(names) {
|
|
1498
|
+
return this.queries.getUnseenNames(names);
|
|
1499
|
+
}
|
|
1500
|
+
findNamedCopybooks(query) {
|
|
1501
|
+
return (0, cobol_copybooks_1.findNamedCopybooks)(this.queries, query);
|
|
1502
|
+
}
|
|
1625
1503
|
getSegmentMatches(words, limit = 6) {
|
|
1626
1504
|
if (words.length === 0)
|
|
1627
1505
|
return [];
|
|
1628
|
-
// Variant → original word (plural folding), for coverage accounting.
|
|
1629
1506
|
const variantToWord = new Map();
|
|
1630
1507
|
for (const word of words) {
|
|
1631
1508
|
for (const variant of (0, identifier_segments_1.segmentLookupVariants)(word)) {
|
|
@@ -1634,11 +1511,6 @@ class CodeGraph {
|
|
|
1634
1511
|
}
|
|
1635
1512
|
}
|
|
1636
1513
|
const variants = [...variantToWord.keys()];
|
|
1637
|
-
// Tier A: co-occurrence. The SQL folds variants back to their original
|
|
1638
|
-
// word (#1146), so minWords=2 means two distinct PROMPT WORDS — a name
|
|
1639
|
-
// matching both `service` and `services` can't tie with (or crowd past
|
|
1640
|
-
// the LIMIT) a genuine two-word match. The JS re-check below recomputes
|
|
1641
|
-
// the fold from live segments as the honesty layer.
|
|
1642
1514
|
const variantPairs = [...variantToWord.entries()].map(([segment, word]) => ({ segment, word }));
|
|
1643
1515
|
const candidates = [];
|
|
1644
1516
|
for (const hit of this.queries.getSegmentCoOccurrence(variantPairs, 2, 24)) {
|
|
@@ -1646,16 +1518,6 @@ class CodeGraph {
|
|
|
1646
1518
|
if (matched.size >= 2)
|
|
1647
1519
|
candidates.push({ name: hit.name, matchedWords: matched });
|
|
1648
1520
|
}
|
|
1649
|
-
// Tier B: single rare word. Only when co-occurrence found nothing — a
|
|
1650
|
-
// co-occurring name is categorically stronger evidence — and under
|
|
1651
|
-
// stricter rules, because one word is thin: the word must be ≥5 chars
|
|
1652
|
-
// (measured FPs: "this", "typo"); the segment must appear in AT LEAST TWO
|
|
1653
|
-
// names (a concept the codebase is about clusters across names —
|
|
1654
|
-
// CheckoutService/CheckoutController — while a prose coincidence is a
|
|
1655
|
-
// singleton: measured FP "deploy to PRODUCTION" → the one name
|
|
1656
|
-
// matchesNonProductionDir); and the candidate name must have ≥2 segments
|
|
1657
|
-
// (a bare common verb matching a bare function name — "write" → `write` —
|
|
1658
|
-
// is prose coincidence, not the user naming a symbol).
|
|
1659
1521
|
if (candidates.length === 0) {
|
|
1660
1522
|
const singleWordVariants = variants.filter((v) => variantToWord.get(v).length >= 5);
|
|
1661
1523
|
const counts = this.queries.getSegmentNameCounts(singleWordVariants);
|
|
@@ -1672,13 +1534,6 @@ class CodeGraph {
|
|
|
1672
1534
|
}
|
|
1673
1535
|
}
|
|
1674
1536
|
}
|
|
1675
|
-
// Verify against nodes (the honesty gate) and pick a representative
|
|
1676
|
-
// definition per name. A name whose only nodes are file/import kind has
|
|
1677
|
-
// no real definition to point at — surfacing the import statement instead
|
|
1678
|
-
// reads as a matched symbol but isn't one (#1144) — so it's skipped, the
|
|
1679
|
-
// same way an orphaned vocab row is. (Import names no longer enter the
|
|
1680
|
-
// vocab at write time, but rows written before that exclusion persist
|
|
1681
|
-
// until the next full index.)
|
|
1682
1537
|
const out = [];
|
|
1683
1538
|
const seen = new Set();
|
|
1684
1539
|
candidates.sort((a, b) => b.matchedWords.size - a.matchedWords.size || a.name.length - b.name.length);
|
|
@@ -1690,10 +1545,10 @@ class CodeGraph {
|
|
|
1690
1545
|
seen.add(candidate.name);
|
|
1691
1546
|
const nodes = this.queries.getNodesByName(candidate.name);
|
|
1692
1547
|
if (nodes.length === 0)
|
|
1693
|
-
continue;
|
|
1548
|
+
continue;
|
|
1694
1549
|
const rep = nodes.find((n) => n.kind !== 'file' && n.kind !== 'import');
|
|
1695
1550
|
if (!rep)
|
|
1696
|
-
continue;
|
|
1551
|
+
continue;
|
|
1697
1552
|
out.push({
|
|
1698
1553
|
name: candidate.name,
|
|
1699
1554
|
kind: rep.kind,
|
|
@@ -1704,13 +1559,7 @@ class CodeGraph {
|
|
|
1704
1559
|
}
|
|
1705
1560
|
return out;
|
|
1706
1561
|
}
|
|
1707
|
-
/** A single word ("state") can match hundreds of names in a big repo — that
|
|
1708
|
-
* is noise, not signal. Ceiling for the single-word tier; co-occurrence is
|
|
1709
|
-
* exempt because two words on one name is already discriminative. */
|
|
1710
1562
|
static SEGMENT_RARITY_CEILING = 25;
|
|
1711
|
-
/** Which of the prompt's original words match `name`'s segments (via
|
|
1712
|
-
* variants). Segments are recomputed in JS — a name-keyed vocab lookup
|
|
1713
|
-
* would scan the (segment, name) primary key. */
|
|
1714
1563
|
wordsMatchingName(name, variantToWord) {
|
|
1715
1564
|
const segments = new Set((0, identifier_segments_1.splitIdentifierSegments)(name));
|
|
1716
1565
|
const matched = new Set();
|
|
@@ -1720,16 +1569,6 @@ class CodeGraph {
|
|
|
1720
1569
|
}
|
|
1721
1570
|
return matched;
|
|
1722
1571
|
}
|
|
1723
|
-
/**
|
|
1724
|
-
* One-shot upgrade heal for callers that open the graph WITHOUT syncing —
|
|
1725
|
-
* concretely the prompt hook, whose MEDIUM tier reads the segment
|
|
1726
|
-
* vocabulary: a database migrated from before the vocab table existed
|
|
1727
|
-
* starts with it empty, and the only other backfill lives inside `sync()`,
|
|
1728
|
-
* which such callers never run (#1142). Returns true when the vocab is
|
|
1729
|
-
* usable (already populated — the overwhelmingly common one-SELECT case —
|
|
1730
|
-
* or healed here); false when it isn't (empty graph, or another process
|
|
1731
|
-
* holds the index lock — that process's own sync heals it).
|
|
1732
|
-
*/
|
|
1733
1572
|
async healSegmentVocabIfEmpty() {
|
|
1734
1573
|
const empty = (() => {
|
|
1735
1574
|
try {
|
|
@@ -1748,12 +1587,22 @@ class CodeGraph {
|
|
|
1748
1587
|
this.fileLock.acquire();
|
|
1749
1588
|
}
|
|
1750
1589
|
catch {
|
|
1751
|
-
return false;
|
|
1590
|
+
return false;
|
|
1752
1591
|
}
|
|
1753
1592
|
try {
|
|
1754
1593
|
if (!this.queries.isNameSegmentVocabEmpty())
|
|
1755
|
-
return true;
|
|
1756
|
-
|
|
1594
|
+
return true;
|
|
1595
|
+
if (!this.db.readOnly) {
|
|
1596
|
+
await this.rebuildNameSegmentVocab();
|
|
1597
|
+
return true;
|
|
1598
|
+
}
|
|
1599
|
+
const writer = db_1.DatabaseConnection.open(this.db.getPath());
|
|
1600
|
+
try {
|
|
1601
|
+
await this.rebuildNameSegmentVocab(new queries_1.QueryBuilder(writer.getDb()));
|
|
1602
|
+
}
|
|
1603
|
+
finally {
|
|
1604
|
+
writer.close();
|
|
1605
|
+
}
|
|
1757
1606
|
return true;
|
|
1758
1607
|
}
|
|
1759
1608
|
finally {
|
|
@@ -1761,331 +1610,139 @@ class CodeGraph {
|
|
|
1761
1610
|
}
|
|
1762
1611
|
});
|
|
1763
1612
|
}
|
|
1764
|
-
|
|
1765
|
-
* Rebuild the segment vocabulary from the current graph, batched and
|
|
1766
|
-
* yielding — the upgrade-heal path for indexes built before the vocab table
|
|
1767
|
-
* existed. Runs inside the index mutex/lock (sync and
|
|
1768
|
-
* healSegmentVocabIfEmpty hold them).
|
|
1769
|
-
*/
|
|
1770
|
-
async rebuildNameSegmentVocab() {
|
|
1613
|
+
async rebuildNameSegmentVocab(queries = this.queries) {
|
|
1771
1614
|
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
1772
1615
|
const BATCH = 2000;
|
|
1773
1616
|
for (let offset = 0;; offset += BATCH) {
|
|
1774
|
-
const names =
|
|
1617
|
+
const names = queries.getDistinctNodeNames(BATCH, offset);
|
|
1775
1618
|
if (names.length === 0)
|
|
1776
1619
|
break;
|
|
1777
|
-
|
|
1620
|
+
queries.insertNameSegmentsBatch(names);
|
|
1778
1621
|
await maybeYield();
|
|
1779
1622
|
}
|
|
1780
1623
|
}
|
|
1781
|
-
/**
|
|
1782
|
-
* Normalized project-name tokens (go.mod / package.json / repo dir) used to
|
|
1783
|
-
* down-weight the non-discriminative project name in search ranking (#720).
|
|
1784
|
-
* Exposed so explore can exclude it from the PascalCase type-disambiguation
|
|
1785
|
-
* bias, which would otherwise pull overloaded tokens toward whichever stack
|
|
1786
|
-
* embeds the project name.
|
|
1787
|
-
*/
|
|
1788
1624
|
getProjectNameTokens() {
|
|
1789
1625
|
return this.queries.getProjectNameTokens();
|
|
1790
1626
|
}
|
|
1791
|
-
/**
|
|
1792
|
-
* Find the project's "primary route file" — the file with the densest
|
|
1793
|
-
* concentration of framework-emitted `route` nodes (≥3 routes, ≥30%
|
|
1794
|
-
* of all non-test routes). Used to inline the routing config in
|
|
1795
|
-
* `codegraph_explore` responses on small realworld template repos
|
|
1796
|
-
* (rails-realworld, laravel-realworld, drupal-admintoolbar, …) where
|
|
1797
|
-
* Glob+Read of `routes.rb`/`urls.py`/etc. otherwise beats codegraph.
|
|
1798
|
-
*/
|
|
1799
1627
|
getTopRouteFile() {
|
|
1800
1628
|
return this.queries.getTopRouteFile();
|
|
1801
1629
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
* via the `references` edge that framework resolvers emit. Returns
|
|
1806
|
-
* null when fewer than 3 valid (non-test) routes exist.
|
|
1807
|
-
*/
|
|
1808
|
-
getRoutingManifest(limit) {
|
|
1809
|
-
return this.queries.getRoutingManifest(limit);
|
|
1810
|
-
}
|
|
1811
|
-
// ===========================================================================
|
|
1812
|
-
// Edge Operations
|
|
1813
|
-
// ===========================================================================
|
|
1814
|
-
/**
|
|
1815
|
-
* Get outgoing edges from a node
|
|
1816
|
-
*/
|
|
1630
|
+
getRoutingManifest(limit, perRoute) {
|
|
1631
|
+
return this.queries.getRoutingManifest(limit, perRoute);
|
|
1632
|
+
}
|
|
1817
1633
|
getOutgoingEdges(nodeId) {
|
|
1818
1634
|
return this.queries.getOutgoingEdges(nodeId);
|
|
1819
1635
|
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Get incoming edges to a node
|
|
1822
|
-
*/
|
|
1823
1636
|
getIncomingEdges(nodeId) {
|
|
1824
1637
|
return this.queries.getIncomingEdges(nodeId);
|
|
1825
1638
|
}
|
|
1826
|
-
// ===========================================================================
|
|
1827
|
-
// File Operations
|
|
1828
|
-
// ===========================================================================
|
|
1829
|
-
/**
|
|
1830
|
-
* Get a file record by path
|
|
1831
|
-
*/
|
|
1832
1639
|
getFile(filePath) {
|
|
1833
1640
|
return this.queries.getFileByPath(filePath);
|
|
1834
1641
|
}
|
|
1835
|
-
/**
|
|
1836
|
-
* Whether the index holds any file under `dir`, a project-relative POSIX
|
|
1837
|
-
* directory (e.g. `packages/api`).
|
|
1838
|
-
*/
|
|
1839
1642
|
hasFilesUnder(dir) {
|
|
1840
1643
|
return this.queries.hasFilesUnder(dir);
|
|
1841
1644
|
}
|
|
1842
|
-
/**
|
|
1843
|
-
* Get all tracked files
|
|
1844
|
-
*/
|
|
1845
1645
|
getFiles() {
|
|
1846
1646
|
return this.queries.getAllFiles();
|
|
1847
1647
|
}
|
|
1848
|
-
/**
|
|
1849
|
-
* A `(path) => boolean` generated-file test over a BOUNDED candidate list,
|
|
1850
|
-
* unioning the index-time content-banner flag with the filename convention
|
|
1851
|
-
* (#1500). One query up front, O(1) per call after — built for use inside a
|
|
1852
|
-
* ranking comparator, where re-querying per comparison would be quadratic.
|
|
1853
|
-
*
|
|
1854
|
-
* Pass every path you might ask about; a path outside the list falls back to
|
|
1855
|
-
* the filename check alone.
|
|
1856
|
-
*/
|
|
1857
1648
|
generatedFilePredicate(filePaths) {
|
|
1858
1649
|
return this.queries.generatedPredicateFor(filePaths);
|
|
1859
1650
|
}
|
|
1860
|
-
/**
|
|
1861
|
-
* A `(path) => boolean` ambient-declaration test over a BOUNDED candidate
|
|
1862
|
-
* list: true for a file that declares nothing but types, originates no call
|
|
1863
|
-
* edge, and that nothing in the index depends on — an ambient `.d.ts` of
|
|
1864
|
-
* global shims, vendored typings, module augmentation (CG-28). Structural
|
|
1865
|
-
* rather than extension-based, and deliberately narrow: see
|
|
1866
|
-
* `QueryBuilder.getAmbientDeclarationPathsAmong` for why each condition is
|
|
1867
|
-
* there, in particular why a `types.ts` the codebase imports is NOT flagged.
|
|
1868
|
-
*/
|
|
1869
1651
|
ambientDeclarationFilePredicate(filePaths) {
|
|
1870
1652
|
return this.queries.ambientDeclarationPredicateFor(filePaths);
|
|
1871
1653
|
}
|
|
1872
|
-
/** How many indexed files are flagged tool-generated. Reported by `status`. */
|
|
1873
1654
|
getGeneratedFileCount() {
|
|
1874
1655
|
return this.queries.countGeneratedFiles();
|
|
1875
1656
|
}
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1657
|
+
getIndexHealth() {
|
|
1658
|
+
const needsReindex = [];
|
|
1659
|
+
const parseErrors = [];
|
|
1660
|
+
for (const file of this.queries.getFilesWithoutNodesOrWithErrors()) {
|
|
1661
|
+
const errors = file.errors ?? [];
|
|
1662
|
+
if ((0, grammars_1.hasGrammarLoadFailure)(errors)) {
|
|
1663
|
+
needsReindex.push(file.path);
|
|
1664
|
+
}
|
|
1665
|
+
else if (file.nodeCount === 0) {
|
|
1666
|
+
if ((0, grammars_1.isFileLevelOnlyLanguage)(file.language))
|
|
1667
|
+
continue;
|
|
1668
|
+
if (errors.length === 0)
|
|
1669
|
+
needsReindex.push(file.path);
|
|
1670
|
+
else if (errors.some((e) => e.severity === 'error' || e.code === 'parse_error'))
|
|
1671
|
+
parseErrors.push(file.path);
|
|
1672
|
+
}
|
|
1673
|
+
else if (errors.some((e) => e.code === 'parse_error')) {
|
|
1674
|
+
parseErrors.push(file.path);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
return { needsReindex, parseErrors };
|
|
1678
|
+
}
|
|
1679
|
+
getLanguageCoverage() {
|
|
1680
|
+
const parsedFilesByLanguage = {};
|
|
1681
|
+
const unparsedLanguages = [];
|
|
1682
|
+
for (const { language, parsed } of this.queries.getParsedFileCounts()) {
|
|
1683
|
+
if (!(0, grammars_1.yieldsSymbols)(language))
|
|
1684
|
+
continue;
|
|
1685
|
+
parsedFilesByLanguage[language] = parsed;
|
|
1686
|
+
if (parsed === 0)
|
|
1687
|
+
unparsedLanguages.push(language);
|
|
1688
|
+
}
|
|
1689
|
+
return { parsedFilesByLanguage, unparsedLanguages };
|
|
1690
|
+
}
|
|
1889
1691
|
getContext(nodeId) {
|
|
1890
1692
|
return this.graphManager.getContext(nodeId);
|
|
1891
1693
|
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Traverse the graph from a starting node
|
|
1894
|
-
*
|
|
1895
|
-
* Uses breadth-first search by default. Supports filtering by edge types,
|
|
1896
|
-
* node types, and traversal direction.
|
|
1897
|
-
*
|
|
1898
|
-
* @param startId - Starting node ID
|
|
1899
|
-
* @param options - Traversal options
|
|
1900
|
-
* @returns Subgraph containing traversed nodes and edges
|
|
1901
|
-
*/
|
|
1902
1694
|
traverse(startId, options) {
|
|
1903
1695
|
return this.traverser.traverseBFS(startId, options);
|
|
1904
1696
|
}
|
|
1905
|
-
/**
|
|
1906
|
-
* Get the call graph for a function
|
|
1907
|
-
*
|
|
1908
|
-
* Returns both callers (functions that call this function) and
|
|
1909
|
-
* callees (functions called by this function) up to the specified depth.
|
|
1910
|
-
*
|
|
1911
|
-
* @param nodeId - ID of the function/method node
|
|
1912
|
-
* @param depth - Maximum depth in each direction (default: 2)
|
|
1913
|
-
* @returns Subgraph containing the call graph
|
|
1914
|
-
*/
|
|
1915
1697
|
getCallGraph(nodeId, depth = 2) {
|
|
1916
1698
|
return this.traverser.getCallGraph(nodeId, depth);
|
|
1917
1699
|
}
|
|
1918
|
-
/**
|
|
1919
|
-
* Get the type hierarchy for a class/interface
|
|
1920
|
-
*
|
|
1921
|
-
* Returns both ancestors (types this extends/implements) and
|
|
1922
|
-
* descendants (types that extend/implement this).
|
|
1923
|
-
*
|
|
1924
|
-
* @param nodeId - ID of the class/interface node
|
|
1925
|
-
* @returns Subgraph containing the type hierarchy
|
|
1926
|
-
*/
|
|
1927
1700
|
getTypeHierarchy(nodeId) {
|
|
1928
1701
|
return this.traverser.getTypeHierarchy(nodeId);
|
|
1929
1702
|
}
|
|
1930
|
-
/**
|
|
1931
|
-
* Find all usages of a symbol
|
|
1932
|
-
*
|
|
1933
|
-
* Returns all nodes that reference the specified symbol through
|
|
1934
|
-
* any edge type (calls, references, type_of, etc.).
|
|
1935
|
-
*
|
|
1936
|
-
* @param nodeId - ID of the symbol node
|
|
1937
|
-
* @returns Array of nodes and edges that reference this symbol
|
|
1938
|
-
*/
|
|
1939
1703
|
findUsages(nodeId) {
|
|
1940
1704
|
return this.traverser.findUsages(nodeId);
|
|
1941
1705
|
}
|
|
1942
|
-
/**
|
|
1943
|
-
* Get callers of a function/method
|
|
1944
|
-
*
|
|
1945
|
-
* @param nodeId - ID of the function/method node
|
|
1946
|
-
* @param maxDepth - Maximum depth to traverse (default: 1)
|
|
1947
|
-
* @returns Array of nodes that call this function
|
|
1948
|
-
*/
|
|
1949
1706
|
getCallers(nodeId, maxDepth = 1) {
|
|
1950
1707
|
return this.traverser.getCallers(nodeId, maxDepth);
|
|
1951
1708
|
}
|
|
1952
|
-
/**
|
|
1953
|
-
* Get callees of a function/method
|
|
1954
|
-
*
|
|
1955
|
-
* @param nodeId - ID of the function/method node
|
|
1956
|
-
* @param maxDepth - Maximum depth to traverse (default: 1)
|
|
1957
|
-
* @returns Array of nodes called by this function
|
|
1958
|
-
*/
|
|
1959
1709
|
getCallees(nodeId, maxDepth = 1) {
|
|
1960
1710
|
return this.traverser.getCallees(nodeId, maxDepth);
|
|
1961
1711
|
}
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
* @param maxDepth - Maximum depth to traverse (default: 3)
|
|
1969
|
-
* @returns Subgraph containing potentially impacted nodes
|
|
1970
|
-
*/
|
|
1971
|
-
getImpactRadius(nodeId, maxDepth = 3) {
|
|
1972
|
-
return this.traverser.getImpactRadius(nodeId, maxDepth);
|
|
1973
|
-
}
|
|
1974
|
-
/**
|
|
1975
|
-
* Find the shortest path between two nodes
|
|
1976
|
-
*
|
|
1977
|
-
* @param fromId - Starting node ID
|
|
1978
|
-
* @param toId - Target node ID
|
|
1979
|
-
* @param edgeKinds - Edge types to consider (all if empty)
|
|
1980
|
-
* @returns Array of nodes and edges forming the path, or null if no path exists
|
|
1981
|
-
*/
|
|
1712
|
+
getCallSites(nodeId, direction) {
|
|
1713
|
+
return this.traverser.getCallSites(nodeId, direction);
|
|
1714
|
+
}
|
|
1715
|
+
getImpactRadius(nodeId, maxDepth = 3, options = {}) {
|
|
1716
|
+
return this.traverser.getImpactRadius(nodeId, maxDepth, options);
|
|
1717
|
+
}
|
|
1982
1718
|
findPath(fromId, toId, edgeKinds) {
|
|
1983
1719
|
return this.traverser.findPath(fromId, toId, edgeKinds);
|
|
1984
1720
|
}
|
|
1985
|
-
/**
|
|
1986
|
-
* Get ancestors of a node in the containment hierarchy
|
|
1987
|
-
*
|
|
1988
|
-
* @param nodeId - ID of the node
|
|
1989
|
-
* @returns Array of ancestor nodes from immediate parent to root
|
|
1990
|
-
*/
|
|
1991
1721
|
getAncestors(nodeId) {
|
|
1992
1722
|
return this.traverser.getAncestors(nodeId);
|
|
1993
1723
|
}
|
|
1994
|
-
/**
|
|
1995
|
-
* Get immediate children of a node
|
|
1996
|
-
*
|
|
1997
|
-
* @param nodeId - ID of the node
|
|
1998
|
-
* @returns Array of child nodes
|
|
1999
|
-
*/
|
|
2000
1724
|
getChildren(nodeId) {
|
|
2001
1725
|
return this.traverser.getChildren(nodeId);
|
|
2002
1726
|
}
|
|
2003
|
-
/**
|
|
2004
|
-
* Get dependencies of a file
|
|
2005
|
-
*
|
|
2006
|
-
* @param filePath - Path to the file
|
|
2007
|
-
* @returns Array of file paths this file depends on
|
|
2008
|
-
*/
|
|
2009
1727
|
getFileDependencies(filePath) {
|
|
2010
1728
|
return this.graphManager.getFileDependencies(filePath);
|
|
2011
1729
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
* @param filePath - Path to the file
|
|
2016
|
-
* @returns Array of file paths that depend on this file
|
|
2017
|
-
*/
|
|
2018
|
-
getFileDependents(filePath) {
|
|
2019
|
-
return this.graphManager.getFileDependents(filePath);
|
|
2020
|
-
}
|
|
2021
|
-
/**
|
|
2022
|
-
* Find circular dependencies in the codebase
|
|
2023
|
-
*
|
|
2024
|
-
* @returns Array of cycles, each cycle is an array of file paths
|
|
2025
|
-
*/
|
|
1730
|
+
getFileDependents(filePath, opts = {}) {
|
|
1731
|
+
return this.graphManager.getFileDependents(filePath, opts);
|
|
1732
|
+
}
|
|
2026
1733
|
findCircularDependencies() {
|
|
2027
1734
|
return this.graphManager.findCircularDependencies();
|
|
2028
1735
|
}
|
|
2029
|
-
/**
|
|
2030
|
-
* Find unreferenced symbols — the RAW candidate set.
|
|
2031
|
-
*
|
|
2032
|
-
* Non-exported symbols of the given kinds with no incoming edge but
|
|
2033
|
-
* `contains`. That is a fact, not a claim: on this engine's own index it
|
|
2034
|
-
* returns ~2 500 symbols, of which about 20 are actually unreachable. The
|
|
2035
|
-
* rest are overrides, framework registrations, mis-resolved twins and
|
|
2036
|
-
* references the extractor never recorded.
|
|
2037
|
-
*
|
|
2038
|
-
* For a list anybody should act on, use `buildDeadCodeReport` from
|
|
2039
|
-
* `src/graph/dead-code.ts`, which applies the exclusions and counts every one
|
|
2040
|
-
* of them. This method is kept as-is because it is a published API.
|
|
2041
|
-
*
|
|
2042
|
-
* @param kinds - Node kinds to check (default: functions, methods, classes)
|
|
2043
|
-
* @returns Array of unreferenced nodes
|
|
2044
|
-
*/
|
|
2045
1736
|
findDeadCode(kinds) {
|
|
2046
1737
|
return this.graphManager.findDeadCode(kinds);
|
|
2047
1738
|
}
|
|
2048
|
-
/**
|
|
2049
|
-
* Get complexity metrics for a node
|
|
2050
|
-
*
|
|
2051
|
-
* @param nodeId - ID of the node
|
|
2052
|
-
* @returns Object containing various complexity metrics
|
|
2053
|
-
*/
|
|
2054
1739
|
getNodeMetrics(nodeId) {
|
|
2055
1740
|
return this.graphManager.getNodeMetrics(nodeId);
|
|
2056
1741
|
}
|
|
2057
|
-
// ===========================================================================
|
|
2058
|
-
// Context Building
|
|
2059
|
-
// ===========================================================================
|
|
2060
|
-
/**
|
|
2061
|
-
* Get the source code for a node
|
|
2062
|
-
*
|
|
2063
|
-
* Reads the file and extracts the code between startLine and endLine.
|
|
2064
|
-
*
|
|
2065
|
-
* @param nodeId - ID of the node
|
|
2066
|
-
* @returns Code string or null if not found
|
|
2067
|
-
*/
|
|
2068
1742
|
async getCode(nodeId) {
|
|
2069
1743
|
return this.contextBuilder.getCode(nodeId);
|
|
2070
1744
|
}
|
|
2071
|
-
/**
|
|
2072
|
-
* Find relevant subgraph for a query
|
|
2073
|
-
*
|
|
2074
|
-
* Combines semantic search with graph traversal to find the most
|
|
2075
|
-
* relevant nodes and their relationships for a given query.
|
|
2076
|
-
*
|
|
2077
|
-
* @param query - Natural language query describing the task
|
|
2078
|
-
* @param options - Search and traversal options
|
|
2079
|
-
* @returns Subgraph of relevant nodes and edges
|
|
2080
|
-
*/
|
|
2081
1745
|
async findRelevantContext(query, options) {
|
|
2082
|
-
// Segment-vocab supplement: FTS keeps camelCase names as single tokens,
|
|
2083
|
-
// so a word-level query ("auto-scroll to bottom") can never reach
|
|
2084
|
-
// `pinFeedIfNearBottom` through search alone. Resolve the query's words
|
|
2085
|
-
// against name_segment_vocab (same precision rules as the prompt hook:
|
|
2086
|
-
// co-occurrence, else rare singles, verified against live nodes) and hand
|
|
2087
|
-
// the names down as dampened exact-name seeds. Callers that pass their
|
|
2088
|
-
// own seedNames keep them; failures degrade to no supplement.
|
|
2089
1746
|
let seedNames = options?.seedNames;
|
|
2090
1747
|
if (seedNames === undefined) {
|
|
2091
1748
|
try {
|
|
@@ -2098,56 +1755,23 @@ class CodeGraph {
|
|
|
2098
1755
|
}
|
|
2099
1756
|
return this.contextBuilder.findRelevantContext(query, { ...options, seedNames });
|
|
2100
1757
|
}
|
|
2101
|
-
/**
|
|
2102
|
-
* Build context for a task
|
|
2103
|
-
*
|
|
2104
|
-
* Creates comprehensive context by:
|
|
2105
|
-
* 1. Running FTS search to find entry points
|
|
2106
|
-
* 2. Expanding the graph around entry points
|
|
2107
|
-
* 3. Extracting code blocks for key nodes
|
|
2108
|
-
* 4. Formatting output for Claude
|
|
2109
|
-
*
|
|
2110
|
-
* @param input - Task description (string or {title, description})
|
|
2111
|
-
* @param options - Build options (maxNodes, includeCode, format, etc.)
|
|
2112
|
-
* @returns TaskContext object or formatted string (markdown/JSON)
|
|
2113
|
-
*/
|
|
2114
1758
|
async buildContext(input, options) {
|
|
2115
1759
|
return this.contextBuilder.buildContext(input, options);
|
|
2116
1760
|
}
|
|
2117
|
-
// ===========================================================================
|
|
2118
|
-
// Database Management
|
|
2119
|
-
// ===========================================================================
|
|
2120
|
-
/**
|
|
2121
|
-
* Optimize the database (vacuum and analyze)
|
|
2122
|
-
*/
|
|
2123
1761
|
optimize() {
|
|
2124
1762
|
this.db.optimize();
|
|
2125
1763
|
}
|
|
2126
|
-
/**
|
|
2127
|
-
* Clear all data from the graph
|
|
2128
|
-
*/
|
|
2129
1764
|
clear() {
|
|
2130
1765
|
this.queries.clear();
|
|
2131
1766
|
}
|
|
2132
|
-
/**
|
|
2133
|
-
* Alias for close() for backwards compatibility.
|
|
2134
|
-
* @deprecated Use close() instead
|
|
2135
|
-
*/
|
|
2136
1767
|
destroy() {
|
|
2137
1768
|
this.close();
|
|
2138
1769
|
}
|
|
2139
|
-
/**
|
|
2140
|
-
* Completely remove CodeGraph from the project.
|
|
2141
|
-
* This closes the database and deletes the .CodeGraph directory.
|
|
2142
|
-
*
|
|
2143
|
-
* WARNING: This permanently deletes all CodeGraph data for the project.
|
|
2144
|
-
*/
|
|
2145
1770
|
uninitialize() {
|
|
2146
1771
|
this.close();
|
|
2147
1772
|
(0, directory_1.removeDirectory)(this.projectRoot);
|
|
2148
1773
|
}
|
|
2149
1774
|
}
|
|
2150
1775
|
exports.CodeGraph = CodeGraph;
|
|
2151
|
-
// Default export
|
|
2152
1776
|
exports.default = CodeGraph;
|
|
2153
1777
|
//# sourceMappingURL=index.js.map
|