@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
|
@@ -1,61 +1,126 @@
|
|
|
1
1
|
// Pattern search markdown renderer — all formatting for literal, regex, and structured search results.
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type { StructuralProvider as StructuralSubstrate } from "@mrclrchtr/supi-code-runtime/api";
|
|
4
|
+
import {
|
|
5
|
+
createEvidenceList,
|
|
6
|
+
type EvidenceListMetadata,
|
|
7
|
+
renderEvidenceListDisclosure,
|
|
8
|
+
} from "../../analysis/evidence.ts";
|
|
9
|
+
import type {
|
|
10
|
+
StructuredMatch,
|
|
11
|
+
StructuredPatternKind,
|
|
12
|
+
StructuredPatternResult,
|
|
13
|
+
} from "../../analysis/search/pattern.ts";
|
|
14
|
+
import type { RgMatch } from "../../analysis/search/ripgrep.ts";
|
|
15
|
+
import { groupByFile } from "../../analysis/search/ripgrep.ts";
|
|
7
16
|
|
|
8
17
|
// ── Structured search formatting ─────────────────────────────────────
|
|
9
18
|
|
|
10
19
|
// biome-ignore lint/complexity/useMaxParams: structured empty-state with optional result parameter keeps partial-warning logic together
|
|
11
20
|
export function renderStructuredEmptyState(
|
|
12
21
|
pattern: string,
|
|
13
|
-
kind:
|
|
22
|
+
kind: StructuredPatternKind,
|
|
14
23
|
relScope: string,
|
|
15
24
|
_structural?: StructuralSubstrate,
|
|
16
25
|
result?: StructuredPatternResult,
|
|
17
26
|
): string {
|
|
18
27
|
const lines = [`No ${kind} matches found for \`${pattern}\` in \`${relScope}\`.`];
|
|
19
|
-
|
|
28
|
+
const partial = renderPartialWarning(result);
|
|
29
|
+
if (partial) {
|
|
20
30
|
lines.push("");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`_Partial structured results — +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted after reaching the structured scan cap. Narrow \`path\` or \`pattern\` for complete coverage._`,
|
|
28
|
-
);
|
|
29
|
-
}
|
|
31
|
+
lines.push(partial);
|
|
32
|
+
}
|
|
33
|
+
const failureLines = renderFailureSummary(result?.failures);
|
|
34
|
+
if (failureLines.length > 0) {
|
|
35
|
+
lines.push("");
|
|
36
|
+
lines.push(...failureLines);
|
|
30
37
|
}
|
|
31
38
|
return lines.join("\n");
|
|
32
39
|
}
|
|
33
40
|
|
|
41
|
+
function renderFailureSummary(failures?: Array<{ file: string; reason: string }>): string[] {
|
|
42
|
+
if (!failures || failures.length === 0) return [];
|
|
43
|
+
const lines: string[] = [
|
|
44
|
+
`**${failures.length} file${failures.length !== 1 ? "s" : ""} could not be analyzed:**`,
|
|
45
|
+
];
|
|
46
|
+
for (const f of failures.slice(0, 5)) {
|
|
47
|
+
lines.push(`- \`${f.file}\` — ${f.reason}`);
|
|
48
|
+
}
|
|
49
|
+
if (failures.length > 5) {
|
|
50
|
+
lines.push(`- _+${failures.length - 5} more_`);
|
|
51
|
+
}
|
|
52
|
+
return lines;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function renderPartialWarning(result?: StructuredPatternResult): string | null {
|
|
56
|
+
if (!result || result.omittedCount <= 0 || !result.partialReason) return null;
|
|
57
|
+
if (result.partialReason === "timeout") {
|
|
58
|
+
return `_Partial structured results — scan timed out with +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted. Narrow \`path\` or \`pattern\` for complete coverage._`;
|
|
59
|
+
}
|
|
60
|
+
return `_Partial structured results — +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted after reaching the structured scan cap. Narrow \`path\` or \`pattern\` for complete coverage._`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: pattern search rendering groups matches by file and adds summaries — each branch stays linear
|
|
64
|
+
// biome-ignore lint/complexity/useMaxParams: structured renderer mirrors the existing public helper shape plus display cap
|
|
34
65
|
export function renderStructuredMatches(
|
|
35
66
|
pattern: string,
|
|
36
|
-
kind:
|
|
67
|
+
kind: StructuredPatternKind,
|
|
37
68
|
relScope: string,
|
|
38
69
|
result: StructuredPatternResult,
|
|
39
|
-
|
|
70
|
+
maxResults: number,
|
|
71
|
+
): { content: string; evidenceList: EvidenceListMetadata } {
|
|
72
|
+
const evidence = createEvidenceList({
|
|
73
|
+
key: "find.astMatches",
|
|
74
|
+
items: result.matches,
|
|
75
|
+
maxResults,
|
|
76
|
+
});
|
|
40
77
|
const grouped = new Map<string, StructuredMatch[]>();
|
|
41
|
-
for (const match of
|
|
78
|
+
for (const match of evidence.items) {
|
|
42
79
|
const group = grouped.get(match.file) ?? [];
|
|
43
80
|
group.push(match);
|
|
44
81
|
grouped.set(match.file, group);
|
|
45
82
|
}
|
|
46
83
|
|
|
47
84
|
const kindLabel =
|
|
48
|
-
kind === "definition"
|
|
85
|
+
kind === "definition"
|
|
86
|
+
? "Definitions"
|
|
87
|
+
: kind === "export"
|
|
88
|
+
? "Exports"
|
|
89
|
+
: kind === "import"
|
|
90
|
+
? "Imports"
|
|
91
|
+
: kind === "call"
|
|
92
|
+
? "Calls"
|
|
93
|
+
: kind === "type"
|
|
94
|
+
? "Types"
|
|
95
|
+
: kind === "interface"
|
|
96
|
+
? "Interfaces"
|
|
97
|
+
: kind === "class"
|
|
98
|
+
? "Classes"
|
|
99
|
+
: kind === "method"
|
|
100
|
+
? "Methods"
|
|
101
|
+
: kind === "enum"
|
|
102
|
+
? "Enums"
|
|
103
|
+
: "Tests";
|
|
49
104
|
const lines: string[] = [];
|
|
50
105
|
lines.push(`# Pattern ${kindLabel}: \`${pattern}\``);
|
|
51
106
|
lines.push("");
|
|
52
107
|
lines.push(
|
|
53
108
|
`**${result.matches.length} match${result.matches.length !== 1 ? "es" : ""}** across **${grouped.size} file${grouped.size !== 1 ? "s" : ""}** in \`${relScope}\``,
|
|
54
109
|
);
|
|
55
|
-
|
|
110
|
+
if (kind === "call") {
|
|
111
|
+
lines.push("");
|
|
112
|
+
lines.push(
|
|
113
|
+
'_Note: AST call results are name-based, not symbol-identity-aware. Use `code_graph` with `relations: ["references"]` on a resolved target for identity-aware callers._',
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
const partialWarning = renderPartialWarning(result);
|
|
56
117
|
if (partialWarning) {
|
|
57
118
|
lines.push(partialWarning);
|
|
58
119
|
}
|
|
120
|
+
if (result.failures.length > 0) {
|
|
121
|
+
lines.push("");
|
|
122
|
+
lines.push(...renderFailureSummary(result.failures));
|
|
123
|
+
}
|
|
59
124
|
lines.push("");
|
|
60
125
|
|
|
61
126
|
if (kind === "definition" || kind === "export") {
|
|
@@ -64,26 +129,18 @@ export function renderStructuredMatches(
|
|
|
64
129
|
|
|
65
130
|
for (const [file, fileMatches] of grouped) {
|
|
66
131
|
lines.push(`### ${file}`);
|
|
67
|
-
for (const match of fileMatches
|
|
132
|
+
for (const match of fileMatches) {
|
|
68
133
|
lines.push(`- \`${match.name}\` (${match.kind}) L${match.line}`);
|
|
69
134
|
}
|
|
70
|
-
if (fileMatches.length > 8) {
|
|
71
|
-
lines.push(`- _+${fileMatches.length - 8} more in this file_`);
|
|
72
|
-
}
|
|
73
135
|
lines.push("");
|
|
74
136
|
}
|
|
75
137
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function formatPartialStructuredWarning(result: StructuredPatternResult): string | null {
|
|
80
|
-
if (!result.partialReason || result.omittedCount <= 0) return null;
|
|
81
|
-
|
|
82
|
-
if (result.partialReason === "timeout") {
|
|
83
|
-
return `_Partial structured results — scan timed out with +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted. Narrow \`path\` or \`pattern\` for complete coverage._`;
|
|
138
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
139
|
+
if (disclosure) {
|
|
140
|
+
lines.push(disclosure);
|
|
84
141
|
}
|
|
85
142
|
|
|
86
|
-
return
|
|
143
|
+
return { content: lines.join("\n"), evidenceList: evidence.metadata };
|
|
87
144
|
}
|
|
88
145
|
|
|
89
146
|
function addDuplicateSummary(lines: string[], matches: StructuredMatch[]): void {
|
|
@@ -137,40 +194,35 @@ export function renderPatternResults(
|
|
|
137
194
|
relScope: string,
|
|
138
195
|
matches: RgMatch[],
|
|
139
196
|
maxResults: number,
|
|
140
|
-
): string {
|
|
197
|
+
): { content: string; evidenceList: EvidenceListMetadata } {
|
|
141
198
|
const lines: string[] = [];
|
|
142
199
|
lines.push(`# Pattern: \`${pattern}\``);
|
|
143
200
|
lines.push("");
|
|
144
201
|
lines.push(`**${matches.length} match${matches.length > 1 ? "es" : ""}** in \`${relScope}\``);
|
|
145
202
|
lines.push("");
|
|
146
203
|
|
|
147
|
-
const
|
|
148
|
-
|
|
204
|
+
const evidence = createEvidenceList({
|
|
205
|
+
key: "find.textMatches",
|
|
206
|
+
items: matches,
|
|
207
|
+
maxResults,
|
|
208
|
+
});
|
|
209
|
+
const byFile = groupByFile(evidence.items);
|
|
149
210
|
for (const [file, fileMatches] of byFile) {
|
|
150
|
-
if (shown >= maxResults) break;
|
|
151
211
|
lines.push(`### ${file}`);
|
|
152
212
|
const renderedLines = new Set<number>();
|
|
153
213
|
const matchLines = new Set(fileMatches.map((match) => match.line));
|
|
154
|
-
for (const m of fileMatches
|
|
214
|
+
for (const m of fileMatches) {
|
|
155
215
|
renderMatchWithContext(lines, m, renderedLines, matchLines, pattern);
|
|
156
216
|
}
|
|
157
|
-
if (fileMatches.length > 5) {
|
|
158
|
-
lines.push(`- _+${fileMatches.length - 5} more in this file_`);
|
|
159
|
-
}
|
|
160
217
|
lines.push("");
|
|
161
|
-
shown++;
|
|
162
218
|
}
|
|
163
219
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
);
|
|
220
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
221
|
+
if (disclosure) {
|
|
222
|
+
lines.push(disclosure);
|
|
168
223
|
}
|
|
169
224
|
lines.push("");
|
|
170
|
-
lines.
|
|
171
|
-
lines.push("");
|
|
172
|
-
|
|
173
|
-
return lines.join("\n");
|
|
225
|
+
return { content: lines.join("\n"), evidenceList: evidence.metadata };
|
|
174
226
|
}
|
|
175
227
|
|
|
176
228
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: context-line rendering with before/after/skip logic is clearer as one function
|
|
@@ -232,8 +284,5 @@ export function renderPatternSummary(
|
|
|
232
284
|
lines.push(`- _+${sorted.length - maxResults} more files omitted_`);
|
|
233
285
|
}
|
|
234
286
|
lines.push("");
|
|
235
|
-
lines.push("_Text search — results may include comments, strings, or unrelated matches._");
|
|
236
|
-
lines.push("");
|
|
237
|
-
|
|
238
287
|
return lines.join("\n");
|
|
239
288
|
}
|
|
@@ -2,25 +2,36 @@
|
|
|
2
2
|
// Coordinates ripgrep literal/regex search and structured tree-sitter search,
|
|
3
3
|
// returning fully rendered content + details metadata.
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
6
|
+
import {
|
|
7
|
+
getStructuredPatternMatches,
|
|
8
|
+
isStructuredPatternKind,
|
|
9
|
+
type StructuredPatternKind,
|
|
10
|
+
} from "../../analysis/search/pattern.ts";
|
|
11
|
+
import type { RgMatch } from "../../analysis/search/ripgrep.ts";
|
|
12
|
+
import {
|
|
13
|
+
normalizePath,
|
|
14
|
+
runRipgrep,
|
|
15
|
+
runRipgrepDetailed,
|
|
16
|
+
toDisplayPath,
|
|
17
|
+
} from "../../analysis/search/ripgrep.ts";
|
|
18
|
+
import type { CodeIntelResult, SearchDetails } from "../../types/index.ts";
|
|
19
|
+
import type { CodeQueryParams } from "../params.ts";
|
|
6
20
|
import {
|
|
7
21
|
renderPatternResults,
|
|
8
22
|
renderPatternSummary,
|
|
9
23
|
renderRegexError,
|
|
10
24
|
renderStructuredEmptyState,
|
|
11
25
|
renderStructuredMatches,
|
|
12
|
-
} from "
|
|
13
|
-
import
|
|
14
|
-
import type { RgMatch } from "../search-helpers.ts";
|
|
15
|
-
import { normalizePath, runRipgrep, runRipgrepDetailed } from "../search-helpers.ts";
|
|
16
|
-
import type { CodeIntelResult, SearchDetails } from "../types.ts";
|
|
17
|
-
import type { CodeProvider } from "../workspace/request-context.ts";
|
|
26
|
+
} from "./markdown.ts";
|
|
27
|
+
import { executeSemanticSearch } from "./semantic-search.ts";
|
|
18
28
|
|
|
19
29
|
export interface PatternInput {
|
|
20
30
|
pattern: string;
|
|
21
31
|
path?: string;
|
|
22
32
|
regex?: boolean;
|
|
23
33
|
kind?: string;
|
|
34
|
+
mode?: "text" | "regex" | "ast" | "semantic";
|
|
24
35
|
maxResults?: number;
|
|
25
36
|
contextLines?: number;
|
|
26
37
|
summary?: boolean;
|
|
@@ -29,9 +40,12 @@ export interface PatternInput {
|
|
|
29
40
|
export interface PatternDeps {
|
|
30
41
|
cwd: string;
|
|
31
42
|
provider: CodeProvider | null;
|
|
43
|
+
/** Abort signal forwarded to ripgrep for text/regex modes. */
|
|
44
|
+
signal?: AbortSignal;
|
|
32
45
|
}
|
|
33
46
|
|
|
34
47
|
/** Execute the pattern search use-case. */
|
|
48
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: mode dispatch branches are linear, not nested
|
|
35
49
|
export async function executePattern(
|
|
36
50
|
input: PatternInput,
|
|
37
51
|
deps: PatternDeps,
|
|
@@ -43,6 +57,11 @@ export async function executePattern(
|
|
|
43
57
|
};
|
|
44
58
|
}
|
|
45
59
|
|
|
60
|
+
// Semantic mode — LSP workspace symbol search
|
|
61
|
+
if (input.mode === "semantic") {
|
|
62
|
+
return executeSemanticSearch(input, deps.provider, deps.cwd);
|
|
63
|
+
}
|
|
64
|
+
|
|
46
65
|
const maxResults = input.maxResults ?? 8;
|
|
47
66
|
const contextLines = input.contextLines ?? 1;
|
|
48
67
|
const scopePath = input.path ? normalizePath(input.path, deps.cwd) : deps.cwd;
|
|
@@ -61,19 +80,20 @@ export async function executePattern(
|
|
|
61
80
|
}
|
|
62
81
|
|
|
63
82
|
const matches = input.regex
|
|
64
|
-
? getRegexMatches({
|
|
83
|
+
? await getRegexMatches({
|
|
65
84
|
pattern: input.pattern,
|
|
66
85
|
scopePath,
|
|
67
86
|
cwd: deps.cwd,
|
|
68
87
|
maxResults,
|
|
69
88
|
contextLines,
|
|
70
89
|
summary: input.summary,
|
|
90
|
+
signal: deps.signal,
|
|
71
91
|
})
|
|
72
|
-
: runRipgrep(input.pattern, scopePath, deps.cwd, {
|
|
73
|
-
maxMatches: input.summary ? undefined : maxResults * 3,
|
|
92
|
+
: await runRipgrep(input.pattern, scopePath, deps.cwd, {
|
|
74
93
|
contextLines,
|
|
75
94
|
literal: true,
|
|
76
95
|
filterLowSignal: true,
|
|
96
|
+
signal: deps.signal,
|
|
77
97
|
});
|
|
78
98
|
|
|
79
99
|
if (typeof matches === "string") {
|
|
@@ -91,20 +111,29 @@ export async function executePattern(
|
|
|
91
111
|
return formatEmptyResult(input, relScope);
|
|
92
112
|
}
|
|
93
113
|
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
:
|
|
114
|
+
const displayMatches = matches.map((m) => ({
|
|
115
|
+
...m,
|
|
116
|
+
file: toDisplayPath(deps.cwd, m.file),
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
const rendered = input.summary
|
|
120
|
+
? {
|
|
121
|
+
content: renderPatternSummary(input.pattern, relScope, displayMatches, maxResults),
|
|
122
|
+
evidenceList: undefined,
|
|
123
|
+
}
|
|
124
|
+
: renderPatternResults(input.pattern, relScope, displayMatches, maxResults);
|
|
97
125
|
|
|
98
126
|
const details: SearchDetails = {
|
|
99
127
|
confidence: "heuristic",
|
|
100
128
|
scope: input.path ?? null,
|
|
101
129
|
candidateCount: matches.length,
|
|
102
|
-
omittedCount: 0,
|
|
130
|
+
omittedCount: rendered.evidenceList?.omittedCount ?? 0,
|
|
131
|
+
evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
|
|
103
132
|
nextQueries: input.regex
|
|
104
133
|
? ["Set `regex: false` for literal matching"]
|
|
105
134
|
: ["Set `regex: true` for regex matching"],
|
|
106
135
|
};
|
|
107
|
-
return { content, details: { type: "search" as const, data: details } };
|
|
136
|
+
return { content: rendered.content, details: { type: "search" as const, data: details } };
|
|
108
137
|
}
|
|
109
138
|
|
|
110
139
|
// ── Structured search ────────────────────────────────────────────────
|
|
@@ -112,11 +141,11 @@ export async function executePattern(
|
|
|
112
141
|
// biome-ignore lint/complexity/useMaxParams: structured-search parameters are clearer as positional when linking input, scope, and substrate
|
|
113
142
|
async function executeStructuredSearch(
|
|
114
143
|
input: PatternInput,
|
|
115
|
-
kind:
|
|
144
|
+
kind: StructuredPatternKind,
|
|
116
145
|
scopePath: string,
|
|
117
146
|
cwd: string,
|
|
118
147
|
relScope: string,
|
|
119
|
-
|
|
148
|
+
maxResults: number,
|
|
120
149
|
provider: CodeProvider | null,
|
|
121
150
|
): Promise<CodeIntelResult> {
|
|
122
151
|
if (!provider) {
|
|
@@ -148,7 +177,7 @@ async function executeStructuredSearch(
|
|
|
148
177
|
if (!structured || structured.matches.length === 0) {
|
|
149
178
|
const content = renderStructuredEmptyState(
|
|
150
179
|
input.pattern,
|
|
151
|
-
kind
|
|
180
|
+
kind,
|
|
152
181
|
relScope,
|
|
153
182
|
provider,
|
|
154
183
|
structured ?? undefined,
|
|
@@ -171,24 +200,28 @@ async function executeStructuredSearch(
|
|
|
171
200
|
};
|
|
172
201
|
}
|
|
173
202
|
|
|
203
|
+
const rendered = renderStructuredMatches(input.pattern, kind, relScope, structured, maxResults);
|
|
204
|
+
|
|
174
205
|
return {
|
|
175
|
-
content:
|
|
176
|
-
input.pattern,
|
|
177
|
-
kind as "definition" | "export" | "import",
|
|
178
|
-
relScope,
|
|
179
|
-
structured,
|
|
180
|
-
),
|
|
206
|
+
content: rendered.content,
|
|
181
207
|
details: {
|
|
182
208
|
type: "search",
|
|
183
209
|
data: {
|
|
184
210
|
confidence: "structural",
|
|
185
211
|
scope: input.path ?? null,
|
|
186
212
|
candidateCount: structured.matches.length,
|
|
187
|
-
omittedCount: structured.omittedCount,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
213
|
+
omittedCount: structured.omittedCount + (rendered.evidenceList.omittedCount ?? 0),
|
|
214
|
+
evidenceLists: [rendered.evidenceList],
|
|
215
|
+
nextQueries:
|
|
216
|
+
kind === "call"
|
|
217
|
+
? [
|
|
218
|
+
"Omit `kind` for plain text matches",
|
|
219
|
+
'Use `code_graph` with `relations: ["references"]` on a resolved target for identity-aware callers',
|
|
220
|
+
]
|
|
221
|
+
: [
|
|
222
|
+
"Omit `kind` for plain text matches",
|
|
223
|
+
"Widen `scope` or raise `maxResults` for broader coverage",
|
|
224
|
+
],
|
|
192
225
|
},
|
|
193
226
|
},
|
|
194
227
|
};
|
|
@@ -223,18 +256,19 @@ function formatEmptyResult(input: PatternInput, relScope: string): CodeIntelResu
|
|
|
223
256
|
};
|
|
224
257
|
}
|
|
225
258
|
|
|
226
|
-
function getRegexMatches(options: {
|
|
259
|
+
async function getRegexMatches(options: {
|
|
227
260
|
pattern: string;
|
|
228
261
|
scopePath: string;
|
|
229
262
|
cwd: string;
|
|
230
263
|
maxResults: number;
|
|
231
264
|
contextLines: number;
|
|
232
265
|
summary?: boolean;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
266
|
+
signal?: AbortSignal;
|
|
267
|
+
}): Promise<RgMatch[] | string> {
|
|
268
|
+
const result = await runRipgrepDetailed(options.pattern, options.scopePath, options.cwd, {
|
|
236
269
|
contextLines: options.contextLines,
|
|
237
270
|
filterLowSignal: true,
|
|
271
|
+
signal: options.signal,
|
|
238
272
|
});
|
|
239
273
|
|
|
240
274
|
if (result.error) {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic search support for the pattern/find use-case.
|
|
3
|
+
*
|
|
4
|
+
* LSP workspace-symbol search with scope filtering and markdown rendering.
|
|
5
|
+
* Extracted from orchestrate.ts to keep the main use-case under the
|
|
6
|
+
* file-line limit.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { CodeSymbol } from "@mrclrchtr/supi-code-runtime/api";
|
|
10
|
+
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
11
|
+
import { createEvidenceList, renderEvidenceListDisclosure } from "../../analysis/evidence.ts";
|
|
12
|
+
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
13
|
+
import { normalizePath } from "../../analysis/search/ripgrep.ts";
|
|
14
|
+
import type { CodeIntelResult, SearchDetails } from "../../types/index.ts";
|
|
15
|
+
import type { PatternInput } from "./orchestrate.ts";
|
|
16
|
+
|
|
17
|
+
export async function executeSemanticSearch(
|
|
18
|
+
input: PatternInput,
|
|
19
|
+
provider: CodeProvider | null,
|
|
20
|
+
cwd: string,
|
|
21
|
+
): Promise<CodeIntelResult> {
|
|
22
|
+
if (!provider?.workspaceSymbols) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
"code_find semantic search is unavailable because no semantic/LSP provider is active for this workspace.",
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const symbols = await provider.workspaceSymbols(input.pattern);
|
|
29
|
+
if (symbols === null) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"code_find semantic search is unavailable because the active semantic provider cannot serve workspace symbol queries.",
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const scopePath = input.path ? normalizePath(input.path, cwd) : cwd;
|
|
36
|
+
const scopedSymbols = filterSymbolsByScope(symbols, scopePath);
|
|
37
|
+
if (scopedSymbols.length === 0) {
|
|
38
|
+
return renderSemanticEmptyResult(input);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return renderSemanticResults(input, scopedSymbols, cwd);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function filterSymbolsByScope<T extends { file: string }>(symbols: T[], scopePath: string): T[] {
|
|
45
|
+
return symbols.filter((symbol) => isWithinOrEqual(scopePath, symbol.file));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function renderSemanticEmptyResult(input: PatternInput): CodeIntelResult {
|
|
49
|
+
const relPath = input.path ?? ".";
|
|
50
|
+
return {
|
|
51
|
+
content: `**Semantic search** — \`${input.pattern}\`\n\nNo semantic results found in \`${relPath}\`.`,
|
|
52
|
+
details: {
|
|
53
|
+
type: "search",
|
|
54
|
+
data: {
|
|
55
|
+
confidence: "semantic",
|
|
56
|
+
scope: input.path ?? null,
|
|
57
|
+
candidateCount: 0,
|
|
58
|
+
omittedCount: 0,
|
|
59
|
+
nextQueries: [
|
|
60
|
+
'Use `mode: "text"` for literal text search',
|
|
61
|
+
'Use `mode: "ast"` with `kind` for structural filtering',
|
|
62
|
+
],
|
|
63
|
+
} satisfies SearchDetails,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function renderSemanticResults(
|
|
69
|
+
input: PatternInput,
|
|
70
|
+
symbols: CodeSymbol[],
|
|
71
|
+
cwd: string,
|
|
72
|
+
): CodeIntelResult {
|
|
73
|
+
const max = input.maxResults ?? 8;
|
|
74
|
+
const evidence = createEvidenceList({
|
|
75
|
+
key: "find.semanticSymbols",
|
|
76
|
+
items: symbols,
|
|
77
|
+
maxResults: max,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const lines = [
|
|
81
|
+
`**Semantic search** — \`${input.pattern}\` (${symbols.length} symbol${symbols.length !== 1 ? "s" : ""} found)`,
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
for (const sym of evidence.items) {
|
|
85
|
+
const kindLabel = sym.kind ? ` [${sym.kind}]` : "";
|
|
86
|
+
const container = sym.container ? ` (in ${sym.container})` : "";
|
|
87
|
+
const fileRel = sym.file.startsWith(cwd) ? sym.file.slice(cwd.length + 1) : sym.file;
|
|
88
|
+
const anchor = sym.nameAnchor ?? sym.declarationAnchor;
|
|
89
|
+
lines.push(`- \`${sym.name}\`${kindLabel}${container} — \`${fileRel}:${anchor.line}\``);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
93
|
+
if (disclosure) {
|
|
94
|
+
lines.push(disclosure);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
content: lines.join("\n"),
|
|
99
|
+
details: {
|
|
100
|
+
type: "search",
|
|
101
|
+
data: {
|
|
102
|
+
confidence: "semantic",
|
|
103
|
+
scope: input.path ?? null,
|
|
104
|
+
candidateCount: symbols.length,
|
|
105
|
+
omittedCount: evidence.metadata.omittedCount ?? 0,
|
|
106
|
+
evidenceLists: [evidence.metadata],
|
|
107
|
+
nextQueries: [
|
|
108
|
+
'Use `mode: "text"` for literal text search',
|
|
109
|
+
'Use `mode: "ast"` with `kind` for structural filtering',
|
|
110
|
+
],
|
|
111
|
+
} satisfies SearchDetails,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI renderer for code_find — renderCall + renderResult.
|
|
3
|
+
*/
|
|
4
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
6
|
+
import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
|
|
7
|
+
import type { CodeFindToolParams } from "./execute.ts";
|
|
8
|
+
|
|
9
|
+
/** ── renderCall ────────────────────────────────────────────────── */
|
|
10
|
+
|
|
11
|
+
export function renderFindCall(args: unknown, theme: Theme, _context: unknown): Text {
|
|
12
|
+
const params = (args ?? {}) as CodeFindToolParams;
|
|
13
|
+
const mode = params.mode ?? "text";
|
|
14
|
+
|
|
15
|
+
let content = theme.fg("toolTitle", "code_find");
|
|
16
|
+
|
|
17
|
+
if (params.query) {
|
|
18
|
+
content += ` ${theme.fg("accent", JSON.stringify(params.query))}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
content += ` ${theme.fg("muted", mode)}`;
|
|
22
|
+
|
|
23
|
+
if (params.kind) {
|
|
24
|
+
content += theme.fg("dim", ` [${params.kind}]`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return new Text(content, 0, 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** ── renderResult ──────────────────────────────────────────────── */
|
|
31
|
+
|
|
32
|
+
export function renderFindResult(
|
|
33
|
+
result: ToolResult,
|
|
34
|
+
options: ResultOptios,
|
|
35
|
+
theme: Theme,
|
|
36
|
+
_context: unknown,
|
|
37
|
+
): ReturnType<typeof renderSimpleResult> {
|
|
38
|
+
return renderSimpleResult(result, options, theme, "Searching…");
|
|
39
|
+
}
|