@mrclrchtr/supi-code-intelligence 1.16.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +373 -63
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
- package/package.json +14 -9
- package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
- package/src/analysis/architecture/model.ts +76 -0
- package/src/analysis/brief/directory.ts +324 -0
- package/src/analysis/brief/enrich.ts +157 -0
- package/src/analysis/brief/file.ts +84 -0
- package/src/analysis/brief/inventory.ts +177 -0
- package/src/analysis/brief/main.ts +176 -0
- package/src/analysis/brief/models.ts +75 -0
- package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
- package/src/analysis/brief/summarize.ts +208 -0
- package/src/analysis/brief/types.ts +27 -0
- package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
- package/src/analysis/coverage/coverage-warnings.ts +224 -0
- package/src/analysis/evidence.ts +91 -0
- package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
- package/src/analysis/provider.ts +186 -0
- package/src/analysis/read-next.ts +126 -0
- package/src/analysis/readiness.ts +73 -0
- package/src/{refactor → analysis/refactor}/safety.ts +1 -1
- package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
- package/src/analysis/search/pattern.ts +345 -0
- package/src/analysis/search/ripgrep.ts +473 -0
- package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
- package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
- package/src/analysis/target/anchored.ts +349 -0
- package/src/analysis/target/bridge.ts +152 -0
- package/src/analysis/target/file-resolution.ts +125 -0
- package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
- package/src/{planner → analysis/target}/planner.ts +30 -20
- package/src/{targeting → analysis/target}/query.ts +17 -3
- package/src/analysis/target/resolve-common.ts +115 -0
- package/src/analysis/target/service.ts +229 -0
- package/src/analysis/target/symbol.ts +196 -0
- package/src/{targeting → analysis/target}/types.ts +17 -1
- package/src/analysis/tests/likely-tests.ts +174 -0
- package/src/analysis/tests/test-discovery.ts +540 -0
- package/src/analysis/tests/vitest.ts +87 -0
- package/src/api.ts +34 -41
- package/src/app/app.ts +125 -0
- package/src/app/manager.ts +65 -0
- package/src/extension.ts +132 -1
- package/src/index.ts +1 -57
- package/src/session/refactor-plans.ts +82 -0
- package/src/session/session.ts +300 -0
- package/src/session/target-store.ts +293 -0
- package/src/substrate/lsp/diagnostic-injection.ts +218 -0
- package/src/substrate/lsp/lifecycle.ts +66 -0
- package/src/substrate/lsp/overrides.ts +132 -0
- package/src/substrate/lsp/recovery.ts +55 -0
- package/src/substrate/lsp/settings.ts +286 -0
- package/src/substrate/lsp/state.ts +46 -0
- package/src/substrate/lsp/utils.ts +17 -0
- package/src/substrate/tree-sitter/lifecycle.ts +52 -0
- package/src/tool/find/execute.ts +118 -0
- package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
- package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
- package/src/tool/find/semantic-search.ts +114 -0
- package/src/tool/find/tui.ts +39 -0
- package/src/tool/graph/callees.ts +87 -0
- package/src/tool/graph/calls-md.ts +54 -0
- package/src/tool/graph/collect-relation.ts +371 -0
- package/src/tool/graph/execute.ts +95 -0
- package/src/tool/graph/implementations-md.ts +79 -0
- package/src/tool/graph/implementations.ts +76 -0
- package/src/tool/graph/markdown-base.ts +243 -0
- package/src/tool/graph/orchestrate.ts +285 -0
- package/src/tool/graph/references-md.ts +34 -0
- package/src/tool/graph/references.ts +81 -0
- package/src/tool/graph/tui.ts +120 -0
- package/src/tool/graph/types.ts +97 -0
- package/src/tool/guidance.ts +96 -49
- package/src/tool/health/execute.ts +76 -0
- package/src/tool/health/markdown.ts +280 -0
- package/src/tool/health/orchestrate.ts +159 -0
- package/src/tool/health/sections/diagnostics.ts +182 -0
- package/src/tool/health/sections/recovery.ts +89 -0
- package/src/tool/health/sections/signals.ts +89 -0
- package/src/tool/health/tui.ts +137 -0
- package/src/tool/impact/analysis.ts +247 -0
- package/src/tool/impact/change-set-impact.ts +151 -0
- package/src/tool/impact/execute.ts +98 -0
- package/src/tool/impact/file-level-impact.ts +81 -0
- package/src/tool/impact/markdown.ts +283 -0
- package/src/tool/impact/orchestrate.ts +97 -0
- package/src/tool/impact/result.ts +21 -0
- package/src/tool/impact/single-impact.ts +89 -0
- package/src/tool/impact/tui.ts +39 -0
- package/src/tool/impact/types.ts +34 -0
- package/src/tool/infra/cross-field.ts +335 -0
- package/src/tool/infra/error-results.ts +199 -0
- package/src/tool/infra/pipeline.ts +311 -0
- package/src/tool/infra/progress.ts +21 -0
- package/src/tool/infra/readiness-message.ts +5 -0
- package/src/tool/infra/truncate.ts +49 -0
- package/src/tool/inspect/execute.ts +76 -0
- package/src/tool/inspect/markdown.ts +169 -0
- package/src/tool/inspect/orchestrate.ts +156 -0
- package/src/tool/inspect/tui.ts +36 -0
- package/src/tool/orientation/deps.ts +63 -0
- package/src/tool/orientation/execute.ts +50 -0
- package/src/tool/orientation/markdown.ts +35 -0
- package/src/tool/orientation/mode.ts +88 -0
- package/src/tool/orientation/orchestrate.ts +478 -0
- package/src/tool/orientation/precise-target.ts +257 -0
- package/src/tool/orientation/tui.ts +131 -0
- package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
- package/src/tool/refactor-apply/execute.ts +20 -0
- package/src/tool/refactor-apply/markdown.ts +118 -0
- package/src/tool/refactor-apply/orchestrate.ts +89 -0
- package/src/tool/refactor-apply/tui.ts +51 -0
- package/src/tool/refactor-plan/execute.ts +73 -0
- package/src/tool/refactor-plan/markdown.ts +118 -0
- package/src/tool/refactor-plan/orchestrate.ts +363 -0
- package/src/tool/refactor-plan/tui.ts +42 -0
- package/src/tool/register.ts +123 -0
- package/src/tool/resolve/execute.ts +82 -0
- package/src/tool/resolve/markdown.ts +150 -0
- package/src/tool/resolve/orchestrate.ts +134 -0
- package/src/tool/resolve/tui.ts +40 -0
- package/src/tool/schemas.ts +337 -0
- package/src/tool/specs.ts +257 -0
- package/src/types/details.ts +188 -0
- package/src/types/execution.ts +60 -0
- package/src/types/index.ts +28 -0
- package/src/{intent/types.ts → types/tool-names.ts} +15 -14
- package/src/ui/footer.ts +52 -0
- package/src/ui/markdown/brief.ts +218 -0
- package/src/ui/markdown/gather.ts +177 -0
- package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
- package/src/{presentation → ui}/markdown/overview.ts +2 -2
- package/src/ui/markdown/types.ts +80 -0
- package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
- package/src/ui/status-command.ts +260 -0
- package/src/ui/status-overlay.ts +500 -0
- package/src/ui/tui/common.ts +220 -0
- package/src/ui/tui/index.ts +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
- package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
- package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
- package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
- package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
- package/src/brief-focused.ts +0 -563
- package/src/code-intelligence.ts +0 -70
- package/src/pattern-structured.ts +0 -194
- package/src/presentation/markdown/affected.ts +0 -170
- package/src/presentation/markdown/brief.ts +0 -174
- package/src/presentation/markdown/map.ts +0 -54
- package/src/presentation/markdown/refactor.ts +0 -27
- package/src/presentation/markdown/relations.ts +0 -121
- package/src/resolve-target.ts +0 -130
- package/src/search-helpers.ts +0 -303
- package/src/substrates/types.ts +0 -30
- package/src/target-resolution.ts +0 -122
- package/src/targeting/resolve-anchored.ts +0 -80
- package/src/targeting/resolve-symbol.ts +0 -110
- package/src/tool/execute-affected.ts +0 -71
- package/src/tool/execute-brief.ts +0 -59
- package/src/tool/execute-map.ts +0 -35
- package/src/tool/execute-pattern.ts +0 -29
- package/src/tool/execute-refactor.ts +0 -101
- package/src/tool/execute-relations.ts +0 -79
- package/src/tool/register-tools.ts +0 -32
- package/src/tool/tool-specs.ts +0 -190
- package/src/tool/validation.ts +0 -43
- package/src/types.ts +0 -169
- package/src/use-case/generate-affected.ts +0 -297
- package/src/use-case/generate-map.ts +0 -176
- package/src/use-case/generate-relations.ts +0 -438
- package/src/use-case/types.ts +0 -43
- package/src/workspace/request-context.ts +0 -139
- /package/src/{query-params.ts → tool/params.ts} +0 -0
package/src/brief-focused.ts
DELETED
|
@@ -1,563 +0,0 @@
|
|
|
1
|
-
// Focused brief generation — directory and file briefs.
|
|
2
|
-
// biome-ignore-all lint/style/noExcessiveLinesPerFile: focused brief formatting and recursive directory summarization are kept together to share local helpers
|
|
3
|
-
|
|
4
|
-
import * as fs from "node:fs";
|
|
5
|
-
import * as path from "node:path";
|
|
6
|
-
import { formatGitContext, gatherGitContext } from "./git-context.ts";
|
|
7
|
-
import type { ArchitectureModel } from "./model.ts";
|
|
8
|
-
import { findModuleForPath, getDependencies, getDependents } from "./model.ts";
|
|
9
|
-
import {
|
|
10
|
-
appendPrioritySignalsSection,
|
|
11
|
-
summarizePrioritySignalsForFiles,
|
|
12
|
-
} from "./prioritization-signals.ts";
|
|
13
|
-
import type { BriefDetails, ConfidenceMode } from "./types.ts";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generate a focused brief for a specific path (directory or file).
|
|
17
|
-
*/
|
|
18
|
-
export function generateFocusedBrief(
|
|
19
|
-
model: ArchitectureModel,
|
|
20
|
-
focusPath: string,
|
|
21
|
-
): { content: string; details: BriefDetails } {
|
|
22
|
-
const resolvedPath = path.resolve(focusPath);
|
|
23
|
-
|
|
24
|
-
if (!fs.existsSync(resolvedPath)) {
|
|
25
|
-
return {
|
|
26
|
-
content: `**Error:** Path not found: \`${focusPath}\``,
|
|
27
|
-
details: {
|
|
28
|
-
confidence: "unavailable",
|
|
29
|
-
focusTarget: focusPath,
|
|
30
|
-
startHere: [],
|
|
31
|
-
publicSurfaces: [],
|
|
32
|
-
dependencySummary: null,
|
|
33
|
-
omittedCount: 0,
|
|
34
|
-
nextQueries: [],
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const stat = fs.statSync(resolvedPath);
|
|
40
|
-
|
|
41
|
-
if (stat.isDirectory()) {
|
|
42
|
-
return generateDirectoryBrief(model, resolvedPath, focusPath);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return generateFileBrief(model, resolvedPath, focusPath);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function generateDirectoryBrief(
|
|
49
|
-
model: ArchitectureModel,
|
|
50
|
-
resolvedPath: string,
|
|
51
|
-
originalPath: string,
|
|
52
|
-
): { content: string; details: BriefDetails } {
|
|
53
|
-
const mod = findModuleForPath(model, resolvedPath);
|
|
54
|
-
const lines: string[] = [];
|
|
55
|
-
const confidence: ConfidenceMode = "structural";
|
|
56
|
-
const startHere: Array<{ target: string; reason: string }> = [];
|
|
57
|
-
const publicSurfaces: string[] = [];
|
|
58
|
-
const nextQueries: string[] = [];
|
|
59
|
-
|
|
60
|
-
if (mod && mod.root === resolvedPath) {
|
|
61
|
-
formatModuleBrief({ mod, model, lines, startHere, publicSurfaces, nextQueries, resolvedPath });
|
|
62
|
-
} else {
|
|
63
|
-
formatNonModuleDir({
|
|
64
|
-
model,
|
|
65
|
-
mod,
|
|
66
|
-
resolvedPath,
|
|
67
|
-
originalPath,
|
|
68
|
-
lines,
|
|
69
|
-
publicSurfaces,
|
|
70
|
-
nextQueries,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (nextQueries.length > 0) {
|
|
75
|
-
lines.push("");
|
|
76
|
-
lines.push("## Next");
|
|
77
|
-
for (const q of nextQueries.slice(0, 2)) {
|
|
78
|
-
lines.push(`- ${q}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const prioritySignals = summarizePrioritySignalsForFiles(
|
|
83
|
-
model.root,
|
|
84
|
-
summarizeDirectoryRecursively(resolvedPath).allFiles,
|
|
85
|
-
);
|
|
86
|
-
appendPrioritySignalsSection(lines, prioritySignals);
|
|
87
|
-
|
|
88
|
-
const gitCtx = gatherGitContext(model.root);
|
|
89
|
-
if (gitCtx) {
|
|
90
|
-
lines.push(formatGitContext(gitCtx));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
lines.push("");
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
content: lines.join("\n"),
|
|
97
|
-
details: {
|
|
98
|
-
confidence,
|
|
99
|
-
focusTarget: originalPath,
|
|
100
|
-
startHere: startHere.slice(0, 3),
|
|
101
|
-
publicSurfaces: publicSurfaces.slice(0, 5),
|
|
102
|
-
dependencySummary: mod ? { moduleCount: 1, edgeCount: mod.internalDeps.length } : null,
|
|
103
|
-
omittedCount: 0,
|
|
104
|
-
nextQueries,
|
|
105
|
-
prioritySignals,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
interface ModuleBriefContext {
|
|
111
|
-
mod: NonNullable<ReturnType<typeof findModuleForPath>>;
|
|
112
|
-
model: ArchitectureModel;
|
|
113
|
-
lines: string[];
|
|
114
|
-
startHere: Array<{ target: string; reason: string }>;
|
|
115
|
-
publicSurfaces: string[];
|
|
116
|
-
nextQueries: string[];
|
|
117
|
-
resolvedPath: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function formatModuleBrief(ctx: ModuleBriefContext): void {
|
|
121
|
-
const { mod, model, lines, startHere, publicSurfaces, nextQueries, resolvedPath } = ctx;
|
|
122
|
-
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
123
|
-
lines.push(`# Module: ${shortName}`);
|
|
124
|
-
if (mod.description) {
|
|
125
|
-
lines.push("");
|
|
126
|
-
lines.push(mod.description);
|
|
127
|
-
}
|
|
128
|
-
lines.push("");
|
|
129
|
-
lines.push(`- Path: \`${mod.relativePath}\``);
|
|
130
|
-
|
|
131
|
-
if (mod.entrypoints.length > 0) {
|
|
132
|
-
lines.push(`- Entrypoints: ${mod.entrypoints.map((e) => `\`${e}\``).join(", ")}`);
|
|
133
|
-
for (const ep of mod.entrypoints) {
|
|
134
|
-
publicSurfaces.push(`${shortName}: ${ep}`);
|
|
135
|
-
startHere.push({ target: ep, reason: "module entrypoint" });
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
addDependenciesSection(model, mod, lines);
|
|
140
|
-
addDependentsSection(model, mod, lines, nextQueries);
|
|
141
|
-
addSourceFilesSection(resolvedPath, lines);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function addDependenciesSection(
|
|
145
|
-
model: ArchitectureModel,
|
|
146
|
-
mod: NonNullable<ReturnType<typeof findModuleForPath>>,
|
|
147
|
-
lines: string[],
|
|
148
|
-
): void {
|
|
149
|
-
const deps = getDependencies(model, mod.name);
|
|
150
|
-
if (deps.length > 0) {
|
|
151
|
-
lines.push("");
|
|
152
|
-
lines.push("## Dependencies (internal)");
|
|
153
|
-
for (const dep of deps) {
|
|
154
|
-
const depShort = dep.name.replace(/^@[^/]+\//, "");
|
|
155
|
-
lines.push(`- ${depShort} (\`${dep.relativePath}\`)`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (mod.externalDeps.length > 0) {
|
|
160
|
-
const shown = mod.externalDeps.slice(0, 8);
|
|
161
|
-
lines.push("");
|
|
162
|
-
lines.push("## Dependencies (external)");
|
|
163
|
-
for (const dep of shown) {
|
|
164
|
-
lines.push(`- ${dep}`);
|
|
165
|
-
}
|
|
166
|
-
if (mod.externalDeps.length > 8) {
|
|
167
|
-
lines.push(`- _+${mod.externalDeps.length - 8} more_`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function addDependentsSection(
|
|
173
|
-
model: ArchitectureModel,
|
|
174
|
-
mod: NonNullable<ReturnType<typeof findModuleForPath>>,
|
|
175
|
-
lines: string[],
|
|
176
|
-
nextQueries: string[],
|
|
177
|
-
): void {
|
|
178
|
-
const dependents = getDependents(model, mod.name);
|
|
179
|
-
if (dependents.length > 0) {
|
|
180
|
-
lines.push("");
|
|
181
|
-
lines.push("## Dependents");
|
|
182
|
-
for (const dep of dependents) {
|
|
183
|
-
const depShort = dep.name.replace(/^@[^/]+\//, "");
|
|
184
|
-
lines.push(`- ${depShort} (\`${dep.relativePath}\`)`);
|
|
185
|
-
}
|
|
186
|
-
nextQueries.push("`code_affected` before modifying exports from this module");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (mod.entrypoints.length > 0) {
|
|
190
|
-
const ep = mod.entrypoints[0];
|
|
191
|
-
nextQueries.push(
|
|
192
|
-
`\`code_brief\` with \`file: "${mod.relativePath}/${ep.replace(/^\.\//, "")}"\` for entrypoint details`,
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function addSourceFilesSection(resolvedPath: string, lines: string[]): void {
|
|
198
|
-
const files = listSourceFiles(resolvedPath);
|
|
199
|
-
if (files.length > 0) {
|
|
200
|
-
const shown = files.slice(0, 10);
|
|
201
|
-
lines.push("");
|
|
202
|
-
lines.push("## Source Files");
|
|
203
|
-
for (const f of shown) {
|
|
204
|
-
lines.push(`- \`${f}\``);
|
|
205
|
-
}
|
|
206
|
-
if (files.length > 10) {
|
|
207
|
-
lines.push(`- _+${files.length - 10} more files_`);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
interface NonModuleDirContext {
|
|
213
|
-
model: ArchitectureModel;
|
|
214
|
-
mod: ReturnType<typeof findModuleForPath>;
|
|
215
|
-
resolvedPath: string;
|
|
216
|
-
originalPath: string;
|
|
217
|
-
lines: string[];
|
|
218
|
-
publicSurfaces: string[];
|
|
219
|
-
nextQueries: string[];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: nested-directory brief formatting is clearer as one staged formatter than as many tiny helpers
|
|
223
|
-
function formatNonModuleDir(ctx: NonModuleDirContext): void {
|
|
224
|
-
const { model, mod, resolvedPath, originalPath, lines, publicSurfaces, nextQueries } = ctx;
|
|
225
|
-
const relPath = path.relative(model.root, resolvedPath);
|
|
226
|
-
lines.push(`# Directory: ${relPath || originalPath}`);
|
|
227
|
-
lines.push("");
|
|
228
|
-
|
|
229
|
-
if (mod) {
|
|
230
|
-
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
231
|
-
lines.push(`_Inside module: ${shortName} (\`${mod.relativePath}\`)_`);
|
|
232
|
-
lines.push("");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const summary = summarizeDirectoryRecursively(resolvedPath);
|
|
236
|
-
if (summary.directFiles.length > 0) {
|
|
237
|
-
lines.push("## Source Files");
|
|
238
|
-
for (const f of summary.directFiles.slice(0, 10)) {
|
|
239
|
-
lines.push(`- \`${f}\``);
|
|
240
|
-
}
|
|
241
|
-
if (summary.directFiles.length > 10) {
|
|
242
|
-
lines.push(`- _+${summary.directFiles.length - 10} more files_`);
|
|
243
|
-
}
|
|
244
|
-
lines.push("");
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (summary.totalSourceFiles > 0) {
|
|
248
|
-
lines.push("## Descendant Source Files");
|
|
249
|
-
lines.push(`- Total: ${summary.totalSourceFiles}`);
|
|
250
|
-
for (const subdir of summary.subdirs.slice(0, 8)) {
|
|
251
|
-
lines.push(
|
|
252
|
-
`- \`${subdir.name}/\` — ${subdir.fileCount} file${subdir.fileCount !== 1 ? "s" : ""}`,
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
if (summary.subdirs.length > 8) {
|
|
256
|
-
lines.push(`- _+${summary.subdirs.length - 8} more subdirectories_`);
|
|
257
|
-
}
|
|
258
|
-
lines.push("");
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (summary.publicSurfaces.length > 0) {
|
|
262
|
-
lines.push("## Public Surfaces");
|
|
263
|
-
for (const surface of summary.publicSurfaces.slice(0, 8)) {
|
|
264
|
-
lines.push(`- ${surface}`);
|
|
265
|
-
publicSurfaces.push(surface);
|
|
266
|
-
}
|
|
267
|
-
if (summary.publicSurfaces.length > 8) {
|
|
268
|
-
lines.push(`- _+${summary.publicSurfaces.length - 8} more exports_`);
|
|
269
|
-
}
|
|
270
|
-
lines.push("");
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (summary.totalSourceFiles > 0) {
|
|
274
|
-
lines.push("## Import / Export Summary");
|
|
275
|
-
lines.push(`- Imports: ${summary.importCount}`);
|
|
276
|
-
lines.push(`- Exports: ${summary.exportCount}`);
|
|
277
|
-
lines.push("");
|
|
278
|
-
nextQueries.push(
|
|
279
|
-
`\`code_pattern\` with \`path: "${relPath || originalPath}"\` to inspect a specific nested symbol`,
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (summary.totalSourceFiles === 0) {
|
|
284
|
-
lines.push("No recognized source files in this directory.");
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function generateFileBrief(
|
|
289
|
-
model: ArchitectureModel,
|
|
290
|
-
resolvedPath: string,
|
|
291
|
-
originalPath: string,
|
|
292
|
-
): { content: string; details: BriefDetails } {
|
|
293
|
-
const mod = findModuleForPath(model, resolvedPath);
|
|
294
|
-
const lines: string[] = [];
|
|
295
|
-
const confidence: ConfidenceMode = "structural";
|
|
296
|
-
const publicSurfaces: string[] = [];
|
|
297
|
-
const nextQueries: string[] = [];
|
|
298
|
-
|
|
299
|
-
const fileName = path.basename(resolvedPath);
|
|
300
|
-
const relPath = path.relative(model.root, resolvedPath);
|
|
301
|
-
|
|
302
|
-
lines.push(`# File: ${relPath || fileName}`);
|
|
303
|
-
lines.push("");
|
|
304
|
-
|
|
305
|
-
if (mod) {
|
|
306
|
-
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
307
|
-
lines.push(`_Module: ${shortName} (\`${mod.relativePath}\`)_`);
|
|
308
|
-
lines.push("");
|
|
309
|
-
|
|
310
|
-
const isEntrypoint = mod.entrypoints.some((ep) => {
|
|
311
|
-
const epResolved = path.resolve(mod.root, ep);
|
|
312
|
-
return epResolved === resolvedPath;
|
|
313
|
-
});
|
|
314
|
-
if (isEntrypoint) {
|
|
315
|
-
lines.push("**This file is a module entrypoint.**");
|
|
316
|
-
lines.push("");
|
|
317
|
-
publicSurfaces.push(`${shortName} entrypoint`);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
try {
|
|
322
|
-
const content = fs.readFileSync(resolvedPath, "utf-8");
|
|
323
|
-
const lineCount = content.split("\n").length;
|
|
324
|
-
lines.push(`- Lines: ${lineCount}`);
|
|
325
|
-
lines.push(`- Extension: \`${path.extname(resolvedPath)}\``);
|
|
326
|
-
} catch {
|
|
327
|
-
lines.push("_Could not read file contents._");
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const prioritySignals = summarizePrioritySignalsForFiles(model.root, [resolvedPath]);
|
|
331
|
-
if (prioritySignals) {
|
|
332
|
-
lines.push("");
|
|
333
|
-
appendPrioritySignalsSection(lines, prioritySignals);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
nextQueries.push(
|
|
337
|
-
`\`code_relations\` with \`kind: "callers"\`, \`file: "${relPath}"\`, and a line/character for call-site analysis`,
|
|
338
|
-
);
|
|
339
|
-
if (mod) {
|
|
340
|
-
nextQueries.push(
|
|
341
|
-
`\`code_brief\` with \`path: "${mod.relativePath}"\` for the containing module overview`,
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (nextQueries.length > 0) {
|
|
346
|
-
lines.push("");
|
|
347
|
-
lines.push("## Next");
|
|
348
|
-
for (const q of nextQueries.slice(0, 2)) {
|
|
349
|
-
lines.push(`- ${q}`);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
const gitCtx = gatherGitContext(model.root);
|
|
354
|
-
if (gitCtx) {
|
|
355
|
-
lines.push(formatGitContext(gitCtx));
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
lines.push("");
|
|
359
|
-
|
|
360
|
-
return {
|
|
361
|
-
content: lines.join("\n"),
|
|
362
|
-
details: {
|
|
363
|
-
confidence,
|
|
364
|
-
focusTarget: originalPath,
|
|
365
|
-
startHere: [],
|
|
366
|
-
publicSurfaces,
|
|
367
|
-
dependencySummary: null,
|
|
368
|
-
omittedCount: 0,
|
|
369
|
-
nextQueries,
|
|
370
|
-
prioritySignals,
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// ── Helpers ───────────────────────────────────────────────────────────
|
|
376
|
-
|
|
377
|
-
const SOURCE_EXTENSIONS = new Set([
|
|
378
|
-
// JS/TS
|
|
379
|
-
".ts",
|
|
380
|
-
".tsx",
|
|
381
|
-
".js",
|
|
382
|
-
".jsx",
|
|
383
|
-
".mts",
|
|
384
|
-
".cts",
|
|
385
|
-
".mjs",
|
|
386
|
-
".cjs",
|
|
387
|
-
// Python
|
|
388
|
-
".py",
|
|
389
|
-
".pyi",
|
|
390
|
-
// Rust
|
|
391
|
-
".rs",
|
|
392
|
-
// Go
|
|
393
|
-
".go",
|
|
394
|
-
".mod",
|
|
395
|
-
// C/C++
|
|
396
|
-
".c",
|
|
397
|
-
".h",
|
|
398
|
-
".cpp",
|
|
399
|
-
".hpp",
|
|
400
|
-
".cc",
|
|
401
|
-
".cxx",
|
|
402
|
-
".hxx",
|
|
403
|
-
".c++",
|
|
404
|
-
".h++",
|
|
405
|
-
// Java / Kotlin
|
|
406
|
-
".java",
|
|
407
|
-
".kt",
|
|
408
|
-
".kts",
|
|
409
|
-
// Ruby
|
|
410
|
-
".rb",
|
|
411
|
-
// Shell
|
|
412
|
-
".sh",
|
|
413
|
-
".bash",
|
|
414
|
-
".zsh",
|
|
415
|
-
// Web
|
|
416
|
-
".html",
|
|
417
|
-
".htm",
|
|
418
|
-
".xhtml",
|
|
419
|
-
".css",
|
|
420
|
-
".scss",
|
|
421
|
-
".less",
|
|
422
|
-
// Data / Config
|
|
423
|
-
".json",
|
|
424
|
-
".yaml",
|
|
425
|
-
".yml",
|
|
426
|
-
".toml",
|
|
427
|
-
".md",
|
|
428
|
-
// Other languages
|
|
429
|
-
".php",
|
|
430
|
-
".swift",
|
|
431
|
-
".cs",
|
|
432
|
-
".r",
|
|
433
|
-
".sql",
|
|
434
|
-
]);
|
|
435
|
-
|
|
436
|
-
interface RecursiveDirectorySummary {
|
|
437
|
-
directFiles: string[];
|
|
438
|
-
allFiles: string[];
|
|
439
|
-
totalSourceFiles: number;
|
|
440
|
-
subdirs: Array<{ name: string; fileCount: number }>;
|
|
441
|
-
publicSurfaces: string[];
|
|
442
|
-
importCount: number;
|
|
443
|
-
exportCount: number;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function listSourceFiles(dir: string): string[] {
|
|
447
|
-
const files: string[] = [];
|
|
448
|
-
try {
|
|
449
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
450
|
-
for (const entry of entries) {
|
|
451
|
-
if (!entry.isFile()) continue;
|
|
452
|
-
if (entry.name.startsWith(".")) continue;
|
|
453
|
-
if (SOURCE_EXTENSIONS.has(path.extname(entry.name))) {
|
|
454
|
-
files.push(entry.name);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
} catch {
|
|
458
|
-
// Directory not readable
|
|
459
|
-
}
|
|
460
|
-
return files.sort((a, b) => a.localeCompare(b));
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function summarizeDirectoryRecursively(dir: string): RecursiveDirectorySummary {
|
|
464
|
-
const directFiles = listSourceFiles(dir);
|
|
465
|
-
const summary: RecursiveDirectorySummary = {
|
|
466
|
-
directFiles,
|
|
467
|
-
allFiles: directFiles.map((file) => path.join(dir, file)),
|
|
468
|
-
totalSourceFiles: directFiles.length,
|
|
469
|
-
subdirs: [],
|
|
470
|
-
publicSurfaces: [],
|
|
471
|
-
importCount: 0,
|
|
472
|
-
exportCount: 0,
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
accumulateJsTsSignals(summary, dir, directFiles, "");
|
|
476
|
-
|
|
477
|
-
try {
|
|
478
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
479
|
-
for (const entry of entries) {
|
|
480
|
-
if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
|
|
481
|
-
const childDir = path.join(dir, entry.name);
|
|
482
|
-
const childSummary = summarizeDirectoryRecursively(childDir);
|
|
483
|
-
if (childSummary.totalSourceFiles === 0) continue;
|
|
484
|
-
summary.totalSourceFiles += childSummary.totalSourceFiles;
|
|
485
|
-
summary.allFiles.push(...childSummary.allFiles);
|
|
486
|
-
summary.subdirs.push({ name: entry.name, fileCount: childSummary.totalSourceFiles });
|
|
487
|
-
summary.publicSurfaces.push(
|
|
488
|
-
...childSummary.publicSurfaces.map((surface) => `${entry.name}/${surface}`),
|
|
489
|
-
);
|
|
490
|
-
summary.importCount += childSummary.importCount;
|
|
491
|
-
summary.exportCount += childSummary.exportCount;
|
|
492
|
-
}
|
|
493
|
-
} catch {
|
|
494
|
-
// Directory not readable
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
summary.subdirs.sort((a, b) => a.name.localeCompare(b.name));
|
|
498
|
-
return summary;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
function accumulateJsTsSignals(
|
|
502
|
-
summary: RecursiveDirectorySummary,
|
|
503
|
-
dir: string,
|
|
504
|
-
files: string[],
|
|
505
|
-
prefix: string,
|
|
506
|
-
): void {
|
|
507
|
-
for (const file of files) {
|
|
508
|
-
if (!isJsTsFile(file)) continue;
|
|
509
|
-
try {
|
|
510
|
-
const relFile = prefix ? `${prefix}/${file}` : file;
|
|
511
|
-
const content = fs.readFileSync(path.join(dir, file), "utf-8");
|
|
512
|
-
summary.importCount += countMatches(content, /^import\s/gm);
|
|
513
|
-
const exports = extractNamedExports(content);
|
|
514
|
-
summary.exportCount += exports.length;
|
|
515
|
-
for (const exportedName of exports) {
|
|
516
|
-
summary.publicSurfaces.push(`\`${exportedName}\` — \`${relFile}\``);
|
|
517
|
-
}
|
|
518
|
-
} catch {
|
|
519
|
-
// File not readable
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function isJsTsFile(file: string): boolean {
|
|
525
|
-
return [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"].includes(
|
|
526
|
-
path.extname(file),
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Lightweight exported-name extraction for recursive directory briefs.
|
|
532
|
-
*
|
|
533
|
-
* Best-effort only: handles exported declarations and simple named export lists,
|
|
534
|
-
* but intentionally does not try to cover default exports, export-all forms,
|
|
535
|
-
* re-exported defaults, or every multiline formatting variant.
|
|
536
|
-
*/
|
|
537
|
-
function extractNamedExports(content: string): string[] {
|
|
538
|
-
const names = new Set<string>();
|
|
539
|
-
const declarationRegex =
|
|
540
|
-
/export\s+(?:async\s+)?(?:function|class|interface|type|const|let|var|enum)\s+([A-Za-z_$][\w$]*)/g;
|
|
541
|
-
const namedExportRegex = /export\s*\{\s*([^}]+)\s*\}/g;
|
|
542
|
-
|
|
543
|
-
for (const match of content.matchAll(declarationRegex)) {
|
|
544
|
-
if (match[1]) names.add(match[1]);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
for (const match of content.matchAll(namedExportRegex)) {
|
|
548
|
-
const parts = match[1]?.split(",") ?? [];
|
|
549
|
-
for (const part of parts) {
|
|
550
|
-
const candidate = part
|
|
551
|
-
.trim()
|
|
552
|
-
.split(/\s+as\s+/i)[0]
|
|
553
|
-
?.trim();
|
|
554
|
-
if (candidate) names.add(candidate);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
return [...names].sort((a, b) => a.localeCompare(b));
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
function countMatches(content: string, regex: RegExp): number {
|
|
562
|
-
return [...content.matchAll(regex)].length;
|
|
563
|
-
}
|
package/src/code-intelligence.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Code Intelligence extension entry point — registers the focused code-intelligence tools.
|
|
2
|
-
// Provides architecture briefs, project maps, relationship tracing, impact assessment, and pattern search.
|
|
3
|
-
//
|
|
4
|
-
// No longer wires CodeProviders — the substrate packages (supi-lsp, supi-tree-sitter)
|
|
5
|
-
// publish their capabilities directly into the shared workspace runtime.
|
|
6
|
-
|
|
7
|
-
import type { BeforeAgentStartEventResult, ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
|
-
import { buildArchitectureModel } from "./model.ts";
|
|
9
|
-
import { renderOverview } from "./presentation/markdown/overview.ts";
|
|
10
|
-
import { registerCodeIntelligenceTools } from "./tool/register-tools.ts";
|
|
11
|
-
import { buildOverviewData } from "./use-case/build-overview.ts";
|
|
12
|
-
|
|
13
|
-
const OVERVIEW_CUSTOM_TYPE = "code-intelligence-overview";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Register the focused code-intelligence tools and inject a lightweight
|
|
17
|
-
* architecture overview once per session.
|
|
18
|
-
*
|
|
19
|
-
* Capabilities are published by substrate packages into the shared
|
|
20
|
-
* workspace runtime — no local provider wiring needed.
|
|
21
|
-
*/
|
|
22
|
-
export default function codeIntelligenceExtension(pi: ExtensionAPI) {
|
|
23
|
-
let hasInjectedOverview = false;
|
|
24
|
-
let _activeCwd: string | null = null;
|
|
25
|
-
|
|
26
|
-
pi.on("session_start", (_event, ctx) => {
|
|
27
|
-
hasInjectedOverview = false;
|
|
28
|
-
_activeCwd = ctx.cwd;
|
|
29
|
-
|
|
30
|
-
// Scan active branch for existing overview to avoid duplicates on reload/resume
|
|
31
|
-
const branch = ctx.sessionManager.getBranch();
|
|
32
|
-
for (const entry of branch) {
|
|
33
|
-
if (entry.type === "custom_message" && entry.customType === OVERVIEW_CUSTOM_TYPE) {
|
|
34
|
-
hasInjectedOverview = true;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
pi.on(
|
|
41
|
-
"before_agent_start",
|
|
42
|
-
async (_event, ctx): Promise<BeforeAgentStartEventResult | undefined> => {
|
|
43
|
-
if (hasInjectedOverview) return;
|
|
44
|
-
hasInjectedOverview = true;
|
|
45
|
-
|
|
46
|
-
const model = await buildArchitectureModel(ctx.cwd);
|
|
47
|
-
if (!model || model.modules.length === 0) return;
|
|
48
|
-
|
|
49
|
-
const data = buildOverviewData(model);
|
|
50
|
-
if (!data) return;
|
|
51
|
-
|
|
52
|
-
const overview = renderOverview(data);
|
|
53
|
-
if (!overview) return;
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
message: {
|
|
57
|
-
customType: OVERVIEW_CUSTOM_TYPE,
|
|
58
|
-
display: false,
|
|
59
|
-
content: overview,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
registerCodeIntelligenceTools(pi);
|
|
66
|
-
|
|
67
|
-
pi.on("session_shutdown", () => {
|
|
68
|
-
_activeCwd = null;
|
|
69
|
-
});
|
|
70
|
-
}
|