@colbymchenry/codegraph-win32-arm64 1.5.0 → 1.6.1
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 +744 -320
- package/lib/dist/bin/codegraph.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/formatter.d.ts +7 -1
- package/lib/dist/context/formatter.d.ts.map +1 -1
- package/lib/dist/context/formatter.js +12 -6
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +12 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +103 -16
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +58 -2
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +187 -32
- 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 +64 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +583 -6
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1417 -57
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +27 -4
- 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 +130 -2
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +306 -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/cfml-extractor.d.ts +1 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +15 -3
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- 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 +41 -14
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +48 -12
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +176 -11
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +38 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +115 -3
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +218 -14
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +874 -176
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +58 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +310 -19
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +8 -3
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +58 -22
- package/lib/dist/extraction/languages/erlang.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.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +169 -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/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +4 -0
- package/lib/dist/extraction/languages/objc.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 +20 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +50 -20
- 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/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +9 -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-pool.d.ts +7 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +20 -1
- package/lib/dist/extraction/parse-pool.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 +381 -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 +31 -3
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +101 -18
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +926 -132
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- 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 +248 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -0
- package/lib/dist/graph/branch-guards.js +2231 -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 +552 -0
- package/lib/dist/graph/named-symbol-flow.js.map +1 -0
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -0
- package/lib/dist/graph/queries.js.map +1 -1
- 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 +62 -36
- 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 +273 -11
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +511 -34
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +4 -3
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +11 -8
- 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 +72 -12
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +23 -8
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +74 -47
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-cli.js +215 -0
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.js +219 -0
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
- 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/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +6 -0
- package/lib/dist/installer/targets/registry.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/toml.d.ts +6 -5
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +99 -20
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +12 -5
- 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 +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +17 -1
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +8 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +65 -2
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +17 -4
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +133 -23
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +26 -13
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +126 -32
- 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 +31 -9
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +190 -64
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +140 -0
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/lib/dist/mcp/explore-dedup.js +239 -0
- package/lib/dist/mcp/explore-dedup.js.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.js +558 -0
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.d.ts +217 -0
- package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +322 -0
- package/lib/dist/mcp/explore-session-state.js.map +1 -0
- 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 +30 -0
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
- package/lib/dist/mcp/index-freshness.d.ts +7 -0
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness.js +94 -0
- package/lib/dist/mcp/index-freshness.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +27 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +159 -14
- 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 +14 -3
- 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 +181 -0
- package/lib/dist/mcp/project-lifecycle.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +15 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +2 -2
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +9 -7
- 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 +2 -2
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +13 -5
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +16 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +36 -13
- package/lib/dist/mcp/session.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 +544 -38
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +4246 -770
- 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/project-config.d.ts +23 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +39 -2
- package/lib/dist/project-config.js.map +1 -1
- 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 +127 -0
- package/lib/dist/resolution/alias-binding.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +21 -19
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- 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 +330 -154
- 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 +342 -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/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +96 -2
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +189 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-router.js +785 -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 +251 -16
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +5 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +29 -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 +79 -47
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +6 -14
- 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 +328 -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/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +166 -0
- 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 +46 -0
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-router.js +187 -0
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +2 -1
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +188 -139
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.js +6 -1
- 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 +11 -1
- 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 +82 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.js +377 -0
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
- package/lib/dist/resolution/import-resolver.d.ts +38 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +394 -28
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +89 -25
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +567 -149
- 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 +46 -0
- package/lib/dist/resolution/js-builtins.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +99 -22
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +2192 -87
- 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/path-aliases.d.ts +6 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +125 -17
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.d.ts +33 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.js +126 -0
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/resolver-pool.d.ts +2 -0
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +4 -0
- package/lib/dist/resolution/resolver-pool.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/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 +49 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.js +931 -0
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +78 -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/identifier-segments.d.ts +10 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -1
- package/lib/dist/search/identifier-segments.js +29 -0
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-paths.d.ts +106 -0
- package/lib/dist/search/query-paths.d.ts.map +1 -0
- package/lib/dist/search/query-paths.js +513 -0
- package/lib/dist/search/query-paths.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +16 -1
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +48 -10
- 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 +74 -35
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +281 -99
- package/lib/dist/sync/watcher.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 +92 -41
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +21 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +2 -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 +87 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
- package/lib/dist/ui-server/api/effects.js +499 -0
- package/lib/dist/ui-server/api/effects.js.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts +86 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.js +279 -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 +238 -0
- package/lib/dist/ui-server/api/map.d.ts.map +1 -0
- package/lib/dist/ui-server/api/map.js +681 -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 +388 -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 +39 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/lib/dist/ui-server/api/route-roots.js +96 -0
- package/lib/dist/ui-server/api/route-roots.js.map +1 -0
- package/lib/dist/ui-server/api/routes.d.ts +59 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/routes.js +108 -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 +611 -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 +1446 -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 +369 -0
- package/lib/dist/ui-server/api/trails.js.map +1 -0
- package/lib/dist/ui-server/api/when.d.ts +125 -0
- package/lib/dist/ui-server/api/when.d.ts.map +1 -0
- package/lib/dist/ui-server/api/when.js +251 -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/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 +307 -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/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/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-CF9yvio6.css +1 -0
- package/lib/dist/viewer/assets/index-D4S7YUPf.js +97 -0
- package/lib/dist/viewer/index.html +16 -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,12 +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;
|
|
51
|
+
exports.getGitChangedFiles = getGitChangedFiles;
|
|
52
|
+
exports.getGitHeadSha = getGitHeadSha;
|
|
53
|
+
exports.canTrustGitFastPath = canTrustGitFastPath;
|
|
50
54
|
exports.scanDirectory = scanDirectory;
|
|
51
55
|
exports.scanDirectoryAsync = scanDirectoryAsync;
|
|
52
56
|
const fs = __importStar(require("fs"));
|
|
@@ -59,6 +63,7 @@ const tree_sitter_1 = require("./tree-sitter");
|
|
|
59
63
|
const parse_pool_1 = require("./parse-pool");
|
|
60
64
|
const store_writer_1 = require("./store-writer");
|
|
61
65
|
const kernel_1 = require("./kernel");
|
|
66
|
+
const generated_detection_1 = require("./generated-detection");
|
|
62
67
|
const grammars_1 = require("./grammars");
|
|
63
68
|
const project_config_1 = require("../project-config");
|
|
64
69
|
const directory_1 = require("../directory");
|
|
@@ -67,6 +72,8 @@ const utils_1 = require("../utils");
|
|
|
67
72
|
const ignore_1 = __importDefault(require("ignore"));
|
|
68
73
|
const frameworks_1 = require("../resolution/frameworks");
|
|
69
74
|
const cooperative_yield_1 = require("../resolution/cooperative-yield");
|
|
75
|
+
const file_limits_1 = require("../file-limits");
|
|
76
|
+
Object.defineProperty(exports, "oversizeStamp", { enumerable: true, get: function () { return file_limits_1.oversizeStamp; } });
|
|
70
77
|
/**
|
|
71
78
|
* Number of files to read in parallel during indexing.
|
|
72
79
|
* File reads are I/O-bound; batching overlaps I/O wait with CPU parse work.
|
|
@@ -106,11 +113,26 @@ function hashContent(content) {
|
|
|
106
113
|
return crypto.createHash('sha256').update(content).digest('hex');
|
|
107
114
|
}
|
|
108
115
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
116
|
+
* What change detection hashes for a file: its text when it is under the size
|
|
117
|
+
* limit, the size stamp when it is over — an oversize file is never decoded.
|
|
118
|
+
* `null` when the bytes show a `.ts` file is an MPEG transport stream, not
|
|
119
|
+
* TypeScript (#1910): decided from the bytes already read, so it costs no I/O
|
|
120
|
+
* and runs only for a file that is new or changed — never once per `.ts` file
|
|
121
|
+
* at discovery, which on a slow disk is a random read per file per scan.
|
|
112
122
|
*/
|
|
113
|
-
|
|
123
|
+
function readSourceOrStamp(fullPath) {
|
|
124
|
+
const { stats, bytes } = (0, file_limits_1.readBoundedSourceSync)(fullPath);
|
|
125
|
+
if (bytes === null)
|
|
126
|
+
return (0, file_limits_1.oversizeStamp)(stats.size);
|
|
127
|
+
return isMpegTsBytes(fullPath, bytes) ? null : bytes.toString('utf8');
|
|
128
|
+
}
|
|
129
|
+
/** Whether these bytes, read from `filePath`, are a `.ts` MPEG transport stream (#1910). */
|
|
130
|
+
function isMpegTsBytes(filePath, bytes) {
|
|
131
|
+
if (!(0, grammars_1.hasMpegTsExtension)(filePath) || !(0, grammars_1.isMpegTransportStream)(bytes.subarray(0, grammars_1.MPEG_TS_SNIFF_BYTES)))
|
|
132
|
+
return false;
|
|
133
|
+
(0, errors_1.logDebug)('Skipping MPEG transport stream named .ts — not TypeScript', { filePath });
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
114
136
|
/**
|
|
115
137
|
* Directory names that are dependency, build, cache, or tooling output across the
|
|
116
138
|
* languages/frameworks CodeGraph supports — curated from the canonical
|
|
@@ -190,6 +212,13 @@ const DEFAULT_IGNORE_PATTERNS = [
|
|
|
190
212
|
'bazel-*/', // Bazel output symlink trees
|
|
191
213
|
// Android resource dirs at any depth, with their qualifier variants (#1047).
|
|
192
214
|
...ANDROID_RES_TYPES.map((t) => `**/res/${t}*/`),
|
|
215
|
+
// `build` is also a legal JVM package segment. Keep it under conventional
|
|
216
|
+
// source roots (any source set: main, test, androidTest, ...) while continuing
|
|
217
|
+
// to exclude module/build output (#1642). Unignore only the directory, not its
|
|
218
|
+
// subtree: other defaults still apply.
|
|
219
|
+
'!**/src/*/java/**/build/',
|
|
220
|
+
'!**/src/*/kotlin/**/build/',
|
|
221
|
+
'!**/src/*/scala/**/build/',
|
|
193
222
|
];
|
|
194
223
|
/** True if `buf` decodes as strict UTF-8 (no invalid byte sequences). */
|
|
195
224
|
function isValidUtf8(buf) {
|
|
@@ -259,18 +288,119 @@ function readGitignorePatterns(giPath) {
|
|
|
259
288
|
}
|
|
260
289
|
return kept.join('\n');
|
|
261
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Resolve the repository GIT_DIR for `repoRoot` (a `.git` directory, or the
|
|
293
|
+
* target of a `.git` file pointer). Null when this isn't a git checkout.
|
|
294
|
+
*/
|
|
295
|
+
function resolveGitDir(repoRoot) {
|
|
296
|
+
const gitPath = path.join(repoRoot, '.git');
|
|
297
|
+
let st;
|
|
298
|
+
try {
|
|
299
|
+
st = fs.statSync(gitPath);
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
if (st.isDirectory())
|
|
305
|
+
return gitPath;
|
|
306
|
+
if (!st.isFile())
|
|
307
|
+
return null;
|
|
308
|
+
try {
|
|
309
|
+
const raw = fs.readFileSync(gitPath, 'utf8').match(/^gitdir:\s*(.+)$/m)?.[1]?.trim();
|
|
310
|
+
if (!raw)
|
|
311
|
+
return null;
|
|
312
|
+
return path.isAbsolute(raw) ? path.normalize(raw) : path.resolve(repoRoot, raw);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/** Expand a leading `~/` the way git does for `core.excludesFile`. */
|
|
319
|
+
function expandUserPath(p) {
|
|
320
|
+
if (p === '~')
|
|
321
|
+
return os.homedir();
|
|
322
|
+
if (p.startsWith('~/'))
|
|
323
|
+
return path.join(os.homedir(), p.slice(2));
|
|
324
|
+
return p;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Root-relative exclude patterns from git sources that are NOT the root
|
|
328
|
+
* `.gitignore`: `.git/info/exclude` and `core.excludesFile`. Same semantics as
|
|
329
|
+
* the root `.gitignore`, so they merge into {@link buildDefaultIgnore}. Without
|
|
330
|
+
* these, the watcher / FS-walk scope silently diverged from
|
|
331
|
+
* `git ls-files --exclude-standard` (#1728).
|
|
332
|
+
*/
|
|
333
|
+
function readGitExcludeExtraPatterns(rootDir) {
|
|
334
|
+
const chunks = [];
|
|
335
|
+
const gitDir = resolveGitDir(rootDir);
|
|
336
|
+
if (gitDir) {
|
|
337
|
+
const excludePath = path.join(gitDir, 'info', 'exclude');
|
|
338
|
+
if (fs.existsSync(excludePath)) {
|
|
339
|
+
const patterns = readGitignorePatterns(excludePath);
|
|
340
|
+
if (patterns)
|
|
341
|
+
chunks.push(patterns);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
try {
|
|
345
|
+
const configured = (0, child_process_1.execFileSync)('git', ['-C', rootDir, 'config', '--get', 'core.excludesFile'], { encoding: 'utf8', timeout: 5_000, stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
346
|
+
if (configured) {
|
|
347
|
+
const abs = expandUserPath(configured);
|
|
348
|
+
if (fs.existsSync(abs)) {
|
|
349
|
+
const patterns = readGitignorePatterns(abs);
|
|
350
|
+
if (patterns)
|
|
351
|
+
chunks.push(patterns);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
// No git, unset, or timeout — leave extras empty.
|
|
357
|
+
}
|
|
358
|
+
return chunks.join('\n');
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Directories `git ls-files -o -i --exclude-standard --directory` reports as
|
|
362
|
+
* ignored-untracked. Seeded into {@link ScopeIgnore} so nested `.gitignore`
|
|
363
|
+
* effects (and any exclude-standard rule the flat matcher might miss) prune the
|
|
364
|
+
* watcher the same way the indexer skips them (#1728).
|
|
365
|
+
*/
|
|
366
|
+
function listGitIgnoredDirectories(rootDir) {
|
|
367
|
+
try {
|
|
368
|
+
const out = (0, child_process_1.execFileSync)('git', ['-C', rootDir, 'ls-files', '-z', '-o', '-i', '--exclude-standard', '--directory'], {
|
|
369
|
+
encoding: 'utf8',
|
|
370
|
+
timeout: 60_000,
|
|
371
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
372
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
373
|
+
});
|
|
374
|
+
const dirs = [];
|
|
375
|
+
for (const entry of out.split('\0')) {
|
|
376
|
+
if (!entry)
|
|
377
|
+
continue;
|
|
378
|
+
dirs.push(entry.endsWith('/') ? entry : `${entry}/`);
|
|
379
|
+
}
|
|
380
|
+
return dirs;
|
|
381
|
+
}
|
|
382
|
+
catch {
|
|
383
|
+
return [];
|
|
384
|
+
}
|
|
385
|
+
}
|
|
262
386
|
/**
|
|
263
387
|
* An `ignore` matcher seeded with the built-in defaults, merged with the project's
|
|
264
|
-
* root .gitignore so a negation there (e.g. `!vendor/`) overrides a default
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
388
|
+
* root .gitignore so a negation there (e.g. `!vendor/`) overrides a default, plus
|
|
389
|
+
* git's other root-relative exclude files (`.git/info/exclude`, `core.excludesFile`)
|
|
390
|
+
* so watcher / FS-walk scope matches `git ls-files --exclude-standard` (#1728).
|
|
391
|
+
* Shared by both enumeration paths so behavior is identical with or without git —
|
|
392
|
+
* and so the defaults apply to tracked files too (committing a dependency dir
|
|
393
|
+
* doesn't make it project code; the explicit `.gitignore` negation is the only
|
|
394
|
+
* opt-in).
|
|
268
395
|
*/
|
|
269
396
|
function buildDefaultIgnore(rootDir) {
|
|
270
397
|
const ig = (0, ignore_1.default)().add(DEFAULT_IGNORE_PATTERNS);
|
|
271
398
|
const rootGitignore = path.join(rootDir, '.gitignore');
|
|
272
399
|
if (fs.existsSync(rootGitignore))
|
|
273
400
|
ig.add(readGitignorePatterns(rootGitignore));
|
|
401
|
+
const extra = readGitExcludeExtraPatterns(rootDir);
|
|
402
|
+
if (extra)
|
|
403
|
+
ig.add(extra);
|
|
274
404
|
return ig;
|
|
275
405
|
}
|
|
276
406
|
/**
|
|
@@ -589,15 +719,38 @@ function findNestedGitRepos(absDir, relPrefix) {
|
|
|
589
719
|
}
|
|
590
720
|
/**
|
|
591
721
|
* Workspace-scope ignore matcher. Ordinary paths get the root's matcher
|
|
592
|
-
* (built-in defaults + root `.gitignore`
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
722
|
+
* (built-in defaults + root `.gitignore` + `.git/info/exclude` +
|
|
723
|
+
* `core.excludesFile`, plus directories `git ls-files --exclude-standard`
|
|
724
|
+
* reports as ignored); paths inside an EMBEDDED repo get that repo's own
|
|
725
|
+
* matcher — the parent's `.gitignore` hides a child repo from git, not from
|
|
726
|
+
* the index (#514). A directory path (trailing slash) that is an ANCESTOR of
|
|
727
|
+
* an embedded root is never ignored, so directory-pruning callers (the Linux
|
|
728
|
+
* per-directory watcher) still descend to reach the embedded repos.
|
|
729
|
+
*
|
|
730
|
+
* Shared by the indexer (scoped sync / skip checks) and the watcher so their
|
|
731
|
+
* scope cannot diverge from each other or from `git ls-files --exclude-standard`
|
|
732
|
+
* (#1728).
|
|
733
|
+
*/
|
|
734
|
+
/**
|
|
735
|
+
* The grammars to preload for a file set.
|
|
598
736
|
*
|
|
599
|
-
*
|
|
737
|
+
* Path-only detection calls every `.h` file C, but parse-time detection reads
|
|
738
|
+
* the source and can reclassify it as C++ or Objective-C (`detectLanguage`
|
|
739
|
+
* with a `source` argument). Workers only ever get the grammars named here, so
|
|
740
|
+
* a header that turns out to be Objective-C in a project with no `.m` file
|
|
741
|
+
* found no parser and failed with `Failed to get parser for language: objc`
|
|
742
|
+
* (#1628). C++ was already covered; Objective-C was not.
|
|
600
743
|
*/
|
|
744
|
+
function preloadLanguagesForFiles(files, overrides) {
|
|
745
|
+
const languages = [...new Set(files.map((f) => (0, grammars_1.detectLanguage)(f, undefined, overrides)))];
|
|
746
|
+
if (languages.includes('c')) {
|
|
747
|
+
for (const ambiguous of ['cpp', 'objc']) {
|
|
748
|
+
if (!languages.includes(ambiguous))
|
|
749
|
+
languages.push(ambiguous);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return languages;
|
|
753
|
+
}
|
|
601
754
|
class ScopeIgnore {
|
|
602
755
|
rootMatcher;
|
|
603
756
|
exclude;
|
|
@@ -676,7 +829,14 @@ exports.ScopeIgnore = ScopeIgnore;
|
|
|
676
829
|
function buildScopeIgnore(rootDir, embeddedRoots) {
|
|
677
830
|
const roots = embeddedRoots ? [...embeddedRoots] : discoverEmbeddedRepoRoots(rootDir);
|
|
678
831
|
const include = loadIncludeMatcher(rootDir);
|
|
679
|
-
|
|
832
|
+
// Root matcher already has defaults + root `.gitignore` + info/exclude +
|
|
833
|
+
// core.excludesFile. Seed ignored-untracked directories from git so nested
|
|
834
|
+
// `.gitignore` effects prune the watcher identically to the indexer (#1728).
|
|
835
|
+
const rootMatcher = buildDefaultIgnore(rootDir);
|
|
836
|
+
for (const dir of listGitIgnoredDirectories(rootDir)) {
|
|
837
|
+
rootMatcher.add(dir);
|
|
838
|
+
}
|
|
839
|
+
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)) : []);
|
|
680
840
|
}
|
|
681
841
|
/**
|
|
682
842
|
* Whether an embedded repo found as a tracked gitlink (mode 160000, #1031/#1033)
|
|
@@ -743,7 +903,7 @@ function discoverEmbeddedRepoRoots(rootDir) {
|
|
|
743
903
|
// same way collectGitFiles does, keeping watcher scope == indexer scope.
|
|
744
904
|
// (#1031, #1033)
|
|
745
905
|
try {
|
|
746
|
-
const staged = (
|
|
906
|
+
const staged = lsFilesStaged({ cwd: repoAbs, encoding: 'utf-8', timeout: 30000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
747
907
|
const repoIgnore = buildDefaultIgnore(repoAbs);
|
|
748
908
|
for (const entry of staged.split('\0')) {
|
|
749
909
|
if (!entry || entry.slice(0, 6) !== '160000')
|
|
@@ -863,6 +1023,30 @@ function findIgnoredEmbeddedRepos(repoDir, includeIgnored, prefix) {
|
|
|
863
1023
|
}
|
|
864
1024
|
return repos;
|
|
865
1025
|
}
|
|
1026
|
+
/**
|
|
1027
|
+
* `git ls-files -z -s`, expanding submodules where git allows it.
|
|
1028
|
+
*
|
|
1029
|
+
* `--recurse-submodules` could not be combined with `-s` before git 2.36:
|
|
1030
|
+
* `builtin/ls-files.c` listed `show_stage` among the modes that die, and the
|
|
1031
|
+
* check is unconditional — it does not look at whether the repo actually has
|
|
1032
|
+
* submodules, so every call fails on older git. Ubuntu 22.04 LTS (2.34.1) and
|
|
1033
|
+
* Debian 11 (2.30.2) are both below that line.
|
|
1034
|
+
*
|
|
1035
|
+
* Letting the throw escape cost far more than submodule expansion: it unwound
|
|
1036
|
+
* the whole git-visible pass, so `includeIgnored`, gitlink recursion and the
|
|
1037
|
+
* `codegraph.json` include allowlist silently stopped applying and files went
|
|
1038
|
+
* missing from the index with no error (#1549). Retry without the flag instead
|
|
1039
|
+
* — `-s` is the part that matters here, since gitlink detection reads the mode
|
|
1040
|
+
* bits, and embedded repos are reached through the gitlink recursion anyway.
|
|
1041
|
+
*/
|
|
1042
|
+
function lsFilesStaged(gitOpts) {
|
|
1043
|
+
try {
|
|
1044
|
+
return (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s', '--recurse-submodules'], gitOpts);
|
|
1045
|
+
}
|
|
1046
|
+
catch {
|
|
1047
|
+
return (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s'], gitOpts);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
866
1050
|
/**
|
|
867
1051
|
* Collect git-visible files (tracked + untracked, .gitignore-respected) from the
|
|
868
1052
|
* git repository rooted at `repoDir`, adding each to `files` with `prefix`
|
|
@@ -907,7 +1091,7 @@ function collectGitFiles(repoDir, prefix, files, embeddedRoots, includeIgnored =
|
|
|
907
1091
|
// on disk → those files are silently dropped from the index. (#541) With -s the
|
|
908
1092
|
// path follows a TAB after the `<mode> <object> <stage>` prefix.
|
|
909
1093
|
const gitlinkRels = [];
|
|
910
|
-
const tracked = (
|
|
1094
|
+
const tracked = lsFilesStaged(gitOpts);
|
|
911
1095
|
for (const entry of tracked.split('\0')) {
|
|
912
1096
|
if (!entry)
|
|
913
1097
|
continue;
|
|
@@ -998,6 +1182,10 @@ function getGitVisibleFiles(rootDir) {
|
|
|
998
1182
|
// git check-ignore exits 0 if the path IS ignored, 1 if not
|
|
999
1183
|
(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 });
|
|
1000
1184
|
// Directory is gitignored by parent repo — fall back to filesystem walk
|
|
1185
|
+
(0, errors_1.logDebug)('project root is gitignored by a parent repo — falling back to filesystem walk', {
|
|
1186
|
+
rootDir,
|
|
1187
|
+
gitRoot,
|
|
1188
|
+
});
|
|
1001
1189
|
return null;
|
|
1002
1190
|
}
|
|
1003
1191
|
catch {
|
|
@@ -1024,7 +1212,20 @@ function getGitVisibleFiles(rootDir) {
|
|
|
1024
1212
|
visible.add(f);
|
|
1025
1213
|
return visible;
|
|
1026
1214
|
}
|
|
1027
|
-
catch {
|
|
1215
|
+
catch (error) {
|
|
1216
|
+
// Any failure here (git missing, a `git rev-parse`/`ls-files` timeout or
|
|
1217
|
+
// buffer overrun under load, an unreadable repo, unsupported flag combo on
|
|
1218
|
+
// older git, etc.) silently sent every caller to `scanDirectoryWalk` with
|
|
1219
|
+
// zero signal that the fast git-delegated path was skipped — making reports
|
|
1220
|
+
// like #1567 (nested-`.gitignore`-excluded `node_modules` walked into)
|
|
1221
|
+
// hard to triage, since both ignore implementations look correct in
|
|
1222
|
+
// isolation but there was no way to tell which one ran. Log it under the
|
|
1223
|
+
// existing CODEGRAPH_DEBUG gate so a future report can confirm or rule out
|
|
1224
|
+
// the fallback in one step.
|
|
1225
|
+
(0, errors_1.logDebug)('git-based file listing unavailable — falling back to filesystem walk', {
|
|
1226
|
+
rootDir,
|
|
1227
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1228
|
+
});
|
|
1028
1229
|
return null;
|
|
1029
1230
|
}
|
|
1030
1231
|
}
|
|
@@ -1042,21 +1243,102 @@ function getGitVisibleFiles(rootDir) {
|
|
|
1042
1243
|
* case this cannot see (the child status that would report the deletions is gone
|
|
1043
1244
|
* with it); a full `codegraph index` reconciles that.
|
|
1044
1245
|
*/
|
|
1045
|
-
function getGitChangedFiles(rootDir) {
|
|
1246
|
+
function getGitChangedFiles(rootDir, sinceCommit) {
|
|
1046
1247
|
try {
|
|
1248
|
+
// `git status` only ever describes the WORKING TREE, so a change that has
|
|
1249
|
+
// been committed leaves no entry and never enters the candidate set — the
|
|
1250
|
+
// hash comparison in getChangedFiles is correct but is never reached for
|
|
1251
|
+
// it, and `pendingChanges` reads 0 while the index is genuinely behind
|
|
1252
|
+
// (#1829). `sinceCommit` — the commit the index was last brought up to
|
|
1253
|
+
// date at — adds the other half: what has been committed since. Callers
|
|
1254
|
+
// that hold no such stamp still get exactly what they always did, the
|
|
1255
|
+
// working-tree changes.
|
|
1047
1256
|
const changes = { modified: [], added: [], deleted: [] };
|
|
1048
1257
|
// Custom extension → language overrides from the project's codegraph.json,
|
|
1049
1258
|
// so change detection sees the same custom-extension files the full index does.
|
|
1050
1259
|
const overrides = (0, project_config_1.loadExtensionOverrides)(rootDir);
|
|
1051
|
-
collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir));
|
|
1260
|
+
collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir), sinceCommit ?? undefined);
|
|
1052
1261
|
return changes;
|
|
1053
1262
|
}
|
|
1054
1263
|
catch {
|
|
1055
1264
|
return null;
|
|
1056
1265
|
}
|
|
1057
1266
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1267
|
+
/**
|
|
1268
|
+
* Metadata key: the commit the index was last brought up to date at. Written by
|
|
1269
|
+
* a full index AND by every successful sync — unlike the extraction stamp, which
|
|
1270
|
+
* a sync must not advance because it only touches a subset of files. This one is
|
|
1271
|
+
* about the tree; failed file paths remain explicit retry candidates. (#1829)
|
|
1272
|
+
*/
|
|
1273
|
+
exports.INDEXED_AT_COMMIT_KEY = 'indexed_at_commit';
|
|
1274
|
+
/** HEAD's commit sha, or null in a non-git repo or one with no commits yet. */
|
|
1275
|
+
function getGitHeadSha(rootDir) {
|
|
1276
|
+
try {
|
|
1277
|
+
return (0, child_process_1.execFileSync)('git', ['rev-parse', 'HEAD'], {
|
|
1278
|
+
cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
1279
|
+
}).trim() || null;
|
|
1280
|
+
}
|
|
1281
|
+
catch {
|
|
1282
|
+
return null;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* NUL-delimited status/path pairs for every path committed
|
|
1287
|
+
* between `sinceCommit` and HEAD. Empty when the stamp IS HEAD, which is the
|
|
1288
|
+
* common case — one cheap git call on the hot path.
|
|
1289
|
+
*/
|
|
1290
|
+
function gitCommittedChangesSince(repoDir, sinceCommit) {
|
|
1291
|
+
// NUL framing preserves Unicode, quotes, tabs and newlines in Git paths.
|
|
1292
|
+
// Let command failures reach getGitChangedFiles: [] would falsely mean clean.
|
|
1293
|
+
const out = (0, child_process_1.execFileSync)('git', ['diff', '--relative', '--name-status', '--no-renames', '-z', sinceCommit, 'HEAD', '--', '.'], {
|
|
1294
|
+
cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
1295
|
+
});
|
|
1296
|
+
return out.split('\0');
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Can an INDEX trust the git fast path, given the commit it was built at?
|
|
1300
|
+
*
|
|
1301
|
+
* False means "fall back to the full scan" — the expensive path that compares
|
|
1302
|
+
* every file on disk against the DB, and the only correct read when git cannot
|
|
1303
|
+
* say what happened between the stamp and now:
|
|
1304
|
+
*
|
|
1305
|
+
* - stamp present but unknown to this repo (rebase, gc, shallow clone, a stamp
|
|
1306
|
+
* from a different checkout) — history moved under the index.
|
|
1307
|
+
* - stamp absent while the repo HAS commits — an index built before stamping
|
|
1308
|
+
* existed. One full scan; the next sync stamps it and the fast path returns.
|
|
1309
|
+
*
|
|
1310
|
+
* A repo with NO commits keeps the fast path with or without a stamp: every
|
|
1311
|
+
* file is untracked, so `git status` already sees all of them. Callers with no
|
|
1312
|
+
* index behind them (the exported `getGitChangedFiles`) never ask this — a
|
|
1313
|
+
* working-tree diff is the whole of what they wanted. (#1829)
|
|
1314
|
+
*/
|
|
1315
|
+
function canTrustGitFastPath(rootDir, sinceCommit) {
|
|
1316
|
+
const head = getGitHeadSha(rootDir);
|
|
1317
|
+
if (head == null)
|
|
1318
|
+
return true; // no commits (or not a git repo — caller handles that)
|
|
1319
|
+
if (!sinceCommit)
|
|
1320
|
+
return false;
|
|
1321
|
+
if (sinceCommit === head)
|
|
1322
|
+
return true;
|
|
1323
|
+
try {
|
|
1324
|
+
(0, child_process_1.execFileSync)('git', ['cat-file', '-e', `${sinceCommit}^{commit}`], {
|
|
1325
|
+
cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
1326
|
+
});
|
|
1327
|
+
return true;
|
|
1328
|
+
}
|
|
1329
|
+
catch {
|
|
1330
|
+
return false;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null, exclude = null, sinceCommit) {
|
|
1334
|
+
const output = (0, child_process_1.execFileSync)('git',
|
|
1335
|
+
// `-uall` lists individual untracked files instead of collapsing an
|
|
1336
|
+
// entirely-untracked directory into one `?? dir/` entry, which would
|
|
1337
|
+
// otherwise be dropped here (only embedded git repos are recursed into
|
|
1338
|
+
// below). Nested untracked git repos still collapse to `?? repo/` even
|
|
1339
|
+
// with `-uall` — git never crosses a repo boundary — so the recursion
|
|
1340
|
+
// still handles them. (#1213)
|
|
1341
|
+
['status', '--porcelain', '--no-renames', '-z', '-uall'], { cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
1060
1342
|
// This repo's own ignore rules — built-in defaults (#407) plus its .gitignore.
|
|
1061
1343
|
// Change detection must exclude the SAME files the full index does, but git
|
|
1062
1344
|
// status hides neither: it ignores nothing for *tracked* paths, and the
|
|
@@ -1068,45 +1350,63 @@ function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null
|
|
|
1068
1350
|
// ScopeIgnore: every embedded repo is judged by ITS OWN rules, never the
|
|
1069
1351
|
// parent's. (#766)
|
|
1070
1352
|
const ig = buildDefaultIgnore(repoDir);
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
continue; // Minimum: "XY file"
|
|
1075
|
-
const statusCode = line.substring(0, 2);
|
|
1076
|
-
const rel = (0, utils_1.normalizePath)(line.substring(3));
|
|
1077
|
-
// Untracked directory entries (trailing slash) may hide an embedded repo —
|
|
1078
|
-
// collect for the recursion below instead of treating as a file.
|
|
1079
|
-
if (statusCode === '??' && rel.endsWith('/')) {
|
|
1080
|
-
untrackedDirs.push(rel);
|
|
1081
|
-
continue;
|
|
1082
|
-
}
|
|
1353
|
+
// One classifier for both candidate sources below, so a committed change is
|
|
1354
|
+
// filtered by exactly the rules a working-tree change is (#766, #999, #1829).
|
|
1355
|
+
const classify = (statusCode, rel) => {
|
|
1083
1356
|
const filePath = (0, utils_1.normalizePath)(prefix + rel);
|
|
1084
1357
|
if (!(0, grammars_1.isSourceFile)(filePath, overrides))
|
|
1085
|
-
|
|
1358
|
+
return;
|
|
1086
1359
|
if (statusCode.includes('D')) {
|
|
1087
1360
|
// Deletions stay unfiltered: getChangedFiles acts on one only when the
|
|
1088
1361
|
// path is already tracked in the DB, where removal is always correct — and
|
|
1089
1362
|
// that lets a newly-excluded dir's stale rows clean themselves up. (#766)
|
|
1090
1363
|
out.deleted.push(filePath);
|
|
1091
|
-
|
|
1364
|
+
return;
|
|
1092
1365
|
}
|
|
1093
1366
|
// Added (`??`) / modified files inside an excluded dir must not enter the
|
|
1094
1367
|
// index — match against the repo-relative path, same as the full scan. (#766)
|
|
1095
1368
|
if (ig.ignores(rel))
|
|
1096
|
-
|
|
1369
|
+
return;
|
|
1097
1370
|
// User `codegraph.json` `exclude` (#999) is project-root-relative, so it's
|
|
1098
1371
|
// matched against the full path — sync must not re-add a tracked file the
|
|
1099
1372
|
// full index now keeps out. Deletions above stay unfiltered so a file that
|
|
1100
1373
|
// WAS indexed before an exclude was added still cleans itself out.
|
|
1101
1374
|
if (exclude && exclude.ignores(filePath))
|
|
1102
|
-
|
|
1375
|
+
return;
|
|
1103
1376
|
if (statusCode === '??') {
|
|
1104
1377
|
out.added.push(filePath);
|
|
1105
1378
|
}
|
|
1106
1379
|
else {
|
|
1107
|
-
// M, MM, AM, A (staged), etc. — treat as modified
|
|
1380
|
+
// M, MM, AM, A (staged), etc. — treat as modified. getChangedFiles
|
|
1381
|
+
// re-decides added-vs-modified from the DB, so a committed `A` that the
|
|
1382
|
+
// index never saw still lands in `added`.
|
|
1108
1383
|
out.modified.push(filePath);
|
|
1109
1384
|
}
|
|
1385
|
+
};
|
|
1386
|
+
const untrackedDirs = [];
|
|
1387
|
+
for (const line of output.split('\0')) {
|
|
1388
|
+
if (line.length < 4)
|
|
1389
|
+
continue; // Minimum: "XY file"
|
|
1390
|
+
const statusCode = line.substring(0, 2);
|
|
1391
|
+
const rel = (0, utils_1.normalizePath)(line.substring(3));
|
|
1392
|
+
// Untracked directory entries (trailing slash) may hide an embedded repo —
|
|
1393
|
+
// collect for the recursion below instead of treating as a file.
|
|
1394
|
+
if (statusCode === '??' && rel.endsWith('/')) {
|
|
1395
|
+
untrackedDirs.push(rel);
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
classify(statusCode, rel);
|
|
1399
|
+
}
|
|
1400
|
+
// Committed but unindexed: everything between the commit this index was last
|
|
1401
|
+
// brought up to date at and HEAD. `git status` cannot see these — committing
|
|
1402
|
+
// is precisely what removes a file from its output — so without this pass a
|
|
1403
|
+
// `git commit` makes a real pending change read as zero (#1829). The stamp
|
|
1404
|
+
// belongs to the ROOT repo, so the embedded-repo recursion below passes none.
|
|
1405
|
+
if (sinceCommit) {
|
|
1406
|
+
const fields = gitCommittedChangesSince(repoDir, sinceCommit);
|
|
1407
|
+
for (let i = 0; i + 1 < fields.length; i += 2) {
|
|
1408
|
+
classify(`${fields[i].charAt(0)} `, (0, utils_1.normalizePath)(fields[i + 1]));
|
|
1409
|
+
}
|
|
1110
1410
|
}
|
|
1111
1411
|
// Recurse embedded repos found under untracked dirs (at the dir itself or
|
|
1112
1412
|
// nested deeper). Gitignored dirs are walked only for the directories the
|
|
@@ -1148,11 +1448,16 @@ function scanDirectory(rootDir, onProgress) {
|
|
|
1148
1448
|
// Fallback: walk filesystem for non-git projects
|
|
1149
1449
|
return scanDirectoryWalk(rootDir, onProgress);
|
|
1150
1450
|
}
|
|
1151
|
-
/**
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1451
|
+
/** Record one file the scan declined to index. */
|
|
1452
|
+
function tallySkip(stats, rel) {
|
|
1453
|
+
if (!stats)
|
|
1454
|
+
return;
|
|
1455
|
+
const ext = path.extname(rel).toLowerCase();
|
|
1456
|
+
if (!ext)
|
|
1457
|
+
return;
|
|
1458
|
+
stats.unsupportedByExtension.set(ext, (stats.unsupportedByExtension.get(ext) ?? 0) + 1);
|
|
1459
|
+
}
|
|
1460
|
+
async function scanDirectoryAsync(rootDir, onProgress, stats) {
|
|
1156
1461
|
// Custom extension → language overrides from the project's codegraph.json.
|
|
1157
1462
|
const overrides = (0, project_config_1.loadExtensionOverrides)(rootDir);
|
|
1158
1463
|
const gitFiles = getGitVisibleFiles(rootDir);
|
|
@@ -1169,15 +1474,18 @@ async function scanDirectoryAsync(rootDir, onProgress) {
|
|
|
1169
1474
|
await new Promise(r => setImmediate(r));
|
|
1170
1475
|
}
|
|
1171
1476
|
}
|
|
1477
|
+
else {
|
|
1478
|
+
tallySkip(stats, filePath);
|
|
1479
|
+
}
|
|
1172
1480
|
}
|
|
1173
1481
|
return files;
|
|
1174
1482
|
}
|
|
1175
|
-
return scanDirectoryWalk(rootDir, onProgress);
|
|
1483
|
+
return scanDirectoryWalk(rootDir, onProgress, stats);
|
|
1176
1484
|
}
|
|
1177
1485
|
/**
|
|
1178
1486
|
* Filesystem walk fallback for non-git projects.
|
|
1179
1487
|
*/
|
|
1180
|
-
function scanDirectoryWalk(rootDir, onProgress) {
|
|
1488
|
+
function scanDirectoryWalk(rootDir, onProgress, stats) {
|
|
1181
1489
|
const files = [];
|
|
1182
1490
|
let count = 0;
|
|
1183
1491
|
const visitedDirs = new Set();
|
|
@@ -1249,10 +1557,15 @@ function scanDirectoryWalk(rootDir, onProgress) {
|
|
|
1249
1557
|
}
|
|
1250
1558
|
}
|
|
1251
1559
|
else if (stat.isFile()) {
|
|
1252
|
-
if (!isIgnored(fullPath, false, active)
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1560
|
+
if (!isIgnored(fullPath, false, active)) {
|
|
1561
|
+
if ((0, grammars_1.isSourceFile)(relativePath, overrides)) {
|
|
1562
|
+
files.push(relativePath);
|
|
1563
|
+
count++;
|
|
1564
|
+
onProgress?.(count, relativePath);
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
tallySkip(stats, relativePath);
|
|
1568
|
+
}
|
|
1256
1569
|
}
|
|
1257
1570
|
}
|
|
1258
1571
|
}
|
|
@@ -1267,10 +1580,15 @@ function scanDirectoryWalk(rootDir, onProgress) {
|
|
|
1267
1580
|
}
|
|
1268
1581
|
}
|
|
1269
1582
|
else if (entry.isFile()) {
|
|
1270
|
-
if (!isIgnored(fullPath, false, active)
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1583
|
+
if (!isIgnored(fullPath, false, active)) {
|
|
1584
|
+
if ((0, grammars_1.isSourceFile)(relativePath, overrides)) {
|
|
1585
|
+
files.push(relativePath);
|
|
1586
|
+
count++;
|
|
1587
|
+
onProgress?.(count, relativePath);
|
|
1588
|
+
}
|
|
1589
|
+
else {
|
|
1590
|
+
tallySkip(stats, relativePath);
|
|
1591
|
+
}
|
|
1274
1592
|
}
|
|
1275
1593
|
}
|
|
1276
1594
|
}
|
|
@@ -1343,10 +1661,57 @@ class ExtractionOrchestrator {
|
|
|
1343
1661
|
* hasn't run yet so single-file re-index paths can detect on the spot.
|
|
1344
1662
|
*/
|
|
1345
1663
|
detectedFrameworkNames = null;
|
|
1664
|
+
/**
|
|
1665
|
+
* Scope matcher for SCOPED syncs, memoized on the mtimes of the two root
|
|
1666
|
+
* files it is derived from (`codegraph.json`, `.gitignore`). See
|
|
1667
|
+
* {@link scopedSyncMatcher}.
|
|
1668
|
+
*/
|
|
1669
|
+
scopedMatcher = null;
|
|
1346
1670
|
constructor(rootDir, queries) {
|
|
1347
1671
|
this.rootDir = rootDir;
|
|
1348
1672
|
this.queries = queries;
|
|
1349
1673
|
}
|
|
1674
|
+
/**
|
|
1675
|
+
* The scope matcher a scoped sync applies to the paths it was handed — the
|
|
1676
|
+
* same `buildScopeIgnore` the full scan uses, so an explicitly-passed path
|
|
1677
|
+
* that is OUT of scope (a user `exclude` in `codegraph.json`, a `.gitignore`
|
|
1678
|
+
* rule, a built-in default) is treated exactly as the full walk would treat
|
|
1679
|
+
* it: absent, hence removed if tracked, never parsed (#1590).
|
|
1680
|
+
*
|
|
1681
|
+
* Memoized on the root config + root `.gitignore` mtimes: building the
|
|
1682
|
+
* matcher runs embedded-repo discovery (`git ls-files`), which would defeat
|
|
1683
|
+
* the scoped path's whole point (skipping O(repo) work) if paid per sync.
|
|
1684
|
+
* Two `stat`s per sync while nothing changed. An embedded repo created
|
|
1685
|
+
* between config edits joins the scoped matcher on the next full sync, the
|
|
1686
|
+
* same lifecycle the watcher's own matcher already has.
|
|
1687
|
+
*/
|
|
1688
|
+
scopedSyncMatcher() {
|
|
1689
|
+
// Bust when any root-level exclude source the matcher reads may have
|
|
1690
|
+
// changed. Nested `.gitignore` edits force a full watcher sync, which
|
|
1691
|
+
// clears this cache (see the full-reconcile branch in sync()).
|
|
1692
|
+
const gitDir = resolveGitDir(this.rootDir);
|
|
1693
|
+
const key = [
|
|
1694
|
+
project_config_1.PROJECT_CONFIG_FILENAME,
|
|
1695
|
+
'.gitignore',
|
|
1696
|
+
gitDir ? path.join(gitDir, 'info', 'exclude') : '',
|
|
1697
|
+
]
|
|
1698
|
+
.map((name) => {
|
|
1699
|
+
if (!name)
|
|
1700
|
+
return '-';
|
|
1701
|
+
try {
|
|
1702
|
+
return String(fs.statSync(path.isAbsolute(name) ? name : path.join(this.rootDir, name)).mtimeMs);
|
|
1703
|
+
}
|
|
1704
|
+
catch {
|
|
1705
|
+
return '-';
|
|
1706
|
+
}
|
|
1707
|
+
})
|
|
1708
|
+
.join('|');
|
|
1709
|
+
if (this.scopedMatcher && this.scopedMatcher.key === key)
|
|
1710
|
+
return this.scopedMatcher.matcher;
|
|
1711
|
+
const matcher = buildScopeIgnore(this.rootDir);
|
|
1712
|
+
this.scopedMatcher = { key, matcher };
|
|
1713
|
+
return matcher;
|
|
1714
|
+
}
|
|
1350
1715
|
/**
|
|
1351
1716
|
* Build a filesystem-backed ResolutionContext sufficient for framework
|
|
1352
1717
|
* detection. Graph-query methods (getNodesByName etc.) return empty because
|
|
@@ -1380,7 +1745,9 @@ class ExtractionOrchestrator {
|
|
|
1380
1745
|
if (!full)
|
|
1381
1746
|
return null;
|
|
1382
1747
|
try {
|
|
1383
|
-
|
|
1748
|
+
// Framework detectors scan source by name; a file over the size
|
|
1749
|
+
// limit was never indexed and must not be decoded here either (#1910).
|
|
1750
|
+
return (0, file_limits_1.readBoundedSourceSync)(full).bytes?.toString('utf8') ?? null;
|
|
1384
1751
|
}
|
|
1385
1752
|
catch {
|
|
1386
1753
|
return null;
|
|
@@ -1462,6 +1829,7 @@ class ExtractionOrchestrator {
|
|
|
1462
1829
|
// early-run 5-10s single stalls were observed on 95k-file repos but never
|
|
1463
1830
|
// attributed — these labels settle scan vs framework-detect vs grammars.
|
|
1464
1831
|
const tScan = Date.now();
|
|
1832
|
+
const skipStats = { unsupportedByExtension: new Map() };
|
|
1465
1833
|
const files = await scanDirectoryAsync(this.rootDir, (current, file) => {
|
|
1466
1834
|
onProgress?.({
|
|
1467
1835
|
phase: 'scanning',
|
|
@@ -1469,9 +1837,26 @@ class ExtractionOrchestrator {
|
|
|
1469
1837
|
total: 0,
|
|
1470
1838
|
currentFile: file,
|
|
1471
1839
|
});
|
|
1472
|
-
});
|
|
1840
|
+
}, skipStats);
|
|
1473
1841
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
1474
1842
|
console.error(`[phase-timing] scan: ${Date.now() - tScan}ms (${files.length} files)`);
|
|
1843
|
+
/** Only meaningful when nothing was indexable — see IndexResult (#1502). */
|
|
1844
|
+
const skipSummary = () => {
|
|
1845
|
+
let total = 0;
|
|
1846
|
+
for (const n of skipStats.unsupportedByExtension.values())
|
|
1847
|
+
total += n;
|
|
1848
|
+
if (total === 0)
|
|
1849
|
+
return {};
|
|
1850
|
+
const top = [...skipStats.unsupportedByExtension.entries()]
|
|
1851
|
+
.map(([ext, count]) => ({ ext, count }))
|
|
1852
|
+
.sort((a, b) => b.count - a.count || a.ext.localeCompare(b.ext))
|
|
1853
|
+
.slice(0, 5);
|
|
1854
|
+
return { filesSkippedUnsupported: total, topUnsupportedExtensions: top };
|
|
1855
|
+
};
|
|
1856
|
+
// A re-index over an existing DB skips unchanged-hash files at the store,
|
|
1857
|
+
// which would preserve wiped zero-node rows (#1541) — drop them first so
|
|
1858
|
+
// this run stores their files fresh. No-op on a fresh DB.
|
|
1859
|
+
this.healZeroNodeRows();
|
|
1475
1860
|
// Detect frameworks once per indexAll run using the scanned file list.
|
|
1476
1861
|
// Names are passed to each parse call so framework-specific extractors
|
|
1477
1862
|
// (route nodes, middleware, etc.) run after the tree-sitter pass.
|
|
@@ -1507,11 +1892,7 @@ class ExtractionOrchestrator {
|
|
|
1507
1892
|
});
|
|
1508
1893
|
await new Promise(resolve => setImmediate(resolve));
|
|
1509
1894
|
// Detect needed languages and load grammars in the parse worker
|
|
1510
|
-
const neededLanguages =
|
|
1511
|
-
// .h files default to 'c' but may be C++ — ensure cpp grammar is loaded when c is needed
|
|
1512
|
-
if (neededLanguages.includes('c') && !neededLanguages.includes('cpp')) {
|
|
1513
|
-
neededLanguages.push('cpp');
|
|
1514
|
-
}
|
|
1895
|
+
const neededLanguages = preloadLanguagesForFiles(files, overrides);
|
|
1515
1896
|
// Parse files on a pool of worker threads (keeps the main thread free for UI
|
|
1516
1897
|
// and uses every core). Falls back to in-process parsing when the compiled
|
|
1517
1898
|
// worker is unavailable (e.g. running from source in tests).
|
|
@@ -1618,29 +1999,27 @@ class ExtractionOrchestrator {
|
|
|
1618
1999
|
// Store: on the writer thread when active (fresh DB — bundles applied
|
|
1619
2000
|
// in the same file order this chain dispatches them), else on the main
|
|
1620
2001
|
// thread (SQLite connections are per-thread).
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
if (
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
else {
|
|
1636
|
-
storeWriter.send(this.buildFreshStoreBundle(filePath, content, language, stats, result));
|
|
1637
|
-
}
|
|
1638
|
-
await storeWriter.waitBelow(STORE_WRITER_WINDOW);
|
|
2002
|
+
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
2003
|
+
if (storeWriter) {
|
|
2004
|
+
if (result.kernelBuffers) {
|
|
2005
|
+
// Buffers go to the writer as-is; the worker decodes + finalizes.
|
|
2006
|
+
// The main thread's only per-file work stays O(1) + the content hash.
|
|
2007
|
+
storeWriter.send({
|
|
2008
|
+
kernel: true,
|
|
2009
|
+
filePath,
|
|
2010
|
+
language,
|
|
2011
|
+
buffers: result.kernelBuffers,
|
|
2012
|
+
file: this.buildFileRecord(filePath, content, language, stats, nodeCount, result.errors),
|
|
2013
|
+
});
|
|
1639
2014
|
}
|
|
1640
2015
|
else {
|
|
1641
|
-
|
|
1642
|
-
await this.storeExtractionResult(filePath, content, language, stats, materialized, commitYield);
|
|
2016
|
+
storeWriter.send(this.buildFreshStoreBundle(filePath, content, language, stats, result));
|
|
1643
2017
|
}
|
|
2018
|
+
await storeWriter.waitBelow(STORE_WRITER_WINDOW);
|
|
2019
|
+
}
|
|
2020
|
+
else {
|
|
2021
|
+
const materialized = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
2022
|
+
await this.storeExtractionResult(filePath, content, language, stats, materialized, commitYield);
|
|
1644
2023
|
}
|
|
1645
2024
|
if (result.errors.length > 0) {
|
|
1646
2025
|
for (const err of result.errors) {
|
|
@@ -1671,16 +2050,19 @@ class ExtractionOrchestrator {
|
|
|
1671
2050
|
}
|
|
1672
2051
|
onProgress?.({ phase: 'parsing', current: processed, total, currentFile: filePath });
|
|
1673
2052
|
};
|
|
1674
|
-
const recordParseFailure = (filePath, err) => {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
2053
|
+
const recordParseFailure = async (filePath, content, stats, err) => {
|
|
2054
|
+
await storeResult(filePath, content, stats, {
|
|
2055
|
+
nodes: [],
|
|
2056
|
+
edges: [],
|
|
2057
|
+
unresolvedReferences: [],
|
|
2058
|
+
errors: [{
|
|
2059
|
+
message: err instanceof Error ? err.message : String(err),
|
|
2060
|
+
filePath,
|
|
2061
|
+
severity: 'error',
|
|
2062
|
+
code: 'parse_error',
|
|
2063
|
+
}],
|
|
2064
|
+
durationMs: 0,
|
|
1682
2065
|
});
|
|
1683
|
-
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
1684
2066
|
};
|
|
1685
2067
|
// Commit buffered parses to the DB in file order, advancing the cursor over
|
|
1686
2068
|
// contiguous completed results. Runs after each parse settles (and once more
|
|
@@ -1705,7 +2087,7 @@ class ExtractionOrchestrator {
|
|
|
1705
2087
|
if (item.ok)
|
|
1706
2088
|
await storeResult(item.filePath, item.content, item.stats, item.result);
|
|
1707
2089
|
else
|
|
1708
|
-
recordParseFailure(item.filePath, item.err);
|
|
2090
|
+
await recordParseFailure(item.filePath, item.content, item.stats, item.err);
|
|
1709
2091
|
}
|
|
1710
2092
|
}
|
|
1711
2093
|
catch (err) {
|
|
@@ -1725,7 +2107,7 @@ class ExtractionOrchestrator {
|
|
|
1725
2107
|
completed.set(seq, { ok: true, filePath, content, stats, result });
|
|
1726
2108
|
}
|
|
1727
2109
|
catch (parseErr) {
|
|
1728
|
-
completed.set(seq, { ok: false, filePath, err: parseErr });
|
|
2110
|
+
completed.set(seq, { ok: false, filePath, content, stats, err: parseErr });
|
|
1729
2111
|
}
|
|
1730
2112
|
flushOrdered();
|
|
1731
2113
|
})();
|
|
@@ -1738,8 +2120,11 @@ class ExtractionOrchestrator {
|
|
|
1738
2120
|
// window has room. When nothing is in flight but the window is still full,
|
|
1739
2121
|
// the async commit chain is what's behind — await it so the cursor
|
|
1740
2122
|
// advances (buffered items hold whole file contents, so this bound is
|
|
1741
|
-
// load-bearing for memory).
|
|
1742
|
-
|
|
2123
|
+
// load-bearing for memory). Once a store has failed the cursor never
|
|
2124
|
+
// moves again — flushOrdered returns at once — so stop waiting and let
|
|
2125
|
+
// the drain below rethrow; waiting would spin on microtasks forever,
|
|
2126
|
+
// pinning a core and starving every timer in the process.
|
|
2127
|
+
while (nextSeq - nextToStore >= windowSize && !flushError && !aborted) {
|
|
1743
2128
|
if (inFlight.size > 0)
|
|
1744
2129
|
await Promise.race(inFlight);
|
|
1745
2130
|
else
|
|
@@ -1764,8 +2149,20 @@ class ExtractionOrchestrator {
|
|
|
1764
2149
|
(0, errors_1.logWarn)('Path traversal blocked in batch reader', { filePath: fp });
|
|
1765
2150
|
return { filePath: fp, content: null, stats: null, error: new Error('Path traversal blocked') };
|
|
1766
2151
|
}
|
|
1767
|
-
|
|
1768
|
-
|
|
2152
|
+
// Stat first: a file over the size limit is stored as skipped
|
|
2153
|
+
// without ever being read or decoded (#1910), so ten oversize
|
|
2154
|
+
// fixtures in one I/O batch no longer cost their size in RSS.
|
|
2155
|
+
const { stats, bytes } = await (0, file_limits_1.readBoundedSource)(fullPath);
|
|
2156
|
+
if (bytes === null) {
|
|
2157
|
+
return { filePath: fp, content: (0, file_limits_1.oversizeStamp)(stats.size), stats, error: null };
|
|
2158
|
+
}
|
|
2159
|
+
// Read bytes, not text: a `.ts` that is really an MPEG transport
|
|
2160
|
+
// stream (#1910) is recognised from its head here, at no extra I/O,
|
|
2161
|
+
// and never decoded or parsed.
|
|
2162
|
+
if (isMpegTsBytes(fp, bytes)) {
|
|
2163
|
+
return { filePath: fp, content: null, stats: null, error: null, skipped: true };
|
|
2164
|
+
}
|
|
2165
|
+
const content = bytes.toString('utf-8');
|
|
1769
2166
|
return { filePath: fp, content, stats, error: null };
|
|
1770
2167
|
}
|
|
1771
2168
|
catch (err) {
|
|
@@ -1774,11 +2171,17 @@ class ExtractionOrchestrator {
|
|
|
1774
2171
|
}));
|
|
1775
2172
|
// Dispatch each readable file into the bounded parse window; the window
|
|
1776
2173
|
// stores results on the main thread as they arrive.
|
|
1777
|
-
for (const { filePath, content, stats, error } of fileContents) {
|
|
2174
|
+
for (const { filePath, content, stats, error, skipped } of fileContents) {
|
|
1778
2175
|
if (signal?.aborted) {
|
|
1779
2176
|
aborted = true;
|
|
1780
2177
|
break;
|
|
1781
2178
|
}
|
|
2179
|
+
if (skipped) {
|
|
2180
|
+
// Not a source file after all — counted as done, stored as nothing.
|
|
2181
|
+
processed++;
|
|
2182
|
+
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
2183
|
+
continue;
|
|
2184
|
+
}
|
|
1782
2185
|
if (error || content === null || stats === null) {
|
|
1783
2186
|
processed++;
|
|
1784
2187
|
filesErrored++;
|
|
@@ -1791,21 +2194,24 @@ class ExtractionOrchestrator {
|
|
|
1791
2194
|
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
1792
2195
|
continue;
|
|
1793
2196
|
}
|
|
1794
|
-
// Honour
|
|
2197
|
+
// Honour MAX_SOURCE_FILE_SIZE_BYTES. Without this check, vendored generated
|
|
1795
2198
|
// headers, minified bundles, and other multi-MB files get indexed,
|
|
1796
2199
|
// wasting WASM heap and the worker recycle budget on inputs with no
|
|
1797
2200
|
// useful symbols. The single-file extractFile path already enforces
|
|
1798
2201
|
// this; the bulk path used to silently skip the check.
|
|
1799
|
-
if (stats.size >
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
2202
|
+
if (stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
|
|
2203
|
+
await storeResult(filePath, content, stats, {
|
|
2204
|
+
nodes: [],
|
|
2205
|
+
edges: [],
|
|
2206
|
+
unresolvedReferences: [],
|
|
2207
|
+
errors: [{
|
|
2208
|
+
message: `File exceeds max size (${stats.size} > ${file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES})`,
|
|
2209
|
+
filePath,
|
|
2210
|
+
severity: 'warning',
|
|
2211
|
+
code: 'size_exceeded',
|
|
2212
|
+
}],
|
|
2213
|
+
durationMs: 0,
|
|
1807
2214
|
});
|
|
1808
|
-
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
1809
2215
|
continue;
|
|
1810
2216
|
}
|
|
1811
2217
|
// Parse on the pool (main thread stays unblocked). Errors/timeouts are
|
|
@@ -1823,6 +2229,9 @@ class ExtractionOrchestrator {
|
|
|
1823
2229
|
if (flushError) {
|
|
1824
2230
|
if (storeWriter)
|
|
1825
2231
|
await storeWriter.close();
|
|
2232
|
+
// Its worker threads would otherwise outlive the failed index.
|
|
2233
|
+
if (pool)
|
|
2234
|
+
await pool.destroy();
|
|
1826
2235
|
throw flushError;
|
|
1827
2236
|
}
|
|
1828
2237
|
// All bundles are posted; wait for the writer to apply them, then close
|
|
@@ -1851,6 +2260,7 @@ class ExtractionOrchestrator {
|
|
|
1851
2260
|
filesSkipped,
|
|
1852
2261
|
filesErrored,
|
|
1853
2262
|
filesDiscovered: total,
|
|
2263
|
+
...skipSummary(),
|
|
1854
2264
|
nodesCreated: totalNodes,
|
|
1855
2265
|
edgesCreated: totalEdges,
|
|
1856
2266
|
errors: [{ message: 'Aborted', severity: 'error' }, ...errors],
|
|
@@ -1893,7 +2303,11 @@ class ExtractionOrchestrator {
|
|
|
1893
2303
|
const fullPath = (0, utils_1.validatePathWithinRoot)(this.rootDir, filePath);
|
|
1894
2304
|
if (!fullPath)
|
|
1895
2305
|
continue;
|
|
1896
|
-
|
|
2306
|
+
// Bounded like the first read: the file may have grown since (#1910).
|
|
2307
|
+
const bytes = (await (0, file_limits_1.readBoundedSource)(fullPath)).bytes;
|
|
2308
|
+
if (bytes === null)
|
|
2309
|
+
continue;
|
|
2310
|
+
content = bytes.toString('utf8');
|
|
1897
2311
|
}
|
|
1898
2312
|
catch {
|
|
1899
2313
|
continue;
|
|
@@ -1906,8 +2320,15 @@ class ExtractionOrchestrator {
|
|
|
1906
2320
|
stillFailing.push(errEntry);
|
|
1907
2321
|
continue;
|
|
1908
2322
|
}
|
|
2323
|
+
// The pool hands kernel results back as an undecoded buffer transport
|
|
2324
|
+
// (`nodes`/`edges` EMPTY, tables in kernelBuffers). The main loop
|
|
2325
|
+
// decodes or forwards to the store worker; this path stores directly,
|
|
2326
|
+
// so decode here — otherwise a kernel-language retry passes the gate
|
|
2327
|
+
// below via `errors.length === 0`, stores nothing, and the file is
|
|
2328
|
+
// permanently recorded as "(0 symbols)" with the error erased (#1541).
|
|
2329
|
+
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
2330
|
+
result = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
1909
2331
|
if (result.nodes.length > 0 || result.errors.length === 0) {
|
|
1910
|
-
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
1911
2332
|
const stats = await fsp.stat(path.join(this.rootDir, filePath));
|
|
1912
2333
|
await this.storeExtractionResult(filePath, content, language, stats, result, commitYield);
|
|
1913
2334
|
const idx = errors.indexOf(errEntry);
|
|
@@ -1936,7 +2357,10 @@ class ExtractionOrchestrator {
|
|
|
1936
2357
|
const fullPath = (0, utils_1.validatePathWithinRoot)(this.rootDir, filePath);
|
|
1937
2358
|
if (!fullPath)
|
|
1938
2359
|
continue;
|
|
1939
|
-
|
|
2360
|
+
const bytes = (await (0, file_limits_1.readBoundedSource)(fullPath)).bytes;
|
|
2361
|
+
if (bytes === null)
|
|
2362
|
+
continue;
|
|
2363
|
+
fullContent = bytes.toString('utf8');
|
|
1940
2364
|
}
|
|
1941
2365
|
catch {
|
|
1942
2366
|
continue;
|
|
@@ -1954,13 +2378,20 @@ class ExtractionOrchestrator {
|
|
|
1954
2378
|
catch {
|
|
1955
2379
|
continue;
|
|
1956
2380
|
}
|
|
2381
|
+
// Same undecoded-transport hazard as the first retry pass (#1541).
|
|
2382
|
+
const language = (0, grammars_1.detectLanguage)(filePath, fullContent, overrides);
|
|
2383
|
+
result = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
1957
2384
|
if (result.nodes.length > 0 || result.errors.length === 0) {
|
|
1958
|
-
const language = (0, grammars_1.detectLanguage)(filePath, fullContent, overrides);
|
|
1959
2385
|
const stats = await fsp.stat(path.join(this.rootDir, filePath));
|
|
1960
2386
|
await this.storeExtractionResult(filePath, fullContent, language, stats, result, commitYield);
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
2387
|
+
// Salvaged from comment-stripped source: keep a visible trace in
|
|
2388
|
+
// the summary instead of erasing the failure outright — the
|
|
2389
|
+
// stored result may be missing whatever the failing parse choked
|
|
2390
|
+
// on, and a silently "clean" file here is how an index quietly
|
|
2391
|
+
// disagrees with a later per-file sync of the same bytes (#1565).
|
|
2392
|
+
errEntry.severity = 'warning';
|
|
2393
|
+
errEntry.code = 'salvaged_stripped';
|
|
2394
|
+
errEntry.message = `Indexed from comment-stripped source after repeated parse failures (symbols may be incomplete until the file is re-indexed): ${errEntry.message}`;
|
|
1964
2395
|
filesErrored--;
|
|
1965
2396
|
filesIndexed++;
|
|
1966
2397
|
totalNodes += result.nodes.length;
|
|
@@ -1979,6 +2410,7 @@ class ExtractionOrchestrator {
|
|
|
1979
2410
|
filesSkipped,
|
|
1980
2411
|
filesErrored,
|
|
1981
2412
|
filesDiscovered: total,
|
|
2413
|
+
...skipSummary(),
|
|
1982
2414
|
nodesCreated: totalNodes,
|
|
1983
2415
|
edgesCreated: totalEdges,
|
|
1984
2416
|
errors,
|
|
@@ -2049,8 +2481,14 @@ class ExtractionOrchestrator {
|
|
|
2049
2481
|
let content;
|
|
2050
2482
|
let stats;
|
|
2051
2483
|
try {
|
|
2052
|
-
|
|
2053
|
-
|
|
2484
|
+
// An oversize file is stored as skipped; its bytes are never needed (#1910).
|
|
2485
|
+
const read = await (0, file_limits_1.readBoundedSource)(fullPath);
|
|
2486
|
+
stats = read.stats;
|
|
2487
|
+
// An MPEG transport stream named `.ts` is not TypeScript (#1910).
|
|
2488
|
+
if (read.bytes !== null && isMpegTsBytes(relativePath, read.bytes)) {
|
|
2489
|
+
return { nodes: [], edges: [], unresolvedReferences: [], errors: [], durationMs: 0 };
|
|
2490
|
+
}
|
|
2491
|
+
content = read.bytes === null ? (0, file_limits_1.oversizeStamp)(stats.size) : read.bytes.toString('utf8');
|
|
2054
2492
|
}
|
|
2055
2493
|
catch (error) {
|
|
2056
2494
|
return {
|
|
@@ -2087,15 +2525,16 @@ class ExtractionOrchestrator {
|
|
|
2087
2525
|
durationMs: 0,
|
|
2088
2526
|
};
|
|
2089
2527
|
}
|
|
2528
|
+
const language = (0, grammars_1.detectLanguage)(relativePath, content, (0, project_config_1.loadExtensionOverrides)(this.rootDir));
|
|
2090
2529
|
// Check file size
|
|
2091
|
-
if (stats.size >
|
|
2092
|
-
|
|
2530
|
+
if (stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
|
|
2531
|
+
const result = {
|
|
2093
2532
|
nodes: [],
|
|
2094
2533
|
edges: [],
|
|
2095
2534
|
unresolvedReferences: [],
|
|
2096
2535
|
errors: [
|
|
2097
2536
|
{
|
|
2098
|
-
message: `File exceeds max size (${stats.size} > ${
|
|
2537
|
+
message: `File exceeds max size (${stats.size} > ${file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES})`,
|
|
2099
2538
|
filePath: relativePath,
|
|
2100
2539
|
severity: 'warning',
|
|
2101
2540
|
code: 'size_exceeded',
|
|
@@ -2103,9 +2542,10 @@ class ExtractionOrchestrator {
|
|
|
2103
2542
|
],
|
|
2104
2543
|
durationMs: 0,
|
|
2105
2544
|
};
|
|
2545
|
+
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
2546
|
+
return result;
|
|
2106
2547
|
}
|
|
2107
2548
|
// Detect language (honoring the project's codegraph.json extension overrides)
|
|
2108
|
-
const language = (0, grammars_1.detectLanguage)(relativePath, content, (0, project_config_1.loadExtensionOverrides)(this.rootDir));
|
|
2109
2549
|
if (!(0, grammars_1.isLanguageSupported)(language)) {
|
|
2110
2550
|
return {
|
|
2111
2551
|
nodes: [],
|
|
@@ -2121,15 +2561,43 @@ class ExtractionOrchestrator {
|
|
|
2121
2561
|
const frameworkNames = this.ensureDetectedFrameworks();
|
|
2122
2562
|
const result = (0, tree_sitter_1.extractFromSource)(relativePath, content, language, frameworkNames);
|
|
2123
2563
|
// Store in database
|
|
2124
|
-
|
|
2125
|
-
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
2126
|
-
}
|
|
2564
|
+
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
2127
2565
|
return result;
|
|
2128
2566
|
}
|
|
2129
2567
|
/**
|
|
2130
2568
|
* Store extraction result in database
|
|
2131
2569
|
*/
|
|
2570
|
+
/**
|
|
2571
|
+
* Delete file rows recorded with ZERO nodes so their files re-index.
|
|
2572
|
+
*
|
|
2573
|
+
* No extraction path stores an empty, error-free result for a
|
|
2574
|
+
* symbol-bearing language — even an empty file keeps its file node — so a
|
|
2575
|
+
* zero-node row is a wiped one (#1541: an interrupted parse's retry stored
|
|
2576
|
+
* an undecoded kernel transport). The wiped row's content hash matches the
|
|
2577
|
+
* on-disk bytes, so every hash-based reconcile skips the file forever;
|
|
2578
|
+
* deleting the row lets the normal add path repair it. File-level-only
|
|
2579
|
+
* languages (yaml, twig, properties) are left alone. Deleting a zero-node
|
|
2580
|
+
* row cascades nothing: it has no nodes, so no edges or refs either.
|
|
2581
|
+
*/
|
|
2582
|
+
healZeroNodeRows() {
|
|
2583
|
+
for (const f of this.queries.getAllFiles()) {
|
|
2584
|
+
// A zero-node row WITH recorded errors is a deliberate skip marker
|
|
2585
|
+
// (#1557: oversized / repeatedly-unparseable files are persisted with
|
|
2586
|
+
// their reason so syncs stop retrying them) — leave those alone. The
|
|
2587
|
+
// #1541 wipe rows are the error-FREE zero-node rows.
|
|
2588
|
+
if (f.nodeCount === 0 &&
|
|
2589
|
+
!(0, grammars_1.isFileLevelOnlyLanguage)(f.language) &&
|
|
2590
|
+
(f.errors === undefined || f.errors.length === 0)) {
|
|
2591
|
+
this.queries.deleteFile(f.path);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2132
2595
|
async storeExtractionResult(filePath, content, language, stats, result, onYield) {
|
|
2596
|
+
// A kernel result can arrive as an undecoded buffer transport (empty
|
|
2597
|
+
// node/edge arrays, tables riding in kernelBuffers). Decode it before
|
|
2598
|
+
// storing — persisting the transport as-is records the file as having no
|
|
2599
|
+
// symbols at all (#1541). No-op for already-decoded results.
|
|
2600
|
+
result = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
2133
2601
|
// Bulk inserts run in bounded sub-transactions with a yield between, so a
|
|
2134
2602
|
// giant generated file (tens of thousands of symbols) can't block the
|
|
2135
2603
|
// event loop — and the #850 watchdog heartbeat — for the whole store.
|
|
@@ -2138,11 +2606,24 @@ class ExtractionOrchestrator {
|
|
|
2138
2606
|
// is unchanged: a partially-stored file has no record and re-indexes.
|
|
2139
2607
|
const STORE_CHUNK = 2000;
|
|
2140
2608
|
const contentHash = hashContent(content);
|
|
2141
|
-
// Check if file already exists and hasn't changed
|
|
2609
|
+
// Check if file already exists and hasn't changed. A skip/failure MARKER
|
|
2610
|
+
// row (zero nodes + recorded errors, #1557) never blocks a store carrying
|
|
2611
|
+
// real content: markers are written BEFORE the retry pass under the same
|
|
2612
|
+
// content hash, so treating them as "no changes" would silently discard a
|
|
2613
|
+
// successful retry's symbols — a permanent empty file presented as
|
|
2614
|
+
// recovered (the #1541 wipe, reintroduced through the marker path).
|
|
2142
2615
|
const existingFile = this.queries.getFileByPath(filePath);
|
|
2143
2616
|
if (existingFile && existingFile.contentHash === contentHash) {
|
|
2144
|
-
|
|
2617
|
+
const existingIsMarker = existingFile.nodeCount === 0 && (existingFile.errors?.length ?? 0) > 0;
|
|
2618
|
+
const incomingHasContent = result.nodes.length > 0;
|
|
2619
|
+
if (!existingIsMarker || !incomingHasContent) {
|
|
2620
|
+
return; // No changes
|
|
2621
|
+
}
|
|
2145
2622
|
}
|
|
2623
|
+
// Re-decided on every re-index of a changed file, so a banner added (or
|
|
2624
|
+
// removed) by an edit is reflected on the next sync (#1500). Computed after
|
|
2625
|
+
// the unchanged-file early return so untouched files pay nothing.
|
|
2626
|
+
const generated = (0, generated_detection_1.detectGeneratedFile)(filePath, content);
|
|
2146
2627
|
// Snapshot incoming cross-file edges BEFORE deleting this file's nodes.
|
|
2147
2628
|
// `deleteFile` cascades to delete every edge whose source OR target is a
|
|
2148
2629
|
// node in this file (edges.FK ... ON DELETE CASCADE). Edges whose SOURCE is
|
|
@@ -2202,6 +2683,7 @@ class ExtractionOrchestrator {
|
|
|
2202
2683
|
indexedAt: Date.now(),
|
|
2203
2684
|
nodeCount: result.nodes.length,
|
|
2204
2685
|
errors: result.errors.length > 0 ? result.errors : undefined,
|
|
2686
|
+
generated,
|
|
2205
2687
|
},
|
|
2206
2688
|
});
|
|
2207
2689
|
if (crossFileIncomingEdges.length > 0) {
|
|
@@ -2257,6 +2739,7 @@ class ExtractionOrchestrator {
|
|
|
2257
2739
|
indexedAt: Date.now(),
|
|
2258
2740
|
nodeCount: result.nodes.length,
|
|
2259
2741
|
errors: result.errors.length > 0 ? result.errors : undefined,
|
|
2742
|
+
generated,
|
|
2260
2743
|
};
|
|
2261
2744
|
this.queries.upsertFile(fileRecord);
|
|
2262
2745
|
}
|
|
@@ -2276,6 +2759,10 @@ class ExtractionOrchestrator {
|
|
|
2276
2759
|
indexedAt: Date.now(),
|
|
2277
2760
|
nodeCount,
|
|
2278
2761
|
errors: resultErrors.length > 0 ? resultErrors : undefined,
|
|
2762
|
+
// Decided here, once, while the content is already in memory — never at
|
|
2763
|
+
// query time (#1500). The header scan short-circuits on a single
|
|
2764
|
+
// substring test for ~every hand-written file.
|
|
2765
|
+
generated: (0, generated_detection_1.detectGeneratedFile)(filePath, content),
|
|
2279
2766
|
};
|
|
2280
2767
|
}
|
|
2281
2768
|
buildFreshStoreBundle(filePath, content, language, stats, result) {
|
|
@@ -2313,6 +2800,64 @@ class ExtractionOrchestrator {
|
|
|
2313
2800
|
this.queries.insertUnresolvedRefsBatch(resurrected);
|
|
2314
2801
|
}
|
|
2315
2802
|
}
|
|
2803
|
+
/**
|
|
2804
|
+
* Re-open, for re-resolution, every resolution edge whose answer this sync
|
|
2805
|
+
* may have changed — the fix for index drift (CG-33).
|
|
2806
|
+
*
|
|
2807
|
+
* Incremental sync re-resolves only the references IN the changed files, but
|
|
2808
|
+
* resolution's answer is a function of the WHOLE graph: a reference binds to
|
|
2809
|
+
* one of the same-named definitions project-wide, so adding or removing a
|
|
2810
|
+
* definition of `pct` can change which `pct` every other file's `pct(...)`
|
|
2811
|
+
* should bind to. Those other files are never revisited, and their references
|
|
2812
|
+
* resolved successfully once and were deleted from `unresolved_refs`, so
|
|
2813
|
+
* nothing existed to revisit them with — the index kept an answer that was
|
|
2814
|
+
* correct against an older graph. Measured on codegraph's own long-lived
|
|
2815
|
+
* index: 4.3% of distinct edges differed from a clean rebuild, in BOTH
|
|
2816
|
+
* directions, overwhelmingly `calls`. See docs/benchmarks/index-drift-cg33.md.
|
|
2817
|
+
*
|
|
2818
|
+
* This deletes each affected edge and re-inserts it as the reference that
|
|
2819
|
+
* created it (the refName/refKind stamp), status='pending', for the sync's
|
|
2820
|
+
* resolution sweep to bind against the post-sync graph — the same input a
|
|
2821
|
+
* full rebuild resolves from, which is what makes the two converge.
|
|
2822
|
+
*
|
|
2823
|
+
* Deliberately conservative in three ways, because a wrong deletion is a
|
|
2824
|
+
* permanent edge loss while a missed rebind is only residual drift:
|
|
2825
|
+
* - an edge with no refName stamp (synthesized, or built by an engine older
|
|
2826
|
+
* than the stamp) is left ALONE rather than reconstructed from the target's
|
|
2827
|
+
* plain name, same rule as `resurrectRefFromDroppedEdge`;
|
|
2828
|
+
* - edges whose source is in a file this sync already re-extracted are
|
|
2829
|
+
* skipped — their references were re-resolved from scratch moments ago;
|
|
2830
|
+
* - very common names are skipped by the per-name ceiling in
|
|
2831
|
+
* `getResolutionEdgesByTargetName`.
|
|
2832
|
+
*
|
|
2833
|
+
* Returns the number of references resurrected.
|
|
2834
|
+
*/
|
|
2835
|
+
resurrectStaleResolutionEdges(definitionDelta, changedFilePaths) {
|
|
2836
|
+
if (definitionDelta.length === 0)
|
|
2837
|
+
return 0;
|
|
2838
|
+
const alreadyFresh = new Set(changedFilePaths);
|
|
2839
|
+
const candidates = this.queries.getResolutionEdgesByTargetName(definitionDelta);
|
|
2840
|
+
const edgeIds = [];
|
|
2841
|
+
const refs = [];
|
|
2842
|
+
for (const e of candidates) {
|
|
2843
|
+
if (alreadyFresh.has(e.sourceFilePath))
|
|
2844
|
+
continue;
|
|
2845
|
+
const ref = resurrectRefFromDroppedEdge(e);
|
|
2846
|
+
if (!ref)
|
|
2847
|
+
continue; // no stamp — never delete what we cannot restore
|
|
2848
|
+
edgeIds.push(e.edgeId);
|
|
2849
|
+
refs.push(ref);
|
|
2850
|
+
}
|
|
2851
|
+
if (refs.length === 0)
|
|
2852
|
+
return 0;
|
|
2853
|
+
// Delete first. The sweep re-inserts whichever edge resolution now picks,
|
|
2854
|
+
// and `insertEdges` is INSERT OR IGNORE against idx_edges_identity — so a
|
|
2855
|
+
// rebind to the same target is a clean no-op, but leaving the old row in
|
|
2856
|
+
// place for a rebind ELSEWHERE would keep both, turning drift into
|
|
2857
|
+
// duplication.
|
|
2858
|
+
this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
|
|
2859
|
+
return refs.length;
|
|
2860
|
+
}
|
|
2316
2861
|
/**
|
|
2317
2862
|
* Sync the index with the current file state.
|
|
2318
2863
|
*
|
|
@@ -2331,7 +2876,15 @@ class ExtractionOrchestrator {
|
|
|
2331
2876
|
* set is not exactly known (directory removals, event overflow): the full
|
|
2332
2877
|
* scan-diff remains the ground truth those cases need (#1285).
|
|
2333
2878
|
*/
|
|
2334
|
-
scopedPaths
|
|
2879
|
+
scopedPaths,
|
|
2880
|
+
/**
|
|
2881
|
+
* Writer-side WAL pressure valve (#1539). Called after every changed file
|
|
2882
|
+
* is stored, when no extraction transaction is open, so a checkpoint can
|
|
2883
|
+
* safely catch up before the next file grows the WAL further.
|
|
2884
|
+
*/
|
|
2885
|
+
backpressure,
|
|
2886
|
+
/** Inspect changed inputs before deletion/re-extraction cascades their edges. */
|
|
2887
|
+
onFileChange) {
|
|
2335
2888
|
await (0, grammars_1.initGrammars)(); // Initialize WASM runtime (grammars loaded lazily below)
|
|
2336
2889
|
const startTime = Date.now();
|
|
2337
2890
|
let filesChecked = 0;
|
|
@@ -2340,12 +2893,17 @@ class ExtractionOrchestrator {
|
|
|
2340
2893
|
let filesRemoved = 0;
|
|
2341
2894
|
let nodesUpdated = 0;
|
|
2342
2895
|
const changedFilePaths = [];
|
|
2896
|
+
// `file\0name` definition pairs for the files this sync touches, sampled
|
|
2897
|
+
// BEFORE their nodes are replaced/deleted. Compared against the post-store
|
|
2898
|
+
// pairs below to derive `definitionDelta` (CG-33).
|
|
2899
|
+
const pairsBefore = new Set();
|
|
2343
2900
|
onProgress?.({
|
|
2344
2901
|
phase: 'scanning',
|
|
2345
2902
|
current: 0,
|
|
2346
2903
|
total: 0,
|
|
2347
2904
|
});
|
|
2348
2905
|
const filesToIndex = [];
|
|
2906
|
+
const failedFilePaths = [];
|
|
2349
2907
|
// === Filesystem reconcile (git-independent) ===
|
|
2350
2908
|
// The source of truth for "what changed" is the filesystem vs the indexed
|
|
2351
2909
|
// state — never git. We enumerate the current source files and reconcile
|
|
@@ -2365,7 +2923,20 @@ class ExtractionOrchestrator {
|
|
|
2365
2923
|
// reads `filesChecked === 0 && durationMs === 0` as the
|
|
2366
2924
|
// lock-unavailable signature (#449).
|
|
2367
2925
|
const unique = [...new Set(scopedPaths)];
|
|
2368
|
-
|
|
2926
|
+
// A scoped path is "present" only if it exists AND is in scope — the
|
|
2927
|
+
// same two gates the full walk applies (source extension, scope
|
|
2928
|
+
// matcher). Without the scope gate a caller's stale view of scope
|
|
2929
|
+
// leaked straight into the index: the watcher re-parsed a file the
|
|
2930
|
+
// user had just excluded in `codegraph.json` while `codegraph sync`
|
|
2931
|
+
// removed it (#1590). Out-of-scope paths fall out of `currentFiles`,
|
|
2932
|
+
// so a tracked one takes the removal branch below, exactly as a full
|
|
2933
|
+
// sync would treat it. (`include`-forced paths pass: ScopeIgnore
|
|
2934
|
+
// applies the include precedence itself.)
|
|
2935
|
+
const scope = this.scopedSyncMatcher();
|
|
2936
|
+
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
2937
|
+
currentFiles = unique.filter((p) => (0, grammars_1.isSourceFile)(p, overrides) &&
|
|
2938
|
+
!scope.ignores(p) &&
|
|
2939
|
+
fs.existsSync(path.join(this.rootDir, p)));
|
|
2369
2940
|
trackedFiles = [];
|
|
2370
2941
|
for (const p of unique) {
|
|
2371
2942
|
const rec = this.queries.getFileByPath(p);
|
|
@@ -2377,10 +2948,17 @@ class ExtractionOrchestrator {
|
|
|
2377
2948
|
console.error(`[phase-timing] sync-scoped: ${Date.now() - tSyncScan}ms (${unique.length} paths, ${trackedFiles.length} tracked)`);
|
|
2378
2949
|
}
|
|
2379
2950
|
else {
|
|
2951
|
+
// Full reconcile: drop the memoized scope matcher so a nested
|
|
2952
|
+
// `.gitignore` / exclude-standard change that forced this full sync is
|
|
2953
|
+
// visible to the next scoped sync (#1728).
|
|
2954
|
+
this.scopedMatcher = null;
|
|
2380
2955
|
currentFiles = await scanDirectoryAsync(this.rootDir);
|
|
2381
2956
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
2382
2957
|
console.error(`[phase-timing] sync-scan: ${Date.now() - tSyncScan}ms (${currentFiles.length} files)`);
|
|
2383
2958
|
filesChecked = currentFiles.length;
|
|
2959
|
+
// Full reconcile only (scoped syncs must not touch rows outside their
|
|
2960
|
+
// scope): drop zero-node rows so the wiped files re-index as adds below.
|
|
2961
|
+
this.healZeroNodeRows();
|
|
2384
2962
|
const tTracked = Date.now();
|
|
2385
2963
|
trackedFiles = this.queries.getAllFiles();
|
|
2386
2964
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
@@ -2397,26 +2975,34 @@ class ExtractionOrchestrator {
|
|
|
2397
2975
|
// `reconcileChecks` drives the cooperative yield shared with the adds/mods loop
|
|
2398
2976
|
// below (see SYNC_RECONCILE_YIELD_INTERVAL / issue #905).
|
|
2399
2977
|
let reconcileChecks = 0;
|
|
2978
|
+
const removeTracked = (tracked) => {
|
|
2979
|
+
// Before the cascade deletes them, resurrect incoming cross-file
|
|
2980
|
+
// resolution edges as their original refs (#1240 removal case): the
|
|
2981
|
+
// callers live in files this sync will NOT revisit, so this is their
|
|
2982
|
+
// only chance to rebind to an alternative definition — or to park as
|
|
2983
|
+
// failed until the symbol reappears somewhere. (A deleted file whose
|
|
2984
|
+
// CALLERS are also being deleted is fine: their nodes cascade later
|
|
2985
|
+
// in this loop and take the resurrected rows with them.)
|
|
2986
|
+
// Every name this file defined is about to stop existing here, which
|
|
2987
|
+
// narrows the candidate set for that name repo-wide (CG-33).
|
|
2988
|
+
for (const pair of this.queries.getNodeNamePairsByFiles([tracked.path]))
|
|
2989
|
+
pairsBefore.add(pair);
|
|
2990
|
+
const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
|
|
2991
|
+
if (incoming.length > 0) {
|
|
2992
|
+
const resurrected = incoming
|
|
2993
|
+
.map((e) => resurrectRefFromDroppedEdge(e))
|
|
2994
|
+
.filter((r) => r !== null);
|
|
2995
|
+
if (resurrected.length > 0) {
|
|
2996
|
+
this.queries.insertUnresolvedRefsBatch(resurrected);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
onFileChange?.(tracked.path);
|
|
3000
|
+
this.queries.deleteFile(tracked.path);
|
|
3001
|
+
filesRemoved++;
|
|
3002
|
+
};
|
|
2400
3003
|
for (const tracked of trackedFiles) {
|
|
2401
3004
|
if (!currentSet.has(tracked.path) || !fs.existsSync(path.join(this.rootDir, tracked.path))) {
|
|
2402
|
-
|
|
2403
|
-
// resolution edges as their original refs (#1240 removal case): the
|
|
2404
|
-
// callers live in files this sync will NOT revisit, so this is their
|
|
2405
|
-
// only chance to rebind to an alternative definition — or to park as
|
|
2406
|
-
// failed until the symbol reappears somewhere. (A deleted file whose
|
|
2407
|
-
// CALLERS are also being deleted is fine: their nodes cascade later
|
|
2408
|
-
// in this loop and take the resurrected rows with them.)
|
|
2409
|
-
const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
|
|
2410
|
-
if (incoming.length > 0) {
|
|
2411
|
-
const resurrected = incoming
|
|
2412
|
-
.map((e) => resurrectRefFromDroppedEdge(e))
|
|
2413
|
-
.filter((r) => r !== null);
|
|
2414
|
-
if (resurrected.length > 0) {
|
|
2415
|
-
this.queries.insertUnresolvedRefsBatch(resurrected);
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
this.queries.deleteFile(tracked.path);
|
|
2419
|
-
filesRemoved++;
|
|
3005
|
+
removeTracked(tracked);
|
|
2420
3006
|
}
|
|
2421
3007
|
if (++reconcileChecks % SYNC_RECONCILE_YIELD_INTERVAL === 0) {
|
|
2422
3008
|
await new Promise((resolve) => setImmediate(resolve));
|
|
@@ -2446,39 +3032,54 @@ class ExtractionOrchestrator {
|
|
|
2446
3032
|
}
|
|
2447
3033
|
catch (error) {
|
|
2448
3034
|
(0, errors_1.logDebug)('Skipping unstattable file during sync', { filePath, error: String(error) });
|
|
3035
|
+
failedFilePaths.push(filePath);
|
|
2449
3036
|
continue;
|
|
2450
3037
|
}
|
|
2451
3038
|
}
|
|
2452
3039
|
// New, or size/mtime changed — read + hash to confirm a real content change.
|
|
3040
|
+
// (An oversize file hashes as its size stamp, unread — #1910.)
|
|
2453
3041
|
let content;
|
|
2454
3042
|
try {
|
|
2455
|
-
content =
|
|
3043
|
+
content = readSourceOrStamp(fullPath);
|
|
2456
3044
|
}
|
|
2457
3045
|
catch (error) {
|
|
2458
3046
|
(0, errors_1.logDebug)('Skipping unreadable file during sync', { filePath, error: String(error) });
|
|
3047
|
+
failedFilePaths.push(filePath);
|
|
3048
|
+
continue;
|
|
3049
|
+
}
|
|
3050
|
+
// Not source after all — an MPEG transport stream named `.ts` (#1910):
|
|
3051
|
+
// a new one is ignored, a tracked file that became one is removed.
|
|
3052
|
+
if (content === null) {
|
|
3053
|
+
if (tracked)
|
|
3054
|
+
removeTracked(tracked);
|
|
2459
3055
|
continue;
|
|
2460
3056
|
}
|
|
2461
3057
|
const contentHash = hashContent(content);
|
|
2462
3058
|
if (!tracked) {
|
|
3059
|
+
onFileChange?.(filePath, content);
|
|
2463
3060
|
filesToIndex.push(filePath);
|
|
2464
3061
|
changedFilePaths.push(filePath);
|
|
2465
3062
|
filesAdded++;
|
|
2466
3063
|
}
|
|
2467
3064
|
else if (tracked.contentHash !== contentHash) {
|
|
3065
|
+
onFileChange?.(filePath, content);
|
|
2468
3066
|
filesToIndex.push(filePath);
|
|
2469
3067
|
changedFilePaths.push(filePath);
|
|
2470
3068
|
filesModified++;
|
|
2471
3069
|
}
|
|
2472
3070
|
}
|
|
3071
|
+
// Sampled here — after the add/modify classification, before any file is
|
|
3072
|
+
// re-extracted — because `storeExtractionResult` deletes a file's nodes
|
|
3073
|
+
// before inserting the new ones, so this is the last point the pre-edit
|
|
3074
|
+
// definition set is readable (CG-33).
|
|
3075
|
+
if (filesToIndex.length > 0) {
|
|
3076
|
+
for (const pair of this.queries.getNodeNamePairsByFiles(filesToIndex))
|
|
3077
|
+
pairsBefore.add(pair);
|
|
3078
|
+
}
|
|
2473
3079
|
// Load only grammars needed for changed files
|
|
2474
3080
|
if (filesToIndex.length > 0) {
|
|
2475
3081
|
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
2476
|
-
|
|
2477
|
-
// .h files default to 'c' but may be C++ — ensure cpp grammar is loaded
|
|
2478
|
-
if (neededLanguages.includes('c') && !neededLanguages.includes('cpp')) {
|
|
2479
|
-
neededLanguages.push('cpp');
|
|
2480
|
-
}
|
|
2481
|
-
await (0, grammars_1.loadGrammarsForLanguages)(neededLanguages);
|
|
3082
|
+
await (0, grammars_1.loadGrammarsForLanguages)(preloadLanguagesForFiles(filesToIndex, overrides));
|
|
2482
3083
|
}
|
|
2483
3084
|
// Index changed files
|
|
2484
3085
|
const total = filesToIndex.length;
|
|
@@ -2491,8 +3092,35 @@ class ExtractionOrchestrator {
|
|
|
2491
3092
|
currentFile: filePath,
|
|
2492
3093
|
});
|
|
2493
3094
|
const result = await this.indexFile(filePath);
|
|
3095
|
+
if (result.errors.some(e => e.severity === 'error'))
|
|
3096
|
+
failedFilePaths.push(filePath);
|
|
2494
3097
|
nodesUpdated += result.nodes.length;
|
|
2495
|
-
|
|
3098
|
+
const pause = backpressure?.();
|
|
3099
|
+
if (pause)
|
|
3100
|
+
await pause;
|
|
3101
|
+
}
|
|
3102
|
+
// Names whose definition set this sync changed: a `file\0name` pair present
|
|
3103
|
+
// before but not after (removed/renamed away) or after but not before
|
|
3104
|
+
// (added). A pair on both sides is untouched as far as resolution's
|
|
3105
|
+
// candidate set is concerned — only its node id moved, which
|
|
3106
|
+
// reattachCrossFileEdges already follows — so an edit that only changes
|
|
3107
|
+
// bodies yields an empty delta and no downstream rebind work (CG-33).
|
|
3108
|
+
//
|
|
3109
|
+
// Compared per FILE, not as one name set over the whole batch: a commit
|
|
3110
|
+
// that adds `collect` to a new file while an unrelated changed file already
|
|
3111
|
+
// defined `collect` must still flag the name, and a bare name set cancels
|
|
3112
|
+
// exactly that case out. That miss left the largest residual class in the
|
|
3113
|
+
// first measurement of this fix.
|
|
3114
|
+
const pairsAfter = this.queries.getNodeNamePairsByFiles(filesToIndex);
|
|
3115
|
+
const deltaNames = new Set();
|
|
3116
|
+
const nameOf = (pair) => pair.slice(pair.indexOf('\0') + 1);
|
|
3117
|
+
for (const pair of pairsBefore)
|
|
3118
|
+
if (!pairsAfter.has(pair))
|
|
3119
|
+
deltaNames.add(nameOf(pair));
|
|
3120
|
+
for (const pair of pairsAfter)
|
|
3121
|
+
if (!pairsBefore.has(pair))
|
|
3122
|
+
deltaNames.add(nameOf(pair));
|
|
3123
|
+
const definitionDelta = [...deltaNames];
|
|
2496
3124
|
return {
|
|
2497
3125
|
filesChecked,
|
|
2498
3126
|
filesAdded,
|
|
@@ -2501,48 +3129,112 @@ class ExtractionOrchestrator {
|
|
|
2501
3129
|
nodesUpdated,
|
|
2502
3130
|
durationMs: Date.now() - startTime,
|
|
2503
3131
|
changedFilePaths: changedFilePaths.length > 0 ? changedFilePaths : undefined,
|
|
3132
|
+
...(failedFilePaths.length > 0 ? { failedFilePaths } : {}),
|
|
3133
|
+
definitionDelta: definitionDelta.length > 0 ? definitionDelta : undefined,
|
|
2504
3134
|
};
|
|
2505
3135
|
}
|
|
3136
|
+
indexedDirtyPaths(stamp) {
|
|
3137
|
+
try {
|
|
3138
|
+
const state = JSON.parse(this.queries.getMetadata('indexed_dirty_paths') ?? 'null');
|
|
3139
|
+
if (!state || state.commit !== (stamp ?? '') || !Array.isArray(state.paths))
|
|
3140
|
+
return null;
|
|
3141
|
+
if (!state.paths.every((p) => typeof p === 'string' && p.length > 0 &&
|
|
3142
|
+
!path.isAbsolute(p) && !p.split('/').includes('..')))
|
|
3143
|
+
return null;
|
|
3144
|
+
return state.paths;
|
|
3145
|
+
}
|
|
3146
|
+
catch {
|
|
3147
|
+
return null;
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
/** Capture before file reads. In-flight/failed full writes must not claim freshness. */
|
|
3151
|
+
beginGitIndexState(full) {
|
|
3152
|
+
const head = getGitHeadSha(this.rootDir) ?? '';
|
|
3153
|
+
const stamp = this.queries.getMetadata(exports.INDEXED_AT_COMMIT_KEY) ?? '';
|
|
3154
|
+
const prior = this.indexedDirtyPaths(stamp);
|
|
3155
|
+
const status = getGitChangedFiles(this.rootDir);
|
|
3156
|
+
const dirty = status ? [...new Set([
|
|
3157
|
+
...(full ? [] : prior ?? []), ...status.added, ...status.modified, ...status.deleted,
|
|
3158
|
+
])] : null;
|
|
3159
|
+
if (full || prior === null || dirty === null) {
|
|
3160
|
+
this.queries.setMetadata(exports.INDEXED_AT_COMMIT_KEY, '');
|
|
3161
|
+
this.queries.setMetadata('indexed_dirty_paths', '');
|
|
3162
|
+
}
|
|
3163
|
+
else {
|
|
3164
|
+
// Scoped writes leave the commit alone and retain dirty paths before the
|
|
3165
|
+
// first write, so a crash cannot forget an indexed uncommitted edit.
|
|
3166
|
+
this.queries.setMetadata('indexed_dirty_paths', JSON.stringify({ commit: stamp, paths: dirty }));
|
|
3167
|
+
}
|
|
3168
|
+
return { head, stamp, dirty };
|
|
3169
|
+
}
|
|
3170
|
+
finishGitIndexState(snapshot, full, retries = []) {
|
|
3171
|
+
const after = getGitChangedFiles(this.rootDir);
|
|
3172
|
+
if (!snapshot.dirty || !after)
|
|
3173
|
+
return;
|
|
3174
|
+
const commit = full ? snapshot.head : snapshot.stamp;
|
|
3175
|
+
const paths = [...new Set([...snapshot.dirty, ...after.added, ...after.modified, ...after.deleted, ...retries])].sort();
|
|
3176
|
+
// The embedded commit makes a torn pair fail closed: readers reject a dirty
|
|
3177
|
+
// set that doesn't match the separately stored commit. Write the set first.
|
|
3178
|
+
this.queries.setMetadata('indexed_dirty_paths', JSON.stringify({ commit, paths }));
|
|
3179
|
+
if (full)
|
|
3180
|
+
this.queries.setMetadata(exports.INDEXED_AT_COMMIT_KEY, commit);
|
|
3181
|
+
}
|
|
2506
3182
|
/**
|
|
2507
3183
|
* Get files that have changed since last index.
|
|
2508
3184
|
* Uses git status as a fast path when available, falling back to full scan.
|
|
2509
3185
|
*/
|
|
2510
3186
|
getChangedFiles() {
|
|
2511
|
-
|
|
3187
|
+
// The commit this index was last brought up to date at. Absent on an index
|
|
3188
|
+
// built before stamping existed — getGitChangedFiles then declines the fast
|
|
3189
|
+
// path and the full scan below answers correctly, once, until a sync or a
|
|
3190
|
+
// full index writes the stamp. (#1829)
|
|
3191
|
+
let sinceCommit = null;
|
|
3192
|
+
try {
|
|
3193
|
+
sinceCommit = this.queries.getMetadata(exports.INDEXED_AT_COMMIT_KEY) ?? null;
|
|
3194
|
+
}
|
|
3195
|
+
catch { /* advisory */ }
|
|
3196
|
+
const dirtyPaths = this.indexedDirtyPaths(sinceCommit);
|
|
3197
|
+
const gitChanges = dirtyPaths !== null && canTrustGitFastPath(this.rootDir, sinceCommit)
|
|
3198
|
+
? getGitChangedFiles(this.rootDir, sinceCommit)
|
|
3199
|
+
: null;
|
|
2512
3200
|
if (gitChanges) {
|
|
2513
3201
|
// === Git fast path ===
|
|
2514
3202
|
const added = [];
|
|
2515
3203
|
const modified = [];
|
|
2516
3204
|
const removed = [];
|
|
2517
|
-
//
|
|
2518
|
-
|
|
3205
|
+
// Git supplies candidates, never the verdict. A committed deletion may
|
|
3206
|
+
// have been recreated locally; a previously indexed dirty path may have
|
|
3207
|
+
// vanished from git status after restore. Classify current disk vs DB once.
|
|
3208
|
+
const candidates = new Set([...gitChanges.deleted, ...gitChanges.modified, ...gitChanges.added, ...dirtyPaths]);
|
|
3209
|
+
const scope = this.scopedSyncMatcher();
|
|
3210
|
+
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
3211
|
+
for (const filePath of candidates) {
|
|
2519
3212
|
const tracked = this.queries.getFileByPath(filePath);
|
|
2520
|
-
if (tracked) {
|
|
2521
|
-
removed.push(filePath);
|
|
2522
|
-
}
|
|
2523
|
-
}
|
|
2524
|
-
// Modified + added files — read + hash, compare with DB. Untracked (`??`)
|
|
2525
|
-
// files stay untracked in git even after indexing, so they must be
|
|
2526
|
-
// hash-compared like modified files instead of always counting as added —
|
|
2527
|
-
// otherwise status reports them as pending forever. (See issue #206.)
|
|
2528
|
-
for (const filePath of [...gitChanges.modified, ...gitChanges.added]) {
|
|
2529
3213
|
const fullPath = path.join(this.rootDir, filePath);
|
|
3214
|
+
if (!(0, grammars_1.isSourceFile)(filePath, overrides) || scope.ignores(filePath) || !fs.existsSync(fullPath)) {
|
|
3215
|
+
if (tracked)
|
|
3216
|
+
removed.push(filePath);
|
|
3217
|
+
continue;
|
|
3218
|
+
}
|
|
2530
3219
|
let content;
|
|
2531
3220
|
try {
|
|
2532
|
-
content =
|
|
3221
|
+
content = readSourceOrStamp(fullPath);
|
|
2533
3222
|
}
|
|
2534
3223
|
catch (error) {
|
|
2535
3224
|
(0, errors_1.logDebug)('Skipping unreadable file while detecting changes', { filePath, error: String(error) });
|
|
2536
3225
|
continue;
|
|
2537
3226
|
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
if (
|
|
2541
|
-
|
|
3227
|
+
// A `.ts` that is an MPEG transport stream is not source (#1910), so an
|
|
3228
|
+
// untracked clip is never pending and a tracked file that became one is gone.
|
|
3229
|
+
if (content === null) {
|
|
3230
|
+
if (tracked)
|
|
3231
|
+
removed.push(filePath);
|
|
3232
|
+
continue;
|
|
2542
3233
|
}
|
|
2543
|
-
|
|
3234
|
+
if (!tracked)
|
|
3235
|
+
added.push(filePath);
|
|
3236
|
+
else if (tracked.contentHash !== hashContent(content))
|
|
2544
3237
|
modified.push(filePath);
|
|
2545
|
-
}
|
|
2546
3238
|
}
|
|
2547
3239
|
return { added, modified, removed };
|
|
2548
3240
|
}
|
|
@@ -2568,14 +3260,20 @@ class ExtractionOrchestrator {
|
|
|
2568
3260
|
const fullPath = path.join(this.rootDir, filePath);
|
|
2569
3261
|
let content;
|
|
2570
3262
|
try {
|
|
2571
|
-
content =
|
|
3263
|
+
content = readSourceOrStamp(fullPath);
|
|
2572
3264
|
}
|
|
2573
3265
|
catch (error) {
|
|
2574
3266
|
(0, errors_1.logDebug)('Skipping unreadable file while detecting changes', { filePath, error: String(error) });
|
|
2575
3267
|
continue;
|
|
2576
3268
|
}
|
|
2577
|
-
const contentHash = hashContent(content);
|
|
2578
3269
|
const tracked = trackedMap.get(filePath);
|
|
3270
|
+
// An MPEG transport stream named `.ts` (#1910) is not source.
|
|
3271
|
+
if (content === null) {
|
|
3272
|
+
if (tracked)
|
|
3273
|
+
removed.push(filePath);
|
|
3274
|
+
continue;
|
|
3275
|
+
}
|
|
3276
|
+
const contentHash = hashContent(content);
|
|
2579
3277
|
if (!tracked) {
|
|
2580
3278
|
added.push(filePath);
|
|
2581
3279
|
}
|