@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,61 @@
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 `model-docs` subcommand. Launched by the parent with
11
+ * `node <this> --services <module> [--out-file <file>]`. It dynamic-imports the
12
+ * head's services module, runs the framework's `reflectGrammar` (the same
13
+ * reflection the `reflect` subcommand uses), and delivers a navigable Markdown
14
+ * reference to stdout or the named file. Read-only — exits 0 unless booting the
15
+ * head throws. Never imported — only spawned.
16
+ */
17
+ import { emitReport, loadHeadlessContext, OUT_FILE_FLAG } from './headless-harness.js';
18
+ import { formatModelDocs } from './model-docs-report.js';
19
+ function parseArgs(argv) {
20
+ const parsed = {};
21
+ for (let index = 0; index < argv.length; index += 1) {
22
+ const flag = argv[index];
23
+ if (flag === '--services' || flag === OUT_FILE_FLAG) {
24
+ const value = argv[index + 1];
25
+ if (value === undefined) {
26
+ console.error(`Missing value for ${flag}`);
27
+ process.exit(1);
28
+ }
29
+ if (flag === '--services') {
30
+ parsed.servicesModule = value;
31
+ }
32
+ else {
33
+ parsed.outFile = value;
34
+ }
35
+ index += 1;
36
+ }
37
+ else {
38
+ console.error(`Unknown option: ${flag}`);
39
+ process.exit(1);
40
+ }
41
+ }
42
+ return parsed;
43
+ }
44
+ async function main(argv) {
45
+ const args = parseArgs(argv);
46
+ if (!args.servicesModule) {
47
+ console.error('model-docs-driver: --services <module> is required.');
48
+ process.exit(1);
49
+ }
50
+ const { createServices, coreNode } = await loadHeadlessContext(args.servicesModule);
51
+ const reflection = coreNode.reflectGrammar({ createServices });
52
+ emitReport(formatModelDocs(reflection), args.outFile);
53
+ return 0;
54
+ }
55
+ main(process.argv.slice(2))
56
+ .then(code => process.exit(code))
57
+ .catch((error) => {
58
+ console.error(error instanceof Error ? error.message : String(error));
59
+ process.exit(1);
60
+ });
61
+ //# sourceMappingURL=model-docs-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-docs-driver.js","sourceRoot":"","sources":["../../src/commands/model-docs-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;GAOG;AAEH,OAAO,EAA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,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,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;IAC/D,UAAU,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,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,18 @@
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 as a navigable Markdown model reference for adopter
12
+ * docs: a per-language grammar summary, an anchor-linked type index, and a per-type
13
+ * section with cross-linked super/sub types, a reverse "referenced by" index, and a
14
+ * property table. Distinct from `reflect`'s flat dump — this is the publishable
15
+ * reference (cross-linked, navigable), whereas `reflect --json` is the machine form.
16
+ */
17
+ export declare function formatModelDocs(reflection: GrammarReflection): string;
18
+ //# sourceMappingURL=model-docs-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-docs-report.d.ts","sourceRoot":"","sources":["../../src/commands/model-docs-report.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,sBAAsB,CAAC;AAmG9E;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAerE"}
@@ -0,0 +1,123 @@
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
+ /** GitHub-style heading slug: lowercase, non-alphanumerics to hyphens, collapse repeats. */
10
+ function slug(name) {
11
+ return name
12
+ .toLowerCase()
13
+ .replace(/[^a-z0-9]+/g, '-')
14
+ .replace(/^-+|-+$/g, '');
15
+ }
16
+ /** A Markdown link to a type's section, when that type has a section; else bare code. */
17
+ function typeLink(name, known) {
18
+ return known.has(name) ? `[${name}](#${slug(name)})` : `\`${name}\``;
19
+ }
20
+ /** Escape a value for a Markdown table cell (only `|` and newlines can break a row). */
21
+ function cell(value) {
22
+ return value.replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
23
+ }
24
+ /** Per-language grammar summary — extensions, entry rule, terminals table. */
25
+ function languageSection(reflection) {
26
+ const lines = ['## Languages', ''];
27
+ for (const language of reflection.languages) {
28
+ lines.push(`### ${language.languageId}`, '');
29
+ const extensions = language.fileExtensions.length ? language.fileExtensions.map(ext => `\`${ext}\``).join(', ') : '_none_';
30
+ lines.push(`- File extensions: ${extensions}`);
31
+ lines.push(`- Entry rule: ${language.entryRule ? `\`${language.entryRule}\`` : '_none_'}`);
32
+ lines.push('');
33
+ if (language.terminals.length) {
34
+ lines.push('| Terminal | Pattern | Hidden |', '| --- | --- | --- |');
35
+ for (const terminal of language.terminals) {
36
+ const pattern = terminal.pattern !== undefined ? `\`${cell(terminal.pattern)}\`` : '';
37
+ lines.push(`| ${cell(terminal.name)} | ${pattern} | ${terminal.hidden ? 'yes' : ''} |`);
38
+ }
39
+ lines.push('');
40
+ }
41
+ }
42
+ return lines;
43
+ }
44
+ /** The alphabetical type index (TOC), each entry linked, marking abstract vs concrete. */
45
+ function typeIndexSection(reflection) {
46
+ const lines = [`## Types (${reflection.types.length})`, ''];
47
+ for (const type of reflection.types) {
48
+ const kind = type.directSubTypes.length ? ' _(abstract)_' : '';
49
+ lines.push(`- [${type.name}](#${slug(type.name)})${kind}`);
50
+ }
51
+ lines.push('');
52
+ return lines;
53
+ }
54
+ /** Build the reverse index: for each type, the `Type.property` sites that cross-reference it. */
55
+ function referencedByIndex(reflection) {
56
+ const index = new Map();
57
+ for (const type of reflection.types) {
58
+ for (const property of type.properties) {
59
+ if (property.referenceType !== undefined) {
60
+ const sites = index.get(property.referenceType) ?? [];
61
+ sites.push(`${type.name}.${property.name}`);
62
+ index.set(property.referenceType, sites);
63
+ }
64
+ }
65
+ }
66
+ return index;
67
+ }
68
+ /** One type's detail section — extends / subtypes / referenced-by / property table. */
69
+ function typeSection(type, known, referencedBy) {
70
+ const lines = [`### ${type.name}`, ''];
71
+ if (type.superTypes.length) {
72
+ lines.push(`- Extends: ${type.superTypes.map(name => typeLink(name, known)).join(', ')}`);
73
+ }
74
+ if (type.directSubTypes.length) {
75
+ lines.push(`- Known subtypes: ${type.directSubTypes.map(name => typeLink(name, known)).join(', ')}`);
76
+ }
77
+ if (referencedBy.length) {
78
+ // The reverse index is keyed by type, so each `Owner.property` site links to Owner's section.
79
+ const links = referencedBy.map(site => {
80
+ const owner = site.slice(0, site.indexOf('.'));
81
+ return `${typeLink(owner, known)}.${site.slice(site.indexOf('.') + 1)}`;
82
+ });
83
+ lines.push(`- Referenced by: ${links.join(', ')}`);
84
+ }
85
+ lines.push('');
86
+ if (type.properties.length) {
87
+ lines.push('| Property | Kind | Target | Array |', '| --- | --- | --- | --- |');
88
+ for (const property of type.properties) {
89
+ const isReference = property.referenceType !== undefined;
90
+ const target = isReference ? typeLink(property.referenceType, known) : '';
91
+ lines.push(`| ${cell(property.name)} | ${isReference ? 'reference' : 'value'} | ${target} | ${property.array ? 'yes' : ''} |`);
92
+ }
93
+ }
94
+ else {
95
+ lines.push('_No properties._');
96
+ }
97
+ lines.push('');
98
+ return lines;
99
+ }
100
+ /**
101
+ * Render a grammar reflection as a navigable Markdown model reference for adopter
102
+ * docs: a per-language grammar summary, an anchor-linked type index, and a per-type
103
+ * section with cross-linked super/sub types, a reverse "referenced by" index, and a
104
+ * property table. Distinct from `reflect`'s flat dump — this is the publishable
105
+ * reference (cross-linked, navigable), whereas `reflect --json` is the machine form.
106
+ */
107
+ export function formatModelDocs(reflection) {
108
+ const known = new Set(reflection.types.map(type => type.name));
109
+ const referencedBy = referencedByIndex(reflection);
110
+ const typeSections = reflection.types.flatMap(type => typeSection(type, known, referencedBy.get(type.name) ?? []));
111
+ return [
112
+ '# Model reference',
113
+ '',
114
+ 'Generated from the grammar reflection. One section per AST node type.',
115
+ '',
116
+ ...languageSection(reflection),
117
+ ...typeIndexSection(reflection),
118
+ '## Type details',
119
+ '',
120
+ ...typeSections
121
+ ].join('\n');
122
+ }
123
+ //# sourceMappingURL=model-docs-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-docs-report.js","sourceRoot":"","sources":["../../src/commands/model-docs-report.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,4FAA4F;AAC5F,SAAS,IAAI,CAAC,IAAY;IACvB,OAAO,IAAI;SACP,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,yFAAyF;AACzF,SAAS,QAAQ,CAAC,IAAY,EAAE,KAA0B;IACvD,OAAO,KAAK,CAAC,GAAG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,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnH,OAAO;QACJ,mBAAmB;QACnB,EAAE;QACF,uEAAuE;QACvE,EAAE;QACF,GAAG,eAAe,CAAC,UAAU,CAAC;QAC9B,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAC/B,iBAAiB;QACjB,EAAE;QACF,GAAG,YAAY;KACjB,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 runModelDocs} subcommand. */
11
+ export interface ModelDocsCommandOptions extends DriverSpawnOptions {
12
+ /** ESM module exporting a zero-arg `createServices(): { shared }` thunk. */
13
+ readonly servicesModule: string;
14
+ /** Write the Markdown to this file instead of stdout. */
15
+ readonly outFile?: string;
16
+ }
17
+ /** Build the argv the driver child parses. Pure → unit-testable. */
18
+ export declare function buildModelDocsDriverArgs(options: ModelDocsCommandOptions): string[];
19
+ /**
20
+ * Headless model-surface documentation — emits a navigable Markdown reference of
21
+ * every AST node type (type index, cross-linked super/sub types, a reverse
22
+ * "referenced by" index, and a per-language grammar summary), suitable for
23
+ * publishing into adopter docs. Read-only: no workspace is built (the reflection is
24
+ * static once the head registers its language), so it takes no `<workspace>`.
25
+ * There is no `--json` — the machine-readable form is `hydranium-cli reflect --json`.
26
+ * The work runs in a spawned child that dynamic-imports the head's `createServices`
27
+ * module, keeping the binary language-agnostic.
28
+ */
29
+ export declare function runModelDocs(options: ModelDocsCommandOptions): Promise<void>;
30
+ //# sourceMappingURL=model-docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-docs.d.ts","sourceRoot":"","sources":["../../src/commands/model-docs.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ/F,uDAAuD;AACvD,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IAChE,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oEAAoE;AACpE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,EAAE,CAMnF;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E"}
@@ -0,0 +1,37 @@
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/model-docs.js` the
13
+ * compiled driver sits beside it at `lib/commands/model-docs-driver.js`.
14
+ */
15
+ const DRIVER = fileURLToPath(new URL('./model-docs-driver.js', import.meta.url));
16
+ /** Build the argv the driver child parses. Pure → unit-testable. */
17
+ export function buildModelDocsDriverArgs(options) {
18
+ const args = ['--services', options.servicesModule];
19
+ if (options.outFile !== undefined) {
20
+ args.push(OUT_FILE_FLAG, options.outFile);
21
+ }
22
+ return args;
23
+ }
24
+ /**
25
+ * Headless model-surface documentation — emits a navigable Markdown reference of
26
+ * every AST node type (type index, cross-linked super/sub types, a reverse
27
+ * "referenced by" index, and a per-language grammar summary), suitable for
28
+ * publishing into adopter docs. Read-only: no workspace is built (the reflection is
29
+ * static once the head registers its language), so it takes no `<workspace>`.
30
+ * There is no `--json` — the machine-readable form is `hydranium-cli reflect --json`.
31
+ * The work runs in a spawned child that dynamic-imports the head's `createServices`
32
+ * module, keeping the binary language-agnostic.
33
+ */
34
+ export function runModelDocs(options) {
35
+ return runDriverChild(['--max-old-space-size=8192', DRIVER, ...buildModelDocsDriverArgs(options)], options);
36
+ }
37
+ //# sourceMappingURL=model-docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-docs.js","sourceRoot":"","sources":["../../src/commands/model-docs.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,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAUjF,oEAAoE;AACpE,MAAM,UAAU,wBAAwB,CAAC,OAAgC;IACtE,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpD,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;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgC;IAC1D,OAAO,cAAc,CAAC,CAAC,2BAA2B,EAAE,MAAM,EAAE,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC/G,CAAC"}
@@ -0,0 +1,25 @@
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 ProjectsCommandOptions } from './projects.js';
11
+ /**
12
+ * Every flag `projects` accepts. All three are consumed by the shared spawn
13
+ * parser; the command declares no options of its own beyond them.
14
+ */
15
+ export declare const PROJECTS_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.
19
+ */
20
+ export declare const PROJECTS_VALUE_FLAGS: readonly string[];
21
+ /** The `--help` text, as data, held to {@link PROJECTS_FLAGS} by a test. */
22
+ export declare const PROJECTS_HELP: readonly string[];
23
+ export declare function parseProjectsArgs(args: string[], onError?: UsageError): ProjectsCommandOptions;
24
+ export declare function runProjectsCommand(args: string[]): Promise<void>;
25
+ //# sourceMappingURL=projects-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects-args.d.ts","sourceRoot":"","sources":["../../src/commands/projects-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAOJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAe,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAA6B,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAmB,CAAC;AAEtE,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAU1C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,sBAAsB,CAQ7G;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhE"}
@@ -0,0 +1,49 @@
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, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
10
+ import { runProjects } from './projects.js';
11
+ /**
12
+ * Every flag `projects` accepts. All three are consumed by the shared spawn
13
+ * parser; the command declares no options of its own beyond them.
14
+ */
15
+ export const PROJECTS_FLAGS = SERVER_SPAWN_VALUE_FLAGS;
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.
19
+ */
20
+ export const PROJECTS_VALUE_FLAGS = PROJECTS_FLAGS;
21
+ /** The `--help` text, as data, held to {@link PROJECTS_FLAGS} by a test. */
22
+ export const PROJECTS_HELP = [
23
+ 'Usage: hydranium-cli projects --server "<cmd> [args...]" [--cwd <dir>] [--log-level <level>]',
24
+ '',
25
+ 'List projects exposed by the data-server subprocess. Output is newline-delimited',
26
+ 'JSON — one project envelope per line.',
27
+ '',
28
+ 'Options:',
29
+ ' --server "<cmd>" Command-line for the data-server subprocess (required).',
30
+ ' --cwd <dir> Working directory for the spawned child. Default: cwd.',
31
+ ' --log-level <lvl> Log threshold for the spawned server (off|error|warn|info|debug|trace).'
32
+ ];
33
+ export function parseProjectsArgs(args, onError = exitWithUsage) {
34
+ const { serverCommand, serverArgs, cwd, logLevel, extra } = parseServerSpawnOptions(args, 'projects', onError);
35
+ // `projects` declares no options beyond the shared ones, so nothing may
36
+ // survive the spawn parser. Draining `extra` against an empty set is what
37
+ // makes a typo an error here rather than a flag that silently did nothing —
38
+ // the siblings get this from the option list they pass.
39
+ parseFlagOptions(extra, 'projects', [], onError);
40
+ return { serverCommand, serverArgs, cwd, logLevel };
41
+ }
42
+ export function runProjectsCommand(args) {
43
+ if (helpRequested(args, PROJECTS_VALUE_FLAGS)) {
44
+ printHelp(PROJECTS_HELP);
45
+ return Promise.resolve();
46
+ }
47
+ return runProjects(parseProjectsArgs(args));
48
+ }
49
+ //# sourceMappingURL=projects-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects-args.js","sourceRoot":"","sources":["../../src/commands/projects-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAA+B,MAAM,eAAe,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB,wBAAwB,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB,cAAc,CAAC;AAEtE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC7C,8FAA8F;IAC9F,EAAE;IACF,kFAAkF;IAClF,uCAAuC;IACvC,EAAE;IACF,UAAU;IACV,8EAA8E;IAC9E,6EAA6E;IAC7E,8FAA8F;CAChG,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,IAAc,EAAE,UAAsB,aAAa;IAClF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/G,wEAAwE;IACxE,0EAA0E;IAC1E,4EAA4E;IAC5E,wDAAwD;IACxD,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAc;IAC9C,IAAI,aAAa,CAAC,IAAI,EAAE,oBAAoB,CAAC,EAAE,CAAC;QAC7C,SAAS,CAAC,aAAa,CAAC,CAAC;QACzB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,45 @@
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 runProjects} subcommand. `serverCommand` /
13
+ * `serverArgs` mirror what an adopter would pass to spawn the data-server
14
+ * subprocess.
15
+ */
16
+ export interface ProjectsCommandOptions {
17
+ /**
18
+ * Command-line tokens used to spawn the data-server child. Mirrors
19
+ * the `--server "<cmd> [args...]"` shape on the CLI surface — split
20
+ * into command + args here so callers don't have to handle quoting.
21
+ */
22
+ readonly serverCommand: string;
23
+ readonly serverArgs?: readonly string[];
24
+ readonly cwd?: string;
25
+ /** Log threshold for the spawned server, set on its `HYDRANIUM_LOG_LEVEL` env. */
26
+ readonly logLevel?: LogThreshold;
27
+ /**
28
+ * Output sink. Default: `process.stdout.write`. Tests inject a
29
+ * capturing stub.
30
+ */
31
+ readonly write?: (line: string) => void;
32
+ /**
33
+ * Test-only injection: skip the spawn + use this proxy directly. The
34
+ * production CLI never passes this; subcommand unit tests do.
35
+ */
36
+ readonly __proxyForTest?: DataServerProtocol<TransferElement>;
37
+ }
38
+ /**
39
+ * Print the projects exposed by the data-server as one JSON object per
40
+ * line (newline-delimited JSON). Each line is independently parseable —
41
+ * adopters piping the output into `jq` or another line-oriented tool
42
+ * don't need to wait for end-of-stream.
43
+ */
44
+ export declare function runProjects(options: ProjectsCommandOptions): Promise<void>;
45
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/commands/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,YAAY,EAAW,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACpC;;;;OAIG;IACH,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;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAChE;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBhF"}
@@ -0,0 +1,39 @@
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 { logLevelEnv } from '../log-level.js';
10
+ import { withDataServer } from '../spawn-data-server.js';
11
+ /**
12
+ * Print the projects exposed by the data-server as one JSON object per
13
+ * line (newline-delimited JSON). Each line is independently parseable —
14
+ * adopters piping the output into `jq` or another line-oriented tool
15
+ * don't need to wait for end-of-stream.
16
+ */
17
+ export async function runProjects(options) {
18
+ const write = options.write ?? ((line) => process.stdout.write(line));
19
+ if (options.__proxyForTest) {
20
+ const projects = await options.__proxyForTest.getProjects();
21
+ writeProjects(projects, write);
22
+ return;
23
+ }
24
+ await withDataServer({
25
+ command: options.serverCommand,
26
+ args: options.serverArgs,
27
+ cwd: options.cwd,
28
+ env: options.logLevel ? logLevelEnv(options.logLevel) : undefined
29
+ }, async (server) => {
30
+ const projects = await server.getProjects();
31
+ writeProjects(projects, write);
32
+ });
33
+ }
34
+ function writeProjects(projects, write) {
35
+ for (const project of projects) {
36
+ write(`${JSON.stringify(project)}\n`);
37
+ }
38
+ }
39
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/commands/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AA8BzD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA+B;IAC9D,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,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;QAC5D,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC/B,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,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC5C,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC,CACH,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,QAA4B,EAAE,KAA6B;IAC/E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC9B,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
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 QueryCommandOptions } from './query.js';
11
+ /**
12
+ * Every flag `query` 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 QUERY_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.
19
+ */
20
+ export declare const QUERY_VALUE_FLAGS: readonly string[];
21
+ /** The `--help` text, as data, held to {@link QUERY_FLAGS} by a test. */
22
+ export declare const QUERY_HELP: readonly string[];
23
+ export declare function parseQueryArgs(args: string[], onError?: UsageError): QueryCommandOptions;
24
+ export declare function runQueryCommand(args: string[]): Promise<void>;
25
+ //# sourceMappingURL=query-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-args.d.ts","sourceRoot":"","sources":["../../src/commands/query-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAQJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAIhE;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAAgD,CAAC;AAE1F;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAgB,CAAC;AAEhE,yEAAyE;AACzE,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAUvC,CAAC;AAEF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,mBAAmB,CAIvG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7D"}
@@ -0,0 +1,46 @@
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 { runQuery } from './query.js';
11
+ const OWN_FLAGS = ['--uri'];
12
+ /**
13
+ * Every flag `query` 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 QUERY_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.
20
+ */
21
+ export const QUERY_VALUE_FLAGS = QUERY_FLAGS;
22
+ /** The `--help` text, as data, held to {@link QUERY_FLAGS} by a test. */
23
+ export const QUERY_HELP = [
24
+ 'Usage: hydranium-cli query --server "<cmd> [args...]" --uri <uri> [--cwd <dir>] [--log-level <level>]',
25
+ '',
26
+ 'Print the data-server document envelope for `<uri>` as a single JSON line.',
27
+ '',
28
+ 'Options:',
29
+ ' --server "<cmd>" Command-line for the data-server subprocess (required).',
30
+ ' --uri <uri> Document URI (required).',
31
+ ' --cwd <dir> Working directory for the spawned child. Default: cwd.',
32
+ ' --log-level <lvl> Log threshold for the spawned server (off|error|warn|info|debug|trace).'
33
+ ];
34
+ export function parseQueryArgs(args, onError = exitWithUsage) {
35
+ const { serverCommand, serverArgs, cwd, logLevel, extra } = parseServerSpawnOptions(args, 'query', onError);
36
+ const { uri } = parseFlagOptions(extra, 'query', OWN_FLAGS, onError);
37
+ return { serverCommand, serverArgs, cwd, logLevel, uri: assertRequired(uri, '--uri', 'query', onError) };
38
+ }
39
+ export function runQueryCommand(args) {
40
+ if (helpRequested(args, QUERY_VALUE_FLAGS)) {
41
+ printHelp(QUERY_HELP);
42
+ return Promise.resolve();
43
+ }
44
+ return runQuery(parseQueryArgs(args));
45
+ }
46
+ //# sourceMappingURL=query-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-args.js","sourceRoot":"","sources":["../../src/commands/query-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,QAAQ,EAA4B,MAAM,YAAY,CAAC;AAEhE,MAAM,SAAS,GAAG,CAAC,OAAO,CAAU,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE1F;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsB,WAAW,CAAC;AAEhE,yEAAyE;AACzE,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC1C,uGAAuG;IACvG,EAAE;IACF,4EAA4E;IAC5E,EAAE;IACF,UAAU;IACV,8EAA8E;IAC9E,+CAA+C;IAC/C,6EAA6E;IAC7E,8FAA8F;CAChG,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,IAAc,EAAE,UAAsB,aAAa;IAC/E,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5G,MAAM,EAAE,GAAG,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACrE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAc;IAC3C,IAAI,aAAa,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAAE,CAAC;QAC1C,SAAS,CAAC,UAAU,CAAC,CAAC;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,32 @@
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 runQuery} subcommand. Prints the data-server's
13
+ * current view of a document — invokes `getModelDocument({ uri })` on
14
+ * the spawned subprocess and writes the response envelope as a single
15
+ * JSON line. Adopters piping the output into `jq` get a complete record
16
+ * per invocation.
17
+ *
18
+ * Test-only `__proxyForTest` bypasses the spawn for unit tests; the
19
+ * production CLI never passes it.
20
+ */
21
+ export interface QueryCommandOptions {
22
+ readonly serverCommand: string;
23
+ readonly serverArgs?: readonly string[];
24
+ readonly cwd?: string;
25
+ /** Log threshold for the spawned server, set on its `HYDRANIUM_LOG_LEVEL` env. */
26
+ readonly logLevel?: LogThreshold;
27
+ readonly uri: string;
28
+ readonly write?: (line: string) => void;
29
+ readonly __proxyForTest?: DataServerProtocol<TransferElement>;
30
+ }
31
+ export declare function runQuery(options: QueryCommandOptions): Promise<void>;
32
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/commands/query.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;AAInE;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IACjC,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,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAChE;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB1E"}
@@ -0,0 +1,29 @@
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 { logLevelEnv } from '../log-level.js';
10
+ import { withDataServer } from '../spawn-data-server.js';
11
+ export async function runQuery(options) {
12
+ const write = options.write ?? ((line) => process.stdout.write(line));
13
+ if (options.__proxyForTest) {
14
+ // One-shot, unsubscribed read — request validation so the dumped envelope carries diagnostics.
15
+ const doc = await options.__proxyForTest.getModelDocument({ uri: options.uri, includeDiagnostics: true });
16
+ write(`${JSON.stringify(doc)}\n`);
17
+ return;
18
+ }
19
+ await withDataServer({
20
+ command: options.serverCommand,
21
+ args: options.serverArgs,
22
+ cwd: options.cwd,
23
+ env: options.logLevel ? logLevelEnv(options.logLevel) : undefined
24
+ }, async (server) => {
25
+ const doc = await server.getModelDocument({ uri: options.uri, includeDiagnostics: true });
26
+ write(`${JSON.stringify(doc)}\n`);
27
+ });
28
+ }
29
+ //# sourceMappingURL=query.js.map