homegraph 0.9.9
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/LICENSE +21 -0
- package/README.md +709 -0
- package/dist/bin/codegraph.d.ts +26 -0
- package/dist/bin/codegraph.d.ts.map +1 -0
- package/dist/bin/codegraph.js +1572 -0
- package/dist/bin/codegraph.js.map +1 -0
- package/dist/bin/homegraph.d.ts +26 -0
- package/dist/bin/homegraph.d.ts.map +1 -0
- package/dist/bin/homegraph.js +1572 -0
- package/dist/bin/homegraph.js.map +1 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/node-version-check.d.ts.map +1 -0
- package/dist/bin/node-version-check.js +79 -0
- package/dist/bin/node-version-check.js.map +1 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/bin/uninstall.d.ts.map +1 -0
- package/dist/bin/uninstall.js +36 -0
- package/dist/bin/uninstall.js.map +1 -0
- package/dist/context/formatter.d.ts +30 -0
- package/dist/context/formatter.d.ts.map +1 -0
- package/dist/context/formatter.js +263 -0
- package/dist/context/formatter.js.map +1 -0
- package/dist/context/index.d.ts +119 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +1289 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/index.d.ts +101 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +250 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +131 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +386 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +1562 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.sql +151 -0
- package/dist/db/sqlite-adapter.d.ts +53 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/dist/db/sqlite-adapter.js +117 -0
- package/dist/db/sqlite-adapter.js.map +1 -0
- package/dist/directory.d.ts +57 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +253 -0
- package/dist/directory.js.map +1 -0
- package/dist/errors.d.ts +136 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +219 -0
- package/dist/errors.js.map +1 -0
- package/dist/extraction/arkanalyzer-extractor.d.ts +6 -0
- package/dist/extraction/arkanalyzer-extractor.d.ts.map +1 -0
- package/dist/extraction/arkanalyzer-extractor.js +11 -0
- package/dist/extraction/arkanalyzer-extractor.js.map +1 -0
- package/dist/extraction/arkanalyzer-project.d.ts +20 -0
- package/dist/extraction/arkanalyzer-project.d.ts.map +1 -0
- package/dist/extraction/arkanalyzer-project.js +596 -0
- package/dist/extraction/arkanalyzer-project.js.map +1 -0
- package/dist/extraction/context.d.ts +12 -0
- package/dist/extraction/context.d.ts.map +1 -0
- package/dist/extraction/context.js +29 -0
- package/dist/extraction/context.js.map +1 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/dist/extraction/dfm-extractor.js +151 -0
- package/dist/extraction/dfm-extractor.js.map +1 -0
- package/dist/extraction/extraction-version.d.ts +25 -0
- package/dist/extraction/extraction-version.d.ts.map +1 -0
- package/dist/extraction/extraction-version.js +28 -0
- package/dist/extraction/extraction-version.js.map +1 -0
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +80 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +108 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +465 -0
- package/dist/extraction/grammars.js.map +1 -0
- package/dist/extraction/index.d.ts +138 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +1396 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/languages/arkts.d.ts +18 -0
- package/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/dist/extraction/languages/arkts.js +878 -0
- package/dist/extraction/languages/arkts.js.map +1 -0
- package/dist/extraction/languages/c-cpp.d.ts +4 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/dist/extraction/languages/c-cpp.js +173 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -0
- package/dist/extraction/languages/csharp.d.ts +25 -0
- package/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/dist/extraction/languages/csharp.js +120 -0
- package/dist/extraction/languages/csharp.js.map +1 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/dart.d.ts.map +1 -0
- package/dist/extraction/languages/dart.js +192 -0
- package/dist/extraction/languages/dart.js.map +1 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/go.d.ts.map +1 -0
- package/dist/extraction/languages/go.js +74 -0
- package/dist/extraction/languages/go.js.map +1 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/index.d.ts.map +1 -0
- package/dist/extraction/languages/index.js +51 -0
- package/dist/extraction/languages/index.js.map +1 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/java.d.ts.map +1 -0
- package/dist/extraction/languages/java.js +74 -0
- package/dist/extraction/languages/java.js.map +1 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/dist/extraction/languages/javascript.js +90 -0
- package/dist/extraction/languages/javascript.js.map +1 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/dist/extraction/languages/kotlin.js +285 -0
- package/dist/extraction/languages/kotlin.js.map +1 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts.map +1 -0
- package/dist/extraction/languages/lua.js +150 -0
- package/dist/extraction/languages/lua.js.map +1 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts.map +1 -0
- package/dist/extraction/languages/luau.js +37 -0
- package/dist/extraction/languages/luau.js.map +1 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +133 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/dist/extraction/languages/pascal.js +66 -0
- package/dist/extraction/languages/pascal.js.map +1 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/php.d.ts.map +1 -0
- package/dist/extraction/languages/php.js +120 -0
- package/dist/extraction/languages/php.js.map +1 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/python.d.ts.map +1 -0
- package/dist/extraction/languages/python.js +56 -0
- package/dist/extraction/languages/python.js.map +1 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/dist/extraction/languages/ruby.js +149 -0
- package/dist/extraction/languages/ruby.js.map +1 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/rust.d.ts.map +1 -0
- package/dist/extraction/languages/rust.js +113 -0
- package/dist/extraction/languages/rust.js.map +1 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/scala.d.ts.map +1 -0
- package/dist/extraction/languages/scala.js +174 -0
- package/dist/extraction/languages/scala.js.map +1 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/swift.d.ts.map +1 -0
- package/dist/extraction/languages/swift.js +91 -0
- package/dist/extraction/languages/swift.js.map +1 -0
- package/dist/extraction/languages/typescript.d.ts +3 -0
- package/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/dist/extraction/languages/typescript.js +129 -0
- package/dist/extraction/languages/typescript.js.map +1 -0
- package/dist/extraction/liquid-extractor.d.ts +59 -0
- package/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/dist/extraction/liquid-extractor.js +354 -0
- package/dist/extraction/liquid-extractor.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +198 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/parse-worker.d.ts.map +1 -0
- package/dist/extraction/parse-worker.js +94 -0
- package/dist/extraction/parse-worker.js.map +1 -0
- package/dist/extraction/razor-extractor.d.ts +42 -0
- package/dist/extraction/razor-extractor.d.ts.map +1 -0
- package/dist/extraction/razor-extractor.js +285 -0
- package/dist/extraction/razor-extractor.js.map +1 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/dist/extraction/svelte-extractor.js +272 -0
- package/dist/extraction/svelte-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-helpers.js +103 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +210 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-types.js +10 -0
- package/dist/extraction/tree-sitter-types.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts +455 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/dist/extraction/tree-sitter.js +4089 -0
- package/dist/extraction/tree-sitter.js.map +1 -0
- package/dist/extraction/vue-extractor.d.ts +51 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/dist/extraction/vue-extractor.js +251 -0
- package/dist/extraction/vue-extractor.js.map +1 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/dist/extraction/wasm-runtime-flags.js +106 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +339 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/graph/traversal.d.ts.map +1 -0
- package/dist/graph/traversal.js +531 -0
- package/dist/graph/traversal.js.map +1 -0
- package/dist/index.d.ts +522 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +947 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/config-writer.d.ts +28 -0
- package/dist/installer/config-writer.d.ts.map +1 -0
- package/dist/installer/config-writer.js +91 -0
- package/dist/installer/config-writer.js.map +1 -0
- package/dist/installer/index.d.ts +100 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +497 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +18 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +21 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +308 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +56 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +388 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/codex.d.ts.map +1 -0
- package/dist/installer/targets/codex.js +187 -0
- package/dist/installer/targets/codex.js.map +1 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/cursor.d.ts.map +1 -0
- package/dist/installer/targets/cursor.js +254 -0
- package/dist/installer/targets/cursor.js.map +1 -0
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +167 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -0
- package/dist/installer/targets/hermes.js +359 -0
- package/dist/installer/targets/hermes.js.map +1 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +178 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts +30 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +237 -0
- package/dist/installer/targets/opencode.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +91 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +77 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +247 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/toml.d.ts.map +1 -0
- package/dist/installer/targets/toml.js +147 -0
- package/dist/installer/targets/toml.js.map +1 -0
- package/dist/installer/targets/types.d.ts +101 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +16 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +125 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon.d.ts +220 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +616 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/engine.d.ts +105 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +270 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +112 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +478 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/ppid-watchdog.d.ts +44 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
- package/dist/mcp/ppid-watchdog.js +27 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -0
- package/dist/mcp/proxy.d.ts +81 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +584 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +19 -0
- package/dist/mcp/server-instructions.d.ts.map +1 -0
- package/dist/mcp/server-instructions.js +74 -0
- package/dist/mcp/server-instructions.js.map +1 -0
- package/dist/mcp/session.d.ts +77 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +294 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +413 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +3049 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +343 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +1818 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/dist/resolution/frameworks/csharp.js +241 -0
- package/dist/resolution/frameworks/csharp.js.map +1 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/dist/resolution/frameworks/drupal.js +367 -0
- package/dist/resolution/frameworks/drupal.js.map +1 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +148 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/dist/resolution/frameworks/express.js +308 -0
- package/dist/resolution/frameworks/express.js.map +1 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/dist/resolution/frameworks/go.js +161 -0
- package/dist/resolution/frameworks/go.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +48 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/resolution/frameworks/index.js +161 -0
- package/dist/resolution/frameworks/index.js.map +1 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/dist/resolution/frameworks/java.js +504 -0
- package/dist/resolution/frameworks/java.js.map +1 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/dist/resolution/frameworks/laravel.js +257 -0
- package/dist/resolution/frameworks/laravel.js.map +1 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/dist/resolution/frameworks/nestjs.js +698 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/dist/resolution/frameworks/python.js +400 -0
- package/dist/resolution/frameworks/python.js.map +1 -0
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +410 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/dist/resolution/frameworks/react.js +365 -0
- package/dist/resolution/frameworks/react.js.map +1 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/dist/resolution/frameworks/ruby.js +302 -0
- package/dist/resolution/frameworks/ruby.js.map +1 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/dist/resolution/frameworks/rust.js +304 -0
- package/dist/resolution/frameworks/rust.js.map +1 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/dist/resolution/frameworks/svelte.js +249 -0
- package/dist/resolution/frameworks/svelte.js.map +1 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift.js +400 -0
- package/dist/resolution/frameworks/swift.js.map +1 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/dist/resolution/frameworks/vue.js +306 -0
- package/dist/resolution/frameworks/vue.js.map +1 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +68 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -0
- package/dist/resolution/import-resolver.js +1726 -0
- package/dist/resolution/import-resolver.js.map +1 -0
- package/dist/resolution/index.d.ts +159 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +1025 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.d.ts.map +1 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/lru-cache.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +52 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +707 -0
- package/dist/resolution/name-matcher.js.map +1 -0
- package/dist/resolution/path-aliases.d.ts +68 -0
- package/dist/resolution/path-aliases.d.ts.map +1 -0
- package/dist/resolution/path-aliases.js +238 -0
- package/dist/resolution/path-aliases.js.map +1 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/strip-comments.d.ts.map +1 -0
- package/dist/resolution/strip-comments.js +441 -0
- package/dist/resolution/strip-comments.js.map +1 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +216 -0
- package/dist/resolution/types.d.ts.map +1 -0
- package/dist/resolution/types.js +8 -0
- package/dist/resolution/types.js.map +1 -0
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +208 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-parser.d.ts.map +1 -0
- package/dist/search/query-parser.js +177 -0
- package/dist/search/query-parser.js.map +1 -0
- package/dist/search/query-utils.d.ts +71 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +380 -0
- package/dist/search/query-utils.js.map +1 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/git-hooks.d.ts.map +1 -0
- package/dist/sync/git-hooks.js +225 -0
- package/dist/sync/git-hooks.js.map +1 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +35 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watch-policy.d.ts.map +1 -0
- package/dist/sync/watch-policy.js +124 -0
- package/dist/sync/watch-policy.js.map +1 -0
- package/dist/sync/watcher.d.ts +283 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +606 -0
- package/dist/sync/watcher.js.map +1 -0
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +137 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/types.d.ts +377 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +80 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +78 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/dist/ui/shimmer-progress.js +90 -0
- package/dist/ui/shimmer-progress.js.map +1 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/dist/ui/shimmer-worker.js +118 -0
- package/dist/ui/shimmer-worker.js.map +1 -0
- package/dist/ui/types.d.ts +17 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +3 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/upgrade/index.d.ts +132 -0
- package/dist/upgrade/index.d.ts.map +1 -0
- package/dist/upgrade/index.js +462 -0
- package/dist/upgrade/index.js.map +1 -0
- package/dist/utils.d.ts +205 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +549 -0
- package/dist/utils.js.map +1 -0
- package/package.json +57 -0
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/audit.sh +68 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +120 -0
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/parse-run.mjs +45 -0
- package/scripts/agent-eval/parse-session.mjs +93 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +67 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +118 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/npm-shim.js +246 -0
- package/scripts/pack-npm.sh +119 -0
- package/scripts/prepare-release.mjs +270 -0
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ArkTS (.ets) extraction via ArkAnalyzer.
|
|
4
|
+
*
|
|
5
|
+
* Unlike tree-sitter languages, ArkTS is batch-complete: the first `.ets`
|
|
6
|
+
* parse builds one Scene for the whole project, runs RTA, persists every
|
|
7
|
+
* `.ets` file (nodes, edges, cross-file RTA calls) directly to the DB, then
|
|
8
|
+
* returns the requested file's result. Later `.ets` hits in the same batch
|
|
9
|
+
* short-circuit (orchestrator store skips via matching content hash).
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ArkTSExtractor = void 0;
|
|
46
|
+
exports.resetArkTSBatch = resetArkTSBatch;
|
|
47
|
+
const crypto = __importStar(require("crypto"));
|
|
48
|
+
const fs = __importStar(require("fs"));
|
|
49
|
+
const path = __importStar(require("path"));
|
|
50
|
+
const arkanalyzer_1 = require("arkanalyzer");
|
|
51
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
52
|
+
const context_1 = require("../context");
|
|
53
|
+
const ARK_PROVENANCE = 'heuristic';
|
|
54
|
+
let persistedBatch = null;
|
|
55
|
+
/** File that triggered the most recent batch persist (for indexAll edge stats). */
|
|
56
|
+
let batchTriggerFile = null;
|
|
57
|
+
function hashContent(content) {
|
|
58
|
+
return crypto.createHash('sha256').update(content).digest('hex');
|
|
59
|
+
}
|
|
60
|
+
function emptyResult(filePath, message, severity) {
|
|
61
|
+
return {
|
|
62
|
+
nodes: [],
|
|
63
|
+
edges: [],
|
|
64
|
+
unresolvedReferences: [],
|
|
65
|
+
errors: [{ message, filePath, severity }],
|
|
66
|
+
durationMs: 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function scanEtsFiles(rootDir) {
|
|
70
|
+
const found = [];
|
|
71
|
+
function walk(dir) {
|
|
72
|
+
let entries;
|
|
73
|
+
try {
|
|
74
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
for (const entry of entries) {
|
|
80
|
+
const full = path.join(dir, entry.name);
|
|
81
|
+
if (entry.isDirectory()) {
|
|
82
|
+
if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === '.homegraph')
|
|
83
|
+
continue;
|
|
84
|
+
walk(full);
|
|
85
|
+
}
|
|
86
|
+
else if (entry.isFile() && entry.name.endsWith('.ets')) {
|
|
87
|
+
found.push(path.relative(rootDir, full).replace(/\\/g, '/'));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
walk(rootDir);
|
|
92
|
+
found.sort();
|
|
93
|
+
return found;
|
|
94
|
+
}
|
|
95
|
+
function computeBatchKey(rootDir, etsFiles) {
|
|
96
|
+
return etsFiles
|
|
97
|
+
.map((rel) => {
|
|
98
|
+
const full = path.join(rootDir, rel);
|
|
99
|
+
const stat = fs.statSync(full);
|
|
100
|
+
const content = fs.readFileSync(full, 'utf-8');
|
|
101
|
+
return `${rel}:${stat.mtimeMs}:${hashContent(content)}`;
|
|
102
|
+
})
|
|
103
|
+
.join('\0');
|
|
104
|
+
}
|
|
105
|
+
function persistFileResult(queries, filePath, content, stats, result) {
|
|
106
|
+
const contentHash = hashContent(content);
|
|
107
|
+
const existingFile = queries.getFileByPath(filePath);
|
|
108
|
+
if (existingFile?.contentHash === contentHash) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (existingFile) {
|
|
112
|
+
queries.deleteFile(filePath);
|
|
113
|
+
}
|
|
114
|
+
const validNodes = result.nodes.filter((n) => n.id && n.kind && n.name && n.filePath && n.language);
|
|
115
|
+
if (validNodes.length > 0) {
|
|
116
|
+
queries.insertNodes(validNodes);
|
|
117
|
+
}
|
|
118
|
+
if (result.edges.length > 0) {
|
|
119
|
+
const insertedIds = new Set(validNodes.map((n) => n.id));
|
|
120
|
+
const validEdges = result.edges.filter((e) => insertedIds.has(e.source) && insertedIds.has(e.target));
|
|
121
|
+
if (validEdges.length > 0) {
|
|
122
|
+
queries.insertEdges(validEdges);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (result.unresolvedReferences.length > 0) {
|
|
126
|
+
const insertedIds = new Set(validNodes.map((n) => n.id));
|
|
127
|
+
const refsWithContext = result.unresolvedReferences
|
|
128
|
+
.filter((ref) => insertedIds.has(ref.fromNodeId))
|
|
129
|
+
.map((ref) => ({
|
|
130
|
+
...ref,
|
|
131
|
+
filePath: ref.filePath ?? filePath,
|
|
132
|
+
language: ref.language ?? 'arkts',
|
|
133
|
+
}));
|
|
134
|
+
if (refsWithContext.length > 0) {
|
|
135
|
+
queries.insertUnresolvedRefsBatch(refsWithContext);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const fileRecord = {
|
|
139
|
+
path: filePath,
|
|
140
|
+
contentHash,
|
|
141
|
+
language: 'arkts',
|
|
142
|
+
size: stats.size,
|
|
143
|
+
modifiedAt: stats.mtimeMs,
|
|
144
|
+
indexedAt: Date.now(),
|
|
145
|
+
nodeCount: result.nodes.length,
|
|
146
|
+
errors: result.errors.length > 0 ? result.errors : undefined,
|
|
147
|
+
};
|
|
148
|
+
queries.upsertFile(fileRecord);
|
|
149
|
+
}
|
|
150
|
+
/** Build Scene, run RTA, and write every `.ets` file + cross-file edges to the DB. */
|
|
151
|
+
function runArkTSBatch(rootDir, queries, triggerFile) {
|
|
152
|
+
const etsFiles = scanEtsFiles(rootDir);
|
|
153
|
+
const batchKey = etsFiles.length > 0 ? computeBatchKey(rootDir, etsFiles) : '';
|
|
154
|
+
if (persistedBatch &&
|
|
155
|
+
persistedBatch.rootDir === rootDir &&
|
|
156
|
+
persistedBatch.batchKey === batchKey) {
|
|
157
|
+
return persistedBatch;
|
|
158
|
+
}
|
|
159
|
+
batchTriggerFile = null;
|
|
160
|
+
if (etsFiles.length === 0) {
|
|
161
|
+
persistedBatch = null;
|
|
162
|
+
return {
|
|
163
|
+
fileResults: new Map(),
|
|
164
|
+
crossFileEdges: [],
|
|
165
|
+
nodeIds: new Set(),
|
|
166
|
+
errors: [],
|
|
167
|
+
rootDir,
|
|
168
|
+
batchKey: '',
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const index = buildArkTSIndex(rootDir, etsFiles);
|
|
172
|
+
queries.deleteArkTSCrossFileCallEdges();
|
|
173
|
+
for (const [filePath, fileResult] of index.fileResults) {
|
|
174
|
+
const full = path.join(rootDir, filePath);
|
|
175
|
+
const content = fs.readFileSync(full, 'utf-8');
|
|
176
|
+
const stats = fs.statSync(full);
|
|
177
|
+
persistFileResult(queries, filePath, content, stats, fileResult);
|
|
178
|
+
}
|
|
179
|
+
if (index.crossFileEdges.length > 0) {
|
|
180
|
+
const valid = index.crossFileEdges.filter((e) => index.nodeIds.has(e.source) && index.nodeIds.has(e.target));
|
|
181
|
+
if (valid.length > 0) {
|
|
182
|
+
queries.insertEdges(valid);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
persistedBatch = { ...index, rootDir, batchKey };
|
|
186
|
+
batchTriggerFile = triggerFile;
|
|
187
|
+
return persistedBatch;
|
|
188
|
+
}
|
|
189
|
+
/** Clear cached batch state (tests). */
|
|
190
|
+
function resetArkTSBatch() {
|
|
191
|
+
persistedBatch = null;
|
|
192
|
+
batchTriggerFile = null;
|
|
193
|
+
}
|
|
194
|
+
class ArkTSExtractor {
|
|
195
|
+
filePath;
|
|
196
|
+
constructor(filePath, _source) {
|
|
197
|
+
this.filePath = filePath;
|
|
198
|
+
}
|
|
199
|
+
extract() {
|
|
200
|
+
const startTime = Date.now();
|
|
201
|
+
const rootDir = (0, context_1.getExtractionProjectRoot)();
|
|
202
|
+
const queries = (0, context_1.getExtractionQueries)();
|
|
203
|
+
if (!rootDir || !queries) {
|
|
204
|
+
return {
|
|
205
|
+
...emptyResult(this.filePath, 'Extraction context not bound', 'error'),
|
|
206
|
+
durationMs: Date.now() - startTime,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const batch = runArkTSBatch(rootDir, queries, this.filePath);
|
|
210
|
+
if (batch.fileResults.size === 0) {
|
|
211
|
+
return {
|
|
212
|
+
...emptyResult(this.filePath, 'No .ets files in project', 'warning'),
|
|
213
|
+
durationMs: Date.now() - startTime,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const cached = batch.fileResults.get(this.filePath);
|
|
217
|
+
if (!cached) {
|
|
218
|
+
return {
|
|
219
|
+
...emptyResult(this.filePath, 'File not present in ArkTS index', 'warning'),
|
|
220
|
+
durationMs: Date.now() - startTime,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
const edges = this.filePath === batchTriggerFile
|
|
224
|
+
? [...cached.edges, ...batch.crossFileEdges]
|
|
225
|
+
: cached.edges;
|
|
226
|
+
return {
|
|
227
|
+
nodes: cached.nodes,
|
|
228
|
+
edges,
|
|
229
|
+
unresolvedReferences: cached.unresolvedReferences,
|
|
230
|
+
errors: [...cached.errors],
|
|
231
|
+
durationMs: Date.now() - startTime,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.ArkTSExtractor = ArkTSExtractor;
|
|
236
|
+
const CLASS_CATEGORY = {
|
|
237
|
+
CLASS: 0,
|
|
238
|
+
STRUCT: 1,
|
|
239
|
+
INTERFACE: 2,
|
|
240
|
+
ENUM: 3,
|
|
241
|
+
};
|
|
242
|
+
/** ArkAnalyzer {@link FieldCategory} values (not re-exported from the npm entry). */
|
|
243
|
+
const FIELD_CATEGORY = {
|
|
244
|
+
PROPERTY_DECLARATION: 0,
|
|
245
|
+
PROPERTY_ASSIGNMENT: 1,
|
|
246
|
+
SHORT_HAND_PROPERTY_ASSIGNMENT: 2,
|
|
247
|
+
SPREAD_ASSIGNMENT: 3,
|
|
248
|
+
PROPERTY_SIGNATURE: 4,
|
|
249
|
+
ENUM_MEMBER: 5,
|
|
250
|
+
INDEX_SIGNATURE: 6,
|
|
251
|
+
GET_ACCESSOR: 7,
|
|
252
|
+
PARAMETER_PROPERTY: 8,
|
|
253
|
+
};
|
|
254
|
+
/** {@link ModifierType.CONST} — not re-exported from the arkanalyzer npm entry. */
|
|
255
|
+
const MODIFIER_CONST = 128;
|
|
256
|
+
function normalizeRelPath(rootDir, absolutePath) {
|
|
257
|
+
return path.relative(rootDir, absolutePath).replace(/\\/g, '/');
|
|
258
|
+
}
|
|
259
|
+
function buildQualifiedName(parts) {
|
|
260
|
+
return parts.filter(Boolean).join('::');
|
|
261
|
+
}
|
|
262
|
+
function collectNamespaceChain(ns) {
|
|
263
|
+
const parts = [];
|
|
264
|
+
let current = ns;
|
|
265
|
+
while (current) {
|
|
266
|
+
parts.unshift(current.getName());
|
|
267
|
+
current = current.getDeclaringArkNamespace();
|
|
268
|
+
}
|
|
269
|
+
return parts;
|
|
270
|
+
}
|
|
271
|
+
function buildNamespaceQualifiedName(ns) {
|
|
272
|
+
return buildQualifiedName(collectNamespaceChain(ns));
|
|
273
|
+
}
|
|
274
|
+
function anonymousClassDisplayName(cls) {
|
|
275
|
+
let superName = cls.getSuperClassName() || 'Object';
|
|
276
|
+
const lastSep = Math.max(superName.lastIndexOf('.'), superName.lastIndexOf('::'));
|
|
277
|
+
if (lastSep >= 0)
|
|
278
|
+
superName = superName.slice(lastSep + 1);
|
|
279
|
+
superName = superName.trim() || 'Object';
|
|
280
|
+
const line = cls.getOriginFullPosition()?.getFirstLine() ?? 1;
|
|
281
|
+
return `<${superName}$anon@${line}>`;
|
|
282
|
+
}
|
|
283
|
+
function classDisplayName(cls) {
|
|
284
|
+
return cls.isAnonymousClass() ? anonymousClassDisplayName(cls) : cls.getName();
|
|
285
|
+
}
|
|
286
|
+
function shouldSkipArkMethod(method) {
|
|
287
|
+
if (method.isDefaultArkMethod())
|
|
288
|
+
return true;
|
|
289
|
+
if (method.isAnonymousMethod())
|
|
290
|
+
return true;
|
|
291
|
+
const name = method.getName();
|
|
292
|
+
if (name === arkanalyzer_1.DEFAULT_ARK_METHOD_NAME)
|
|
293
|
+
return true;
|
|
294
|
+
if (name === arkanalyzer_1.INSTANCE_INIT_METHOD_NAME || name === arkanalyzer_1.STATIC_INIT_METHOD_NAME)
|
|
295
|
+
return true;
|
|
296
|
+
if (name.startsWith(arkanalyzer_1.STATIC_BLOCK_METHOD_NAME_PREFIX))
|
|
297
|
+
return true;
|
|
298
|
+
if (resolveMethodDisplayName(method) === null)
|
|
299
|
+
return true;
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
/** Decode ArkAnalyzer nested-method encoding (`%inner$outer`) to the user-visible name. */
|
|
303
|
+
function resolveMethodDisplayName(method) {
|
|
304
|
+
const name = method.getName();
|
|
305
|
+
if (name === arkanalyzer_1.DEFAULT_ARK_METHOD_NAME)
|
|
306
|
+
return null;
|
|
307
|
+
if (name === arkanalyzer_1.INSTANCE_INIT_METHOD_NAME || name === arkanalyzer_1.STATIC_INIT_METHOD_NAME)
|
|
308
|
+
return null;
|
|
309
|
+
if (name.startsWith(arkanalyzer_1.STATIC_BLOCK_METHOD_NAME_PREFIX))
|
|
310
|
+
return null;
|
|
311
|
+
if (name.startsWith(arkanalyzer_1.ANONYMOUS_METHOD_PREFIX))
|
|
312
|
+
return null;
|
|
313
|
+
if (name.startsWith(arkanalyzer_1.NAME_PREFIX) && name.includes(arkanalyzer_1.NAME_DELIMITER)) {
|
|
314
|
+
const inner = name.slice(arkanalyzer_1.NAME_PREFIX.length, name.indexOf(arkanalyzer_1.NAME_DELIMITER));
|
|
315
|
+
if (inner && !inner.startsWith('AM'))
|
|
316
|
+
return inner;
|
|
317
|
+
}
|
|
318
|
+
if (name.startsWith(arkanalyzer_1.NAME_PREFIX))
|
|
319
|
+
return null;
|
|
320
|
+
return name;
|
|
321
|
+
}
|
|
322
|
+
function shouldSkipLocalName(name) {
|
|
323
|
+
if (!name || name === 'this')
|
|
324
|
+
return true;
|
|
325
|
+
if (name.startsWith(arkanalyzer_1.NAME_PREFIX))
|
|
326
|
+
return true;
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
function classNodeKind(cls) {
|
|
330
|
+
switch (cls.getCategory()) {
|
|
331
|
+
case CLASS_CATEGORY.INTERFACE:
|
|
332
|
+
return 'interface';
|
|
333
|
+
case CLASS_CATEGORY.ENUM:
|
|
334
|
+
return 'enum';
|
|
335
|
+
case CLASS_CATEGORY.STRUCT:
|
|
336
|
+
return 'struct';
|
|
337
|
+
default:
|
|
338
|
+
return 'class';
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function buildMethodQualifiedName(method, displayName) {
|
|
342
|
+
const cls = method.getDeclaringArkClass();
|
|
343
|
+
const ns = cls.getDeclaringArkNamespace();
|
|
344
|
+
const parts = [];
|
|
345
|
+
if (ns)
|
|
346
|
+
parts.push(...collectNamespaceChain(ns));
|
|
347
|
+
if (!cls.isDefaultArkClass()) {
|
|
348
|
+
parts.push(classDisplayName(cls));
|
|
349
|
+
}
|
|
350
|
+
const outer = method.getOuterMethod();
|
|
351
|
+
if (outer) {
|
|
352
|
+
const outerName = resolveMethodDisplayName(outer);
|
|
353
|
+
if (outerName)
|
|
354
|
+
parts.push(outerName);
|
|
355
|
+
}
|
|
356
|
+
parts.push(displayName ?? resolveMethodDisplayName(method) ?? method.getName());
|
|
357
|
+
return buildQualifiedName(parts);
|
|
358
|
+
}
|
|
359
|
+
function buildClassQualifiedName(cls) {
|
|
360
|
+
const ns = cls.getDeclaringArkNamespace();
|
|
361
|
+
const parts = [];
|
|
362
|
+
if (ns)
|
|
363
|
+
parts.push(...collectNamespaceChain(ns));
|
|
364
|
+
if (!cls.isDefaultArkClass()) {
|
|
365
|
+
parts.push(classDisplayName(cls));
|
|
366
|
+
}
|
|
367
|
+
return buildQualifiedName(parts) || classDisplayName(cls);
|
|
368
|
+
}
|
|
369
|
+
function buildFieldQualifiedName(field) {
|
|
370
|
+
const cls = field.getDeclaringArkClass();
|
|
371
|
+
const parts = [];
|
|
372
|
+
const ns = cls.getDeclaringArkNamespace();
|
|
373
|
+
if (ns)
|
|
374
|
+
parts.push(...collectNamespaceChain(ns));
|
|
375
|
+
if (!cls.isDefaultArkClass()) {
|
|
376
|
+
parts.push(classDisplayName(cls));
|
|
377
|
+
}
|
|
378
|
+
parts.push(field.getName());
|
|
379
|
+
return buildQualifiedName(parts);
|
|
380
|
+
}
|
|
381
|
+
function buildTypeAliasQualifiedName(name, ns) {
|
|
382
|
+
const parts = [];
|
|
383
|
+
if (ns)
|
|
384
|
+
parts.push(...collectNamespaceChain(ns));
|
|
385
|
+
parts.push(name);
|
|
386
|
+
return buildQualifiedName(parts);
|
|
387
|
+
}
|
|
388
|
+
function linesFromPosition(pos) {
|
|
389
|
+
if (!pos)
|
|
390
|
+
return { line: 1, endLine: 1, col: 0 };
|
|
391
|
+
const line = pos.getFirstLine();
|
|
392
|
+
const endLine = pos.getLastLine();
|
|
393
|
+
return {
|
|
394
|
+
line: line > 0 ? line : 1,
|
|
395
|
+
endLine: endLine > 0 ? endLine : line > 0 ? line : 1,
|
|
396
|
+
col: pos.getFirstCol() >= 0 ? pos.getFirstCol() : 0,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function modelModifiersToNodeExtras(model) {
|
|
400
|
+
const extra = {};
|
|
401
|
+
if (model.isExport?.())
|
|
402
|
+
extra.isExported = true;
|
|
403
|
+
if (model.isStatic?.())
|
|
404
|
+
extra.isStatic = true;
|
|
405
|
+
if (model.isPublic?.())
|
|
406
|
+
extra.visibility = 'public';
|
|
407
|
+
else if (model.isPrivate?.())
|
|
408
|
+
extra.visibility = 'private';
|
|
409
|
+
else if (model.isProtected?.())
|
|
410
|
+
extra.visibility = 'protected';
|
|
411
|
+
return extra;
|
|
412
|
+
}
|
|
413
|
+
function fieldNodeKind(field, cls) {
|
|
414
|
+
switch (field.getCategory()) {
|
|
415
|
+
case FIELD_CATEGORY.ENUM_MEMBER:
|
|
416
|
+
return cls.getCategory() === CLASS_CATEGORY.ENUM ? 'enum_member' : null;
|
|
417
|
+
case FIELD_CATEGORY.PROPERTY_SIGNATURE:
|
|
418
|
+
case FIELD_CATEGORY.GET_ACCESSOR:
|
|
419
|
+
return 'property';
|
|
420
|
+
case FIELD_CATEGORY.INDEX_SIGNATURE:
|
|
421
|
+
case FIELD_CATEGORY.SPREAD_ASSIGNMENT:
|
|
422
|
+
return 'property';
|
|
423
|
+
case FIELD_CATEGORY.PROPERTY_DECLARATION:
|
|
424
|
+
case FIELD_CATEGORY.PROPERTY_ASSIGNMENT:
|
|
425
|
+
case FIELD_CATEGORY.SHORT_HAND_PROPERTY_ASSIGNMENT:
|
|
426
|
+
case FIELD_CATEGORY.PARAMETER_PROPERTY:
|
|
427
|
+
if (cls.isDefaultArkClass()) {
|
|
428
|
+
return field.containsModifier?.(MODIFIER_CONST) ? 'constant' : 'variable';
|
|
429
|
+
}
|
|
430
|
+
return 'property';
|
|
431
|
+
default:
|
|
432
|
+
return 'field';
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function makeNode(relativePath, language, kind, name, qualifiedName, line, endLine, column, extra) {
|
|
436
|
+
const safeLine = line > 0 ? line : 1;
|
|
437
|
+
return {
|
|
438
|
+
id: (0, tree_sitter_helpers_1.generateNodeId)(relativePath, kind, qualifiedName, safeLine),
|
|
439
|
+
kind,
|
|
440
|
+
name,
|
|
441
|
+
qualifiedName,
|
|
442
|
+
filePath: relativePath,
|
|
443
|
+
language,
|
|
444
|
+
startLine: safeLine,
|
|
445
|
+
endLine: endLine > 0 ? endLine : safeLine,
|
|
446
|
+
startColumn: column >= 0 ? column : 0,
|
|
447
|
+
endColumn: column >= 0 ? column : 0,
|
|
448
|
+
updatedAt: Date.now(),
|
|
449
|
+
...extra,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function makeFileNode(relativePath, language, lineCount) {
|
|
453
|
+
return {
|
|
454
|
+
id: `file:${relativePath}`,
|
|
455
|
+
kind: 'file',
|
|
456
|
+
name: path.basename(relativePath),
|
|
457
|
+
qualifiedName: relativePath,
|
|
458
|
+
filePath: relativePath,
|
|
459
|
+
language,
|
|
460
|
+
startLine: 1,
|
|
461
|
+
endLine: Math.max(lineCount, 1),
|
|
462
|
+
startColumn: 0,
|
|
463
|
+
endColumn: 0,
|
|
464
|
+
isExported: false,
|
|
465
|
+
updatedAt: Date.now(),
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function arkEdge(source, target, kind, extra) {
|
|
469
|
+
return {
|
|
470
|
+
source,
|
|
471
|
+
target,
|
|
472
|
+
kind,
|
|
473
|
+
provenance: ARK_PROVENANCE,
|
|
474
|
+
metadata: { synthesizedBy: 'arkanalyzer', ...(extra?.metadata ?? {}) },
|
|
475
|
+
...extra,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function resolveRtaEntryPoints(scene) {
|
|
479
|
+
const explicit = scene.getEntryPoints();
|
|
480
|
+
if (explicit.length > 0)
|
|
481
|
+
return explicit;
|
|
482
|
+
return scene
|
|
483
|
+
.getMethods()
|
|
484
|
+
.filter((m) => !shouldSkipArkMethod(m))
|
|
485
|
+
.map((m) => m.getSignature());
|
|
486
|
+
}
|
|
487
|
+
class ArkTSAdapter {
|
|
488
|
+
rootDir;
|
|
489
|
+
scanned;
|
|
490
|
+
methodToId = new Map();
|
|
491
|
+
classToId = new Map();
|
|
492
|
+
nodeIds = new Set();
|
|
493
|
+
fileResults = new Map();
|
|
494
|
+
crossFileEdges = [];
|
|
495
|
+
constructor(rootDir, scannedFiles) {
|
|
496
|
+
this.rootDir = rootDir;
|
|
497
|
+
this.scanned = new Set(scannedFiles);
|
|
498
|
+
}
|
|
499
|
+
build(scene) {
|
|
500
|
+
const entryPoints = resolveRtaEntryPoints(scene);
|
|
501
|
+
let callGraph;
|
|
502
|
+
try {
|
|
503
|
+
callGraph = scene.makeCallGraphRTA(entryPoints);
|
|
504
|
+
}
|
|
505
|
+
catch {
|
|
506
|
+
callGraph = null;
|
|
507
|
+
}
|
|
508
|
+
for (const arkFile of scene.getFiles()) {
|
|
509
|
+
const relativePath = normalizeRelPath(this.rootDir, arkFile.getFilePath());
|
|
510
|
+
if (!this.scanned.has(relativePath))
|
|
511
|
+
continue;
|
|
512
|
+
if (!relativePath.endsWith('.ets'))
|
|
513
|
+
continue;
|
|
514
|
+
this.indexFile(arkFile);
|
|
515
|
+
}
|
|
516
|
+
if (callGraph) {
|
|
517
|
+
for (const edge of callGraph.getCallEdges()) {
|
|
518
|
+
const caller = callGraph.getArkMethodByFuncID(edge.getSrcID());
|
|
519
|
+
const callee = callGraph.getArkMethodByFuncID(edge.getDstID());
|
|
520
|
+
if (!caller || !callee)
|
|
521
|
+
continue;
|
|
522
|
+
if (shouldSkipArkMethod(caller) && !caller.getDeclaringArkClass().isDefaultArkClass()) {
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
const callerId = this.methodToId.get(caller);
|
|
526
|
+
const calleeId = this.methodToId.get(callee);
|
|
527
|
+
if (!callerId || !calleeId)
|
|
528
|
+
continue;
|
|
529
|
+
const callerFile = normalizeRelPath(this.rootDir, caller.getDeclaringArkFile().getFilePath());
|
|
530
|
+
const callEdge = arkEdge(callerId, calleeId, 'calls', {
|
|
531
|
+
metadata: {
|
|
532
|
+
synthesizedBy: 'arkanalyzer',
|
|
533
|
+
dispatch: edge.hasDirectCall() ? 'direct' : 'indirect',
|
|
534
|
+
sourceFile: callerFile,
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
const callerResult = this.fileResults.get(callerFile);
|
|
538
|
+
if (callerResult && this.nodeInFile(calleeId, callerFile)) {
|
|
539
|
+
callerResult.edges.push(callEdge);
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
this.crossFileEdges.push(callEdge);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return {
|
|
547
|
+
fileResults: this.fileResults,
|
|
548
|
+
crossFileEdges: this.crossFileEdges,
|
|
549
|
+
nodeIds: this.nodeIds,
|
|
550
|
+
errors: [],
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
nodeInFile(nodeId, relativePath) {
|
|
554
|
+
const result = this.fileResults.get(relativePath);
|
|
555
|
+
return result?.nodes.some((n) => n.id === nodeId) ?? false;
|
|
556
|
+
}
|
|
557
|
+
ensureFileResult(relativePath, lineCount) {
|
|
558
|
+
let result = this.fileResults.get(relativePath);
|
|
559
|
+
if (!result) {
|
|
560
|
+
result = {
|
|
561
|
+
nodes: [makeFileNode(relativePath, 'arkts', lineCount)],
|
|
562
|
+
edges: [],
|
|
563
|
+
unresolvedReferences: [],
|
|
564
|
+
errors: [],
|
|
565
|
+
durationMs: 0,
|
|
566
|
+
};
|
|
567
|
+
this.fileResults.set(relativePath, result);
|
|
568
|
+
this.nodeIds.add(`file:${relativePath}`);
|
|
569
|
+
}
|
|
570
|
+
return result;
|
|
571
|
+
}
|
|
572
|
+
addNode(result, node) {
|
|
573
|
+
if (this.nodeIds.has(node.id))
|
|
574
|
+
return;
|
|
575
|
+
result.nodes.push(node);
|
|
576
|
+
this.nodeIds.add(node.id);
|
|
577
|
+
}
|
|
578
|
+
indexFile(arkFile) {
|
|
579
|
+
const relativePath = normalizeRelPath(this.rootDir, arkFile.getFilePath());
|
|
580
|
+
const language = 'arkts';
|
|
581
|
+
let lineCount = 1;
|
|
582
|
+
try {
|
|
583
|
+
lineCount = arkFile.getCode()?.split('\n').length ?? 1;
|
|
584
|
+
}
|
|
585
|
+
catch {
|
|
586
|
+
// use default
|
|
587
|
+
}
|
|
588
|
+
const result = this.ensureFileResult(relativePath, lineCount);
|
|
589
|
+
const fileId = `file:${relativePath}`;
|
|
590
|
+
for (const ns of arkFile.getNamespaces()) {
|
|
591
|
+
this.indexNamespace(relativePath, language, result, ns, fileId);
|
|
592
|
+
}
|
|
593
|
+
this.indexClassesInNamespace(relativePath, language, result, arkFile.getClasses(), fileId);
|
|
594
|
+
this.indexDefaultClass(relativePath, language, result, arkFile.getDefaultClass(), fileId);
|
|
595
|
+
this.indexTypeAliases(relativePath, language, result, arkFile, undefined, fileId);
|
|
596
|
+
this.indexModuleLocals(relativePath, language, result, arkFile, undefined, fileId);
|
|
597
|
+
this.indexImports(relativePath, language, result, arkFile, fileId);
|
|
598
|
+
}
|
|
599
|
+
indexModuleLocals(relativePath, language, result, arkFile, ns, parentId) {
|
|
600
|
+
const declaringClass = ns ? ns.getDefaultClass() : arkFile.getDefaultClass();
|
|
601
|
+
const body = declaringClass.getDefaultArkMethod()?.getBody();
|
|
602
|
+
if (!body)
|
|
603
|
+
return;
|
|
604
|
+
for (const [name, local] of body.getLocals()) {
|
|
605
|
+
this.indexLocal(relativePath, language, result, name, local, ns, parentId);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
indexLocal(relativePath, language, result, name, local, ns, parentId) {
|
|
609
|
+
if (shouldSkipLocalName(name))
|
|
610
|
+
return;
|
|
611
|
+
const kind = local.getConstFlag() ? 'constant' : 'variable';
|
|
612
|
+
const stmt = local.getDeclaringStmt();
|
|
613
|
+
const { line, endLine, col } = linesFromPosition(stmt?.getOriginFullPosition());
|
|
614
|
+
const qn = buildTypeAliasQualifiedName(name, ns);
|
|
615
|
+
const localNode = makeNode(relativePath, language, kind, name, qn, line, endLine, col, {
|
|
616
|
+
signature: local.getType()?.toString(),
|
|
617
|
+
...modelModifiersToNodeExtras(local),
|
|
618
|
+
});
|
|
619
|
+
this.addNode(result, localNode);
|
|
620
|
+
result.edges.push(arkEdge(parentId, localNode.id, 'contains'));
|
|
621
|
+
}
|
|
622
|
+
indexTypeAliases(relativePath, language, result, arkFile, ns, parentId) {
|
|
623
|
+
const declaringClass = ns ? ns.getDefaultClass() : arkFile.getDefaultClass();
|
|
624
|
+
const body = declaringClass.getDefaultArkMethod()?.getBody();
|
|
625
|
+
const aliasMap = body?.getAliasTypeMap();
|
|
626
|
+
if (!aliasMap)
|
|
627
|
+
return;
|
|
628
|
+
for (const [name, entry] of aliasMap) {
|
|
629
|
+
const aliasType = entry[0];
|
|
630
|
+
const stmt = entry[1];
|
|
631
|
+
const { line, endLine, col } = linesFromPosition(stmt.getOriginFullPosition());
|
|
632
|
+
const qn = buildTypeAliasQualifiedName(name, ns);
|
|
633
|
+
const aliasNode = makeNode(relativePath, language, 'type_alias', name, qn, line, endLine, col, {
|
|
634
|
+
signature: aliasType.getOriginalType()?.toString(),
|
|
635
|
+
...modelModifiersToNodeExtras(aliasType),
|
|
636
|
+
});
|
|
637
|
+
this.addNode(result, aliasNode);
|
|
638
|
+
result.edges.push(arkEdge(parentId, aliasNode.id, 'contains'));
|
|
639
|
+
this.indexDecorators(result, aliasNode.id, aliasType, relativePath, language, line);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
indexDecorators(result, fromNodeId, model, relativePath, language, line) {
|
|
643
|
+
const decorators = model.getDecorators?.();
|
|
644
|
+
if (!decorators)
|
|
645
|
+
return;
|
|
646
|
+
for (const dec of decorators) {
|
|
647
|
+
const kind = dec.getKind();
|
|
648
|
+
if (!kind)
|
|
649
|
+
continue;
|
|
650
|
+
result.unresolvedReferences.push({
|
|
651
|
+
fromNodeId,
|
|
652
|
+
referenceName: kind,
|
|
653
|
+
referenceKind: 'decorates',
|
|
654
|
+
line,
|
|
655
|
+
column: 0,
|
|
656
|
+
filePath: relativePath,
|
|
657
|
+
language,
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
indexNamespace(relativePath, language, result, ns, parentId) {
|
|
662
|
+
const qn = buildNamespaceQualifiedName(ns);
|
|
663
|
+
const positions = ns.getOriginFullPositions();
|
|
664
|
+
const { line, endLine, col } = linesFromPosition(positions[0]);
|
|
665
|
+
const nsNode = makeNode(relativePath, language, 'namespace', ns.getName(), qn, line, endLine, col, {
|
|
666
|
+
...modelModifiersToNodeExtras(ns),
|
|
667
|
+
});
|
|
668
|
+
this.addNode(result, nsNode);
|
|
669
|
+
result.edges.push(arkEdge(parentId, nsNode.id, 'contains'));
|
|
670
|
+
this.indexDecorators(result, nsNode.id, ns, relativePath, language, line);
|
|
671
|
+
this.indexClassesInNamespace(relativePath, language, result, ns.getClasses(), nsNode.id);
|
|
672
|
+
this.indexDefaultClass(relativePath, language, result, ns.getDefaultClass(), nsNode.id);
|
|
673
|
+
this.indexTypeAliases(relativePath, language, result, ns.getDeclaringArkFile(), ns, nsNode.id);
|
|
674
|
+
this.indexModuleLocals(relativePath, language, result, ns.getDeclaringArkFile(), ns, nsNode.id);
|
|
675
|
+
for (const childNs of ns.getNamespaces()) {
|
|
676
|
+
this.indexNamespace(relativePath, language, result, childNs, nsNode.id);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
indexClassesInNamespace(relativePath, language, result, classes, parentId) {
|
|
680
|
+
for (const cls of classes) {
|
|
681
|
+
this.indexClass(relativePath, language, result, cls, parentId);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
indexClass(relativePath, language, result, cls, parentId) {
|
|
685
|
+
if (cls.isDefaultArkClass())
|
|
686
|
+
return;
|
|
687
|
+
const displayName = classDisplayName(cls);
|
|
688
|
+
const qn = buildClassQualifiedName(cls);
|
|
689
|
+
const kind = classNodeKind(cls);
|
|
690
|
+
const { line, endLine, col } = linesFromPosition(cls.getOriginFullPosition());
|
|
691
|
+
const classNode = makeNode(relativePath, language, kind, displayName, qn, line, endLine, col, {
|
|
692
|
+
...modelModifiersToNodeExtras(cls),
|
|
693
|
+
});
|
|
694
|
+
this.addNode(result, classNode);
|
|
695
|
+
this.classToId.set(cls, classNode.id);
|
|
696
|
+
result.edges.push(arkEdge(parentId, classNode.id, 'contains'));
|
|
697
|
+
this.indexDecorators(result, classNode.id, cls, relativePath, language, line);
|
|
698
|
+
if (cls.isAnonymousClass()) {
|
|
699
|
+
const superName = cls.getSuperClassName();
|
|
700
|
+
if (superName) {
|
|
701
|
+
result.unresolvedReferences.push({
|
|
702
|
+
fromNodeId: classNode.id,
|
|
703
|
+
referenceName: superName.includes('.') ? superName.split('.').pop() : superName,
|
|
704
|
+
referenceKind: 'extends',
|
|
705
|
+
line,
|
|
706
|
+
column: col,
|
|
707
|
+
filePath: relativePath,
|
|
708
|
+
language,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (cls.hasComponentDecorator()) {
|
|
713
|
+
const componentNode = makeNode(relativePath, language, 'component', displayName, qn, line, endLine, col, { ...modelModifiersToNodeExtras(cls) });
|
|
714
|
+
this.addNode(result, componentNode);
|
|
715
|
+
result.edges.push(arkEdge(classNode.id, componentNode.id, 'contains'));
|
|
716
|
+
}
|
|
717
|
+
const superName = cls.getSuperClassName();
|
|
718
|
+
if (superName) {
|
|
719
|
+
const superCls = cls.getHeritageClass(superName);
|
|
720
|
+
if (superCls && !superCls.isDefaultArkClass()) {
|
|
721
|
+
const superId = this.classToId.get(superCls);
|
|
722
|
+
if (superId) {
|
|
723
|
+
const edgeKind = superCls.getCategory() === CLASS_CATEGORY.INTERFACE ? 'implements' : 'extends';
|
|
724
|
+
result.edges.push(arkEdge(classNode.id, superId, edgeKind));
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
for (const ifaceName of cls.getImplementedInterfaceNames()) {
|
|
729
|
+
const iface = cls.getImplementedInterface(ifaceName);
|
|
730
|
+
if (iface && this.classToId.has(iface)) {
|
|
731
|
+
result.edges.push(arkEdge(classNode.id, this.classToId.get(iface), 'implements'));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
for (const method of cls.getMethods(true)) {
|
|
735
|
+
if (shouldSkipArkMethod(method))
|
|
736
|
+
continue;
|
|
737
|
+
this.indexMethod(relativePath, language, result, method, classNode.id);
|
|
738
|
+
}
|
|
739
|
+
for (const field of cls.getFields()) {
|
|
740
|
+
this.indexField(relativePath, language, result, field, classNode.id, cls);
|
|
741
|
+
}
|
|
742
|
+
this.indexClassScopedTypeAliases(relativePath, language, result, cls, classNode.id);
|
|
743
|
+
}
|
|
744
|
+
indexClassScopedTypeAliases(relativePath, language, result, cls, parentId) {
|
|
745
|
+
const candidates = [cls.getDefaultArkMethod(), cls.getInstanceInitMethod(), cls.getStaticInitMethod()];
|
|
746
|
+
for (const method of candidates) {
|
|
747
|
+
if (!method)
|
|
748
|
+
continue;
|
|
749
|
+
const aliasMap = method.getBody()?.getAliasTypeMap();
|
|
750
|
+
if (!aliasMap)
|
|
751
|
+
continue;
|
|
752
|
+
for (const [name, entry] of aliasMap) {
|
|
753
|
+
const aliasType = entry[0];
|
|
754
|
+
const stmt = entry[1];
|
|
755
|
+
const { line, endLine, col } = linesFromPosition(stmt.getOriginFullPosition());
|
|
756
|
+
const qn = buildQualifiedName([buildClassQualifiedName(cls), name]);
|
|
757
|
+
const aliasNode = makeNode(relativePath, language, 'type_alias', name, qn, line, endLine, col, {
|
|
758
|
+
signature: aliasType.getOriginalType()?.toString(),
|
|
759
|
+
...modelModifiersToNodeExtras(aliasType),
|
|
760
|
+
});
|
|
761
|
+
this.addNode(result, aliasNode);
|
|
762
|
+
result.edges.push(arkEdge(parentId, aliasNode.id, 'contains'));
|
|
763
|
+
this.indexDecorators(result, aliasNode.id, aliasType, relativePath, language, line);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
indexDefaultClass(relativePath, language, result, cls, fileId) {
|
|
768
|
+
for (const method of cls.getMethods(true)) {
|
|
769
|
+
if (shouldSkipArkMethod(method))
|
|
770
|
+
continue;
|
|
771
|
+
const kind = cls.isDefaultArkClass() ? 'function' : 'method';
|
|
772
|
+
const parentId = cls.isDefaultArkClass()
|
|
773
|
+
? fileId
|
|
774
|
+
: (this.classToId.get(cls) ?? fileId);
|
|
775
|
+
this.indexMethod(relativePath, language, result, method, parentId, kind);
|
|
776
|
+
}
|
|
777
|
+
for (const field of cls.getFields()) {
|
|
778
|
+
const parentId = cls.isDefaultArkClass() ? fileId : (this.classToId.get(cls) ?? fileId);
|
|
779
|
+
this.indexField(relativePath, language, result, field, parentId, cls);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
indexField(relativePath, language, result, field, parentId, cls) {
|
|
783
|
+
const name = field.getName();
|
|
784
|
+
if (!name || shouldSkipLocalName(name))
|
|
785
|
+
return;
|
|
786
|
+
const kind = fieldNodeKind(field, cls);
|
|
787
|
+
if (!kind)
|
|
788
|
+
return;
|
|
789
|
+
const { line, endLine, col } = linesFromPosition(field.getOriginFullPosition());
|
|
790
|
+
const qn = buildFieldQualifiedName(field);
|
|
791
|
+
const fieldNode = makeNode(relativePath, language, kind, name, qn, line, endLine, col, {
|
|
792
|
+
signature: field.getType()?.toString(),
|
|
793
|
+
...modelModifiersToNodeExtras(field),
|
|
794
|
+
});
|
|
795
|
+
this.addNode(result, fieldNode);
|
|
796
|
+
result.edges.push(arkEdge(parentId, fieldNode.id, 'contains'));
|
|
797
|
+
this.indexDecorators(result, fieldNode.id, field, relativePath, language, line);
|
|
798
|
+
}
|
|
799
|
+
indexMethod(relativePath, language, result, method, parentId, forcedKind) {
|
|
800
|
+
const displayName = resolveMethodDisplayName(method);
|
|
801
|
+
if (!displayName)
|
|
802
|
+
return;
|
|
803
|
+
const cls = method.getDeclaringArkClass();
|
|
804
|
+
const kind = forcedKind ?? (cls.isDefaultArkClass() ? 'function' : 'method');
|
|
805
|
+
const qn = buildMethodQualifiedName(method, displayName);
|
|
806
|
+
const { line, endLine, col } = linesFromPosition(method.getImplOriginFullPosition());
|
|
807
|
+
const sig = method.getSignature()?.toString();
|
|
808
|
+
const methodNode = makeNode(relativePath, language, kind, displayName, qn, line, endLine, col, {
|
|
809
|
+
signature: sig,
|
|
810
|
+
...modelModifiersToNodeExtras(method),
|
|
811
|
+
});
|
|
812
|
+
this.addNode(result, methodNode);
|
|
813
|
+
this.methodToId.set(method, methodNode.id);
|
|
814
|
+
result.edges.push(arkEdge(parentId, methodNode.id, 'contains'));
|
|
815
|
+
this.indexDecorators(result, methodNode.id, method, relativePath, language, line);
|
|
816
|
+
}
|
|
817
|
+
indexImports(relativePath, language, result, arkFile, fileId) {
|
|
818
|
+
for (const importInfo of arkFile.getImportInfos()) {
|
|
819
|
+
const modulePath = importInfo.getFrom();
|
|
820
|
+
const line = importInfo.getOriginFullPosition().getFirstLine();
|
|
821
|
+
const clause = importInfo.getImportClauseName() || modulePath || 'import';
|
|
822
|
+
const importNode = makeNode(relativePath, language, 'import', clause, `${relativePath}::import::${clause}::${line}`, line, line, 0, { signature: modulePath });
|
|
823
|
+
this.addNode(result, importNode);
|
|
824
|
+
result.edges.push(arkEdge(fileId, importNode.id, 'contains'));
|
|
825
|
+
const exportInfo = importInfo.getLazyExportInfo();
|
|
826
|
+
if (exportInfo) {
|
|
827
|
+
const targetFile = exportInfo.getDeclaringArkFile();
|
|
828
|
+
if (targetFile) {
|
|
829
|
+
const targetRel = normalizeRelPath(this.rootDir, targetFile.getFilePath());
|
|
830
|
+
const targetFileId = `file:${targetRel}`;
|
|
831
|
+
if (this.nodeIds.has(targetFileId)) {
|
|
832
|
+
result.edges.push(arkEdge(importNode.id, targetFileId, 'imports', {
|
|
833
|
+
metadata: { synthesizedBy: 'arkanalyzer', module: modulePath },
|
|
834
|
+
}));
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
else if (modulePath) {
|
|
839
|
+
result.unresolvedReferences.push({
|
|
840
|
+
fromNodeId: importNode.id,
|
|
841
|
+
referenceName: modulePath,
|
|
842
|
+
referenceKind: 'imports',
|
|
843
|
+
line,
|
|
844
|
+
column: 0,
|
|
845
|
+
filePath: relativePath,
|
|
846
|
+
language,
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function buildArkTSIndex(rootDir, scannedFiles) {
|
|
853
|
+
const errors = [];
|
|
854
|
+
const config = (0, arkanalyzer_1.buildSceneConfigFromProject)(rootDir, process.env.OHOS_SDK_HOME, {
|
|
855
|
+
supportFileExts: ['.ets'],
|
|
856
|
+
enableMethodBodyBuild: true,
|
|
857
|
+
});
|
|
858
|
+
const scene = new arkanalyzer_1.Scene();
|
|
859
|
+
try {
|
|
860
|
+
scene.buildSceneFromProjectDir(config);
|
|
861
|
+
scene.inferTypes();
|
|
862
|
+
}
|
|
863
|
+
catch (e) {
|
|
864
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
865
|
+
errors.push({ message: `ArkTS Scene build failed: ${message}`, severity: 'error' });
|
|
866
|
+
return {
|
|
867
|
+
fileResults: new Map(),
|
|
868
|
+
crossFileEdges: [],
|
|
869
|
+
nodeIds: new Set(),
|
|
870
|
+
errors,
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
const adapter = new ArkTSAdapter(rootDir, scannedFiles);
|
|
874
|
+
const index = adapter.build(scene);
|
|
875
|
+
index.errors.push(...errors);
|
|
876
|
+
return index;
|
|
877
|
+
}
|
|
878
|
+
//# sourceMappingURL=arkts.js.map
|