@hydranium/cli 1.0.0-next.25 → 1.0.0-next.251

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 (179) hide show
  1. package/README.md +73 -204
  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.d.ts +3 -2
  11. package/lib/commands/ast-ground-truth-args.d.ts.map +1 -1
  12. package/lib/commands/ast-ground-truth-args.js +11 -9
  13. package/lib/commands/ast-ground-truth-args.js.map +1 -1
  14. package/lib/commands/ast-ground-truth.js +1 -1
  15. package/lib/commands/ast-ground-truth.js.map +1 -1
  16. package/lib/commands/generate-ast-builder.d.ts +49 -0
  17. package/lib/commands/generate-ast-builder.d.ts.map +1 -0
  18. package/lib/commands/generate-ast-builder.js +200 -0
  19. package/lib/commands/generate-ast-builder.js.map +1 -0
  20. package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
  21. package/lib/commands/generate-transfer-model-args.js +11 -1
  22. package/lib/commands/generate-transfer-model-args.js.map +1 -1
  23. package/lib/commands/generate-transfer-model-config.d.ts.map +1 -1
  24. package/lib/commands/generate-transfer-model-config.js +3 -1
  25. package/lib/commands/generate-transfer-model-config.js.map +1 -1
  26. package/lib/commands/generate-transfer-model.d.ts +9 -0
  27. package/lib/commands/generate-transfer-model.d.ts.map +1 -1
  28. package/lib/commands/generate-transfer-model.js +16 -3
  29. package/lib/commands/generate-transfer-model.js.map +1 -1
  30. package/lib/commands/harness-args.d.ts +37 -42
  31. package/lib/commands/harness-args.d.ts.map +1 -1
  32. package/lib/commands/harness-args.js +65 -25
  33. package/lib/commands/harness-args.js.map +1 -1
  34. package/lib/commands/headless-harness.d.ts +37 -20
  35. package/lib/commands/headless-harness.d.ts.map +1 -1
  36. package/lib/commands/headless-harness.js +68 -17
  37. package/lib/commands/headless-harness.js.map +1 -1
  38. package/lib/commands/init-args.js +6 -6
  39. package/lib/commands/init-args.js.map +1 -1
  40. package/lib/commands/init-prompt.d.ts.map +1 -1
  41. package/lib/commands/init-templates.d.ts +8 -10
  42. package/lib/commands/init-templates.d.ts.map +1 -1
  43. package/lib/commands/init-templates.js +245 -140
  44. package/lib/commands/init-templates.js.map +1 -1
  45. package/lib/commands/init-wizard.js +4 -4
  46. package/lib/commands/init-wizard.js.map +1 -1
  47. package/lib/commands/init-workspace.d.ts +13 -3
  48. package/lib/commands/init-workspace.d.ts.map +1 -1
  49. package/lib/commands/init-workspace.js +21 -6
  50. package/lib/commands/init-workspace.js.map +1 -1
  51. package/lib/commands/init.d.ts +16 -10
  52. package/lib/commands/init.d.ts.map +1 -1
  53. package/lib/commands/init.js +17 -15
  54. package/lib/commands/init.js.map +1 -1
  55. package/lib/commands/lint-grammar-args.d.ts +3 -2
  56. package/lib/commands/lint-grammar-args.d.ts.map +1 -1
  57. package/lib/commands/lint-grammar-args.js +13 -10
  58. package/lib/commands/lint-grammar-args.js.map +1 -1
  59. package/lib/commands/lint-grammar-report.js.map +1 -1
  60. package/lib/commands/lint-grammar.js +1 -1
  61. package/lib/commands/lint-grammar.js.map +1 -1
  62. package/lib/commands/measure-memory-args.d.ts +3 -2
  63. package/lib/commands/measure-memory-args.d.ts.map +1 -1
  64. package/lib/commands/measure-memory-args.js +20 -10
  65. package/lib/commands/measure-memory-args.js.map +1 -1
  66. package/lib/commands/measure-memory-driver.js +3 -2
  67. package/lib/commands/measure-memory-driver.js.map +1 -1
  68. package/lib/commands/measure-memory.js +1 -1
  69. package/lib/commands/measure-memory.js.map +1 -1
  70. package/lib/commands/model-docs-args.d.ts +4 -3
  71. package/lib/commands/model-docs-args.d.ts.map +1 -1
  72. package/lib/commands/model-docs-args.js +12 -10
  73. package/lib/commands/model-docs-args.js.map +1 -1
  74. package/lib/commands/model-docs.js +1 -1
  75. package/lib/commands/model-docs.js.map +1 -1
  76. package/lib/commands/projects-args.d.ts.map +1 -1
  77. package/lib/commands/projects-args.js +5 -5
  78. package/lib/commands/projects-args.js.map +1 -1
  79. package/lib/commands/projects.d.ts +3 -4
  80. package/lib/commands/projects.d.ts.map +1 -1
  81. package/lib/commands/projects.js +2 -2
  82. package/lib/commands/projects.js.map +1 -1
  83. package/lib/commands/query-args.d.ts.map +1 -1
  84. package/lib/commands/query-args.js +5 -5
  85. package/lib/commands/query-args.js.map +1 -1
  86. package/lib/commands/query.d.ts +3 -4
  87. package/lib/commands/query.d.ts.map +1 -1
  88. package/lib/commands/query.js +2 -2
  89. package/lib/commands/query.js.map +1 -1
  90. package/lib/commands/reflect-args.d.ts +3 -2
  91. package/lib/commands/reflect-args.d.ts.map +1 -1
  92. package/lib/commands/reflect-args.js +13 -10
  93. package/lib/commands/reflect-args.js.map +1 -1
  94. package/lib/commands/reflect-report.js.map +1 -1
  95. package/lib/commands/reflect.js +1 -1
  96. package/lib/commands/reflect.js.map +1 -1
  97. package/lib/commands/save-args.d.ts.map +1 -1
  98. package/lib/commands/save-args.js +6 -4
  99. package/lib/commands/save-args.js.map +1 -1
  100. package/lib/commands/save.d.ts +8 -4
  101. package/lib/commands/save.d.ts.map +1 -1
  102. package/lib/commands/save.js +31 -6
  103. package/lib/commands/save.js.map +1 -1
  104. package/lib/commands/validate-args.d.ts +3 -2
  105. package/lib/commands/validate-args.d.ts.map +1 -1
  106. package/lib/commands/validate-args.js +13 -10
  107. package/lib/commands/validate-args.js.map +1 -1
  108. package/lib/commands/validate-report.js.map +1 -1
  109. package/lib/commands/validate.js +1 -1
  110. package/lib/commands/validate.js.map +1 -1
  111. package/lib/commands/watch-args.d.ts.map +1 -1
  112. package/lib/commands/watch-args.js +6 -4
  113. package/lib/commands/watch-args.js.map +1 -1
  114. package/lib/commands/watch.d.ts +3 -4
  115. package/lib/commands/watch.d.ts.map +1 -1
  116. package/lib/commands/watch.js +20 -2
  117. package/lib/commands/watch.js.map +1 -1
  118. package/lib/driver-heap.d.ts +52 -0
  119. package/lib/driver-heap.d.ts.map +1 -0
  120. package/lib/driver-heap.js +51 -0
  121. package/lib/driver-heap.js.map +1 -0
  122. package/lib/index.d.ts +1 -0
  123. package/lib/index.d.ts.map +1 -1
  124. package/lib/index.js +1 -0
  125. package/lib/index.js.map +1 -1
  126. package/lib/log-level.d.ts +21 -11
  127. package/lib/log-level.d.ts.map +1 -1
  128. package/lib/log-level.js +25 -14
  129. package/lib/log-level.js.map +1 -1
  130. package/lib/spawn-data-server.d.ts +6 -1
  131. package/lib/spawn-data-server.d.ts.map +1 -1
  132. package/lib/spawn-data-server.js +2 -1
  133. package/lib/spawn-data-server.js.map +1 -1
  134. package/lib/stderr-connection-logger.d.ts +12 -0
  135. package/lib/stderr-connection-logger.d.ts.map +1 -0
  136. package/lib/stderr-connection-logger.js +16 -0
  137. package/lib/stderr-connection-logger.js.map +1 -0
  138. package/lib/testing/echo-server.js +8 -1
  139. package/lib/testing/echo-server.js.map +1 -1
  140. package/package.json +50 -39
  141. package/src/commands/analyze-heap.ts +4 -1
  142. package/src/commands/ast-ground-truth-args.ts +15 -12
  143. package/src/commands/ast-ground-truth.ts +1 -1
  144. package/src/commands/generate-ast-builder.ts +246 -0
  145. package/src/commands/generate-transfer-model-args.ts +11 -1
  146. package/src/commands/generate-transfer-model-config.ts +3 -1
  147. package/src/commands/generate-transfer-model.ts +25 -3
  148. package/src/commands/harness-args.ts +73 -28
  149. package/src/commands/headless-harness.ts +86 -26
  150. package/src/commands/init-args.ts +6 -6
  151. package/src/commands/init-templates.ts +255 -142
  152. package/src/commands/init-wizard.ts +4 -4
  153. package/src/commands/init-workspace.ts +31 -7
  154. package/src/commands/init.ts +36 -26
  155. package/src/commands/lint-grammar-args.ts +17 -13
  156. package/src/commands/lint-grammar.ts +1 -1
  157. package/src/commands/measure-memory-args.ts +25 -13
  158. package/src/commands/measure-memory-driver.ts +3 -2
  159. package/src/commands/measure-memory.ts +1 -1
  160. package/src/commands/model-docs-args.ts +16 -13
  161. package/src/commands/model-docs.ts +1 -1
  162. package/src/commands/projects-args.ts +5 -4
  163. package/src/commands/projects.ts +4 -6
  164. package/src/commands/query-args.ts +5 -4
  165. package/src/commands/query.ts +4 -6
  166. package/src/commands/reflect-args.ts +17 -13
  167. package/src/commands/reflect.ts +1 -1
  168. package/src/commands/save-args.ts +6 -3
  169. package/src/commands/save.ts +49 -10
  170. package/src/commands/validate-args.ts +17 -13
  171. package/src/commands/validate.ts +1 -1
  172. package/src/commands/watch-args.ts +6 -3
  173. package/src/commands/watch.ts +28 -7
  174. package/src/driver-heap.ts +65 -0
  175. package/src/index.ts +1 -0
  176. package/src/log-level.ts +42 -14
  177. package/src/spawn-data-server.ts +14 -2
  178. package/src/stderr-connection-logger.ts +18 -0
  179. package/src/testing/echo-server.ts +10 -2
