@mrclrchtr/supi-code-intelligence 1.16.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +373 -63
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
- package/package.json +14 -9
- package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
- package/src/analysis/architecture/model.ts +76 -0
- package/src/analysis/brief/directory.ts +324 -0
- package/src/analysis/brief/enrich.ts +157 -0
- package/src/analysis/brief/file.ts +84 -0
- package/src/analysis/brief/inventory.ts +177 -0
- package/src/analysis/brief/main.ts +176 -0
- package/src/analysis/brief/models.ts +75 -0
- package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
- package/src/analysis/brief/summarize.ts +208 -0
- package/src/analysis/brief/types.ts +27 -0
- package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
- package/src/analysis/coverage/coverage-warnings.ts +224 -0
- package/src/analysis/evidence.ts +91 -0
- package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
- package/src/analysis/provider.ts +186 -0
- package/src/analysis/read-next.ts +126 -0
- package/src/analysis/readiness.ts +73 -0
- package/src/{refactor → analysis/refactor}/safety.ts +1 -1
- package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
- package/src/analysis/search/pattern.ts +345 -0
- package/src/analysis/search/ripgrep.ts +473 -0
- package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
- package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
- package/src/analysis/target/anchored.ts +349 -0
- package/src/analysis/target/bridge.ts +152 -0
- package/src/analysis/target/file-resolution.ts +125 -0
- package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
- package/src/{planner → analysis/target}/planner.ts +30 -20
- package/src/{targeting → analysis/target}/query.ts +17 -3
- package/src/analysis/target/resolve-common.ts +115 -0
- package/src/analysis/target/service.ts +229 -0
- package/src/analysis/target/symbol.ts +196 -0
- package/src/{targeting → analysis/target}/types.ts +17 -1
- package/src/analysis/tests/likely-tests.ts +174 -0
- package/src/analysis/tests/test-discovery.ts +540 -0
- package/src/analysis/tests/vitest.ts +87 -0
- package/src/api.ts +34 -41
- package/src/app/app.ts +125 -0
- package/src/app/manager.ts +65 -0
- package/src/extension.ts +132 -1
- package/src/index.ts +1 -57
- package/src/session/refactor-plans.ts +82 -0
- package/src/session/session.ts +300 -0
- package/src/session/target-store.ts +293 -0
- package/src/substrate/lsp/diagnostic-injection.ts +218 -0
- package/src/substrate/lsp/lifecycle.ts +66 -0
- package/src/substrate/lsp/overrides.ts +132 -0
- package/src/substrate/lsp/recovery.ts +55 -0
- package/src/substrate/lsp/settings.ts +286 -0
- package/src/substrate/lsp/state.ts +46 -0
- package/src/substrate/lsp/utils.ts +17 -0
- package/src/substrate/tree-sitter/lifecycle.ts +52 -0
- package/src/tool/find/execute.ts +118 -0
- package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
- package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
- package/src/tool/find/semantic-search.ts +114 -0
- package/src/tool/find/tui.ts +39 -0
- package/src/tool/graph/callees.ts +87 -0
- package/src/tool/graph/calls-md.ts +54 -0
- package/src/tool/graph/collect-relation.ts +371 -0
- package/src/tool/graph/execute.ts +95 -0
- package/src/tool/graph/implementations-md.ts +79 -0
- package/src/tool/graph/implementations.ts +76 -0
- package/src/tool/graph/markdown-base.ts +243 -0
- package/src/tool/graph/orchestrate.ts +285 -0
- package/src/tool/graph/references-md.ts +34 -0
- package/src/tool/graph/references.ts +81 -0
- package/src/tool/graph/tui.ts +120 -0
- package/src/tool/graph/types.ts +97 -0
- package/src/tool/guidance.ts +96 -49
- package/src/tool/health/execute.ts +76 -0
- package/src/tool/health/markdown.ts +280 -0
- package/src/tool/health/orchestrate.ts +159 -0
- package/src/tool/health/sections/diagnostics.ts +182 -0
- package/src/tool/health/sections/recovery.ts +89 -0
- package/src/tool/health/sections/signals.ts +89 -0
- package/src/tool/health/tui.ts +137 -0
- package/src/tool/impact/analysis.ts +247 -0
- package/src/tool/impact/change-set-impact.ts +151 -0
- package/src/tool/impact/execute.ts +98 -0
- package/src/tool/impact/file-level-impact.ts +81 -0
- package/src/tool/impact/markdown.ts +283 -0
- package/src/tool/impact/orchestrate.ts +97 -0
- package/src/tool/impact/result.ts +21 -0
- package/src/tool/impact/single-impact.ts +89 -0
- package/src/tool/impact/tui.ts +39 -0
- package/src/tool/impact/types.ts +34 -0
- package/src/tool/infra/cross-field.ts +335 -0
- package/src/tool/infra/error-results.ts +199 -0
- package/src/tool/infra/pipeline.ts +311 -0
- package/src/tool/infra/progress.ts +21 -0
- package/src/tool/infra/readiness-message.ts +5 -0
- package/src/tool/infra/truncate.ts +49 -0
- package/src/tool/inspect/execute.ts +76 -0
- package/src/tool/inspect/markdown.ts +169 -0
- package/src/tool/inspect/orchestrate.ts +156 -0
- package/src/tool/inspect/tui.ts +36 -0
- package/src/tool/orientation/deps.ts +63 -0
- package/src/tool/orientation/execute.ts +50 -0
- package/src/tool/orientation/markdown.ts +35 -0
- package/src/tool/orientation/mode.ts +88 -0
- package/src/tool/orientation/orchestrate.ts +478 -0
- package/src/tool/orientation/precise-target.ts +257 -0
- package/src/tool/orientation/tui.ts +131 -0
- package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
- package/src/tool/refactor-apply/execute.ts +20 -0
- package/src/tool/refactor-apply/markdown.ts +118 -0
- package/src/tool/refactor-apply/orchestrate.ts +89 -0
- package/src/tool/refactor-apply/tui.ts +51 -0
- package/src/tool/refactor-plan/execute.ts +73 -0
- package/src/tool/refactor-plan/markdown.ts +118 -0
- package/src/tool/refactor-plan/orchestrate.ts +363 -0
- package/src/tool/refactor-plan/tui.ts +42 -0
- package/src/tool/register.ts +123 -0
- package/src/tool/resolve/execute.ts +82 -0
- package/src/tool/resolve/markdown.ts +150 -0
- package/src/tool/resolve/orchestrate.ts +134 -0
- package/src/tool/resolve/tui.ts +40 -0
- package/src/tool/schemas.ts +337 -0
- package/src/tool/specs.ts +257 -0
- package/src/types/details.ts +188 -0
- package/src/types/execution.ts +60 -0
- package/src/types/index.ts +28 -0
- package/src/{intent/types.ts → types/tool-names.ts} +15 -14
- package/src/ui/footer.ts +52 -0
- package/src/ui/markdown/brief.ts +218 -0
- package/src/ui/markdown/gather.ts +177 -0
- package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
- package/src/{presentation → ui}/markdown/overview.ts +2 -2
- package/src/ui/markdown/types.ts +80 -0
- package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
- package/src/ui/status-command.ts +260 -0
- package/src/ui/status-overlay.ts +500 -0
- package/src/ui/tui/common.ts +220 -0
- package/src/ui/tui/index.ts +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
- package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
- package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
- package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
- package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
- package/src/brief-focused.ts +0 -563
- package/src/code-intelligence.ts +0 -70
- package/src/pattern-structured.ts +0 -194
- package/src/presentation/markdown/affected.ts +0 -170
- package/src/presentation/markdown/brief.ts +0 -174
- package/src/presentation/markdown/map.ts +0 -54
- package/src/presentation/markdown/refactor.ts +0 -27
- package/src/presentation/markdown/relations.ts +0 -121
- package/src/resolve-target.ts +0 -130
- package/src/search-helpers.ts +0 -303
- package/src/substrates/types.ts +0 -30
- package/src/target-resolution.ts +0 -122
- package/src/targeting/resolve-anchored.ts +0 -80
- package/src/targeting/resolve-symbol.ts +0 -110
- package/src/tool/execute-affected.ts +0 -71
- package/src/tool/execute-brief.ts +0 -59
- package/src/tool/execute-map.ts +0 -35
- package/src/tool/execute-pattern.ts +0 -29
- package/src/tool/execute-refactor.ts +0 -101
- package/src/tool/execute-relations.ts +0 -79
- package/src/tool/register-tools.ts +0 -32
- package/src/tool/tool-specs.ts +0 -190
- package/src/tool/validation.ts +0 -43
- package/src/types.ts +0 -169
- package/src/use-case/generate-affected.ts +0 -297
- package/src/use-case/generate-map.ts +0 -176
- package/src/use-case/generate-relations.ts +0 -438
- package/src/use-case/types.ts +0 -43
- package/src/workspace/request-context.ts +0 -139
- /package/src/{query-params.ts → tool/params.ts} +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverage warning evaluation for degraded structural and semantic coverage.
|
|
3
|
+
*
|
|
4
|
+
* Normalizes LSP startup state, Tree-sitter health, and deprecated config keys
|
|
5
|
+
* into a structured warning report consumed by chat warnings, /supi-ci-status,
|
|
6
|
+
* and code_health.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getDefaultWorkspaceRuntime } from "@mrclrchtr/supi-code-runtime/api";
|
|
10
|
+
import { loadSupiConfigForScope } from "@mrclrchtr/supi-core/config";
|
|
11
|
+
import { getDeprecatedLspKeys, loadConfig, scanMissingServers } from "@mrclrchtr/supi-lsp/api";
|
|
12
|
+
|
|
13
|
+
export interface CoverageWarning {
|
|
14
|
+
type: "deprecated-key" | "language-disabled" | "missing-server" | "structural-unavailable";
|
|
15
|
+
message: string;
|
|
16
|
+
language?: string;
|
|
17
|
+
detail?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CoverageWarningReport {
|
|
21
|
+
hasWarnings: boolean;
|
|
22
|
+
warnings: CoverageWarning[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CoverageMissingServerSource {
|
|
26
|
+
getMissingServers(): Array<{ name: string; command: string; foundExtensions?: string[] }>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Input needed to evaluate coverage. */
|
|
30
|
+
export interface CoverageEvalInput {
|
|
31
|
+
deprecatedKeys: ReturnType<typeof getDeprecatedLspKeys>;
|
|
32
|
+
explicitlyDisabledLanguages: string[];
|
|
33
|
+
missingServers: Array<{ name: string; command: string; foundExtensions: string[] }>;
|
|
34
|
+
structuralState: { kind: string; reason?: string };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ── Evaluation ───────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Evaluate the current coverage state and return a structured warning report.
|
|
41
|
+
*
|
|
42
|
+
* Does not handle deduplication or grace period — callers are responsible
|
|
43
|
+
* for managing emission timing through CoverageWarningState.
|
|
44
|
+
*/
|
|
45
|
+
export function evaluateCoverageWarnings(input: CoverageEvalInput): CoverageWarningReport {
|
|
46
|
+
const warnings: CoverageWarning[] = [];
|
|
47
|
+
|
|
48
|
+
// 1. Deprecated keys
|
|
49
|
+
if (input.deprecatedKeys.projectEnabled || input.deprecatedKeys.globalEnabled) {
|
|
50
|
+
warnings.push({
|
|
51
|
+
type: "deprecated-key",
|
|
52
|
+
message:
|
|
53
|
+
"lsp.enabled is deprecated and ignored. Use lsp.servers.<language>.enabled: false for per-language disable.",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (input.deprecatedKeys.projectActive || input.deprecatedKeys.globalActive) {
|
|
57
|
+
warnings.push({
|
|
58
|
+
type: "deprecated-key",
|
|
59
|
+
message:
|
|
60
|
+
"lsp.active is deprecated and ignored. All detected servers are attempted unless explicitly disabled.",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 2. Explicitly disabled languages
|
|
65
|
+
for (const lang of input.explicitlyDisabledLanguages) {
|
|
66
|
+
warnings.push({
|
|
67
|
+
type: "language-disabled",
|
|
68
|
+
language: lang,
|
|
69
|
+
message: `Semantic coverage reduced: "${lang}" servers are disabled via lsp.servers.${lang}.enabled: false`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 3. Missing server binaries
|
|
74
|
+
for (const server of input.missingServers) {
|
|
75
|
+
warnings.push({
|
|
76
|
+
type: "missing-server",
|
|
77
|
+
language: server.name,
|
|
78
|
+
message: `Cannot start "${server.name}" server — "${server.command}" not found on PATH`,
|
|
79
|
+
detail:
|
|
80
|
+
server.foundExtensions.length > 0
|
|
81
|
+
? `Affected file types: ${server.foundExtensions.join(", ")}`
|
|
82
|
+
: undefined,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 4. Structural (Tree-sitter) failure
|
|
87
|
+
if (input.structuralState.kind === "unavailable") {
|
|
88
|
+
warnings.push({
|
|
89
|
+
type: "structural-unavailable",
|
|
90
|
+
message: `Structural coverage unavailable: ${input.structuralState.reason ?? "Tree-sitter initialization failed"}`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return { hasWarnings: warnings.length > 0, warnings };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── Session state (deduplication + grace period) ─────────────
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Per-session state for managing warning emission timing and deduplication.
|
|
101
|
+
*/
|
|
102
|
+
export class CoverageWarningState {
|
|
103
|
+
private lastWarningsHash: string | null = null;
|
|
104
|
+
private forceEmitted = false;
|
|
105
|
+
private readonly startedAt: number;
|
|
106
|
+
|
|
107
|
+
constructor() {
|
|
108
|
+
this.startedAt = Date.now();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Return warnings that should be emitted to the user now.
|
|
113
|
+
*
|
|
114
|
+
* Deduplication is hash-based rather than once-per-session: if the
|
|
115
|
+
* warning set changes (e.g., a new missing server is detected), the
|
|
116
|
+
* new warnings are emitted. Identical sets are suppressed.
|
|
117
|
+
* - Respects grace period (no warnings before `gracePeriodMs` has elapsed)
|
|
118
|
+
* - An empty report (no warnings) does not consume emission state
|
|
119
|
+
*/
|
|
120
|
+
getPendingWarnings(
|
|
121
|
+
report: CoverageWarningReport,
|
|
122
|
+
gracePeriodMs: number = 5_000,
|
|
123
|
+
): CoverageWarning[] {
|
|
124
|
+
// Grace period: don't emit during initial pending/settling state
|
|
125
|
+
if (Date.now() - this.startedAt < gracePeriodMs) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!report.hasWarnings || report.warnings.length === 0) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (this.forceEmitted) return [];
|
|
134
|
+
|
|
135
|
+
const nextHash = this.computeHash(report);
|
|
136
|
+
if (nextHash === this.lastWarningsHash) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.lastWarningsHash = nextHash;
|
|
141
|
+
return report.warnings;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Check whether a warning has already been emitted this session. */
|
|
145
|
+
get hasEmitted(): boolean {
|
|
146
|
+
return this.lastWarningsHash !== null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Force the state to consider warnings as already emitted. Useful for testing. */
|
|
150
|
+
markEmitted(): void {
|
|
151
|
+
this.forceEmitted = true;
|
|
152
|
+
this.lastWarningsHash = "emitted";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Reset the session state. */
|
|
156
|
+
reset(): void {
|
|
157
|
+
this.forceEmitted = false;
|
|
158
|
+
this.lastWarningsHash = null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private computeHash(report: CoverageWarningReport): string {
|
|
162
|
+
return report.warnings
|
|
163
|
+
.map((w) => `${w.type}:${w.language ?? ""}:${w.message}`)
|
|
164
|
+
.sort((a, b) => a.localeCompare(b))
|
|
165
|
+
.join("|");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ── Runtime state gathering ─────────────────────────────────
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Gather the coverage evaluation input from current runtime state.
|
|
173
|
+
*
|
|
174
|
+
* Reads deprecated keys from supi-lsp, structural state from the
|
|
175
|
+
* workspace runtime, and explicitly disabled languages / missing server
|
|
176
|
+
* info from the LSP controller or a config-based fallback scan.
|
|
177
|
+
*/
|
|
178
|
+
export function gatherCoverageEvalInput(
|
|
179
|
+
cwd: string,
|
|
180
|
+
lspController: CoverageMissingServerSource | null,
|
|
181
|
+
): CoverageEvalInput {
|
|
182
|
+
const deprecatedKeys = getDeprecatedLspKeys(cwd);
|
|
183
|
+
const structuralState = getDefaultWorkspaceRuntime().getWorkspace(cwd).structural.state;
|
|
184
|
+
const explicitlyDisabledLanguages = detectExplicitlyDisabledLanguages(cwd);
|
|
185
|
+
const missingServers = lspController
|
|
186
|
+
? normalizeMissingServers(lspController.getMissingServers())
|
|
187
|
+
: scanMissingServers(loadConfig(cwd), cwd);
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
deprecatedKeys,
|
|
191
|
+
explicitlyDisabledLanguages,
|
|
192
|
+
missingServers,
|
|
193
|
+
structuralState,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function normalizeMissingServers(
|
|
198
|
+
raw: Array<{ name: string; command: string; foundExtensions?: string[] }>,
|
|
199
|
+
): Array<{ name: string; command: string; foundExtensions: string[] }> {
|
|
200
|
+
return raw.map((entry) => ({
|
|
201
|
+
name: entry.name,
|
|
202
|
+
command: entry.command,
|
|
203
|
+
foundExtensions: entry.foundExtensions ?? [],
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Read raw scoped config to find languages with `servers.<lang>.enabled: false`. */
|
|
208
|
+
function detectExplicitlyDisabledLanguages(cwd: string): string[] {
|
|
209
|
+
const disabled = new Set<string>();
|
|
210
|
+
for (const scope of ["project", "global"] as const) {
|
|
211
|
+
const raw = loadSupiConfigForScope(
|
|
212
|
+
"lsp",
|
|
213
|
+
cwd,
|
|
214
|
+
{ servers: {} as Record<string, { enabled?: boolean }> },
|
|
215
|
+
{ scope },
|
|
216
|
+
);
|
|
217
|
+
const servers = (raw as { servers?: Record<string, { enabled?: boolean }> }).servers;
|
|
218
|
+
if (!servers) continue;
|
|
219
|
+
for (const [name, srv] of Object.entries(servers)) {
|
|
220
|
+
if (srv.enabled === false) disabled.add(name);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return [...disabled].sort();
|
|
224
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type EvidencePartialReason = "timeout" | "safety-limit" | "interrupted" | "provider-limited";
|
|
2
|
+
|
|
3
|
+
export interface EvidenceListMetadata {
|
|
4
|
+
key: string;
|
|
5
|
+
totalCount: number | null;
|
|
6
|
+
shownCount: number;
|
|
7
|
+
omittedCount: number | null;
|
|
8
|
+
partialReason: EvidencePartialReason | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface EvidenceList<T> {
|
|
12
|
+
key: string;
|
|
13
|
+
items: T[];
|
|
14
|
+
metadata: EvidenceListMetadata;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CreateEvidenceListParams<T> {
|
|
18
|
+
key: string;
|
|
19
|
+
items: T[];
|
|
20
|
+
maxResults?: number;
|
|
21
|
+
sort?: (a: T, b: T) => number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface CreatePartialEvidenceListParams<T> {
|
|
25
|
+
key: string;
|
|
26
|
+
items: T[];
|
|
27
|
+
partialReason: EvidencePartialReason;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface EvidenceListSummary {
|
|
31
|
+
omittedCount: number;
|
|
32
|
+
evidenceLists: EvidenceListMetadata[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function createEvidenceList<T>(params: CreateEvidenceListParams<T>): EvidenceList<T> {
|
|
36
|
+
const ordered = params.sort ? [...params.items].sort(params.sort) : [...params.items];
|
|
37
|
+
const maxResults = params.maxResults ?? ordered.length;
|
|
38
|
+
const items = ordered.slice(0, Math.max(0, maxResults));
|
|
39
|
+
const omittedCount = Math.max(0, ordered.length - items.length);
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
key: params.key,
|
|
43
|
+
items,
|
|
44
|
+
metadata: {
|
|
45
|
+
key: params.key,
|
|
46
|
+
totalCount: ordered.length,
|
|
47
|
+
shownCount: items.length,
|
|
48
|
+
omittedCount,
|
|
49
|
+
partialReason: null,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function createPartialEvidenceList<T>(
|
|
55
|
+
params: CreatePartialEvidenceListParams<T>,
|
|
56
|
+
): EvidenceList<T> {
|
|
57
|
+
return {
|
|
58
|
+
key: params.key,
|
|
59
|
+
items: [...params.items],
|
|
60
|
+
metadata: {
|
|
61
|
+
key: params.key,
|
|
62
|
+
totalCount: null,
|
|
63
|
+
shownCount: params.items.length,
|
|
64
|
+
omittedCount: null,
|
|
65
|
+
partialReason: params.partialReason,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function renderEvidenceListDisclosure<T>(list: EvidenceList<T>): string | null {
|
|
71
|
+
return renderEvidenceListMetadataDisclosure(list.metadata);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function renderEvidenceListMetadataDisclosure(
|
|
75
|
+
metadata: EvidenceListMetadata,
|
|
76
|
+
): string | null {
|
|
77
|
+
if (metadata.totalCount === null) {
|
|
78
|
+
if (metadata.partialReason === null) return null;
|
|
79
|
+
return `_(showing ${metadata.shownCount}; more may exist — ${metadata.partialReason})_`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if ((metadata.omittedCount ?? 0) <= 0) return null;
|
|
83
|
+
return `_(showing ${metadata.shownCount} of ${metadata.totalCount}; ${metadata.omittedCount} omitted)_`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function summarizeEvidenceLists(lists: EvidenceList<unknown>[]): EvidenceListSummary {
|
|
87
|
+
return {
|
|
88
|
+
omittedCount: lists.reduce((sum, list) => sum + (list.metadata.omittedCount ?? 0), 0),
|
|
89
|
+
evidenceLists: lists.map((list) => list.metadata),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
+
import type { ResolvedTargetData, ResolvedTargetGroupData } from "./target/types.ts";
|
|
3
3
|
|
|
4
4
|
interface FileLineRef {
|
|
5
5
|
file: string;
|
|
@@ -7,8 +7,8 @@ interface FileLineRef {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function isResolvedTargetGroup(
|
|
10
|
-
target:
|
|
11
|
-
): target is
|
|
10
|
+
target: ResolvedTargetData | ResolvedTargetGroupData,
|
|
11
|
+
): target is ResolvedTargetGroupData {
|
|
12
12
|
return "targets" in target;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicit analysis request context.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the shared capability broker (@mrclrchtr/supi-code-runtime) and
|
|
5
|
+
* workspace-session-local caches into an explicit context object that
|
|
6
|
+
* deep analysis modules consume instead of calling getCodeProvider(cwd)
|
|
7
|
+
* on their own.
|
|
8
|
+
*
|
|
9
|
+
* This is NOT a second capability registry — it's a composite read
|
|
10
|
+
* over the canonical broker plus session-scoped state.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
getDefaultWorkspaceRuntime,
|
|
15
|
+
type SemanticProvider,
|
|
16
|
+
type StructuralProvider,
|
|
17
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
18
|
+
import { getSessionLspService, type SessionLspServiceState } from "@mrclrchtr/supi-lsp/api";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Unified code analysis provider combining semantic (LSP-backed) and
|
|
22
|
+
* structural (tree-sitter-backed) operations.
|
|
23
|
+
*/
|
|
24
|
+
export interface CodeProvider extends SemanticProvider, StructuralProvider {}
|
|
25
|
+
|
|
26
|
+
/** Availability state for the code provider in a workspace. */
|
|
27
|
+
export type CodeProviderState =
|
|
28
|
+
| { kind: "ready"; provider: CodeProvider; lspService: SessionLspServiceState }
|
|
29
|
+
| { kind: "unavailable"; reason: string };
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Explicit context object passed to analysis services.
|
|
33
|
+
*
|
|
34
|
+
* Contains the cwd, a CodeProvider (ready or unavailable), and
|
|
35
|
+
* any session-local model state that services need.
|
|
36
|
+
*/
|
|
37
|
+
export interface AnalysisContext {
|
|
38
|
+
cwd: string;
|
|
39
|
+
providerState: CodeProviderState;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Build an AnalysisContext for a workspace cwd.
|
|
44
|
+
*
|
|
45
|
+
* Reads the shared capability broker from @mrclrchtr/supi-code-runtime
|
|
46
|
+
* and returns a composite provider if at least one capability is available.
|
|
47
|
+
*/
|
|
48
|
+
export function buildAnalysisContext(cwd: string): AnalysisContext {
|
|
49
|
+
return {
|
|
50
|
+
cwd,
|
|
51
|
+
providerState: getCodeProviderState(cwd),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get the code provider state for a workspace cwd from the shared runtime.
|
|
57
|
+
*/
|
|
58
|
+
export function getCodeProviderState(cwd: string): CodeProviderState {
|
|
59
|
+
const runtime = getDefaultWorkspaceRuntime();
|
|
60
|
+
const ws = runtime.getWorkspace(cwd);
|
|
61
|
+
|
|
62
|
+
const hasSemantic =
|
|
63
|
+
(ws.semantic.state.kind === "ready" || ws.semantic.state.kind === "pending") &&
|
|
64
|
+
ws.semantic.provider !== null;
|
|
65
|
+
const hasStructural = ws.structural.state.kind === "ready" && ws.structural.provider !== null;
|
|
66
|
+
|
|
67
|
+
if (!hasSemantic && !hasStructural) {
|
|
68
|
+
return {
|
|
69
|
+
kind: "unavailable",
|
|
70
|
+
reason: "No code provider initialized for this workspace",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
kind: "ready",
|
|
76
|
+
provider: createCompositeProvider(
|
|
77
|
+
(hasSemantic ? ws.semantic.provider : null) as SemanticProvider | null,
|
|
78
|
+
(hasStructural ? ws.structural.provider : null) as StructuralProvider | null,
|
|
79
|
+
),
|
|
80
|
+
lspService: getSessionLspService(cwd),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Alias for getCodeProviderState — kept for backward compatibility. */
|
|
85
|
+
export const getCodeProvider = getCodeProviderState;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Create a single CodeProvider that delegates semantic methods to the
|
|
89
|
+
* semantic (LSP) provider and structural methods to the structural
|
|
90
|
+
* (tree-sitter) provider.
|
|
91
|
+
*
|
|
92
|
+
* Uses `...args` spread so that new optional parameters added to
|
|
93
|
+
* provider methods are forwarded automatically — no need to update
|
|
94
|
+
* the composite wrapper.
|
|
95
|
+
*/
|
|
96
|
+
function createCompositeProvider(
|
|
97
|
+
semantic: SemanticProvider | null,
|
|
98
|
+
structural: StructuralProvider | null,
|
|
99
|
+
): CodeProvider {
|
|
100
|
+
return {
|
|
101
|
+
// ── Semantic methods ──────────────────────────────────────────────
|
|
102
|
+
async references(...args: Parameters<SemanticProvider["references"]>) {
|
|
103
|
+
return semantic?.references(...args) ?? null;
|
|
104
|
+
},
|
|
105
|
+
async implementation(...args: Parameters<SemanticProvider["implementation"]>) {
|
|
106
|
+
return semantic?.implementation(...args) ?? null;
|
|
107
|
+
},
|
|
108
|
+
async documentSymbols(...args: Parameters<SemanticProvider["documentSymbols"]>) {
|
|
109
|
+
return semantic?.documentSymbols(...args) ?? null;
|
|
110
|
+
},
|
|
111
|
+
async workspaceSymbols(...args: Parameters<SemanticProvider["workspaceSymbols"]>) {
|
|
112
|
+
return semantic?.workspaceSymbols(...args) ?? null;
|
|
113
|
+
},
|
|
114
|
+
async hover(...args: Parameters<NonNullable<SemanticProvider["hover"]>>) {
|
|
115
|
+
return semantic?.hover?.(...args) ?? null;
|
|
116
|
+
},
|
|
117
|
+
async definition(...args: Parameters<NonNullable<SemanticProvider["definition"]>>) {
|
|
118
|
+
return semantic?.definition?.(...args) ?? null;
|
|
119
|
+
},
|
|
120
|
+
async codeActions(...args: Parameters<NonNullable<SemanticProvider["codeActions"]>>) {
|
|
121
|
+
return semantic?.codeActions?.(...args) ?? [];
|
|
122
|
+
},
|
|
123
|
+
async codeActionTitles(...args: Parameters<NonNullable<SemanticProvider["codeActionTitles"]>>) {
|
|
124
|
+
return semantic?.codeActionTitles?.(...args) ?? null;
|
|
125
|
+
},
|
|
126
|
+
async rename(...args: Parameters<NonNullable<SemanticProvider["rename"]>>) {
|
|
127
|
+
const result = await semantic?.rename?.(...args);
|
|
128
|
+
return (
|
|
129
|
+
result ?? {
|
|
130
|
+
kind: "unavailable" as const,
|
|
131
|
+
reason: "Rename not available",
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// ── Structural methods ────────────────────────────────────────────
|
|
137
|
+
async calleesAt(...args: Parameters<StructuralProvider["calleesAt"]>) {
|
|
138
|
+
return (
|
|
139
|
+
structural?.calleesAt(...args) ?? {
|
|
140
|
+
kind: "unavailable" as const,
|
|
141
|
+
message: "Structural analysis not available.",
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
async exports(...args: Parameters<StructuralProvider["exports"]>) {
|
|
146
|
+
return (
|
|
147
|
+
structural?.exports(...args) ?? {
|
|
148
|
+
kind: "unavailable" as const,
|
|
149
|
+
message: "Structural analysis not available.",
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
async outline(...args: Parameters<StructuralProvider["outline"]>) {
|
|
154
|
+
return (
|
|
155
|
+
structural?.outline(...args) ?? {
|
|
156
|
+
kind: "unavailable" as const,
|
|
157
|
+
message: "Structural analysis not available.",
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
async imports(...args: Parameters<StructuralProvider["imports"]>) {
|
|
162
|
+
return (
|
|
163
|
+
structural?.imports(...args) ?? {
|
|
164
|
+
kind: "unavailable" as const,
|
|
165
|
+
message: "Structural analysis not available.",
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
async nodeAt(...args: Parameters<StructuralProvider["nodeAt"]>) {
|
|
170
|
+
return (
|
|
171
|
+
structural?.nodeAt(...args) ?? {
|
|
172
|
+
kind: "unavailable" as const,
|
|
173
|
+
message: "Structural analysis not available.",
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
},
|
|
177
|
+
async callSites(...args: Parameters<StructuralProvider["callSites"]>) {
|
|
178
|
+
return (
|
|
179
|
+
structural?.callSites(...args) ?? {
|
|
180
|
+
kind: "unavailable" as const,
|
|
181
|
+
message: "Structural analysis not available.",
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export interface ReadNextItem {
|
|
2
|
+
file: string;
|
|
3
|
+
startLine: number;
|
|
4
|
+
endLine: number;
|
|
5
|
+
reason: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const DEFAULT_MAX_READ_LINES = 120;
|
|
9
|
+
const DEFAULT_CONTEXT_BEFORE = 5;
|
|
10
|
+
const DEFAULT_CONTEXT_AFTER = 40;
|
|
11
|
+
|
|
12
|
+
interface ReadNextRangeInput extends ReadNextItem {
|
|
13
|
+
maxLines?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Build read-next guidance for a known source range, bounded for readable tool output. */
|
|
17
|
+
export function readNextRange(input: ReadNextRangeInput): ReadNextItem {
|
|
18
|
+
const maxLines = input.maxLines ?? DEFAULT_MAX_READ_LINES;
|
|
19
|
+
const start = Math.max(1, Math.floor(input.startLine));
|
|
20
|
+
const rawEnd = Math.max(start, Math.floor(input.endLine));
|
|
21
|
+
const end = Math.min(rawEnd, start + Math.max(1, maxLines) - 1);
|
|
22
|
+
return { file: input.file, startLine: start, endLine: end, reason: input.reason };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Build read-next guidance around a known point when no precise symbol range is available. */
|
|
26
|
+
export function readNextAround(
|
|
27
|
+
file: string,
|
|
28
|
+
line: number,
|
|
29
|
+
reason: string,
|
|
30
|
+
options: { before?: number; after?: number; maxLines?: number } = {},
|
|
31
|
+
): ReadNextItem {
|
|
32
|
+
const before = options.before ?? DEFAULT_CONTEXT_BEFORE;
|
|
33
|
+
const after = options.after ?? DEFAULT_CONTEXT_AFTER;
|
|
34
|
+
const start = Math.max(1, Math.floor(line) - before);
|
|
35
|
+
const end = Math.max(start, Math.floor(line) + after);
|
|
36
|
+
return readNextRange({
|
|
37
|
+
file,
|
|
38
|
+
startLine: start,
|
|
39
|
+
endLine: end,
|
|
40
|
+
reason,
|
|
41
|
+
maxLines: options.maxLines,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Render guidance-chrome source ranges that should be inspected with the built-in read tool. */
|
|
46
|
+
export function renderReadNextSection(items: ReadNextItem[], maxItems = 3): string[] {
|
|
47
|
+
const visible = dedupeReadNextItems(items).slice(0, maxItems);
|
|
48
|
+
if (visible.length === 0) return [];
|
|
49
|
+
|
|
50
|
+
const lines = ["## Read Next"];
|
|
51
|
+
for (const item of visible) {
|
|
52
|
+
const lineCount = item.endLine - item.startLine + 1;
|
|
53
|
+
lines.push(
|
|
54
|
+
`- \`${item.file}\` ${formatLineRange(item)} — ${item.reason} (\`read\` offset ${item.startLine}, limit ${lineCount})`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
lines.push("");
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function formatLineRange(item: ReadNextItem): string {
|
|
62
|
+
if (item.startLine === item.endLine) return `L${item.startLine}`;
|
|
63
|
+
return `L${item.startLine}–L${item.endLine}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ── Higher-level builders (used by relation collectors and tool executors) ─
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Build a single read-next item to inspect the resolved target itself.
|
|
70
|
+
*
|
|
71
|
+
* Used by code_graph relation handlers and code_orientation to guide
|
|
72
|
+
* the agent toward reading the target's source range.
|
|
73
|
+
*/
|
|
74
|
+
export function readNextTarget(file: string, line: number, reason?: string): ReadNextItem {
|
|
75
|
+
return readNextAround(file, line, reason ?? "inspect the target implementation");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Build read-next items for the top N reference/call/implementation sites.
|
|
80
|
+
*
|
|
81
|
+
* Used by the references and callees relation handlers in collect-relation.ts
|
|
82
|
+
* to guide the agent toward the most relevant reference sites.
|
|
83
|
+
*/
|
|
84
|
+
export function readNextTopSites(
|
|
85
|
+
sites: ReadonlyArray<{ file: string; line: number }>,
|
|
86
|
+
maxSites = 2,
|
|
87
|
+
label = "reference",
|
|
88
|
+
): ReadNextItem[] {
|
|
89
|
+
return sites
|
|
90
|
+
.slice(0, maxSites)
|
|
91
|
+
.map((site) => readNextAround(site.file, site.line, `inspect a ${label} site`));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Build a read-next item for an enclosing scope (function/class/block).
|
|
96
|
+
*
|
|
97
|
+
* Used by the callees relation handler and code_orientation's
|
|
98
|
+
* findEnclosingOutlineItem to guide the agent toward inspecting the
|
|
99
|
+
* scope that contains the target.
|
|
100
|
+
*/
|
|
101
|
+
export function readNextEnclosingScope(
|
|
102
|
+
file: string,
|
|
103
|
+
scope: { name?: string; startLine?: number; endLine?: number },
|
|
104
|
+
fallbackLine: number,
|
|
105
|
+
fallbackName?: string,
|
|
106
|
+
): ReadNextItem {
|
|
107
|
+
const name = scope.name ?? fallbackName ?? "scope";
|
|
108
|
+
return readNextRange({
|
|
109
|
+
file,
|
|
110
|
+
startLine: scope.startLine ?? fallbackLine,
|
|
111
|
+
endLine: scope.endLine ?? scope.startLine ?? fallbackLine,
|
|
112
|
+
reason: `inspect enclosing scope \`${name}\``,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function dedupeReadNextItems(items: ReadNextItem[]): ReadNextItem[] {
|
|
117
|
+
const seen = new Set<string>();
|
|
118
|
+
const result: ReadNextItem[] = [];
|
|
119
|
+
for (const item of items) {
|
|
120
|
+
const key = `${item.file}:${item.startLine}:${item.endLine}:${item.reason}`;
|
|
121
|
+
if (seen.has(key)) continue;
|
|
122
|
+
seen.add(key);
|
|
123
|
+
result.push(item);
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|