@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.
Files changed (344) 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/package.json +4 -31
  70. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
  71. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
  72. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
  73. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
  74. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
  75. package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
  76. package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
  77. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
  78. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
  79. package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
  80. package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
  81. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
  82. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
  83. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
  84. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
  85. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
  86. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
  87. package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
  88. package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  93. 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
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  98. 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
  99. 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
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
  106. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
  107. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
  108. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
  109. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
  110. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
  111. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
  112. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
  113. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
  114. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
  115. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
  116. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
  117. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
  118. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
  119. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
  120. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
  121. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
  122. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
  123. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
  124. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
  125. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
  126. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
  127. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
  128. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
  129. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  130. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
  131. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
  132. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
  133. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
  134. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
  135. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
  136. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
  137. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
  138. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
  139. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
  140. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  141. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
  142. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
  143. package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
  144. package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
  145. package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
  146. package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
  147. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
  148. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
  149. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
  150. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
  151. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
  152. package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
  153. package/package.json +14 -9
  154. package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
  155. package/src/analysis/architecture/model.ts +76 -0
  156. package/src/analysis/brief/directory.ts +324 -0
  157. package/src/analysis/brief/enrich.ts +157 -0
  158. package/src/analysis/brief/file.ts +84 -0
  159. package/src/analysis/brief/inventory.ts +177 -0
  160. package/src/analysis/brief/main.ts +176 -0
  161. package/src/analysis/brief/models.ts +75 -0
  162. package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
  163. package/src/analysis/brief/summarize.ts +208 -0
  164. package/src/analysis/brief/types.ts +27 -0
  165. package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
  166. package/src/analysis/coverage/coverage-warnings.ts +224 -0
  167. package/src/analysis/evidence.ts +91 -0
  168. package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
  169. package/src/analysis/provider.ts +186 -0
  170. package/src/analysis/read-next.ts +126 -0
  171. package/src/analysis/readiness.ts +73 -0
  172. package/src/{refactor → analysis/refactor}/safety.ts +1 -1
  173. package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
  174. package/src/analysis/search/pattern.ts +345 -0
  175. package/src/analysis/search/ripgrep.ts +473 -0
  176. package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
  177. package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
  178. package/src/analysis/target/anchored.ts +349 -0
  179. package/src/analysis/target/bridge.ts +152 -0
  180. package/src/analysis/target/file-resolution.ts +125 -0
  181. package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
  182. package/src/{planner → analysis/target}/planner.ts +30 -20
  183. package/src/{targeting → analysis/target}/query.ts +17 -3
  184. package/src/analysis/target/resolve-common.ts +115 -0
  185. package/src/analysis/target/service.ts +229 -0
  186. package/src/analysis/target/symbol.ts +196 -0
  187. package/src/{targeting → analysis/target}/types.ts +17 -1
  188. package/src/analysis/tests/likely-tests.ts +174 -0
  189. package/src/analysis/tests/test-discovery.ts +540 -0
  190. package/src/analysis/tests/vitest.ts +87 -0
  191. package/src/api.ts +34 -41
  192. package/src/app/app.ts +125 -0
  193. package/src/app/manager.ts +65 -0
  194. package/src/extension.ts +132 -1
  195. package/src/index.ts +1 -57
  196. package/src/session/refactor-plans.ts +82 -0
  197. package/src/session/session.ts +300 -0
  198. package/src/session/target-store.ts +293 -0
  199. package/src/substrate/lsp/diagnostic-injection.ts +218 -0
  200. package/src/substrate/lsp/lifecycle.ts +66 -0
  201. package/src/substrate/lsp/overrides.ts +132 -0
  202. package/src/substrate/lsp/recovery.ts +55 -0
  203. package/src/substrate/lsp/settings.ts +286 -0
  204. package/src/substrate/lsp/state.ts +46 -0
  205. package/src/substrate/lsp/utils.ts +17 -0
  206. package/src/substrate/tree-sitter/lifecycle.ts +52 -0
  207. package/src/tool/find/execute.ts +118 -0
  208. package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
  209. package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
  210. package/src/tool/find/semantic-search.ts +114 -0
  211. package/src/tool/find/tui.ts +39 -0
  212. package/src/tool/graph/callees.ts +87 -0
  213. package/src/tool/graph/calls-md.ts +54 -0
  214. package/src/tool/graph/collect-relation.ts +371 -0
  215. package/src/tool/graph/execute.ts +95 -0
  216. package/src/tool/graph/implementations-md.ts +79 -0
  217. package/src/tool/graph/implementations.ts +76 -0
  218. package/src/tool/graph/markdown-base.ts +243 -0
  219. package/src/tool/graph/orchestrate.ts +285 -0
  220. package/src/tool/graph/references-md.ts +34 -0
  221. package/src/tool/graph/references.ts +81 -0
  222. package/src/tool/graph/tui.ts +120 -0
  223. package/src/tool/graph/types.ts +97 -0
  224. package/src/tool/guidance.ts +96 -49
  225. package/src/tool/health/execute.ts +76 -0
  226. package/src/tool/health/markdown.ts +280 -0
  227. package/src/tool/health/orchestrate.ts +159 -0
  228. package/src/tool/health/sections/diagnostics.ts +182 -0
  229. package/src/tool/health/sections/recovery.ts +89 -0
  230. package/src/tool/health/sections/signals.ts +89 -0
  231. package/src/tool/health/tui.ts +137 -0
  232. package/src/tool/impact/analysis.ts +247 -0
  233. package/src/tool/impact/change-set-impact.ts +151 -0
  234. package/src/tool/impact/execute.ts +98 -0
  235. package/src/tool/impact/file-level-impact.ts +81 -0
  236. package/src/tool/impact/markdown.ts +283 -0
  237. package/src/tool/impact/orchestrate.ts +97 -0
  238. package/src/tool/impact/result.ts +21 -0
  239. package/src/tool/impact/single-impact.ts +89 -0
  240. package/src/tool/impact/tui.ts +39 -0
  241. package/src/tool/impact/types.ts +34 -0
  242. package/src/tool/infra/cross-field.ts +335 -0
  243. package/src/tool/infra/error-results.ts +199 -0
  244. package/src/tool/infra/pipeline.ts +311 -0
  245. package/src/tool/infra/progress.ts +21 -0
  246. package/src/tool/infra/readiness-message.ts +5 -0
  247. package/src/tool/infra/truncate.ts +49 -0
  248. package/src/tool/inspect/execute.ts +76 -0
  249. package/src/tool/inspect/markdown.ts +169 -0
  250. package/src/tool/inspect/orchestrate.ts +156 -0
  251. package/src/tool/inspect/tui.ts +36 -0
  252. package/src/tool/orientation/deps.ts +63 -0
  253. package/src/tool/orientation/execute.ts +50 -0
  254. package/src/tool/orientation/markdown.ts +35 -0
  255. package/src/tool/orientation/mode.ts +88 -0
  256. package/src/tool/orientation/orchestrate.ts +478 -0
  257. package/src/tool/orientation/precise-target.ts +257 -0
  258. package/src/tool/orientation/tui.ts +131 -0
  259. package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
  260. package/src/tool/refactor-apply/execute.ts +20 -0
  261. package/src/tool/refactor-apply/markdown.ts +118 -0
  262. package/src/tool/refactor-apply/orchestrate.ts +89 -0
  263. package/src/tool/refactor-apply/tui.ts +51 -0
  264. package/src/tool/refactor-plan/execute.ts +73 -0
  265. package/src/tool/refactor-plan/markdown.ts +118 -0
  266. package/src/tool/refactor-plan/orchestrate.ts +363 -0
  267. package/src/tool/refactor-plan/tui.ts +42 -0
  268. package/src/tool/register.ts +123 -0
  269. package/src/tool/resolve/execute.ts +82 -0
  270. package/src/tool/resolve/markdown.ts +150 -0
  271. package/src/tool/resolve/orchestrate.ts +134 -0
  272. package/src/tool/resolve/tui.ts +40 -0
  273. package/src/tool/schemas.ts +337 -0
  274. package/src/tool/specs.ts +257 -0
  275. package/src/types/details.ts +188 -0
  276. package/src/types/execution.ts +60 -0
  277. package/src/types/index.ts +28 -0
  278. package/src/{intent/types.ts → types/tool-names.ts} +15 -14
  279. package/src/ui/footer.ts +52 -0
  280. package/src/ui/markdown/brief.ts +218 -0
  281. package/src/ui/markdown/gather.ts +177 -0
  282. package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
  283. package/src/{presentation → ui}/markdown/overview.ts +2 -2
  284. package/src/ui/markdown/types.ts +80 -0
  285. package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
  286. package/src/ui/status-command.ts +260 -0
  287. package/src/ui/status-overlay.ts +500 -0
  288. package/src/ui/tui/common.ts +220 -0
  289. package/src/ui/tui/index.ts +37 -0
  290. package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
  291. package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
  292. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
  293. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
  294. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
  295. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
  296. package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
  297. package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
  298. package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
  299. package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
  300. package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
  301. package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
  302. package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
  303. package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
  304. package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
  305. package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
  306. package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
  307. package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
  308. package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
  309. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
  310. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
  311. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
  312. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
  313. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
  314. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
  315. package/src/brief-focused.ts +0 -563
  316. package/src/code-intelligence.ts +0 -70
  317. package/src/pattern-structured.ts +0 -194
  318. package/src/presentation/markdown/affected.ts +0 -170
  319. package/src/presentation/markdown/brief.ts +0 -174
  320. package/src/presentation/markdown/map.ts +0 -54
  321. package/src/presentation/markdown/refactor.ts +0 -27
  322. package/src/presentation/markdown/relations.ts +0 -121
  323. package/src/resolve-target.ts +0 -130
  324. package/src/search-helpers.ts +0 -303
  325. package/src/substrates/types.ts +0 -30
  326. package/src/target-resolution.ts +0 -122
  327. package/src/targeting/resolve-anchored.ts +0 -80
  328. package/src/targeting/resolve-symbol.ts +0 -110
  329. package/src/tool/execute-affected.ts +0 -71
  330. package/src/tool/execute-brief.ts +0 -59
  331. package/src/tool/execute-map.ts +0 -35
  332. package/src/tool/execute-pattern.ts +0 -29
  333. package/src/tool/execute-refactor.ts +0 -101
  334. package/src/tool/execute-relations.ts +0 -79
  335. package/src/tool/register-tools.ts +0 -32
  336. package/src/tool/tool-specs.ts +0 -190
  337. package/src/tool/validation.ts +0 -43
  338. package/src/types.ts +0 -169
  339. package/src/use-case/generate-affected.ts +0 -297
  340. package/src/use-case/generate-map.ts +0 -176
  341. package/src/use-case/generate-relations.ts +0 -438
  342. package/src/use-case/types.ts +0 -43
  343. package/src/workspace/request-context.ts +0 -139
  344. /package/src/{query-params.ts → tool/params.ts} +0 -0
