@hydranium/cli 1.0.0-next.30 → 1.0.0-next.300
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 +75 -204
- package/bin/hydranium-cli.js +13 -0
- package/heap-analysis/heap/core/load.mjs +2 -2
- package/lib/cli-version.js.map +1 -1
- package/lib/cli.js +7 -2
- package/lib/cli.js.map +1 -1
- package/lib/commands/analyze-heap-args.js.map +1 -1
- 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-args.d.ts +3 -2
- package/lib/commands/ast-ground-truth-args.d.ts.map +1 -1
- package/lib/commands/ast-ground-truth-args.js +11 -9
- package/lib/commands/ast-ground-truth-args.js.map +1 -1
- package/lib/commands/ast-ground-truth-driver.js +2 -1
- package/lib/commands/ast-ground-truth-driver.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/client-session.d.ts +17 -0
- package/lib/commands/client-session.d.ts.map +1 -0
- package/lib/commands/client-session.js +27 -0
- package/lib/commands/client-session.js.map +1 -0
- package/lib/commands/create-args.d.ts +17 -0
- package/lib/commands/create-args.d.ts.map +1 -0
- package/lib/commands/create-args.js +53 -0
- package/lib/commands/create-args.js.map +1 -0
- package/lib/commands/create.d.ts +38 -0
- package/lib/commands/create.d.ts.map +1 -0
- package/lib/commands/create.js +43 -0
- package/lib/commands/create.js.map +1 -0
- package/lib/commands/delete-args.d.ts +17 -0
- package/lib/commands/delete-args.d.ts.map +1 -0
- package/lib/commands/delete-args.js +49 -0
- package/lib/commands/delete-args.js.map +1 -0
- package/lib/commands/delete.d.ts +30 -0
- package/lib/commands/delete.d.ts.map +1 -0
- package/lib/commands/delete.js +32 -0
- package/lib/commands/delete.js.map +1 -0
- 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 +6 -3
- 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 +18 -4
- package/lib/commands/generate-transfer-model.js.map +1 -1
- package/lib/commands/harness-args.d.ts +44 -42
- package/lib/commands/harness-args.d.ts.map +1 -1
- package/lib/commands/harness-args.js +109 -27
- package/lib/commands/harness-args.js.map +1 -1
- package/lib/commands/headless-harness.d.ts +37 -20
- package/lib/commands/headless-harness.d.ts.map +1 -1
- package/lib/commands/headless-harness.js +68 -17
- package/lib/commands/headless-harness.js.map +1 -1
- package/lib/commands/init-args.js +6 -6
- package/lib/commands/init-args.js.map +1 -1
- package/lib/commands/init-prompt.d.ts.map +1 -1
- package/lib/commands/init-templates.d.ts +8 -10
- package/lib/commands/init-templates.d.ts.map +1 -1
- package/lib/commands/init-templates.js +261 -167
- package/lib/commands/init-templates.js.map +1 -1
- package/lib/commands/init-wizard.js +4 -4
- package/lib/commands/init-wizard.js.map +1 -1
- package/lib/commands/init-workspace.d.ts +13 -3
- package/lib/commands/init-workspace.d.ts.map +1 -1
- package/lib/commands/init-workspace.js +21 -6
- package/lib/commands/init-workspace.js.map +1 -1
- package/lib/commands/init.d.ts +16 -10
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +17 -15
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/lint-grammar-args.d.ts +3 -2
- package/lib/commands/lint-grammar-args.d.ts.map +1 -1
- package/lib/commands/lint-grammar-args.js +13 -10
- package/lib/commands/lint-grammar-args.js.map +1 -1
- package/lib/commands/lint-grammar-driver.js +2 -1
- package/lib/commands/lint-grammar-driver.js.map +1 -1
- package/lib/commands/lint-grammar-report.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-args.d.ts +3 -2
- package/lib/commands/measure-memory-args.d.ts.map +1 -1
- package/lib/commands/measure-memory-args.js +22 -11
- package/lib/commands/measure-memory-args.js.map +1 -1
- package/lib/commands/measure-memory-driver.js +5 -3
- 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-args.d.ts +4 -3
- package/lib/commands/model-docs-args.d.ts.map +1 -1
- package/lib/commands/model-docs-args.js +12 -10
- package/lib/commands/model-docs-args.js.map +1 -1
- package/lib/commands/model-docs-driver.js +2 -1
- package/lib/commands/model-docs-driver.js.map +1 -1
- package/lib/commands/model-docs.js +1 -1
- package/lib/commands/model-docs.js.map +1 -1
- package/lib/commands/projects-args.d.ts.map +1 -1
- package/lib/commands/projects-args.js +5 -5
- package/lib/commands/projects-args.js.map +1 -1
- package/lib/commands/projects.d.ts +3 -4
- package/lib/commands/projects.d.ts.map +1 -1
- package/lib/commands/projects.js +2 -2
- package/lib/commands/projects.js.map +1 -1
- package/lib/commands/query-args.d.ts.map +1 -1
- package/lib/commands/query-args.js +5 -5
- package/lib/commands/query-args.js.map +1 -1
- package/lib/commands/query.d.ts +3 -4
- package/lib/commands/query.d.ts.map +1 -1
- package/lib/commands/query.js +2 -2
- package/lib/commands/query.js.map +1 -1
- package/lib/commands/reflect-args.d.ts +3 -2
- package/lib/commands/reflect-args.d.ts.map +1 -1
- package/lib/commands/reflect-args.js +13 -10
- package/lib/commands/reflect-args.js.map +1 -1
- package/lib/commands/reflect-driver.js +2 -1
- package/lib/commands/reflect-driver.js.map +1 -1
- package/lib/commands/reflect-report.js.map +1 -1
- package/lib/commands/reflect.js +1 -1
- package/lib/commands/reflect.js.map +1 -1
- package/lib/commands/save-args.d.ts.map +1 -1
- package/lib/commands/save-args.js +7 -4
- package/lib/commands/save-args.js.map +1 -1
- package/lib/commands/save.d.ts +8 -4
- package/lib/commands/save.d.ts.map +1 -1
- package/lib/commands/save.js +12 -23
- package/lib/commands/save.js.map +1 -1
- package/lib/commands/validate-args.d.ts +3 -2
- package/lib/commands/validate-args.d.ts.map +1 -1
- package/lib/commands/validate-args.js +13 -10
- package/lib/commands/validate-args.js.map +1 -1
- package/lib/commands/validate-driver.js +2 -1
- package/lib/commands/validate-driver.js.map +1 -1
- package/lib/commands/validate-report.js.map +1 -1
- package/lib/commands/validate.js +1 -1
- package/lib/commands/validate.js.map +1 -1
- package/lib/commands/watch-args.d.ts.map +1 -1
- package/lib/commands/watch-args.js +6 -4
- package/lib/commands/watch-args.js.map +1 -1
- package/lib/commands/watch.d.ts +3 -4
- package/lib/commands/watch.d.ts.map +1 -1
- package/lib/commands/watch.js +20 -2
- 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 +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/log-level.d.ts +21 -11
- package/lib/log-level.d.ts.map +1 -1
- package/lib/log-level.js +25 -14
- package/lib/log-level.js.map +1 -1
- package/lib/spawn-data-server.d.ts +9 -4
- package/lib/spawn-data-server.d.ts.map +1 -1
- package/lib/spawn-data-server.js +5 -4
- package/lib/spawn-data-server.js.map +1 -1
- package/lib/stderr-connection-logger.d.ts +12 -0
- package/lib/stderr-connection-logger.d.ts.map +1 -0
- package/lib/stderr-connection-logger.js +16 -0
- package/lib/stderr-connection-logger.js.map +1 -0
- package/lib/testing/echo-server.js +9 -1
- package/lib/testing/echo-server.js.map +1 -1
- package/package.json +50 -39
- package/src/cli.ts +7 -2
- package/src/commands/analyze-heap.ts +4 -1
- package/src/commands/ast-ground-truth-args.ts +15 -12
- package/src/commands/ast-ground-truth-driver.ts +2 -1
- package/src/commands/ast-ground-truth.ts +1 -1
- package/src/commands/client-session.ts +33 -0
- package/src/commands/create-args.ts +68 -0
- package/src/commands/create.ts +83 -0
- package/src/commands/delete-args.ts +64 -0
- package/src/commands/delete.ts +61 -0
- 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 +6 -3
- package/src/commands/generate-transfer-model.ts +27 -4
- package/src/commands/harness-args.ts +99 -31
- package/src/commands/headless-harness.ts +86 -26
- package/src/commands/init-args.ts +6 -6
- package/src/commands/init-templates.ts +272 -169
- package/src/commands/init-wizard.ts +4 -4
- package/src/commands/init-workspace.ts +31 -7
- package/src/commands/init.ts +36 -26
- package/src/commands/lint-grammar-args.ts +17 -13
- package/src/commands/lint-grammar-driver.ts +2 -1
- package/src/commands/lint-grammar.ts +1 -1
- package/src/commands/measure-memory-args.ts +27 -14
- package/src/commands/measure-memory-driver.ts +5 -3
- package/src/commands/measure-memory.ts +1 -1
- package/src/commands/model-docs-args.ts +16 -13
- package/src/commands/model-docs-driver.ts +2 -1
- package/src/commands/model-docs.ts +1 -1
- package/src/commands/projects-args.ts +5 -4
- package/src/commands/projects.ts +4 -6
- package/src/commands/query-args.ts +5 -4
- package/src/commands/query.ts +4 -6
- package/src/commands/reflect-args.ts +17 -13
- package/src/commands/reflect-driver.ts +2 -1
- package/src/commands/reflect.ts +1 -1
- package/src/commands/save-args.ts +7 -3
- package/src/commands/save.ts +24 -27
- package/src/commands/validate-args.ts +17 -13
- package/src/commands/validate-driver.ts +2 -1
- package/src/commands/validate.ts +1 -1
- package/src/commands/watch-args.ts +6 -3
- package/src/commands/watch.ts +28 -7
- package/src/driver-heap.ts +65 -0
- package/src/index.ts +3 -0
- package/src/log-level.ts +42 -14
- package/src/spawn-data-server.ts +17 -5
- package/src/stderr-connection-logger.ts +18 -0
- package/src/testing/echo-server.ts +11 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch-args.d.ts","sourceRoot":"","sources":["../../src/commands/watch-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"watch-args.d.ts","sourceRoot":"","sources":["../../src/commands/watch-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAIjF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAAgD,CAAC;AAE1F;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAgB,CAAC;AAEhE,yEAAyE;AACzE,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAYvC,CAAC;AAEF,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,mBAAmB,CAavG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAS7D"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { assertRequired, exitWithUsage, helpRequested, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
|
|
9
|
+
import { assertRequired, exitWithUsage, helpRequested, logHelpLines, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
|
|
10
10
|
import { runWatch, wireSigintAbort } from './watch.js';
|
|
11
11
|
const OWN_FLAGS = ['--uri', '--client-id'];
|
|
12
12
|
/**
|
|
@@ -21,7 +21,7 @@ export const WATCH_FLAGS = [...SERVER_SPAWN_VALUE_FLAGS, ...OWN_FLAGS];
|
|
|
21
21
|
export const WATCH_VALUE_FLAGS = WATCH_FLAGS;
|
|
22
22
|
/** The `--help` text, as data, held to {@link WATCH_FLAGS} by a test. */
|
|
23
23
|
export const WATCH_HELP = [
|
|
24
|
-
'Usage: hydranium-cli watch --server "<cmd>..." --uri <uri> [--client-id <id>] [--cwd <dir>] [--log-level <level>]',
|
|
24
|
+
'Usage: hydranium-cli watch --server "<cmd>..." --uri <uri> [--client-id <id>] [--cwd <dir>] [--log-level <lvl>] [--log-file <file>] [--log-file-level <lvl>]',
|
|
25
25
|
'',
|
|
26
26
|
'Subscribe to document updates at `<uri>` and print events as newline-delimited',
|
|
27
27
|
'JSON. Long-running — exits cleanly on SIGINT (Ctrl-C).',
|
|
@@ -31,17 +31,19 @@ export const WATCH_HELP = [
|
|
|
31
31
|
' --uri <uri> Document URI (required).',
|
|
32
32
|
' --client-id <id> Subscriber identity. Default: hydranium-cli.',
|
|
33
33
|
' --cwd <dir> Working directory for the spawned child. Default: cwd.',
|
|
34
|
-
'
|
|
34
|
+
...logHelpLines(22, 'the spawned server')
|
|
35
35
|
];
|
|
36
36
|
/** Parse the argv; the abort signal is the entry point's to supply, not the command line's. */
|
|
37
37
|
export function parseWatchArgs(args, onError = exitWithUsage) {
|
|
38
|
-
const { serverCommand, serverArgs, cwd, logLevel, extra } = parseServerSpawnOptions(args, 'watch', onError);
|
|
38
|
+
const { serverCommand, serverArgs, cwd, logLevel, logFile, logFileLevel, extra } = parseServerSpawnOptions(args, 'watch', onError);
|
|
39
39
|
const { uri, clientId } = parseFlagOptions(extra, 'watch', OWN_FLAGS, onError);
|
|
40
40
|
return {
|
|
41
41
|
serverCommand,
|
|
42
42
|
serverArgs,
|
|
43
43
|
cwd,
|
|
44
44
|
logLevel,
|
|
45
|
+
logFile,
|
|
46
|
+
logFileLevel,
|
|
45
47
|
uri: assertRequired(uri, '--uri', 'watch', onError),
|
|
46
48
|
clientId
|
|
47
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch-args.js","sourceRoot":"","sources":["../../src/commands/watch-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAA4B,MAAM,YAAY,CAAC;AAEjF,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,aAAa,CAAU,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE1F;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsB,WAAW,CAAC;AAEhE,yEAAyE;AACzE,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC1C,
|
|
1
|
+
{"version":3,"file":"watch-args.js","sourceRoot":"","sources":["../../src/commands/watch-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAA4B,MAAM,YAAY,CAAC;AAEjF,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,aAAa,CAAU,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE1F;;;GAGG;AACH,MAAM,CA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AO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACtF,CAAC"}
|
package/lib/commands/watch.d.ts
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import type {
|
|
9
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
10
10
|
import type { DataClientProtocol, DataServerProtocol } from '@hydranium/protocol/data';
|
|
11
|
+
import { type LogOptions } from '../log-level.js';
|
|
11
12
|
/**
|
|
12
13
|
* Options for the {@link runWatch} subcommand. Subscribes to document
|
|
13
14
|
* updates at `uri` and writes each event as one JSON line. Long-running
|
|
@@ -18,12 +19,10 @@ import type { DataClientProtocol, DataServerProtocol } from '@hydranium/protocol
|
|
|
18
19
|
* — production CLI wires SIGINT directly. `__handleForTest` bypasses
|
|
19
20
|
* the spawn step for unit tests.
|
|
20
21
|
*/
|
|
21
|
-
export interface WatchCommandOptions {
|
|
22
|
+
export interface WatchCommandOptions extends LogOptions {
|
|
22
23
|
readonly serverCommand: string;
|
|
23
24
|
readonly serverArgs?: readonly string[];
|
|
24
25
|
readonly cwd?: string;
|
|
25
|
-
/** Log threshold for the spawned server, set on its `HYDRANIUM_LOG_LEVEL` env. */
|
|
26
|
-
readonly logLevel?: LogThreshold;
|
|
27
26
|
readonly uri: string;
|
|
28
27
|
readonly clientId?: string;
|
|
29
28
|
readonly write?: (line: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OA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QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmE1E"}
|
package/lib/commands/watch.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import {
|
|
9
|
+
import { logEnv } from '../log-level.js';
|
|
10
10
|
import { spawnDataServer } from '../spawn-data-server.js';
|
|
11
11
|
/**
|
|
12
12
|
* Wait for the handle's premature-death rejection, and swallow it once the watch
|
|
@@ -67,6 +67,24 @@ export async function runWatch(options) {
|
|
|
67
67
|
onDocumentSaved() {
|
|
68
68
|
// Persistence is out of band for the per-URI update view.
|
|
69
69
|
},
|
|
70
|
+
onDocumentDirtyChanged() {
|
|
71
|
+
// Out of band for the per-URI update view, as persistence is.
|
|
72
|
+
},
|
|
73
|
+
onDocumentDeleted(event) {
|
|
74
|
+
// In band, unlike the two neighbours: this is the end of the stream
|
|
75
|
+
// the view exists to show, and a consumer that never hears it waits
|
|
76
|
+
// forever for an update that cannot come. The line carries no
|
|
77
|
+
// `document`, so a reader must switch on shape rather than assume one.
|
|
78
|
+
if (event.uri !== options.uri) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
write(`${JSON.stringify(event)}\n`);
|
|
82
|
+
},
|
|
83
|
+
onDocumentsBuilt() {
|
|
84
|
+
// Out of band for a per-URI view by construction: this notification
|
|
85
|
+
// carries only documents nobody watches, and this command watches the
|
|
86
|
+
// one URI it was given.
|
|
87
|
+
},
|
|
70
88
|
onProjectsChanged() {
|
|
71
89
|
// Project lifecycle is out of band for the per-URI update view.
|
|
72
90
|
}
|
|
@@ -78,7 +96,7 @@ export async function runWatch(options) {
|
|
|
78
96
|
command: options.serverCommand,
|
|
79
97
|
args: options.serverArgs,
|
|
80
98
|
cwd: options.cwd,
|
|
81
|
-
env:
|
|
99
|
+
env: logEnv(options)
|
|
82
100
|
}, localClient);
|
|
83
101
|
options.__handleForTest?.bindClient(localClient);
|
|
84
102
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA2D1D;;;;;;;;;;;;;;;GAeG;AACH,KAAK,UAAU,uBAAuB,CAAC,cAA0C,EAAE,MAA+B;IAC/G,IAAI,CAAC,cAAc,EAAE,CAAC;QACnB,OAAO,IAAI,OAAO,CAAO,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,CAAC;QACF,MAAM,cAAc,CAAC;IACxB,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACrB,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACnB,OAAO;QACV,CAAC;QACD,MAAM,GAAG,CAAC;IACb,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,UAA2B;IACxD,MAAM,OAAO,GAAG,GAAS,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAA4B;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK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eAAe,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACjD,IAAI,CAAC;QACF,gFAAgF;QAChF,iFAAiF;QACjF,+EAA+E;QAC/E,kEAAkE;QAClE,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAChF,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9F,CAAC;YAAS,CAAC;QACR,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,YAAY,CACxB,MAAgG,EAChG,GAAW,EACX,QAAgB,EAChB,MAA+B;IAE/B,MAAM,MAAM,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC;QACF,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC/B,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;gBACnB,OAAO,EAAE,CAAC;gBACV,OAAO;YACV,CAAC;YACD,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACN,CAAC;YAAS,CAAC;QACR,MAAM,MAAM,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
* Heap ceiling in MiB for a driver child on a machine with no cgroup limit.
|
|
11
|
+
*
|
|
12
|
+
* The subcommands that spawn one build a whole workspace in that child —
|
|
13
|
+
* `measure-memory` deliberately so, `analyze-heap` loads an entire heap
|
|
14
|
+
* snapshot — so the default Node would pick from physical RAM is too low for
|
|
15
|
+
* the workspaces these are pointed at.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DRIVER_HEAP_MB = 8192;
|
|
18
|
+
/** Environment variable an operator raises or lowers {@link driverHeapArgs} with. */
|
|
19
|
+
export declare const DRIVER_HEAP_ENV = "HYDRANIUM_CLI_MAX_OLD_SPACE_MB";
|
|
20
|
+
/**
|
|
21
|
+
* Smallest ceiling {@link DRIVER_HEAP_ENV} may state. A driver child builds a
|
|
22
|
+
* whole workspace, so a value this far below the default is a unit mistake
|
|
23
|
+
* rather than a deliberate squeeze.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MIN_DRIVER_HEAP_MB = 256;
|
|
26
|
+
/**
|
|
27
|
+
* A cgroup reading, so a caller — in practice a test — can decide the ceiling
|
|
28
|
+
* instead of inheriting the machine's. Omitted fields fall back to this
|
|
29
|
+
* process's own reading.
|
|
30
|
+
*/
|
|
31
|
+
export interface HeapReading {
|
|
32
|
+
readonly constrained?: number;
|
|
33
|
+
readonly total?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The `execArgv` prefix every driver child is spawned under.
|
|
37
|
+
*
|
|
38
|
+
* Inside a container this is EMPTY on purpose. {@link DRIVER_HEAP_MB} is sized
|
|
39
|
+
* for a workstation, and handing it to a process under a smaller cgroup limit
|
|
40
|
+
* is worse than handing it nothing: V8 has no reason to collect hard below a
|
|
41
|
+
* ceiling it will never reach, so the kernel OOM-kills the container first and
|
|
42
|
+
* the failure arrives as a signal against the whole cgroup rather than as a
|
|
43
|
+
* heap error the parent can attribute. Left to itself, Node sizes the heap from
|
|
44
|
+
* the limit instead.
|
|
45
|
+
*
|
|
46
|
+
* That trades away the ability to use a LARGE container's memory, since Node's
|
|
47
|
+
* derived default is a fraction of the limit — which is what {@link DRIVER_HEAP_ENV}
|
|
48
|
+
* is for. An operator who states a number has decided, so it wins in a
|
|
49
|
+
* container too.
|
|
50
|
+
*/
|
|
51
|
+
export declare function driverHeapArgs(reading?: HeapReading): string[];
|
|
52
|
+
//# sourceMappingURL=driver-heap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-heap.d.ts","sourceRoot":"","sources":["../src/driver-heap.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,qFAAqF;AACrF,eAAO,MAAM,eAAe,mCAAmC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,EAAE,CAOlE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { heapCeilingArgs } from '@hydranium/core/node';
|
|
10
|
+
/**
|
|
11
|
+
* Heap ceiling in MiB for a driver child on a machine with no cgroup limit.
|
|
12
|
+
*
|
|
13
|
+
* The subcommands that spawn one build a whole workspace in that child —
|
|
14
|
+
* `measure-memory` deliberately so, `analyze-heap` loads an entire heap
|
|
15
|
+
* snapshot — so the default Node would pick from physical RAM is too low for
|
|
16
|
+
* the workspaces these are pointed at.
|
|
17
|
+
*/
|
|
18
|
+
export const DRIVER_HEAP_MB = 8192;
|
|
19
|
+
/** Environment variable an operator raises or lowers {@link driverHeapArgs} with. */
|
|
20
|
+
export const DRIVER_HEAP_ENV = 'HYDRANIUM_CLI_MAX_OLD_SPACE_MB';
|
|
21
|
+
/**
|
|
22
|
+
* Smallest ceiling {@link DRIVER_HEAP_ENV} may state. A driver child builds a
|
|
23
|
+
* whole workspace, so a value this far below the default is a unit mistake
|
|
24
|
+
* rather than a deliberate squeeze.
|
|
25
|
+
*/
|
|
26
|
+
export const MIN_DRIVER_HEAP_MB = 256;
|
|
27
|
+
/**
|
|
28
|
+
* The `execArgv` prefix every driver child is spawned under.
|
|
29
|
+
*
|
|
30
|
+
* Inside a container this is EMPTY on purpose. {@link DRIVER_HEAP_MB} is sized
|
|
31
|
+
* for a workstation, and handing it to a process under a smaller cgroup limit
|
|
32
|
+
* is worse than handing it nothing: V8 has no reason to collect hard below a
|
|
33
|
+
* ceiling it will never reach, so the kernel OOM-kills the container first and
|
|
34
|
+
* the failure arrives as a signal against the whole cgroup rather than as a
|
|
35
|
+
* heap error the parent can attribute. Left to itself, Node sizes the heap from
|
|
36
|
+
* the limit instead.
|
|
37
|
+
*
|
|
38
|
+
* That trades away the ability to use a LARGE container's memory, since Node's
|
|
39
|
+
* derived default is a fraction of the limit — which is what {@link DRIVER_HEAP_ENV}
|
|
40
|
+
* is for. An operator who states a number has decided, so it wins in a
|
|
41
|
+
* container too.
|
|
42
|
+
*/
|
|
43
|
+
export function driverHeapArgs(reading = {}) {
|
|
44
|
+
return heapCeilingArgs({
|
|
45
|
+
desktopDefaultMb: DRIVER_HEAP_MB,
|
|
46
|
+
envValue: process.env[DRIVER_HEAP_ENV],
|
|
47
|
+
minMb: MIN_DRIVER_HEAP_MB,
|
|
48
|
+
...reading
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=driver-heap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-heap.js","sourceRoot":"","sources":["../src/driver-heap.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,gCAAgC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAYtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,OAAO,GAAgB,EAAE;IACrD,OAAO,eAAe,CAAC;QACpB,gBAAgB,EAAE,cAAc;QAChC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QACtC,KAAK,EAAE,kBAAkB;QACzB,GAAG,OAAO;KACZ,CAAC,CAAC;AACN,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
export * from './commands/create.js';
|
|
10
|
+
export * from './commands/delete.js';
|
|
11
|
+
export * from './commands/generate-ast-builder.js';
|
|
9
12
|
export * from './commands/generate-transfer-model.js';
|
|
10
13
|
export * from './commands/projects.js';
|
|
11
14
|
export * from './commands/query.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC;AACtD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
export * from './commands/create.js';
|
|
10
|
+
export * from './commands/delete.js';
|
|
11
|
+
export * from './commands/generate-ast-builder.js';
|
|
9
12
|
export * from './commands/generate-transfer-model.js';
|
|
10
13
|
export * from './commands/projects.js';
|
|
11
14
|
export * from './commands/query.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC;AACtD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
package/lib/log-level.d.ts
CHANGED
|
@@ -7,20 +7,30 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type LogThreshold } from '@hydranium/protocol';
|
|
10
|
+
/** The log flags every subcommand takes, as the env {@link logEnv} hands its child. */
|
|
11
|
+
export interface LogOptions {
|
|
12
|
+
/** Threshold for the client sink; the server's log-level setting replaces it. */
|
|
13
|
+
readonly logLevel?: LogThreshold;
|
|
14
|
+
/** File the server tees its log to; `{workspace}` expands once it is known, `{pid}` from the start. */
|
|
15
|
+
readonly logFile?: string;
|
|
16
|
+
/** The file's own threshold, which the log-level setting does not change. */
|
|
17
|
+
readonly logFileLevel?: LogThreshold;
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
|
-
* Validate a raw `--log-level` argument into a
|
|
12
|
-
* an unrecognised value so the CLI's top-level
|
|
13
|
-
* and exits non-zero (mirroring how the other
|
|
14
|
-
* for the argv-supplied value; the resolved
|
|
15
|
-
* {@link
|
|
20
|
+
* Validate a raw `--log-level` / `--log-file-level` argument into a
|
|
21
|
+
* {@link LogThreshold}. Throws on an unrecognised value so the CLI's top-level
|
|
22
|
+
* `catch` surfaces a clean error and exits non-zero (mirroring how the other
|
|
23
|
+
* option parsers fail fast). Use for the argv-supplied value; the resolved
|
|
24
|
+
* threshold is handed to {@link logEnv} to target the spawned server.
|
|
16
25
|
*/
|
|
17
|
-
export declare function parseLogLevelOption(raw: string): LogThreshold;
|
|
26
|
+
export declare function parseLogLevelOption(raw: string, flag?: string): LogThreshold;
|
|
18
27
|
/**
|
|
19
28
|
* Build the environment override that targets *only the spawned server's* log
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
*
|
|
29
|
+
* configuration, or `undefined` when no log flag was given. Passed to
|
|
30
|
+
* `spawnDataServer` as `env`, it sets the same `HYDRANIUM_LOG_LEVEL` /
|
|
31
|
+
* `HYDRANIUM_LOG_FILE` / `HYDRANIUM_LOG_FILE_LEVEL` variables the server reads
|
|
32
|
+
* at startup — the CLI's own logging is unaffected, unlike ambient variables
|
|
33
|
+
* that the child would inherit alongside the parent. The server owns *how* log level
|
|
24
34
|
* works; this only routes the CLI's request onto the channel it already reads.
|
|
25
35
|
*
|
|
26
36
|
* **The variable is read by `LspLogger`'s constructor**, which is bound on the
|
|
@@ -35,5 +45,5 @@ export declare function parseLogLevelOption(raw: string): LogThreshold;
|
|
|
35
45
|
* not go to stdout: that is the JSON-RPC channel, so a log line there would
|
|
36
46
|
* corrupt the very request this flag was set to diagnose.
|
|
37
47
|
*/
|
|
38
|
-
export declare function
|
|
48
|
+
export declare function logEnv(options: LogOptions): Record<string, string> | undefined;
|
|
39
49
|
//# sourceMappingURL=log-level.d.ts.map
|
package/lib/log-level.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-level.d.ts","sourceRoot":"","sources":["../src/log-level.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"log-level.d.ts","sourceRoot":"","sources":["../src/log-level.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAMJ,KAAK,YAAY,EACnB,MAAM,qBAAqB,CAAC;AAE7B,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACxB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACjC,uGAAuG;IACvG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAgB,GAAG,YAAY,CAMnF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAY9E"}
|
package/lib/log-level.js
CHANGED
|
@@ -6,27 +6,28 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { DEFAULT_LOG_LEVEL_ENV, LEVEL_ORDER, parseLogLevel } from '@hydranium/protocol';
|
|
9
|
+
import { DEFAULT_LOG_FILE_ENV, DEFAULT_LOG_FILE_LEVEL_ENV, DEFAULT_LOG_LEVEL_ENV, LEVEL_ORDER, parseLogLevel } from '@hydranium/protocol';
|
|
10
10
|
/**
|
|
11
|
-
* Validate a raw `--log-level` argument into a
|
|
12
|
-
* an unrecognised value so the CLI's top-level
|
|
13
|
-
* and exits non-zero (mirroring how the other
|
|
14
|
-
* for the argv-supplied value; the resolved
|
|
15
|
-
* {@link
|
|
11
|
+
* Validate a raw `--log-level` / `--log-file-level` argument into a
|
|
12
|
+
* {@link LogThreshold}. Throws on an unrecognised value so the CLI's top-level
|
|
13
|
+
* `catch` surfaces a clean error and exits non-zero (mirroring how the other
|
|
14
|
+
* option parsers fail fast). Use for the argv-supplied value; the resolved
|
|
15
|
+
* threshold is handed to {@link logEnv} to target the spawned server.
|
|
16
16
|
*/
|
|
17
|
-
export function parseLogLevelOption(raw) {
|
|
17
|
+
export function parseLogLevelOption(raw, flag = '--log-level') {
|
|
18
18
|
const level = parseLogLevel(raw);
|
|
19
19
|
if (!level) {
|
|
20
|
-
throw new Error(`Invalid
|
|
20
|
+
throw new Error(`Invalid ${flag}: ${raw} (expected one of: ${Object.keys(LEVEL_ORDER).join(', ')})`);
|
|
21
21
|
}
|
|
22
22
|
return level;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Build the environment override that targets *only the spawned server's* log
|
|
26
|
-
*
|
|
27
|
-
* `
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* configuration, or `undefined` when no log flag was given. Passed to
|
|
27
|
+
* `spawnDataServer` as `env`, it sets the same `HYDRANIUM_LOG_LEVEL` /
|
|
28
|
+
* `HYDRANIUM_LOG_FILE` / `HYDRANIUM_LOG_FILE_LEVEL` variables the server reads
|
|
29
|
+
* at startup — the CLI's own logging is unaffected, unlike ambient variables
|
|
30
|
+
* that the child would inherit alongside the parent. The server owns *how* log level
|
|
30
31
|
* works; this only routes the CLI's request onto the channel it already reads.
|
|
31
32
|
*
|
|
32
33
|
* **The variable is read by `LspLogger`'s constructor**, which is bound on the
|
|
@@ -41,7 +42,17 @@ export function parseLogLevelOption(raw) {
|
|
|
41
42
|
* not go to stdout: that is the JSON-RPC channel, so a log line there would
|
|
42
43
|
* corrupt the very request this flag was set to diagnose.
|
|
43
44
|
*/
|
|
44
|
-
export function
|
|
45
|
-
|
|
45
|
+
export function logEnv(options) {
|
|
46
|
+
const env = {};
|
|
47
|
+
if (options.logLevel !== undefined) {
|
|
48
|
+
env[DEFAULT_LOG_LEVEL_ENV] = options.logLevel;
|
|
49
|
+
}
|
|
50
|
+
if (options.logFile !== undefined) {
|
|
51
|
+
env[DEFAULT_LOG_FILE_ENV] = options.logFile;
|
|
52
|
+
}
|
|
53
|
+
if (options.logFileLevel !== undefined) {
|
|
54
|
+
env[DEFAULT_LOG_FILE_LEVEL_ENV] = options.logFileLevel;
|
|
55
|
+
}
|
|
56
|
+
return Object.keys(env).length > 0 ? env : undefined;
|
|
46
57
|
}
|
|
47
58
|
//# sourceMappingURL=log-level.js.map
|
package/lib/log-level.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-level.js","sourceRoot":"","sources":["../src/log-level.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"log-level.js","sourceRoot":"","sources":["../src/log-level.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,WAAW,EACX,aAAa,EAEf,MAAM,qBAAqB,CAAC;AAY7B;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,IAAI,GAAG,aAAa;IAClE,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,CAAC,KAAK,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,GAAG,sBAAsB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,KAAK,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,MAAM,CAAC,OAAmB;IACvC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAClC,GAAG,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IACjD,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,GAAG,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACtC,GAAG,CAAC,0BAA0B,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { type TransferDiagnostic, type TransferElement } from '@hydranium/protocol';
|
|
10
10
|
import { type DataClientProtocol, type DataServerProtocol } from '@hydranium/protocol/data';
|
|
11
11
|
import { type ChildProcess } from 'node:child_process';
|
|
12
|
-
import { type MessageConnection } from 'vscode-jsonrpc/node';
|
|
12
|
+
import { type Logger as ConnectionLogger, type MessageConnection } from 'vscode-jsonrpc/node';
|
|
13
13
|
/**
|
|
14
14
|
* Options for {@link spawnDataServer}. `command` is the binary or script
|
|
15
15
|
* path; `args` are the command-line arguments passed to it. The adopter's
|
|
@@ -42,6 +42,11 @@ export interface SpawnDataServerOptions {
|
|
|
42
42
|
* scripted use; set to `'pipe'` to capture for assertion in tests.
|
|
43
43
|
*/
|
|
44
44
|
readonly stderr?: 'inherit' | 'ignore' | 'pipe';
|
|
45
|
+
/**
|
|
46
|
+
* Where the connection to the child logs its protocol faults, such as a
|
|
47
|
+
* response that matches no request. Default: this process's stderr.
|
|
48
|
+
*/
|
|
49
|
+
readonly logger?: ConnectionLogger;
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* Lifecycle handle for a spawned data-server. Owns the child process,
|
|
@@ -94,9 +99,9 @@ export declare function spawnDataServer<TTransfer extends TransferElement, TDiag
|
|
|
94
99
|
* child down afterwards. The `use` call is raced against
|
|
95
100
|
* {@link DataServerHandle.whenTerminated}, so a spawn failure or a premature child
|
|
96
101
|
* exit rejects with a clear message instead of hanging on an RPC that can never be
|
|
97
|
-
* answered. This is the one-shot counterpart the
|
|
98
|
-
*
|
|
99
|
-
*
|
|
102
|
+
* answered. This is the one-shot counterpart the data-server subcommands
|
|
103
|
+
* compose; `watch` races its own long-running loop against `whenTerminated`
|
|
104
|
+
* directly.
|
|
100
105
|
*/
|
|
101
106
|
export declare function withDataServer<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic, R>(options: SpawnDataServerOptions, use: (server: DataServerProtocol<TTransfer, TDiagnostic>, handle: DataServerHandle<TTransfer, TDiagnostic>) => Promise<R>, localClient?: DataClientProtocol<TTransfer, TDiagnostic>): Promise<R>;
|
|
102
107
|
//# sourceMappingURL=spawn-data-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-data-server.d.ts","sourceRoot":"","sources":["../src/spawn-data-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAkB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAGJ,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"spawn-data-server.d.ts","sourceRoot":"","sources":["../src/spawn-data-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAkB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAGJ,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAIJ,KAAK,MAAM,IAAI,gBAAgB,EAC/B,KAAK,iBAAiB,EACxB,MAAM,qBAAqB,CAAC;AAG7B;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,sBAAsB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,E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CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EACzH,WAAW,CAAC,EAAE,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,GACxD,OAAO,CAAC,CAAC,CAAC,CAYZ"}
|
package/lib/spawn-data-server.js
CHANGED
|
@@ -10,6 +10,7 @@ import { createRpcProxy } from '@hydranium/protocol';
|
|
|
10
10
|
import { DATA_CLIENT_PROTOCOL_METHODS, DATA_SERVER_WIRE_PREFIX } from '@hydranium/protocol/data';
|
|
11
11
|
import { spawn } from 'node:child_process';
|
|
12
12
|
import { StreamMessageReader, StreamMessageWriter, createMessageConnection } from 'vscode-jsonrpc/node';
|
|
13
|
+
import { STDERR_CONNECTION_LOGGER } from './stderr-connection-logger.js';
|
|
13
14
|
/**
|
|
14
15
|
* Spawn a data-server subprocess and wire a typed proxy over its
|
|
15
16
|
* stdio JSON-RPC. The function returns once the connection is
|
|
@@ -61,7 +62,7 @@ export function spawnDataServer(options, localClient) {
|
|
|
61
62
|
});
|
|
62
63
|
const reader = new StreamMessageReader(child.stdout);
|
|
63
64
|
const writer = new StreamMessageWriter(child.stdin);
|
|
64
|
-
const connection = createMessageConnection(reader, writer);
|
|
65
|
+
const connection = createMessageConnection(reader, writer, options.logger ?? STDERR_CONNECTION_LOGGER);
|
|
65
66
|
// Consume transport error / close so a child that dies mid-stream (its stdout
|
|
66
67
|
// closing, a write landing on a torn-down stdin) is observed here rather than
|
|
67
68
|
// escaping as an unhandled error — the death is reported via `whenTerminated`.
|
|
@@ -133,9 +134,9 @@ export function spawnDataServer(options, localClient) {
|
|
|
133
134
|
* child down afterwards. The `use` call is raced against
|
|
134
135
|
* {@link DataServerHandle.whenTerminated}, so a spawn failure or a premature child
|
|
135
136
|
* exit rejects with a clear message instead of hanging on an RPC that can never be
|
|
136
|
-
* answered. This is the one-shot counterpart the
|
|
137
|
-
*
|
|
138
|
-
*
|
|
137
|
+
* answered. This is the one-shot counterpart the data-server subcommands
|
|
138
|
+
* compose; `watch` races its own long-running loop against `whenTerminated`
|
|
139
|
+
* directly.
|
|
139
140
|
*/
|
|
140
141
|
export async function withDataServer(options, use, localClient) {
|
|
141
142
|
const handle = spawnDataServer(options, localClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-data-server.js","sourceRoot":"","sources":["../src/spawn-data-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAiD,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACJ,4BAA4B,EAC5B,uBAAuB,EAGzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"spawn-data-server.js","sourceRoot":"","sources":["../src/spawn-data-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAiD,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACJ,4BAA4B,EAC5B,uBAAuB,EAGzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACJ,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EAGzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AA0EzE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAC5B,OAA+B,EAC/B,WAAwD;IAExD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE;QAC7D,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,G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AC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACjC,OAA+B,EAC/B,GAAyH,EACzH,WAAwD;IAExD,MAAM,MAAM,GAAG,eAAe,CAAyB,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7E,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,4EAA4E;IAC5E,iFAAiF;IACjF,wEAAwE;IACxE,KAAK,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC;QACF,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IAClE,CAAC;YAAS,CAAC;QACR,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import type { Logger as ConnectionLogger } from 'vscode-jsonrpc/node';
|
|
10
|
+
/** Every connection line goes to stderr: stdout carries the command's output or the protocol stream. */
|
|
11
|
+
export declare const STDERR_CONNECTION_LOGGER: ConnectionLogger;
|
|
12
|
+
//# sourceMappingURL=stderr-connection-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stderr-connection-logger.d.ts","sourceRoot":"","sources":["../src/stderr-connection-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,wGAAwG;AACxG,eAAO,MAAM,wBAAwB,EAAE,gBAKtC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
/** Every connection line goes to stderr: stdout carries the command's output or the protocol stream. */
|
|
10
|
+
export const STDERR_CONNECTION_LOGGER = {
|
|
11
|
+
error: message => console.error(message),
|
|
12
|
+
warn: message => console.error(message),
|
|
13
|
+
info: message => console.error(message),
|
|
14
|
+
log: message => console.error(message)
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=stderr-connection-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stderr-connection-logger.js","sourceRoot":"","sources":["../src/stderr-connection-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,wGAAwG;AACxG,MAAM,CAAC,MAAM,wBAAwB,GAAqB;IACvD,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;IACxC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;IACvC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;CACxC,CAAC"}
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { DataServer } from '@hydranium/data-server';
|
|
20
20
|
import { makeTestServices } from '@hydranium/core/testing';
|
|
21
|
+
import { describeErrorWithStack } from '@hydranium/protocol';
|
|
21
22
|
import { StreamMessageReader, StreamMessageWriter, createMessageConnection } from 'vscode-jsonrpc/node';
|
|
23
|
+
import { STDERR_CONNECTION_LOGGER } from '../stderr-connection-logger.js';
|
|
22
24
|
function parseFakeRoot(text) {
|
|
23
25
|
const match = /^name:(.+)$/.exec(text);
|
|
24
26
|
return { $type: 'FakeRoot', name: match ? match[1] : 'unknown' };
|
|
@@ -60,7 +62,13 @@ function main() {
|
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
const
|
|
65
|
+
const writer = new StreamMessageWriter(process.stdout);
|
|
66
|
+
const connection = createMessageConnection(new StreamMessageReader(process.stdin), writer, STDERR_CONNECTION_LOGGER);
|
|
67
|
+
if (process.argv.includes('--send-response-without-id')) {
|
|
68
|
+
// A response the parent cannot match to a request, for its connection to log.
|
|
69
|
+
const response = { jsonrpc: '2.0', id: null, result: null };
|
|
70
|
+
writer.write(response).catch((error) => STDERR_CONNECTION_LOGGER.error(describeErrorWithStack(error)));
|
|
71
|
+
}
|
|
64
72
|
if (process.argv.includes('--exit-on-request')) {
|
|
65
73
|
// Fail-fast fixture mode: read a full request (the reader parses the whole
|
|
66
74
|
// message, so the parent's write completed — no partial-write race) then die
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-server.js","sourceRoot":"","sources":["../../src/testing/echo-server.ts"],"names":[],"mappings":";AACA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"echo-server.js","sourceRoot":"","sources":["../../src/testing/echo-server.ts"],"names":[],"mappings":";AACA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAA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