homegraph 1.5.6 → 1.5.8
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/CHANGELOG.md +53 -0
- package/README.md +12 -6
- package/dist/bin/homegraph.js +16 -14
- package/dist/context/index.js +120 -15
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +11 -25
- package/dist/db/queries.d.ts +5 -1
- package/dist/db/queries.js +31 -2
- package/dist/db/sqlite-adapter.d.ts +6 -12
- package/dist/db/sqlite-adapter.js +13 -41
- package/dist/directory.d.ts +1 -1
- package/dist/directory.js +25 -1
- package/dist/extraction/grammars.d.ts +2 -0
- package/dist/extraction/grammars.js +7 -7
- package/dist/extraction/languages/arkts.d.ts +25 -3
- package/dist/extraction/languages/arkts.js +184 -22
- package/dist/graph/evidence-paths.d.ts +63 -0
- package/dist/graph/evidence-paths.js +245 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +55 -17
- package/dist/mcp/arkts-evidence-packs.d.ts +67 -0
- package/dist/mcp/arkts-evidence-packs.js +352 -0
- package/dist/mcp/daemon.js +1 -1
- package/dist/mcp/engine.d.ts +20 -7
- package/dist/mcp/engine.js +113 -106
- package/dist/mcp/evidence-rendering.d.ts +10 -0
- package/dist/mcp/evidence-rendering.js +71 -0
- package/dist/mcp/explore-repeat-guard.d.ts +8 -13
- package/dist/mcp/explore-repeat-guard.js +54 -114
- package/dist/mcp/explore-session-state.d.ts +26 -4
- package/dist/mcp/explore-session-state.js +50 -4
- package/dist/mcp/index-availability.d.ts +23 -0
- package/dist/mcp/index-availability.js +78 -0
- package/dist/mcp/index.js +5 -4
- package/dist/mcp/query-cache.d.ts +1 -1
- package/dist/mcp/query-cache.js +90 -3
- package/dist/mcp/query-worker.d.ts +1 -1
- package/dist/mcp/query-worker.js +1 -1
- package/dist/mcp/server-instructions.d.ts +4 -9
- package/dist/mcp/server-instructions.js +34 -61
- package/dist/mcp/session.js +12 -4
- package/dist/mcp/source-slice-identity.d.ts +3 -0
- package/dist/mcp/source-slice-identity.js +11 -0
- package/dist/mcp/tools.d.ts +43 -9
- package/dist/mcp/tools.js +859 -155
- package/dist/search/literal-evidence.d.ts +44 -0
- package/dist/search/literal-evidence.js +278 -0
- package/dist/search/query-plan-provider.d.ts +6 -0
- package/dist/search/query-plan-provider.js +289 -0
- package/dist/search/query-plan.d.ts +98 -0
- package/dist/search/query-plan.js +334 -0
- package/dist/search/query-utils.d.ts +6 -1
- package/dist/search/query-utils.js +64 -5
- package/dist/spec/llm/client.js +3 -15
- package/dist/spec/llm/openai-sdk.d.ts +14 -0
- package/dist/spec/llm/openai-sdk.js +37 -0
- package/dist/spec/llm/retry.js +8 -9
- package/dist/types.d.ts +17 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +24 -0
- package/package.json +3 -5
- package/dist/addons/dynamic-import.d.ts.map +0 -1
- package/dist/addons/dynamic-import.js.map +0 -1
- package/dist/addons/init-template.d.ts.map +0 -1
- package/dist/addons/init-template.js.map +0 -1
- package/dist/addons/loader.d.ts.map +0 -1
- package/dist/addons/loader.js.map +0 -1
- package/dist/addons/manager.d.ts.map +0 -1
- package/dist/addons/manager.js.map +0 -1
- package/dist/addons/paths.d.ts.map +0 -1
- package/dist/addons/paths.js.map +0 -1
- package/dist/addons/registry.d.ts.map +0 -1
- package/dist/addons/registry.js.map +0 -1
- package/dist/addons/semver.d.ts.map +0 -1
- package/dist/addons/semver.js.map +0 -1
- package/dist/addons/types.d.ts.map +0 -1
- package/dist/addons/types.js.map +0 -1
- package/dist/addons/validate.d.ts.map +0 -1
- package/dist/addons/validate.js.map +0 -1
- package/dist/arkui/index.d.ts.map +0 -1
- package/dist/arkui/index.js.map +0 -1
- package/dist/arkui/migrate-passage.d.ts.map +0 -1
- package/dist/arkui/migrate-passage.js.map +0 -1
- package/dist/arkui/migrate-semantics.d.ts.map +0 -1
- package/dist/arkui/migrate-semantics.js.map +0 -1
- package/dist/arkui/migrate-snapshot.d.ts.map +0 -1
- package/dist/arkui/migrate-snapshot.js.map +0 -1
- package/dist/bin/addon-commands.d.ts.map +0 -1
- package/dist/bin/addon-commands.js.map +0 -1
- package/dist/bin/command-supervision.d.ts.map +0 -1
- package/dist/bin/command-supervision.js.map +0 -1
- package/dist/bin/fatal-handler.d.ts.map +0 -1
- package/dist/bin/fatal-handler.js.map +0 -1
- package/dist/bin/homegraph.d.ts.map +0 -1
- package/dist/bin/homegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js.map +0 -1
- package/dist/context/markers.d.ts.map +0 -1
- package/dist/context/markers.js.map +0 -1
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js.map +0 -1
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/db/wal-valve.d.ts.map +0 -1
- package/dist/db/wal-valve.js.map +0 -1
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/extraction/arkts-batch-worker.d.ts.map +0 -1
- package/dist/extraction/arkts-batch-worker.js.map +0 -1
- package/dist/extraction/astro-extractor.d.ts.map +0 -1
- package/dist/extraction/astro-extractor.js.map +0 -1
- package/dist/extraction/cfml-extractor.d.ts.map +0 -1
- package/dist/extraction/cfml-extractor.js.map +0 -1
- package/dist/extraction/context.d.ts.map +0 -1
- package/dist/extraction/context.js.map +0 -1
- package/dist/extraction/default-ignore.d.ts.map +0 -1
- package/dist/extraction/default-ignore.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/extraction-version.d.ts.map +0 -1
- package/dist/extraction/extraction-version.js.map +0 -1
- package/dist/extraction/function-ref.d.ts.map +0 -1
- package/dist/extraction/function-ref.js.map +0 -1
- package/dist/extraction/generated-detection.d.ts.map +0 -1
- package/dist/extraction/generated-detection.js.map +0 -1
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/arkts.d.ts.map +0 -1
- package/dist/extraction/languages/arkts.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/cfquery.d.ts.map +0 -1
- package/dist/extraction/languages/cfquery.js.map +0 -1
- package/dist/extraction/languages/cfscript.d.ts.map +0 -1
- package/dist/extraction/languages/cfscript.js.map +0 -1
- package/dist/extraction/languages/cobol.d.ts.map +0 -1
- package/dist/extraction/languages/cobol.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/erlang.d.ts.map +0 -1
- package/dist/extraction/languages/erlang.js.map +0 -1
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/lua.d.ts.map +0 -1
- package/dist/extraction/languages/lua.js.map +0 -1
- package/dist/extraction/languages/luau.d.ts.map +0 -1
- package/dist/extraction/languages/luau.js.map +0 -1
- package/dist/extraction/languages/nix.d.ts.map +0 -1
- package/dist/extraction/languages/nix.js.map +0 -1
- package/dist/extraction/languages/objc.d.ts.map +0 -1
- package/dist/extraction/languages/objc.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/r.d.ts.map +0 -1
- package/dist/extraction/languages/r.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/solidity.d.ts.map +0 -1
- package/dist/extraction/languages/solidity.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/terraform.d.ts.map +0 -1
- package/dist/extraction/languages/terraform.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/languages/vbnet.d.ts.map +0 -1
- package/dist/extraction/languages/vbnet.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/mybatis-extractor.d.ts.map +0 -1
- package/dist/extraction/mybatis-extractor.js.map +0 -1
- package/dist/extraction/parse-pool.d.ts.map +0 -1
- package/dist/extraction/parse-pool.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/razor-extractor.d.ts.map +0 -1
- package/dist/extraction/razor-extractor.js.map +0 -1
- package/dist/extraction/store-worker.d.ts.map +0 -1
- package/dist/extraction/store-worker.js.map +0 -1
- package/dist/extraction/store-writer.d.ts.map +0 -1
- package/dist/extraction/store-writer.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +0 -1
- package/dist/extraction/wasm-runtime-flags.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js.map +0 -1
- package/dist/graph-sources.d.ts.map +0 -1
- package/dist/graph-sources.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/antigravity.d.ts.map +0 -1
- package/dist/installer/targets/antigravity.js.map +0 -1
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codebuddy.d.ts.map +0 -1
- package/dist/installer/targets/codebuddy.js.map +0 -1
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/deveco.d.ts.map +0 -1
- package/dist/installer/targets/deveco.js.map +0 -1
- package/dist/installer/targets/gemini.d.ts.map +0 -1
- package/dist/installer/targets/gemini.js.map +0 -1
- package/dist/installer/targets/hermes.d.ts.map +0 -1
- package/dist/installer/targets/hermes.js.map +0 -1
- package/dist/installer/targets/kiro.d.ts.map +0 -1
- package/dist/installer/targets/kiro.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/daemon-manager.d.ts.map +0 -1
- package/dist/mcp/daemon-manager.js.map +0 -1
- package/dist/mcp/daemon-paths.d.ts.map +0 -1
- package/dist/mcp/daemon-paths.js.map +0 -1
- package/dist/mcp/daemon-registry.d.ts.map +0 -1
- package/dist/mcp/daemon-registry.js.map +0 -1
- package/dist/mcp/daemon.d.ts.map +0 -1
- package/dist/mcp/daemon.js.map +0 -1
- package/dist/mcp/diff-impact.d.ts.map +0 -1
- package/dist/mcp/diff-impact.js.map +0 -1
- package/dist/mcp/dynamic-boundaries.d.ts.map +0 -1
- package/dist/mcp/dynamic-boundaries.js.map +0 -1
- package/dist/mcp/early-ppid.d.ts.map +0 -1
- package/dist/mcp/early-ppid.js.map +0 -1
- package/dist/mcp/engine.d.ts.map +0 -1
- package/dist/mcp/engine.js.map +0 -1
- package/dist/mcp/explore-dedup.d.ts.map +0 -1
- package/dist/mcp/explore-dedup.js.map +0 -1
- package/dist/mcp/explore-repeat-guard.d.ts.map +0 -1
- package/dist/mcp/explore-repeat-guard.js.map +0 -1
- package/dist/mcp/explore-session-state.d.ts.map +0 -1
- package/dist/mcp/explore-session-state.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/liveness-watchdog.d.ts.map +0 -1
- package/dist/mcp/liveness-watchdog.js.map +0 -1
- package/dist/mcp/memory-budget.d.ts.map +0 -1
- package/dist/mcp/memory-budget.js.map +0 -1
- package/dist/mcp/ppid-watchdog.d.ts.map +0 -1
- package/dist/mcp/ppid-watchdog.js.map +0 -1
- package/dist/mcp/proxy.d.ts.map +0 -1
- package/dist/mcp/proxy.js.map +0 -1
- package/dist/mcp/query-cache.d.ts.map +0 -1
- package/dist/mcp/query-cache.js.map +0 -1
- package/dist/mcp/query-pool.d.ts.map +0 -1
- package/dist/mcp/query-pool.js.map +0 -1
- package/dist/mcp/query-worker.d.ts.map +0 -1
- package/dist/mcp/query-worker.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/session.d.ts.map +0 -1
- package/dist/mcp/session.js.map +0 -1
- package/dist/mcp/startup-handshake.d.ts.map +0 -1
- package/dist/mcp/startup-handshake.js.map +0 -1
- package/dist/mcp/stdin-teardown.d.ts.map +0 -1
- package/dist/mcp/stdin-teardown.js.map +0 -1
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js.map +0 -1
- package/dist/mcp/version.d.ts.map +0 -1
- package/dist/mcp/version.js.map +0 -1
- package/dist/project-config.d.ts.map +0 -1
- package/dist/project-config.js.map +0 -1
- package/dist/project-map/index.d.ts.map +0 -1
- package/dist/project-map/index.js.map +0 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +0 -1
- package/dist/resolution/c-fnptr-synthesizer.js.map +0 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +0 -1
- package/dist/resolution/callback-synthesizer.js.map +0 -1
- package/dist/resolution/cooperative-yield.d.ts.map +0 -1
- package/dist/resolution/cooperative-yield.js.map +0 -1
- package/dist/resolution/frameworks/arkts-entry.d.ts.map +0 -1
- package/dist/resolution/frameworks/arkts-entry.js.map +0 -1
- package/dist/resolution/frameworks/arkts-napi.d.ts.map +0 -1
- package/dist/resolution/frameworks/arkts-napi.js.map +0 -1
- package/dist/resolution/frameworks/astro.d.ts.map +0 -1
- package/dist/resolution/frameworks/astro.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/cics.d.ts.map +0 -1
- package/dist/resolution/frameworks/cics.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/drupal.d.ts.map +0 -1
- package/dist/resolution/frameworks/drupal.js.map +0 -1
- package/dist/resolution/frameworks/expo-modules.d.ts.map +0 -1
- package/dist/resolution/frameworks/expo-modules.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/fabric.d.ts.map +0 -1
- package/dist/resolution/frameworks/fabric.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/goframe.d.ts.map +0 -1
- package/dist/resolution/frameworks/goframe.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
- package/dist/resolution/frameworks/nestjs.js.map +0 -1
- package/dist/resolution/frameworks/play.d.ts.map +0 -1
- package/dist/resolution/frameworks/play.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react-native.d.ts.map +0 -1
- package/dist/resolution/frameworks/react-native.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift-objc.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift-objc.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/terraform.d.ts.map +0 -1
- package/dist/resolution/frameworks/terraform.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/go-module.d.ts.map +0 -1
- package/dist/resolution/go-module.js.map +0 -1
- package/dist/resolution/goframe-synthesizer.d.ts.map +0 -1
- package/dist/resolution/goframe-synthesizer.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/lru-cache.d.ts.map +0 -1
- package/dist/resolution/lru-cache.js.map +0 -1
- package/dist/resolution/memory-budget.d.ts.map +0 -1
- package/dist/resolution/memory-budget.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/resolver-pool.d.ts.map +0 -1
- package/dist/resolution/resolver-pool.js.map +0 -1
- package/dist/resolution/resolver-worker.d.ts.map +0 -1
- package/dist/resolution/resolver-worker.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/swift-objc-bridge.d.ts.map +0 -1
- package/dist/resolution/swift-objc-bridge.js.map +0 -1
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js.map +0 -1
- package/dist/resolution/workspace-packages.d.ts.map +0 -1
- package/dist/resolution/workspace-packages.js.map +0 -1
- package/dist/search/identifier-segments.d.ts.map +0 -1
- package/dist/search/identifier-segments.js.map +0 -1
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js.map +0 -1
- package/dist/spec/build/diff-parser.d.ts.map +0 -1
- package/dist/spec/build/diff-parser.js.map +0 -1
- package/dist/spec/build/pipeline.d.ts.map +0 -1
- package/dist/spec/build/pipeline.js.map +0 -1
- package/dist/spec/build/scan.d.ts.map +0 -1
- package/dist/spec/build/scan.js.map +0 -1
- package/dist/spec/build/scope-resolver.d.ts.map +0 -1
- package/dist/spec/build/scope-resolver.js.map +0 -1
- package/dist/spec/build/spec-extractor.d.ts.map +0 -1
- package/dist/spec/build/spec-extractor.js.map +0 -1
- package/dist/spec/config.d.ts.map +0 -1
- package/dist/spec/config.js.map +0 -1
- package/dist/spec/db/commit-node.d.ts.map +0 -1
- package/dist/spec/db/commit-node.js.map +0 -1
- package/dist/spec/db/fragment-node.d.ts.map +0 -1
- package/dist/spec/db/fragment-node.js.map +0 -1
- package/dist/spec/db/fts.d.ts.map +0 -1
- package/dist/spec/db/fts.js.map +0 -1
- package/dist/spec/db/index.d.ts.map +0 -1
- package/dist/spec/db/index.js.map +0 -1
- package/dist/spec/db/persist.d.ts.map +0 -1
- package/dist/spec/db/persist.js.map +0 -1
- package/dist/spec/db/relations.d.ts.map +0 -1
- package/dist/spec/db/relations.js.map +0 -1
- package/dist/spec/db/schema.d.ts.map +0 -1
- package/dist/spec/db/schema.js.map +0 -1
- package/dist/spec/db/spec-node.d.ts.map +0 -1
- package/dist/spec/db/spec-node.js.map +0 -1
- package/dist/spec/db/sql-utils.d.ts.map +0 -1
- package/dist/spec/db/sql-utils.js.map +0 -1
- package/dist/spec/evolve/cluster-context.d.ts.map +0 -1
- package/dist/spec/evolve/cluster-context.js.map +0 -1
- package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +0 -1
- package/dist/spec/evolve/commit-spec-analyzer.js.map +0 -1
- package/dist/spec/evolve/commit-spec-persister.d.ts.map +0 -1
- package/dist/spec/evolve/commit-spec-persister.js.map +0 -1
- package/dist/spec/evolve/impact-locator.d.ts.map +0 -1
- package/dist/spec/evolve/impact-locator.js.map +0 -1
- package/dist/spec/evolve/pipeline.d.ts.map +0 -1
- package/dist/spec/evolve/pipeline.js.map +0 -1
- package/dist/spec/evolve/spec-rewriter.d.ts.map +0 -1
- package/dist/spec/evolve/spec-rewriter.js.map +0 -1
- package/dist/spec/git/commits.d.ts.map +0 -1
- package/dist/spec/git/commits.js.map +0 -1
- package/dist/spec/git/exec.d.ts.map +0 -1
- package/dist/spec/git/exec.js.map +0 -1
- package/dist/spec/git/index.d.ts.map +0 -1
- package/dist/spec/git/index.js.map +0 -1
- package/dist/spec/graph/index.d.ts.map +0 -1
- package/dist/spec/graph/index.js.map +0 -1
- package/dist/spec/graph/queries.d.ts.map +0 -1
- package/dist/spec/graph/queries.js.map +0 -1
- package/dist/spec/llm/agent-client.d.ts.map +0 -1
- package/dist/spec/llm/agent-client.js.map +0 -1
- package/dist/spec/llm/agents/claude-code.d.ts.map +0 -1
- package/dist/spec/llm/agents/claude-code.js.map +0 -1
- package/dist/spec/llm/agents/codex.d.ts.map +0 -1
- package/dist/spec/llm/agents/codex.js.map +0 -1
- package/dist/spec/llm/agents/detect-utils.d.ts.map +0 -1
- package/dist/spec/llm/agents/detect-utils.js.map +0 -1
- package/dist/spec/llm/agents/deveco-code.d.ts.map +0 -1
- package/dist/spec/llm/agents/deveco-code.js.map +0 -1
- package/dist/spec/llm/agents/index.d.ts.map +0 -1
- package/dist/spec/llm/agents/index.js.map +0 -1
- package/dist/spec/llm/agents/types.d.ts.map +0 -1
- package/dist/spec/llm/agents/types.js.map +0 -1
- package/dist/spec/llm/client.d.ts.map +0 -1
- package/dist/spec/llm/client.js.map +0 -1
- package/dist/spec/llm/factory.d.ts.map +0 -1
- package/dist/spec/llm/factory.js.map +0 -1
- package/dist/spec/llm/prompts.d.ts.map +0 -1
- package/dist/spec/llm/prompts.js.map +0 -1
- package/dist/spec/llm/retry.d.ts.map +0 -1
- package/dist/spec/llm/retry.js.map +0 -1
- package/dist/spec/mine/addon/adapter.d.ts.map +0 -1
- package/dist/spec/mine/addon/adapter.js.map +0 -1
- package/dist/spec/mine/addon/render.d.ts.map +0 -1
- package/dist/spec/mine/addon/render.js.map +0 -1
- package/dist/spec/mine/addon/types.d.ts.map +0 -1
- package/dist/spec/mine/addon/types.js.map +0 -1
- package/dist/spec/mine/clustering/features.d.ts.map +0 -1
- package/dist/spec/mine/clustering/features.js.map +0 -1
- package/dist/spec/mine/clustering/index.d.ts.map +0 -1
- package/dist/spec/mine/clustering/index.js.map +0 -1
- package/dist/spec/mine/clustering/leiden.d.ts.map +0 -1
- package/dist/spec/mine/clustering/leiden.js.map +0 -1
- package/dist/spec/mine/clustering/text-similarity.d.ts.map +0 -1
- package/dist/spec/mine/clustering/text-similarity.js.map +0 -1
- package/dist/spec/mine/generator.d.ts.map +0 -1
- package/dist/spec/mine/generator.js.map +0 -1
- package/dist/spec/mine/persist.d.ts.map +0 -1
- package/dist/spec/mine/persist.js.map +0 -1
- package/dist/spec/mine/pipeline.d.ts.map +0 -1
- package/dist/spec/mine/pipeline.js.map +0 -1
- package/dist/spec/mine/scanner.d.ts.map +0 -1
- package/dist/spec/mine/scanner.js.map +0 -1
- package/dist/spec/types.d.ts.map +0 -1
- package/dist/spec/types.js.map +0 -1
- package/dist/spec/ui/index.d.ts.map +0 -1
- package/dist/spec/ui/index.js.map +0 -1
- package/dist/spec/ui/progress-handler.d.ts.map +0 -1
- package/dist/spec/ui/progress-handler.js.map +0 -1
- package/dist/spec/ui/progress.d.ts.map +0 -1
- package/dist/spec/ui/progress.js.map +0 -1
- package/dist/spec/utils/fs.d.ts.map +0 -1
- package/dist/spec/utils/fs.js.map +0 -1
- package/dist/spec/utils/index.d.ts.map +0 -1
- package/dist/spec/utils/index.js.map +0 -1
- package/dist/spec/utils/meta.d.ts.map +0 -1
- package/dist/spec/utils/meta.js.map +0 -1
- package/dist/spec/utils/truncate.d.ts.map +0 -1
- package/dist/spec/utils/truncate.js.map +0 -1
- package/dist/sync/git-hooks.d.ts.map +0 -1
- package/dist/sync/git-hooks.js.map +0 -1
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watch-policy.d.ts.map +0 -1
- package/dist/sync/watch-policy.js.map +0 -1
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js.map +0 -1
- package/dist/sync/worktree.d.ts.map +0 -1
- package/dist/sync/worktree.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js.map +0 -1
- package/dist/upgrade/index.d.ts.map +0 -1
- package/dist/upgrade/index.js.map +0 -1
- package/dist/upgrade/remove-binary.d.ts.map +0 -1
- package/dist/upgrade/remove-binary.js.map +0 -1
- package/dist/upgrade/update-check.d.ts.map +0 -1
- package/dist/upgrade/update-check.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SQLite Adapter
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Two-tier selection (first success wins):
|
|
5
5
|
* 1. `node:sqlite` (`DatabaseSync`) — real SQLite + WAL + FTS5, Node ≥22.5
|
|
6
6
|
* (skipped when the build lacks FTS5 — e.g. some Node 23.x official builds)
|
|
7
|
-
* 2. `
|
|
8
|
-
* 3. `node-sqlite3-wasm` — last-resort fallback (no WAL; slower / lock-prone)
|
|
7
|
+
* 2. `node-sqlite3-wasm` — cross-platform fallback (no WAL; slower / lock-prone)
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
* FTS5 is present and skips the native build. Override with
|
|
12
|
-
* `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|native|wasm`.
|
|
13
|
-
* optionalDependency `better-sqlite3` is 12.x (Node 22+); wasm remains the last resort.
|
|
9
|
+
* Override with `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|wasm`.
|
|
14
10
|
*/
|
|
15
11
|
export interface SqliteStatement {
|
|
16
12
|
run(...params: any[]): {
|
|
@@ -37,11 +33,11 @@ export interface SqliteDatabase {
|
|
|
37
33
|
readonly open: boolean;
|
|
38
34
|
}
|
|
39
35
|
/** Active SQLite backend after {@link createDatabase}. */
|
|
40
|
-
export type SqliteBackend = 'node-sqlite' | '
|
|
36
|
+
export type SqliteBackend = 'node-sqlite' | 'wasm';
|
|
41
37
|
/**
|
|
42
38
|
* One-line recovery hint when WASM is active (no WAL — slower / lock-prone).
|
|
43
39
|
*/
|
|
44
|
-
export declare const WASM_FALLBACK_FIX_RECIPE:
|
|
40
|
+
export declare const WASM_FALLBACK_FIX_RECIPE = "upgrade to Node.js 22.5+ (uses built-in node:sqlite with FTS5), then restart homegraph";
|
|
45
41
|
/**
|
|
46
42
|
* Banner shown to stderr when falling back to WASM.
|
|
47
43
|
*/
|
|
@@ -49,11 +45,9 @@ export declare function buildWasmFallbackBanner(priorErrors?: string): string;
|
|
|
49
45
|
/** True when `require('node:sqlite').DatabaseSync` succeeds. */
|
|
50
46
|
export declare function isNodeSqliteAvailable(): boolean;
|
|
51
47
|
export declare function isNodeSqliteFts5Available(): boolean;
|
|
52
|
-
/** True when `require('better-sqlite3')` succeeds. */
|
|
53
|
-
export declare function isNativeSqliteAvailable(): boolean;
|
|
54
48
|
/**
|
|
55
49
|
* Create a database connection.
|
|
56
|
-
* Order: node:sqlite (with FTS5) →
|
|
50
|
+
* Order: node:sqlite (with FTS5) → node-sqlite3-wasm (unless overridden).
|
|
57
51
|
*/
|
|
58
52
|
export declare function createDatabase(dbPath: string, opts?: {
|
|
59
53
|
readOnly?: boolean;
|
|
@@ -2,30 +2,23 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* SQLite Adapter
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Two-tier selection (first success wins):
|
|
6
6
|
* 1. `node:sqlite` (`DatabaseSync`) — real SQLite + WAL + FTS5, Node ≥22.5
|
|
7
7
|
* (skipped when the build lacks FTS5 — e.g. some Node 23.x official builds)
|
|
8
|
-
* 2. `
|
|
9
|
-
* 3. `node-sqlite3-wasm` — last-resort fallback (no WAL; slower / lock-prone)
|
|
8
|
+
* 2. `node-sqlite3-wasm` — cross-platform fallback (no WAL; slower / lock-prone)
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* FTS5 is present and skips the native build. Override with
|
|
13
|
-
* `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|native|wasm`.
|
|
14
|
-
* optionalDependency `better-sqlite3` is 12.x (Node 22+); wasm remains the last resort.
|
|
10
|
+
* Override with `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|wasm`.
|
|
15
11
|
*/
|
|
16
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
13
|
exports.WASM_FALLBACK_FIX_RECIPE = void 0;
|
|
18
14
|
exports.buildWasmFallbackBanner = buildWasmFallbackBanner;
|
|
19
15
|
exports.isNodeSqliteAvailable = isNodeSqliteAvailable;
|
|
20
16
|
exports.isNodeSqliteFts5Available = isNodeSqliteFts5Available;
|
|
21
|
-
exports.isNativeSqliteAvailable = isNativeSqliteAvailable;
|
|
22
17
|
exports.createDatabase = createDatabase;
|
|
23
18
|
/**
|
|
24
19
|
* One-line recovery hint when WASM is active (no WAL — slower / lock-prone).
|
|
25
20
|
*/
|
|
26
|
-
exports.WASM_FALLBACK_FIX_RECIPE = 'upgrade to Node.js 22.5+ (uses built-in node:sqlite),
|
|
27
|
-
'`xcode-select --install` (macOS) / `apt install build-essential` (Debian/Ubuntu) ' +
|
|
28
|
-
'then `npm rebuild better-sqlite3`.';
|
|
21
|
+
exports.WASM_FALLBACK_FIX_RECIPE = 'upgrade to Node.js 22.5+ (uses built-in node:sqlite with FTS5), then restart homegraph';
|
|
29
22
|
/**
|
|
30
23
|
* Banner shown to stderr when falling back to WASM.
|
|
31
24
|
*/
|
|
@@ -33,20 +26,15 @@ function buildWasmFallbackBanner(priorErrors) {
|
|
|
33
26
|
const sep = '─'.repeat(72);
|
|
34
27
|
const lines = [
|
|
35
28
|
sep,
|
|
36
|
-
'[HomeGraph] WASM SQLite fallback active (node:sqlite
|
|
29
|
+
'[HomeGraph] WASM SQLite fallback active (node:sqlite unavailable or lacks FTS5)',
|
|
37
30
|
sep,
|
|
38
31
|
'Indexing and sync will be 5-10x slower than a WAL backend, and concurrent',
|
|
39
|
-
'reads can hit "database is locked". Prefer Node 22.5
|
|
32
|
+
'reads can hit "database is locked". Prefer Node.js 22.5 or newer.',
|
|
40
33
|
'',
|
|
41
|
-
'Fix — use built-in SQLite
|
|
34
|
+
'Fix — use built-in SQLite:',
|
|
42
35
|
' Use Node.js 22.5 or newer, then restart homegraph',
|
|
43
36
|
'',
|
|
44
|
-
'
|
|
45
|
-
' macOS: xcode-select --install && npm rebuild better-sqlite3',
|
|
46
|
-
' Linux: sudo apt install build-essential python3 make && npm rebuild better-sqlite3',
|
|
47
|
-
' Any: npm install better-sqlite3 --save',
|
|
48
|
-
'',
|
|
49
|
-
'Verify after fix: `homegraph status` should show Backend: node-sqlite or native.',
|
|
37
|
+
'Verify after fix: `homegraph status` should show Backend: node-sqlite.',
|
|
50
38
|
];
|
|
51
39
|
if (priorErrors) {
|
|
52
40
|
lines.push('', `Prior load errors: ${priorErrors}`);
|
|
@@ -155,20 +143,9 @@ function isNodeSqliteFts5Available() {
|
|
|
155
143
|
}
|
|
156
144
|
return cachedNodeSqliteFts5;
|
|
157
145
|
}
|
|
158
|
-
/** True when `require('better-sqlite3')` succeeds. */
|
|
159
|
-
function isNativeSqliteAvailable() {
|
|
160
|
-
try {
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
162
|
-
require('better-sqlite3');
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
146
|
/**
|
|
170
147
|
* Wraps Node's built-in `node:sqlite` (`DatabaseSync`) to match the
|
|
171
|
-
*
|
|
148
|
+
* statement/database interface the rest of the code expects.
|
|
172
149
|
*/
|
|
173
150
|
class NodeSqliteAdapter {
|
|
174
151
|
_db;
|
|
@@ -362,10 +339,11 @@ class WasmDatabaseAdapter {
|
|
|
362
339
|
}
|
|
363
340
|
function resolveBackendOrder() {
|
|
364
341
|
const raw = process.env.HOMEGRAPH_SQLITE_BACKEND?.trim().toLowerCase();
|
|
365
|
-
if (raw === 'node-sqlite' || raw === '
|
|
342
|
+
if (raw === 'node-sqlite' || raw === 'wasm') {
|
|
366
343
|
return [raw];
|
|
367
344
|
}
|
|
368
|
-
|
|
345
|
+
// Unknown values (including legacy `native`) fall through to the default order.
|
|
346
|
+
return ['node-sqlite', 'wasm'];
|
|
369
347
|
}
|
|
370
348
|
function tryOpenBackend(backend, dbPath, opts) {
|
|
371
349
|
try {
|
|
@@ -379,12 +357,6 @@ function tryOpenBackend(backend, dbPath, opts) {
|
|
|
379
357
|
}
|
|
380
358
|
return { db: new NodeSqliteAdapter(dbPath, opts), backend: 'node-sqlite' };
|
|
381
359
|
}
|
|
382
|
-
if (backend === 'native') {
|
|
383
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
384
|
-
const Database = require('better-sqlite3');
|
|
385
|
-
const db = opts?.readOnly ? new Database(dbPath, { readonly: true }) : new Database(dbPath);
|
|
386
|
-
return { db: db, backend: 'native' };
|
|
387
|
-
}
|
|
388
360
|
return { db: new WasmDatabaseAdapter(dbPath, opts), backend: 'wasm' };
|
|
389
361
|
}
|
|
390
362
|
catch (error) {
|
|
@@ -393,7 +365,7 @@ function tryOpenBackend(backend, dbPath, opts) {
|
|
|
393
365
|
}
|
|
394
366
|
/**
|
|
395
367
|
* Create a database connection.
|
|
396
|
-
* Order: node:sqlite (with FTS5) →
|
|
368
|
+
* Order: node:sqlite (with FTS5) → node-sqlite3-wasm (unless overridden).
|
|
397
369
|
*/
|
|
398
370
|
function createDatabase(dbPath, opts) {
|
|
399
371
|
const order = resolveBackendOrder();
|
package/dist/directory.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare function isInitialized(projectRoot: string): boolean;
|
|
|
63
63
|
* The returned string is a human phrase that slots into "… looks like {reason}".
|
|
64
64
|
*/
|
|
65
65
|
export declare function unsafeIndexRootReason(projectRoot: string): string | null;
|
|
66
|
-
export declare function findNearestHomeGraphRoot(startPath: string): string | null;
|
|
66
|
+
export declare function findNearestHomeGraphRoot(startPath: string, floor?: string): string | null;
|
|
67
67
|
/**
|
|
68
68
|
* Indexed sub-project roots beneath `root` (bounded breadth-first scan). For
|
|
69
69
|
* the monorepo case behind #964: the index lives in a CHILD
|
package/dist/directory.js
CHANGED
|
@@ -183,17 +183,41 @@ function unsafeIndexRootReason(projectRoot) {
|
|
|
183
183
|
}
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
186
|
-
function findNearestHomeGraphRoot(startPath) {
|
|
186
|
+
function findNearestHomeGraphRoot(startPath, floor) {
|
|
187
|
+
// A floor (an MCP host's explicit --path / rootUri) bounds the walk: an
|
|
188
|
+
// ancestor .homegraph above it must not be adopted — a stray ancestor index
|
|
189
|
+
// hijacks every nested server, whose daemon then indexes the wrong (often
|
|
190
|
+
// huge) tree and OOMs (spec 0028). Only honored when it contains the start;
|
|
191
|
+
// a misconfigured floor must not break discovery.
|
|
192
|
+
const resolveBestEffort = (p) => {
|
|
193
|
+
try {
|
|
194
|
+
return fs.realpathSync(path.resolve(p));
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return path.resolve(p);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
// Walk the literal chain (returned to the caller in ITS coordinate system);
|
|
201
|
+
// track the realpath chain in parallel only for the boundary comparison, so
|
|
202
|
+
// a symlinked prefix (macOS /var vs /private/var) cannot desync the floor.
|
|
187
203
|
let current = path.resolve(startPath);
|
|
204
|
+
let currentReal = resolveBestEffort(current);
|
|
188
205
|
const root = path.parse(current).root;
|
|
206
|
+
const floorDir = floor ? resolveBestEffort(floor) : null;
|
|
207
|
+
const clamped = floorDir !== null &&
|
|
208
|
+
(currentReal === floorDir || currentReal.startsWith(floorDir + path.sep));
|
|
189
209
|
while (current !== root) {
|
|
190
210
|
if (isInitialized(current)) {
|
|
191
211
|
return current;
|
|
192
212
|
}
|
|
213
|
+
if (clamped && currentReal === floorDir) {
|
|
214
|
+
return null; // the floor itself has no index — stop, never look above
|
|
215
|
+
}
|
|
193
216
|
const parent = path.dirname(current);
|
|
194
217
|
if (parent === current)
|
|
195
218
|
break; // Reached filesystem root
|
|
196
219
|
current = parent;
|
|
220
|
+
currentReal = path.dirname(currentReal);
|
|
197
221
|
}
|
|
198
222
|
// Check root as well
|
|
199
223
|
if (isInitialized(current)) {
|
|
@@ -51,6 +51,8 @@ export declare function isArkModuleJson5(filePath: string): boolean;
|
|
|
51
51
|
* Idempotent — safe to call multiple times.
|
|
52
52
|
*/
|
|
53
53
|
export declare function initGrammars(): Promise<void>;
|
|
54
|
+
/** Filenames copy-assets must ship under dist/extraction/wasm/ (Spec 0031). */
|
|
55
|
+
export declare function vendoredWasmFilenames(): string[];
|
|
54
56
|
/**
|
|
55
57
|
* Pre-read the grammar WASM bytes for an index set, keyed by language. The
|
|
56
58
|
* orchestrator reads each grammar ONCE and hands the bytes to every parse
|
|
@@ -47,6 +47,7 @@ exports.isErlangAppFile = isErlangAppFile;
|
|
|
47
47
|
exports.isPlayRoutesFile = isPlayRoutesFile;
|
|
48
48
|
exports.isArkModuleJson5 = isArkModuleJson5;
|
|
49
49
|
exports.initGrammars = initGrammars;
|
|
50
|
+
exports.vendoredWasmFilenames = vendoredWasmFilenames;
|
|
50
51
|
exports.readGrammarWasmBytes = readGrammarWasmBytes;
|
|
51
52
|
exports.loadGrammarsForLanguages = loadGrammarsForLanguages;
|
|
52
53
|
exports.loadAllGrammars = loadAllGrammars;
|
|
@@ -309,13 +310,8 @@ async function initGrammars() {
|
|
|
309
310
|
* primary constructors natively. Terraform: tree-sitter-wasms does not ship
|
|
310
311
|
* HCL/Terraform at all, so we vendor the prebuilt tree-sitter-terraform.wasm
|
|
311
312
|
* from @tree-sitter-grammars/tree-sitter-hcl 1.2.0 (Apache-2.0) —
|
|
312
|
-
* byte-identical to the npm package's artifact.
|
|
313
|
-
*
|
|
314
|
-
* the tree-sitter-arkts 0.2.0 npm package (harmony-contrib/tree-sitter-arkts,
|
|
315
|
-
* MIT) — byte-identical to the npm tarball's artifact. It extends the
|
|
316
|
-
* tree-sitter-javascript grammar the same way tree-sitter-typescript does,
|
|
317
|
-
* adding `struct_declaration` and the `arkui_component_expression` build()
|
|
318
|
-
* DSL. Nix: tree-sitter-wasms doesn't ship it; we vendor a wasm built from
|
|
313
|
+
* byte-identical to the npm package's artifact. Nix: tree-sitter-wasms doesn't
|
|
314
|
+
* ship it; we vendor a wasm built from
|
|
319
315
|
* nix-community/tree-sitter-nix @ 3d0173d (MIT) with tree-sitter-cli 0.25.10
|
|
320
316
|
* (`generate` + `build --wasm`, ABI 15 — upstream's checked-in parser.c is
|
|
321
317
|
* still ABI 13; all 54 upstream corpus tests pass on the regenerated parser).
|
|
@@ -324,6 +320,10 @@ const VENDORED_WASM_LANGS = new Set([
|
|
|
324
320
|
'pascal', 'scala', 'lua', 'luau', 'csharp', 'r', 'cfml', 'cfscript', 'cfquery',
|
|
325
321
|
'cobol', 'vbnet', 'erlang', 'terraform', 'nix',
|
|
326
322
|
]);
|
|
323
|
+
/** Filenames copy-assets must ship under dist/extraction/wasm/ (Spec 0031). */
|
|
324
|
+
function vendoredWasmFilenames() {
|
|
325
|
+
return [...new Set([...VENDORED_WASM_LANGS].map((lang) => WASM_GRAMMAR_FILES[lang]))].sort();
|
|
326
|
+
}
|
|
327
327
|
/** Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms). */
|
|
328
328
|
function resolveWasmPath(lang) {
|
|
329
329
|
const wasmFile = WASM_GRAMMAR_FILES[lang];
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { ArkField, ArkFile, ArkMethod, ClassSignature, MethodSignature } from 'arkanalyzer';
|
|
28
28
|
import type { ViewTreeNode } from 'arkanalyzer';
|
|
29
|
-
import { ExtractionError, ExtractionResult } from '../../types';
|
|
29
|
+
import { ExtractionError, ExtractionResult, Language } from '../../types';
|
|
30
30
|
import type { QueryBuilder } from '../../db/queries';
|
|
31
31
|
import type { IndexProgress, IndexResult } from '../index';
|
|
32
32
|
/** Strip arkanalyzer file-location prefixes from type text (`@proj/file.ets: Foo` → `Foo`). */
|
|
@@ -62,6 +62,22 @@ export declare function normalizeHarmonyModuleSrcPath(srcPath: string): string;
|
|
|
62
62
|
* Returns [] when missing or unparsable — callers should fall back to full Scene.
|
|
63
63
|
*/
|
|
64
64
|
export declare function listHarmonyProjectModules(rootDir: string): HarmonyModuleRef[];
|
|
65
|
+
/**
|
|
66
|
+
* Nearest package-like directory for an orphan Ark source, or the first path
|
|
67
|
+
* segment. Never returns the project root (registering `.` would re-scan every
|
|
68
|
+
* Harmony module). Lone files directly under the root return null.
|
|
69
|
+
*/
|
|
70
|
+
export declare function findSyntheticArkModuleRoot(rootDir: string, relFile: string): string | null;
|
|
71
|
+
/**
|
|
72
|
+
* ArkAnalyzer sources under `scannedFiles` that are not inside any
|
|
73
|
+
* build-profile PROJECT module `srcPath`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function listOrphanArkAnalyzerSources(scannedFiles: Iterable<string>, harmonyModules: HarmonyModuleRef[]): string[];
|
|
76
|
+
/**
|
|
77
|
+
* Cluster orphan `.ets`/`.ts`/`.d.ts` into synthetic PROJECT module roots
|
|
78
|
+
* (e.g. `HMRouterPlugin` for a Node hvigor plugin living beside HAP modules).
|
|
79
|
+
*/
|
|
80
|
+
export declare function listSyntheticArkModuleRoots(rootDir: string, scannedFiles: Iterable<string>, harmonyModules?: HarmonyModuleRef[]): HarmonyModuleRef[];
|
|
65
81
|
export type DirtyHarmonyModuleResolution = {
|
|
66
82
|
mode: 'full';
|
|
67
83
|
reason: string;
|
|
@@ -73,12 +89,18 @@ export type DirtyHarmonyModuleResolution = {
|
|
|
73
89
|
};
|
|
74
90
|
/**
|
|
75
91
|
* Map changed/removed paths to Harmony modules for incremental ArkTS sync.
|
|
76
|
-
* Structural project files (`build-profile.json5`, root `oh-package.json5`)
|
|
77
|
-
*
|
|
92
|
+
* Structural project files (`build-profile.json5`, root `oh-package.json5`)
|
|
93
|
+
* force a full rebuild. Orphan trees covered by synthetic PROJECT modules
|
|
94
|
+
* (e.g. `HMRouterPlugin`) map to those module srcPaths instead of full rebuild.
|
|
78
95
|
*/
|
|
79
96
|
export declare function resolveDirtyHarmonyModules(rootDir: string, changedFiles: Iterable<string>): DirtyHarmonyModuleResolution;
|
|
80
97
|
/** HarmonyOS sources indexed via ArkAnalyzer Scene batch (`.ets`, `.ts`, `.d.ts`). */
|
|
81
98
|
export declare function isArkAnalyzerSourcePath(filePath: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Graph `language` tag for an ArkAnalyzer-indexed path. Extraction still uses AA;
|
|
101
|
+
* the tag must match the source kind so status / language filters stay truthful.
|
|
102
|
+
*/
|
|
103
|
+
export declare function languageForArkAnalyzerPath(filePath: string): Language;
|
|
82
104
|
/**
|
|
83
105
|
* Enumerate ArkAnalyzer sources under `rootDir`, using the same ignore rules as
|
|
84
106
|
* `scanDirectory` (defaults like `build/`/`dist/`, root `.gitignore`, exclude).
|
|
@@ -69,8 +69,12 @@ exports.buildArkMethodSignatureFields = buildArkMethodSignatureFields;
|
|
|
69
69
|
exports.shouldUseIsolatedArkTSBuild = shouldUseIsolatedArkTSBuild;
|
|
70
70
|
exports.normalizeHarmonyModuleSrcPath = normalizeHarmonyModuleSrcPath;
|
|
71
71
|
exports.listHarmonyProjectModules = listHarmonyProjectModules;
|
|
72
|
+
exports.findSyntheticArkModuleRoot = findSyntheticArkModuleRoot;
|
|
73
|
+
exports.listOrphanArkAnalyzerSources = listOrphanArkAnalyzerSources;
|
|
74
|
+
exports.listSyntheticArkModuleRoots = listSyntheticArkModuleRoots;
|
|
72
75
|
exports.resolveDirtyHarmonyModules = resolveDirtyHarmonyModules;
|
|
73
76
|
exports.isArkAnalyzerSourcePath = isArkAnalyzerSourcePath;
|
|
77
|
+
exports.languageForArkAnalyzerPath = languageForArkAnalyzerPath;
|
|
74
78
|
exports.scanEtsFiles = scanEtsFiles;
|
|
75
79
|
exports.runIsolatedArkTSBatchEntry = runIsolatedArkTSBatchEntry;
|
|
76
80
|
exports.primeArkTSBatch = primeArkTSBatch;
|
|
@@ -353,6 +357,121 @@ function listHarmonyProjectModules(rootDir) {
|
|
|
353
357
|
}
|
|
354
358
|
return out;
|
|
355
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Absolute path for ArkAnalyzer module registration (realpath when available).
|
|
362
|
+
* Must match how incremental target matching resolves `srcPath`.
|
|
363
|
+
*/
|
|
364
|
+
function resolveArkModuleAbsPath(rootDir, relSrcPath) {
|
|
365
|
+
const resolved = path.resolve(rootDir, relSrcPath);
|
|
366
|
+
try {
|
|
367
|
+
return fs.realpathSync(resolved);
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
return resolved;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Nearest package-like directory for an orphan Ark source, or the first path
|
|
375
|
+
* segment. Never returns the project root (registering `.` would re-scan every
|
|
376
|
+
* Harmony module). Lone files directly under the root return null.
|
|
377
|
+
*/
|
|
378
|
+
function findSyntheticArkModuleRoot(rootDir, relFile) {
|
|
379
|
+
const file = normIndexPath(relFile);
|
|
380
|
+
if (!file || file.startsWith('@'))
|
|
381
|
+
return null;
|
|
382
|
+
let dir = path.posix.dirname(file);
|
|
383
|
+
if (dir === '.' || dir === '')
|
|
384
|
+
return null;
|
|
385
|
+
const rootAbs = path.resolve(rootDir);
|
|
386
|
+
let curAbs = path.resolve(rootDir, dir);
|
|
387
|
+
for (;;) {
|
|
388
|
+
const relFromRoot = path.relative(rootAbs, curAbs);
|
|
389
|
+
if (!relFromRoot || relFromRoot.startsWith('..') || path.isAbsolute(relFromRoot))
|
|
390
|
+
break;
|
|
391
|
+
const rel = relFromRoot.replace(/\\/g, '/');
|
|
392
|
+
if (fs.existsSync(path.join(curAbs, 'package.json')) ||
|
|
393
|
+
fs.existsSync(path.join(curAbs, 'oh-package.json5'))) {
|
|
394
|
+
return normalizeHarmonyModuleSrcPath(rel);
|
|
395
|
+
}
|
|
396
|
+
const parent = path.dirname(curAbs);
|
|
397
|
+
if (parent === curAbs)
|
|
398
|
+
break;
|
|
399
|
+
curAbs = parent;
|
|
400
|
+
}
|
|
401
|
+
const first = file.split('/')[0];
|
|
402
|
+
if (!first || first === file)
|
|
403
|
+
return null;
|
|
404
|
+
return normalizeHarmonyModuleSrcPath(first);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* ArkAnalyzer sources under `scannedFiles` that are not inside any
|
|
408
|
+
* build-profile PROJECT module `srcPath`.
|
|
409
|
+
*/
|
|
410
|
+
function listOrphanArkAnalyzerSources(scannedFiles, harmonyModules) {
|
|
411
|
+
const orphans = [];
|
|
412
|
+
for (const raw of scannedFiles) {
|
|
413
|
+
const f = normIndexPath(raw);
|
|
414
|
+
if (!f || !isArkAnalyzerSourcePath(f) || f.startsWith('@'))
|
|
415
|
+
continue;
|
|
416
|
+
if (findLongestHarmonyModule(f, harmonyModules))
|
|
417
|
+
continue;
|
|
418
|
+
orphans.push(f);
|
|
419
|
+
}
|
|
420
|
+
orphans.sort();
|
|
421
|
+
return orphans;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Cluster orphan `.ets`/`.ts`/`.d.ts` into synthetic PROJECT module roots
|
|
425
|
+
* (e.g. `HMRouterPlugin` for a Node hvigor plugin living beside HAP modules).
|
|
426
|
+
*/
|
|
427
|
+
function listSyntheticArkModuleRoots(rootDir, scannedFiles, harmonyModules) {
|
|
428
|
+
const modules = harmonyModules ?? listHarmonyProjectModules(rootDir);
|
|
429
|
+
const orphans = listOrphanArkAnalyzerSources(scannedFiles, modules);
|
|
430
|
+
const bySrc = new Map();
|
|
431
|
+
for (const f of orphans) {
|
|
432
|
+
const srcPath = findSyntheticArkModuleRoot(rootDir, f);
|
|
433
|
+
if (!srcPath)
|
|
434
|
+
continue;
|
|
435
|
+
// Never shadow a real Harmony module path.
|
|
436
|
+
if (modules.some((m) => m.srcPath === srcPath))
|
|
437
|
+
continue;
|
|
438
|
+
if (bySrc.has(srcPath))
|
|
439
|
+
continue;
|
|
440
|
+
const abs = path.resolve(rootDir, srcPath);
|
|
441
|
+
if (!fs.existsSync(abs) || !fs.statSync(abs).isDirectory())
|
|
442
|
+
continue;
|
|
443
|
+
bySrc.set(srcPath, {
|
|
444
|
+
name: `synthetic:${path.basename(srcPath)}`,
|
|
445
|
+
srcPath,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
return [...bySrc.values()].sort((a, b) => a.srcPath.localeCompare(b.srcPath));
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Register orphan trees as PROJECT modules before dependency analysis so they
|
|
452
|
+
* enter `analyseByModule` topo order. No `oh-package.json5` → empty dep edges
|
|
453
|
+
* (npm-only deps stay unresolved); that is expected for Node plugins.
|
|
454
|
+
*/
|
|
455
|
+
function registerSyntheticArkModules(builder, rootDir, scannedFiles, harmonyModules) {
|
|
456
|
+
const synthetics = listSyntheticArkModuleRoots(rootDir, scannedFiles, harmonyModules);
|
|
457
|
+
for (const syn of synthetics) {
|
|
458
|
+
const abs = resolveArkModuleAbsPath(rootDir, syn.srcPath);
|
|
459
|
+
builder.registerModule(abs, syn.name);
|
|
460
|
+
}
|
|
461
|
+
return synthetics;
|
|
462
|
+
}
|
|
463
|
+
/** Prep PROJECT + oh_modules, inject synthetic orphan modules, then build the dep graph. */
|
|
464
|
+
function prepareArkModulesWithSynthetics(scene, rootDir, scannedFiles) {
|
|
465
|
+
if (scene.isModulesRegistered())
|
|
466
|
+
return [];
|
|
467
|
+
const builder = new arkanalyzer_1.ModuleBuilder(scene);
|
|
468
|
+
builder.prepareModules();
|
|
469
|
+
const harmonyModules = listHarmonyProjectModules(rootDir);
|
|
470
|
+
const synthetics = registerSyntheticArkModules(builder, rootDir, scannedFiles, harmonyModules);
|
|
471
|
+
builder.analyzeModuleDependencies();
|
|
472
|
+
scene.setModulesRegistered(true);
|
|
473
|
+
return synthetics;
|
|
474
|
+
}
|
|
356
475
|
function findLongestHarmonyModule(fileRel, modules) {
|
|
357
476
|
const file = normIndexPath(fileRel);
|
|
358
477
|
let best = null;
|
|
@@ -367,8 +486,9 @@ function findLongestHarmonyModule(fileRel, modules) {
|
|
|
367
486
|
}
|
|
368
487
|
/**
|
|
369
488
|
* Map changed/removed paths to Harmony modules for incremental ArkTS sync.
|
|
370
|
-
* Structural project files (`build-profile.json5`, root `oh-package.json5`)
|
|
371
|
-
*
|
|
489
|
+
* Structural project files (`build-profile.json5`, root `oh-package.json5`)
|
|
490
|
+
* force a full rebuild. Orphan trees covered by synthetic PROJECT modules
|
|
491
|
+
* (e.g. `HMRouterPlugin`) map to those module srcPaths instead of full rebuild.
|
|
372
492
|
*/
|
|
373
493
|
function resolveDirtyHarmonyModules(rootDir, changedFiles) {
|
|
374
494
|
if (!shouldUseModularArkTSBuild(rootDir)) {
|
|
@@ -389,17 +509,22 @@ function resolveDirtyHarmonyModules(rootDir, changedFiles) {
|
|
|
389
509
|
return { mode: 'full', reason: 'root oh-package.json5 changed' };
|
|
390
510
|
}
|
|
391
511
|
}
|
|
512
|
+
// Synthetic roots for orphans among the changed set (cheap; no full scan).
|
|
513
|
+
const synthetics = listSyntheticArkModuleRoots(rootDir, changed, modules);
|
|
514
|
+
const allModules = [...modules, ...synthetics];
|
|
392
515
|
const dirty = new Set();
|
|
393
516
|
const unmatched = [];
|
|
394
517
|
for (const f of changed) {
|
|
395
518
|
// Virtual ArkAnalyzer paths are batch artifacts, not Harmony module sources.
|
|
396
519
|
if (f.startsWith('@'))
|
|
397
520
|
continue;
|
|
398
|
-
const isModuleMeta = f.endsWith('/module.json5') ||
|
|
521
|
+
const isModuleMeta = f.endsWith('/module.json5') ||
|
|
522
|
+
f.endsWith('/oh-package.json5') ||
|
|
523
|
+
f.endsWith('/package.json');
|
|
399
524
|
const isArkSrc = isArkAnalyzerSourcePath(f);
|
|
400
525
|
if (!isArkSrc && !isModuleMeta)
|
|
401
526
|
continue;
|
|
402
|
-
const match = findLongestHarmonyModule(f,
|
|
527
|
+
const match = findLongestHarmonyModule(f, allModules);
|
|
403
528
|
if (match)
|
|
404
529
|
dirty.add(match.srcPath);
|
|
405
530
|
else if (isArkSrc)
|
|
@@ -430,6 +555,21 @@ function isArkAnalyzerSourcePath(filePath) {
|
|
|
430
555
|
// `.d.ts` ends with `.ts` (Node extname) — one `.ts` suffix covers both.
|
|
431
556
|
return base.endsWith('.ets') || base.endsWith('.ts');
|
|
432
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Graph `language` tag for an ArkAnalyzer-indexed path. Extraction still uses AA;
|
|
560
|
+
* the tag must match the source kind so status / language filters stay truthful.
|
|
561
|
+
*/
|
|
562
|
+
function languageForArkAnalyzerPath(filePath) {
|
|
563
|
+
const base = path.basename(filePath).toLowerCase();
|
|
564
|
+
if (base.endsWith('.d.ets') || base.endsWith('.ets'))
|
|
565
|
+
return 'arkts';
|
|
566
|
+
if (base.endsWith('.d.ts') || base.endsWith('.ts') || base.endsWith('.mts') || base.endsWith('.cts')) {
|
|
567
|
+
return 'typescript';
|
|
568
|
+
}
|
|
569
|
+
if (base.endsWith('.js') || base.endsWith('.mjs') || base.endsWith('.cjs'))
|
|
570
|
+
return 'javascript';
|
|
571
|
+
return 'arkts';
|
|
572
|
+
}
|
|
433
573
|
function isEtsFileName(name) {
|
|
434
574
|
return name.endsWith('.ets');
|
|
435
575
|
}
|
|
@@ -634,7 +774,7 @@ function persistFileResult(queries, filePath, content, stats, result, options) {
|
|
|
634
774
|
.map((ref) => ({
|
|
635
775
|
...ref,
|
|
636
776
|
filePath: ref.filePath ?? filePath,
|
|
637
|
-
language: ref.language ??
|
|
777
|
+
language: ref.language ?? languageForArkAnalyzerPath(filePath),
|
|
638
778
|
}));
|
|
639
779
|
if (refsWithContext.length > 0) {
|
|
640
780
|
queries.insertUnresolvedRefsBatch(refsWithContext);
|
|
@@ -643,7 +783,7 @@ function persistFileResult(queries, filePath, content, stats, result, options) {
|
|
|
643
783
|
const fileRecord = {
|
|
644
784
|
path: filePath,
|
|
645
785
|
contentHash,
|
|
646
|
-
language:
|
|
786
|
+
language: languageForArkAnalyzerPath(filePath),
|
|
647
787
|
size: stats.size,
|
|
648
788
|
modifiedAt: stats.mtimeMs,
|
|
649
789
|
indexedAt: Date.now(),
|
|
@@ -1197,12 +1337,27 @@ class ArkTSExtractor {
|
|
|
1197
1337
|
}
|
|
1198
1338
|
}
|
|
1199
1339
|
exports.ArkTSExtractor = ArkTSExtractor;
|
|
1340
|
+
/** ArkAnalyzer {@link ClassCategory} (not re-exported from the npm entry). */
|
|
1200
1341
|
const CLASS_CATEGORY = {
|
|
1201
1342
|
CLASS: 0,
|
|
1202
1343
|
STRUCT: 1,
|
|
1203
1344
|
INTERFACE: 2,
|
|
1204
1345
|
ENUM: 3,
|
|
1346
|
+
TYPE_LITERAL: 4,
|
|
1347
|
+
OBJECT: 5,
|
|
1348
|
+
/** C++ frontend only; never map to HomeGraph `class`. */
|
|
1349
|
+
UNION: 6,
|
|
1205
1350
|
};
|
|
1351
|
+
/**
|
|
1352
|
+
* IR shapes that are `ArkClass` in ArkAnalyzer but are not declaration-level
|
|
1353
|
+
* types in HomeGraph's symbol graph. Indexing them as `class` inflates
|
|
1354
|
+
* `graph_class` and orphans them under the file node.
|
|
1355
|
+
*/
|
|
1356
|
+
function isNonDeclarationArkClassCategory(category) {
|
|
1357
|
+
return (category === CLASS_CATEGORY.TYPE_LITERAL ||
|
|
1358
|
+
category === CLASS_CATEGORY.OBJECT ||
|
|
1359
|
+
category === CLASS_CATEGORY.UNION);
|
|
1360
|
+
}
|
|
1206
1361
|
/** ArkAnalyzer {@link FieldCategory} values (not re-exported from the npm entry). */
|
|
1207
1362
|
const FIELD_CATEGORY = {
|
|
1208
1363
|
PROPERTY_DECLARATION: 0,
|
|
@@ -1382,7 +1537,10 @@ function classNodeKind(cls) {
|
|
|
1382
1537
|
return 'enum';
|
|
1383
1538
|
case CLASS_CATEGORY.STRUCT:
|
|
1384
1539
|
return 'struct';
|
|
1540
|
+
case CLASS_CATEGORY.CLASS:
|
|
1541
|
+
return 'class';
|
|
1385
1542
|
default:
|
|
1543
|
+
// TYPE_LITERAL / OBJECT / UNION must be filtered before indexClass.
|
|
1386
1544
|
return 'class';
|
|
1387
1545
|
}
|
|
1388
1546
|
}
|
|
@@ -3048,7 +3206,7 @@ class ArkTSAdapter {
|
|
|
3048
3206
|
let result = this.fileResults.get(relativePath);
|
|
3049
3207
|
if (!result) {
|
|
3050
3208
|
result = {
|
|
3051
|
-
nodes: [makeFileNode(relativePath,
|
|
3209
|
+
nodes: [makeFileNode(relativePath, languageForArkAnalyzerPath(relativePath), lineCount)],
|
|
3052
3210
|
edges: [],
|
|
3053
3211
|
unresolvedReferences: [],
|
|
3054
3212
|
errors: [],
|
|
@@ -3067,7 +3225,7 @@ class ArkTSAdapter {
|
|
|
3067
3225
|
}
|
|
3068
3226
|
indexFile(arkFile) {
|
|
3069
3227
|
const relativePath = this.normalizeRelPath(arkFile.getFilePath());
|
|
3070
|
-
const language =
|
|
3228
|
+
const language = languageForArkAnalyzerPath(relativePath);
|
|
3071
3229
|
let lineCount = 1;
|
|
3072
3230
|
try {
|
|
3073
3231
|
lineCount = arkFile.getCode()?.split('\n').length ?? 1;
|
|
@@ -3160,6 +3318,7 @@ class ArkTSAdapter {
|
|
|
3160
3318
|
const localNode = makeNode(relativePath, language, kind, name, qn, line, endLine, col, {
|
|
3161
3319
|
signature: local.getType()?.toString(),
|
|
3162
3320
|
...modelModifiersToNodeExtras(local),
|
|
3321
|
+
// Local's public TS surface doesn't declare getMetadata; runtime may still carry it.
|
|
3163
3322
|
...docstringExtras(local),
|
|
3164
3323
|
});
|
|
3165
3324
|
this.addNode(result, localNode);
|
|
@@ -3179,6 +3338,7 @@ class ArkTSAdapter {
|
|
|
3179
3338
|
const aliasNode = makeNode(relativePath, language, 'type_alias', name, qn, line, endLine, col, {
|
|
3180
3339
|
signature: aliasType.getOriginalType()?.toString(),
|
|
3181
3340
|
...modelModifiersToNodeExtras(aliasType),
|
|
3341
|
+
// AliasType's public TS surface doesn't declare getMetadata; runtime may still carry it.
|
|
3182
3342
|
...docstringExtras(aliasType),
|
|
3183
3343
|
});
|
|
3184
3344
|
this.addNode(result, aliasNode);
|
|
@@ -3232,6 +3392,10 @@ class ArkTSAdapter {
|
|
|
3232
3392
|
indexClass(relativePath, language, result, cls, parentId) {
|
|
3233
3393
|
if (cls.isDefaultArkClass())
|
|
3234
3394
|
return;
|
|
3395
|
+
// Object / type literals (and C++ unions) are ArkAnalyzer IR classes, not
|
|
3396
|
+
// HomeGraph declaration nodes — skip the shell and its nested fields.
|
|
3397
|
+
if (isNonDeclarationArkClassCategory(cls.getCategory()))
|
|
3398
|
+
return;
|
|
3235
3399
|
const displayName = classDisplayName(cls);
|
|
3236
3400
|
const qn = buildClassQualifiedName(cls);
|
|
3237
3401
|
const kind = classNodeKind(cls);
|
|
@@ -3581,7 +3745,7 @@ class ArkTSAdapter {
|
|
|
3581
3745
|
if (classId)
|
|
3582
3746
|
return classId;
|
|
3583
3747
|
const fileId = `file:${relativePath}`;
|
|
3584
|
-
this.indexClass(relativePath,
|
|
3748
|
+
this.indexClass(relativePath, languageForArkAnalyzerPath(relativePath), result, cls, fileId);
|
|
3585
3749
|
return this.resolveClassNodeId(cls) ?? fileId;
|
|
3586
3750
|
}
|
|
3587
3751
|
/**
|
|
@@ -3622,7 +3786,7 @@ class ArkTSAdapter {
|
|
|
3622
3786
|
const parentId = this.resolveMethodParentId(method, relativePath, result);
|
|
3623
3787
|
const cls = method.getDeclaringArkClass();
|
|
3624
3788
|
const kind = cls.isDefaultArkClass() ? 'function' : 'method';
|
|
3625
|
-
this.indexMethod(relativePath,
|
|
3789
|
+
this.indexMethod(relativePath, languageForArkAnalyzerPath(relativePath), result, method, parentId, kind, displayName);
|
|
3626
3790
|
return this.methodToId.get(method) ?? null;
|
|
3627
3791
|
}
|
|
3628
3792
|
addViewTreeEdge(result, source, target, kind, callerFile, via, line, extraMeta) {
|
|
@@ -3666,7 +3830,7 @@ class ArkTSAdapter {
|
|
|
3666
3830
|
return null;
|
|
3667
3831
|
const cls = method.getDeclaringArkClass();
|
|
3668
3832
|
const kind = cls.isDefaultArkClass() ? 'function' : 'method';
|
|
3669
|
-
this.indexMethod(relativePath,
|
|
3833
|
+
this.indexMethod(relativePath, languageForArkAnalyzerPath(relativePath), result, method, parentId, kind, displayName);
|
|
3670
3834
|
return this.methodToId.get(method) ?? null;
|
|
3671
3835
|
}
|
|
3672
3836
|
indexMethod(relativePath, language, result, method, parentId, forcedKind, forcedDisplayName) {
|
|
@@ -3871,23 +4035,21 @@ function buildArkTSIndexByModuleInner(rootDir, scannedFiles, options) {
|
|
|
3871
4035
|
};
|
|
3872
4036
|
try {
|
|
3873
4037
|
scene.config(sceneConfig);
|
|
4038
|
+
// Register build-profile modules + orphan trees (no oh-package) before the
|
|
4039
|
+
// dep graph is frozen — otherwise analyseByModule never sees HMRouterPlugin-style .ts.
|
|
4040
|
+
const synthetics = prepareArkModulesWithSynthetics(scene, rootDir, scannedList);
|
|
4041
|
+
if (synthetics.length > 0) {
|
|
4042
|
+
process.stderr.write(`\n\x1b[33m ArkTS: synthetic PROJECT modules (${synthetics.length}, no oh-package deps): ${synthetics
|
|
4043
|
+
.map((s) => s.srcPath)
|
|
4044
|
+
.join(', ')}...\x1b[0m\n`);
|
|
4045
|
+
}
|
|
3874
4046
|
const config = new arkanalyzer_1.ModuleAnalysisConfig();
|
|
3875
4047
|
config.setLoadLevel(arkanalyzer_1.ModuleDepthLevel.BODIES);
|
|
3876
4048
|
// SIGNATURES is enough for ViewTree stubs / types; BODIES on deps caused
|
|
3877
4049
|
// each module's RTA to re-walk shared library CFGs (multi-hour indexes).
|
|
3878
4050
|
config.setDependencyLoadLevel(arkanalyzer_1.ModuleDepthLevel.SIGNATURES);
|
|
3879
4051
|
if (targetSrcSet) {
|
|
3880
|
-
|
|
3881
|
-
scene.analyseByModule(() => { }, new arkanalyzer_1.ModuleAnalysisConfig());
|
|
3882
|
-
const wantAbs = new Set([...targetSrcSet].map((src) => {
|
|
3883
|
-
const resolved = path.resolve(rootDir, src);
|
|
3884
|
-
try {
|
|
3885
|
-
return fs.realpathSync(resolved).toLowerCase();
|
|
3886
|
-
}
|
|
3887
|
-
catch {
|
|
3888
|
-
return resolved.toLowerCase();
|
|
3889
|
-
}
|
|
3890
|
-
}));
|
|
4052
|
+
const wantAbs = new Set([...targetSrcSet].map((src) => resolveArkModuleAbsPath(rootDir, src).toLowerCase()));
|
|
3891
4053
|
const ids = [];
|
|
3892
4054
|
for (const mod of scene.getModules()) {
|
|
3893
4055
|
if (mod.getModuleType() !== arkanalyzer_1.ModuleType.PROJECT)
|