@mrclrchtr/supi-code-intelligence 1.16.0 → 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/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.d.ts +21 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.d.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +1 -1
- 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
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
import * as fs from "node:fs";
|
|
11
11
|
import * as path from "node:path";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import type {
|
|
13
|
+
SemanticProvider as SemanticSubstrate,
|
|
14
|
+
StructuralProvider as StructuralSubstrate,
|
|
15
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
16
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
17
|
+
import { highestConfidence } from "../helpers.ts";
|
|
18
|
+
import { getCodeProvider } from "../provider.ts";
|
|
19
|
+
import { normalizePath } from "../search/ripgrep.ts";
|
|
16
20
|
import type { ResolvedTargetData, ResolvedTargetGroupData } from "./types.ts";
|
|
17
21
|
|
|
18
22
|
const BINARY_EXTENSIONS = new Set([
|
|
@@ -73,7 +77,7 @@ export async function resolveFileTargetGroup(
|
|
|
73
77
|
if (isBinaryFile(resolvedFile)) {
|
|
74
78
|
return {
|
|
75
79
|
kind: "error",
|
|
76
|
-
message: `File type not supported for semantic analysis: \`${file}\`. Use \`
|
|
80
|
+
message: `File type not supported for semantic analysis: \`${file}\`. Use \`code_find\` with \`mode: "text"\` for explicit text search.`,
|
|
77
81
|
};
|
|
78
82
|
}
|
|
79
83
|
|
|
@@ -122,25 +126,37 @@ async function resolveViaSemantic(
|
|
|
122
126
|
|
|
123
127
|
const topLevel = symbols
|
|
124
128
|
.filter((s) => !s.container)
|
|
125
|
-
.map((s) =>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
.map((s) => {
|
|
130
|
+
const a = s.nameAnchor ?? s.declarationAnchor;
|
|
131
|
+
return {
|
|
132
|
+
file: resolvedFile,
|
|
133
|
+
position: { line: a.line - 1, character: a.character - 1 },
|
|
134
|
+
displayLine: a.line,
|
|
135
|
+
displayCharacter: a.character,
|
|
136
|
+
name: s.name,
|
|
137
|
+
kind: s.kind,
|
|
138
|
+
confidence: "semantic" as const,
|
|
139
|
+
anchorKind: (s.nameAnchor ? "name" : "declaration") as AnchorKind,
|
|
140
|
+
container: s.container ?? null,
|
|
141
|
+
};
|
|
142
|
+
});
|
|
134
143
|
|
|
135
144
|
if (topLevel.length === 0) return structuralTargets;
|
|
136
|
-
if (!structuralTargets || structuralTargets.length === 0) return dedupeTargets(topLevel);
|
|
137
145
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
// Semantic symbols are available — prefer them over structural exports.
|
|
147
|
+
// Only fall back to structural targets that have no semantic counterpart
|
|
148
|
+
// (different position).
|
|
149
|
+
if (!structuralTargets || structuralTargets.length === 0) return dedupeTargets(topLevel);
|
|
142
150
|
|
|
143
|
-
|
|
151
|
+
// Build a position-based dedup: for each position, prefer the semantic entry.
|
|
152
|
+
const byPos = new Map<string, ResolvedTargetData>();
|
|
153
|
+
for (const t of structuralTargets) {
|
|
154
|
+
byPos.set(`${t.position.line}:${t.position.character}`, t);
|
|
155
|
+
}
|
|
156
|
+
for (const t of topLevel) {
|
|
157
|
+
byPos.set(`${t.position.line}:${t.position.character}`, t);
|
|
158
|
+
}
|
|
159
|
+
return [...byPos.values()];
|
|
144
160
|
} catch {
|
|
145
161
|
return structuralTargets;
|
|
146
162
|
}
|
|
@@ -169,6 +185,10 @@ async function resolveViaStructral(
|
|
|
169
185
|
name: record.name,
|
|
170
186
|
kind: record.kind,
|
|
171
187
|
confidence: "structural" as const,
|
|
188
|
+
// Structural exports use the node start (startLine/startCharacter) =
|
|
189
|
+
// declaration anchor; no name anchor is derivable from exports alone.
|
|
190
|
+
anchorKind: "declaration",
|
|
191
|
+
container: null,
|
|
172
192
|
})),
|
|
173
193
|
);
|
|
174
194
|
} catch {
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* routing decisions for each tool intent. Keeps the execution strategy
|
|
6
6
|
* explicit and centralized instead of scattering capability checks
|
|
7
7
|
* across per-tool execute files.
|
|
8
|
+
*
|
|
9
|
+
* This is the canonical planner — src/planner/planner.ts becomes a
|
|
10
|
+
* thin forwarder to here.
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
13
|
import { getDefaultWorkspaceRuntime } from "@mrclrchtr/supi-code-runtime/api";
|
|
11
|
-
import type { PlannerRoute } from "
|
|
12
|
-
import type { CodeIntelligenceToolName, CodeRelationsKind } from "../tool/tool-specs.ts";
|
|
14
|
+
import type { CodeIntelligenceToolName, PlannerRoute } from "../../types/index.ts";
|
|
13
15
|
|
|
14
16
|
interface RouteAvailability {
|
|
15
17
|
semanticAvailable: boolean;
|
|
@@ -22,7 +24,8 @@ function readAvailability(cwd: string): RouteAvailability {
|
|
|
22
24
|
const workspace = runtime.getWorkspace(cwd);
|
|
23
25
|
return {
|
|
24
26
|
semanticAvailable:
|
|
25
|
-
workspace.semantic.state.kind === "ready"
|
|
27
|
+
(workspace.semantic.state.kind === "ready" || workspace.semantic.state.kind === "pending") &&
|
|
28
|
+
workspace.semantic.provider !== null,
|
|
26
29
|
structuralAvailable:
|
|
27
30
|
workspace.structural.state.kind === "ready" && workspace.structural.provider !== null,
|
|
28
31
|
refactorAvailable: workspace.semantic.refactorAvailable,
|
|
@@ -40,10 +43,6 @@ function semanticOnly(availability: RouteAvailability): PlannerRoute["preferred"
|
|
|
40
43
|
return availability.semanticAvailable ? "semantic" : "unavailable";
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
function structuralOnly(availability: RouteAvailability): PlannerRoute["preferred"] {
|
|
44
|
-
return availability.structuralAvailable ? "structural" : "unavailable";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
46
|
function briefPreferred(availability: RouteAvailability): PlannerRoute["preferred"] {
|
|
48
47
|
if (availability.semanticAvailable) return "semantic";
|
|
49
48
|
if (availability.structuralAvailable) return "structural";
|
|
@@ -53,30 +52,41 @@ function briefPreferred(availability: RouteAvailability): PlannerRoute["preferre
|
|
|
53
52
|
/**
|
|
54
53
|
* Get the routing decision for a tool intent in a workspace.
|
|
55
54
|
*/
|
|
56
|
-
export function routeFor(
|
|
57
|
-
cwd: string,
|
|
58
|
-
tool: CodeIntelligenceToolName,
|
|
59
|
-
relationsKind?: CodeRelationsKind,
|
|
60
|
-
): PlannerRoute {
|
|
55
|
+
export function routeFor(cwd: string, tool: CodeIntelligenceToolName): PlannerRoute {
|
|
61
56
|
const availability = readAvailability(cwd);
|
|
62
57
|
|
|
63
|
-
if (tool === "
|
|
64
|
-
|
|
58
|
+
if (tool === "code_graph") {
|
|
59
|
+
// code_graph dispatches per-relation at execution time. Return the best
|
|
60
|
+
// available preference; the executor handles per-relation unavailability.
|
|
61
|
+
if (availability.semanticAvailable) return withPreferred(availability, "semantic");
|
|
62
|
+
if (availability.structuralAvailable) return withPreferred(availability, "structural");
|
|
63
|
+
return withPreferred(availability, "unavailable");
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
if (tool === "
|
|
68
|
-
|
|
69
|
-
relationsKind === "callees" ? structuralOnly(availability) : semanticOnly(availability);
|
|
70
|
-
return withPreferred(availability, preferred);
|
|
66
|
+
if (tool === "code_orientation" || tool === "code_inspect") {
|
|
67
|
+
return withPreferred(availability, briefPreferred(availability));
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
if (tool === "
|
|
70
|
+
if (tool === "code_impact") {
|
|
74
71
|
return withPreferred(availability, semanticOnly(availability));
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
if (tool === "
|
|
74
|
+
if (tool === "code_refactor_plan") {
|
|
78
75
|
return withPreferred(availability, availability.refactorAvailable ? "semantic" : "unavailable");
|
|
79
76
|
}
|
|
80
77
|
|
|
78
|
+
if (tool === "code_refactor_apply") {
|
|
79
|
+
// Plan application does not require a live semantic provider — validity
|
|
80
|
+
// is enforced through fingerprint comparison in the executor.
|
|
81
|
+
// Return semantic-preferred so the route check never blocks valid plans.
|
|
82
|
+
return withPreferred(availability, "semantic");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (tool === "code_health") {
|
|
86
|
+
// code_health reads diagnostics and server state from the LSP service
|
|
87
|
+
// directly; it does not require live semantic/structural providers.
|
|
88
|
+
return withPreferred(availability, "search");
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
return withPreferred(availability, briefPreferred(availability));
|
|
82
92
|
}
|
|
@@ -24,9 +24,10 @@ export interface QueryInput {
|
|
|
24
24
|
*
|
|
25
25
|
* Priority order:
|
|
26
26
|
* 1. anchored: file + line + character
|
|
27
|
-
* 2.
|
|
28
|
-
* 3.
|
|
29
|
-
* 4.
|
|
27
|
+
* 2. scoped symbol: file + symbol (without coordinates) — uses file as path scope for symbol discovery
|
|
28
|
+
* 3. file: file without coordinates or symbol
|
|
29
|
+
* 4. symbol: symbol without file
|
|
30
|
+
* 5. invalid: neither file nor symbol
|
|
30
31
|
*/
|
|
31
32
|
export function normalizeQuery(input: QueryInput): NormalizedQuery {
|
|
32
33
|
if (input.file && input.line != null && input.character != null) {
|
|
@@ -38,6 +39,19 @@ export function normalizeQuery(input: QueryInput): NormalizedQuery {
|
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
// Scoped symbol: both file and symbol present, no line/character.
|
|
43
|
+
// The file acts as a path scope for symbol discovery — resolves to a
|
|
44
|
+
// precise target within that file rather than a file-level group.
|
|
45
|
+
if (input.file && input.symbol) {
|
|
46
|
+
return {
|
|
47
|
+
kind: "symbol",
|
|
48
|
+
symbol: input.symbol,
|
|
49
|
+
path: input.file,
|
|
50
|
+
symbolKind: input.kind,
|
|
51
|
+
exportedOnly: input.exportedOnly,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
if (input.file) {
|
|
42
56
|
return { kind: "file", file: input.file };
|
|
43
57
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared code_resolve result contracts and registration helpers.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from service.ts and file-resolution.ts so file-level
|
|
5
|
+
* resolution can reuse the public resolve result shape without importing the
|
|
6
|
+
* service implementation back, avoiding a runtime import cycle.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { resolve } from "node:path";
|
|
10
|
+
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
11
|
+
import type { WorkspaceCodeIntelligenceSession } from "../../session/session.ts";
|
|
12
|
+
import type { TargetRegistrationInput, TargetStoreEntry } from "../../session/target-store.ts";
|
|
13
|
+
import type { DisambiguationCandidateData } from "./types.ts";
|
|
14
|
+
|
|
15
|
+
export interface ResolveServiceParams {
|
|
16
|
+
query?: string;
|
|
17
|
+
scope?: string;
|
|
18
|
+
kind?: string;
|
|
19
|
+
file?: string;
|
|
20
|
+
line?: number;
|
|
21
|
+
character?: number;
|
|
22
|
+
maxResults?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A disambiguation candidate with a registered target handle.
|
|
27
|
+
*
|
|
28
|
+
* Composes {@link DisambiguationCandidateData} with the stored
|
|
29
|
+
* {@link TargetStoreEntry} so renderers get both candidate metadata and stable
|
|
30
|
+
* handles.
|
|
31
|
+
*/
|
|
32
|
+
export interface DisambiguationCandidate extends DisambiguationCandidateData {
|
|
33
|
+
targetId: string;
|
|
34
|
+
/** Full stored entry for tool details. */
|
|
35
|
+
entry: TargetStoreEntry;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ResolveServiceResult =
|
|
39
|
+
| {
|
|
40
|
+
kind: "resolved";
|
|
41
|
+
/** Registered target entries from the session store (absolute paths). */
|
|
42
|
+
targets: TargetStoreEntry[];
|
|
43
|
+
confidence: ConfidenceMode;
|
|
44
|
+
omittedCount: number;
|
|
45
|
+
nextQueries: string[];
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
kind: "disambiguation";
|
|
49
|
+
candidates: DisambiguationCandidate[];
|
|
50
|
+
omittedCount: number;
|
|
51
|
+
nextQueries: string[];
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
kind: "error";
|
|
55
|
+
message: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Register a single resolved target from the targeting pipeline into the
|
|
60
|
+
* workflow target store and return the full stored entry.
|
|
61
|
+
*/
|
|
62
|
+
export function registerFromTarget(
|
|
63
|
+
target: {
|
|
64
|
+
file: string;
|
|
65
|
+
position: { line: number; character: number };
|
|
66
|
+
displayLine: number;
|
|
67
|
+
displayCharacter: number;
|
|
68
|
+
name: string | null;
|
|
69
|
+
kind: string | null;
|
|
70
|
+
confidence: string;
|
|
71
|
+
anchorKind: TargetStoreEntry["anchorKind"];
|
|
72
|
+
container: string | null;
|
|
73
|
+
resolution?: import("../../types/index.ts").AnchoredResolutionMetadata;
|
|
74
|
+
},
|
|
75
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
76
|
+
provenance: string,
|
|
77
|
+
): TargetStoreEntry {
|
|
78
|
+
const input: TargetRegistrationInput = {
|
|
79
|
+
file: target.file,
|
|
80
|
+
position: target.position,
|
|
81
|
+
displayLine: target.displayLine,
|
|
82
|
+
displayCharacter: target.displayCharacter,
|
|
83
|
+
name: target.name,
|
|
84
|
+
kind: target.kind,
|
|
85
|
+
confidence: target.confidence as ConfidenceMode,
|
|
86
|
+
provenance,
|
|
87
|
+
anchorKind: target.anchorKind,
|
|
88
|
+
container: target.container,
|
|
89
|
+
resolution: target.resolution,
|
|
90
|
+
};
|
|
91
|
+
const { entry } = session.registerTarget(input);
|
|
92
|
+
return entry;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Register a disambiguation candidate in the target store and return it with handles. */
|
|
96
|
+
export function registerCandidate(
|
|
97
|
+
c: DisambiguationCandidateData,
|
|
98
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
99
|
+
): DisambiguationCandidate {
|
|
100
|
+
const cwd = session.cwd;
|
|
101
|
+
const input: TargetRegistrationInput = {
|
|
102
|
+
file: resolve(cwd, c.file),
|
|
103
|
+
position: { line: c.line - 1, character: c.character - 1 },
|
|
104
|
+
displayLine: c.line,
|
|
105
|
+
displayCharacter: c.character,
|
|
106
|
+
name: c.name,
|
|
107
|
+
kind: c.kind,
|
|
108
|
+
confidence: "semantic" as ConfidenceMode,
|
|
109
|
+
provenance: "disambiguation",
|
|
110
|
+
anchorKind: c.anchorKind,
|
|
111
|
+
container: c.container,
|
|
112
|
+
};
|
|
113
|
+
const { targetId, entry } = session.registerTarget(input);
|
|
114
|
+
return { ...c, targetId, entry };
|
|
115
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* code_resolve business logic.
|
|
3
|
+
*
|
|
4
|
+
* Normalizes code_resolve params (query, scope, kind, file, line, character)
|
|
5
|
+
* into the existing targeting pipeline, registers resolved targets in the
|
|
6
|
+
* target store, and returns a typed intermediate result that the tool
|
|
7
|
+
* executor renders into markdown + details.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import type { WorkspaceCodeIntelligenceSession } from "../../session/session.ts";
|
|
11
|
+
import type { CodeProvider } from "../provider.ts";
|
|
12
|
+
import { getCodeProviderState } from "../provider.ts";
|
|
13
|
+
import { normalizePath } from "../search/ripgrep.ts";
|
|
14
|
+
import { resolveAnchoredSymbolTarget } from "./anchored.ts";
|
|
15
|
+
import { resolveFileOnlyInput, tryPathLikeQuery } from "./file-resolution.ts";
|
|
16
|
+
import {
|
|
17
|
+
type ResolveServiceParams,
|
|
18
|
+
type ResolveServiceResult,
|
|
19
|
+
registerCandidate,
|
|
20
|
+
registerFromTarget,
|
|
21
|
+
} from "./resolve-common.ts";
|
|
22
|
+
import { resolveSymbolTarget as resolveSymbol } from "./symbol.ts";
|
|
23
|
+
import type { TargetOutcome } from "./types.ts";
|
|
24
|
+
|
|
25
|
+
export type {
|
|
26
|
+
DisambiguationCandidate,
|
|
27
|
+
ResolveServiceParams,
|
|
28
|
+
ResolveServiceResult,
|
|
29
|
+
} from "./resolve-common.ts";
|
|
30
|
+
|
|
31
|
+
// ── Validation ────────────────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Cross-field validation for code_resolve params — defense-in-depth.
|
|
35
|
+
*
|
|
36
|
+
* The tool executor pipeline already validates via
|
|
37
|
+
* {@link ../../tool/infra/cross-field.ts!resolveCrossFieldRules}, which is the
|
|
38
|
+
* canonical source of these rules for tool-level use. This copy exists so
|
|
39
|
+
* the resolve service validates its own inputs when called outside the
|
|
40
|
+
* pipeline (e.g. from code_orientation's coordinate resolution).
|
|
41
|
+
*
|
|
42
|
+
* TypeBox (via pi schema validation) already enforces:
|
|
43
|
+
* - kind must be a valid StringEnum value
|
|
44
|
+
* - line/character must be numbers >= 1
|
|
45
|
+
* - additionalProperties: false
|
|
46
|
+
*/
|
|
47
|
+
export function validateResolveParams(params: ResolveServiceParams): string | null {
|
|
48
|
+
const hasQuery = params.query !== undefined && params.query.length > 0;
|
|
49
|
+
const hasFile = params.file !== undefined && params.file.length > 0;
|
|
50
|
+
const hasLine = params.line !== undefined;
|
|
51
|
+
const hasCharacter = params.character !== undefined;
|
|
52
|
+
if (!hasQuery && !hasFile) {
|
|
53
|
+
return "**Error:** `code_resolve` requires either `query` (for symbol/search resolution) or `file` (for anchored/file-level resolution).";
|
|
54
|
+
}
|
|
55
|
+
if (hasLine !== hasCharacter) {
|
|
56
|
+
return "**Error:** `line` and `character` must be provided together.";
|
|
57
|
+
}
|
|
58
|
+
if ((hasLine || hasCharacter) && !hasFile) {
|
|
59
|
+
return "**Error:** `line` and `character` require `file`.";
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ── Resolver sub-routines ─────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
/** Resolve anchored (file + line + character) input via provider-backed symbol resolution. */
|
|
67
|
+
async function resolveAnchoredInput(
|
|
68
|
+
params: ResolveServiceParams,
|
|
69
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
70
|
+
_maxResults: number,
|
|
71
|
+
provider: CodeProvider | null,
|
|
72
|
+
): Promise<ResolveServiceResult> {
|
|
73
|
+
const cwd = session.cwd;
|
|
74
|
+
const file = params.file;
|
|
75
|
+
const line = params.line;
|
|
76
|
+
const character = params.character;
|
|
77
|
+
if (!file) {
|
|
78
|
+
return { kind: "error", message: "**Error:** File required for anchored resolution." };
|
|
79
|
+
}
|
|
80
|
+
if (line == null || character == null) {
|
|
81
|
+
return {
|
|
82
|
+
kind: "error",
|
|
83
|
+
message: "**Error:** Line and character required for anchored resolution.",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const resolvedFile = normalizePath(file, cwd);
|
|
87
|
+
if (!existsSync(resolvedFile)) {
|
|
88
|
+
return { kind: "error", message: `**Error:** File not found: \`${file}\`` };
|
|
89
|
+
}
|
|
90
|
+
const outcome = await resolveAnchoredSymbolTarget(resolvedFile, line, character, provider);
|
|
91
|
+
if (outcome.kind === "error") {
|
|
92
|
+
return { kind: "error", message: outcome.message };
|
|
93
|
+
}
|
|
94
|
+
if (outcome.kind === "resolved") {
|
|
95
|
+
const entry = registerFromTarget(outcome.target, session, "anchored");
|
|
96
|
+
return {
|
|
97
|
+
kind: "resolved",
|
|
98
|
+
targets: [entry],
|
|
99
|
+
confidence: entry.confidence,
|
|
100
|
+
omittedCount: 0,
|
|
101
|
+
nextQueries: [
|
|
102
|
+
"`code_graph` for usages of this target",
|
|
103
|
+
'`code_graph` with `relations: ["callees"]` for direct structural calls from this target',
|
|
104
|
+
"`code_impact` for blast radius",
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// Disambiguation — register each candidate and surface targetIds.
|
|
109
|
+
const disambig = outcome as Extract<TargetOutcome, { kind: "disambiguation" }>;
|
|
110
|
+
const candidates = disambig.candidates.map((c) => registerCandidate(c, session));
|
|
111
|
+
return {
|
|
112
|
+
kind: "disambiguation",
|
|
113
|
+
candidates,
|
|
114
|
+
omittedCount: disambig.omittedCount,
|
|
115
|
+
nextQueries: [
|
|
116
|
+
"Use `file` + `line` + `character` for one of the candidates above (pass the identifier coordinate)",
|
|
117
|
+
"Or refine with `query` + `scope` or `kind` filters",
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Resolve query/symbol input via semantic workspace symbols. */
|
|
123
|
+
async function resolveQueryTarget(opts: {
|
|
124
|
+
query: string;
|
|
125
|
+
kind: string | undefined;
|
|
126
|
+
scope: string | undefined;
|
|
127
|
+
session: WorkspaceCodeIntelligenceSession;
|
|
128
|
+
provider: CodeProvider;
|
|
129
|
+
maxResults: number;
|
|
130
|
+
}): Promise<ResolveServiceResult> {
|
|
131
|
+
const { query, kind, scope, session, provider, maxResults } = opts;
|
|
132
|
+
const cwd = session.cwd;
|
|
133
|
+
|
|
134
|
+
const scopePath = scope ? normalizePath(scope, cwd) : undefined;
|
|
135
|
+
const symbolKind = kind !== undefined && kind !== "symbol" ? kind : undefined;
|
|
136
|
+
const exportedOnly = kind === "export" ? true : undefined;
|
|
137
|
+
|
|
138
|
+
const outcome = await resolveSymbol(query, cwd, provider, {
|
|
139
|
+
path: scopePath,
|
|
140
|
+
kind: symbolKind,
|
|
141
|
+
exportedOnly,
|
|
142
|
+
maxResults,
|
|
143
|
+
});
|
|
144
|
+
if (outcome.kind === "error") {
|
|
145
|
+
return { kind: "error", message: outcome.message };
|
|
146
|
+
}
|
|
147
|
+
if (outcome.kind === "resolved") {
|
|
148
|
+
const entry = registerFromTarget(outcome.target, session, "symbol");
|
|
149
|
+
return {
|
|
150
|
+
kind: "resolved",
|
|
151
|
+
targets: [entry],
|
|
152
|
+
confidence: entry.confidence,
|
|
153
|
+
omittedCount: 0,
|
|
154
|
+
nextQueries: [
|
|
155
|
+
"`code_graph` for usages of this target",
|
|
156
|
+
'`code_graph` with `relations: ["callees"]` for direct structural calls from this target',
|
|
157
|
+
"`code_impact` for blast radius",
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
// resolveSymbol never returns "group", so only disambiguation remains
|
|
162
|
+
const disambig = outcome as Extract<TargetOutcome, { kind: "disambiguation" }>;
|
|
163
|
+
const candidates = disambig.candidates.map((c) => registerCandidate(c, session));
|
|
164
|
+
return {
|
|
165
|
+
kind: "disambiguation",
|
|
166
|
+
candidates,
|
|
167
|
+
omittedCount: disambig.omittedCount,
|
|
168
|
+
nextQueries: [
|
|
169
|
+
"Use `file` + `line` + `character` for one of the candidates above",
|
|
170
|
+
"Or refine the query with `scope` or `kind` filters",
|
|
171
|
+
],
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// ── Main entry ────────────────────────────────────────────────────────
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Execute the code_resolve service.
|
|
179
|
+
*
|
|
180
|
+
* Returns a structured intermediate result (resolved, disambiguation, or error)
|
|
181
|
+
* that the tool executor renders into user-facing markdown + details.
|
|
182
|
+
*/
|
|
183
|
+
export async function executeResolveService(
|
|
184
|
+
params: ResolveServiceParams,
|
|
185
|
+
session: WorkspaceCodeIntelligenceSession,
|
|
186
|
+
): Promise<ResolveServiceResult> {
|
|
187
|
+
const cwd = session.cwd;
|
|
188
|
+
const validationError = validateResolveParams(params);
|
|
189
|
+
if (validationError) {
|
|
190
|
+
return { kind: "error", message: validationError };
|
|
191
|
+
}
|
|
192
|
+
const providerState = getCodeProviderState(cwd);
|
|
193
|
+
const provider = providerState.kind === "ready" ? providerState.provider : null;
|
|
194
|
+
const maxResults = params.maxResults ?? 10;
|
|
195
|
+
// Anchored resolution
|
|
196
|
+
if (params.file && params.line != null && params.character != null) {
|
|
197
|
+
return resolveAnchoredInput(params, session, maxResults, provider);
|
|
198
|
+
}
|
|
199
|
+
// File-only resolution
|
|
200
|
+
if (params.file && !params.query) {
|
|
201
|
+
return resolveFileOnlyInput(params, session, maxResults, provider);
|
|
202
|
+
}
|
|
203
|
+
// Query resolution
|
|
204
|
+
if (!params.query) {
|
|
205
|
+
return {
|
|
206
|
+
kind: "error",
|
|
207
|
+
message: "**Error:** Provide a `query` or `file` for resolution.",
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
// Special case: path-like query with kind file
|
|
211
|
+
const pathResult = await tryPathLikeQuery(params, session, maxResults, provider);
|
|
212
|
+
if (pathResult) return pathResult;
|
|
213
|
+
// Standard symbol resolution requires semantic provider
|
|
214
|
+
if (provider === null) {
|
|
215
|
+
return {
|
|
216
|
+
kind: "error",
|
|
217
|
+
message:
|
|
218
|
+
"**Error:** Symbol query requires active LSP. Use anchored coordinates (file + line + character) or a file-only query.",
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return resolveQueryTarget({
|
|
222
|
+
query: params.query,
|
|
223
|
+
kind: params.kind,
|
|
224
|
+
scope: params.scope,
|
|
225
|
+
session,
|
|
226
|
+
provider,
|
|
227
|
+
maxResults,
|
|
228
|
+
});
|
|
229
|
+
}
|