@mrclrchtr/supi-code-intelligence 11.4.0 → 13.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 (330) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +17 -9
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  6. package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  7. package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  8. package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  9. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  10. package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  12. package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  13. package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  14. package/node_modules/@mrclrchtr/supi-lsp/README.md +21 -16
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
  27. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +3 -2
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
  29. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +13 -3
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +15 -1
  32. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +1 -1
  33. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +71 -13
  34. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +28 -6
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-edit-capture.ts +258 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
  40. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +75 -14
  41. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +8 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +48 -79
  43. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
  44. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
  45. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +14 -5
  46. package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
  49. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +43 -21
  51. package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
  52. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +21 -35
  53. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
  54. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-command-capture.ts +139 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +202 -47
  56. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
  57. package/node_modules/@mrclrchtr/supi-lsp/src/session/route-boundary.ts +26 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +74 -14
  61. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +3 -0
  62. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
  63. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +24 -1
  64. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  65. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  66. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  67. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  68. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  69. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  70. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  71. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  72. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  73. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  74. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  75. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
  76. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
  77. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
  78. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
  83. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
  84. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
  85. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
  86. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
  87. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
  88. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +16 -2
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +4 -3
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +2 -0
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-range.ts +94 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +26 -6
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +6 -3
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +13 -4
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +1 -9
  106. package/node_modules/fast-xml-parser/CHANGELOG.md +886 -0
  107. package/node_modules/fast-xml-parser/LICENSE +21 -0
  108. package/node_modules/fast-xml-parser/README.md +204 -0
  109. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
  110. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
  111. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  112. package/node_modules/fast-xml-parser/lib/fxp.d.cts +774 -0
  113. package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  114. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  115. package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  116. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  117. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
  118. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
  119. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/README.md +92 -0
  120. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/package.json +57 -0
  121. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityDecoder.js +644 -0
  122. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityEncoder.js +239 -0
  123. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/all-entities.js +53 -0
  124. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entities.js +1139 -0
  125. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entityTries.js +60 -0
  126. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.d.ts +358 -0
  127. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.js +29 -0
  128. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +52 -0
  129. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/LICENSE +21 -0
  130. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/README.md +77 -0
  131. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
  132. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
  133. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
  134. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
  135. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +77 -0
  136. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
  137. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +609 -0
  138. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
  139. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +360 -0
  140. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
  141. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +23 -0
  142. package/node_modules/fast-xml-parser/node_modules/is-unsafe/LICENSE +21 -0
  143. package/node_modules/fast-xml-parser/node_modules/is-unsafe/README.md +632 -0
  144. package/node_modules/fast-xml-parser/node_modules/is-unsafe/package.json +56 -0
  145. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/html.js +102 -0
  146. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/log.js +98 -0
  147. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/nosql.js +114 -0
  148. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/redos.js +60 -0
  149. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/shell.js +105 -0
  150. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql-strict.js +47 -0
  151. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql.js +95 -0
  152. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/svg.js +81 -0
  153. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/xml.js +79 -0
  154. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.cjs +27 -0
  155. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.d.ts +103 -0
  156. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.js +292 -0
  157. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/util/decode-entities.js +48 -0
  158. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/LICENSE +21 -0
  159. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/README.md +947 -0
  160. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
  161. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.d.cts +725 -0
  162. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
  163. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
  164. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/package.json +79 -0
  165. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js +232 -0
  166. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js +225 -0
  167. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js +663 -0
  168. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.d.ts +589 -0
  169. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.js +30 -0
  170. package/node_modules/fast-xml-parser/node_modules/strnum/CHANGELOG.md +63 -0
  171. package/node_modules/fast-xml-parser/node_modules/strnum/LICENSE +21 -0
  172. package/node_modules/fast-xml-parser/node_modules/strnum/README.md +113 -0
  173. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/LICENSE +21 -0
  174. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/README.md +142 -0
  175. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/anynum.js +135 -0
  176. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/digitTable.js +116 -0
  177. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/package.json +42 -0
  178. package/node_modules/fast-xml-parser/node_modules/strnum/package.json +36 -0
  179. package/node_modules/fast-xml-parser/node_modules/strnum/strnum.js +176 -0
  180. package/node_modules/fast-xml-parser/node_modules/xml-naming/LICENSE +21 -0
  181. package/node_modules/fast-xml-parser/node_modules/xml-naming/README.md +287 -0
  182. package/node_modules/fast-xml-parser/node_modules/xml-naming/package.json +56 -0
  183. package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.d.ts +108 -0
  184. package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.js +382 -0
  185. package/node_modules/fast-xml-parser/package.json +93 -0
  186. package/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
  187. package/node_modules/fast-xml-parser/src/cli/man.js +17 -0
  188. package/node_modules/fast-xml-parser/src/cli/read.js +43 -0
  189. package/node_modules/fast-xml-parser/src/fxp.d.ts +754 -0
  190. package/node_modules/fast-xml-parser/src/fxp.js +14 -0
  191. package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
  192. package/node_modules/fast-xml-parser/src/util.js +61 -0
  193. package/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
  194. package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +106 -0
  195. package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
  196. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
  197. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
  198. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
  199. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
  200. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
  201. package/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
  202. package/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
  203. package/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
  204. package/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
  205. package/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
  206. package/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
  207. package/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
  208. package/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
  209. package/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
  210. package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
  211. package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
  212. package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
  213. package/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
  214. package/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
  215. package/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
  216. package/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
  217. package/node_modules/fast-xml-parser/src/validator.js +518 -0
  218. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +6 -0
  219. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +426 -0
  220. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +164 -0
  221. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +907 -0
  222. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +77 -0
  223. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +177 -0
  224. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +54 -0
  225. package/package.json +10 -8
  226. package/src/analysis/evidence.ts +331 -73
  227. package/src/analysis/health/diagnostics.ts +66 -18
  228. package/src/analysis/health/evidence-reason.ts +44 -0
  229. package/src/analysis/health/server-status.ts +41 -12
  230. package/src/analysis/search/pattern.ts +3 -3
  231. package/src/analysis/target/anchored-structural.ts +4 -1
  232. package/src/analysis/target/anchored.ts +3 -6
  233. package/src/analysis/target/symbol.ts +42 -48
  234. package/src/analysis/target/types.ts +4 -9
  235. package/src/analysis/workspace/cmake-parser.ts +207 -0
  236. package/src/analysis/workspace/cmake.ts +141 -0
  237. package/src/analysis/workspace/maven.ts +310 -0
  238. package/src/analysis/workspace/membership.ts +100 -26
  239. package/src/analysis/workspace/metadata.ts +6 -1
  240. package/src/analysis/workspace/observe.ts +6 -0
  241. package/src/analysis/workspace/types.ts +11 -3
  242. package/src/diagnostics/coverage.ts +49 -0
  243. package/src/diagnostics/evidence.ts +10 -2
  244. package/src/session/find-types.ts +8 -4
  245. package/src/session/find-workflow.ts +11 -16
  246. package/src/session/health-workflow.ts +6 -0
  247. package/src/session/input/common.ts +1 -1
  248. package/src/session/input/health-refactor.ts +48 -34
  249. package/src/session/input/workflows.ts +45 -46
  250. package/src/session/inspect/file-point.ts +2 -2
  251. package/src/session/inspect-types.ts +1 -1
  252. package/src/session/inspect-workflow.ts +3 -3
  253. package/src/session/orientation/collect.ts +42 -7
  254. package/src/session/orientation/context-facts.ts +3 -3
  255. package/src/session/orientation/context-sections.ts +13 -15
  256. package/src/session/orientation/facts.ts +5 -8
  257. package/src/session/orientation-workflow.ts +4 -19
  258. package/src/session/refactor-file-actions.ts +122 -0
  259. package/src/session/refactor-plan-pipeline.ts +152 -0
  260. package/src/session/refactor-plans.ts +18 -15
  261. package/src/session/refactor-types.ts +24 -12
  262. package/src/session/refactor-workflow.ts +68 -243
  263. package/src/session/target-workflow.ts +25 -18
  264. package/src/tool/code_find/execute.ts +6 -7
  265. package/src/tool/code_find/result.ts +5 -7
  266. package/src/tool/code_find/spec.ts +9 -16
  267. package/src/tool/code_find/tui.ts +12 -6
  268. package/src/tool/code_graph/display.ts +5 -6
  269. package/src/tool/code_graph/format.ts +8 -24
  270. package/src/tool/code_graph/result.ts +16 -75
  271. package/src/tool/code_graph/section.ts +21 -33
  272. package/src/tool/code_graph/spec.ts +6 -0
  273. package/src/tool/code_graph/tui.ts +10 -5
  274. package/src/tool/code_health/diagnostic-tui.ts +49 -0
  275. package/src/tool/code_health/guidance.ts +27 -0
  276. package/src/tool/code_health/markdown.ts +60 -8
  277. package/src/tool/code_health/result.ts +20 -9
  278. package/src/tool/code_health/spec.ts +6 -0
  279. package/src/tool/code_health/structured-schema.ts +18 -4
  280. package/src/tool/code_health/structured.ts +22 -18
  281. package/src/tool/code_health/tui.ts +33 -40
  282. package/src/tool/code_inspect/execute.ts +1 -1
  283. package/src/tool/code_inspect/markdown.ts +33 -6
  284. package/src/tool/code_inspect/result.ts +24 -19
  285. package/src/tool/code_inspect/spec.ts +14 -6
  286. package/src/tool/code_inspect/structured.ts +4 -21
  287. package/src/tool/code_inspect/tui.ts +2 -2
  288. package/src/tool/code_orientation/result.ts +53 -100
  289. package/src/tool/code_orientation/spec.ts +8 -0
  290. package/src/tool/code_orientation/structured-schema.ts +16 -12
  291. package/src/tool/code_orientation/structured-workspace.ts +13 -7
  292. package/src/tool/code_orientation/structured.ts +31 -39
  293. package/src/tool/code_orientation/workspace-format.ts +4 -10
  294. package/src/tool/code_orientation/workspace-instructions.ts +4 -5
  295. package/src/tool/code_orientation/workspace-observations.ts +2 -2
  296. package/src/tool/code_orientation/workspace-output.ts +16 -7
  297. package/src/tool/code_orientation/workspace-projects.ts +7 -10
  298. package/src/tool/code_orientation/workspace-sections.ts +13 -19
  299. package/src/tool/code_refactor_apply/result.ts +2 -1
  300. package/src/tool/code_refactor_apply/spec.ts +7 -0
  301. package/src/tool/code_refactor_plan/execute.ts +0 -2
  302. package/src/tool/code_refactor_plan/result.ts +23 -13
  303. package/src/tool/code_refactor_plan/spec.ts +8 -2
  304. package/src/tool/code_refactor_plan/structured.ts +59 -12
  305. package/src/tool/code_refactor_plan/tui.ts +14 -17
  306. package/src/tool/code_resolve/markdown.ts +5 -47
  307. package/src/tool/code_resolve/result.ts +43 -72
  308. package/src/tool/code_resolve/spec.ts +6 -0
  309. package/src/tool/infra/truncate.ts +2 -16
  310. package/src/tool/namespace.ts +14 -0
  311. package/src/tool/refactor-markdown.ts +55 -15
  312. package/src/tool/register.ts +3 -0
  313. package/src/tool/result/candidate-selection.ts +141 -0
  314. package/src/tool/result/display.ts +41 -45
  315. package/src/tool/result/errors.ts +1 -0
  316. package/src/tool/result/model-budget.ts +26 -1
  317. package/src/tool/result/refactor-preview.ts +118 -0
  318. package/src/tool/result/refactor-unavailable.ts +16 -0
  319. package/src/tool/result/refactor.ts +19 -10
  320. package/src/tool/result/structured.ts +2 -1
  321. package/src/tool/result/types.ts +9 -8
  322. package/src/tool/schemas.ts +76 -38
  323. package/src/tool/specs.ts +3 -0
  324. package/src/ui/footer.ts +2 -4
  325. package/src/ui/status-overlay.ts +1 -1
  326. package/src/ui/status-presentation.ts +4 -7
  327. package/src/ui/tui/candidate-selection.ts +40 -95
  328. package/src/ui/tui/common.ts +16 -70
  329. package/src/ui/tui/display.ts +6 -24
  330. package/src/tool/result/candidate-row.ts +0 -49
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Static `CMakeLists.txt` reader for explicit `project()` declarations.
3
+ *
4
+ * A project is reported only for exactly one top-level `project()` call with
5
+ * a literal name. Repeated, conditional, function/macro-body, and
6
+ * variable-dependent calls are disclosed instead of guessed. Targets,
7
+ * `add_subdirectory()`, included files, presets, and configured build trees
8
+ * are not observed, and CMake is never run.
9
+ */
10
+
11
+ import type { CMakeArgument, CMakeCommand } from "./cmake-parser.ts";
12
+ import { parseCMakeFile } from "./cmake-parser.ts";
13
+ import type { DocumentContribution, ParsedDocument } from "./metadata-types.ts";
14
+ import { baseProject, issue } from "./metadata-utils.ts";
15
+ import type { MetadataIssue } from "./types.ts";
16
+
17
+ const DYNAMIC_REFERENCE = /\$(?:\{|ENV\{|CACHE\{|<)/;
18
+
19
+ /** Read one `CMakeLists.txt` document. */
20
+ export function readCMakeDocument(document: ParsedDocument): DocumentContribution {
21
+ if (document.kind !== "cmake-lists") return { project: null, workspace: null, issues: [] };
22
+ if (typeof document.data !== "string") {
23
+ return {
24
+ project: null,
25
+ workspace: null,
26
+ issues: [issue(document.path, null, "malformed", "CMakeLists.txt must be text.")],
27
+ };
28
+ }
29
+ const parsed = parseCMakeFile(document.data);
30
+ if (parsed.issue) {
31
+ return {
32
+ project: null,
33
+ workspace: null,
34
+ issues: [issue(document.path, `line ${parsed.issue.line}`, "malformed", parsed.issue.reason)],
35
+ };
36
+ }
37
+ const calls = parsed.commands.filter((command) => command.name === "project");
38
+ if (calls.length === 0) return { project: null, workspace: null, issues: [] };
39
+ const issues: MetadataIssue[] = [];
40
+ const nested = calls.filter((call) => call.depth > 0);
41
+ for (const call of nested) {
42
+ issues.push(
43
+ issue(
44
+ document.path,
45
+ `project line ${call.line}`,
46
+ "dynamic",
47
+ "project() inside a control block, function, macro, or block() depends on evaluation.",
48
+ ),
49
+ );
50
+ }
51
+ if (calls.length > 1) {
52
+ issues.push(
53
+ issue(
54
+ document.path,
55
+ "project",
56
+ "unresolved",
57
+ `Multiple project() calls (lines ${calls.map((call) => call.line).join(", ")}); none is selected.`,
58
+ ),
59
+ );
60
+ }
61
+ const call = calls[0];
62
+ if (calls.length !== 1 || nested.length > 0 || !call) {
63
+ return { project: null, workspace: null, issues };
64
+ }
65
+ return readProjectCall(document, call, issues);
66
+ }
67
+
68
+ function readProjectCall(
69
+ document: ParsedDocument,
70
+ call: CMakeCommand,
71
+ issues: MetadataIssue[],
72
+ ): DocumentContribution {
73
+ const field = `project line ${call.line}`;
74
+ const nameArgument = call.args[0];
75
+ const name = nameArgument ? literalValue(nameArgument) : null;
76
+ if (!nameArgument || name === null) {
77
+ issues.push(
78
+ issue(
79
+ document.path,
80
+ field,
81
+ nameArgument && DYNAMIC_REFERENCE.test(nameArgument.text) ? "dynamic" : "unsupported",
82
+ nameArgument
83
+ ? "project() name is not a single literal value."
84
+ : "project() declares no name.",
85
+ ),
86
+ );
87
+ return { project: null, workspace: null, issues };
88
+ }
89
+ const description = readDescription(document.path, call, issues);
90
+ return {
91
+ project: baseProject({
92
+ manifestPath: document.path,
93
+ kind: "cmake-project",
94
+ directory: document.directory,
95
+ name,
96
+ nameField: "project",
97
+ description,
98
+ descriptionField: description === null ? null : "project.DESCRIPTION",
99
+ }),
100
+ workspace: null,
101
+ issues,
102
+ };
103
+ }
104
+
105
+ function readDescription(path: string, call: CMakeCommand, issues: MetadataIssue[]): string | null {
106
+ const keyword = call.args.findIndex(
107
+ (argument, index) =>
108
+ index > 0 && argument.form === "unquoted" && argument.text === "DESCRIPTION",
109
+ );
110
+ if (keyword < 0) return null;
111
+ const argument = call.args[keyword + 1];
112
+ const value = argument ? literalValue(argument) : null;
113
+ if (value === null) {
114
+ issues.push(
115
+ issue(
116
+ path,
117
+ "project.DESCRIPTION",
118
+ argument && DYNAMIC_REFERENCE.test(argument.text) ? "dynamic" : "unsupported",
119
+ "project() DESCRIPTION is not a single-line literal value.",
120
+ ),
121
+ );
122
+ return null;
123
+ }
124
+ return value;
125
+ }
126
+
127
+ /**
128
+ * Return a literal argument value, or null when evaluation would be required.
129
+ *
130
+ * Multi-line values are rejected. Bracket arguments are otherwise literal. Quoted and unquoted arguments are
131
+ * literal only without variable or generator-expression references, escapes,
132
+ * or list separators.
133
+ */
134
+ function literalValue(argument: CMakeArgument): string | null {
135
+ if (argument.form === "paren") return null;
136
+ const text = argument.text;
137
+ if (text.length === 0 || /[\r\n]/.test(text)) return null;
138
+ if (argument.form === "bracket") return text;
139
+ if (DYNAMIC_REFERENCE.test(text) || text.includes("\\") || text.includes(";")) return null;
140
+ return text;
141
+ }
@@ -0,0 +1,310 @@
1
+ /**
2
+ * Static Maven `pom.xml` reader.
3
+ *
4
+ * Reads only literal project identity (`artifactId`), description, and explicit
5
+ * aggregation (`modules` / `subprojects`). It never runs Maven, resolves parents,
6
+ * interpolates properties, or activates profiles. Parent inheritance is not
7
+ * module membership.
8
+ */
9
+
10
+ import { XMLParser, XMLValidator } from "fast-xml-parser";
11
+ import type { DocumentContribution, ParsedDocument, WorkspaceConfig } from "./metadata-types.ts";
12
+ import { baseProject, isRecord, issue } from "./metadata-utils.ts";
13
+ import type { MetadataIssue } from "./types.ts";
14
+
15
+ const SUPPORTED_MODEL_VERSIONS = new Set(["4.0.0", "4.1.0"]);
16
+ const NAMESPACE_PREFIX = "http://maven.apache.org/POM/";
17
+ const TEXT = "#text";
18
+ const CDATA = "#cdata";
19
+ const XMLNS = "@_xmlns";
20
+
21
+ const parser = new XMLParser({
22
+ // Custom DOCTYPE entities are never expanded; predefined entities are decoded below.
23
+ processEntities: false,
24
+ ignoreAttributes: false,
25
+ attributeNamePrefix: "@_",
26
+ parseTagValue: false,
27
+ parseAttributeValue: false,
28
+ trimValues: true,
29
+ ignoreDeclaration: true,
30
+ ignorePiTags: true,
31
+ textNodeName: TEXT,
32
+ // Keep CDATA separate so its literal text is never entity-decoded.
33
+ cdataPropName: CDATA,
34
+ isArray: (_name, _path, _leaf, isAttribute) => !isAttribute,
35
+ });
36
+
37
+ /** Parse POM text into the shared parsed-document payload, or throw a readable error. */
38
+ export function parsePom(text: string): unknown {
39
+ const validation = XMLValidator.validate(text);
40
+ if (validation !== true) {
41
+ const { msg, line } = validation.err;
42
+ throw new Error(`Invalid XML at line ${line}: ${msg}`);
43
+ }
44
+ return parser.parse(text);
45
+ }
46
+
47
+ /** Read one parsed `pom.xml` without resolving inherited or build-time behavior. */
48
+ export function readMavenDocument(document: ParsedDocument): DocumentContribution {
49
+ const issues: MetadataIssue[] = [];
50
+ const project = rootProject(document, issues);
51
+ if (!project) return { project: null, workspace: null, issues };
52
+ const modelVersion = readModelVersion(document.path, project, issues);
53
+ if (modelVersion === null) return { project: null, workspace: null, issues };
54
+ const name = readText(document.path, project, "artifactId", issues);
55
+ if (name === null && !issues.some((entry) => entry.field === "project.artifactId")) {
56
+ issues.push(
57
+ issue(document.path, "project.artifactId", "malformed", "POM declares no artifactId."),
58
+ );
59
+ }
60
+ const description = readText(document.path, project, "description", issues);
61
+ discloseProfileModules(document.path, project, issues);
62
+ return {
63
+ project: baseProject({
64
+ manifestPath: document.path,
65
+ kind: "maven-project",
66
+ directory: document.directory,
67
+ name,
68
+ nameField: name === null ? null : "project.artifactId",
69
+ description,
70
+ descriptionField: description === null ? null : "project.description",
71
+ }),
72
+ workspace: readAggregation(document, project, modelVersion, issues),
73
+ issues,
74
+ };
75
+ }
76
+
77
+ function rootProject(
78
+ document: ParsedDocument,
79
+ issues: MetadataIssue[],
80
+ ): Record<string, unknown> | null {
81
+ const data = document.data;
82
+ const roots = isRecord(data) ? Object.keys(data) : [];
83
+ const project = isRecord(data) && Array.isArray(data.project) ? data.project : null;
84
+ if (roots.length !== 1 || project?.length !== 1 || !isRecord(project[0])) {
85
+ issues.push(
86
+ issue(document.path, null, "malformed", "pom.xml must have one <project> root element."),
87
+ );
88
+ return null;
89
+ }
90
+ return project[0];
91
+ }
92
+
93
+ function readModelVersion(
94
+ path: string,
95
+ project: Record<string, unknown>,
96
+ issues: MetadataIssue[],
97
+ ): string | null {
98
+ const declared = readText(path, project, "modelVersion", issues);
99
+ const namespace = typeof project[XMLNS] === "string" ? project[XMLNS] : null;
100
+ const fromNamespace = namespace?.startsWith(NAMESPACE_PREFIX)
101
+ ? namespace.slice(NAMESPACE_PREFIX.length)
102
+ : null;
103
+ const version = declared ?? fromNamespace;
104
+ if (version !== null && SUPPORTED_MODEL_VERSIONS.has(version)) return version;
105
+ issues.push(
106
+ issue(
107
+ path,
108
+ "project.modelVersion",
109
+ "unsupported",
110
+ version === null
111
+ ? "POM model version is not declared; only 4.0.0 and 4.1.0 are read."
112
+ : `Unsupported POM model version \`${version}\`; only 4.0.0 and 4.1.0 are read.`,
113
+ ),
114
+ );
115
+ return null;
116
+ }
117
+
118
+ function readAggregation(
119
+ document: ParsedDocument,
120
+ project: Record<string, unknown>,
121
+ modelVersion: string,
122
+ issues: MetadataIssue[],
123
+ ): WorkspaceConfig | null {
124
+ const hasModules = Object.hasOwn(project, "modules");
125
+ const hasSubprojects = Object.hasOwn(project, "subprojects");
126
+ if (hasSubprojects && modelVersion === "4.0.0") {
127
+ issues.push(
128
+ issue(
129
+ document.path,
130
+ "project.subprojects",
131
+ "unsupported",
132
+ "subprojects requires POM model version 4.1.0.",
133
+ ),
134
+ );
135
+ }
136
+ const useSubprojects = hasSubprojects && modelVersion !== "4.0.0";
137
+ if (useSubprojects && hasModules) {
138
+ issues.push(
139
+ issue(
140
+ document.path,
141
+ "project.modules",
142
+ "unsupported",
143
+ "modules is not combined with subprojects; only subprojects is read.",
144
+ ),
145
+ );
146
+ }
147
+ const [container, child] = useSubprojects
148
+ ? ["subprojects", "subproject"]
149
+ : hasModules
150
+ ? ["modules", "module"]
151
+ : [null, null];
152
+ if (container === null || child === null) return null;
153
+ const field = `project.${container}.${child}`;
154
+ const values = readList(document.path, project[container], { container, child }, issues);
155
+ if (values === null) return null;
156
+ return {
157
+ kind: "maven-modules",
158
+ manifestPath: document.path,
159
+ directory: document.directory,
160
+ field,
161
+ patterns: values,
162
+ excludeField: null,
163
+ excludes: [],
164
+ };
165
+ }
166
+
167
+ function readList(
168
+ path: string,
169
+ nodes: unknown,
170
+ { container, child }: { container: string; child: string },
171
+ issues: MetadataIssue[],
172
+ ): string[] | null {
173
+ const field = `project.${container}`;
174
+ if (!Array.isArray(nodes) || nodes.length !== 1) {
175
+ issues.push(issue(path, field, "malformed", `${field} must appear once.`));
176
+ return null;
177
+ }
178
+ const node = nodes[0];
179
+ // An empty container element parses as an empty string.
180
+ if (node === "") return [];
181
+ if (!isRecord(node)) {
182
+ issues.push(issue(path, field, "malformed", `${field} must contain <${child}> elements.`));
183
+ return null;
184
+ }
185
+ const values: string[] = [];
186
+ const entries = Array.isArray(node[child]) ? node[child] : [];
187
+ for (const [index, entry] of entries.entries()) {
188
+ const value = elementText(entry);
189
+ if (value === null || value === "") {
190
+ issues.push(
191
+ issue(
192
+ path,
193
+ `${field}.${child}[${index}]`,
194
+ "malformed",
195
+ `${child} must be a non-empty path.`,
196
+ ),
197
+ );
198
+ continue;
199
+ }
200
+ values.push(value);
201
+ }
202
+ return values;
203
+ }
204
+
205
+ function discloseProfileModules(
206
+ path: string,
207
+ project: Record<string, unknown>,
208
+ issues: MetadataIssue[],
209
+ ): void {
210
+ const profiles = Array.isArray(project.profiles) ? project.profiles[0] : null;
211
+ const entries = isRecord(profiles) && Array.isArray(profiles.profile) ? profiles.profile : [];
212
+ for (const [index, profile] of entries.entries()) {
213
+ if (!isRecord(profile)) continue;
214
+ for (const container of ["modules", "subprojects"]) {
215
+ if (!Object.hasOwn(profile, container)) continue;
216
+ issues.push(
217
+ issue(
218
+ path,
219
+ `project.profiles.profile[${index}].${container}`,
220
+ "unsupported",
221
+ "Profile-scoped aggregation is not read; profile activation is not evaluated.",
222
+ ),
223
+ );
224
+ }
225
+ }
226
+ }
227
+
228
+ /** Read one optional single text element, disclosing unsupported shapes. */
229
+ function readText(
230
+ path: string,
231
+ project: Record<string, unknown>,
232
+ key: string,
233
+ issues: MetadataIssue[],
234
+ ): string | null {
235
+ if (!Object.hasOwn(project, key)) return null;
236
+ const field = `project.${key}`;
237
+ const nodes = project[key];
238
+ if (!Array.isArray(nodes) || nodes.length !== 1) {
239
+ issues.push(issue(path, field, "malformed", `${field} must appear once.`));
240
+ return null;
241
+ }
242
+ const value = elementText(nodes[0]);
243
+ if (value === null) {
244
+ issues.push(
245
+ issue(
246
+ path,
247
+ field,
248
+ "unsupported",
249
+ `${field} must be plain text without nested elements or custom entities.`,
250
+ ),
251
+ );
252
+ return null;
253
+ }
254
+ if (value === "") return null;
255
+ if (value.includes("${")) {
256
+ issues.push(
257
+ issue(path, field, "dynamic", `${field} uses property interpolation; it is not resolved.`),
258
+ );
259
+ return null;
260
+ }
261
+ return value;
262
+ }
263
+
264
+ /**
265
+ * Read one element's text. Plain text is entity-decoded; a single CDATA section
266
+ * is literal. Nested elements and text mixed with CDATA are unsupported (null).
267
+ */
268
+ function elementText(node: unknown): string | null {
269
+ if (typeof node === "string") return decodeText(node);
270
+ if (!isRecord(node)) return null;
271
+ const keys = Object.keys(node).filter((key) => !key.startsWith("@_"));
272
+ if (keys.length === 0) return "";
273
+ if (keys.length !== 1) return null;
274
+ const value = node[keys[0] ?? ""];
275
+ if (keys[0] === TEXT && typeof value === "string") return decodeText(value);
276
+ if (keys[0] === CDATA && Array.isArray(value) && value.length === 1) {
277
+ return typeof value[0] === "string" ? value[0] : null;
278
+ }
279
+ return null;
280
+ }
281
+
282
+ const PREDEFINED_ENTITIES: Readonly<Record<string, string>> = {
283
+ amp: "&",
284
+ lt: "<",
285
+ gt: ">",
286
+ quot: '"',
287
+ apos: "'",
288
+ };
289
+
290
+ /** Decode predefined and numeric character references; custom entities return null. */
291
+ function decodeText(value: string): string | null {
292
+ let unsupported = false;
293
+ const decoded = value.replaceAll(
294
+ /&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][\w.-]*);/g,
295
+ (_match, ref) => {
296
+ if (ref.startsWith("#x")) return safeCodePoint(Number.parseInt(ref.slice(2), 16));
297
+ if (ref.startsWith("#")) return safeCodePoint(Number.parseInt(ref.slice(1), 10));
298
+ const entity = PREDEFINED_ENTITIES[ref];
299
+ if (entity === undefined) unsupported = true;
300
+ return entity ?? "";
301
+ },
302
+ );
303
+ return unsupported ? null : decoded;
304
+
305
+ function safeCodePoint(code: number): string {
306
+ if (code > 0 && code <= 0x10ffff) return String.fromCodePoint(code);
307
+ unsupported = true;
308
+ return "";
309
+ }
310
+ }
@@ -25,12 +25,12 @@ export function applyMemberships(
25
25
  issues: MetadataIssue[],
26
26
  ): ProjectDeclaration[] {
27
27
  const compiled = configs.map((config) => compileConfig(config, issues));
28
- const goMatches = new Map<string, Set<string>>();
28
+ const exactMatches = new Map<string, Set<string>>();
29
29
  const result = projects.map((project) => ({
30
30
  ...project,
31
- memberships: membershipsForProject(project, compiled, goMatches),
31
+ memberships: membershipsForProject(project, compiled, exactMatches),
32
32
  }));
33
- reportUnmatchedGoUses(compiled, goMatches, issues);
33
+ reportUnmatchedExactPaths(compiled, exactMatches, issues);
34
34
  return result;
35
35
  }
36
36
 
@@ -60,6 +60,7 @@ function compilePattern(
60
60
  value: string,
61
61
  issues: MetadataIssue[],
62
62
  ): CompiledPattern | null {
63
+ if (config.kind === "maven-modules") return compileMavenModule(config, value, issues);
63
64
  const negative = config.kind === "node-workspace" && value.startsWith("!");
64
65
  const normalized = normalizeRelativePath(negative ? value.slice(1) : value);
65
66
  if (
@@ -94,40 +95,88 @@ function compilePattern(
94
95
  return { value, negative, glob: normalized };
95
96
  }
96
97
 
98
+ /**
99
+ * Resolve one Maven module path to an exact root-relative project directory.
100
+ *
101
+ * Maven module values are literal paths relative to the aggregator directory,
102
+ * optionally naming the module's `pom.xml`. Globs are not Maven syntax.
103
+ */
104
+ function compileMavenModule(
105
+ config: WorkspaceConfig,
106
+ value: string,
107
+ issues: MetadataIssue[],
108
+ ): CompiledPattern | null {
109
+ const disclose = (kind: MetadataIssue["kind"], reason: string) => {
110
+ issues.push(issue(config.manifestPath, config.field, kind, reason));
111
+ return null;
112
+ };
113
+ if (value.includes("${")) {
114
+ return disclose("dynamic", `Module path \`${value}\` uses property interpolation.`);
115
+ }
116
+ const slashed = value.replaceAll("\\", "/");
117
+ if (slashed.startsWith("/") || /^[A-Za-z]:/.test(slashed)) {
118
+ return disclose("unsupported", `Absolute module path \`${value}\` is not read.`);
119
+ }
120
+ let directory = path.posix
121
+ .normalize(path.posix.join(config.directory, slashed))
122
+ .replace(/\/+$/, "");
123
+ const basename = path.posix.basename(directory);
124
+ if (basename === "pom.xml") directory = path.posix.dirname(directory);
125
+ else if (basename.endsWith(".xml")) {
126
+ return disclose("unsupported", `Module path \`${value}\` names a non-pom.xml file.`);
127
+ }
128
+ if (directory === config.directory || (directory === "" && config.directory === ".")) {
129
+ return disclose("unsupported", `Module path \`${value}\` refers to the aggregator itself.`);
130
+ }
131
+ if (directory === ".." || directory.startsWith("../")) {
132
+ return disclose("unresolved", `Module path \`${value}\` points outside the observation root.`);
133
+ }
134
+ return { value, negative: false, glob: directory === "" ? "." : directory };
135
+ }
136
+
97
137
  function membershipsForProject(
98
138
  project: ProjectDeclaration,
99
139
  configs: readonly CompiledConfig[],
100
- goMatches: Map<string, Set<string>>,
140
+ exactMatches: Map<string, Set<string>>,
101
141
  ): ProjectMembership[] {
102
142
  const memberships: ProjectMembership[] = [];
103
143
  for (const compiled of configs) {
104
144
  if (!supportsKind(compiled.config.kind, project.kind)) continue;
105
- const relative = relativeDirectory(compiled.config.directory, project.directory);
106
- if (relative === null) continue;
107
- if (compiled.config.kind === "go-work") {
108
- const membership = matchGoUse(compiled, project, goMatches);
109
- if (membership) memberships.push(membership);
110
- continue;
111
- }
112
- if (isExcluded(compiled, relative)) continue;
113
- const matched = lastMatchingPattern(compiled.patterns, relative);
114
- if (!matched) continue;
115
- memberships.push({
116
- kind: compiled.config.kind,
117
- manifestPath: compiled.config.manifestPath,
118
- field: compiled.config.field,
119
- value: matched.value,
120
- });
145
+ const membership = membershipFor(compiled, project, exactMatches);
146
+ if (membership) memberships.push(membership);
121
147
  }
122
148
  return dedupeMemberships(memberships);
123
149
  }
124
150
 
151
+ function membershipFor(
152
+ compiled: CompiledConfig,
153
+ project: ProjectDeclaration,
154
+ exactMatches: Map<string, Set<string>>,
155
+ ): ProjectMembership | null {
156
+ if (compiled.config.kind === "maven-modules") {
157
+ return matchExactPath(compiled, project, exactMatches);
158
+ }
159
+ const relative = relativeDirectory(compiled.config.directory, project.directory);
160
+ if (relative === null) return null;
161
+ if (compiled.config.kind === "go-work") return matchGoUse(compiled, project, exactMatches);
162
+ if (isExcluded(compiled, relative)) return null;
163
+ const matched = lastMatchingPattern(compiled.patterns, relative);
164
+ if (!matched) return null;
165
+ return {
166
+ kind: compiled.config.kind,
167
+ manifestPath: compiled.config.manifestPath,
168
+ field: compiled.config.field,
169
+ value: matched.value,
170
+ };
171
+ }
172
+
125
173
  function supportsKind(
126
174
  workspaceKind: WorkspaceConfig["kind"],
127
175
  projectKind: ProjectDeclaration["kind"],
128
176
  ): boolean {
129
177
  if (workspaceKind === "node-workspace") return projectKind === "node-package";
130
178
  if (workspaceKind === "cargo-workspace") return projectKind === "rust-package";
179
+ if (workspaceKind === "maven-modules") return projectKind === "maven-project";
131
180
  return projectKind === "go-module";
132
181
  }
133
182
 
@@ -163,15 +212,33 @@ function patternMatches(pattern: CompiledPattern, relative: string): boolean {
163
212
  }
164
213
  }
165
214
 
215
+ /** Match a pre-resolved exact project directory, marking every spelling that resolves to it. */
216
+ function matchExactPath(
217
+ config: CompiledConfig,
218
+ project: ProjectDeclaration,
219
+ matches: Map<string, Set<string>>,
220
+ ): ProjectMembership | null {
221
+ const matched = config.patterns.filter((pattern) => pattern.glob === project.directory);
222
+ for (const pattern of matched) markExactMatch(config.config.manifestPath, pattern.value, matches);
223
+ const first = matched[0];
224
+ if (!first) return null;
225
+ return {
226
+ kind: config.config.kind,
227
+ manifestPath: config.config.manifestPath,
228
+ field: config.config.field,
229
+ value: first.value,
230
+ };
231
+ }
232
+
166
233
  function matchGoUse(
167
234
  config: CompiledConfig,
168
235
  project: ProjectDeclaration,
169
- goMatches: Map<string, Set<string>>,
236
+ exactMatches: Map<string, Set<string>>,
170
237
  ): ProjectMembership | null {
171
238
  for (const pattern of config.patterns) {
172
239
  const usePath = normalizeRelativePath(path.posix.join(config.config.directory, pattern.glob));
173
240
  if (usePath !== project.directory) continue;
174
- markGoMatch(config.config.manifestPath, pattern.value, goMatches);
241
+ markExactMatch(config.config.manifestPath, pattern.value, exactMatches);
175
242
  return {
176
243
  kind: "go-work",
177
244
  manifestPath: config.config.manifestPath,
@@ -182,19 +249,24 @@ function matchGoUse(
182
249
  return null;
183
250
  }
184
251
 
185
- function markGoMatch(manifestPath: string, value: string, matches: Map<string, Set<string>>): void {
252
+ function markExactMatch(
253
+ manifestPath: string,
254
+ value: string,
255
+ matches: Map<string, Set<string>>,
256
+ ): void {
186
257
  const values = matches.get(manifestPath) ?? new Set<string>();
187
258
  values.add(value);
188
259
  matches.set(manifestPath, values);
189
260
  }
190
261
 
191
- function reportUnmatchedGoUses(
262
+ function reportUnmatchedExactPaths(
192
263
  configs: readonly CompiledConfig[],
193
264
  matches: ReadonlyMap<string, Set<string>>,
194
265
  issues: MetadataIssue[],
195
266
  ): void {
196
267
  for (const compiled of configs) {
197
- if (compiled.config.kind !== "go-work") continue;
268
+ const kind = compiled.config.kind;
269
+ if (kind !== "go-work" && kind !== "maven-modules") continue;
198
270
  const matched = matches.get(compiled.config.manifestPath) ?? new Set<string>();
199
271
  for (const pattern of compiled.patterns) {
200
272
  if (matched.has(pattern.value)) continue;
@@ -203,7 +275,9 @@ function reportUnmatchedGoUses(
203
275
  compiled.config.manifestPath,
204
276
  compiled.config.field,
205
277
  "unresolved",
206
- `go.work use path \`${pattern.value}\` has no observed go.mod project.`,
278
+ kind === "go-work"
279
+ ? `go.work use path \`${pattern.value}\` has no observed go.mod project.`
280
+ : `Maven module path \`${pattern.value}\` has no observed pom.xml project.`,
207
281
  ),
208
282
  );
209
283
  }
@@ -5,6 +5,7 @@ import * as path from "node:path";
5
5
  import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
6
6
  import { parse as parseToml } from "smol-toml";
7
7
  import { parseDocument } from "yaml";
8
+ import { parsePom } from "./maven.ts";
8
9
  import type { MetadataReadResult, ParsedDocument } from "./metadata-types.ts";
9
10
  import { isRecord, issue } from "./metadata-utils.ts";
10
11
  import { errorMessage, relativeDirectory } from "./paths.ts";
@@ -25,6 +26,8 @@ const KIND_BY_BASENAME = new Map<string, MetadataDocumentKind>([
25
26
  ["Cargo.toml", "cargo"],
26
27
  ["go.mod", "go-mod"],
27
28
  ["go.work", "go-work"],
29
+ ["pom.xml", "maven-pom"],
30
+ ["CMakeLists.txt", "cmake-lists"],
28
31
  ]);
29
32
 
30
33
  interface ReadOutcome {
@@ -105,7 +108,9 @@ function parseText(relativePath: string, kind: MetadataDocumentKind, text: strin
105
108
  }
106
109
  return complete(relativePath, kind, document.toJS());
107
110
  }
108
- if (kind === "go-mod" || kind === "go-work") return complete(relativePath, kind, text);
111
+ if (kind === "go-mod" || kind === "go-work" || kind === "cmake-lists")
112
+ return complete(relativePath, kind, text);
113
+ if (kind === "maven-pom") return complete(relativePath, kind, parsePom(text));
109
114
  return complete(relativePath, kind, parseToml(text));
110
115
  } catch (error) {
111
116
  return failed(relativePath, kind, `Could not parse metadata: ${errorMessage(error)}`);