@mrclrchtr/supi-code-intelligence 1.16.1 → 2.0.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/README.md +373 -63
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
- package/package.json +14 -9
- package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
- package/src/analysis/architecture/model.ts +76 -0
- package/src/analysis/brief/directory.ts +324 -0
- package/src/analysis/brief/enrich.ts +157 -0
- package/src/analysis/brief/file.ts +84 -0
- package/src/analysis/brief/inventory.ts +177 -0
- package/src/analysis/brief/main.ts +176 -0
- package/src/analysis/brief/models.ts +75 -0
- package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
- package/src/analysis/brief/summarize.ts +208 -0
- package/src/analysis/brief/types.ts +27 -0
- package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
- package/src/analysis/coverage/coverage-warnings.ts +224 -0
- package/src/analysis/evidence.ts +91 -0
- package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
- package/src/analysis/provider.ts +186 -0
- package/src/analysis/read-next.ts +126 -0
- package/src/analysis/readiness.ts +73 -0
- package/src/{refactor → analysis/refactor}/safety.ts +1 -1
- package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
- package/src/analysis/search/pattern.ts +345 -0
- package/src/analysis/search/ripgrep.ts +473 -0
- package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
- package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
- package/src/analysis/target/anchored.ts +349 -0
- package/src/analysis/target/bridge.ts +152 -0
- package/src/analysis/target/file-resolution.ts +125 -0
- package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
- package/src/{planner → analysis/target}/planner.ts +30 -20
- package/src/{targeting → analysis/target}/query.ts +17 -3
- package/src/analysis/target/resolve-common.ts +115 -0
- package/src/analysis/target/service.ts +229 -0
- package/src/analysis/target/symbol.ts +196 -0
- package/src/{targeting → analysis/target}/types.ts +17 -1
- package/src/analysis/tests/likely-tests.ts +174 -0
- package/src/analysis/tests/test-discovery.ts +540 -0
- package/src/analysis/tests/vitest.ts +87 -0
- package/src/api.ts +34 -41
- package/src/app/app.ts +125 -0
- package/src/app/manager.ts +65 -0
- package/src/extension.ts +132 -1
- package/src/index.ts +1 -57
- package/src/session/refactor-plans.ts +82 -0
- package/src/session/session.ts +300 -0
- package/src/session/target-store.ts +293 -0
- package/src/substrate/lsp/diagnostic-injection.ts +218 -0
- package/src/substrate/lsp/lifecycle.ts +66 -0
- package/src/substrate/lsp/overrides.ts +132 -0
- package/src/substrate/lsp/recovery.ts +55 -0
- package/src/substrate/lsp/settings.ts +286 -0
- package/src/substrate/lsp/state.ts +46 -0
- package/src/substrate/lsp/utils.ts +17 -0
- package/src/substrate/tree-sitter/lifecycle.ts +52 -0
- package/src/tool/find/execute.ts +118 -0
- package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
- package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
- package/src/tool/find/semantic-search.ts +114 -0
- package/src/tool/find/tui.ts +39 -0
- package/src/tool/graph/callees.ts +87 -0
- package/src/tool/graph/calls-md.ts +54 -0
- package/src/tool/graph/collect-relation.ts +371 -0
- package/src/tool/graph/execute.ts +95 -0
- package/src/tool/graph/implementations-md.ts +79 -0
- package/src/tool/graph/implementations.ts +76 -0
- package/src/tool/graph/markdown-base.ts +243 -0
- package/src/tool/graph/orchestrate.ts +285 -0
- package/src/tool/graph/references-md.ts +34 -0
- package/src/tool/graph/references.ts +81 -0
- package/src/tool/graph/tui.ts +120 -0
- package/src/tool/graph/types.ts +97 -0
- package/src/tool/guidance.ts +96 -49
- package/src/tool/health/execute.ts +76 -0
- package/src/tool/health/markdown.ts +280 -0
- package/src/tool/health/orchestrate.ts +159 -0
- package/src/tool/health/sections/diagnostics.ts +182 -0
- package/src/tool/health/sections/recovery.ts +89 -0
- package/src/tool/health/sections/signals.ts +89 -0
- package/src/tool/health/tui.ts +137 -0
- package/src/tool/impact/analysis.ts +247 -0
- package/src/tool/impact/change-set-impact.ts +151 -0
- package/src/tool/impact/execute.ts +98 -0
- package/src/tool/impact/file-level-impact.ts +81 -0
- package/src/tool/impact/markdown.ts +283 -0
- package/src/tool/impact/orchestrate.ts +97 -0
- package/src/tool/impact/result.ts +21 -0
- package/src/tool/impact/single-impact.ts +89 -0
- package/src/tool/impact/tui.ts +39 -0
- package/src/tool/impact/types.ts +34 -0
- package/src/tool/infra/cross-field.ts +335 -0
- package/src/tool/infra/error-results.ts +199 -0
- package/src/tool/infra/pipeline.ts +311 -0
- package/src/tool/infra/progress.ts +21 -0
- package/src/tool/infra/readiness-message.ts +5 -0
- package/src/tool/infra/truncate.ts +49 -0
- package/src/tool/inspect/execute.ts +76 -0
- package/src/tool/inspect/markdown.ts +169 -0
- package/src/tool/inspect/orchestrate.ts +156 -0
- package/src/tool/inspect/tui.ts +36 -0
- package/src/tool/orientation/deps.ts +63 -0
- package/src/tool/orientation/execute.ts +50 -0
- package/src/tool/orientation/markdown.ts +35 -0
- package/src/tool/orientation/mode.ts +88 -0
- package/src/tool/orientation/orchestrate.ts +478 -0
- package/src/tool/orientation/precise-target.ts +257 -0
- package/src/tool/orientation/tui.ts +131 -0
- package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
- package/src/tool/refactor-apply/execute.ts +20 -0
- package/src/tool/refactor-apply/markdown.ts +118 -0
- package/src/tool/refactor-apply/orchestrate.ts +89 -0
- package/src/tool/refactor-apply/tui.ts +51 -0
- package/src/tool/refactor-plan/execute.ts +73 -0
- package/src/tool/refactor-plan/markdown.ts +118 -0
- package/src/tool/refactor-plan/orchestrate.ts +363 -0
- package/src/tool/refactor-plan/tui.ts +42 -0
- package/src/tool/register.ts +123 -0
- package/src/tool/resolve/execute.ts +82 -0
- package/src/tool/resolve/markdown.ts +150 -0
- package/src/tool/resolve/orchestrate.ts +134 -0
- package/src/tool/resolve/tui.ts +40 -0
- package/src/tool/schemas.ts +337 -0
- package/src/tool/specs.ts +257 -0
- package/src/types/details.ts +188 -0
- package/src/types/execution.ts +60 -0
- package/src/types/index.ts +28 -0
- package/src/{intent/types.ts → types/tool-names.ts} +15 -14
- package/src/ui/footer.ts +52 -0
- package/src/ui/markdown/brief.ts +218 -0
- package/src/ui/markdown/gather.ts +177 -0
- package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
- package/src/{presentation → ui}/markdown/overview.ts +2 -2
- package/src/ui/markdown/types.ts +80 -0
- package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
- package/src/ui/status-command.ts +260 -0
- package/src/ui/status-overlay.ts +500 -0
- package/src/ui/tui/common.ts +220 -0
- package/src/ui/tui/index.ts +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
- package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
- package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
- package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
- package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
- package/src/brief-focused.ts +0 -563
- package/src/code-intelligence.ts +0 -70
- package/src/pattern-structured.ts +0 -194
- package/src/presentation/markdown/affected.ts +0 -170
- package/src/presentation/markdown/brief.ts +0 -174
- package/src/presentation/markdown/map.ts +0 -54
- package/src/presentation/markdown/refactor.ts +0 -27
- package/src/presentation/markdown/relations.ts +0 -121
- package/src/resolve-target.ts +0 -130
- package/src/search-helpers.ts +0 -303
- package/src/substrates/types.ts +0 -30
- package/src/target-resolution.ts +0 -122
- package/src/targeting/resolve-anchored.ts +0 -80
- package/src/targeting/resolve-symbol.ts +0 -110
- package/src/tool/execute-affected.ts +0 -71
- package/src/tool/execute-brief.ts +0 -59
- package/src/tool/execute-map.ts +0 -35
- package/src/tool/execute-pattern.ts +0 -29
- package/src/tool/execute-refactor.ts +0 -101
- package/src/tool/execute-relations.ts +0 -79
- package/src/tool/register-tools.ts +0 -32
- package/src/tool/tool-specs.ts +0 -190
- package/src/tool/validation.ts +0 -43
- package/src/types.ts +0 -169
- package/src/use-case/generate-affected.ts +0 -297
- package/src/use-case/generate-map.ts +0 -176
- package/src/use-case/generate-relations.ts +0 -438
- package/src/use-case/types.ts +0 -43
- package/src/workspace/request-context.ts +0 -139
- /package/src/{query-params.ts → tool/params.ts} +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchored target resolution — resolves a file + position pair into a
|
|
3
|
+
* typed target outcome using purely filesystem-level validation.
|
|
4
|
+
*
|
|
5
|
+
* This resolver does not require LSP or Tree-sitter. It validates
|
|
6
|
+
* file existence, binary-file guards, and produces the necessary
|
|
7
|
+
* position conversions for downstream semantic operations.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import type {
|
|
13
|
+
CodeResult,
|
|
14
|
+
CodeSymbol,
|
|
15
|
+
NodeAtData,
|
|
16
|
+
SemanticProvider,
|
|
17
|
+
StructuralProvider,
|
|
18
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
19
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
20
|
+
import type { AnchoredResolutionMetadata, AnchoredResolutionSource } from "../../types/index.ts";
|
|
21
|
+
import type { DisambiguationCandidateData, ResolvedTargetData, TargetOutcome } from "./types.ts";
|
|
22
|
+
|
|
23
|
+
/** 1-based symbol anchor position (mirrors the runtime `SymbolAnchor`). */
|
|
24
|
+
type Anchor = { line: number; character: number };
|
|
25
|
+
|
|
26
|
+
const BINARY_EXTENSIONS = new Set([
|
|
27
|
+
".png",
|
|
28
|
+
".jpg",
|
|
29
|
+
".jpeg",
|
|
30
|
+
".gif",
|
|
31
|
+
".webp",
|
|
32
|
+
".bmp",
|
|
33
|
+
".ico",
|
|
34
|
+
".woff",
|
|
35
|
+
".woff2",
|
|
36
|
+
".ttf",
|
|
37
|
+
".eot",
|
|
38
|
+
".zip",
|
|
39
|
+
".tar",
|
|
40
|
+
".gz",
|
|
41
|
+
".bz2",
|
|
42
|
+
".pdf",
|
|
43
|
+
".doc",
|
|
44
|
+
".docx",
|
|
45
|
+
".exe",
|
|
46
|
+
".dll",
|
|
47
|
+
".so",
|
|
48
|
+
".dylib",
|
|
49
|
+
".wasm",
|
|
50
|
+
".node",
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
function isBinaryFile(filePath: string): boolean {
|
|
54
|
+
return BINARY_EXTENSIONS.has(path.extname(filePath).toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ── Provider-backed anchored symbol resolution ────────────────────────
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Minimal provider surface used by anchored symbol resolution — only the
|
|
61
|
+
* methods the resolver actually consults. The composite `CodeProvider` from
|
|
62
|
+
* `request-context.ts` satisfies this shape, as do focused test doubles.
|
|
63
|
+
*/
|
|
64
|
+
export interface AnchoredResolverProvider {
|
|
65
|
+
documentSymbols?: SemanticProvider["documentSymbols"];
|
|
66
|
+
nodeAt?: StructuralProvider["nodeAt"];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Tree-sitter node types that introduce a named declaration. */
|
|
70
|
+
const DECLARATION_NODE_TYPES = new Set([
|
|
71
|
+
"function_declaration",
|
|
72
|
+
"generator_function_declaration",
|
|
73
|
+
"function_signature",
|
|
74
|
+
"method_definition",
|
|
75
|
+
"method_declaration",
|
|
76
|
+
"method_signature",
|
|
77
|
+
"class_declaration",
|
|
78
|
+
"interface_declaration",
|
|
79
|
+
"enum_declaration",
|
|
80
|
+
"type_alias_declaration",
|
|
81
|
+
"lexical_declaration",
|
|
82
|
+
"variable_declaration",
|
|
83
|
+
"export_statement",
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
/** Tree-sitter node types that represent non-symbol tokens. */
|
|
87
|
+
const NON_SYMBOL_NODE_TYPES = new Set([
|
|
88
|
+
"comment",
|
|
89
|
+
"line_comment",
|
|
90
|
+
"block_comment",
|
|
91
|
+
"string",
|
|
92
|
+
"string_fragment",
|
|
93
|
+
"template_string",
|
|
94
|
+
"template_literal_type",
|
|
95
|
+
"regex",
|
|
96
|
+
"regex_pattern",
|
|
97
|
+
"number",
|
|
98
|
+
"escape_sequence",
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
function kindFromDeclarationType(nodeType: string): string | null {
|
|
102
|
+
if (nodeType.includes("function")) return "Function";
|
|
103
|
+
if (nodeType.includes("method")) return "Method";
|
|
104
|
+
if (nodeType.includes("class")) return "Class";
|
|
105
|
+
if (nodeType.includes("interface")) return "Interface";
|
|
106
|
+
if (nodeType.includes("enum")) return "Enum";
|
|
107
|
+
if (nodeType.includes("type_alias")) return "Type";
|
|
108
|
+
if (nodeType.includes("lexical") || nodeType.includes("variable")) return "Variable";
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Classify how (or whether) a document symbol relates to a 1-based coordinate.
|
|
114
|
+
*
|
|
115
|
+
* - `"exact"` — the coordinate lands on the identifier token (name anchor).
|
|
116
|
+
* - `"snap"` — the coordinate lands on the declaration header/modifier area
|
|
117
|
+
* on the declaration line, before the identifier, and a name anchor exists
|
|
118
|
+
* to snap to.
|
|
119
|
+
* - `null` — no relationship.
|
|
120
|
+
*/
|
|
121
|
+
function matchSymbolAt(s: CodeSymbol, line: number, character: number): "exact" | "snap" | null {
|
|
122
|
+
const nameAnchor = s.nameAnchor;
|
|
123
|
+
if (nameAnchor && nameAnchor.line === line) {
|
|
124
|
+
const start = nameAnchor.character;
|
|
125
|
+
const end = start + s.name.length;
|
|
126
|
+
if (character >= start && character < end) return "exact";
|
|
127
|
+
}
|
|
128
|
+
const decl = s.declarationAnchor;
|
|
129
|
+
if (decl.line === line && nameAnchor && nameAnchor.line === line) {
|
|
130
|
+
if (character >= decl.character && character < nameAnchor.character) return "snap";
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildResolution(
|
|
136
|
+
requested: Anchor,
|
|
137
|
+
resolvedAnchor: Anchor,
|
|
138
|
+
snapped: boolean,
|
|
139
|
+
source: AnchoredResolutionSource,
|
|
140
|
+
): AnchoredResolutionMetadata {
|
|
141
|
+
return {
|
|
142
|
+
requested: { line: requested.line, character: requested.character },
|
|
143
|
+
resolved: { line: resolvedAnchor.line, character: resolvedAnchor.character },
|
|
144
|
+
snapped,
|
|
145
|
+
source,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function resolvedFromSymbol(
|
|
150
|
+
file: string,
|
|
151
|
+
s: CodeSymbol,
|
|
152
|
+
opts: { snapped: boolean; requested: Anchor; source: AnchoredResolutionSource },
|
|
153
|
+
): { kind: "resolved"; target: ResolvedTargetData } {
|
|
154
|
+
const a = (s.nameAnchor ?? s.declarationAnchor) as Anchor;
|
|
155
|
+
return {
|
|
156
|
+
kind: "resolved",
|
|
157
|
+
target: {
|
|
158
|
+
file,
|
|
159
|
+
position: { line: a.line - 1, character: a.character - 1 },
|
|
160
|
+
displayLine: a.line,
|
|
161
|
+
displayCharacter: a.character,
|
|
162
|
+
name: s.name,
|
|
163
|
+
kind: s.kind,
|
|
164
|
+
confidence: "semantic",
|
|
165
|
+
anchorKind: (s.nameAnchor ? "name" : "declaration") as AnchorKind,
|
|
166
|
+
container: s.container ?? null,
|
|
167
|
+
resolution: buildResolution(opts.requested, a, opts.snapped, opts.source),
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function candidatesFromSymbols(
|
|
173
|
+
file: string,
|
|
174
|
+
matched: CodeSymbol[],
|
|
175
|
+
): { kind: "disambiguation"; candidates: DisambiguationCandidateData[]; omittedCount: number } {
|
|
176
|
+
const candidates = matched.map((s, idx) => {
|
|
177
|
+
const a = (s.nameAnchor ?? s.declarationAnchor) as Anchor;
|
|
178
|
+
return {
|
|
179
|
+
name: s.name,
|
|
180
|
+
kind: s.kind,
|
|
181
|
+
container: s.container ?? null,
|
|
182
|
+
file,
|
|
183
|
+
line: a.line,
|
|
184
|
+
character: a.character,
|
|
185
|
+
reason: `${a.line}:${a.character}`,
|
|
186
|
+
rank: idx + 1,
|
|
187
|
+
anchorKind: (s.nameAnchor ? "name" : "declaration") as AnchorKind,
|
|
188
|
+
} satisfies DisambiguationCandidateData;
|
|
189
|
+
});
|
|
190
|
+
return { kind: "disambiguation", candidates, omittedCount: 0 };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Layer 1: match the coordinate against LSP document symbols. Returns null to fall through. */
|
|
194
|
+
async function resolveFromSemantic(
|
|
195
|
+
file: string,
|
|
196
|
+
requested: Anchor,
|
|
197
|
+
provider: AnchoredResolverProvider,
|
|
198
|
+
): Promise<TargetOutcome | null> {
|
|
199
|
+
if (!provider.documentSymbols) return null;
|
|
200
|
+
let symbols: CodeSymbol[] | null = null;
|
|
201
|
+
try {
|
|
202
|
+
symbols = await provider.documentSymbols(file);
|
|
203
|
+
} catch {
|
|
204
|
+
symbols = null;
|
|
205
|
+
}
|
|
206
|
+
if (!symbols || symbols.length === 0) return null;
|
|
207
|
+
|
|
208
|
+
const exact: CodeSymbol[] = [];
|
|
209
|
+
const snap: CodeSymbol[] = [];
|
|
210
|
+
for (const s of symbols) {
|
|
211
|
+
const m = matchSymbolAt(s, requested.line, requested.character);
|
|
212
|
+
if (m === "exact") exact.push(s);
|
|
213
|
+
else if (m === "snap") snap.push(s);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (exact.length === 1) {
|
|
217
|
+
return resolvedFromSymbol(file, exact[0], { snapped: false, requested, source: "semantic" });
|
|
218
|
+
}
|
|
219
|
+
if (exact.length > 1) return candidatesFromSymbols(file, exact);
|
|
220
|
+
if (snap.length === 1) {
|
|
221
|
+
return resolvedFromSymbol(file, snap[0], { snapped: true, requested, source: "semantic" });
|
|
222
|
+
}
|
|
223
|
+
if (snap.length > 1) return candidatesFromSymbols(file, snap);
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Layer 2: classify the coordinate via tree-sitter `nodeAt`. Returns null to fall through. */
|
|
228
|
+
async function resolveFromStructural(
|
|
229
|
+
file: string,
|
|
230
|
+
requested: Anchor,
|
|
231
|
+
provider: AnchoredResolverProvider,
|
|
232
|
+
): Promise<TargetOutcome | null> {
|
|
233
|
+
if (!provider.nodeAt) return null;
|
|
234
|
+
let nodeResult: CodeResult<NodeAtData> | null = null;
|
|
235
|
+
try {
|
|
236
|
+
nodeResult = await provider.nodeAt(file, requested.line, requested.character);
|
|
237
|
+
} catch {
|
|
238
|
+
nodeResult = null;
|
|
239
|
+
}
|
|
240
|
+
if (nodeResult?.kind !== "success") return null;
|
|
241
|
+
|
|
242
|
+
const node = nodeResult.data;
|
|
243
|
+
if (NON_SYMBOL_NODE_TYPES.has(node.type)) {
|
|
244
|
+
return {
|
|
245
|
+
kind: "error",
|
|
246
|
+
message: coordinateNotOnSymbolMessage(file, requested.line, requested.character, node.type),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
if (node.type !== "identifier") {
|
|
250
|
+
// Keyword/modifier/operator etc. — no LSP header snap available.
|
|
251
|
+
return {
|
|
252
|
+
kind: "error",
|
|
253
|
+
message: coordinateNotOnSymbolMessage(file, requested.line, requested.character, node.type),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const declAncestor = node.ancestry.find((a) => DECLARATION_NODE_TYPES.has(a.type));
|
|
258
|
+
if (!declAncestor) {
|
|
259
|
+
// Identifier is a usage, not a declaration name.
|
|
260
|
+
return {
|
|
261
|
+
kind: "error",
|
|
262
|
+
message: coordinateNotOnSymbolMessage(
|
|
263
|
+
file,
|
|
264
|
+
requested.line,
|
|
265
|
+
requested.character,
|
|
266
|
+
"identifier usage",
|
|
267
|
+
),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
const nameAnchor: Anchor = { line: node.startLine, character: node.startCharacter };
|
|
271
|
+
const snapped =
|
|
272
|
+
nameAnchor.line !== requested.line || nameAnchor.character !== requested.character;
|
|
273
|
+
return {
|
|
274
|
+
kind: "resolved",
|
|
275
|
+
target: {
|
|
276
|
+
file,
|
|
277
|
+
position: { line: nameAnchor.line - 1, character: nameAnchor.character - 1 },
|
|
278
|
+
displayLine: nameAnchor.line,
|
|
279
|
+
displayCharacter: nameAnchor.character,
|
|
280
|
+
name: node.text,
|
|
281
|
+
kind: kindFromDeclarationType(declAncestor.type),
|
|
282
|
+
confidence: "structural",
|
|
283
|
+
anchorKind: "name",
|
|
284
|
+
container: null,
|
|
285
|
+
resolution: buildResolution(requested, nameAnchor, snapped, "structural-identifier"),
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Resolve a real symbol target from anchored coordinates using provider
|
|
292
|
+
* evidence. Replaces the anonymous point-target behavior for `code_resolve`
|
|
293
|
+
* and `code_orientation`.
|
|
294
|
+
*
|
|
295
|
+
* Layered resolution (per the coordinated-targets plan):
|
|
296
|
+
* 1. Prefer LSP document-symbol evidence: exact identifier hit, declaration
|
|
297
|
+
* header snap (only when exactly one enclosing symbol is unambiguous), or
|
|
298
|
+
* explicit disambiguation candidates.
|
|
299
|
+
* 2. Structural fallback via tree-sitter `nodeAt` — only when unambiguous and
|
|
300
|
+
* provider-backed: an identifier token that is a declaration name resolves
|
|
301
|
+
* to a structural name-anchor target; comment/string/non-symbol nodes fail
|
|
302
|
+
* honestly.
|
|
303
|
+
* 3. If no provider-backed symbol target can be resolved, return an explicit
|
|
304
|
+
* error recommending `code_inspect` for point-level facts.
|
|
305
|
+
*
|
|
306
|
+
* This does not perform heuristic global text search and does not silently
|
|
307
|
+
* treat declaration anchors as name anchors (ADR 0003).
|
|
308
|
+
*/
|
|
309
|
+
export async function resolveAnchoredSymbolTarget(
|
|
310
|
+
file: string,
|
|
311
|
+
line: number,
|
|
312
|
+
character: number,
|
|
313
|
+
provider: AnchoredResolverProvider | null,
|
|
314
|
+
): Promise<TargetOutcome> {
|
|
315
|
+
if (!fs.existsSync(file)) {
|
|
316
|
+
return { kind: "error", message: `File not found: \`${file}\`` };
|
|
317
|
+
}
|
|
318
|
+
if (isBinaryFile(file)) {
|
|
319
|
+
return {
|
|
320
|
+
kind: "error",
|
|
321
|
+
message: `File type not supported for semantic analysis: \`${file}\`. Use \`code_find\` with \`mode: "text"\` for explicit text search.`,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const requested: Anchor = { line, character };
|
|
326
|
+
if (provider) {
|
|
327
|
+
const semantic = await resolveFromSemantic(file, requested, provider);
|
|
328
|
+
if (semantic) return semantic;
|
|
329
|
+
const structural = await resolveFromStructural(file, requested, provider);
|
|
330
|
+
if (structural) return structural;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return { kind: "error", message: coordinateNotOnSymbolMessage(file, line, character, null) };
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function coordinateNotOnSymbolMessage(
|
|
337
|
+
file: string,
|
|
338
|
+
line: number,
|
|
339
|
+
character: number,
|
|
340
|
+
detail: string | null,
|
|
341
|
+
): string {
|
|
342
|
+
const at = `${path.basename(file)}:${line}:${character}`;
|
|
343
|
+
const reason = detail ? ` (on \`${detail}\`)` : "";
|
|
344
|
+
return (
|
|
345
|
+
`**Error:** No symbol target resolved at \`${at}\`${reason}. ` +
|
|
346
|
+
"`code_resolve` resolves real symbol targets from provider-backed evidence; " +
|
|
347
|
+
"use `code_inspect` for point-level facts at this coordinate, or pass the identifier coordinate of a declaration."
|
|
348
|
+
);
|
|
349
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified target resolution facade through src/analysis/target/*.
|
|
3
|
+
*
|
|
4
|
+
* This is the canonical resolution path. It handles anchored coordinates,
|
|
5
|
+
* file-only, symbol discovery, and disambiguation cases through one path.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { SemanticProvider } from "@mrclrchtr/supi-code-runtime/api";
|
|
9
|
+
import { normalizePath } from "../search/ripgrep.ts";
|
|
10
|
+
import { resolveAnchoredSymbolTarget } from "./anchored.ts";
|
|
11
|
+
import { resolveFileTargetGroup as resolveFile } from "./file.ts";
|
|
12
|
+
import { normalizeQuery, type QueryInput } from "./query.ts";
|
|
13
|
+
import { resolveSymbolTarget as resolveSymbol } from "./symbol.ts";
|
|
14
|
+
import type {
|
|
15
|
+
NormalizedQuery,
|
|
16
|
+
ResolvedTargetData,
|
|
17
|
+
ResolvedTargetGroupData,
|
|
18
|
+
TargetOutcome,
|
|
19
|
+
} from "./types.ts";
|
|
20
|
+
|
|
21
|
+
export type { QueryInput } from "./query.ts";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a target from action params through one canonical path.
|
|
25
|
+
*
|
|
26
|
+
* Returns either a resolved target, a target group, or an error string.
|
|
27
|
+
*/
|
|
28
|
+
export async function resolveTarget(
|
|
29
|
+
params: QueryInput,
|
|
30
|
+
cwd: string,
|
|
31
|
+
semantic?: SemanticProvider,
|
|
32
|
+
): Promise<ResolvedTargetData | ResolvedTargetGroupData | string> {
|
|
33
|
+
const query = normalizeQuery(params);
|
|
34
|
+
|
|
35
|
+
switch (query.kind) {
|
|
36
|
+
case "anchored":
|
|
37
|
+
return resolveAnchoredCase(query, cwd, semantic);
|
|
38
|
+
|
|
39
|
+
case "file": {
|
|
40
|
+
const result = await resolveFile(query.file, cwd);
|
|
41
|
+
if (result.kind === "error") return result.message;
|
|
42
|
+
return result.group;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
case "symbol": {
|
|
46
|
+
if (!semantic) {
|
|
47
|
+
return "**Error:** Symbol discovery requires active LSP. Use `file` + coordinates, or enable LSP and retry.";
|
|
48
|
+
}
|
|
49
|
+
const outcome = await resolveSymbol(query.symbol, cwd, semantic, {
|
|
50
|
+
path: query.path,
|
|
51
|
+
kind: query.symbolKind,
|
|
52
|
+
exportedOnly: query.exportedOnly,
|
|
53
|
+
});
|
|
54
|
+
if (outcome.kind === "resolved") return outcome.target;
|
|
55
|
+
if (outcome.kind === "error") return outcome.message;
|
|
56
|
+
if (outcome.kind !== "disambiguation") {
|
|
57
|
+
return "**Error:** Unexpected resolution outcome.";
|
|
58
|
+
}
|
|
59
|
+
// Disambiguation — format candidates
|
|
60
|
+
return formatDisambiguation(query.symbol, outcome);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
case "invalid":
|
|
64
|
+
return `**Error:** ${query.reason}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Anchored case: route file + line + character through the same provider-backed
|
|
70
|
+
* symbol resolver as `code_resolve`/`code_orientation` (resolveAnchoredSymbolTarget),
|
|
71
|
+
* so `code_graph`/`code_impact` resolve real symbol targets (exact identifier
|
|
72
|
+
* hit or declaration-header snap) instead of anonymous point targets.
|
|
73
|
+
* Per ADR 0003 — no silent `name:null` point targets.
|
|
74
|
+
*/
|
|
75
|
+
async function resolveAnchoredCase(
|
|
76
|
+
query: Extract<NormalizedQuery, { kind: "anchored" }>,
|
|
77
|
+
cwd: string,
|
|
78
|
+
semantic: SemanticProvider | undefined,
|
|
79
|
+
): Promise<ResolvedTargetData | string> {
|
|
80
|
+
const resolvedFile = normalizePath(query.file, cwd);
|
|
81
|
+
const result = await resolveAnchoredSymbolTarget(
|
|
82
|
+
resolvedFile,
|
|
83
|
+
query.line,
|
|
84
|
+
query.character,
|
|
85
|
+
semantic ?? null,
|
|
86
|
+
);
|
|
87
|
+
if (result.kind === "error") return result.message;
|
|
88
|
+
if (result.kind === "resolved") return result.target;
|
|
89
|
+
if (result.kind === "disambiguation") {
|
|
90
|
+
return formatAnchoredDisambiguation(query.file, query.line, query.character, result);
|
|
91
|
+
}
|
|
92
|
+
return "**Error:** Unexpected resolution outcome.";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function formatDisambiguation(
|
|
96
|
+
symbol: string,
|
|
97
|
+
result: Extract<TargetOutcome, { kind: "disambiguation" }>,
|
|
98
|
+
): string {
|
|
99
|
+
const lines: string[] = [];
|
|
100
|
+
lines.push(`# Disambiguation needed for \`${symbol}\``);
|
|
101
|
+
lines.push("");
|
|
102
|
+
const omitNote = result.omittedCount > 0 ? ` (+${result.omittedCount} more)` : "";
|
|
103
|
+
lines.push(
|
|
104
|
+
`Found ${result.candidates.length} candidates${omitNote}. Rerun with anchored coordinates:`,
|
|
105
|
+
);
|
|
106
|
+
lines.push("");
|
|
107
|
+
|
|
108
|
+
for (const c of result.candidates) {
|
|
109
|
+
const kind = c.kind ? ` (${c.kind})` : "";
|
|
110
|
+
const container = c.container ? ` in ${c.container}` : "";
|
|
111
|
+
lines.push(
|
|
112
|
+
`${c.rank}. **${c.name}**${kind}${container} — \`${c.file}\`:${c.line}:${c.character}`,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
lines.push("");
|
|
117
|
+
if (result.candidates.length > 0) {
|
|
118
|
+
const first = result.candidates[0];
|
|
119
|
+
lines.push(
|
|
120
|
+
`Example: rerun with \`file: "${first.file}"\`, \`line: ${first.line}\`, and \`character: ${first.character}\`.`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return lines.join("\n");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Format anchored-coordinate disambiguation (multiple symbols match one coordinate). */
|
|
128
|
+
function formatAnchoredDisambiguation(
|
|
129
|
+
file: string,
|
|
130
|
+
line: number,
|
|
131
|
+
character: number,
|
|
132
|
+
result: Extract<TargetOutcome, { kind: "disambiguation" }>,
|
|
133
|
+
): string {
|
|
134
|
+
const lines: string[] = [];
|
|
135
|
+
lines.push(`# Disambiguation needed at \`${file}:${line}:${character}\``);
|
|
136
|
+
lines.push("");
|
|
137
|
+
const omitNote = result.omittedCount > 0 ? ` (+${result.omittedCount} more)` : "";
|
|
138
|
+
lines.push(
|
|
139
|
+
`Found ${result.candidates.length} symbol candidates at this coordinate${omitNote}. Use \`code_resolve\` to pick one:`,
|
|
140
|
+
);
|
|
141
|
+
lines.push("");
|
|
142
|
+
|
|
143
|
+
for (const c of result.candidates) {
|
|
144
|
+
const kind = c.kind ? ` (${c.kind})` : "";
|
|
145
|
+
const container = c.container ? ` in ${c.container}` : "";
|
|
146
|
+
lines.push(
|
|
147
|
+
`${c.rank}. **${c.name}**${kind}${container} — \`${c.file}\`:${c.line}:${c.character}`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return lines.join("\n");
|
|
152
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-level resolution logic for code_resolve.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from resolve/service.ts. Handles file-only resolution and
|
|
5
|
+
* path-like query resolution for the code_resolve tool.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { resolve } from "node:path";
|
|
10
|
+
import type { WorkspaceCodeIntelligenceSession } from "../../session/session.ts";
|
|
11
|
+
import type { CodeProvider } from "../provider.ts";
|
|
12
|
+
import { normalizePath } from "../search/ripgrep.ts";
|
|
13
|
+
import { resolveFileTargetGroup as resolveFile } from "./file.ts";
|
|
14
|
+
import {
|
|
15
|
+
type ResolveServiceParams,
|
|
16
|
+
type ResolveServiceResult,
|
|
17
|
+
registerFromTarget,
|
|
18
|
+
} from "./resolve-common.ts";
|
|
19
|
+
|
|
20
|
+
/** Resolve file-only (no coordinates) input. */
|
|
21
|
+
export async function resolveFileOnlyInput(
|
|
22
|
+
params: ResolveServiceParams,
|
|
23
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
24
|
+
maxResults: number,
|
|
25
|
+
provider: CodeProvider | null,
|
|
26
|
+
): Promise<ResolveServiceResult> {
|
|
27
|
+
const cwd = session.cwd;
|
|
28
|
+
const file = params.file;
|
|
29
|
+
if (!file) {
|
|
30
|
+
return { kind: "error", message: "**Error:** File required for file-level resolution." };
|
|
31
|
+
}
|
|
32
|
+
const resolvedFile = normalizePath(file, cwd);
|
|
33
|
+
if (!existsSync(resolvedFile)) {
|
|
34
|
+
return { kind: "error", message: `**Error:** File not found: \`${file}\`` };
|
|
35
|
+
}
|
|
36
|
+
const outcome = await resolveFile(file, cwd, {
|
|
37
|
+
semantic: provider ?? undefined,
|
|
38
|
+
structural: provider ?? undefined,
|
|
39
|
+
});
|
|
40
|
+
if (outcome.kind === "error") {
|
|
41
|
+
return { kind: "error", message: outcome.message };
|
|
42
|
+
}
|
|
43
|
+
const targets = outcome.group.targets
|
|
44
|
+
.slice(0, maxResults)
|
|
45
|
+
.map((t) =>
|
|
46
|
+
registerFromTarget({ ...t, position: t.position, confidence: t.confidence }, session, "file"),
|
|
47
|
+
);
|
|
48
|
+
return {
|
|
49
|
+
kind: "resolved",
|
|
50
|
+
targets,
|
|
51
|
+
confidence: outcome.group.confidence,
|
|
52
|
+
omittedCount: Math.max(0, outcome.group.targets.length - maxResults),
|
|
53
|
+
nextQueries: [
|
|
54
|
+
"Use `targetId` with `code_graph` for reference tracking",
|
|
55
|
+
"Use `targetId` with `code_impact` for blast radius",
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Handle a path-like query with kind: "file". */
|
|
61
|
+
export async function resolvePathQuery(
|
|
62
|
+
query: string,
|
|
63
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
64
|
+
maxResults: number,
|
|
65
|
+
provider: CodeProvider | null,
|
|
66
|
+
): Promise<ResolveServiceResult | null> {
|
|
67
|
+
const cwd = session.cwd;
|
|
68
|
+
const candidatePath = resolvePathLikeQuery(query, cwd);
|
|
69
|
+
if (!candidatePath) return null;
|
|
70
|
+
const outcome = await resolveFile(candidatePath, cwd, {
|
|
71
|
+
semantic: provider ?? undefined,
|
|
72
|
+
structural: provider ?? undefined,
|
|
73
|
+
});
|
|
74
|
+
if (outcome.kind === "error") return null;
|
|
75
|
+
const targets = outcome.group.targets
|
|
76
|
+
.slice(0, maxResults)
|
|
77
|
+
.map((t) =>
|
|
78
|
+
registerFromTarget({ ...t, position: t.position, confidence: t.confidence }, session, "file"),
|
|
79
|
+
);
|
|
80
|
+
return {
|
|
81
|
+
kind: "resolved",
|
|
82
|
+
targets,
|
|
83
|
+
confidence: outcome.group.confidence,
|
|
84
|
+
omittedCount: Math.max(0, outcome.group.targets.length - maxResults),
|
|
85
|
+
nextQueries: [
|
|
86
|
+
"Use `targetId` with `code_graph` for reference tracking",
|
|
87
|
+
"Use `targetId` with `code_impact` for blast radius",
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Attempt file-level resolution when query looks like a file path. */
|
|
93
|
+
export async function tryPathLikeQuery(
|
|
94
|
+
params: ResolveServiceParams,
|
|
95
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
96
|
+
maxResults: number,
|
|
97
|
+
provider: CodeProvider | null,
|
|
98
|
+
): Promise<ResolveServiceResult | null> {
|
|
99
|
+
if (params.kind !== "file" && params.kind !== "File") return null;
|
|
100
|
+
const query = params.query;
|
|
101
|
+
if (!query || !isPathLike(query)) return null;
|
|
102
|
+
return resolvePathQuery(query, session, maxResults, provider);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function isPathLike(query: string): boolean {
|
|
106
|
+
return (
|
|
107
|
+
query.includes("/") || query.includes("\\") || query.endsWith(".ts") || query.endsWith(".js")
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Attempt to resolve a path-like query string to an absolute file path.
|
|
113
|
+
* Returns null if the path cannot be resolved to an existing file.
|
|
114
|
+
*/
|
|
115
|
+
export function resolvePathLikeQuery(query: string, cwd: string): string | null {
|
|
116
|
+
const candidate = resolve(cwd, query);
|
|
117
|
+
if (existsSync(candidate)) {
|
|
118
|
+
return candidate;
|
|
119
|
+
}
|
|
120
|
+
for (const ext of [".ts", ".tsx", ".js", ".jsx", ".json", ".md"]) {
|
|
121
|
+
const withExt = candidate + ext;
|
|
122
|
+
if (existsSync(withExt)) return withExt;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|