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,707 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Name Matcher
|
|
4
|
+
*
|
|
5
|
+
* Handles symbol name matching for reference resolution.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.matchByFilePath = matchByFilePath;
|
|
9
|
+
exports.sameLanguageFamily = sameLanguageFamily;
|
|
10
|
+
exports.isKnownLanguageFamily = isKnownLanguageFamily;
|
|
11
|
+
exports.crossesKnownFamily = crossesKnownFamily;
|
|
12
|
+
exports.matchByExactName = matchByExactName;
|
|
13
|
+
exports.matchByQualifiedName = matchByQualifiedName;
|
|
14
|
+
exports.matchMethodCall = matchMethodCall;
|
|
15
|
+
exports.matchFuzzy = matchFuzzy;
|
|
16
|
+
exports.matchReference = matchReference;
|
|
17
|
+
/**
|
|
18
|
+
* Try to resolve a path-like reference (e.g., "snippets/drawer-menu.liquid")
|
|
19
|
+
* by matching the filename against file nodes.
|
|
20
|
+
*/
|
|
21
|
+
function matchByFilePath(ref, context) {
|
|
22
|
+
// Path-like (`a/b.liquid`) OR a bare filename ending in a short extension
|
|
23
|
+
// (`Foo.h` — an Objective-C `#import "Foo.h"`, resolved to the header by
|
|
24
|
+
// basename). A bare ref WITHOUT an extension is a symbol name, not a file, so
|
|
25
|
+
// leave it to the symbol-matching strategies.
|
|
26
|
+
if (!ref.referenceName.includes('/') && !/\.[A-Za-z][A-Za-z0-9]{0,3}$/.test(ref.referenceName)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
// Extract the filename from the path
|
|
30
|
+
const fileName = ref.referenceName.split('/').pop();
|
|
31
|
+
if (!fileName)
|
|
32
|
+
return null;
|
|
33
|
+
// Search for file nodes with this name
|
|
34
|
+
const candidates = context.getNodesByName(fileName);
|
|
35
|
+
const fileNodes = candidates.filter(n => n.kind === 'file');
|
|
36
|
+
if (fileNodes.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
// Prefer exact path match on qualified_name
|
|
39
|
+
const exactMatch = fileNodes.find(n => n.qualifiedName === ref.referenceName || n.filePath === ref.referenceName);
|
|
40
|
+
if (exactMatch) {
|
|
41
|
+
return {
|
|
42
|
+
original: ref,
|
|
43
|
+
targetNodeId: exactMatch.id,
|
|
44
|
+
confidence: 0.95,
|
|
45
|
+
resolvedBy: 'file-path',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Fall back to suffix match (e.g., ref="snippets/foo.liquid" matches
|
|
49
|
+
// "src/snippets/foo.liquid"). When several files share the basename — a
|
|
50
|
+
// `#include "RNCAsyncStorage.h"` with a same-named header on another platform
|
|
51
|
+
// (windows/code/ vs apple/) — prefer the one in the includer's own directory,
|
|
52
|
+
// then by directory proximity / same language family. A C/C++ include (and any
|
|
53
|
+
// bare-filename import) resolves relative to the including file, not to an
|
|
54
|
+
// arbitrary same-named header elsewhere in the tree.
|
|
55
|
+
const suffixMatches = fileNodes.filter(n => n.qualifiedName.endsWith(ref.referenceName) || n.filePath.endsWith(ref.referenceName));
|
|
56
|
+
if (suffixMatches.length > 0) {
|
|
57
|
+
return {
|
|
58
|
+
original: ref,
|
|
59
|
+
targetNodeId: pickClosestFileNode(suffixMatches, ref).id,
|
|
60
|
+
confidence: 0.85,
|
|
61
|
+
resolvedBy: 'file-path',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// If only one file node with this name, use it with lower confidence
|
|
65
|
+
if (fileNodes.length === 1) {
|
|
66
|
+
return {
|
|
67
|
+
original: ref,
|
|
68
|
+
targetNodeId: fileNodes[0].id,
|
|
69
|
+
confidence: 0.7,
|
|
70
|
+
resolvedBy: 'file-path',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Among several file nodes that all match a bare include/import by basename,
|
|
77
|
+
* pick the one closest to the referencing file: same directory first, then by
|
|
78
|
+
* directory-tree proximity, with the same language family as a tiebreak. A
|
|
79
|
+
* C/C++ `#include "X.h"` (and any bare-filename import) resolves relative to the
|
|
80
|
+
* including file — not to an arbitrary same-named header on another platform.
|
|
81
|
+
*/
|
|
82
|
+
function pickClosestFileNode(candidates, ref) {
|
|
83
|
+
const dirOf = (p) => {
|
|
84
|
+
const i = p.lastIndexOf('/');
|
|
85
|
+
return i >= 0 ? p.slice(0, i) : '';
|
|
86
|
+
};
|
|
87
|
+
const refDir = dirOf(ref.filePath);
|
|
88
|
+
const sameDir = candidates.filter((c) => dirOf(c.filePath) === refDir);
|
|
89
|
+
const pool = sameDir.length > 0 ? sameDir : candidates;
|
|
90
|
+
let best = pool[0];
|
|
91
|
+
let bestScore = -Infinity;
|
|
92
|
+
for (const c of pool) {
|
|
93
|
+
const score = computePathProximity(ref.filePath, c.filePath) +
|
|
94
|
+
(sameLanguageFamily(c.language, ref.language) ? 5 : 0);
|
|
95
|
+
if (score > bestScore) {
|
|
96
|
+
bestScore = score;
|
|
97
|
+
best = c;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return best;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Language families that share a type system / runtime, so a same-language-only
|
|
104
|
+
* reference may still resolve across them (a Kotlin `Foo.BAR` can name a Java
|
|
105
|
+
* `Foo`). Anything not listed forms its own singleton family.
|
|
106
|
+
*/
|
|
107
|
+
const LANGUAGE_FAMILY = {
|
|
108
|
+
java: 'jvm', kotlin: 'jvm', scala: 'jvm',
|
|
109
|
+
swift: 'apple', objc: 'apple',
|
|
110
|
+
typescript: 'web', tsx: 'web', javascript: 'web', jsx: 'web',
|
|
111
|
+
c: 'c', cpp: 'c',
|
|
112
|
+
// Razor/Blazor markup names C# types — same family so `@model Foo` /
|
|
113
|
+
// `<MyComponent/>` resolve to their `.cs` class through the cross-family gate.
|
|
114
|
+
csharp: 'dotnet', razor: 'dotnet',
|
|
115
|
+
};
|
|
116
|
+
function sameLanguageFamily(a, b) {
|
|
117
|
+
if (a === b)
|
|
118
|
+
return true;
|
|
119
|
+
const fa = LANGUAGE_FAMILY[a];
|
|
120
|
+
return fa !== undefined && fa === LANGUAGE_FAMILY[b];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* True when `lang` belongs to a known multi-language family (jvm/apple/web/c).
|
|
124
|
+
* Languages not listed (php, python, go, ruby, rust, dart, …) and config
|
|
125
|
+
* formats (yaml/xml/blade) form their own singleton families and return
|
|
126
|
+
* `false` — used to leave config↔code framework bridges (whose config side is
|
|
127
|
+
* never a known programming-language family) out of the cross-family gate.
|
|
128
|
+
*/
|
|
129
|
+
function isKnownLanguageFamily(lang) {
|
|
130
|
+
return LANGUAGE_FAMILY[lang] !== undefined;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* True when `a` and `b` are two DIFFERENT *known* language families — the
|
|
134
|
+
* signature of a coincidental cross-language name collision (a TS `import
|
|
135
|
+
* React` matching a Swift `import React`, a C++ `#include "X.h"` matching a
|
|
136
|
+
* same-named ObjC header on another platform). The both-*known* test is
|
|
137
|
+
* deliberately weaker than {@link sameLanguageFamily}'s negation: a
|
|
138
|
+
* single-file-component language that carries its own tag (`vue`/`svelte`)
|
|
139
|
+
* importing a `.ts` module, or any singleton-family language (php/go/ruby/…),
|
|
140
|
+
* returns `false` here and is left alone.
|
|
141
|
+
*/
|
|
142
|
+
function crossesKnownFamily(a, b) {
|
|
143
|
+
return isKnownLanguageFamily(a) && isKnownLanguageFamily(b) && !sameLanguageFamily(a, b);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Drop cross-language candidates from a name lookup. Two regimes:
|
|
147
|
+
* - `references` (type-usage): a type named in language X resolves to a
|
|
148
|
+
* SAME-family type, never a coincidentally same-named symbol in another
|
|
149
|
+
* language (the Android `BatteryManager` system class vs a JS one). Strict
|
|
150
|
+
* same-family filter — cross-language communication is `calls`, not refs.
|
|
151
|
+
* - `imports` (import binding): an `import`/`#include` never crosses two
|
|
152
|
+
* KNOWN families (TS `import React` ↮ Swift `import React`). Weaker
|
|
153
|
+
* both-known filter so `.vue`/`.svelte` (own tag) importing `.ts` survives.
|
|
154
|
+
*/
|
|
155
|
+
function applyLanguageGate(candidates, ref) {
|
|
156
|
+
if (ref.referenceKind === 'references') {
|
|
157
|
+
return candidates.filter((c) => sameLanguageFamily(c.language, ref.language));
|
|
158
|
+
}
|
|
159
|
+
if (ref.referenceKind === 'imports') {
|
|
160
|
+
return candidates.filter((c) => !crossesKnownFamily(c.language, ref.language));
|
|
161
|
+
}
|
|
162
|
+
return candidates;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Try to resolve a reference by exact name match
|
|
166
|
+
*/
|
|
167
|
+
function matchByExactName(ref, context) {
|
|
168
|
+
const candidates = applyLanguageGate(context.getNodesByName(ref.referenceName), ref);
|
|
169
|
+
if (candidates.length === 0) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
// If only one match, use it — but penalize cross-language matches
|
|
173
|
+
if (candidates.length === 1) {
|
|
174
|
+
const isCrossLanguage = candidates[0].language !== ref.language;
|
|
175
|
+
return {
|
|
176
|
+
original: ref,
|
|
177
|
+
targetNodeId: candidates[0].id,
|
|
178
|
+
confidence: isCrossLanguage ? 0.5 : 0.9,
|
|
179
|
+
resolvedBy: 'exact-match',
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// Multiple matches - try to narrow down
|
|
183
|
+
const bestMatch = findBestMatch(ref, candidates, context);
|
|
184
|
+
if (bestMatch) {
|
|
185
|
+
// Lower confidence when the match is from a distant/unrelated module
|
|
186
|
+
const proximity = computePathProximity(ref.filePath, bestMatch.filePath);
|
|
187
|
+
const confidence = proximity >= 30 ? 0.7 : 0.4;
|
|
188
|
+
return {
|
|
189
|
+
original: ref,
|
|
190
|
+
targetNodeId: bestMatch.id,
|
|
191
|
+
confidence,
|
|
192
|
+
resolvedBy: 'exact-match',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Try to resolve by qualified name
|
|
199
|
+
*/
|
|
200
|
+
function matchByQualifiedName(ref, context) {
|
|
201
|
+
// Check if the reference name looks qualified (contains :: or .)
|
|
202
|
+
if (!ref.referenceName.includes('::') && !ref.referenceName.includes('.')) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const candidates = context.getNodesByQualifiedName(ref.referenceName);
|
|
206
|
+
if (candidates.length === 1) {
|
|
207
|
+
return {
|
|
208
|
+
original: ref,
|
|
209
|
+
targetNodeId: candidates[0].id,
|
|
210
|
+
confidence: 0.95,
|
|
211
|
+
resolvedBy: 'qualified-name',
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// Try partial qualified name match
|
|
215
|
+
const parts = ref.referenceName.split(/[:.]/);
|
|
216
|
+
const lastName = parts[parts.length - 1];
|
|
217
|
+
if (lastName) {
|
|
218
|
+
const partialCandidates = context.getNodesByName(lastName);
|
|
219
|
+
for (const candidate of partialCandidates) {
|
|
220
|
+
if (candidate.qualifiedName.endsWith(ref.referenceName)) {
|
|
221
|
+
return {
|
|
222
|
+
original: ref,
|
|
223
|
+
targetNodeId: candidate.id,
|
|
224
|
+
confidence: 0.85,
|
|
225
|
+
resolvedBy: 'qualified-name',
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
function resolveMethodOnType(typeName, methodName, ref, context, confidence, resolvedBy,
|
|
233
|
+
/**
|
|
234
|
+
* Optional FQN that identifies WHICH class declaration `typeName`
|
|
235
|
+
* refers to in the caller's file. When multiple candidates share
|
|
236
|
+
* the same qualifiedName (`FooConverter::convert` in both
|
|
237
|
+
* `dao/converter/` and `service/converter/`), the FQN's
|
|
238
|
+
* file-path-suffix picks the right one — the disambiguation
|
|
239
|
+
* signal Java imports carry but the call site doesn't (#314).
|
|
240
|
+
*/
|
|
241
|
+
preferredFqn) {
|
|
242
|
+
// Look up methods by name and match by qualifiedName ending in
|
|
243
|
+
// `<typeName>::<methodName>`. This works whether the method is defined
|
|
244
|
+
// in-class (`class Foo { int bar() { ... } }`) or out-of-line in a separate
|
|
245
|
+
// file (`int Foo::bar() { ... }` in foo.cpp while class Foo is in foo.hpp).
|
|
246
|
+
// The previous same-file approach missed the latter — the typical C++ layout.
|
|
247
|
+
const methodCandidates = context.getNodesByName(methodName);
|
|
248
|
+
const want = `${typeName}::${methodName}`;
|
|
249
|
+
const matches = [];
|
|
250
|
+
for (const m of methodCandidates) {
|
|
251
|
+
if (m.kind !== 'method')
|
|
252
|
+
continue;
|
|
253
|
+
if (m.language !== ref.language)
|
|
254
|
+
continue;
|
|
255
|
+
const qn = m.qualifiedName;
|
|
256
|
+
if (qn === want || qn.endsWith(`::${want}`)) {
|
|
257
|
+
matches.push(m);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (matches.length === 0)
|
|
261
|
+
return null;
|
|
262
|
+
if (matches.length > 1 && preferredFqn) {
|
|
263
|
+
const ext = ref.language === 'kotlin' ? '.kt' : '.java';
|
|
264
|
+
const fqnPath = preferredFqn.replace(/\./g, '/') + ext;
|
|
265
|
+
const chosen = matches.find((m) => {
|
|
266
|
+
const fp = m.filePath.replace(/\\/g, '/');
|
|
267
|
+
return fp.endsWith(fqnPath) || fp.endsWith('/' + fqnPath);
|
|
268
|
+
});
|
|
269
|
+
if (chosen) {
|
|
270
|
+
return {
|
|
271
|
+
original: ref,
|
|
272
|
+
targetNodeId: chosen.id,
|
|
273
|
+
confidence,
|
|
274
|
+
resolvedBy,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
original: ref,
|
|
280
|
+
targetNodeId: matches[0].id,
|
|
281
|
+
confidence,
|
|
282
|
+
resolvedBy,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
// C++ keywords/control-flow tokens that can appear right before a receiver
|
|
286
|
+
// (e.g. `return ptr->m()`) and must NOT be treated as a type.
|
|
287
|
+
const CPP_NON_TYPE_TOKENS = new Set([
|
|
288
|
+
'return', 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'default',
|
|
289
|
+
'break', 'continue', 'goto', 'throw', 'new', 'delete', 'co_await', 'co_yield',
|
|
290
|
+
'co_return', 'static_cast', 'const_cast', 'dynamic_cast', 'reinterpret_cast',
|
|
291
|
+
'sizeof', 'alignof', 'typeid', 'and', 'or', 'not', 'xor',
|
|
292
|
+
]);
|
|
293
|
+
function normalizeCppTypeName(typeName) {
|
|
294
|
+
const normalized = typeName
|
|
295
|
+
.replace(/\b(const|volatile|mutable|typename|class|struct)\b/g, ' ')
|
|
296
|
+
.replace(/[&*]+/g, ' ')
|
|
297
|
+
.replace(/<[^>]*>/g, ' ')
|
|
298
|
+
.replace(/\s+/g, ' ')
|
|
299
|
+
.trim();
|
|
300
|
+
if (!normalized)
|
|
301
|
+
return null;
|
|
302
|
+
const parts = normalized.split(/::/).filter(Boolean);
|
|
303
|
+
const last = parts[parts.length - 1];
|
|
304
|
+
if (!last)
|
|
305
|
+
return null;
|
|
306
|
+
if (CPP_NON_TYPE_TOKENS.has(last))
|
|
307
|
+
return null;
|
|
308
|
+
return last;
|
|
309
|
+
}
|
|
310
|
+
// Declarator regex: matches `Type receiver`, `Type* receiver`, `Type *receiver`,
|
|
311
|
+
// `Type*receiver`, `Type<X> receiver`, etc., REQUIRING a declarator terminator
|
|
312
|
+
// (`;`, `=`, `,`, `)`, `[`, `{`, `(`, or end-of-line) after the receiver. The
|
|
313
|
+
// terminator rules out uses like `return receiver->m()` where the preceding
|
|
314
|
+
// token is a keyword, not a type.
|
|
315
|
+
function buildDeclaratorRegex(escapedReceiver) {
|
|
316
|
+
return new RegExp(`([A-Za-z_][\\w:]*(?:\\s*<[^;=(){}]+>)?(?:\\s*[*&]+)?)\\s*\\b${escapedReceiver}\\b\\s*(?=[;=,)\\[{(]|$)`);
|
|
317
|
+
}
|
|
318
|
+
function inferCppReceiverType(receiverName, ref, context) {
|
|
319
|
+
const source = context.readFile(ref.filePath);
|
|
320
|
+
if (!source)
|
|
321
|
+
return null;
|
|
322
|
+
const lines = source.split(/\r?\n/);
|
|
323
|
+
const callLineIndex = Math.max(0, Math.min(lines.length - 1, ref.line - 1));
|
|
324
|
+
const escapedReceiver = receiverName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
325
|
+
const receiverPattern = new RegExp(`\\b${escapedReceiver}\\b`);
|
|
326
|
+
const declaratorRegex = buildDeclaratorRegex(escapedReceiver);
|
|
327
|
+
for (let i = callLineIndex; i >= 0; i--) {
|
|
328
|
+
const line = lines[i];
|
|
329
|
+
if (!line || !receiverPattern.test(line))
|
|
330
|
+
continue;
|
|
331
|
+
const declaratorMatch = line.match(declaratorRegex);
|
|
332
|
+
if (declaratorMatch) {
|
|
333
|
+
const normalized = normalizeCppTypeName(declaratorMatch[1] ?? '');
|
|
334
|
+
if (normalized)
|
|
335
|
+
return normalized;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
const headerCandidates = [
|
|
339
|
+
ref.filePath.replace(/\.(?:c|cc|cpp|cxx)$/i, '.h'),
|
|
340
|
+
ref.filePath.replace(/\.(?:c|cc|cpp|cxx)$/i, '.hpp'),
|
|
341
|
+
ref.filePath.replace(/\.(?:c|cc|cpp|cxx)$/i, '.hxx'),
|
|
342
|
+
].filter((candidate, index, arr) => arr.indexOf(candidate) === index && candidate !== ref.filePath);
|
|
343
|
+
for (const headerPath of headerCandidates) {
|
|
344
|
+
if (!context.fileExists(headerPath))
|
|
345
|
+
continue;
|
|
346
|
+
const headerSource = context.readFile(headerPath);
|
|
347
|
+
if (!headerSource)
|
|
348
|
+
continue;
|
|
349
|
+
for (const line of headerSource.split(/\r?\n/)) {
|
|
350
|
+
if (!receiverPattern.test(line))
|
|
351
|
+
continue;
|
|
352
|
+
const declaratorMatch = line.match(declaratorRegex);
|
|
353
|
+
if (!declaratorMatch)
|
|
354
|
+
continue;
|
|
355
|
+
const normalized = normalizeCppTypeName(declaratorMatch[1] ?? '');
|
|
356
|
+
if (normalized)
|
|
357
|
+
return normalized;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Java/Kotlin: infer a receiver's declared type by walking field declarations
|
|
364
|
+
* in the class enclosing the call site. The field's `signature` is already in
|
|
365
|
+
* the form "<TypeName> <fieldName>" (set by tree-sitter.ts extractField), so we
|
|
366
|
+
* pull the type from there. Handles Spring `@Resource UserBO userbo;` /
|
|
367
|
+
* `@Autowired private UserService userService;` where the receiver field name
|
|
368
|
+
* doesn't match the class name by Java naming convention.
|
|
369
|
+
*
|
|
370
|
+
* Returns the bare type name (generics stripped, dotted package stripped) or
|
|
371
|
+
* null when no matching field is in the enclosing class.
|
|
372
|
+
*/
|
|
373
|
+
function inferJavaFieldReceiverType(receiverName, ref, context) {
|
|
374
|
+
const inFile = context.getNodesInFile(ref.filePath);
|
|
375
|
+
if (inFile.length === 0)
|
|
376
|
+
return null;
|
|
377
|
+
// Find the class enclosing the call line (tightest match by latest start).
|
|
378
|
+
let enclosing = null;
|
|
379
|
+
for (const n of inFile) {
|
|
380
|
+
if (n.kind !== 'class' && n.kind !== 'interface')
|
|
381
|
+
continue;
|
|
382
|
+
if (n.language !== ref.language)
|
|
383
|
+
continue;
|
|
384
|
+
const end = n.endLine ?? n.startLine;
|
|
385
|
+
if (n.startLine <= ref.line && end >= ref.line) {
|
|
386
|
+
if (!enclosing || n.startLine >= enclosing.startLine)
|
|
387
|
+
enclosing = n;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (!enclosing)
|
|
391
|
+
return null;
|
|
392
|
+
const enclosingEnd = enclosing.endLine ?? enclosing.startLine;
|
|
393
|
+
const field = inFile.find((n) => n.kind === 'field' &&
|
|
394
|
+
n.name === receiverName &&
|
|
395
|
+
n.language === ref.language &&
|
|
396
|
+
n.startLine >= enclosing.startLine &&
|
|
397
|
+
(n.endLine ?? n.startLine) <= enclosingEnd);
|
|
398
|
+
if (!field || !field.signature)
|
|
399
|
+
return null;
|
|
400
|
+
// Signature shape: "<TypeName> <fieldName>" (extractField). Pull the type,
|
|
401
|
+
// strip generics + dotted package, drop array/varargs markers.
|
|
402
|
+
const beforeName = field.signature.slice(0, field.signature.lastIndexOf(field.name));
|
|
403
|
+
const typeRaw = beforeName.trim();
|
|
404
|
+
if (!typeRaw)
|
|
405
|
+
return null;
|
|
406
|
+
const typeNoGenerics = typeRaw.replace(/<[^>]*>/g, '').trim();
|
|
407
|
+
const typeNoArray = typeNoGenerics.replace(/\[\s*\]/g, '').replace(/\.\.\.$/, '').trim();
|
|
408
|
+
const parts = typeNoArray.split(/[.\s]+/).filter(Boolean);
|
|
409
|
+
const lastPart = parts[parts.length - 1];
|
|
410
|
+
if (!lastPart)
|
|
411
|
+
return null;
|
|
412
|
+
if (!/^[A-Z]/.test(lastPart))
|
|
413
|
+
return null; // primitives / lowercase → skip
|
|
414
|
+
return lastPart;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Try to resolve by method name on a class/object
|
|
418
|
+
*/
|
|
419
|
+
function matchMethodCall(ref, context) {
|
|
420
|
+
// Parse method call patterns like "obj.method" or "Class::method". The method
|
|
421
|
+
// part allows trailing `:` keywords so Objective-C selectors resolve
|
|
422
|
+
// (`SDImageCache.storeImage:`, `obj.setX:y:`); colons never appear in other
|
|
423
|
+
// languages' method refs, so this is a no-op for them.
|
|
424
|
+
// The receiver allows dots (`builder.Services.AddCoreServices`) so a CHAINED
|
|
425
|
+
// call resolves by its last segment — Strategy 3 below name-matches the method
|
|
426
|
+
// (with its existing single-candidate / receiver-overlap guards). Without this
|
|
427
|
+
// a multi-dot extension-method call (C# DI `builder.Services.AddCoreServices()`,
|
|
428
|
+
// `Guard.Against.X()`) matched no pattern and never resolved.
|
|
429
|
+
const dotMatch = ref.referenceName.match(/^([\w.]+)\.(\w+:?(?:\w+:)*)$/);
|
|
430
|
+
const colonMatch = ref.referenceName.match(/^(\w+)::(\w+)$/);
|
|
431
|
+
const match = dotMatch || colonMatch;
|
|
432
|
+
if (!match) {
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
435
|
+
const [, objectOrClass, methodName] = match;
|
|
436
|
+
if (ref.language === 'cpp' && dotMatch) {
|
|
437
|
+
const inferredType = inferCppReceiverType(objectOrClass, ref, context);
|
|
438
|
+
if (inferredType) {
|
|
439
|
+
const typedMatch = resolveMethodOnType(inferredType, methodName, ref, context, 0.9, 'instance-method');
|
|
440
|
+
if (typedMatch) {
|
|
441
|
+
return typedMatch;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
// Java/Kotlin: receiver may be a field whose name doesn't match the type by
|
|
446
|
+
// Java naming convention (`userbo` → class `UserBO`, abbreviated). Look up
|
|
447
|
+
// the field in the enclosing class to get its declared type, then resolve
|
|
448
|
+
// the method on that type. Covers Spring `@Resource`/`@Autowired` field
|
|
449
|
+
// injection where the field type is the concrete bean class.
|
|
450
|
+
if ((ref.language === 'java' || ref.language === 'kotlin') && dotMatch) {
|
|
451
|
+
const inferredType = inferJavaFieldReceiverType(objectOrClass, ref, context);
|
|
452
|
+
if (inferredType) {
|
|
453
|
+
// When two classes share the same simple name, the caller file's
|
|
454
|
+
// import is the only signal that names WHICH one — pass the
|
|
455
|
+
// imported FQN so resolveMethodOnType can disambiguate (#314).
|
|
456
|
+
const imports = context.getImportMappings(ref.filePath, ref.language);
|
|
457
|
+
const importedFqn = imports.find((i) => i.localName === inferredType)?.source;
|
|
458
|
+
const typedMatch = resolveMethodOnType(inferredType, methodName, ref, context, 0.9, 'instance-method', importedFqn);
|
|
459
|
+
if (typedMatch) {
|
|
460
|
+
return typedMatch;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
// Strategy 1: Direct class name match (existing logic)
|
|
465
|
+
const classCandidates = context.getNodesByName(objectOrClass);
|
|
466
|
+
for (const classNode of classCandidates) {
|
|
467
|
+
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'interface') {
|
|
468
|
+
// Skip cross-language class matches
|
|
469
|
+
if (classNode.language !== ref.language)
|
|
470
|
+
continue;
|
|
471
|
+
const nodesInFile = context.getNodesInFile(classNode.filePath);
|
|
472
|
+
const methodNode = nodesInFile.find((n) => n.kind === 'method' &&
|
|
473
|
+
n.name === methodName &&
|
|
474
|
+
n.qualifiedName.includes(classNode.name));
|
|
475
|
+
if (methodNode) {
|
|
476
|
+
return {
|
|
477
|
+
original: ref,
|
|
478
|
+
targetNodeId: methodNode.id,
|
|
479
|
+
confidence: 0.85,
|
|
480
|
+
resolvedBy: 'qualified-name',
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
// Strategy 2: Instance variable receiver - try capitalized form to find class
|
|
486
|
+
// e.g., "permissionEngine" → look for classes containing "PermissionEngine"
|
|
487
|
+
const capitalizedReceiver = objectOrClass.charAt(0).toUpperCase() + objectOrClass.slice(1);
|
|
488
|
+
if (capitalizedReceiver !== objectOrClass) {
|
|
489
|
+
const fuzzyClassCandidates = context.getNodesByName(capitalizedReceiver);
|
|
490
|
+
for (const classNode of fuzzyClassCandidates) {
|
|
491
|
+
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'interface') {
|
|
492
|
+
// Skip cross-language class matches
|
|
493
|
+
if (classNode.language !== ref.language)
|
|
494
|
+
continue;
|
|
495
|
+
const nodesInFile = context.getNodesInFile(classNode.filePath);
|
|
496
|
+
const methodNode = nodesInFile.find((n) => n.kind === 'method' &&
|
|
497
|
+
n.name === methodName &&
|
|
498
|
+
n.qualifiedName.includes(classNode.name));
|
|
499
|
+
if (methodNode) {
|
|
500
|
+
return {
|
|
501
|
+
original: ref,
|
|
502
|
+
targetNodeId: methodNode.id,
|
|
503
|
+
confidence: 0.8,
|
|
504
|
+
resolvedBy: 'instance-method',
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
// Strategy 3: Find methods by name across the codebase, match by receiver
|
|
511
|
+
// name similarity with the containing class. Handles abbreviated variable
|
|
512
|
+
// names like permissionEngine → PermissionRuleEngine.
|
|
513
|
+
if (methodName) {
|
|
514
|
+
const methodCandidates = context.getNodesByName(methodName);
|
|
515
|
+
const methods = methodCandidates.filter((n) => n.kind === 'method' && n.name === methodName);
|
|
516
|
+
// Filter to same-language candidates first
|
|
517
|
+
const sameLanguageMethods = methods.filter(m => m.language === ref.language);
|
|
518
|
+
const targetMethods = sameLanguageMethods.length > 0 ? sameLanguageMethods : methods;
|
|
519
|
+
// If only one same-language method with this name exists, use it
|
|
520
|
+
if (targetMethods.length === 1 && targetMethods[0].language === ref.language) {
|
|
521
|
+
return {
|
|
522
|
+
original: ref,
|
|
523
|
+
targetNodeId: targetMethods[0].id,
|
|
524
|
+
confidence: 0.7,
|
|
525
|
+
resolvedBy: 'instance-method',
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
// Multiple methods: score by receiver name word overlap with class name
|
|
529
|
+
if (targetMethods.length > 1) {
|
|
530
|
+
const receiverWords = splitCamelCase(objectOrClass);
|
|
531
|
+
let bestMatch;
|
|
532
|
+
let bestScore = 0;
|
|
533
|
+
for (const method of targetMethods) {
|
|
534
|
+
const classWords = splitCamelCase(method.qualifiedName);
|
|
535
|
+
let score = receiverWords.filter(w => classWords.some(cw => cw.toLowerCase() === w.toLowerCase())).length;
|
|
536
|
+
// Bonus for same language
|
|
537
|
+
if (method.language === ref.language)
|
|
538
|
+
score += 1;
|
|
539
|
+
if (score > bestScore) {
|
|
540
|
+
bestScore = score;
|
|
541
|
+
bestMatch = method;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
if (bestMatch && bestScore >= 2) {
|
|
545
|
+
return {
|
|
546
|
+
original: ref,
|
|
547
|
+
targetNodeId: bestMatch.id,
|
|
548
|
+
confidence: 0.65,
|
|
549
|
+
resolvedBy: 'instance-method',
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Split a camelCase or PascalCase string into words.
|
|
558
|
+
*/
|
|
559
|
+
function splitCamelCase(str) {
|
|
560
|
+
return str.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
561
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
562
|
+
.split(/[\s._:\/\\]+/)
|
|
563
|
+
.filter(w => w.length > 1);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Compute directory proximity between two file paths.
|
|
567
|
+
* Returns a score based on the number of shared directory segments.
|
|
568
|
+
* Higher score = closer in directory tree.
|
|
569
|
+
*/
|
|
570
|
+
function computePathProximity(filePath1, filePath2) {
|
|
571
|
+
const dir1 = filePath1.split('/').slice(0, -1);
|
|
572
|
+
const dir2 = filePath2.split('/').slice(0, -1);
|
|
573
|
+
let shared = 0;
|
|
574
|
+
for (let i = 0; i < Math.min(dir1.length, dir2.length); i++) {
|
|
575
|
+
if (dir1[i] === dir2[i]) {
|
|
576
|
+
shared++;
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
break;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
// Each shared directory segment contributes 15 points, capped at 80
|
|
583
|
+
return Math.min(shared * 15, 80);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Find the best matching node when there are multiple candidates
|
|
587
|
+
*/
|
|
588
|
+
function findBestMatch(ref, candidates, _context) {
|
|
589
|
+
// Prioritization rules:
|
|
590
|
+
// 1. Same file > different file
|
|
591
|
+
// 2. Directory proximity (same module/package > different module)
|
|
592
|
+
// 3. Same language > different language
|
|
593
|
+
// 4. Functions/methods > classes/types (for call references)
|
|
594
|
+
// 5. Exported > non-exported
|
|
595
|
+
let bestScore = -1;
|
|
596
|
+
let bestNode = null;
|
|
597
|
+
for (const candidate of candidates) {
|
|
598
|
+
let score = 0;
|
|
599
|
+
// Same file bonus
|
|
600
|
+
if (candidate.filePath === ref.filePath) {
|
|
601
|
+
score += 100;
|
|
602
|
+
}
|
|
603
|
+
// Directory proximity bonus — strongly prefer same module/package
|
|
604
|
+
score += computePathProximity(ref.filePath, candidate.filePath);
|
|
605
|
+
// Language matching: strongly prefer same language, penalize cross-language
|
|
606
|
+
if (candidate.language === ref.language) {
|
|
607
|
+
score += 50;
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
score -= 80;
|
|
611
|
+
}
|
|
612
|
+
// For call references, prefer functions/methods
|
|
613
|
+
if (ref.referenceKind === 'calls') {
|
|
614
|
+
if (candidate.kind === 'function' || candidate.kind === 'method') {
|
|
615
|
+
score += 25;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
// For instantiation references (`new Foo()`), prefer class-like
|
|
619
|
+
// targets — without this, a function named `Foo` in another module
|
|
620
|
+
// could outscore the actual class.
|
|
621
|
+
if (ref.referenceKind === 'instantiates') {
|
|
622
|
+
if (candidate.kind === 'class' ||
|
|
623
|
+
candidate.kind === 'struct' ||
|
|
624
|
+
candidate.kind === 'interface') {
|
|
625
|
+
score += 25;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
// For decorator references (`@Foo`), prefer functions. Class
|
|
629
|
+
// decorators (Python `@SomeClass`, Java annotation interfaces)
|
|
630
|
+
// also resolve here, hence the smaller class bonus.
|
|
631
|
+
if (ref.referenceKind === 'decorates') {
|
|
632
|
+
if (candidate.kind === 'function' || candidate.kind === 'method') {
|
|
633
|
+
score += 25;
|
|
634
|
+
}
|
|
635
|
+
else if (candidate.kind === 'class' || candidate.kind === 'interface') {
|
|
636
|
+
score += 15;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
// Exported bonus
|
|
640
|
+
if (candidate.isExported) {
|
|
641
|
+
score += 10;
|
|
642
|
+
}
|
|
643
|
+
// Closer line number (within same file)
|
|
644
|
+
if (candidate.filePath === ref.filePath && candidate.startLine) {
|
|
645
|
+
const distance = Math.abs(candidate.startLine - ref.line);
|
|
646
|
+
score += Math.max(0, 20 - distance / 10);
|
|
647
|
+
}
|
|
648
|
+
if (score > bestScore) {
|
|
649
|
+
bestScore = score;
|
|
650
|
+
bestNode = candidate;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return bestNode;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Fuzzy match - last resort with lower confidence
|
|
657
|
+
*/
|
|
658
|
+
function matchFuzzy(ref, context) {
|
|
659
|
+
const lowerName = ref.referenceName.toLowerCase();
|
|
660
|
+
// Use pre-built lowercase index for O(1) lookup instead of scanning all nodes
|
|
661
|
+
const candidates = context.getNodesByLowerName(lowerName);
|
|
662
|
+
// Filter to callable kinds only (function, method, class)
|
|
663
|
+
const callableKinds = new Set(['function', 'method', 'class']);
|
|
664
|
+
const callableCandidates = applyLanguageGate(candidates.filter((n) => callableKinds.has(n.kind)), ref);
|
|
665
|
+
// Prefer same-language matches
|
|
666
|
+
const sameLanguageCandidates = callableCandidates.filter(n => n.language === ref.language);
|
|
667
|
+
const finalCandidates = sameLanguageCandidates.length > 0 ? sameLanguageCandidates : callableCandidates;
|
|
668
|
+
if (finalCandidates.length === 1) {
|
|
669
|
+
const isCrossLanguage = finalCandidates[0].language !== ref.language;
|
|
670
|
+
return {
|
|
671
|
+
original: ref,
|
|
672
|
+
targetNodeId: finalCandidates[0].id,
|
|
673
|
+
confidence: isCrossLanguage ? 0.3 : 0.5,
|
|
674
|
+
resolvedBy: 'fuzzy',
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Match all strategies in order of confidence
|
|
681
|
+
*/
|
|
682
|
+
function matchReference(ref, context) {
|
|
683
|
+
// Try strategies in order of confidence
|
|
684
|
+
let result;
|
|
685
|
+
// 0. File path match (e.g., "snippets/drawer-menu.liquid" → file node)
|
|
686
|
+
result = matchByFilePath(ref, context);
|
|
687
|
+
if (result)
|
|
688
|
+
return result;
|
|
689
|
+
// 1. Qualified name match (highest confidence)
|
|
690
|
+
result = matchByQualifiedName(ref, context);
|
|
691
|
+
if (result)
|
|
692
|
+
return result;
|
|
693
|
+
// 2. Method call pattern
|
|
694
|
+
result = matchMethodCall(ref, context);
|
|
695
|
+
if (result)
|
|
696
|
+
return result;
|
|
697
|
+
// 3. Exact name match
|
|
698
|
+
result = matchByExactName(ref, context);
|
|
699
|
+
if (result)
|
|
700
|
+
return result;
|
|
701
|
+
// 4. Fuzzy match (lowest confidence)
|
|
702
|
+
result = matchFuzzy(ref, context);
|
|
703
|
+
if (result)
|
|
704
|
+
return result;
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
//# sourceMappingURL=name-matcher.js.map
|