@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.
Files changed (348) hide show
  1. package/README.md +373 -63
  2. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  3. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  4. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
  6. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  8. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  9. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  10. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
  11. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
  12. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  13. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  14. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  15. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
  16. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
  17. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
  18. package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
  19. package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
  20. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
  21. package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
  22. package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  23. package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  24. package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  25. package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
  26. package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  27. package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  28. package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  29. package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  30. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
  31. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
  32. package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  33. package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  34. package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
  36. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  37. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
  40. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  42. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
  45. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
  46. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  47. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
  50. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
  51. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
  52. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
  53. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
  54. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
  55. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
  56. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  57. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
  60. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  62. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  63. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  64. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
  65. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
  66. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  67. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  68. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  69. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.d.ts +21 -2
  70. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +1 -0
  71. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.d.ts +2 -1
  72. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +1 -1
  73. package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
  74. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
  75. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
  76. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
  77. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
  78. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
  79. package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
  80. package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
  81. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
  82. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
  83. package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
  84. package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
  85. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
  86. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
  87. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
  88. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
  89. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
  90. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
  91. package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
  92. package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  97. 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
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  102. 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
  103. 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
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  106. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  107. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
  108. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
  109. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
  110. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
  111. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
  112. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
  113. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
  114. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  115. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  116. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  117. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
  118. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  119. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  120. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  121. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  122. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
  123. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
  124. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  125. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  126. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  127. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
  128. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
  129. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
  130. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
  131. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
  132. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
  133. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  134. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
  135. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
  136. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
  137. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
  138. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
  139. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
  140. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
  141. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
  142. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
  143. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
  144. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  145. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
  146. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
  147. package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
  148. package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
  149. package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
  150. package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
  151. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
  152. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
  153. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
  154. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
  155. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
  156. package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
  157. package/package.json +14 -9
  158. package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
  159. package/src/analysis/architecture/model.ts +76 -0
  160. package/src/analysis/brief/directory.ts +324 -0
  161. package/src/analysis/brief/enrich.ts +157 -0
  162. package/src/analysis/brief/file.ts +84 -0
  163. package/src/analysis/brief/inventory.ts +177 -0
  164. package/src/analysis/brief/main.ts +176 -0
  165. package/src/analysis/brief/models.ts +75 -0
  166. package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
  167. package/src/analysis/brief/summarize.ts +208 -0
  168. package/src/analysis/brief/types.ts +27 -0
  169. package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
  170. package/src/analysis/coverage/coverage-warnings.ts +224 -0
  171. package/src/analysis/evidence.ts +91 -0
  172. package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
  173. package/src/analysis/provider.ts +186 -0
  174. package/src/analysis/read-next.ts +126 -0
  175. package/src/analysis/readiness.ts +73 -0
  176. package/src/{refactor → analysis/refactor}/safety.ts +1 -1
  177. package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
  178. package/src/analysis/search/pattern.ts +345 -0
  179. package/src/analysis/search/ripgrep.ts +473 -0
  180. package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
  181. package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
  182. package/src/analysis/target/anchored.ts +349 -0
  183. package/src/analysis/target/bridge.ts +152 -0
  184. package/src/analysis/target/file-resolution.ts +125 -0
  185. package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
  186. package/src/{planner → analysis/target}/planner.ts +30 -20
  187. package/src/{targeting → analysis/target}/query.ts +17 -3
  188. package/src/analysis/target/resolve-common.ts +115 -0
  189. package/src/analysis/target/service.ts +229 -0
  190. package/src/analysis/target/symbol.ts +196 -0
  191. package/src/{targeting → analysis/target}/types.ts +17 -1
  192. package/src/analysis/tests/likely-tests.ts +174 -0
  193. package/src/analysis/tests/test-discovery.ts +540 -0
  194. package/src/analysis/tests/vitest.ts +87 -0
  195. package/src/api.ts +34 -41
  196. package/src/app/app.ts +125 -0
  197. package/src/app/manager.ts +65 -0
  198. package/src/extension.ts +132 -1
  199. package/src/index.ts +1 -57
  200. package/src/session/refactor-plans.ts +82 -0
  201. package/src/session/session.ts +300 -0
  202. package/src/session/target-store.ts +293 -0
  203. package/src/substrate/lsp/diagnostic-injection.ts +218 -0
  204. package/src/substrate/lsp/lifecycle.ts +66 -0
  205. package/src/substrate/lsp/overrides.ts +132 -0
  206. package/src/substrate/lsp/recovery.ts +55 -0
  207. package/src/substrate/lsp/settings.ts +286 -0
  208. package/src/substrate/lsp/state.ts +46 -0
  209. package/src/substrate/lsp/utils.ts +17 -0
  210. package/src/substrate/tree-sitter/lifecycle.ts +52 -0
  211. package/src/tool/find/execute.ts +118 -0
  212. package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
  213. package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
  214. package/src/tool/find/semantic-search.ts +114 -0
  215. package/src/tool/find/tui.ts +39 -0
  216. package/src/tool/graph/callees.ts +87 -0
  217. package/src/tool/graph/calls-md.ts +54 -0
  218. package/src/tool/graph/collect-relation.ts +371 -0
  219. package/src/tool/graph/execute.ts +95 -0
  220. package/src/tool/graph/implementations-md.ts +79 -0
  221. package/src/tool/graph/implementations.ts +76 -0
  222. package/src/tool/graph/markdown-base.ts +243 -0
  223. package/src/tool/graph/orchestrate.ts +285 -0
  224. package/src/tool/graph/references-md.ts +34 -0
  225. package/src/tool/graph/references.ts +81 -0
  226. package/src/tool/graph/tui.ts +120 -0
  227. package/src/tool/graph/types.ts +97 -0
  228. package/src/tool/guidance.ts +96 -49
  229. package/src/tool/health/execute.ts +76 -0
  230. package/src/tool/health/markdown.ts +280 -0
  231. package/src/tool/health/orchestrate.ts +159 -0
  232. package/src/tool/health/sections/diagnostics.ts +182 -0
  233. package/src/tool/health/sections/recovery.ts +89 -0
  234. package/src/tool/health/sections/signals.ts +89 -0
  235. package/src/tool/health/tui.ts +137 -0
  236. package/src/tool/impact/analysis.ts +247 -0
  237. package/src/tool/impact/change-set-impact.ts +151 -0
  238. package/src/tool/impact/execute.ts +98 -0
  239. package/src/tool/impact/file-level-impact.ts +81 -0
  240. package/src/tool/impact/markdown.ts +283 -0
  241. package/src/tool/impact/orchestrate.ts +97 -0
  242. package/src/tool/impact/result.ts +21 -0
  243. package/src/tool/impact/single-impact.ts +89 -0
  244. package/src/tool/impact/tui.ts +39 -0
  245. package/src/tool/impact/types.ts +34 -0
  246. package/src/tool/infra/cross-field.ts +335 -0
  247. package/src/tool/infra/error-results.ts +199 -0
  248. package/src/tool/infra/pipeline.ts +311 -0
  249. package/src/tool/infra/progress.ts +21 -0
  250. package/src/tool/infra/readiness-message.ts +5 -0
  251. package/src/tool/infra/truncate.ts +49 -0
  252. package/src/tool/inspect/execute.ts +76 -0
  253. package/src/tool/inspect/markdown.ts +169 -0
  254. package/src/tool/inspect/orchestrate.ts +156 -0
  255. package/src/tool/inspect/tui.ts +36 -0
  256. package/src/tool/orientation/deps.ts +63 -0
  257. package/src/tool/orientation/execute.ts +50 -0
  258. package/src/tool/orientation/markdown.ts +35 -0
  259. package/src/tool/orientation/mode.ts +88 -0
  260. package/src/tool/orientation/orchestrate.ts +478 -0
  261. package/src/tool/orientation/precise-target.ts +257 -0
  262. package/src/tool/orientation/tui.ts +131 -0
  263. package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
  264. package/src/tool/refactor-apply/execute.ts +20 -0
  265. package/src/tool/refactor-apply/markdown.ts +118 -0
  266. package/src/tool/refactor-apply/orchestrate.ts +89 -0
  267. package/src/tool/refactor-apply/tui.ts +51 -0
  268. package/src/tool/refactor-plan/execute.ts +73 -0
  269. package/src/tool/refactor-plan/markdown.ts +118 -0
  270. package/src/tool/refactor-plan/orchestrate.ts +363 -0
  271. package/src/tool/refactor-plan/tui.ts +42 -0
  272. package/src/tool/register.ts +123 -0
  273. package/src/tool/resolve/execute.ts +82 -0
  274. package/src/tool/resolve/markdown.ts +150 -0
  275. package/src/tool/resolve/orchestrate.ts +134 -0
  276. package/src/tool/resolve/tui.ts +40 -0
  277. package/src/tool/schemas.ts +337 -0
  278. package/src/tool/specs.ts +257 -0
  279. package/src/types/details.ts +188 -0
  280. package/src/types/execution.ts +60 -0
  281. package/src/types/index.ts +28 -0
  282. package/src/{intent/types.ts → types/tool-names.ts} +15 -14
  283. package/src/ui/footer.ts +52 -0
  284. package/src/ui/markdown/brief.ts +218 -0
  285. package/src/ui/markdown/gather.ts +177 -0
  286. package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
  287. package/src/{presentation → ui}/markdown/overview.ts +2 -2
  288. package/src/ui/markdown/types.ts +80 -0
  289. package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
  290. package/src/ui/status-command.ts +260 -0
  291. package/src/ui/status-overlay.ts +500 -0
  292. package/src/ui/tui/common.ts +220 -0
  293. package/src/ui/tui/index.ts +37 -0
  294. package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
  295. package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
  296. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
  297. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
  298. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
  299. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
  300. package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
  301. package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
  302. package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
  303. package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
  304. package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
  305. package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
  306. package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
  307. package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
  308. package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
  309. package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
  310. package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
  311. package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
  312. package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
  313. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
  314. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
  315. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
  316. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
  317. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
  318. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
  319. package/src/brief-focused.ts +0 -563
  320. package/src/code-intelligence.ts +0 -70
  321. package/src/pattern-structured.ts +0 -194
  322. package/src/presentation/markdown/affected.ts +0 -170
  323. package/src/presentation/markdown/brief.ts +0 -174
  324. package/src/presentation/markdown/map.ts +0 -54
  325. package/src/presentation/markdown/refactor.ts +0 -27
  326. package/src/presentation/markdown/relations.ts +0 -121
  327. package/src/resolve-target.ts +0 -130
  328. package/src/search-helpers.ts +0 -303
  329. package/src/substrates/types.ts +0 -30
  330. package/src/target-resolution.ts +0 -122
  331. package/src/targeting/resolve-anchored.ts +0 -80
  332. package/src/targeting/resolve-symbol.ts +0 -110
  333. package/src/tool/execute-affected.ts +0 -71
  334. package/src/tool/execute-brief.ts +0 -59
  335. package/src/tool/execute-map.ts +0 -35
  336. package/src/tool/execute-pattern.ts +0 -29
  337. package/src/tool/execute-refactor.ts +0 -101
  338. package/src/tool/execute-relations.ts +0 -79
  339. package/src/tool/register-tools.ts +0 -32
  340. package/src/tool/tool-specs.ts +0 -190
  341. package/src/tool/validation.ts +0 -43
  342. package/src/types.ts +0 -169
  343. package/src/use-case/generate-affected.ts +0 -297
  344. package/src/use-case/generate-map.ts +0 -176
  345. package/src/use-case/generate-relations.ts +0 -438
  346. package/src/use-case/types.ts +0 -43
  347. package/src/workspace/request-context.ts +0 -139
  348. /package/src/{query-params.ts → tool/params.ts} +0 -0
