@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,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TUI rendering utilities for code-intelligence tool results.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from the per-tool renderers to eliminate duplication:
|
|
5
|
+
* evidence section rendering, markdown detail, count badges,
|
|
6
|
+
* partial/error guards, and the shared simple-result pattern.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getMarkdownTheme, type Theme } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
11
|
+
import { formatEvidenceBadge } from "@mrclrchtr/supi-code-runtime/api";
|
|
12
|
+
|
|
13
|
+
// ── Result type ──────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
/** Shape of a pi tool result consumed by renderResult functions. */
|
|
16
|
+
export interface ToolResult {
|
|
17
|
+
content: Array<{ type: string; text?: string }>;
|
|
18
|
+
details?: { type: string; data: Record<string, unknown> };
|
|
19
|
+
isError?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ── Evidence key labels ──────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
export const EVIDENCE_KEY_LABELS: Record<string, string> = {
|
|
25
|
+
"callees.calls": "calls",
|
|
26
|
+
"exports.symbols": "exports",
|
|
27
|
+
"find.astMatches": "AST matches",
|
|
28
|
+
"find.semanticSymbols": "symbols",
|
|
29
|
+
"find.textMatches": "matches",
|
|
30
|
+
"health.dirtyFiles": "dirty files",
|
|
31
|
+
"implements.locations": "implementations",
|
|
32
|
+
"imports.modules": "imports",
|
|
33
|
+
"inspect.codeActions": "code actions",
|
|
34
|
+
"references.locations": "references",
|
|
35
|
+
"refactor.edits": "edits",
|
|
36
|
+
"resolve.candidates": "candidates",
|
|
37
|
+
"resolve.targets": "targets",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Resolve a human-readable label for an evidence list key. */
|
|
41
|
+
export function evidenceLabel(key: string): string {
|
|
42
|
+
return EVIDENCE_KEY_LABELS[key] ?? key;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ── Evidence entires ─────────────────────────────────────────────
|
|
46
|
+
|
|
47
|
+
export interface EvidenceEntry {
|
|
48
|
+
key?: string;
|
|
49
|
+
shownCount?: number;
|
|
50
|
+
totalCount?: number | null;
|
|
51
|
+
omittedCount?: number | null;
|
|
52
|
+
partialReason?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ── Evidence section ─────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
/** Append formatted evidence badge lines to a container. */
|
|
58
|
+
export function renderEvidenceLines(
|
|
59
|
+
container: Container,
|
|
60
|
+
entries: EvidenceEntry[] | undefined,
|
|
61
|
+
theme: Theme,
|
|
62
|
+
): void {
|
|
63
|
+
if (!entries || entries.length === 0) return;
|
|
64
|
+
for (const ev of entries) {
|
|
65
|
+
const badge = formatEvidenceBadge({
|
|
66
|
+
shownCount: Number(ev.shownCount ?? 0),
|
|
67
|
+
totalCount: ev.totalCount != null ? Number(ev.totalCount) : null,
|
|
68
|
+
omittedCount: ev.omittedCount != null ? Number(ev.omittedCount) : null,
|
|
69
|
+
partialReason: typeof ev.partialReason === "string" ? ev.partialReason : null,
|
|
70
|
+
label: evidenceLabel(String(ev.key ?? "")),
|
|
71
|
+
});
|
|
72
|
+
container.addChild(new Text(theme.fg("muted", badge), 0, 0));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ── Markdown detail ──────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
interface MarkdownSource {
|
|
79
|
+
content?: Array<{ type: string; text?: string }>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Append a "raw markdown" section to a container when markdown content is present. */
|
|
83
|
+
export function renderMarkdownDetail(
|
|
84
|
+
container: Container,
|
|
85
|
+
source: MarkdownSource,
|
|
86
|
+
theme: Theme,
|
|
87
|
+
): void {
|
|
88
|
+
const markdownText = source.content?.find((c) => c.type === "text")?.text ?? "";
|
|
89
|
+
if (!markdownText) return;
|
|
90
|
+
container.addChild(new Spacer(1));
|
|
91
|
+
const divider = `${theme.fg("border", "────")} ${theme.fg("dim", "raw markdown")} ${theme.fg("border", "─".repeat(100))}`;
|
|
92
|
+
container.addChild(new Text(divider, 0, 0));
|
|
93
|
+
container.addChild(new Markdown(markdownText, 0, 0, getMarkdownTheme()));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ── Partial / error guards ───────────────────────────────────────
|
|
97
|
+
|
|
98
|
+
export function renderPartial(label: string, theme: Theme): Text {
|
|
99
|
+
return new Text(theme.fg("warning", label), 0, 0);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function renderError(label: string, theme: Theme): Text {
|
|
103
|
+
return new Text(theme.fg("error", label), 0, 0);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ── Result optios ────────────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
export interface ResultOptios {
|
|
109
|
+
expanded: boolean;
|
|
110
|
+
isPartial: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Shared simple-result renderer ────────────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Shared result renderer for the "simple" code-intelligence tools
|
|
117
|
+
* (resolve, inspect, find, impact, refactor_plan, refactor_apply).
|
|
118
|
+
*
|
|
119
|
+
* Handles partial, error, compact, and expanded states uniformly.
|
|
120
|
+
*/
|
|
121
|
+
export function renderSimpleResult(
|
|
122
|
+
result: ToolResult,
|
|
123
|
+
options: ResultOptios,
|
|
124
|
+
theme: Theme,
|
|
125
|
+
partialLabel: string,
|
|
126
|
+
): Container | Text {
|
|
127
|
+
if (options.isPartial) return renderPartial(partialLabel, theme);
|
|
128
|
+
if (result.isError) return renderError("Tool failed", theme);
|
|
129
|
+
|
|
130
|
+
const data = result.details?.data as Record<string, unknown> | undefined;
|
|
131
|
+
if (options.expanded) return buildExpandedView(result, data, theme);
|
|
132
|
+
|
|
133
|
+
return buildSimpleCompact(data, theme);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function buildExpandedView(
|
|
137
|
+
result: ToolResult,
|
|
138
|
+
data: Record<string, unknown> | undefined,
|
|
139
|
+
theme: Theme,
|
|
140
|
+
): Container {
|
|
141
|
+
const container = new Container();
|
|
142
|
+
|
|
143
|
+
const header = buildSimpleHeader(data, theme);
|
|
144
|
+
if (header) container.addChild(header);
|
|
145
|
+
|
|
146
|
+
const lists = data?.evidenceLists as EvidenceEntry[] | undefined;
|
|
147
|
+
if (lists && lists.length > 0) {
|
|
148
|
+
container.addChild(new Spacer(1));
|
|
149
|
+
renderEvidenceLines(container, lists, theme);
|
|
150
|
+
container.addChild(new Spacer(1));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
renderMarkdownDetail(container, result, theme);
|
|
154
|
+
|
|
155
|
+
return container;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Options for {@link buildSimpleCompact} and {@link buildSimpleHeader}. */
|
|
159
|
+
export interface SimpleResultOptions {
|
|
160
|
+
/** Omitted count for the evidence badge. Defaults to 0. */
|
|
161
|
+
omittedCount?: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function buildSimpleCompact(
|
|
165
|
+
data: Record<string, unknown> | undefined,
|
|
166
|
+
theme: Theme,
|
|
167
|
+
opts?: SimpleResultOptions,
|
|
168
|
+
): Text {
|
|
169
|
+
if (!data) return new Text(theme.fg("dim", "No results"), 0, 0);
|
|
170
|
+
|
|
171
|
+
const candidateCount = (data.candidateCount as number) ?? (data.targetCount as number) ?? 0;
|
|
172
|
+
const omittedCount = opts?.omittedCount ?? 0;
|
|
173
|
+
const confidence = (data.confidence as string) ?? "";
|
|
174
|
+
|
|
175
|
+
const badge = formatEvidenceBadge({
|
|
176
|
+
shownCount: candidateCount,
|
|
177
|
+
totalCount: candidateCount + omittedCount,
|
|
178
|
+
omittedCount,
|
|
179
|
+
partialReason: null,
|
|
180
|
+
label: "results",
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const dot = theme.fg("dim", "·");
|
|
184
|
+
const segments = [theme.fg("success", theme.bold(badge))];
|
|
185
|
+
if (confidence) {
|
|
186
|
+
segments.push(`${theme.fg("dim", "confidence")} ${theme.fg("muted", confidence)}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return new Text(segments.join(` ${dot} `), 0, 0);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function buildSimpleHeader(
|
|
193
|
+
data: Record<string, unknown> | undefined,
|
|
194
|
+
theme: Theme,
|
|
195
|
+
opts?: SimpleResultOptions,
|
|
196
|
+
): Text | null {
|
|
197
|
+
if (!data) return null;
|
|
198
|
+
|
|
199
|
+
const candidateCount = (data.candidateCount as number) ?? (data.targetCount as number) ?? 0;
|
|
200
|
+
const omittedCount = opts?.omittedCount ?? 0;
|
|
201
|
+
const confidence = (data.confidence as string) ?? "";
|
|
202
|
+
|
|
203
|
+
if (candidateCount === 0 && !confidence) return null;
|
|
204
|
+
|
|
205
|
+
const badge = formatEvidenceBadge({
|
|
206
|
+
shownCount: candidateCount,
|
|
207
|
+
totalCount: candidateCount + omittedCount,
|
|
208
|
+
omittedCount,
|
|
209
|
+
partialReason: null,
|
|
210
|
+
label: "results",
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const dot = theme.fg("dim", "·");
|
|
214
|
+
const segments = [theme.fg("accent", theme.bold(badge))];
|
|
215
|
+
if (confidence) {
|
|
216
|
+
segments.push(`${theme.fg("dim", "confidence")} ${theme.fg("muted", confidence)}`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return new Text(segments.join(` ${dot} `), 0, 0);
|
|
220
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel export for code-intelligence TUI renderers.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
renderFindCall,
|
|
7
|
+
renderFindResult,
|
|
8
|
+
} from "../../tool/find/tui.ts";
|
|
9
|
+
export {
|
|
10
|
+
renderGraphCall,
|
|
11
|
+
renderGraphResult,
|
|
12
|
+
} from "../../tool/graph/tui.ts";
|
|
13
|
+
export {
|
|
14
|
+
renderHealthCall,
|
|
15
|
+
renderHealthResult,
|
|
16
|
+
} from "../../tool/health/tui.ts";
|
|
17
|
+
export {
|
|
18
|
+
renderImpactCall,
|
|
19
|
+
renderImpactResult,
|
|
20
|
+
} from "../../tool/impact/tui.ts";
|
|
21
|
+
export {
|
|
22
|
+
renderInspectCall,
|
|
23
|
+
renderInspectResult,
|
|
24
|
+
} from "../../tool/inspect/tui.ts";
|
|
25
|
+
export { renderOrientationCall, renderOrientationResult } from "../../tool/orientation/tui.ts";
|
|
26
|
+
export {
|
|
27
|
+
renderRefactorApplyCall,
|
|
28
|
+
renderRefactorApplyResult,
|
|
29
|
+
} from "../../tool/refactor-apply/tui.ts";
|
|
30
|
+
export {
|
|
31
|
+
renderRefactorPlanCall,
|
|
32
|
+
renderRefactorPlanResult,
|
|
33
|
+
} from "../../tool/refactor-plan/tui.ts";
|
|
34
|
+
export {
|
|
35
|
+
renderResolveCall,
|
|
36
|
+
renderResolveResult,
|
|
37
|
+
} from "../../tool/resolve/tui.ts";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./lsp.ts";
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
// LSP result formatting — converts LSP response types into readable text.
|
|
2
|
-
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import type {
|
|
5
|
-
AnnotatedTextEdit,
|
|
6
|
-
CodeAction,
|
|
7
|
-
DocumentSymbol,
|
|
8
|
-
Hover,
|
|
9
|
-
Location,
|
|
10
|
-
LocationLink,
|
|
11
|
-
MarkedString,
|
|
12
|
-
MarkupContent,
|
|
13
|
-
SnippetTextEdit,
|
|
14
|
-
SymbolInformation,
|
|
15
|
-
TextEdit,
|
|
16
|
-
WorkspaceEdit,
|
|
17
|
-
WorkspaceSymbol,
|
|
18
|
-
} from "./config/types.ts";
|
|
19
|
-
import { isProjectSource } from "./summary.ts";
|
|
20
|
-
import { uriToFile } from "./utils.ts";
|
|
21
|
-
|
|
22
|
-
// ── Hover ─────────────────────────────────────────────────────────────
|
|
23
|
-
|
|
24
|
-
export function formatHover(hover: Hover): string {
|
|
25
|
-
const contents = hover.contents;
|
|
26
|
-
|
|
27
|
-
if (typeof contents === "string") return contents;
|
|
28
|
-
if ("value" in contents) {
|
|
29
|
-
const mc = contents as MarkupContent | { language: string; value: string };
|
|
30
|
-
if ("kind" in mc) return mc.value;
|
|
31
|
-
return `\`\`\`${mc.language}\n${mc.value}\n\`\`\``;
|
|
32
|
-
}
|
|
33
|
-
if (Array.isArray(contents)) {
|
|
34
|
-
return (contents as MarkedString[])
|
|
35
|
-
.map((c) => (typeof c === "string" ? c : `\`\`\`${c.language}\n${c.value}\n\`\`\``))
|
|
36
|
-
.join("\n\n");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return String(contents);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// ── Locations ─────────────────────────────────────────────────────────
|
|
43
|
-
|
|
44
|
-
function formatLocationLine(loc: Location, cwd: string): string {
|
|
45
|
-
const file = relPath(uriToFile(loc.uri), cwd);
|
|
46
|
-
const line = loc.range.start.line + 1;
|
|
47
|
-
const col = loc.range.start.character + 1;
|
|
48
|
-
return `${file}:${line}:${col}`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function formatLocationList(label: string, locs: Location[], cwd: string): string {
|
|
52
|
-
const lines = [`${label} (${locs.length} locations):\n`];
|
|
53
|
-
for (const loc of locs) {
|
|
54
|
-
lines.push(`- ${formatLocationLine(loc, cwd)}`);
|
|
55
|
-
}
|
|
56
|
-
return lines.join("\n");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function formatExternalFallback(label: string, locs: Location[], cwd: string): string {
|
|
60
|
-
const maxShown = 3;
|
|
61
|
-
const shown = locs.slice(0, maxShown);
|
|
62
|
-
const hidden = locs.length - maxShown;
|
|
63
|
-
|
|
64
|
-
let result: string;
|
|
65
|
-
if (shown.length === 1) {
|
|
66
|
-
result = `${label}: ${formatLocationLine(shown[0], cwd)}`;
|
|
67
|
-
} else {
|
|
68
|
-
const lines = [`${label} (${locs.length} locations):\n`];
|
|
69
|
-
for (const loc of shown) {
|
|
70
|
-
lines.push(`- ${formatLocationLine(loc, cwd)}`);
|
|
71
|
-
}
|
|
72
|
-
result = lines.join("\n");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (hidden > 0) {
|
|
76
|
-
result += `\n+${hidden} more external ${hidden === 1 ? "location" : "locations"}`;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function formatExternalSuffix(count: number): string {
|
|
83
|
-
return count === 1
|
|
84
|
-
? "+1 external location (node_modules, .pnpm, or out-of-tree)"
|
|
85
|
-
: `+${count} external locations (node_modules, .pnpm, or out-of-tree)`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function formatLocations(label: string, locations: Location[], cwd: string): string {
|
|
89
|
-
const projectLocs: Location[] = [];
|
|
90
|
-
const externalLocs: Location[] = [];
|
|
91
|
-
for (const loc of locations) {
|
|
92
|
-
if (isProjectSource(uriToFile(loc.uri), cwd)) {
|
|
93
|
-
projectLocs.push(loc);
|
|
94
|
-
} else {
|
|
95
|
-
externalLocs.push(loc);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
let result: string;
|
|
100
|
-
|
|
101
|
-
if (projectLocs.length === 1) {
|
|
102
|
-
result = `${label}: ${formatLocationLine(projectLocs[0], cwd)}`;
|
|
103
|
-
} else if (projectLocs.length > 1) {
|
|
104
|
-
result = formatLocationList(label, projectLocs, cwd);
|
|
105
|
-
} else if (externalLocs.length > 0) {
|
|
106
|
-
return formatExternalFallback(label, externalLocs, cwd);
|
|
107
|
-
} else {
|
|
108
|
-
return `${label}: No locations found.`;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (externalLocs.length > 0) {
|
|
112
|
-
result += `\n${formatExternalSuffix(externalLocs.length)}`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function normalizeLocations(result: Location | Location[] | LocationLink[]): Location[] {
|
|
119
|
-
if (Array.isArray(result)) {
|
|
120
|
-
return result.map((item) => {
|
|
121
|
-
if ("targetUri" in item) {
|
|
122
|
-
const link = item as LocationLink;
|
|
123
|
-
return { uri: link.targetUri, range: link.targetSelectionRange };
|
|
124
|
-
}
|
|
125
|
-
return item as Location;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
return [result as Location];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ── Symbols ───────────────────────────────────────────────────────────
|
|
132
|
-
|
|
133
|
-
export function formatDocumentSymbols(symbols: DocumentSymbol[], indent: number): string {
|
|
134
|
-
const lines: string[] = [];
|
|
135
|
-
const prefix = " ".repeat(indent);
|
|
136
|
-
|
|
137
|
-
for (const sym of symbols) {
|
|
138
|
-
const kind = symbolKindName(sym.kind);
|
|
139
|
-
const line = sym.selectionRange.start.line + 1;
|
|
140
|
-
const detail = sym.detail ? ` — ${sym.detail}` : "";
|
|
141
|
-
lines.push(`${prefix}- ${kind} **${sym.name}**${detail} (line ${line})`);
|
|
142
|
-
|
|
143
|
-
if (sym.children && sym.children.length > 0) {
|
|
144
|
-
lines.push(formatDocumentSymbols(sym.children, indent + 1));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return lines.join("\n");
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function formatSymbolInformation(symbols: SymbolInformation[], cwd: string): string {
|
|
152
|
-
const projectSyms: (SymbolInformation | WorkspaceSymbol)[] = [];
|
|
153
|
-
const externalSyms: (SymbolInformation | WorkspaceSymbol)[] = [];
|
|
154
|
-
for (const sym of symbols) {
|
|
155
|
-
if (isProjectSource(uriToFile(sym.location.uri), cwd)) {
|
|
156
|
-
projectSyms.push(sym);
|
|
157
|
-
} else {
|
|
158
|
-
externalSyms.push(sym);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const lines: string[] = [];
|
|
163
|
-
const symbolsToShow = projectSyms.length > 0 ? projectSyms : externalSyms;
|
|
164
|
-
for (const sym of symbolsToShow) {
|
|
165
|
-
const kind = symbolKindName(sym.kind);
|
|
166
|
-
const file = relPath(uriToFile(sym.location.uri), cwd);
|
|
167
|
-
const line = "range" in sym.location ? sym.location.range.start.line + 1 : "?";
|
|
168
|
-
const container = sym.containerName ? ` (in ${sym.containerName})` : "";
|
|
169
|
-
lines.push(`- ${kind} **${sym.name}**${container} — ${file}:${line}`);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (projectSyms.length > 0 && externalSyms.length > 0) {
|
|
173
|
-
const suffix =
|
|
174
|
-
externalSyms.length === 1
|
|
175
|
-
? "+1 external symbol (node_modules, .pnpm, or out-of-tree)"
|
|
176
|
-
: `+${externalSyms.length} external symbols (node_modules, .pnpm, or out-of-tree)`;
|
|
177
|
-
lines.push(`- _${suffix}_`);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return lines.join("\n");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ── Workspace Edits ───────────────────────────────────────────────────
|
|
184
|
-
|
|
185
|
-
interface DisplayEdit {
|
|
186
|
-
range: { start: { line: number } };
|
|
187
|
-
newText: string;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
interface EditEntry {
|
|
191
|
-
file: string;
|
|
192
|
-
edits: DisplayEdit[];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Normalize a TextEdit/AnnotatedTextEdit/SnippetTextEdit to a display-friendly form.
|
|
197
|
-
*
|
|
198
|
-
* @since 3.18.0 — vscode-languageserver-types widened TextDocumentEdit.edits to include
|
|
199
|
-
* SnippetTextEdit (guarded by `workspace.workspaceEdit.snippetEditSupport` client capability).
|
|
200
|
-
*/
|
|
201
|
-
function editToDisplay(edit: TextEdit | AnnotatedTextEdit | SnippetTextEdit): DisplayEdit {
|
|
202
|
-
if ("snippet" in edit) {
|
|
203
|
-
return { range: edit.range, newText: edit.snippet.value };
|
|
204
|
-
}
|
|
205
|
-
return { range: edit.range, newText: edit.newText };
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: pre-existing — not introduced by this change
|
|
209
|
-
function partitionWorkspaceEdit(
|
|
210
|
-
edit: WorkspaceEdit,
|
|
211
|
-
cwd: string,
|
|
212
|
-
): { projectChanges: EditEntry[]; externalCount: number } {
|
|
213
|
-
const projectChanges: EditEntry[] = [];
|
|
214
|
-
let externalCount = 0;
|
|
215
|
-
|
|
216
|
-
if (edit.changes) {
|
|
217
|
-
for (const [uri, edits] of Object.entries(edit.changes)) {
|
|
218
|
-
const filePath = uriToFile(uri);
|
|
219
|
-
if (isProjectSource(filePath, cwd)) {
|
|
220
|
-
projectChanges.push({
|
|
221
|
-
file: relPath(filePath, cwd),
|
|
222
|
-
edits: edits.map(editToDisplay),
|
|
223
|
-
});
|
|
224
|
-
} else {
|
|
225
|
-
externalCount++;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (edit.documentChanges) {
|
|
231
|
-
for (const dc of edit.documentChanges) {
|
|
232
|
-
if (!("textDocument" in dc)) continue;
|
|
233
|
-
const filePath = uriToFile(dc.textDocument.uri);
|
|
234
|
-
if (isProjectSource(filePath, cwd)) {
|
|
235
|
-
projectChanges.push({
|
|
236
|
-
file: relPath(filePath, cwd),
|
|
237
|
-
edits: dc.edits.map(editToDisplay),
|
|
238
|
-
});
|
|
239
|
-
} else {
|
|
240
|
-
externalCount++;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return { projectChanges, externalCount };
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export function formatWorkspaceEdit(edit: WorkspaceEdit, cwd: string): string {
|
|
249
|
-
const { projectChanges, externalCount } = partitionWorkspaceEdit(edit, cwd);
|
|
250
|
-
|
|
251
|
-
const lines: string[] = ["Rename workspace edit:\n"];
|
|
252
|
-
for (const { file, edits } of projectChanges) {
|
|
253
|
-
lines.push(`**${file}** (${edits.length} change(s))`);
|
|
254
|
-
for (const e of edits) {
|
|
255
|
-
const line = e.range.start.line + 1;
|
|
256
|
-
lines.push(` Line ${line}: → "${e.newText}"`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (externalCount > 0) {
|
|
261
|
-
const suffix =
|
|
262
|
-
externalCount === 1
|
|
263
|
-
? "+1 external file (node_modules, .pnpm, or out-of-tree)"
|
|
264
|
-
: `+${externalCount} external files (node_modules, .pnpm, or out-of-tree)`;
|
|
265
|
-
lines.push(`\n_${suffix}_`);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return lines.join("\n");
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// ── Code Actions ──────────────────────────────────────────────────────
|
|
272
|
-
|
|
273
|
-
export function formatCodeActions(actions: CodeAction[]): string {
|
|
274
|
-
const lines = [`Available code actions (${actions.length}):\n`];
|
|
275
|
-
for (const action of actions) {
|
|
276
|
-
const kind = action.kind ? ` [${action.kind}]` : "";
|
|
277
|
-
const preferred = action.isPreferred ? " ⭐" : "";
|
|
278
|
-
lines.push(`- **${action.title}**${kind}${preferred}`);
|
|
279
|
-
if (action.edit) {
|
|
280
|
-
const fileCount = action.edit.changes
|
|
281
|
-
? Object.keys(action.edit.changes).length
|
|
282
|
-
: (action.edit.documentChanges?.length ?? 0);
|
|
283
|
-
lines.push(` Edits ${fileCount} file(s)`);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return lines.join("\n");
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// ── Workspace Symbols ─────────────────────────────────────────────────
|
|
290
|
-
|
|
291
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: pre-existing — threshold exceeded by widened parameter type for WorkspaceSymbol compatibility
|
|
292
|
-
export function formatWorkspaceSymbols(
|
|
293
|
-
symbols: (SymbolInformation | WorkspaceSymbol)[],
|
|
294
|
-
cwd: string,
|
|
295
|
-
): string {
|
|
296
|
-
if (symbols.length === 0) return "No symbols found.";
|
|
297
|
-
|
|
298
|
-
const projectSyms: (SymbolInformation | WorkspaceSymbol)[] = [];
|
|
299
|
-
const externalSyms: (SymbolInformation | WorkspaceSymbol)[] = [];
|
|
300
|
-
for (const sym of symbols) {
|
|
301
|
-
if (isProjectSource(uriToFile(sym.location.uri), cwd)) {
|
|
302
|
-
projectSyms.push(sym);
|
|
303
|
-
} else {
|
|
304
|
-
externalSyms.push(sym);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (projectSyms.length === 0 && externalSyms.length > 0) {
|
|
309
|
-
return `Workspace symbols: No in-project symbols found.\n+${externalSyms.length} external symbol${externalSyms.length === 1 ? "" : "s"} (node_modules, .pnpm, or out-of-tree).`;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const lines = [`Workspace symbols (${projectSyms.length}):\n`];
|
|
313
|
-
for (const sym of projectSyms) {
|
|
314
|
-
const kind = symbolKindName(sym.kind);
|
|
315
|
-
const file = relPath(uriToFile(sym.location.uri), cwd);
|
|
316
|
-
const loc = "range" in sym.location ? sym.location.range : null;
|
|
317
|
-
const line = loc ? loc.start.line + 1 : "?";
|
|
318
|
-
const col = loc ? loc.start.character + 1 : "?";
|
|
319
|
-
const container = sym.containerName ? ` — ${sym.containerName}` : "";
|
|
320
|
-
lines.push(`- **${sym.name}** (${kind})${container} — ${file}:${line}:${col}`);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (externalSyms.length > 0) {
|
|
324
|
-
const suffix =
|
|
325
|
-
externalSyms.length === 1
|
|
326
|
-
? "+1 external symbol (node_modules, .pnpm, or out-of-tree)"
|
|
327
|
-
: `+${externalSyms.length} external symbols (node_modules, .pnpm, or out-of-tree)`;
|
|
328
|
-
lines.push(`\n_${suffix}_`);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return lines.join("\n");
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// ── Symbol Kind Names ─────────────────────────────────────────────────
|
|
335
|
-
|
|
336
|
-
const SYMBOL_KIND_NAMES: Record<number, string> = {
|
|
337
|
-
1: "File",
|
|
338
|
-
2: "Module",
|
|
339
|
-
3: "Namespace",
|
|
340
|
-
4: "Package",
|
|
341
|
-
5: "Class",
|
|
342
|
-
6: "Method",
|
|
343
|
-
7: "Property",
|
|
344
|
-
8: "Field",
|
|
345
|
-
9: "Constructor",
|
|
346
|
-
10: "Enum",
|
|
347
|
-
11: "Interface",
|
|
348
|
-
12: "Function",
|
|
349
|
-
13: "Variable",
|
|
350
|
-
14: "Constant",
|
|
351
|
-
15: "String",
|
|
352
|
-
16: "Number",
|
|
353
|
-
17: "Boolean",
|
|
354
|
-
18: "Array",
|
|
355
|
-
19: "Object",
|
|
356
|
-
20: "Key",
|
|
357
|
-
21: "Null",
|
|
358
|
-
22: "EnumMember",
|
|
359
|
-
23: "Struct",
|
|
360
|
-
24: "Event",
|
|
361
|
-
25: "Operator",
|
|
362
|
-
26: "TypeParameter",
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
function symbolKindName(kind: number): string {
|
|
366
|
-
return SYMBOL_KIND_NAMES[kind] ?? `Kind(${kind})`;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// ── Helpers ───────────────────────────────────────────────────────────
|
|
370
|
-
|
|
371
|
-
function relPath(filePath: string, cwd: string): string {
|
|
372
|
-
return path.relative(cwd, filePath);
|
|
373
|
-
}
|