@hydranium/cli 1.0.0-next.18 → 1.0.0-next.181

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 (106) hide show
  1. package/README.md +14 -0
  2. package/bin/hydranium-cli.js +13 -0
  3. package/lib/cli-version.js.map +1 -1
  4. package/lib/cli.js +0 -0
  5. package/lib/commands/analyze-heap-args.js.map +1 -1
  6. package/lib/commands/analyze-heap.d.ts +3 -0
  7. package/lib/commands/analyze-heap.d.ts.map +1 -1
  8. package/lib/commands/analyze-heap.js +2 -1
  9. package/lib/commands/analyze-heap.js.map +1 -1
  10. package/lib/commands/ast-ground-truth-args.js.map +1 -1
  11. package/lib/commands/ast-ground-truth.js +1 -1
  12. package/lib/commands/ast-ground-truth.js.map +1 -1
  13. package/lib/commands/generate-ast-builder.d.ts +49 -0
  14. package/lib/commands/generate-ast-builder.d.ts.map +1 -0
  15. package/lib/commands/generate-ast-builder.js +200 -0
  16. package/lib/commands/generate-ast-builder.js.map +1 -0
  17. package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
  18. package/lib/commands/generate-transfer-model-args.js +11 -1
  19. package/lib/commands/generate-transfer-model-args.js.map +1 -1
  20. package/lib/commands/generate-transfer-model-config.d.ts.map +1 -1
  21. package/lib/commands/generate-transfer-model-config.js +3 -1
  22. package/lib/commands/generate-transfer-model-config.js.map +1 -1
  23. package/lib/commands/generate-transfer-model.d.ts +9 -0
  24. package/lib/commands/generate-transfer-model.d.ts.map +1 -1
  25. package/lib/commands/generate-transfer-model.js +16 -3
  26. package/lib/commands/generate-transfer-model.js.map +1 -1
  27. package/lib/commands/harness-args.js.map +1 -1
  28. package/lib/commands/headless-harness.d.ts +18 -3
  29. package/lib/commands/headless-harness.d.ts.map +1 -1
  30. package/lib/commands/headless-harness.js +12 -4
  31. package/lib/commands/headless-harness.js.map +1 -1
  32. package/lib/commands/init-args.js.map +1 -1
  33. package/lib/commands/init-prompt.d.ts.map +1 -1
  34. package/lib/commands/init-templates.d.ts +0 -9
  35. package/lib/commands/init-templates.d.ts.map +1 -1
  36. package/lib/commands/init-templates.js +78 -55
  37. package/lib/commands/init-templates.js.map +1 -1
  38. package/lib/commands/init-wizard.js.map +1 -1
  39. package/lib/commands/init-workspace.d.ts +7 -3
  40. package/lib/commands/init-workspace.d.ts.map +1 -1
  41. package/lib/commands/init-workspace.js +11 -6
  42. package/lib/commands/init-workspace.js.map +1 -1
  43. package/lib/commands/init.d.ts +4 -2
  44. package/lib/commands/init.d.ts.map +1 -1
  45. package/lib/commands/init.js +7 -10
  46. package/lib/commands/init.js.map +1 -1
  47. package/lib/commands/lint-grammar-args.js.map +1 -1
  48. package/lib/commands/lint-grammar-report.js.map +1 -1
  49. package/lib/commands/lint-grammar.js +1 -1
  50. package/lib/commands/lint-grammar.js.map +1 -1
  51. package/lib/commands/measure-memory-args.js.map +1 -1
  52. package/lib/commands/measure-memory-driver.js +3 -2
  53. package/lib/commands/measure-memory-driver.js.map +1 -1
  54. package/lib/commands/measure-memory.js +1 -1
  55. package/lib/commands/measure-memory.js.map +1 -1
  56. package/lib/commands/model-docs-args.js.map +1 -1
  57. package/lib/commands/model-docs.js +1 -1
  58. package/lib/commands/model-docs.js.map +1 -1
  59. package/lib/commands/projects-args.js.map +1 -1
  60. package/lib/commands/query-args.js.map +1 -1
  61. package/lib/commands/reflect-args.js.map +1 -1
  62. package/lib/commands/reflect-report.js.map +1 -1
  63. package/lib/commands/reflect.js +1 -1
  64. package/lib/commands/reflect.js.map +1 -1
  65. package/lib/commands/save-args.js.map +1 -1
  66. package/lib/commands/save.d.ts +5 -0
  67. package/lib/commands/save.d.ts.map +1 -1
  68. package/lib/commands/save.js +29 -4
  69. package/lib/commands/save.js.map +1 -1
  70. package/lib/commands/validate-args.js.map +1 -1
  71. package/lib/commands/validate-report.js.map +1 -1
  72. package/lib/commands/validate.js +1 -1
  73. package/lib/commands/validate.js.map +1 -1
  74. package/lib/commands/watch-args.js.map +1 -1
  75. package/lib/commands/watch.d.ts.map +1 -1
  76. package/lib/commands/watch.js +18 -0
  77. package/lib/commands/watch.js.map +1 -1
  78. package/lib/driver-heap.d.ts +52 -0
  79. package/lib/driver-heap.d.ts.map +1 -0
  80. package/lib/driver-heap.js +51 -0
  81. package/lib/driver-heap.js.map +1 -0
  82. package/lib/index.d.ts +1 -0
  83. package/lib/index.d.ts.map +1 -1
  84. package/lib/index.js +1 -0
  85. package/lib/index.js.map +1 -1
  86. package/package.json +35 -34
  87. package/src/commands/analyze-heap.ts +4 -1
  88. package/src/commands/ast-ground-truth.ts +1 -1
  89. package/src/commands/generate-ast-builder.ts +246 -0
  90. package/src/commands/generate-transfer-model-args.ts +11 -1
  91. package/src/commands/generate-transfer-model-config.ts +3 -1
  92. package/src/commands/generate-transfer-model.ts +25 -3
  93. package/src/commands/headless-harness.ts +22 -4
  94. package/src/commands/init-templates.ts +81 -56
  95. package/src/commands/init-workspace.ts +17 -7
  96. package/src/commands/init.ts +12 -13
  97. package/src/commands/lint-grammar.ts +1 -1
  98. package/src/commands/measure-memory-driver.ts +3 -2
  99. package/src/commands/measure-memory.ts +1 -1
  100. package/src/commands/model-docs.ts +1 -1
  101. package/src/commands/reflect.ts +1 -1
  102. package/src/commands/save.ts +45 -4
  103. package/src/commands/validate.ts +1 -1
  104. package/src/commands/watch.ts +24 -1
  105. package/src/driver-heap.ts +65 -0
  106. package/src/index.ts +1 -0