@@ -0,0 +1,188 @@
1
+ import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
+ import type { EvidenceListMetadata } from "../analysis/evidence.ts";
3
+ import type { PrioritySignalsSummary } from "../analysis/signals/project.ts";
4
+ import type { TestSurfaceDetails } from "../analysis/tests/test-discovery.ts";
5
+ import type { AnchorKind, TargetStoreEntry } from "../session/target-store.ts";
6
+
7
+ export type { TestSurfaceDetails } from "../analysis/tests/test-discovery.ts";
8
+
9
+ // ── Anchored coordinate resolution metadata ───────────────────────────
10
+
11
+ /**
12
+ * Provider-backed evidence source that identified an anchored coordinate
13
+ * target. Drives the markdown provenance note and structured resolution
14
+ * metadata per ADR 0003/0004.
15
+ *
16
+ * - `semantic` — LSP document symbols identified the symbol and its anchors.
17
+ * - `structural` — tree-sitter structural evidence (outline/exports/nodeAt)
18
+ * identified the declaration and/or identifier.
19
+ * - `structural-identifier` — tree-sitter `nodeAt` classified the coordinate
20
+ * as an identifier token and snapped it to a declaration via ancestry.
21
+ */
22
+ export type AnchoredResolutionSource = "semantic" | "structural" | "structural-identifier";
23
+
24
+ /**
25
+ * Resolution metadata for a target resolved from anchored coordinates.
26
+ *
27
+ * Records the requested coordinate, the resolved anchor coordinate, whether
28
+ * the resolved anchor differs from the request (a snap), and the
29
+ * provider-backed evidence source. Structured details always carry this when
30
+ * a target was resolved from coordinates; markdown surfaces a note only when
31
+ * the resolution was non-obvious (snapped or degraded).
32
+ */
33
+ export interface AnchoredResolutionMetadata {
34
+ /** The 1-based coordinate the caller requested. */
35
+ requested: { line: number; character: number };
36
+ /** The 1-based anchor coordinate the target was resolved to. */
37
+ resolved: { line: number; character: number };
38
+ /** Whether the resolved anchor differs from the requested coordinate. */
39
+ snapped: boolean;
40
+ /** Provider-backed evidence source that identified the target. */
41
+ source: AnchoredResolutionSource;
42
+ }
43
+
44
+ /** Structured details metadata returned alongside markdown brief content. */
45
+ export interface BriefDetails {
46
+ confidence: ConfidenceMode;
47
+ focusTarget: string | null;
48
+ startHere: Array<{ target: string; reason: string }>;
49
+ publicSurfaces: string[];
50
+ dependencySummary: { moduleCount: number; edgeCount: number } | null;
51
+ omittedCount: number;
52
+ evidenceLists?: EvidenceListMetadata[];
53
+ nextQueries: string[];
54
+ prioritySignals?: PrioritySignalsSummary | null;
55
+ }
56
+
57
+ /** Structured details metadata for relationship and pattern results. */
58
+ export interface SearchDetails {
59
+ confidence: ConfidenceMode;
60
+ scope: string | null;
61
+ candidateCount: number;
62
+ omittedCount: number;
63
+ evidenceLists?: EvidenceListMetadata[];
64
+ nextQueries: string[];
65
+ tests?: TestSurfaceDetails;
66
+ }
67
+
68
+ /** Structured details metadata for affected analysis results. */
69
+ export interface AffectedDetails {
70
+ confidence: ConfidenceMode;
71
+ directCount: number;
72
+ downstreamCount: number;
73
+ riskLevel: "low" | "medium" | "high";
74
+ checkNext: string[];
75
+ likelyTests: string[];
76
+ /** Concrete test commands to run relevant verification. */
77
+ likelyTestCommands: string[];
78
+ omittedCount: number;
79
+ evidenceLists?: EvidenceListMetadata[];
80
+ nextQueries: string[];
81
+ prioritySignals?: PrioritySignalsSummary | null;
82
+ tests?: TestSurfaceDetails;
83
+ }
84
+
85
+ /**
86
+ * Structured details metadata for workflow-oriented impact analysis results.
87
+ *
88
+ * Currently structurally identical to `AffectedDetails`. When adding own fields,
89
+ * audit callers in `orchestrate.ts` that construct `{ type: "impact", data }`
90
+ * so they return `ImpactDetails`, not just `AffectedDetails`.
91
+ */
92
+ export interface ImpactDetails extends AffectedDetails {}
93
+
94
+ // Canonical disambiguation candidate — re-exported from resolution/types.ts
95
+ export type { DisambiguationCandidateData as DisambiguationCandidate } from "../analysis/target/types.ts";
96
+
97
+ /** Structured details metadata for code_resolve results. */
98
+ export interface ResolveDetails {
99
+ confidence: ConfidenceMode;
100
+ targetCount: number;
101
+ omittedCount: number;
102
+ evidenceLists?: EvidenceListMetadata[];
103
+ /** Resolved targets with relative paths (computed from {@link TargetStoreEntry} at detail-build time). */
104
+ targets: Array<{
105
+ targetId: string;
106
+ spanId: string;
107
+ /** Workspace-relative path. */
108
+ file: string;
109
+ displayLine: number;
110
+ displayCharacter: number;
111
+ name: string | null;
112
+ kind: string | null;
113
+ anchorKind: AnchorKind;
114
+ confidence: ConfidenceMode;
115
+ provenance: string;
116
+ /** Resolution provenance — present when the target was resolved from anchored coordinates. */
117
+ resolution?: AnchoredResolutionMetadata;
118
+ }>;
119
+ /** Disambiguation candidates from the resolve service. */
120
+ candidates?: Array<{
121
+ targetId: string;
122
+ name: string;
123
+ kind: string | null;
124
+ container: string | null;
125
+ file: string;
126
+ line: number;
127
+ character: number;
128
+ reason: string;
129
+ rank: number;
130
+ anchorKind: AnchorKind;
131
+ }>;
132
+ nextQueries: string[];
133
+ }
134
+
135
+ /** Structured details metadata for code_orientation results. */
136
+ export interface ContextDetails {
137
+ confidence: ConfidenceMode;
138
+ task: string | null;
139
+ focusTarget: string | null;
140
+ requestedSections: string[];
141
+ renderedSections: string[];
142
+ omittedCount: number;
143
+ evidenceLists?: EvidenceListMetadata[];
144
+ nextQueries: string[];
145
+ tests?: TestSurfaceDetails;
146
+ /**
147
+ * Resolved target store entry — populated for both coordinate and targetId
148
+ * precise-target inputs. Absent for orientation/scope-only calls and for
149
+ * ambiguous coordinate resolution (see `candidates`).
150
+ * File paths are absolute; compute relative paths at render time.
151
+ */
152
+ target?: TargetStoreEntry;
153
+ /**
154
+ * Disambiguation candidates with targetIds — populated only when coordinate
155
+ * resolution was ambiguous. No task sections are rendered in that case.
156
+ */
157
+ candidates?: Array<{
158
+ targetId: string;
159
+ name: string;
160
+ kind: string | null;
161
+ container: string | null;
162
+ file: string;
163
+ line: number;
164
+ character: number;
165
+ rank: number;
166
+ }>;
167
+ }
168
+
169
+ /** Structured details metadata for code_inspect results. */
170
+ export interface InspectDetails {
171
+ confidence: ConfidenceMode;
172
+ focusTarget: string;
173
+ unavailableSections: string[];
174
+ evidenceLists?: EvidenceListMetadata[];
175
+ nextQueries: string[];
176
+ }
177
+
178
+ /** Structured details metadata for code_health results. */
179
+ export interface HealthDetails {
180
+ lspAvailable: boolean;
181
+ lspStatus: string;
182
+ recovered: boolean;
183
+ /** Structural (tree-sitter) substrate readiness. Undefined when not evaluated. */
184
+ structuralStatus?: string;
185
+ diagnosticFileCount: number;
186
+ serverCount: number;
187
+ evidenceLists?: EvidenceListMetadata[];
188
+ }
@@ -0,0 +1,60 @@
1
+ import type { AgentToolUpdateCallback } from "@earendil-works/pi-coding-agent";
2
+ import type { WorkspaceCodeIntelligenceSession } from "../session/session.ts";
3
+ import type {
4
+ BriefDetails,
5
+ ContextDetails,
6
+ HealthDetails,
7
+ ImpactDetails,
8
+ InspectDetails,
9
+ ResolveDetails,
10
+ SearchDetails,
11
+ } from "./details.ts";
12
+
13
+ /**
14
+ * Execution context passed to every code-intelligence tool executor.
15
+ *
16
+ * The adapter in `tool/register.ts` builds this from the pi
17
+ * `ToolDefinition.execute` arguments and forwards it to `spec.run`.
18
+ * `signal` and `onUpdate` are optional. An executor that does not yet use
19
+ * them can still type its ctx as `{ cwd: string }` (a structural supertype —
20
+ * it destructures only `cwd` and ignores the rest) and keep compiling; all
21
+ * current executors use this full type, and long-running ones forward `signal`
22
+ * to subprocesses / emit coarse `onUpdate` beats.
23
+ *
24
+ * The `session` property carries the per-workspace
25
+ * `WorkspaceCodeIntelligenceSession` facade (ADR 0008) for centralized
26
+ * provider access, target resolution, and plan management. Executors
27
+ * must prefer `ctx.session` over ad-hoc session factories.
28
+ */
29
+ export interface CodeIntelToolExecCtx {
30
+ cwd: string;
31
+ /** Abort signal from the agent runtime; forward to long-running subprocesses. */
32
+ signal?: AbortSignal;
33
+ /** Progress callback; long-running executors emit coarse beats, not chatty ones. */
34
+ onUpdate?: AgentToolUpdateCallback;
35
+ /**
36
+ * Per-workspace code-intelligence session facade.
37
+ *
38
+ * Provides centralized access to:
39
+ * - Provider state: {@link WorkspaceCodeIntelligenceSession.getProviders}
40
+ * - Target resolution: {@link WorkspaceCodeIntelligenceSession.expandTargetId}
41
+ * - Plan management: {@link WorkspaceCodeIntelligenceSession.storePlan}
42
+ *
43
+ * Present on every execution. Executors that need it should destructure
44
+ * `{ cwd, session }` from their ctx parameter.
45
+ */
46
+ session: WorkspaceCodeIntelligenceSession;
47
+ }
48
+
49
+ /** Tool result shape returned by executeAction. */
50
+ export interface CodeIntelResult {
51
+ content: string;
52
+ details?:
53
+ | { type: "brief"; data: BriefDetails }
54
+ | { type: "context"; data: ContextDetails }
55
+ | { type: "inspect"; data: InspectDetails }
56
+ | { type: "search"; data: SearchDetails }
57
+ | { type: "impact"; data: ImpactDetails }
58
+ | { type: "resolve"; data: ResolveDetails }
59
+ | { type: "health"; data: HealthDetails };
60
+ }
@@ -0,0 +1,28 @@
1
+ // ── Tool names and routing ─────────────────────────────────────────────
2
+
3
+ export {
4
+ CODE_INTELLIGENCE_TOOL_NAMES,
5
+ type CodeIntelligenceToolName,
6
+ type PlannerRoute,
7
+ } from "./tool-names.ts";
8
+
9
+ // ── Execution context and result ────────────────────────────────────────
10
+
11
+ export type { CodeIntelResult, CodeIntelToolExecCtx } from "./execution.ts";
12
+
13
+ // ── Detail types ────────────────────────────────────────────────────────
14
+
15
+ export type {
16
+ AffectedDetails,
17
+ AnchoredResolutionMetadata,
18
+ AnchoredResolutionSource,
19
+ BriefDetails,
20
+ ContextDetails,
21
+ DisambiguationCandidate,
22
+ HealthDetails,
23
+ ImpactDetails,
24
+ InspectDetails,
25
+ ResolveDetails,
26
+ SearchDetails,
27
+ TestSurfaceDetails,
28
+ } from "./details.ts";
@@ -1,7 +1,18 @@
1
- /**
2
- * Normalized intent and routing types for the code-intelligence planner.
3
- */
4
- import type { CodeIntelligenceToolName, CodeRelationsKind } from "../tool/tool-specs.ts";
1
+ /** Canonical code-intelligence tool names. */
2
+ export const CODE_INTELLIGENCE_TOOL_NAMES = [
3
+ "code_resolve",
4
+ "code_inspect",
5
+ "code_orientation",
6
+ "code_find",
7
+ "code_graph",
8
+ "code_impact",
9
+ "code_refactor_plan",
10
+ "code_refactor_apply",
11
+ "code_health",
12
+ ] as const;
13
+
14
+ /** Canonical code-intelligence tool name. */
15
+ export type CodeIntelligenceToolName = (typeof CODE_INTELLIGENCE_TOOL_NAMES)[number];
5
16
 
