@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
|
@@ -137,8 +137,8 @@ export function parseInitArgs(args: string[], onError: UsageError = exitWithUsag
|
|
|
137
137
|
scoped().diagram = true;
|
|
138
138
|
break;
|
|
139
139
|
case '--heads': {
|
|
140
|
-
// Validated in `resolveInitComposition
|
|
141
|
-
//
|
|
140
|
+
// Validated in `resolveInitComposition`; the cast only gets the
|
|
141
|
+
// strings that far.
|
|
142
142
|
heads = next().split(',') as InitHead[];
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
@@ -185,41 +185,46 @@ export const INIT_HELP: readonly string[] = [
|
|
|
185
185
|
' ( --grammar <Name> [--extensions <list>]',
|
|
186
186
|
' [--language-id <id>] [--diagram] )...',
|
|
187
187
|
'',
|
|
188
|
-
'Scaffold a new Hydranium language project end-to-end:
|
|
189
|
-
'
|
|
190
|
-
'
|
|
191
|
-
'
|
|
192
|
-
'
|
|
188
|
+
'Scaffold a new Hydranium language project end-to-end: two packages and a',
|
|
189
|
+
'starter workspace, each in its own directory. server/ holds a starter grammar',
|
|
190
|
+
'per --grammar, the `create<Name>Services` DI wiring, a launch of every head',
|
|
191
|
+
'and build scripts; protocol/ holds what the server and its clients both',
|
|
192
|
+
'import; workspace/ holds two starter model files per grammar. A standalone',
|
|
193
|
+
'project also gets a root manifest naming the two packages as npm workspaces.',
|
|
194
|
+
'Does NOT run `npm install` or `langium generate` — those are printed as next',
|
|
195
|
+
'steps. Refuses a non-empty directory without --force.',
|
|
193
196
|
'',
|
|
194
197
|
'Run it with no --name on a terminal to be prompted instead. The wizard echoes',
|
|
195
198
|
'the command it composed before running it, so every answer is reproducible as',
|
|
196
199
|
'flags. Without a terminal a missing --name stays an error, so CI never hangs.',
|
|
197
200
|
'',
|
|
198
201
|
'Project options (position-free):',
|
|
199
|
-
' <target-dir>
|
|
202
|
+
' <target-dir> The project directory to scaffold into (required).',
|
|
200
203
|
' --name <Name> PascalCase PROJECT name; drives the services and the',
|
|
201
204
|
' Langium projectName, i.e. the shared generated symbols',
|
|
202
205
|
' (<Name>AstReflection, <Name>GeneratedSharedModule) (required).',
|
|
203
|
-
' --heads <list> Comma-separated protocol heads: lsp, data, glsp
|
|
204
|
-
'
|
|
205
|
-
'
|
|
206
|
-
' The emitted dependencies, main.ts and
|
|
207
|
-
' all follow this set. Default: lsp,data.',
|
|
206
|
+
' --heads <list> Comma-separated protocol heads: lsp, data, glsp, any',
|
|
207
|
+
' non-empty set. Without lsp, main.ts serves the socket',
|
|
208
|
+
' heads from a workspace path it is given and prints',
|
|
209
|
+
' their ports. The emitted dependencies, main.ts and',
|
|
210
|
+
' module bindings all follow this set. Default: lsp,data.',
|
|
208
211
|
' --force Scaffold into a non-empty directory anyway.',
|
|
209
|
-
' --monorepo Scaffold
|
|
210
|
-
'
|
|
211
|
-
'
|
|
212
|
-
' scripts address the
|
|
213
|
-
' ancestor declares `workspaces`.
|
|
214
|
-
' target — the root `workspaces`
|
|
215
|
-
'
|
|
212
|
+
' --monorepo Scaffold the packages as members of the surrounding npm',
|
|
213
|
+
' workspace, with no root of their own: each tsconfig',
|
|
214
|
+
' extends the root config that actually carries',
|
|
215
|
+
' compilerOptions, and the scripts address the server by',
|
|
216
|
+
' --prefix. Errors when no ancestor declares `workspaces`.',
|
|
217
|
+
' Never writes outside the target — the root `workspaces`',
|
|
218
|
+
' entries and dependency pins are printed, not added.',
|
|
219
|
+
' --scope <@scope> npm scope for the package names, e.g. @acme. Not inferred:',
|
|
216
220
|
' a root manifest is usually named for the repo, not the',
|
|
217
221
|
' scope. The wizard offers the siblings’ scope as a default.',
|
|
218
|
-
' --public Omit "private": true
|
|
219
|
-
'
|
|
220
|
-
'
|
|
221
|
-
'
|
|
222
|
-
'
|
|
222
|
+
' --public Omit "private": true from the server and protocol',
|
|
223
|
+
' packages, so they can be published together. The',
|
|
224
|
+
' scaffold emits it by default, because the manifests',
|
|
225
|
+
' also declare license "UNLICENSED": a package granting',
|
|
226
|
+
' no rights on a public registry contradicts itself. Pass',
|
|
227
|
+
' this once the project has picked a licence.',
|
|
223
228
|
'',
|
|
224
229
|
'Grammar options — each applies to the PRECEDING --grammar:',
|
|
225
230
|
' --grammar <Name> PascalCase GRAMMAR name; drives the `grammar X` declaration',
|
|
@@ -233,8 +238,8 @@ export const INIT_HELP: readonly string[] = [
|
|
|
233
238
|
' (default: <project-id>-<grammar-id>).',
|
|
234
239
|
' --diagram Scaffold a GLSP diagram for that grammar. Requires',
|
|
235
240
|
' `glsp` in --heads. Derived when there is exactly one',
|
|
236
|
-
' grammar; required when there are several, because
|
|
237
|
-
' diagram
|
|
241
|
+
' grammar; required when there are several, because the',
|
|
242
|
+
' scaffolded diagram is typed over one grammar’s model.',
|
|
238
243
|
'',
|
|
239
244
|
'Example — three grammars, one with a differing extension, three heads:',
|
|
240
245
|
' hydranium-cli init ./order-flow --name OrderFlow --heads lsp,data,glsp \\',
|
|
@@ -66,7 +66,7 @@ export interface PromptPort {
|
|
|
66
66
|
readonly choices: ReadonlyArray<PromptChoice<Value>>;
|
|
67
67
|
readonly initialValue?: Value;
|
|
68
68
|
}) => Promise<Value>;
|
|
69
|
-
/** Ask for
|
|
69
|
+
/** Ask for at least one of several choices. */
|
|
70
70
|
readonly multiselect: <Value extends string>(options: {
|
|
71
71
|
readonly message: string;
|
|
72
72
|
readonly choices: ReadonlyArray<PromptChoice<Value>>;
|
|
@@ -78,8 +78,9 @@ export interface PromptPort {
|
|
|
78
78
|
readonly outro: (message: string) => void;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/** The
|
|
82
|
-
export const
|
|
81
|
+
/** The heads, as a checkbox list. */
|
|
82
|
+
export const HEAD_CHOICES: ReadonlyArray<PromptChoice<InitHead>> = [
|
|
83
|
+
{ value: 'lsp', label: 'lsp', hint: 'text editing in an LSP client' },
|
|
83
84
|
{ value: 'data', label: 'data', hint: 'typed JSON-RPC for forms, trees and code-gen' },
|
|
84
85
|
{ value: 'glsp', label: 'glsp', hint: 'graphical editing; adds a scaffolded diagram' }
|
|
85
86
|
];
|
|
@@ -138,9 +139,7 @@ export async function createClackPrompt(): Promise<PromptPort> {
|
|
|
138
139
|
message: options.message,
|
|
139
140
|
options: toOptions(options.choices),
|
|
140
141
|
initialValues: options.initialValues ? [...options.initialValues] : [],
|
|
141
|
-
|
|
142
|
-
// server, so an empty selection must not be rejected.
|
|
143
|
-
required: false
|
|
142
|
+
required: true
|
|
144
143
|
})
|
|
145
144
|
),
|
|
146
145
|
confirm: async options => unwrap(await clack.confirm({ message: options.message, initialValue: options.initialValue })),
|