@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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Symbol target resolution — discovers symbols via the semantic substrate
|
|
3
|
+
* and returns typed outcomes (resolved, disambiguation, or error).
|
|
4
|
+
*
|
|
5
|
+
* This resolver is semantic-only: it does not fall back to text search
|
|
6
|
+
* or heuristic guessing. Ambiguous matches produce explicit disambiguation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import type {
|
|
11
|
+
CodeSymbol,
|
|
12
|
+
SemanticProvider as SemanticSubstrate,
|
|
13
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
14
|
+
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
15
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
16
|
+
import { normalizePath } from "../search/ripgrep.ts";
|
|
17
|
+
import type { DisambiguationCandidateData, TargetOutcome } from "./types.ts";
|
|
18
|
+
|
|
19
|
+
const MAX_CANDIDATES = 8; // default fallback when maxResults is not provided
|
|
20
|
+
const NON_EXPORTED_KINDS = new Set(["Variable", "Field", "Property"]);
|
|
21
|
+
|
|
22
|
+
function normalizeContainer(container: string | null | undefined): string | null {
|
|
23
|
+
return container ?? null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function isExactDocumentSymbolMatch(candidate: CodeSymbol, workspaceSymbol: CodeSymbol): boolean {
|
|
27
|
+
return (
|
|
28
|
+
candidate.name === workspaceSymbol.name &&
|
|
29
|
+
candidate.kind === workspaceSymbol.kind &&
|
|
30
|
+
normalizeContainer(candidate.container) === normalizeContainer(workspaceSymbol.container)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The preferred anchor for resolution/downstream: the name (identifier) anchor
|
|
36
|
+
* when the provider derived it, else the declaration anchor. Strict consumers
|
|
37
|
+
* (tree-sitter `calleesAt`, LSP `rename`) prefer the name anchor; tolerant
|
|
38
|
+
* consumers (`references`, `implementation`, `definition`) accept either.
|
|
39
|
+
* Per ADR 0003. When `nameAnchor` is absent, strict consumers that consume
|
|
40
|
+
* this anchor should hard-fail observably (slice D) rather than silently use
|
|
41
|
+
* the declaration — handled at the consumer boundary, not here.
|
|
42
|
+
*/
|
|
43
|
+
function anchorOf(s: CodeSymbol): CodeSymbol["declarationAnchor"] {
|
|
44
|
+
return s.nameAnchor ?? s.declarationAnchor;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Prefer a document-symbol anchor when it provides one unambiguous exact match
|
|
49
|
+
* for the already-selected workspace symbol.
|
|
50
|
+
*/
|
|
51
|
+
async function refineResolvedSymbolAnchor(
|
|
52
|
+
workspaceSymbol: CodeSymbol,
|
|
53
|
+
semantic: SemanticSubstrate,
|
|
54
|
+
): Promise<CodeSymbol> {
|
|
55
|
+
try {
|
|
56
|
+
const documentSymbols = await semantic.documentSymbols(workspaceSymbol.file);
|
|
57
|
+
if (!documentSymbols || documentSymbols.length === 0) {
|
|
58
|
+
return workspaceSymbol;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const exactMatches = documentSymbols.filter((candidate) =>
|
|
62
|
+
isExactDocumentSymbolMatch(candidate, workspaceSymbol),
|
|
63
|
+
);
|
|
64
|
+
if (exactMatches.length !== 1) {
|
|
65
|
+
return workspaceSymbol;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const refined = exactMatches[0];
|
|
69
|
+
const a = anchorOf(refined);
|
|
70
|
+
if (a.line <= 0 && a.character <= 0) {
|
|
71
|
+
return workspaceSymbol;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return refined;
|
|
75
|
+
} catch {
|
|
76
|
+
return workspaceSymbol;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Resolve a symbol via the semantic substrate.
|
|
82
|
+
*
|
|
83
|
+
* @param symbol - the symbol name to search for
|
|
84
|
+
* @param cwd - session working directory
|
|
85
|
+
* @param semantic - the semantic substrate (LSP-backed)
|
|
86
|
+
* @param options - optional filters: path scope, kind filter, exported-only
|
|
87
|
+
* @returns Typed outcome: resolved, disambiguation, or error
|
|
88
|
+
*/
|
|
89
|
+
export async function resolveSymbolTarget(
|
|
90
|
+
symbol: string,
|
|
91
|
+
cwd: string,
|
|
92
|
+
semantic: SemanticSubstrate,
|
|
93
|
+
options?: {
|
|
94
|
+
path?: string;
|
|
95
|
+
kind?: string;
|
|
96
|
+
exportedOnly?: boolean;
|
|
97
|
+
maxResults?: number;
|
|
98
|
+
},
|
|
99
|
+
): Promise<TargetOutcome> {
|
|
100
|
+
const results = await semantic.workspaceSymbols(symbol);
|
|
101
|
+
if (results === null) {
|
|
102
|
+
return {
|
|
103
|
+
kind: "error",
|
|
104
|
+
message: `Symbol discovery for \`${symbol}\` requires active LSP. Use \`file\` + coordinates, or enable LSP and retry.`,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (results.length === 0) {
|
|
108
|
+
return { kind: "error", message: `Symbol not found: \`${symbol}\`` };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Filter by path scope. Tool paths may include pi's leading `@` prefix;
|
|
112
|
+
// normalize through the shared path helper so every caller gets the same
|
|
113
|
+
// scope semantics.
|
|
114
|
+
const scopePath = options?.path ? normalizePath(options.path, cwd) : null;
|
|
115
|
+
let candidates = results.filter((s) => {
|
|
116
|
+
if (scopePath && !isWithinOrEqual(scopePath, s.file)) return false;
|
|
117
|
+
return true;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Filter by kind
|
|
121
|
+
if (options?.kind) {
|
|
122
|
+
const kindLower = options.kind.toLowerCase();
|
|
123
|
+
candidates = candidates.filter((s) => s.kind.toLowerCase().includes(kindLower));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Filter to exported symbols only
|
|
127
|
+
if (options?.exportedOnly) {
|
|
128
|
+
candidates = candidates.filter((s) => !NON_EXPORTED_KINDS.has(s.kind));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Range-less candidates (line=0,char=0) come from URI-only workspace symbols.
|
|
132
|
+
// Keep them for disambiguation but don't promote to single-match resolution.
|
|
133
|
+
const ranged = candidates.filter(
|
|
134
|
+
(s) => s.declarationAnchor.line > 0 || s.declarationAnchor.character > 0,
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
if (ranged.length === 1) {
|
|
138
|
+
const c = await refineResolvedSymbolAnchor(ranged[0], semantic);
|
|
139
|
+
const a = anchorOf(c);
|
|
140
|
+
return {
|
|
141
|
+
kind: "resolved",
|
|
142
|
+
target: {
|
|
143
|
+
file: c.file,
|
|
144
|
+
position: { line: a.line - 1, character: a.character - 1 },
|
|
145
|
+
displayLine: a.line,
|
|
146
|
+
displayCharacter: a.character,
|
|
147
|
+
name: c.name,
|
|
148
|
+
kind: c.kind,
|
|
149
|
+
confidence: "semantic",
|
|
150
|
+
anchorKind: (c.nameAnchor ? "name" : "declaration") as AnchorKind,
|
|
151
|
+
container: c.container ?? null,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// All candidates lost or only rangeless
|
|
157
|
+
if (candidates.length === 0) {
|
|
158
|
+
return {
|
|
159
|
+
kind: "error",
|
|
160
|
+
message: `Symbol not found: \`${symbol}\`${scopePath ? ` in path \`${options?.path}\`` : ""}`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Multiple candidates — refine each to a name (identifier) anchor before
|
|
165
|
+
// returning disambiguation, so position-strict downstream substrates
|
|
166
|
+
// (tree-sitter calleesAt, LSP rename) receive the identifier anchor rather
|
|
167
|
+
// than the declaration anchor (the `export` keyword) that workspace-symbol
|
|
168
|
+
// hits carry. Mirrors the single-match refine path above.
|
|
169
|
+
// Per ADR 0003, `anchorOf` prefers the refined doc symbol's `nameAnchor`.
|
|
170
|
+
// TODO: batch the per-file documentSymbols dedupe across candidates.
|
|
171
|
+
const cap = options?.maxResults ?? MAX_CANDIDATES;
|
|
172
|
+
const refined = await Promise.all(
|
|
173
|
+
candidates.slice(0, cap).map((c) => refineResolvedSymbolAnchor(c, semantic)),
|
|
174
|
+
);
|
|
175
|
+
const candidatesOut = refined.map((c, idx) => {
|
|
176
|
+
const relFile = path.relative(cwd, c.file);
|
|
177
|
+
const a = anchorOf(c);
|
|
178
|
+
return {
|
|
179
|
+
name: c.name,
|
|
180
|
+
kind: c.kind,
|
|
181
|
+
container: c.container ?? null,
|
|
182
|
+
file: relFile,
|
|
183
|
+
line: a.line,
|
|
184
|
+
character: a.character,
|
|
185
|
+
reason: relFile,
|
|
186
|
+
rank: idx + 1,
|
|
187
|
+
anchorKind: (c.nameAnchor ? "name" : "declaration") as AnchorKind,
|
|
188
|
+
};
|
|
189
|
+
}) satisfies DisambiguationCandidateData[];
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
kind: "disambiguation",
|
|
193
|
+
candidates: candidatesOut,
|
|
194
|
+
omittedCount: Math.max(0, candidates.length - cap),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* and keep action-facing code focused on routing, not string building.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
SemanticProvider as SemanticSubstrate,
|
|
11
|
+
StructuralProvider as StructuralSubstrate,
|
|
12
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
13
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
10
14
|
|
|
11
15
|
// ── Normalized query ──────────────────────────────────────────────────
|
|
12
16
|
|
|
@@ -68,6 +72,16 @@ export interface ResolvedTargetData {
|
|
|
68
72
|
name: string | null;
|
|
69
73
|
kind: string | null;
|
|
70
74
|
confidence: "semantic" | "structural" | "heuristic" | "unavailable";
|
|
75
|
+
/** Which anchor this target carries — drives strict-consumer enforcement (ADR 0003). */
|
|
76
|
+
anchorKind: AnchorKind;
|
|
77
|
+
/** Symbolic container (class/namespace/module name), or null for top-level. */
|
|
78
|
+
container: string | null;
|
|
79
|
+
/**
|
|
80
|
+
* Resolution provenance — present when the target was resolved from
|
|
81
|
+
* anchored coordinates. Carries requested/resolved coordinates, whether the
|
|
82
|
+
* anchor was snapped, and the provider-backed evidence source.
|
|
83
|
+
*/
|
|
84
|
+
resolution?: import("../../types/index.ts").AnchoredResolutionMetadata;
|
|
71
85
|
}
|
|
72
86
|
|
|
73
87
|
/**
|
|
@@ -92,6 +106,8 @@ export interface DisambiguationCandidateData {
|
|
|
92
106
|
character: number;
|
|
93
107
|
reason: string;
|
|
94
108
|
rank: number;
|
|
109
|
+
/** Which anchor this candidate carries (ADR 0003). */
|
|
110
|
+
anchorKind: AnchorKind;
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
/**
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Likely test file discovery for impact analysis.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from orchestrate.ts to keep impact orchestration focused.
|
|
5
|
+
* Combines direct test-file detection, semantic reference-based discovery,
|
|
6
|
+
* and path conventions to find companion test files for affected source files.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import type { CodePosition } from "@mrclrchtr/supi-code-runtime/api";
|
|
11
|
+
import type { CodeProvider } from "../provider.ts";
|
|
12
|
+
import {
|
|
13
|
+
type DiscoveredTestFile,
|
|
14
|
+
describeTestFile,
|
|
15
|
+
discoverTestFilesForSource,
|
|
16
|
+
isTestFilePath,
|
|
17
|
+
} from "./test-discovery.ts";
|
|
18
|
+
|
|
19
|
+
export interface ChangeSetFileEntry {
|
|
20
|
+
absPath: string;
|
|
21
|
+
relPath: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type TestAnchorMap = Map<string, CodePosition[]>;
|
|
25
|
+
|
|
26
|
+
export interface LikelyTestsResult {
|
|
27
|
+
paths: string[];
|
|
28
|
+
files: Array<Pick<DiscoveredTestFile, "absPath" | "testNames" | "labelStatus">>;
|
|
29
|
+
provenance?: "semantic+conventions" | "conventions-only";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function buildTestAnchorMap(
|
|
33
|
+
entries: Array<{ file: string; position: CodePosition }>,
|
|
34
|
+
): TestAnchorMap {
|
|
35
|
+
const map: TestAnchorMap = new Map();
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
const key = path.resolve(entry.file);
|
|
38
|
+
const positions = map.get(key) ?? [];
|
|
39
|
+
positions.push(entry.position);
|
|
40
|
+
map.set(key, positions);
|
|
41
|
+
}
|
|
42
|
+
return map;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function normalizeChangeSet(files: string[], cwd: string): ChangeSetFileEntry[] {
|
|
46
|
+
const seen = new Set<string>();
|
|
47
|
+
const result: ChangeSetFileEntry[] = [];
|
|
48
|
+
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
const absPath = path.resolve(cwd, file);
|
|
51
|
+
const relPath = path.relative(cwd, absPath) || file;
|
|
52
|
+
if (seen.has(absPath)) continue;
|
|
53
|
+
seen.add(absPath);
|
|
54
|
+
result.push({ absPath, relPath });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function dedupeDiscoveredTestFiles(
|
|
61
|
+
files: Array<Pick<DiscoveredTestFile, "absPath" | "testNames" | "labelStatus">>,
|
|
62
|
+
): Array<Pick<DiscoveredTestFile, "absPath" | "testNames" | "labelStatus">> {
|
|
63
|
+
const byPath = new Map<
|
|
64
|
+
string,
|
|
65
|
+
Pick<DiscoveredTestFile, "absPath" | "testNames" | "labelStatus">
|
|
66
|
+
>();
|
|
67
|
+
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
const existing = byPath.get(file.absPath);
|
|
70
|
+
if (!existing) {
|
|
71
|
+
byPath.set(file.absPath, file);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (existing.labelStatus !== "recognized" && file.labelStatus === "recognized") {
|
|
76
|
+
byPath.set(file.absPath, file);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return [...byPath.values()].sort((left, right) => left.absPath.localeCompare(right.absPath));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// biome-ignore lint/complexity/useMaxParams: shared likely-test collection keeps evidence inputs explicit
|
|
84
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: discovery aggregation across direct tests, semantic references, and conventions is clearest in one helper
|
|
85
|
+
export async function collectLikelyTests(
|
|
86
|
+
affectedFiles: Set<string>,
|
|
87
|
+
cwd: string,
|
|
88
|
+
references: CodeProvider["references"] | undefined,
|
|
89
|
+
testAnchors?: TestAnchorMap,
|
|
90
|
+
fallbackProvenance?: "semantic+conventions" | "conventions-only",
|
|
91
|
+
outline?: CodeProvider["outline"],
|
|
92
|
+
): Promise<LikelyTestsResult> {
|
|
93
|
+
const seen = new Set<string>();
|
|
94
|
+
const likelyTests: string[] = [];
|
|
95
|
+
const discoveredFiles: Array<Pick<DiscoveredTestFile, "absPath" | "testNames" | "labelStatus">> =
|
|
96
|
+
[];
|
|
97
|
+
let provenance = fallbackProvenance;
|
|
98
|
+
|
|
99
|
+
for (const affFile of affectedFiles) {
|
|
100
|
+
if (isTestFilePath(affFile)) {
|
|
101
|
+
addLikelyTestPath(cwd, affFile, seen, likelyTests);
|
|
102
|
+
const described = await describeTestFile(affFile, { outline, cwd });
|
|
103
|
+
discoveredFiles.push(described);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const positions = testAnchors?.get(path.resolve(affFile)) ?? [];
|
|
108
|
+
const discoveries =
|
|
109
|
+
positions.length > 0
|
|
110
|
+
? await Promise.all(
|
|
111
|
+
positions.map((position) =>
|
|
112
|
+
discoverTestFilesForSource(affFile, {
|
|
113
|
+
cwd,
|
|
114
|
+
cap: 3,
|
|
115
|
+
references,
|
|
116
|
+
outline,
|
|
117
|
+
position,
|
|
118
|
+
}),
|
|
119
|
+
),
|
|
120
|
+
)
|
|
121
|
+
: [
|
|
122
|
+
await discoverTestFilesForSource(affFile, {
|
|
123
|
+
cwd,
|
|
124
|
+
cap: 3,
|
|
125
|
+
references,
|
|
126
|
+
outline,
|
|
127
|
+
}),
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
for (const discovery of discoveries) {
|
|
131
|
+
if (discovery.kind !== "found") continue;
|
|
132
|
+
if (discovery.provenance === "semantic+conventions") {
|
|
133
|
+
provenance = "semantic+conventions";
|
|
134
|
+
} else if (!provenance) {
|
|
135
|
+
provenance = discovery.provenance;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const discovered = dedupeDiscoveredTestFiles(discoveries.flatMap((entry) => entry.files));
|
|
140
|
+
for (const testFile of discovered) {
|
|
141
|
+
addLikelyTestPath(cwd, testFile.absPath, seen, likelyTests);
|
|
142
|
+
discoveredFiles.push(testFile);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const files = dedupeDiscoveredTestFiles(discoveredFiles).slice(0, 3);
|
|
147
|
+
likelyTests.sort((a, b) => a.localeCompare(b));
|
|
148
|
+
return { paths: likelyTests.slice(0, 3), files, provenance };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function addLikelyTestPath(
|
|
152
|
+
cwd: string,
|
|
153
|
+
absPath: string,
|
|
154
|
+
seen: Set<string>,
|
|
155
|
+
likelyTests: string[],
|
|
156
|
+
): void {
|
|
157
|
+
const relPath = path.relative(cwd, absPath) || absPath;
|
|
158
|
+
if (seen.has(relPath)) return;
|
|
159
|
+
seen.add(relPath);
|
|
160
|
+
likelyTests.push(relPath);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
import { detectVitestWorkspace, VITEST_RUNNABLE_EXTENSIONS } from "./vitest.ts";
|
|
164
|
+
|
|
165
|
+
export function buildLikelyTestCommands(cwd: string, likelyTests: string[]): string[] {
|
|
166
|
+
if (likelyTests.length === 0 || !detectVitestWorkspace(cwd)) {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return likelyTests
|
|
171
|
+
.filter((testPath) => VITEST_RUNNABLE_EXTENSIONS.has(path.extname(testPath)))
|
|
172
|
+
.slice(0, 3)
|
|
173
|
+
.map((relTest) => `pnpm vitest run ${relTest} --reporter=verbose`);
|
|
174
|
+
}
|