@hydranium/cli 1.0.0-next.28 → 1.0.0-next.280

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 (222) hide show
  1. package/README.md +75 -204
  2. package/bin/hydranium-cli.js +13 -0
  3. package/heap-analysis/heap/core/load.mjs +2 -2
  4. package/lib/cli-version.js.map +1 -1
  5. package/lib/cli.js +7 -2
  6. package/lib/cli.js.map +1 -1
  7. package/lib/commands/analyze-heap-args.js.map +1 -1
  8. package/lib/commands/analyze-heap.d.ts +3 -0
  9. package/lib/commands/analyze-heap.d.ts.map +1 -1
  10. package/lib/commands/analyze-heap.js +2 -1
  11. package/lib/commands/analyze-heap.js.map +1 -1
  12. package/lib/commands/ast-ground-truth-args.d.ts +3 -2
  13. package/lib/commands/ast-ground-truth-args.d.ts.map +1 -1
  14. package/lib/commands/ast-ground-truth-args.js +11 -9
  15. package/lib/commands/ast-ground-truth-args.js.map +1 -1
  16. package/lib/commands/ast-ground-truth-driver.js +2 -1
  17. package/lib/commands/ast-ground-truth-driver.js.map +1 -1
  18. package/lib/commands/ast-ground-truth.js +1 -1
  19. package/lib/commands/ast-ground-truth.js.map +1 -1
  20. package/lib/commands/client-session.d.ts +17 -0
  21. package/lib/commands/client-session.d.ts.map +1 -0
  22. package/lib/commands/client-session.js +27 -0
  23. package/lib/commands/client-session.js.map +1 -0
  24. package/lib/commands/create-args.d.ts +17 -0
  25. package/lib/commands/create-args.d.ts.map +1 -0
  26. package/lib/commands/create-args.js +53 -0
  27. package/lib/commands/create-args.js.map +1 -0
  28. package/lib/commands/create.d.ts +38 -0
  29. package/lib/commands/create.d.ts.map +1 -0
  30. package/lib/commands/create.js +47 -0
  31. package/lib/commands/create.js.map +1 -0
  32. package/lib/commands/delete-args.d.ts +17 -0
  33. package/lib/commands/delete-args.d.ts.map +1 -0
  34. package/lib/commands/delete-args.js +49 -0
  35. package/lib/commands/delete-args.js.map +1 -0
  36. package/lib/commands/delete.d.ts +30 -0
  37. package/lib/commands/delete.d.ts.map +1 -0
  38. package/lib/commands/delete.js +32 -0
  39. package/lib/commands/delete.js.map +1 -0
  40. package/lib/commands/generate-ast-builder.d.ts +49 -0
  41. package/lib/commands/generate-ast-builder.d.ts.map +1 -0
  42. package/lib/commands/generate-ast-builder.js +200 -0
  43. package/lib/commands/generate-ast-builder.js.map +1 -0
  44. package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
  45. package/lib/commands/generate-transfer-model-args.js +11 -1
  46. package/lib/commands/generate-transfer-model-args.js.map +1 -1
  47. package/lib/commands/generate-transfer-model-config.d.ts.map +1 -1
  48. package/lib/commands/generate-transfer-model-config.js +6 -3
  49. package/lib/commands/generate-transfer-model-config.js.map +1 -1
  50. package/lib/commands/generate-transfer-model.d.ts +9 -0
  51. package/lib/commands/generate-transfer-model.d.ts.map +1 -1
  52. package/lib/commands/generate-transfer-model.js +18 -4
  53. package/lib/commands/generate-transfer-model.js.map +1 -1
  54. package/lib/commands/harness-args.d.ts +44 -42
  55. package/lib/commands/harness-args.d.ts.map +1 -1
  56. package/lib/commands/harness-args.js +109 -27
  57. package/lib/commands/harness-args.js.map +1 -1
  58. package/lib/commands/headless-harness.d.ts +37 -20
  59. package/lib/commands/headless-harness.d.ts.map +1 -1
  60. package/lib/commands/headless-harness.js +68 -17
  61. package/lib/commands/headless-harness.js.map +1 -1
  62. package/lib/commands/init-args.js +6 -6
  63. package/lib/commands/init-args.js.map +1 -1
  64. package/lib/commands/init-prompt.d.ts.map +1 -1
  65. package/lib/commands/init-templates.d.ts +8 -10
  66. package/lib/commands/init-templates.d.ts.map +1 -1
  67. package/lib/commands/init-templates.js +261 -167
  68. package/lib/commands/init-templates.js.map +1 -1
  69. package/lib/commands/init-wizard.js +4 -4
  70. package/lib/commands/init-wizard.js.map +1 -1
  71. package/lib/commands/init-workspace.d.ts +13 -3
  72. package/lib/commands/init-workspace.d.ts.map +1 -1
  73. package/lib/commands/init-workspace.js +21 -6
  74. package/lib/commands/init-workspace.js.map +1 -1
  75. package/lib/commands/init.d.ts +16 -10
  76. package/lib/commands/init.d.ts.map +1 -1
  77. package/lib/commands/init.js +17 -15
  78. package/lib/commands/init.js.map +1 -1
  79. package/lib/commands/lint-grammar-args.d.ts +3 -2
  80. package/lib/commands/lint-grammar-args.d.ts.map +1 -1
  81. package/lib/commands/lint-grammar-args.js +13 -10
  82. package/lib/commands/lint-grammar-args.js.map +1 -1
  83. package/lib/commands/lint-grammar-driver.js +2 -1
  84. package/lib/commands/lint-grammar-driver.js.map +1 -1
  85. package/lib/commands/lint-grammar-report.js.map +1 -1
  86. package/lib/commands/lint-grammar.js +1 -1
  87. package/lib/commands/lint-grammar.js.map +1 -1
  88. package/lib/commands/measure-memory-args.d.ts +3 -2
  89. package/lib/commands/measure-memory-args.d.ts.map +1 -1
  90. package/lib/commands/measure-memory-args.js +22 -11
  91. package/lib/commands/measure-memory-args.js.map +1 -1
  92. package/lib/commands/measure-memory-driver.js +5 -3
  93. package/lib/commands/measure-memory-driver.js.map +1 -1
  94. package/lib/commands/measure-memory.js +1 -1
  95. package/lib/commands/measure-memory.js.map +1 -1
  96. package/lib/commands/model-docs-args.d.ts +4 -3
  97. package/lib/commands/model-docs-args.d.ts.map +1 -1
  98. package/lib/commands/model-docs-args.js +12 -10
  99. package/lib/commands/model-docs-args.js.map +1 -1
  100. package/lib/commands/model-docs-driver.js +2 -1
  101. package/lib/commands/model-docs-driver.js.map +1 -1
  102. package/lib/commands/model-docs.js +1 -1
  103. package/lib/commands/model-docs.js.map +1 -1
  104. package/lib/commands/projects-args.d.ts.map +1 -1
  105. package/lib/commands/projects-args.js +5 -5
  106. package/lib/commands/projects-args.js.map +1 -1
  107. package/lib/commands/projects.d.ts +3 -4
  108. package/lib/commands/projects.d.ts.map +1 -1
  109. package/lib/commands/projects.js +2 -2
  110. package/lib/commands/projects.js.map +1 -1
  111. package/lib/commands/query-args.d.ts.map +1 -1
  112. package/lib/commands/query-args.js +5 -5
  113. package/lib/commands/query-args.js.map +1 -1
  114. package/lib/commands/query.d.ts +3 -4
  115. package/lib/commands/query.d.ts.map +1 -1
  116. package/lib/commands/query.js +2 -2
  117. package/lib/commands/query.js.map +1 -1
  118. package/lib/commands/reflect-args.d.ts +3 -2
  119. package/lib/commands/reflect-args.d.ts.map +1 -1
  120. package/lib/commands/reflect-args.js +13 -10
  121. package/lib/commands/reflect-args.js.map +1 -1
  122. package/lib/commands/reflect-driver.js +2 -1
  123. package/lib/commands/reflect-driver.js.map +1 -1
  124. package/lib/commands/reflect-report.js.map +1 -1
  125. package/lib/commands/reflect.js +1 -1
  126. package/lib/commands/reflect.js.map +1 -1
  127. package/lib/commands/save-args.d.ts.map +1 -1
  128. package/lib/commands/save-args.js +7 -4
  129. package/lib/commands/save-args.js.map +1 -1
  130. package/lib/commands/save.d.ts +8 -4
  131. package/lib/commands/save.d.ts.map +1 -1
  132. package/lib/commands/save.js +12 -23
  133. package/lib/commands/save.js.map +1 -1
  134. package/lib/commands/validate-args.d.ts +3 -2
  135. package/lib/commands/validate-args.d.ts.map +1 -1
  136. package/lib/commands/validate-args.js +13 -10
  137. package/lib/commands/validate-args.js.map +1 -1
  138. package/lib/commands/validate-driver.js +2 -1
  139. package/lib/commands/validate-driver.js.map +1 -1
  140. package/lib/commands/validate-report.js.map +1 -1
  141. package/lib/commands/validate.js +1 -1
  142. package/lib/commands/validate.js.map +1 -1
  143. package/lib/commands/watch-args.d.ts.map +1 -1
  144. package/lib/commands/watch-args.js +6 -4
  145. package/lib/commands/watch-args.js.map +1 -1
  146. package/lib/commands/watch.d.ts +3 -4
  147. package/lib/commands/watch.d.ts.map +1 -1
  148. package/lib/commands/watch.js +20 -2
  149. package/lib/commands/watch.js.map +1 -1
  150. package/lib/driver-heap.d.ts +52 -0
  151. package/lib/driver-heap.d.ts.map +1 -0
  152. package/lib/driver-heap.js +51 -0
  153. package/lib/driver-heap.js.map +1 -0
  154. package/lib/index.d.ts +3 -0
  155. package/lib/index.d.ts.map +1 -1
  156. package/lib/index.js +3 -0
  157. package/lib/index.js.map +1 -1
  158. package/lib/log-level.d.ts +21 -11
  159. package/lib/log-level.d.ts.map +1 -1
  160. package/lib/log-level.js +25 -14
  161. package/lib/log-level.js.map +1 -1
  162. package/lib/spawn-data-server.d.ts +9 -4
  163. package/lib/spawn-data-server.d.ts.map +1 -1
  164. package/lib/spawn-data-server.js +5 -4
  165. package/lib/spawn-data-server.js.map +1 -1
  166. package/lib/stderr-connection-logger.d.ts +12 -0
  167. package/lib/stderr-connection-logger.d.ts.map +1 -0
  168. package/lib/stderr-connection-logger.js +16 -0
  169. package/lib/stderr-connection-logger.js.map +1 -0
  170. package/lib/testing/echo-server.js +9 -1
  171. package/lib/testing/echo-server.js.map +1 -1
  172. package/package.json +50 -39
  173. package/src/cli.ts +7 -2
  174. package/src/commands/analyze-heap.ts +4 -1
  175. package/src/commands/ast-ground-truth-args.ts +15 -12
  176. package/src/commands/ast-ground-truth-driver.ts +2 -1
  177. package/src/commands/ast-ground-truth.ts +1 -1
  178. package/src/commands/client-session.ts +33 -0
  179. package/src/commands/create-args.ts +68 -0
  180. package/src/commands/create.ts +86 -0
  181. package/src/commands/delete-args.ts +64 -0
  182. package/src/commands/delete.ts +61 -0
  183. package/src/commands/generate-ast-builder.ts +246 -0
  184. package/src/commands/generate-transfer-model-args.ts +11 -1
  185. package/src/commands/generate-transfer-model-config.ts +6 -3
  186. package/src/commands/generate-transfer-model.ts +27 -4
  187. package/src/commands/harness-args.ts +95 -31
  188. package/src/commands/headless-harness.ts +86 -26
  189. package/src/commands/init-args.ts +6 -6
  190. package/src/commands/init-templates.ts +272 -169
  191. package/src/commands/init-wizard.ts +4 -4
  192. package/src/commands/init-workspace.ts +31 -7
  193. package/src/commands/init.ts +36 -26
  194. package/src/commands/lint-grammar-args.ts +17 -13
  195. package/src/commands/lint-grammar-driver.ts +2 -1
  196. package/src/commands/lint-grammar.ts +1 -1
  197. package/src/commands/measure-memory-args.ts +27 -14
  198. package/src/commands/measure-memory-driver.ts +5 -3
  199. package/src/commands/measure-memory.ts +1 -1
  200. package/src/commands/model-docs-args.ts +16 -13
  201. package/src/commands/model-docs-driver.ts +2 -1
  202. package/src/commands/model-docs.ts +1 -1
  203. package/src/commands/projects-args.ts +5 -4
  204. package/src/commands/projects.ts +4 -6
  205. package/src/commands/query-args.ts +5 -4
  206. package/src/commands/query.ts +4 -6
  207. package/src/commands/reflect-args.ts +17 -13
  208. package/src/commands/reflect-driver.ts +2 -1
  209. package/src/commands/reflect.ts +1 -1
  210. package/src/commands/save-args.ts +7 -3
  211. package/src/commands/save.ts +24 -27
  212. package/src/commands/validate-args.ts +17 -13
  213. package/src/commands/validate-driver.ts +2 -1
  214. package/src/commands/validate.ts +1 -1
  215. package/src/commands/watch-args.ts +6 -3
  216. package/src/commands/watch.ts +28 -7
  217. package/src/driver-heap.ts +65 -0
  218. package/src/index.ts +3 -0
  219. package/src/log-level.ts +42 -14
  220. package/src/spawn-data-server.ts +17 -5
  221. package/src/stderr-connection-logger.ts +18 -0
  222. package/src/testing/echo-server.ts +11 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ast-ground-truth.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth.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,8BAA8B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAYvF,oEAAoE;AACpE,MAAM,UAAU,0BAA0B,CAAC,OAAqC;IAC7E,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,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;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqC;IACpE,OAAO,cAAc,CAAC,CAAC,2BAA2B,EAAE,MAAM,EAAE,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACjH,CAAC"}
