@colbymchenry/codegraph-win32-arm64 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codegraph +5 -0
- package/lib/dist/.test-build-engine.json +1 -0
- package/lib/dist/.test-build-viewer.json +1 -0
- package/lib/dist/bin/codegraph.d.ts +1 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +605 -291
- 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 +39 -27
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/bin/viewer-gate.d.ts +17 -0
- package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
- package/lib/dist/bin/viewer-gate.js +31 -0
- package/lib/dist/bin/viewer-gate.js.map +1 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +43 -2
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +21 -2
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +86 -31
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +40 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +454 -10
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1080 -41
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +11 -1
- package/lib/dist/db/sqlite-adapter.d.ts +2 -0
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +56 -7
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/synthesis-stage.d.ts +12 -0
- package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
- package/lib/dist/db/synthesis-stage.js +89 -0
- package/lib/dist/db/synthesis-stage.js.map +1 -0
- package/lib/dist/db/wal-valve.d.ts +32 -12
- package/lib/dist/db/wal-valve.d.ts.map +1 -1
- package/lib/dist/db/wal-valve.js +65 -22
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/db/wsl-shared-index.d.ts +53 -0
- package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
- package/lib/dist/db/wsl-shared-index.js +121 -0
- package/lib/dist/db/wsl-shared-index.js.map +1 -0
- package/lib/dist/directory.d.ts +131 -2
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +299 -23
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/errors.d.ts +14 -0
- package/lib/dist/errors.d.ts.map +1 -1
- package/lib/dist/errors.js +16 -1
- 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 +7 -35
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +77 -10
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +302 -71
- 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 +68 -0
- package/lib/dist/extraction/commonjs-requires.js.map +1 -0
- package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/dfm-extractor.js +14 -10
- 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 -1
- package/lib/dist/extraction/function-ref.d.ts +6 -4
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +35 -14
- 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 +42 -2
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +40 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +171 -1
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +132 -19
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +825 -195
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/index.js +6 -0
- package/lib/dist/extraction/kernel/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +73 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +412 -16
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +14 -5
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +16 -3
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/javascript.js +1 -1
- package/lib/dist/extraction/languages/javascript.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts +4 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +237 -36
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
- package/lib/dist/extraction/languages/lua.js +4 -1
- package/lib/dist/extraction/languages/lua.js.map +1 -1
- package/lib/dist/extraction/languages/python.d.ts.map +1 -1
- package/lib/dist/extraction/languages/python.js +71 -0
- package/lib/dist/extraction/languages/python.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +3 -0
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
- package/lib/dist/extraction/languages/scala.js +18 -3
- package/lib/dist/extraction/languages/scala.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 +50 -0
- package/lib/dist/extraction/languages/swift.js.map +1 -1
- package/lib/dist/extraction/languages/typescript.d.ts +7 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +30 -2
- package/lib/dist/extraction/languages/typescript.js.map +1 -1
- package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/liquid-extractor.js +98 -22
- package/lib/dist/extraction/liquid-extractor.js.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +6 -4
- 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 +24 -0
- package/lib/dist/extraction/parse-budget.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +12 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +51 -3
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +3 -1
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/sfc-script.d.ts +43 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -0
- package/lib/dist/extraction/sfc-script.js +135 -0
- package/lib/dist/extraction/sfc-script.js.map +1 -0
- package/lib/dist/extraction/store-worker.js +5 -0
- 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 +12 -4
- 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 +7 -37
- package/lib/dist/extraction/svelte-extractor.js.map +1 -1
- package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
- package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
- package/lib/dist/extraction/syntax-tokens.js +382 -0
- package/lib/dist/extraction/syntax-tokens.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +29 -3
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +104 -17
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +943 -88
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +7 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +73 -35
- 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 +196 -0
- package/lib/dist/extraction/vue-options-api.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-scala.wasm +0 -0
- package/lib/dist/file-limits.d.ts +40 -0
- package/lib/dist/file-limits.d.ts.map +1 -0
- package/lib/dist/file-limits.js +147 -0
- package/lib/dist/file-limits.js.map +1 -0
- package/lib/dist/graph/branch-guards.d.ts +265 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -0
- package/lib/dist/graph/branch-guards.js +2326 -0
- package/lib/dist/graph/branch-guards.js.map +1 -0
- package/lib/dist/graph/dead-code.d.ts +251 -0
- package/lib/dist/graph/dead-code.d.ts.map +1 -0
- package/lib/dist/graph/dead-code.js +776 -0
- package/lib/dist/graph/dead-code.js.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.js +283 -0
- package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
- package/lib/dist/graph/index.d.ts +4 -0
- package/lib/dist/graph/index.d.ts.map +1 -1
- package/lib/dist/graph/index.js +16 -1
- package/lib/dist/graph/index.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
- package/lib/dist/graph/named-symbol-flow.js +559 -0
- package/lib/dist/graph/named-symbol-flow.js.map +1 -0
- package/lib/dist/graph/symbol-lookup.d.ts +83 -0
- package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
- package/lib/dist/graph/symbol-lookup.js +181 -0
- package/lib/dist/graph/symbol-lookup.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +9 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +61 -35
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/graph/type-hierarchy.d.ts +155 -0
- package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
- package/lib/dist/graph/type-hierarchy.js +382 -0
- package/lib/dist/graph/type-hierarchy.js.map +1 -0
- package/lib/dist/index.d.ts +256 -11
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +402 -34
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +3 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
- package/lib/dist/installer/targets/antigravity.js +14 -2
- package/lib/dist/installer/targets/antigravity.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts +3 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +35 -7
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +2 -1
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +14 -4
- 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 +7 -1
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
- package/lib/dist/installer/targets/opencode.d.ts +16 -5
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +73 -22
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +14 -3
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +39 -11
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +7 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/answer-freshness.d.ts +10 -0
- package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/answer-freshness.js +68 -0
- package/lib/dist/mcp/answer-freshness.js.map +1 -0
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +16 -0
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +2 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +20 -5
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +11 -4
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +132 -36
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +17 -7
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +116 -24
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +46 -42
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +30 -9
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +158 -66
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +5 -2
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -1
- package/lib/dist/mcp/explore-dedup.js +8 -5
- package/lib/dist/mcp/explore-dedup.js.map +1 -1
- package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
- package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.js +36 -0
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
- package/lib/dist/mcp/index-freshness.d.ts +13 -0
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness.js +117 -0
- package/lib/dist/mcp/index-freshness.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +3 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +95 -11
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +11 -2
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
- package/lib/dist/mcp/project-lifecycle.js +182 -0
- package/lib/dist/mcp/project-lifecycle.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +9 -2
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +201 -32
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +18 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +67 -11
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/query-worker.js +2 -2
- package/lib/dist/mcp/query-worker.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +6 -3
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +3 -1
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
- package/lib/dist/mcp/startup-handshake.js +10 -2
- package/lib/dist/mcp/startup-handshake.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +306 -36
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +2395 -966
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/writer-lock.d.ts +61 -0
- package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
- package/lib/dist/mcp/writer-lock.js +260 -0
- package/lib/dist/mcp/writer-lock.js.map +1 -0
- package/lib/dist/resolution/alias-binding.d.ts +56 -0
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
- package/lib/dist/resolution/alias-binding.js +143 -0
- package/lib/dist/resolution/alias-binding.js.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts +49 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.js +359 -0
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +460 -144
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
- package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-constructor.js +123 -0
- package/lib/dist/resolution/cpp-constructor.js.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.js +392 -0
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
- package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
- 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 +1126 -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 +32 -6
- package/lib/dist/resolution/frameworks/astro.js.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +186 -24
- package/lib/dist/resolution/frameworks/csharp.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 +95 -1
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +195 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-router.js +847 -0
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +339 -45
- 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 +13 -11
- 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 +11 -28
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +8 -2
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +39 -1
- 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 +88 -68
- 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 +369 -26
- 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 +45 -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 +288 -55
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/nextjs.js +329 -0
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.js +139 -0
- package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.js +78 -0
- package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
- 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 +45 -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 +3 -1
- 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 +279 -26
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.js +153 -14
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +47 -0
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-router.js +201 -0
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +13 -2
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +542 -144
- 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 +177 -17
- 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 +24 -22
- 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 +14 -6
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +253 -124
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts +98 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.js +500 -0
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
- 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 +45 -11
- package/lib/dist/resolution/frameworks/vue.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +66 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +643 -61
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +124 -25
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +769 -152
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +13 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
- package/lib/dist/resolution/js-builtins.js +48 -0
- package/lib/dist/resolution/js-builtins.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +101 -22
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +8267 -287
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
- package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/next-router-synthesizer.js +113 -0
- package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts +35 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.js +197 -0
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/resolver-pool.d.ts +22 -1
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +35 -5
- package/lib/dist/resolution/resolver-pool.js.map +1 -1
- package/lib/dist/resolution/resolver-worker.js +3 -0
- package/lib/dist/resolution/resolver-worker.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +6 -0
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +58 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
- 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 +454 -0
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -0
- package/lib/dist/resolution/synth-utils.d.ts +26 -0
- package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
- package/lib/dist/resolution/synth-utils.js +75 -0
- package/lib/dist/resolution/synth-utils.js.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts +54 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.js +1294 -0
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
- package/lib/dist/resolution/type-parameters.d.ts +11 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/type-parameters.js +287 -0
- package/lib/dist/resolution/type-parameters.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +105 -2
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js +64 -0
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
- package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
- package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
- package/lib/dist/search/query-paths.d.ts +50 -1
- package/lib/dist/search/query-paths.d.ts.map +1 -1
- package/lib/dist/search/query-paths.js +227 -12
- package/lib/dist/search/query-paths.js.map +1 -1
- package/lib/dist/search/query-utils.d.ts +15 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +35 -7
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watch-policy.d.ts +14 -0
- package/lib/dist/sync/watch-policy.d.ts.map +1 -1
- package/lib/dist/sync/watch-policy.js +19 -0
- package/lib/dist/sync/watch-policy.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +52 -35
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +236 -100
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +22 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +54 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts +4 -2
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +159 -66
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +1 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +1 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
- package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/deadcode.js +136 -0
- package/lib/dist/ui-server/api/deadcode.js.map +1 -0
- package/lib/dist/ui-server/api/effects.d.ts +94 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
- package/lib/dist/ui-server/api/effects.js +527 -0
- package/lib/dist/ui-server/api/effects.js.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts +92 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.js +364 -0
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
- package/lib/dist/ui-server/api/events.d.ts +183 -0
- package/lib/dist/ui-server/api/events.d.ts.map +1 -0
- package/lib/dist/ui-server/api/events.js +430 -0
- package/lib/dist/ui-server/api/events.js.map +1 -0
- package/lib/dist/ui-server/api/file.d.ts +66 -0
- package/lib/dist/ui-server/api/file.d.ts.map +1 -0
- package/lib/dist/ui-server/api/file.js +235 -0
- package/lib/dist/ui-server/api/file.js.map +1 -0
- package/lib/dist/ui-server/api/filecode.d.ts +126 -0
- package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/filecode.js +205 -0
- package/lib/dist/ui-server/api/filecode.js.map +1 -0
- package/lib/dist/ui-server/api/flow.d.ts +226 -0
- package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
- package/lib/dist/ui-server/api/flow.js +612 -0
- package/lib/dist/ui-server/api/flow.js.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.js +92 -0
- package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
- package/lib/dist/ui-server/api/index.d.ts +90 -0
- package/lib/dist/ui-server/api/index.d.ts.map +1 -0
- package/lib/dist/ui-server/api/index.js +332 -0
- package/lib/dist/ui-server/api/index.js.map +1 -0
- package/lib/dist/ui-server/api/map.d.ts +273 -0
- package/lib/dist/ui-server/api/map.d.ts.map +1 -0
- package/lib/dist/ui-server/api/map.js +781 -0
- package/lib/dist/ui-server/api/map.js.map +1 -0
- package/lib/dist/ui-server/api/node.d.ts +81 -0
- package/lib/dist/ui-server/api/node.d.ts.map +1 -0
- package/lib/dist/ui-server/api/node.js +394 -0
- package/lib/dist/ui-server/api/node.js.map +1 -0
- package/lib/dist/ui-server/api/nodes.d.ts +25 -0
- package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/nodes.js +45 -0
- package/lib/dist/ui-server/api/nodes.js.map +1 -0
- package/lib/dist/ui-server/api/program.d.ts +139 -0
- package/lib/dist/ui-server/api/program.d.ts.map +1 -0
- package/lib/dist/ui-server/api/program.js +315 -0
- package/lib/dist/ui-server/api/program.js.map +1 -0
- package/lib/dist/ui-server/api/respond.d.ts +76 -0
- package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
- package/lib/dist/ui-server/api/respond.js +186 -0
- package/lib/dist/ui-server/api/respond.js.map +1 -0
- package/lib/dist/ui-server/api/route-roots.d.ts +45 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/lib/dist/ui-server/api/route-roots.js +117 -0
- package/lib/dist/ui-server/api/route-roots.js.map +1 -0
- package/lib/dist/ui-server/api/routes.d.ts +61 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/routes.js +164 -0
- package/lib/dist/ui-server/api/routes.js.map +1 -0
- package/lib/dist/ui-server/api/screens.d.ts +117 -0
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
- package/lib/dist/ui-server/api/screens.js +626 -0
- package/lib/dist/ui-server/api/screens.js.map +1 -0
- package/lib/dist/ui-server/api/search.d.ts +29 -0
- package/lib/dist/ui-server/api/search.d.ts.map +1 -0
- package/lib/dist/ui-server/api/search.js +232 -0
- package/lib/dist/ui-server/api/search.js.map +1 -0
- package/lib/dist/ui-server/api/session.d.ts +52 -0
- package/lib/dist/ui-server/api/session.d.ts.map +1 -0
- package/lib/dist/ui-server/api/session.js +196 -0
- package/lib/dist/ui-server/api/session.js.map +1 -0
- package/lib/dist/ui-server/api/source.d.ts +200 -0
- package/lib/dist/ui-server/api/source.d.ts.map +1 -0
- package/lib/dist/ui-server/api/source.js +422 -0
- package/lib/dist/ui-server/api/source.js.map +1 -0
- package/lib/dist/ui-server/api/stats.d.ts +27 -0
- package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
- package/lib/dist/ui-server/api/stats.js +164 -0
- package/lib/dist/ui-server/api/stats.js.map +1 -0
- package/lib/dist/ui-server/api/steps.d.ts +274 -0
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
- package/lib/dist/ui-server/api/steps.js +1554 -0
- package/lib/dist/ui-server/api/steps.js.map +1 -0
- package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
- package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trail-store.js +323 -0
- package/lib/dist/ui-server/api/trail-store.js.map +1 -0
- package/lib/dist/ui-server/api/trails.d.ts +163 -0
- package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trails.js +370 -0
- package/lib/dist/ui-server/api/trails.js.map +1 -0
- package/lib/dist/ui-server/api/when.d.ts +133 -0
- package/lib/dist/ui-server/api/when.d.ts.map +1 -0
- package/lib/dist/ui-server/api/when.js +275 -0
- package/lib/dist/ui-server/api/when.js.map +1 -0
- package/lib/dist/ui-server/api/wire.d.ts +179 -0
- package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
- package/lib/dist/ui-server/api/wire.js +231 -0
- package/lib/dist/ui-server/api/wire.js.map +1 -0
- package/lib/dist/ui-server/assets.d.ts +40 -0
- package/lib/dist/ui-server/assets.d.ts.map +1 -0
- package/lib/dist/ui-server/assets.js +110 -0
- package/lib/dist/ui-server/assets.js.map +1 -0
- package/lib/dist/ui-server/constants.d.ts +32 -0
- package/lib/dist/ui-server/constants.d.ts.map +1 -0
- package/lib/dist/ui-server/constants.js +35 -0
- package/lib/dist/ui-server/constants.js.map +1 -0
- 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 +139 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -0
- package/lib/dist/ui-server/highlight/index.d.ts +113 -0
- package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/index.js +312 -0
- package/lib/dist/ui-server/highlight/index.js.map +1 -0
- package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
- package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/languages.js +50 -0
- package/lib/dist/ui-server/highlight/languages.js.map +1 -0
- 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 +20 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -0
- package/lib/dist/ui-server/index.d.ts +92 -0
- package/lib/dist/ui-server/index.d.ts.map +1 -0
- package/lib/dist/ui-server/index.js +399 -0
- package/lib/dist/ui-server/index.js.map +1 -0
- package/lib/dist/ui-server/open-browser.d.ts +31 -0
- package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
- package/lib/dist/ui-server/open-browser.js +79 -0
- package/lib/dist/ui-server/open-browser.js.map +1 -0
- package/lib/dist/ui-server/security.d.ts +127 -0
- package/lib/dist/ui-server/security.d.ts.map +1 -0
- package/lib/dist/ui-server/security.js +332 -0
- package/lib/dist/ui-server/security.js.map +1 -0
- package/lib/dist/ui-server/static.d.ts +45 -0
- package/lib/dist/ui-server/static.d.ts.map +1 -0
- package/lib/dist/ui-server/static.js +165 -0
- package/lib/dist/ui-server/static.js.map +1 -0
- package/lib/dist/upgrade/index.d.ts +43 -5
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +157 -35
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/utils.d.ts +14 -2
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +25 -10
- package/lib/dist/utils.js.map +1 -1
- package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- package/lib/dist/viewer/assets/index-BSGpxBr9.js +99 -0
- package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
- package/lib/dist/viewer/index.html +16 -0
- 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 +100 -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/picomatch/README.md +56 -51
- package/lib/node_modules/picomatch/lib/constants.js +4 -0
- package/lib/node_modules/picomatch/lib/parse.js +341 -1
- package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
- package/lib/node_modules/picomatch/lib/scan.js +30 -18
- package/lib/node_modules/picomatch/package.json +4 -4
- package/lib/package.json +9 -2
- package/package.json +1 -1
|
@@ -41,13 +41,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.isSourceFile = exports.detectLanguage = exports.extractFromSource = exports.ExtractionOrchestrator = exports.ScopeIgnore = void 0;
|
|
44
|
+
exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.isSourceFile = exports.detectLanguage = exports.extractFromSource = exports.ExtractionOrchestrator = exports.INDEXED_AT_COMMIT_KEY = exports.ScopeIgnore = exports.oversizeStamp = void 0;
|
|
45
45
|
exports.hashContent = hashContent;
|
|
46
46
|
exports.buildDefaultIgnore = buildDefaultIgnore;
|
|
47
|
+
exports.preloadLanguagesForFiles = preloadLanguagesForFiles;
|
|
47
48
|
exports.buildScopeIgnore = buildScopeIgnore;
|
|
48
49
|
exports.discoverEmbeddedRepoRoots = discoverEmbeddedRepoRoots;
|
|
49
50
|
exports.findUnindexedIgnoredRepos = findUnindexedIgnoredRepos;
|
|
50
51
|
exports.getGitChangedFiles = getGitChangedFiles;
|
|
52
|
+
exports.getGitHeadSha = getGitHeadSha;
|
|
53
|
+
exports.canTrustGitFastPath = canTrustGitFastPath;
|
|
51
54
|
exports.scanDirectory = scanDirectory;
|
|
52
55
|
exports.scanDirectoryAsync = scanDirectoryAsync;
|
|
53
56
|
const fs = __importStar(require("fs"));
|
|
@@ -68,7 +71,10 @@ const errors_1 = require("../errors");
|
|
|
68
71
|
const utils_1 = require("../utils");
|
|
69
72
|
const ignore_1 = __importDefault(require("ignore"));
|
|
70
73
|
const frameworks_1 = require("../resolution/frameworks");
|
|
74
|
+
const package_deps_1 = require("../resolution/frameworks/package-deps");
|
|
71
75
|
const cooperative_yield_1 = require("../resolution/cooperative-yield");
|
|
76
|
+
const file_limits_1 = require("../file-limits");
|
|
77
|
+
Object.defineProperty(exports, "oversizeStamp", { enumerable: true, get: function () { return file_limits_1.oversizeStamp; } });
|
|
72
78
|
/**
|
|
73
79
|
* Number of files to read in parallel during indexing.
|
|
74
80
|
* File reads are I/O-bound; batching overlaps I/O wait with CPU parse work.
|
|
@@ -108,11 +114,26 @@ function hashContent(content) {
|
|
|
108
114
|
return crypto.createHash('sha256').update(content).digest('hex');
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
117
|
+
* What change detection hashes for a file: its text when it is under the size
|
|
118
|
+
* limit, the size stamp when it is over — an oversize file is never decoded.
|
|
119
|
+
* `null` when the bytes show a `.ts` file is an MPEG transport stream, not
|
|
120
|
+
* TypeScript (#1910): decided from the bytes already read, so it costs no I/O
|
|
121
|
+
* and runs only for a file that is new or changed — never once per `.ts` file
|
|
122
|
+
* at discovery, which on a slow disk is a random read per file per scan.
|
|
114
123
|
*/
|
|
115
|
-
|
|
124
|
+
function readSourceOrStamp(fullPath) {
|
|
125
|
+
const { stats, bytes } = (0, file_limits_1.readBoundedSourceSync)(fullPath);
|
|
126
|
+
if (bytes === null)
|
|
127
|
+
return (0, file_limits_1.oversizeStamp)(stats.size);
|
|
128
|
+
return isMpegTsBytes(fullPath, bytes) ? null : bytes.toString('utf8');
|
|
129
|
+
}
|
|
130
|
+
/** Whether these bytes, read from `filePath`, are a `.ts` MPEG transport stream (#1910). */
|
|
131
|
+
function isMpegTsBytes(filePath, bytes) {
|
|
132
|
+
if (!(0, grammars_1.hasMpegTsExtension)(filePath) || !(0, grammars_1.isMpegTransportStream)(bytes.subarray(0, grammars_1.MPEG_TS_SNIFF_BYTES)))
|
|
133
|
+
return false;
|
|
134
|
+
(0, errors_1.logDebug)('Skipping MPEG transport stream named .ts — not TypeScript', { filePath });
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
116
137
|
/**
|
|
117
138
|
* Directory names that are dependency, build, cache, or tooling output across the
|
|
118
139
|
* languages/frameworks CodeGraph supports — curated from the canonical
|
|
@@ -192,6 +213,13 @@ const DEFAULT_IGNORE_PATTERNS = [
|
|
|
192
213
|
'bazel-*/', // Bazel output symlink trees
|
|
193
214
|
// Android resource dirs at any depth, with their qualifier variants (#1047).
|
|
194
215
|
...ANDROID_RES_TYPES.map((t) => `**/res/${t}*/`),
|
|
216
|
+
// `build` is also a legal JVM package segment. Keep it under conventional
|
|
217
|
+
// source roots (any source set: main, test, androidTest, ...) while continuing
|
|
218
|
+
// to exclude module/build output (#1642). Unignore only the directory, not its
|
|
219
|
+
// subtree: other defaults still apply.
|
|
220
|
+
'!**/src/*/java/**/build/',
|
|
221
|
+
'!**/src/*/kotlin/**/build/',
|
|
222
|
+
'!**/src/*/scala/**/build/',
|
|
195
223
|
];
|
|
196
224
|
/** True if `buf` decodes as strict UTF-8 (no invalid byte sequences). */
|
|
197
225
|
function isValidUtf8(buf) {
|
|
@@ -261,18 +289,120 @@ function readGitignorePatterns(giPath) {
|
|
|
261
289
|
}
|
|
262
290
|
return kept.join('\n');
|
|
263
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Resolve the repository GIT_DIR for `repoRoot` (a `.git` directory, or the
|
|
294
|
+
* target of a `.git` file pointer). Null when this isn't a git checkout.
|
|
295
|
+
*/
|
|
296
|
+
function resolveGitDir(repoRoot) {
|
|
297
|
+
const gitPath = path.join(repoRoot, '.git');
|
|
298
|
+
let st;
|
|
299
|
+
try {
|
|
300
|
+
st = fs.statSync(gitPath);
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
if (st.isDirectory())
|
|
306
|
+
return gitPath;
|
|
307
|
+
if (!st.isFile())
|
|
308
|
+
return null;
|
|
309
|
+
try {
|
|
310
|
+
const raw = fs.readFileSync(gitPath, 'utf8').match(/^gitdir:\s*(.+)$/m)?.[1]?.trim();
|
|
311
|
+
if (!raw)
|
|
312
|
+
return null;
|
|
313
|
+
return path.isAbsolute(raw) ? path.normalize(raw) : path.resolve(repoRoot, raw);
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/** Expand a leading `~/` the way git does for `core.excludesFile`. */
|
|
320
|
+
function expandUserPath(p) {
|
|
321
|
+
if (p === '~')
|
|
322
|
+
return os.homedir();
|
|
323
|
+
if (p.startsWith('~/'))
|
|
324
|
+
return path.join(os.homedir(), p.slice(2));
|
|
325
|
+
return p;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Root-relative exclude patterns from git sources that are NOT the root
|
|
329
|
+
* `.gitignore`: `.git/info/exclude` and `core.excludesFile`. Same semantics as
|
|
330
|
+
* the root `.gitignore`, so they merge into {@link buildDefaultIgnore}. Without
|
|
331
|
+
* these, the watcher / FS-walk scope silently diverged from
|
|
332
|
+
* `git ls-files --exclude-standard` (#1728).
|
|
333
|
+
*/
|
|
334
|
+
function readGitExcludeExtraPatterns(rootDir) {
|
|
335
|
+
const chunks = [];
|
|
336
|
+
const gitDir = resolveGitDir(rootDir);
|
|
337
|
+
if (gitDir) {
|
|
338
|
+
const excludePath = path.join(gitDir, 'info', 'exclude');
|
|
339
|
+
if (fs.existsSync(excludePath)) {
|
|
340
|
+
const patterns = readGitignorePatterns(excludePath);
|
|
341
|
+
if (patterns)
|
|
342
|
+
chunks.push(patterns);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
try {
|
|
346
|
+
const configured = (0, child_process_1.execFileSync)('git', ['-C', rootDir, 'config', '--get', 'core.excludesFile'], { encoding: 'utf8', timeout: 5_000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true }).trim();
|
|
347
|
+
if (configured) {
|
|
348
|
+
const abs = expandUserPath(configured);
|
|
349
|
+
if (fs.existsSync(abs)) {
|
|
350
|
+
const patterns = readGitignorePatterns(abs);
|
|
351
|
+
if (patterns)
|
|
352
|
+
chunks.push(patterns);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
// No git, unset, or timeout — leave extras empty.
|
|
358
|
+
}
|
|
359
|
+
return chunks.join('\n');
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Directories `git ls-files -o -i --exclude-standard --directory` reports as
|
|
363
|
+
* ignored-untracked. Seeded into {@link ScopeIgnore} so nested `.gitignore`
|
|
364
|
+
* effects (and any exclude-standard rule the flat matcher might miss) prune the
|
|
365
|
+
* watcher the same way the indexer skips them (#1728).
|
|
366
|
+
*/
|
|
367
|
+
function listGitIgnoredDirectories(rootDir) {
|
|
368
|
+
try {
|
|
369
|
+
const out = (0, child_process_1.execFileSync)('git', ['-C', rootDir, 'ls-files', '-z', '-o', '-i', '--exclude-standard', '--directory'], {
|
|
370
|
+
encoding: 'utf8',
|
|
371
|
+
timeout: 60_000,
|
|
372
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
373
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
374
|
+
windowsHide: true,
|
|
375
|
+
});
|
|
376
|
+
const dirs = [];
|
|
377
|
+
for (const entry of out.split('\0')) {
|
|
378
|
+
if (!entry)
|
|
379
|
+
continue;
|
|
380
|
+
dirs.push(entry.endsWith('/') ? entry : `${entry}/`);
|
|
381
|
+
}
|
|
382
|
+
return dirs;
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
return [];
|
|
386
|
+
}
|
|
387
|
+
}
|
|
264
388
|
/**
|
|
265
389
|
* An `ignore` matcher seeded with the built-in defaults, merged with the project's
|
|
266
|
-
* root .gitignore so a negation there (e.g. `!vendor/`) overrides a default
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
390
|
+
* root .gitignore so a negation there (e.g. `!vendor/`) overrides a default, plus
|
|
391
|
+
* git's other root-relative exclude files (`.git/info/exclude`, `core.excludesFile`)
|
|
392
|
+
* so watcher / FS-walk scope matches `git ls-files --exclude-standard` (#1728).
|
|
393
|
+
* Shared by both enumeration paths so behavior is identical with or without git —
|
|
394
|
+
* and so the defaults apply to tracked files too (committing a dependency dir
|
|
395
|
+
* doesn't make it project code; the explicit `.gitignore` negation is the only
|
|
396
|
+
* opt-in).
|
|
270
397
|
*/
|
|
271
398
|
function buildDefaultIgnore(rootDir) {
|
|
272
399
|
const ig = (0, ignore_1.default)().add(DEFAULT_IGNORE_PATTERNS);
|
|
273
400
|
const rootGitignore = path.join(rootDir, '.gitignore');
|
|
274
401
|
if (fs.existsSync(rootGitignore))
|
|
275
402
|
ig.add(readGitignorePatterns(rootGitignore));
|
|
403
|
+
const extra = readGitExcludeExtraPatterns(rootDir);
|
|
404
|
+
if (extra)
|
|
405
|
+
ig.add(extra);
|
|
276
406
|
return ig;
|
|
277
407
|
}
|
|
278
408
|
/**
|
|
@@ -591,15 +721,48 @@ function findNestedGitRepos(absDir, relPrefix) {
|
|
|
591
721
|
}
|
|
592
722
|
/**
|
|
593
723
|
* Workspace-scope ignore matcher. Ordinary paths get the root's matcher
|
|
594
|
-
* (built-in defaults + root `.gitignore`
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
*
|
|
724
|
+
* (built-in defaults + root `.gitignore` + `.git/info/exclude` +
|
|
725
|
+
* `core.excludesFile`, plus directories `git ls-files --exclude-standard`
|
|
726
|
+
* reports as ignored); paths inside an EMBEDDED repo get that repo's own
|
|
727
|
+
* matcher — the parent's `.gitignore` hides a child repo from git, not from
|
|
728
|
+
* the index (#514). A directory path (trailing slash) that is an ANCESTOR of
|
|
729
|
+
* an embedded root is never ignored, so directory-pruning callers (the Linux
|
|
730
|
+
* per-directory watcher) still descend to reach the embedded repos.
|
|
600
731
|
*
|
|
601
|
-
*
|
|
732
|
+
* Shared by the indexer (scoped sync / skip checks) and the watcher so their
|
|
733
|
+
* scope cannot diverge from each other or from `git ls-files --exclude-standard`
|
|
734
|
+
* (#1728).
|
|
602
735
|
*/
|
|
736
|
+
/**
|
|
737
|
+
* The grammars to preload for a file set.
|
|
738
|
+
*
|
|
739
|
+
* Path-only detection calls every `.h` file C, but parse-time detection reads
|
|
740
|
+
* the source and can reclassify it as C++ or Objective-C (`detectLanguage`
|
|
741
|
+
* with a `source` argument). Workers only ever get the grammars named here, so
|
|
742
|
+
* a header that turns out to be Objective-C in a project with no `.m` file
|
|
743
|
+
* found no parser and failed with `Failed to get parser for language: objc`
|
|
744
|
+
* (#1628). C++ was already covered; Objective-C was not.
|
|
745
|
+
*/
|
|
746
|
+
function preloadLanguagesForFiles(files, overrides) {
|
|
747
|
+
const languages = [...new Set(files.map((f) => (0, grammars_1.detectLanguage)(f, undefined, overrides)))];
|
|
748
|
+
// A Flow-typed `.js` is read with the TSX grammar (see detectLanguage).
|
|
749
|
+
if ((languages.includes('javascript') || languages.includes('jsx')) && !languages.includes('tsx'))
|
|
750
|
+
languages.push('tsx');
|
|
751
|
+
if (languages.includes('c')) {
|
|
752
|
+
for (const ambiguous of ['cpp', 'objc']) {
|
|
753
|
+
if (!languages.includes(ambiguous))
|
|
754
|
+
languages.push(ambiguous);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
// An `.inc` path-detects as PHP but may read as Pascal (#2279) — unless
|
|
758
|
+
// codegraph.json maps `.inc` explicitly, which detectLanguage never overrides.
|
|
759
|
+
if (!languages.includes('pascal') &&
|
|
760
|
+
!(overrides && overrides['.inc']) &&
|
|
761
|
+
files.some((f) => f.toLowerCase().endsWith('.inc'))) {
|
|
762
|
+
languages.push('pascal');
|
|
763
|
+
}
|
|
764
|
+
return languages;
|
|
765
|
+
}
|
|
603
766
|
class ScopeIgnore {
|
|
604
767
|
rootMatcher;
|
|
605
768
|
exclude;
|
|
@@ -678,7 +841,14 @@ exports.ScopeIgnore = ScopeIgnore;
|
|
|
678
841
|
function buildScopeIgnore(rootDir, embeddedRoots) {
|
|
679
842
|
const roots = embeddedRoots ? [...embeddedRoots] : discoverEmbeddedRepoRoots(rootDir);
|
|
680
843
|
const include = loadIncludeMatcher(rootDir);
|
|
681
|
-
|
|
844
|
+
// Root matcher already has defaults + root `.gitignore` + info/exclude +
|
|
845
|
+
// core.excludesFile. Seed ignored-untracked directories from git so nested
|
|
846
|
+
// `.gitignore` effects prune the watcher identically to the indexer (#1728).
|
|
847
|
+
const rootMatcher = buildDefaultIgnore(rootDir);
|
|
848
|
+
for (const dir of listGitIgnoredDirectories(rootDir)) {
|
|
849
|
+
rootMatcher.add(dir);
|
|
850
|
+
}
|
|
851
|
+
return new ScopeIgnore(rootMatcher, roots.map((root) => ({ root, matcher: buildDefaultIgnore(path.join(rootDir, root)) })), loadExcludeMatcher(rootDir), include, include ? includeStaticRoots((0, project_config_1.loadIncludePatterns)(rootDir)) : []);
|
|
682
852
|
}
|
|
683
853
|
/**
|
|
684
854
|
* Whether an embedded repo found as a tracked gitlink (mode 160000, #1031/#1033)
|
|
@@ -745,7 +915,7 @@ function discoverEmbeddedRepoRoots(rootDir) {
|
|
|
745
915
|
// same way collectGitFiles does, keeping watcher scope == indexer scope.
|
|
746
916
|
// (#1031, #1033)
|
|
747
917
|
try {
|
|
748
|
-
const staged = (
|
|
918
|
+
const staged = lsFilesStaged({ cwd: repoAbs, encoding: 'utf-8', timeout: 30000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
749
919
|
const repoIgnore = buildDefaultIgnore(repoAbs);
|
|
750
920
|
for (const entry of staged.split('\0')) {
|
|
751
921
|
if (!entry || entry.slice(0, 6) !== '160000')
|
|
@@ -865,6 +1035,30 @@ function findIgnoredEmbeddedRepos(repoDir, includeIgnored, prefix) {
|
|
|
865
1035
|
}
|
|
866
1036
|
return repos;
|
|
867
1037
|
}
|
|
1038
|
+
/**
|
|
1039
|
+
* `git ls-files -z -s`, expanding submodules where git allows it.
|
|
1040
|
+
*
|
|
1041
|
+
* `--recurse-submodules` could not be combined with `-s` before git 2.36:
|
|
1042
|
+
* `builtin/ls-files.c` listed `show_stage` among the modes that die, and the
|
|
1043
|
+
* check is unconditional — it does not look at whether the repo actually has
|
|
1044
|
+
* submodules, so every call fails on older git. Ubuntu 22.04 LTS (2.34.1) and
|
|
1045
|
+
* Debian 11 (2.30.2) are both below that line.
|
|
1046
|
+
*
|
|
1047
|
+
* Letting the throw escape cost far more than submodule expansion: it unwound
|
|
1048
|
+
* the whole git-visible pass, so `includeIgnored`, gitlink recursion and the
|
|
1049
|
+
* `codegraph.json` include allowlist silently stopped applying and files went
|
|
1050
|
+
* missing from the index with no error (#1549). Retry without the flag instead
|
|
1051
|
+
* — `-s` is the part that matters here, since gitlink detection reads the mode
|
|
1052
|
+
* bits, and embedded repos are reached through the gitlink recursion anyway.
|
|
1053
|
+
*/
|
|
1054
|
+
function lsFilesStaged(gitOpts) {
|
|
1055
|
+
try {
|
|
1056
|
+
return (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s', '--recurse-submodules'], gitOpts);
|
|
1057
|
+
}
|
|
1058
|
+
catch {
|
|
1059
|
+
return (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s'], gitOpts);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
868
1062
|
/**
|
|
869
1063
|
* Collect git-visible files (tracked + untracked, .gitignore-respected) from the
|
|
870
1064
|
* git repository rooted at `repoDir`, adding each to `files` with `prefix`
|
|
@@ -909,7 +1103,7 @@ function collectGitFiles(repoDir, prefix, files, embeddedRoots, includeIgnored =
|
|
|
909
1103
|
// on disk → those files are silently dropped from the index. (#541) With -s the
|
|
910
1104
|
// path follows a TAB after the `<mode> <object> <stage>` prefix.
|
|
911
1105
|
const gitlinkRels = [];
|
|
912
|
-
const tracked = (
|
|
1106
|
+
const tracked = lsFilesStaged(gitOpts);
|
|
913
1107
|
for (const entry of tracked.split('\0')) {
|
|
914
1108
|
if (!entry)
|
|
915
1109
|
continue;
|
|
@@ -1000,6 +1194,10 @@ function getGitVisibleFiles(rootDir) {
|
|
|
1000
1194
|
// git check-ignore exits 0 if the path IS ignored, 1 if not
|
|
1001
1195
|
(0, child_process_1.execFileSync)('git', ['check-ignore', '-q', path.resolve(rootDir)], { cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
1002
1196
|
// Directory is gitignored by parent repo — fall back to filesystem walk
|
|
1197
|
+
(0, errors_1.logDebug)('project root is gitignored by a parent repo — falling back to filesystem walk', {
|
|
1198
|
+
rootDir,
|
|
1199
|
+
gitRoot,
|
|
1200
|
+
});
|
|
1003
1201
|
return null;
|
|
1004
1202
|
}
|
|
1005
1203
|
catch {
|
|
@@ -1026,7 +1224,20 @@ function getGitVisibleFiles(rootDir) {
|
|
|
1026
1224
|
visible.add(f);
|
|
1027
1225
|
return visible;
|
|
1028
1226
|
}
|
|
1029
|
-
catch {
|
|
1227
|
+
catch (error) {
|
|
1228
|
+
// Any failure here (git missing, a `git rev-parse`/`ls-files` timeout or
|
|
1229
|
+
// buffer overrun under load, an unreadable repo, unsupported flag combo on
|
|
1230
|
+
// older git, etc.) silently sent every caller to `scanDirectoryWalk` with
|
|
1231
|
+
// zero signal that the fast git-delegated path was skipped — making reports
|
|
1232
|
+
// like #1567 (nested-`.gitignore`-excluded `node_modules` walked into)
|
|
1233
|
+
// hard to triage, since both ignore implementations look correct in
|
|
1234
|
+
// isolation but there was no way to tell which one ran. Log it under the
|
|
1235
|
+
// existing CODEGRAPH_DEBUG gate so a future report can confirm or rule out
|
|
1236
|
+
// the fallback in one step.
|
|
1237
|
+
(0, errors_1.logDebug)('git-based file listing unavailable — falling back to filesystem walk', {
|
|
1238
|
+
rootDir,
|
|
1239
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1240
|
+
});
|
|
1030
1241
|
return null;
|
|
1031
1242
|
}
|
|
1032
1243
|
}
|
|
@@ -1044,20 +1255,94 @@ function getGitVisibleFiles(rootDir) {
|
|
|
1044
1255
|
* case this cannot see (the child status that would report the deletions is gone
|
|
1045
1256
|
* with it); a full `codegraph index` reconciles that.
|
|
1046
1257
|
*/
|
|
1047
|
-
function getGitChangedFiles(rootDir) {
|
|
1258
|
+
function getGitChangedFiles(rootDir, sinceCommit) {
|
|
1048
1259
|
try {
|
|
1260
|
+
// `git status` only ever describes the WORKING TREE, so a change that has
|
|
1261
|
+
// been committed leaves no entry and never enters the candidate set — the
|
|
1262
|
+
// hash comparison in getChangedFiles is correct but is never reached for
|
|
1263
|
+
// it, and `pendingChanges` reads 0 while the index is genuinely behind
|
|
1264
|
+
// (#1829). `sinceCommit` — the commit the index was last brought up to
|
|
1265
|
+
// date at — adds the other half: what has been committed since. Callers
|
|
1266
|
+
// that hold no such stamp still get exactly what they always did, the
|
|
1267
|
+
// working-tree changes.
|
|
1049
1268
|
const changes = { modified: [], added: [], deleted: [] };
|
|
1050
1269
|
// Custom extension → language overrides from the project's codegraph.json,
|
|
1051
1270
|
// so change detection sees the same custom-extension files the full index does.
|
|
1052
1271
|
const overrides = (0, project_config_1.loadExtensionOverrides)(rootDir);
|
|
1053
|
-
collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir));
|
|
1272
|
+
collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir), sinceCommit ?? undefined);
|
|
1054
1273
|
return changes;
|
|
1055
1274
|
}
|
|
1056
1275
|
catch {
|
|
1057
1276
|
return null;
|
|
1058
1277
|
}
|
|
1059
1278
|
}
|
|
1060
|
-
|
|
1279
|
+
/**
|
|
1280
|
+
* Metadata key: the commit the index was last brought up to date at. Written by
|
|
1281
|
+
* a full index AND by every successful sync — unlike the extraction stamp, which
|
|
1282
|
+
* a sync must not advance because it only touches a subset of files. This one is
|
|
1283
|
+
* about the tree; failed file paths remain explicit retry candidates. (#1829)
|
|
1284
|
+
*/
|
|
1285
|
+
exports.INDEXED_AT_COMMIT_KEY = 'indexed_at_commit';
|
|
1286
|
+
/** HEAD's commit sha, or null in a non-git repo or one with no commits yet. */
|
|
1287
|
+
function getGitHeadSha(rootDir) {
|
|
1288
|
+
try {
|
|
1289
|
+
return (0, child_process_1.execFileSync)('git', ['rev-parse', 'HEAD'], {
|
|
1290
|
+
cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
1291
|
+
}).trim() || null;
|
|
1292
|
+
}
|
|
1293
|
+
catch {
|
|
1294
|
+
return null;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* NUL-delimited status/path pairs for every path committed
|
|
1299
|
+
* between `sinceCommit` and HEAD. Empty when the stamp IS HEAD, which is the
|
|
1300
|
+
* common case — one cheap git call on the hot path.
|
|
1301
|
+
*/
|
|
1302
|
+
function gitCommittedChangesSince(repoDir, sinceCommit) {
|
|
1303
|
+
// NUL framing preserves Unicode, quotes, tabs and newlines in Git paths.
|
|
1304
|
+
// Let command failures reach getGitChangedFiles: [] would falsely mean clean.
|
|
1305
|
+
const out = (0, child_process_1.execFileSync)('git', ['diff', '--relative', '--name-status', '--no-renames', '-z', sinceCommit, 'HEAD', '--', '.'], {
|
|
1306
|
+
cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
1307
|
+
});
|
|
1308
|
+
return out.split('\0');
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Can an INDEX trust the git fast path, given the commit it was built at?
|
|
1312
|
+
*
|
|
1313
|
+
* False means "fall back to the full scan" — the expensive path that compares
|
|
1314
|
+
* every file on disk against the DB, and the only correct read when git cannot
|
|
1315
|
+
* say what happened between the stamp and now:
|
|
1316
|
+
*
|
|
1317
|
+
* - stamp present but unknown to this repo (rebase, gc, shallow clone, a stamp
|
|
1318
|
+
* from a different checkout) — history moved under the index.
|
|
1319
|
+
* - stamp absent while the repo HAS commits — an index built before stamping
|
|
1320
|
+
* existed. One full scan; the next sync stamps it and the fast path returns.
|
|
1321
|
+
*
|
|
1322
|
+
* A repo with NO commits keeps the fast path with or without a stamp: every
|
|
1323
|
+
* file is untracked, so `git status` already sees all of them. Callers with no
|
|
1324
|
+
* index behind them (the exported `getGitChangedFiles`) never ask this — a
|
|
1325
|
+
* working-tree diff is the whole of what they wanted. (#1829)
|
|
1326
|
+
*/
|
|
1327
|
+
function canTrustGitFastPath(rootDir, sinceCommit) {
|
|
1328
|
+
const head = getGitHeadSha(rootDir);
|
|
1329
|
+
if (head == null)
|
|
1330
|
+
return true; // no commits (or not a git repo — caller handles that)
|
|
1331
|
+
if (!sinceCommit)
|
|
1332
|
+
return false;
|
|
1333
|
+
if (sinceCommit === head)
|
|
1334
|
+
return true;
|
|
1335
|
+
try {
|
|
1336
|
+
(0, child_process_1.execFileSync)('git', ['cat-file', '-e', `${sinceCommit}^{commit}`], {
|
|
1337
|
+
cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
1338
|
+
});
|
|
1339
|
+
return true;
|
|
1340
|
+
}
|
|
1341
|
+
catch {
|
|
1342
|
+
return false;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null, exclude = null, sinceCommit) {
|
|
1061
1346
|
const output = (0, child_process_1.execFileSync)('git',
|
|
1062
1347
|
// `-uall` lists individual untracked files instead of collapsing an
|
|
1063
1348
|
// entirely-untracked directory into one `?? dir/` entry, which would
|
|
@@ -1065,7 +1350,7 @@ function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null
|
|
|
1065
1350
|
// below). Nested untracked git repos still collapse to `?? repo/` even
|
|
1066
1351
|
// with `-uall` — git never crosses a repo boundary — so the recursion
|
|
1067
1352
|
// still handles them. (#1213)
|
|
1068
|
-
['status', '--porcelain', '--no-renames', '-uall'], { cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
1353
|
+
['status', '--porcelain', '--no-renames', '-z', '-uall'], { cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
1069
1354
|
// This repo's own ignore rules — built-in defaults (#407) plus its .gitignore.
|
|
1070
1355
|
// Change detection must exclude the SAME files the full index does, but git
|
|
1071
1356
|
// status hides neither: it ignores nothing for *tracked* paths, and the
|
|
@@ -1077,45 +1362,63 @@ function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null
|
|
|
1077
1362
|
// ScopeIgnore: every embedded repo is judged by ITS OWN rules, never the
|
|
1078
1363
|
// parent's. (#766)
|
|
1079
1364
|
const ig = buildDefaultIgnore(repoDir);
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
continue; // Minimum: "XY file"
|
|
1084
|
-
const statusCode = line.substring(0, 2);
|
|
1085
|
-
const rel = (0, utils_1.normalizePath)(line.substring(3));
|
|
1086
|
-
// Untracked directory entries (trailing slash) may hide an embedded repo —
|
|
1087
|
-
// collect for the recursion below instead of treating as a file.
|
|
1088
|
-
if (statusCode === '??' && rel.endsWith('/')) {
|
|
1089
|
-
untrackedDirs.push(rel);
|
|
1090
|
-
continue;
|
|
1091
|
-
}
|
|
1365
|
+
// One classifier for both candidate sources below, so a committed change is
|
|
1366
|
+
// filtered by exactly the rules a working-tree change is (#766, #999, #1829).
|
|
1367
|
+
const classify = (statusCode, rel) => {
|
|
1092
1368
|
const filePath = (0, utils_1.normalizePath)(prefix + rel);
|
|
1093
1369
|
if (!(0, grammars_1.isSourceFile)(filePath, overrides))
|
|
1094
|
-
|
|
1370
|
+
return;
|
|
1095
1371
|
if (statusCode.includes('D')) {
|
|
1096
1372
|
// Deletions stay unfiltered: getChangedFiles acts on one only when the
|
|
1097
1373
|
// path is already tracked in the DB, where removal is always correct — and
|
|
1098
1374
|
// that lets a newly-excluded dir's stale rows clean themselves up. (#766)
|
|
1099
1375
|
out.deleted.push(filePath);
|
|
1100
|
-
|
|
1376
|
+
return;
|
|
1101
1377
|
}
|
|
1102
1378
|
// Added (`??`) / modified files inside an excluded dir must not enter the
|
|
1103
1379
|
// index — match against the repo-relative path, same as the full scan. (#766)
|
|
1104
1380
|
if (ig.ignores(rel))
|
|
1105
|
-
|
|
1381
|
+
return;
|
|
1106
1382
|
// User `codegraph.json` `exclude` (#999) is project-root-relative, so it's
|
|
1107
1383
|
// matched against the full path — sync must not re-add a tracked file the
|
|
1108
1384
|
// full index now keeps out. Deletions above stay unfiltered so a file that
|
|
1109
1385
|
// WAS indexed before an exclude was added still cleans itself out.
|
|
1110
1386
|
if (exclude && exclude.ignores(filePath))
|
|
1111
|
-
|
|
1387
|
+
return;
|
|
1112
1388
|
if (statusCode === '??') {
|
|
1113
1389
|
out.added.push(filePath);
|
|
1114
1390
|
}
|
|
1115
1391
|
else {
|
|
1116
|
-
// M, MM, AM, A (staged), etc. — treat as modified
|
|
1392
|
+
// M, MM, AM, A (staged), etc. — treat as modified. getChangedFiles
|
|
1393
|
+
// re-decides added-vs-modified from the DB, so a committed `A` that the
|
|
1394
|
+
// index never saw still lands in `added`.
|
|
1117
1395
|
out.modified.push(filePath);
|
|
1118
1396
|
}
|
|
1397
|
+
};
|
|
1398
|
+
const untrackedDirs = [];
|
|
1399
|
+
for (const line of output.split('\0')) {
|
|
1400
|
+
if (line.length < 4)
|
|
1401
|
+
continue; // Minimum: "XY file"
|
|
1402
|
+
const statusCode = line.substring(0, 2);
|
|
1403
|
+
const rel = (0, utils_1.normalizePath)(line.substring(3));
|
|
1404
|
+
// Untracked directory entries (trailing slash) may hide an embedded repo —
|
|
1405
|
+
// collect for the recursion below instead of treating as a file.
|
|
1406
|
+
if (statusCode === '??' && rel.endsWith('/')) {
|
|
1407
|
+
untrackedDirs.push(rel);
|
|
1408
|
+
continue;
|
|
1409
|
+
}
|
|
1410
|
+
classify(statusCode, rel);
|
|
1411
|
+
}
|
|
1412
|
+
// Committed but unindexed: everything between the commit this index was last
|
|
1413
|
+
// brought up to date at and HEAD. `git status` cannot see these — committing
|
|
1414
|
+
// is precisely what removes a file from its output — so without this pass a
|
|
1415
|
+
// `git commit` makes a real pending change read as zero (#1829). The stamp
|
|
1416
|
+
// belongs to the ROOT repo, so the embedded-repo recursion below passes none.
|
|
1417
|
+
if (sinceCommit) {
|
|
1418
|
+
const fields = gitCommittedChangesSince(repoDir, sinceCommit);
|
|
1419
|
+
for (let i = 0; i + 1 < fields.length; i += 2) {
|
|
1420
|
+
classify(`${fields[i].charAt(0)} `, (0, utils_1.normalizePath)(fields[i + 1]));
|
|
1421
|
+
}
|
|
1119
1422
|
}
|
|
1120
1423
|
// Recurse embedded repos found under untracked dirs (at the dir itself or
|
|
1121
1424
|
// nested deeper). Gitignored dirs are walked only for the directories the
|
|
@@ -1157,11 +1460,16 @@ function scanDirectory(rootDir, onProgress) {
|
|
|
1157
1460
|
// Fallback: walk filesystem for non-git projects
|
|
1158
1461
|
return scanDirectoryWalk(rootDir, onProgress);
|
|
1159
1462
|
}
|
|
1160
|
-
/**
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1463
|
+
/** Record one file the scan declined to index. */
|
|
1464
|
+
function tallySkip(stats, rel) {
|
|
1465
|
+
if (!stats)
|
|
1466
|
+
return;
|
|
1467
|
+
const ext = path.extname(rel).toLowerCase();
|
|
1468
|
+
if (!ext)
|
|
1469
|
+
return;
|
|
1470
|
+
stats.unsupportedByExtension.set(ext, (stats.unsupportedByExtension.get(ext) ?? 0) + 1);
|
|
1471
|
+
}
|
|
1472
|
+
async function scanDirectoryAsync(rootDir, onProgress, stats) {
|
|
1165
1473
|
// Custom extension → language overrides from the project's codegraph.json.
|
|
1166
1474
|
const overrides = (0, project_config_1.loadExtensionOverrides)(rootDir);
|
|
1167
1475
|
const gitFiles = getGitVisibleFiles(rootDir);
|
|
@@ -1178,15 +1486,18 @@ async function scanDirectoryAsync(rootDir, onProgress) {
|
|
|
1178
1486
|
await new Promise(r => setImmediate(r));
|
|
1179
1487
|
}
|
|
1180
1488
|
}
|
|
1489
|
+
else {
|
|
1490
|
+
tallySkip(stats, filePath);
|
|
1491
|
+
}
|
|
1181
1492
|
}
|
|
1182
1493
|
return files;
|
|
1183
1494
|
}
|
|
1184
|
-
return scanDirectoryWalk(rootDir, onProgress);
|
|
1495
|
+
return scanDirectoryWalk(rootDir, onProgress, stats);
|
|
1185
1496
|
}
|
|
1186
1497
|
/**
|
|
1187
1498
|
* Filesystem walk fallback for non-git projects.
|
|
1188
1499
|
*/
|
|
1189
|
-
function scanDirectoryWalk(rootDir, onProgress) {
|
|
1500
|
+
function scanDirectoryWalk(rootDir, onProgress, stats) {
|
|
1190
1501
|
const files = [];
|
|
1191
1502
|
let count = 0;
|
|
1192
1503
|
const visitedDirs = new Set();
|
|
@@ -1258,10 +1569,15 @@ function scanDirectoryWalk(rootDir, onProgress) {
|
|
|
1258
1569
|
}
|
|
1259
1570
|
}
|
|
1260
1571
|
else if (stat.isFile()) {
|
|
1261
|
-
if (!isIgnored(fullPath, false, active)
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1572
|
+
if (!isIgnored(fullPath, false, active)) {
|
|
1573
|
+
if ((0, grammars_1.isSourceFile)(relativePath, overrides)) {
|
|
1574
|
+
files.push(relativePath);
|
|
1575
|
+
count++;
|
|
1576
|
+
onProgress?.(count, relativePath);
|
|
1577
|
+
}
|
|
1578
|
+
else {
|
|
1579
|
+
tallySkip(stats, relativePath);
|
|
1580
|
+
}
|
|
1265
1581
|
}
|
|
1266
1582
|
}
|
|
1267
1583
|
}
|
|
@@ -1276,10 +1592,15 @@ function scanDirectoryWalk(rootDir, onProgress) {
|
|
|
1276
1592
|
}
|
|
1277
1593
|
}
|
|
1278
1594
|
else if (entry.isFile()) {
|
|
1279
|
-
if (!isIgnored(fullPath, false, active)
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1595
|
+
if (!isIgnored(fullPath, false, active)) {
|
|
1596
|
+
if ((0, grammars_1.isSourceFile)(relativePath, overrides)) {
|
|
1597
|
+
files.push(relativePath);
|
|
1598
|
+
count++;
|
|
1599
|
+
onProgress?.(count, relativePath);
|
|
1600
|
+
}
|
|
1601
|
+
else {
|
|
1602
|
+
tallySkip(stats, relativePath);
|
|
1603
|
+
}
|
|
1283
1604
|
}
|
|
1284
1605
|
}
|
|
1285
1606
|
}
|
|
@@ -1339,6 +1660,67 @@ function resurrectRefFromDroppedEdge(e) {
|
|
|
1339
1660
|
language: e.sourceLanguage,
|
|
1340
1661
|
};
|
|
1341
1662
|
}
|
|
1663
|
+
/**
|
|
1664
|
+
* What tells a file's nodes apart across a re-index, coarsest first. (kind,
|
|
1665
|
+
* name) is the #899 key and settles every name a file defines once; a name it
|
|
1666
|
+
* defines more than once — the same method on two classes, a method's
|
|
1667
|
+
* overloads — is split further by qualified name, then by signature (#2276).
|
|
1668
|
+
*/
|
|
1669
|
+
const REINDEX_IDENTITY_TIERS = [
|
|
1670
|
+
(n) => `${n.kind}\0${n.name}`,
|
|
1671
|
+
(n) => n.qualifiedName,
|
|
1672
|
+
(n) => n.signature ?? '',
|
|
1673
|
+
];
|
|
1674
|
+
function groupNodeIdentities(nodes, key) {
|
|
1675
|
+
const groups = new Map();
|
|
1676
|
+
for (const n of nodes) {
|
|
1677
|
+
const k = key(n);
|
|
1678
|
+
const group = groups.get(k);
|
|
1679
|
+
if (group)
|
|
1680
|
+
group.push(n);
|
|
1681
|
+
else
|
|
1682
|
+
groups.set(k, [n]);
|
|
1683
|
+
}
|
|
1684
|
+
return groups;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Pair each node a file had before a re-index with the node that replaces it,
|
|
1688
|
+
* old id → new id. Ids embed the start line, so they can't be compared across
|
|
1689
|
+
* an edit. Each tier of {@link REINDEX_IDENTITY_TIERS} splits the groups the
|
|
1690
|
+
* one before left ambiguous, and a group down to one node on each side is a
|
|
1691
|
+
* pair. Nodes still identical after every tier (overloads in a language that
|
|
1692
|
+
* records no signature) pair by position, but only when both sides have the
|
|
1693
|
+
* same number of them. Anything else stays unpaired: the caller re-resolves
|
|
1694
|
+
* its edges from their original reference instead of handing them all to
|
|
1695
|
+
* whichever same-named node happens to come last (#2276).
|
|
1696
|
+
*/
|
|
1697
|
+
function pairReindexedNodes(prior, next) {
|
|
1698
|
+
const pairs = new Map();
|
|
1699
|
+
const byPosition = (a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn;
|
|
1700
|
+
const pairGroups = (before, after, tier) => {
|
|
1701
|
+
const key = REINDEX_IDENTITY_TIERS[tier];
|
|
1702
|
+
const afterGroups = groupNodeIdentities(after, key);
|
|
1703
|
+
for (const [k, group] of groupNodeIdentities(before, key)) {
|
|
1704
|
+
const match = afterGroups.get(k);
|
|
1705
|
+
if (!match)
|
|
1706
|
+
continue;
|
|
1707
|
+
if (group.length === 1 && match.length === 1) {
|
|
1708
|
+
pairs.set(group[0].id, match[0].id);
|
|
1709
|
+
}
|
|
1710
|
+
else if (tier + 1 < REINDEX_IDENTITY_TIERS.length) {
|
|
1711
|
+
pairGroups(group, match, tier + 1);
|
|
1712
|
+
}
|
|
1713
|
+
else if (group.length === match.length) {
|
|
1714
|
+
const a = [...group].sort(byPosition);
|
|
1715
|
+
const b = [...match].sort(byPosition);
|
|
1716
|
+
for (let i = 0; i < a.length; i++)
|
|
1717
|
+
pairs.set(a[i].id, b[i].id);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
pairGroups(prior, next, 0);
|
|
1722
|
+
return pairs;
|
|
1723
|
+
}
|
|
1342
1724
|
/**
|
|
1343
1725
|
* Extraction orchestrator
|
|
1344
1726
|
*/
|
|
@@ -1377,10 +1759,20 @@ class ExtractionOrchestrator {
|
|
|
1377
1759
|
* same lifecycle the watcher's own matcher already has.
|
|
1378
1760
|
*/
|
|
1379
1761
|
scopedSyncMatcher() {
|
|
1380
|
-
|
|
1762
|
+
// Bust when any root-level exclude source the matcher reads may have
|
|
1763
|
+
// changed. Nested `.gitignore` edits force a full watcher sync, which
|
|
1764
|
+
// clears this cache (see the full-reconcile branch in sync()).
|
|
1765
|
+
const gitDir = resolveGitDir(this.rootDir);
|
|
1766
|
+
const key = [
|
|
1767
|
+
project_config_1.PROJECT_CONFIG_FILENAME,
|
|
1768
|
+
'.gitignore',
|
|
1769
|
+
gitDir ? path.join(gitDir, 'info', 'exclude') : '',
|
|
1770
|
+
]
|
|
1381
1771
|
.map((name) => {
|
|
1772
|
+
if (!name)
|
|
1773
|
+
return '-';
|
|
1382
1774
|
try {
|
|
1383
|
-
return String(fs.statSync(path.join(this.rootDir, name)).mtimeMs);
|
|
1775
|
+
return String(fs.statSync(path.isAbsolute(name) ? name : path.join(this.rootDir, name)).mtimeMs);
|
|
1384
1776
|
}
|
|
1385
1777
|
catch {
|
|
1386
1778
|
return '-';
|
|
@@ -1426,7 +1818,9 @@ class ExtractionOrchestrator {
|
|
|
1426
1818
|
if (!full)
|
|
1427
1819
|
return null;
|
|
1428
1820
|
try {
|
|
1429
|
-
|
|
1821
|
+
// Framework detectors scan source by name; a file over the size
|
|
1822
|
+
// limit was never indexed and must not be decoded here either (#1910).
|
|
1823
|
+
return (0, file_limits_1.readBoundedSourceSync)(full).bytes?.toString('utf8') ?? null;
|
|
1430
1824
|
}
|
|
1431
1825
|
catch {
|
|
1432
1826
|
return null;
|
|
@@ -1463,8 +1857,83 @@ class ExtractionOrchestrator {
|
|
|
1463
1857
|
const fileList = files ?? scanDirectory(this.rootDir);
|
|
1464
1858
|
const context = this.buildDetectionContext(fileList);
|
|
1465
1859
|
this.detectedFrameworkNames = (0, frameworks_1.detectFrameworks)(context).map((r) => r.name);
|
|
1860
|
+
const declared = (0, package_deps_1.declaredDependencies)(context);
|
|
1861
|
+
this.gatedFrameworks = new Map();
|
|
1862
|
+
for (const name of this.detectedFrameworkNames) {
|
|
1863
|
+
const deps = (0, frameworks_1.getFrameworkResolver)(name)?.appDependencies;
|
|
1864
|
+
// Gated only when some manifest names the framework: otherwise detection
|
|
1865
|
+
// found it by other evidence and every file is its app's.
|
|
1866
|
+
if (deps && deps.some((d) => declared.has(d)))
|
|
1867
|
+
this.gatedFrameworks.set(name, deps);
|
|
1868
|
+
}
|
|
1869
|
+
this.appFrameworkMemo.clear();
|
|
1870
|
+
this.manifestDependencies.clear();
|
|
1466
1871
|
return this.detectedFrameworkNames;
|
|
1467
1872
|
}
|
|
1873
|
+
/** Detected frameworks whose extractors run only inside their own apps, with the packages that mark one. */
|
|
1874
|
+
gatedFrameworks = new Map();
|
|
1875
|
+
/** `<dir>|<framework>` → does the package.json at or above `dir` declare the framework. */
|
|
1876
|
+
appFrameworkMemo = new Map();
|
|
1877
|
+
/** Directory → the dependency names its package.json declares, null without one. */
|
|
1878
|
+
manifestDependencies = new Map();
|
|
1879
|
+
/**
|
|
1880
|
+
* The detected frameworks whose extractors apply to `filePath`: all of them,
|
|
1881
|
+
* except one with `appDependencies` when neither the file's package.json nor
|
|
1882
|
+
* an enclosing one declares any of them.
|
|
1883
|
+
*/
|
|
1884
|
+
frameworksForFile(filePath, names) {
|
|
1885
|
+
if (this.gatedFrameworks.size === 0)
|
|
1886
|
+
return names;
|
|
1887
|
+
const slash = filePath.lastIndexOf('/');
|
|
1888
|
+
const dir = slash < 0 ? '' : filePath.slice(0, slash);
|
|
1889
|
+
const kept = names.filter((name) => this.frameworkAppliesIn(dir, name));
|
|
1890
|
+
return kept.length === names.length ? names : kept;
|
|
1891
|
+
}
|
|
1892
|
+
frameworkAppliesIn(dir, name) {
|
|
1893
|
+
const deps = this.gatedFrameworks.get(name);
|
|
1894
|
+
if (!deps)
|
|
1895
|
+
return true;
|
|
1896
|
+
const key = `${dir}|${name}`;
|
|
1897
|
+
const memo = this.appFrameworkMemo.get(key);
|
|
1898
|
+
if (memo !== undefined)
|
|
1899
|
+
return memo;
|
|
1900
|
+
// The nearest manifest that names ANY gated framework decides: true-sheet's
|
|
1901
|
+
// root package.json declares expo-router for its example app, and its
|
|
1902
|
+
// `docs/` Next.js app — whose own package.json declares `next` — is not
|
|
1903
|
+
// an Expo app for it.
|
|
1904
|
+
let applies = false;
|
|
1905
|
+
for (let d = dir; d !== null; d = d === '' ? null : d.includes('/') ? d.slice(0, d.lastIndexOf('/')) : '') {
|
|
1906
|
+
const declared = this.dependenciesDeclaredIn(d);
|
|
1907
|
+
if (!declared)
|
|
1908
|
+
continue;
|
|
1909
|
+
if (deps.some((dep) => declared.has(dep))) {
|
|
1910
|
+
applies = true;
|
|
1911
|
+
break;
|
|
1912
|
+
}
|
|
1913
|
+
if ([...this.gatedFrameworks].some(([other, otherDeps]) => other !== name && otherDeps.some((dep) => declared.has(dep))))
|
|
1914
|
+
break;
|
|
1915
|
+
}
|
|
1916
|
+
this.appFrameworkMemo.set(key, applies);
|
|
1917
|
+
return applies;
|
|
1918
|
+
}
|
|
1919
|
+
dependenciesDeclaredIn(dir) {
|
|
1920
|
+
if (this.manifestDependencies.has(dir))
|
|
1921
|
+
return this.manifestDependencies.get(dir);
|
|
1922
|
+
let declared = null;
|
|
1923
|
+
try {
|
|
1924
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(this.rootDir, dir, 'package.json'), 'utf8'));
|
|
1925
|
+
declared = new Set();
|
|
1926
|
+
for (const field of ['dependencies', 'devDependencies', 'peerDependencies']) {
|
|
1927
|
+
const group = pkg[field];
|
|
1928
|
+
if (group && typeof group === 'object')
|
|
1929
|
+
for (const name of Object.keys(group))
|
|
1930
|
+
declared.add(name);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
catch { /* no or unreadable manifest */ }
|
|
1934
|
+
this.manifestDependencies.set(dir, declared);
|
|
1935
|
+
return declared;
|
|
1936
|
+
}
|
|
1468
1937
|
/**
|
|
1469
1938
|
* Index all files in the project
|
|
1470
1939
|
*/
|
|
@@ -1508,6 +1977,7 @@ class ExtractionOrchestrator {
|
|
|
1508
1977
|
// early-run 5-10s single stalls were observed on 95k-file repos but never
|
|
1509
1978
|
// attributed — these labels settle scan vs framework-detect vs grammars.
|
|
1510
1979
|
const tScan = Date.now();
|
|
1980
|
+
const skipStats = { unsupportedByExtension: new Map() };
|
|
1511
1981
|
const files = await scanDirectoryAsync(this.rootDir, (current, file) => {
|
|
1512
1982
|
onProgress?.({
|
|
1513
1983
|
phase: 'scanning',
|
|
@@ -1515,9 +1985,22 @@ class ExtractionOrchestrator {
|
|
|
1515
1985
|
total: 0,
|
|
1516
1986
|
currentFile: file,
|
|
1517
1987
|
});
|
|
1518
|
-
});
|
|
1988
|
+
}, skipStats);
|
|
1519
1989
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
1520
1990
|
console.error(`[phase-timing] scan: ${Date.now() - tScan}ms (${files.length} files)`);
|
|
1991
|
+
/** Only meaningful when nothing was indexable — see IndexResult (#1502). */
|
|
1992
|
+
const skipSummary = () => {
|
|
1993
|
+
let total = 0;
|
|
1994
|
+
for (const n of skipStats.unsupportedByExtension.values())
|
|
1995
|
+
total += n;
|
|
1996
|
+
if (total === 0)
|
|
1997
|
+
return {};
|
|
1998
|
+
const top = [...skipStats.unsupportedByExtension.entries()]
|
|
1999
|
+
.map(([ext, count]) => ({ ext, count }))
|
|
2000
|
+
.sort((a, b) => b.count - a.count || a.ext.localeCompare(b.ext))
|
|
2001
|
+
.slice(0, 5);
|
|
2002
|
+
return { filesSkippedUnsupported: total, topUnsupportedExtensions: top };
|
|
2003
|
+
};
|
|
1521
2004
|
// A re-index over an existing DB skips unchanged-hash files at the store,
|
|
1522
2005
|
// which would preserve wiped zero-node rows (#1541) — drop them first so
|
|
1523
2006
|
// this run stores their files fresh. No-op on a fresh DB.
|
|
@@ -1557,11 +2040,7 @@ class ExtractionOrchestrator {
|
|
|
1557
2040
|
});
|
|
1558
2041
|
await new Promise(resolve => setImmediate(resolve));
|
|
1559
2042
|
// Detect needed languages and load grammars in the parse worker
|
|
1560
|
-
const neededLanguages =
|
|
1561
|
-
// .h files default to 'c' but may be C++ — ensure cpp grammar is loaded when c is needed
|
|
1562
|
-
if (neededLanguages.includes('c') && !neededLanguages.includes('cpp')) {
|
|
1563
|
-
neededLanguages.push('cpp');
|
|
1564
|
-
}
|
|
2043
|
+
const neededLanguages = preloadLanguagesForFiles(files, overrides);
|
|
1565
2044
|
// Parse files on a pool of worker threads (keeps the main thread free for UI
|
|
1566
2045
|
// and uses every core). Falls back to in-process parsing when the compiled
|
|
1567
2046
|
// worker is unavailable (e.g. running from source in tests).
|
|
@@ -1628,9 +2107,10 @@ class ExtractionOrchestrator {
|
|
|
1628
2107
|
*/
|
|
1629
2108
|
const parseFile = (filePath, content) => {
|
|
1630
2109
|
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
2110
|
+
const names = this.frameworksForFile(filePath, frameworkNames);
|
|
1631
2111
|
if (!pool)
|
|
1632
|
-
return Promise.resolve((0, tree_sitter_1.extractFromSource)(filePath, content, language,
|
|
1633
|
-
return pool.requestParse({ filePath, content, language, frameworkNames });
|
|
2112
|
+
return Promise.resolve((0, tree_sitter_1.extractFromSource)(filePath, content, language, names));
|
|
2113
|
+
return pool.requestParse({ filePath, content, language, frameworkNames: names });
|
|
1634
2114
|
};
|
|
1635
2115
|
// --- Bounded rolling-window dispatch, ordered commit ---
|
|
1636
2116
|
// Reads stay batched/parallel; parses run concurrently across the pool; the
|
|
@@ -1679,6 +2159,7 @@ class ExtractionOrchestrator {
|
|
|
1679
2159
|
language,
|
|
1680
2160
|
buffers: result.kernelBuffers,
|
|
1681
2161
|
file: this.buildFileRecord(filePath, content, language, stats, nodeCount, result.errors),
|
|
2162
|
+
...(result.unresolvedReferences.length > 0 ? { extraRefs: result.unresolvedReferences } : {}),
|
|
1682
2163
|
});
|
|
1683
2164
|
}
|
|
1684
2165
|
else {
|
|
@@ -1789,8 +2270,11 @@ class ExtractionOrchestrator {
|
|
|
1789
2270
|
// window has room. When nothing is in flight but the window is still full,
|
|
1790
2271
|
// the async commit chain is what's behind — await it so the cursor
|
|
1791
2272
|
// advances (buffered items hold whole file contents, so this bound is
|
|
1792
|
-
// load-bearing for memory).
|
|
1793
|
-
|
|
2273
|
+
// load-bearing for memory). Once a store has failed the cursor never
|
|
2274
|
+
// moves again — flushOrdered returns at once — so stop waiting and let
|
|
2275
|
+
// the drain below rethrow; waiting would spin on microtasks forever,
|
|
2276
|
+
// pinning a core and starving every timer in the process.
|
|
2277
|
+
while (nextSeq - nextToStore >= windowSize && !flushError && !aborted) {
|
|
1794
2278
|
if (inFlight.size > 0)
|
|
1795
2279
|
await Promise.race(inFlight);
|
|
1796
2280
|
else
|
|
@@ -1815,8 +2299,20 @@ class ExtractionOrchestrator {
|
|
|
1815
2299
|
(0, errors_1.logWarn)('Path traversal blocked in batch reader', { filePath: fp });
|
|
1816
2300
|
return { filePath: fp, content: null, stats: null, error: new Error('Path traversal blocked') };
|
|
1817
2301
|
}
|
|
1818
|
-
|
|
1819
|
-
|
|
2302
|
+
// Stat first: a file over the size limit is stored as skipped
|
|
2303
|
+
// without ever being read or decoded (#1910), so ten oversize
|
|
2304
|
+
// fixtures in one I/O batch no longer cost their size in RSS.
|
|
2305
|
+
const { stats, bytes } = await (0, file_limits_1.readBoundedSource)(fullPath);
|
|
2306
|
+
if (bytes === null) {
|
|
2307
|
+
return { filePath: fp, content: (0, file_limits_1.oversizeStamp)(stats.size), stats, error: null };
|
|
2308
|
+
}
|
|
2309
|
+
// Read bytes, not text: a `.ts` that is really an MPEG transport
|
|
2310
|
+
// stream (#1910) is recognised from its head here, at no extra I/O,
|
|
2311
|
+
// and never decoded or parsed.
|
|
2312
|
+
if (isMpegTsBytes(fp, bytes)) {
|
|
2313
|
+
return { filePath: fp, content: null, stats: null, error: null, skipped: true };
|
|
2314
|
+
}
|
|
2315
|
+
const content = bytes.toString('utf-8');
|
|
1820
2316
|
return { filePath: fp, content, stats, error: null };
|
|
1821
2317
|
}
|
|
1822
2318
|
catch (err) {
|
|
@@ -1825,11 +2321,17 @@ class ExtractionOrchestrator {
|
|
|
1825
2321
|
}));
|
|
1826
2322
|
// Dispatch each readable file into the bounded parse window; the window
|
|
1827
2323
|
// stores results on the main thread as they arrive.
|
|
1828
|
-
for (const { filePath, content, stats, error } of fileContents) {
|
|
2324
|
+
for (const { filePath, content, stats, error, skipped } of fileContents) {
|
|
1829
2325
|
if (signal?.aborted) {
|
|
1830
2326
|
aborted = true;
|
|
1831
2327
|
break;
|
|
1832
2328
|
}
|
|
2329
|
+
if (skipped) {
|
|
2330
|
+
// Not a source file after all — counted as done, stored as nothing.
|
|
2331
|
+
processed++;
|
|
2332
|
+
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
2333
|
+
continue;
|
|
2334
|
+
}
|
|
1833
2335
|
if (error || content === null || stats === null) {
|
|
1834
2336
|
processed++;
|
|
1835
2337
|
filesErrored++;
|
|
@@ -1842,18 +2344,18 @@ class ExtractionOrchestrator {
|
|
|
1842
2344
|
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
1843
2345
|
continue;
|
|
1844
2346
|
}
|
|
1845
|
-
// Honour
|
|
2347
|
+
// Honour MAX_SOURCE_FILE_SIZE_BYTES. Without this check, vendored generated
|
|
1846
2348
|
// headers, minified bundles, and other multi-MB files get indexed,
|
|
1847
2349
|
// wasting WASM heap and the worker recycle budget on inputs with no
|
|
1848
2350
|
// useful symbols. The single-file extractFile path already enforces
|
|
1849
2351
|
// this; the bulk path used to silently skip the check.
|
|
1850
|
-
if (stats.size >
|
|
2352
|
+
if (stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
|
|
1851
2353
|
await storeResult(filePath, content, stats, {
|
|
1852
2354
|
nodes: [],
|
|
1853
2355
|
edges: [],
|
|
1854
2356
|
unresolvedReferences: [],
|
|
1855
2357
|
errors: [{
|
|
1856
|
-
message: `File exceeds max size (${stats.size} > ${
|
|
2358
|
+
message: `File exceeds max size (${stats.size} > ${file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES})`,
|
|
1857
2359
|
filePath,
|
|
1858
2360
|
severity: 'warning',
|
|
1859
2361
|
code: 'size_exceeded',
|
|
@@ -1877,6 +2379,9 @@ class ExtractionOrchestrator {
|
|
|
1877
2379
|
if (flushError) {
|
|
1878
2380
|
if (storeWriter)
|
|
1879
2381
|
await storeWriter.close();
|
|
2382
|
+
// Its worker threads would otherwise outlive the failed index.
|
|
2383
|
+
if (pool)
|
|
2384
|
+
await pool.destroy();
|
|
1880
2385
|
throw flushError;
|
|
1881
2386
|
}
|
|
1882
2387
|
// All bundles are posted; wait for the writer to apply them, then close
|
|
@@ -1905,6 +2410,7 @@ class ExtractionOrchestrator {
|
|
|
1905
2410
|
filesSkipped,
|
|
1906
2411
|
filesErrored,
|
|
1907
2412
|
filesDiscovered: total,
|
|
2413
|
+
...skipSummary(),
|
|
1908
2414
|
nodesCreated: totalNodes,
|
|
1909
2415
|
edgesCreated: totalEdges,
|
|
1910
2416
|
errors: [{ message: 'Aborted', severity: 'error' }, ...errors],
|
|
@@ -1947,7 +2453,11 @@ class ExtractionOrchestrator {
|
|
|
1947
2453
|
const fullPath = (0, utils_1.validatePathWithinRoot)(this.rootDir, filePath);
|
|
1948
2454
|
if (!fullPath)
|
|
1949
2455
|
continue;
|
|
1950
|
-
|
|
2456
|
+
// Bounded like the first read: the file may have grown since (#1910).
|
|
2457
|
+
const bytes = (await (0, file_limits_1.readBoundedSource)(fullPath)).bytes;
|
|
2458
|
+
if (bytes === null)
|
|
2459
|
+
continue;
|
|
2460
|
+
content = bytes.toString('utf8');
|
|
1951
2461
|
}
|
|
1952
2462
|
catch {
|
|
1953
2463
|
continue;
|
|
@@ -1997,7 +2507,10 @@ class ExtractionOrchestrator {
|
|
|
1997
2507
|
const fullPath = (0, utils_1.validatePathWithinRoot)(this.rootDir, filePath);
|
|
1998
2508
|
if (!fullPath)
|
|
1999
2509
|
continue;
|
|
2000
|
-
|
|
2510
|
+
const bytes = (await (0, file_limits_1.readBoundedSource)(fullPath)).bytes;
|
|
2511
|
+
if (bytes === null)
|
|
2512
|
+
continue;
|
|
2513
|
+
fullContent = bytes.toString('utf8');
|
|
2001
2514
|
}
|
|
2002
2515
|
catch {
|
|
2003
2516
|
continue;
|
|
@@ -2047,6 +2560,7 @@ class ExtractionOrchestrator {
|
|
|
2047
2560
|
filesSkipped,
|
|
2048
2561
|
filesErrored,
|
|
2049
2562
|
filesDiscovered: total,
|
|
2563
|
+
...skipSummary(),
|
|
2050
2564
|
nodesCreated: totalNodes,
|
|
2051
2565
|
edgesCreated: totalEdges,
|
|
2052
2566
|
errors,
|
|
@@ -2117,8 +2631,14 @@ class ExtractionOrchestrator {
|
|
|
2117
2631
|
let content;
|
|
2118
2632
|
let stats;
|
|
2119
2633
|
try {
|
|
2120
|
-
|
|
2121
|
-
|
|
2634
|
+
// An oversize file is stored as skipped; its bytes are never needed (#1910).
|
|
2635
|
+
const read = await (0, file_limits_1.readBoundedSource)(fullPath);
|
|
2636
|
+
stats = read.stats;
|
|
2637
|
+
// An MPEG transport stream named `.ts` is not TypeScript (#1910).
|
|
2638
|
+
if (read.bytes !== null && isMpegTsBytes(relativePath, read.bytes)) {
|
|
2639
|
+
return { nodes: [], edges: [], unresolvedReferences: [], errors: [], durationMs: 0 };
|
|
2640
|
+
}
|
|
2641
|
+
content = read.bytes === null ? (0, file_limits_1.oversizeStamp)(stats.size) : read.bytes.toString('utf8');
|
|
2122
2642
|
}
|
|
2123
2643
|
catch (error) {
|
|
2124
2644
|
return {
|
|
@@ -2157,14 +2677,14 @@ class ExtractionOrchestrator {
|
|
|
2157
2677
|
}
|
|
2158
2678
|
const language = (0, grammars_1.detectLanguage)(relativePath, content, (0, project_config_1.loadExtensionOverrides)(this.rootDir));
|
|
2159
2679
|
// Check file size
|
|
2160
|
-
if (stats.size >
|
|
2680
|
+
if (stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
|
|
2161
2681
|
const result = {
|
|
2162
2682
|
nodes: [],
|
|
2163
2683
|
edges: [],
|
|
2164
2684
|
unresolvedReferences: [],
|
|
2165
2685
|
errors: [
|
|
2166
2686
|
{
|
|
2167
|
-
message: `File exceeds max size (${stats.size} > ${
|
|
2687
|
+
message: `File exceeds max size (${stats.size} > ${file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES})`,
|
|
2168
2688
|
filePath: relativePath,
|
|
2169
2689
|
severity: 'warning',
|
|
2170
2690
|
code: 'size_exceeded',
|
|
@@ -2188,7 +2708,7 @@ class ExtractionOrchestrator {
|
|
|
2188
2708
|
// Extract from source. Use cached framework names if indexAll has run,
|
|
2189
2709
|
// otherwise detect on the spot so single-file re-index paths still emit
|
|
2190
2710
|
// route nodes / middleware / etc.
|
|
2191
|
-
const frameworkNames = this.ensureDetectedFrameworks();
|
|
2711
|
+
const frameworkNames = this.frameworksForFile(relativePath, this.ensureDetectedFrameworks());
|
|
2192
2712
|
const result = (0, tree_sitter_1.extractFromSource)(relativePath, content, language, frameworkNames);
|
|
2193
2713
|
// Store in database
|
|
2194
2714
|
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
@@ -2231,9 +2751,9 @@ class ExtractionOrchestrator {
|
|
|
2231
2751
|
// Bulk inserts run in bounded sub-transactions with a yield between, so a
|
|
2232
2752
|
// giant generated file (tens of thousands of symbols) can't block the
|
|
2233
2753
|
// event loop — and the #850 watchdog heartbeat — for the whole store.
|
|
2234
|
-
//
|
|
2235
|
-
// own), and the files-table record still lands last, so
|
|
2236
|
-
//
|
|
2754
|
+
// That chunked path is not one atomic transaction (each insert call has
|
|
2755
|
+
// its own), and the files-table record still lands last, so a
|
|
2756
|
+
// partially-stored file has no record and re-indexes.
|
|
2237
2757
|
const STORE_CHUNK = 2000;
|
|
2238
2758
|
const contentHash = hashContent(content);
|
|
2239
2759
|
// Check if file already exists and hasn't changed. A skip/failure MARKER
|
|
@@ -2263,20 +2783,21 @@ class ExtractionOrchestrator {
|
|
|
2263
2783
|
// `references` edges from callers that import it via module-attribute
|
|
2264
2784
|
// access (`pkg.mod.fn(...)`).
|
|
2265
2785
|
//
|
|
2266
|
-
// We snapshot the
|
|
2267
|
-
//
|
|
2268
|
-
// `sha256(filePath:kind:name:line)`, so any line shift in
|
|
2269
|
-
// (e.g. a docstring-only edit above the symbol) changes
|
|
2270
|
-
// a naive re-insert by old id would silently drop
|
|
2271
|
-
// (
|
|
2272
|
-
//
|
|
2786
|
+
// We snapshot the edges plus the identity of every node the file had, so
|
|
2787
|
+
// each edge can follow its old target to the re-indexed node that replaces
|
|
2788
|
+
// it. Node ids are `sha256(filePath:kind:name:line)`, so any line shift in
|
|
2789
|
+
// the callee file (e.g. a docstring-only edit above the symbol) changes
|
|
2790
|
+
// every target id and a naive re-insert by old id would silently drop
|
|
2791
|
+
// every edge. Pairing by (kind, name) — then qualified name, signature and
|
|
2792
|
+
// position when the file defines a name more than once (#2276) — is stable
|
|
2793
|
+
// across line shifts; if the symbol was renamed/removed, no pair is found
|
|
2794
|
+
// and the edge is re-resolved from its original reference (see below).
|
|
2273
2795
|
const crossFileIncomingEdges = existingFile
|
|
2274
2796
|
? this.queries.getCrossFileIncomingEdgesWithTarget(filePath)
|
|
2275
2797
|
: [];
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
}
|
|
2798
|
+
const priorNodes = crossFileIncomingEdges.length > 0
|
|
2799
|
+
? this.queries.getNodeIdentitiesByFile(filePath)
|
|
2800
|
+
: [];
|
|
2280
2801
|
// Filter out nodes with missing required fields before insertion.
|
|
2281
2802
|
// This prevents FK violations when edges reference nodes that would
|
|
2282
2803
|
// be silently skipped by insertNode() (see issue #42).
|
|
@@ -2291,36 +2812,49 @@ class ExtractionOrchestrator {
|
|
|
2291
2812
|
language: ref.language ?? language,
|
|
2292
2813
|
}));
|
|
2293
2814
|
// Fast path for the common case (everything fits one chunk): the whole
|
|
2294
|
-
//
|
|
2295
|
-
//
|
|
2296
|
-
//
|
|
2815
|
+
// re-store — deleting the old rows, the new nodes, edges, refs and file
|
|
2816
|
+
// record, and the re-attached incoming edges — lands in ONE transaction
|
|
2817
|
+
// with no event-loop yields in between. Committed separately, a crash
|
|
2818
|
+
// after the delete left the file looking new (no snapshot next time) and
|
|
2819
|
+
// a crash before the re-attach left it looking current: either way other
|
|
2820
|
+
// files' edges into it were lost for good. Giant generated files keep the
|
|
2821
|
+
// chunked + yielding path below so the #850 watchdog heartbeat stays
|
|
2822
|
+
// serviced.
|
|
2297
2823
|
const fitsOneChunk = validNodes.length <= STORE_CHUNK &&
|
|
2298
2824
|
validEdges.length <= STORE_CHUNK &&
|
|
2299
2825
|
validRefs.length <= STORE_CHUNK;
|
|
2300
2826
|
if (fitsOneChunk) {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2827
|
+
this.queries.runInTransaction(() => {
|
|
2828
|
+
if (existingFile) {
|
|
2829
|
+
this.queries.deleteFile(filePath);
|
|
2830
|
+
}
|
|
2831
|
+
this.queries.storeFileBundle({
|
|
2832
|
+
nodes: validNodes,
|
|
2833
|
+
edges: validEdges,
|
|
2834
|
+
refs: validRefs,
|
|
2835
|
+
file: {
|
|
2836
|
+
path: filePath,
|
|
2837
|
+
contentHash,
|
|
2838
|
+
language,
|
|
2839
|
+
size: stats.size,
|
|
2840
|
+
modifiedAt: stats.mtimeMs,
|
|
2841
|
+
indexedAt: Date.now(),
|
|
2842
|
+
nodeCount: result.nodes.length,
|
|
2843
|
+
errors: result.errors.length > 0 ? result.errors : undefined,
|
|
2844
|
+
generated,
|
|
2845
|
+
},
|
|
2846
|
+
});
|
|
2847
|
+
// On a fresh bulk index crossFileIncomingEdges is [].
|
|
2848
|
+
if (crossFileIncomingEdges.length > 0) {
|
|
2849
|
+
this.reattachCrossFileEdges(crossFileIncomingEdges, priorNodes, validNodes);
|
|
2850
|
+
}
|
|
2318
2851
|
});
|
|
2319
|
-
if (crossFileIncomingEdges.length > 0) {
|
|
2320
|
-
this.reattachCrossFileEdges(crossFileIncomingEdges, validNodes);
|
|
2321
|
-
}
|
|
2322
2852
|
return;
|
|
2323
2853
|
}
|
|
2854
|
+
// Delete existing data for this file
|
|
2855
|
+
if (existingFile) {
|
|
2856
|
+
this.queries.deleteFile(filePath);
|
|
2857
|
+
}
|
|
2324
2858
|
// Insert nodes (chunked — see STORE_CHUNK above)
|
|
2325
2859
|
for (let i = 0; i < validNodes.length; i += STORE_CHUNK) {
|
|
2326
2860
|
this.queries.insertNodes(validNodes.slice(i, i + STORE_CHUNK));
|
|
@@ -2334,25 +2868,26 @@ class ExtractionOrchestrator {
|
|
|
2334
2868
|
}
|
|
2335
2869
|
}
|
|
2336
2870
|
// Re-insert cross-file incoming edges snapshotted before the delete,
|
|
2337
|
-
//
|
|
2338
|
-
//
|
|
2871
|
+
// moving each edge's target to the re-indexed node that replaces it (see
|
|
2872
|
+
// pairReindexedNodes). Node ids include the source line, so any line
|
|
2339
2873
|
// shift in the callee file (e.g. a docstring-only edit above the symbol)
|
|
2340
2874
|
// changes every target id and a naive re-insert by old id would drop them
|
|
2341
2875
|
// all. `insertEdges` still filters to endpoints that exist. This closes
|
|
2342
2876
|
// the #899 edge-drop on `sync`.
|
|
2343
2877
|
//
|
|
2344
|
-
// Edges whose callee (target) was renamed/removed during the re-index
|
|
2345
|
-
//
|
|
2346
|
-
//
|
|
2347
|
-
// metadata.refName/refKind at creation) so
|
|
2348
|
-
// sweep can rebind it to
|
|
2349
|
-
//
|
|
2350
|
-
//
|
|
2351
|
-
// the stamp existed, or
|
|
2352
|
-
//
|
|
2353
|
-
//
|
|
2878
|
+
// Edges whose callee (target) was renamed/removed during the re-index, or
|
|
2879
|
+
// can't be told apart from a same-named sibling (#2276), are not silently
|
|
2880
|
+
// dropped or guessed at: each is resurrected as its ORIGINAL unresolved
|
|
2881
|
+
// ref (stamped on the edge as metadata.refName/refKind at creation) so
|
|
2882
|
+
// the same sync's resolution sweep can rebind it to the right definition
|
|
2883
|
+
// here or an alternative one elsewhere, or park it as status='failed' to
|
|
2884
|
+
// be retried when the symbol reappears — the removal-side counterpart of
|
|
2885
|
+
// #1240. Edges without refName (built before the stamp existed, or
|
|
2886
|
+
// synthesized) still drop silently: reconstructing a ref from the
|
|
2887
|
+
// target's plain name would strip receiver/qualifier context and risk a
|
|
2888
|
+
// rebind a full re-index would never make.
|
|
2354
2889
|
if (crossFileIncomingEdges.length > 0) {
|
|
2355
|
-
this.reattachCrossFileEdges(crossFileIncomingEdges, validNodes);
|
|
2890
|
+
this.reattachCrossFileEdges(crossFileIncomingEdges, priorNodes, validNodes);
|
|
2356
2891
|
}
|
|
2357
2892
|
// Insert unresolved references in batch with denormalized filePath/language
|
|
2358
2893
|
for (let i = 0; i < validRefs.length; i += STORE_CHUNK) {
|
|
@@ -2400,20 +2935,18 @@ class ExtractionOrchestrator {
|
|
|
2400
2935
|
}
|
|
2401
2936
|
/**
|
|
2402
2937
|
* Re-attach cross-file incoming edges snapshotted before a re-index delete
|
|
2403
|
-
* (#899):
|
|
2404
|
-
* (
|
|
2405
|
-
*
|
|
2406
|
-
*
|
|
2938
|
+
* (#899): move each edge's target to the re-indexed node that replaces it
|
|
2939
|
+
* ({@link pairReindexedNodes}). Targets that vanished, or that can't be
|
|
2940
|
+
* told apart from a same-named sibling (#2276), are resurrected as their
|
|
2941
|
+
* original unresolved ref (#1240's removal-side counterpart) when the edge
|
|
2942
|
+
* carries its refName stamp, so resolution picks the target afresh.
|
|
2407
2943
|
*/
|
|
2408
|
-
reattachCrossFileEdges(crossFileIncomingEdges, validNodes) {
|
|
2409
|
-
const
|
|
2410
|
-
for (const n of validNodes) {
|
|
2411
|
-
newNodesByKindName.set(`${n.kind}\0${n.name}`, n.id);
|
|
2412
|
-
}
|
|
2944
|
+
reattachCrossFileEdges(crossFileIncomingEdges, priorNodes, validNodes) {
|
|
2945
|
+
const replacementOf = pairReindexedNodes(priorNodes, validNodes);
|
|
2413
2946
|
const reinserted = [];
|
|
2414
2947
|
const resurrected = [];
|
|
2415
2948
|
for (const e of crossFileIncomingEdges) {
|
|
2416
|
-
const newTargetId =
|
|
2949
|
+
const newTargetId = replacementOf.get(e.target);
|
|
2417
2950
|
if (newTargetId) {
|
|
2418
2951
|
reinserted.push({ source: e.source, target: newTargetId, kind: e.kind, metadata: e.metadata, line: e.line, column: e.column, provenance: e.provenance });
|
|
2419
2952
|
}
|
|
@@ -2485,8 +3018,7 @@ class ExtractionOrchestrator {
|
|
|
2485
3018
|
// rebind to the same target is a clean no-op, but leaving the old row in
|
|
2486
3019
|
// place for a rebind ELSEWHERE would keep both, turning drift into
|
|
2487
3020
|
// duplication.
|
|
2488
|
-
this.queries.
|
|
2489
|
-
this.queries.insertUnresolvedRefsBatch(refs);
|
|
3021
|
+
this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
|
|
2490
3022
|
return refs.length;
|
|
2491
3023
|
}
|
|
2492
3024
|
/**
|
|
@@ -2507,7 +3039,15 @@ class ExtractionOrchestrator {
|
|
|
2507
3039
|
* set is not exactly known (directory removals, event overflow): the full
|
|
2508
3040
|
* scan-diff remains the ground truth those cases need (#1285).
|
|
2509
3041
|
*/
|
|
2510
|
-
scopedPaths
|
|
3042
|
+
scopedPaths,
|
|
3043
|
+
/**
|
|
3044
|
+
* Writer-side WAL pressure valve (#1539). Called after every changed file
|
|
3045
|
+
* is stored, when no extraction transaction is open, so a checkpoint can
|
|
3046
|
+
* safely catch up before the next file grows the WAL further.
|
|
3047
|
+
*/
|
|
3048
|
+
backpressure,
|
|
3049
|
+
/** Inspect changed inputs before deletion/re-extraction cascades their edges. */
|
|
3050
|
+
onFileChange) {
|
|
2511
3051
|
await (0, grammars_1.initGrammars)(); // Initialize WASM runtime (grammars loaded lazily below)
|
|
2512
3052
|
const startTime = Date.now();
|
|
2513
3053
|
let filesChecked = 0;
|
|
@@ -2526,6 +3066,7 @@ class ExtractionOrchestrator {
|
|
|
2526
3066
|
total: 0,
|
|
2527
3067
|
});
|
|
2528
3068
|
const filesToIndex = [];
|
|
3069
|
+
const failedFilePaths = [];
|
|
2529
3070
|
// === Filesystem reconcile (git-independent) ===
|
|
2530
3071
|
// The source of truth for "what changed" is the filesystem vs the indexed
|
|
2531
3072
|
// state — never git. We enumerate the current source files and reconcile
|
|
@@ -2570,6 +3111,10 @@ class ExtractionOrchestrator {
|
|
|
2570
3111
|
console.error(`[phase-timing] sync-scoped: ${Date.now() - tSyncScan}ms (${unique.length} paths, ${trackedFiles.length} tracked)`);
|
|
2571
3112
|
}
|
|
2572
3113
|
else {
|
|
3114
|
+
// Full reconcile: drop the memoized scope matcher so a nested
|
|
3115
|
+
// `.gitignore` / exclude-standard change that forced this full sync is
|
|
3116
|
+
// visible to the next scoped sync (#1728).
|
|
3117
|
+
this.scopedMatcher = null;
|
|
2573
3118
|
currentFiles = await scanDirectoryAsync(this.rootDir);
|
|
2574
3119
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
2575
3120
|
console.error(`[phase-timing] sync-scan: ${Date.now() - tSyncScan}ms (${currentFiles.length} files)`);
|
|
@@ -2593,30 +3138,34 @@ class ExtractionOrchestrator {
|
|
|
2593
3138
|
// `reconcileChecks` drives the cooperative yield shared with the adds/mods loop
|
|
2594
3139
|
// below (see SYNC_RECONCILE_YIELD_INTERVAL / issue #905).
|
|
2595
3140
|
let reconcileChecks = 0;
|
|
3141
|
+
const removeTracked = (tracked) => {
|
|
3142
|
+
// Before the cascade deletes them, resurrect incoming cross-file
|
|
3143
|
+
// resolution edges as their original refs (#1240 removal case): the
|
|
3144
|
+
// callers live in files this sync will NOT revisit, so this is their
|
|
3145
|
+
// only chance to rebind to an alternative definition — or to park as
|
|
3146
|
+
// failed until the symbol reappears somewhere. (A deleted file whose
|
|
3147
|
+
// CALLERS are also being deleted is fine: their nodes cascade later
|
|
3148
|
+
// in this loop and take the resurrected rows with them.)
|
|
3149
|
+
// Every name this file defined is about to stop existing here, which
|
|
3150
|
+
// narrows the candidate set for that name repo-wide (CG-33).
|
|
3151
|
+
for (const pair of this.queries.getNodeNamePairsByFiles([tracked.path]))
|
|
3152
|
+
pairsBefore.add(pair);
|
|
3153
|
+
const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
|
|
3154
|
+
if (incoming.length > 0) {
|
|
3155
|
+
const resurrected = incoming
|
|
3156
|
+
.map((e) => resurrectRefFromDroppedEdge(e))
|
|
3157
|
+
.filter((r) => r !== null);
|
|
3158
|
+
if (resurrected.length > 0) {
|
|
3159
|
+
this.queries.insertUnresolvedRefsBatch(resurrected);
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
onFileChange?.(tracked.path);
|
|
3163
|
+
this.queries.deleteFile(tracked.path);
|
|
3164
|
+
filesRemoved++;
|
|
3165
|
+
};
|
|
2596
3166
|
for (const tracked of trackedFiles) {
|
|
2597
3167
|
if (!currentSet.has(tracked.path) || !fs.existsSync(path.join(this.rootDir, tracked.path))) {
|
|
2598
|
-
|
|
2599
|
-
// resolution edges as their original refs (#1240 removal case): the
|
|
2600
|
-
// callers live in files this sync will NOT revisit, so this is their
|
|
2601
|
-
// only chance to rebind to an alternative definition — or to park as
|
|
2602
|
-
// failed until the symbol reappears somewhere. (A deleted file whose
|
|
2603
|
-
// CALLERS are also being deleted is fine: their nodes cascade later
|
|
2604
|
-
// in this loop and take the resurrected rows with them.)
|
|
2605
|
-
// Every name this file defined is about to stop existing here, which
|
|
2606
|
-
// narrows the candidate set for that name repo-wide (CG-33).
|
|
2607
|
-
for (const pair of this.queries.getNodeNamePairsByFiles([tracked.path]))
|
|
2608
|
-
pairsBefore.add(pair);
|
|
2609
|
-
const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
|
|
2610
|
-
if (incoming.length > 0) {
|
|
2611
|
-
const resurrected = incoming
|
|
2612
|
-
.map((e) => resurrectRefFromDroppedEdge(e))
|
|
2613
|
-
.filter((r) => r !== null);
|
|
2614
|
-
if (resurrected.length > 0) {
|
|
2615
|
-
this.queries.insertUnresolvedRefsBatch(resurrected);
|
|
2616
|
-
}
|
|
2617
|
-
}
|
|
2618
|
-
this.queries.deleteFile(tracked.path);
|
|
2619
|
-
filesRemoved++;
|
|
3168
|
+
removeTracked(tracked);
|
|
2620
3169
|
}
|
|
2621
3170
|
if (++reconcileChecks % SYNC_RECONCILE_YIELD_INTERVAL === 0) {
|
|
2622
3171
|
await new Promise((resolve) => setImmediate(resolve));
|
|
@@ -2646,25 +3195,37 @@ class ExtractionOrchestrator {
|
|
|
2646
3195
|
}
|
|
2647
3196
|
catch (error) {
|
|
2648
3197
|
(0, errors_1.logDebug)('Skipping unstattable file during sync', { filePath, error: String(error) });
|
|
3198
|
+
failedFilePaths.push(filePath);
|
|
2649
3199
|
continue;
|
|
2650
3200
|
}
|
|
2651
3201
|
}
|
|
2652
3202
|
// New, or size/mtime changed — read + hash to confirm a real content change.
|
|
3203
|
+
// (An oversize file hashes as its size stamp, unread — #1910.)
|
|
2653
3204
|
let content;
|
|
2654
3205
|
try {
|
|
2655
|
-
content =
|
|
3206
|
+
content = readSourceOrStamp(fullPath);
|
|
2656
3207
|
}
|
|
2657
3208
|
catch (error) {
|
|
2658
3209
|
(0, errors_1.logDebug)('Skipping unreadable file during sync', { filePath, error: String(error) });
|
|
3210
|
+
failedFilePaths.push(filePath);
|
|
3211
|
+
continue;
|
|
3212
|
+
}
|
|
3213
|
+
// Not source after all — an MPEG transport stream named `.ts` (#1910):
|
|
3214
|
+
// a new one is ignored, a tracked file that became one is removed.
|
|
3215
|
+
if (content === null) {
|
|
3216
|
+
if (tracked)
|
|
3217
|
+
removeTracked(tracked);
|
|
2659
3218
|
continue;
|
|
2660
3219
|
}
|
|
2661
3220
|
const contentHash = hashContent(content);
|
|
2662
3221
|
if (!tracked) {
|
|
3222
|
+
onFileChange?.(filePath, content);
|
|
2663
3223
|
filesToIndex.push(filePath);
|
|
2664
3224
|
changedFilePaths.push(filePath);
|
|
2665
3225
|
filesAdded++;
|
|
2666
3226
|
}
|
|
2667
3227
|
else if (tracked.contentHash !== contentHash) {
|
|
3228
|
+
onFileChange?.(filePath, content);
|
|
2668
3229
|
filesToIndex.push(filePath);
|
|
2669
3230
|
changedFilePaths.push(filePath);
|
|
2670
3231
|
filesModified++;
|
|
@@ -2681,12 +3242,7 @@ class ExtractionOrchestrator {
|
|
|
2681
3242
|
// Load only grammars needed for changed files
|
|
2682
3243
|
if (filesToIndex.length > 0) {
|
|
2683
3244
|
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
2684
|
-
|
|
2685
|
-
// .h files default to 'c' but may be C++ — ensure cpp grammar is loaded
|
|
2686
|
-
if (neededLanguages.includes('c') && !neededLanguages.includes('cpp')) {
|
|
2687
|
-
neededLanguages.push('cpp');
|
|
2688
|
-
}
|
|
2689
|
-
await (0, grammars_1.loadGrammarsForLanguages)(neededLanguages);
|
|
3245
|
+
await (0, grammars_1.loadGrammarsForLanguages)(preloadLanguagesForFiles(filesToIndex, overrides));
|
|
2690
3246
|
}
|
|
2691
3247
|
// Index changed files
|
|
2692
3248
|
const total = filesToIndex.length;
|
|
@@ -2699,7 +3255,12 @@ class ExtractionOrchestrator {
|
|
|
2699
3255
|
currentFile: filePath,
|
|
2700
3256
|
});
|
|
2701
3257
|
const result = await this.indexFile(filePath);
|
|
3258
|
+
if (result.errors.some(e => e.severity === 'error'))
|
|
3259
|
+
failedFilePaths.push(filePath);
|
|
2702
3260
|
nodesUpdated += result.nodes.length;
|
|
3261
|
+
const pause = backpressure?.();
|
|
3262
|
+
if (pause)
|
|
3263
|
+
await pause;
|
|
2703
3264
|
}
|
|
2704
3265
|
// Names whose definition set this sync changed: a `file\0name` pair present
|
|
2705
3266
|
// before but not after (removed/renamed away) or after but not before
|
|
@@ -2731,49 +3292,112 @@ class ExtractionOrchestrator {
|
|
|
2731
3292
|
nodesUpdated,
|
|
2732
3293
|
durationMs: Date.now() - startTime,
|
|
2733
3294
|
changedFilePaths: changedFilePaths.length > 0 ? changedFilePaths : undefined,
|
|
3295
|
+
...(failedFilePaths.length > 0 ? { failedFilePaths } : {}),
|
|
2734
3296
|
definitionDelta: definitionDelta.length > 0 ? definitionDelta : undefined,
|
|
2735
3297
|
};
|
|
2736
3298
|
}
|
|
3299
|
+
indexedDirtyPaths(stamp) {
|
|
3300
|
+
try {
|
|
3301
|
+
const state = JSON.parse(this.queries.getMetadata('indexed_dirty_paths') ?? 'null');
|
|
3302
|
+
if (!state || state.commit !== (stamp ?? '') || !Array.isArray(state.paths))
|
|
3303
|
+
return null;
|
|
3304
|
+
if (!state.paths.every((p) => typeof p === 'string' && p.length > 0 &&
|
|
3305
|
+
!path.isAbsolute(p) && !p.split('/').includes('..')))
|
|
3306
|
+
return null;
|
|
3307
|
+
return state.paths;
|
|
3308
|
+
}
|
|
3309
|
+
catch {
|
|
3310
|
+
return null;
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
/** Capture before file reads. In-flight/failed full writes must not claim freshness. */
|
|
3314
|
+
beginGitIndexState(full) {
|
|
3315
|
+
const head = getGitHeadSha(this.rootDir) ?? '';
|
|
3316
|
+
const stamp = this.queries.getMetadata(exports.INDEXED_AT_COMMIT_KEY) ?? '';
|
|
3317
|
+
const prior = this.indexedDirtyPaths(stamp);
|
|
3318
|
+
const status = getGitChangedFiles(this.rootDir);
|
|
3319
|
+
const dirty = status ? [...new Set([
|
|
3320
|
+
...(full ? [] : prior ?? []), ...status.added, ...status.modified, ...status.deleted,
|
|
3321
|
+
])] : null;
|
|
3322
|
+
if (full || prior === null || dirty === null) {
|
|
3323
|
+
this.queries.setMetadata(exports.INDEXED_AT_COMMIT_KEY, '');
|
|
3324
|
+
this.queries.setMetadata('indexed_dirty_paths', '');
|
|
3325
|
+
}
|
|
3326
|
+
else {
|
|
3327
|
+
// Scoped writes leave the commit alone and retain dirty paths before the
|
|
3328
|
+
// first write, so a crash cannot forget an indexed uncommitted edit.
|
|
3329
|
+
this.queries.setMetadata('indexed_dirty_paths', JSON.stringify({ commit: stamp, paths: dirty }));
|
|
3330
|
+
}
|
|
3331
|
+
return { head, stamp, dirty };
|
|
3332
|
+
}
|
|
3333
|
+
finishGitIndexState(snapshot, full, retries = []) {
|
|
3334
|
+
const after = getGitChangedFiles(this.rootDir);
|
|
3335
|
+
if (!snapshot.dirty || !after)
|
|
3336
|
+
return;
|
|
3337
|
+
const commit = full ? snapshot.head : snapshot.stamp;
|
|
3338
|
+
const paths = [...new Set([...snapshot.dirty, ...after.added, ...after.modified, ...after.deleted, ...retries])].sort();
|
|
3339
|
+
// The embedded commit makes a torn pair fail closed: readers reject a dirty
|
|
3340
|
+
// set that doesn't match the separately stored commit. Write the set first.
|
|
3341
|
+
this.queries.setMetadata('indexed_dirty_paths', JSON.stringify({ commit, paths }));
|
|
3342
|
+
if (full)
|
|
3343
|
+
this.queries.setMetadata(exports.INDEXED_AT_COMMIT_KEY, commit);
|
|
3344
|
+
}
|
|
2737
3345
|
/**
|
|
2738
3346
|
* Get files that have changed since last index.
|
|
2739
3347
|
* Uses git status as a fast path when available, falling back to full scan.
|
|
2740
3348
|
*/
|
|
2741
3349
|
getChangedFiles() {
|
|
2742
|
-
|
|
3350
|
+
// The commit this index was last brought up to date at. Absent on an index
|
|
3351
|
+
// built before stamping existed — getGitChangedFiles then declines the fast
|
|
3352
|
+
// path and the full scan below answers correctly, once, until a sync or a
|
|
3353
|
+
// full index writes the stamp. (#1829)
|
|
3354
|
+
let sinceCommit = null;
|
|
3355
|
+
try {
|
|
3356
|
+
sinceCommit = this.queries.getMetadata(exports.INDEXED_AT_COMMIT_KEY) ?? null;
|
|
3357
|
+
}
|
|
3358
|
+
catch { /* advisory */ }
|
|
3359
|
+
const dirtyPaths = this.indexedDirtyPaths(sinceCommit);
|
|
3360
|
+
const gitChanges = dirtyPaths !== null && canTrustGitFastPath(this.rootDir, sinceCommit)
|
|
3361
|
+
? getGitChangedFiles(this.rootDir, sinceCommit)
|
|
3362
|
+
: null;
|
|
2743
3363
|
if (gitChanges) {
|
|
2744
3364
|
// === Git fast path ===
|
|
2745
3365
|
const added = [];
|
|
2746
3366
|
const modified = [];
|
|
2747
3367
|
const removed = [];
|
|
2748
|
-
//
|
|
2749
|
-
|
|
3368
|
+
// Git supplies candidates, never the verdict. A committed deletion may
|
|
3369
|
+
// have been recreated locally; a previously indexed dirty path may have
|
|
3370
|
+
// vanished from git status after restore. Classify current disk vs DB once.
|
|
3371
|
+
const candidates = new Set([...gitChanges.deleted, ...gitChanges.modified, ...gitChanges.added, ...dirtyPaths]);
|
|
3372
|
+
const scope = this.scopedSyncMatcher();
|
|
3373
|
+
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
3374
|
+
for (const filePath of candidates) {
|
|
2750
3375
|
const tracked = this.queries.getFileByPath(filePath);
|
|
2751
|
-
if (tracked) {
|
|
2752
|
-
removed.push(filePath);
|
|
2753
|
-
}
|
|
2754
|
-
}
|
|
2755
|
-
// Modified + added files — read + hash, compare with DB. Untracked (`??`)
|
|
2756
|
-
// files stay untracked in git even after indexing, so they must be
|
|
2757
|
-
// hash-compared like modified files instead of always counting as added —
|
|
2758
|
-
// otherwise status reports them as pending forever. (See issue #206.)
|
|
2759
|
-
for (const filePath of [...gitChanges.modified, ...gitChanges.added]) {
|
|
2760
3376
|
const fullPath = path.join(this.rootDir, filePath);
|
|
3377
|
+
if (!(0, grammars_1.isSourceFile)(filePath, overrides) || scope.ignores(filePath) || !fs.existsSync(fullPath)) {
|
|
3378
|
+
if (tracked)
|
|
3379
|
+
removed.push(filePath);
|
|
3380
|
+
continue;
|
|
3381
|
+
}
|
|
2761
3382
|
let content;
|
|
2762
3383
|
try {
|
|
2763
|
-
content =
|
|
3384
|
+
content = readSourceOrStamp(fullPath);
|
|
2764
3385
|
}
|
|
2765
3386
|
catch (error) {
|
|
2766
3387
|
(0, errors_1.logDebug)('Skipping unreadable file while detecting changes', { filePath, error: String(error) });
|
|
2767
3388
|
continue;
|
|
2768
3389
|
}
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
if (
|
|
2772
|
-
|
|
3390
|
+
// A `.ts` that is an MPEG transport stream is not source (#1910), so an
|
|
3391
|
+
// untracked clip is never pending and a tracked file that became one is gone.
|
|
3392
|
+
if (content === null) {
|
|
3393
|
+
if (tracked)
|
|
3394
|
+
removed.push(filePath);
|
|
3395
|
+
continue;
|
|
2773
3396
|
}
|
|
2774
|
-
|
|
3397
|
+
if (!tracked)
|
|
3398
|
+
added.push(filePath);
|
|
3399
|
+
else if (tracked.contentHash !== hashContent(content))
|
|
2775
3400
|
modified.push(filePath);
|
|
2776
|
-
}
|
|
2777
3401
|
}
|
|
2778
3402
|
return { added, modified, removed };
|
|
2779
3403
|
}
|
|
@@ -2799,14 +3423,20 @@ class ExtractionOrchestrator {
|
|
|
2799
3423
|
const fullPath = path.join(this.rootDir, filePath);
|
|
2800
3424
|
let content;
|
|
2801
3425
|
try {
|
|
2802
|
-
content =
|
|
3426
|
+
content = readSourceOrStamp(fullPath);
|
|
2803
3427
|
}
|
|
2804
3428
|
catch (error) {
|
|
2805
3429
|
(0, errors_1.logDebug)('Skipping unreadable file while detecting changes', { filePath, error: String(error) });
|
|
2806
3430
|
continue;
|
|
2807
3431
|
}
|
|
2808
|
-
const contentHash = hashContent(content);
|
|
2809
3432
|
const tracked = trackedMap.get(filePath);
|
|
3433
|
+
// An MPEG transport stream named `.ts` (#1910) is not source.
|
|
3434
|
+
if (content === null) {
|
|
3435
|
+
if (tracked)
|
|
3436
|
+
removed.push(filePath);
|
|
3437
|
+
continue;
|
|
3438
|
+
}
|
|
3439
|
+
const contentHash = hashContent(content);
|
|
2810
3440
|
if (!tracked) {
|
|
2811
3441
|
added.push(filePath);
|
|
2812
3442
|
}
|