@mrclrchtr/supi-code-intelligence 1.8.0 → 1.9.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 (159) hide show
  1. package/README.md +17 -1
  2. package/node_modules/@mrclrchtr/supi-code-runtime/README.md +13 -0
  3. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +97 -0
  4. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +53 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +30 -0
  6. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +76 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +186 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +11 -0
  9. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-messages.ts +119 -0
  10. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-provider-registry.ts +36 -0
  11. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +31 -0
  12. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context.ts +16 -0
  13. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +255 -0
  14. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +30 -0
  15. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +40 -0
  16. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path.ts +2 -0
  17. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
  18. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project.ts +15 -0
  19. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +86 -0
  20. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +29 -0
  21. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +4 -0
  22. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +15 -0
  23. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +41 -0
  24. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +226 -0
  25. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -0
  26. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +9 -0
  27. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +11 -0
  28. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
  29. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +116 -0
  30. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/types.ts +2 -0
  31. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +40 -0
  32. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +35 -0
  33. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +68 -0
  34. package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +31 -0
  35. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +110 -0
  36. package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/context.ts +41 -0
  37. package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +170 -0
  38. package/node_modules/@mrclrchtr/supi-core/README.md +3 -13
  39. package/node_modules/@mrclrchtr/supi-core/package.json +1 -7
  40. package/node_modules/@mrclrchtr/supi-lsp/README.md +20 -2
  41. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +13 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +97 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +57 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +30 -0
  45. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +76 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +186 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +11 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-messages.ts +119 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-provider-registry.ts +36 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +31 -0
  51. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context.ts +16 -0
  52. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +255 -0
  53. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +30 -0
  54. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +40 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path.ts +2 -0
  56. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
  57. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project.ts +15 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +86 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +29 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +4 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +15 -0
  62. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +41 -0
  63. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +226 -0
  64. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -0
  65. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +9 -0
  66. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +11 -0
  67. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
  68. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +116 -0
  69. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/types.ts +2 -0
  70. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +40 -0
  71. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +35 -0
  72. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +68 -0
  73. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +31 -0
  74. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +110 -0
  75. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/context.ts +41 -0
  76. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +170 -0
  77. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +3 -13
  78. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -7
  79. package/node_modules/@mrclrchtr/supi-lsp/package.json +9 -6
  80. package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +17 -7
  81. package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +3 -1
  82. package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +24 -0
  83. package/node_modules/@mrclrchtr/supi-lsp/src/manager/client-pool.ts +33 -0
  84. package/node_modules/@mrclrchtr/supi-lsp/src/manager/diagnostic-store.ts +51 -0
  85. package/node_modules/@mrclrchtr/supi-lsp/src/manager/recovery-coordinator.ts +37 -0
  86. package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-router.ts +44 -0
  87. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +156 -0
  88. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +39 -0
  89. package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -1
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -1
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +13 -0
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +97 -0
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +57 -0
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +30 -0
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +76 -0
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +186 -0
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +11 -0
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-messages.ts +119 -0
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-provider-registry.ts +36 -0
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +31 -0
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context.ts +16 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +255 -0
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +30 -0
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +40 -0
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path.ts +2 -0
  106. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
  107. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project.ts +15 -0
  108. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +86 -0
  109. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +29 -0
  110. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +4 -0
  111. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +15 -0
  112. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +41 -0
  113. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +226 -0
  114. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -0
  115. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +9 -0
  116. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +11 -0
  117. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
  118. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +116 -0
  119. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/types.ts +2 -0
  120. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +40 -0
  121. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +35 -0
  122. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +68 -0
  123. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +31 -0
  124. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +110 -0
  125. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/context.ts +41 -0
  126. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +170 -0
  127. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +3 -13
  128. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -7
  129. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +9 -6
  130. package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +144 -0
  131. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-registration.ts +37 -0
  132. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +18 -8
  133. package/package.json +8 -6
  134. package/src/api.ts +31 -16
  135. package/src/brief-focused.ts +2 -2
  136. package/src/brief.ts +2 -2
  137. package/src/code-intelligence.ts +13 -1
  138. package/src/index.ts +29 -16
  139. package/src/{architecture.ts → model.ts} +20 -61
  140. package/src/presentation/markdown/brief.ts +2 -2
  141. package/src/substrates/types.ts +22 -105
  142. package/src/targeting/resolve-file.ts +4 -7
  143. package/src/tool/execute-affected.ts +25 -1
  144. package/src/tool/execute-brief.ts +5 -4
  145. package/src/tool/execute-pattern.ts +4 -3
  146. package/src/tool/execute-relations.ts +22 -1
  147. package/src/types.ts +101 -3
  148. package/src/use-case/build-overview.ts +1 -1
  149. package/src/use-case/generate-affected.ts +25 -7
  150. package/src/use-case/generate-brief.ts +31 -14
  151. package/src/use-case/generate-pattern.ts +9 -9
  152. package/src/use-case/generate-relations.ts +66 -20
  153. package/src/use-case/types.ts +3 -3
  154. package/src/workspace/request-context.ts +139 -0
  155. package/node_modules/@mrclrchtr/supi-core/src/extension.ts +0 -1
  156. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/extension.ts +0 -1
  157. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/extension.ts +0 -1
  158. package/src/substrates/lsp-adapter.ts +0 -197
  159. package/src/substrates/tree-sitter-adapter.ts +0 -173