1
+ {"version":3,"file":"ast-ground-truth.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth.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,8BAA8B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAYvF,oEAAoE;AACpE,MAAM,UAAU,0BAA0B,CAAC,OAAqC;IAC7E,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,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;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqC;IACpE,OAAO,cAAc,CAAC,CAAC,MAAM,EAAE,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,17 @@
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 { TransferElement } from '@hydranium/protocol';
10
+ import type { DataServerProtocol } from '@hydranium/protocol/data';
11
+ /**
12
+ * Run `fn` as the client session `clientId`, and end the session whether `fn`
13
+ * succeeded or not, which closes whatever it left open. An end that fails
14
+ * after a failed `fn` is swallowed: `fn`'s error is the one the user needs.
15
+ */
16
+ export declare function withClientSession<T>(server: Pick<DataServerProtocol<TransferElement>, 'createSession' | 'closeSession'>, clientId: string, fn: () => Promise<T>): Promise<T>;
17
+ //# sourceMappingURL=client-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-session.d.ts","sourceRoot":"","sources":["../../src/commands/client-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACtC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC,EACnF,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAWZ"}
@@ -0,0 +1,27 @@
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
+ * Run `fn` as the client session `clientId`, and end the session whether `fn`
11
+ * succeeded or not, which closes whatever it left open. An end that fails
12
+ * after a failed `fn` is swallowed: `fn`'s error is the one the user needs.
13
+ */
14
+ export async function withClientSession(server, clientId, fn) {
15
+ await server.createSession({ clientId, label: 'hydranium-cli' });
16
+ let result;
17
+ try {
18
+ result = await fn();
19
+ }
20
+ catch (error) {
21
+ await server.closeSession({ clientId }).catch(() => undefined);
22
+ throw error;
23
+ }
24
+ await server.closeSession({ clientId });
25
+ return result;
26
+ }
27
+ //# sourceMappingURL=client-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-session.js","sourceRoot":"","sources":["../../src/commands/client-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACpC,MAAmF,EACnF,QAAgB,EAChB,EAAoB;IAEpB,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;IACjE,IAAI,MAAS,CAAC;IACd,IAAI,CAAC;QACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACvB,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AACjB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 CreateCommandOptions } from './create.js';
11
+ /** Every flag `create` accepts, each of which takes a value. */
12
+ export declare const CREATE_FLAGS: readonly string[];
13
+ /** The `--help` text, as data, held to {@link CREATE_FLAGS} by a test. */
14
+ export declare const CREATE_HELP: readonly string[];
15
+ export declare function parseCreateArgs(args: string[], onError?: UsageError): CreateCommandOptions;
16
+ export declare function runCreateCommand(args: string[]): Promise<void>;
17
+ //# sourceMappingURL=create-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-args.d.ts","sourceRoot":"","sources":["../../src/commands/create-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,aAAa,CAAC;AAInE,gEAAgE;AAChE,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAgD,CAAC;AAE3F,0EAA0E;AAC1E,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAexC,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,oBAAoB,CAczG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D"}
@@ -0,0 +1,53 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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, logHelpLines, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
10
+ import { runCreate } from './create.js';
11
+ const OWN_FLAGS = ['--uri', '--content', '--client-id'];
12
+ /** Every flag `create` accepts, each of which takes a value. */
13
+ export const CREATE_FLAGS = [...SERVER_SPAWN_VALUE_FLAGS, ...OWN_FLAGS];
14
+ /** The `--help` text, as data, held to {@link CREATE_FLAGS} by a test. */
15
+ export const CREATE_HELP = [
16
+ 'Usage: hydranium-cli create --server "<cmd>..." --uri <uri> --content <text|@file> [--client-id <id>] [--cwd <dir>] [--log-level <lvl>] [--log-file <file>] [--log-file-level <lvl>]',
17
+ '',
18
+ 'Create the document at `<uri>` with `<content>` via createModelDocument, and persist it',
19
+ 'as given. Fails when the file exists or a client has it open.',
20
+ 'Output is the post-save envelope as a single JSON line.',
21
+ '',
22
+ 'Options:',
23
+ ' --server "<cmd>" Command-line for the data-server subprocess (required).',
24
+ ' --uri <uri> Document URI (required).',
25
+ ' --content <text> Content to write (required). Prefix `@` to read from a file',
26
+ ' (escape with `\\@` for literal `@`-leading content).',
27
+ ' --client-id <id> clientId for authorship attribution. Default: hydranium-cli.',
28
+ ' --cwd <dir> Working directory for the spawned child. Default: cwd.',
29
+ ...logHelpLines(22, 'the spawned server')
30
+ ];
31
+ export function parseCreateArgs(args, onError = exitWithUsage) {
32
+ const { serverCommand, serverArgs, cwd, logLevel, logFile, logFileLevel, extra } = parseServerSpawnOptions(args, 'create', onError);
33
+ const { uri, content, clientId } = parseFlagOptions(extra, 'create', OWN_FLAGS, onError);
34
+ return {
35
+ serverCommand,
36
+ serverArgs,
37
+ cwd,
38
+ logLevel,
39
+ logFile,
40
+ logFileLevel,
41
+ uri: assertRequired(uri, '--uri', 'create', onError),
42
+ content: assertRequired(content, '--content', 'create', onError),
43
+ clientId
44
+ };
45
+ }
46
+ export function runCreateCommand(args) {
47
+ if (helpRequested(args, CREATE_FLAGS)) {
48
+ printHelp(CREATE_HELP);
49
+ return Promise.resolve();
50
+ }
51
+ return runCreate(parseCreateArgs(args));
52
+ }
53
+ //# sourceMappingURL=create-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-args.js","sourceRoot":"","sources":["../../src/commands/create-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6B,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAU,CAAC;AAEjE,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC3C,sLAAsL;IACtL,EAAE;IACF,yFAAyF;IACzF,+DAA+D;IAC/D,yDAAyD;IACzD,EAAE;IACF,UAAU;IACV,iFAAiF;IACjF,kDAAkD;IAClD,qFAAqF;IACrF,8EAA8E;IAC9E,sFAAsF;IACtF,gFAAgF;IAChF,GAAG,YAAY,CAAC,EAAE,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,OAAO,GAAe,aAAa;IAChF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpI,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACzF,OAAO;QACJ,aAAa;QACb,UAAU;QACV,GAAG;QACH,QAAQ;QACR,OAAO;QACP,YAAY;QACZ,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;QACpD,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC;QAChE,QAAQ;KACV,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC5C,IAAI,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QACrC,SAAS,CAAC,WAAW,CAAC,CAAC;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,38 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 TransferElement } from '@hydranium/protocol';
10
+ import type { DataServerProtocol } from '@hydranium/protocol/data';
11
+ import { type LogOptions } from '../log-level.js';
12
+ /**
13
+ * Options for the {@link runCreate} subcommand. Creates the document at `uri`
14
+ * with `content` (literal text or `@<path>` for a file reference) via the
15
+ * data-server's `createModelDocument` RPC, and persists that text as it is.
16
+ * Fails when the file exists or a client has it open. Writes the post-save
17
+ * envelope as a single JSON line, as `save` does.
18
+ *
19
+ * `clientId` defaults to `'hydranium-cli'`. The command creates as a client
20
+ * session under it: it registers the session, creates the document, persists
21
+ * it, since a created document reaches disk only with a save, and ends the
22
+ * session.
23
+ */
24
+ export interface CreateCommandOptions extends LogOptions {
25
+ readonly serverCommand: string;
26
+ readonly serverArgs?: readonly string[];
27
+ readonly cwd?: string;
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 runCreate(options: CreateCommandOptions): Promise<void>;
38
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK1D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACrD,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,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,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB5E"}
@@ -0,0 +1,47 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 { TransferDocument, textHash } from '@hydranium/protocol';
10
+ import { logEnv } from '../log-level.js';
11
+ import { withDataServer } from '../spawn-data-server.js';
12
+ import { withClientSession } from './client-session.js';
13
+ import { resolveContent } from './harness-args.js';
14
+ export async function runCreate(options) {
15
+ const write = options.write ?? ((line) => process.stdout.write(line));
16
+ const clientId = options.clientId ?? 'hydranium-cli';
17
+ const text = await resolveContent(options.content, options.__readFileForTest);
18
+ if (options.__proxyForTest) {
19
+ write(`${JSON.stringify(await createPersisted(options.__proxyForTest, options.uri, clientId, text))}\n`);
20
+ return;
21
+ }
22
+ await withDataServer({
23
+ command: options.serverCommand,
24
+ args: options.serverArgs,
25
+ cwd: options.cwd,
26
+ env: logEnv(options)
27
+ }, async (server) => {
28
+ write(`${JSON.stringify(await createPersisted(server, options.uri, clientId, text))}\n`);
29
+ });
30
+ }
31
+ /**
32
+ * Create `uri` with `text` as the session `clientId` and persist it, then end
33
+ * the session. The persist is gated on the version the create answered, so a
34
+ * later write fails it. The answer is the document's state when the server
35
+ * replied, which can already hold another client's write, so text other than
36
+ * `text` fails the command before anything persists.
37
+ */
38
+ function createPersisted(server, uri, clientId, text) {
39
+ return withClientSession(server, clientId, async () => {
40
+ const created = await server.createModelDocument({ uri, clientId, text });
41
+ if (created.text?.hash !== textHash(text)) {
42
+ throw new Error(`Cannot create ${uri}: another client wrote to it before the create answered`);
43
+ }
44
+ return server.persistModelDocument({ uri, clientId, baseVersion: TransferDocument.assertLoaded(created).model.version });
45
+ });
46
+ }
47
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAwB,MAAM,qBAAqB,CAAC;AAEvF,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4BnD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA6B;IAC1D,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,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE9E,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1B,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACzG,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,MAAM,CAAC,OAAO,CAAC;KACtB,EACD,KAAK,EAAC,MAAM,EAAC,EAAE;QACZ,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5F,CAAC,CACH,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CACrB,MAAoI,EACpI,GAAW,EACX,QAAgB,EAChB,IAAY;IAEZ,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,yDAAyD,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,MAAM,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5H,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,17 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 DeleteCommandOptions } from './delete.js';
11
+ /** Every flag `delete` accepts, each of which takes a value. */
12
+ export declare const DELETE_FLAGS: readonly string[];
13
+ /** The `--help` text, as data, held to {@link DELETE_FLAGS} by a test. */
14
+ export declare const DELETE_HELP: readonly string[];
15
+ export declare function parseDeleteArgs(args: string[], onError?: UsageError): DeleteCommandOptions;
16
+ export declare function runDeleteCommand(args: string[]): Promise<void>;
17
+ //# sourceMappingURL=delete-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-args.d.ts","sourceRoot":"","sources":["../../src/commands/delete-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,aAAa,CAAC;AAInE,gEAAgE;AAChE,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAgD,CAAC;AAE3F,0EAA0E;AAC1E,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAYxC,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,oBAAoB,CAazG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D"}
@@ -0,0 +1,49 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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, logHelpLines, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
10
+ import { runDelete } from './delete.js';
11
+ const OWN_FLAGS = ['--uri', '--client-id'];
12
+ /** Every flag `delete` accepts, each of which takes a value. */
13
+ export const DELETE_FLAGS = [...SERVER_SPAWN_VALUE_FLAGS, ...OWN_FLAGS];
14
+ /** The `--help` text, as data, held to {@link DELETE_FLAGS} by a test. */
15
+ export const DELETE_HELP = [
16
+ 'Usage: hydranium-cli delete --server "<cmd>..." --uri <uri> [--client-id <id>] [--cwd <dir>] [--log-level <lvl>] [--log-file <file>] [--log-file-level <lvl>]',
17
+ '',
18
+ 'Delete the document at `<uri>`, its file and then the document, via deleteModelDocument,',
19
+ 'whatever text it holds. Prints nothing.',
20
+ '',
21
+ 'Options:',
22
+ ' --server "<cmd>" Command-line for the data-server subprocess (required).',
23
+ ' --uri <uri> Document URI (required).',
24
+ ' --client-id <id> clientId the deletion is attributed to. Default: hydranium-cli.',
25
+ ' --cwd <dir> Working directory for the spawned child. Default: cwd.',
26
+ ...logHelpLines(22, 'the spawned server')
27
+ ];
28
+ export function parseDeleteArgs(args, onError = exitWithUsage) {
29
+ const { serverCommand, serverArgs, cwd, logLevel, logFile, logFileLevel, extra } = parseServerSpawnOptions(args, 'delete', onError);
30
+ const { uri, clientId } = parseFlagOptions(extra, 'delete', OWN_FLAGS, onError);
31
+ return {
32
+ serverCommand,
33
+ serverArgs,
34
+ cwd,
35
+ logLevel,
36
+ logFile,
37
+ logFileLevel,
38
+ uri: assertRequired(uri, '--uri', 'delete', onError),
39
+ clientId
40
+ };
41
+ }
42
+ export function runDeleteCommand(args) {
43
+ if (helpRequested(args, DELETE_FLAGS)) {
44
+ printHelp(DELETE_HELP);
45
+ return Promise.resolve();
46
+ }
47
+ return runDelete(parseDeleteArgs(args));
48
+ }
49
+ //# sourceMappingURL=delete-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-args.js","sourceRoot":"","sources":["../../src/commands/delete-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6B,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,aAAa,CAAU,CAAC;AAEpD,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC3C,+JAA+J;IAC/J,EAAE;IACF,0FAA0F;IAC1F,yCAAyC;IACzC,EAAE;IACF,UAAU;IACV,iFAAiF;IACjF,kDAAkD;IAClD,yFAAyF;IACzF,gFAAgF;IAChF,GAAG,YAAY,CAAC,EAAE,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,OAAO,GAAe,aAAa;IAChF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpI,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAChF,OAAO;QACJ,aAAa;QACb,UAAU;QACV,GAAG;QACH,QAAQ;QACR,OAAO;QACP,YAAY;QACZ,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;QACpD,QAAQ;KACV,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC5C,IAAI,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QACrC,SAAS,CAAC,WAAW,CAAC,CAAC;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,30 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 { TransferElement } from '@hydranium/protocol';
10
+ import type { DataServerProtocol } from '@hydranium/protocol/data';
11
+ import { type LogOptions } from '../log-level.js';
12
+ /**
13
+ * Options for the {@link runDelete} subcommand. Deletes the document at `uri`,
14
+ * its file and then the document, via the data-server's `deleteModelDocument`
15
+ * RPC, whatever text it holds. Prints nothing; a failed delete rejects.
16
+ *
17
+ * `clientId` defaults to `'hydranium-cli'`. The command deletes as a client
18
+ * session under it: it registers the session, opens the document, deletes it,
19
+ * and ends the session.
20
+ */
21
+ export interface DeleteCommandOptions extends LogOptions {
22
+ readonly serverCommand: string;
23
+ readonly serverArgs?: readonly string[];
24
+ readonly cwd?: string;
25
+ readonly uri: string;
26
+ readonly clientId?: string;
27
+ readonly __proxyForTest?: DataServerProtocol<TransferElement>;
28
+ }
29
+ export declare function runDelete(options: DeleteCommandOptions): Promise<void>;
30
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACrD,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,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAChE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5E"}
@@ -0,0 +1,32 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 { logEnv } from '../log-level.js';
10
+ import { withDataServer } from '../spawn-data-server.js';
11
+ import { withClientSession } from './client-session.js';
12
+ export async function runDelete(options) {
13
+ const clientId = options.clientId ?? 'hydranium-cli';
14
+ if (options.__proxyForTest) {
15
+ await deleteOpened(options.__proxyForTest, options.uri, clientId);
16
+ return;
17
+ }
18
+ await withDataServer({
19
+ command: options.serverCommand,
20
+ args: options.serverArgs,
21
+ cwd: options.cwd,
22
+ env: logEnv(options)
23
+ }, server => deleteOpened(server, options.uri, clientId));
24
+ }
25
+ /** Open `uri` as the session `clientId` and delete it, then end the session. */
26
+ function deleteOpened(server, uri, clientId) {
27
+ return withClientSession(server, clientId, async () => {
28
+ await server.openModelDocument({ uri, clientId });
29
+ await server.deleteModelDocument({ uri, clientId, baseVersion: 'any' });
30
+ });
31
+ }
32
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAoBxD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA6B;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IACrD,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1B,MAAM,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClE,OAAO;IACV,CAAC;IACD,MAAM,cAAc,CACjB;QACG,OAAO,EAAE,OAAO,CAAC,aAAa;QAC9B,IAAI,EAAE,OAAO,CAAC,UAAU;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC;KACtB,EACD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CACvD,CAAC;AACL,CAAC;AAED,gFAAgF;AAChF,SAAS,YAAY,CAClB,MAAiI,EACjI,GAAW,EACX,QAAgB;IAEhB,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,MAAM,CAAC,iBAAiB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,MAAM,MAAM,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -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 type { SourceFile } from 'ts-morph';
10
+ /** Inputs for {@link emitAstBuilder}, resolved by the transfer-model command. */
11
+ export interface EmitAstBuilderOptions {
12
+ /** Destination path for the generated builder module. */
13
+ outFile: string;
14
+ /** Path to the Langium-generated AST file the builder imports from. */
15
+ astFile: string;
16
+ /** Language id derived from the `<LanguageId>AstReflection` class name. */
17
+ languageId: string;
18
+ /** Header line naming the command that regenerates the file. */
19
+ regenCommand: string;
20
+ }
21
+ /**
22
+ * Emit a module binding {@link makeAstNodeBuilder} to a project's reflection,
23
+ * once per grammar plus once across all of them.
24
+ *
25
+ * **The binding is boilerplate with exactly one degree of freedom** — the type
26
+ * map — so hand-writing it buys nothing and goes stale the moment a grammar is
27
+ * added. Generating it is also the only way a narrowed binding can exist at all:
28
+ * the per-grammar type maps live in namespaces Langium emits only on its
29
+ * multi-language path, so a single-grammar project gets the merged binding alone
30
+ * and there is nothing to narrow.
31
+ *
32
+ * **A narrowed binding is only as narrow as its grammar's import closure.**
33
+ * Langium's per-grammar `AstType` lists everything REACHABLE from that grammar,
34
+ * so where one grammar imports all the others its map equals the project's and
35
+ * its binding checks nothing the merged one does not. The emitted doc says so at
36
+ * each declaration rather than promising a guarantee the type map cannot give.
37
+ *
38
+ * Answers `false` when the AST source declares no whole-project type alias,
39
+ * which means the file did not come from `langium generate` and the caller
40
+ * should report rather than write a module that cannot compile.
41
+ */
42
+ export declare function emitAstBuilder(astSource: SourceFile, options: EmitAstBuilderOptions): boolean;
43
+ /**
44
+ * The module text {@link emitAstBuilder} would write, or `undefined` when the
45
+ * AST source declares no whole-project type alias. Pure over its inputs, so the
46
+ * emitted shape is testable without touching a filesystem.
47
+ */
48
+ export declare function buildAstBuilderSource(astSource: SourceFile, options: EmitAstBuilderOptions): string | undefined;
49
+ //# sourceMappingURL=generate-ast-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-ast-builder.d.ts","sourceRoot":"","sources":["../../src/commands/generate-ast-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACnC,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;CACvB;AAyBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAc7F;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAqB/G"}