@hydranium/cli 1.0.0-next.8 → 1.0.0-next.85
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/README.md +14 -0
- package/lib/commands/analyze-heap.d.ts +3 -0
- package/lib/commands/analyze-heap.d.ts.map +1 -1
- package/lib/commands/analyze-heap.js +2 -1
- package/lib/commands/analyze-heap.js.map +1 -1
- package/lib/commands/ast-ground-truth.js +1 -1
- package/lib/commands/ast-ground-truth.js.map +1 -1
- package/lib/commands/generate-ast-builder.d.ts +49 -0
- package/lib/commands/generate-ast-builder.d.ts.map +1 -0
- package/lib/commands/generate-ast-builder.js +200 -0
- package/lib/commands/generate-ast-builder.js.map +1 -0
- package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model-args.js +11 -1
- package/lib/commands/generate-transfer-model-args.js.map +1 -1
- package/lib/commands/generate-transfer-model-config.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model-config.js +3 -1
- package/lib/commands/generate-transfer-model-config.js.map +1 -1
- package/lib/commands/generate-transfer-model.d.ts +9 -0
- package/lib/commands/generate-transfer-model.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model.js +16 -3
- package/lib/commands/generate-transfer-model.js.map +1 -1
- package/lib/commands/headless-harness.d.ts +18 -3
- package/lib/commands/headless-harness.d.ts.map +1 -1
- package/lib/commands/headless-harness.js +12 -4
- package/lib/commands/headless-harness.js.map +1 -1
- package/lib/commands/init-templates.d.ts +0 -9
- package/lib/commands/init-templates.d.ts.map +1 -1
- package/lib/commands/init-templates.js +49 -35
- package/lib/commands/init-templates.js.map +1 -1
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +2 -6
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/lint-grammar.js +1 -1
- package/lib/commands/lint-grammar.js.map +1 -1
- package/lib/commands/measure-memory-driver.js +3 -2
- package/lib/commands/measure-memory-driver.js.map +1 -1
- package/lib/commands/measure-memory.js +1 -1
- package/lib/commands/measure-memory.js.map +1 -1
- package/lib/commands/model-docs.js +1 -1
- package/lib/commands/model-docs.js.map +1 -1
- package/lib/commands/reflect.js +1 -1
- package/lib/commands/reflect.js.map +1 -1
- package/lib/commands/save.js +2 -2
- package/lib/commands/save.js.map +1 -1
- package/lib/commands/validate.js +1 -1
- package/lib/commands/validate.js.map +1 -1
- package/lib/commands/watch.d.ts.map +1 -1
- package/lib/commands/watch.js +15 -0
- package/lib/commands/watch.js.map +1 -1
- package/lib/driver-heap.d.ts +52 -0
- package/lib/driver-heap.d.ts.map +1 -0
- package/lib/driver-heap.js +51 -0
- package/lib/driver-heap.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +11 -10
- package/src/commands/analyze-heap.ts +4 -1
- package/src/commands/ast-ground-truth.ts +1 -1
- package/src/commands/generate-ast-builder.ts +246 -0
- package/src/commands/generate-transfer-model-args.ts +11 -1
- package/src/commands/generate-transfer-model-config.ts +3 -1
- package/src/commands/generate-transfer-model.ts +25 -3
- package/src/commands/headless-harness.ts +22 -4
- package/src/commands/init-templates.ts +49 -36
- package/src/commands/init.ts +2 -8
- package/src/commands/lint-grammar.ts +1 -1
- package/src/commands/measure-memory-driver.ts +3 -2
- package/src/commands/measure-memory.ts +1 -1
- package/src/commands/model-docs.ts +1 -1
- package/src/commands/reflect.ts +1 -1
- package/src/commands/save.ts +2 -2
- package/src/commands/validate.ts +1 -1
- package/src/commands/watch.ts +21 -1
- package/src/driver-heap.ts +65 -0
- package/src/index.ts +1 -0
package/src/commands/reflect.ts
CHANGED
|
@@ -47,5 +47,5 @@ export function buildReflectDriverArgs(options: ReflectCommandOptions): string[]
|
|
|
47
47
|
* the binary language-agnostic.
|
|
48
48
|
*/
|
|
49
49
|
export function runReflect(options: ReflectCommandOptions): Promise<void> {
|
|
50
|
-
return runDriverChild([
|
|
50
|
+
return runDriverChild([DRIVER, ...buildReflectDriverArgs(options)], options);
|
|
51
51
|
}
|
package/src/commands/save.ts
CHANGED
|
@@ -46,7 +46,7 @@ export async function runSave(options: SaveCommandOptions): Promise<void> {
|
|
|
46
46
|
const model = await resolveContent(options.content, options.__readFileForTest);
|
|
47
47
|
|
|
48
48
|
if (options.__proxyForTest) {
|
|
49
|
-
const doc = await options.__proxyForTest.saveModelDocument({ uri: options.uri, clientId, model });
|
|
49
|
+
const doc = await options.__proxyForTest.saveModelDocument({ uri: options.uri, clientId, model, basedOn: 'anything' });
|
|
50
50
|
write(`${JSON.stringify(doc)}\n`);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
@@ -59,7 +59,7 @@ export async function runSave(options: SaveCommandOptions): Promise<void> {
|
|
|
59
59
|
env: options.logLevel ? logLevelEnv(options.logLevel) : undefined
|
|
60
60
|
},
|
|
61
61
|
async server => {
|
|
62
|
-
const doc = await server.saveModelDocument({ uri: options.uri, clientId, model });
|
|
62
|
+
const doc = await server.saveModelDocument({ uri: options.uri, clientId, model, basedOn: 'anything' });
|
|
63
63
|
write(`${JSON.stringify(doc)}\n`);
|
|
64
64
|
}
|
|
65
65
|
);
|
package/src/commands/validate.ts
CHANGED
|
@@ -54,5 +54,5 @@ export function buildValidateDriverArgs(options: ValidateCommandOptions): string
|
|
|
54
54
|
* The child's exit code propagates to this process so shells and CI see the gate.
|
|
55
55
|
*/
|
|
56
56
|
export function runValidate(options: ValidateCommandOptions): Promise<void> {
|
|
57
|
-
return runDriverChild([
|
|
57
|
+
return runDriverChild([DRIVER, ...buildValidateDriverArgs(options)], options);
|
|
58
58
|
}
|
package/src/commands/watch.ts
CHANGED
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import type { LogThreshold, TransferElement } from '@hydranium/protocol';
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
DataClientProtocol,
|
|
13
|
+
DataServerProtocol,
|
|
14
|
+
TransferDocumentDeletedEvent,
|
|
15
|
+
TransferDocumentUpdatedEvent
|
|
16
|
+
} from '@hydranium/protocol/data';
|
|
12
17
|
import { logLevelEnv } from '../log-level.js';
|
|
13
18
|
import { spawnDataServer } from '../spawn-data-server.js';
|
|
14
19
|
|
|
@@ -132,6 +137,21 @@ export async function runWatch(options: WatchCommandOptions): Promise<void> {
|
|
|
132
137
|
onDocumentSaved(): void {
|
|
133
138
|
// Persistence is out of band for the per-URI update view.
|
|
134
139
|
},
|
|
140
|
+
onDocumentDeleted(event: TransferDocumentDeletedEvent): void {
|
|
141
|
+
// In band, unlike the two neighbours: this is the end of the stream
|
|
142
|
+
// the view exists to show, and a consumer that never hears it waits
|
|
143
|
+
// forever for an update that cannot come. The line carries no
|
|
144
|
+
// `document`, so a reader must switch on shape rather than assume one.
|
|
145
|
+
if (event.uri !== options.uri) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
write(`${JSON.stringify(event)}\n`);
|
|
149
|
+
},
|
|
150
|
+
onDocumentsBuilt(): void {
|
|
151
|
+
// Out of band for a per-URI view by construction: this notification
|
|
152
|
+
// carries only documents nobody watches, and this command watches the
|
|
153
|
+
// one URI it was given.
|
|
154
|
+
},
|
|
135
155
|
onProjectsChanged(): void {
|
|
136
156
|
// Project lifecycle is out of band for the per-URI update view.
|
|
137
157
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
import { heapCeilingArgs } from '@hydranium/core/node';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Heap ceiling in MiB for a driver child on a machine with no cgroup limit.
|
|
14
|
+
*
|
|
15
|
+
* The subcommands that spawn one build a whole workspace in that child —
|
|
16
|
+
* `measure-memory` deliberately so, `analyze-heap` loads an entire heap
|
|
17
|
+
* snapshot — so the default Node would pick from physical RAM is too low for
|
|
18
|
+
* the workspaces these are pointed at.
|
|
19
|
+
*/
|
|
20
|
+
export const DRIVER_HEAP_MB = 8192;
|
|
21
|
+
|
|
22
|
+
/** Environment variable an operator raises or lowers {@link driverHeapArgs} with. */
|
|
23
|
+
export const DRIVER_HEAP_ENV = 'HYDRANIUM_CLI_MAX_OLD_SPACE_MB';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Smallest ceiling {@link DRIVER_HEAP_ENV} may state. A driver child builds a
|
|
27
|
+
* whole workspace, so a value this far below the default is a unit mistake
|
|
28
|
+
* rather than a deliberate squeeze.
|
|
29
|
+
*/
|
|
30
|
+
export const MIN_DRIVER_HEAP_MB = 256;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A cgroup reading, so a caller — in practice a test — can decide the ceiling
|
|
34
|
+
* instead of inheriting the machine's. Omitted fields fall back to this
|
|
35
|
+
* process's own reading.
|
|
36
|
+
*/
|
|
37
|
+
export interface HeapReading {
|
|
38
|
+
readonly constrained?: number;
|
|
39
|
+
readonly total?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The `execArgv` prefix every driver child is spawned under.
|
|
44
|
+
*
|
|
45
|
+
* Inside a container this is EMPTY on purpose. {@link DRIVER_HEAP_MB} is sized
|
|
46
|
+
* for a workstation, and handing it to a process under a smaller cgroup limit
|
|
47
|
+
* is worse than handing it nothing: V8 has no reason to collect hard below a
|
|
48
|
+
* ceiling it will never reach, so the kernel OOM-kills the container first and
|
|
49
|
+
* the failure arrives as a signal against the whole cgroup rather than as a
|
|
50
|
+
* heap error the parent can attribute. Left to itself, Node sizes the heap from
|
|
51
|
+
* the limit instead.
|
|
52
|
+
*
|
|
53
|
+
* That trades away the ability to use a LARGE container's memory, since Node's
|
|
54
|
+
* derived default is a fraction of the limit — which is what {@link DRIVER_HEAP_ENV}
|
|
55
|
+
* is for. An operator who states a number has decided, so it wins in a
|
|
56
|
+
* container too.
|
|
57
|
+
*/
|
|
58
|
+
export function driverHeapArgs(reading: HeapReading = {}): string[] {
|
|
59
|
+
return heapCeilingArgs({
|
|
60
|
+
desktopDefaultMb: DRIVER_HEAP_MB,
|
|
61
|
+
envValue: process.env[DRIVER_HEAP_ENV],
|
|
62
|
+
minMb: MIN_DRIVER_HEAP_MB,
|
|
63
|
+
...reading
|
|
64
|
+
});
|
|
65
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
+
export * from './commands/generate-ast-builder.js';
|
|
10
11
|
export * from './commands/generate-transfer-model.js';
|
|
11
12
|
export * from './commands/projects.js';
|
|
12
13
|
export * from './commands/query.js';
|