cgraphx 1.1.0
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 +243 -0
- package/dist/.claude-template/commands/my-commit.md +9 -0
- package/dist/.claude-template/commands/my-query.md +4 -0
- package/dist/.claude-template/hooks/context-monitor/context-monitor.cjs +216 -0
- package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.d.ts +4 -0
- package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.js +24 -0
- package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config-reader.d.ts +8 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config-reader.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config-reader.js +204 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config-reader.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config.d.ts +46 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config.js +220 -0
- package/dist/.claude-template/plugins/claude-hud/dist/config.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/constants.d.ts +10 -0
- package/dist/.claude-template/plugins/claude-hud/dist/constants.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/constants.js +10 -0
- package/dist/.claude-template/plugins/claude-hud/dist/constants.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/debug.d.ts +6 -0
- package/dist/.claude-template/plugins/claude-hud/dist/debug.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/debug.js +15 -0
- package/dist/.claude-template/plugins/claude-hud/dist/debug.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.d.ts +23 -0
- package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.js +103 -0
- package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/git.d.ts +16 -0
- package/dist/.claude-template/plugins/claude-hud/dist/git.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/git.js +86 -0
- package/dist/.claude-template/plugins/claude-hud/dist/git.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/index.d.ts +24 -0
- package/dist/.claude-template/plugins/claude-hud/dist/index.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/index.js +97 -0
- package/dist/.claude-template/plugins/claude-hud/dist/index.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.js +44 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/colors.d.ts +12 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/colors.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/colors.js +58 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/colors.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/index.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/index.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/index.js +379 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/index.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.js +30 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.js +52 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.d.ts +5 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.js +5 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.js +74 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.js +92 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.d.ts +7 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.js +247 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.js +25 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.js +43 -0
- package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.d.ts +7 -0
- package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.js +62 -0
- package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/stdin.d.ts +9 -0
- package/dist/.claude-template/plugins/claude-hud/dist/stdin.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/stdin.js +136 -0
- package/dist/.claude-template/plugins/claude-hud/dist/stdin.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/transcript.d.ts +3 -0
- package/dist/.claude-template/plugins/claude-hud/dist/transcript.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/transcript.js +189 -0
- package/dist/.claude-template/plugins/claude-hud/dist/transcript.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/types.d.ts +79 -0
- package/dist/.claude-template/plugins/claude-hud/dist/types.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/types.js +5 -0
- package/dist/.claude-template/plugins/claude-hud/dist/types.js.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/usage-api.d.ts +59 -0
- package/dist/.claude-template/plugins/claude-hud/dist/usage-api.d.ts.map +1 -0
- package/dist/.claude-template/plugins/claude-hud/dist/usage-api.js +733 -0
- package/dist/.claude-template/plugins/claude-hud/dist/usage-api.js.map +1 -0
- package/dist/.claude-template/skills/cgraphx/SKILL.md +143 -0
- package/dist/.claude-template/skills/cgraphx/agent-prompt.md +56 -0
- package/dist/.claude-template/skills/clarify-requirements/SKILL.md +425 -0
- package/dist/.claude-template/skills/code-impact-api/SKILL.md +143 -0
- package/dist/.claude-template/skills/code-impact-api/agent-prompt.md +51 -0
- package/dist/.claude-template/skills/code-impact-docgen/SKILL.md +366 -0
- package/dist/.claude-template/skills/code-impact-docgen/template-business-html.md +242 -0
- package/dist/.claude-template/skills/code-impact-docgen/template-business-md.md +107 -0
- package/dist/.claude-template/skills/code-impact-docgen/template-technical-html.md +205 -0
- package/dist/.claude-template/skills/code-impact-docgen/template-technical-md.md +155 -0
- package/dist/.claude-template/skills/code-impact-init/SKILL.md +800 -0
- package/dist/.claude-template/skills/code-impact-markdown/SKILL.md +345 -0
- package/dist/.claude-template/skills/code-impact-markdown/template-guide.md +68 -0
- package/dist/.claude-template/skills/code-impact-markdown/template-memory.md +82 -0
- package/dist/.claude-template/skills/code-impact-markdown/template-runbook.md +58 -0
- package/dist/.claude-template/skills/db-query/SKILL.md +166 -0
- package/dist/.claude-template/skills/db-query/agent-prompt.md +55 -0
- package/dist/.claude-template/skills/developer-timeline/SKILL.md +302 -0
- package/dist/.claude-template/skills/developer-timeline/demo-single-page-report.html +657 -0
- package/dist/.claude-template/skills/implementation/SKILL.md +136 -0
- package/dist/.claude-template/skills/subagent-implement/SKILL.md +225 -0
- package/dist/.claude-template/skills/subagent-implement/implementer-prompt.md +127 -0
- package/dist/.claude-template/skills/subagent-implement/quality-reviewer-prompt.md +130 -0
- package/dist/.claude-template/skills/subagent-implement/spec-reviewer-prompt.md +112 -0
- package/dist/.claude-template/skills/write-plan/SKILL.md +322 -0
- package/dist/.claude-template/skills/write-plan/plan-document-reviewer-prompt.md +134 -0
- package/dist/.claude-template/skills/write-prd/SKILL.md +242 -0
- package/dist/.claude-template/skills/write-spec/SKILL.md +278 -0
- package/dist/bin/codegraph.d.ts +26 -0
- package/dist/bin/codegraph.d.ts.map +1 -0
- package/dist/bin/codegraph.js +2014 -0
- package/dist/bin/codegraph.js.map +1 -0
- package/dist/bin/fatal-handler.d.ts +20 -0
- package/dist/bin/fatal-handler.d.ts.map +1 -0
- package/dist/bin/fatal-handler.js +118 -0
- package/dist/bin/fatal-handler.js.map +1 -0
- package/dist/bin/node-version-check.d.ts +51 -0
- package/dist/bin/node-version-check.d.ts.map +1 -0
- package/dist/bin/node-version-check.js +114 -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 +1296 -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 +122 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +296 -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 +140 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +401 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +1591 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.sql +152 -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/dbquery/cli.d.ts +17 -0
- package/dist/dbquery/cli.d.ts.map +1 -0
- package/dist/dbquery/cli.js +229 -0
- package/dist/dbquery/cli.js.map +1 -0
- package/dist/dbquery/config.d.ts +38 -0
- package/dist/dbquery/config.d.ts.map +1 -0
- package/dist/dbquery/config.js +244 -0
- package/dist/dbquery/config.js.map +1 -0
- package/dist/dbquery/constants.d.ts +40 -0
- package/dist/dbquery/constants.d.ts.map +1 -0
- package/dist/dbquery/constants.js +65 -0
- package/dist/dbquery/constants.js.map +1 -0
- package/dist/dbquery/drivers/mysql.d.ts +15 -0
- package/dist/dbquery/drivers/mysql.d.ts.map +1 -0
- package/dist/dbquery/drivers/mysql.js +102 -0
- package/dist/dbquery/drivers/mysql.js.map +1 -0
- package/dist/dbquery/drivers/postgres.d.ts +16 -0
- package/dist/dbquery/drivers/postgres.d.ts.map +1 -0
- package/dist/dbquery/drivers/postgres.js +105 -0
- package/dist/dbquery/drivers/postgres.js.map +1 -0
- package/dist/dbquery/errors.d.ts +40 -0
- package/dist/dbquery/errors.d.ts.map +1 -0
- package/dist/dbquery/errors.js +85 -0
- package/dist/dbquery/errors.js.map +1 -0
- package/dist/dbquery/executor.d.ts +30 -0
- package/dist/dbquery/executor.d.ts.map +1 -0
- package/dist/dbquery/executor.js +243 -0
- package/dist/dbquery/executor.js.map +1 -0
- package/dist/dbquery/format.d.ts +18 -0
- package/dist/dbquery/format.d.ts.map +1 -0
- package/dist/dbquery/format.js +174 -0
- package/dist/dbquery/format.js.map +1 -0
- package/dist/dbquery/index.d.ts +10 -0
- package/dist/dbquery/index.d.ts.map +1 -0
- package/dist/dbquery/index.js +23 -0
- package/dist/dbquery/index.js.map +1 -0
- package/dist/dbquery/init.d.ts +33 -0
- package/dist/dbquery/init.d.ts.map +1 -0
- package/dist/dbquery/init.js +125 -0
- package/dist/dbquery/init.js.map +1 -0
- package/dist/dbquery/logging.d.ts +22 -0
- package/dist/dbquery/logging.d.ts.map +1 -0
- package/dist/dbquery/logging.js +140 -0
- package/dist/dbquery/logging.js.map +1 -0
- package/dist/dbquery/mcp-tools.d.ts +29 -0
- package/dist/dbquery/mcp-tools.d.ts.map +1 -0
- package/dist/dbquery/mcp-tools.js +206 -0
- package/dist/dbquery/mcp-tools.js.map +1 -0
- package/dist/dbquery/queries.d.ts +31 -0
- package/dist/dbquery/queries.d.ts.map +1 -0
- package/dist/dbquery/queries.js +160 -0
- package/dist/dbquery/queries.js.map +1 -0
- package/dist/dbquery/safety.d.ts +35 -0
- package/dist/dbquery/safety.d.ts.map +1 -0
- package/dist/dbquery/safety.js +306 -0
- package/dist/dbquery/safety.js.map +1 -0
- package/dist/dbquery/types.d.ts +152 -0
- package/dist/dbquery/types.d.ts.map +1 -0
- package/dist/dbquery/types.js +10 -0
- package/dist/dbquery/types.js.map +1 -0
- package/dist/directory.d.ts +147 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +523 -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/astro-extractor.d.ts +79 -0
- package/dist/extraction/astro-extractor.d.ts.map +1 -0
- package/dist/extraction/astro-extractor.js +320 -0
- package/dist/extraction/astro-extractor.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/function-ref.d.ts +118 -0
- package/dist/extraction/function-ref.d.ts.map +1 -0
- package/dist/extraction/function-ref.js +727 -0
- package/dist/extraction/function-ref.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 +83 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +114 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +477 -0
- package/dist/extraction/grammars.js.map +1 -0
- package/dist/extraction/index.d.ts +175 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +1887 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/languages/c-cpp.d.ts +12 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/dist/extraction/languages/c-cpp.js +275 -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 +175 -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 +374 -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 +111 -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 +53 -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 +315 -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 +106 -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 +379 -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 +175 -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 +77 -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 +196 -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/r.d.ts +3 -0
- package/dist/extraction/languages/r.d.ts.map +1 -0
- package/dist/extraction/languages/r.js +314 -0
- package/dist/extraction/languages/r.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 +142 -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 +209 -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 +152 -0
- package/dist/extraction/languages/swift.js.map +1 -0
- package/dist/extraction/languages/typescript.d.ts +16 -0
- package/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/dist/extraction/languages/typescript.js +167 -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 +357 -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 +97 -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 +275 -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 +152 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +239 -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 +647 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/dist/extraction/tree-sitter.js +5592 -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 +254 -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-r.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 +540 -0
- package/dist/graph/traversal.js.map +1 -0
- package/dist/index.d.ts +563 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1041 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/claude-assets.d.ts +45 -0
- package/dist/installer/claude-assets.d.ts.map +1 -0
- package/dist/installer/claude-assets.js +144 -0
- package/dist/installer/claude-assets.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 +101 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +692 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +41 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +53 -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 +66 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +564 -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 +185 -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 +165 -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 +38 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +288 -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 +101 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +264 -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 +108 -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/markdown/cli.d.ts +16 -0
- package/dist/markdown/cli.d.ts.map +1 -0
- package/dist/markdown/cli.js +533 -0
- package/dist/markdown/cli.js.map +1 -0
- package/dist/markdown/constants.d.ts +22 -0
- package/dist/markdown/constants.d.ts.map +1 -0
- package/dist/markdown/constants.js +71 -0
- package/dist/markdown/constants.js.map +1 -0
- package/dist/markdown/dedup.d.ts +20 -0
- package/dist/markdown/dedup.d.ts.map +1 -0
- package/dist/markdown/dedup.js +64 -0
- package/dist/markdown/dedup.js.map +1 -0
- package/dist/markdown/errors.d.ts +22 -0
- package/dist/markdown/errors.d.ts.map +1 -0
- package/dist/markdown/errors.js +45 -0
- package/dist/markdown/errors.js.map +1 -0
- package/dist/markdown/extractor.d.ts +43 -0
- package/dist/markdown/extractor.d.ts.map +1 -0
- package/dist/markdown/extractor.js +152 -0
- package/dist/markdown/extractor.js.map +1 -0
- package/dist/markdown/frontmatter-parser.d.ts +47 -0
- package/dist/markdown/frontmatter-parser.d.ts.map +1 -0
- package/dist/markdown/frontmatter-parser.js +199 -0
- package/dist/markdown/frontmatter-parser.js.map +1 -0
- package/dist/markdown/indexer.d.ts +34 -0
- package/dist/markdown/indexer.d.ts.map +1 -0
- package/dist/markdown/indexer.js +256 -0
- package/dist/markdown/indexer.js.map +1 -0
- package/dist/markdown/mcp-tools.d.ts +33 -0
- package/dist/markdown/mcp-tools.d.ts.map +1 -0
- package/dist/markdown/mcp-tools.js +300 -0
- package/dist/markdown/mcp-tools.js.map +1 -0
- package/dist/markdown/query.d.ts +108 -0
- package/dist/markdown/query.d.ts.map +1 -0
- package/dist/markdown/query.js +570 -0
- package/dist/markdown/query.js.map +1 -0
- package/dist/markdown/schema-bootstrap.d.ts +40 -0
- package/dist/markdown/schema-bootstrap.d.ts.map +1 -0
- package/dist/markdown/schema-bootstrap.js +85 -0
- package/dist/markdown/schema-bootstrap.js.map +1 -0
- package/dist/markdown/schema.sql +124 -0
- package/dist/markdown/store.d.ts +77 -0
- package/dist/markdown/store.d.ts.map +1 -0
- package/dist/markdown/store.js +194 -0
- package/dist/markdown/store.js.map +1 -0
- package/dist/markdown/summary-extractor.d.ts +22 -0
- package/dist/markdown/summary-extractor.d.ts.map +1 -0
- package/dist/markdown/summary-extractor.js +66 -0
- package/dist/markdown/summary-extractor.js.map +1 -0
- package/dist/markdown/types.d.ts +159 -0
- package/dist/markdown/types.d.ts.map +1 -0
- package/dist/markdown/types.js +9 -0
- package/dist/markdown/types.js.map +1 -0
- package/dist/markdown/validator.d.ts +44 -0
- package/dist/markdown/validator.d.ts.map +1 -0
- package/dist/markdown/validator.js +95 -0
- package/dist/markdown/validator.js.map +1 -0
- package/dist/mcp/daemon-manager.d.ts +42 -0
- package/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/dist/mcp/daemon-manager.js +129 -0
- package/dist/mcp/daemon-manager.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-registry.d.ts +47 -0
- package/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/dist/mcp/daemon-registry.js +229 -0
- package/dist/mcp/daemon-registry.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 +637 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/dist/mcp/dynamic-boundaries.js +359 -0
- package/dist/mcp/dynamic-boundaries.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 +278 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +113 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +499 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/dist/mcp/liveness-watchdog.js +207 -0
- package/dist/mcp/liveness-watchdog.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 +87 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +641 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +34 -0
- package/dist/mcp/server-instructions.d.ts.map +1 -0
- package/dist/mcp/server-instructions.js +106 -0
- package/dist/mcp/server-instructions.js.map +1 -0
- package/dist/mcp/session.d.ts +79 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +330 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/dist/mcp/stdin-teardown.js +49 -0
- package/dist/mcp/stdin-teardown.js.map +1 -0
- package/dist/mcp/tools.d.ts +547 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +4122 -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 +359 -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/project-config.d.ts +36 -0
- package/dist/project-config.d.ts.map +1 -0
- package/dist/project-config.js +235 -0
- package/dist/project-config.js.map +1 -0
- package/dist/reasoning/config.d.ts +45 -0
- package/dist/reasoning/config.d.ts.map +1 -0
- package/dist/reasoning/config.js +171 -0
- package/dist/reasoning/config.js.map +1 -0
- package/dist/reasoning/credentials.d.ts +5 -0
- package/dist/reasoning/credentials.d.ts.map +1 -0
- package/dist/reasoning/credentials.js +83 -0
- package/dist/reasoning/credentials.js.map +1 -0
- package/dist/reasoning/login.d.ts +21 -0
- package/dist/reasoning/login.d.ts.map +1 -0
- package/dist/reasoning/login.js +85 -0
- package/dist/reasoning/login.js.map +1 -0
- package/dist/reasoning/reasoner.d.ts +43 -0
- package/dist/reasoning/reasoner.d.ts.map +1 -0
- package/dist/reasoning/reasoner.js +308 -0
- package/dist/reasoning/reasoner.js.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +33 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.js +352 -0
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +15 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +2926 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/astro.d.ts +9 -0
- package/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/dist/resolution/frameworks/astro.js +169 -0
- package/dist/resolution/frameworks/astro.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/goframe.d.ts +41 -0
- package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/dist/resolution/frameworks/goframe.js +112 -0
- package/dist/resolution/frameworks/goframe.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +50 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/resolution/frameworks/index.js +169 -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 +509 -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 +334 -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 +253 -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 +303 -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/goframe-synthesizer.d.ts +28 -0
- package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/dist/resolution/goframe-synthesizer.js +158 -0
- package/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +78 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -0
- package/dist/resolution/import-resolver.js +1849 -0
- package/dist/resolution/import-resolver.js.map +1 -0
- package/dist/resolution/index.d.ts +196 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +1328 -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 +93 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +1212 -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 +443 -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 +233 -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 +87 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +449 -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 +350 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +811 -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/telemetry/index.d.ts +143 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +541 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/timeline/bash-semantics.d.ts +52 -0
- package/dist/timeline/bash-semantics.d.ts.map +1 -0
- package/dist/timeline/bash-semantics.js +376 -0
- package/dist/timeline/bash-semantics.js.map +1 -0
- package/dist/timeline/cli.d.ts +50 -0
- package/dist/timeline/cli.d.ts.map +1 -0
- package/dist/timeline/cli.js +367 -0
- package/dist/timeline/cli.js.map +1 -0
- package/dist/timeline/constants.d.ts +62 -0
- package/dist/timeline/constants.d.ts.map +1 -0
- package/dist/timeline/constants.js +73 -0
- package/dist/timeline/constants.js.map +1 -0
- package/dist/timeline/errors.d.ts +27 -0
- package/dist/timeline/errors.d.ts.map +1 -0
- package/dist/timeline/errors.js +51 -0
- package/dist/timeline/errors.js.map +1 -0
- package/dist/timeline/hook-runner.d.ts +36 -0
- package/dist/timeline/hook-runner.d.ts.map +1 -0
- package/dist/timeline/hook-runner.js +61 -0
- package/dist/timeline/hook-runner.js.map +1 -0
- package/dist/timeline/hooks.d.ts +45 -0
- package/dist/timeline/hooks.d.ts.map +1 -0
- package/dist/timeline/hooks.js +364 -0
- package/dist/timeline/hooks.js.map +1 -0
- package/dist/timeline/index.d.ts +12 -0
- package/dist/timeline/index.d.ts.map +1 -0
- package/dist/timeline/index.js +28 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/indexer.d.ts +37 -0
- package/dist/timeline/indexer.d.ts.map +1 -0
- package/dist/timeline/indexer.js +76 -0
- package/dist/timeline/indexer.js.map +1 -0
- package/dist/timeline/installer.d.ts +33 -0
- package/dist/timeline/installer.d.ts.map +1 -0
- package/dist/timeline/installer.js +255 -0
- package/dist/timeline/installer.js.map +1 -0
- package/dist/timeline/payload.d.ts +31 -0
- package/dist/timeline/payload.d.ts.map +1 -0
- package/dist/timeline/payload.js +58 -0
- package/dist/timeline/payload.js.map +1 -0
- package/dist/timeline/post-tool-summary.d.ts +29 -0
- package/dist/timeline/post-tool-summary.d.ts.map +1 -0
- package/dist/timeline/post-tool-summary.js +190 -0
- package/dist/timeline/post-tool-summary.js.map +1 -0
- package/dist/timeline/recorder.d.ts +36 -0
- package/dist/timeline/recorder.d.ts.map +1 -0
- package/dist/timeline/recorder.js +42 -0
- package/dist/timeline/recorder.js.map +1 -0
- package/dist/timeline/schema-bootstrap.d.ts +42 -0
- package/dist/timeline/schema-bootstrap.d.ts.map +1 -0
- package/dist/timeline/schema-bootstrap.js +81 -0
- package/dist/timeline/schema-bootstrap.js.map +1 -0
- package/dist/timeline/schema.sql +37 -0
- package/dist/timeline/store.d.ts +69 -0
- package/dist/timeline/store.d.ts.map +1 -0
- package/dist/timeline/store.js +429 -0
- package/dist/timeline/store.js.map +1 -0
- package/dist/timeline/types.d.ts +78 -0
- package/dist/timeline/types.d.ts.map +1 -0
- package/dist/timeline/types.js +9 -0
- package/dist/timeline/types.js.map +1 -0
- package/dist/types.d.ts +392 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +81 -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 +498 -0
- package/dist/upgrade/index.js.map +1 -0
- package/dist/utils.d.ts +224 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +583 -0
- package/dist/utils.js.map +1 -0
- package/package.json +60 -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/ab-adoption.sh +91 -0
- package/scripts/agent-eval/ab-hook.sh +86 -0
- package/scripts/agent-eval/ab-impl.sh +78 -0
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
- package/scripts/agent-eval/ab-sufficiency.sh +78 -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/offload-eval-3arm.sh +72 -0
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
- package/scripts/agent-eval/offload-eval-setup.sh +24 -0
- package/scripts/agent-eval/offload-eval-styles.sh +72 -0
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
- package/scripts/agent-eval/offload-eval.md +76 -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/redirect-read-hook.sh +38 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +69 -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 +118 -0
- package/scripts/prepare-release.mjs +270 -0
|
@@ -0,0 +1,1212 @@
|
|
|
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.matchFunctionRef = matchFunctionRef;
|
|
13
|
+
exports.matchByExactName = matchByExactName;
|
|
14
|
+
exports.matchByQualifiedName = matchByQualifiedName;
|
|
15
|
+
exports.matchCppCallChain = matchCppCallChain;
|
|
16
|
+
exports.matchScopedCallChain = matchScopedCallChain;
|
|
17
|
+
exports.matchDottedCallChain = matchDottedCallChain;
|
|
18
|
+
exports.matchMethodCall = matchMethodCall;
|
|
19
|
+
exports.matchFuzzy = matchFuzzy;
|
|
20
|
+
exports.matchReference = matchReference;
|
|
21
|
+
/**
|
|
22
|
+
* Try to resolve a path-like reference (e.g., "snippets/drawer-menu.liquid")
|
|
23
|
+
* by matching the filename against file nodes.
|
|
24
|
+
*/
|
|
25
|
+
function matchByFilePath(ref, context) {
|
|
26
|
+
// Path-like (`a/b.liquid`) OR a bare filename ending in a short extension
|
|
27
|
+
// (`Foo.h` — an Objective-C `#import "Foo.h"`, resolved to the header by
|
|
28
|
+
// basename). A bare ref WITHOUT an extension is a symbol name, not a file, so
|
|
29
|
+
// leave it to the symbol-matching strategies.
|
|
30
|
+
if (!ref.referenceName.includes('/') && !/\.[A-Za-z][A-Za-z0-9]{0,3}$/.test(ref.referenceName)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
// Extract the filename from the path
|
|
34
|
+
const fileName = ref.referenceName.split('/').pop();
|
|
35
|
+
if (!fileName)
|
|
36
|
+
return null;
|
|
37
|
+
// Search for file nodes with this name
|
|
38
|
+
const candidates = context.getNodesByName(fileName);
|
|
39
|
+
const fileNodes = candidates.filter(n => n.kind === 'file');
|
|
40
|
+
if (fileNodes.length === 0)
|
|
41
|
+
return null;
|
|
42
|
+
// Prefer exact path match on qualified_name
|
|
43
|
+
const exactMatch = fileNodes.find(n => n.qualifiedName === ref.referenceName || n.filePath === ref.referenceName);
|
|
44
|
+
if (exactMatch) {
|
|
45
|
+
return {
|
|
46
|
+
original: ref,
|
|
47
|
+
targetNodeId: exactMatch.id,
|
|
48
|
+
confidence: 0.95,
|
|
49
|
+
resolvedBy: 'file-path',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Fall back to suffix match (e.g., ref="snippets/foo.liquid" matches
|
|
53
|
+
// "src/snippets/foo.liquid"). When several files share the basename — a
|
|
54
|
+
// `#include "RNCAsyncStorage.h"` with a same-named header on another platform
|
|
55
|
+
// (windows/code/ vs apple/) — prefer the one in the includer's own directory,
|
|
56
|
+
// then by directory proximity / same language family. A C/C++ include (and any
|
|
57
|
+
// bare-filename import) resolves relative to the including file, not to an
|
|
58
|
+
// arbitrary same-named header elsewhere in the tree.
|
|
59
|
+
const suffixMatches = fileNodes.filter(n => n.qualifiedName.endsWith(ref.referenceName) || n.filePath.endsWith(ref.referenceName));
|
|
60
|
+
if (suffixMatches.length > 0) {
|
|
61
|
+
return {
|
|
62
|
+
original: ref,
|
|
63
|
+
targetNodeId: pickClosestFileNode(suffixMatches, ref).id,
|
|
64
|
+
confidence: 0.85,
|
|
65
|
+
resolvedBy: 'file-path',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// If only one file node with this name, use it with lower confidence
|
|
69
|
+
if (fileNodes.length === 1) {
|
|
70
|
+
return {
|
|
71
|
+
original: ref,
|
|
72
|
+
targetNodeId: fileNodes[0].id,
|
|
73
|
+
confidence: 0.7,
|
|
74
|
+
resolvedBy: 'file-path',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Among several file nodes that all match a bare include/import by basename,
|
|
81
|
+
* pick the one closest to the referencing file: same directory first, then by
|
|
82
|
+
* directory-tree proximity, with the same language family as a tiebreak. A
|
|
83
|
+
* C/C++ `#include "X.h"` (and any bare-filename import) resolves relative to the
|
|
84
|
+
* including file — not to an arbitrary same-named header on another platform.
|
|
85
|
+
*/
|
|
86
|
+
function pickClosestFileNode(candidates, ref) {
|
|
87
|
+
const dirOf = (p) => {
|
|
88
|
+
const i = p.lastIndexOf('/');
|
|
89
|
+
return i >= 0 ? p.slice(0, i) : '';
|
|
90
|
+
};
|
|
91
|
+
const refDir = dirOf(ref.filePath);
|
|
92
|
+
const sameDir = candidates.filter((c) => dirOf(c.filePath) === refDir);
|
|
93
|
+
const pool = sameDir.length > 0 ? sameDir : candidates;
|
|
94
|
+
let best = pool[0];
|
|
95
|
+
let bestScore = -Infinity;
|
|
96
|
+
for (const c of pool) {
|
|
97
|
+
const score = computePathProximity(ref.filePath, c.filePath) +
|
|
98
|
+
(sameLanguageFamily(c.language, ref.language) ? 5 : 0);
|
|
99
|
+
if (score > bestScore) {
|
|
100
|
+
bestScore = score;
|
|
101
|
+
best = c;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return best;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Language families that share a type system / runtime, so a same-language-only
|
|
108
|
+
* reference may still resolve across them (a Kotlin `Foo.BAR` can name a Java
|
|
109
|
+
* `Foo`). Anything not listed forms its own singleton family.
|
|
110
|
+
*/
|
|
111
|
+
const LANGUAGE_FAMILY = {
|
|
112
|
+
java: 'jvm', kotlin: 'jvm', scala: 'jvm',
|
|
113
|
+
swift: 'apple', objc: 'apple',
|
|
114
|
+
typescript: 'web', tsx: 'web', javascript: 'web', jsx: 'web',
|
|
115
|
+
c: 'c', cpp: 'c',
|
|
116
|
+
// Razor/Blazor markup names C# types — same family so `@model Foo` /
|
|
117
|
+
// `<MyComponent/>` resolve to their `.cs` class through the cross-family gate.
|
|
118
|
+
csharp: 'dotnet', razor: 'dotnet',
|
|
119
|
+
};
|
|
120
|
+
function sameLanguageFamily(a, b) {
|
|
121
|
+
if (a === b)
|
|
122
|
+
return true;
|
|
123
|
+
const fa = LANGUAGE_FAMILY[a];
|
|
124
|
+
return fa !== undefined && fa === LANGUAGE_FAMILY[b];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* True when `lang` belongs to a known multi-language family (jvm/apple/web/c).
|
|
128
|
+
* Languages not listed (php, python, go, ruby, rust, dart, …) and config
|
|
129
|
+
* formats (yaml/xml/blade) form their own singleton families and return
|
|
130
|
+
* `false` — used to leave config↔code framework bridges (whose config side is
|
|
131
|
+
* never a known programming-language family) out of the cross-family gate.
|
|
132
|
+
*/
|
|
133
|
+
function isKnownLanguageFamily(lang) {
|
|
134
|
+
return LANGUAGE_FAMILY[lang] !== undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* True when `a` and `b` are two DIFFERENT *known* language families — the
|
|
138
|
+
* signature of a coincidental cross-language name collision (a TS `import
|
|
139
|
+
* React` matching a Swift `import React`, a C++ `#include "X.h"` matching a
|
|
140
|
+
* same-named ObjC header on another platform). The both-*known* test is
|
|
141
|
+
* deliberately weaker than {@link sameLanguageFamily}'s negation: a
|
|
142
|
+
* single-file-component language that carries its own tag (`vue`/`svelte`)
|
|
143
|
+
* importing a `.ts` module, or any singleton-family language (php/go/ruby/…),
|
|
144
|
+
* returns `false` here and is left alone.
|
|
145
|
+
*/
|
|
146
|
+
function crossesKnownFamily(a, b) {
|
|
147
|
+
return isKnownLanguageFamily(a) && isKnownLanguageFamily(b) && !sameLanguageFamily(a, b);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Drop cross-language candidates from a name lookup. Two regimes:
|
|
151
|
+
* - `references` (type-usage): a type named in language X resolves to a
|
|
152
|
+
* SAME-family type, never a coincidentally same-named symbol in another
|
|
153
|
+
* language (the Android `BatteryManager` system class vs a JS one). Strict
|
|
154
|
+
* same-family filter — cross-language communication is `calls`, not refs.
|
|
155
|
+
* - `imports` (import binding): an `import`/`#include` never crosses two
|
|
156
|
+
* KNOWN families (TS `import React` ↮ Swift `import React`). Weaker
|
|
157
|
+
* both-known filter so `.vue`/`.svelte` (own tag) importing `.ts` survives.
|
|
158
|
+
*/
|
|
159
|
+
function applyLanguageGate(candidates, ref) {
|
|
160
|
+
if (ref.referenceKind === 'references' || ref.referenceKind === 'function_ref') {
|
|
161
|
+
return candidates.filter((c) => sameLanguageFamily(c.language, ref.language));
|
|
162
|
+
}
|
|
163
|
+
if (ref.referenceKind === 'imports') {
|
|
164
|
+
return candidates.filter((c) => !crossesKnownFamily(c.language, ref.language));
|
|
165
|
+
}
|
|
166
|
+
return candidates;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Resolve a function-as-value reference (#756) — a function name used as a
|
|
170
|
+
* callback/function-pointer value (`register(handler)`, `o->cb = handler`,
|
|
171
|
+
* `{ .cb = handler }`, `signal(SIGINT, handler)`). The ONLY strategy allowed
|
|
172
|
+
* for `function_ref` refs: exact name, function/method targets only, same
|
|
173
|
+
* language family, same-file first, and cross-file only when the match is
|
|
174
|
+
* UNIQUE. No fuzzy fallback, no qualified-name walking — a wrong callback
|
|
175
|
+
* edge is worse than none.
|
|
176
|
+
*/
|
|
177
|
+
function matchFunctionRef(ref, context) {
|
|
178
|
+
// `this.<member>` refs are resolved ONLY by the class-scoped resolver in
|
|
179
|
+
// resolveOne (resolveThisMemberFnRef) — never by name matching here.
|
|
180
|
+
if (ref.referenceName.startsWith('this.'))
|
|
181
|
+
return null;
|
|
182
|
+
// In JS/TS/Python a bare identifier can never be a method value (methods
|
|
183
|
+
// are only reachable through a receiver — `this.m` / `self.m` /
|
|
184
|
+
// `Cls.m`), so bare fn-refs match FUNCTIONS only. This also sidesteps the
|
|
185
|
+
// pre-existing TS quirk of class fields extracting as method-kind nodes,
|
|
186
|
+
// which otherwise soaked up local names passed as arguments (excalidraw
|
|
187
|
+
// A/B finding; same pattern in vendored docopt.py). Python's `self.m`
|
|
188
|
+
// form keeps method targets via its own capture shape. C++ likewise: a
|
|
189
|
+
// bare identifier can only be a FREE function (member values need
|
|
190
|
+
// `&Cls::method`). PHP string callables name global FUNCTIONS (methods
|
|
191
|
+
// need the `[$obj, 'm']` array form, which carries its own shape). Other
|
|
192
|
+
// languages keep method targets: C# method groups, Swift/Dart
|
|
193
|
+
// implicit-self, Java/Kotlin method references.
|
|
194
|
+
const bareFnOnly = ref.language === 'typescript' || ref.language === 'tsx' ||
|
|
195
|
+
ref.language === 'javascript' || ref.language === 'jsx' ||
|
|
196
|
+
ref.language === 'cpp' || ref.language === 'python' ||
|
|
197
|
+
ref.language === 'php';
|
|
198
|
+
// Qualified member-pointer (`&Widget::on_click` → "Widget::on_click"):
|
|
199
|
+
// resolve the member ON THAT SCOPE — exempt from bareFnOnly (the `&Cls::m`
|
|
200
|
+
// shape is an explicit member reference). Unique-or-drop like everything else.
|
|
201
|
+
if (ref.referenceName.includes('::')) {
|
|
202
|
+
const memberName = ref.referenceName.slice(ref.referenceName.lastIndexOf('::') + 2);
|
|
203
|
+
const scoped = context
|
|
204
|
+
.getNodesByName(memberName)
|
|
205
|
+
.filter((n) => (n.kind === 'function' || n.kind === 'method') &&
|
|
206
|
+
sameLanguageFamily(n.language, ref.language) &&
|
|
207
|
+
n.id !== ref.fromNodeId &&
|
|
208
|
+
(n.qualifiedName === ref.referenceName ||
|
|
209
|
+
n.qualifiedName.endsWith(`::${ref.referenceName}`)));
|
|
210
|
+
if (scoped.length === 0)
|
|
211
|
+
return null;
|
|
212
|
+
const sameFileScoped = scoped.filter((n) => n.filePath === ref.filePath);
|
|
213
|
+
const pool = sameFileScoped.length > 0 ? sameFileScoped : scoped;
|
|
214
|
+
if (sameFileScoped.length === 0 && scoped.length > 1)
|
|
215
|
+
return null;
|
|
216
|
+
const target = pool.reduce((a, b) => (a.startLine <= b.startLine ? a : b));
|
|
217
|
+
return {
|
|
218
|
+
original: ref,
|
|
219
|
+
targetNodeId: target.id,
|
|
220
|
+
confidence: 0.9,
|
|
221
|
+
resolvedBy: 'function-ref',
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
let candidates = context
|
|
225
|
+
.getNodesByName(ref.referenceName)
|
|
226
|
+
.filter((n) => (n.kind === 'function' || (!bareFnOnly && n.kind === 'method')) &&
|
|
227
|
+
sameLanguageFamily(n.language, ref.language) &&
|
|
228
|
+
n.id !== ref.fromNodeId // a function registering itself is not a dependency edge
|
|
229
|
+
);
|
|
230
|
+
if (candidates.length === 0)
|
|
231
|
+
return null;
|
|
232
|
+
// Swift implicit-self: a bare identifier can name a METHOD only of the
|
|
233
|
+
// ENCLOSING type (`Button(action: handleTap)` written inside that type) —
|
|
234
|
+
// a same-named method on any OTHER class is a parameter collision
|
|
235
|
+
// (Alamofire: a `request` parameter resolving to EventMonitor::request).
|
|
236
|
+
// Scope method candidates to the from-symbol's type; top-level code has no
|
|
237
|
+
// implicit self, so method targets are excluded there entirely. Free
|
|
238
|
+
// functions are unaffected.
|
|
239
|
+
if (ref.language === 'swift' && candidates.some((n) => n.kind === 'method')) {
|
|
240
|
+
const fromNode = context.getNodeById?.(ref.fromNodeId);
|
|
241
|
+
const sep = fromNode ? fromNode.qualifiedName.lastIndexOf('::') : -1;
|
|
242
|
+
const classPrefix = fromNode && sep > 0 ? fromNode.qualifiedName.slice(0, sep) : null;
|
|
243
|
+
candidates = candidates.filter((n) => {
|
|
244
|
+
if (n.kind !== 'method')
|
|
245
|
+
return true;
|
|
246
|
+
if (!classPrefix)
|
|
247
|
+
return false;
|
|
248
|
+
const mSep = n.qualifiedName.lastIndexOf('::');
|
|
249
|
+
if (mSep <= 0)
|
|
250
|
+
return false;
|
|
251
|
+
const methodPrefix = n.qualifiedName.slice(0, mSep);
|
|
252
|
+
// Accept exact-scope matches plus suffix relationships either way, so
|
|
253
|
+
// extension-declared members (`Holder::m`) still match a nested
|
|
254
|
+
// from-scope (`Module::Holder::wire`) and vice versa.
|
|
255
|
+
return (methodPrefix === classPrefix ||
|
|
256
|
+
methodPrefix.endsWith(`::${classPrefix}`) ||
|
|
257
|
+
classPrefix.endsWith(`::${methodPrefix}`));
|
|
258
|
+
});
|
|
259
|
+
if (candidates.length === 0)
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
// Same-file definition wins — the extraction gate guarantees most survivors
|
|
263
|
+
// have one, and it's the dominant C pattern (static callback registered in
|
|
264
|
+
// a same-file ops struct).
|
|
265
|
+
const sameFile = candidates.filter((n) => n.filePath === ref.filePath);
|
|
266
|
+
if (sameFile.length > 0) {
|
|
267
|
+
// Swift: several same-named METHODS in one file is an API overload family
|
|
268
|
+
// (`Session.request(...)` × N), and a bare identifier hitting it is almost
|
|
269
|
+
// always a same-named parameter, not a method value (Alamofire A/B
|
|
270
|
+
// finding) — refuse rather than guess. A single method (SwiftUI's
|
|
271
|
+
// `action: handleTap`) still resolves.
|
|
272
|
+
if (ref.language === 'swift' &&
|
|
273
|
+
sameFile.length > 1 &&
|
|
274
|
+
sameFile.every((n) => n.kind === 'method')) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
// Same-name overloads in one file are the same conceptual symbol; pick
|
|
278
|
+
// the first by position for determinism.
|
|
279
|
+
const target = sameFile.reduce((a, b) => (a.startLine <= b.startLine ? a : b));
|
|
280
|
+
return {
|
|
281
|
+
original: ref,
|
|
282
|
+
targetNodeId: target.id,
|
|
283
|
+
confidence: sameFile.length === 1 ? 0.95 : 0.9,
|
|
284
|
+
resolvedBy: 'function-ref',
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
// Cross-file (imported names the import resolver didn't already claim):
|
|
288
|
+
// only an unambiguous match resolves.
|
|
289
|
+
if (candidates.length === 1) {
|
|
290
|
+
return {
|
|
291
|
+
original: ref,
|
|
292
|
+
targetNodeId: candidates[0].id,
|
|
293
|
+
confidence: 0.8,
|
|
294
|
+
resolvedBy: 'function-ref',
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Try to resolve a reference by exact name match
|
|
301
|
+
*/
|
|
302
|
+
function matchByExactName(ref, context) {
|
|
303
|
+
// `import`-kind nodes are import STATEMENTS, not definitions, so a reference
|
|
304
|
+
// resolving to a sibling file's `import` is a meaningless edge — the real
|
|
305
|
+
// import→definition resolution is the import resolver's job (resolveViaImport),
|
|
306
|
+
// never name-matching here. Excluding them also removes a quadratic blow-up:
|
|
307
|
+
// a ubiquitous package (`react`, `@superset-ui/core`, Python `logging`/`typing`)
|
|
308
|
+
// is re-declared as an `import` node in every file that imports it, so K
|
|
309
|
+
// unresolved import refs each scored K same-named import candidates through
|
|
310
|
+
// findBestMatch — O(K²) per package, the dominant cost of "Resolving refs" on
|
|
311
|
+
// large import-heavy (front-end + back-end) repos (#915).
|
|
312
|
+
const candidates = applyLanguageGate(context.getNodesByName(ref.referenceName), ref)
|
|
313
|
+
.filter((n) => n.kind !== 'import');
|
|
314
|
+
if (candidates.length === 0) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
// If only one match, use it — but penalize cross-language matches
|
|
318
|
+
if (candidates.length === 1) {
|
|
319
|
+
const isCrossLanguage = candidates[0].language !== ref.language;
|
|
320
|
+
return {
|
|
321
|
+
original: ref,
|
|
322
|
+
targetNodeId: candidates[0].id,
|
|
323
|
+
confidence: isCrossLanguage ? 0.5 : 0.9,
|
|
324
|
+
resolvedBy: 'exact-match',
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
// Multiple matches - try to narrow down
|
|
328
|
+
const bestMatch = findBestMatch(ref, candidates, context);
|
|
329
|
+
if (bestMatch) {
|
|
330
|
+
// Lower confidence when the match is from a distant/unrelated module
|
|
331
|
+
const proximity = computePathProximity(ref.filePath, bestMatch.filePath);
|
|
332
|
+
const confidence = proximity >= 30 ? 0.7 : 0.4;
|
|
333
|
+
return {
|
|
334
|
+
original: ref,
|
|
335
|
+
targetNodeId: bestMatch.id,
|
|
336
|
+
confidence,
|
|
337
|
+
resolvedBy: 'exact-match',
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Try to resolve by qualified name
|
|
344
|
+
*/
|
|
345
|
+
function matchByQualifiedName(ref, context) {
|
|
346
|
+
// Check if the reference name looks qualified (contains :: or .)
|
|
347
|
+
if (!ref.referenceName.includes('::') && !ref.referenceName.includes('.')) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
const candidates = context.getNodesByQualifiedName(ref.referenceName);
|
|
351
|
+
if (candidates.length === 1) {
|
|
352
|
+
return {
|
|
353
|
+
original: ref,
|
|
354
|
+
targetNodeId: candidates[0].id,
|
|
355
|
+
confidence: 0.95,
|
|
356
|
+
resolvedBy: 'qualified-name',
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
// Try partial qualified name match
|
|
360
|
+
const parts = ref.referenceName.split(/[:.]/);
|
|
361
|
+
const lastName = parts[parts.length - 1];
|
|
362
|
+
if (lastName) {
|
|
363
|
+
const partialCandidates = context.getNodesByName(lastName);
|
|
364
|
+
for (const candidate of partialCandidates) {
|
|
365
|
+
if (candidate.qualifiedName.endsWith(ref.referenceName)) {
|
|
366
|
+
return {
|
|
367
|
+
original: ref,
|
|
368
|
+
targetNodeId: candidate.id,
|
|
369
|
+
confidence: 0.85,
|
|
370
|
+
resolvedBy: 'qualified-name',
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
function resolveMethodOnType(typeName, methodName, ref, context, confidence, resolvedBy,
|
|
378
|
+
/**
|
|
379
|
+
* Optional FQN that identifies WHICH class declaration `typeName`
|
|
380
|
+
* refers to in the caller's file. When multiple candidates share
|
|
381
|
+
* the same qualifiedName (`FooConverter::convert` in both
|
|
382
|
+
* `dao/converter/` and `service/converter/`), the FQN's
|
|
383
|
+
* file-path-suffix picks the right one — the disambiguation
|
|
384
|
+
* signal Java imports carry but the call site doesn't (#314).
|
|
385
|
+
*/
|
|
386
|
+
preferredFqn,
|
|
387
|
+
/** Recursion guard for the supertype/conformance walk. */
|
|
388
|
+
depth = 0) {
|
|
389
|
+
// Look up methods by name and match by qualifiedName ending in
|
|
390
|
+
// `<typeName>::<methodName>`. This works whether the method is defined
|
|
391
|
+
// in-class (`class Foo { int bar() { ... } }`) or out-of-line in a separate
|
|
392
|
+
// file (`int Foo::bar() { ... }` in foo.cpp while class Foo is in foo.hpp).
|
|
393
|
+
// The previous same-file approach missed the latter — the typical C++ layout.
|
|
394
|
+
const methodCandidates = context.getNodesByName(methodName);
|
|
395
|
+
const want = `${typeName}::${methodName}`;
|
|
396
|
+
const matches = [];
|
|
397
|
+
for (const m of methodCandidates) {
|
|
398
|
+
if (m.kind !== 'method')
|
|
399
|
+
continue;
|
|
400
|
+
if (m.language !== ref.language)
|
|
401
|
+
continue;
|
|
402
|
+
const qn = m.qualifiedName;
|
|
403
|
+
if (qn === want || qn.endsWith(`::${want}`)) {
|
|
404
|
+
matches.push(m);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (matches.length === 0) {
|
|
408
|
+
// Conformance fallback: the method may be defined on a supertype `typeName`
|
|
409
|
+
// extends, or on a protocol / trait it conforms to (e.g. a Swift protocol-
|
|
410
|
+
// extension method, a C# default-interface or extension method, a Kotlin
|
|
411
|
+
// extension on a supertype). Walk supertypes transitively (depth-capped) via
|
|
412
|
+
// the resolved implements/extends edges — empty in the first resolution pass,
|
|
413
|
+
// populated in the conformance pass. Still VALIDATED (the method must exist on
|
|
414
|
+
// a supertype), so a wrong inference produces no edge.
|
|
415
|
+
if (depth < 4 && context.getSupertypes) {
|
|
416
|
+
for (const supertype of context.getSupertypes(typeName, ref.language)) {
|
|
417
|
+
const via = resolveMethodOnType(supertype, methodName, ref, context, confidence, resolvedBy, preferredFqn, depth + 1);
|
|
418
|
+
if (via)
|
|
419
|
+
return via;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
if (matches.length > 1 && preferredFqn) {
|
|
425
|
+
const ext = ref.language === 'kotlin' ? '.kt' : '.java';
|
|
426
|
+
const fqnPath = preferredFqn.replace(/\./g, '/') + ext;
|
|
427
|
+
const chosen = matches.find((m) => {
|
|
428
|
+
const fp = m.filePath.replace(/\\/g, '/');
|
|
429
|
+
return fp.endsWith(fqnPath) || fp.endsWith('/' + fqnPath);
|
|
430
|
+
});
|
|
431
|
+
if (chosen) {
|
|
432
|
+
return {
|
|
433
|
+
original: ref,
|
|
434
|
+
targetNodeId: chosen.id,
|
|
435
|
+
confidence,
|
|
436
|
+
resolvedBy,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return {
|
|
441
|
+
original: ref,
|
|
442
|
+
targetNodeId: matches[0].id,
|
|
443
|
+
confidence,
|
|
444
|
+
resolvedBy,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
// C++ keywords/control-flow tokens that can appear right before a receiver
|
|
448
|
+
// (e.g. `return ptr->m()`) and must NOT be treated as a type.
|
|
449
|
+
const CPP_NON_TYPE_TOKENS = new Set([
|
|
450
|
+
'return', 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'default',
|
|
451
|
+
'break', 'continue', 'goto', 'throw', 'new', 'delete', 'co_await', 'co_yield',
|
|
452
|
+
'co_return', 'static_cast', 'const_cast', 'dynamic_cast', 'reinterpret_cast',
|
|
453
|
+
'sizeof', 'alignof', 'typeid', 'and', 'or', 'not', 'xor',
|
|
454
|
+
]);
|
|
455
|
+
function normalizeCppTypeName(typeName) {
|
|
456
|
+
const normalized = typeName
|
|
457
|
+
.replace(/\b(const|volatile|mutable|typename|class|struct)\b/g, ' ')
|
|
458
|
+
.replace(/[&*]+/g, ' ')
|
|
459
|
+
.replace(/<[^>]*>/g, ' ')
|
|
460
|
+
.replace(/\s+/g, ' ')
|
|
461
|
+
.trim();
|
|
462
|
+
if (!normalized)
|
|
463
|
+
return null;
|
|
464
|
+
const parts = normalized.split(/::/).filter(Boolean);
|
|
465
|
+
const last = parts[parts.length - 1];
|
|
466
|
+
if (!last)
|
|
467
|
+
return null;
|
|
468
|
+
if (CPP_NON_TYPE_TOKENS.has(last))
|
|
469
|
+
return null;
|
|
470
|
+
return last;
|
|
471
|
+
}
|
|
472
|
+
// Declarator regex: matches `Type receiver`, `Type* receiver`, `Type *receiver`,
|
|
473
|
+
// `Type*receiver`, `Type<X> receiver`, etc., REQUIRING a declarator terminator
|
|
474
|
+
// (`;`, `=`, `,`, `)`, `[`, `{`, `(`, or end-of-line) after the receiver. The
|
|
475
|
+
// terminator rules out uses like `return receiver->m()` where the preceding
|
|
476
|
+
// token is a keyword, not a type.
|
|
477
|
+
function buildDeclaratorRegex(escapedReceiver) {
|
|
478
|
+
return new RegExp(`([A-Za-z_][\\w:]*(?:\\s*<[^;=(){}]+>)?(?:\\s*[*&]+)?)\\s*\\b${escapedReceiver}\\b\\s*(?=[;=,)\\[{(]|$)`);
|
|
479
|
+
}
|
|
480
|
+
function inferCppReceiverType(receiverName, ref, context, depth = 0) {
|
|
481
|
+
const source = context.readFile(ref.filePath);
|
|
482
|
+
if (!source)
|
|
483
|
+
return null;
|
|
484
|
+
const lines = source.split(/\r?\n/);
|
|
485
|
+
const callLineIndex = Math.max(0, Math.min(lines.length - 1, ref.line - 1));
|
|
486
|
+
const escapedReceiver = receiverName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
487
|
+
const receiverPattern = new RegExp(`\\b${escapedReceiver}\\b`);
|
|
488
|
+
const declaratorRegex = buildDeclaratorRegex(escapedReceiver);
|
|
489
|
+
for (let i = callLineIndex; i >= 0; i--) {
|
|
490
|
+
const line = lines[i];
|
|
491
|
+
if (!line || !receiverPattern.test(line))
|
|
492
|
+
continue;
|
|
493
|
+
const declaratorMatch = line.match(declaratorRegex);
|
|
494
|
+
if (declaratorMatch) {
|
|
495
|
+
const normalized = normalizeCppTypeName(declaratorMatch[1] ?? '');
|
|
496
|
+
if (normalized === 'auto') {
|
|
497
|
+
// `auto x = Foo::instance();` — the declared type is deduced; recover it
|
|
498
|
+
// from the initializer (call return type / construction) (#645).
|
|
499
|
+
const initType = inferCppAutoInitializerType(line, receiverName, ref, context, depth);
|
|
500
|
+
if (initType)
|
|
501
|
+
return initType;
|
|
502
|
+
// No usable initializer on this line — keep scanning earlier ones.
|
|
503
|
+
}
|
|
504
|
+
else if (normalized) {
|
|
505
|
+
return normalized;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
const headerCandidates = [
|
|
510
|
+
ref.filePath.replace(/\.(?:c|cc|cpp|cxx)$/i, '.h'),
|
|
511
|
+
ref.filePath.replace(/\.(?:c|cc|cpp|cxx)$/i, '.hpp'),
|
|
512
|
+
ref.filePath.replace(/\.(?:c|cc|cpp|cxx)$/i, '.hxx'),
|
|
513
|
+
].filter((candidate, index, arr) => arr.indexOf(candidate) === index && candidate !== ref.filePath);
|
|
514
|
+
for (const headerPath of headerCandidates) {
|
|
515
|
+
if (!context.fileExists(headerPath))
|
|
516
|
+
continue;
|
|
517
|
+
const headerSource = context.readFile(headerPath);
|
|
518
|
+
if (!headerSource)
|
|
519
|
+
continue;
|
|
520
|
+
for (const line of headerSource.split(/\r?\n/)) {
|
|
521
|
+
if (!receiverPattern.test(line))
|
|
522
|
+
continue;
|
|
523
|
+
const declaratorMatch = line.match(declaratorRegex);
|
|
524
|
+
if (!declaratorMatch)
|
|
525
|
+
continue;
|
|
526
|
+
const normalized = normalizeCppTypeName(declaratorMatch[1] ?? '');
|
|
527
|
+
if (normalized && normalized !== 'auto')
|
|
528
|
+
return normalized;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Last `::`-separated segment of a (possibly namespace-qualified) C++ name.
|
|
535
|
+
*/
|
|
536
|
+
function cppLastSegment(name) {
|
|
537
|
+
const parts = name.split('::').filter(Boolean);
|
|
538
|
+
return parts[parts.length - 1] ?? name;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Return type captured at extraction for `Class::method` (or a free function),
|
|
542
|
+
* read off the indexed node's `returnType` — used by the C++ (#645) and PHP
|
|
543
|
+
* (#608) chained-call resolvers. Language-filtered. Null when not indexed or no
|
|
544
|
+
* return type was recorded (a `void`/primitive return).
|
|
545
|
+
*/
|
|
546
|
+
function lookupCalleeReturnType(callee, ref, context) {
|
|
547
|
+
let method = callee;
|
|
548
|
+
let cls = null;
|
|
549
|
+
if (callee.includes('::')) {
|
|
550
|
+
const parts = callee.split('::').filter(Boolean);
|
|
551
|
+
method = parts[parts.length - 1] ?? callee;
|
|
552
|
+
cls = parts.slice(0, -1).join('::');
|
|
553
|
+
}
|
|
554
|
+
const candidates = context.getNodesByName(method).filter((n) => (n.kind === 'method' || n.kind === 'function') &&
|
|
555
|
+
n.language === ref.language &&
|
|
556
|
+
!!n.returnType);
|
|
557
|
+
if (cls) {
|
|
558
|
+
const want = `${cls}::${method}`;
|
|
559
|
+
// The call site may name the class with MORE namespace qualification than
|
|
560
|
+
// the stored node (`details::registry::instance` at the call vs
|
|
561
|
+
// `registry::instance` on the node — the receiver type only carries the
|
|
562
|
+
// immediate class), or LESS. Accept an exact match or either being a
|
|
563
|
+
// namespace-suffix of the other; the shared `::<class>::<method>` tail keeps
|
|
564
|
+
// it specific.
|
|
565
|
+
const m = candidates.find((n) => n.qualifiedName === want ||
|
|
566
|
+
n.qualifiedName.endsWith(`::${want}`) ||
|
|
567
|
+
want.endsWith(`::${n.qualifiedName}`));
|
|
568
|
+
return m?.returnType ?? null;
|
|
569
|
+
}
|
|
570
|
+
return candidates.find((n) => n.kind === 'function')?.returnType ?? null;
|
|
571
|
+
}
|
|
572
|
+
/** Does the graph contain a class/struct named `name`'s last segment? */
|
|
573
|
+
function cppClassExists(name, ref, context) {
|
|
574
|
+
const last = cppLastSegment(name);
|
|
575
|
+
return context
|
|
576
|
+
.getNodesByName(last)
|
|
577
|
+
.some((n) => (n.kind === 'class' || n.kind === 'struct') && n.language === ref.language);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Infer the class produced by a C++ call/construction expression, using return
|
|
581
|
+
* types captured at extraction (#645). Handles, in order:
|
|
582
|
+
* - `make_unique<T>()` / `make_shared<T>()` → T
|
|
583
|
+
* - single-level member call `recv.method()` → recv's type, then method's return
|
|
584
|
+
* - `Class::method()` / free `func()` → the callee's recorded return type
|
|
585
|
+
* - direct construction `Type()` / `ns::Type()` → Type
|
|
586
|
+
* Returns null when undeterminable. Callers MUST still validate the outer method
|
|
587
|
+
* exists on the result before creating an edge, so a wrong guess stays silent.
|
|
588
|
+
*/
|
|
589
|
+
function resolveCppCallResultType(inner, ref, context, depth = 0) {
|
|
590
|
+
if (depth > 3)
|
|
591
|
+
return null; // guard against pathological mutual recursion
|
|
592
|
+
const expr = inner.trim();
|
|
593
|
+
const make = expr.match(/(?:^|::)(?:make_unique|make_shared)\s*<\s*([A-Za-z_]\w*)/);
|
|
594
|
+
if (make)
|
|
595
|
+
return make[1] ?? null;
|
|
596
|
+
// Single-level member call `recv.method` (the `manager.view().render()` shape).
|
|
597
|
+
const dotIdx = expr.lastIndexOf('.');
|
|
598
|
+
if (dotIdx > 0) {
|
|
599
|
+
const recv = expr.slice(0, dotIdx);
|
|
600
|
+
const method = expr.slice(dotIdx + 1);
|
|
601
|
+
if (recv.includes('.') || recv.includes('(') || recv.includes('::'))
|
|
602
|
+
return null; // single level only
|
|
603
|
+
const recvType = inferCppReceiverType(recv, ref, context, depth + 1);
|
|
604
|
+
if (!recvType)
|
|
605
|
+
return null;
|
|
606
|
+
return lookupCalleeReturnType(`${recvType}::${method}`, ref, context);
|
|
607
|
+
}
|
|
608
|
+
const ret = lookupCalleeReturnType(expr, ref, context);
|
|
609
|
+
if (ret)
|
|
610
|
+
return ret;
|
|
611
|
+
// Direct construction — the callee itself names a class/struct.
|
|
612
|
+
if (cppClassExists(expr, ref, context))
|
|
613
|
+
return cppLastSegment(expr);
|
|
614
|
+
return null;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Recover the type of an `auto`-declared local from its initializer on the
|
|
618
|
+
* declaration line — `auto x = Foo::instance();`, `auto w = make_unique<W>();`,
|
|
619
|
+
* `auto p = new W();`, `auto w = Widget();` (#645).
|
|
620
|
+
*/
|
|
621
|
+
function inferCppAutoInitializerType(line, receiverName, ref, context, depth) {
|
|
622
|
+
const escaped = receiverName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
623
|
+
const m = line.match(new RegExp(`\\b${escaped}\\b\\s*=\\s*([^;]+)`));
|
|
624
|
+
if (!m || !m[1])
|
|
625
|
+
return null;
|
|
626
|
+
const init = m[1].trim();
|
|
627
|
+
const neu = init.match(/^new\s+([A-Za-z_][\w:]*)/);
|
|
628
|
+
if (neu && neu[1])
|
|
629
|
+
return cppLastSegment(neu[1]);
|
|
630
|
+
// A call or construction: `Foo(...)`, `A::b(...)`, `make_unique<T>(...)`.
|
|
631
|
+
const call = init.match(/^([A-Za-z_][\w:]*(?:\s*<[^>;]*>)?)\s*\(/);
|
|
632
|
+
if (call && call[1])
|
|
633
|
+
return resolveCppCallResultType(call[1].replace(/\s+/g, ''), ref, context, depth + 1);
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Resolve a C++ chained call whose receiver is itself a call — encoded by the
|
|
638
|
+
* extractor as `<innerCallee>().<method>` (#645). The receiver's type is what
|
|
639
|
+
* the inner call returns; the outer method is then resolved and VALIDATED on it
|
|
640
|
+
* (resolveMethodOnType requires `cls::method` to exist), so a wrong inference
|
|
641
|
+
* produces no edge rather than a wrong one.
|
|
642
|
+
*/
|
|
643
|
+
function matchCppCallChain(ref, context) {
|
|
644
|
+
const m = ref.referenceName.match(/^(.+)\(\)\.(\w+)$/);
|
|
645
|
+
if (!m || !m[1] || !m[2])
|
|
646
|
+
return null;
|
|
647
|
+
const cls = resolveCppCallResultType(m[1], ref, context);
|
|
648
|
+
if (!cls)
|
|
649
|
+
return null;
|
|
650
|
+
return resolveMethodOnType(cls, m[2], ref, context, 0.85, 'instance-method');
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Resolve a `::`-scoped factory chain whose receiver is a scoped/static call —
|
|
654
|
+
* PHP `Cls::for($x)->method()` (#608, the per-credential Laravel client idiom) or
|
|
655
|
+
* Rust `Foo::new().bar()` (an associated-function call) — both encoded by the
|
|
656
|
+
* extractor as `Cls::factory().method`. The receiver's type is what `Cls::factory`
|
|
657
|
+
* returns: a `self` marker (PHP `: self`/`: static`, Rust `-> Self`) resolves to
|
|
658
|
+
* the factory's own type, a concrete return type to that type. The outer method is
|
|
659
|
+
* then resolved and VALIDATED on it (resolveMethodOnType requires the method to
|
|
660
|
+
* exist on the type or a supertype it conforms to), so a wrong inference yields no
|
|
661
|
+
* edge rather than a wrong one. Shared by the `::`-receiver languages (PHP, Rust).
|
|
662
|
+
*/
|
|
663
|
+
function matchScopedCallChain(ref, context) {
|
|
664
|
+
const m = ref.referenceName.match(/^(.+)\(\)\.(\w+)$/);
|
|
665
|
+
if (!m || !m[1] || !m[2])
|
|
666
|
+
return null;
|
|
667
|
+
const inner = m[1];
|
|
668
|
+
const method = m[2];
|
|
669
|
+
if (!inner.includes('::'))
|
|
670
|
+
return null; // only static-factory (`Cls::method`) chains
|
|
671
|
+
const factoryClass = inner.slice(0, inner.lastIndexOf('::'));
|
|
672
|
+
const ret = lookupCalleeReturnType(inner, ref, context);
|
|
673
|
+
if (!ret)
|
|
674
|
+
return null;
|
|
675
|
+
// `self` (the extractor's marker for self/static/$this) → the factory's class.
|
|
676
|
+
const resolvedClass = ret === 'self' ? factoryClass : ret;
|
|
677
|
+
return resolveMethodOnType(resolvedClass, method, ref, context, 0.85, 'instance-method');
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Languages where an unprefixed capitalized call `Foo(args)` constructs the
|
|
681
|
+
* class (so a `Foo(args).method()` receiver's type is `Foo`). Java/C# need `new`,
|
|
682
|
+
* so a bare `Foo()` there is a method call, not construction — excluded. Scala's
|
|
683
|
+
* `Foo(args)` is a case-class / companion `apply`, which conventionally returns
|
|
684
|
+
* `Foo` — and resolveMethodOnType validates, so a non-conventional `apply` that
|
|
685
|
+
* returns another type simply yields no edge rather than a wrong one. Pascal/Delphi:
|
|
686
|
+
* a `TFoo(x)` is a TYPECAST whose result is a `TFoo`, so `TFoo(x).method()` resolves
|
|
687
|
+
* the method on `TFoo` — same shape, same validation.
|
|
688
|
+
*/
|
|
689
|
+
const CONSTRUCTS_VIA_BARE_CALL = new Set(['kotlin', 'swift', 'scala', 'dart', 'pascal']);
|
|
690
|
+
/**
|
|
691
|
+
* Resolve a dotted chained call whose receiver is a static factory / fluent call —
|
|
692
|
+
* `Foo.getInstance().bar()`, encoded by the extractor as `Foo.getInstance().bar`
|
|
693
|
+
* (#645/#608 mechanism). The receiver's type is what `Foo.getInstance` returns
|
|
694
|
+
* (its declared return type); the outer method is then resolved and VALIDATED on
|
|
695
|
+
* it (resolveMethodOnType requires `Type::method` to exist), so a wrong inference
|
|
696
|
+
* yields no edge rather than a wrong one (e.g. a same-named `bar()` on an
|
|
697
|
+
* unrelated class is never matched). Shared by the dot-notation languages
|
|
698
|
+
* (Java, Kotlin, C#, Swift) — same receiver shape, same `Class::method` qualified names.
|
|
699
|
+
*/
|
|
700
|
+
function matchDottedCallChain(ref, context) {
|
|
701
|
+
const m = ref.referenceName.match(/^(.+)\(\)\.(\w+)$/);
|
|
702
|
+
if (!m || !m[1] || !m[2])
|
|
703
|
+
return null;
|
|
704
|
+
const inner = m[1]; // `Foo.getInstance`
|
|
705
|
+
const method = m[2]; // `bar`
|
|
706
|
+
const lastDot = inner.lastIndexOf('.');
|
|
707
|
+
if (lastDot <= 0) {
|
|
708
|
+
// Go: bare package-level factory FUNCTION `New().method()` — the receiver's
|
|
709
|
+
// type is what `New` returns; resolve the method on that.
|
|
710
|
+
if (ref.language === 'go') {
|
|
711
|
+
const ret = lookupCalleeReturnType(inner, ref, context);
|
|
712
|
+
if (ret) {
|
|
713
|
+
return resolveMethodOnType(ret, method, ref, context, 0.85, 'instance-method', importedFqnOf(ret, ref, context));
|
|
714
|
+
}
|
|
715
|
+
// `inner` isn't a function with a captured return type — typically a
|
|
716
|
+
// package-level VARIABLE holding a function value (e.g. gin's `engine()`),
|
|
717
|
+
// whose type we can't recover. Fall back to bare-name resolution of the
|
|
718
|
+
// method so we don't DROP an edge the un-re-encoded bare path would have
|
|
719
|
+
// found. (When `inner` IS a real factory function but the method doesn't
|
|
720
|
+
// exist on its return type, `ret` is truthy and we returned no edge above —
|
|
721
|
+
// the absent-method safety guarantee is preserved.)
|
|
722
|
+
//
|
|
723
|
+
// CRITICAL: resolve the TARGET via a synthetic bare-name ref, but return the
|
|
724
|
+
// match tied to the ORIGINAL `ref` (referenceName `inner().method`). The
|
|
725
|
+
// batched resolver (resolveAndPersistBatched) reads unresolved rows from
|
|
726
|
+
// offset 0 every pass and relies on deleteSpecificResolvedReferences —
|
|
727
|
+
// keyed on referenceName — to clear each resolved row so the batch empties.
|
|
728
|
+
// If we propagated the synthetic ref's bare `method` as `.original`, the
|
|
729
|
+
// delete would never match the stored `inner().method` row, the batch would
|
|
730
|
+
// never drain, and the loop would re-resolve + re-insert forever (a runaway
|
|
731
|
+
// that grew gin's graph to 5M edges / 1.4 GB before this fix).
|
|
732
|
+
const bareRef = { ...ref, referenceName: method };
|
|
733
|
+
const bareMatch = matchByExactName(bareRef, context) ?? matchFuzzy(bareRef, context);
|
|
734
|
+
return bareMatch ? { ...bareMatch, original: ref } : null;
|
|
735
|
+
}
|
|
736
|
+
// Constructor receiver `Foo(args).method()` (encoded `Foo().method`): a bare,
|
|
737
|
+
// capitalized inner is a class construction, so the receiver's type is the
|
|
738
|
+
// class itself — resolve the method on it. Only in languages where an
|
|
739
|
+
// unprefixed capitalized call constructs the class (Kotlin, Swift); in Java/C#
|
|
740
|
+
// a bare `Foo()` is a method call (constructors need `new`), so we must not
|
|
741
|
+
// assume construction. A lowercase bare inner is a top-level `factory().method()`
|
|
742
|
+
// whose type we can't recover — bail.
|
|
743
|
+
if (!CONSTRUCTS_VIA_BARE_CALL.has(ref.language) || !/^[A-Z]/.test(inner))
|
|
744
|
+
return null;
|
|
745
|
+
return resolveMethodOnType(inner, method, ref, context, 0.85, 'instance-method', importedFqnOf(inner, ref, context));
|
|
746
|
+
}
|
|
747
|
+
// Factory/fluent receiver `Receiver.factory(args).method()`: the receiver's
|
|
748
|
+
// type is what `Receiver.factory` returns (its declared return type).
|
|
749
|
+
const factoryClass = inner.slice(0, lastDot).split('.').pop(); // simple class name
|
|
750
|
+
const factoryMethod = inner.slice(lastDot + 1);
|
|
751
|
+
if (!factoryClass || !factoryMethod)
|
|
752
|
+
return null;
|
|
753
|
+
const ret = lookupCalleeReturnType(`${factoryClass}::${factoryMethod}`, ref, context);
|
|
754
|
+
if (!ret) {
|
|
755
|
+
// Objective-C: a class-message factory — `[X alloc]`, `[X new]`,
|
|
756
|
+
// `[X sharedFoo]` — returns an instance of the RECEIVER class `X` by
|
|
757
|
+
// convention (`instancetype`). So when the factory's own return type isn't
|
|
758
|
+
// recoverable (its selector returns `instancetype`, or `alloc`/`new` aren't
|
|
759
|
+
// user-defined nodes at all), the receiver's type is the class `X` itself.
|
|
760
|
+
// This resolves the ubiquitous `[[X alloc] init]` and singleton chains.
|
|
761
|
+
// resolveMethodOnType validates against X (and its supertypes), so a class
|
|
762
|
+
// whose method actually lives elsewhere yields NO edge, not a wrong one — and
|
|
763
|
+
// crucially this does NOT fire when a concrete return type WAS captured but
|
|
764
|
+
// simply lacks the method (that already returned null above: absent-method
|
|
765
|
+
// safety, so a same-named decoy is still never matched).
|
|
766
|
+
if (ref.language === 'objc' && /^[A-Z]/.test(factoryClass)) {
|
|
767
|
+
return resolveMethodOnType(factoryClass, method, ref, context, 0.8, 'instance-method', importedFqnOf(factoryClass, ref, context));
|
|
768
|
+
}
|
|
769
|
+
// Pascal/Delphi: the extractor only re-encodes a `TFoo`/`IFoo`-prefixed chain
|
|
770
|
+
// (the type-naming convention), so `factoryClass` is always a real class here.
|
|
771
|
+
// A factory whose return type wasn't captured is a CONSTRUCTOR
|
|
772
|
+
// (`TFileMem.Create().SetCachePerformance` — `constructor Create` has no `:
|
|
773
|
+
// TBar` annotation but returns its own class) or an unannotated function. In
|
|
774
|
+
// both cases the receiver's type is the class itself, so resolve the method on
|
|
775
|
+
// `factoryClass`. resolveMethodOnType validates against it (and its
|
|
776
|
+
// supertypes), so a wrong inference yields no edge — and this never fires when
|
|
777
|
+
// a return type WAS captured but lacks the method (absent-method safety above).
|
|
778
|
+
if (ref.language === 'pascal' && /^[TI]/.test(factoryClass)) {
|
|
779
|
+
return resolveMethodOnType(factoryClass, method, ref, context, 0.8, 'instance-method', importedFqnOf(factoryClass, ref, context));
|
|
780
|
+
}
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
return resolveMethodOnType(ret, method, ref, context, 0.85, 'instance-method', importedFqnOf(ret, ref, context));
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* When several classes share a simple type name, the caller file's import of
|
|
787
|
+
* that type is the only signal that names WHICH one (#314). Returns the imported
|
|
788
|
+
* FQN for `typeName` in the ref's file, or undefined.
|
|
789
|
+
*/
|
|
790
|
+
function importedFqnOf(typeName, ref, context) {
|
|
791
|
+
const imports = context.getImportMappings(ref.filePath, ref.language);
|
|
792
|
+
return imports.find((i) => i.localName === typeName)?.source;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Java/Kotlin: infer a receiver's declared type by walking field declarations
|
|
796
|
+
* in the class enclosing the call site. The field's `signature` is already in
|
|
797
|
+
* the form "<TypeName> <fieldName>" (set by tree-sitter.ts extractField), so we
|
|
798
|
+
* pull the type from there. Handles Spring `@Resource UserBO userbo;` /
|
|
799
|
+
* `@Autowired private UserService userService;` where the receiver field name
|
|
800
|
+
* doesn't match the class name by Java naming convention.
|
|
801
|
+
*
|
|
802
|
+
* Returns the bare type name (generics stripped, dotted package stripped) or
|
|
803
|
+
* null when no matching field is in the enclosing class.
|
|
804
|
+
*/
|
|
805
|
+
function inferJavaFieldReceiverType(receiverName, ref, context) {
|
|
806
|
+
const inFile = context.getNodesInFile(ref.filePath);
|
|
807
|
+
if (inFile.length === 0)
|
|
808
|
+
return null;
|
|
809
|
+
// Find the class enclosing the call line (tightest match by latest start).
|
|
810
|
+
let enclosing = null;
|
|
811
|
+
for (const n of inFile) {
|
|
812
|
+
if (n.kind !== 'class' && n.kind !== 'interface')
|
|
813
|
+
continue;
|
|
814
|
+
if (n.language !== ref.language)
|
|
815
|
+
continue;
|
|
816
|
+
const end = n.endLine ?? n.startLine;
|
|
817
|
+
if (n.startLine <= ref.line && end >= ref.line) {
|
|
818
|
+
if (!enclosing || n.startLine >= enclosing.startLine)
|
|
819
|
+
enclosing = n;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (!enclosing)
|
|
823
|
+
return null;
|
|
824
|
+
const enclosingEnd = enclosing.endLine ?? enclosing.startLine;
|
|
825
|
+
const field = inFile.find((n) => n.kind === 'field' &&
|
|
826
|
+
n.name === receiverName &&
|
|
827
|
+
n.language === ref.language &&
|
|
828
|
+
n.startLine >= enclosing.startLine &&
|
|
829
|
+
(n.endLine ?? n.startLine) <= enclosingEnd);
|
|
830
|
+
if (!field || !field.signature)
|
|
831
|
+
return null;
|
|
832
|
+
// Signature shape: "<TypeName> <fieldName>" (extractField). Pull the type,
|
|
833
|
+
// strip generics + dotted package, drop array/varargs markers.
|
|
834
|
+
const beforeName = field.signature.slice(0, field.signature.lastIndexOf(field.name));
|
|
835
|
+
const typeRaw = beforeName.trim();
|
|
836
|
+
if (!typeRaw)
|
|
837
|
+
return null;
|
|
838
|
+
const typeNoGenerics = typeRaw.replace(/<[^>]*>/g, '').trim();
|
|
839
|
+
const typeNoArray = typeNoGenerics.replace(/\[\s*\]/g, '').replace(/\.\.\.$/, '').trim();
|
|
840
|
+
const parts = typeNoArray.split(/[.\s]+/).filter(Boolean);
|
|
841
|
+
const lastPart = parts[parts.length - 1];
|
|
842
|
+
if (!lastPart)
|
|
843
|
+
return null;
|
|
844
|
+
if (!/^[A-Z]/.test(lastPart))
|
|
845
|
+
return null; // primitives / lowercase → skip
|
|
846
|
+
return lastPart;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Try to resolve by method name on a class/object
|
|
850
|
+
*/
|
|
851
|
+
function matchMethodCall(ref, context) {
|
|
852
|
+
// Parse method call patterns like "obj.method" or "Class::method". The method
|
|
853
|
+
// part allows trailing `:` keywords so Objective-C selectors resolve
|
|
854
|
+
// (`SDImageCache.storeImage:`, `obj.setX:y:`); colons never appear in other
|
|
855
|
+
// languages' method refs, so this is a no-op for them.
|
|
856
|
+
// The receiver allows dots (`builder.Services.AddCoreServices`) so a CHAINED
|
|
857
|
+
// call resolves by its last segment — Strategy 3 below name-matches the method
|
|
858
|
+
// (with its existing single-candidate / receiver-overlap guards). Without this
|
|
859
|
+
// a multi-dot extension-method call (C# DI `builder.Services.AddCoreServices()`,
|
|
860
|
+
// `Guard.Against.X()`) matched no pattern and never resolved.
|
|
861
|
+
const dotMatch = ref.referenceName.match(/^([\w.]+)\.(\w+:?(?:\w+:)*)$/);
|
|
862
|
+
const colonMatch = ref.referenceName.match(/^(\w+)::(\w+)$/);
|
|
863
|
+
const match = dotMatch || colonMatch;
|
|
864
|
+
if (!match) {
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
const [, objectOrClass, methodName] = match;
|
|
868
|
+
if (ref.language === 'cpp' && dotMatch) {
|
|
869
|
+
const inferredType = inferCppReceiverType(objectOrClass, ref, context);
|
|
870
|
+
if (inferredType) {
|
|
871
|
+
const typedMatch = resolveMethodOnType(inferredType, methodName, ref, context, 0.9, 'instance-method');
|
|
872
|
+
if (typedMatch) {
|
|
873
|
+
return typedMatch;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
// Java/Kotlin: receiver may be a field whose name doesn't match the type by
|
|
878
|
+
// Java naming convention (`userbo` → class `UserBO`, abbreviated). Look up
|
|
879
|
+
// the field in the enclosing class to get its declared type, then resolve
|
|
880
|
+
// the method on that type. Covers Spring `@Resource`/`@Autowired` field
|
|
881
|
+
// injection where the field type is the concrete bean class.
|
|
882
|
+
if ((ref.language === 'java' || ref.language === 'kotlin') && dotMatch) {
|
|
883
|
+
const inferredType = inferJavaFieldReceiverType(objectOrClass, ref, context);
|
|
884
|
+
if (inferredType) {
|
|
885
|
+
// When two classes share the same simple name, the caller file's
|
|
886
|
+
// import is the only signal that names WHICH one — pass the
|
|
887
|
+
// imported FQN so resolveMethodOnType can disambiguate (#314).
|
|
888
|
+
const imports = context.getImportMappings(ref.filePath, ref.language);
|
|
889
|
+
const importedFqn = imports.find((i) => i.localName === inferredType)?.source;
|
|
890
|
+
const typedMatch = resolveMethodOnType(inferredType, methodName, ref, context, 0.9, 'instance-method', importedFqn);
|
|
891
|
+
if (typedMatch) {
|
|
892
|
+
return typedMatch;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
// Strategy 1: Direct class name match (existing logic)
|
|
897
|
+
const classCandidates = context.getNodesByName(objectOrClass);
|
|
898
|
+
for (const classNode of classCandidates) {
|
|
899
|
+
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'interface') {
|
|
900
|
+
// Skip cross-language class matches
|
|
901
|
+
if (classNode.language !== ref.language)
|
|
902
|
+
continue;
|
|
903
|
+
const nodesInFile = context.getNodesInFile(classNode.filePath);
|
|
904
|
+
const methodNode = nodesInFile.find((n) => n.kind === 'method' &&
|
|
905
|
+
n.name === methodName &&
|
|
906
|
+
n.qualifiedName.includes(classNode.name));
|
|
907
|
+
if (methodNode) {
|
|
908
|
+
return {
|
|
909
|
+
original: ref,
|
|
910
|
+
targetNodeId: methodNode.id,
|
|
911
|
+
confidence: 0.85,
|
|
912
|
+
resolvedBy: 'qualified-name',
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
// Strategy 2: Instance variable receiver - try capitalized form to find class
|
|
918
|
+
// e.g., "permissionEngine" → look for classes containing "PermissionEngine"
|
|
919
|
+
const capitalizedReceiver = objectOrClass.charAt(0).toUpperCase() + objectOrClass.slice(1);
|
|
920
|
+
if (capitalizedReceiver !== objectOrClass) {
|
|
921
|
+
const fuzzyClassCandidates = context.getNodesByName(capitalizedReceiver);
|
|
922
|
+
for (const classNode of fuzzyClassCandidates) {
|
|
923
|
+
if (classNode.kind === 'class' || classNode.kind === 'struct' || classNode.kind === 'interface') {
|
|
924
|
+
// Skip cross-language class matches
|
|
925
|
+
if (classNode.language !== ref.language)
|
|
926
|
+
continue;
|
|
927
|
+
const nodesInFile = context.getNodesInFile(classNode.filePath);
|
|
928
|
+
const methodNode = nodesInFile.find((n) => n.kind === 'method' &&
|
|
929
|
+
n.name === methodName &&
|
|
930
|
+
n.qualifiedName.includes(classNode.name));
|
|
931
|
+
if (methodNode) {
|
|
932
|
+
return {
|
|
933
|
+
original: ref,
|
|
934
|
+
targetNodeId: methodNode.id,
|
|
935
|
+
confidence: 0.8,
|
|
936
|
+
resolvedBy: 'instance-method',
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
// Strategy 3: Find methods by name across the codebase, match by receiver
|
|
943
|
+
// name similarity with the containing class. Handles abbreviated variable
|
|
944
|
+
// names like permissionEngine → PermissionRuleEngine.
|
|
945
|
+
if (methodName) {
|
|
946
|
+
const methodCandidates = context.getNodesByName(methodName);
|
|
947
|
+
const methods = methodCandidates.filter((n) => n.kind === 'method' && n.name === methodName);
|
|
948
|
+
// Filter to same-language candidates first
|
|
949
|
+
const sameLanguageMethods = methods.filter(m => m.language === ref.language);
|
|
950
|
+
const targetMethods = sameLanguageMethods.length > 0 ? sameLanguageMethods : methods;
|
|
951
|
+
// If only one same-language method with this name exists, use it
|
|
952
|
+
if (targetMethods.length === 1 && targetMethods[0].language === ref.language) {
|
|
953
|
+
return {
|
|
954
|
+
original: ref,
|
|
955
|
+
targetNodeId: targetMethods[0].id,
|
|
956
|
+
confidence: 0.7,
|
|
957
|
+
resolvedBy: 'instance-method',
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
// Multiple methods: score by receiver name word overlap with class name
|
|
961
|
+
if (targetMethods.length > 1) {
|
|
962
|
+
const receiverWords = splitCamelCase(objectOrClass);
|
|
963
|
+
let bestMatch;
|
|
964
|
+
let bestScore = 0;
|
|
965
|
+
for (const method of targetMethods) {
|
|
966
|
+
const classWords = splitCamelCase(method.qualifiedName);
|
|
967
|
+
let score = receiverWords.filter(w => classWords.some(cw => cw.toLowerCase() === w.toLowerCase())).length;
|
|
968
|
+
// Bonus for same language
|
|
969
|
+
if (method.language === ref.language)
|
|
970
|
+
score += 1;
|
|
971
|
+
if (score > bestScore) {
|
|
972
|
+
bestScore = score;
|
|
973
|
+
bestMatch = method;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
if (bestMatch && bestScore >= 2) {
|
|
977
|
+
return {
|
|
978
|
+
original: ref,
|
|
979
|
+
targetNodeId: bestMatch.id,
|
|
980
|
+
confidence: 0.65,
|
|
981
|
+
resolvedBy: 'instance-method',
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Split a camelCase or PascalCase string into words.
|
|
990
|
+
*/
|
|
991
|
+
function splitCamelCase(str) {
|
|
992
|
+
return str.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
993
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
994
|
+
.split(/[\s._:\/\\]+/)
|
|
995
|
+
.filter(w => w.length > 1);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Compute directory proximity from a pre-split list of directory segments
|
|
999
|
+
* (`filePath1` minus its filename) and a second file path.
|
|
1000
|
+
* Returns a score based on the number of shared leading directory segments.
|
|
1001
|
+
* Higher score = closer in directory tree.
|
|
1002
|
+
*
|
|
1003
|
+
* Split into a pre-split variant because findBestMatch scores every candidate
|
|
1004
|
+
* against the SAME `ref.filePath`; re-splitting it per candidate was a hot spot
|
|
1005
|
+
* on large repos (#915), so the caller splits it once and passes the segments.
|
|
1006
|
+
*/
|
|
1007
|
+
function pathProximityFromDirs(dir1, filePath2) {
|
|
1008
|
+
const dir2 = filePath2.split('/');
|
|
1009
|
+
dir2.pop(); // drop filename — matches the original slice(0, -1) on both paths
|
|
1010
|
+
let shared = 0;
|
|
1011
|
+
const limit = Math.min(dir1.length, dir2.length);
|
|
1012
|
+
for (let i = 0; i < limit; i++) {
|
|
1013
|
+
if (dir1[i] === dir2[i]) {
|
|
1014
|
+
shared++;
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
break;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
// Each shared directory segment contributes 15 points, capped at 80
|
|
1021
|
+
return Math.min(shared * 15, 80);
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Compute directory proximity between two file paths.
|
|
1025
|
+
* Returns a score based on the number of shared directory segments.
|
|
1026
|
+
*/
|
|
1027
|
+
function computePathProximity(filePath1, filePath2) {
|
|
1028
|
+
const dir1 = filePath1.split('/');
|
|
1029
|
+
dir1.pop();
|
|
1030
|
+
return pathProximityFromDirs(dir1, filePath2);
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Find the best matching node when there are multiple candidates
|
|
1034
|
+
*/
|
|
1035
|
+
function findBestMatch(ref, candidates, _context) {
|
|
1036
|
+
// Prioritization rules:
|
|
1037
|
+
// 1. Same file > different file
|
|
1038
|
+
// 2. Directory proximity (same module/package > different module)
|
|
1039
|
+
// 3. Same language > different language
|
|
1040
|
+
// 4. Functions/methods > classes/types (for call references)
|
|
1041
|
+
// 5. Exported > non-exported
|
|
1042
|
+
let bestScore = -1;
|
|
1043
|
+
let bestNode = null;
|
|
1044
|
+
// Split the ref's path once (it's the same across every candidate) instead of
|
|
1045
|
+
// re-splitting it inside computePathProximity per candidate (#915 hot spot).
|
|
1046
|
+
const refDirs = ref.filePath.split('/');
|
|
1047
|
+
refDirs.pop();
|
|
1048
|
+
// A same-language candidate ALWAYS outscores a cross-language one: same-language
|
|
1049
|
+
// scores at least +50 (language bonus), while a cross-language candidate maxes
|
|
1050
|
+
// out at +35 (−80 language, +80 proximity, +25 kind, +10 exported; it can never
|
|
1051
|
+
// be in the same file). So when any same-language candidate exists, skip the
|
|
1052
|
+
// cross-language ones — provably the same winner, without paying the per-candidate
|
|
1053
|
+
// scoring. Cuts the candidate set to same-language size on mixed front-end +
|
|
1054
|
+
// back-end repos (#915). When ALL candidates are cross-language (a legitimate
|
|
1055
|
+
// cross-language `calls` bridge), none are skipped and behavior is unchanged.
|
|
1056
|
+
const hasSameLanguage = candidates.some((c) => c.language === ref.language);
|
|
1057
|
+
for (const candidate of candidates) {
|
|
1058
|
+
if (hasSameLanguage && candidate.language !== ref.language)
|
|
1059
|
+
continue;
|
|
1060
|
+
let score = 0;
|
|
1061
|
+
// Same file bonus
|
|
1062
|
+
if (candidate.filePath === ref.filePath) {
|
|
1063
|
+
score += 100;
|
|
1064
|
+
}
|
|
1065
|
+
// Directory proximity bonus — strongly prefer same module/package
|
|
1066
|
+
score += pathProximityFromDirs(refDirs, candidate.filePath);
|
|
1067
|
+
// Language matching: strongly prefer same language, penalize cross-language
|
|
1068
|
+
if (candidate.language === ref.language) {
|
|
1069
|
+
score += 50;
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
score -= 80;
|
|
1073
|
+
}
|
|
1074
|
+
// For call references, prefer functions/methods
|
|
1075
|
+
if (ref.referenceKind === 'calls') {
|
|
1076
|
+
if (candidate.kind === 'function' || candidate.kind === 'method') {
|
|
1077
|
+
score += 25;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
// For instantiation references (`new Foo()`), prefer class-like
|
|
1081
|
+
// targets — without this, a function named `Foo` in another module
|
|
1082
|
+
// could outscore the actual class.
|
|
1083
|
+
if (ref.referenceKind === 'instantiates') {
|
|
1084
|
+
if (candidate.kind === 'class' ||
|
|
1085
|
+
candidate.kind === 'struct' ||
|
|
1086
|
+
candidate.kind === 'interface') {
|
|
1087
|
+
score += 25;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
// For decorator references (`@Foo`), prefer functions. Class
|
|
1091
|
+
// decorators (Python `@SomeClass`, Java annotation interfaces)
|
|
1092
|
+
// also resolve here, hence the smaller class bonus.
|
|
1093
|
+
if (ref.referenceKind === 'decorates') {
|
|
1094
|
+
if (candidate.kind === 'function' || candidate.kind === 'method') {
|
|
1095
|
+
score += 25;
|
|
1096
|
+
}
|
|
1097
|
+
else if (candidate.kind === 'class' || candidate.kind === 'interface') {
|
|
1098
|
+
score += 15;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
// Exported bonus
|
|
1102
|
+
if (candidate.isExported) {
|
|
1103
|
+
score += 10;
|
|
1104
|
+
}
|
|
1105
|
+
// Closer line number (within same file)
|
|
1106
|
+
if (candidate.filePath === ref.filePath && candidate.startLine) {
|
|
1107
|
+
const distance = Math.abs(candidate.startLine - ref.line);
|
|
1108
|
+
score += Math.max(0, 20 - distance / 10);
|
|
1109
|
+
}
|
|
1110
|
+
if (score > bestScore) {
|
|
1111
|
+
bestScore = score;
|
|
1112
|
+
bestNode = candidate;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return bestNode;
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Fuzzy match - last resort with lower confidence
|
|
1119
|
+
*/
|
|
1120
|
+
function matchFuzzy(ref, context) {
|
|
1121
|
+
const lowerName = ref.referenceName.toLowerCase();
|
|
1122
|
+
// Use pre-built lowercase index for O(1) lookup instead of scanning all nodes
|
|
1123
|
+
const candidates = context.getNodesByLowerName(lowerName);
|
|
1124
|
+
// Filter to callable kinds only (function, method, class)
|
|
1125
|
+
const callableKinds = new Set(['function', 'method', 'class']);
|
|
1126
|
+
const callableCandidates = applyLanguageGate(candidates.filter((n) => callableKinds.has(n.kind)), ref);
|
|
1127
|
+
// Prefer same-language matches
|
|
1128
|
+
const sameLanguageCandidates = callableCandidates.filter(n => n.language === ref.language);
|
|
1129
|
+
const finalCandidates = sameLanguageCandidates.length > 0 ? sameLanguageCandidates : callableCandidates;
|
|
1130
|
+
if (finalCandidates.length === 1) {
|
|
1131
|
+
const isCrossLanguage = finalCandidates[0].language !== ref.language;
|
|
1132
|
+
return {
|
|
1133
|
+
original: ref,
|
|
1134
|
+
targetNodeId: finalCandidates[0].id,
|
|
1135
|
+
confidence: isCrossLanguage ? 0.3 : 0.5,
|
|
1136
|
+
resolvedBy: 'fuzzy',
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
return null;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Match all strategies in order of confidence
|
|
1143
|
+
*/
|
|
1144
|
+
function matchReference(ref, context) {
|
|
1145
|
+
// Function-as-value refs (#756) resolve ONLY through the dedicated matcher —
|
|
1146
|
+
// never the fuzzy/qualified fallthrough below (a wrong callback edge is
|
|
1147
|
+
// worse than none).
|
|
1148
|
+
if (ref.referenceKind === 'function_ref') {
|
|
1149
|
+
return matchFunctionRef(ref, context);
|
|
1150
|
+
}
|
|
1151
|
+
// Try strategies in order of confidence
|
|
1152
|
+
let result;
|
|
1153
|
+
// 0. File path match (e.g., "snippets/drawer-menu.liquid" → file node)
|
|
1154
|
+
result = matchByFilePath(ref, context);
|
|
1155
|
+
if (result)
|
|
1156
|
+
return result;
|
|
1157
|
+
// 1. Qualified name match (highest confidence)
|
|
1158
|
+
result = matchByQualifiedName(ref, context);
|
|
1159
|
+
if (result)
|
|
1160
|
+
return result;
|
|
1161
|
+
// 1b. C++ chained call whose receiver is another call — `Foo::instance().bar()`
|
|
1162
|
+
// encoded as `Foo::instance().bar` by the extractor (#645). Resolve the
|
|
1163
|
+
// receiver's type from what the inner call returns, then the method on it.
|
|
1164
|
+
if (ref.language === 'cpp' || ref.language === 'c') {
|
|
1165
|
+
result = matchCppCallChain(ref, context);
|
|
1166
|
+
if (result)
|
|
1167
|
+
return result;
|
|
1168
|
+
}
|
|
1169
|
+
// 1c. `::`-scoped factory chain — PHP `Cls::for($x)->method()` (#608) or Rust
|
|
1170
|
+
// `Foo::new().bar()`, both encoded as `Cls::factory().method`. The receiver's
|
|
1171
|
+
// type is the factory's `self` (PHP `: self`/`: static`, Rust `-> Self`) or
|
|
1172
|
+
// concrete return type.
|
|
1173
|
+
if (ref.language === 'php' || ref.language === 'rust') {
|
|
1174
|
+
result = matchScopedCallChain(ref, context);
|
|
1175
|
+
if (result)
|
|
1176
|
+
return result;
|
|
1177
|
+
}
|
|
1178
|
+
// 1d. Dotted chained static-factory / fluent call (Java / Kotlin / C# / Swift /
|
|
1179
|
+
// Go / Scala / Dart / Objective-C) — `Foo.getInstance().bar()` encoded as
|
|
1180
|
+
// `Foo.getInstance().bar`, Go's bare-factory `New().Method()` as `New().Method`,
|
|
1181
|
+
// Scala's companion factory, Dart's static factory / factory-constructor, or
|
|
1182
|
+
// ObjC's chained message send `[[Foo create] doIt]` encoded as `Foo.create().doIt`
|
|
1183
|
+
// (#645/#608 mechanism). Resolve the method's class from the inner call's
|
|
1184
|
+
// declared return type, then validate it.
|
|
1185
|
+
if (ref.language === 'java' ||
|
|
1186
|
+
ref.language === 'kotlin' ||
|
|
1187
|
+
ref.language === 'csharp' ||
|
|
1188
|
+
ref.language === 'swift' ||
|
|
1189
|
+
ref.language === 'go' ||
|
|
1190
|
+
ref.language === 'scala' ||
|
|
1191
|
+
ref.language === 'dart' ||
|
|
1192
|
+
ref.language === 'objc' ||
|
|
1193
|
+
ref.language === 'pascal') {
|
|
1194
|
+
result = matchDottedCallChain(ref, context);
|
|
1195
|
+
if (result)
|
|
1196
|
+
return result;
|
|
1197
|
+
}
|
|
1198
|
+
// 2. Method call pattern
|
|
1199
|
+
result = matchMethodCall(ref, context);
|
|
1200
|
+
if (result)
|
|
1201
|
+
return result;
|
|
1202
|
+
// 3. Exact name match
|
|
1203
|
+
result = matchByExactName(ref, context);
|
|
1204
|
+
if (result)
|
|
1205
|
+
return result;
|
|
1206
|
+
// 4. Fuzzy match (lowest confidence)
|
|
1207
|
+
result = matchFuzzy(ref, context);
|
|
1208
|
+
if (result)
|
|
1209
|
+
return result;
|
|
1210
|
+
return null;
|
|
1211
|
+
}
|
|
1212
|
+
//# sourceMappingURL=name-matcher.js.map
|