@mrclrchtr/supi-code-intelligence 1.16.1 → 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/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
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
LocationLink,
|
|
13
13
|
Position,
|
|
14
14
|
ProjectServerInfo,
|
|
15
|
+
Range,
|
|
15
16
|
SymbolInformation,
|
|
16
17
|
WorkspaceEdit,
|
|
17
18
|
WorkspaceSymbol,
|
|
@@ -19,6 +20,10 @@ import type {
|
|
|
19
20
|
import type { LspManager } from "../manager/manager.ts";
|
|
20
21
|
import { resolveSessionPath } from "../utils.ts";
|
|
21
22
|
|
|
23
|
+
function isRange(value: Position | Range): value is Range {
|
|
24
|
+
return "start" in value && "end" in value;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
/** Workspace diagnostic summary grouped by file. */
|
|
23
28
|
export interface WorkspaceDiagnosticSummaryEntry {
|
|
24
29
|
file: string;
|
|
@@ -54,6 +59,11 @@ export type SessionLspServiceState =
|
|
|
54
59
|
| { kind: "disabled" }
|
|
55
60
|
| { kind: "unavailable"; reason: string };
|
|
56
61
|
|
|
62
|
+
export type SemanticReadinessResult =
|
|
63
|
+
| { kind: "ready" }
|
|
64
|
+
| { kind: "timeout" }
|
|
65
|
+
| { kind: "unavailable"; reason: string };
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
* Public wrapper around {@link LspManager} that exposes stable semantic operations.
|
|
59
69
|
* File path inputs may be absolute or session-cwd-relative; a leading `@` is stripped
|
|
@@ -122,20 +132,54 @@ export class SessionLspService {
|
|
|
122
132
|
return client.rename(resolvedPath, position, newName);
|
|
123
133
|
}
|
|
124
134
|
|
|
125
|
-
async codeActions(
|
|
135
|
+
async codeActions(
|
|
136
|
+
filePath: string,
|
|
137
|
+
positionOrRange: Position | Range,
|
|
138
|
+
): Promise<CodeAction[] | null> {
|
|
126
139
|
const resolvedPath = this.resolveFilePath(filePath);
|
|
127
140
|
const client = await this.manager.ensureFileOpen(resolvedPath);
|
|
128
141
|
if (!client) return null;
|
|
129
142
|
|
|
130
|
-
const range =
|
|
143
|
+
const range = isRange(positionOrRange)
|
|
144
|
+
? positionOrRange
|
|
145
|
+
: { start: positionOrRange, end: positionOrRange };
|
|
131
146
|
const diagnostics = client
|
|
132
147
|
.getDiagnostics(resolvedPath)
|
|
133
|
-
.filter((diagnostic) => diagnostic.range.
|
|
134
|
-
.filter((diagnostic) => diagnostic.range.
|
|
148
|
+
.filter((diagnostic) => diagnostic.range.end.line >= range.start.line)
|
|
149
|
+
.filter((diagnostic) => diagnostic.range.start.line <= range.end.line);
|
|
135
150
|
|
|
136
151
|
return client.codeActions(resolvedPath, range, { diagnostics });
|
|
137
152
|
}
|
|
138
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Wait until the LSP client that owns a file is ready for semantic queries.
|
|
156
|
+
* Performs a lightweight semantic warm-up probe before resolving.
|
|
157
|
+
*/
|
|
158
|
+
async waitUntilReadyForFile(
|
|
159
|
+
filePath: string,
|
|
160
|
+
options: { timeoutMs?: number } = {},
|
|
161
|
+
): Promise<SemanticReadinessResult> {
|
|
162
|
+
const resolvedPath = this.resolveFilePath(filePath);
|
|
163
|
+
if (!this.manager.canServeFile(resolvedPath)) {
|
|
164
|
+
return {
|
|
165
|
+
kind: "unavailable",
|
|
166
|
+
reason: "No LSP client can serve this file",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return raceReadiness(this.manager.waitUntilFileReady(resolvedPath), options.timeoutMs);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Wait until all started LSP clients are ready for semantic queries.
|
|
175
|
+
* Performs one representative warm-up probe per client/root.
|
|
176
|
+
*/
|
|
177
|
+
async waitUntilReadyForWorkspace(
|
|
178
|
+
options: { timeoutMs?: number } = {},
|
|
179
|
+
): Promise<SemanticReadinessResult> {
|
|
180
|
+
return raceReadiness(this.manager.waitUntilWorkspaceReady(), options.timeoutMs);
|
|
181
|
+
}
|
|
182
|
+
|
|
139
183
|
// ── Project / runtime awareness ─────────────────────────────────────
|
|
140
184
|
|
|
141
185
|
getProjectServers(): ProjectServerInfo[] {
|
|
@@ -190,8 +234,41 @@ export class SessionLspService {
|
|
|
190
234
|
// ── Registry ──────────────────────────────────────────────────────────
|
|
191
235
|
|
|
192
236
|
const WAIT_INTERVAL_MS = 25;
|
|
237
|
+
const DEFAULT_SEMANTIC_READY_TIMEOUT_MS = 15_000;
|
|
193
238
|
const registry = createSessionStateRegistry<SessionLspServiceState>("supi-lsp/session-registry");
|
|
194
239
|
|
|
240
|
+
async function raceReadiness(
|
|
241
|
+
readiness: Promise<unknown>,
|
|
242
|
+
timeoutMs: number | undefined,
|
|
243
|
+
): Promise<SemanticReadinessResult> {
|
|
244
|
+
const effectiveTimeoutMs = timeoutMs ?? DEFAULT_SEMANTIC_READY_TIMEOUT_MS;
|
|
245
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
246
|
+
|
|
247
|
+
try {
|
|
248
|
+
await Promise.race([
|
|
249
|
+
readiness,
|
|
250
|
+
new Promise<never>((_, reject) => {
|
|
251
|
+
timer = setTimeout(
|
|
252
|
+
() => reject(new Error("semantic-readiness-timeout")),
|
|
253
|
+
effectiveTimeoutMs,
|
|
254
|
+
);
|
|
255
|
+
}),
|
|
256
|
+
]);
|
|
257
|
+
return { kind: "ready" };
|
|
258
|
+
} catch (error) {
|
|
259
|
+
if (timer) clearTimeout(timer);
|
|
260
|
+
if (error instanceof Error && error.message === "semantic-readiness-timeout") {
|
|
261
|
+
return { kind: "timeout" };
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
kind: "unavailable",
|
|
265
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
266
|
+
};
|
|
267
|
+
} finally {
|
|
268
|
+
if (timer) clearTimeout(timer);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
195
272
|
/** Publish the LSP service state for a session cwd. */
|
|
196
273
|
export function setSessionLspServiceState(cwd: string, state: SessionLspServiceState): void {
|
|
197
274
|
registry.set(cwd, state);
|
|
@@ -112,6 +112,8 @@ export function isProjectSource(filePath: string, cwd: string): boolean {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export function shouldIgnoreLspPath(filePath: string, cwd: string): boolean {
|
|
115
|
+
if (!isInProjectTree(filePath, cwd)) return true;
|
|
116
|
+
|
|
115
117
|
const normalized = normalizeRelevantPath(filePath);
|
|
116
118
|
if (
|
|
117
119
|
normalized === "node_modules" ||
|
|
@@ -8,50 +8,31 @@
|
|
|
8
8
|
|
|
9
9
|
# @mrclrchtr/supi-tree-sitter
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Tree-sitter structural code analysis library for the [pi coding agent](https://github.com/earendil-works/pi).
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pi install npm:@mrclrchtr/supi-tree-sitter
|
|
17
|
-
```
|
|
13
|
+
This is a **library-only** package — it has no pi extension surface. Use `@mrclrchtr/supi-code-intelligence`
|
|
14
|
+
to access structural code-understanding workflows in pi.
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
## Install
|
|
20
17
|
|
|
21
18
|
```bash
|
|
22
|
-
|
|
19
|
+
npm install @mrclrchtr/supi-tree-sitter
|
|
23
20
|
```
|
|
24
21
|
|
|
25
22
|

|
|
26
23
|
|
|
27
24
|
## What you get
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- `tree_sitter_outline` — shallow structural outline of declarations in JavaScript/TypeScript files
|
|
32
|
-
- `tree_sitter_imports` — list imports in JavaScript/TypeScript files
|
|
33
|
-
- `tree_sitter_exports` — list exports in JavaScript/TypeScript files
|
|
34
|
-
- `tree_sitter_node_at` — find the exact syntax node and ancestry at a position (any supported grammar)
|
|
35
|
-
- `tree_sitter_query` — run a custom Tree-sitter query against a file (any supported grammar)
|
|
36
|
-
- `tree_sitter_callees` — find outgoing calls from the enclosing function or method at a position (most grammars)
|
|
26
|
+
This package provides the parser-backed structural substrate consumed by `@mrclrchtr/supi-code-intelligence`:
|
|
37
27
|
|
|
38
|
-
|
|
28
|
+
- a shared session-scoped Tree-sitter service for structural analysis
|
|
29
|
+
- an owned parsing session API for direct library consumers
|
|
30
|
+
- a `StructuralProvider` adapter published through `./provider/tree-sitter-provider`
|
|
31
|
+
- structural extraction helpers for outline/import/export/node/callee/call-site analysis inside the library surface
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
It does **not** register pi tools or commands on its own.
|
|
41
34
|
|
|
42
|
-
-
|
|
43
|
-
- `tree_sitter_imports` — module specifiers and source locations for each import
|
|
44
|
-
- `tree_sitter_exports` — kind, name, and module specifier (for re-exports) of each export
|
|
45
|
-
|
|
46
|
-
### Node-at, query, callees
|
|
47
|
-
|
|
48
|
-
These tools work across all or most supported grammars:
|
|
49
|
-
|
|
50
|
-
- `tree_sitter_node_at` — exact syntax node type and ancestry at a given file position
|
|
51
|
-
- `tree_sitter_query` — custom Tree-sitter query pattern matching on any supported grammar
|
|
52
|
-
- `tree_sitter_callees` — outgoing calls from the enclosing function or method at a given position
|
|
53
|
-
|
|
54
|
-
Coordinates use **1-based** line and character columns. Character positions use UTF-16 code units. Relative paths resolve from the session cwd, and a leading `@` on file paths is stripped.
|
|
35
|
+
Coordinates in the library APIs use **1-based** line and character columns. Character positions use UTF-16 code units. Relative paths resolve from the session cwd, and a leading `@` on file paths is stripped.
|
|
55
36
|
|
|
56
37
|
## Supported file families
|
|
57
38
|
|
|
@@ -85,9 +66,10 @@ supi-tree-sitter ← Tree-sitter WASM + session-scoped service + runtime capabi
|
|
|
85
66
|
## Package surfaces
|
|
86
67
|
|
|
87
68
|
- `@mrclrchtr/supi-tree-sitter/api` — reusable parsing session factory, shared session-scoped structural service access, and shared result types
|
|
88
|
-
- `@mrclrchtr/supi-tree-sitter/extension` — pi extension entrypoint
|
|
89
69
|
- `@mrclrchtr/supi-tree-sitter/provider/tree-sitter-provider` — shared StructuralProvider adapter
|
|
90
70
|
|
|
71
|
+
This is a **library-only** package. Public tool registration and pi event handlers belong to `@mrclrchtr/supi-code-intelligence`.
|
|
72
|
+
|
|
91
73
|
Owned session example:
|
|
92
74
|
|
|
93
75
|
```ts
|
|
@@ -115,11 +97,10 @@ if (state.kind === "ready") {
|
|
|
115
97
|
|
|
116
98
|
## Source
|
|
117
99
|
|
|
118
|
-
- `src/
|
|
119
|
-
- `src/
|
|
120
|
-
- `src/tool/register-tools.ts` — focused tool registration driven by tool specs
|
|
121
|
-
- `src/tree-sitter.ts` — extension entrypoint (thin wire-up)
|
|
100
|
+
- `src/api.ts` — public library entrypoint
|
|
101
|
+
- `src/index.ts` — re-export surface
|
|
122
102
|
- `src/session/runtime.ts` — parser and query runtime
|
|
123
103
|
- `src/session/session.ts` — runtime-backed service helpers and owned session API
|
|
124
104
|
- `src/session/service-registry.ts` — shared session-scoped structural service registry
|
|
125
|
-
- `src/
|
|
105
|
+
- `src/provider/tree-sitter-provider.ts` — `StructuralProvider` adapter consumed by `@mrclrchtr/supi-code-intelligence`
|
|
106
|
+
- `src/tool/outline.ts`, `src/tool/imports.ts`, `src/tool/exports.ts`, `src/tool/node-at.ts`, `src/tool/callees.ts`, `src/tool/call-sites.ts` — structural analyses exposed through the library surface
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"settings",
|
|
24
24
|
"configuration"
|
|
25
25
|
],
|
|
26
|
+
"type": "module",
|
|
26
27
|
"files": [
|
|
27
28
|
"src/**/*.ts",
|
|
28
29
|
"!__tests__"
|
|
@@ -53,12 +54,14 @@
|
|
|
53
54
|
},
|
|
54
55
|
"main": "src/api.ts",
|
|
55
56
|
"exports": {
|
|
57
|
+
"./abort-utils": "./src/abort-utils.ts",
|
|
56
58
|
"./api": "./src/api.ts",
|
|
57
59
|
"./config": "./src/config.ts",
|
|
58
60
|
"./context": "./src/context.ts",
|
|
59
61
|
"./debug": "./src/debug-registry.ts",
|
|
60
62
|
"./footer-registry": "./src/footer-registry.ts",
|
|
61
63
|
"./llm": "./src/llm.ts",
|
|
64
|
+
"./model-selection": "./src/model-selection.ts",
|
|
62
65
|
"./package.json": "./package.json",
|
|
63
66
|
"./path": "./src/path.ts",
|
|
64
67
|
"./report": "./src/report.ts",
|
|
@@ -67,6 +70,8 @@
|
|
|
67
70
|
"./session": "./src/session.ts",
|
|
68
71
|
"./settings": "./src/settings.ts",
|
|
69
72
|
"./settings-ui": "./src/settings-ui.ts",
|
|
73
|
+
"./spinner-frames": "./src/spinner-frames.ts",
|
|
74
|
+
"./status-spinner": "./src/status-spinner.ts",
|
|
70
75
|
"./terminal": "./src/terminal.ts",
|
|
71
76
|
"./tool-framework": "./src/tool-framework.ts",
|
|
72
77
|
"./types": "./src/types.ts"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abort controller/signal utility helpers.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Combine a caller-provided abort controller with a generation timeout signal.
|
|
9
|
+
*
|
|
10
|
+
* Returns the combined signal and a cleanup function that removes both
|
|
11
|
+
* event listeners. Callers must invoke cleanup in a `finally` block
|
|
12
|
+
* to avoid listener leaks.
|
|
13
|
+
*/
|
|
14
|
+
export function combineAbortSignals(
|
|
15
|
+
abort: AbortController,
|
|
16
|
+
timeoutMs: number,
|
|
17
|
+
): { signal: AbortSignal; cleanup: () => void } {
|
|
18
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
19
|
+
const combinedController = new AbortController();
|
|
20
|
+
const onAbort = () => combinedController.abort();
|
|
21
|
+
abort.signal.addEventListener("abort", onAbort, { once: true });
|
|
22
|
+
timeoutSignal.addEventListener("abort", onAbort, { once: true });
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
signal: combinedController.signal,
|
|
26
|
+
cleanup: () => {
|
|
27
|
+
abort.signal.removeEventListener("abort", onAbort);
|
|
28
|
+
timeoutSignal.removeEventListener("abort", onAbort);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// For lighter imports, use one of the domain subpaths directly
|
|
7
7
|
// (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
|
|
8
8
|
|
|
9
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
10
|
+
export * from "./abort-utils.ts";
|
|
9
11
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
10
12
|
export * from "./config.ts";
|
|
11
13
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
@@ -17,6 +19,8 @@ export * from "./footer-registry.ts";
|
|
|
17
19
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
18
20
|
export * from "./llm.ts";
|
|
19
21
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
22
|
+
export * from "./model-selection.ts";
|
|
23
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
20
24
|
export * from "./path.ts";
|
|
21
25
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
22
26
|
export * from "./project.ts";
|
|
@@ -29,6 +33,10 @@ export * from "./settings.ts";
|
|
|
29
33
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
30
34
|
export * from "./settings-ui.ts";
|
|
31
35
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
36
|
+
export * from "./spinner-frames.ts";
|
|
37
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
38
|
+
export * from "./status-spinner.ts";
|
|
39
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
32
40
|
export * from "./terminal.ts";
|
|
33
41
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
34
42
|
export * from "./tool-framework.ts";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// to enable auto-generated persistChange. When all items have a configType,
|
|
6
6
|
// the persistChange callback can be omitted.
|
|
7
7
|
|
|
8
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
8
9
|
import type { SettingItem } from "@earendil-works/pi-tui";
|
|
9
10
|
import type { SettingsScope } from "../settings/settings-registry.ts";
|
|
10
11
|
import { registerSettings } from "../settings/settings-registry.ts";
|
|
@@ -60,7 +61,12 @@ export interface ConfigSettingsOptions<T> {
|
|
|
60
61
|
* persistChange handling. When ALL items declare a configType,
|
|
61
62
|
* the `persistChange` callback can be omitted.
|
|
62
63
|
*/
|
|
63
|
-
buildItems: (
|
|
64
|
+
buildItems: (
|
|
65
|
+
settings: T,
|
|
66
|
+
scope: SettingsScope,
|
|
67
|
+
cwd: string,
|
|
68
|
+
ctx?: ExtensionContext,
|
|
69
|
+
) => ConfigSettingItem[];
|
|
64
70
|
/**
|
|
65
71
|
* Handle a settings change with scoped persistence helpers.
|
|
66
72
|
*
|
|
@@ -141,12 +147,12 @@ export function registerConfigSettings<T>(options: ConfigSettingsOptions<T>): vo
|
|
|
141
147
|
registerSettings({
|
|
142
148
|
id: options.id,
|
|
143
149
|
label: options.label,
|
|
144
|
-
loadValues: (scope, cwd) => {
|
|
150
|
+
loadValues: (scope, cwd, ctx) => {
|
|
145
151
|
const settings = loadSupiConfigForScope(options.section, cwd, options.defaults, {
|
|
146
152
|
scope,
|
|
147
153
|
homeDir: options.homeDir,
|
|
148
154
|
});
|
|
149
|
-
const items = options.buildItems(settings, scope, cwd);
|
|
155
|
+
const items = options.buildItems(settings, scope, cwd, ctx);
|
|
150
156
|
cachedItems = items;
|
|
151
157
|
return items;
|
|
152
158
|
},
|
|
@@ -173,7 +179,7 @@ export function registerConfigSettings<T>(options: ConfigSettingsOptions<T>): vo
|
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
// Auto-generate when all items are declarative
|
|
176
|
-
const items = cachedItems ?? options.buildItems(options.defaults, scope, cwd);
|
|
182
|
+
const items = cachedItems ?? options.buildItems(options.defaults, scope, cwd, undefined);
|
|
177
183
|
if (areAllItemsDeclarative(items)) {
|
|
178
184
|
autoPersistChange(settingId, value, helpers, items);
|
|
179
185
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { createRegistry } from "./registry-utils.ts";
|
|
9
9
|
|
|
10
10
|
/** Where the contribution should appear in the footer. */
|
|
11
|
-
export type FooterPlacement = "stats" | "status";
|
|
11
|
+
export type FooterPlacement = "stats" | "stats-end" | "status";
|
|
12
12
|
|
|
13
13
|
/** A single footer contribution registered by an extension. */
|
|
14
14
|
export interface FooterContribution {
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// For lighter imports, use one of the domain subpaths directly
|
|
7
7
|
// (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
|
|
8
8
|
|
|
9
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
10
|
+
export * from "./abort-utils.ts";
|
|
9
11
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
10
12
|
export * from "./config.ts";
|
|
11
13
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
@@ -15,6 +17,8 @@ export * from "./debug-registry.ts";
|
|
|
15
17
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
16
18
|
export * from "./footer-registry.ts";
|
|
17
19
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
20
|
+
export * from "./model-selection.ts";
|
|
21
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
18
22
|
export * from "./path.ts";
|
|
19
23
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
20
24
|
export * from "./project.ts";
|
|
@@ -27,6 +31,8 @@ export * from "./settings.ts";
|
|
|
27
31
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
28
32
|
export * from "./settings-ui.ts";
|
|
29
33
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
34
|
+
export * from "./status-spinner.ts";
|
|
35
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
30
36
|
export * from "./terminal.ts";
|
|
31
37
|
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
32
38
|
export * from "./tool-framework.ts";
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared model-selection helpers for SuPi extensions.
|
|
3
|
+
*
|
|
4
|
+
* Provides scoped-model listing using PI's `enabledModels` configuration,
|
|
5
|
+
* matching the same semantics as the `@mrclrchtr/supi-review` model picker.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Model } from "@earendil-works/pi-ai";
|
|
11
|
+
import { type ExtensionContext, SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
12
|
+
|
|
13
|
+
// ── Types ──────────────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
/** A selectable model entry with display metadata. */
|
|
16
|
+
export interface ModelSelection {
|
|
17
|
+
/** Canonical `provider/model-id` string. */
|
|
18
|
+
canonicalId: string;
|
|
19
|
+
/** Provider name, e.g. `"anthropic"`. */
|
|
20
|
+
provider: string;
|
|
21
|
+
/** Model id, e.g. `"claude-sonnet-4-5"`. */
|
|
22
|
+
id: string;
|
|
23
|
+
// biome-ignore lint/suspicious/noExplicitAny: Model<any> is pi's canonical type
|
|
24
|
+
model: Model<any>;
|
|
25
|
+
/** Human-readable label (model name or canonicalId). */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Optional description (canonicalId when different from label). */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Whether this model is the current session model. */
|
|
30
|
+
isCurrent: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
/** Build the canonical `provider/model-id` string. */
|
|
36
|
+
export function toCanonicalModelId(
|
|
37
|
+
model: Pick<NonNullable<ExtensionContext["model"]>, "provider" | "id">,
|
|
38
|
+
): string {
|
|
39
|
+
return `${model.provider}/${model.id}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* List selectable models from PI's scoped model configuration.
|
|
44
|
+
*
|
|
45
|
+
* Only models that match the configured `enabledModels` patterns are offered.
|
|
46
|
+
* The current session model is included only when it is inside that scoped set.
|
|
47
|
+
* Returns an empty array when no scoped model patterns are configured.
|
|
48
|
+
*/
|
|
49
|
+
export function getSelectableModels(
|
|
50
|
+
ctx: Pick<ExtensionContext, "cwd" | "modelRegistry" | "model">,
|
|
51
|
+
enabledModelPatterns = SettingsManager.create(ctx.cwd).getEnabledModels(),
|
|
52
|
+
): ModelSelection[] {
|
|
53
|
+
if (!enabledModelPatterns || enabledModelPatterns.length === 0) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const byCanonicalId = new Map<string, ModelSelection>();
|
|
58
|
+
const availableModels = filterByEnabledModels(
|
|
59
|
+
enabledModelPatterns,
|
|
60
|
+
ctx.modelRegistry.getAvailable(),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const addModel = (
|
|
64
|
+
// biome-ignore lint/suspicious/noExplicitAny: Model<any> is pi's canonical type
|
|
65
|
+
model: Model<any>,
|
|
66
|
+
isCurrent: boolean,
|
|
67
|
+
) => {
|
|
68
|
+
const canonicalId = toCanonicalModelId(model);
|
|
69
|
+
const existing = byCanonicalId.get(canonicalId);
|
|
70
|
+
if (existing) {
|
|
71
|
+
if (isCurrent) existing.isCurrent = true;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
byCanonicalId.set(canonicalId, {
|
|
76
|
+
canonicalId,
|
|
77
|
+
provider: model.provider,
|
|
78
|
+
id: model.id,
|
|
79
|
+
model,
|
|
80
|
+
label: model.name ?? canonicalId,
|
|
81
|
+
description: canonicalId,
|
|
82
|
+
isCurrent,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
if (ctx.model && matchModelPatterns(ctx.model, enabledModelPatterns)) {
|
|
87
|
+
addModel(ctx.model, true);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
for (const model of availableModels) {
|
|
91
|
+
addModel(
|
|
92
|
+
model,
|
|
93
|
+
ctx.model ? toCanonicalModelId(model) === toCanonicalModelId(ctx.model) : false,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return Array.from(byCanonicalId.values()).sort((a, b) => {
|
|
98
|
+
if (a.isCurrent !== b.isCurrent) return a.isCurrent ? -1 : 1;
|
|
99
|
+
return a.canonicalId.localeCompare(b.canonicalId);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ── Private helpers ────────────────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
function filterByEnabledModels<T extends { provider: string; id: string }>(
|
|
106
|
+
patterns: string[],
|
|
107
|
+
models: T[],
|
|
108
|
+
): T[] {
|
|
109
|
+
return models.filter((model) => matchModelPatterns(model, patterns));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function matchModelPatterns(model: { provider: string; id: string }, patterns: string[]): boolean {
|
|
113
|
+
return patterns.some((pattern) => matchModelPattern(model, pattern));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function matchModelPattern(model: { provider: string; id: string }, pattern: string): boolean {
|
|
117
|
+
const canonicalId = `${model.provider}/${model.id}`;
|
|
118
|
+
if (pattern.includes("/")) {
|
|
119
|
+
return simpleGlobMatch(canonicalId, pattern);
|
|
120
|
+
}
|
|
121
|
+
return simpleGlobMatch(model.id, pattern) || simpleGlobMatch(canonicalId, pattern);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function simpleGlobMatch(text: string, pattern: string): boolean {
|
|
125
|
+
if (!pattern.includes("*") && !pattern.includes("?")) {
|
|
126
|
+
return text.toLowerCase() === pattern.toLowerCase();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const regex = pattern
|
|
130
|
+
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
131
|
+
.replace(/\*/g, ".*")
|
|
132
|
+
.replace(/\?/g, ".");
|
|
133
|
+
return new RegExp(`^${regex}$`, "i").test(text);
|
|
134
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Extensions declare their settings via `registerSettings()` during their
|
|
4
4
|
// factory function. The generic settings UI reads them via `getRegisteredSettings()`.
|
|
5
5
|
|
|
6
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
7
|
import type { SettingItem } from "@earendil-works/pi-tui";
|
|
7
8
|
import { createRegistry } from "../registry-utils.ts";
|
|
8
9
|
|
|
@@ -14,9 +15,15 @@ export interface SettingsSection {
|
|
|
14
15
|
/** Human-readable label shown in the UI */
|
|
15
16
|
label: string;
|
|
16
17
|
/** Load current SettingItem[] for the given scope */
|
|
17
|
-
loadValues: (scope: SettingsScope, cwd: string) => SettingItem[];
|
|
18
|
+
loadValues: (scope: SettingsScope, cwd: string, ctx?: ExtensionContext) => SettingItem[];
|
|
18
19
|
/** Persist a change back to config */
|
|
19
|
-
persistChange: (
|
|
20
|
+
persistChange: (
|
|
21
|
+
scope: SettingsScope,
|
|
22
|
+
cwd: string,
|
|
23
|
+
settingId: string,
|
|
24
|
+
value: string,
|
|
25
|
+
ctx?: ExtensionContext,
|
|
26
|
+
) => void;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
const registry = createRegistry<SettingsSection>("settings-registry");
|