6
17
  /**
7
18
  * A route describes how the planner recommends handling a tool intent.
@@ -22,13 +33,3 @@ export interface PlannerRoute {
22
33
  */
23
34
  preferred: "semantic" | "structural" | "search" | "unavailable";
24
35
  }
25
-
26
- /**
27
- * A resolved intents for a tool execution request.
28
- * Provides the normalized target and routing info together.
29
- */
30
- export interface ResolvedIntent {
31
- tool: CodeIntelligenceToolName;
32
- relationsKind?: CodeRelationsKind;
33
- route: PlannerRoute;
34
- }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * LSP footer stats-end contribution for code-intelligence.
3
+ *
4
+ * Provides the persistent "| λ lsp • N servers • M open files" suffix on the
5
+ * footer stats line, after cost and context info. This was removed during the
6
+ * supi-lsp → supi-code-intelligence migration.
7
+ */
8
+
9
+ import { footerContributions } from "@mrclrchtr/supi-core/footer-registry";
10
+ import type { LspAdapterState } from "../substrate/lsp/state.ts";
11
+
12
+ /** Build the LSP status text: "λ lsp • 2 servers • 5 open files" */
13
+ export function buildLspStatusText(lspState: LspAdapterState): string | undefined {
14
+ const controller = lspState.controller;
15
+ const service = controller?.service;
16
+ if (!service) return undefined;
17
+
18
+ const servers = service.getProjectServers();
19
+ const runningServers = servers.filter((s) => s.status === "running").length;
20
+ const openFiles = servers.reduce((sum, s) => sum + s.openFiles.length, 0);
21
+
22
+ if (runningServers === 0 && openFiles === 0) return undefined;
23
+
24
+ const parts = ["λ lsp"];
25
+ if (runningServers > 0)
26
+ parts.push(`${runningServers} ${runningServers === 1 ? "server" : "servers"}`);
27
+ if (openFiles > 0) parts.push(`${openFiles} ${openFiles === 1 ? "open file" : "open files"}`);
28
+ return parts.join(" • ");
29
+ }
30
+
31
+ // ── Footer stats contribution ───────────────────────────────────────────
32
+
33
+ const FOOTER_KEY = "lsp-status";
34
+
35
+ /** Register the LSP stats-end footer contribution for the given adapter state. */
36
+ export function registerLspFooterContribution(lspState: LspAdapterState): void {
37
+ footerContributions.register({
38
+ key: FOOTER_KEY,
39
+ placement: "stats-end",
40
+ priority: 100,
41
+ render: () => {
42
+ const text = buildLspStatusText(lspState);
43
+ if (!text) return "";
44
+ return `| ${text}`;
45
+ },
46
+ });
47
+ }
48
+
49
+ /** Remove the LSP stats footer contribution. */
50
+ export function unregisterLspFooterContribution(): void {
51
+ footerContributions.unregister(FOOTER_KEY);
52
+ }
@@ -0,0 +1,218 @@
1
+ // Brief markdown renderer — consumes use-case data and produces markdown content + details metadata.
2
+
3
+ import * as path from "node:path";
4
+ import type { ArchitectureModel } from "../../analysis/architecture/model.ts";
5
+ import { findModuleForPath } from "../../analysis/architecture/model.ts";
6
+ import type { BriefDetails } from "../../types/index.ts";
7
+
8
+ interface TreeSitterContext {
9
+ nodeInfo: unknown;
10
+ outline: Array<{ name: string; kind: string; startLine: number; endLine: number }>;
11
+ imports: Array<{ moduleSpecifier: string }>;
12
+ exports: Array<{ name: string; kind: string }>;
13
+ }
14
+
15
+ // ── Symbol brief ──────────────────────────────────────────────────────
16
+
17
+ export function renderSymbolBrief(params: {
18
+ relPath: string;
19
+ symbolName: string;
20
+ targetLine: number;
21
+ targetCharacter: number;
22
+ targetKind: string | null;
23
+ context: TreeSitterContext;
24
+ model: ArchitectureModel | null;
25
+ details: BriefDetails;
26
+ cwd: string;
27
+ }): { content: string; details: BriefDetails } {
28
+ const lines: string[] = [];
29
+ lines.push(`# Symbol Brief: ${params.symbolName || params.relPath}`);
30
+ lines.push("");
31
+ lines.push(
32
+ `**Resolved to:** \`${params.relPath}:${params.targetLine}:${params.targetCharacter}\`${params.targetKind ? ` (${params.targetKind})` : ""}`,
33
+ );
34
+ lines.push("");
35
+
36
+ appendFileOrientationContext(lines, params.context);
37
+
38
+ if (params.model) {
39
+ const resolvedFile = path.resolve(params.cwd, params.relPath);
40
+ const mod = findModuleForPath(params.model, resolvedFile);
41
+ if (mod) {
42
+ const shortName = mod.name.replace(/^@[^/]+\//, "");
43
+ lines.push(`_Module: ${shortName} (\`${mod.relativePath}\`)_`);
44
+ lines.push("");
45
+ }
46
+ }
47
+
48
+ return { content: lines.join("\n"), details: params.details };
49
+ }
50
+
51
+ function getOutlinePrefix(kind: string): string {
52
+ if (kind === "function" || kind === "method") return "ƒ";
53
+ if (kind === "class") return "◆";
54
+ return "·";
55
+ }
56
+
57
+ function appendFileOrientationContext(lines: string[], context: TreeSitterContext): void {
58
+ if (context.outline.length > 0) {
59
+ lines.push("## File Outline");
60
+ const shown = context.outline.slice(0, 15);
61
+ for (const item of shown) {
62
+ const prefix = getOutlinePrefix(item.kind);
63
+ lines.push(`- ${prefix} \`${item.name}\` (${item.kind}) L${item.startLine}`);
64
+ }
65
+ if (context.outline.length > 15) {
66
+ lines.push(`- _+${context.outline.length - 15} more declarations_`);
67
+ }
68
+ lines.push("");
69
+ }
70
+
71
+ if (context.imports.length > 0) {
72
+ lines.push("## Imports");
73
+ const shown = context.imports.slice(0, 10);
74
+ for (const imp of shown) {
75
+ lines.push(`- \`${imp.moduleSpecifier}\``);
76
+ }
77
+ if (context.imports.length > 10) {
78
+ lines.push(`- _+${context.imports.length - 10} more_`);
79
+ }
80
+ lines.push("");
81
+ }
82
+
83
+ if (context.exports.length > 0) {
84
+ lines.push("## Exports");
85
+ const shown = context.exports.slice(0, 10);
86
+ for (const exp of shown) {
87
+ lines.push(`- \`${exp.name}\` (${exp.kind})`);
88
+ }
89
+ if (context.exports.length > 10) {
90
+ lines.push(`- _+${context.exports.length - 10} more_`);
91
+ }
92
+ lines.push("");
93
+ }
94
+ }
95
+
96
+ // ── File brief ───────────────────────────────────────────────────────
97
+
98
+ interface FileBriefInput {
99
+ relPath: string;
100
+ lineCount: number;
101
+ isEntrypoint: boolean;
102
+ moduleName: string | null;
103
+ moduleRelativePath: string | null;
104
+ enrichment: {
105
+ outline: Array<{ name: string; kind: string; startLine: number; endLine: number }>;
106
+ imports: Array<{ moduleSpecifier: string }>;
107
+ exports: Array<{ name: string; kind: string }>;
108
+ diagnostics: Array<{ line: number; severity: number; message: string }>;
109
+ };
110
+ maxResults?: number;
111
+ }
112
+
113
+ export function renderFileBrief(input: FileBriefInput): string {
114
+ const lines: string[] = [];
115
+ lines.push(`# File: ${input.relPath}`);
116
+ lines.push("");
117
+
118
+ if (input.moduleName) {
119
+ lines.push(`_Module: ${input.moduleName} (\`${input.moduleRelativePath}\`)_`);
120
+ lines.push("");
121
+ }
122
+
123
+ if (input.isEntrypoint) {
124
+ lines.push("**This file is a module entrypoint.**");
125
+ lines.push("");
126
+ }
127
+
128
+ lines.push(`- Lines: ${input.lineCount}`);
129
+ lines.push("");
130
+
131
+ // Diagnostics section (inline first diagnostic messages)
132
+ appendDiagnosticsSection(lines, input.enrichment.diagnostics, input.maxResults);
133
+
134
+ // Structural context (outline, imports, exports)
135
+ if (input.enrichment.outline.length > 0) {
136
+ lines.push("## File Outline");
137
+ const shown = input.enrichment.outline;
138
+ for (const item of shown) {
139
+ const prefix = getOutlinePrefix(item.kind);
140
+ lines.push(`- ${prefix} \`${item.name}\` (${item.kind}) L${item.startLine}`);
141
+ }
142
+ lines.push("");
143
+ }
144
+
145
+ if (input.enrichment.imports.length > 0) {
146
+ lines.push("## Imports");
147
+ for (const imp of input.enrichment.imports) {
148
+ lines.push(`- \`${imp.moduleSpecifier}\``);
149
+ }
150
+ lines.push("");
151
+ }
152
+
153
+ if (input.enrichment.exports.length > 0) {
154
+ lines.push("## Exports");
155
+ for (const exp of input.enrichment.exports) {
156
+ lines.push(`- \`${exp.name}\` (${exp.kind})`);
157
+ }
158
+ lines.push("");
159
+ }
160
+
161
+ return lines.join("\n");
162
+ }
163
+
164
+ // ── Module brief diagnostics section ─────────────────────────────────
165
+
166
+ export function renderModuleDiagnostics(
167
+ fileDiagnostics: Array<{ file: string; errors: number; warnings: number }>,
168
+ maxResults?: number,
169
+ ): string | null {
170
+ if (fileDiagnostics.length === 0) return null;
171
+
172
+ const lines: string[] = [];
173
+ lines.push("## Diagnostics");
174
+ const cap = maxResults ?? 5;
175
+ for (const entry of fileDiagnostics.slice(0, cap)) {
176
+ const parts: string[] = [];
177
+ if (entry.errors > 0) parts.push(`${entry.errors} error${entry.errors > 1 ? "s" : ""}`);
178
+ if (entry.warnings > 0) parts.push(`${entry.warnings} warning${entry.warnings > 1 ? "s" : ""}`);
179
+ lines.push(`- \`${entry.file}\` — ${parts.join(", ")}`);
180
+ }
181
+ if (fileDiagnostics.length > cap) {
182
+ lines.push(`- _+${fileDiagnostics.length - cap} more files_`);
183
+ }
184
+ lines.push("");
185
+
186
+ return lines.join("\n");
187
+ }
188
+
189
+ // ── Diagnostics section (inline) ─────────────────────────────────────
190
+
191
+ function severityLabel(severity: number): string {
192
+ switch (severity) {
193
+ case 1:
194
+ return "Error";
195
+ case 2:
196
+ return "Warning";
197
+ case 3:
198
+ return "Info";
199
+ case 4:
200
+ return "Hint";
201
+ default:
202
+ return "Diagnostic";
203
+ }
204
+ }
205
+
206
+ function appendDiagnosticsSection(
207
+ lines: string[],
208
+ diagnostics: Array<{ line: number; severity: number; message: string }>,
209
+ _maxResults?: number,
210
+ ): void {
211
+ if (diagnostics.length === 0) return;
212
+
213
+ lines.push("## Diagnostics");
214
+ for (const d of diagnostics) {
215
+ lines.push(`- L${d.line}: ${severityLabel(d.severity)}: ${d.message}`);
216
+ }
217
+ lines.push("");
218
+ }