@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
@@ -1,122 +0,0 @@
1
- /**
2
- * Target resolution — facade that delegates to the structured targeting pipeline
3
- * while preserving backward-compatible types and exports for existing consumers.
4
- *
5
- * New code should import from `./targeting/` directly.
6
- */
7
-
8
- import { type Position, toLspPosition } from "@mrclrchtr/supi-lsp/api";
9
- import { normalizePath } from "./search-helpers.ts";
10
- import type { SemanticSubstrate, StructuralSubstrate } from "./substrates/types.ts";
11
- import { resolveAnchoredTarget as resolveAnchored } from "./targeting/resolve-anchored.ts";
12
- import { resolveFileTargetGroup as resolveFile } from "./targeting/resolve-file.ts";
13
- import { resolveSymbolTarget as resolveSymbol } from "./targeting/resolve-symbol.ts";
14
- import type { ConfidenceMode, DisambiguationCandidate } from "./types.ts";
15
-
16
- // ── Re-exported legacy types ──────────────────────────────────────────
17
-
18
- export interface ResolvedTarget {
19
- file: string;
20
- /** 0-based position for LSP API */
21
- position: Position;
22
- /** 1-based position for user display */
23
- displayLine: number;
24
- displayCharacter: number;
25
- name: string | null;
26
- kind: string | null;
27
- confidence: ConfidenceMode;
28
- }
29
-
30
- export interface ResolvedTargetGroup {
31
- file: string;
32
- displayName: string;
33
- targets: ResolvedTarget[];
34
- confidence: ConfidenceMode;
35
- }
36
-
37
- export type TargetResolutionResult =
38
- | { kind: "resolved"; target: ResolvedTarget }
39
- | { kind: "disambiguation"; candidates: DisambiguationCandidate[]; omittedCount: number }
40
- | { kind: "error"; message: string };
41
-
42
- // Re-export normalizePath for consumers who import from target-resolution
43
- export { normalizePath } from "./search-helpers.ts";
44
-
45
- /**
46
- * Convert 1-based public coordinates to 0-based LSP Position.
47
- */
48
- export function toZeroBased(line: number, character: number): Position {
49
- return toLspPosition(line, character);
50
- }
51
-
52
- // ── Anchored resolver ─────────────────────────────────────────────────
53
-
54
- /**
55
- * Resolve a target from anchored coordinates (file + line + character).
56
- * Delegates to the new targeting pipeline after normalizing the file path.
57
- */
58
- export function resolveAnchoredTarget(
59
- file: string,
60
- line: number,
61
- character: number,
62
- cwd: string,
63
- ): TargetResolutionResult {
64
- const resolvedFile = normalizePath(file, cwd);
65
- const outcome = resolveAnchored(resolvedFile, line, character);
66
-
67
- if (outcome.kind === "resolved") {
68
- return {
69
- kind: "resolved",
70
- target: outcome.target as ResolvedTarget,
71
- };
72
- }
73
-
74
- return outcome as TargetResolutionResult;
75
- }
76
-
77
- // ── File-level target group ───────────────────────────────────────────
78
-
79
- /**
80
- * Resolve a file-only request into a group of actionable targets.
81
- * Delegates to the new targeting pipeline with optional structural substrate.
82
- */
83
- export async function resolveFileTargetGroup(
84
- file: string,
85
- cwd: string,
86
- structural?: StructuralSubstrate,
87
- ): Promise<{ kind: "resolved"; group: ResolvedTargetGroup } | { kind: "error"; message: string }> {
88
- const outcome = await resolveFile(file, cwd, { structural });
89
- if (outcome.kind === "error") return outcome;
90
- return {
91
- kind: "resolved",
92
- group: outcome.group as ResolvedTargetGroup,
93
- };
94
- }
95
-
96
- // ── Symbol resolver ───────────────────────────────────────────────────
97
-
98
- /**
99
- * Resolve a target from symbol discovery — finds matching declarations.
100
- * Symbol discovery is semantic-only; it does not fall back to text search.
101
- */
102
- export async function resolveSymbolTarget(
103
- symbol: string,
104
- cwd: string,
105
- semantic: SemanticSubstrate,
106
- options?: {
107
- path?: string;
108
- kind?: string;
109
- exportedOnly?: boolean;
110
- },
111
- ): Promise<TargetResolutionResult> {
112
- const outcome = await resolveSymbol(symbol, cwd, semantic, options);
113
-
114
- if (outcome.kind === "resolved") {
115
- return {
116
- kind: "resolved",
117
- target: outcome.target as ResolvedTarget,
118
- };
119
- }
120
-
121
- return outcome as TargetResolutionResult;
122
- }
@@ -1,80 +0,0 @@
1
- /**
2
- * Anchored target resolution — resolves a file + position pair into a
3
- * typed target outcome using purely filesystem-level validation.
4
- *
5
- * This resolver does not require LSP or Tree-sitter. It validates
6
- * file existence, binary-file guards, and produces the necessary
7
- * position conversions for downstream semantic operations.
8
- */
9
-
10
- import * as fs from "node:fs";
11
- import * as path from "node:path";
12
-
13
- const BINARY_EXTENSIONS = new Set([
14
- ".png",
15
- ".jpg",
16
- ".jpeg",
17
- ".gif",
18
- ".webp",
19
- ".bmp",
20
- ".ico",
21
- ".woff",
22
- ".woff2",
23
- ".ttf",
24
- ".eot",
25
- ".zip",
26
- ".tar",
27
- ".gz",
28
- ".bz2",
29
- ".pdf",
30
- ".doc",
31
- ".docx",
32
- ".exe",
33
- ".dll",
34
- ".so",
35
- ".dylib",
36
- ".wasm",
37
- ".node",
38
- ]);
39
-
40
- function isBinaryFile(filePath: string): boolean {
41
- return BINARY_EXTENSIONS.has(path.extname(filePath).toLowerCase());
42
- }
43
-
44
- /**
45
- * Resolve an anchored target from file + position.
46
- *
47
- * @param file - absolute path to the file
48
- * @param line - 1-based line
49
- * @param character - 1-based character
50
- * @returns Typed outcome: resolved or error
51
- */
52
- export function resolveAnchoredTarget(
53
- file: string,
54
- line: number,
55
- character: number,
56
- ): import("./types.ts").TargetOutcome {
57
- if (!fs.existsSync(file)) {
58
- return { kind: "error", message: `File not found: \`${file}\`` };
59
- }
60
-
61
- if (isBinaryFile(file)) {
62
- return {
63
- kind: "error",
64
- message: `File type not supported for semantic analysis: \`${file}\`. Use \`code_pattern\` for explicit text search.`,
65
- };
66
- }
67
-
68
- return {
69
- kind: "resolved",
70
- target: {
71
- file,
72
- position: { line: line - 1, character: character - 1 },
73
- displayLine: line,
74
- displayCharacter: character,
75
- name: null,
76
- kind: null,
77
- confidence: "semantic",
78
- },
79
- };
80
- }
@@ -1,110 +0,0 @@
1
- /**
2
- * Symbol target resolution — discovers symbols via the semantic substrate
3
- * and returns typed outcomes (resolved, disambiguation, or error).
4
- *
5
- * This resolver is semantic-only: it does not fall back to text search
6
- * or heuristic guessing. Ambiguous matches produce explicit disambiguation.
7
- */
8
-
9
- import * as path from "node:path";
10
- import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
11
- import type { SemanticSubstrate } from "../substrates/types.ts";
12
- import type { DisambiguationCandidateData, TargetOutcome } from "./types.ts";
13
-
14
- const MAX_CANDIDATES = 8;
15
- const NON_EXPORTED_KINDS = new Set(["Variable", "Field", "Property"]);
16
-
17
- /**
18
- * Resolve a symbol via the semantic substrate.
19
- *
20
- * @param symbol - the symbol name to search for
21
- * @param cwd - session working directory
22
- * @param semantic - the semantic substrate (LSP-backed)
23
- * @param options - optional filters: path scope, kind filter, exported-only
24
- * @returns Typed outcome: resolved, disambiguation, or error
25
- */
26
- export async function resolveSymbolTarget(
27
- symbol: string,
28
- cwd: string,
29
- semantic: SemanticSubstrate,
30
- options?: {
31
- path?: string;
32
- kind?: string;
33
- exportedOnly?: boolean;
34
- },
35
- ): Promise<TargetOutcome> {
36
- const results = await semantic.workspaceSymbols(symbol);
37
- if (results === null) {
38
- return {
39
- kind: "error",
40
- message: `Symbol discovery for \`${symbol}\` requires active LSP. Use \`file\` + coordinates, or enable LSP and retry.`,
41
- };
42
- }
43
- if (results.length === 0) {
44
- return { kind: "error", message: `Symbol not found: \`${symbol}\`` };
45
- }
46
-
47
- // Filter by path scope
48
- const scopePath = options?.path ? path.resolve(cwd, options.path) : null;
49
- let candidates = results.filter((s) => {
50
- if (scopePath && !isWithinOrEqual(scopePath, s.file)) return false;
51
- return true;
52
- });
53
-
54
- // Filter by kind
55
- if (options?.kind) {
56
- const kindLower = options.kind.toLowerCase();
57
- candidates = candidates.filter((s) => s.kind.toLowerCase().includes(kindLower));
58
- }
59
-
60
- // Filter to exported symbols only
61
- if (options?.exportedOnly) {
62
- candidates = candidates.filter((s) => !NON_EXPORTED_KINDS.has(s.kind));
63
- }
64
-
65
- // Range-less candidates (line=0,char=0) come from URI-only workspace symbols.
66
- // Keep them for disambiguation but don't promote to single-match resolution.
67
- const ranged = candidates.filter((s) => s.line > 0 || s.character > 0);
68
-
69
- if (ranged.length === 1) {
70
- const c = ranged[0];
71
- return {
72
- kind: "resolved",
73
- target: {
74
- file: c.file,
75
- position: { line: c.line - 1, character: c.character - 1 },
76
- displayLine: c.line,
77
- displayCharacter: c.character,
78
- name: c.name,
79
- kind: c.kind,
80
- confidence: "semantic",
81
- },
82
- };
83
- }
84
-
85
- // All candidates lost or only rangeless
86
- if (candidates.length === 0) {
87
- return {
88
- kind: "error",
89
- message: `Symbol not found: \`${symbol}\`${scopePath ? ` in path \`${options?.path}\`` : ""}`,
90
- };
91
- }
92
-
93
- // Multiple candidates — return disambiguation
94
- const candidatesOut = candidates.slice(0, MAX_CANDIDATES).map((c, idx) => ({
95
- name: c.name,
96
- kind: c.kind,
97
- container: c.container ?? null,
98
- file: path.relative(cwd, c.file),
99
- line: c.line,
100
- character: c.character,
101
- reason: path.relative(cwd, c.file),
102
- rank: idx + 1,
103
- })) satisfies DisambiguationCandidateData[];
104
-
105
- return {
106
- kind: "disambiguation",
107
- candidates: candidatesOut,
108
- omittedCount: Math.max(0, candidates.length - MAX_CANDIDATES),
109
- };
110
- }
@@ -1,71 +0,0 @@
1
- import { routeFor } from "../planner/planner.ts";
2
- import type { CodeIntelResult } from "../types.ts";
3
- import { executeAffected } from "../use-case/generate-affected.ts";
4
- import { getCodeProvider } from "../workspace/request-context.ts";
5
- import { validateFocusedToolParams } from "./validation.ts";
6
-
7
- export interface CodeAffectedToolParams {
8
- file?: string;
9
- line?: number;
10
- character?: number;
11
- symbol?: string;
12
- exportedOnly?: boolean;
13
- maxResults?: number;
14
- }
15
-
16
- /** Execute the public code_affected tool through the affected use-case. */
17
- export async function executeAffectedTool(
18
- params: CodeAffectedToolParams,
19
- ctx: { cwd: string },
20
- ): Promise<CodeIntelResult> {
21
- const error = validateFocusedToolParams(params, ctx.cwd);
22
- if (error) {
23
- return { content: error, details: undefined };
24
- }
25
-
26
- // Semantic actions require file or symbol
27
- if (!params.file && !params.symbol) {
28
- return {
29
- content:
30
- "**Error:** Semantic actions require either anchored coordinates (`file`, `line`, `character`) or a `symbol` for discovery.",
31
- details: {
32
- type: "affected" as const,
33
- data: {
34
- confidence: "unavailable" as const,
35
- directCount: 0,
36
- downstreamCount: 0,
37
- riskLevel: "low" as const,
38
- checkNext: [],
39
- likelyTests: [],
40
- omittedCount: 0,
41
- nextQueries: ["Provide `file`, `line`, `character` or a `symbol` for discovery"],
42
- },
43
- },
44
- };
45
- }
46
-
47
- const route = routeFor(ctx.cwd, "code_affected");
48
- if (route.preferred === "unavailable") {
49
- return {
50
- content:
51
- "**Error:** No semantic analysis provider is available for this workspace. Use lsp_* tools directly if needed.",
52
- details: {
53
- type: "affected" as const,
54
- data: {
55
- confidence: "unavailable" as const,
56
- directCount: 0,
57
- downstreamCount: 0,
58
- riskLevel: "low" as const,
59
- checkNext: [],
60
- likelyTests: [],
61
- omittedCount: 0,
62
- nextQueries: ["Check LSP configuration for this workspace"],
63
- },
64
- },
65
- };
66
- }
67
-
68
- const providerState = getCodeProvider(ctx.cwd);
69
- const provider = providerState.kind === "ready" ? providerState.provider : null;
70
- return executeAffected(params, { cwd: ctx.cwd, provider });
71
- }
@@ -1,59 +0,0 @@
1
- import { buildArchitectureModel } from "../model.ts";
2
- import { routeFor } from "../planner/planner.ts";
3
- import type { CodeIntelResult } from "../types.ts";
4
- import { executeBrief } from "../use-case/generate-brief.ts";
5
- import type { BriefInput } from "../use-case/types.ts";
6
- import { getCodeProvider } from "../workspace/request-context.ts";
7
- import { validateFocusedToolParams } from "./validation.ts";
8
-
9
- export interface CodeBriefToolParams {
10
- path?: string;
11
- file?: string;
12
- line?: number;
13
- character?: number;
14
- symbol?: string;
15
- maxResults?: number;
16
- }
17
-
18
- /** Execute the public code_brief tool through the planner-backed use-case layers. */
19
- export async function executeBriefTool(
20
- params: CodeBriefToolParams,
21
- ctx: { cwd: string },
22
- ): Promise<CodeIntelResult> {
23
- const error = validateFocusedToolParams(params, ctx.cwd);
24
- if (error) {
25
- return { content: error, details: undefined };
26
- }
27
-
28
- const route = routeFor(ctx.cwd, "code_brief");
29
- const providerState = getCodeProvider(ctx.cwd);
30
- let provider = providerState.kind === "ready" ? providerState.provider : null;
31
-
32
- if (route.preferred === "unavailable") {
33
- // code_brief can still work with model-only data even without providers
34
- provider = null;
35
- }
36
- const model = await buildArchitectureModel(ctx.cwd);
37
-
38
- const input: BriefInput = determineInput(params);
39
- const deps = { model, provider, cwd: ctx.cwd };
40
-
41
- const result = await executeBrief(input, deps);
42
- return { content: result.content, details: { type: "brief", data: result.details } };
43
- }
44
-
45
- function determineInput(params: CodeBriefToolParams): BriefInput {
46
- if (params.file && params.line != null && params.character != null) {
47
- return { kind: "anchored", file: params.file, line: params.line, character: params.character };
48
- }
49
- if (params.symbol) {
50
- return { kind: "symbol", symbol: params.symbol, path: params.path };
51
- }
52
- if (params.path) {
53
- return { kind: "path", path: params.path };
54
- }
55
- if (params.file) {
56
- return { kind: "file", file: params.file };
57
- }
58
- return { kind: "project" };
59
- }
@@ -1,35 +0,0 @@
1
- import * as fs from "node:fs";
2
- import { renderMap } from "../presentation/markdown/map.ts";
3
- import { normalizePath } from "../search-helpers.ts";
4
- import type { CodeIntelResult } from "../types.ts";
5
- import { buildMapData } from "../use-case/generate-map.ts";
6
-
7
- export interface CodeMapToolParams {
8
- path?: string;
9
- }
10
-
11
- /** Execute the public code_map tool with focused directory validation. */
12
- export async function executeMapTool(
13
- params: CodeMapToolParams,
14
- ctx: { cwd: string },
15
- ): Promise<CodeIntelResult> {
16
- const scopePath = params.path ? normalizePath(params.path, ctx.cwd) : ctx.cwd;
17
-
18
- if (!fs.existsSync(scopePath)) {
19
- return {
20
- content: `**Error:** code_map path not found: \`${params.path ?? scopePath}\``,
21
- details: undefined,
22
- };
23
- }
24
-
25
- if (!fs.statSync(scopePath).isDirectory()) {
26
- return {
27
- content: "**Error:** code_map requires a directory path, not a file.",
28
- details: undefined,
29
- };
30
- }
31
-
32
- const data = buildMapData(scopePath, ctx.cwd);
33
- const rendered = renderMap(data);
34
- return { content: rendered.content, details: { type: "map", data: rendered.details } };
35
- }
@@ -1,29 +0,0 @@
1
- import type { CodeIntelResult } from "../types.ts";
2
- import { executePattern } from "../use-case/generate-pattern.ts";
3
- import { getCodeProvider } from "../workspace/request-context.ts";
4
- import { validatePatternToolParams } from "./validation.ts";
5
-
6
- export interface CodePatternToolParams {
7
- path?: string;
8
- pattern: string;
9
- regex?: boolean;
10
- kind?: string;
11
- maxResults?: number;
12
- contextLines?: number;
13
- summary?: boolean;
14
- }
15
-
16
- /** Execute the public code_pattern tool through the pattern use-case. */
17
- export async function executePatternTool(
18
- params: CodePatternToolParams,
19
- ctx: { cwd: string },
20
- ): Promise<CodeIntelResult> {
21
- const error = validatePatternToolParams(params, ctx.cwd);
22
- if (error) {
23
- return { content: error, details: undefined };
24
- }
25
-
26
- const providerState = getCodeProvider(ctx.cwd);
27
- const provider = providerState.kind === "ready" ? providerState.provider : null;
28
- return executePattern(params, { cwd: ctx.cwd, provider });
29
- }
@@ -1,101 +0,0 @@
1
- /**
2
- * code_refactor tool execution.
3
- *
4
- * Routes through the planner to get the refactor-capable semantic provider,
5
- * calls rename/codeActions, validates the returned edit, applies it,
6
- * and returns the result.
7
- */
8
-
9
- import { getDefaultWorkspaceRuntime } from "@mrclrchtr/supi-code-runtime/api";
10
- import { toLspPosition } from "@mrclrchtr/supi-lsp/api";
11
- import { routeFor } from "../planner/planner.ts";
12
- import { renderRefactorResult } from "../presentation/markdown/refactor.ts";
13
- import { applyWorkspaceEdit } from "../refactor/apply-workspace-edit.ts";
14
- import { validateEdit } from "../refactor/safety.ts";
15
- import { normalizePath } from "../search-helpers.ts";
16
- import type { CodeIntelResult } from "../types.ts";
17
-
18
- export interface CodeRefactorToolParams {
19
- operation: "rename";
20
- file: string;
21
- line: number;
22
- character: number;
23
- newName: string;
24
- // Future: "code-action" operation could be added here
25
- }
26
-
27
- /**
28
- * Execute the code_refactor tool.
29
- */
30
- export async function executeRefactorTool(
31
- params: CodeRefactorToolParams,
32
- ctx: { cwd: string },
33
- ): Promise<CodeIntelResult> {
34
- const route = routeFor(ctx.cwd, "code_refactor");
35
- if (route.preferred === "unavailable") {
36
- return {
37
- content:
38
- "**Error:** No refactor-capable provider is available for this workspace. Ensure an LSP server is configured and running.",
39
- details: undefined,
40
- };
41
- }
42
-
43
- const runtime = getDefaultWorkspaceRuntime();
44
- const ws = runtime.getWorkspace(ctx.cwd);
45
- const provider = ws.semantic.provider;
46
-
47
- if (!provider?.rename) {
48
- return {
49
- content: "**Error:** The active semantic provider does not support rename operations.",
50
- details: undefined,
51
- };
52
- }
53
-
54
- const resolvedFile = normalizePath(params.file, ctx.cwd);
55
-
56
- // Execute the rename operation with 0-based LSP coordinates
57
- const refactorResult = await provider.rename(
58
- resolvedFile,
59
- toLspPosition(params.line, params.character),
60
- params.newName,
61
- );
62
-
63
- if (refactorResult.kind === "unavailable") {
64
- return {
65
- content: `**Refactor unavailable:** ${refactorResult.reason}`,
66
- details: undefined,
67
- };
68
- }
69
-
70
- if (refactorResult.kind === "ambiguous") {
71
- const candidates = refactorResult.candidates
72
- .map((c, i) => {
73
- const location = c.file ? `${c.file}${c.line != null ? `:${c.line}` : ""}` : "";
74
- return `${i + 1}. ${c.description}${location ? ` (${location})` : ""}`;
75
- })
76
- .join("\n");
77
- return {
78
- content: `**Refactor ambiguous:** Multiple matching targets found. Please disambiguate:\n${candidates}`,
79
- details: undefined,
80
- };
81
- }
82
-
83
- // Validate the edit
84
- const validation = validateEdit(refactorResult.edits);
85
- if (!validation.safe) {
86
- return {
87
- content: `**Refactor safety check failed:** ${validation.reason}`,
88
- details: undefined,
89
- };
90
- }
91
-
92
- // Apply the edit
93
- const applyResult = applyWorkspaceEdit(refactorResult.edits);
94
- const content = renderRefactorResult({
95
- result: applyResult,
96
- operation: `rename "${params.newName}"`,
97
- targetDescription: `${resolvedFile}:${params.line}:${params.character}`,
98
- });
99
-
100
- return { content, details: undefined };
101
- }
@@ -1,79 +0,0 @@
1
- import { routeFor } from "../planner/planner.ts";
2
- import type { CodeIntelResult } from "../types.ts";
3
- import type { RelationsInput } from "../use-case/generate-relations.ts";
4
- import { executeRelations } from "../use-case/generate-relations.ts";
5
- import { getCodeProvider } from "../workspace/request-context.ts";
6
- import type { CodeRelationsKind } from "./tool-specs.ts";
7
- import { validateFocusedToolParams } from "./validation.ts";
8
-
9
- export interface CodeRelationsToolParams {
10
- kind: CodeRelationsKind;
11
- path?: string;
12
- file?: string;
13
- line?: number;
14
- character?: number;
15
- symbol?: string;
16
- exportedOnly?: boolean;
17
- maxResults?: number;
18
- }
19
-
20
- /** Execute the public code_relations tool through the planner-backed routing. */
21
- export async function executeRelationsTool(
22
- params: CodeRelationsToolParams,
23
- ctx: { cwd: string },
24
- ): Promise<CodeIntelResult> {
25
- const error = validateFocusedToolParams(params, ctx.cwd);
26
- if (error) {
27
- return { content: error, details: undefined };
28
- }
29
-
30
- // Semantic actions (callers, implementations) or structural (callees) require file or symbol
31
- if (!params.file && !params.symbol) {
32
- return {
33
- content:
34
- "**Error:** Relations require either anchored coordinates (`file`, `line`, `character`) or a `symbol` for discovery.",
35
- details: {
36
- type: "search" as const,
37
- data: {
38
- confidence: "unavailable" as const,
39
- scope: params.path ?? null,
40
- candidateCount: 0,
41
- omittedCount: 0,
42
- nextQueries: ["Provide `file`, `line`, `character` or a `symbol` for discovery"],
43
- },
44
- },
45
- };
46
- }
47
-
48
- const route = routeFor(ctx.cwd, "code_relations", params.kind);
49
- if (route.preferred === "unavailable") {
50
- return {
51
- content: `**Error:** No ${params.kind === "callees" ? "structural" : "semantic"} analysis provider is available for this workspace. Use tree_sitter_callees or lsp_* tools directly if needed.`,
52
- details: {
53
- type: "search" as const,
54
- data: {
55
- confidence: "unavailable" as const,
56
- scope: null,
57
- candidateCount: 0,
58
- omittedCount: 0,
59
- nextQueries: ["Check LSP and tree-sitter configuration"],
60
- },
61
- },
62
- };
63
- }
64
-
65
- const input: RelationsInput = {
66
- kind: params.kind,
67
- path: params.path,
68
- file: params.file,
69
- line: params.line,
70
- character: params.character,
71
- symbol: params.symbol,
72
- exportedOnly: params.exportedOnly,
73
- maxResults: params.maxResults,
74
- };
75
-
76
- const providerState = getCodeProvider(ctx.cwd);
77
- const provider = providerState.kind === "ready" ? providerState.provider : null;
78
- return executeRelations(input, { cwd: ctx.cwd, provider });
79
- }