@colbymchenry/codegraph-win32-arm64 1.6.1 → 1.6.3
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 +427 -684
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +7 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +30 -74
- 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 +641 -40
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1370 -1398
- 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 +81 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +91 -500
- 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 +34 -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 +15 -133
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +102 -10
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +260 -179
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/commonjs-requires.d.ts +23 -0
- package/lib/dist/extraction/commonjs-requires.d.ts.map +1 -0
- package/lib/dist/extraction/commonjs-requires.js +37 -0
- package/lib/dist/extraction/commonjs-requires.js.map +1 -0
- 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 +145 -206
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +9 -0
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +29 -154
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +47 -4
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +91 -374
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +216 -11
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +703 -1368
- 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 +29 -131
- 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.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 +140 -28
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +876 -823
- 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.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +11 -54
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts +84 -0
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +335 -159
- 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 +15 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +69 -150
- 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.js +5 -42
- 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.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.d.ts +15 -0
- package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
- package/lib/dist/extraction/languages/swift.js +33 -27
- 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 +71 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +86 -41
- 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 +16 -0
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -0
- package/lib/dist/extraction/parse-budget.js +11 -0
- package/lib/dist/extraction/parse-budget.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +41 -5
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +74 -158
- 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 +7 -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 +85 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -0
- package/lib/dist/extraction/sfc-script.js +136 -0
- package/lib/dist/extraction/sfc-script.js.map +1 -0
- 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 +5 -37
- package/lib/dist/extraction/store-worker.js.map +1 -1
- package/lib/dist/extraction/store-writer.d.ts +10 -2
- package/lib/dist/extraction/store-writer.d.ts.map +1 -1
- package/lib/dist/extraction/store-writer.js +8 -32
- 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 +16 -122
- 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 +6 -153
- 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 +455 -9
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +1998 -2517
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +20 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +113 -115
- package/lib/dist/extraction/vue-extractor.js.map +1 -1
- package/lib/dist/extraction/vue-options-api.d.ts +28 -0
- package/lib/dist/extraction/vue-options-api.d.ts.map +1 -0
- package/lib/dist/extraction/vue-options-api.js +164 -0
- package/lib/dist/extraction/vue-options-api.js.map +1 -0
- 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-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +6 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +1 -88
- 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 +17 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -1
- package/lib/dist/graph/branch-guards.js +98 -250
- 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/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 +85 -219
- 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 +2 -2
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -135
- 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/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 +21 -0
- package/lib/dist/graph/test-code.d.ts.map +1 -0
- package/lib/dist/graph/test-code.js +50 -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 +98 -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 +195 -25
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +697 -1105
- 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 +9 -5
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +25 -159
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +1 -1
- package/lib/dist/installer/instructions-template.js +0 -37
- 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.js +0 -102
- 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 +81 -11
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +183 -129
- 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.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +2 -79
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +44 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +189 -118
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +23 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +89 -373
- 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 +10 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +41 -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.js +0 -116
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
- 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/index-freshness-worker.js +5 -4
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
- package/lib/dist/mcp/index-freshness.d.ts +7 -1
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -1
- package/lib/dist/mcp/index-freshness.js +20 -12
- 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 +19 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +118 -293
- 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/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.map +1 -1
- package/lib/dist/mcp/project-lifecycle.js +55 -21
- package/lib/dist/mcp/project-lifecycle.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +26 -8
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +209 -223
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +58 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +140 -100
- 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.js +0 -31
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +27 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +29 -130
- 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 +159 -20
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +730 -3545
- 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.js +1 -138
- 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 +19 -52
- 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 +96 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.js +695 -0
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -0
- 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 +15 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1487 -1234
- 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 +60 -61
- 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/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 +142 -0
- package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/angular-router.js +959 -0
- package/lib/dist/resolution/frameworks/angular-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/astro.js +30 -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 +106 -101
- 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/expo-modules.d.ts +10 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.js +79 -65
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +6 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.js +64 -183
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +215 -173
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.js +11 -112
- 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 +15 -61
- 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 +16 -2
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +20 -48
- 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 +209 -147
- 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 +291 -71
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts +35 -0
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js +33 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +236 -192
- 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 +11 -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.d.ts +20 -0
- package/lib/dist/resolution/frameworks/page-component.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/page-component.js +31 -0
- package/lib/dist/resolution/frameworks/page-component.js.map +1 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/play.js +27 -33
- package/lib/dist/resolution/frameworks/play.js.map +1 -1
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +106 -116
- 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 +17 -7
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.js +21 -79
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/react.d.ts +68 -1
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +1721 -114
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +152 -52
- 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 +51 -70
- 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 +9 -74
- 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.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +199 -167
- 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 +26 -10
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.js +147 -147
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/vue.d.ts +9 -2
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue.js +69 -107
- 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 +298 -23
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +1802 -1280
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +449 -5
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +1477 -981
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +14 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
- package/lib/dist/resolution/js-builtins.js +15 -13
- 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 +185 -0
- package/lib/dist/resolution/module-importers.d.ts.map +1 -0
- package/lib/dist/resolution/module-importers.js +588 -0
- package/lib/dist/resolution/module-importers.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +891 -8
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +25013 -2928
- 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/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/react-router-synthesizer.d.ts +2 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.js +67 -48
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +43 -3
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +55 -97
- 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 +10 -36
- 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 +68 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.js +355 -0
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -0
- 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 +7 -2
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.js +318 -121
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
- package/lib/dist/resolution/type-parameters.d.ts +34 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/type-parameters.js +285 -0
- package/lib/dist/resolution/type-parameters.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +209 -10
- 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 +570 -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 +29 -2
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +59 -78
- 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 +68 -146
- 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.d.ts +7 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -1
- package/lib/dist/ui-server/api/effects.js +20 -103
- package/lib/dist/ui-server/api/effects.js.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.d.ts +6 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.js +73 -130
- 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 +41 -6
- package/lib/dist/ui-server/api/map.d.ts.map +1 -1
- package/lib/dist/ui-server/api/map.js +95 -308
- package/lib/dist/ui-server/api/map.js.map +1 -1
- package/lib/dist/ui-server/api/node.d.ts.map +1 -1
- package/lib/dist/ui-server/api/node.js +4 -109
- 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 +6 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
- package/lib/dist/ui-server/api/route-roots.js +18 -39
- package/lib/dist/ui-server/api/route-roots.js.map +1 -1
- package/lib/dist/ui-server/api/routes.d.ts +2 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
- package/lib/dist/ui-server/api/routes.js +47 -47
- 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 +16 -171
- 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 +105 -373
- 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 +20 -94
- package/lib/dist/ui-server/api/trails.js.map +1 -1
- package/lib/dist/ui-server/api/when.d.ts +10 -2
- package/lib/dist/ui-server/api/when.d.ts.map +1 -1
- package/lib/dist/ui-server/api/when.js +32 -44
- 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.d.ts +28 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js +114 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -0
- package/lib/dist/ui-server/highlight/index.d.ts.map +1 -1
- package/lib/dist/ui-server/highlight/index.js +7 -133
- 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.d.ts +7 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js +15 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -0
- 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 +61 -10
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +191 -225
- 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/viewer/assets/{index-D4S7YUPf.js → index-BSGpxBr9.js} +60 -58
- package/lib/dist/viewer/index.html +1 -1
- package/lib/dist/worker-teardown.d.ts +48 -0
- package/lib/dist/worker-teardown.d.ts.map +1 -0
- package/lib/dist/worker-teardown.js +53 -0
- package/lib/dist/worker-teardown.js.map +1 -0
- 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,47 @@ 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 WORKSPACE_METADATA_KEY = 'js_workspace_fingerprint';
|
|
112
|
+
const WORKSPACE_MANIFESTS_METADATA_KEY = 'js_workspace_manifests';
|
|
113
|
+
const MODULE_CONFIG_METADATA_KEY = 'module_config_snapshot';
|
|
114
|
+
const FRAMEWORKS_AT_INDEX_KEY = 'frameworks_at_index';
|
|
115
|
+
const FRAMEWORKS_SINCE_INDEX_KEY = 'frameworks_since_index';
|
|
116
|
+
const RESOLVER_FRAMEWORKS_AT_INDEX_KEY = 'resolver_frameworks_at_index';
|
|
117
|
+
function parseNameList(value) {
|
|
118
|
+
if (!value)
|
|
119
|
+
return null;
|
|
120
|
+
try {
|
|
121
|
+
const parsed = JSON.parse(value);
|
|
122
|
+
return Array.isArray(parsed) && parsed.every((n) => typeof n === 'string') ? parsed : null;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function parseSynthMinIntervalEnv(raw) {
|
|
129
|
+
if (!raw || !raw.trim())
|
|
130
|
+
return undefined;
|
|
131
|
+
const n = Number(raw);
|
|
132
|
+
if (!Number.isInteger(n) || n < 1000 || n > 86_400_000)
|
|
133
|
+
return undefined;
|
|
134
|
+
return n;
|
|
135
|
+
}
|
|
124
136
|
class CodeGraph {
|
|
125
137
|
db;
|
|
126
138
|
queries;
|
|
127
139
|
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
140
|
graphManager;
|
|
134
141
|
traverser;
|
|
135
142
|
contextBuilder;
|
|
136
|
-
// Mutex for preventing concurrent indexing operations (in-process)
|
|
137
143
|
indexMutex = new utils_1.Mutex();
|
|
138
|
-
// File lock for preventing concurrent writes across processes (CLI, MCP, git hooks)
|
|
139
144
|
fileLock;
|
|
140
|
-
// File watcher for auto-sync on file changes
|
|
141
145
|
watcher = null;
|
|
146
|
+
lastSynthesisAt = 0;
|
|
147
|
+
deferredSynthesisTimer = null;
|
|
142
148
|
constructor(db, queries, projectRoot) {
|
|
143
149
|
this.db = db;
|
|
144
150
|
this.queries = queries;
|
|
@@ -146,71 +152,85 @@ class CodeGraph {
|
|
|
146
152
|
this.fileLock = new utils_1.FileLock(path.join((0, directory_2.getCodeGraphDir)(projectRoot), 'codegraph.lock'));
|
|
147
153
|
this.wireLayers();
|
|
148
154
|
}
|
|
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
155
|
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
156
|
try {
|
|
159
157
|
this.queries.setProjectNameTokens((0, query_utils_1.deriveProjectNameTokens)(this.projectRoot));
|
|
160
158
|
}
|
|
161
159
|
catch {
|
|
162
|
-
// Best-effort: ranking still works without it.
|
|
163
160
|
}
|
|
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
161
|
let cachedPatterns;
|
|
177
162
|
let cachedMatcher;
|
|
178
|
-
|
|
163
|
+
const currentMatcher = () => {
|
|
164
|
+
const patterns = (0, project_config_1.loadDeprioritizePatterns)(this.projectRoot);
|
|
165
|
+
if (patterns.length === 0)
|
|
166
|
+
return null;
|
|
167
|
+
if (patterns !== cachedPatterns) {
|
|
168
|
+
cachedPatterns = patterns;
|
|
169
|
+
cachedMatcher = (0, ignore_1.default)().add(patterns);
|
|
170
|
+
}
|
|
171
|
+
return cachedMatcher;
|
|
172
|
+
};
|
|
173
|
+
const matches = (matcher, filePath) => {
|
|
174
|
+
if (!matcher)
|
|
175
|
+
return false;
|
|
176
|
+
const rel = path.isAbsolute(filePath)
|
|
177
|
+
? path.relative(this.projectRoot, filePath)
|
|
178
|
+
: filePath;
|
|
179
|
+
if (!rel || (0, utils_1.escapesRoot)(rel))
|
|
180
|
+
return false;
|
|
181
|
+
return matcher.ignores(rel.split(path.sep).join('/'));
|
|
182
|
+
};
|
|
183
|
+
const deprioritized = (filePath) => {
|
|
179
184
|
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('/'));
|
|
185
|
+
return matches(currentMatcher(), filePath);
|
|
193
186
|
}
|
|
194
187
|
catch {
|
|
195
|
-
// Ranking must never take the search down with it.
|
|
196
188
|
return false;
|
|
197
189
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
190
|
+
};
|
|
191
|
+
deprioritized.snapshot = () => {
|
|
192
|
+
let matcher = null;
|
|
193
|
+
try {
|
|
194
|
+
matcher = currentMatcher();
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
matcher = null;
|
|
198
|
+
}
|
|
199
|
+
return (filePath) => {
|
|
200
|
+
try {
|
|
201
|
+
return matches(matcher, filePath);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
this.queries.setDeprioritizedPathMatcher(deprioritized);
|
|
209
|
+
this.builtOrchestrator = null;
|
|
210
|
+
this.builtResolver = null;
|
|
211
|
+
if (!this.db.readOnly) {
|
|
212
|
+
void this.orchestrator;
|
|
213
|
+
void this.resolver;
|
|
214
|
+
}
|
|
201
215
|
this.graphManager = new graph_1.GraphQueryManager(this.queries);
|
|
202
216
|
this.traverser = new graph_1.GraphTraverser(this.queries);
|
|
203
217
|
this.contextBuilder = (0, context_1.createContextBuilder)(this.projectRoot, this.queries, this.traverser);
|
|
204
218
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
219
|
+
builtOrchestrator = null;
|
|
220
|
+
builtResolver = null;
|
|
221
|
+
get orchestrator() {
|
|
222
|
+
if (!this.builtOrchestrator) {
|
|
223
|
+
this.builtOrchestrator = new ((0, lazy_engine_1.engine)().ExtractionOrchestrator)(this.projectRoot, this.queries);
|
|
224
|
+
if (this.watcher)
|
|
225
|
+
this.builtOrchestrator.setKeepDetectionContents(true);
|
|
226
|
+
}
|
|
227
|
+
return this.builtOrchestrator;
|
|
228
|
+
}
|
|
229
|
+
get resolver() {
|
|
230
|
+
return (this.builtResolver ??= (0, lazy_engine_1.engine)().createResolver(this.projectRoot, this.queries));
|
|
231
|
+
}
|
|
210
232
|
pendingFullReconcile = false;
|
|
211
|
-
/** How long a recreated, not-yet-indexed database is treated as a rebuild in progress. */
|
|
212
233
|
static RECREATE_GRACE_MS = 120_000;
|
|
213
|
-
/** The database file at the path was written within the recreate grace window. */
|
|
214
234
|
isFreshlyRecreated() {
|
|
215
235
|
try {
|
|
216
236
|
return Date.now() - fs.statSync((0, db_1.getDatabasePath)(this.projectRoot)).mtimeMs < CodeGraph.RECREATE_GRACE_MS;
|
|
@@ -219,128 +239,75 @@ class CodeGraph {
|
|
|
219
239
|
return false;
|
|
220
240
|
}
|
|
221
241
|
}
|
|
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
242
|
reopenIfReplaced() {
|
|
242
243
|
if (this.indexMutex.isLocked())
|
|
243
244
|
return false;
|
|
244
245
|
return this.reopenReplacedDatabase();
|
|
245
246
|
}
|
|
246
|
-
/** The body of {@link reopenIfReplaced}, without the in-flight-sync guard. */
|
|
247
247
|
reopenReplacedDatabase() {
|
|
248
248
|
if (!this.db.isReplacedOnDisk())
|
|
249
249
|
return false;
|
|
250
250
|
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
251
|
const fresh = db_1.DatabaseConnection.open(dbPath, { readOnly: this.db.readOnly });
|
|
255
252
|
const stale = this.db;
|
|
256
253
|
this.db = fresh;
|
|
257
254
|
this.queries = new queries_1.QueryBuilder(fresh.getDb());
|
|
258
255
|
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
256
|
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
257
|
try {
|
|
265
258
|
stale.close();
|
|
266
259
|
}
|
|
267
|
-
catch {
|
|
260
|
+
catch { }
|
|
268
261
|
return true;
|
|
269
262
|
}
|
|
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
263
|
static async init(projectRoot, options = {}) {
|
|
283
|
-
await (0,
|
|
264
|
+
await (0, grammars_1.initGrammars)();
|
|
284
265
|
const resolvedRoot = path.resolve(projectRoot);
|
|
285
|
-
// Check if already initialized
|
|
286
266
|
if ((0, directory_1.isInitialized)(resolvedRoot)) {
|
|
287
267
|
throw new Error(`CodeGraph already initialized in ${resolvedRoot}`);
|
|
288
268
|
}
|
|
289
|
-
// Create directory structure
|
|
290
269
|
(0, directory_1.createDirectory)(resolvedRoot);
|
|
291
|
-
// Initialize database
|
|
292
270
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
293
271
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
294
272
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
295
273
|
const instance = new CodeGraph(db, queries, resolvedRoot);
|
|
296
|
-
// Run initial indexing if requested
|
|
297
274
|
if (options.index) {
|
|
298
275
|
await instance.indexAll({ onProgress: options.onProgress });
|
|
299
276
|
}
|
|
300
277
|
return instance;
|
|
301
278
|
}
|
|
302
|
-
/**
|
|
303
|
-
* Initialize synchronously (without indexing)
|
|
304
|
-
*/
|
|
305
279
|
static initSync(projectRoot) {
|
|
306
280
|
const resolvedRoot = path.resolve(projectRoot);
|
|
307
|
-
// Check if already initialized
|
|
308
281
|
if ((0, directory_1.isInitialized)(resolvedRoot)) {
|
|
309
282
|
throw new Error(`CodeGraph already initialized in ${resolvedRoot}`);
|
|
310
283
|
}
|
|
311
|
-
// Create directory structure
|
|
312
284
|
(0, directory_1.createDirectory)(resolvedRoot);
|
|
313
|
-
// Initialize database
|
|
314
285
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
315
286
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
316
287
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
317
288
|
return new CodeGraph(db, queries, resolvedRoot);
|
|
318
289
|
}
|
|
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
290
|
static async open(projectRoot, options = {}) {
|
|
327
|
-
await (0,
|
|
291
|
+
await (0, grammars_1.initGrammars)();
|
|
328
292
|
const resolvedRoot = path.resolve(projectRoot);
|
|
329
|
-
// Check if initialized
|
|
330
293
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
331
294
|
throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
|
|
332
295
|
}
|
|
333
|
-
// Validate directory structure
|
|
334
296
|
const validation = (0, directory_1.validateDirectory)(resolvedRoot);
|
|
335
297
|
if (!validation.valid) {
|
|
336
298
|
throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
|
|
337
299
|
}
|
|
338
|
-
// Open database
|
|
339
300
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
340
|
-
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly });
|
|
301
|
+
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly, deferIndexRecovery: true });
|
|
302
|
+
try {
|
|
303
|
+
await db.recoverIndexesOffThread();
|
|
304
|
+
}
|
|
305
|
+
catch (err) {
|
|
306
|
+
db.close();
|
|
307
|
+
throw err;
|
|
308
|
+
}
|
|
341
309
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
342
310
|
const instance = new CodeGraph(db, queries, resolvedRoot);
|
|
343
|
-
// Sync if requested
|
|
344
311
|
if (options.sync && !options.readOnly) {
|
|
345
312
|
try {
|
|
346
313
|
await instance.sync();
|
|
@@ -352,27 +319,9 @@ class CodeGraph {
|
|
|
352
319
|
}
|
|
353
320
|
return instance;
|
|
354
321
|
}
|
|
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
322
|
static async recreate(projectRoot) {
|
|
372
|
-
await (0,
|
|
323
|
+
await (0, grammars_1.initGrammars)();
|
|
373
324
|
const resolvedRoot = path.resolve(projectRoot);
|
|
374
|
-
// Check if initialized — recreate REBUILDS an existing project; it is not a
|
|
375
|
-
// first-time `init`.
|
|
376
325
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
377
326
|
throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
|
|
378
327
|
}
|
|
@@ -381,91 +330,62 @@ class CodeGraph {
|
|
|
381
330
|
(0, db_1.removeDatabaseFiles)(dbPath);
|
|
382
331
|
}
|
|
383
332
|
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
333
|
const reason = err instanceof Error ? err.message : String(err);
|
|
388
334
|
throw new Error(`Could not rebuild the index — the database file is in use (${reason}). ` +
|
|
389
335
|
`Stop any running CodeGraph MCP server/daemon for this project and retry, ` +
|
|
390
336
|
`or remove the ${(0, directory_2.getCodeGraphDir)(resolvedRoot)} directory and run "codegraph init".`);
|
|
391
337
|
}
|
|
392
|
-
// Re-create an empty, freshly-schema'd database at the same path.
|
|
393
338
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
394
339
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
395
340
|
return new CodeGraph(db, queries, resolvedRoot);
|
|
396
341
|
}
|
|
397
|
-
/**
|
|
398
|
-
* Open synchronously (without sync)
|
|
399
|
-
*/
|
|
400
342
|
static openSync(projectRoot, options = {}) {
|
|
401
343
|
const resolvedRoot = path.resolve(projectRoot);
|
|
402
|
-
// Check if initialized
|
|
403
344
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
404
345
|
throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
|
|
405
346
|
}
|
|
406
|
-
// Validate directory structure
|
|
407
347
|
const validation = (0, directory_1.validateDirectory)(resolvedRoot);
|
|
408
348
|
if (!validation.valid) {
|
|
409
349
|
throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
|
|
410
350
|
}
|
|
411
|
-
// Open database
|
|
412
351
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
413
|
-
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly });
|
|
352
|
+
const db = db_1.DatabaseConnection.open(dbPath, { readOnly: options.readOnly, deferIndexRecovery: options.deferIndexRecovery });
|
|
414
353
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
415
354
|
return new CodeGraph(db, queries, resolvedRoot);
|
|
416
355
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
356
|
+
recoverIndexes() {
|
|
357
|
+
return this.db.recoverIndexesOffThread();
|
|
358
|
+
}
|
|
359
|
+
hasPendingIndexRecovery() {
|
|
360
|
+
return this.db.hasDeferredIndexRecovery();
|
|
361
|
+
}
|
|
420
362
|
static isInitialized(projectRoot) {
|
|
421
363
|
return (0, directory_1.isInitialized)(path.resolve(projectRoot));
|
|
422
364
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
365
|
+
releaseMemory() {
|
|
366
|
+
this.db.releaseMemory();
|
|
367
|
+
}
|
|
426
368
|
close() {
|
|
427
369
|
this.unwatch();
|
|
428
|
-
|
|
370
|
+
if (this.deferredSynthesisTimer) {
|
|
371
|
+
clearTimeout(this.deferredSynthesisTimer);
|
|
372
|
+
this.deferredSynthesisTimer = null;
|
|
373
|
+
}
|
|
429
374
|
this.fileLock.release();
|
|
430
375
|
this.db.close();
|
|
431
376
|
}
|
|
432
|
-
/**
|
|
433
|
-
* Get the project root directory
|
|
434
|
-
*/
|
|
435
377
|
getProjectRoot() {
|
|
436
378
|
return this.projectRoot;
|
|
437
379
|
}
|
|
438
|
-
// ===========================================================================
|
|
439
|
-
// Indexing
|
|
440
|
-
// ===========================================================================
|
|
441
|
-
/**
|
|
442
|
-
* Index all files in the project
|
|
443
|
-
*
|
|
444
|
-
* Uses a mutex to prevent concurrent indexing operations.
|
|
445
|
-
*/
|
|
446
380
|
async indexAll(options = {}) {
|
|
447
381
|
return this.indexMutex.withLock(async () => {
|
|
382
|
+
const startedAt = Date.now();
|
|
448
383
|
try {
|
|
449
384
|
this.fileLock.acquire();
|
|
450
385
|
}
|
|
451
386
|
catch {
|
|
452
387
|
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
388
|
}
|
|
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
389
|
const freshDb = this.queries.getNodeAndEdgeCount().nodes === 0;
|
|
470
390
|
const fastInit = process.env.CODEGRAPH_NO_FAST_INIT !== '1' && freshDb;
|
|
471
391
|
if (fastInit) {
|
|
@@ -473,13 +393,11 @@ class CodeGraph {
|
|
|
473
393
|
this.db.getDb().pragma('journal_mode = MEMORY');
|
|
474
394
|
this.db.getDb().pragma('synchronous = OFF');
|
|
475
395
|
}
|
|
476
|
-
catch {
|
|
396
|
+
catch { }
|
|
477
397
|
}
|
|
478
398
|
const deferWal = !fastInit && process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
479
399
|
let walValve = null;
|
|
480
400
|
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
401
|
let restoreAutocheckpoint = false;
|
|
484
402
|
if (deferWal) {
|
|
485
403
|
priorAutocheckpoint = this.db.getWalAutocheckpoint();
|
|
@@ -490,38 +408,22 @@ class CodeGraph {
|
|
|
490
408
|
try {
|
|
491
409
|
const gitState = this.orchestrator.beginGitIndexState(true);
|
|
492
410
|
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
411
|
try {
|
|
498
412
|
this.queries.setMetadata('index_state', 'indexing');
|
|
499
413
|
}
|
|
500
|
-
catch {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
414
|
+
catch { }
|
|
415
|
+
if (freshDb) {
|
|
416
|
+
try {
|
|
417
|
+
this.queries.clearNameSegmentVocab();
|
|
418
|
+
}
|
|
419
|
+
catch { }
|
|
506
420
|
}
|
|
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
421
|
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
422
|
if (freshDb)
|
|
517
423
|
this.db.beginBulkParseLoad();
|
|
518
424
|
let result;
|
|
519
425
|
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);
|
|
426
|
+
result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose, walValve ? () => walValve.backpressure() : undefined, freshDb ? { dbPath: this.db.getPath(), fastInit } : null);
|
|
525
427
|
}
|
|
526
428
|
finally {
|
|
527
429
|
if (freshDb) {
|
|
@@ -535,58 +437,28 @@ class CodeGraph {
|
|
|
535
437
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
536
438
|
console.error(`[phase-timing] fts-rebuild: ${Date.now() - tFts}ms`);
|
|
537
439
|
}
|
|
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
440
|
if (walValve)
|
|
544
441
|
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
442
|
if (result.success && result.filesIndexed > 0) {
|
|
553
443
|
const tReinit = Date.now();
|
|
554
444
|
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
445
|
this.resolver.runPostExtract();
|
|
558
446
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
559
447
|
console.error(`[phase-timing] resolver-reinit: ${Date.now() - tReinit}ms`);
|
|
560
448
|
}
|
|
561
|
-
// Resolve references to create call/import/extends edges
|
|
562
449
|
if (result.success && result.filesIndexed > 0) {
|
|
563
|
-
// Get count without loading all refs into memory
|
|
564
450
|
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
451
|
if (fastInit && unresolvedCount >= (0, resolver_pool_1.minRefsForPool)()) {
|
|
572
452
|
try {
|
|
573
453
|
this.db.getDb().pragma('synchronous = NORMAL');
|
|
574
454
|
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
455
|
priorAutocheckpoint = this.db.getWalAutocheckpoint();
|
|
584
456
|
this.db.setWalAutocheckpoint(0);
|
|
585
457
|
restoreAutocheckpoint = true;
|
|
586
458
|
walValve = new wal_valve_1.WalCheckpointValve(this.db, undefined, undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
|
|
587
459
|
walValve.start();
|
|
588
460
|
}
|
|
589
|
-
catch {
|
|
461
|
+
catch { }
|
|
590
462
|
}
|
|
591
463
|
options.onProgress?.({
|
|
592
464
|
phase: 'resolving',
|
|
@@ -606,33 +478,31 @@ class CodeGraph {
|
|
|
606
478
|
current: done,
|
|
607
479
|
total: totalPasses,
|
|
608
480
|
});
|
|
609
|
-
}, walValve ? () => walValve.backpressure() : undefined);
|
|
481
|
+
}, walValve ? () => walValve.backpressure() : undefined, true, true);
|
|
610
482
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
611
483
|
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).
|
|
484
|
+
this.lastSynthesisAt = Date.now();
|
|
616
485
|
const tChained = Date.now();
|
|
617
486
|
await this.resolver.resolveChainedCallsViaConformance();
|
|
618
487
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
619
488
|
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
489
|
const tDeferred = Date.now();
|
|
623
490
|
await this.resolver.resolveDeferredThisMemberRefs();
|
|
624
491
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
625
492
|
console.error(`[synth-timing] deferredThisMember: ${Date.now() - tDeferred}ms`);
|
|
493
|
+
await this.resolver.resolveParameterFlows();
|
|
494
|
+
}
|
|
495
|
+
if (!freshDb && result.success && !options.signal?.aborted) {
|
|
496
|
+
const tPrune = Date.now();
|
|
497
|
+
try {
|
|
498
|
+
this.queries.pruneNameSegmentVocab();
|
|
499
|
+
}
|
|
500
|
+
catch { }
|
|
501
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
502
|
+
console.error(`[phase-timing] vocab-prune: ${Date.now() - tPrune}ms`);
|
|
626
503
|
}
|
|
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
504
|
if (result.success && result.filesIndexed > 0) {
|
|
632
505
|
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
506
|
if (walValve) {
|
|
637
507
|
walValve.stop();
|
|
638
508
|
await walValve.drain();
|
|
@@ -641,9 +511,6 @@ class CodeGraph {
|
|
|
641
511
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
642
512
|
console.error(`[phase-timing] maintenance: ${Date.now() - tMaint}ms`);
|
|
643
513
|
}
|
|
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
514
|
if (result.success && result.filesIndexed > 0) {
|
|
648
515
|
const tCount = Date.now();
|
|
649
516
|
const after = this.queries.getNodeAndEdgeCount();
|
|
@@ -652,27 +519,27 @@ class CodeGraph {
|
|
|
652
519
|
result.nodesCreated = after.nodes - before.nodes;
|
|
653
520
|
result.edgesCreated = after.edges - before.edges;
|
|
654
521
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
522
|
+
if (result.success)
|
|
523
|
+
this.stampPythonRootFingerprint();
|
|
524
|
+
if (result.success)
|
|
525
|
+
this.stampWorkspaceFingerprint();
|
|
526
|
+
if (result.success)
|
|
527
|
+
this.stampWorkspaceManifests(this.orchestrator.takeManifestEvidence());
|
|
528
|
+
if (result.success)
|
|
529
|
+
this.stampModuleConfigSnapshot();
|
|
530
|
+
if (result.success)
|
|
531
|
+
this.stampIndexedFrameworks();
|
|
660
532
|
if (result.success && result.filesIndexed > 0) {
|
|
661
533
|
try {
|
|
662
534
|
this.queries.setMetadata('indexed_with_version', version_1.CodeGraphPackageVersion);
|
|
663
535
|
this.queries.setMetadata('indexed_with_extraction_version', String(extraction_version_1.EXTRACTION_VERSION));
|
|
664
536
|
}
|
|
665
|
-
catch {
|
|
537
|
+
catch { }
|
|
666
538
|
}
|
|
667
539
|
if (result.success && result.filesErrored === 0 &&
|
|
668
540
|
(result.filesDiscovered === undefined || result.filesIndexed + result.filesSkipped >= result.filesDiscovered)) {
|
|
669
541
|
this.orchestrator.finishGitIndexState(gitState, true);
|
|
670
542
|
}
|
|
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
543
|
try {
|
|
677
544
|
if (!result.success) {
|
|
678
545
|
this.queries.setMetadata('index_state', 'failed');
|
|
@@ -700,15 +567,11 @@ class CodeGraph {
|
|
|
700
567
|
}
|
|
701
568
|
}
|
|
702
569
|
}
|
|
703
|
-
catch {
|
|
570
|
+
catch { }
|
|
571
|
+
result.durationMs = Date.now() - startedAt;
|
|
704
572
|
return result;
|
|
705
573
|
}
|
|
706
574
|
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
575
|
if (walValve) {
|
|
713
576
|
walValve.stop();
|
|
714
577
|
await walValve.drain();
|
|
@@ -717,26 +580,19 @@ class CodeGraph {
|
|
|
717
580
|
try {
|
|
718
581
|
this.db.setWalAutocheckpoint(priorAutocheckpoint);
|
|
719
582
|
}
|
|
720
|
-
catch {
|
|
583
|
+
catch { }
|
|
721
584
|
}
|
|
722
585
|
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
586
|
try {
|
|
726
587
|
this.db.getDb().pragma('synchronous = NORMAL');
|
|
727
588
|
this.db.getDb().pragma('journal_mode = WAL');
|
|
728
589
|
}
|
|
729
|
-
catch {
|
|
590
|
+
catch { }
|
|
730
591
|
}
|
|
731
592
|
this.fileLock.release();
|
|
732
593
|
}
|
|
733
594
|
});
|
|
734
595
|
}
|
|
735
|
-
/**
|
|
736
|
-
* Index specific files
|
|
737
|
-
*
|
|
738
|
-
* Uses a mutex to prevent concurrent indexing operations.
|
|
739
|
-
*/
|
|
740
596
|
async indexFiles(filePaths) {
|
|
741
597
|
return this.indexMutex.withLock(async () => {
|
|
742
598
|
try {
|
|
@@ -746,70 +602,137 @@ class CodeGraph {
|
|
|
746
602
|
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
603
|
}
|
|
748
604
|
try {
|
|
749
|
-
return this.orchestrator.indexFiles(filePaths);
|
|
605
|
+
return await this.orchestrator.indexFiles(filePaths).finally(() => this.resolver.clearCaches());
|
|
750
606
|
}
|
|
751
607
|
finally {
|
|
752
608
|
this.fileLock.release();
|
|
753
609
|
}
|
|
754
610
|
});
|
|
755
611
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
612
|
+
pythonFilePaths() {
|
|
613
|
+
return new Set(this.queries.getAllFilePaths().filter((f) => f.endsWith('.py')));
|
|
614
|
+
}
|
|
615
|
+
stampPythonRootFingerprint(fingerprint = this.resolver.getPythonRootFingerprint()) {
|
|
616
|
+
try {
|
|
617
|
+
this.queries.setMetadata(PYTHON_ROOTS_METADATA_KEY, fingerprint);
|
|
618
|
+
}
|
|
619
|
+
catch { }
|
|
620
|
+
}
|
|
621
|
+
stampModuleConfigSnapshot() {
|
|
622
|
+
try {
|
|
623
|
+
const stored = this.queries.getMetadata(MODULE_CONFIG_METADATA_KEY);
|
|
624
|
+
this.queries.setMetadata(MODULE_CONFIG_METADATA_KEY, JSON.stringify(this.resolver.getModuleConfigSnapshot(stored, true)));
|
|
625
|
+
}
|
|
626
|
+
catch { }
|
|
627
|
+
}
|
|
628
|
+
stampModuleConfigSnapshotIfMoved() {
|
|
629
|
+
try {
|
|
630
|
+
const stored = this.queries.getMetadata(MODULE_CONFIG_METADATA_KEY);
|
|
631
|
+
const now = JSON.stringify(this.resolver.getModuleConfigSnapshot(stored));
|
|
632
|
+
if (now !== stored)
|
|
633
|
+
this.queries.setMetadata(MODULE_CONFIG_METADATA_KEY, now);
|
|
634
|
+
}
|
|
635
|
+
catch { }
|
|
636
|
+
}
|
|
637
|
+
stampWorkspaceFingerprint(fingerprint = this.resolver.getWorkspaceFingerprint()) {
|
|
638
|
+
try {
|
|
639
|
+
this.queries.setMetadata(WORKSPACE_METADATA_KEY, fingerprint);
|
|
640
|
+
}
|
|
641
|
+
catch { }
|
|
642
|
+
}
|
|
643
|
+
stampWorkspaceManifests(evidence) {
|
|
644
|
+
try {
|
|
645
|
+
const discovery = this.resolver.getWorkspaceDiscovery();
|
|
646
|
+
const stamp = discovery ? (0, lazy_engine_1.engine)().manifestStamp(evidence, discovery) : null;
|
|
647
|
+
const value = stamp ? JSON.stringify(stamp) : '';
|
|
648
|
+
if (this.queries.getMetadata(WORKSPACE_MANIFESTS_METADATA_KEY) !== value)
|
|
649
|
+
this.queries.setMetadata(WORKSPACE_MANIFESTS_METADATA_KEY, value);
|
|
650
|
+
}
|
|
651
|
+
catch { }
|
|
652
|
+
}
|
|
653
|
+
stampIndexedFrameworks() {
|
|
654
|
+
const names = this.orchestrator.getDetectedFrameworkNames();
|
|
655
|
+
if (names === null)
|
|
656
|
+
return;
|
|
657
|
+
try {
|
|
658
|
+
this.queries.setMetadata(FRAMEWORKS_AT_INDEX_KEY, JSON.stringify([...names].sort()));
|
|
659
|
+
this.queries.setMetadata(FRAMEWORKS_SINCE_INDEX_KEY, '');
|
|
660
|
+
this.queries.setMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY, JSON.stringify([...this.resolver.getDetectedFrameworks()].sort()));
|
|
661
|
+
}
|
|
662
|
+
catch { }
|
|
663
|
+
}
|
|
664
|
+
followDetectedFrameworks(detected) {
|
|
665
|
+
const now = [...detected].sort();
|
|
666
|
+
const resolverNow = [...this.resolver.getDetectedFrameworks()].sort();
|
|
667
|
+
if (now.join('\0') !== resolverNow.join('\0'))
|
|
668
|
+
this.resolver.initialize();
|
|
669
|
+
try {
|
|
670
|
+
const atIndex = parseNameList(this.queries.getMetadata(FRAMEWORKS_AT_INDEX_KEY));
|
|
671
|
+
if (!atIndex)
|
|
672
|
+
return;
|
|
673
|
+
const added = now.filter((name) => !atIndex.includes(name));
|
|
674
|
+
const removed = atIndex.filter((name) => !now.includes(name));
|
|
675
|
+
const value = added.length > 0 || removed.length > 0 ? JSON.stringify({ added, removed }) : '';
|
|
676
|
+
if ((this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY) ?? '') !== value) {
|
|
677
|
+
this.queries.setMetadata(FRAMEWORKS_SINCE_INDEX_KEY, value);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
catch { }
|
|
681
|
+
}
|
|
682
|
+
getFrameworkChangesSinceIndex() {
|
|
683
|
+
const names = (list) => (Array.isArray(list) ? list.filter((n) => typeof n === 'string') : []);
|
|
684
|
+
const added = new Set();
|
|
685
|
+
const removed = new Set();
|
|
686
|
+
try {
|
|
687
|
+
const value = this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY);
|
|
688
|
+
if (value) {
|
|
689
|
+
const parsed = JSON.parse(value);
|
|
690
|
+
for (const name of names(parsed.added))
|
|
691
|
+
added.add(name);
|
|
692
|
+
for (const name of names(parsed.removed))
|
|
693
|
+
removed.add(name);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
catch { }
|
|
697
|
+
try {
|
|
698
|
+
const atIndex = parseNameList(this.queries.getMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY));
|
|
699
|
+
if (atIndex) {
|
|
700
|
+
const now = this.resolver.getDetectedFrameworks();
|
|
701
|
+
for (const name of now)
|
|
702
|
+
if (!atIndex.includes(name))
|
|
703
|
+
added.add(name);
|
|
704
|
+
for (const name of atIndex)
|
|
705
|
+
if (!now.includes(name))
|
|
706
|
+
removed.add(name);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
catch { }
|
|
710
|
+
return added.size > 0 || removed.size > 0 ? { added: [...added].sort(), removed: [...removed].sort() } : null;
|
|
711
|
+
}
|
|
762
712
|
async sync(options = {}) {
|
|
713
|
+
const { ESM_IMPORT_LANGUAGES, aliasMayName, changedModuleConfigs, changedRoutes, createImportReader, hasSynthesisPattern, isJsxChildCandidate, moduleConfigLanguages, parseManifestStamp, parseModuleConfigSnapshot, reopenNameMatchedImports, reopenReferencesThroughAddedFiles, reopenReferencesThroughBarrels, reopenReferencesThroughChangedDefaults, reopenReferencesThroughDeclaredPackages, reopenReferencesThroughRetargetedModules, trustedManifestList, } = (0, lazy_engine_1.engine)();
|
|
763
714
|
return this.indexMutex.withLock(async () => {
|
|
715
|
+
const startedAt = Date.now();
|
|
764
716
|
try {
|
|
765
717
|
this.fileLock.acquire();
|
|
766
718
|
}
|
|
767
719
|
catch (err) {
|
|
768
|
-
throw new
|
|
720
|
+
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
721
|
}
|
|
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
722
|
try {
|
|
780
723
|
this.reopenReplacedDatabase();
|
|
781
724
|
}
|
|
782
725
|
catch (err) {
|
|
783
726
|
this.fileLock.release();
|
|
784
|
-
throw new
|
|
727
|
+
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
728
|
}
|
|
786
729
|
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
730
|
if (this.getIndexState() === null && this.isFreshlyRecreated()) {
|
|
795
731
|
this.fileLock.release();
|
|
796
|
-
throw new
|
|
732
|
+
throw new errors_2.LockUnavailableError('A rebuild of this index is in progress; retry when it finishes.');
|
|
797
733
|
}
|
|
798
|
-
// Cleared only once this run completes (below): a sync that throws
|
|
799
|
-
// must leave the full catch-up for the next one.
|
|
800
734
|
options = { ...options, paths: undefined };
|
|
801
735
|
}
|
|
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
736
|
const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
814
737
|
let walValve = null;
|
|
815
738
|
let priorAutocheckpoint = 1000;
|
|
@@ -820,10 +743,6 @@ class CodeGraph {
|
|
|
820
743
|
walValve.start();
|
|
821
744
|
}
|
|
822
745
|
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
746
|
const vocabWasEmpty = (() => {
|
|
828
747
|
try {
|
|
829
748
|
return this.queries.isNameSegmentVocabEmpty();
|
|
@@ -832,55 +751,101 @@ class CodeGraph {
|
|
|
832
751
|
return false;
|
|
833
752
|
}
|
|
834
753
|
})();
|
|
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
754
|
const backpressure = walValve ? () => walValve.backpressure() : undefined;
|
|
841
755
|
const fullReconcile = !options.paths || options.paths.length === 0;
|
|
842
756
|
const gitState = this.orchestrator.beginGitIndexState(fullReconcile);
|
|
843
|
-
|
|
844
|
-
// resolution/synthesis. Detect those orphans BEFORE this sync adds refs.
|
|
757
|
+
const pythonFilesBefore = this.pythonFilePaths();
|
|
845
758
|
let refreshSynthesis = this.queries.getMetadata('synthesis_pending') === '1' ||
|
|
846
759
|
this.queries.getUnresolvedReferencesCount() > 0;
|
|
847
760
|
if (refreshSynthesis)
|
|
848
761
|
this.queries.setMetadata('synthesis_pending', '1');
|
|
762
|
+
const watchRoutes = this.resolver.hasNavigationRouters();
|
|
763
|
+
let routesBefore = null;
|
|
764
|
+
const flowChange = this.resolver.trackParameterFlows();
|
|
849
765
|
const result = await this.orchestrator.sync(options.onProgress, options.paths, backpressure, (filePath, content) => {
|
|
766
|
+
flowChange.before(filePath);
|
|
767
|
+
if (watchRoutes && routesBefore === null)
|
|
768
|
+
routesBefore = this.queries.getNodesByKind('route');
|
|
850
769
|
if (!refreshSynthesis && (this.queries.hasSynthesizedEdgesTouchingFile(filePath) ||
|
|
851
770
|
this.queries.wasSynthesisInput(filePath) ||
|
|
852
|
-
(content !== undefined &&
|
|
771
|
+
(content !== undefined && hasSynthesisPattern(filePath, content)))) {
|
|
853
772
|
refreshSynthesis = true;
|
|
854
773
|
this.queries.setMetadata('synthesis_pending', '1');
|
|
855
774
|
}
|
|
856
775
|
});
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
776
|
+
if (result.detectedFrameworks)
|
|
777
|
+
this.followDetectedFrameworks(result.detectedFrameworks);
|
|
778
|
+
if (!refreshSynthesis && result.definitionDelta && result.changedFilePaths) {
|
|
779
|
+
const delta = new Set(result.definitionDelta);
|
|
780
|
+
const defined = this.queries.getNodesByFiles(result.changedFilePaths).filter((n) => delta.has(n.name));
|
|
781
|
+
if (defined.some(isJsxChildCandidate) || aliasMayName(this.queries, defined)) {
|
|
782
|
+
refreshSynthesis = true;
|
|
783
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
784
|
+
}
|
|
785
|
+
}
|
|
860
786
|
if (walValve)
|
|
861
787
|
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) {
|
|
788
|
+
if (result.filesAdded > 0 || result.filesModified > 0 || result.filesRemoved > 0) {
|
|
867
789
|
this.resolver.runPostExtract();
|
|
868
790
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
791
|
+
if (routesBefore) {
|
|
792
|
+
const tNav = Date.now();
|
|
793
|
+
const routes = changedRoutes(routesBefore, this.queries.getNodesByKind('route'));
|
|
794
|
+
const reopened = this.resolver.reopenNavigationsFor(routes, result.changedFilePaths ?? []);
|
|
795
|
+
if (routes.length > 0 && !refreshSynthesis) {
|
|
796
|
+
refreshSynthesis = true;
|
|
797
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
798
|
+
}
|
|
799
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
800
|
+
console.error(`[phase-timing] sync-navigation-retry: ${Date.now() - tNav}ms (${routes.length} routes changed, ${reopened} refs re-opened)`);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
{
|
|
804
|
+
const tConfig = Date.now();
|
|
805
|
+
const stored = this.queries.getMetadata(MODULE_CONFIG_METADATA_KEY);
|
|
806
|
+
const snapshot = this.resolver.getModuleConfigSnapshot(stored, result.filesAdded > 0 || result.filesRemoved > 0);
|
|
807
|
+
const changed = stored === null ? [] : changedModuleConfigs(parseModuleConfigSnapshot(stored), snapshot);
|
|
808
|
+
if (changed.length > 0) {
|
|
809
|
+
this.resolver.resetModuleConfig();
|
|
810
|
+
let reopened = 0;
|
|
811
|
+
for (const language of moduleConfigLanguages(changed))
|
|
812
|
+
reopened += this.orchestrator.resurrectResolutionEdgesForLanguage(language);
|
|
813
|
+
refreshSynthesis = true;
|
|
814
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
815
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
816
|
+
console.error(`[phase-timing] sync-module-config: ${Date.now() - tConfig}ms (${changed.join(', ')} changed, ${reopened} refs re-opened)`);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if (fullReconcile) {
|
|
821
|
+
const tWorkspace = Date.now();
|
|
822
|
+
const before = this.queries.getMetadata(WORKSPACE_METADATA_KEY);
|
|
823
|
+
const evidence = this.orchestrator.takeManifestEvidence();
|
|
824
|
+
const known = before === null ? null : trustedManifestList(this.projectRoot, parseManifestStamp(this.queries.getMetadata(WORKSPACE_MANIFESTS_METADATA_KEY)), evidence);
|
|
825
|
+
const now = this.resolver.refreshWorkspacePackages(known ?? undefined);
|
|
826
|
+
if (!known)
|
|
827
|
+
this.stampWorkspaceManifests(evidence);
|
|
828
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
829
|
+
console.error(`[phase-timing] sync-workspace-manifests: ${Date.now() - tWorkspace}ms (${known ? `${known.length} read where the last walk found them` : 'walked'})`);
|
|
830
|
+
}
|
|
831
|
+
if (before !== null && before !== now) {
|
|
832
|
+
let reopened = 0;
|
|
833
|
+
for (const language of ESM_IMPORT_LANGUAGES)
|
|
834
|
+
reopened += this.orchestrator.resurrectResolutionEdgesForLanguage(language);
|
|
835
|
+
refreshSynthesis = true;
|
|
836
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
837
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
838
|
+
console.error(`[phase-timing] sync-workspace-packages: ${Date.now() - tWorkspace}ms (${reopened} refs re-opened)`);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
if (before !== now)
|
|
842
|
+
this.stampWorkspaceFingerprint(now);
|
|
878
843
|
}
|
|
879
|
-
// Resolve references if files were updated
|
|
880
844
|
const filesChanged = result.filesAdded > 0 || result.filesModified > 0;
|
|
845
|
+
let edgesBeforeRetry;
|
|
846
|
+
const edgesBeforeResolution = this.queries.getMaxEdgeId();
|
|
881
847
|
if (filesChanged) {
|
|
882
848
|
if (result.changedFilePaths) {
|
|
883
|
-
// Scope resolution to changed files (git fast path — bounded set)
|
|
884
849
|
const tRefLoad = Date.now();
|
|
885
850
|
const unresolvedRefs = this.queries.getUnresolvedReferencesByFiles(result.changedFilePaths);
|
|
886
851
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
@@ -897,17 +862,32 @@ class CodeGraph {
|
|
|
897
862
|
total,
|
|
898
863
|
});
|
|
899
864
|
});
|
|
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
865
|
const tRetry = Date.now();
|
|
910
|
-
|
|
866
|
+
edgesBeforeRetry = this.queries.getMaxEdgeId();
|
|
867
|
+
const retryable = this.queries.getRetryableFailedReferences([...new Set([
|
|
868
|
+
...this.queries.getNodeNamesByFiles(result.changedFilePaths),
|
|
869
|
+
...result.changedFilePaths.flatMap(reference_tail_1.moduleReferenceKeys),
|
|
870
|
+
])]);
|
|
871
|
+
const addedFiles = new Set(result.addedFilePaths ?? []);
|
|
872
|
+
const resolvesToAdded = (specifier, fromFile, language) => {
|
|
873
|
+
const file = this.resolver.resolveModuleFile(specifier, fromFile, language);
|
|
874
|
+
return file !== null && addedFiles.has(file);
|
|
875
|
+
};
|
|
876
|
+
const resolvedModules = addedFiles.size === 0 ? [] : this.queries.getFailedScopedImports()
|
|
877
|
+
.filter((s) => resolvesToAdded(s.name, s.filePath, s.language))
|
|
878
|
+
.map((s) => s.name);
|
|
879
|
+
const folderImports = addedFiles.size === 0 ? [] : this.queries.getFailedFolderImports()
|
|
880
|
+
.filter((ref) => ref.filePath !== undefined && ref.language !== undefined &&
|
|
881
|
+
resolvesToAdded(ref.referenceName, ref.filePath, ref.language));
|
|
882
|
+
const retryRows = new Set(retryable.map((ref) => ref.rowId));
|
|
883
|
+
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]));
|
|
884
|
+
for (const ref of [...importRetry, ...folderImports]) {
|
|
885
|
+
if (!retryRows.has(ref.rowId)) {
|
|
886
|
+
retryable.push(ref);
|
|
887
|
+
retryRows.add(ref.rowId);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
retryable.sort((a, b) => (a.rowId ?? 0) - (b.rowId ?? 0));
|
|
911
891
|
if (retryable.length > 0) {
|
|
912
892
|
options.onProgress?.({
|
|
913
893
|
phase: 'resolving',
|
|
@@ -923,9 +903,58 @@ class CodeGraph {
|
|
|
923
903
|
}
|
|
924
904
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
925
905
|
console.error(`[phase-timing] sync-failed-ref-retry: ${Date.now() - tRetry}ms (${retryable.length} refs)`);
|
|
906
|
+
const importReader = createImportReader(this.projectRoot);
|
|
907
|
+
const added = (result.addedFilePaths ?? []).flatMap((filePath) => {
|
|
908
|
+
const file = this.queries.getFileByPath(filePath);
|
|
909
|
+
return file ? [{ path: filePath, language: file.language }] : [];
|
|
910
|
+
});
|
|
911
|
+
if (added.length > 0) {
|
|
912
|
+
const tAdded = Date.now();
|
|
913
|
+
const reopened = reopenReferencesThroughAddedFiles(this.queries, importReader, added, edgesBeforeResolution, (specifier, fromFile, language) => this.resolver.resolveModuleFile(specifier, fromFile, language), (file) => this.resolver.workspacePackageDirOf(file));
|
|
914
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
915
|
+
console.error(`[phase-timing] sync-added-module-importers: ${Date.now() - tAdded}ms (${reopened} refs re-opened)`);
|
|
916
|
+
}
|
|
917
|
+
const tBarrels = Date.now();
|
|
918
|
+
const delta = new Set(result.definitionDelta ?? []);
|
|
919
|
+
const seeds = new Map(added.map((file) => [file.path, file.language]));
|
|
920
|
+
const modified = result.changedFilePaths.filter((filePath) => !seeds.has(filePath));
|
|
921
|
+
if (delta.size > 0 && modified.length > 0) {
|
|
922
|
+
for (const node of this.queries.getNodesByFiles(modified)) {
|
|
923
|
+
if (delta.has(node.name))
|
|
924
|
+
seeds.set(node.filePath, node.language);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
const throughBarrels = reopenReferencesThroughBarrels(this.queries, importReader, [...seeds].map(([path, language]) => ({ path, language })), edgesBeforeResolution);
|
|
928
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
929
|
+
console.error(`[phase-timing] sync-barrel-modules: ${Date.now() - tBarrels}ms (${throughBarrels} refs re-opened)`);
|
|
930
|
+
const declared = reopenReferencesThroughDeclaredPackages(this.queries, importReader, this.projectRoot, result.changedFilePaths, edgesBeforeResolution);
|
|
931
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS && declared > 0)
|
|
932
|
+
console.error(`[phase-timing] sync-declared-packages: ${declared} refs re-opened`);
|
|
933
|
+
const tDefaults = Date.now();
|
|
934
|
+
const movedDefaults = this.resolver.changedDefaultExports(modified, result.changedFilePaths, edgesBeforeResolution);
|
|
935
|
+
const throughDefaults = movedDefaults.length === 0 ? 0
|
|
936
|
+
: reopenReferencesThroughChangedDefaults(this.queries, importReader, movedDefaults, edgesBeforeResolution);
|
|
937
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
938
|
+
console.error(`[phase-timing] sync-default-exports: ${Date.now() - tDefaults}ms (${movedDefaults.length} defaults moved, ${throughDefaults} refs re-opened)`);
|
|
939
|
+
const tNamed = Date.now();
|
|
940
|
+
const editedModules = modified.flatMap((filePath) => {
|
|
941
|
+
const file = this.queries.getFileByPath(filePath);
|
|
942
|
+
return file ? [{ path: filePath, language: file.language }] : [];
|
|
943
|
+
});
|
|
944
|
+
const nameMatched = reopenNameMatchedImports(this.queries, importReader, editedModules, edgesBeforeResolution, (specifier, fromFile, language) => this.resolver.resolveModuleFile(specifier, fromFile, language), (ref) => this.resolver.resolveNow(ref));
|
|
945
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
946
|
+
console.error(`[phase-timing] sync-name-matched-imports: ${Date.now() - tNamed}ms (${nameMatched} refs re-opened)`);
|
|
947
|
+
const tRetargeted = Date.now();
|
|
948
|
+
const retargeted = (result.reExportsChangedFilePaths ?? []).flatMap((filePath) => {
|
|
949
|
+
const file = this.queries.getFileByPath(filePath);
|
|
950
|
+
return file ? [{ path: filePath, language: file.language }] : [];
|
|
951
|
+
});
|
|
952
|
+
const throughRetargeted = retargeted.length === 0 ? 0
|
|
953
|
+
: reopenReferencesThroughRetargetedModules(this.queries, importReader, retargeted);
|
|
954
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
955
|
+
console.error(`[phase-timing] sync-retargeted-modules: ${Date.now() - tRetargeted}ms (${throughRetargeted} refs re-opened)`);
|
|
926
956
|
}
|
|
927
957
|
else {
|
|
928
|
-
// No git info — use batched resolution to avoid OOM
|
|
929
958
|
const unresolvedCount = this.queries.getUnresolvedReferencesCount();
|
|
930
959
|
options.onProgress?.({
|
|
931
960
|
phase: 'resolving',
|
|
@@ -947,39 +976,65 @@ class CodeGraph {
|
|
|
947
976
|
}, backpressure, false);
|
|
948
977
|
}
|
|
949
978
|
}
|
|
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
979
|
if (result.definitionDelta && process.env.CODEGRAPH_NO_REBIND !== '1') {
|
|
964
980
|
const tRebind = Date.now();
|
|
965
|
-
const rebound = this.orchestrator.resurrectStaleResolutionEdges(result.definitionDelta, result.changedFilePaths ?? []);
|
|
981
|
+
const rebound = this.orchestrator.resurrectStaleResolutionEdges(result.definitionDelta, result.changedFilePaths ?? [], edgesBeforeRetry);
|
|
982
|
+
const reopenedFailed = this.queries.reopenFailedReferences(this.queries.getRetryableFailedReferences(result.definitionDelta).flatMap((ref) => (ref.rowId === undefined ? [] : [ref.rowId])));
|
|
966
983
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
967
|
-
console.error(`[phase-timing] sync-rebind: ${Date.now() - tRebind}ms (${result.definitionDelta.length} changed names, ${rebound} edges re-opened)`);
|
|
984
|
+
console.error(`[phase-timing] sync-rebind: ${Date.now() - tRebind}ms (${result.definitionDelta.length} changed names, ${rebound} edges and ${reopenedFailed} failed refs re-opened)`);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
if (filesChanged && result.changedFilePaths) {
|
|
988
|
+
const tModules = Date.now();
|
|
989
|
+
const reopened = this.resolver.reopenRouteModuleReaders(result.changedFilePaths);
|
|
990
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
991
|
+
console.error(`[phase-timing] sync-route-modules: ${Date.now() - tModules}ms (${reopened} refs re-opened)`);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
{
|
|
995
|
+
const before = this.queries.getMetadata(PYTHON_ROOTS_METADATA_KEY);
|
|
996
|
+
const now = this.resolver.getPythonRootFingerprint();
|
|
997
|
+
if (before !== null && before !== now) {
|
|
998
|
+
this.resolver.clearCaches();
|
|
999
|
+
this.orchestrator.resurrectResolutionEdgesForLanguage('python');
|
|
1000
|
+
refreshSynthesis = true;
|
|
1001
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
968
1002
|
}
|
|
1003
|
+
else if (before !== null) {
|
|
1004
|
+
const after = this.pythonFilePaths();
|
|
1005
|
+
const moved = [...after].filter((f) => !pythonFilesBefore.has(f));
|
|
1006
|
+
for (const f of pythonFilesBefore)
|
|
1007
|
+
if (!after.has(f))
|
|
1008
|
+
moved.push(f);
|
|
1009
|
+
const reopened = new Set();
|
|
1010
|
+
if (moved.length > 0) {
|
|
1011
|
+
this.resolver.clearCaches();
|
|
1012
|
+
for (const f of this.orchestrator.resurrectResolutionEdgesTouching('python', this.resolver.getPythonReopenScope(moved)))
|
|
1013
|
+
reopened.add(f);
|
|
1014
|
+
}
|
|
1015
|
+
const editedInits = (result.changedFilePaths ?? []).filter((f) => pythonFilesBefore.has(f) && after.has(f) && /(?:^|[\\/])__init__\.py$/.test(f));
|
|
1016
|
+
if (editedInits.length > 0) {
|
|
1017
|
+
this.resolver.clearCaches();
|
|
1018
|
+
for (const f of this.orchestrator.resurrectPythonPackageImporters(this.resolver.getPythonPackageImporters(editedInits)))
|
|
1019
|
+
reopened.add(f);
|
|
1020
|
+
}
|
|
1021
|
+
const scriptModules = this.resolver.getPythonScriptModuleScope((result.changedFilePaths ?? []).filter((f) => pythonFilesBefore.has(f) && after.has(f)));
|
|
1022
|
+
if (scriptModules.targetFiles.length > 0) {
|
|
1023
|
+
this.resolver.clearCaches();
|
|
1024
|
+
for (const f of this.orchestrator.resurrectResolutionEdgesTouching('python', scriptModules))
|
|
1025
|
+
reopened.add(f);
|
|
1026
|
+
}
|
|
1027
|
+
if (reopened.size > 0) {
|
|
1028
|
+
this.resolver.resolveAndPersist(this.queries.getUnresolvedReferencesByFiles([...reopened]));
|
|
1029
|
+
if (!refreshSynthesis && [...reopened].some((f) => this.queries.hasSynthesizedEdgesTouchingFile(f) || this.queries.wasSynthesisInput(f))) {
|
|
1030
|
+
refreshSynthesis = true;
|
|
1031
|
+
this.queries.setMetadata('synthesis_pending', '1');
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if (before !== now)
|
|
1036
|
+
this.stampPythonRootFingerprint(now);
|
|
969
1037
|
}
|
|
970
|
-
// Orphan sweep (#1187). A resolution pass that dies mid-run — the #850
|
|
971
|
-
// daemon liveness watchdog's SIGKILL (#1122), Ctrl-C, a crash — leaves
|
|
972
|
-
// the refs it never reached in unresolved_refs, and the git-scoped fast
|
|
973
|
-
// path above never revisits them (it reads only the changed files'
|
|
974
|
-
// rows). Those files' call edges were then missing PERMANENTLY, with
|
|
975
|
-
// nothing to see except a too-small blast radius, until a full
|
|
976
|
-
// re-index. A completed pass takes every row it processed out of the
|
|
977
|
-
// PENDING set (resolved rows are deleted, unresolvable ones parked as
|
|
978
|
-
// status='failed' for the #1240 retry above), so any pending row now
|
|
979
|
-
// is such an orphan — or a row from an older engine's scoped pass.
|
|
980
|
-
// Grind them down with the batched resolver; this also makes a bare
|
|
981
|
-
// `codegraph sync` the recovery command for a wedged index. On a
|
|
982
|
-
// healthy index this is one COUNT query.
|
|
983
1038
|
result.pendingRefsProcessed = 0;
|
|
984
1039
|
result.pendingRefsResolved = 0;
|
|
985
1040
|
result.pendingRefsUnresolved = 0;
|
|
@@ -1007,57 +1062,67 @@ class CodeGraph {
|
|
|
1007
1062
|
result.pendingRefsResolved = recovery.stats.resolved;
|
|
1008
1063
|
result.pendingRefsUnresolved = recovery.stats.unresolved;
|
|
1009
1064
|
}
|
|
1065
|
+
if (process.env.CODEGRAPH_NO_REBIND !== '1') {
|
|
1066
|
+
const touched = [...(result.changedFilePaths ?? []), ...(result.removedFilePaths ?? [])];
|
|
1067
|
+
const touchedPy = touched.filter((p) => /\.pyi?$/.test(p));
|
|
1068
|
+
if (touched.length > 0) {
|
|
1069
|
+
const tTypes = Date.now();
|
|
1070
|
+
const reopenedFiles = this.orchestrator.resurrectTypeDependentEdges(touched, result.changedFilePaths ?? []);
|
|
1071
|
+
const ceiling = Number(process.env.CODEGRAPH_PY_ATTR_RETRY_CEILING ?? '') || 2000;
|
|
1072
|
+
const failed = touchedPy.length > 0 ? this.resolver.pythonAttrRetryCandidates(touchedPy, ceiling) : [];
|
|
1073
|
+
const retry = [...this.queries.getUnresolvedReferencesByFiles(reopenedFiles), ...(failed ?? [])];
|
|
1074
|
+
if (retry.length > 0)
|
|
1075
|
+
await this.resolver.resolveAndPersistListYielding(retry);
|
|
1076
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
1077
|
+
console.error(`[phase-timing] sync-type-rebind: ${Date.now() - tTypes}ms (${retry.length} refs${failed ? '' : ', failed-ref fan-in over ceiling'})`);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1010
1081
|
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
1082
|
await this.resolver.resolveChainedCallsViaConformance();
|
|
1015
|
-
// Same lifecycle for `this.<member>` callback registrations whose
|
|
1016
|
-
// member is inherited from a supertype (#808).
|
|
1017
1083
|
await this.resolver.resolveDeferredThisMemberRefs();
|
|
1018
1084
|
}
|
|
1085
|
+
let synthesized = false;
|
|
1019
1086
|
if (refreshSynthesis) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1087
|
+
const hold = this.synthesisHoldMs();
|
|
1088
|
+
if (hold > 0) {
|
|
1089
|
+
this.armDeferredSynthesis(hold);
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
await this.resolver.refreshSynthesis(this.db.getPath(), (done, total) => {
|
|
1093
|
+
options.onProgress?.({ phase: 'linking', current: done, total });
|
|
1094
|
+
}, backpressure);
|
|
1095
|
+
this.queries.setMetadata('synthesis_pending', '0');
|
|
1096
|
+
this.lastSynthesisAt = Date.now();
|
|
1097
|
+
synthesized = true;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
if (filesChanged || result.filesRemoved > 0 || orphanCount > 0) {
|
|
1101
|
+
await this.resolver.resolveParameterFlows(flowChange);
|
|
1024
1102
|
}
|
|
1025
|
-
|
|
1026
|
-
// Off-thread — see indexAll's call site.
|
|
1027
|
-
if (filesChanged || result.filesRemoved > 0 || orphanCount > 0 || refreshSynthesis) {
|
|
1103
|
+
if (filesChanged || result.filesRemoved > 0 || orphanCount > 0 || synthesized) {
|
|
1028
1104
|
await this.db.runMaintenance();
|
|
1029
1105
|
}
|
|
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
1106
|
try {
|
|
1037
1107
|
if (vocabWasEmpty && this.queries.getNodeAndEdgeCount().nodes > 0) {
|
|
1038
1108
|
await this.rebuildNameSegmentVocab();
|
|
1039
1109
|
}
|
|
1040
1110
|
}
|
|
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).
|
|
1111
|
+
catch { }
|
|
1045
1112
|
if (fullReconcile && this.getIndexState() === 'indexing') {
|
|
1046
1113
|
try {
|
|
1047
1114
|
this.queries.setMetadata('index_state', 'complete');
|
|
1048
1115
|
}
|
|
1049
|
-
catch {
|
|
1116
|
+
catch { }
|
|
1050
1117
|
}
|
|
1051
1118
|
this.orchestrator.finishGitIndexState(gitState, fullReconcile, result.failedFilePaths);
|
|
1052
1119
|
if (fullReconcile && result.filesChecked > 0)
|
|
1053
1120
|
this.pendingFullReconcile = false;
|
|
1121
|
+
this.stampModuleConfigSnapshotIfMoved();
|
|
1122
|
+
result.durationMs = Date.now() - startedAt;
|
|
1054
1123
|
return result;
|
|
1055
1124
|
}
|
|
1056
1125
|
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
1126
|
if (walValve) {
|
|
1062
1127
|
walValve.stop();
|
|
1063
1128
|
await walValve.drain();
|
|
@@ -1066,26 +1131,92 @@ class CodeGraph {
|
|
|
1066
1131
|
try {
|
|
1067
1132
|
this.db.setWalAutocheckpoint(priorAutocheckpoint);
|
|
1068
1133
|
}
|
|
1069
|
-
catch {
|
|
1134
|
+
catch { }
|
|
1070
1135
|
}
|
|
1071
1136
|
this.fileLock.release();
|
|
1072
1137
|
}
|
|
1073
1138
|
});
|
|
1074
1139
|
}
|
|
1075
|
-
/**
|
|
1076
|
-
* Check if an indexing operation is currently in progress
|
|
1077
|
-
*/
|
|
1078
1140
|
isIndexing() {
|
|
1079
1141
|
return this.indexMutex.isLocked();
|
|
1080
1142
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1143
|
+
synthesisHoldMs() {
|
|
1144
|
+
const interval = parseSynthMinIntervalEnv(process.env.CODEGRAPH_SYNTH_MIN_INTERVAL_MS);
|
|
1145
|
+
if (!interval || this.lastSynthesisAt === 0)
|
|
1146
|
+
return 0;
|
|
1147
|
+
return Math.max(0, this.lastSynthesisAt + interval - Date.now());
|
|
1148
|
+
}
|
|
1149
|
+
armDeferredSynthesis(delayMs) {
|
|
1150
|
+
if (this.deferredSynthesisTimer)
|
|
1151
|
+
return;
|
|
1152
|
+
this.deferredSynthesisTimer = setTimeout(() => {
|
|
1153
|
+
this.deferredSynthesisTimer = null;
|
|
1154
|
+
void this.runDeferredSynthesis();
|
|
1155
|
+
}, delayMs);
|
|
1156
|
+
this.deferredSynthesisTimer.unref?.();
|
|
1157
|
+
}
|
|
1158
|
+
async runDeferredSynthesis() {
|
|
1159
|
+
const retryLater = () => {
|
|
1160
|
+
if (!this.db.isOpen())
|
|
1161
|
+
return;
|
|
1162
|
+
this.armDeferredSynthesis(parseSynthMinIntervalEnv(process.env.CODEGRAPH_SYNTH_MIN_INTERVAL_MS) ?? 1000);
|
|
1163
|
+
};
|
|
1164
|
+
try {
|
|
1165
|
+
await this.indexMutex.withLock(async () => {
|
|
1166
|
+
if (this.queries.getMetadata('synthesis_pending') !== '1')
|
|
1167
|
+
return;
|
|
1168
|
+
try {
|
|
1169
|
+
this.fileLock.acquire();
|
|
1170
|
+
}
|
|
1171
|
+
catch {
|
|
1172
|
+
retryLater();
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
try {
|
|
1176
|
+
this.reopenReplacedDatabase();
|
|
1177
|
+
if (this.queries.getMetadata('synthesis_pending') !== '1')
|
|
1178
|
+
return;
|
|
1179
|
+
await this.synthesizeWithWalDeferred();
|
|
1180
|
+
}
|
|
1181
|
+
finally {
|
|
1182
|
+
this.fileLock.release();
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
catch (err) {
|
|
1187
|
+
(0, errors_1.logWarn)(`Put-off synthesis failed, trying again after the interval: ${err instanceof Error ? err.message : String(err)}`);
|
|
1188
|
+
retryLater();
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
async synthesizeWithWalDeferred() {
|
|
1192
|
+
const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
1193
|
+
let walValve = null;
|
|
1194
|
+
let priorAutocheckpoint = 1000;
|
|
1195
|
+
if (deferWal) {
|
|
1196
|
+
priorAutocheckpoint = this.db.getWalAutocheckpoint();
|
|
1197
|
+
this.db.setWalAutocheckpoint(0);
|
|
1198
|
+
walValve = new wal_valve_1.WalCheckpointValve(this.db, (0, wal_valve_1.resolveWalValveMb)(process.env.CODEGRAPH_WAL_VALVE_MB, this.db.getDbFileSizeBytes()));
|
|
1199
|
+
walValve.start();
|
|
1200
|
+
}
|
|
1201
|
+
try {
|
|
1202
|
+
await this.resolver.refreshSynthesis(this.db.getPath(), undefined, walValve ? () => walValve.backpressure() : undefined);
|
|
1203
|
+
this.queries.setMetadata('synthesis_pending', '0');
|
|
1204
|
+
this.lastSynthesisAt = Date.now();
|
|
1205
|
+
await this.db.runMaintenance();
|
|
1206
|
+
}
|
|
1207
|
+
finally {
|
|
1208
|
+
if (walValve) {
|
|
1209
|
+
walValve.stop();
|
|
1210
|
+
await walValve.drain();
|
|
1211
|
+
}
|
|
1212
|
+
if (deferWal) {
|
|
1213
|
+
try {
|
|
1214
|
+
this.db.setWalAutocheckpoint(priorAutocheckpoint);
|
|
1215
|
+
}
|
|
1216
|
+
catch { }
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1089
1220
|
isIndexedFileStateCurrent(filePath) {
|
|
1090
1221
|
const tracked = this.queries.getFileByPath(filePath);
|
|
1091
1222
|
if (!tracked)
|
|
@@ -1099,221 +1230,98 @@ class CodeGraph {
|
|
|
1099
1230
|
Math.floor(stat.mtimeMs) === Math.floor(tracked.modifiedAt));
|
|
1100
1231
|
}
|
|
1101
1232
|
catch {
|
|
1102
|
-
// Missing/inaccessible files must still reach sync so removals and
|
|
1103
|
-
// transient filesystem failures are reconciled rather than hidden.
|
|
1104
1233
|
return false;
|
|
1105
1234
|
}
|
|
1106
1235
|
}
|
|
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
1236
|
watch(options = {}) {
|
|
1117
1237
|
if (this.watcher?.isActive())
|
|
1118
1238
|
return true;
|
|
1119
|
-
this.watcher = new
|
|
1239
|
+
this.watcher = new ((0, lazy_engine_1.engine)().FileWatcher)(this.projectRoot, async (paths) => {
|
|
1120
1240
|
const result = await this.sync({ paths });
|
|
1121
1241
|
const filesChanged = result.filesAdded + result.filesModified + result.filesRemoved;
|
|
1122
1242
|
return { filesChanged, durationMs: result.durationMs };
|
|
1123
1243
|
}, options, process.platform === 'win32'
|
|
1124
1244
|
? (filePath) => this.isIndexedFileStateCurrent(filePath)
|
|
1125
1245
|
: undefined);
|
|
1126
|
-
|
|
1246
|
+
this.orchestrator.setKeepDetectionContents(true);
|
|
1247
|
+
const started = this.watcher.start();
|
|
1248
|
+
if (!started)
|
|
1249
|
+
this.orchestrator.setKeepDetectionContents(false);
|
|
1250
|
+
return started;
|
|
1127
1251
|
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Stop watching for file changes.
|
|
1130
|
-
*/
|
|
1131
1252
|
unwatch() {
|
|
1132
1253
|
if (this.watcher) {
|
|
1133
1254
|
this.watcher.stop();
|
|
1134
1255
|
this.watcher = null;
|
|
1135
1256
|
}
|
|
1257
|
+
if (this.builtOrchestrator)
|
|
1258
|
+
this.builtOrchestrator.setKeepDetectionContents(false);
|
|
1136
1259
|
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Check if the file watcher is active.
|
|
1139
|
-
*/
|
|
1140
1260
|
isWatching() {
|
|
1141
1261
|
return this.watcher?.isActive() ?? false;
|
|
1142
1262
|
}
|
|
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
1263
|
isWatcherDegraded() {
|
|
1151
1264
|
return this.watcher?.isDegraded() ?? false;
|
|
1152
1265
|
}
|
|
1153
|
-
/** The reason live watching degraded, or null if it is healthy (#876). */
|
|
1154
1266
|
getWatcherDegradedReason() {
|
|
1155
1267
|
return this.watcher?.getDegradedReason() ?? null;
|
|
1156
1268
|
}
|
|
1157
|
-
/** Re-arm a lock-degraded watcher; its stale state persists until a full sync. */
|
|
1158
1269
|
rearmWatcherAfterLockContention() {
|
|
1159
1270
|
return this.watcher?.rearmAfterLockContention() ?? false;
|
|
1160
1271
|
}
|
|
1161
|
-
/** True while a re-armed watcher owes a full reconcile of missed changes. */
|
|
1162
1272
|
isWatcherRecovering() {
|
|
1163
1273
|
return this.watcher?.isRecoveringFromLock() ?? false;
|
|
1164
1274
|
}
|
|
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
1275
|
getPendingFiles() {
|
|
1178
1276
|
return this.watcher?.getPendingFiles() ?? [];
|
|
1179
1277
|
}
|
|
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
1278
|
waitUntilWatcherReady(timeoutMs) {
|
|
1186
1279
|
return this.watcher ? this.watcher.waitUntilReady(timeoutMs) : Promise.resolve();
|
|
1187
1280
|
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Get files that have changed since last index
|
|
1190
|
-
*/
|
|
1191
1281
|
getChangedFiles() {
|
|
1192
1282
|
return this.orchestrator.getChangedFiles();
|
|
1193
1283
|
}
|
|
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
1284
|
getLastIndexedAt() {
|
|
1200
1285
|
return this.queries.getLastIndexedAt();
|
|
1201
1286
|
}
|
|
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
1287
|
getIndexRevision() {
|
|
1208
1288
|
return this.queries.getIndexRevision();
|
|
1209
1289
|
}
|
|
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
1290
|
getFilesIndexedSince(since, limit) {
|
|
1215
1291
|
return this.queries.getFilesIndexedSince(since, limit);
|
|
1216
1292
|
}
|
|
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
1293
|
dropReadCaches() {
|
|
1234
1294
|
this.queries.clearCache();
|
|
1235
1295
|
}
|
|
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
1296
|
getIndexState() {
|
|
1246
1297
|
const raw = this.queries.getMetadata('index_state');
|
|
1247
1298
|
return raw === 'indexing' || raw === 'complete' || raw === 'partial' || raw === 'failed'
|
|
1248
1299
|
? raw
|
|
1249
1300
|
: null;
|
|
1250
1301
|
}
|
|
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
1302
|
getIndexBuildInfo() {
|
|
1258
1303
|
const version = this.queries.getMetadata('indexed_with_version');
|
|
1259
1304
|
const ev = this.queries.getMetadata('indexed_with_extraction_version');
|
|
1260
1305
|
const parsed = ev != null ? parseInt(ev, 10) : NaN;
|
|
1261
1306
|
return { version, extractionVersion: Number.isFinite(parsed) ? parsed : null };
|
|
1262
1307
|
}
|
|
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
1308
|
isIndexStale() {
|
|
1271
1309
|
if (this.queries.getLastIndexedAt() == null)
|
|
1272
1310
|
return false;
|
|
1273
1311
|
const { extractionVersion } = this.getIndexBuildInfo();
|
|
1274
1312
|
return extractionVersion == null || extractionVersion < extraction_version_1.EXTRACTION_VERSION;
|
|
1275
1313
|
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Extract nodes and edges from source code (without storing)
|
|
1278
|
-
*/
|
|
1279
1314
|
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
|
-
*/
|
|
1315
|
+
return (0, lazy_engine_1.engine)().extractFromSource(filePath, source, (0, grammars_1.detectLanguage)(filePath, source, undefined, this.projectRoot));
|
|
1316
|
+
}
|
|
1294
1317
|
resolveReferences(onProgress) {
|
|
1295
|
-
// Get all unresolved references from the database
|
|
1296
1318
|
const unresolvedRefs = this.queries.getUnresolvedReferences();
|
|
1297
1319
|
return this.resolver.resolveAndPersist(unresolvedRefs, onProgress);
|
|
1298
1320
|
}
|
|
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) {
|
|
1321
|
+
async resolveReferencesBatched(onProgress, onSynthesisProgress, backpressure, synthesize = true, frameworksCurrent = false) {
|
|
1310
1322
|
return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, {
|
|
1311
1323
|
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.
|
|
1324
|
+
shareFrameworks: frameworksCurrent,
|
|
1317
1325
|
bulkEdgeLoad: {
|
|
1318
1326
|
begin: () => this.db.beginBulkEdgeLoad(),
|
|
1319
1327
|
end: () => this.db.endBulkEdgeLoad({ deferSynthesisSite: true }),
|
|
@@ -1326,306 +1334,136 @@ class CodeGraph {
|
|
|
1326
1334
|
backpressure,
|
|
1327
1335
|
}, synthesize);
|
|
1328
1336
|
}
|
|
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
1337
|
getPendingReferenceCount() {
|
|
1337
1338
|
return this.queries.getUnresolvedReferencesCount();
|
|
1338
1339
|
}
|
|
1339
|
-
/**
|
|
1340
|
-
* Get detected frameworks in the project
|
|
1341
|
-
*/
|
|
1342
1340
|
getDetectedFrameworks() {
|
|
1343
1341
|
return this.resolver.getDetectedFrameworks();
|
|
1344
1342
|
}
|
|
1345
|
-
/**
|
|
1346
|
-
* Re-initialize the resolver (useful after adding new files)
|
|
1347
|
-
*/
|
|
1348
1343
|
reinitializeResolver() {
|
|
1349
1344
|
this.resolver.initialize();
|
|
1350
1345
|
}
|
|
1351
|
-
// ===========================================================================
|
|
1352
|
-
// Graph Statistics
|
|
1353
|
-
// ===========================================================================
|
|
1354
|
-
/**
|
|
1355
|
-
* Get statistics about the knowledge graph
|
|
1356
|
-
*/
|
|
1357
1346
|
getStats() {
|
|
1358
1347
|
const stats = this.queries.getStats();
|
|
1359
1348
|
stats.dbSizeBytes = this.db.getSize();
|
|
1360
1349
|
stats.walSizeBytes = this.db.getWalSizeBytes();
|
|
1361
1350
|
return stats;
|
|
1362
1351
|
}
|
|
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
1352
|
getBackend() {
|
|
1369
1353
|
return this.db.getBackend();
|
|
1370
1354
|
}
|
|
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
1355
|
getJournalMode() {
|
|
1378
1356
|
return this.db.getJournalMode();
|
|
1379
1357
|
}
|
|
1380
|
-
// ===========================================================================
|
|
1381
|
-
// Node Operations
|
|
1382
|
-
// ===========================================================================
|
|
1383
|
-
/**
|
|
1384
|
-
* Get a node by ID
|
|
1385
|
-
*/
|
|
1386
1358
|
getNode(id) {
|
|
1387
1359
|
return this.queries.getNodeById(id);
|
|
1388
1360
|
}
|
|
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
1361
|
getNodesByIds(ids) {
|
|
1398
1362
|
return this.queries.getNodesByIds(ids);
|
|
1399
1363
|
}
|
|
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
1364
|
getNodesByQualifiedName(qualifiedName) {
|
|
1412
1365
|
return this.queries.getNodesByQualifiedNameExact(qualifiedName);
|
|
1413
1366
|
}
|
|
1414
|
-
/**
|
|
1415
|
-
* Outgoing edges for many source nodes at once — the batch form of
|
|
1416
|
-
* {@link getOutgoingEdges}. See {@link QueryBuilder.getOutgoingEdgesFrom}.
|
|
1417
|
-
*/
|
|
1418
1367
|
getOutgoingEdgesFrom(nodeIds, kinds) {
|
|
1419
1368
|
return this.queries.getOutgoingEdgesFrom(nodeIds, kinds);
|
|
1420
1369
|
}
|
|
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
1370
|
getFanIn(ids) {
|
|
1426
1371
|
return this.queries.countIncomingEdges(ids);
|
|
1427
1372
|
}
|
|
1428
|
-
/**
|
|
1429
|
-
* Incoming edges for many target nodes at once — the mirror of
|
|
1430
|
-
* {@link getOutgoingEdgesFrom}. See {@link QueryBuilder.getIncomingEdgesTo}.
|
|
1431
|
-
*/
|
|
1432
1373
|
getIncomingEdgesTo(nodeIds, kinds) {
|
|
1433
1374
|
return this.queries.getIncomingEdgesTo(nodeIds, kinds);
|
|
1434
1375
|
}
|
|
1435
|
-
/**
|
|
1436
|
-
* Fan-out (outgoing edge count) for many nodes at once — the mirror of
|
|
1437
|
-
* {@link getFanIn}. See {@link QueryBuilder.countOutgoingEdges}.
|
|
1438
|
-
*/
|
|
1439
1376
|
getFanOut(ids) {
|
|
1440
1377
|
return this.queries.countOutgoingEdges(ids);
|
|
1441
1378
|
}
|
|
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
1379
|
getUnreferencedNodes(kinds, limit) {
|
|
1451
1380
|
return this.queries.getUnreferencedNodes(kinds, limit);
|
|
1452
1381
|
}
|
|
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
1382
|
getAmbiguousReferencedNames(names) {
|
|
1459
1383
|
return this.queries.getAmbiguousReferencedNames(names);
|
|
1460
1384
|
}
|
|
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
1385
|
getLanguagesWithExports(languages) {
|
|
1466
1386
|
return this.queries.getLanguagesWithExports(languages);
|
|
1467
1387
|
}
|
|
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
1388
|
getUnresolvedNamesAmong(names) {
|
|
1474
1389
|
return this.queries.getUnresolvedNamesAmong(names);
|
|
1475
1390
|
}
|
|
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
1391
|
getUnresolvedSupertypeSourcesAmong(nodeIds) {
|
|
1481
1392
|
return this.queries.getUnresolvedSupertypeSourcesAmong(nodeIds);
|
|
1482
1393
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1394
|
+
getUnresolvedReferenceNamesFrom(nodeIds, kinds) {
|
|
1395
|
+
return this.queries.getUnresolvedReferenceNamesFrom(nodeIds, kinds);
|
|
1396
|
+
}
|
|
1397
|
+
getUnresolvedReferenceSourcesNamed(names, kinds) {
|
|
1398
|
+
return this.queries.getUnresolvedReferenceSourcesNamed(names, kinds);
|
|
1399
|
+
}
|
|
1488
1400
|
getTopDependedOn(limit) {
|
|
1489
1401
|
return this.queries.getTopDependedOn(limit);
|
|
1490
1402
|
}
|
|
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
1403
|
getTopCallingFiles(limit) {
|
|
1498
1404
|
return this.queries.getTopCallingFiles(limit);
|
|
1499
1405
|
}
|
|
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
1406
|
getFileDependentCounts(filePaths) {
|
|
1506
1407
|
return new Map(this.queries.getFileDependentCounts(filePaths).map((row) => [row.filePath, row.dependents]));
|
|
1507
1408
|
}
|
|
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
1409
|
getFileReachCounts(filePaths) {
|
|
1514
1410
|
return new Map(this.queries
|
|
1515
1411
|
.getFileReachCounts(filePaths)
|
|
1516
1412
|
.map((row) => [row.filePath, { reaches: row.reaches, refs: row.refs }]));
|
|
1517
1413
|
}
|
|
1518
|
-
/** The `file` nodes for the given paths, in one query. */
|
|
1519
1414
|
getFileNodes(filePaths) {
|
|
1520
1415
|
return this.queries.getFileNodes(filePaths);
|
|
1521
1416
|
}
|
|
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
1417
|
getModuleAggregation(assignments, options) {
|
|
1532
1418
|
return this.queries.aggregateModuleGraph(assignments, options);
|
|
1533
1419
|
}
|
|
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
1420
|
getFileDependencyPairs(minConfidence = 0) {
|
|
1539
1421
|
return this.queries.getCrossFileDependencyPairs(minConfidence);
|
|
1540
1422
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
* the call sites that have no callee row instead of implying there are none.
|
|
1545
|
-
*/
|
|
1423
|
+
getFileImportPairs() {
|
|
1424
|
+
return this.queries.getFileImportPairs();
|
|
1425
|
+
}
|
|
1546
1426
|
getUnresolvedReferencesFrom(nodeId) {
|
|
1547
1427
|
return this.queries.getUnresolvedReferencesFrom(nodeId);
|
|
1548
1428
|
}
|
|
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
1429
|
getUnresolvedReferencesInFile(filePath, limit) {
|
|
1557
1430
|
return this.queries.getUnresolvedReferencesInFile(filePath, limit);
|
|
1558
1431
|
}
|
|
1559
|
-
/**
|
|
1560
|
-
* Get all nodes in a file
|
|
1561
|
-
*/
|
|
1562
1432
|
getNodesInFile(filePath) {
|
|
1563
1433
|
return this.queries.getNodesByFile(filePath);
|
|
1564
1434
|
}
|
|
1565
|
-
/**
|
|
1566
|
-
* Get all nodes in several files, in one batched query.
|
|
1567
|
-
*/
|
|
1568
1435
|
getNodesInFiles(filePaths) {
|
|
1569
1436
|
return this.queries.getNodesByFiles(filePaths);
|
|
1570
1437
|
}
|
|
1571
|
-
/**
|
|
1572
|
-
* Get all nodes of a specific kind
|
|
1573
|
-
*/
|
|
1574
1438
|
getNodesByKind(kind) {
|
|
1575
1439
|
return this.queries.getNodesByKind(kind);
|
|
1576
1440
|
}
|
|
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
1441
|
getNodesByName(name) {
|
|
1583
1442
|
return this.queries.getNodesByName(name);
|
|
1584
1443
|
}
|
|
1585
|
-
/** Nodes whose name starts with `prefix` (index range scan, capped). */
|
|
1586
1444
|
getNodesByNamePrefix(prefix, limit = 20) {
|
|
1587
1445
|
return this.queries.getNodesByNamePrefix(prefix, limit);
|
|
1588
1446
|
}
|
|
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
1447
|
getNodesByNameSubstring(substring, options = {}) {
|
|
1595
1448
|
return this.queries
|
|
1596
1449
|
.findNodesByNameSubstring(substring, options)
|
|
1597
1450
|
.map((r) => r.node);
|
|
1598
1451
|
}
|
|
1599
|
-
/**
|
|
1600
|
-
* Search nodes by text
|
|
1601
|
-
*/
|
|
1602
1452
|
searchNodes(query, options) {
|
|
1603
1453
|
return this.queries.searchNodes(query, options);
|
|
1604
1454
|
}
|
|
1605
|
-
/** Lexical evidence for an empty explore result; does not alter retrieval. */
|
|
1606
1455
|
getExploreMissDiagnostics(query) {
|
|
1607
1456
|
return this.queries.getExploreMissDiagnostics(query);
|
|
1608
1457
|
}
|
|
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
|
-
*/
|
|
1458
|
+
getUnseenNames(names) {
|
|
1459
|
+
return this.queries.getUnseenNames(names);
|
|
1460
|
+
}
|
|
1461
|
+
findNamedCopybooks(query) {
|
|
1462
|
+
return (0, cobol_copybooks_1.findNamedCopybooks)(this.queries, query);
|
|
1463
|
+
}
|
|
1625
1464
|
getSegmentMatches(words, limit = 6) {
|
|
1626
1465
|
if (words.length === 0)
|
|
1627
1466
|
return [];
|
|
1628
|
-
// Variant → original word (plural folding), for coverage accounting.
|
|
1629
1467
|
const variantToWord = new Map();
|
|
1630
1468
|
for (const word of words) {
|
|
1631
1469
|
for (const variant of (0, identifier_segments_1.segmentLookupVariants)(word)) {
|
|
@@ -1634,11 +1472,6 @@ class CodeGraph {
|
|
|
1634
1472
|
}
|
|
1635
1473
|
}
|
|
1636
1474
|
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
1475
|
const variantPairs = [...variantToWord.entries()].map(([segment, word]) => ({ segment, word }));
|
|
1643
1476
|
const candidates = [];
|
|
1644
1477
|
for (const hit of this.queries.getSegmentCoOccurrence(variantPairs, 2, 24)) {
|
|
@@ -1646,16 +1479,6 @@ class CodeGraph {
|
|
|
1646
1479
|
if (matched.size >= 2)
|
|
1647
1480
|
candidates.push({ name: hit.name, matchedWords: matched });
|
|
1648
1481
|
}
|
|
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
1482
|
if (candidates.length === 0) {
|
|
1660
1483
|
const singleWordVariants = variants.filter((v) => variantToWord.get(v).length >= 5);
|
|
1661
1484
|
const counts = this.queries.getSegmentNameCounts(singleWordVariants);
|
|
@@ -1672,13 +1495,6 @@ class CodeGraph {
|
|
|
1672
1495
|
}
|
|
1673
1496
|
}
|
|
1674
1497
|
}
|
|
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
1498
|
const out = [];
|
|
1683
1499
|
const seen = new Set();
|
|
1684
1500
|
candidates.sort((a, b) => b.matchedWords.size - a.matchedWords.size || a.name.length - b.name.length);
|
|
@@ -1690,10 +1506,10 @@ class CodeGraph {
|
|
|
1690
1506
|
seen.add(candidate.name);
|
|
1691
1507
|
const nodes = this.queries.getNodesByName(candidate.name);
|
|
1692
1508
|
if (nodes.length === 0)
|
|
1693
|
-
continue;
|
|
1509
|
+
continue;
|
|
1694
1510
|
const rep = nodes.find((n) => n.kind !== 'file' && n.kind !== 'import');
|
|
1695
1511
|
if (!rep)
|
|
1696
|
-
continue;
|
|
1512
|
+
continue;
|
|
1697
1513
|
out.push({
|
|
1698
1514
|
name: candidate.name,
|
|
1699
1515
|
kind: rep.kind,
|
|
@@ -1704,13 +1520,7 @@ class CodeGraph {
|
|
|
1704
1520
|
}
|
|
1705
1521
|
return out;
|
|
1706
1522
|
}
|
|
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
1523
|
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
1524
|
wordsMatchingName(name, variantToWord) {
|
|
1715
1525
|
const segments = new Set((0, identifier_segments_1.splitIdentifierSegments)(name));
|
|
1716
1526
|
const matched = new Set();
|
|
@@ -1720,16 +1530,6 @@ class CodeGraph {
|
|
|
1720
1530
|
}
|
|
1721
1531
|
return matched;
|
|
1722
1532
|
}
|
|
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
1533
|
async healSegmentVocabIfEmpty() {
|
|
1734
1534
|
const empty = (() => {
|
|
1735
1535
|
try {
|
|
@@ -1748,12 +1548,22 @@ class CodeGraph {
|
|
|
1748
1548
|
this.fileLock.acquire();
|
|
1749
1549
|
}
|
|
1750
1550
|
catch {
|
|
1751
|
-
return false;
|
|
1551
|
+
return false;
|
|
1752
1552
|
}
|
|
1753
1553
|
try {
|
|
1754
1554
|
if (!this.queries.isNameSegmentVocabEmpty())
|
|
1755
|
-
return true;
|
|
1756
|
-
|
|
1555
|
+
return true;
|
|
1556
|
+
if (!this.db.readOnly) {
|
|
1557
|
+
await this.rebuildNameSegmentVocab();
|
|
1558
|
+
return true;
|
|
1559
|
+
}
|
|
1560
|
+
const writer = db_1.DatabaseConnection.open(this.db.getPath());
|
|
1561
|
+
try {
|
|
1562
|
+
await this.rebuildNameSegmentVocab(new queries_1.QueryBuilder(writer.getDb()));
|
|
1563
|
+
}
|
|
1564
|
+
finally {
|
|
1565
|
+
writer.close();
|
|
1566
|
+
}
|
|
1757
1567
|
return true;
|
|
1758
1568
|
}
|
|
1759
1569
|
finally {
|
|
@@ -1761,324 +1571,139 @@ class CodeGraph {
|
|
|
1761
1571
|
}
|
|
1762
1572
|
});
|
|
1763
1573
|
}
|
|
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() {
|
|
1574
|
+
async rebuildNameSegmentVocab(queries = this.queries) {
|
|
1771
1575
|
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
1772
1576
|
const BATCH = 2000;
|
|
1773
1577
|
for (let offset = 0;; offset += BATCH) {
|
|
1774
|
-
const names =
|
|
1578
|
+
const names = queries.getDistinctNodeNames(BATCH, offset);
|
|
1775
1579
|
if (names.length === 0)
|
|
1776
1580
|
break;
|
|
1777
|
-
|
|
1581
|
+
queries.insertNameSegmentsBatch(names);
|
|
1778
1582
|
await maybeYield();
|
|
1779
1583
|
}
|
|
1780
1584
|
}
|
|
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
1585
|
getProjectNameTokens() {
|
|
1789
1586
|
return this.queries.getProjectNameTokens();
|
|
1790
1587
|
}
|
|
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
1588
|
getTopRouteFile() {
|
|
1800
1589
|
return this.queries.getTopRouteFile();
|
|
1801
1590
|
}
|
|
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
|
-
*/
|
|
1591
|
+
getRoutingManifest(limit, perRoute) {
|
|
1592
|
+
return this.queries.getRoutingManifest(limit, perRoute);
|
|
1593
|
+
}
|
|
1817
1594
|
getOutgoingEdges(nodeId) {
|
|
1818
1595
|
return this.queries.getOutgoingEdges(nodeId);
|
|
1819
1596
|
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Get incoming edges to a node
|
|
1822
|
-
*/
|
|
1823
1597
|
getIncomingEdges(nodeId) {
|
|
1824
1598
|
return this.queries.getIncomingEdges(nodeId);
|
|
1825
1599
|
}
|
|
1826
|
-
// ===========================================================================
|
|
1827
|
-
// File Operations
|
|
1828
|
-
// ===========================================================================
|
|
1829
|
-
/**
|
|
1830
|
-
* Get a file record by path
|
|
1831
|
-
*/
|
|
1832
1600
|
getFile(filePath) {
|
|
1833
1601
|
return this.queries.getFileByPath(filePath);
|
|
1834
1602
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1603
|
+
hasFilesUnder(dir) {
|
|
1604
|
+
return this.queries.hasFilesUnder(dir);
|
|
1605
|
+
}
|
|
1838
1606
|
getFiles() {
|
|
1839
1607
|
return this.queries.getAllFiles();
|
|
1840
1608
|
}
|
|
1841
|
-
/**
|
|
1842
|
-
* A `(path) => boolean` generated-file test over a BOUNDED candidate list,
|
|
1843
|
-
* unioning the index-time content-banner flag with the filename convention
|
|
1844
|
-
* (#1500). One query up front, O(1) per call after — built for use inside a
|
|
1845
|
-
* ranking comparator, where re-querying per comparison would be quadratic.
|
|
1846
|
-
*
|
|
1847
|
-
* Pass every path you might ask about; a path outside the list falls back to
|
|
1848
|
-
* the filename check alone.
|
|
1849
|
-
*/
|
|
1850
1609
|
generatedFilePredicate(filePaths) {
|
|
1851
1610
|
return this.queries.generatedPredicateFor(filePaths);
|
|
1852
1611
|
}
|
|
1853
|
-
/**
|
|
1854
|
-
* A `(path) => boolean` ambient-declaration test over a BOUNDED candidate
|
|
1855
|
-
* list: true for a file that declares nothing but types, originates no call
|
|
1856
|
-
* edge, and that nothing in the index depends on — an ambient `.d.ts` of
|
|
1857
|
-
* global shims, vendored typings, module augmentation (CG-28). Structural
|
|
1858
|
-
* rather than extension-based, and deliberately narrow: see
|
|
1859
|
-
* `QueryBuilder.getAmbientDeclarationPathsAmong` for why each condition is
|
|
1860
|
-
* there, in particular why a `types.ts` the codebase imports is NOT flagged.
|
|
1861
|
-
*/
|
|
1862
1612
|
ambientDeclarationFilePredicate(filePaths) {
|
|
1863
1613
|
return this.queries.ambientDeclarationPredicateFor(filePaths);
|
|
1864
1614
|
}
|
|
1865
|
-
/** How many indexed files are flagged tool-generated. Reported by `status`. */
|
|
1866
1615
|
getGeneratedFileCount() {
|
|
1867
1616
|
return this.queries.countGeneratedFiles();
|
|
1868
1617
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1618
|
+
getIndexHealth() {
|
|
1619
|
+
const needsReindex = [];
|
|
1620
|
+
const parseErrors = [];
|
|
1621
|
+
for (const file of this.queries.getFilesWithoutNodesOrWithErrors()) {
|
|
1622
|
+
const errors = file.errors ?? [];
|
|
1623
|
+
if ((0, grammars_1.hasGrammarLoadFailure)(errors)) {
|
|
1624
|
+
needsReindex.push(file.path);
|
|
1625
|
+
}
|
|
1626
|
+
else if (file.nodeCount === 0) {
|
|
1627
|
+
if ((0, grammars_1.isFileLevelOnlyLanguage)(file.language))
|
|
1628
|
+
continue;
|
|
1629
|
+
if (errors.length === 0)
|
|
1630
|
+
needsReindex.push(file.path);
|
|
1631
|
+
else if (errors.some((e) => e.severity === 'error' || e.code === 'parse_error'))
|
|
1632
|
+
parseErrors.push(file.path);
|
|
1633
|
+
}
|
|
1634
|
+
else if (errors.some((e) => e.code === 'parse_error')) {
|
|
1635
|
+
parseErrors.push(file.path);
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
return { needsReindex, parseErrors };
|
|
1639
|
+
}
|
|
1640
|
+
getLanguageCoverage() {
|
|
1641
|
+
const parsedFilesByLanguage = {};
|
|
1642
|
+
const unparsedLanguages = [];
|
|
1643
|
+
for (const { language, parsed } of this.queries.getParsedFileCounts()) {
|
|
1644
|
+
if (!(0, grammars_1.yieldsSymbols)(language))
|
|
1645
|
+
continue;
|
|
1646
|
+
parsedFilesByLanguage[language] = parsed;
|
|
1647
|
+
if (parsed === 0)
|
|
1648
|
+
unparsedLanguages.push(language);
|
|
1649
|
+
}
|
|
1650
|
+
return { parsedFilesByLanguage, unparsedLanguages };
|
|
1651
|
+
}
|
|
1882
1652
|
getContext(nodeId) {
|
|
1883
1653
|
return this.graphManager.getContext(nodeId);
|
|
1884
1654
|
}
|
|
1885
|
-
/**
|
|
1886
|
-
* Traverse the graph from a starting node
|
|
1887
|
-
*
|
|
1888
|
-
* Uses breadth-first search by default. Supports filtering by edge types,
|
|
1889
|
-
* node types, and traversal direction.
|
|
1890
|
-
*
|
|
1891
|
-
* @param startId - Starting node ID
|
|
1892
|
-
* @param options - Traversal options
|
|
1893
|
-
* @returns Subgraph containing traversed nodes and edges
|
|
1894
|
-
*/
|
|
1895
1655
|
traverse(startId, options) {
|
|
1896
1656
|
return this.traverser.traverseBFS(startId, options);
|
|
1897
1657
|
}
|
|
1898
|
-
/**
|
|
1899
|
-
* Get the call graph for a function
|
|
1900
|
-
*
|
|
1901
|
-
* Returns both callers (functions that call this function) and
|
|
1902
|
-
* callees (functions called by this function) up to the specified depth.
|
|
1903
|
-
*
|
|
1904
|
-
* @param nodeId - ID of the function/method node
|
|
1905
|
-
* @param depth - Maximum depth in each direction (default: 2)
|
|
1906
|
-
* @returns Subgraph containing the call graph
|
|
1907
|
-
*/
|
|
1908
1658
|
getCallGraph(nodeId, depth = 2) {
|
|
1909
1659
|
return this.traverser.getCallGraph(nodeId, depth);
|
|
1910
1660
|
}
|
|
1911
|
-
/**
|
|
1912
|
-
* Get the type hierarchy for a class/interface
|
|
1913
|
-
*
|
|
1914
|
-
* Returns both ancestors (types this extends/implements) and
|
|
1915
|
-
* descendants (types that extend/implement this).
|
|
1916
|
-
*
|
|
1917
|
-
* @param nodeId - ID of the class/interface node
|
|
1918
|
-
* @returns Subgraph containing the type hierarchy
|
|
1919
|
-
*/
|
|
1920
1661
|
getTypeHierarchy(nodeId) {
|
|
1921
1662
|
return this.traverser.getTypeHierarchy(nodeId);
|
|
1922
1663
|
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Find all usages of a symbol
|
|
1925
|
-
*
|
|
1926
|
-
* Returns all nodes that reference the specified symbol through
|
|
1927
|
-
* any edge type (calls, references, type_of, etc.).
|
|
1928
|
-
*
|
|
1929
|
-
* @param nodeId - ID of the symbol node
|
|
1930
|
-
* @returns Array of nodes and edges that reference this symbol
|
|
1931
|
-
*/
|
|
1932
1664
|
findUsages(nodeId) {
|
|
1933
1665
|
return this.traverser.findUsages(nodeId);
|
|
1934
1666
|
}
|
|
1935
|
-
/**
|
|
1936
|
-
* Get callers of a function/method
|
|
1937
|
-
*
|
|
1938
|
-
* @param nodeId - ID of the function/method node
|
|
1939
|
-
* @param maxDepth - Maximum depth to traverse (default: 1)
|
|
1940
|
-
* @returns Array of nodes that call this function
|
|
1941
|
-
*/
|
|
1942
1667
|
getCallers(nodeId, maxDepth = 1) {
|
|
1943
1668
|
return this.traverser.getCallers(nodeId, maxDepth);
|
|
1944
1669
|
}
|
|
1945
|
-
/**
|
|
1946
|
-
* Get callees of a function/method
|
|
1947
|
-
*
|
|
1948
|
-
* @param nodeId - ID of the function/method node
|
|
1949
|
-
* @param maxDepth - Maximum depth to traverse (default: 1)
|
|
1950
|
-
* @returns Array of nodes called by this function
|
|
1951
|
-
*/
|
|
1952
1670
|
getCallees(nodeId, maxDepth = 1) {
|
|
1953
1671
|
return this.traverser.getCallees(nodeId, maxDepth);
|
|
1954
1672
|
}
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
* @param maxDepth - Maximum depth to traverse (default: 3)
|
|
1962
|
-
* @returns Subgraph containing potentially impacted nodes
|
|
1963
|
-
*/
|
|
1964
|
-
getImpactRadius(nodeId, maxDepth = 3) {
|
|
1965
|
-
return this.traverser.getImpactRadius(nodeId, maxDepth);
|
|
1966
|
-
}
|
|
1967
|
-
/**
|
|
1968
|
-
* Find the shortest path between two nodes
|
|
1969
|
-
*
|
|
1970
|
-
* @param fromId - Starting node ID
|
|
1971
|
-
* @param toId - Target node ID
|
|
1972
|
-
* @param edgeKinds - Edge types to consider (all if empty)
|
|
1973
|
-
* @returns Array of nodes and edges forming the path, or null if no path exists
|
|
1974
|
-
*/
|
|
1673
|
+
getCallSites(nodeId, direction) {
|
|
1674
|
+
return this.traverser.getCallSites(nodeId, direction);
|
|
1675
|
+
}
|
|
1676
|
+
getImpactRadius(nodeId, maxDepth = 3, options = {}) {
|
|
1677
|
+
return this.traverser.getImpactRadius(nodeId, maxDepth, options);
|
|
1678
|
+
}
|
|
1975
1679
|
findPath(fromId, toId, edgeKinds) {
|
|
1976
1680
|
return this.traverser.findPath(fromId, toId, edgeKinds);
|
|
1977
1681
|
}
|
|
1978
|
-
/**
|
|
1979
|
-
* Get ancestors of a node in the containment hierarchy
|
|
1980
|
-
*
|
|
1981
|
-
* @param nodeId - ID of the node
|
|
1982
|
-
* @returns Array of ancestor nodes from immediate parent to root
|
|
1983
|
-
*/
|
|
1984
1682
|
getAncestors(nodeId) {
|
|
1985
1683
|
return this.traverser.getAncestors(nodeId);
|
|
1986
1684
|
}
|
|
1987
|
-
/**
|
|
1988
|
-
* Get immediate children of a node
|
|
1989
|
-
*
|
|
1990
|
-
* @param nodeId - ID of the node
|
|
1991
|
-
* @returns Array of child nodes
|
|
1992
|
-
*/
|
|
1993
1685
|
getChildren(nodeId) {
|
|
1994
1686
|
return this.traverser.getChildren(nodeId);
|
|
1995
1687
|
}
|
|
1996
|
-
/**
|
|
1997
|
-
* Get dependencies of a file
|
|
1998
|
-
*
|
|
1999
|
-
* @param filePath - Path to the file
|
|
2000
|
-
* @returns Array of file paths this file depends on
|
|
2001
|
-
*/
|
|
2002
1688
|
getFileDependencies(filePath) {
|
|
2003
1689
|
return this.graphManager.getFileDependencies(filePath);
|
|
2004
1690
|
}
|
|
2005
|
-
/**
|
|
2006
|
-
* Get dependents of a file
|
|
2007
|
-
*
|
|
2008
|
-
* @param filePath - Path to the file
|
|
2009
|
-
* @returns Array of file paths that depend on this file
|
|
2010
|
-
*/
|
|
2011
1691
|
getFileDependents(filePath) {
|
|
2012
1692
|
return this.graphManager.getFileDependents(filePath);
|
|
2013
1693
|
}
|
|
2014
|
-
/**
|
|
2015
|
-
* Find circular dependencies in the codebase
|
|
2016
|
-
*
|
|
2017
|
-
* @returns Array of cycles, each cycle is an array of file paths
|
|
2018
|
-
*/
|
|
2019
1694
|
findCircularDependencies() {
|
|
2020
1695
|
return this.graphManager.findCircularDependencies();
|
|
2021
1696
|
}
|
|
2022
|
-
/**
|
|
2023
|
-
* Find unreferenced symbols — the RAW candidate set.
|
|
2024
|
-
*
|
|
2025
|
-
* Non-exported symbols of the given kinds with no incoming edge but
|
|
2026
|
-
* `contains`. That is a fact, not a claim: on this engine's own index it
|
|
2027
|
-
* returns ~2 500 symbols, of which about 20 are actually unreachable. The
|
|
2028
|
-
* rest are overrides, framework registrations, mis-resolved twins and
|
|
2029
|
-
* references the extractor never recorded.
|
|
2030
|
-
*
|
|
2031
|
-
* For a list anybody should act on, use `buildDeadCodeReport` from
|
|
2032
|
-
* `src/graph/dead-code.ts`, which applies the exclusions and counts every one
|
|
2033
|
-
* of them. This method is kept as-is because it is a published API.
|
|
2034
|
-
*
|
|
2035
|
-
* @param kinds - Node kinds to check (default: functions, methods, classes)
|
|
2036
|
-
* @returns Array of unreferenced nodes
|
|
2037
|
-
*/
|
|
2038
1697
|
findDeadCode(kinds) {
|
|
2039
1698
|
return this.graphManager.findDeadCode(kinds);
|
|
2040
1699
|
}
|
|
2041
|
-
/**
|
|
2042
|
-
* Get complexity metrics for a node
|
|
2043
|
-
*
|
|
2044
|
-
* @param nodeId - ID of the node
|
|
2045
|
-
* @returns Object containing various complexity metrics
|
|
2046
|
-
*/
|
|
2047
1700
|
getNodeMetrics(nodeId) {
|
|
2048
1701
|
return this.graphManager.getNodeMetrics(nodeId);
|
|
2049
1702
|
}
|
|
2050
|
-
// ===========================================================================
|
|
2051
|
-
// Context Building
|
|
2052
|
-
// ===========================================================================
|
|
2053
|
-
/**
|
|
2054
|
-
* Get the source code for a node
|
|
2055
|
-
*
|
|
2056
|
-
* Reads the file and extracts the code between startLine and endLine.
|
|
2057
|
-
*
|
|
2058
|
-
* @param nodeId - ID of the node
|
|
2059
|
-
* @returns Code string or null if not found
|
|
2060
|
-
*/
|
|
2061
1703
|
async getCode(nodeId) {
|
|
2062
1704
|
return this.contextBuilder.getCode(nodeId);
|
|
2063
1705
|
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Find relevant subgraph for a query
|
|
2066
|
-
*
|
|
2067
|
-
* Combines semantic search with graph traversal to find the most
|
|
2068
|
-
* relevant nodes and their relationships for a given query.
|
|
2069
|
-
*
|
|
2070
|
-
* @param query - Natural language query describing the task
|
|
2071
|
-
* @param options - Search and traversal options
|
|
2072
|
-
* @returns Subgraph of relevant nodes and edges
|
|
2073
|
-
*/
|
|
2074
1706
|
async findRelevantContext(query, options) {
|
|
2075
|
-
// Segment-vocab supplement: FTS keeps camelCase names as single tokens,
|
|
2076
|
-
// so a word-level query ("auto-scroll to bottom") can never reach
|
|
2077
|
-
// `pinFeedIfNearBottom` through search alone. Resolve the query's words
|
|
2078
|
-
// against name_segment_vocab (same precision rules as the prompt hook:
|
|
2079
|
-
// co-occurrence, else rare singles, verified against live nodes) and hand
|
|
2080
|
-
// the names down as dampened exact-name seeds. Callers that pass their
|
|
2081
|
-
// own seedNames keep them; failures degrade to no supplement.
|
|
2082
1707
|
let seedNames = options?.seedNames;
|
|
2083
1708
|
if (seedNames === undefined) {
|
|
2084
1709
|
try {
|
|
@@ -2091,56 +1716,23 @@ class CodeGraph {
|
|
|
2091
1716
|
}
|
|
2092
1717
|
return this.contextBuilder.findRelevantContext(query, { ...options, seedNames });
|
|
2093
1718
|
}
|
|
2094
|
-
/**
|
|
2095
|
-
* Build context for a task
|
|
2096
|
-
*
|
|
2097
|
-
* Creates comprehensive context by:
|
|
2098
|
-
* 1. Running FTS search to find entry points
|
|
2099
|
-
* 2. Expanding the graph around entry points
|
|
2100
|
-
* 3. Extracting code blocks for key nodes
|
|
2101
|
-
* 4. Formatting output for Claude
|
|
2102
|
-
*
|
|
2103
|
-
* @param input - Task description (string or {title, description})
|
|
2104
|
-
* @param options - Build options (maxNodes, includeCode, format, etc.)
|
|
2105
|
-
* @returns TaskContext object or formatted string (markdown/JSON)
|
|
2106
|
-
*/
|
|
2107
1719
|
async buildContext(input, options) {
|
|
2108
1720
|
return this.contextBuilder.buildContext(input, options);
|
|
2109
1721
|
}
|
|
2110
|
-
// ===========================================================================
|
|
2111
|
-
// Database Management
|
|
2112
|
-
// ===========================================================================
|
|
2113
|
-
/**
|
|
2114
|
-
* Optimize the database (vacuum and analyze)
|
|
2115
|
-
*/
|
|
2116
1722
|
optimize() {
|
|
2117
1723
|
this.db.optimize();
|
|
2118
1724
|
}
|
|
2119
|
-
/**
|
|
2120
|
-
* Clear all data from the graph
|
|
2121
|
-
*/
|
|
2122
1725
|
clear() {
|
|
2123
1726
|
this.queries.clear();
|
|
2124
1727
|
}
|
|
2125
|
-
/**
|
|
2126
|
-
* Alias for close() for backwards compatibility.
|
|
2127
|
-
* @deprecated Use close() instead
|
|
2128
|
-
*/
|
|
2129
1728
|
destroy() {
|
|
2130
1729
|
this.close();
|
|
2131
1730
|
}
|
|
2132
|
-
/**
|
|
2133
|
-
* Completely remove CodeGraph from the project.
|
|
2134
|
-
* This closes the database and deletes the .CodeGraph directory.
|
|
2135
|
-
*
|
|
2136
|
-
* WARNING: This permanently deletes all CodeGraph data for the project.
|
|
2137
|
-
*/
|
|
2138
1731
|
uninitialize() {
|
|
2139
1732
|
this.close();
|
|
2140
1733
|
(0, directory_1.removeDirectory)(this.projectRoot);
|
|
2141
1734
|
}
|
|
2142
1735
|
}
|
|
2143
1736
|
exports.CodeGraph = CodeGraph;
|
|
2144
|
-
// Default export
|
|
2145
1737
|
exports.default = CodeGraph;
|
|
2146
1738
|
//# sourceMappingURL=index.js.map
|