@@ -6,30 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- /**
10
- * The argv machinery the subcommands share, and the error vocabulary they all
11
- * speak.
12
- *
13
- * Its own module rather than functions in the CLI entry point, because the entry
14
- * point runs `main()` on import: a test that wants to read an argv the way a
15
- * command does would otherwise have to spawn the whole binary, so flag handling
16
- * and exit codes could only be covered through a subprocess.
17
- *
18
- * The messages here are a contract — scripts and CI steps match on them — so
19
- * changing one is a breaking change for a caller nobody in this repo can see.
20
- *
21
- * Every parser takes an `onError` defaulting to report-and-exit, which is what a
22
- * command line wants; a caller that would rather handle the problem passes its
23
- * own and the parser hands control to it instead of ending the process.
24
- *
25
- * Each subcommand lives in a sibling `<name>-args` module exporting three things
26
- * a test can hold against each other: its flag list, its `--help` text as data,
27
- * and the parser that turns an argv into the runner's options. Help that drifts
28
- * from the parser is worse than none — it reads as authoritative, so a flag
29
- * missing from it is a capability nobody finds, and one it describes but the
30
- * parser rejects is an invocation that fails for no visible reason.
31
- */
32
- import type { LogThreshold } from '@hydranium/protocol';
9
+ import { type LogOptions } from '../log-level.js';
33
10
  /**
34
11
  * How a parser reports a usage problem. It never returns, so a parser can treat
35
12
  * the call as a dead end and keep narrowing the value it was about to reject.
@@ -44,8 +21,15 @@ export type UsageError = (message: string) => never;
44
21
  * bundled heap analyzer exits with for a usage error.
45
22
  */
