@mrclrchtr/supi-code-intelligence 1.16.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +373 -63
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.d.ts +21 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.d.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
- package/package.json +14 -9
- package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
- package/src/analysis/architecture/model.ts +76 -0
- package/src/analysis/brief/directory.ts +324 -0
- package/src/analysis/brief/enrich.ts +157 -0
- package/src/analysis/brief/file.ts +84 -0
- package/src/analysis/brief/inventory.ts +177 -0
- package/src/analysis/brief/main.ts +176 -0
- package/src/analysis/brief/models.ts +75 -0
- package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
- package/src/analysis/brief/summarize.ts +208 -0
- package/src/analysis/brief/types.ts +27 -0
- package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
- package/src/analysis/coverage/coverage-warnings.ts +224 -0
- package/src/analysis/evidence.ts +91 -0
- package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
- package/src/analysis/provider.ts +186 -0
- package/src/analysis/read-next.ts +126 -0
- package/src/analysis/readiness.ts +73 -0
- package/src/{refactor → analysis/refactor}/safety.ts +1 -1
- package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
- package/src/analysis/search/pattern.ts +345 -0
- package/src/analysis/search/ripgrep.ts +473 -0
- package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
- package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
- package/src/analysis/target/anchored.ts +349 -0
- package/src/analysis/target/bridge.ts +152 -0
- package/src/analysis/target/file-resolution.ts +125 -0
- package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
- package/src/{planner → analysis/target}/planner.ts +30 -20
- package/src/{targeting → analysis/target}/query.ts +17 -3
- package/src/analysis/target/resolve-common.ts +115 -0
- package/src/analysis/target/service.ts +229 -0
- package/src/analysis/target/symbol.ts +196 -0
- package/src/{targeting → analysis/target}/types.ts +17 -1
- package/src/analysis/tests/likely-tests.ts +174 -0
- package/src/analysis/tests/test-discovery.ts +540 -0
- package/src/analysis/tests/vitest.ts +87 -0
- package/src/api.ts +34 -41
- package/src/app/app.ts +125 -0
- package/src/app/manager.ts +65 -0
- package/src/extension.ts +132 -1
- package/src/index.ts +1 -57
- package/src/session/refactor-plans.ts +82 -0
- package/src/session/session.ts +300 -0
- package/src/session/target-store.ts +293 -0
- package/src/substrate/lsp/diagnostic-injection.ts +218 -0
- package/src/substrate/lsp/lifecycle.ts +66 -0
- package/src/substrate/lsp/overrides.ts +132 -0
- package/src/substrate/lsp/recovery.ts +55 -0
- package/src/substrate/lsp/settings.ts +286 -0
- package/src/substrate/lsp/state.ts +46 -0
- package/src/substrate/lsp/utils.ts +17 -0
- package/src/substrate/tree-sitter/lifecycle.ts +52 -0
- package/src/tool/find/execute.ts +118 -0
- package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
- package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
- package/src/tool/find/semantic-search.ts +114 -0
- package/src/tool/find/tui.ts +39 -0
- package/src/tool/graph/callees.ts +87 -0
- package/src/tool/graph/calls-md.ts +54 -0
- package/src/tool/graph/collect-relation.ts +371 -0
- package/src/tool/graph/execute.ts +95 -0
- package/src/tool/graph/implementations-md.ts +79 -0
- package/src/tool/graph/implementations.ts +76 -0
- package/src/tool/graph/markdown-base.ts +243 -0
- package/src/tool/graph/orchestrate.ts +285 -0
- package/src/tool/graph/references-md.ts +34 -0
- package/src/tool/graph/references.ts +81 -0
- package/src/tool/graph/tui.ts +120 -0
- package/src/tool/graph/types.ts +97 -0
- package/src/tool/guidance.ts +96 -49
- package/src/tool/health/execute.ts +76 -0
- package/src/tool/health/markdown.ts +280 -0
- package/src/tool/health/orchestrate.ts +159 -0
- package/src/tool/health/sections/diagnostics.ts +182 -0
- package/src/tool/health/sections/recovery.ts +89 -0
- package/src/tool/health/sections/signals.ts +89 -0
- package/src/tool/health/tui.ts +137 -0
- package/src/tool/impact/analysis.ts +247 -0
- package/src/tool/impact/change-set-impact.ts +151 -0
- package/src/tool/impact/execute.ts +98 -0
- package/src/tool/impact/file-level-impact.ts +81 -0
- package/src/tool/impact/markdown.ts +283 -0
- package/src/tool/impact/orchestrate.ts +97 -0
- package/src/tool/impact/result.ts +21 -0
- package/src/tool/impact/single-impact.ts +89 -0
- package/src/tool/impact/tui.ts +39 -0
- package/src/tool/impact/types.ts +34 -0
- package/src/tool/infra/cross-field.ts +335 -0
- package/src/tool/infra/error-results.ts +199 -0
- package/src/tool/infra/pipeline.ts +311 -0
- package/src/tool/infra/progress.ts +21 -0
- package/src/tool/infra/readiness-message.ts +5 -0
- package/src/tool/infra/truncate.ts +49 -0
- package/src/tool/inspect/execute.ts +76 -0
- package/src/tool/inspect/markdown.ts +169 -0
- package/src/tool/inspect/orchestrate.ts +156 -0
- package/src/tool/inspect/tui.ts +36 -0
- package/src/tool/orientation/deps.ts +63 -0
- package/src/tool/orientation/execute.ts +50 -0
- package/src/tool/orientation/markdown.ts +35 -0
- package/src/tool/orientation/mode.ts +88 -0
- package/src/tool/orientation/orchestrate.ts +478 -0
- package/src/tool/orientation/precise-target.ts +257 -0
- package/src/tool/orientation/tui.ts +131 -0
- package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
- package/src/tool/refactor-apply/execute.ts +20 -0
- package/src/tool/refactor-apply/markdown.ts +118 -0
- package/src/tool/refactor-apply/orchestrate.ts +89 -0
- package/src/tool/refactor-apply/tui.ts +51 -0
- package/src/tool/refactor-plan/execute.ts +73 -0
- package/src/tool/refactor-plan/markdown.ts +118 -0
- package/src/tool/refactor-plan/orchestrate.ts +363 -0
- package/src/tool/refactor-plan/tui.ts +42 -0
- package/src/tool/register.ts +123 -0
- package/src/tool/resolve/execute.ts +82 -0
- package/src/tool/resolve/markdown.ts +150 -0
- package/src/tool/resolve/orchestrate.ts +134 -0
- package/src/tool/resolve/tui.ts +40 -0
- package/src/tool/schemas.ts +337 -0
- package/src/tool/specs.ts +257 -0
- package/src/types/details.ts +188 -0
- package/src/types/execution.ts +60 -0
- package/src/types/index.ts +28 -0
- package/src/{intent/types.ts → types/tool-names.ts} +15 -14
- package/src/ui/footer.ts +52 -0
- package/src/ui/markdown/brief.ts +218 -0
- package/src/ui/markdown/gather.ts +177 -0
- package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
- package/src/{presentation → ui}/markdown/overview.ts +2 -2
- package/src/ui/markdown/types.ts +80 -0
- package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
- package/src/ui/status-command.ts +260 -0
- package/src/ui/status-overlay.ts +500 -0
- package/src/ui/tui/common.ts +220 -0
- package/src/ui/tui/index.ts +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
- package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
- package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
- package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
- package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
- package/src/brief-focused.ts +0 -563
- package/src/code-intelligence.ts +0 -70
- package/src/pattern-structured.ts +0 -194
- package/src/presentation/markdown/affected.ts +0 -170
- package/src/presentation/markdown/brief.ts +0 -174
- package/src/presentation/markdown/map.ts +0 -54
- package/src/presentation/markdown/refactor.ts +0 -27
- package/src/presentation/markdown/relations.ts +0 -121
- package/src/resolve-target.ts +0 -130
- package/src/search-helpers.ts +0 -303
- package/src/substrates/types.ts +0 -30
- package/src/target-resolution.ts +0 -122
- package/src/targeting/resolve-anchored.ts +0 -80
- package/src/targeting/resolve-symbol.ts +0 -110
- package/src/tool/execute-affected.ts +0 -71
- package/src/tool/execute-brief.ts +0 -59
- package/src/tool/execute-map.ts +0 -35
- package/src/tool/execute-pattern.ts +0 -29
- package/src/tool/execute-refactor.ts +0 -101
- package/src/tool/execute-relations.ts +0 -79
- package/src/tool/register-tools.ts +0 -32
- package/src/tool/tool-specs.ts +0 -190
- package/src/tool/validation.ts +0 -43
- package/src/types.ts +0 -169
- package/src/use-case/generate-affected.ts +0 -297
- package/src/use-case/generate-map.ts +0 -176
- package/src/use-case/generate-relations.ts +0 -438
- package/src/use-case/types.ts +0 -43
- package/src/workspace/request-context.ts +0 -139
- /package/src/{query-params.ts → tool/params.ts} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Enrichment helpers for the brief pipeline.
|
|
2
|
+
//
|
|
3
|
+
// Provides three functions:
|
|
4
|
+
// - enrichFileContext(provider, file, maxResults) — outline, imports, exports
|
|
5
|
+
// - enrichDiagnosticContext(cwd, file, maxResults) — LSP diagnostics
|
|
6
|
+
// - gatherBriefEnrichment(provider, cwd, file, maxResults) — orchestrates both
|
|
7
|
+
|
|
8
|
+
import type { SessionLspServiceState } from "@mrclrchtr/supi-lsp/api";
|
|
9
|
+
import { diagnosticMessageString } from "../../substrate/lsp/utils.ts";
|
|
10
|
+
import type { CodeProvider } from "../provider.ts";
|
|
11
|
+
import type { BriefDiagnostic, BriefEnrichment } from "./models.ts";
|
|
12
|
+
|
|
13
|
+
// ── Default caps ─────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
const DEFAULT_OUTLINE_CAP = 15;
|
|
16
|
+
const DEFAULT_IMPORTS_CAP = 10;
|
|
17
|
+
const DEFAULT_EXPORTS_CAP = 10;
|
|
18
|
+
const DEFAULT_DIAGNOSTICS_CAP = 5;
|
|
19
|
+
|
|
20
|
+
function cap(count: number | undefined, def: number): number {
|
|
21
|
+
return count != null && count > 0 ? count : def;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ── Structural enrichment ───────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Enrich file context with outline, imports, and exports from a provider.
|
|
28
|
+
* Each section is capped at maxResults with per-section defaults.
|
|
29
|
+
*/
|
|
30
|
+
export async function enrichFileContext(
|
|
31
|
+
provider: CodeProvider,
|
|
32
|
+
file: string,
|
|
33
|
+
maxResults?: number,
|
|
34
|
+
): Promise<Pick<BriefEnrichment, "outline" | "imports" | "exports">> {
|
|
35
|
+
const outlineCap = cap(maxResults, DEFAULT_OUTLINE_CAP);
|
|
36
|
+
const importsCap = cap(maxResults, DEFAULT_IMPORTS_CAP);
|
|
37
|
+
const exportsCap = cap(maxResults, DEFAULT_EXPORTS_CAP);
|
|
38
|
+
|
|
39
|
+
const outline = await tryOutline(provider, file, outlineCap);
|
|
40
|
+
const imports = await tryImports(provider, file, importsCap);
|
|
41
|
+
const exports = await tryExports(provider, file, exportsCap);
|
|
42
|
+
|
|
43
|
+
return { outline, imports, exports };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function tryOutline(
|
|
47
|
+
provider: CodeProvider,
|
|
48
|
+
file: string,
|
|
49
|
+
capN: number,
|
|
50
|
+
): Promise<BriefEnrichment["outline"]> {
|
|
51
|
+
try {
|
|
52
|
+
const result = await provider.outline(file);
|
|
53
|
+
if (result.kind !== "success") return [];
|
|
54
|
+
return result.data.slice(0, capN).map((item) => ({
|
|
55
|
+
name: item.name,
|
|
56
|
+
kind: item.kind,
|
|
57
|
+
startLine: item.startLine,
|
|
58
|
+
endLine: item.endLine,
|
|
59
|
+
}));
|
|
60
|
+
} catch {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function tryImports(
|
|
66
|
+
provider: CodeProvider,
|
|
67
|
+
file: string,
|
|
68
|
+
capN: number,
|
|
69
|
+
): Promise<BriefEnrichment["imports"]> {
|
|
70
|
+
try {
|
|
71
|
+
const result = await provider.imports(file);
|
|
72
|
+
if (result.kind !== "success") return [];
|
|
73
|
+
return result.data.slice(0, capN).map((item) => ({
|
|
74
|
+
moduleSpecifier: item.moduleSpecifier,
|
|
75
|
+
}));
|
|
76
|
+
} catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function tryExports(
|
|
82
|
+
provider: CodeProvider,
|
|
83
|
+
file: string,
|
|
84
|
+
capN: number,
|
|
85
|
+
): Promise<BriefEnrichment["exports"]> {
|
|
86
|
+
try {
|
|
87
|
+
const result = await provider.exports(file);
|
|
88
|
+
if (result.kind !== "success") return [];
|
|
89
|
+
return result.data.slice(0, capN).map((item) => ({
|
|
90
|
+
name: item.name,
|
|
91
|
+
kind: item.kind,
|
|
92
|
+
}));
|
|
93
|
+
} catch {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── Diagnostic enrichment ───────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get LSP diagnostics for a file (errors + warnings).
|
|
102
|
+
* Returns capped diagnostic entries.
|
|
103
|
+
*/
|
|
104
|
+
export async function enrichDiagnosticContext(
|
|
105
|
+
file: string | undefined,
|
|
106
|
+
maxResults: number | undefined,
|
|
107
|
+
lspService: SessionLspServiceState,
|
|
108
|
+
): Promise<Pick<BriefEnrichment, "diagnostics">> {
|
|
109
|
+
if (!file) return { diagnostics: [] };
|
|
110
|
+
|
|
111
|
+
const capN = cap(maxResults, DEFAULT_DIAGNOSTICS_CAP);
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
if (lspService.kind !== "ready") return { diagnostics: [] };
|
|
115
|
+
|
|
116
|
+
const diags = await lspService.service.fileDiagnostics(file, 2);
|
|
117
|
+
if (!diags || diags.length === 0) return { diagnostics: [] };
|
|
118
|
+
|
|
119
|
+
// Map to our DTO shape (1-based line for display)
|
|
120
|
+
const mapped: BriefDiagnostic[] = diags.map((d) => ({
|
|
121
|
+
line: d.range.start.line + 1,
|
|
122
|
+
severity: d.severity ?? 1,
|
|
123
|
+
message: diagnosticMessageString(d),
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
return { diagnostics: mapped.slice(0, capN) };
|
|
127
|
+
} catch {
|
|
128
|
+
return { diagnostics: [] };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ── Combined enrichment ─────────────────────────────────────────────
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Orchestrate both structural and diagnostic enrichment for a file.
|
|
136
|
+
*/
|
|
137
|
+
export async function gatherBriefEnrichment(
|
|
138
|
+
provider: CodeProvider | null,
|
|
139
|
+
file: string,
|
|
140
|
+
maxResults: number | undefined,
|
|
141
|
+
lspService: SessionLspServiceState,
|
|
142
|
+
): Promise<BriefEnrichment> {
|
|
143
|
+
// Structural context (outline, imports, exports) needs a provider
|
|
144
|
+
const structural = provider
|
|
145
|
+
? await enrichFileContext(provider, file, maxResults)
|
|
146
|
+
: { outline: [], imports: [], exports: [] };
|
|
147
|
+
|
|
148
|
+
// Diagnostics can work independently of provider (reaches LSP directly)
|
|
149
|
+
const diagnostic = await enrichDiagnosticContext(file, maxResults, lspService);
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
outline: structural.outline,
|
|
153
|
+
imports: structural.imports,
|
|
154
|
+
exports: structural.exports,
|
|
155
|
+
diagnostics: diagnostic.diagnostics,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-level brief generation with provider enrichment.
|
|
3
|
+
*
|
|
4
|
+
* Generates a brief for a single source file, enriching with outline, imports,
|
|
5
|
+
* exports, diagnostics, and entrypoint-detection metadata.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from brief-focused.ts.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { renderFileBrief } from "../../ui/markdown/brief.ts";
|
|
13
|
+
import type { ArchitectureModel } from "../architecture/model.ts";
|
|
14
|
+
import { findModuleForPath } from "../architecture/model.ts";
|
|
15
|
+
import { gatherBriefEnrichment } from "./enrich.ts";
|
|
16
|
+
import type { BriefOpts } from "./models.ts";
|
|
17
|
+
|
|
18
|
+
/** Generate a file-level brief with structural enrichment and diagnostics. */
|
|
19
|
+
export async function generateFileBrief(
|
|
20
|
+
model: ArchitectureModel,
|
|
21
|
+
resolvedPath: string,
|
|
22
|
+
opts?: BriefOpts,
|
|
23
|
+
): Promise<{
|
|
24
|
+
content: string;
|
|
25
|
+
publicSurfaces: string[];
|
|
26
|
+
nextQueries: string[];
|
|
27
|
+
}> {
|
|
28
|
+
const mod = findModuleForPath(model, resolvedPath);
|
|
29
|
+
const publicSurfaces: string[] = [];
|
|
30
|
+
const nextQueries: string[] = [];
|
|
31
|
+
|
|
32
|
+
const fileName = path.basename(resolvedPath);
|
|
33
|
+
const relPath = path.relative(model.root, resolvedPath);
|
|
34
|
+
|
|
35
|
+
let lineCount = 0;
|
|
36
|
+
try {
|
|
37
|
+
const fileContent = fs.readFileSync(resolvedPath, "utf-8");
|
|
38
|
+
lineCount = fileContent.split("\n").length;
|
|
39
|
+
} catch {
|
|
40
|
+
// Leave 0
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const isEntrypoint =
|
|
44
|
+
mod?.entrypoints.some((ep) => path.resolve(mod.root, ep) === resolvedPath) ?? false;
|
|
45
|
+
|
|
46
|
+
const lspService =
|
|
47
|
+
opts?.lspService ??
|
|
48
|
+
({
|
|
49
|
+
kind: "unavailable" as const,
|
|
50
|
+
reason: "No LSP service",
|
|
51
|
+
} as import("@mrclrchtr/supi-lsp/api").SessionLspServiceState);
|
|
52
|
+
const enrichment = await gatherBriefEnrichment(
|
|
53
|
+
opts?.provider ?? null,
|
|
54
|
+
relPath,
|
|
55
|
+
opts?.maxResults,
|
|
56
|
+
lspService,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const renderedContent = renderFileBrief({
|
|
60
|
+
relPath: relPath || fileName,
|
|
61
|
+
lineCount,
|
|
62
|
+
isEntrypoint,
|
|
63
|
+
moduleName: mod ? mod.name.replace(/^@[^/]+\//, "") : null,
|
|
64
|
+
moduleRelativePath: mod ? mod.relativePath : null,
|
|
65
|
+
enrichment,
|
|
66
|
+
maxResults: opts?.maxResults,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (isEntrypoint) {
|
|
70
|
+
const shortName = mod?.name.replace(/^@[^/]+\//, "") ?? "";
|
|
71
|
+
publicSurfaces.push(`${shortName} entrypoint`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
nextQueries.push(
|
|
75
|
+
`\`code_graph\`, \`file: "${relPath}"\`, and a line/character for reference sites`,
|
|
76
|
+
);
|
|
77
|
+
if (mod) {
|
|
78
|
+
nextQueries.push(
|
|
79
|
+
`\`code_orientation\` with \`focus: "${mod.relativePath}"\` for the containing module overview`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return { content: renderedContent, publicSurfaces, nextQueries };
|
|
84
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory inventory collection — flat file counts by extension and landmark detection.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from brief-focused.ts to keep the focus-generation modules
|
|
5
|
+
* cohesive and avoid a single 800+ line file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as fs from "node:fs";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
|
|
11
|
+
// ── Types ─────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
/** Flat inventory of a directory tree. */
|
|
14
|
+
export interface DirectoryInventory {
|
|
15
|
+
totalFiles: number;
|
|
16
|
+
byExtension: Map<string, number>;
|
|
17
|
+
landmarkFiles: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ── Public API ────────────────────────────────────────────────────────
|
|
21
|
+
|
|
22
|
+
/** Walk a directory tree collecting extension breakdown and landmark files. */
|
|
23
|
+
export function collectDirectoryInventory(dir: string): DirectoryInventory {
|
|
24
|
+
const byExtension = new Map<string, number>();
|
|
25
|
+
const landmarkFiles: string[] = [];
|
|
26
|
+
const state = { totalFiles: 0, byExtension, landmarkFiles };
|
|
27
|
+
|
|
28
|
+
function walk(currentPath: string) {
|
|
29
|
+
let entries: fs.Dirent[];
|
|
30
|
+
try {
|
|
31
|
+
entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
32
|
+
} catch {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
processInventoryEntry(entry, currentPath, walk, state);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
walk(dir);
|
|
41
|
+
landmarkFiles.sort((a, b) => a.localeCompare(b));
|
|
42
|
+
return { totalFiles: state.totalFiles, byExtension, landmarkFiles };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Append inventory (extension breakdown + landmarks) to a lines array. */
|
|
46
|
+
export function addInventoryToLines(lines: string[], inventory: DirectoryInventory): void {
|
|
47
|
+
if (inventory.totalFiles === 0) return;
|
|
48
|
+
|
|
49
|
+
lines.push(`**Files:** ${inventory.totalFiles} total`);
|
|
50
|
+
|
|
51
|
+
const sortedExts = [...inventory.byExtension.entries()].sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
52
|
+
for (const [ext, count] of sortedExts) {
|
|
53
|
+
const label = EXTENSION_LABELS.get(ext) ?? (ext || "(no extension)");
|
|
54
|
+
lines.push(`- ${label}: ${count}`);
|
|
55
|
+
}
|
|
56
|
+
if (inventory.byExtension.size > 10) {
|
|
57
|
+
lines.push(`- _+${inventory.byExtension.size - 10} more extensions_`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (inventory.landmarkFiles.length > 0) {
|
|
61
|
+
const unique = [...new Set(inventory.landmarkFiles)].sort((a, b) => a.localeCompare(b));
|
|
62
|
+
lines.push("");
|
|
63
|
+
lines.push("**Landmark files:**");
|
|
64
|
+
for (const f of unique) {
|
|
65
|
+
lines.push(`- \`${f}\``);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ── Internal helpers ──────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
/** Process a single directory entry during inventory collection. */
|
|
73
|
+
function processInventoryEntry(
|
|
74
|
+
entry: fs.Dirent,
|
|
75
|
+
currentPath: string,
|
|
76
|
+
walkFn: (p: string) => void,
|
|
77
|
+
state: {
|
|
78
|
+
totalFiles: number;
|
|
79
|
+
byExtension: Map<string, number>;
|
|
80
|
+
landmarkFiles: string[];
|
|
81
|
+
},
|
|
82
|
+
): void {
|
|
83
|
+
if (entry.name.startsWith(".") && entry.isDirectory()) return;
|
|
84
|
+
if (SKIP_DIRS.has(entry.name)) return;
|
|
85
|
+
if (entry.isDirectory()) {
|
|
86
|
+
walkFn(path.join(currentPath, entry.name));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
state.totalFiles++;
|
|
90
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
91
|
+
state.byExtension.set(ext, (state.byExtension.get(ext) ?? 0) + 1);
|
|
92
|
+
if (LANDMARK_FILES.has(entry.name)) {
|
|
93
|
+
state.landmarkFiles.push(entry.name);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── Constants ─────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
/** Human-readable labels for common file extensions. */
|
|
100
|
+
const EXTENSION_LABELS: Map<string, string> = new Map([
|
|
101
|
+
[".ts", "TypeScript"],
|
|
102
|
+
[".tsx", "TSX"],
|
|
103
|
+
[".js", "JavaScript"],
|
|
104
|
+
[".jsx", "JSX"],
|
|
105
|
+
[".mts", "TypeScript"],
|
|
106
|
+
[".cts", "TypeScript"],
|
|
107
|
+
[".mjs", "JavaScript"],
|
|
108
|
+
[".cjs", "JavaScript"],
|
|
109
|
+
[".py", "Python"],
|
|
110
|
+
[".pyi", "Python"],
|
|
111
|
+
[".rs", "Rust"],
|
|
112
|
+
[".go", "Go"],
|
|
113
|
+
[".mod", "Go"],
|
|
114
|
+
[".java", "Java"],
|
|
115
|
+
[".kt", "Kotlin"],
|
|
116
|
+
[".kts", "Kotlin"],
|
|
117
|
+
[".rb", "Ruby"],
|
|
118
|
+
[".php", "PHP"],
|
|
119
|
+
[".swift", "Swift"],
|
|
120
|
+
[".cpp", "C++"],
|
|
121
|
+
[".hpp", "C++"],
|
|
122
|
+
[".cc", "C++"],
|
|
123
|
+
[".cxx", "C++"],
|
|
124
|
+
[".hxx", "C++ Header"],
|
|
125
|
+
[".c++", "C++"],
|
|
126
|
+
[".h++", "C++ Header"],
|
|
127
|
+
[".c", "C"],
|
|
128
|
+
[".h", "C Header"],
|
|
129
|
+
[".css", "CSS"],
|
|
130
|
+
[".scss", "SCSS"],
|
|
131
|
+
[".less", "Less"],
|
|
132
|
+
[".html", "HTML"],
|
|
133
|
+
[".htm", "HTML"],
|
|
134
|
+
[".xhtml", "HTML"],
|
|
135
|
+
[".json", "JSON"],
|
|
136
|
+
[".yaml", "YAML"],
|
|
137
|
+
[".yml", "YAML"],
|
|
138
|
+
[".toml", "TOML"],
|
|
139
|
+
[".md", "Markdown"],
|
|
140
|
+
[".sh", "Shell"],
|
|
141
|
+
[".bash", "Shell"],
|
|
142
|
+
[".zsh", "Shell"],
|
|
143
|
+
[".r", "R"],
|
|
144
|
+
[".sql", "SQL"],
|
|
145
|
+
[".cs", "C#"],
|
|
146
|
+
]);
|
|
147
|
+
|
|
148
|
+
/** Landmark files — well-known project configuration files. */
|
|
149
|
+
const LANDMARK_FILES = new Set([
|
|
150
|
+
"package.json",
|
|
151
|
+
"tsconfig.json",
|
|
152
|
+
"jsconfig.json",
|
|
153
|
+
"vite.config.ts",
|
|
154
|
+
"vitest.config.ts",
|
|
155
|
+
"jest.config.ts",
|
|
156
|
+
"playwright.config.ts",
|
|
157
|
+
"biome.json",
|
|
158
|
+
"eslint.config.js",
|
|
159
|
+
".eslintrc.js",
|
|
160
|
+
"deno.json",
|
|
161
|
+
"deno.jsonc",
|
|
162
|
+
"Cargo.toml",
|
|
163
|
+
"go.mod",
|
|
164
|
+
"pyproject.toml",
|
|
165
|
+
"setup.py",
|
|
166
|
+
"requirements.txt",
|
|
167
|
+
"Makefile",
|
|
168
|
+
"justfile",
|
|
169
|
+
"Taskfile.yml",
|
|
170
|
+
"Dockerfile",
|
|
171
|
+
"docker-compose.yml",
|
|
172
|
+
".env.example",
|
|
173
|
+
".env.local.example",
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
/** Skip these directories during flat inventory walks. */
|
|
177
|
+
const SKIP_DIRS = new Set(["node_modules", "dist", "build", ".git"]);
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focused brief generation — dispatches to file or directory brief.
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point, extracted from the original 800+ line
|
|
5
|
+
* brief-focused.ts. File and directory brief logic now live in sibling
|
|
6
|
+
* modules under use-case/brief/.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
12
|
+
import type { BriefDetails } from "../../types/index.ts";
|
|
13
|
+
import type { ArchitectureModel } from "../architecture/model.ts";
|
|
14
|
+
import { findModuleForPath } from "../architecture/model.ts";
|
|
15
|
+
import { formatGitContext, gatherGitContext } from "../signals/git.ts";
|
|
16
|
+
import {
|
|
17
|
+
appendPrioritySignalsSection,
|
|
18
|
+
summarizePrioritySignalsForFiles,
|
|
19
|
+
} from "../signals/project.ts";
|
|
20
|
+
import { generateDirectoryBrief } from "./directory.ts";
|
|
21
|
+
import { generateFileBrief } from "./file.ts";
|
|
22
|
+
import type { BriefOpts } from "./models.ts";
|
|
23
|
+
import { summarizeDirectoryRecursively } from "./summarize.ts";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generate a focused brief for a specific path (directory or file).
|
|
27
|
+
*
|
|
28
|
+
* When opts.provider is available, file briefs include structural
|
|
29
|
+
* context (outline, imports, exports) and inline diagnostics.
|
|
30
|
+
* Module briefs include aggregated diagnostics across source files.
|
|
31
|
+
*/
|
|
32
|
+
export async function generateFocusedBrief(
|
|
33
|
+
model: ArchitectureModel,
|
|
34
|
+
focusPath: string,
|
|
35
|
+
opts?: BriefOpts,
|
|
36
|
+
): Promise<{ content: string; details: BriefDetails }> {
|
|
37
|
+
const resolvedPath = path.resolve(focusPath);
|
|
38
|
+
|
|
39
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
40
|
+
return {
|
|
41
|
+
content: `**Error:** Path not found: \`${focusPath}\``,
|
|
42
|
+
details: {
|
|
43
|
+
confidence: "unavailable",
|
|
44
|
+
focusTarget: focusPath,
|
|
45
|
+
startHere: [],
|
|
46
|
+
publicSurfaces: [],
|
|
47
|
+
dependencySummary: null,
|
|
48
|
+
omittedCount: 0,
|
|
49
|
+
nextQueries: [],
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const stat = fs.statSync(resolvedPath);
|
|
55
|
+
|
|
56
|
+
if (stat.isDirectory()) {
|
|
57
|
+
return await generateDirectoryFocused(model, resolvedPath, focusPath, opts);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return await generateFileFocused(model, resolvedPath, focusPath, opts);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ── Directory dispatch ────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
async function generateDirectoryFocused(
|
|
66
|
+
model: ArchitectureModel,
|
|
67
|
+
resolvedPath: string,
|
|
68
|
+
originalPath: string,
|
|
69
|
+
opts?: BriefOpts,
|
|
70
|
+
): Promise<{ content: string; details: BriefDetails }> {
|
|
71
|
+
const confidence: ConfidenceMode = "structural";
|
|
72
|
+
|
|
73
|
+
const { lines, publicSurfaces, nextQueries, startHere } = await generateDirectoryBrief(
|
|
74
|
+
model,
|
|
75
|
+
resolvedPath,
|
|
76
|
+
originalPath,
|
|
77
|
+
opts,
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Determine module info for dependency summary
|
|
81
|
+
const mod = findModuleForPath(model, resolvedPath);
|
|
82
|
+
const isModuleRoot = mod && mod.root === resolvedPath;
|
|
83
|
+
|
|
84
|
+
// Priority signals
|
|
85
|
+
const lspService =
|
|
86
|
+
opts?.lspService ??
|
|
87
|
+
({
|
|
88
|
+
kind: "unavailable" as const,
|
|
89
|
+
reason: "No LSP service",
|
|
90
|
+
} as import("@mrclrchtr/supi-lsp/api").SessionLspServiceState);
|
|
91
|
+
const prioritySignals = summarizePrioritySignalsForFiles(
|
|
92
|
+
model.root,
|
|
93
|
+
summarizeDirectoryRecursively(resolvedPath).allFiles,
|
|
94
|
+
lspService,
|
|
95
|
+
);
|
|
96
|
+
appendPrioritySignalsSection(lines, prioritySignals);
|
|
97
|
+
|
|
98
|
+
// Git context
|
|
99
|
+
if (opts?.showGitContext !== false) {
|
|
100
|
+
const gitCtx = gatherGitContext(model.root);
|
|
101
|
+
if (gitCtx) {
|
|
102
|
+
lines.push(formatGitContext(gitCtx));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
lines.push("");
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
content: lines.join("\n"),
|
|
110
|
+
details: {
|
|
111
|
+
confidence,
|
|
112
|
+
focusTarget: originalPath,
|
|
113
|
+
startHere: startHere.slice(0, 3),
|
|
114
|
+
publicSurfaces: publicSurfaces.slice(0, 5),
|
|
115
|
+
dependencySummary: isModuleRoot
|
|
116
|
+
? { moduleCount: 1, edgeCount: mod.internalDeps.length }
|
|
117
|
+
: null,
|
|
118
|
+
omittedCount: 0,
|
|
119
|
+
nextQueries,
|
|
120
|
+
prioritySignals,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ── File dispatch ─────────────────────────────────────────────────────
|
|
126
|
+
|
|
127
|
+
async function generateFileFocused(
|
|
128
|
+
model: ArchitectureModel,
|
|
129
|
+
resolvedPath: string,
|
|
130
|
+
originalPath: string,
|
|
131
|
+
opts?: BriefOpts,
|
|
132
|
+
): Promise<{ content: string; details: BriefDetails }> {
|
|
133
|
+
const {
|
|
134
|
+
content: briefContent,
|
|
135
|
+
publicSurfaces,
|
|
136
|
+
nextQueries,
|
|
137
|
+
} = await generateFileBrief(model, resolvedPath, opts);
|
|
138
|
+
|
|
139
|
+
// Priority signals
|
|
140
|
+
const lspService =
|
|
141
|
+
opts?.lspService ??
|
|
142
|
+
({
|
|
143
|
+
kind: "unavailable" as const,
|
|
144
|
+
reason: "No LSP service",
|
|
145
|
+
} as import("@mrclrchtr/supi-lsp/api").SessionLspServiceState);
|
|
146
|
+
const prioritySignals = summarizePrioritySignalsForFiles(model.root, [resolvedPath], lspService);
|
|
147
|
+
const extraLines: string[] = [];
|
|
148
|
+
if (prioritySignals) {
|
|
149
|
+
appendPrioritySignalsSection(extraLines, prioritySignals);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Git context
|
|
153
|
+
if (opts?.showGitContext !== false) {
|
|
154
|
+
const gitCtx = gatherGitContext(model.root);
|
|
155
|
+
if (gitCtx) {
|
|
156
|
+
extraLines.push(formatGitContext(gitCtx));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const extraStr = extraLines.filter((l) => l.trim()).join("\n");
|
|
161
|
+
const combinedContent = extraStr ? `${briefContent.trim()}\n\n${extraStr}\n` : briefContent;
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
content: combinedContent,
|
|
165
|
+
details: {
|
|
166
|
+
confidence: "structural",
|
|
167
|
+
focusTarget: originalPath,
|
|
168
|
+
startHere: [],
|
|
169
|
+
publicSurfaces,
|
|
170
|
+
dependencySummary: null,
|
|
171
|
+
omittedCount: 0,
|
|
172
|
+
nextQueries,
|
|
173
|
+
prioritySignals,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Typed DTOs for brief pipeline stages.
|
|
2
|
+
//
|
|
3
|
+
// Each brief mode produces a typed model (sync, manifest + fs), then
|
|
4
|
+
// enrichment adds provider context (async), then renderers consume
|
|
5
|
+
// the enriched model to produce markdown.
|
|
6
|
+
|
|
7
|
+
// ── Brief models (build stage output) ────────────────────────────────
|
|
8
|
+
|
|
9
|
+
/** Model for a single-file brief. */
|
|
10
|
+
export interface FileBriefModel {
|
|
11
|
+
kind: "file";
|
|
12
|
+
file: string;
|
|
13
|
+
relPath: string;
|
|
14
|
+
lineCount: number;
|
|
15
|
+
isEntrypoint: boolean;
|
|
16
|
+
moduleName: string | null;
|
|
17
|
+
moduleRelativePath: string | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Model for a module (package) brief. */
|
|
21
|
+
export interface ModuleBriefModel {
|
|
22
|
+
kind: "module";
|
|
23
|
+
name: string;
|
|
24
|
+
shortName: string;
|
|
25
|
+
description: string | null;
|
|
26
|
+
relativePath: string;
|
|
27
|
+
entrypoints: string[];
|
|
28
|
+
sourceFiles: string[];
|
|
29
|
+
allFiles: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Model for a non-module directory brief. */
|
|
33
|
+
export interface DirectoryBriefModel {
|
|
34
|
+
kind: "directory";
|
|
35
|
+
path: string;
|
|
36
|
+
relPath: string;
|
|
37
|
+
directFiles: string[];
|
|
38
|
+
subdirs: Array<{ name: string; fileCount: number }>;
|
|
39
|
+
totalSourceFiles: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ── Enrichment (async provider context) ──────────────────────────────
|
|
43
|
+
|
|
44
|
+
/** A single file's diagnostic entry. */
|
|
45
|
+
export interface BriefDiagnostic {
|
|
46
|
+
line: number;
|
|
47
|
+
severity: number;
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Provider-enriched context for a file or module. */
|
|
52
|
+
export interface BriefEnrichment {
|
|
53
|
+
outline: Array<{ name: string; kind: string; startLine: number; endLine: number }>;
|
|
54
|
+
imports: Array<{ moduleSpecifier: string }>;
|
|
55
|
+
exports: Array<{ name: string; kind: string }>;
|
|
56
|
+
diagnostics: BriefDiagnostic[];
|
|
57
|
+
/** Per-file aggregated diagnostics for module briefs. */
|
|
58
|
+
fileDiagnostics?: Array<{ file: string; errors: number; warnings: number }>;
|
|
59
|
+
/** Entrypoint outlines for module briefs. */
|
|
60
|
+
entrypointOutlines?: Array<{
|
|
61
|
+
entrypoint: string;
|
|
62
|
+
items: Array<{ name: string; kind: string; startLine: number }>;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Options for generateFocusedBrief. */
|
|
67
|
+
export interface BriefOpts {
|
|
68
|
+
provider?: import("../provider.ts").CodeProvider | null;
|
|
69
|
+
maxResults?: number;
|
|
70
|
+
cwd: string;
|
|
71
|
+
/** Show git context in orientation output. Defaults to true. */
|
|
72
|
+
showGitContext?: boolean;
|
|
73
|
+
/** LSP service state for diagnostic access. */
|
|
74
|
+
lspService?: import("@mrclrchtr/supi-lsp/api").SessionLspServiceState;
|
|
75
|
+
}
|