@hydranium/cli 1.0.0-next.10

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 (267) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +240 -0
  3. package/heap-analysis/analyze-heap.mjs +798 -0
  4. package/heap-analysis/heap/core/aggregate.mjs +152 -0
  5. package/heap-analysis/heap/core/bucket-label.mjs +23 -0
  6. package/heap-analysis/heap/core/cutpoints.mjs +51 -0
  7. package/heap-analysis/heap/core/diff.mjs +56 -0
  8. package/heap-analysis/heap/core/format.mjs +47 -0
  9. package/heap-analysis/heap/core/holders.mjs +80 -0
  10. package/heap-analysis/heap/core/load.mjs +46 -0
  11. package/heap-analysis/heap/core/report.mjs +68 -0
  12. package/heap-analysis/heap/core/strings.mjs +80 -0
  13. package/heap-analysis/heap/langium/concepts.mjs +230 -0
  14. package/heap-analysis/heap/langium/glsp.classifier.mjs +80 -0
  15. package/heap-analysis/heap/langium/langium.classifier.mjs +203 -0
  16. package/heap-analysis/heap/renderer/renderer.mjs +122 -0
  17. package/lib/cli-version.d.ts +21 -0
  18. package/lib/cli-version.d.ts.map +1 -0
  19. package/lib/cli-version.js +30 -0
  20. package/lib/cli-version.js.map +1 -0
  21. package/lib/cli.d.ts +11 -0
  22. package/lib/cli.d.ts.map +1 -0
  23. package/lib/cli.js +135 -0
  24. package/lib/cli.js.map +1 -0
  25. package/lib/commands/analyze-heap-args.d.ts +46 -0
  26. package/lib/commands/analyze-heap-args.d.ts.map +1 -0
  27. package/lib/commands/analyze-heap-args.js +174 -0
  28. package/lib/commands/analyze-heap-args.js.map +1 -0
  29. package/lib/commands/analyze-heap.d.ts +37 -0
  30. package/lib/commands/analyze-heap.d.ts.map +1 -0
  31. package/lib/commands/analyze-heap.js +63 -0
  32. package/lib/commands/analyze-heap.js.map +1 -0
  33. package/lib/commands/ast-ground-truth-args.d.ts +23 -0
  34. package/lib/commands/ast-ground-truth-args.d.ts.map +1 -0
  35. package/lib/commands/ast-ground-truth-args.js +47 -0
  36. package/lib/commands/ast-ground-truth-args.js.map +1 -0
  37. package/lib/commands/ast-ground-truth-driver.d.ts +10 -0
  38. package/lib/commands/ast-ground-truth-driver.d.ts.map +1 -0
  39. package/lib/commands/ast-ground-truth-driver.js +72 -0
  40. package/lib/commands/ast-ground-truth-driver.js.map +1 -0
  41. package/lib/commands/ast-ground-truth.d.ts +31 -0
  42. package/lib/commands/ast-ground-truth.d.ts.map +1 -0
  43. package/lib/commands/ast-ground-truth.js +36 -0
  44. package/lib/commands/ast-ground-truth.js.map +1 -0
  45. package/lib/commands/generate-transfer-model-args.d.ts +38 -0
  46. package/lib/commands/generate-transfer-model-args.d.ts.map +1 -0
  47. package/lib/commands/generate-transfer-model-args.js +183 -0
  48. package/lib/commands/generate-transfer-model-args.js.map +1 -0
  49. package/lib/commands/generate-transfer-model-config.d.ts +32 -0
  50. package/lib/commands/generate-transfer-model-config.d.ts.map +1 -0
  51. package/lib/commands/generate-transfer-model-config.js +122 -0
  52. package/lib/commands/generate-transfer-model-config.js.map +1 -0
  53. package/lib/commands/generate-transfer-model.d.ts +110 -0
  54. package/lib/commands/generate-transfer-model.d.ts.map +1 -0
  55. package/lib/commands/generate-transfer-model.js +587 -0
  56. package/lib/commands/generate-transfer-model.js.map +1 -0
  57. package/lib/commands/harness-args.d.ts +198 -0
  58. package/lib/commands/harness-args.d.ts.map +1 -0
  59. package/lib/commands/harness-args.js +339 -0
  60. package/lib/commands/harness-args.js.map +1 -0
  61. package/lib/commands/headless-harness.d.ts +97 -0
  62. package/lib/commands/headless-harness.d.ts.map +1 -0
  63. package/lib/commands/headless-harness.js +121 -0
  64. package/lib/commands/headless-harness.js.map +1 -0
  65. package/lib/commands/init-args.d.ts +81 -0
  66. package/lib/commands/init-args.d.ts.map +1 -0
  67. package/lib/commands/init-args.js +250 -0
  68. package/lib/commands/init-args.js.map +1 -0
  69. package/lib/commands/init-prompt.d.ts +66 -0
  70. package/lib/commands/init-prompt.d.ts.map +1 -0
  71. package/lib/commands/init-prompt.js +71 -0
  72. package/lib/commands/init-prompt.js.map +1 -0
  73. package/lib/commands/init-templates.d.ts +42 -0
  74. package/lib/commands/init-templates.d.ts.map +1 -0
  75. package/lib/commands/init-templates.js +1902 -0
  76. package/lib/commands/init-templates.js.map +1 -0
  77. package/lib/commands/init-wizard.d.ts +65 -0
  78. package/lib/commands/init-wizard.d.ts.map +1 -0
  79. package/lib/commands/init-wizard.js +302 -0
  80. package/lib/commands/init-wizard.js.map +1 -0
  81. package/lib/commands/init-workspace.d.ts +168 -0
  82. package/lib/commands/init-workspace.d.ts.map +1 -0
  83. package/lib/commands/init-workspace.js +372 -0
  84. package/lib/commands/init-workspace.js.map +1 -0
  85. package/lib/commands/init.d.ts +273 -0
  86. package/lib/commands/init.d.ts.map +1 -0
  87. package/lib/commands/init.js +303 -0
  88. package/lib/commands/init.js.map +1 -0
  89. package/lib/commands/lint-grammar-args.d.ts +23 -0
  90. package/lib/commands/lint-grammar-args.d.ts.map +1 -0
  91. package/lib/commands/lint-grammar-args.js +63 -0
  92. package/lib/commands/lint-grammar-args.js.map +1 -0
  93. package/lib/commands/lint-grammar-driver.d.ts +10 -0
  94. package/lib/commands/lint-grammar-driver.d.ts.map +1 -0
  95. package/lib/commands/lint-grammar-driver.js +72 -0
  96. package/lib/commands/lint-grammar-driver.js.map +1 -0
  97. package/lib/commands/lint-grammar-report.d.ts +24 -0
  98. package/lib/commands/lint-grammar-report.d.ts.map +1 -0
  99. package/lib/commands/lint-grammar-report.js +65 -0
  100. package/lib/commands/lint-grammar-report.js.map +1 -0
  101. package/lib/commands/lint-grammar.d.ts +33 -0
  102. package/lib/commands/lint-grammar.d.ts.map +1 -0
  103. package/lib/commands/lint-grammar.js +42 -0
  104. package/lib/commands/lint-grammar.js.map +1 -0
  105. package/lib/commands/measure-memory-args.d.ts +23 -0
  106. package/lib/commands/measure-memory-args.d.ts.map +1 -0
  107. package/lib/commands/measure-memory-args.js +106 -0
  108. package/lib/commands/measure-memory-args.js.map +1 -0
  109. package/lib/commands/measure-memory-driver.d.ts +10 -0
  110. package/lib/commands/measure-memory-driver.d.ts.map +1 -0
  111. package/lib/commands/measure-memory-driver.js +110 -0
  112. package/lib/commands/measure-memory-driver.js.map +1 -0
  113. package/lib/commands/measure-memory.d.ts +68 -0
  114. package/lib/commands/measure-memory.d.ts.map +1 -0
  115. package/lib/commands/measure-memory.js +100 -0
  116. package/lib/commands/measure-memory.js.map +1 -0
  117. package/lib/commands/model-docs-args.d.ts +23 -0
  118. package/lib/commands/model-docs-args.d.ts.map +1 -0
  119. package/lib/commands/model-docs-args.js +53 -0
  120. package/lib/commands/model-docs-args.js.map +1 -0
  121. package/lib/commands/model-docs-driver.d.ts +10 -0
  122. package/lib/commands/model-docs-driver.d.ts.map +1 -0
  123. package/lib/commands/model-docs-driver.js +61 -0
  124. package/lib/commands/model-docs-driver.js.map +1 -0
  125. package/lib/commands/model-docs-report.d.ts +18 -0
  126. package/lib/commands/model-docs-report.d.ts.map +1 -0
  127. package/lib/commands/model-docs-report.js +123 -0
  128. package/lib/commands/model-docs-report.js.map +1 -0
  129. package/lib/commands/model-docs.d.ts +30 -0
  130. package/lib/commands/model-docs.d.ts.map +1 -0
  131. package/lib/commands/model-docs.js +37 -0
  132. package/lib/commands/model-docs.js.map +1 -0
  133. package/lib/commands/projects-args.d.ts +25 -0
  134. package/lib/commands/projects-args.d.ts.map +1 -0
  135. package/lib/commands/projects-args.js +49 -0
  136. package/lib/commands/projects-args.js.map +1 -0
  137. package/lib/commands/projects.d.ts +45 -0
  138. package/lib/commands/projects.d.ts.map +1 -0
  139. package/lib/commands/projects.js +39 -0
  140. package/lib/commands/projects.js.map +1 -0
  141. package/lib/commands/query-args.d.ts +25 -0
  142. package/lib/commands/query-args.d.ts.map +1 -0
  143. package/lib/commands/query-args.js +46 -0
  144. package/lib/commands/query-args.js.map +1 -0
  145. package/lib/commands/query.d.ts +32 -0
  146. package/lib/commands/query.d.ts.map +1 -0
  147. package/lib/commands/query.js +29 -0
  148. package/lib/commands/query.js.map +1 -0
  149. package/lib/commands/reflect-args.d.ts +23 -0
  150. package/lib/commands/reflect-args.d.ts.map +1 -0
  151. package/lib/commands/reflect-args.js +59 -0
  152. package/lib/commands/reflect-args.js.map +1 -0
  153. package/lib/commands/reflect-driver.d.ts +10 -0
  154. package/lib/commands/reflect-driver.d.ts.map +1 -0
  155. package/lib/commands/reflect-driver.js +66 -0
  156. package/lib/commands/reflect-driver.js.map +1 -0
  157. package/lib/commands/reflect-report.d.ts +20 -0
  158. package/lib/commands/reflect-report.d.ts.map +1 -0
  159. package/lib/commands/reflect-report.js +127 -0
  160. package/lib/commands/reflect-report.js.map +1 -0
  161. package/lib/commands/reflect.d.ts +30 -0
  162. package/lib/commands/reflect.d.ts.map +1 -0
  163. package/lib/commands/reflect.js +38 -0
  164. package/lib/commands/reflect.js.map +1 -0
  165. package/lib/commands/save-args.d.ts +26 -0
  166. package/lib/commands/save-args.d.ts.map +1 -0
  167. package/lib/commands/save-args.js +59 -0
  168. package/lib/commands/save-args.js.map +1 -0
  169. package/lib/commands/save.d.ts +38 -0
  170. package/lib/commands/save.d.ts.map +1 -0
  171. package/lib/commands/save.js +48 -0
  172. package/lib/commands/save.js.map +1 -0
  173. package/lib/commands/validate-args.d.ts +23 -0
  174. package/lib/commands/validate-args.d.ts.map +1 -0
  175. package/lib/commands/validate-args.js +60 -0
  176. package/lib/commands/validate-args.js.map +1 -0
  177. package/lib/commands/validate-driver.d.ts +10 -0
  178. package/lib/commands/validate-driver.d.ts.map +1 -0
  179. package/lib/commands/validate-driver.js +72 -0
  180. package/lib/commands/validate-driver.js.map +1 -0
  181. package/lib/commands/validate-report.d.ts +30 -0
  182. package/lib/commands/validate-report.d.ts.map +1 -0
  183. package/lib/commands/validate-report.js +87 -0
  184. package/lib/commands/validate-report.js.map +1 -0
  185. package/lib/commands/validate.d.ts +34 -0
  186. package/lib/commands/validate.d.ts.map +1 -0
  187. package/lib/commands/validate.js +41 -0
  188. package/lib/commands/validate.js.map +1 -0
  189. package/lib/commands/watch-args.d.ts +26 -0
  190. package/lib/commands/watch-args.d.ts.map +1 -0
  191. package/lib/commands/watch-args.js +59 -0
  192. package/lib/commands/watch-args.js.map +1 -0
  193. package/lib/commands/watch.d.ts +75 -0
  194. package/lib/commands/watch.d.ts.map +1 -0
  195. package/lib/commands/watch.js +112 -0
  196. package/lib/commands/watch.js.map +1 -0
  197. package/lib/index.d.ts +16 -0
  198. package/lib/index.d.ts.map +1 -0
  199. package/lib/index.js +16 -0
  200. package/lib/index.js.map +1 -0
  201. package/lib/log-level.d.ts +39 -0
  202. package/lib/log-level.d.ts.map +1 -0
  203. package/lib/log-level.js +47 -0
  204. package/lib/log-level.js.map +1 -0
  205. package/lib/package-name.d.ts +33 -0
  206. package/lib/package-name.d.ts.map +1 -0
  207. package/lib/package-name.js +37 -0
  208. package/lib/package-name.js.map +1 -0
  209. package/lib/spawn-data-server.d.ts +102 -0
  210. package/lib/spawn-data-server.d.ts.map +1 -0
  211. package/lib/spawn-data-server.js +154 -0
  212. package/lib/spawn-data-server.js.map +1 -0
  213. package/lib/testing/echo-server.d.ts +11 -0
  214. package/lib/testing/echo-server.d.ts.map +1 -0
  215. package/lib/testing/echo-server.js +79 -0
  216. package/lib/testing/echo-server.js.map +1 -0
  217. package/package.json +105 -0
  218. package/src/cli-version.ts +32 -0
  219. package/src/cli.ts +139 -0
  220. package/src/commands/analyze-heap-args.ts +184 -0
  221. package/src/commands/analyze-heap.ts +76 -0
  222. package/src/commands/ast-ground-truth-args.ts +63 -0
  223. package/src/commands/ast-ground-truth-driver.ts +81 -0
  224. package/src/commands/ast-ground-truth.ts +49 -0
  225. package/src/commands/generate-transfer-model-args.ts +203 -0
  226. package/src/commands/generate-transfer-model-config.ts +128 -0
  227. package/src/commands/generate-transfer-model.ts +716 -0
  228. package/src/commands/harness-args.ts +429 -0
  229. package/src/commands/headless-harness.ts +165 -0
  230. package/src/commands/init-args.ts +273 -0
  231. package/src/commands/init-prompt.ts +149 -0
  232. package/src/commands/init-templates.ts +2037 -0
  233. package/src/commands/init-wizard.ts +378 -0
  234. package/src/commands/init-workspace.ts +442 -0
  235. package/src/commands/init.ts +554 -0
  236. package/src/commands/lint-grammar-args.ts +79 -0
  237. package/src/commands/lint-grammar-driver.ts +83 -0
  238. package/src/commands/lint-grammar-report.ts +74 -0
  239. package/src/commands/lint-grammar.ts +57 -0
  240. package/src/commands/measure-memory-args.ts +123 -0
  241. package/src/commands/measure-memory-driver.ts +128 -0
  242. package/src/commands/measure-memory.ts +143 -0
  243. package/src/commands/model-docs-args.ts +69 -0
  244. package/src/commands/model-docs-driver.ts +68 -0
  245. package/src/commands/model-docs-report.ts +133 -0
  246. package/src/commands/model-docs.ts +48 -0
  247. package/src/commands/projects-args.ts +62 -0
  248. package/src/commands/projects.ts +76 -0
  249. package/src/commands/query-args.ts +61 -0
  250. package/src/commands/query.ts +58 -0
  251. package/src/commands/reflect-args.ts +75 -0
  252. package/src/commands/reflect-driver.ts +76 -0
  253. package/src/commands/reflect-report.ts +138 -0
  254. package/src/commands/reflect.ts +51 -0
  255. package/src/commands/save-args.ts +74 -0
  256. package/src/commands/save.ts +84 -0
  257. package/src/commands/validate-args.ts +76 -0
  258. package/src/commands/validate-driver.ts +84 -0
  259. package/src/commands/validate-report.ts +95 -0
  260. package/src/commands/validate.ts +58 -0
  261. package/src/commands/watch-args.ts +74 -0
  262. package/src/commands/watch.ts +185 -0
  263. package/src/index.ts +16 -0
  264. package/src/log-level.ts +49 -0
  265. package/src/package-name.ts +39 -0
  266. package/src/spawn-data-server.ts +247 -0
  267. package/src/testing/echo-server.ts +93 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAuBzD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAA4B;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9E,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1B,+FAA+F;QAC/F,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1G,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO;IACV,CAAC;IAED,MAAM,cAAc,CACjB;QACG,OAAO,EAAE,OAAO,CAAC,aAAa;QAC9B,IAAI,EAAE,OAAO,CAAC,UAAU;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;KACnE,EACD,KAAK,EAAC,MAAM,EAAC,EAAE;QACZ,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1F,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CACH,CAAC;AACL,CAAC"}