46
23
  export declare function exitWithUsage(message: string): never;
47
- /** The value flag {@link parseHarnessArgs} consumes itself, before any the subcommand declares. */
24
+ /** Names the head's services module; every harness subcommand requires it. */
48
25
  export declare const SERVICES_FLAG = "--services";
26
+ /**
27
+ * Registers a loader in the driver child that imports the head. The child is a
28
+ * fresh `node`, so a loader registered on the CLI's own process never reaches it.
29
+ */
30
+ export declare const IMPORT_FLAG = "--import";
31
+ /** The value flags {@link parseHarnessArgs} consumes itself, before any the subcommand declares. */
32
+ export declare const HARNESS_VALUE_FLAGS: readonly ["--services", "--import"];
49
33
  /**
50
34
  * The one spelling of the log threshold, shared by both subcommand families.
51
35
  *
@@ -55,27 +39,37 @@ export declare const SERVICES_FLAG = "--services";
55
39
  * on which command a caller happened to reach for.
56
40
  */
57
41
  export declare const LOG_LEVEL_FLAG = "--log-level";
42
+ export declare const LOG_FILE_FLAG = "--log-file";
43
+ export declare const LOG_FILE_LEVEL_FLAG = "--log-file-level";
44
+ /** The log flags every subcommand takes, read by {@link logOptions}. */
45
+ export declare const LOG_VALUE_FLAGS: readonly ["--log-level", "--log-file", "--log-file-level"];
58
46
  /** The value flags {@link parseServerSpawnOptions} consumes itself. */
59
47
  export declare const SERVER_SPAWN_VALUE_FLAGS: readonly string[];
60
48
  /**
61
- * The `--help` line every subcommand describes {@link LOG_LEVEL_FLAG} with.
49
+ * The `--help` lines every subcommand describes {@link LOG_VALUE_FLAGS} with.
62
50
  *
63
51
  * Shared text, per-command padding: `command-args.test.ts` compares the flags a
64
52
  * help block DESCRIBES against the flags the parser accepts, and it recognises a
65
- * description by the two-space indent — so the line has to be a real option entry
53
+ * description by the two-space indent — so each line has to be a real option entry
66
54
  * in each block, and the column each block aligns its descriptions at is the
67
- * block's own.
55
+ * block's own. A flag too wide for that column takes its description on the
56
+ * next line, at the column.
68
57
  */
69
- export declare function logLevelHelpLine(padTo: number): string;
58
+ export declare function logHelpLines(padTo: number, head?: string): string[];
59
+ /** The `--help` lines every `--services` subcommand describes {@link IMPORT_FLAG} with, aligned as {@link logHelpLines}. */
60
+ export declare function importHelpLines(padTo: number): string[];
70
61
  /**
71
- * Narrow a raw {@link LOG_LEVEL_FLAG} value that {@link parseHarnessArgs}
72
- * collected, leaving an absent flag absent.
62
+ * Narrow the raw {@link LOG_VALUE_FLAGS} values a parser collected, leaving
63
+ * absent flags absent.
64
+ *
65
+ * `--log-file` resolves against the caller's directory: the child may run
66
+ * elsewhere (`--cwd`), and a relative path would land the log there.
73
67
  *
74
68
  * Throws rather than reaching `onError`, matching {@link parseServerSpawnOptions}:
75
69
  * the level vocabulary belongs to the protocol package, which reports it, and the
76
70
  * entry point's catch turns that into the same message-and-exit.
77
71
  */
78
- export declare function logLevelOption(value: string | undefined): LogThreshold | undefined;
72
+ export declare function logOptions(options: Readonly<Record<string, string | undefined>>): LogOptions;
79
73
  /**
80
74
  * Whether the argv asks for the command's help rather than describing a run.
81
75
  *
@@ -95,6 +89,8 @@ export declare function printHelp(lines: readonly string[]): void;
95
89
  /** What {@link parseHarnessArgs} recovered from an argv. */
