@hydranium/cli 1.0.0-next.31 → 1.0.0-next.312
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 +79 -205
- 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-languages.d.ts +35 -0
- package/lib/commands/generate-languages.d.ts.map +1 -0
- package/lib/commands/generate-languages.js +105 -0
- package/lib/commands/generate-languages.js.map +1 -0
- package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model-args.js +7 -0
- 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 +15 -1
- package/lib/commands/generate-transfer-model.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model.js +46 -8
- 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.d.ts.map +1 -1
- package/lib/commands/init-args.js +32 -27
- package/lib/commands/init-args.js.map +1 -1
- package/lib/commands/init-prompt.d.ts +3 -3
- package/lib/commands/init-prompt.d.ts.map +1 -1
- package/lib/commands/init-prompt.js +4 -5
- package/lib/commands/init-prompt.js.map +1 -1
- package/lib/commands/init-templates.d.ts +18 -14
- package/lib/commands/init-templates.d.ts.map +1 -1
- package/lib/commands/init-templates.js +732 -677
- package/lib/commands/init-templates.js.map +1 -1
- package/lib/commands/init-wizard.d.ts.map +1 -1
- package/lib/commands/init-wizard.js +17 -27
- package/lib/commands/init-wizard.js.map +1 -1
- package/lib/commands/init-workspace.d.ts +13 -11
- package/lib/commands/init-workspace.d.ts.map +1 -1
- package/lib/commands/init-workspace.js +21 -7
- package/lib/commands/init-workspace.js.map +1 -1
- package/lib/commands/init.d.ts +45 -19
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +80 -43
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/kebab.d.ts +15 -0
- package/lib/commands/kebab.d.ts.map +1 -0
- package/lib/commands/kebab.js +17 -0
- package/lib/commands/kebab.js.map +1 -0
- 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 +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -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 +52 -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-languages.ts +132 -0
- package/src/commands/generate-transfer-model-args.ts +7 -0
- package/src/commands/generate-transfer-model-config.ts +6 -3
- package/src/commands/generate-transfer-model.ts +56 -8
- package/src/commands/harness-args.ts +99 -31
- package/src/commands/headless-harness.ts +86 -26
- package/src/commands/init-args.ts +32 -27
- package/src/commands/init-prompt.ts +5 -6
- package/src/commands/init-templates.ts +790 -696
- package/src/commands/init-wizard.ts +17 -27
- package/src/commands/init-workspace.ts +31 -16
- package/src/commands/init.ts +126 -58
- package/src/commands/kebab.ts +17 -0
- 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 +2 -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
- package/templates/gitignore +1 -0
- package/templates/protocol/gitignore +3 -0
- package/templates/protocol/src/__GRAMMAR_ID__-diagram-types.ts +41 -0
- package/templates/server/gitignore +6 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/create-node-operation-handler.ts +62 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/gmodel-factory.ts +60 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/state.ts +18 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/storage.ts +16 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/submission-handler.ts +24 -0
- package/templates/server/src/grammar/common.langium +12 -0
- package/templates/server/src/language-server/__GRAMMAR_ID__-serializer.ts +53 -0
- package/templates/server/src/language-server/ast.ts +23 -0
- package/templates/server/src/node/services.ts +16 -0
- package/templates/server/test/__GRAMMAR_ID__-diagram.test.ts +112 -0
- package/templates/server/test/tsconfig.json +4 -0
- package/templates/server/tsconfig.test.json +10 -0
- package/templates/server/vitest.config.ts +14 -0
- package/templates/workspace/nodes.__EXTENSION__ +5 -0
- package/templates/workspace/references.__EXTENSION__ +2 -0
package/lib/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
export * from './commands/create.js';
|
|
10
|
+
export * from './commands/delete.js';
|
|
9
11
|
export * from './commands/generate-ast-builder.js';
|
|
10
12
|
export * from './commands/generate-transfer-model.js';
|
|
11
13
|
export * from './commands/projects.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,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"}
|
|
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,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
export * from './commands/create.js';
|
|
10
|
+
export * from './commands/delete.js';
|
|
9
11
|
export * from './commands/generate-ast-builder.js';
|
|
10
12
|
export * from './commands/generate-transfer-model.js';
|
|
11
13
|
export * from './commands/projects.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,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"}
|
|
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,gBAA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C,SAAS,EAAE,WAAW,CAAC,GACxD,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAqH1C;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,SAAS,kBAAkB,EAAE,CAAC,EAC9G,OAAO,EAAE,sBAAsB,EAC/B,GAAG,EAAE,CAAC,MAAM,EAAE,kBAAkB,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,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,EAAE;gBAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC,EAAE,SAAS,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,OAAO,eAAe,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AAClE,CAAC;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,yBA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AE,CAAC;QACvD,8EAA8E;QAC9E,MAAM,QAAQ,GAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC7E,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnH,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC9C,2EAA2E;QAC3E,6EAA6E;QAC7E,8EAA8E;QAC9E,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5C,UAAU,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO;IACV,CAAC;IAED,IAAI,UAAU,CAAW,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtD,UAAU,CAAC,MAAM,EAAE,CAAC;IACpB,sEAAsE;IACtE,qEAAqE;IACrE,6CAA6C;AAChD,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/cli",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.312",
|
|
4
4
|
"description": "Build-time codegen tools + data-server subcommands for the hydranium framework.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"codegen",
|
|
6
8
|
"hydranium",
|
|
7
9
|
"langium",
|
|
8
10
|
"language-server",
|
|
9
|
-
"lsp"
|
|
10
|
-
"cli",
|
|
11
|
-
"codegen"
|
|
11
|
+
"lsp"
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://github.com/eclipse-emfcloud/hydranium/tree/main/packages/cli",
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/eclipse-emfcloud/hydranium/issues"
|
|
16
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Hydranium Team"
|
|
20
|
+
},
|
|
17
21
|
"repository": {
|
|
18
22
|
"type": "git",
|
|
19
23
|
"url": "https://github.com/eclipse-emfcloud/hydranium.git",
|
|
20
24
|
"directory": "packages/cli"
|
|
21
25
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"name": "Hydranium Team"
|
|
26
|
+
"bin": {
|
|
27
|
+
"hydranium-cli": "bin/hydranium-cli.js"
|
|
25
28
|
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin",
|
|
31
|
+
"lib",
|
|
32
|
+
"src",
|
|
33
|
+
"heap-analysis",
|
|
34
|
+
"templates",
|
|
35
|
+
"!lib/**/*.tsbuildinfo"
|
|
36
|
+
],
|
|
37
|
+
"type": "module",
|
|
26
38
|
"sideEffects": [
|
|
27
39
|
"./lib/cli.js",
|
|
28
40
|
"./lib/commands/*-driver.js",
|
|
29
41
|
"./lib/testing/echo-server.js"
|
|
30
42
|
],
|
|
31
|
-
"
|
|
43
|
+
"main": "lib/index.js",
|
|
44
|
+
"types": "lib/index.d.ts",
|
|
32
45
|
"exports": {
|
|
33
46
|
".": {
|
|
34
47
|
"types": "./lib/index.d.ts",
|
|
@@ -39,21 +52,13 @@
|
|
|
39
52
|
"default": "./lib/cli.js"
|
|
40
53
|
}
|
|
41
54
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"bin": {
|
|
45
|
-
"hydranium-cli": "lib/cli.js"
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
46
57
|
},
|
|
47
|
-
"files": [
|
|
48
|
-
"lib",
|
|
49
|
-
"src",
|
|
50
|
-
"heap-analysis",
|
|
51
|
-
"!lib/**/*.tsbuildinfo"
|
|
52
|
-
],
|
|
53
58
|
"scripts": {
|
|
54
|
-
"build": "tsc -b
|
|
59
|
+
"build": "tsc -b",
|
|
55
60
|
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
56
|
-
"lint": "
|
|
61
|
+
"lint": "oxlint --format stylish --config ../../oxlint.config.cjs src test --max-warnings 0",
|
|
57
62
|
"prepack": "node -e \"const m=require('./package.json'),fs=require('node:fs');const missing=[m.main,...Object.values(m.bin||{})].filter(entry=>entry&&!fs.existsSync(entry));if(missing.length){console.error('prepack '+m.name+': not built ('+missing.join(', ')+' missing). Run the build before packing: a files entry that matches nothing is skipped silently, so the tarball would ship src only.');process.exit(1);}\"",
|
|
58
63
|
"test": "npm run typecheck:test && vitest run",
|
|
59
64
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
@@ -65,23 +70,34 @@
|
|
|
65
70
|
"ts-morph": "^25.0.0"
|
|
66
71
|
},
|
|
67
72
|
"devDependencies": {
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"@hydranium/
|
|
73
|
+
"@eclipse-glsp/graph": "2.7.0",
|
|
74
|
+
"@eclipse-glsp/protocol": "2.7.0",
|
|
75
|
+
"@eclipse-glsp/server": "2.7.0",
|
|
76
|
+
"@hydranium/core": "1.0.0-next.312",
|
|
77
|
+
"@hydranium/data-server": "1.0.0-next.312",
|
|
78
|
+
"@hydranium/glsp-server": "1.0.0-next.312",
|
|
79
|
+
"@hydranium/langium": "1.0.0-next.312",
|
|
80
|
+
"@hydranium/protocol": "1.0.0-next.312",
|
|
81
|
+
"@types/node": "^22.0.0",
|
|
82
|
+
"inversify": "6.2.2",
|
|
83
|
+
"langium": "4.3.1",
|
|
84
|
+
"langium-cli": "4.3.0",
|
|
85
|
+
"reflect-metadata": "0.2.2",
|
|
72
86
|
"rimraf": "^5.0.0",
|
|
73
|
-
"typescript": "^
|
|
74
|
-
"
|
|
75
|
-
"vscode-
|
|
87
|
+
"typescript": "^7.0.2",
|
|
88
|
+
"vitest": "^4.0.0",
|
|
89
|
+
"vscode-jsonrpc": "9.0.0",
|
|
90
|
+
"vscode-languageserver": "10.0.1",
|
|
91
|
+
"vscode-languageserver-protocol": "3.18.1"
|
|
76
92
|
},
|
|
77
93
|
"peerDependencies": {
|
|
78
|
-
"@hydranium/core": "1.0.0-next.
|
|
79
|
-
"@hydranium/data-server": "1.0.0-next.
|
|
80
|
-
"@hydranium/langium": "1.0.0-next.
|
|
81
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
94
|
+
"@hydranium/core": "1.0.0-next.312",
|
|
95
|
+
"@hydranium/data-server": "1.0.0-next.312",
|
|
96
|
+
"@hydranium/langium": "1.0.0-next.312",
|
|
97
|
+
"@hydranium/protocol": "1.0.0-next.312",
|
|
82
98
|
"@memlab/core": "^2.0.3",
|
|
83
99
|
"@memlab/heap-analysis": "^2.0.3",
|
|
84
|
-
"vscode-jsonrpc": "9.0.
|
|
100
|
+
"vscode-jsonrpc": "^9.0.0"
|
|
85
101
|
},
|
|
86
102
|
"peerDependenciesMeta": {
|
|
87
103
|
"@memlab/core": {
|
|
@@ -94,13 +110,10 @@
|
|
|
94
110
|
"engines": {
|
|
95
111
|
"node": ">=22.13"
|
|
96
112
|
},
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
"//build": "The chmod is load-bearing, not cruft. npm sets a bin's executable bit through bin-links' fixBin, but ONLY when it first creates the link — and `tsc` never sets it, so after `npm run clean` (which deletes lib/) a rebuild leaves lib/cli.js at 0644 and the node_modules/.bin/hydranium-cli symlink resolves to a non-executable target. Every example's `generate` step then dies with `sh: hydranium-cli: Permission denied`, surfacing as an opaque npm error code 127 during `turbo run build`. npm rebuild, npm rebuild @hydranium/cli AND a full npm install all fail to restore it, because npm will not revisit an existing workspace symlink; only a from-scratch `rm -rf node_modules` install does. Written as `node -e` rather than `chmod +x` so it stays portable — on Windows npm generates .cmd/.ps1 shims where the bit is irrelevant and chmodSync is harmless. The example packages' bins need no such step: their tests spawn them via process.execPath, never through the shim.",
|
|
101
|
-
"//exports": "Two keys, and the SHORT list is the point: `files` ships the whole compiled tree, so without a map every `lib/commands/*.js`, every internal helper and `lib/testing/echo-server.js` is deep-importable the moment this publishes, and semver then applies to all of it. `.` is the library barrel (the data-server subcommands an adopter calls as functions). `./lib/cli.js` is the BINARY ARTEFACT, and it is declared because a consumer that spawns the CLI resolves it BY SPECIFIER — `createRequire(import.meta.url).resolve('@hydranium/cli/lib/cli.js')` — to get the path npx would run; `bin` gives a shim on PATH, not a path, so dropping this key breaks that resolution and the failure surfaces as \"hydranium-cli is not built\", naming the wrong cause. It is declared in the `/lib/` spelling ONLY: that spelling already resolves under both of this repo's module resolvers, so the twin rule (which exists so a BARE subpath is reachable from node10) has nothing to add here and a bare twin would only be a second name for one artefact. `heap-analysis/` needs no key even though `files` ships it — `analyze-heap` reaches the analyzer through a `new URL(..., import.meta.url)` file URL, which `exports` does not gate, and the package's own tests reach it relatively. `./testing` is deliberately absent: `echo-server` is a spawnable stdio fixture, not a reusable export.",
|
|
113
|
+
"//devDependencies": "Every package an `init` scaffold declares, other than this one, is declared here, whether or not `src` uses it: the scaffold-compiles test compiles and runs scaffolds inside this package, so their imports and tools resolve through these declarations. `check:init-provenance` holds this list and its versions to the scaffold's manifest.",
|
|
114
|
+
"//exports": "Two keys, and the SHORT list is the point: `files` ships the whole compiled tree, so without a map every `lib/commands/*.js`, every internal helper and `lib/testing/echo-server.js` is deep-importable the moment this publishes, and semver then applies to all of it. `.` is the library barrel (the data-server subcommands an adopter calls as functions). `./lib/cli.js` is the BINARY ARTEFACT, and it is declared because a consumer that spawns the CLI resolves it BY SPECIFIER — `createRequire(import.meta.url).resolve('@hydranium/cli/lib/cli.js')` — to get the path npx would run; `bin` gives a shim on PATH, not a path, so dropping this key breaks that resolution and the failure surfaces as \"hydranium-cli is not built\", naming the wrong cause. `heap-analysis/` and `templates/` need no key even though `files` ships them — `analyze-heap` and `init` reach them through a `new URL(..., import.meta.url)` file URL, which `exports` does not gate, and the package's own tests reach them relatively. `./testing` is deliberately absent: `echo-server` is a spawnable stdio fixture, not a reusable export.",
|
|
102
115
|
"//memlab": "@memlab/core and @memlab/heap-analysis are OPTIONAL PEER dependencies, not optionalDependencies, and the distinction is the whole point: npm installs optionalDependencies BY DEFAULT, both memlab packages pin puppeteer exactly, and puppeteer's postinstall downloads a Chrome binary — so every adopter of this CLI paid ~86 MB and a browser download for the one subcommand almost none of them run, and the download can fail and be walked past as a warning. An optional peer is not auto-installed, so `analyze-heap` documents `npm install @memlab/core @memlab/heap-analysis` as the opt-in and every other subcommand is unaffected. Taken pre-publish deliberately: after publish the install shape is what adopters already have.",
|
|
103
|
-
"//peerDependencies": "`vscode-jsonrpc`
|
|
104
|
-
"//prepack": "The publish guard,
|
|
116
|
+
"//peerDependencies": "`vscode-jsonrpc` takes a caret, so the framework shares the transport the LSP connection resolves, which an `init` scaffold pins: each `vscode-languageserver-protocol` release pins its transport exactly, so an exact peer would name a copy a fresh install rarely holds. The caret excludes 8.x, so a tree whose top holds GLSP's copy fails the peer with a named ERESOLVE warning, an error under `--strict-peer-deps`, rather than resolving silently. No peer reaches a NESTED copy, such as GLSP's or one the LSP packages nest. The wire compares message types and `ResponseError`s by copy identity, so the framework sends typed messages by method name and recognises errors with `isResponseError` rather than `instanceof`.",
|
|
117
|
+
"//prepack": "The publish guard, a `prepack` rather than a `prepare`: `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error.",
|
|
105
118
|
"//sideEffects": "The listed modules RUN on load rather than exporting anything: `cli.js` is the `bin`, each `*-driver.js` is spawned as its own process and calls `main(process.argv)` at top level, and `echo-server.js` starts a server. Their whole purpose is the effect, so a bundler must never treat them as prunable. Everything else here is library code with no module-level state beyond `new URL(..., import.meta.url)` constants."
|
|
106
119
|
}
|
package/src/cli.ts
CHANGED
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
|
|
11
11
|
import { Command } from 'commander';
|
|
12
|
+
import { describeError } from '@hydranium/protocol';
|
|
12
13
|
import { readCliVersion } from './cli-version.js';
|
|
13
14
|
import { runAnalyzeHeapCommand } from './commands/analyze-heap-args.js';
|
|
14
15
|
import { runAstGroundTruthCommand } from './commands/ast-ground-truth-args.js';
|
|
16
|
+
import { runCreateCommand } from './commands/create-args.js';
|
|
17
|
+
import { runDeleteCommand } from './commands/delete-args.js';
|
|
15
18
|
import { runGenerateTransferModelCommand } from './commands/generate-transfer-model-args.js';
|
|
16
19
|
import { runInitCommand } from './commands/init-args.js';
|
|
17
20
|
import { InitWizardCancelled } from './commands/init-prompt.js';
|
|
@@ -44,6 +47,8 @@ const COMMANDS: Record<string, { readonly summary: string; readonly run: (args:
|
|
|
44
47
|
summary: "Tally a workspace's live-model $types (analyze-heap --validate input).",
|
|
45
48
|
run: runAstGroundTruthCommand
|
|
46
49
|
},
|
|
50
|
+
create: { summary: 'Create a new document and its file via a data-server subprocess.', run: runCreateCommand },
|
|
51
|
+
delete: { summary: 'Delete a document, its file included, via a data-server subprocess.', run: runDeleteCommand },
|
|
47
52
|
'generate-transfer-model': {
|
|
48
53
|
summary: 'Generate a transfer-model TypeScript file from a Langium AST.',
|
|
49
54
|
run: runGenerateTransferModelCommand
|
|
@@ -55,7 +60,7 @@ const COMMANDS: Record<string, { readonly summary: string; readonly run: (args:
|
|
|
55
60
|
projects: { summary: 'List projects exposed by a data-server subprocess.', run: runProjectsCommand },
|
|
56
61
|
query: { summary: 'Print the data-server document envelope for a URI.', run: runQueryCommand },
|
|
57
62
|
reflect: { summary: "Dump a head's grammar/AST reflection (types, terminals, refs).", run: runReflectCommand },
|
|
58
|
-
save: { summary: 'Update + persist
|
|
63
|
+
save: { summary: 'Update + persist an existing document via a data-server subprocess.', run: runSaveCommand },
|
|
59
64
|
validate: { summary: 'Validate a workspace headlessly; non-zero exit on errors (CI gate).', run: runValidateCommand },
|
|
60
65
|
watch: { summary: 'Subscribe to data-server document updates; print events as NDJSON.', run: runWatchCommand }
|
|
61
66
|
};
|
|
@@ -134,6 +139,6 @@ main(process.argv.slice(2)).catch(err => {
|
|
|
134
139
|
if (err instanceof InitWizardCancelled) {
|
|
135
140
|
process.exit(130);
|
|
136
141
|
}
|
|
137
|
-
console.error(
|
|
142
|
+
console.error(describeError(err));
|
|
138
143
|
process.exit(1);
|
|
139
144
|
});
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { driverHeapArgs, type HeapReading } from '../driver-heap.js';
|
|
11
12
|
import { spawnNodeChild } from './headless-harness.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -41,6 +42,8 @@ export interface AnalyzeHeapDeps {
|
|
|
41
42
|
readonly __spawnForTest?: (execArgs: string[]) => Promise<number>;
|
|
42
43
|
/** Override the memlab-availability check. */
|
|
43
44
|
readonly __memlabInstalledForTest?: () => boolean;
|
|
45
|
+
/** Decide the heap ceiling from a stated cgroup reading rather than the machine's. */
|
|
46
|
+
readonly __heapReadingForTest?: HeapReading;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
/**
|
|
@@ -69,7 +72,7 @@ export async function runAnalyzeHeap(args: string[], deps: AnalyzeHeapDeps = {})
|
|
|
69
72
|
return;
|
|
70
73
|
}
|
|
71
74
|
const spawnChild = deps.__spawnForTest ?? spawnNodeChild;
|
|
72
|
-
const code = await spawnChild([
|
|
75
|
+
const code = await spawnChild([...driverHeapArgs(deps.__heapReadingForTest), ANALYZER, ...args]);
|
|
73
76
|
if (code) {
|
|
74
77
|
process.exitCode = code;
|
|
75
78
|
}
|