@@ -0,0 +1,65 @@
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
+ import { heapCeilingArgs } from '@hydranium/core/node';
11
+
12
+ /**
13
+ * Heap ceiling in MiB for a driver child on a machine with no cgroup limit.
14
+ *
15
+ * The subcommands that spawn one build a whole workspace in that child —
16
+ * `measure-memory` deliberately so, `analyze-heap` loads an entire heap
17
+ * snapshot — so the default Node would pick from physical RAM is too low for
18
+ * the workspaces these are pointed at.
19
+ */
20
+ export const DRIVER_HEAP_MB = 8192;
21
+
22
+ /** Environment variable an operator raises or lowers {@link driverHeapArgs} with. */
23
+ export const DRIVER_HEAP_ENV = 'HYDRANIUM_CLI_MAX_OLD_SPACE_MB';
24
+
25
+ /**
26
+ * Smallest ceiling {@link DRIVER_HEAP_ENV} may state. A driver child builds a
27
+ * whole workspace, so a value this far below the default is a unit mistake
28
+ * rather than a deliberate squeeze.
29
+ */
30
+ export const MIN_DRIVER_HEAP_MB = 256;
31
+
32
+ /**
33
+ * A cgroup reading, so a caller — in practice a test — can decide the ceiling
34
+ * instead of inheriting the machine's. Omitted fields fall back to this
35
+ * process's own reading.
36
+ */
37
+ export interface HeapReading {
38
+ readonly constrained?: number;
39
+ readonly total?: number;
40
+ }
41
+
42
+ /**
43
+ * The `execArgv` prefix every driver child is spawned under.
44
+ *
45
+ * Inside a container this is EMPTY on purpose. {@link DRIVER_HEAP_MB} is sized
46
+ * for a workstation, and handing it to a process under a smaller cgroup limit
47
+ * is worse than handing it nothing: V8 has no reason to collect hard below a
48
+ * ceiling it will never reach, so the kernel OOM-kills the container first and
49
+ * the failure arrives as a signal against the whole cgroup rather than as a
50
+ * heap error the parent can attribute. Left to itself, Node sizes the heap from
51
+ * the limit instead.
52
+ *
53
+ * That trades away the ability to use a LARGE container's memory, since Node's
54
+ * derived default is a fraction of the limit — which is what {@link DRIVER_HEAP_ENV}
55
+ * is for. An operator who states a number has decided, so it wins in a
56
+ * container too.
57
+ */
58
+ export function driverHeapArgs(reading: HeapReading = {}): string[] {
59
+ return heapCeilingArgs({
60
+ desktopDefaultMb: DRIVER_HEAP_MB,
61
+ envValue: process.env[DRIVER_HEAP_ENV],
62
+ minMb: MIN_DRIVER_HEAP_MB,
63
+ ...reading
64
+ });
65
+ }
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
 
10
+ export * from './commands/generate-ast-builder.js';
10
11
  export * from './commands/generate-transfer-model.js';
11
12
  export * from './commands/projects.js';
12
13
  export * from './commands/query.js';