96
90
  export interface ParsedHarnessArgs {
97
91
  servicesModule: string;
92
+ /** The {@link IMPORT_FLAG} values in the order given, absent when there were none. */
93
+ imports?: string[];
98
94
  /**
99
95
  * An absolute directory path, resolved by {@link resolveWorkspaceArgument} and
100
96
  * checked to exist. `''` when the subcommand declared `requireWorkspace: false`.
@@ -122,12 +118,12 @@ export interface HarnessArgsConfig {
122
118
  }
123
119
  /**
124
120
  * Shared parser for the headless-harness subcommands. Consumes the required
125
- * `--services <module>` value flag and a single positional `<workspace>`, plus
126
- * the `valueFlags` (each takes a value) and `boolFlags` (presence-only, recorded
127
- * as `'true'`) the subcommand recognises. Unknown flags or a missing
128
- * `--services`/`<workspace>` are usage errors, and so is a `<workspace>` that
129
- * reaches no directory — see {@link resolveWorkspaceArgument} for why that cannot
130
- * be left to the run.
121
+ * `--services <module>` value flag, the repeatable `--import <specifier>` and a
122
+ * single positional `<workspace>`, plus the `valueFlags` (each takes a value)
123
+ * and `boolFlags` (presence-only, recorded as `'true'`) the subcommand
124
+ * recognises. Unknown flags or a missing `--services`/`<workspace>` are usage
125
+ * errors, and so is a `<workspace>` that reaches no directory — see
126
+ * {@link resolveWorkspaceArgument} for why that cannot be left to the run.
131
127
  */
132
128
  export declare function parseHarnessArgs(args: string[], commandName: string, valueFlags: readonly string[], boolFlags: readonly string[], config?: HarnessArgsConfig): ParsedHarnessArgs;
133
129
  /**
@@ -167,20 +163,19 @@ export declare function numericOption(value: string | undefined, flag: string, o
167
163
  */
168
164
  export declare function parseFlagOptions(extra: string[], commandName: string, recognised: readonly string[], onError?: UsageError): Record<string, string | undefined>;
169
165
  /** What {@link parseServerSpawnOptions} recovered from an argv. */
170
- export interface SpawnOptions {
166
+ export interface SpawnOptions extends LogOptions {
171
167
  serverCommand: string;
172
168
  serverArgs: string[];
173
169
  cwd?: string;
174
- logLevel?: LogThreshold;
175
170
  /** The tokens this parser did not claim, for the subcommand's own options. */
176
171
  extra: string[];
177
172
  }
178
173
  /**
179
174
  * Shared option parser for subcommands that spawn a data-server child. Consumes
180
- * `--server` / `--cwd` / `--log-level` and returns the surviving tokens as
175
+ * `--server` / `--cwd` / the {@link LOG_VALUE_FLAGS} and returns the surviving tokens as
181
176
  * `extra` for {@link parseFlagOptions} to finish.
182
177
  *
183
- * An unrecognised `--log-level` value throws rather than reaching `onError`: the
178
+ * An unrecognised log level value throws rather than reaching `onError`: the
184
179
  * level vocabulary belongs to the protocol package, which reports it, and the
185
180
  * entry point's catch turns that into the same message-and-exit.
186
181
  *
@@ -1 +1 @@
1
- {"version":3,"file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AAE,OAAO,GAAE,UAA0B,GAAG,MAAM,CAsB5H;AAcD,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,UAA0B,GAAG,CAAC,CAK7H;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,UAA0B,GAAG,MAAM,GAAG,SAAS,CAS9H;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,OAAO,GAAE,UAA0B,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAgBpC;AAMD,mEAAmE;AACnE,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,KAAK,EAAE,MAAM,EAAE,CAAC;CAClB;AAkBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,UAA0B,GAAG,YAAY,CA8C9H"}
@@ -22,8 +22,15 @@ export function exitWithUsage(message) {
22
22
  console.error(message);
23
23
  process.exit(2);
24
24
  }
25
- /** The value flag {@link parseHarnessArgs} consumes itself, before any the subcommand declares. */
25
+ /** Names the head's services module; every harness subcommand requires it. */
26
26
  export const SERVICES_FLAG = '--services';
27
+ /**
28
+ * Registers a loader in the driver child that imports the head. The child is a
29
+ * fresh `node`, so a loader registered on the CLI's own process never reaches it.
30
+ */
31
+ export const IMPORT_FLAG = '--import';
32
+ /** The value flags {@link parseHarnessArgs} consumes itself, before any the subcommand declares. */
33
+ export const HARNESS_VALUE_FLAGS = [SERVICES_FLAG, IMPORT_FLAG];
27
34
  /**
28
35
  * The one spelling of the log threshold, shared by both subcommand families.
29
36
  *
@@ -33,30 +40,58 @@ export const SERVICES_FLAG = '--services';
33
40
  * on which command a caller happened to reach for.
34
41
  */
35
42
  export const LOG_LEVEL_FLAG = '--log-level';
43
+ export const LOG_FILE_FLAG = '--log-file';
44
+ export const LOG_FILE_LEVEL_FLAG = '--log-file-level';
45
+ /** The log flags every subcommand takes, read by {@link logOptions}. */
46
+ export const LOG_VALUE_FLAGS = [LOG_LEVEL_FLAG, LOG_FILE_FLAG, LOG_FILE_LEVEL_FLAG];
36
47
  /** The value flags {@link parseServerSpawnOptions} consumes itself. */
37
- export const SERVER_SPAWN_VALUE_FLAGS = ['--server', '--cwd', LOG_LEVEL_FLAG];
48
+ export const SERVER_SPAWN_VALUE_FLAGS = ['--server', '--cwd', ...LOG_VALUE_FLAGS];
38
49
  /**
39
- * The `--help` line every subcommand describes {@link LOG_LEVEL_FLAG} with.
50
+ * The `--help` lines every subcommand describes {@link LOG_VALUE_FLAGS} with.
40
51
  *
41
52
  * Shared text, per-command padding: `command-args.test.ts` compares the flags a
42
53
  * help block DESCRIBES against the flags the parser accepts, and it recognises a
43
- * description by the two-space indent — so the line has to be a real option entry
54
+ * description by the two-space indent — so each line has to be a real option entry
44
55
  * in each block, and the column each block aligns its descriptions at is the
45
- * block's own.
56
+ * block's own. A flag too wide for that column takes its description on the
57
+ * next line, at the column.
46
58
  */
47
- export function logLevelHelpLine(padTo) {
48
- return ` ${`${LOG_LEVEL_FLAG} <lvl>`.padEnd(padTo)}Log threshold for the head this boots (off|error|warn|info|debug|trace).`;
59
+ export function logHelpLines(padTo, head = 'the head this boots') {
60
+ return [
61
+ helpLine(`${LOG_LEVEL_FLAG} <lvl>`, `Log threshold for ${head} (off|error|warn|info|debug|trace).`, padTo),
62
+ helpLine(`${LOG_FILE_FLAG} <file>`, `Also write ${head}'s log to <file>; {workspace} expands to the workspace.`, padTo),
63
+ helpLine(`${LOG_FILE_LEVEL_FLAG} <lvl>`, `Threshold for that file, which the log-level setting does not change.`, padTo)
64
+ ].flat();
65
+ }
66
+ /** The `--help` lines every `--services` subcommand describes {@link IMPORT_FLAG} with, aligned as {@link logHelpLines}. */
67
+ export function importHelpLines(padTo) {
68
+ return helpLine(`${IMPORT_FLAG} <specifier>`, 'Loader to register before importing <module>, e.g. tsx (repeatable).', padTo);
69
+ }
70
+ function helpLine(flag, text, padTo) {
71
+ return flag.length < padTo - 1 ? [` ${flag.padEnd(padTo)}${text}`] : [` ${flag}`, `${' '.repeat(padTo + 2)}${text}`];
49
72
  }
50
73
  /**
51
- * Narrow a raw {@link LOG_LEVEL_FLAG} value that {@link parseHarnessArgs}
52
- * collected, leaving an absent flag absent.
74
+ * Narrow the raw {@link LOG_VALUE_FLAGS} values a parser collected, leaving
75
+ * absent flags absent.
76
+ *
77
+ * `--log-file` resolves against the caller's directory: the child may run
78
+ * elsewhere (`--cwd`), and a relative path would land the log there.
53
79
  *
54
80
  * Throws rather than reaching `onError`, matching {@link parseServerSpawnOptions}:
55
81
  * the level vocabulary belongs to the protocol package, which reports it, and the
56
82
  * entry point's catch turns that into the same message-and-exit.
57
83
  */
58
- export function logLevelOption(value) {
59
- return value === undefined ? undefined : parseLogLevelOption(value);
84
+ export function logOptions(options) {
85
+ const level = (flag) => {
86
+ const value = options[flag];
87
+ return value === undefined ? undefined : parseLogLevelOption(value, flag);
88
+ };
89
+ const logFile = options[LOG_FILE_FLAG];
90
+ return {
91
+ logLevel: level(LOG_LEVEL_FLAG),
92
+ logFile: logFile === undefined ? undefined : path.resolve(logFile),
93
+ logFileLevel: level(LOG_FILE_LEVEL_FLAG)
94
+ };
60
95
  }
61
96
  /**
62
97
  * Whether the argv asks for the command's help rather than describing a run.
@@ -92,12 +127,12 @@ export function printHelp(lines) {
92
127
  }
93
128
  /**
94
129
  * Shared parser for the headless-harness subcommands. Consumes the required
95
- * `--services <module>` value flag and a single positional `<workspace>`, plus
96
- * the `valueFlags` (each takes a value) and `boolFlags` (presence-only, recorded
97
- * as `'true'`) the subcommand recognises. Unknown flags or a missing
98
- * `--services`/`<workspace>` are usage errors, and so is a `<workspace>` that
99
- * reaches no directory — see {@link resolveWorkspaceArgument} for why that cannot
100
- * be left to the run.
130
+ * `--services <module>` value flag, the repeatable `--import <specifier>` and a
131
+ * single positional `<workspace>`, plus the `valueFlags` (each takes a value)
132
+ * and `boolFlags` (presence-only, recorded as `'true'`) the subcommand
133
+ * recognises. Unknown flags or a missing `--services`/`<workspace>` are usage
134
+ * errors, and so is a `<workspace>` that reaches no directory — see
135
+ * {@link resolveWorkspaceArgument} for why that cannot be left to the run.
101
136
  */
102
137
  export function parseHarnessArgs(args, commandName, valueFlags, boolFlags, config = {}) {
103
138
  const requireWorkspace = config.requireWorkspace ?? true;
@@ -108,6 +143,7 @@ export function parseHarnessArgs(args, commandName, valueFlags, boolFlags, confi
108
143
  const options = {};
109
144
  const values = {};
110
145
  let servicesModule;
146
+ let imports;
111
147
  let workspace;
112
148
  for (let index = 0; index < args.length; index += 1) {
113
149
  const flag = args[index];
@@ -119,9 +155,12 @@ export function parseHarnessArgs(args, commandName, valueFlags, boolFlags, confi
119
155
  index += 1;
120
156
  return value;
121
157
  };
122
- if (flag === '--services') {
158
+ if (flag === SERVICES_FLAG) {
123
159
  servicesModule = next();
124
160
  }
161
+ else if (flag === IMPORT_FLAG) {
162
+ (imports ??= []).push(next());
163
+ }
125
164
  else if (boolSet.has(flag)) {
126
165
  options[flag] = 'true';
127
166
  }
@@ -142,7 +181,8 @@ export function parseHarnessArgs(args, commandName, valueFlags, boolFlags, confi
142
181
  }
143
182
  }
144
183
  return {
145
- servicesModule: assertRequired(servicesModule, '--services', commandName, onError),
184
+ servicesModule: assertRequired(servicesModule, SERVICES_FLAG, commandName, onError),
185
+ imports,
146
186
  workspace: requireWorkspace
147
187
  ? resolveWorkspaceArgument(assertRequired(workspace, '<workspace>', commandName, onError), commandName, onError)
148
188
  : (workspace ?? ''),
@@ -271,10 +311,10 @@ function isRelativePathToken(token, isCommand) {
271
311
  }
272
312
  /**
273
313
  * Shared option parser for subcommands that spawn a data-server child. Consumes
274
- * `--server` / `--cwd` / `--log-level` and returns the surviving tokens as
314
+ * `--server` / `--cwd` / the {@link LOG_VALUE_FLAGS} and returns the surviving tokens as
275
315
  * `extra` for {@link parseFlagOptions} to finish.
276
316
  *
277
- * An unrecognised `--log-level` value throws rather than reaching `onError`: the
317
+ * An unrecognised log level value throws rather than reaching `onError`: the
278
318
  * level vocabulary belongs to the protocol package, which reports it, and the
279
319
  * entry point's catch turns that into the same message-and-exit.
280
320
  *
@@ -291,7 +331,7 @@ function isRelativePathToken(token, isCommand) {
291
331
  export function parseServerSpawnOptions(args, commandName, onError = exitWithUsage) {
292
332
  let serverSpec;
293
333
  let cwd;
294
- let logLevel;
334
+ const logFlags = {};
295
335
  const extra = [];
296
336
  for (let index = 0; index < args.length; index += 1) {
297
337
  const flag = args[index];
@@ -309,8 +349,8 @@ export function parseServerSpawnOptions(args, commandName, onError = exitWithUsa
309
349
  else if (flag === '--cwd') {
310
350
  cwd = claim();
311
351
  }
312
- else if (flag === LOG_LEVEL_FLAG) {
313
- logLevel = parseLogLevelOption(claim());
352
+ else if (LOG_VALUE_FLAGS.includes(flag)) {
353
+ logFlags[flag] = claim();
314
354
  }
315
355
  else {
316
356
  extra.push(flag);
@@ -334,6 +374,6 @@ export function parseServerSpawnOptions(args, commandName, onError = exitWithUsa
334
374
  `give the workspace to the entry as its own argument (hydranium-cli ${commandName} --help)`);
335
375
  }
336
376
  }
337
- return { serverCommand, serverArgs, cwd, logLevel, extra };
377
+ return { serverCommand, serverArgs, cwd, ...logOptions(logFlags), extra };
338
378
  }
339
379
  //# sourceMappingURL=harness-args.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"harness-args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AC;QAC5B,CAAC;aAAM,CAAC;YACL,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,oDAAoD,WAAW,UAAU,CAAC,CAAC;IACtF,CAAC;IACD,sEAAsE;IACtE,iEAAiE;IACjE,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnC,CAAC;IACD,MAAM,CAAC,aAAa,EAAE,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC;IAC9C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,EAAE,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9F,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,CACJ,2DAA2D,QAAQ,kCAAkC;gBAClG,YAAY,GAAG,wFAAwF;gBACvG,sEAAsE,WAAW,UAAU,CAChG,CAAC;QACL,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;AAC7E,CAAC"}
@@ -7,7 +7,8 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  import type * as HydraniumCoreNode from '@hydranium/core/node';
10
- import type { LogThreshold } from '@hydranium/protocol';
10
+ import { type HeapReading } from '../driver-heap.js';
11
+ import { type LogOptions } from '../log-level.js';
11
12
  /** The flag every report-producing subcommand names its destination file with. */
12
13
  export declare const OUT_FILE_FLAG = "--out-file";
13
14
  /** The `@hydranium/core/node` module surface the drivers use (type only). */
@@ -30,13 +31,15 @@ export interface HeadlessContext {
30
31
  * its `createServices` thunk AND the `@hydranium/core/node` harness, both
31
32
  * resolved from the HEAD's location rather than the CLI's.
32
33
  *
33
- * The module is an ESM file (typically a compiled `lib/*.js`) exporting a
34
- * ZERO-ARG `createServices(): { shared }`. `hydranium-cli` is language-agnostic
34
+ * The module is an ESM file exporting a ZERO-ARG `createServices(): { shared }`:
35
+ * a compiled `lib/*.js`, or the TypeScript source when the child was started
36
+ * with a loader through {@link IMPORT_FLAG}. `hydranium-cli` is language-agnostic
35
37
  * and cannot statically import a head's `create<Lang>Services`, so the dynamic
36
38
  * import is the seam that keeps the binary head-neutral. Resolving the harness
37
- * from the head's graph (via `createRequire` rooted at the head module) means the
38
- * CLI itself needs no `@hydranium/core` dependency — the head always has it — and
39
- * guarantees the harness runs against the SAME core copy as `createServices`.
39
+ * from the head's graph (via `createRequire` rooted at the head module) rather
40
+ * than from the CLI's guarantees it runs against the SAME core copy as
41
+ * `createServices`, which a second copy of the module would break even where
42
+ * both resolve.
40
43
  *
41
44
  * Throws a clear error when the path names no file, and when the export is
42
45
  * missing or not a function.
@@ -66,31 +69,45 @@ export declare function emitReport(report: string, outFile: string | undefined):
66
69
  export declare function spawnNodeChild(execArgs: string[], env?: Record<string, string>): Promise<number>;
67
70
  /** How a subcommand parent reaches its driver child; the seam `__spawnForTest` replaces. */
68
71
  export type SpawnDriverChild = (execArgs: string[], env?: Record<string, string>) => Promise<number>;
69
- /** What every `--services` subcommand carries for the child it spawns, on top of its own options. */
70
- export interface DriverSpawnOptions {
71
- /**
72
- * Log threshold for the head the driver boots. Absent leaves the child's
73
- * inherited environment alone, so an ambient `HYDRANIUM_LOG_LEVEL` still wins
74
- * where a caller set one.
75
- */
76
- readonly logLevel?: LogThreshold;
72
+ /**
73
+ * What every `--services` subcommand carries for the child it spawns, on top of
74
+ * its own options. The log options apply to the head the driver boots; an
75
+ * absent one leaves the child's inherited environment alone, so an ambient
76
+ * variable still wins where a caller set one.
77
+ */
78
+ export interface DriverSpawnOptions extends LogOptions {
79
+ /** Specifiers the driver child registers with Node's `--import`, in order, before it imports the head. */
80
+ readonly imports?: readonly string[];
77
81
  /** Test-only: capture the node argv and env instead of spawning the real child. */
78
82
  readonly __spawnForTest?: SpawnDriverChild;
83
+ /**
84
+ * Test-only: decide the heap ceiling from a stated cgroup reading rather
85
+ * than the machine's. Without it an argv assertion means one thing on a
86
+ * workstation and nothing at all under a memory limit, so a suite that
87
+ * asserts the ceiling is present passes vacuously in a container.
88
+ */
89
+ readonly __heapReadingForTest?: HeapReading;
79
90
  }
80
91
  /**
81
92
  * Parent-side: run a subcommand's driver child and propagate its exit code, so a
82
93
  * shell or CI step sees the gate.
83
94
  *
84
- * **The log threshold travels in the child's ENVIRONMENT, not its argv.** The
85
- * head's logger reads `HYDRANIUM_LOG_LEVEL` while `createServices` constructs it,
86
- * which is inside the driver's dynamic import — a flag the driver parsed would
87
- * arrive after the only moment it can be read. Setting it here rather than
88
- * exporting it also leaves the CLI's own output alone, unlike an ambient
89
- * `HYDRANIUM_LOG_LEVEL=…` the parent would carry too.
95
+ * **The log options travel in the child's ENVIRONMENT, not its argv.** The
96
+ * head's logger reads its `HYDRANIUM_LOG_*` variables while `createServices`
97
+ * constructs it, which is inside the driver's dynamic import — a flag the driver
98
+ * parsed would arrive after the only moment it can be read. Setting them here
99
+ * rather than exporting them also leaves the CLI's own output alone, unlike
100
+ * ambient variables the parent would carry too.
90
101
  *
91
102
  * A head that binds a logger of its own decides for itself whether the flag means
92
103
  * anything, which is the intended seam: the CLI is language-agnostic and cannot
93
104
  * reach past `createServices`.
105
+ *
106
+ * **The heap ceiling is prepended HERE rather than passed by each subcommand.**
107
+ * Every caller wants the same answer to the same question, and the answer is not
108
+ * a constant — see {@link driverHeapArgs}. A literal at the call site is a place
109
+ * the container case can be missed, and the caller that misses it takes the whole
110
+ * cgroup down with it rather than failing on its own.
94
111
  */
95
112
  export declare function runDriverChild(execArgs: string[], options: DriverSpawnOptions): Promise<void>;
96
113
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"headless-harness.d.ts","sourceRoot":"","sources":["../../src/commands/headless-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASxD,kFAAkF;AAClF,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,6EAA6E;AAC7E,KAAK,cAAc,GAAG,OAAO,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;AAE5F,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC7B,gEAAgE;IAChE,cAAc,EAAE,eAAe,CAAC;IAChC,yEAAyE;IACzE,QAAQ,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA4B1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAS5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAShG;AAED,4FAA4F;AAC5F,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC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ACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAShG;AAED,4FAA4F;AAC5F,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAErG;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACnD,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,mFAAmF;IACnF,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,WAAW,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnG"}
@@ -11,8 +11,9 @@ import { statSync, writeFileSync } from 'node:fs';
11
11
  import { createRequire } from 'node:module';
12
12
  import * as path from 'node:path';
13
13
  import { pathToFileURL } from 'node:url';
14
- import { logLevelEnv } from '../log-level.js';
15
- import { SERVICES_FLAG } from './harness-args.js';
14
+ import { driverHeapArgs } from '../driver-heap.js';
15
+ import { logEnv } from '../log-level.js';
16
+ import { IMPORT_FLAG, SERVICES_FLAG } from './harness-args.js';
16
17
  /** The flag every report-producing subcommand names its destination file with. */
17
18
  export const OUT_FILE_FLAG = '--out-file';
18
19
  /**
@@ -20,13 +21,15 @@ export const OUT_FILE_FLAG = '--out-file';
20
21
  * its `createServices` thunk AND the `@hydranium/core/node` harness, both
21
22
  * resolved from the HEAD's location rather than the CLI's.
22
23
  *
23
- * The module is an ESM file (typically a compiled `lib/*.js`) exporting a
24
- * ZERO-ARG `createServices(): { shared }`. `hydranium-cli` is language-agnostic
24
+ * The module is an ESM file exporting a ZERO-ARG `createServices(): { shared }`:
25
+ * a compiled `lib/*.js`, or the TypeScript source when the child was started
26
+ * with a loader through {@link IMPORT_FLAG}. `hydranium-cli` is language-agnostic
25
27
  * and cannot statically import a head's `create<Lang>Services`, so the dynamic
26
28
  * import is the seam that keeps the binary head-neutral. Resolving the harness
27
- * from the head's graph (via `createRequire` rooted at the head module) means the
28
- * CLI itself needs no `@hydranium/core` dependency — the head always has it — and
29
- * guarantees the harness runs against the SAME core copy as `createServices`.
29
+ * from the head's graph (via `createRequire` rooted at the head module) rather
30
+ * than from the CLI's guarantees it runs against the SAME core copy as
31
+ * `createServices`, which a second copy of the module would break even where
32
+ * both resolve.
30
33
  *
31
34
  * Throws a clear error when the path names no file, and when the export is
32
35
  * missing or not a function.
@@ -40,11 +43,17 @@ export async function loadHeadlessContext(servicesModule) {
40
43
  const stats = statSync(modulePath, { throwIfNoEntry: false });
41
44
  if (stats === undefined || !stats.isFile()) {
42
45
  throw new Error(`${SERVICES_FLAG} must name an existing ESM file; '${servicesModule}' resolved to ${modulePath}, ` +
43
- `which is not one. Pass the head's COMPILED entry, e.g. \`${SERVICES_FLAG} ./lib/services.js\` — ` +
44
- 'not the TypeScript source and not a package name.');
46
+ `which is not one. Pass the path of the head's entry, e.g. \`${SERVICES_FLAG} ./lib/services.js\` — ` +
47
+ 'not a package name.');
45
48
  }
46
49
  const moduleUrl = pathToFileURL(modulePath).href;
47
- const imported = (await import(moduleUrl));
50
+ let imported;
51
+ try {
52
+ imported = (await import(moduleUrl));
53
+ }
54
+ catch (err) {
55
+ throw withLoaderHint(err, modulePath);
56
+ }
48
57
  const createServices = imported.createServices;
49
58
  if (typeof createServices !== 'function') {
50
59
  throw new Error(`Services module '${servicesModule}' must export a zero-arg 'createServices(): { shared }' ` +
@@ -56,6 +65,30 @@ export async function loadHeadlessContext(servicesModule) {
56
65
  const coreNode = (await import(pathToFileURL(coreNodePath).href));
57
66
  return { createServices: createServices, coreNode };
58
67
  }
68
+ /** The codes Node fails a TypeScript entry with when no loader handled it, depending on its version. */
69
+ const UNLOADED_TYPESCRIPT_CODES = new Set([
70
+ 'ERR_UNKNOWN_FILE_EXTENSION',
71
+ 'ERR_MODULE_NOT_FOUND',
72
+ 'ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX'
73
+ ]);
74
+ /**
75
+ * Append a loader hint to a TypeScript entry's import failure, unless the child
76
+ * was started with {@link IMPORT_FLAG}, where the hint would only repeat the
77
+ * caller's own command. Appended rather than substituted: a loader set through
78
+ * `NODE_OPTIONS` does not show in `execArgv`, and under it the failure can be a
79
+ * missing module that only Node's own message names.
80
+ */
81
+ function withLoaderHint(err, modulePath) {
82
+ if (!(err instanceof Error) || !/\.[cm]?ts$/.test(modulePath) || !('code' in err) || typeof err.code !== 'string') {
83
+ return err;
84
+ }
85
+ if (!UNLOADED_TYPESCRIPT_CODES.has(err.code) || process.execArgv.some(arg => arg.startsWith(IMPORT_FLAG))) {
86
+ return err;
87
+ }
88
+ return new Error(`${err.message}\nA TypeScript head needs a loader registered with \`${IMPORT_FLAG}\`, e.g. \`${IMPORT_FLAG} tsx\`.`, {
89
+ cause: err
90
+ });
91
+ }
59
92
  /**
60
93
  * Child-side: deliver a finished report — to `outFile` when one was named, else
61
94
  * to stdout.
@@ -100,22 +133,40 @@ export function spawnNodeChild(execArgs, env) {
100
133
  * Parent-side: run a subcommand's driver child and propagate its exit code, so a
101
134
  * shell or CI step sees the gate.
102
135
  *
103
- * **The log threshold travels in the child's ENVIRONMENT, not its argv.** The
104
- * head's logger reads `HYDRANIUM_LOG_LEVEL` while `createServices` constructs it,
105
- * which is inside the driver's dynamic import — a flag the driver parsed would
106
- * arrive after the only moment it can be read. Setting it here rather than
107
- * exporting it also leaves the CLI's own output alone, unlike an ambient
108
- * `HYDRANIUM_LOG_LEVEL=…` the parent would carry too.
136
+ * **The log options travel in the child's ENVIRONMENT, not its argv.** The
137
+ * head's logger reads its `HYDRANIUM_LOG_*` variables while `createServices`
138
+ * constructs it, which is inside the driver's dynamic import — a flag the driver
139
+ * parsed would arrive after the only moment it can be read. Setting them here
140
+ * rather than exporting them also leaves the CLI's own output alone, unlike
141
+ * ambient variables the parent would carry too.
109
142
  *
110
143
  * A head that binds a logger of its own decides for itself whether the flag means
111
144
  * anything, which is the intended seam: the CLI is language-agnostic and cannot
112
145
  * reach past `createServices`.
146
+ *
147
+ * **The heap ceiling is prepended HERE rather than passed by each subcommand.**
148
+ * Every caller wants the same answer to the same question, and the answer is not
149
+ * a constant — see {@link driverHeapArgs}. A literal at the call site is a place
150
+ * the container case can be missed, and the caller that misses it takes the whole
151
+ * cgroup down with it rather than failing on its own.
113
152
  */
114
153
  export async function runDriverChild(execArgs, options) {
115
154
  const spawnChild = options.__spawnForTest ?? spawnNodeChild;
116
- const code = await spawnChild(execArgs, options.logLevel === undefined ? undefined : logLevelEnv(options.logLevel));
155
+ const importArgs = (options.imports ?? []).map(specifier => `${IMPORT_FLAG}=${loaderSpecifier(specifier)}`);
156
+ const code = await spawnChild([...driverHeapArgs(options.__heapReadingForTest), ...importArgs, ...execArgs], logEnv(options));
117
157
  if (code) {
118
158
  process.exitCode = code;
119
159
  }
120
160
  }
161
+ /**
162
+ * A path, absolute or `./`/`../` relative with either separator, becomes a file
163
+ * URL resolved against the caller's directory. Node reads `--import` as a URL or
164
+ * package specifier, so it would take a Windows `C:\…` for the URL scheme `c:`
165
+ * and a `.\…` for a package name. Any other specifier passes through as Node
166
+ * reads it.
167
+ */
168
+ function loaderSpecifier(specifier) {
169
+ const isPath = path.isAbsolute(specifier) || /^\.\.?[\\/]/.test(specifier);
170
+ return isPath ? pathToFileURL(path.resolve(specifier)).href : specifier;
171
+ }
121
172
  //# sourceMappingURL=headless-harness.js.map