@mrclrchtr/supi-code-intelligence 1.16.1 → 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 (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
package/README.md CHANGED
@@ -28,90 +28,404 @@ pi install ./packages/supi-code-intelligence
28
28
 
29
29
  After install, pi gets:
30
30
 
31
- - `code_brief` — interpretive orientation for a project, package, directory, file, or symbol
32
- - `code_map` — factual repo/package/directory inventory
33
- - `code_relations` — callers, callees, or implementations for a resolved target
34
- - `code_affected` — blast radius, downstream impact, and risk for a target
35
- - `code_pattern` — explicit literal, regex, or structured search
36
- - `code_refactor` — direct-apply semantic rename with safety gates
31
+ - `code_orientation` — first-pass orientation for projects, discovered modules, directories, files, or precise symbols (`code_brief` and the old `code_context` surface have been replaced)
32
+ - `code_inspect` — factual point inspection for one precise file position
33
+ - `code_graph` — unified relation graph (references, callees, imports, exports, implementations, tests) from a resolved target
34
+ - `code_impact` — preferred workflow-oriented blast radius, downstream impact, and user-supplied change-set analysis
35
+ - `code_find` — unified ranked search (text, regex, AST, semantic)
36
+ - `code_health` — diagnostics, server status, dirty workspace, coverage, and unused-code health signals
37
+ - `code_refactor_plan` — pure planner; preview an operation-aware semantic refactor plan without mutating files
38
+ - `code_refactor_apply` — sole mutator; apply a previously stored, validated plan by `planId`
39
+ - `code_resolve` — resolve human/code references into precise targets with stable target handles for follow-up calls
37
40
  - a lightweight hidden architecture overview injected near the start of a session when a project model can be built
38
- - **all `lsp_*` expert tools** from `@mrclrchtr/supi-lsp` (hover, definition, references, implementation, diagnostics, rename, code actions, recover, document/workspace symbols)
39
- - **all `tree_sitter_*` expert tools** from `@mrclrchtr/supi-tree-sitter` (outline, imports, exports, node-at, query, callees)
40
41
  - bundled support from `@mrclrchtr/supi-lsp`, `@mrclrchtr/supi-tree-sitter`, and `@mrclrchtr/supi-core`
41
42
 
42
- Installing `@mrclrchtr/supi-code-intelligence` activates all three tool families. Each family is owned and documented by its own package:
43
+ ## Coming from standard tools?
44
+
45
+ | Standard approach | `code_*` equivalent |
46
+ |---|---|
47
+ | `rg "symbol" --type ts` | `code_resolve(query="symbol")` → `code_graph(targetId, relations=["references"])` |
48
+ | `read` + manual symbol tracing | `code_inspect(file, line, character)` for point facts, then `read` the suggested source range |
49
+ | manual dependency/reference tracing | `code_graph(targetId, relations=["references", "callees", "tests"])` |
50
+ | `git status` + diagnostics commands | `code_health(refresh=true, include=["diagnostics", "servers", "dirty"])` |
51
+ | `rg` + counting + intuition | `code_impact(targetId, change="...")` or `code_impact(changeSetFiles=[...])` |
52
+ | `rg` for defs/imports/exports | `code_find(mode="ast", kind="definition")` |
53
+ | Multi-file find-and-replace | `code_refactor_plan` → review → `code_refactor_apply` |
54
+ | `ls` + `read` to explore a package | `code_orientation(focus="packages/...")`, then inspect identified entrypoints |
55
+ | `rg "symbolName"` (ambiguous) | `code_resolve(query="symbolName")` |
56
+
57
+ > 💡 **Key insight:** `code_resolve` → `targetId` → `code_graph`/`code_orientation`/`code_impact` is the core chained workflow. `code_*` tools summarize and prioritize; use `read` on the suggested ranges before editing.
58
+
59
+ ## Standard-tools cookbook
60
+
61
+ ### Find references to a symbol
62
+
63
+ Standard:
64
+ ```bash
65
+ rg -n "myFunction" packages/my-package
66
+ ```
67
+ Then manually separate declarations, docs, imports, and actual symbol uses.
68
+
69
+ Code intelligence:
70
+ ```text
71
+ code_resolve(query="myFunction", scope="packages/my-package") → targetId
72
+ code_graph(targetId, relations=["references", "tests"])
73
+ ```
74
+ Use the `Read Next` section to inspect the resolved target or top reference sites.
75
+
76
+ ### Understand a package or module
77
+
78
+ Standard:
79
+ ```bash
80
+ find packages/my-package -maxdepth 3 -type f
81
+ cat packages/my-package/package.json
82
+ ```
83
+ Then read likely entrypoints by hand.
84
+
85
+ Code intelligence:
86
+ ```text
87
+ code_orientation(focus="packages/my-package")
88
+ code_orientation(focus="packages/my-package/src/tool")
89
+ code_orientation(focus="packages/my-package/src/tool/health/execute.ts")
90
+ ```
91
+ Orientation briefs are summaries, not source replacement; read the files before editing.
92
+
93
+ ### Estimate impact before a change
94
+
95
+ Standard: run `rg`, inspect consumers, infer test files, and decide risk manually.
96
+
97
+ Code intelligence:
98
+ ```text
99
+ code_resolve(query="myFunction") → targetId
100
+ code_impact(targetId, change="change output formatting", includeTests=true)
101
+ ```
102
+ For already-known files, use `code_impact(changeSetFiles=["packages/.../file.ts"], includeTests=true)`.
103
+
104
+ ### Check health quickly
105
+
106
+ Standard: combine editor diagnostics, `git status`, coverage files, and project commands.
107
+
108
+ Code intelligence:
109
+ ```text
110
+ code_health(refresh=true, include=["diagnostics", "servers", "dirty"])
111
+ code_health(include=["coverage", "unused"])
112
+ ```
113
+ `code_health` is a quick status surface; it does not replace the project's required verification commands after edits.
114
+
115
+ ## Quick start — three most common workflows
116
+
117
+ ### Find references and trace usage
118
+ ```
119
+ code_resolve(query="myFunction") → capture targetId
120
+ code_graph(targetId, relations=["references"]) → inspect usage
121
+ code_orientation(targetId) → orient around the symbol
122
+ ```
123
+
124
+ ### Understand a package before editing
125
+ ```
126
+ code_orientation(focus="packages/my-package") → package orientation
127
+ code_orientation(focus="packages/my-package/src/tool") → directory drill-down
128
+ code_health(scope="packages/my-package", refresh=true) → check diagnostics
129
+ ```
130
+
131
+ ### Safe rename refactoring
132
+ ```
133
+ code_resolve(query="oldName") → capture targetId
134
+ code_impact(targetId, change="rename to newName") → estimate blast radius
135
+ code_refactor_plan(targetId, operation="rename_symbol", newName="newName") → preview
136
+ code_refactor_apply(planId) → apply
137
+ ```
138
+
139
+ ## ⚠️ `targetId` lifecycle — essential for chained workflows
140
+
141
+ > 💡 **Every chained workflow — references, impact, refactoring — flows through `targetId`. Spend 30 seconds here.**
142
+
143
+ `targetId` handles are the backbone of the chained workflow:
144
+
145
+ - **Session-scoped** — handles live only within the current agent session. A new session resolves targets fresh.
146
+ - **Fingerprint-gated** — when the backing file is modified, the stored fingerprint no longer matches and the handle becomes stale. Re-run `code_resolve` to obtain a fresh handle.
147
+ - **Content-hash based** — `targetId`s are derived from the symbol's name, kind, container, and file fingerprint (position is excluded). Re-resolving the same symbol across reloads produces the same ID.
148
+ - **No cross-session persistence** — `planId` handles follow the same lifecycle.
149
+
150
+ ```text
151
+ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐
152
+ │ code_resolve │ ──→ │ targetId │ ──→ │ code_graph │
153
+ │ │ │ (stable) │ │ code_orientation│
154
+ └─────────────┘ └──────────────┘ │ code_impact │
155
+ ↑ │ └─────────────┘
156
+ │ re-resolve │ stale after
157
+ └───────────────────┘ file edit
158
+ ```
159
+
160
+ ## When each tool won't help you
161
+
162
+ - **No silent fallback:** non-search tools do not silently turn semantic requests into grep. If the required provider is unavailable, results say so or the tool errors.
163
+ - **LSP warmup/provider gaps:** `code_resolve` symbol queries, semantic `code_find`, references, implementations, impact, and refactor planning need an active semantic/LSP provider. Retry after warmup or check `code_health`.
164
+ - **Tree-sitter/structural gaps:** AST `code_find`, callees, imports, exports, outlines, and structural test-label extraction need the structural provider.
165
+ - **`code_graph` callees** — won't find calls inside nested functions, callbacks, or method bodies unless `calleeDepth: "deep"` is requested. Callees are structural source-shape evidence, not symbol identity.
166
+ - **`code_find` semantic mode** — fails when no LSP provider is active. It does not fall back to text search — use `mode: "text"` explicitly.
167
+ - **`code_refactor_plan`** — requires LSP precise edit support. When the LSP can't produce semantic edits for the target, the tool throws — there is no text fallback.
168
+ - **`code_health` coverage/unused** — depends on `coverage/coverage-summary.json` and `knip.json` at the project root. Use `coveragePath` and `unusedPath` params for non-standard locations.
169
+ - **`code_impact`** — `change`-only requests (no target, no changeSetFiles) return insufficient-evidence instead of guessing.
170
+ - **`code_find` AST test mode** — `mode: "ast"` with `kind: "test"` matches outline entries with test-like names. Does not find test blocks within untest-like wrapper functions.
171
+
172
+ Installing `@mrclrchtr/supi-code-intelligence` activates only the public `code_*` tool surface. `@mrclrchtr/supi-lsp` and `@mrclrchtr/supi-tree-sitter` remain bundled library substrates that power the semantic and structural parts of that surface. Historical compatibility aliases are not registered as public tools.
173
+
174
+ ## Startup performance
175
+
176
+ LSP language servers start automatically on session open. By default, every server with matching source files in the project is started **concurrently** — in polyglot repos or monorepos with multiple language footprints, this parallel startup can cause a significant CPU spike.
177
+
178
+ **If you experience high CPU on startup:**
179
+
180
+ **Disable specific language servers** you don't need by adding per-language opt-outs to your config:
181
+
182
+ ```json
183
+ {
184
+ "lsp": {
185
+ "servers": {
186
+ "python": { "enabled": false },
187
+ "rust": { "enabled": false }
188
+ }
189
+ }
190
+ }
191
+ ```
192
+
193
+ Add this to `.pi/supi/config.json` (project) or `~/.pi/agent/supi/config.json` (global). Only the listed language servers are excluded; all others start normally.
194
+
195
+ > **Note:** The global `lsp.enabled` switch and `lsp.active` allowlist are deprecated and ignored since v0.7.0. LSP now always attempts to start detected servers. If your config still has `lsp.enabled` or `lsp.active` keys, a one-time deprecation warning will appear at session start, but the keys have no runtime effect.
196
+
197
+ ### Degraded coverage warnings
198
+
199
+ When the code-intelligence stack cannot provide full coverage for a workspace, you will see:
200
+
201
+ - **Deprecated key warnings** — if `lsp.enabled` or `lsp.active` are present in your config (ignored keys)
202
+ - **Language-scoped semantic warnings** — when a detected language's LSP server binary is missing from PATH, or has been explicitly disabled via `lsp.servers.<language>.enabled: false`
203
+ - **Structural warnings** — when Tree-sitter initialization fails (structural coverage unavailable)
204
+
205
+ These warnings appear once near session start and are also visible in:
206
+ - `/supi-ci-status` — the interactive overlay
207
+ - `code_health` — the health check tool
208
+
209
+ ## V2 workflow roadmap
210
+
211
+ The workflow-oriented surface is rolling out incrementally.
212
+
213
+ The current public surface now includes:
214
+
215
+ - `code_resolve` — **active** (Phase 1)
216
+ - `code_inspect` — **active** (explicit point inspection tool)
217
+ - `code_orientation` — **active** (orientation surface; replaces `code_brief` and old `code_context`)
218
+ - `code_find` — **active** (Phase 2a, supersedes code_pattern)
219
+ - `code_health` — **active** (Phase 1.5)
220
+ - `code_graph` — **active** (Phase 3, supersedes code_references/code_calls/code_implementations)
221
+ - `code_impact` — **active** (Phase 4, preferred workflow impact tool)
222
+ - `code_refactor_plan` — **active** (Phase 5, pure refactor planner)
223
+ - `code_refactor_apply` — **active** (Phase 5, refactor plan applier)
224
+
225
+ The design source of truth lives in `src/tool/` with types, schemas, and metadata.
43
226
 
44
227
  This package is for questions like:
45
228
 
46
229
  - what is in this package or directory?
47
- - who calls this symbol?
230
+ - where is this symbol referenced?
48
231
  - what does this function call?
232
+ - what are the implementations of this interface?
49
233
  - what is the likely blast radius of a change?
50
234
  - where is this pattern defined, imported, or exported?
51
235
 
52
- - `@mrclrchtr/supi-lsp` owns the semantic `lsp_*` tools
53
- - `@mrclrchtr/supi-tree-sitter` owns the structural `tree_sitter_*` tools
54
- - `@mrclrchtr/supi-code-intelligence` owns the analysis `code_*` tools and provides cross-family orchestration guidance
236
+ - `@mrclrchtr/supi-lsp` provides the semantic library substrate used by the public `code_*` tools
237
+ - `@mrclrchtr/supi-tree-sitter` provides the structural library substrate used by the public `code_*` tools
238
+ - `@mrclrchtr/supi-code-intelligence` owns the public `code_*` tool surface and the orchestration layer above those substrates
55
239
 
56
- ## Tool overview
240
+ ## Workflow cookbook
57
241
 
58
- ### `code_brief`
59
- Interpretive orientation. Use for prioritized context, start-here guidance, and project/package/directory/file/symbol overview.
242
+ ### Trace a symbol and prepare a change
60
243
 
61
- ### `code_map`
62
- Strictly factual inventory. Accepts the repo root, a package root, or **any directory path**. Rejects file paths.
244
+ 1. `code_resolve(query="executeHealthTool")` → capture `targetId`
245
+ 2. `code_graph(targetId, relations=["references", "callees", "tests"])` inspect usage
246
+ 3. `code_impact(targetId, change="add coverage unused section")` → estimate blast radius
247
+ 4. `code_orientation(targetId)` → orient around definitions, docs, and local diagnostics
248
+ 5. Edit files, then `code_health(scope="packages/...", refresh=true)` → verify diagnostics
63
249
 
64
- ### `code_relations`
65
- Relationship tracing tool with:
66
- - `kind: "callers"`
67
- - `kind: "callees"`
68
- - `kind: "implementations"`
250
+ ### Context from a known source location (one call)
69
251
 
70
- `callers` and `implementations` are semantic-only. `callees` is structural-only.
252
+ When you already know the file and identifier coordinate, skip the separate `code_resolve` turn and pass coordinates directly to `code_orientation`:
71
253
 
72
- ### `code_affected`
73
- Semantic blast-radius analysis for a concrete target. This tool no longer falls back to grep-style guesses.
254
+ 1. `code_orientation(focus="packages/.../execute-health.ts", line=42, character=17)` → resolves the target, renders the sections, and returns a reusable `targetId`
255
+ 2. `code_graph(targetId, relations=["references"])` follow up using the `targetId` from step 1
74
256
 
75
- ### `code_pattern`
76
- Explicit search tool for:
77
- - literal search
78
- - regex search (`regex: true`)
79
- - structured search (`kind: "definition" | "export" | "import"`)
257
+ ### Understand a package before editing
80
258
 
81
- This is the only tool in the family that intentionally returns heuristic/text-search results.
259
+ 1. `code_orientation(focus="packages/supi-code-intelligence")` package orientation
260
+ 2. `code_orientation(focus="packages/supi-code-intelligence/src/tool")` → directory drill-down
261
+ 3. `code_orientation(focus="packages/.../execute-graph.ts")` → file overview
262
+
263
+ ### Safe refactoring
264
+
265
+ 1. `code_resolve(query="oldFunctionName")` → capture `targetId`
266
+ 2. `code_graph(targetId, relations=["references"])` → confirm scope
267
+ 3. `code_refactor_plan(targetId, operation="rename_symbol", newName="newFunctionName")` → preview plan
268
+ 4. `code_refactor_apply(planId)` → apply after reviewing the plan
269
+
270
+ ## Tool overview
271
+
272
+ ### `code_orientation`
273
+ Primary orientation surface for understanding where you are before choosing surgical tools.
274
+
275
+ - accepts `focus`, `targetId`, `line`, `character`, and `maxResults`
276
+ - omit `focus` for project orientation
277
+ - `focus` is path-first and language-agnostic; if no path exists, discovered module-name lookup is attempted
278
+ - `focus` + `line` + `character` resolves a real symbol target through the same provider-backed path as `code_resolve` and exposes a reusable `targetId`
279
+ - `targetId` takes precedence over `focus`/coordinates; stale target IDs error and do not fall back
280
+ - symbol orientation renders definitions, JSDoc/TSDoc docs, local diagnostics near the target, and Read Next guidance
281
+ - use `code_graph` for references/callees/imports/exports/tests, `code_impact` for blast radius, and `code_health` for full health/status
282
+ - `maxResults` defaults to 10 and caps each rendered list independently
283
+ - `code_orientation` replaces `code_brief` and the old `code_context` public surface; there is no compatibility alias
284
+
285
+ ### `code_inspect`
286
+ Factual point-inspection tool for one precise file position.
287
+
288
+ - requires `file`, `line`, and `character`
289
+ - returns best-effort syntax, enclosing symbol, hover/type info, definition target(s), nearby diagnostics, and code-action titles
290
+ - stays honest when providers are missing by rendering explicit unavailable sections instead of heuristic guesses
291
+ - keeps diagnostics summary/refresh on `code_health`; `code_inspect` only reports local facts near the inspected point
292
+
293
+ ### `code_graph`
294
+ Unified relation-graph tool. Replaces `code_references`, `code_calls`, and `code_implementations`. Resolves one target and dispatches to the appropriate substrate per requested relation.
295
+
296
+ - **targetId** (preferred from `code_resolve`) or file+line+character or symbol
297
+ - **relations**: `["all", "references", "callees", "imports", "exports", "implements", "tests"]` — default `["references"]`; use `["all"]` for the full graph in one call
298
+ - Each relation is best-effort: unavailable substrates skip with a note rather than failing the call
299
+ - **Each relation annotates its evidence source** in the output. For the `tests` relation, provenance describes **file discovery only** — `semantic+conventions` means semantic references contributed, `conventions-only` means only deterministic path/layout conventions contributed.
300
+ - `callees` reports **structural outgoing calls** from the enclosing executable scope at the target anchor. It matches call expressions by source shape, not symbol identity. By default (`calleeDepth: "direct"`), calls inside nested function/method/callback scopes are excluded. Pass `calleeDepth: "deep"` to include all callees within the enclosing scope, including those inside nested scopes.
301
+ - Test-producing surfaces also include a small structured tests metadata shape in tool details: discovery status/provenance plus per-file label status and extracted labels.
302
+ - Targeted graph results include a `Read Next` guidance section for the resolved target, enclosing scope, or top relation sites when those source ranges are known.
303
+ - `imports` and `exports` use file-level tree-sitter analysis; `tests` discovers companion tests using semantic import/reference evidence plus deterministic package-layout conventions (`__tests__/unit/…`, `__tests__/integration/…`)
304
+ - Test-label extraction is tracked separately from discovery provenance. When a discovered test file has no recognized `describe` / `it` / `test` / `spec` blocks, user-facing output shows `_(no recognized test blocks)_` intentionally instead of helper or variable names.
305
+ - Bounded package/tool-aware candidates are generated for source files at `src/tool/<name>/execute.ts`. Exact candidates such as `code-<name>-tool.test.ts`, `<name>-tool.test.ts`, and `execute-<name>.test.ts` are checked in both `__tests__/unit/` and `__tests__/integration/`. No broad search, fuzzy matching, or AI guessing is performed.
306
+
307
+ ### `code_impact`
308
+ Preferred workflow-oriented impact analysis.
309
+
310
+ - supports target-based analysis through a `targetId` from `code_resolve`
311
+ - supports change-set entry points through `changeSetFiles` and explicit `includeTests`
312
+ - `includeTests` uses the same shared test discovery as `code_graph` (import/reference evidence plus package-layout conventions)
313
+ - **Target-based analysis** uses semantic references and fails explicitly when no LSP provider is available
314
+ - **changeSetFiles analysis** uses structural evidence by default and, when LSP/export data is available, merges semantic references for symbols defined in change-set files. `changeSetFiles` is user-supplied; it is not inferred from git and carries no line-level diff evidence. Evidence is annotated as either `**Evidence: structural**` or `**Evidence: semantic+structural**`.
315
+ - **test list annotations** — when likely tests are shown, impact headings annotate discovery provenance explicitly (`Likely Tests (semantic+conventions)` or `Likely Tests (conventions-only)`)
316
+ - **explicit empty-test note** — when `includeTests: true` is set and bounded companion/package discovery completes without finding any test files, an explicit `No likely tests found by bounded companion/package discovery.` note appears instead of silently omitting test information. This note is not shown when `includeTests` is omitted or unavailable.
317
+ - **target-based analysis seeds the target file itself** — zero-reference targets still report affected evidence and likely tests
318
+ - target and change-set impact results include a `Read Next` guidance section for source ranges worth inspecting before editing
319
+ - when the workspace clearly uses Vitest, likely test files also come with concrete `pnpm vitest run … --reporter=verbose` commands
320
+ - `change`-only requests stay honest and return an explicit insufficient-evidence result instead of heuristic guessing
321
+ - uses real workspace/provider evidence only; no heuristic grep fallback
322
+
323
+ ### `code_find`
324
+ Unified ranked search tool with a strict evidence contract.
325
+
326
+ - omitted `mode` or `mode: "text"` → literal text search; `kind` is not accepted
327
+ - `mode: "regex"` → ripgrep regex search; `kind` is not accepted
328
+ - `mode: "semantic"` → LSP workspace symbol search; `kind` is not accepted and semantic mode does not fall back to text search
329
+ - `mode: "ast"` → tree-sitter structured search; requires explicit `kind`
330
+ - supported AST kinds: `definition`, `import`, `export`, `call`, `type`, `interface`, `class`, `method`, `enum`, `test`
331
+ - AST `call` mode matches call-site identifiers by name, not by symbol identity; use `code_graph` with `relations: ["references"]` on a resolved target for identity-aware callers
332
+ - unsupported mode/kind combinations fail explicitly instead of being broadened into best-effort search
333
+
334
+ Supports `query` (required), `scope`, `mode`, `kind`, `contextLines`, and `maxResults`.
335
+
336
+ ### `code_health`
337
+ Health/status summary for the current workspace or a scoped path.
338
+
339
+ - defaults to diagnostics + servers when `include` is omitted
340
+ - `include` can request `diagnostics`, `servers`, `dirty`, `coverage`, and `unused`
341
+ - `coverage` reads `coverage/coverage-summary.json` when present and reports low-coverage files
342
+ - `unused` reads `knip.json` when present and reports unused files/exports
343
+ - when a requested coverage/unused report is missing, the result says so explicitly instead of silently falling back to diagnostics
344
+
345
+ ### `code_refactor_plan`
346
+ Pure refactor planner.
347
+
348
+ - previews a precise semantic refactor plan without mutating files
349
+ - returns a `planId` for follow-up `code_refactor_apply`
350
+ - uses the workflow schema (`operation`, target/file coords, optional selected `range`, and operation-specific fields)
351
+ - legacy `operation: "rename"` is accepted as a compatibility alias for `rename_symbol`
352
+ - extract operations require a 1-based `range`, `newName`, and an LSP code action that returns precise text edits
353
+
354
+ Supported operations:
355
+ - `rename_symbol`
356
+ - `extract_function`
357
+ - `extract_variable`
358
+
359
+ Notes:
360
+ - only precise semantic text edits become plans
361
+ - `targetId` from `code_resolve` can replace raw file + line + character targeting
362
+ - this tool never mutates files
363
+
364
+ ### `code_refactor_apply`
365
+ Sole mutator in the refactor workflow.
366
+
367
+ - applies a previously stored plan by `planId`
368
+ - rejects stale plans using file fingerprints and re-validates ranges/overlap before mutation
369
+ - this is the only tool in the refactor workflow that writes files
370
+
371
+ ## Internal compatibility paths
372
+
373
+ The `code_affected` tool has been fully removed. Use `code_impact` exclusively.
82
374
 
83
375
  ## Shared input conventions
84
376
 
85
377
  Depending on the tool, inputs may include:
86
- - `path`
378
+ - `scope`
87
379
  - `file`
88
380
  - `line`
89
381
  - `character`
382
+ - `query`
90
383
  - `symbol`
91
384
  - `kind`
92
- - `pattern`
93
- - `regex`
94
- - `exportedOnly`
385
+ - `targetId`
386
+ - `changeSetFiles`
387
+ - `includeTests`
95
388
  - `maxResults`
96
389
  - `contextLines`
97
- - `summary`
98
390
 
99
391
  Notes:
100
392
  - line and character positions are **1-based**
101
- - `line` and `character` require `file`, not `path`
102
- - a leading `@` is stripped from `path` and `file`
393
+ - `line` and `character` require `file`, not `scope`
394
+ - `code_inspect` is the public point-inspection tool for `file` + `line` + `character`
395
+ - `targetId` (from `code_resolve`) can replace raw coordinates in `code_orientation`, `code_graph`, and `code_refactor_plan`; it is the only public target selector for `code_impact`. In `code_orientation`, `targetId` takes precedence over `focus`/`line`/`character`; a stale/invalid `targetId` errors and does not fall back to coordinates.
396
+ - `code_orientation` accepts `focus` + `line` + `character` directly as a coordinate target mode: it resolves a real symbol target through the same provider-backed path as `code_resolve` and exposes a reusable `targetId`. Coordinate mode requires all three fields when any is present; `focus` must be a file path and partial coordinates are a validation error.
397
+ - `focus` is the selection input for `code_orientation`; other tools keep `scope` for narrowing/filtering.
398
+ - `focus`, `scope`, and `file` use pi-style paths where applicable: a leading `@` is stripped and relative paths resolve from the current cwd
103
399
  - non-search tools do **not** silently fall back to heuristic grep behavior
104
400
 
401
+ ### `code_resolve` anchored coordinate resolution
402
+
403
+ `code_resolve({ file, line, character })` resolves a **real symbol target** from provider-backed evidence, not an anonymous point target:
404
+
405
+ - an exact coordinate on a symbol identifier resolves to a named `name` anchor with a stable `targetId`.
406
+ - a coordinate on a declaration header/modifier (such as an `export` keyword) snaps to the symbol's name anchor **only when** provider-backed evidence identifies exactly one enclosing symbol. Snapped results carry a visible note and structured resolution metadata (requested vs. resolved coordinate and evidence source).
407
+ - ambiguous coordinates return ranked candidates with `targetId`s and do not pick one silently.
408
+ - whitespace, comment, or other non-symbol coordinates return an explicit error and recommend `code_inspect` for point-level facts — `code_resolve` does not register anonymous point targets.
409
+
410
+ ### Target handle lifecycle
411
+
412
+ - `targetId` handles are session-scoped; they are valid only within the current agent session.
413
+ - A handle becomes stale when its backing file is modified and the stored fingerprint no longer matches. Stale handles return an explicit error — re-run `code_resolve` to obtain a fresh handle.
414
+ - Handles have no cross-session persistence; a new session resolves targets fresh.
415
+ - `planId` handles follow the same session-scoped, fingerprint-checked lifecycle. See `docs/adr/0002-refactor-planner-applier-split.md` for the planner/applier invariant.
416
+
105
417
  ## Result style
106
418
 
107
- Results report confidence such as:
419
+ Results report evidence provenance such as:
108
420
 
109
- - `semantic`
110
- - `structural`
111
- - `heuristic`
112
- - `unavailable`
421
+ - `semantic` — backed by LSP/semantic provider
422
+ - `structural` — backed by tree-sitter/structural provider
423
+ - `heuristic` — pattern-based, may include false positives
424
+ - `unavailable` — the required provider or substrate was absent
113
425
 
114
- `heuristic` is now primarily a `code_pattern` concern. The other tools prefer explicit unavailable states over silent search fallbacks.
426
+ `heuristic` results may appear from `code_find` in text/regex modes. The other tools prefer explicit unavailable states over silent search fallbacks.
427
+
428
+ **Evidence-strictness principle:** Every tool result that depends on LSP or TreeSitter explicitly declares its evidence source. For test discovery, provenance describes how companion test files were found: `semantic+conventions` means semantic references contributed, `conventions-only` means only path-based conventions ran. Test-label extraction is a separate concern; `_(no recognized test blocks)_` is an intentional honest placeholder, not silent degradation.
115
429
 
116
430
  ## Architecture
117
431
 
@@ -125,30 +439,26 @@ supi-code-runtime ← shared broker + canonical provider/result contracts
125
439
  supi-lsp / supi-tree-sitter
126
440
  (semantic) (structural)
127
441
 
128
- supi-code-intelligence ← planner, presentation, code_* tools, code_refactor
442
+ supi-code-intelligence ← analysis orchestration, UI, code_* tools
129
443
  ```
130
444
 
131
445
  ## Package surfaces
132
446
 
133
- - `@mrclrchtr/supi-code-intelligence/api` — reusable architecture, brief, and target-resolution helpers
447
+ - `@mrclrchtr/supi-code-intelligence` — package-root type re-export surface
448
+ - `@mrclrchtr/supi-code-intelligence/api` — reusable type contracts
134
449
  - `@mrclrchtr/supi-code-intelligence/extension` — pi extension entrypoint
135
450
 
136
- Example:
137
-
138
- ```ts
139
- import { buildArchitectureModel, generateOverview } from "@mrclrchtr/supi-code-intelligence/api";
140
-
141
- const model = await buildArchitectureModel("/project");
142
- const overview = generateOverview(model);
143
- ```
144
-
145
451
  ## Source
146
452
 
147
- - `src/code-intelligence.ts` — extension entry point: overview injection and tool registration
148
- - `src/use-case/` — typed orchestration modules for brief, map, relations, affected, and pattern
149
- - `src/presentation/markdown/` — markdown renderers that format use-case results
150
- - `src/targeting/` — typed target-resolution pipeline
151
- - `src/tool/tool-specs.ts`single source of truth for the public tool surface
152
- - `src/tool/register-tools.ts` — focused tool registration wiring
453
+ - `src/extension.ts` — extension composition root: substrate lifecycle, tool registration, status UI, overview/warning injection
454
+ - `src/app/` — app-level session lifecycle and manager wiring
455
+ - `src/session/` — session-scoped target handles and refactor plan storage
456
+ - `src/substrate/` — LSP and Tree-sitter adapter lifecycle/state/overrides/recovery
457
+ - `src/analysis/`target resolution, architecture briefs, provider composition, search/reference helpers, project signals, coverage warnings, and test discovery
458
+ - `src/tool/specs.ts` — single source of truth for the current public tool surface
459
+ - `src/tool/register.ts` — focused tool registration wiring
153
460
  - `src/tool/guidance.ts` — prompt surfaces derived from tool specs
154
- - `src/tool/execute-*.ts`thin adapters that validate params and route to use-case/presentation layers
461
+ - `src/tool/<tool>/`per-tool execution, orchestration, markdown, and TUI renderers
462
+ - `src/tool/infra/` — tool pipeline, validation, progress, truncation, readiness messages, and error-result helpers
463
+ - `src/ui/` — shared status UI, message/footer renderers, and non-tool-specific markdown/TUI helpers
464
+ - `src/types/` — small cross-cutting internal type surface
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "1.16.1",
3
+ "version": "2.0.0",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,6 +23,7 @@
23
23
  "settings",
24
24
  "configuration"
25
25
  ],
26
+ "type": "module",
26
27
  "files": [
27
28
  "src/**/*.ts",
28
29
  "!__tests__"
@@ -49,12 +50,14 @@
49
50
  },
50
51
  "main": "src/api.ts",
51
52
  "exports": {
53
+ "./abort-utils": "./src/abort-utils.ts",
52
54
  "./api": "./src/api.ts",
53
55
  "./config": "./src/config.ts",
54
56
  "./context": "./src/context.ts",
55
57
  "./debug": "./src/debug-registry.ts",
56
58
  "./footer-registry": "./src/footer-registry.ts",
57
59
  "./llm": "./src/llm.ts",
60
+ "./model-selection": "./src/model-selection.ts",
58
61
  "./package.json": "./package.json",
59
62
  "./path": "./src/path.ts",
60
63
  "./report": "./src/report.ts",
@@ -63,6 +66,8 @@
63
66
  "./session": "./src/session.ts",
64
67
  "./settings": "./src/settings.ts",
65
68
  "./settings-ui": "./src/settings-ui.ts",
69
+ "./spinner-frames": "./src/spinner-frames.ts",
70
+ "./status-spinner": "./src/status-spinner.ts",
66
71
  "./terminal": "./src/terminal.ts",
67
72
  "./tool-framework": "./src/tool-framework.ts",
68
73
  "./types": "./src/types.ts"
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Abort controller/signal utility helpers.
3
+ *
4
+ * @module
5
+ */
6
+
7
+ /**
8
+ * Combine a caller-provided abort controller with a generation timeout signal.
9
+ *
10
+ * Returns the combined signal and a cleanup function that removes both
11
+ * event listeners. Callers must invoke cleanup in a `finally` block
12
+ * to avoid listener leaks.
13
+ */
14
+ export function combineAbortSignals(
15
+ abort: AbortController,
16
+ timeoutMs: number,
17
+ ): { signal: AbortSignal; cleanup: () => void } {
18
+ const timeoutSignal = AbortSignal.timeout(timeoutMs);
19
+ const combinedController = new AbortController();
20
+ const onAbort = () => combinedController.abort();
21
+ abort.signal.addEventListener("abort", onAbort, { once: true });
22
+ timeoutSignal.addEventListener("abort", onAbort, { once: true });
23
+
24
+ return {
25
+ signal: combinedController.signal,
26
+ cleanup: () => {
27
+ abort.signal.removeEventListener("abort", onAbort);
28
+ timeoutSignal.removeEventListener("abort", onAbort);
29
+ },
30
+ };
31
+ }
@@ -6,6 +6,8 @@
6
6
  // For lighter imports, use one of the domain subpaths directly
7
7
  // (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
8
8
 
9
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
10
+ export * from "./abort-utils.ts";
9
11
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
10
12
  export * from "./config.ts";
11
13
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
@@ -17,6 +19,8 @@ export * from "./footer-registry.ts";
17
19
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
20
  export * from "./llm.ts";
19
21
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
22
+ export * from "./model-selection.ts";
23
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
20
24
  export * from "./path.ts";
21
25
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
22
26
  export * from "./project.ts";
@@ -29,6 +33,10 @@ export * from "./settings.ts";
29
33
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
30
34
  export * from "./settings-ui.ts";
31
35
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
36
+ export * from "./spinner-frames.ts";
37
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
38
+ export * from "./status-spinner.ts";
39
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
32
40
  export * from "./terminal.ts";
33
41
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
34
42
  export * from "./tool-framework.ts";
@@ -5,6 +5,7 @@
5
5
  // to enable auto-generated persistChange. When all items have a configType,
6
6
  // the persistChange callback can be omitted.
7
7
 
8
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
8
9
  import type { SettingItem } from "@earendil-works/pi-tui";
9
10
  import type { SettingsScope } from "../settings/settings-registry.ts";
10
11
  import { registerSettings } from "../settings/settings-registry.ts";
@@ -60,7 +61,12 @@ export interface ConfigSettingsOptions<T> {
60
61
  * persistChange handling. When ALL items declare a configType,
61
62
  * the `persistChange` callback can be omitted.
62
63
  */
63
- buildItems: (settings: T, scope: SettingsScope, cwd: string) => ConfigSettingItem[];
64
+ buildItems: (
65
+ settings: T,
66
+ scope: SettingsScope,
67
+ cwd: string,
68
+ ctx?: ExtensionContext,
69
+ ) => ConfigSettingItem[];
64
70
  /**
65
71
  * Handle a settings change with scoped persistence helpers.
66
72
  *
@@ -141,12 +147,12 @@ export function registerConfigSettings<T>(options: ConfigSettingsOptions<T>): vo
141
147
  registerSettings({
142
148
  id: options.id,
143
149
  label: options.label,
144
- loadValues: (scope, cwd) => {
150
+ loadValues: (scope, cwd, ctx) => {
145
151
  const settings = loadSupiConfigForScope(options.section, cwd, options.defaults, {
146
152
  scope,
147
153
  homeDir: options.homeDir,
148
154
  });
149
- const items = options.buildItems(settings, scope, cwd);
155
+ const items = options.buildItems(settings, scope, cwd, ctx);
150
156
  cachedItems = items;
151
157
  return items;
152
158
  },
@@ -173,7 +179,7 @@ export function registerConfigSettings<T>(options: ConfigSettingsOptions<T>): vo
173
179
  }
174
180
 
175
181
  // Auto-generate when all items are declarative
176
- const items = cachedItems ?? options.buildItems(options.defaults, scope, cwd);
182
+ const items = cachedItems ?? options.buildItems(options.defaults, scope, cwd, undefined);
177
183
  if (areAllItemsDeclarative(items)) {
178
184
  autoPersistChange(settingId, value, helpers, items);
179
185
  }