@hydranium/cli 1.0.0-next.28 → 1.0.0-next.280
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 +47 -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 +86 -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 +95 -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
package/README.md
CHANGED
|
@@ -1,240 +1,111 @@
|
|
|
1
1
|
# `@hydranium/cli`
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
invocation; the other twelve subcommands drive an already-built head from a shell or a CI step —
|
|
8
|
-
grammar introspection, headless validation, transfer-model codegen, memory measurement, and
|
|
9
|
-
operations against a spawned data-server.
|
|
3
|
+
The `hydranium-cli` binary of the
|
|
4
|
+
[Hydranium](https://github.com/eclipse-emfcloud/hydranium) framework. You
|
|
5
|
+
install it when you build a Hydranium language: `init` scaffolds the project,
|
|
6
|
+
and the other commands drive your built head from a shell or a CI step.
|
|
10
7
|
|
|
11
8
|
## What it gives you
|
|
12
9
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
- **Memory and profiling** — `measure-memory`, `ast-ground-truth`, and the memlab-based
|
|
24
|
-
`analyze-heap`.
|
|
25
|
-
- **Data-server operations** — `projects`, `query`, `save` and `watch` spawn a data-server child and
|
|
26
|
-
speak its protocol, printing JSON / NDJSON a script can pipe.
|
|
10
|
+
- Scaffold a buildable language project with one `init` command, or answer a
|
|
11
|
+
wizard that echoes the command it composed.
|
|
12
|
+
- Fail a CI step on a diagnostic or a grammar-convention violation, with no
|
|
13
|
+
editor running.
|
|
14
|
+
- Dump your grammar's reflection, or write a Markdown model reference for your
|
|
15
|
+
own docs.
|
|
16
|
+
- Generate the serializable transfer model from Langium's generated AST.
|
|
17
|
+
- Measure model-store memory and analyze a V8 heap snapshot.
|
|
18
|
+
- List, read, create, save and watch documents through a spawned data server,
|
|
19
|
+
printing JSON a script can pipe, and delete them.
|
|
27
20
|
|
|
28
21
|
## Install
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
> resolves to no package and fails with `E404`. Until the first release the CLI
|
|
32
|
-
> is reachable only from a clone of this repository: run `npm run build`, then
|
|
33
|
-
> substitute `node packages/cli/lib/cli.js` for the `npx …` prefix. Subcommands,
|
|
34
|
-
> flags and output are the same either way.
|
|
35
|
-
|
|
36
|
-
`init` needs no install at all:
|
|
23
|
+
`init` needs no install:
|
|
37
24
|
|
|
38
25
|
```bash
|
|
39
26
|
npx @hydranium/cli init ./my-lang --name MyLang
|
|
40
27
|
```
|
|
41
28
|
|
|
42
|
-
For the
|
|
29
|
+
For the commands you run repeatedly, add it to the project it inspects, or
|
|
30
|
+
install it globally:
|
|
43
31
|
|
|
44
32
|
```bash
|
|
45
33
|
npm install --save-dev @hydranium/cli
|
|
46
34
|
npm install --global @hydranium/cli
|
|
47
35
|
```
|
|
48
36
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
`
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
a filesystem path or a `file:` URI — and exit 2 naming it when it reaches none. Without that a CI
|
|
89
|
-
step whose path has rotted builds nothing, reports whatever documents the head contributes
|
|
90
|
-
independently of the workspace, and exits 0; the count is a property of the head, so it can be
|
|
91
|
-
plausibly non-zero and cannot be read as the tell.
|
|
92
|
-
|
|
93
|
-
**Codegen**
|
|
94
|
-
|
|
95
|
-
- `generate-transfer-model` — generate a transfer-model TypeScript file from a Langium AST.
|
|
96
|
-
`--ast-file`, `--augmentation-file` and `--out-file` are required, and may come from
|
|
97
|
-
`--config <path>` instead; `--langium-config <path>` derives `--ast-file` from that config's `out`
|
|
98
|
-
directory. `--watch` regenerates on change, and the output-naming flags (`--element-type-name`,
|
|
99
|
-
`--terminals-name`, `--terminals-source-name`, `--skip-type-alias`, `--skip-terminal`,
|
|
100
|
-
`--regen-command`) tune the emitted file.
|
|
101
|
-
|
|
102
|
-
**Heap analysis**
|
|
103
|
-
|
|
104
|
-
- `analyze-heap <snapshot>` — Langium-aware V8 heap-snapshot analysis. Its flags (`--out-file`,
|
|
105
|
-
`--json`, `--diff`, `--validate <gt.json>`, `--renderer`, and the drill-down tuning flags) are
|
|
106
|
-
declared alongside every other subcommand's, so an unrecognised one is rejected rather than
|
|
107
|
-
ignored.
|
|
108
|
-
|
|
109
|
-
**Data-server operations** (`--server "<cmd> [args...]"`)
|
|
110
|
-
|
|
111
|
-
These spawn a data-server child and talk to it over its protocol. All four also take `--cwd <dir>`
|
|
112
|
-
and `--log-level <off|error|warn|info|debug|trace>`.
|
|
113
|
-
|
|
114
|
-
`--server` has to name an entry that puts the **data** protocol on stdio, which for a scaffolded
|
|
115
|
-
project is `lib/data-server-main.js` — `init` emits it, and the `<project-id>-data-server` bin key
|
|
116
|
-
points at it. `lib/main.js` is the editor entry: stdio there carries LSP and the data head is a
|
|
117
|
-
socket whose port is published over the LSP connection, so pointing `--server` at it answers
|
|
118
|
-
`Unhandled method data-server/getProjects` (or, without `--stdio`, exits on "Connection input stream
|
|
119
|
-
is not set"). Pass the workspace as the entry's own argument rather than through `--cwd`: `--cwd`
|
|
120
|
-
re-roots the child, so a relative entry path would resolve against the workspace — the parser
|
|
121
|
-
refuses that combination by name rather than letting the child fail on a bare module-not-found.
|
|
122
|
-
An absolute entry path works with `--cwd`.
|
|
37
|
+
| Peer | Range |
|
|
38
|
+
| ------------------------ | ------------- |
|
|
39
|
+
| `@hydranium/core` | `^1.0.0-next` |
|
|
40
|
+
| `@hydranium/data-server` | `^1.0.0-next` |
|
|
41
|
+
| `@hydranium/langium` | `^1.0.0-next` |
|
|
42
|
+
| `@hydranium/protocol` | `^1.0.0-next` |
|
|
43
|
+
| `@memlab/core` | `^2.0.3` |
|
|
44
|
+
| `@memlab/heap-analysis` | `^2.0.3` |
|
|
45
|
+
| `vscode-jsonrpc` | `^9.0.0` |
|
|
46
|
+
|
|
47
|
+
The two memlab packages are optional peers that only `analyze-heap` loads:
|
|
48
|
+
install them with `npm install @memlab/core @memlab/heap-analysis` before its
|
|
49
|
+
first run.
|
|
50
|
+
|
|
51
|
+
## Commands
|
|
52
|
+
|
|
53
|
+
`hydranium-cli --help` lists the commands, and `hydranium-cli <command> --help`
|
|
54
|
+
lists each command's flags.
|
|
55
|
+
|
|
56
|
+
- **Scaffolding.** `init` writes a project you can build right away.
|
|
57
|
+
- **Grammar and workspace.** Boot your built head to reflect its grammar, lint
|
|
58
|
+
it, write a model reference, validate a workspace, or count its AST nodes.
|
|
59
|
+
- **Codegen.** `generate-transfer-model` turns the AST into a transfer model,
|
|
60
|
+
once or on watch.
|
|
61
|
+
- **Memory.** Measure a workspace's model-store memory, and analyze a heap
|
|
62
|
+
snapshot.
|
|
63
|
+
- **Data server.** Spawn your data head and list projects, or query, create,
|
|
64
|
+
save, delete or watch a document.
|
|
65
|
+
|
|
66
|
+
The commands that boot your head take `--services <module>`. That is an ESM
|
|
67
|
+
module exporting a zero-arg `createServices()` that returns `{ shared }`,
|
|
68
|
+
normally your build's `./lib/services.js`. To run the head from its TypeScript
|
|
69
|
+
source instead, register a loader with `--import`:
|
|
70
|
+
`npx hydranium-cli reflect --import tsx --services ./src/services.ts`.
|
|
71
|
+
|
|
72
|
+
The data-server commands take `--server "<cmd> [args...]"`. Point it at the
|
|
73
|
+
data head's stdio entry, `lib/data-server-main.js` in a scaffolded project, not
|
|
74
|
+
at the editor entry `lib/main.js`, whose stdio carries LSP. Pass the workspace
|
|
75
|
+
as the entry's argument rather than through `--cwd`:
|
|
123
76
|
|
|
124
77
|
```bash
|
|
125
78
|
hydranium-cli projects --server "node ./lib/data-server-main.js ./models"
|
|
126
79
|
```
|
|
127
80
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
spawns a data server of its own: a workspace has a **single writer**, so pointing it at one an
|
|
133
|
-
editor already has open is two writers and the later write wins. Neither process will see a
|
|
134
|
-
half-written file, but nothing serialises them either, so a lost write is the documented
|
|
135
|
-
outcome rather than a defect — the guarantee, its one exception and what it does not cover are
|
|
136
|
-
in [Status: one process writes a workspace](../../docs/adopting/status.md#one-process-writes-a-workspace).
|
|
137
|
-
- `watch --uri <uri>` — subscribe to document updates and print events as NDJSON until Ctrl-C.
|
|
138
|
-
`--client-id <id>`.
|
|
139
|
-
|
|
140
|
-
## `init` in detail
|
|
141
|
-
|
|
142
|
-
`init` writes a project you can build immediately, and it writes **only inside the target
|
|
143
|
-
directory** — it refuses a non-empty directory without `--force`, and it never edits a surrounding
|
|
144
|
-
manifest (a root `workspaces` entry is printed, not added). It also does **not** run `npm install`
|
|
145
|
-
or `langium generate`; both are printed as next steps.
|
|
146
|
-
|
|
147
|
-
Project options are position-free:
|
|
148
|
-
|
|
149
|
-
- `<target-dir>` and `--name <Name>` are required. `--name` is the PascalCase **project** name and
|
|
150
|
-
drives the shared generated symbols (`<Name>AstReflection`, `<Name>GeneratedSharedModule`).
|
|
151
|
-
- `--heads <list>` picks the protocol heads from `lsp`, `data`, `glsp`; default `lsp,data`. `lsp` is
|
|
152
|
-
mandatory — it owns the workspace, the build pipeline and the shared tier the others read through.
|
|
153
|
-
- `--monorepo` scaffolds a member of the surrounding npm workspace, `--scope <@scope>` sets the npm
|
|
154
|
-
scope, `--public` drops the emitted `"private": true`, `--force` allows a non-empty directory.
|
|
155
|
-
|
|
156
|
-
The emitted manifest carries `files` (`lib`, `src`, `syntaxes`), a derived `description` and
|
|
157
|
-
`keywords`, and an empty `author` for you to fill. It is `"private": true` unless you pass
|
|
158
|
-
`--public`, because it also declares `"license": "UNLICENSED"` — a scaffold cannot pick a licence for
|
|
159
|
-
your project, and a package that grants no rights has no business being publishable to a public
|
|
160
|
-
registry. Choose a licence, then pass `--public`. The wizard asks this on every run rather than
|
|
161
|
-
letting a default settle it. `files` is not cosmetic: without it npm falls back
|
|
162
|
-
to the `.gitignore` the scaffold also writes, which ignores `lib/` — so a publish would ship `main`
|
|
163
|
-
and omit the `bin` targets beside it, and succeed. There is deliberately no `repository`: a scaffold
|
|
164
|
-
cannot know yours, and tooling follows that field rather than merely displaying it.
|
|
165
|
-
|
|
166
|
-
There is one `bin` key per executable entry — `<project-id>` for `src/main.ts`, plus
|
|
167
|
-
`<project-id>-data-server` for `src/data-server-main.ts` when `data` is in `--heads`. Both sources
|
|
168
|
-
begin with a `#!` line, because npm sets the exec bit on a linked target without adding one: a
|
|
169
|
-
first line that is anything else is handed to the shell.
|
|
170
|
-
|
|
171
|
-
Grammar options are **repeatable and order-scoped**: each applies to the `--grammar` it follows.
|
|
172
|
-
|
|
173
|
-
- `--grammar <Name>` — the PascalCase grammar name; pass it once per grammar. Defaults to `--name`.
|
|
174
|
-
- `--extensions <list>` — comma-separated file extensions for that grammar, leading dot optional;
|
|
175
|
-
accumulates. Defaults to the kebab-cased grammar name.
|
|
176
|
-
- `--language-id <id>` — override that grammar's derived routing key.
|
|
177
|
-
- `--diagram` — scaffold a GLSP diagram for that grammar; requires `glsp` in `--heads`.
|
|
178
|
-
|
|
179
|
-
Leave `--name` off on an interactive terminal and `init` prompts instead, then echoes the command it
|
|
180
|
-
composed before running it — so the wizard is a way to reach an `init` command line, not an
|
|
181
|
-
alternative to one. Without a TTY a missing `--name` stays an error, so CI never hangs.
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
# Scaffold, install, build
|
|
185
|
-
npx @hydranium/cli init ./my-lang --name MyLang
|
|
186
|
-
cd my-lang
|
|
187
|
-
npm install
|
|
188
|
-
npm run build # langium generate + tsc, into lib/
|
|
189
|
-
npm test # the scaffolded DI-composition test
|
|
190
|
-
|
|
191
|
-
# The editor entry: LSP on stdio, every other head on a published socket
|
|
192
|
-
node lib/main.js --stdio
|
|
81
|
+
`create`, `save` and `delete` spawn a data server of their own, and a
|
|
82
|
+
workspace has one writer. Writing in a workspace an editor has open makes two
|
|
83
|
+
writers, and one write is lost: an editor that holds a deleted file can save it
|
|
84
|
+
back.
|
|
193
85
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
# Drive the rest of the CLI against the built factory
|
|
198
|
-
npx hydranium-cli reflect --services ./lib/services.js
|
|
199
|
-
npx hydranium-cli lint-grammar --services ./lib/services.js
|
|
200
|
-
npx hydranium-cli validate --services ./lib/services.js ./models
|
|
201
|
-
npx hydranium-cli model-docs --services ./lib/services.js --out-file model-reference.md
|
|
202
|
-
|
|
203
|
-
# Several grammars, three heads, one of them with a diagram
|
|
204
|
-
npx @hydranium/cli init ./order-flow --name OrderFlow --heads lsp,data,glsp \
|
|
205
|
-
--grammar Domain --grammar Process --diagram \
|
|
206
|
-
--grammar Layout --extensions diagram
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
The scaffold wires only the framework defaults. The seams a real language customizes are walked
|
|
210
|
-
beside those defaults in
|
|
211
|
-
[`docs/concepts/framework-vs-adopter.md`](../../docs/concepts/framework-vs-adopter.md).
|
|
86
|
+
Commands that spawn a child give it a heap ceiling; set
|
|
87
|
+
`HYDRANIUM_CLI_MAX_OLD_SPACE_MB` to state your own in MiB.
|
|
212
88
|
|
|
213
89
|
## Entry points
|
|
214
90
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
specifier, and `bin` offers a shim on `PATH` rather than a path.
|
|
221
|
-
|
|
222
|
-
| Entry | Kind | Contents |
|
|
223
|
-
| ---------------- | ------ | -------------------------------- |
|
|
224
|
-
| `hydranium-cli` | `bin` | The binary — all 13 subcommands. |
|
|
225
|
-
| `@hydranium/cli` | `main` | Programmatic API (see below). |
|
|
91
|
+
| Subpath | Use it for | Runs in |
|
|
92
|
+
| ---------------- | ---------------------------------------------------------------------------- | ------- |
|
|
93
|
+
| `hydranium-cli` | The binary (`bin`). | Node |
|
|
94
|
+
| `.` | Spawn a data server and get a typed proxy; run the codegen as a function. | Node |
|
|
95
|
+
| `./lib/cli.js` | Resolve the binary's file by specifier, to spawn it from a script or a test. | Node |
|
|
226
96
|
|
|
227
|
-
The
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
and the `runProjects` / `runQuery` / `runSave` / `runWatch` command bodies.
|
|
97
|
+
The subpaths need a TypeScript `moduleResolution` that reads `exports`
|
|
98
|
+
(`NodeNext` or `Bundler`); see *Requirements* in
|
|
99
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
231
100
|
|
|
232
101
|
## Status
|
|
233
102
|
|
|
234
|
-
Alpha
|
|
235
|
-
|
|
103
|
+
Alpha: every release is a prerelease that may break the API, so pin an exact
|
|
104
|
+
version. Guides and known limitations:
|
|
105
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
236
106
|
|
|
237
107
|
## License
|
|
238
108
|
|
|
239
109
|
`MIT` — see this package's [`LICENSE`](./LICENSE), and the repository
|
|
240
|
-
[`NOTICE.md`](
|
|
110
|
+
[`NOTICE.md`](https://github.com/eclipse-emfcloud/hydranium/blob/main/NOTICE.md)
|
|
111
|
+
for third-party notices.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
|
|
11
|
+
// Committed rather than built, so the first install of a fresh clone links it:
|
|
12
|
+
// npm skips a `bin` whose target is missing, and `lib/` exists only after a build.
|
|
13
|
+
import '../lib/cli.js';
|
|
@@ -24,10 +24,10 @@ const mb = bytes => bytes / (1024 * 1024);
|
|
|
24
24
|
* @param {(msg: string) => void} [log] timestamped progress sink (defaults to stderr)
|
|
25
25
|
*/
|
|
26
26
|
export async function loadHeap(file, log = progress) {
|
|
27
|
-
const t0 =
|
|
27
|
+
const t0 = performance.now();
|
|
28
28
|
log(`Loading ${file} ...`);
|
|
29
29
|
const heap = await getFullHeapFromFile(file);
|
|
30
|
-
const loadSeconds = (
|
|
30
|
+
const loadSeconds = (performance.now() - t0) / 1000;
|
|
31
31
|
|
|
32
32
|
let totalShallow = 0;
|
|
33
33
|
heap.nodes.forEach(node => {
|
package/lib/cli-version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-version.js","sourceRoot":"","sources":["../src/cli-version.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,+FAA+F;AAC/F,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"cli-version.js","sourceRoot":"","sources":["../src/cli-version.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,+FAA+F;AAC/F,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAA0B,CAAC;IAC1F,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,IAAI,QAAQ,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC3B,CAAC"}
|
package/lib/cli.js
CHANGED
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
* SPDX-License-Identifier: MIT
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
import { Command } from 'commander';
|
|
11
|
+
import { describeError } from '@hydranium/protocol';
|
|
11
12
|
import { readCliVersion } from './cli-version.js';
|
|
12
13
|
import { runAnalyzeHeapCommand } from './commands/analyze-heap-args.js';
|
|
13
14
|
import { runAstGroundTruthCommand } from './commands/ast-ground-truth-args.js';
|
|
15
|
+
import { runCreateCommand } from './commands/create-args.js';
|
|
16
|
+
import { runDeleteCommand } from './commands/delete-args.js';
|
|
14
17
|
import { runGenerateTransferModelCommand } from './commands/generate-transfer-model-args.js';
|
|
15
18
|
import { runInitCommand } from './commands/init-args.js';
|
|
16
19
|
import { InitWizardCancelled } from './commands/init-prompt.js';
|
|
@@ -42,6 +45,8 @@ const COMMANDS = {
|
|
|
42
45
|
summary: "Tally a workspace's live-model $types (analyze-heap --validate input).",
|
|
43
46
|
run: runAstGroundTruthCommand
|
|
44
47
|
},
|
|
48
|
+
create: { summary: 'Create a new document and its file via a data-server subprocess.', run: runCreateCommand },
|
|
49
|
+
delete: { summary: 'Delete a document, its file included, via a data-server subprocess.', run: runDeleteCommand },
|
|
45
50
|
'generate-transfer-model': {
|
|
46
51
|
summary: 'Generate a transfer-model TypeScript file from a Langium AST.',
|
|
47
52
|
run: runGenerateTransferModelCommand
|
|
@@ -53,7 +58,7 @@ const COMMANDS = {
|
|
|
53
58
|
projects: { summary: 'List projects exposed by a data-server subprocess.', run: runProjectsCommand },
|
|
54
59
|
query: { summary: 'Print the data-server document envelope for a URI.', run: runQueryCommand },
|
|
55
60
|
reflect: { summary: "Dump a head's grammar/AST reflection (types, terminals, refs).", run: runReflectCommand },
|
|
56
|
-
save: { summary: 'Update + persist
|
|
61
|
+
save: { summary: 'Update + persist an existing document via a data-server subprocess.', run: runSaveCommand },
|
|
57
62
|
validate: { summary: 'Validate a workspace headlessly; non-zero exit on errors (CI gate).', run: runValidateCommand },
|
|
58
63
|
watch: { summary: 'Subscribe to data-server document updates; print events as NDJSON.', run: runWatchCommand }
|
|
59
64
|
};
|
|
@@ -129,7 +134,7 @@ main(process.argv.slice(2)).catch(err => {
|
|
|
129
134
|
if (err instanceof InitWizardCancelled) {
|
|
130
135
|
process.exit(130);
|
|
131
136
|
}
|
|
132
|
-
console.error(
|
|
137
|
+
console.error(describeError(err));
|
|
133
138
|
process.exit(1);
|
|
134
139
|
});
|
|
135
140
|
//# sourceMappingURL=cli.js.map
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,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E,CAAC;aAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,QAAQ,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,CAAC;YACL,OAAO,CAAC,wBAAwB,IAAI,sCAAsC,CAAC,CAAC;QAC/E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,CAAC,yEAAyE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAc,EAAE,IAAI,GAAoB,EAAE;IAC7E,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,yEAAyE;QACzE,2EAA2E;QAC3E,iDAAiD;QACjD,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAC7B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,aAAa,CAAC,IAAI,EAAE,wBAAwB,CAAC,EAAE,CAAC;QACjD,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
import { type HeapReading } from '../driver-heap.js';
|
|
9
10
|
/**
|
|
10
11
|
* Selects the JSON-vs-JSON comparison, which reads two analysis artifacts and
|
|
11
12
|
* needs neither a snapshot nor memlab. Declared here rather than in the args
|
|
@@ -18,6 +19,8 @@ export interface AnalyzeHeapDeps {
|
|
|
18
19
|
readonly __spawnForTest?: (execArgs: string[]) => Promise<number>;
|
|
19
20
|
/** Override the memlab-availability check. */
|
|
20
21
|
readonly __memlabInstalledForTest?: () => boolean;
|
|
22
|
+
/** Decide the heap ceiling from a stated cgroup reading rather than the machine's. */
|
|
23
|
+
readonly __heapReadingForTest?: HeapReading;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* Run the heap-snapshot analyzer. Memlab is an OPTIONAL PEER dependency and a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-heap.d.ts","sourceRoot":"","sources":["../../src/commands/analyze-heap.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"analyze-heap.d.ts","sourceRoot":"","sources":["../../src/commands/analyze-heap.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqBrE;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,mGAAmG;AACnG,MAAM,WAAW,eAAe;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE,8CAA8C;IAC9C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC;IAClD,sFAAsF;IACtF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,WAAW,CAAC;CAC9C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB9F"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { driverHeapArgs } from '../driver-heap.js';
|
|
10
11
|
import { spawnNodeChild } from './headless-harness.js';
|
|
11
12
|
/**
|
|
12
13
|
* Absolute path to the bundled memlab-based analyzer (a standalone ESM script
|
|
@@ -55,7 +56,7 @@ export async function runAnalyzeHeap(args, deps = {}) {
|
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
const spawnChild = deps.__spawnForTest ?? spawnNodeChild;
|
|
58
|
-
const code = await spawnChild([
|
|
59
|
+
const code = await spawnChild([...driverHeapArgs(deps.__heapReadingForTest), ANALYZER, ...args]);
|
|
59
60
|
if (code) {
|
|
60
61
|
process.exitCode = code;
|
|
61
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-heap.js","sourceRoot":"","sources":["../../src/commands/analyze-heap.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,sCAAsC,EAAE,
|
|
1
|
+
{"version":3,"file":"analyze-heap.js","sourceRoot":"","sources":["../../src/commands/analyze-heap.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAoB,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,sCAAsC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEjG,+FAA+F;AAC/F,SAAS,eAAe;IACrB,MAAM,OAAO,GAAI,OAAO,IAAoD,CAAC,OAAO,CAAC;IACrF,IAAI,CAAC;QACF,OAAO,EAAE,CAAC,uBAAuB,CAAC,CAAC;QACnC,OAAO,OAAO,KAAK,SAAS,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACN,OAAO,KAAK,CAAC;IAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAYlC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAc,EAAE,IAAI,GAAoB,EAAE;IAC5E,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,IAAI,eAAe,CAAC;IAC3E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;QACrD,OAAO,CAAC,KAAK,CACV,qFAAqF;YAClF,sFAAsF;YACtF,kDAAkD,CACvD,CAAC;QACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACV,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACjG,IAAI,IAAI,EAAE,CAAC;QACR,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -10,8 +10,9 @@ import { type AstGroundTruthCommandOptions } from './ast-ground-truth.js';
|
|
|
10
10
|
import { type UsageError } from './harness-args.js';
|
|
11
11
|
/**
|
|
12
12
|
* Every flag `ast-ground-truth` accepts, derived from the sets the parser is
|
|
13
|
-
* handed so the list cannot claim a flag the parser would reject.
|
|
14
|
-
*
|
|
13
|
+
* handed so the list cannot claim a flag the parser would reject.
|
|
14
|
+
* {@link HARNESS_VALUE_FLAGS} are consumed by the shared harness parser itself,
|
|
15
|
+
* so they are in neither set.
|
|
15
16
|
*/
|
|
16
17
|
export declare const AST_GROUND_TRUTH_FLAGS: readonly string[];
|
|
17
18
|
/** The subset that takes a value, so `--help` in a value position reads as data. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-ground-truth-args.d.ts","sourceRoot":"","sources":["../../src/commands/ast-ground-truth-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqB,KAAK,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,
|
|
1
|
+
{"version":3,"file":"ast-ground-truth-args.d.ts","sourceRoot":"","sources":["../../src/commands/ast-ground-truth-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqB,KAAK,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAUJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAK3B;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAA6C,CAAC;AAElG,oFAAoF;AACpF,eAAO,MAAM,4BAA4B,EAAE,SAAS,MAAM,EAA2B,CAAC;AAEtF,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAclD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,4BAA4B,CAGzH;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMtE"}
|
|
@@ -7,20 +7,21 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { runAstGroundTruth } from './ast-ground-truth.js';
|
|
10
|
-
import { exitWithUsage, helpRequested,
|
|
10
|
+
import { exitWithUsage, HARNESS_VALUE_FLAGS, helpRequested, importHelpLines, LOG_VALUE_FLAGS, logHelpLines, logOptions, parseHarnessArgs, printHelp } from './harness-args.js';
|
|
11
11
|
import { OUT_FILE_FLAG } from './headless-harness.js';
|
|
12
|
-
const VALUE_FLAGS = [OUT_FILE_FLAG,
|
|
12
|
+
const VALUE_FLAGS = [OUT_FILE_FLAG, ...LOG_VALUE_FLAGS];
|
|
13
13
|
/**
|
|
14
14
|
* Every flag `ast-ground-truth` accepts, derived from the sets the parser is
|
|
15
|
-
* handed so the list cannot claim a flag the parser would reject.
|
|
16
|
-
*
|
|
15
|
+
* handed so the list cannot claim a flag the parser would reject.
|
|
16
|
+
* {@link HARNESS_VALUE_FLAGS} are consumed by the shared harness parser itself,
|
|
17
|
+
* so they are in neither set.
|
|
17
18
|
*/
|
|
18
|
-
export const AST_GROUND_TRUTH_FLAGS = [
|
|
19
|
+
export const AST_GROUND_TRUTH_FLAGS = [...HARNESS_VALUE_FLAGS, ...VALUE_FLAGS];
|
|
19
20
|
/** The subset that takes a value, so `--help` in a value position reads as data. */
|
|
20
21
|
export const AST_GROUND_TRUTH_VALUE_FLAGS = AST_GROUND_TRUTH_FLAGS;
|
|
21
22
|
/** The `--help` text, as data, held to {@link AST_GROUND_TRUTH_FLAGS} by a test. */
|
|
22
23
|
export const AST_GROUND_TRUTH_HELP = [
|
|
23
|
-
'Usage: hydranium-cli ast-ground-truth --services <module> <workspace> [--out-file <file>] [--log-level <lvl>]',
|
|
24
|
+
'Usage: hydranium-cli ast-ground-truth --services <module> [--import <specifier>]... <workspace> [--out-file <file>] [--log-level <lvl>] [--log-file <file>] [--log-file-level <lvl>]',
|
|
24
25
|
'',
|
|
25
26
|
"Tally a workspace's live-model AST nodes by `$type` — the ground truth that",
|
|
26
27
|
'`analyze-heap --validate <gt.json>` checks a heap snapshot against. `<module>`',
|
|
@@ -29,13 +30,14 @@ export const AST_GROUND_TRUTH_HELP = [
|
|
|
29
30
|
'',
|
|
30
31
|
'Options:',
|
|
31
32
|
' --services <module> ESM module exporting `createServices(): { shared }` (required).',
|
|
33
|
+
...importHelpLines(22),
|
|
32
34
|
' <workspace> Workspace root (path or file URI) to build (required).',
|
|
33
35
|
' --out-file <file> Write the JSON to this file instead of stdout.',
|
|
34
|
-
|
|
36
|
+
...logHelpLines(22)
|
|
35
37
|
];
|
|
36
38
|
export function parseAstGroundTruthArgs(args, onError = exitWithUsage) {
|
|
37
|
-
const { servicesModule, workspace, options } = parseHarnessArgs(args, 'ast-ground-truth', VALUE_FLAGS, [], { onError });
|
|
38
|
-
return { servicesModule, workspace, outFile: options[OUT_FILE_FLAG],
|
|
39
|
+
const { servicesModule, imports, workspace, options } = parseHarnessArgs(args, 'ast-ground-truth', VALUE_FLAGS, [], { onError });
|
|
40
|
+
return { servicesModule, imports, workspace, outFile: options[OUT_FILE_FLAG], ...logOptions(options) };
|
|
39
41
|
}
|
|
40
42
|
export function runAstGroundTruthCommand(args) {
|
|
41
43
|
if (helpRequested(args, AST_GROUND_TRUTH_VALUE_FLAGS)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-ground-truth-args.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,iBAAiB,EAAqC,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EACJ,aAAa,EACb,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"ast-ground-truth-args.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,iBAAiB,EAAqC,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EACJ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,SAAS,EAEX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,GAAG,eAAe,CAAU,CAAC;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fs';
|
|
17
|
+
import { describeError } from '@hydranium/protocol';
|
|
17
18
|
import { loadHeadlessContext, OUT_FILE_FLAG } from './headless-harness.js';
|
|
18
19
|
function parseArgs(argv) {
|
|
19
20
|
const parsed = {};
|
|
@@ -66,7 +67,7 @@ async function main(argv) {
|
|
|
66
67
|
main(process.argv.slice(2))
|
|
67
68
|
.then(() => process.exit(0))
|
|
68
69
|
.catch((error) => {
|
|
69
|
-
console.error(
|
|
70
|
+
console.error(describeError(error));
|
|
70
71
|
process.exit(1);
|
|
71
72
|
});
|
|
72
73
|
//# sourceMappingURL=ast-ground-truth-driver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-ground-truth-driver.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQ3E,SAAS,SAAS,CAAC,IAAc;IAC9B,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,GAAW,EAAE;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;YACD,KAAK,IAAI,CAAC,CAAC;YACX,OAAO,KAAK,CAAC;QAChB,CAAC,CAAC;QACF,QA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,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC;QAC5C,8EAA8E;QAC9E,OAAO,CAAC,KAAK,CAAC,iBAAiB,MAAM,CAAC,SAAS,UAAU,MAAM,CAAC,aAAa,iBAAiB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACjH,CAAC;SAAM,CAAC;QACL,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;AACJ,CAAC;AAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACvB,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3B,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACvB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|
|
@@ -31,6 +31,6 @@ export function buildGroundTruthDriverArgs(options) {
|
|
|
31
31
|
* `--out-file`). No `--expose-gc` needed — this walks the AST, it does not weigh it.
|
|
32
32
|
*/
|
|
33
33
|
export function runAstGroundTruth(options) {
|
|
34
|
-
return runDriverChild([
|
|
34
|
+
return runDriverChild([DRIVER, ...buildGroundTruthDriverArgs(options)], options);
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=ast-ground-truth.js.map
|