@hydranium/cli 1.0.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +240 -0
- package/heap-analysis/analyze-heap.mjs +798 -0
- package/heap-analysis/heap/core/aggregate.mjs +152 -0
- package/heap-analysis/heap/core/bucket-label.mjs +23 -0
- package/heap-analysis/heap/core/cutpoints.mjs +51 -0
- package/heap-analysis/heap/core/diff.mjs +56 -0
- package/heap-analysis/heap/core/format.mjs +47 -0
- package/heap-analysis/heap/core/holders.mjs +80 -0
- package/heap-analysis/heap/core/load.mjs +46 -0
- package/heap-analysis/heap/core/report.mjs +68 -0
- package/heap-analysis/heap/core/strings.mjs +80 -0
- package/heap-analysis/heap/langium/concepts.mjs +230 -0
- package/heap-analysis/heap/langium/glsp.classifier.mjs +80 -0
- package/heap-analysis/heap/langium/langium.classifier.mjs +203 -0
- package/heap-analysis/heap/renderer/renderer.mjs +122 -0
- package/lib/cli-version.d.ts +21 -0
- package/lib/cli-version.d.ts.map +1 -0
- package/lib/cli-version.js +30 -0
- package/lib/cli-version.js.map +1 -0
- package/lib/cli.d.ts +11 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +135 -0
- package/lib/cli.js.map +1 -0
- package/lib/commands/analyze-heap-args.d.ts +46 -0
- package/lib/commands/analyze-heap-args.d.ts.map +1 -0
- package/lib/commands/analyze-heap-args.js +174 -0
- package/lib/commands/analyze-heap-args.js.map +1 -0
- package/lib/commands/analyze-heap.d.ts +37 -0
- package/lib/commands/analyze-heap.d.ts.map +1 -0
- package/lib/commands/analyze-heap.js +63 -0
- package/lib/commands/analyze-heap.js.map +1 -0
- package/lib/commands/ast-ground-truth-args.d.ts +23 -0
- package/lib/commands/ast-ground-truth-args.d.ts.map +1 -0
- package/lib/commands/ast-ground-truth-args.js +47 -0
- package/lib/commands/ast-ground-truth-args.js.map +1 -0
- package/lib/commands/ast-ground-truth-driver.d.ts +10 -0
- package/lib/commands/ast-ground-truth-driver.d.ts.map +1 -0
- package/lib/commands/ast-ground-truth-driver.js +72 -0
- package/lib/commands/ast-ground-truth-driver.js.map +1 -0
- package/lib/commands/ast-ground-truth.d.ts +31 -0
- package/lib/commands/ast-ground-truth.d.ts.map +1 -0
- package/lib/commands/ast-ground-truth.js +36 -0
- package/lib/commands/ast-ground-truth.js.map +1 -0
- package/lib/commands/generate-transfer-model-args.d.ts +38 -0
- package/lib/commands/generate-transfer-model-args.d.ts.map +1 -0
- package/lib/commands/generate-transfer-model-args.js +183 -0
- package/lib/commands/generate-transfer-model-args.js.map +1 -0
- package/lib/commands/generate-transfer-model-config.d.ts +32 -0
- package/lib/commands/generate-transfer-model-config.d.ts.map +1 -0
- package/lib/commands/generate-transfer-model-config.js +122 -0
- package/lib/commands/generate-transfer-model-config.js.map +1 -0
- package/lib/commands/generate-transfer-model.d.ts +110 -0
- package/lib/commands/generate-transfer-model.d.ts.map +1 -0
- package/lib/commands/generate-transfer-model.js +587 -0
- package/lib/commands/generate-transfer-model.js.map +1 -0
- package/lib/commands/harness-args.d.ts +198 -0
- package/lib/commands/harness-args.d.ts.map +1 -0
- package/lib/commands/harness-args.js +339 -0
- package/lib/commands/harness-args.js.map +1 -0
- package/lib/commands/headless-harness.d.ts +97 -0
- package/lib/commands/headless-harness.d.ts.map +1 -0
- package/lib/commands/headless-harness.js +121 -0
- package/lib/commands/headless-harness.js.map +1 -0
- package/lib/commands/init-args.d.ts +81 -0
- package/lib/commands/init-args.d.ts.map +1 -0
- package/lib/commands/init-args.js +250 -0
- package/lib/commands/init-args.js.map +1 -0
- package/lib/commands/init-prompt.d.ts +66 -0
- package/lib/commands/init-prompt.d.ts.map +1 -0
- package/lib/commands/init-prompt.js +71 -0
- package/lib/commands/init-prompt.js.map +1 -0
- package/lib/commands/init-templates.d.ts +42 -0
- package/lib/commands/init-templates.d.ts.map +1 -0
- package/lib/commands/init-templates.js +1902 -0
- package/lib/commands/init-templates.js.map +1 -0
- package/lib/commands/init-wizard.d.ts +65 -0
- package/lib/commands/init-wizard.d.ts.map +1 -0
- package/lib/commands/init-wizard.js +302 -0
- package/lib/commands/init-wizard.js.map +1 -0
- package/lib/commands/init-workspace.d.ts +168 -0
- package/lib/commands/init-workspace.d.ts.map +1 -0
- package/lib/commands/init-workspace.js +372 -0
- package/lib/commands/init-workspace.js.map +1 -0
- package/lib/commands/init.d.ts +273 -0
- package/lib/commands/init.d.ts.map +1 -0
- package/lib/commands/init.js +303 -0
- package/lib/commands/init.js.map +1 -0
- package/lib/commands/lint-grammar-args.d.ts +23 -0
- package/lib/commands/lint-grammar-args.d.ts.map +1 -0
- package/lib/commands/lint-grammar-args.js +63 -0
- package/lib/commands/lint-grammar-args.js.map +1 -0
- package/lib/commands/lint-grammar-driver.d.ts +10 -0
- package/lib/commands/lint-grammar-driver.d.ts.map +1 -0
- package/lib/commands/lint-grammar-driver.js +72 -0
- package/lib/commands/lint-grammar-driver.js.map +1 -0
- package/lib/commands/lint-grammar-report.d.ts +24 -0
- package/lib/commands/lint-grammar-report.d.ts.map +1 -0
- package/lib/commands/lint-grammar-report.js +65 -0
- package/lib/commands/lint-grammar-report.js.map +1 -0
- package/lib/commands/lint-grammar.d.ts +33 -0
- package/lib/commands/lint-grammar.d.ts.map +1 -0
- package/lib/commands/lint-grammar.js +42 -0
- package/lib/commands/lint-grammar.js.map +1 -0
- package/lib/commands/measure-memory-args.d.ts +23 -0
- package/lib/commands/measure-memory-args.d.ts.map +1 -0
- package/lib/commands/measure-memory-args.js +106 -0
- package/lib/commands/measure-memory-args.js.map +1 -0
- package/lib/commands/measure-memory-driver.d.ts +10 -0
- package/lib/commands/measure-memory-driver.d.ts.map +1 -0
- package/lib/commands/measure-memory-driver.js +110 -0
- package/lib/commands/measure-memory-driver.js.map +1 -0
- package/lib/commands/measure-memory.d.ts +68 -0
- package/lib/commands/measure-memory.d.ts.map +1 -0
- package/lib/commands/measure-memory.js +100 -0
- package/lib/commands/measure-memory.js.map +1 -0
- package/lib/commands/model-docs-args.d.ts +23 -0
- package/lib/commands/model-docs-args.d.ts.map +1 -0
- package/lib/commands/model-docs-args.js +53 -0
- package/lib/commands/model-docs-args.js.map +1 -0
- package/lib/commands/model-docs-driver.d.ts +10 -0
- package/lib/commands/model-docs-driver.d.ts.map +1 -0
- package/lib/commands/model-docs-driver.js +61 -0
- package/lib/commands/model-docs-driver.js.map +1 -0
- package/lib/commands/model-docs-report.d.ts +18 -0
- package/lib/commands/model-docs-report.d.ts.map +1 -0
- package/lib/commands/model-docs-report.js +123 -0
- package/lib/commands/model-docs-report.js.map +1 -0
- package/lib/commands/model-docs.d.ts +30 -0
- package/lib/commands/model-docs.d.ts.map +1 -0
- package/lib/commands/model-docs.js +37 -0
- package/lib/commands/model-docs.js.map +1 -0
- package/lib/commands/projects-args.d.ts +25 -0
- package/lib/commands/projects-args.d.ts.map +1 -0
- package/lib/commands/projects-args.js +49 -0
- package/lib/commands/projects-args.js.map +1 -0
- package/lib/commands/projects.d.ts +45 -0
- package/lib/commands/projects.d.ts.map +1 -0
- package/lib/commands/projects.js +39 -0
- package/lib/commands/projects.js.map +1 -0
- package/lib/commands/query-args.d.ts +25 -0
- package/lib/commands/query-args.d.ts.map +1 -0
- package/lib/commands/query-args.js +46 -0
- package/lib/commands/query-args.js.map +1 -0
- package/lib/commands/query.d.ts +32 -0
- package/lib/commands/query.d.ts.map +1 -0
- package/lib/commands/query.js +29 -0
- package/lib/commands/query.js.map +1 -0
- package/lib/commands/reflect-args.d.ts +23 -0
- package/lib/commands/reflect-args.d.ts.map +1 -0
- package/lib/commands/reflect-args.js +59 -0
- package/lib/commands/reflect-args.js.map +1 -0
- package/lib/commands/reflect-driver.d.ts +10 -0
- package/lib/commands/reflect-driver.d.ts.map +1 -0
- package/lib/commands/reflect-driver.js +66 -0
- package/lib/commands/reflect-driver.js.map +1 -0
- package/lib/commands/reflect-report.d.ts +20 -0
- package/lib/commands/reflect-report.d.ts.map +1 -0
- package/lib/commands/reflect-report.js +127 -0
- package/lib/commands/reflect-report.js.map +1 -0
- package/lib/commands/reflect.d.ts +30 -0
- package/lib/commands/reflect.d.ts.map +1 -0
- package/lib/commands/reflect.js +38 -0
- package/lib/commands/reflect.js.map +1 -0
- package/lib/commands/save-args.d.ts +26 -0
- package/lib/commands/save-args.d.ts.map +1 -0
- package/lib/commands/save-args.js +59 -0
- package/lib/commands/save-args.js.map +1 -0
- package/lib/commands/save.d.ts +38 -0
- package/lib/commands/save.d.ts.map +1 -0
- package/lib/commands/save.js +48 -0
- package/lib/commands/save.js.map +1 -0
- package/lib/commands/validate-args.d.ts +23 -0
- package/lib/commands/validate-args.d.ts.map +1 -0
- package/lib/commands/validate-args.js +60 -0
- package/lib/commands/validate-args.js.map +1 -0
- package/lib/commands/validate-driver.d.ts +10 -0
- package/lib/commands/validate-driver.d.ts.map +1 -0
- package/lib/commands/validate-driver.js +72 -0
- package/lib/commands/validate-driver.js.map +1 -0
- package/lib/commands/validate-report.d.ts +30 -0
- package/lib/commands/validate-report.d.ts.map +1 -0
- package/lib/commands/validate-report.js +87 -0
- package/lib/commands/validate-report.js.map +1 -0
- package/lib/commands/validate.d.ts +34 -0
- package/lib/commands/validate.d.ts.map +1 -0
- package/lib/commands/validate.js +41 -0
- package/lib/commands/validate.js.map +1 -0
- package/lib/commands/watch-args.d.ts +26 -0
- package/lib/commands/watch-args.d.ts.map +1 -0
- package/lib/commands/watch-args.js +59 -0
- package/lib/commands/watch-args.js.map +1 -0
- package/lib/commands/watch.d.ts +75 -0
- package/lib/commands/watch.d.ts.map +1 -0
- package/lib/commands/watch.js +112 -0
- package/lib/commands/watch.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/log-level.d.ts +39 -0
- package/lib/log-level.d.ts.map +1 -0
- package/lib/log-level.js +47 -0
- package/lib/log-level.js.map +1 -0
- package/lib/package-name.d.ts +33 -0
- package/lib/package-name.d.ts.map +1 -0
- package/lib/package-name.js +37 -0
- package/lib/package-name.js.map +1 -0
- package/lib/spawn-data-server.d.ts +102 -0
- package/lib/spawn-data-server.d.ts.map +1 -0
- package/lib/spawn-data-server.js +154 -0
- package/lib/spawn-data-server.js.map +1 -0
- package/lib/testing/echo-server.d.ts +11 -0
- package/lib/testing/echo-server.d.ts.map +1 -0
- package/lib/testing/echo-server.js +79 -0
- package/lib/testing/echo-server.js.map +1 -0
- package/package.json +105 -0
- package/src/cli-version.ts +32 -0
- package/src/cli.ts +139 -0
- package/src/commands/analyze-heap-args.ts +184 -0
- package/src/commands/analyze-heap.ts +76 -0
- package/src/commands/ast-ground-truth-args.ts +63 -0
- package/src/commands/ast-ground-truth-driver.ts +81 -0
- package/src/commands/ast-ground-truth.ts +49 -0
- package/src/commands/generate-transfer-model-args.ts +203 -0
- package/src/commands/generate-transfer-model-config.ts +128 -0
- package/src/commands/generate-transfer-model.ts +716 -0
- package/src/commands/harness-args.ts +429 -0
- package/src/commands/headless-harness.ts +165 -0
- package/src/commands/init-args.ts +273 -0
- package/src/commands/init-prompt.ts +149 -0
- package/src/commands/init-templates.ts +2037 -0
- package/src/commands/init-wizard.ts +378 -0
- package/src/commands/init-workspace.ts +442 -0
- package/src/commands/init.ts +554 -0
- package/src/commands/lint-grammar-args.ts +79 -0
- package/src/commands/lint-grammar-driver.ts +83 -0
- package/src/commands/lint-grammar-report.ts +74 -0
- package/src/commands/lint-grammar.ts +57 -0
- package/src/commands/measure-memory-args.ts +123 -0
- package/src/commands/measure-memory-driver.ts +128 -0
- package/src/commands/measure-memory.ts +143 -0
- package/src/commands/model-docs-args.ts +69 -0
- package/src/commands/model-docs-driver.ts +68 -0
- package/src/commands/model-docs-report.ts +133 -0
- package/src/commands/model-docs.ts +48 -0
- package/src/commands/projects-args.ts +62 -0
- package/src/commands/projects.ts +76 -0
- package/src/commands/query-args.ts +61 -0
- package/src/commands/query.ts +58 -0
- package/src/commands/reflect-args.ts +75 -0
- package/src/commands/reflect-driver.ts +76 -0
- package/src/commands/reflect-report.ts +138 -0
- package/src/commands/reflect.ts +51 -0
- package/src/commands/save-args.ts +74 -0
- package/src/commands/save.ts +84 -0
- package/src/commands/validate-args.ts +76 -0
- package/src/commands/validate-driver.ts +84 -0
- package/src/commands/validate-report.ts +95 -0
- package/src/commands/validate.ts +58 -0
- package/src/commands/watch-args.ts +74 -0
- package/src/commands/watch.ts +185 -0
- package/src/index.ts +16 -0
- package/src/log-level.ts +49 -0
- package/src/package-name.ts +39 -0
- package/src/spawn-data-server.ts +247 -0
- package/src/testing/echo-server.ts +93 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-grammar.d.ts","sourceRoot":"","sources":["../../src/commands/lint-grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQhF,yDAAyD;AACzD,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IAClE,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,oGAAoG;IACpG,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,oEAAoE;AACpE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,EAAE,CAYvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { runDriverChild } from './headless-harness.js';
|
|
11
|
+
/**
|
|
12
|
+
* Absolute path to the spawned driver. From `lib/commands/lint-grammar.js` the
|
|
13
|
+
* compiled driver sits beside it at `lib/commands/lint-grammar-driver.js`.
|
|
14
|
+
*/
|
|
15
|
+
const DRIVER = fileURLToPath(new URL('./lint-grammar-driver.js', import.meta.url));
|
|
16
|
+
/** Build the argv the driver child parses. Pure → unit-testable. */
|
|
17
|
+
export function buildLintGrammarDriverArgs(options) {
|
|
18
|
+
const args = ['--services', options.servicesModule];
|
|
19
|
+
for (const property of options.nameProperties ?? []) {
|
|
20
|
+
args.push('--name-property', property);
|
|
21
|
+
}
|
|
22
|
+
if (options.json) {
|
|
23
|
+
args.push('--json');
|
|
24
|
+
}
|
|
25
|
+
if (options.strict) {
|
|
26
|
+
args.push('--strict');
|
|
27
|
+
}
|
|
28
|
+
return args;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Headless grammar-convention lint — a CI gate that checks a head's grammar against
|
|
32
|
+
* the framework's expectations (nameable cross-reference targets, an entry rule) and
|
|
33
|
+
* exits non-zero when a violation is found (`--strict` also fails on warnings).
|
|
34
|
+
* Read-only: no workspace is built (the reflection is static once the head registers
|
|
35
|
+
* its language), so this subcommand takes only `--services` and the name-property
|
|
36
|
+
* overrides. The work runs in a spawned child that dynamic-imports the head's
|
|
37
|
+
* `createServices` module, keeping the binary language-agnostic.
|
|
38
|
+
*/
|
|
39
|
+
export function runLintGrammar(options) {
|
|
40
|
+
return runDriverChild(['--max-old-space-size=8192', DRIVER, ...buildLintGrammarDriverArgs(options)], options);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=lint-grammar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-grammar.js","sourceRoot":"","sources":["../../src/commands/lint-grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,0BAA0B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAcnF,oEAAoE;AACpE,MAAM,UAAU,0BAA0B,CAAC,OAAkC;IAC1E,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpD,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,cAAc,IAAI,EAAE,EAAE,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,IAAI,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,OAAkC;IAC9D,OAAO,cAAc,CAAC,CAAC,2BAA2B,EAAE,MAAM,EAAE,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACjH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type UsageError } from './harness-args.js';
|
|
10
|
+
import { type MeasureMemoryCommandOptions } from './measure-memory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Every flag `measure-memory` accepts, derived from the sets the parser is
|
|
13
|
+
* handed so the list cannot claim a flag the parser would reject. `--services`
|
|
14
|
+
* is consumed by the shared harness parser itself, so it is in neither set.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MEASURE_MEMORY_FLAGS: readonly string[];
|
|
17
|
+
/** The subset that takes a value, so `--help` in a value position reads as data. */
|
|
18
|
+
export declare const MEASURE_MEMORY_VALUE_FLAGS: readonly string[];
|
|
19
|
+
/** The `--help` text, as data, held to {@link MEASURE_MEMORY_FLAGS} by a test. */
|
|
20
|
+
export declare const MEASURE_MEMORY_HELP: readonly string[];
|
|
21
|
+
export declare function parseMeasureMemoryArgs(args: string[], onError?: UsageError): MeasureMemoryCommandOptions;
|
|
22
|
+
export declare function runMeasureMemoryCommand(args: string[]): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=measure-memory-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-memory-args.d.ts","sourceRoot":"","sources":["../../src/commands/measure-memory-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAUJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA4C,KAAK,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAcjH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAmD,CAAC;AAEtG,oFAAoF;AACpF,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAoC,CAAC;AAE7F,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EA4BhD,CAAC;AAwBF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,2BAA2B,CAgBvH;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { exitWithUsage, helpRequested, LOG_LEVEL_FLAG, logLevelHelpLine, logLevelOption, numericOption, parseHarnessArgs, printHelp, SERVICES_FLAG } from './harness-args.js';
|
|
10
|
+
import { parseProfileDimensions, runMeasureMemory } from './measure-memory.js';
|
|
11
|
+
const VALUE_FLAGS = [
|
|
12
|
+
'--edits',
|
|
13
|
+
'--edit-docs',
|
|
14
|
+
'--churn-suffix',
|
|
15
|
+
'--settle',
|
|
16
|
+
'--snapshot-path',
|
|
17
|
+
'--profile',
|
|
18
|
+
'--session-out',
|
|
19
|
+
LOG_LEVEL_FLAG
|
|
20
|
+
];
|
|
21
|
+
const BOOL_FLAGS = ['--snapshot', '--json'];
|
|
22
|
+
/**
|
|
23
|
+
* Every flag `measure-memory` accepts, derived from the sets the parser is
|
|
24
|
+
* handed so the list cannot claim a flag the parser would reject. `--services`
|
|
25
|
+
* is consumed by the shared harness parser itself, so it is in neither set.
|
|
26
|
+
*/
|
|
27
|
+
export const MEASURE_MEMORY_FLAGS = [SERVICES_FLAG, ...VALUE_FLAGS, ...BOOL_FLAGS];
|
|
28
|
+
/** The subset that takes a value, so `--help` in a value position reads as data. */
|
|
29
|
+
export const MEASURE_MEMORY_VALUE_FLAGS = [SERVICES_FLAG, ...VALUE_FLAGS];
|
|
30
|
+
/** The `--help` text, as data, held to {@link MEASURE_MEMORY_FLAGS} by a test. */
|
|
31
|
+
export const MEASURE_MEMORY_HELP = [
|
|
32
|
+
'Usage: hydranium-cli measure-memory --services <module> <workspace> [options]',
|
|
33
|
+
'',
|
|
34
|
+
'Measure model-store memory for a workspace. `<module>` is an ESM module that',
|
|
35
|
+
'exports a zero-arg `createServices(): { shared }` thunk (the head wires its own',
|
|
36
|
+
'filesystem inside). Runs in a `--expose-gc` child for post-GC readings; the',
|
|
37
|
+
'baseline / after-build / churn lines print on stdout. Needs @hydranium/core.',
|
|
38
|
+
'',
|
|
39
|
+
'Options:',
|
|
40
|
+
' --services <module> ESM module exporting `createServices(): { shared }` (required).',
|
|
41
|
+
' <workspace> Workspace root (path or file URI) to build (required).',
|
|
42
|
+
' --edits <N> Rebuild-churn cycles to probe for retention. Default: 0 (skip).',
|
|
43
|
+
' --edit-docs <N> Documents to churn per cycle. Default: 25.',
|
|
44
|
+
' --churn-suffix <ext> Only churn documents whose URI ends with this suffix.',
|
|
45
|
+
' --settle <ms> Wait <ms> after the build before measuring, so a',
|
|
46
|
+
' timer-driven residency policy (shed-closed-when-idle)',
|
|
47
|
+
" sheds first. Pass above the policy's idleMs; omit to",
|
|
48
|
+
' measure the pre-shed (always-keep) baseline.',
|
|
49
|
+
' --snapshot Write a `.heapsnapshot` after the build.',
|
|
50
|
+
' --snapshot-path <p> Snapshot path. Default: <cwd>/<workspace-basename>.heapsnapshot.',
|
|
51
|
+
' --profile <dims> Capture sampled profiles around the build (+churn) into a',
|
|
52
|
+
' profiling session. Comma-separated: cpu,alloc,gc,eld,heap.',
|
|
53
|
+
' --session-out <dir> Parent directory for the profiling session folder (with --profile).',
|
|
54
|
+
' --json Emit the measurement as one JSON document instead of the',
|
|
55
|
+
' progress lines: documentCount, buildMs, emptyHeapBytes,',
|
|
56
|
+
' afterBuildHeapBytes, and churnGrowthBytes / snapshotPath /',
|
|
57
|
+
' profilingSession where the run produced them.',
|
|
58
|
+
logLevelHelpLine(22)
|
|
59
|
+
];
|
|
60
|
+
/**
|
|
61
|
+
* Validate `--profile` in the PARENT, where the numeric flags beside it are
|
|
62
|
+
* already validated.
|
|
63
|
+
*
|
|
64
|
+
* Returns the RAW string rather than the parsed dimensions on purpose: the child
|
|
65
|
+
* re-parses them, because that is where they are used, and this exists only so a
|
|
66
|
+
* typo fails as a usage error before a process is spawned and a whole head
|
|
67
|
+
* imported. Parsing here and passing the result would change what crosses to the
|
|
68
|
+
* child for no gain.
|
|
69
|
+
*/
|
|
70
|
+
function validatedProfile(csv, onError) {
|
|
71
|
+
if (csv === undefined) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
parseProfileDimensions(csv);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
onError(`Option --profile: ${err instanceof Error ? err.message : String(err)}`);
|
|
79
|
+
}
|
|
80
|
+
return csv;
|
|
81
|
+
}
|
|
82
|
+
export function parseMeasureMemoryArgs(args, onError = exitWithUsage) {
|
|
83
|
+
const { servicesModule, workspace, options } = parseHarnessArgs(args, 'measure-memory', VALUE_FLAGS, BOOL_FLAGS, { onError });
|
|
84
|
+
return {
|
|
85
|
+
servicesModule,
|
|
86
|
+
workspace,
|
|
87
|
+
editCycles: numericOption(options['--edits'], '--edits', onError),
|
|
88
|
+
editDocs: numericOption(options['--edit-docs'], '--edit-docs', onError),
|
|
89
|
+
churnSuffix: options['--churn-suffix'],
|
|
90
|
+
settleMs: numericOption(options['--settle'], '--settle', onError),
|
|
91
|
+
writeSnapshot: options['--snapshot'] === 'true',
|
|
92
|
+
snapshotPath: options['--snapshot-path'],
|
|
93
|
+
profile: validatedProfile(options['--profile'], onError),
|
|
94
|
+
sessionOut: options['--session-out'],
|
|
95
|
+
json: options['--json'] === 'true',
|
|
96
|
+
logLevel: logLevelOption(options[LOG_LEVEL_FLAG])
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function runMeasureMemoryCommand(args) {
|
|
100
|
+
if (helpRequested(args, MEASURE_MEMORY_VALUE_FLAGS)) {
|
|
101
|
+
printHelp(MEASURE_MEMORY_HELP);
|
|
102
|
+
return Promise.resolve();
|
|
103
|
+
}
|
|
104
|
+
return runMeasureMemory(parseMeasureMemoryArgs(args));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=measure-memory-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-memory-args.js","sourceRoot":"","sources":["../../src/commands/measure-memory-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,aAAa,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAoC,MAAM,qBAAqB,CAAC;AAEjH,MAAM,WAAW,GAAG;IACjB,SAAS;IACT,aAAa;IACb,gBAAgB;IAChB,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,eAAe;IACf,cAAc;CACP,CAAC;AACX,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAU,CAAC;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,aAAa,EAAE,GAAG,WAAW,EAAE,GAAG,UAAU,CAAC,CAAC;AAEtG,oFAAoF;AACpF,MAAM,CAAC,MAAM,0BAA0B,GAAsB,CAAC,aAAa,EAAE,GAAG,WAAW,CAAC,CAAC;AAE7F,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACnD,+EAA+E;IAC/E,EAAE;IACF,8EAA8E;IAC9E,iFAAiF;IACjF,6EAA6E;IAC7E,8EAA8E;IAC9E,EAAE;IACF,UAAU;IACV,yFAAyF;IACzF,gFAAgF;IAChF,yFAAyF;IACzF,oEAAoE;IACpE,+EAA+E;IAC/E,0EAA0E;IAC1E,+EAA+E;IA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M;QAC/C,YAAY,EAAE,OAAO,CAAC,iBAAiB,CAAC;QACxC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QACxD,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC;QACpC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,MAAM;QAClC,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;KACnD,CAAC;AACL,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAc;IACnD,IAAI,aAAa,CAAC,IAAI,EAAE,0BAA0B,CAAC,EAAE,CAAC;QACnD,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=measure-memory-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-memory-driver.d.ts","sourceRoot":"","sources":["../../src/commands/measure-memory-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
/*
|
|
10
|
+
* Spawned child of the `measure-memory` subcommand. Launched by the parent with
|
|
11
|
+
* `node --expose-gc --max-old-space-size=8192 <this> --services <module> <workspace> ...`
|
|
12
|
+
* so the underlying harness gets post-GC readings. It dynamic-imports the head's
|
|
13
|
+
* services module and runs the framework's `measureModelMemory`, streaming the
|
|
14
|
+
* baseline / after-build / churn lines to stdout. Never imported — only spawned.
|
|
15
|
+
*/
|
|
16
|
+
import { loadHeadlessContext } from './headless-harness.js';
|
|
17
|
+
import { parseProfileDimensions } from './measure-memory.js';
|
|
18
|
+
function parseArgs(argv) {
|
|
19
|
+
const parsed = { writeSnapshot: false, json: false };
|
|
20
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
21
|
+
const flag = argv[index];
|
|
22
|
+
const next = () => {
|
|
23
|
+
const value = argv[index + 1];
|
|
24
|
+
if (value === undefined) {
|
|
25
|
+
console.error(`Missing value for ${flag}`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
index += 1;
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
switch (flag) {
|
|
32
|
+
case '--services':
|
|
33
|
+
parsed.servicesModule = next();
|
|
34
|
+
break;
|
|
35
|
+
case '--edits':
|
|
36
|
+
parsed.editCycles = Number(next());
|
|
37
|
+
break;
|
|
38
|
+
case '--edit-docs':
|
|
39
|
+
parsed.editDocs = Number(next());
|
|
40
|
+
break;
|
|
41
|
+
case '--churn-suffix':
|
|
42
|
+
parsed.churnDocSuffix = next();
|
|
43
|
+
break;
|
|
44
|
+
case '--settle':
|
|
45
|
+
parsed.settleMs = Number(next());
|
|
46
|
+
break;
|
|
47
|
+
case '--snapshot':
|
|
48
|
+
parsed.writeSnapshot = true;
|
|
49
|
+
break;
|
|
50
|
+
case '--snapshot-path':
|
|
51
|
+
parsed.snapshotPath = next();
|
|
52
|
+
break;
|
|
53
|
+
case '--profile':
|
|
54
|
+
parsed.profile = next();
|
|
55
|
+
break;
|
|
56
|
+
case '--session-out':
|
|
57
|
+
parsed.sessionOut = next();
|
|
58
|
+
break;
|
|
59
|
+
case '--json':
|
|
60
|
+
parsed.json = true;
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
if (flag.startsWith('--')) {
|
|
64
|
+
console.error(`Unknown option: ${flag}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
parsed.workspace = flag;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return parsed;
|
|
71
|
+
}
|
|
72
|
+
async function main(argv) {
|
|
73
|
+
const args = parseArgs(argv);
|
|
74
|
+
if (!args.servicesModule || !args.workspace) {
|
|
75
|
+
console.error('measure-memory-driver: --services <module> and a <workspace> are required.');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
const { createServices, coreNode } = await loadHeadlessContext(args.servicesModule);
|
|
79
|
+
const result = await coreNode.measureModelMemory({
|
|
80
|
+
createServices,
|
|
81
|
+
workspace: args.workspace,
|
|
82
|
+
editCycles: args.editCycles,
|
|
83
|
+
editDocs: args.editDocs,
|
|
84
|
+
churnDocSuffix: args.churnDocSuffix,
|
|
85
|
+
settleMs: args.settleMs,
|
|
86
|
+
writeSnapshot: args.writeSnapshot,
|
|
87
|
+
snapshotPath: args.snapshotPath,
|
|
88
|
+
profile: args.profile ? parseProfileDimensions(args.profile) : undefined,
|
|
89
|
+
sessionOut: args.sessionOut,
|
|
90
|
+
// Omitted under `--json` rather than redirected: every progress line would
|
|
91
|
+
// otherwise land on the same stream as the document, so the caller's
|
|
92
|
+
// `JSON.parse` would see a preamble it has no way to bound.
|
|
93
|
+
log: args.json ? undefined : line => console.log(line)
|
|
94
|
+
});
|
|
95
|
+
if (args.json) {
|
|
96
|
+
console.log(JSON.stringify(result, null, 2));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
console.log(`SUMMARY: docs=${result.documentCount} build=${Math.round(result.buildMs)}ms`);
|
|
100
|
+
if (result.profilingSession) {
|
|
101
|
+
console.log(`SESSION: ${result.profilingSession}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
main(process.argv.slice(2))
|
|
105
|
+
.then(() => process.exit(0))
|
|
106
|
+
.catch((error) => {
|
|
107
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
108
|
+
process.exit(1);
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=measure-memory-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-memory-driver.js","sourceRoot":"","sources":["../../src/commands/measure-memory-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAgB7D,SAAS,SAAS,CAAC,IAAc;IAC9B,MAAM,MAAM,GAAe,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACjE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,GAAW,EAAE;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;YACD,KAAK,IAAI,CAAC,CAAC;YACX,OAAO,KAAK,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,IAAI,EAAE,CAAC;YACZ,KAA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,CAAC,IAAI,CAAC,CAAC;IAC3F,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACtD,CAAC;AACJ,CAAC;AAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACvB,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3B,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACvB,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { ProfileCaptureOptions } from '@hydranium/core/node';
|
|
10
|
+
import { type DriverSpawnOptions } from './headless-harness.js';
|
|
11
|
+
/** Options for the {@link runMeasureMemory} subcommand. */
|
|
12
|
+
export interface MeasureMemoryCommandOptions extends DriverSpawnOptions {
|
|
13
|
+
/** ESM module exporting a zero-arg `createServices(): { shared }` thunk. */
|
|
14
|
+
readonly servicesModule: string;
|
|
15
|
+
/** Workspace root (filesystem path or file URI) to build. */
|
|
16
|
+
readonly workspace: string;
|
|
17
|
+
/** Rebuild-churn cycles to probe for retention (default 0 = skip). */
|
|
18
|
+
readonly editCycles?: number;
|
|
19
|
+
/** Documents to churn per cycle. */
|
|
20
|
+
readonly editDocs?: number;
|
|
21
|
+
/** Only churn documents whose URI path ends with this suffix. */
|
|
22
|
+
readonly churnSuffix?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Wait this many milliseconds after the build before measuring, so a
|
|
25
|
+
* timer-driven residency policy (`CstResidencyService`'s
|
|
26
|
+
* `shed-closed-when-idle`) sheds before the reading is taken. Pass a value
|
|
27
|
+
* comfortably above the policy's `idleMs`; omit (or `0`) to measure the
|
|
28
|
+
* pre-shed heap (the always-keep-equivalent baseline).
|
|
29
|
+
*/
|
|
30
|
+
readonly settleMs?: number;
|
|
31
|
+
/** Write a `.heapsnapshot` after the build. */
|
|
32
|
+
readonly writeSnapshot?: boolean;
|
|
33
|
+
/** Snapshot path (default `<cwd>/<workspace-basename>.heapsnapshot`). */
|
|
34
|
+
readonly snapshotPath?: string;
|
|
35
|
+
/** Comma-separated profile dimensions to capture; see {@link parseProfileDimensions} for the tokens. */
|
|
36
|
+
readonly profile?: string;
|
|
37
|
+
/** Parent directory for the profiling session folder. Only used with {@link profile}. */
|
|
38
|
+
readonly sessionOut?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Emit the `MeasureModelMemoryResult` as JSON instead of the progress lines.
|
|
41
|
+
*
|
|
42
|
+
* The progress lines are suppressed rather than kept alongside it, because the
|
|
43
|
+
* flag exists so a script can read stdout as one document — a preamble on the
|
|
44
|
+
* same stream would leave every caller stripping it by hand.
|
|
45
|
+
*/
|
|
46
|
+
readonly json?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse a `--profile` dimension list (`cpu,alloc,gc,eld,heap`) into
|
|
50
|
+
* {@link ProfileCaptureOptions}. Case- and whitespace-tolerant; throws on an
|
|
51
|
+
* unknown token so a typo fails loud rather than silently capturing nothing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseProfileDimensions(csv: string): ProfileCaptureOptions;
|
|
54
|
+
/**
|
|
55
|
+
* Build the argv the driver child parses. Pure → unit-testable; mirrors the
|
|
56
|
+
* driver's own option names.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildDriverArgs(options: MeasureMemoryCommandOptions): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Headless model-store memory measurement. `hydranium-cli` is language-agnostic
|
|
61
|
+
* and cannot import a head's `create<Lang>Services`, so the head passes a module
|
|
62
|
+
* that exports a zero-arg `createServices` thunk (`--services`). Because the
|
|
63
|
+
* underlying `measureModelMemory` harness needs post-GC readings, the work runs
|
|
64
|
+
* in a spawned child launched with `--expose-gc`; the driver dynamic-imports the
|
|
65
|
+
* module and reports the baseline / after-build / churn lines on stdout.
|
|
66
|
+
*/
|
|
67
|
+
export declare function runMeasureMemory(options: MeasureMemoryCommandOptions): Promise<void>;
|
|
68
|
+
//# sourceMappingURL=measure-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-memory.d.ts","sourceRoot":"","sources":["../../src/commands/measure-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQhF,2DAA2D;AAC3D,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB;IACpE,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wGAAwG;IACxG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,yFAAyF;IACzF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAgCzE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,EAAE,CA8B9E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { runDriverChild } from './headless-harness.js';
|
|
11
|
+
/**
|
|
12
|
+
* Absolute path to the spawned driver. From `lib/commands/measure-memory.js`
|
|
13
|
+
* the compiled driver sits beside it at `lib/commands/measure-memory-driver.js`.
|
|
14
|
+
*/
|
|
15
|
+
const DRIVER = fileURLToPath(new URL('./measure-memory-driver.js', import.meta.url));
|
|
16
|
+
/**
|
|
17
|
+
* Parse a `--profile` dimension list (`cpu,alloc,gc,eld,heap`) into
|
|
18
|
+
* {@link ProfileCaptureOptions}. Case- and whitespace-tolerant; throws on an
|
|
19
|
+
* unknown token so a typo fails loud rather than silently capturing nothing.
|
|
20
|
+
*/
|
|
21
|
+
export function parseProfileDimensions(csv) {
|
|
22
|
+
const options = {};
|
|
23
|
+
for (const raw of csv.split(',')) {
|
|
24
|
+
const token = raw.trim().toLowerCase();
|
|
25
|
+
if (!token) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
switch (token) {
|
|
29
|
+
case 'cpu':
|
|
30
|
+
options.cpu = true;
|
|
31
|
+
break;
|
|
32
|
+
case 'alloc':
|
|
33
|
+
case 'allocation':
|
|
34
|
+
options.allocation = true;
|
|
35
|
+
break;
|
|
36
|
+
case 'gc':
|
|
37
|
+
options.gc = true;
|
|
38
|
+
break;
|
|
39
|
+
case 'eld':
|
|
40
|
+
case 'eventloop':
|
|
41
|
+
case 'event-loop':
|
|
42
|
+
options.eventLoopDelay = true;
|
|
43
|
+
break;
|
|
44
|
+
case 'heap':
|
|
45
|
+
case 'heapsnapshot':
|
|
46
|
+
options.heapSnapshot = true;
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`Unknown profile dimension: ${token} (expected cpu, alloc, gc, eld, heap)`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return options;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the argv the driver child parses. Pure → unit-testable; mirrors the
|
|
56
|
+
* driver's own option names.
|
|
57
|
+
*/
|
|
58
|
+
export function buildDriverArgs(options) {
|
|
59
|
+
const args = ['--services', options.servicesModule, options.workspace];
|
|
60
|
+
if (options.editCycles !== undefined) {
|
|
61
|
+
args.push('--edits', String(options.editCycles));
|
|
62
|
+
}
|
|
63
|
+
if (options.editDocs !== undefined) {
|
|
64
|
+
args.push('--edit-docs', String(options.editDocs));
|
|
65
|
+
}
|
|
66
|
+
if (options.churnSuffix !== undefined) {
|
|
67
|
+
args.push('--churn-suffix', options.churnSuffix);
|
|
68
|
+
}
|
|
69
|
+
if (options.settleMs !== undefined) {
|
|
70
|
+
args.push('--settle', String(options.settleMs));
|
|
71
|
+
}
|
|
72
|
+
if (options.writeSnapshot) {
|
|
73
|
+
args.push('--snapshot');
|
|
74
|
+
}
|
|
75
|
+
if (options.snapshotPath !== undefined) {
|
|
76
|
+
args.push('--snapshot-path', options.snapshotPath);
|
|
77
|
+
}
|
|
78
|
+
if (options.profile !== undefined) {
|
|
79
|
+
args.push('--profile', options.profile);
|
|
80
|
+
}
|
|
81
|
+
if (options.sessionOut !== undefined) {
|
|
82
|
+
args.push('--session-out', options.sessionOut);
|
|
83
|
+
}
|
|
84
|
+
if (options.json) {
|
|
85
|
+
args.push('--json');
|
|
86
|
+
}
|
|
87
|
+
return args;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Headless model-store memory measurement. `hydranium-cli` is language-agnostic
|
|
91
|
+
* and cannot import a head's `create<Lang>Services`, so the head passes a module
|
|
92
|
+
* that exports a zero-arg `createServices` thunk (`--services`). Because the
|
|
93
|
+
* underlying `measureModelMemory` harness needs post-GC readings, the work runs
|
|
94
|
+
* in a spawned child launched with `--expose-gc`; the driver dynamic-imports the
|
|
95
|
+
* module and reports the baseline / after-build / churn lines on stdout.
|
|
96
|
+
*/
|
|
97
|
+
export function runMeasureMemory(options) {
|
|
98
|
+
return runDriverChild(['--expose-gc', '--max-old-space-size=8192', DRIVER, ...buildDriverArgs(options)], options);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=measure-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-memory.js","sourceRoot":"","sources":["../../src/commands/measure-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC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AAE,2BAA2B,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACrH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type UsageError } from './harness-args.js';
|
|
10
|
+
import { type ModelDocsCommandOptions } from './model-docs.js';
|
|
11
|
+
/**
|
|
12
|
+
* Every flag `model-docs` accepts, derived from the sets the parser is handed so
|
|
13
|
+
* the list cannot claim a flag the parser would reject. `--services` is consumed
|
|
14
|
+
* by the shared harness parser itself, so it is in neither set.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MODEL_DOCS_FLAGS: readonly string[];
|
|
17
|
+
/** The subset that takes a value, so `--help` in a value position reads as data. */
|
|
18
|
+
export declare const MODEL_DOCS_VALUE_FLAGS: readonly string[];
|
|
19
|
+
/** The `--help` text, as data, held to {@link MODEL_DOCS_FLAGS} by a test. */
|
|
20
|
+
export declare const MODEL_DOCS_HELP: readonly string[];
|
|
21
|
+
export declare function parseModelDocsArgs(args: string[], onError?: UsageError): ModelDocsCommandOptions;
|
|
22
|
+
export declare function runModelDocsCommand(args: string[]): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=model-docs-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-docs-args.d.ts","sourceRoot":"","sources":["../../src/commands/model-docs-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAgB,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAI7E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAoC,CAAC;AAEnF,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAAqB,CAAC;AAE1E,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAgB5C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,uBAAuB,CAM/G;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { exitWithUsage, helpRequested, LOG_LEVEL_FLAG, logLevelHelpLine, logLevelOption, parseHarnessArgs, printHelp, SERVICES_FLAG } from './harness-args.js';
|
|
10
|
+
import { OUT_FILE_FLAG } from './headless-harness.js';
|
|
11
|
+
import { runModelDocs } from './model-docs.js';
|
|
12
|
+
const VALUE_FLAGS = [OUT_FILE_FLAG, LOG_LEVEL_FLAG];
|
|
13
|
+
/**
|
|
14
|
+
* Every flag `model-docs` accepts, derived from the sets the parser is handed so
|
|
15
|
+
* the list cannot claim a flag the parser would reject. `--services` is consumed
|
|
16
|
+
* by the shared harness parser itself, so it is in neither set.
|
|
17
|
+
*/
|
|
18
|
+
export const MODEL_DOCS_FLAGS = [SERVICES_FLAG, ...VALUE_FLAGS];
|
|
19
|
+
/** The subset that takes a value, so `--help` in a value position reads as data. */
|
|
20
|
+
export const MODEL_DOCS_VALUE_FLAGS = MODEL_DOCS_FLAGS;
|
|
21
|
+
/** The `--help` text, as data, held to {@link MODEL_DOCS_FLAGS} by a test. */
|
|
22
|
+
export const MODEL_DOCS_HELP = [
|
|
23
|
+
'Usage: hydranium-cli model-docs --services <module> [--out-file <file>] [--log-level <lvl>]',
|
|
24
|
+
'',
|
|
25
|
+
'Generate a navigable Markdown reference of every AST node type — a type index,',
|
|
26
|
+
'cross-linked super/sub types, a reverse "referenced by" index, and a per-language',
|
|
27
|
+
'grammar summary — for publishing into adopter docs. Read-only: no workspace is',
|
|
28
|
+
'built. Emits Markdown on stdout, or into `--out-file`; the machine-readable form',
|
|
29
|
+
'is `hydranium-cli reflect --json`. `<module>` is an ESM module exporting a',
|
|
30
|
+
'zero-arg `createServices(): { shared }` thunk. Needs @hydranium/core.',
|
|
31
|
+
'',
|
|
32
|
+
'Options:',
|
|
33
|
+
' --services <module> ESM module exporting `createServices(): { shared }` (required).',
|
|
34
|
+
' --out-file <file> Write the Markdown to this file instead of stdout. Written',
|
|
35
|
+
' only once the report exists, unlike a shell redirection,',
|
|
36
|
+
' which truncates the file before the head is even booted.',
|
|
37
|
+
logLevelHelpLine(22)
|
|
38
|
+
];
|
|
39
|
+
export function parseModelDocsArgs(args, onError = exitWithUsage) {
|
|
40
|
+
const { servicesModule, options } = parseHarnessArgs(args, 'model-docs', VALUE_FLAGS, [], {
|
|
41
|
+
requireWorkspace: false,
|
|
42
|
+
onError
|
|
43
|
+
});
|
|
44
|
+
return { servicesModule, outFile: options[OUT_FILE_FLAG], logLevel: logLevelOption(options[LOG_LEVEL_FLAG]) };
|
|
45
|
+
}
|
|
46
|
+
export function runModelDocsCommand(args) {
|
|
47
|
+
if (helpRequested(args, MODEL_DOCS_VALUE_FLAGS)) {
|
|
48
|
+
printHelp(MODEL_DOCS_HELP);
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
return runModelDocs(parseModelDocsArgs(args));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=model-docs-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-docs-args.js","sourceRoot":"","sources":["../../src/commands/model-docs-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,aAAa,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAgC,MAAM,iBAAiB,CAAC;AAE7E,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,cAAc,CAAU,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAsB,CAAC,aAAa,EAAE,GAAG,WAAW,CAAC,CAAC;AAEnF,oFAAoF;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAsB,gBAAgB,CAAC;AAE1E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAsB;IAC/C,6FAA6F;IAC7F,EAAE;IACF,gFAAgF;IAChF,mFAAmF;IACnF,gFAAgF;IAChF,kFAAkF;IAClF,4EAA4E;IAC5E,uEAAuE;IACvE,EAAE;IACF,UAAU;IACV,yFAAyF;IACzF,oFAAoF;IACpF,kFAAkF;IAClF,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,IAAc,EAAE,UAAsB,aAAa;IACnF,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAE;QACvF,gBAAgB,EAAE,KAAK;QACvB,OAAO;KACT,CAAC,CAAC;IACH,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;AACjH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAc;IAC/C,IAAI,aAAa,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC;QAC/C,SAAS,CAAC,eAAe,CAAC,CAAC;QAC3B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=model-docs-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-docs-driver.d.ts","sourceRoot":"","sources":["../../src/commands/model-docs-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF"}
|