@@ -0,0 +1,44 @@
1
+ // Workspace router — routes files to the correct LSP client based on project root.
2
+
3
+ import type { ProjectServerInfo } from "../config/server-config.ts";
4
+ import type { LspManager } from "./manager.ts";
5
+
6
+ /**
7
+ * Routes file paths to the correct LSP client and tracks
8
+ * which project roots are known.
9
+ */
10
+ export interface WorkspaceRouter {
11
+ /** Check whether a file can be served by any active server. */
12
+ canServeFile(filePath: string): boolean;
13
+
14
+ /** Check whether a source file type is supported. */
15
+ isSupportedSourceFile(filePath: string): boolean;
16
+
17
+ /** Get known project server info. */
18
+ getProjectServers(): ProjectServerInfo[];
19
+
20
+ /** Register detected servers from the workspace scan. */
21
+ registerDetectedServers(servers: Array<{ language: string; root: string }>): void;
22
+ }
23
+
24
+ /**
25
+ * Create a WorkspaceRouter backed by LspManager.
26
+ */
27
+ export function createWorkspaceRouter(manager: LspManager): WorkspaceRouter {
28
+ return {
29
+ canServeFile(filePath: string) {
30
+ return manager.canServeFile(filePath);
31
+ },
32
+ isSupportedSourceFile(filePath: string) {
33
+ return manager.isSupportedSourceFile(filePath);
34
+ },
35
+ getProjectServers(): ProjectServerInfo[] {
36
+ return manager.getKnownProjectServers([]);
37
+ },
38
+ registerDetectedServers(servers: Array<{ language: string; root: string }>) {
39
+ manager.registerDetectedServers(
40
+ servers as unknown as Parameters<typeof manager.registerDetectedServers>[0],
41
+ );
42
+ },
43
+ };
44
+ }
@@ -0,0 +1,156 @@
1
+ // LSP semantic provider adapter — wraps SessionLspService into the shared
2
+ // SemanticProvider contract from supi-code-runtime.
3
+
4
+ import type {
5
+ CodeLocation,
6
+ CodePosition,
7
+ CodeSymbol,
8
+ SemanticProvider,
9
+ } from "@mrclrchtr/supi-code-runtime/api";
10
+ import type { DocumentSymbol, Location, LocationLink, SymbolInformation } from "../config/types.ts";
11
+ import type { SessionLspService } from "../session/service-registry.ts";
12
+
13
+ /**
14
+ * Create a SemanticProvider backed by a SessionLspService.
15
+ * Maps LSP types into the shared code-runtime types.
16
+ */
17
+ export function createLspSemanticProvider(lsp: SessionLspService): SemanticProvider {
18
+ return {
19
+ async references(filePath: string, position: CodePosition): Promise<CodeLocation[] | null> {
20
+ const refResult = await lsp.references(filePath, position);
21
+ if (!refResult) return null;
22
+ const mapped: CodeLocation[] = [];
23
+ for (const item of refResult) {
24
+ const loc = toCodeLocation(item);
25
+ if (loc) mapped.push(loc);
26
+ }
27
+ return mapped;
28
+ },
29
+
30
+ async implementation(filePath: string, position: CodePosition): Promise<CodeLocation[] | null> {
31
+ const implResult = await lsp.implementation(filePath, position);
32
+ if (!implResult) return null;
33
+ const normalized = Array.isArray(implResult) ? implResult : [implResult];
34
+ const mapped: CodeLocation[] = [];
35
+ for (const item of normalized) {
36
+ const loc = toCodeLocation(item);
37
+ if (loc) mapped.push(loc);
38
+ }
39
+ return mapped;
40
+ },
41
+
42
+ async documentSymbols(filePath: string): Promise<CodeSymbol[] | null> {
43
+ const symbols = await lsp.documentSymbols(filePath);
44
+ if (!symbols) return null;
45
+ return flattenDocumentSymbols(symbols, filePath);
46
+ },
47
+
48
+ async workspaceSymbols(query: string): Promise<CodeSymbol[] | null> {
49
+ const results = await lsp.workspaceSymbol(query);
50
+ if (!results) return null;
51
+ return results.map((sym) => toCodeSymbol(sym as SymbolInformation));
52
+ },
53
+ };
54
+ }
55
+
56
+ // ── Type conversion helpers ───────────────────────────────────────────
57
+
58
+ function toCodeLocation(item: Location | LocationLink): CodeLocation | null {
59
+ const loc = item as Record<string, unknown>;
60
+ const uri = loc.uri ?? loc.targetUri;
61
+ if (typeof uri !== "string") return null;
62
+
63
+ // Prefer targetSelectionRange > targetRange > range
64
+ const range = loc.targetSelectionRange ?? loc.targetRange ?? loc.range;
65
+ if (!range || typeof range !== "object") return null;
66
+
67
+ const r = range as { start: Record<string, unknown>; end: Record<string, unknown> };
68
+ const start = r.start;
69
+ const end = r.end;
70
+ if (!start || !end) return null;
71
+
72
+ return {
73
+ uri,
74
+ range: {
75
+ start: { line: (start.line as number) ?? 0, character: (start.character as number) ?? 0 },
76
+ end: { line: (end.line as number) ?? 0, character: (end.character as number) ?? 0 },
77
+ },
78
+ };
79
+ }
80
+
81
+ const SYMBOL_KIND_NAMES: Record<number, string> = {
82
+ 1: "File",
83
+ 2: "Module",
84
+ 3: "Namespace",
85
+ 4: "Package",
86
+ 5: "Class",
87
+ 6: "Method",
88
+ 7: "Property",
89
+ 8: "Field",
90
+ 9: "Constructor",
91
+ 10: "Enum",
92
+ 11: "Interface",
93
+ 12: "Function",
94
+ 13: "Variable",
95
+ 14: "Constant",
96
+ 15: "String",
97
+ 16: "Number",
98
+ 17: "Boolean",
99
+ 18: "Array",
100
+ 19: "Object",
101
+ 20: "Key",
102
+ 21: "Null",
103
+ 22: "EnumMember",
104
+ 23: "Struct",
105
+ 24: "Event",
106
+ 25: "Operator",
107
+ 26: "TypeParameter",
108
+ };
109
+
110
+ function symbolKindName(kind: number): string {
111
+ return SYMBOL_KIND_NAMES[kind] ?? "Unknown";
112
+ }
113
+
114
+ function flattenDocumentSymbols(
115
+ symbols: DocumentSymbol[] | SymbolInformation[],
116
+ filePath: string,
117
+ container: string | null = null,
118
+ ): CodeSymbol[] {
119
+ const result: CodeSymbol[] = [];
120
+
121
+ for (const sym of symbols) {
122
+ // DocumentSymbol has selectionRange; SymbolInformation has location
123
+ const ds = sym as DocumentSymbol;
124
+ const si = sym as SymbolInformation;
125
+ const start = ds.selectionRange?.start ?? si.location?.range?.start;
126
+ if (!start) continue;
127
+
128
+ result.push({
129
+ name: sym.name,
130
+ kind: symbolKindName(sym.kind),
131
+ file: filePath,
132
+ line: start.line + 1,
133
+ character: start.character + 1,
134
+ container,
135
+ });
136
+
137
+ if (Array.isArray(ds.children) && ds.children.length > 0) {
138
+ result.push(...flattenDocumentSymbols(ds.children, filePath, sym.name));
139
+ }
140
+ }
141
+
142
+ return result;
143
+ }
144
+
145
+ function toCodeSymbol(sym: SymbolInformation): CodeSymbol {
146
+ const uri = sym.location?.uri ?? "";
147
+ const start = sym.location?.range?.start;
148
+ return {
149
+ name: sym.name,
150
+ kind: symbolKindName(sym.kind),
151
+ file: uri.startsWith("file://") ? decodeURIComponent(uri.slice(7)) : uri,
152
+ line: start ? start.line + 1 : 0,
153
+ character: start ? start.character + 1 : 0,
154
+ container: sym.containerName ?? null,
155
+ };
156
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * LSP-to-runtime capability registration.
3
+ *
4
+ * Adapts a SessionLspService into the runtime's SemanticProvider interface
5
+ * and registers/unregisters it with the shared WorkspaceRuntime at session
6
+ * lifecycle boundaries.
7
+ */
8
+
9
+ import type { WorkspaceRuntime } from "@mrclrchtr/supi-code-runtime/api";
10
+ import { createLspSemanticProvider } from "../provider/lsp-semantic-provider.ts";
11
+ import type { SessionLspService } from "./service-registry.ts";
12
+
13
+ /**
14
+ * Register LSP capabilities for a workspace cwd.
15
+ *
16
+ * Wraps SessionLspService into a SemanticProvider via the existing
17
+ * semantic adapter and publishes it into the shared workspace runtime
18
+ * so that code-intelligence and other consumers can discover semantic
19
+ * analysis availability.
20
+ */
21
+ export function registerLspCapabilities(
22
+ runtime: WorkspaceRuntime,
23
+ cwd: string,
24
+ service: SessionLspService,
25
+ ): void {
26
+ const provider = createLspSemanticProvider(service);
27
+ runtime.registerSemantic(cwd, provider);
28
+ }
29
+
30
+ /**
31
+ * Unregister LSP capabilities for a workspace cwd.
32
+ *
33
+ * Clears only the semantic capability slot — structural (tree-sitter)
34
+ * state is left intact so that a later tree-sitter session_start does
35
+ * not needlessly wipe LSP state on its own restart path.
36
+ */
37
+ export function unregisterLspCapabilities(runtime: WorkspaceRuntime, cwd: string): void {
38
+ runtime.clearSemantic(cwd);
39
+ }
@@ -47,7 +47,6 @@ function createToolExecutor(
47
47
  params: unknown,
48
48
  ) => Promise<string>,
49
49
  ) {
50
- // biome-ignore lint/complexity/useMaxParams: pi ToolDefinition.execute signature
51
50
  return async (
52
51
  _toolCallId: string,
53
52
  params: unknown,
@@ -1,3 +1,5 @@
1
+ ![SuPi](assets/logo.png)
2
+
1
3
  # @mrclrchtr/supi-tree-sitter
2
4
 
3
5
  Adds focused structural code analysis tools to the [pi coding agent](https://github.com/earendil-works/pi) using Tree-sitter parsers.
@@ -14,7 +16,7 @@ For local development:
14
16
  pi install ./packages/supi-tree-sitter
15
17
  ```
16
18
 
17
- After editing the source, run `/reload`.
19
+ ![Tree-sitter outline in action](https://raw.githubusercontent.com/mrclrchtr/supi/main/screenshots/supi-tree-sitter.png)
18
20
 
19
21
  ## What you get
20
22
 
@@ -60,10 +62,25 @@ Coordinates use **1-based** line and character columns. Character positions use
60
62
  - R (`.r`)
61
63
  - SQL (`.sql`)
62
64
 
65
+ ## Architecture
66
+
67
+ `@mrclrchtr/supi-tree-sitter` is the **structural substrate** in SuPi's
68
+ code-understanding stack. It depends on `@mrclrchtr/supi-core` and
69
+ `@mrclrchtr/supi-code-runtime` for shared contracts, and provides structural
70
+ analysis via a session-scoped Tree-sitter service that publishes its
71
+ capabilities into the shared workspace runtime.
72
+
73
+ ```text
74
+ supi-code-runtime ← shared contracts + workspace runtime
75
+
76
+ supi-tree-sitter ← Tree-sitter WASM + session-scoped service + runtime capabilities
77
+ ```
78
+
63
79
  ## Package surfaces
64
80
 
65
81
  - `@mrclrchtr/supi-tree-sitter/api` — reusable parsing session factory, shared session-scoped structural service access, and shared result types
66
82
  - `@mrclrchtr/supi-tree-sitter/extension` — pi extension entrypoint
83
+ - `@mrclrchtr/supi-tree-sitter/provider/tree-sitter-provider` — shared StructuralProvider adapter
67
84
 
68
85
  Owned session example:
69
86
 
@@ -0,0 +1,13 @@
1
+ # @mrclrchtr/supi-code-runtime
2
+
3
+ Shared workspace context, capability contracts, and canonical types for the SuPi code-understanding stack.
4
+
5
+ This is a **library-only package** — it has no pi extension surface, no user-facing tools, and no UI. It provides the shared abstractions that `supi-lsp`, `supi-tree-sitter`, and `supi-code-intelligence` use to communicate capability availability.
6
+
7
+ ## Package surfaces
8
+
9
+ - `@mrclrchtr/supi-code-runtime/api` — shared canonical types, capability interfaces, workspace runtime registry, and typed request context
10
+
11
+ ## License
12
+
13
+ MIT
@@ -0,0 +1,97 @@
1
+ ![SuPi](assets/logo.png)
2
+
3
+ # @mrclrchtr/supi-core
4
+
5
+ Shared infrastructure for SuPi extensions.
6
+
7
+ This is a **pure library** — it does not register any pi commands or tools. The `/supi-settings` command is now available through `@mrclrchtr/supi-settings`.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @mrclrchtr/supi-core
13
+ ```
14
+
15
+ ## Package surfaces
16
+
17
+ - `@mrclrchtr/supi-core/api` — reusable helpers for other packages and extensions
18
+
19
+ ## What you get from the API
20
+
21
+ ### Config helpers
22
+
23
+ - `loadSupiConfig()` — merged config with resolution order `defaults <- global <- project`
24
+ - `loadSupiConfigForScope()` — load one scope at a time for settings UIs
25
+ - `writeSupiConfig()` — persist values
26
+ - `removeSupiConfigKey()` — remove a key or override
27
+
28
+ Config file locations:
29
+
30
+ - global: `~/.pi/agent/supi/config.json`
31
+ - project: `.pi/supi/config.json`
32
+
33
+ ### Settings helpers
34
+
35
+ - `registerSettings()` — register an arbitrary settings section
36
+ - `registerConfigSettings()` — register a config-backed settings section with scoped persistence helpers
37
+ - `registerSettingsCommand()` — register `/supi-settings`
38
+ - `openSettingsOverlay()` — open the shared settings UI directly
39
+ - `createInputSubmenu()` — helper for simple text-entry submenus
40
+
41
+ The built-in settings UI supports:
42
+
43
+ - project/global scope toggle
44
+ - grouped extension sections
45
+ - searchable setting lists
46
+
47
+ ### Context helpers
48
+
49
+ - `wrapExtensionContext()` — wrap injected text in SuPi's `<extension-context>` tag
50
+ - `findLastUserMessageIndex()`
51
+ - `getContextToken()`
52
+ - `getPromptContent()`
53
+ - `pruneAndReorderContextMessages()`
54
+ - `restorePromptContent()`
55
+
56
+ ### Shared registries
57
+
58
+ - context-provider registry for `/supi-context`
59
+ - debug-event registry for producers that want shared debug capture
60
+ - settings registry used by `/supi-settings`
61
+
62
+ ### Project and session helpers
63
+
64
+ - project-root detection and directory walking helpers such as `findProjectRoot()` and `walkProject()`
65
+ - active-branch session helper: `getActiveBranchEntries()`
66
+ - terminal helpers such as `formatTitle()`, `signalWaiting()`, and `signalDone()`
67
+
68
+ ## Example
69
+
70
+ ```ts
71
+ import { loadSupiConfig, registerConfigSettings, wrapExtensionContext } from "@mrclrchtr/supi-core/api";
72
+
73
+ const config = loadSupiConfig("my-extension", process.cwd(), {
74
+ enabled: true,
75
+ });
76
+
77
+ registerConfigSettings({
78
+ id: "my-extension",
79
+ label: "My Extension",
80
+ section: "my-extension",
81
+ defaults: { enabled: true },
82
+ buildItems: () => [],
83
+ persistChange: () => {},
84
+ });
85
+
86
+ const message = wrapExtensionContext("my-extension", "hello", {
87
+ file: "CLAUDE.md",
88
+ turn: 1,
89
+ });
90
+ ```
91
+
92
+ ## Source
93
+
94
+ - `src/api.ts` — exported library surface
95
+ - `src/config.ts` — shared config loading and writing
96
+ - `src/config-settings.ts` — config-backed settings registration helper
97
+ - `src/settings-ui.ts` — shared settings overlay
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@mrclrchtr/supi-core",
3
+ "version": "1.9.0",
4
+ "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/mrclrchtr/supi.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "keywords": [
14
+ "pi",
15
+ "pi-coding-agent"
16
+ ],
17
+ "files": [
18
+ "src/**/*.ts",
19
+ "!__tests__"
20
+ ],
21
+ "peerDependencies": {
22
+ "@earendil-works/pi-coding-agent": "*",
23
+ "@earendil-works/pi-tui": "*",
24
+ "typebox": "*"
25
+ },
26
+ "peerDependenciesMeta": {
27
+ "@earendil-works/pi-coding-agent": {
28
+ "optional": true
29
+ },
30
+ "@earendil-works/pi-tui": {
31
+ "optional": true
32
+ },
33
+ "typebox": {
34
+ "optional": true
35
+ }
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "25.9.1",
39
+ "vitest": "4.1.7"
40
+ },
41
+ "main": "src/api.ts",
42
+ "exports": {
43
+ "./api": "./src/api.ts",
44
+ "./config": "./src/config.ts",
45
+ "./context": "./src/context.ts",
46
+ "./debug": "./src/debug-registry.ts",
47
+ "./package.json": "./package.json",
48
+ "./path": "./src/path.ts",
49
+ "./project": "./src/project.ts",
50
+ "./session": "./src/session.ts",
51
+ "./settings": "./src/settings.ts",
52
+ "./settings-ui": "./src/settings-ui.ts",
53
+ "./terminal": "./src/terminal.ts",
54
+ "./tool-framework": "./src/tool-framework.ts",
55
+ "./types": "./src/types.ts"
56
+ }
57
+ }
@@ -0,0 +1,30 @@
1
+ // supi-core — shared infrastructure for SuPi extensions.
2
+ // Provides XML context tag wrapping, unified config system, context-message utilities,
3
+ // settings registry for supi-wide TUI settings, and a shared tool-spec/registration framework.
4
+ //
5
+ // Convenience barrel — re-exports all domain entry points.
6
+ // For lighter imports, use one of the domain subpaths directly
7
+ // (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
8
+
9
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
10
+ export * from "./config.ts";
11
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
12
+ export * from "./context.ts";
13
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
14
+ export * from "./debug-registry.ts";
15
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
16
+ export * from "./path.ts";
17
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
+ export * from "./project.ts";
19
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
20
+ export * from "./session.ts";
21
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
22
+ export * from "./settings.ts";
23
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
24
+ export * from "./settings-ui.ts";
25
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
26
+ export * from "./terminal.ts";
27
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
28
+ export * from "./tool-framework.ts";
29
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
30
+ export * from "./types.ts";
@@ -0,0 +1,76 @@
1
+ // Config-aware settings helper for SuPi config-backed settings sections.
2
+ // Wraps registerSettings() and centralizes selected-scope loading + scoped persistence.
3
+
4
+ import type { SettingItem } from "@earendil-works/pi-tui";
5
+ import type { SettingsScope } from "../settings/settings-registry.ts";
6
+ import { registerSettings } from "../settings/settings-registry.ts";
7
+ import { loadSupiConfigForScope, removeSupiConfigKey, writeSupiConfig } from "./config.ts";
8
+
9
+ export interface ConfigSettingsHelpers {
10
+ /** Write a key to the selected scope's config section. */
11
+ set(key: string, value: unknown): void;
12
+ /** Remove a key from the selected scope's config section. */
13
+ unset(key: string): void;
14
+ }
15
+
16
+ export interface ConfigSettingsOptions<T> {
17
+ /** Extension identifier — e.g. "lsp", "claude-md" */
18
+ id: string;
19
+ /** Human-readable label shown in the UI */
20
+ label: string;
21
+ /** SuPi config section name — e.g. "lsp", "claude-md" */
22
+ section: string;
23
+ /** Default config values */
24
+ defaults: T;
25
+ /** Build SettingItem[] from scoped config. Called by loadValues. */
26
+ buildItems: (settings: T, scope: SettingsScope, cwd: string) => SettingItem[];
27
+ /** Handle a settings change with scoped persistence helpers. */
28
+ persistChange: (
29
+ scope: SettingsScope,
30
+ cwd: string,
31
+ settingId: string,
32
+ value: string,
33
+ helpers: ConfigSettingsHelpers,
34
+ ) => void;
35
+ /** Optional home directory for config resolution (testing). */
36
+ homeDir?: string;
37
+ }
38
+
39
+ /**
40
+ * Register a config-backed settings section.
41
+ *
42
+ * Loads display values from the selected scope only (`defaults <- selected scope`)
43
+ * instead of merged effective runtime config. Provides scoped `set` / `unset`
44
+ * persistence helpers so extensions don't need to wire `writeSupiConfig` /
45
+ * `removeSupiConfigKey` by hand.
46
+ */
47
+ export function registerConfigSettings<T>(options: ConfigSettingsOptions<T>): void {
48
+ registerSettings({
49
+ id: options.id,
50
+ label: options.label,
51
+ loadValues: (scope, cwd) => {
52
+ const settings = loadSupiConfigForScope(options.section, cwd, options.defaults, {
53
+ scope,
54
+ homeDir: options.homeDir,
55
+ });
56
+ return options.buildItems(settings, scope, cwd);
57
+ },
58
+ persistChange: (scope, cwd, settingId, value) => {
59
+ const helpers: ConfigSettingsHelpers = {
60
+ set: (key, val) => {
61
+ writeSupiConfig(
62
+ { section: options.section, scope, cwd },
63
+ { [key]: val },
64
+ { homeDir: options.homeDir },
65
+ );
66
+ },
67
+ unset: (key) => {
68
+ removeSupiConfigKey({ section: options.section, scope, cwd }, key, {
69
+ homeDir: options.homeDir,
70
+ });
71
+ },
72
+ };
73
+ options.persistChange(scope, cwd, settingId, value, helpers);
74
+ },
75
+ });
76
+ }