@@ -1,61 +1,126 @@
1
1
  // Pattern search markdown renderer — all formatting for literal, regex, and structured search results.
2
2
 
3
- import type { StructuredMatch, StructuredPatternResult } from "../../pattern-structured.ts";
4
- import type { RgMatch } from "../../search-helpers.ts";
5
- import { groupByFile } from "../../search-helpers.ts";
6
- import type { StructuralSubstrate } from "../../substrates/types.ts";
3
+ import type { StructuralProvider as StructuralSubstrate } from "@mrclrchtr/supi-code-runtime/api";
4
+ import {
5
+ createEvidenceList,
6
+ type EvidenceListMetadata,
7
+ renderEvidenceListDisclosure,
8
+ } from "../../analysis/evidence.ts";
9
+ import type {
10
+ StructuredMatch,
11
+ StructuredPatternKind,
12
+ StructuredPatternResult,
13
+ } from "../../analysis/search/pattern.ts";
14
+ import type { RgMatch } from "../../analysis/search/ripgrep.ts";
15
+ import { groupByFile } from "../../analysis/search/ripgrep.ts";
7
16
 
8
17
  // ── Structured search formatting ─────────────────────────────────────
9
18
 
10
19
  // biome-ignore lint/complexity/useMaxParams: structured empty-state with optional result parameter keeps partial-warning logic together