@@ -0,0 +1,23 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type UsageError } from './harness-args.js';
10
+ import { type ReflectCommandOptions } from './reflect.js';
11
+ /**
12
+ * Every flag `reflect` accepts, derived from the sets the parser is handed so
13
+ * the list cannot claim a flag the parser would reject. `--services` is consumed
14
+ * by the shared harness parser itself, so it is in neither set.
15
+ */
16
+ export declare const REFLECT_FLAGS: readonly string[];
17
+ /** The subset that takes a value, so `--help` in a value position reads as data. */
18
+ export declare const REFLECT_VALUE_FLAGS: readonly string[];
19
+ /** The `--help` text, as data, held to {@link REFLECT_FLAGS} by a test. */
20
+ export declare const REFLECT_HELP: readonly string[];
21
+ export declare function parseReflectArgs(args: string[], onError?: UsageError): ReflectCommandOptions;
22
+ export declare function runReflectCommand(args: string[]): Promise<void>;
23
+ //# sourceMappingURL=reflect-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect-args.d.ts","sourceRoot":"","sources":["../../src/commands/reflect-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAKtE;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAmD,CAAC;AAE/F,oFAAoF;AACpF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAAoC,CAAC;AAEtF,2EAA2E;AAC3E,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAgBzC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,qBAAqB,CAW3G;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/D"}
@@ -0,0 +1,59 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { exitWithUsage, helpRequested, LOG_LEVEL_FLAG, logLevelHelpLine, logLevelOption, parseHarnessArgs, printHelp, SERVICES_FLAG } from './harness-args.js';
10
+ import { OUT_FILE_FLAG } from './headless-harness.js';
11
+ import { runReflect } from './reflect.js';
12
+ const VALUE_FLAGS = [OUT_FILE_FLAG, LOG_LEVEL_FLAG];
13
+ const BOOL_FLAGS = ['--json'];
14
+ /**
15
+ * Every flag `reflect` accepts, derived from the sets the parser is handed so
16
+ * the list cannot claim a flag the parser would reject. `--services` is consumed
17
+ * by the shared harness parser itself, so it is in neither set.
18
+ */
19
+ export const REFLECT_FLAGS = [SERVICES_FLAG, ...VALUE_FLAGS, ...BOOL_FLAGS];
20
+ /** The subset that takes a value, so `--help` in a value position reads as data. */
21
+ export const REFLECT_VALUE_FLAGS = [SERVICES_FLAG, ...VALUE_FLAGS];
22
+ /** The `--help` text, as data, held to {@link REFLECT_FLAGS} by a test. */
23
+ export const REFLECT_HELP = [
24
+ 'Usage: hydranium-cli reflect --services <module> [--json] [--out-file <file>] [--log-level <lvl>]',
25
+ '',
26
+ "Dump a head's grammar/AST reflection — the type hierarchy, each language's",
27
+ 'terminals and entry rule, and every cross-reference target. Read-only: no',
28
+ 'workspace is built (the reflection is static once the head registers its',
29
+ 'language), so `reflect` takes no `<workspace>`. `<module>` is an ESM module',
30
+ 'exporting a zero-arg `createServices(): { shared }` thunk. Needs @hydranium/core.',
31
+ '',
32
+ 'Options:',
33
+ ' --services <module> ESM module exporting `createServices(): { shared }` (required).',
34
+ ' --json Emit the raw JSON reflection instead of the Markdown report.',
35
+ ' --out-file <file> Write the report to this file instead of stdout. Written',
36
+ ' only once the report exists, unlike a shell redirection,',
37
+ ' which truncates the file before the head is even booted.',
38
+ logLevelHelpLine(22)
39
+ ];
40
+ export function parseReflectArgs(args, onError = exitWithUsage) {
41
+ const { servicesModule, options } = parseHarnessArgs(args, 'reflect', VALUE_FLAGS, BOOL_FLAGS, {
42
+ requireWorkspace: false,
43
+ onError
44
+ });
45
+ return {
46
+ servicesModule,
47
+ json: options['--json'] === 'true',
48
+ outFile: options[OUT_FILE_FLAG],
49
+ logLevel: logLevelOption(options[LOG_LEVEL_FLAG])
50
+ };
51
+ }
52
+ export function runReflectCommand(args) {
53
+ if (helpRequested(args, REFLECT_VALUE_FLAGS)) {
54
+ printHelp(REFLECT_HELP);
55
+ return Promise.resolve();
56
+ }
57
+ return runReflect(parseReflectArgs(args));
58
+ }
59
+ //# sourceMappingURL=reflect-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect-args.js","sourceRoot":"","sources":["../../src/commands/reflect-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,aAAa,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAA8B,MAAM,cAAc,CAAC;AAEtE,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,cAAc,CAAU,CAAC;AAC7D,MAAM,UAAU,GAAG,CAAC,QAAQ,CAAU,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB,CAAC,aAAa,EAAE,GAAG,WAAW,EAAE,GAAG,UAAU,CAAC,CAAC;AAE/F,oFAAoF;AACpF,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,aAAa,EAAE,GAAG,WAAW,CAAC,CAAC;AAEtF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC5C,mGAAmG;IACnG,EAAE;IACF,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,6EAA6E;IAC7E,mFAAmF;IACnF,EAAE;IACF,UAAU;IACV,yFAAyF;IACzF,sFAAsF;IACtF,kFAAkF;IAClF,kFAAkF;IAClF,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,IAAc,EAAE,UAAsB,aAAa;IACjF,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE;QAC5F,gBAAgB,EAAE,KAAK;QACvB,OAAO;KACT,CAAC,CAAC;IACH,OAAO;QACJ,cAAc;QACd,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,MAAM;QAClC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC;QAC/B,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;KACnD,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC7C,IAAI,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,CAAC;QAC5C,SAAS,CAAC,YAAY,CAAC,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,10 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ export {};
10
+ //# sourceMappingURL=reflect-driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect-driver.d.ts","sourceRoot":"","sources":["../../src/commands/reflect-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF"}
@@ -0,0 +1,66 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /*
10
+ * Spawned child of the `reflect` subcommand. Launched by the parent with
11
+ * `node <this> --services <module> [--json] [--out-file <file>]`. It
12
+ * dynamic-imports the head's services module, runs the framework's
13
+ * `reflectGrammar`, and delivers the report (markdown or `--json`) to stdout or
14
+ * the named file. Read-only — exits 0 unless booting the head throws. Never
15
+ * imported — only spawned.
16
+ */
17
+ import { emitReport, loadHeadlessContext, OUT_FILE_FLAG } from './headless-harness.js';
18
+ import { formatReflectionReport } from './reflect-report.js';
19
+ function parseArgs(argv) {
20
+ const parsed = { json: false };
21
+ for (let index = 0; index < argv.length; index += 1) {
22
+ const flag = argv[index];
23
+ const next = () => {
24
+ const value = argv[index + 1];
25
+ if (value === undefined) {
26
+ console.error(`Missing value for ${flag}`);
27
+ process.exit(1);
28
+ }
29
+ index += 1;
30
+ return value;
31
+ };
32
+ switch (flag) {
33
+ case '--services':
34
+ parsed.servicesModule = next();
35
+ break;
36
+ case '--json':
37
+ parsed.json = true;
38
+ break;
39
+ case OUT_FILE_FLAG:
40
+ parsed.outFile = next();
41
+ break;
42
+ default:
43
+ console.error(`Unknown option: ${flag}`);
44
+ process.exit(1);
45
+ }
46
+ }
47
+ return parsed;
48
+ }
49
+ async function main(argv) {
50
+ const args = parseArgs(argv);
51
+ if (!args.servicesModule) {
52
+ console.error('reflect-driver: --services <module> is required.');
53
+ process.exit(1);
54
+ }
55
+ const { createServices, coreNode } = await loadHeadlessContext(args.servicesModule);
56
+ const result = coreNode.reflectGrammar({ createServices });
57
+ emitReport(formatReflectionReport(result, { json: args.json }), args.outFile);
58
+ return 0;
59
+ }
60
+ main(process.argv.slice(2))
61
+ .then(code => process.exit(code))
62
+ .catch((error) => {
63
+ console.error(error instanceof Error ? error.message : String(error));
64
+ process.exit(1);
65
+ });
66
+ //# sourceMappingURL=reflect-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect-driver.js","sourceRoot":"","sources":["../../src/commands/reflect-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAQ7D,SAAS,SAAS,CAAC,IAAc;IAC9B,MAAM,MAAM,GAAe,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC3C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,GAAW,EAAE;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;YACD,KAAK,IAAI,CAAC,CAAC;YACX,OAAO,KAAK,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,IAAI,EAAE,CAAC;YACZ,KAAK,YAAY;gBACd,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,CAAC;gBAC/B,MAAM;YACT,KAAK,QAAQ;gBACV,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;gBACnB,MAAM;YACT,KAAK,aAAa;gBACf,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;gBACxB,MAAM;YACT;gBACG,OAAO,CAAC,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;gBACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AACjB,CAAC;AAED,KAAK,UAAU,IAAI,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpF,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;IAC3D,UAAU,CAAC,sBAAsB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9E,OAAO,CAAC,CAAC;AACZ,CAAC;AAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACvB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAChC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACvB,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { GrammarReflection } from '@hydranium/core/node';
10
+ /**
11
+ * Render a grammar reflection for the terminal. `json` emits the raw
12
+ * {@link GrammarReflection} (the machine-readable contract); the default is a
13
+ * Markdown reference — a per-language grammar surface (terminals, entry rule), the
14
+ * type-hierarchy tree, the cross-reference target list, and a per-type property
15
+ * table — suitable for piping into a `.md` file.
16
+ */
17
+ export declare function formatReflectionReport(reflection: GrammarReflection, options?: {
18
+ json?: boolean;
19
+ }): string;
20
+ //# sourceMappingURL=reflect-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect-report.d.ts","sourceRoot":"","sources":["../../src/commands/reflect-report.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,sBAAsB,CAAC;AA2G9E;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAY9G"}
@@ -0,0 +1,127 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /** Escape a value for a Markdown table cell (only `|` and newlines can break a row). */
10
+ function cell(value) {
11
+ return value.replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
12
+ }
13
+ /** Wrap a value in inline-code backticks, escaping any embedded backtick run. */
14
+ function code(value) {
15
+ return `\`${value}\``;
16
+ }
17
+ /** The Markdown for each language's grammar surface — extensions, entry rule, terminals table. */
18
+ function languageSection(reflection) {
19
+ const lines = ['## Languages', ''];
20
+ for (const language of reflection.languages) {
21
+ lines.push(`### ${language.languageId}`, '');
22
+ const extensions = language.fileExtensions.length ? language.fileExtensions.map(code).join(', ') : '_none_';
23
+ lines.push(`- File extensions: ${extensions}`);
24
+ lines.push(`- Entry rule: ${language.entryRule ? code(language.entryRule) : '_none_'}`);
25
+ lines.push(`- Terminals: ${language.terminals.length}`, '');
26
+ if (language.terminals.length) {
27
+ lines.push('| Terminal | Pattern | Hidden |', '| --- | --- | --- |');
28
+ for (const terminal of language.terminals) {
29
+ const pattern = terminal.pattern !== undefined ? code(terminal.pattern) : '';
30
+ lines.push(`| ${cell(terminal.name)} | ${cell(pattern)} | ${terminal.hidden ? 'yes' : ''} |`);
31
+ }
32
+ lines.push('');
33
+ }
34
+ }
35
+ return lines;
36
+ }
37
+ /**
38
+ * A depth-first hierarchy tree from the roots (types with no super types) down
39
+ * through `directSubTypes`. A type reachable from several supertypes appears under
40
+ * each; a cycle (should not occur in a grammar) is broken by not re-descending a
41
+ * type already on the current path.
42
+ */
43
+ function hierarchySection(reflection) {
44
+ const byName = new Map(reflection.types.map(type => [type.name, type]));
45
+ const roots = reflection.types.filter(type => type.superTypes.length === 0);
46
+ const lines = ['## Type hierarchy', ''];
47
+ const walk = (type, depth, path) => {
48
+ lines.push(`${' '.repeat(depth)}- ${type.name}`);
49
+ const nextPath = new Set(path).add(type.name);
50
+ for (const childName of type.directSubTypes) {
51
+ const child = byName.get(childName);
52
+ if (child && !nextPath.has(childName)) {
53
+ walk(child, depth + 1, nextPath);
54
+ }
55
+ }
56
+ };
57
+ for (const root of roots) {
58
+ walk(root, 0, new Set());
59
+ }
60
+ lines.push('');
61
+ return lines;
62
+ }
63
+ /** The `Type.property → TargetType` list of every cross-reference in the grammar. */
64
+ function crossReferenceSection(reflection) {
65
+ const lines = ['## Cross-reference targets', ''];
66
+ let hasCrossReferences = false;
67
+ for (const type of reflection.types) {
68
+ for (const property of type.properties) {
69
+ if (property.referenceType !== undefined) {
70
+ lines.push(`- ${code(`${type.name}.${property.name}`)} → ${code(property.referenceType)}`);
71
+ hasCrossReferences = true;
72
+ }
73
+ }
74
+ }
75
+ if (!hasCrossReferences) {
76
+ lines.push('_No cross-references._');
77
+ }
78
+ lines.push('');
79
+ return lines;
80
+ }
81
+ /** Per-type detail: super types plus a property table (name, reference target, array, default). */
82
+ function typeDetailSection(reflection) {
83
+ const lines = [`## Types (${reflection.types.length})`, ''];
84
+ for (const type of reflection.types) {
85
+ lines.push(`### ${type.name}`, '');
86
+ if (type.superTypes.length) {
87
+ lines.push(`- Super types: ${type.superTypes.map(code).join(', ')}`);
88
+ }
89
+ if (type.directSubTypes.length) {
90
+ lines.push(`- Sub types: ${type.directSubTypes.map(code).join(', ')}`);
91
+ }
92
+ lines.push('');
93
+ if (type.properties.length) {
94
+ lines.push('| Property | Reference target | Array | Default |', '| --- | --- | --- | --- |');
95
+ for (const property of type.properties) {
96
+ const reference = property.referenceType !== undefined ? code(property.referenceType) : '';
97
+ lines.push(`| ${cell(property.name)} | ${cell(reference)} | ${property.array ? 'yes' : ''} | ${property.hasDefault ? 'yes' : ''} |`);
98
+ }
99
+ }
100
+ else {
101
+ lines.push('_No properties._');
102
+ }
103
+ lines.push('');
104
+ }
105
+ return lines;
106
+ }
107
+ /**
108
+ * Render a grammar reflection for the terminal. `json` emits the raw
109
+ * {@link GrammarReflection} (the machine-readable contract); the default is a
110
+ * Markdown reference — a per-language grammar surface (terminals, entry rule), the
111
+ * type-hierarchy tree, the cross-reference target list, and a per-type property
112
+ * table — suitable for piping into a `.md` file.
113
+ */
114
+ export function formatReflectionReport(reflection, options = {}) {
115
+ if (options.json) {
116
+ return JSON.stringify(reflection, undefined, 2);
117
+ }
118
+ return [
119
+ '# Grammar reflection',
120
+ '',
121
+ ...languageSection(reflection),
122
+ ...hierarchySection(reflection),
123
+ ...crossReferenceSection(reflection),
124
+ ...typeDetailSection(reflection)
125
+ ].join('\n');
126
+ }
127
+ //# sourceMappingURL=reflect-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect-report.js","sourceRoot":"","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AC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAC1H,CAAC;YACL,CAAC;QACJ,CAAC;aAAM,CAAC;YACL,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA6B,EAAE,UAA8B,EAAE;IACnG,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IACD,OAAO;QACJ,sBAAsB;QACtB,EAAE;QACF,GAAG,eAAe,CAAC,UAAU,CAAC;QAC9B,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAC/B,GAAG,qBAAqB,CAAC,UAAU,CAAC;QACpC,GAAG,iBAAiB,CAAC,UAAU,CAAC;KAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type DriverSpawnOptions } from './headless-harness.js';
10
+ /** Options for the {@link runReflect} subcommand. */
11
+ export interface ReflectCommandOptions extends DriverSpawnOptions {
12
+ /** ESM module exporting a zero-arg `createServices(): { shared }` thunk. */
13
+ readonly servicesModule: string;
14
+ /** Emit the raw JSON reflection instead of the human markdown report. */
15
+ readonly json?: boolean;
16
+ /** Write the report to this file instead of stdout. */
17
+ readonly outFile?: string;
18
+ }
19
+ /** Build the argv the driver child parses. Pure → unit-testable. */
20
+ export declare function buildReflectDriverArgs(options: ReflectCommandOptions): string[];
21
+ /**
22
+ * Headless grammar/AST reflection — dumps a head's type hierarchy, terminals and
23
+ * cross-reference targets. Read-only: no workspace is built (the reflection is
24
+ * available as soon as the head's services register a language), so unlike the
25
+ * sibling harnesses this subcommand takes only `--services`. The work runs in a
26
+ * spawned child that dynamic-imports the head's `createServices` module, keeping
27
+ * the binary language-agnostic.
28
+ */
29
+ export declare function runReflect(options: ReflectCommandOptions): Promise<void>;
30
+ //# sourceMappingURL=reflect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.d.ts","sourceRoot":"","sources":["../../src/commands/reflect.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ/F,qDAAqD;AACrD,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC9D,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,EAAE,CAS/E;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE"}
@@ -0,0 +1,38 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { fileURLToPath } from 'node:url';
10
+ import { OUT_FILE_FLAG, runDriverChild } from './headless-harness.js';
11
+ /**
12
+ * Absolute path to the spawned driver. From `lib/commands/reflect.js` the
13
+ * compiled driver sits beside it at `lib/commands/reflect-driver.js`.
14
+ */
15
+ const DRIVER = fileURLToPath(new URL('./reflect-driver.js', import.meta.url));
16
+ /** Build the argv the driver child parses. Pure → unit-testable. */
17
+ export function buildReflectDriverArgs(options) {
18
+ const args = ['--services', options.servicesModule];
19
+ if (options.json) {
20
+ args.push('--json');
21
+ }
22
+ if (options.outFile !== undefined) {
23
+ args.push(OUT_FILE_FLAG, options.outFile);
24
+ }
25
+ return args;
26
+ }
27
+ /**
28
+ * Headless grammar/AST reflection — dumps a head's type hierarchy, terminals and
29
+ * cross-reference targets. Read-only: no workspace is built (the reflection is
30
+ * available as soon as the head's services register a language), so unlike the
31
+ * sibling harnesses this subcommand takes only `--services`. The work runs in a
32
+ * spawned child that dynamic-imports the head's `createServices` module, keeping
33
+ * the binary language-agnostic.
34
+ */
35
+ export function runReflect(options) {
36
+ return runDriverChild(['--max-old-space-size=8192', DRIVER, ...buildReflectDriverArgs(options)], options);
37
+ }
38
+ //# sourceMappingURL=reflect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.js","sourceRoot":"","sources":["../../src/commands/reflect.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAY9E,oEAAoE;AACpE,MAAM,UAAU,sBAAsB,CAAC,OAA8B;IAClE,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,OAA8B;IACtD,OAAO,cAAc,CAAC,CAAC,2BAA2B,EAAE,MAAM,EAAE,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC7G,CAAC"}
@@ -0,0 +1,26 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type UsageError } from './harness-args.js';
10
+ import { type SaveCommandOptions } from './save.js';
11
+ /**
12
+ * Every flag `save` accepts, derived from its own list plus the shared spawn
13
+ * flags, so the list cannot claim a flag the parser would reject.
14
+ */
15
+ export declare const SAVE_FLAGS: readonly string[];
16
+ /**
17
+ * The subset that takes a value, so `--help` in a value position reads as data.
18
+ * Every flag in this family takes one, so the two lists coincide — and `--content`
19
+ * is the one where a caller plausibly writes that literal text.
20
+ */
21
+ export declare const SAVE_VALUE_FLAGS: readonly string[];
22
+ /** The `--help` text, as data, held to {@link SAVE_FLAGS} by a test. */
23
+ export declare const SAVE_HELP: readonly string[];
24
+ export declare function parseSaveArgs(args: string[], onError?: UsageError): SaveCommandOptions;
25
+ export declare function runSaveCommand(args: string[]): Promise<void>;
26
+ //# sourceMappingURL=save-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-args.d.ts","sourceRoot":"","sources":["../../src/commands/save-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAQJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAW,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI7D;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAgD,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAe,CAAC;AAE9D,wEAAwE;AACxE,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EActC,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,kBAAkB,CAYrG;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5D"}
@@ -0,0 +1,59 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { assertRequired, exitWithUsage, helpRequested, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
10
+ import { runSave } from './save.js';
11
+ const OWN_FLAGS = ['--uri', '--content', '--client-id'];
12
+ /**
13
+ * Every flag `save` accepts, derived from its own list plus the shared spawn
14
+ * flags, so the list cannot claim a flag the parser would reject.
15
+ */
16
+ export const SAVE_FLAGS = [...SERVER_SPAWN_VALUE_FLAGS, ...OWN_FLAGS];
17
+ /**
18
+ * The subset that takes a value, so `--help` in a value position reads as data.
19
+ * Every flag in this family takes one, so the two lists coincide — and `--content`
20
+ * is the one where a caller plausibly writes that literal text.
21
+ */
22
+ export const SAVE_VALUE_FLAGS = SAVE_FLAGS;
23
+ /** The `--help` text, as data, held to {@link SAVE_FLAGS} by a test. */
24
+ export const SAVE_HELP = [
25
+ 'Usage: hydranium-cli save --server "<cmd>..." --uri <uri> --content <text|@file> [--client-id <id>] [--cwd <dir>] [--log-level <level>]',
26
+ '',
27
+ 'Update the document at `<uri>` with `<content>` and persist via saveModelDocument.',
28
+ 'Output is the post-save envelope as a single JSON line.',
29
+ '',
30
+ 'Options:',
31
+ ' --server "<cmd>" Command-line for the data-server subprocess (required).',
32
+ ' --uri <uri> Document URI (required).',
33
+ ' --content <text> Content to write (required). Prefix `@` to read from a file',
34
+ ' (escape with `\\@` for literal `@`-leading content).',
35
+ ' --client-id <id> clientId for authorship attribution. Default: hydranium-cli.',
36
+ ' --cwd <dir> Working directory for the spawned child. Default: cwd.',
37
+ ' --log-level <lvl> Log threshold for the spawned server (off|error|warn|info|debug|trace).'
38
+ ];
39
+ export function parseSaveArgs(args, onError = exitWithUsage) {
40
+ const { serverCommand, serverArgs, cwd, logLevel, extra } = parseServerSpawnOptions(args, 'save', onError);
41
+ const { uri, content, clientId } = parseFlagOptions(extra, 'save', OWN_FLAGS, onError);
42
+ return {
43
+ serverCommand,
44
+ serverArgs,
45
+ cwd,
46
+ logLevel,
47
+ uri: assertRequired(uri, '--uri', 'save', onError),
48
+ content: assertRequired(content, '--content', 'save', onError),
49
+ clientId
50
+ };
51
+ }
52
+ export function runSaveCommand(args) {
53
+ if (helpRequested(args, SAVE_VALUE_FLAGS)) {
54
+ printHelp(SAVE_HELP);
55
+ return Promise.resolve();
56
+ }
57
+ return runSave(parseSaveArgs(args));
58
+ }
59
+ //# sourceMappingURL=save-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-args.js","sourceRoot":"","sources":["../../src/commands/save-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAA2B,MAAM,WAAW,CAAC;AAE7D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AC;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { LogThreshold, TransferElement } from '@hydranium/protocol';
10
+ import type { DataServerProtocol } from '@hydranium/protocol/data';
11
+ /**
12
+ * Options for the {@link runSave} subcommand. Updates the document at
13
+ * `uri` with `content` (literal text or `@<path>` for a file reference)
14
+ * and persists it via the data-server's `saveModelDocument` RPC. Writes
15
+ * the post-save envelope as a single JSON line — the same shape
16
+ * `query` emits, so a save's output is consumable by the same `jq`
17
+ * pipelines.
18
+ *
19
+ * `clientId` defaults to `'hydranium-cli'` — adopters wanting a richer
20
+ * identity (per-user, per-script) override.
21
+ */
22
+ export interface SaveCommandOptions {
23
+ readonly serverCommand: string;
24
+ readonly serverArgs?: readonly string[];
25
+ readonly cwd?: string;
26
+ /** Log threshold for the spawned server, set on its `HYDRANIUM_LOG_LEVEL` env. */
27
+ readonly logLevel?: LogThreshold;
28
+ readonly uri: string;
29
+ /** Literal content text, or `@<path>` to read from a file. */
30
+ readonly content: string;
31
+ readonly clientId?: string;
32
+ readonly write?: (line: string) => void;
33
+ readonly __proxyForTest?: DataServerProtocol<TransferElement>;
34
+ /** Test-only: override the file-reader so unit tests can stub `@<path>` expansion. */
35
+ readonly __readFileForTest?: (path: string) => Promise<string>;
36
+ }
37
+ export declare function runSave(options: SaveCommandOptions): Promise<void>;
38
+ //# sourceMappingURL=save.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../src/commands/save.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKnE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC9D,sFAAsF;IACtF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjE;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBxE"}
@@ -0,0 +1,48 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import * as fs from 'node:fs/promises';
10
+ import { logLevelEnv } from '../log-level.js';
11
+ import { withDataServer } from '../spawn-data-server.js';
12
+ export async function runSave(options) {
13
+ const write = options.write ?? ((line) => process.stdout.write(line));
14
+ const clientId = options.clientId ?? 'hydranium-cli';
15
+ const model = await resolveContent(options.content, options.__readFileForTest);
16
+ if (options.__proxyForTest) {
17
+ const doc = await options.__proxyForTest.saveModelDocument({ uri: options.uri, clientId, model });
18
+ write(`${JSON.stringify(doc)}\n`);
19
+ return;
20
+ }
21
+ await withDataServer({
22
+ command: options.serverCommand,
23
+ args: options.serverArgs,
24
+ cwd: options.cwd,
25
+ env: options.logLevel ? logLevelEnv(options.logLevel) : undefined
26
+ }, async (server) => {
27
+ const doc = await server.saveModelDocument({ uri: options.uri, clientId, model });
28
+ write(`${JSON.stringify(doc)}\n`);
29
+ });
30
+ }
31
+ /**
32
+ * Resolve the `--content` argument to its textual form. The `@<path>`
33
+ * prefix reads from a file (parses as UTF-8); anything else is taken
34
+ * literally. The leading `@` can be escaped as `\@` for content that
35
+ * legitimately starts with `@`.
36
+ */
37
+ async function resolveContent(content, readFile) {
38
+ if (content.startsWith('@')) {
39
+ const path = content.slice(1);
40
+ const reader = readFile ?? ((target) => fs.readFile(target, 'utf8'));
41
+ return reader(path);
42
+ }
43
+ if (content.startsWith('\\@')) {
44
+ return content.slice(1);
45
+ }
46
+ return content;
47
+ }
48
+ //# sourceMappingURL=save.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save.js","sourceRoot":"","sources":["../../src/commands/save.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AA6BzD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAA2B;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAA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