11
20
  export function renderStructuredEmptyState(
12
21
  pattern: string,
13
- kind: "definition" | "export" | "import",
22
+ kind: StructuredPatternKind,
14
23
  relScope: string,
15
24
  _structural?: StructuralSubstrate,
16
25
  result?: StructuredPatternResult,
17
26
  ): string {
18
27
  const lines = [`No ${kind} matches found for \`${pattern}\` in \`${relScope}\`.`];
19
- if (result && result.omittedCount > 0 && result.partialReason) {
28
+ const partial = renderPartialWarning(result);
29
+ if (partial) {
20
30
  lines.push("");
21
- if (result.partialReason === "timeout") {
22
- lines.push(
23
- `_Partial structured results — scan timed out with +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted. Narrow \`path\` or \`pattern\` for complete coverage._`,
24
- );
25
- } else {
26
- lines.push(
27
- `_Partial structured results — +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted after reaching the structured scan cap. Narrow \`path\` or \`pattern\` for complete coverage._`,
28
- );
29
- }
31
+ lines.push(partial);
32
+ }
33
+ const failureLines = renderFailureSummary(result?.failures);
34
+ if (failureLines.length > 0) {
35
+ lines.push("");
36
+ lines.push(...failureLines);
30
37
  }
31
38
  return lines.join("\n");
32
39
  }
33
40
 
41
+ function renderFailureSummary(failures?: Array<{ file: string; reason: string }>): string[] {
42
+ if (!failures || failures.length === 0) return [];
43
+ const lines: string[] = [
44
+ `**${failures.length} file${failures.length !== 1 ? "s" : ""} could not be analyzed:**`,
45
+ ];
46
+ for (const f of failures.slice(0, 5)) {
47
+ lines.push(`- \`${f.file}\` — ${f.reason}`);
48
+ }
49
+ if (failures.length > 5) {
50
+ lines.push(`- _+${failures.length - 5} more_`);
51
+ }
52
+ return lines;
53
+ }
54
+
55
+ function renderPartialWarning(result?: StructuredPatternResult): string | null {
56
+ if (!result || result.omittedCount <= 0 || !result.partialReason) return null;
57
+ if (result.partialReason === "timeout") {
58
+ return `_Partial structured results — scan timed out with +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted. Narrow \`path\` or \`pattern\` for complete coverage._`;
59
+ }
60
+ return `_Partial structured results — +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted after reaching the structured scan cap. Narrow \`path\` or \`pattern\` for complete coverage._`;
61
+ }
62
+
63
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: pattern search rendering groups matches by file and adds summaries — each branch stays linear
64
+ // biome-ignore lint/complexity/useMaxParams: structured renderer mirrors the existing public helper shape plus display cap
34
65
  export function renderStructuredMatches(
35
66
  pattern: string,
36
- kind: "definition" | "export" | "import",
67
+ kind: StructuredPatternKind,
37
68
  relScope: string,
38
69
  result: StructuredPatternResult,
39
- ): string {
70
+ maxResults: number,
71
+ ): { content: string; evidenceList: EvidenceListMetadata } {
72
+ const evidence = createEvidenceList({
73
+ key: "find.astMatches",
74
+ items: result.matches,
75
+ maxResults,
76
+ });
40
77
  const grouped = new Map<string, StructuredMatch[]>();
41
- for (const match of result.matches) {
78
+ for (const match of evidence.items) {
42
79
  const group = grouped.get(match.file) ?? [];
43
80
  group.push(match);
44
81
  grouped.set(match.file, group);
45
82
  }
46
83
 
47
84
  const kindLabel =
48
- kind === "definition" ? "Definitions" : kind === "export" ? "Exports" : "Imports";
85
+ kind === "definition"
86
+ ? "Definitions"
87
+ : kind === "export"
88
+ ? "Exports"
89
+ : kind === "import"
90
+ ? "Imports"
91
+ : kind === "call"
92
+ ? "Calls"
93
+ : kind === "type"
94
+ ? "Types"
95
+ : kind === "interface"
96
+ ? "Interfaces"
97
+ : kind === "class"
98
+ ? "Classes"
99
+ : kind === "method"
100
+ ? "Methods"
101
+ : kind === "enum"
102
+ ? "Enums"
103
+ : "Tests";
49
104
  const lines: string[] = [];
50
105
  lines.push(`# Pattern ${kindLabel}: \`${pattern}\``);
51
106
  lines.push("");
52
107
  lines.push(
53
108
  `**${result.matches.length} match${result.matches.length !== 1 ? "es" : ""}** across **${grouped.size} file${grouped.size !== 1 ? "s" : ""}** in \`${relScope}\``,
54
109
  );
55
- const partialWarning = formatPartialStructuredWarning(result);
110
+ if (kind === "call") {
111
+ lines.push("");
112
+ lines.push(
113
+ '_Note: AST call results are name-based, not symbol-identity-aware. Use `code_graph` with `relations: ["references"]` on a resolved target for identity-aware callers._',
114
+ );
115
+ }
116
+ const partialWarning = renderPartialWarning(result);
56
117
  if (partialWarning) {
57
118
  lines.push(partialWarning);
58
119
  }
120
+ if (result.failures.length > 0) {
121
+ lines.push("");
122
+ lines.push(...renderFailureSummary(result.failures));
123
+ }
59
124
  lines.push("");
60
125
 
61
126
  if (kind === "definition" || kind === "export") {
@@ -64,26 +129,18 @@ export function renderStructuredMatches(
64
129
 
65
130
  for (const [file, fileMatches] of grouped) {
66
131
  lines.push(`### ${file}`);
67
- for (const match of fileMatches.slice(0, 8)) {
132
+ for (const match of fileMatches) {
68
133
  lines.push(`- \`${match.name}\` (${match.kind}) L${match.line}`);
69
134
  }
70
- if (fileMatches.length > 8) {
71
- lines.push(`- _+${fileMatches.length - 8} more in this file_`);
72
- }
73
135
  lines.push("");
74
136
  }
75
137
 
76
- return lines.join("\n");
77
- }
78
-
79
- function formatPartialStructuredWarning(result: StructuredPatternResult): string | null {
80
- if (!result.partialReason || result.omittedCount <= 0) return null;
81
-
82
- if (result.partialReason === "timeout") {
83
- return `_Partial structured results — scan timed out with +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted. Narrow \`path\` or \`pattern\` for complete coverage._`;
138
+ const disclosure = renderEvidenceListDisclosure(evidence);
139
+ if (disclosure) {
140
+ lines.push(disclosure);
84
141
  }
85
142
 
86
- return `_Partial structured results — +${result.omittedCount} file${result.omittedCount !== 1 ? "s" : ""} omitted after reaching the structured scan cap. Narrow \`path\` or \`pattern\` for complete coverage._`;
143
+ return { content: lines.join("\n"), evidenceList: evidence.metadata };
87
144
  }
88
145
 
89
146
  function addDuplicateSummary(lines: string[], matches: StructuredMatch[]): void {
@@ -137,40 +194,35 @@ export function renderPatternResults(
137
194
  relScope: string,
138
195
  matches: RgMatch[],
139
196
  maxResults: number,
140
- ): string {
197
+ ): { content: string; evidenceList: EvidenceListMetadata } {
141
198
  const lines: string[] = [];
142
199
  lines.push(`# Pattern: \`${pattern}\``);
143
200
  lines.push("");
144
201
  lines.push(`**${matches.length} match${matches.length > 1 ? "es" : ""}** in \`${relScope}\``);
145
202
  lines.push("");
146
203
 
147
- const byFile = groupByFile(matches);
148
- let shown = 0;
204
+ const evidence = createEvidenceList({
205
+ key: "find.textMatches",
206
+ items: matches,
207
+ maxResults,
208
+ });
209
+ const byFile = groupByFile(evidence.items);
149
210
  for (const [file, fileMatches] of byFile) {
150
- if (shown >= maxResults) break;
151
211
  lines.push(`### ${file}`);
152
212
  const renderedLines = new Set<number>();
153
213
  const matchLines = new Set(fileMatches.map((match) => match.line));
154
- for (const m of fileMatches.slice(0, 5)) {
214
+ for (const m of fileMatches) {
155
215
  renderMatchWithContext(lines, m, renderedLines, matchLines, pattern);
156
216
  }
157
- if (fileMatches.length > 5) {
158
- lines.push(`- _+${fileMatches.length - 5} more in this file_`);
159
- }
160
217
  lines.push("");
161
- shown++;
162
218
  }
163
219
 
164
- if (byFile.size > maxResults) {
165
- lines.push(
166
- `_+${byFile.size - maxResults} more files omitted. Narrow \`path\` or increase \`maxResults\`._`,
167
- );
220
+ const disclosure = renderEvidenceListDisclosure(evidence);
221
+ if (disclosure) {
222
+ lines.push(disclosure);
168
223
  }
169
224
  lines.push("");
170
- lines.push("_Text search — results may include comments, strings, or unrelated matches._");
171
- lines.push("");
172
-
173
- return lines.join("\n");
225
+ return { content: lines.join("\n"), evidenceList: evidence.metadata };
174
226
  }
175
227
 
176
228
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: context-line rendering with before/after/skip logic is clearer as one function
@@ -232,8 +284,5 @@ export function renderPatternSummary(
232
284
  lines.push(`- _+${sorted.length - maxResults} more files omitted_`);
233
285
  }
234
286
  lines.push("");
235
- lines.push("_Text search — results may include comments, strings, or unrelated matches._");
236
- lines.push("");
237
-
238
287
  return lines.join("\n");
239
288
  }
@@ -2,25 +2,36 @@
2
2
  // Coordinates ripgrep literal/regex search and structured tree-sitter search,
3
3
  // returning fully rendered content + details metadata.
4
4
 
5
- import { getStructuredPatternMatches, isStructuredPatternKind } from "../pattern-structured.ts";
5
+ import type { CodeProvider } from "../../analysis/provider.ts";
6
+ import {
7
+ getStructuredPatternMatches,
8
+ isStructuredPatternKind,
9
+ type StructuredPatternKind,
10
+ } from "../../analysis/search/pattern.ts";
11
+ import type { RgMatch } from "../../analysis/search/ripgrep.ts";
12
+ import {
13
+ normalizePath,
14
+ runRipgrep,
15
+ runRipgrepDetailed,
16
+ toDisplayPath,
17
+ } from "../../analysis/search/ripgrep.ts";
18
+ import type { CodeIntelResult, SearchDetails } from "../../types/index.ts";
19
+ import type { CodeQueryParams } from "../params.ts";
6
20
  import {
7
21
  renderPatternResults,
8
22
  renderPatternSummary,
9
23
  renderRegexError,
10
24
  renderStructuredEmptyState,
11
25
  renderStructuredMatches,
12
- } from "../presentation/markdown/pattern.ts";
13
- import type { CodeQueryParams } from "../query-params.ts";
14
- import type { RgMatch } from "../search-helpers.ts";
15
- import { normalizePath, runRipgrep, runRipgrepDetailed } from "../search-helpers.ts";
16
- import type { CodeIntelResult, SearchDetails } from "../types.ts";
17
- import type { CodeProvider } from "../workspace/request-context.ts";
26
+ } from "./markdown.ts";
27
+ import { executeSemanticSearch } from "./semantic-search.ts";
18
28
 
19
29
  export interface PatternInput {
20
30
  pattern: string;
21
31
  path?: string;
22
32
  regex?: boolean;
23
33
  kind?: string;
34
+ mode?: "text" | "regex" | "ast" | "semantic";
24
35
  maxResults?: number;
25
36
  contextLines?: number;
26
37
  summary?: boolean;
@@ -29,9 +40,12 @@ export interface PatternInput {
29
40
  export interface PatternDeps {
30
41
  cwd: string;
31
42
  provider: CodeProvider | null;
43
+ /** Abort signal forwarded to ripgrep for text/regex modes. */
44
+ signal?: AbortSignal;
32
45
  }
33
46
 
34
47
  /** Execute the pattern search use-case. */
48
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: mode dispatch branches are linear, not nested
35
49
  export async function executePattern(
36
50
  input: PatternInput,
37
51
  deps: PatternDeps,
@@ -43,6 +57,11 @@ export async function executePattern(
43
57
  };
44
58
  }
45
59
 
60
+ // Semantic mode — LSP workspace symbol search
61
+ if (input.mode === "semantic") {
62
+ return executeSemanticSearch(input, deps.provider, deps.cwd);
63
+ }
64
+
46
65
  const maxResults = input.maxResults ?? 8;
47
66
  const contextLines = input.contextLines ?? 1;
48
67
  const scopePath = input.path ? normalizePath(input.path, deps.cwd) : deps.cwd;
@@ -61,19 +80,20 @@ export async function executePattern(
61
80
  }
62
81
 
63
82
  const matches = input.regex
64
- ? getRegexMatches({
83
+ ? await getRegexMatches({
65
84
  pattern: input.pattern,
66
85
  scopePath,
67
86
  cwd: deps.cwd,
68
87
  maxResults,
69
88
  contextLines,
70
89
  summary: input.summary,
90
+ signal: deps.signal,
71
91
  })
72
- : runRipgrep(input.pattern, scopePath, deps.cwd, {
73
- maxMatches: input.summary ? undefined : maxResults * 3,
92
+ : await runRipgrep(input.pattern, scopePath, deps.cwd, {
74
93
  contextLines,
75
94
  literal: true,
76
95
  filterLowSignal: true,
96
+ signal: deps.signal,
77
97
  });
78
98
 
79
99
  if (typeof matches === "string") {
@@ -91,20 +111,29 @@ export async function executePattern(
91
111
  return formatEmptyResult(input, relScope);
92
112
  }
93
113
 
94
- const content = input.summary
95
- ? renderPatternSummary(input.pattern, relScope, matches, maxResults)
96
- : renderPatternResults(input.pattern, relScope, matches, maxResults);
114
+ const displayMatches = matches.map((m) => ({
115
+ ...m,
116
+ file: toDisplayPath(deps.cwd, m.file),
117
+ }));
118
+
119
+ const rendered = input.summary
120
+ ? {
121
+ content: renderPatternSummary(input.pattern, relScope, displayMatches, maxResults),
122
+ evidenceList: undefined,
123
+ }
124
+ : renderPatternResults(input.pattern, relScope, displayMatches, maxResults);
97
125
 
98
126
  const details: SearchDetails = {
99
127
  confidence: "heuristic",
100
128
  scope: input.path ?? null,
101
129
  candidateCount: matches.length,
102
- omittedCount: 0,
130
+ omittedCount: rendered.evidenceList?.omittedCount ?? 0,
131
+ evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
103
132
  nextQueries: input.regex
104
133
  ? ["Set `regex: false` for literal matching"]
105
134
  : ["Set `regex: true` for regex matching"],
106
135
  };
107
- return { content, details: { type: "search" as const, data: details } };
136
+ return { content: rendered.content, details: { type: "search" as const, data: details } };
108
137
  }
109
138
 
110
139
  // ── Structured search ────────────────────────────────────────────────
@@ -112,11 +141,11 @@ export async function executePattern(
112
141
  // biome-ignore lint/complexity/useMaxParams: structured-search parameters are clearer as positional when linking input, scope, and substrate
113
142
  async function executeStructuredSearch(
114
143
  input: PatternInput,
115
- kind: "definition" | "export" | "import",
144
+ kind: StructuredPatternKind,
116
145
  scopePath: string,
117
146
  cwd: string,
118
147
  relScope: string,
119
- _maxResults: number,
148
+ maxResults: number,
120
149
  provider: CodeProvider | null,
121
150
  ): Promise<CodeIntelResult> {
122
151
  if (!provider) {
@@ -148,7 +177,7 @@ async function executeStructuredSearch(
148
177
  if (!structured || structured.matches.length === 0) {
149
178
  const content = renderStructuredEmptyState(
150
179
  input.pattern,
151
- kind as "definition" | "export" | "import",
180
+ kind,
152
181
  relScope,
153
182
  provider,
154
183
  structured ?? undefined,
@@ -171,24 +200,28 @@ async function executeStructuredSearch(
171
200
  };
172
201
  }
173
202
 
203
+ const rendered = renderStructuredMatches(input.pattern, kind, relScope, structured, maxResults);
204
+
174
205
  return {
175
- content: renderStructuredMatches(
176
- input.pattern,
177
- kind as "definition" | "export" | "import",
178
- relScope,
179
- structured,
180
- ),
206
+ content: rendered.content,
181
207
  details: {
182
208
  type: "search",
183
209
  data: {
184
210
  confidence: "structural",
185
211
  scope: input.path ?? null,
186
212
  candidateCount: structured.matches.length,
187
- omittedCount: structured.omittedCount,
188
- nextQueries: [
189
- "Omit `kind` for plain text matches",
190
- "Use `summary: true` for broader textual distribution",
191
- ],
213
+ omittedCount: structured.omittedCount + (rendered.evidenceList.omittedCount ?? 0),
214
+ evidenceLists: [rendered.evidenceList],
215
+ nextQueries:
216
+ kind === "call"
217
+ ? [
218
+ "Omit `kind` for plain text matches",
219
+ 'Use `code_graph` with `relations: ["references"]` on a resolved target for identity-aware callers',
220
+ ]
221
+ : [
222
+ "Omit `kind` for plain text matches",
223
+ "Widen `scope` or raise `maxResults` for broader coverage",
224
+ ],
192
225
  },
193
226
  },
194
227
  };
@@ -223,18 +256,19 @@ function formatEmptyResult(input: PatternInput, relScope: string): CodeIntelResu
223
256
  };
224
257
  }
225
258
 
226
- function getRegexMatches(options: {
259
+ async function getRegexMatches(options: {
227
260
  pattern: string;
228
261
  scopePath: string;
229
262
  cwd: string;
230
263
  maxResults: number;
231
264
  contextLines: number;
232
265
  summary?: boolean;
233
- }): RgMatch[] | string {
234
- const result = runRipgrepDetailed(options.pattern, options.scopePath, options.cwd, {
235
- maxMatches: options.summary ? undefined : options.maxResults * 3,
266
+ signal?: AbortSignal;
267
+ }): Promise<RgMatch[] | string> {
268
+ const result = await runRipgrepDetailed(options.pattern, options.scopePath, options.cwd, {
236
269
  contextLines: options.contextLines,
237
270
  filterLowSignal: true,
271
+ signal: options.signal,
238
272
  });
239
273
 
240
274
  if (result.error) {
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Semantic search support for the pattern/find use-case.
3
+ *
4
+ * LSP workspace-symbol search with scope filtering and markdown rendering.
5
+ * Extracted from orchestrate.ts to keep the main use-case under the
6
+ * file-line limit.
7
+ */
8
+
9
+ import type { CodeSymbol } from "@mrclrchtr/supi-code-runtime/api";
10
+ import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
11
+ import { createEvidenceList, renderEvidenceListDisclosure } from "../../analysis/evidence.ts";
12
+ import type { CodeProvider } from "../../analysis/provider.ts";
13
+ import { normalizePath } from "../../analysis/search/ripgrep.ts";
14
+ import type { CodeIntelResult, SearchDetails } from "../../types/index.ts";
15
+ import type { PatternInput } from "./orchestrate.ts";
16
+
17
+ export async function executeSemanticSearch(
18
+ input: PatternInput,
19
+ provider: CodeProvider | null,
20
+ cwd: string,
21
+ ): Promise<CodeIntelResult> {
22
+ if (!provider?.workspaceSymbols) {
23
+ throw new Error(
24
+ "code_find semantic search is unavailable because no semantic/LSP provider is active for this workspace.",
25
+ );
26
+ }
27
+
28
+ const symbols = await provider.workspaceSymbols(input.pattern);
29
+ if (symbols === null) {
30
+ throw new Error(
31
+ "code_find semantic search is unavailable because the active semantic provider cannot serve workspace symbol queries.",
32
+ );
33
+ }
34
+
35
+ const scopePath = input.path ? normalizePath(input.path, cwd) : cwd;
36
+ const scopedSymbols = filterSymbolsByScope(symbols, scopePath);
37
+ if (scopedSymbols.length === 0) {
38
+ return renderSemanticEmptyResult(input);
39
+ }
40
+
41
+ return renderSemanticResults(input, scopedSymbols, cwd);
42
+ }
43
+
44
+ function filterSymbolsByScope<T extends { file: string }>(symbols: T[], scopePath: string): T[] {
45
+ return symbols.filter((symbol) => isWithinOrEqual(scopePath, symbol.file));
46
+ }
47
+
48
+ function renderSemanticEmptyResult(input: PatternInput): CodeIntelResult {
49
+ const relPath = input.path ?? ".";
50
+ return {
51
+ content: `**Semantic search** — \`${input.pattern}\`\n\nNo semantic results found in \`${relPath}\`.`,
52
+ details: {
53
+ type: "search",
54
+ data: {
55
+ confidence: "semantic",
56
+ scope: input.path ?? null,
57
+ candidateCount: 0,
58
+ omittedCount: 0,
59
+ nextQueries: [
60
+ 'Use `mode: "text"` for literal text search',
61
+ 'Use `mode: "ast"` with `kind` for structural filtering',
62
+ ],
63
+ } satisfies SearchDetails,
64
+ },
65
+ };
66
+ }
67
+
68
+ function renderSemanticResults(
69
+ input: PatternInput,
70
+ symbols: CodeSymbol[],
71
+ cwd: string,
72
+ ): CodeIntelResult {
73
+ const max = input.maxResults ?? 8;
74
+ const evidence = createEvidenceList({
75
+ key: "find.semanticSymbols",
76
+ items: symbols,
77
+ maxResults: max,
78
+ });
79
+
80
+ const lines = [
81
+ `**Semantic search** — \`${input.pattern}\` (${symbols.length} symbol${symbols.length !== 1 ? "s" : ""} found)`,
82
+ ];
83
+
84
+ for (const sym of evidence.items) {
85
+ const kindLabel = sym.kind ? ` [${sym.kind}]` : "";
86
+ const container = sym.container ? ` (in ${sym.container})` : "";
87
+ const fileRel = sym.file.startsWith(cwd) ? sym.file.slice(cwd.length + 1) : sym.file;
88
+ const anchor = sym.nameAnchor ?? sym.declarationAnchor;
89
+ lines.push(`- \`${sym.name}\`${kindLabel}${container} — \`${fileRel}:${anchor.line}\``);
90
+ }
91
+
92
+ const disclosure = renderEvidenceListDisclosure(evidence);
93
+ if (disclosure) {
94
+ lines.push(disclosure);
95
+ }
96
+
97
+ return {
98
+ content: lines.join("\n"),
99
+ details: {
100
+ type: "search",
101
+ data: {
102
+ confidence: "semantic",
103
+ scope: input.path ?? null,
104
+ candidateCount: symbols.length,
105
+ omittedCount: evidence.metadata.omittedCount ?? 0,
106
+ evidenceLists: [evidence.metadata],
107
+ nextQueries: [
108
+ 'Use `mode: "text"` for literal text search',
109
+ 'Use `mode: "ast"` with `kind` for structural filtering',
110
+ ],
111
+ } satisfies SearchDetails,
112
+ },
113
+ };
114
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * TUI renderer for code_find — renderCall + renderResult.
3
+ */
4
+ import type { Theme } from "@earendil-works/pi-coding-agent";
5
+ import { Text } from "@earendil-works/pi-tui";
6
+ import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
7
+ import type { CodeFindToolParams } from "./execute.ts";
8
+
9
+ /** ── renderCall ────────────────────────────────────────────────── */
10
+
11
+ export function renderFindCall(args: unknown, theme: Theme, _context: unknown): Text {
12
+ const params = (args ?? {}) as CodeFindToolParams;
13
+ const mode = params.mode ?? "text";
14
+
15
+ let content = theme.fg("toolTitle", "code_find");
16
+
17
+ if (params.query) {
18
+ content += ` ${theme.fg("accent", JSON.stringify(params.query))}`;
19
+ }
20
+
21
+ content += ` ${theme.fg("muted", mode)}`;
22
+
23
+ if (params.kind) {
24
+ content += theme.fg("dim", ` [${params.kind}]`);
25
+ }
26
+
27
+ return new Text(content, 0, 0);
28
+ }
29
+
30
+ /** ── renderResult ──────────────────────────────────────────────── */
31
+
32
+ export function renderFindResult(
33
+ result: ToolResult,
34
+ options: ResultOptios,
35
+ theme: Theme,
36
+ _context: unknown,
37
+ ): ReturnType<typeof renderSimpleResult> {
38
+ return renderSimpleResult(result, options, theme, "Searching…");
39
+ }