@eudiplo/cli 7.2.0 → 7.3.0-main.b6ff9ed
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 +88 -24
- package/dist/commands/commands/index.d.ts +4 -0
- package/dist/commands/commands/index.d.ts.map +1 -0
- package/dist/commands/commands/index.js +13 -0
- package/dist/commands/commands/index.js.map +1 -0
- package/dist/commands/commands/render.d.ts +4 -0
- package/dist/commands/commands/render.d.ts.map +1 -0
- package/dist/commands/commands/render.js +52 -0
- package/dist/commands/commands/render.js.map +1 -0
- package/dist/commands/completion/action.d.ts +6 -0
- package/dist/commands/completion/action.d.ts.map +1 -0
- package/dist/commands/completion/action.js +133 -0
- package/dist/commands/completion/action.js.map +1 -0
- package/dist/commands/completion/index.d.ts +6 -0
- package/dist/commands/completion/index.d.ts.map +1 -0
- package/dist/commands/completion/index.js +23 -0
- package/dist/commands/completion/index.js.map +1 -0
- package/dist/commands/config/action.d.ts +4 -0
- package/dist/commands/config/action.d.ts.map +1 -0
- package/dist/commands/config/action.js +33 -0
- package/dist/commands/config/action.js.map +1 -0
- package/dist/commands/config/editor/action.d.ts +3 -0
- package/dist/commands/config/editor/action.d.ts.map +1 -0
- package/dist/commands/config/editor/action.js +112 -0
- package/dist/commands/config/editor/action.js.map +1 -0
- package/dist/commands/config/editor/index.d.ts +5 -0
- package/dist/commands/config/editor/index.d.ts.map +1 -0
- package/dist/commands/config/editor/index.js +20 -0
- package/dist/commands/config/editor/index.js.map +1 -0
- package/dist/commands/config/index.d.ts +1 -1
- package/dist/commands/config/index.d.ts.map +1 -1
- package/dist/commands/config/index.js +22 -0
- package/dist/commands/config/index.js.map +1 -1
- package/dist/commands/config/portability/action.d.ts +5 -0
- package/dist/commands/config/portability/action.d.ts.map +1 -0
- package/dist/commands/config/portability/action.js +164 -0
- package/dist/commands/config/portability/action.js.map +1 -0
- package/dist/commands/config/portability/index.d.ts +5 -0
- package/dist/commands/config/portability/index.d.ts.map +1 -0
- package/dist/commands/config/portability/index.js +44 -0
- package/dist/commands/config/portability/index.js.map +1 -0
- package/dist/commands/config/portability/migrations.d.ts +24 -0
- package/dist/commands/config/portability/migrations.d.ts.map +1 -0
- package/dist/commands/config/portability/migrations.js +95 -0
- package/dist/commands/config/portability/migrations.js.map +1 -0
- package/dist/commands/config/portability/migrations.spec.d.ts +2 -0
- package/dist/commands/config/portability/migrations.spec.d.ts.map +1 -0
- package/dist/commands/config/portability/migrations.spec.js +32 -0
- package/dist/commands/config/portability/migrations.spec.js.map +1 -0
- package/dist/commands/config/tenant/action.d.ts.map +1 -1
- package/dist/commands/config/tenant/action.js +16 -6
- package/dist/commands/config/tenant/action.js.map +1 -1
- package/dist/commands/config/tenant/index.d.ts.map +1 -1
- package/dist/commands/config/tenant/index.js.map +1 -1
- package/dist/commands/config/validate/action.d.ts.map +1 -1
- package/dist/commands/config/validate/action.js +3 -1
- package/dist/commands/config/validate/action.js.map +1 -1
- package/dist/commands/config/validate/registry.d.ts +1 -0
- package/dist/commands/config/validate/registry.d.ts.map +1 -1
- package/dist/commands/config/validate/registry.js +1 -1
- package/dist/commands/config/validate/registry.js.map +1 -1
- package/dist/commands/config/validate/registry.json +12 -23
- package/dist/commands/config/validate/report.d.ts.map +1 -1
- package/dist/commands/config/validate/report.js +6 -1
- package/dist/commands/config/validate/report.js.map +1 -1
- package/dist/commands/config/validate/schemas.d.ts +1 -0
- package/dist/commands/config/validate/schemas.d.ts.map +1 -1
- package/dist/commands/config/validate/schemas.js +16 -5
- package/dist/commands/config/validate/schemas.js.map +1 -1
- package/dist/commands/config/validate/types.d.ts.map +1 -1
- package/dist/commands/config/validate/validator.d.ts.map +1 -1
- package/dist/commands/config/validate/validator.js +13 -5
- package/dist/commands/config/validate/validator.js.map +1 -1
- package/dist/commands/demo/action.d.ts.map +1 -1
- package/dist/commands/demo/action.js +3 -2
- package/dist/commands/demo/action.js.map +1 -1
- package/dist/commands/demo/index.d.ts.map +1 -1
- package/dist/commands/demo/index.js.map +1 -1
- package/dist/commands/deployment/action.d.ts.map +1 -1
- package/dist/commands/deployment/action.js +10 -3
- package/dist/commands/deployment/action.js.map +1 -1
- package/dist/commands/deployment/index.d.ts.map +1 -1
- package/dist/commands/deployment/index.js +1 -1
- package/dist/commands/deployment/index.js.map +1 -1
- package/dist/commands/doctor/action.d.ts.map +1 -1
- package/dist/commands/doctor/action.js +1 -1
- package/dist/commands/doctor/action.js.map +1 -1
- package/dist/commands/init/action.d.ts.map +1 -1
- package/dist/commands/init/action.js +20 -7
- package/dist/commands/init/action.js.map +1 -1
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js.map +1 -1
- package/dist/commands/instance/action.d.ts +4 -0
- package/dist/commands/instance/action.d.ts.map +1 -1
- package/dist/commands/instance/action.js +66 -1
- package/dist/commands/instance/action.js.map +1 -1
- package/dist/commands/instance/index.d.ts.map +1 -1
- package/dist/commands/instance/index.js +31 -1
- package/dist/commands/instance/index.js.map +1 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/shared.js +4 -1
- package/dist/commands/shared.js.map +1 -1
- package/dist/commands/status/action.d.ts.map +1 -1
- package/dist/commands/status/action.js.map +1 -1
- package/dist/commands/version/action.d.ts.map +1 -1
- package/dist/commands/version/action.js +3 -1
- package/dist/commands/version/action.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +8 -1
- package/dist/runtime.js.map +1 -1
- package/dist/sea-assets.d.ts +4 -2
- package/dist/sea-assets.d.ts.map +1 -1
- package/dist/sea-assets.js +6 -3
- package/dist/sea-assets.js.map +1 -1
- package/dist/services/cli-config.d.ts +2 -0
- package/dist/services/cli-config.d.ts.map +1 -1
- package/dist/services/cli-config.js +22 -1
- package/dist/services/cli-config.js.map +1 -1
- package/dist/services/compose-project.d.ts.map +1 -1
- package/dist/services/compose-project.js +14 -6
- package/dist/services/compose-project.js.map +1 -1
- package/dist/services/deployment-drivers.d.ts +7 -0
- package/dist/services/deployment-drivers.d.ts.map +1 -1
- package/dist/services/deployment-drivers.js +79 -16
- package/dist/services/deployment-drivers.js.map +1 -1
- package/dist/services/diagnostics.d.ts.map +1 -1
- package/dist/services/diagnostics.js +3 -1
- package/dist/services/diagnostics.js.map +1 -1
- package/dist/services/instance-selection.d.ts.map +1 -1
- package/dist/services/instance-selection.js.map +1 -1
- package/dist/services/project-directory.d.ts.map +1 -1
- package/dist/services/project-directory.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -8
- package/templates/demo-config/issuance/issuance.json +20 -12
- package/templates/demo-config/key-chains/access.json +13 -2
- package/templates/demo-config/key-chains/attestation.json +14 -3
- package/templates/demo-config/key-chains/status-list.json +15 -4
- package/templates/demo-config/key-chains/trust-list.json +13 -2
- package/templates/demo-config/presentation/age-over-18.json +46 -53
- package/templates/demo-config/presentation/pid.json +44 -0
- package/templates/demo-config.manifest.json +1 -0
- package/templates/schemas/AttributeProviderAuth.schema.json +60 -0
- package/templates/schemas/AttributeProviderConfigFile.schema.json +37 -0
- package/templates/schemas/CertImportDto.schema.json +35 -0
- package/templates/schemas/ClientConfigFile.schema.json +37 -0
- package/templates/schemas/ConfigDocumentMetadata.schema.json +25 -0
- package/templates/schemas/CreateClientDto.schema.json +1 -0
- package/templates/schemas/CreateStatusListDto.schema.json +46 -0
- package/templates/schemas/CreateTenantDto.schema.json +117 -0
- package/templates/schemas/CredentialConfigFile.schema.json +37 -0
- package/templates/schemas/DCQL.schema.json +401 -0
- package/templates/schemas/EmbeddedDisclosurePolicy.schema.json +106 -0
- package/templates/schemas/ImportTenantDto.schema.json +69 -0
- package/templates/schemas/IssuanceConfigFile.schema.json +32 -0
- package/templates/schemas/KeyChainConfigFile.schema.json +476 -0
- package/templates/schemas/KeyChainCreateDto.schema.json +66 -0
- package/templates/schemas/KeyChainUpdateDto.schema.json +40 -0
- package/templates/schemas/KmsConfigFile.schema.json +37 -0
- package/templates/schemas/PresentationConfigFile.schema.json +32 -0
- package/templates/schemas/RegistrarConfigFile.schema.json +37 -0
- package/templates/schemas/RotationPolicyCreateDto.schema.json +28 -0
- package/templates/schemas/RotationPolicyUpdateDto.schema.json +25 -0
- package/templates/schemas/SessionStorageConfig.schema.json +24 -0
- package/templates/schemas/StatusListConfig.schema.json +51 -0
- package/templates/schemas/StatusListConfigFile.schema.json +37 -0
- package/templates/schemas/TenantConfigFile.schema.json +230 -0
- package/templates/schemas/TransactionData.schema.json +24 -0
- package/templates/schemas/TrustListConfigFile.schema.json +37 -0
- package/templates/schemas/UpdateAttributeProviderDto.schema.json +93 -0
- package/templates/schemas/UpdateClientDto.schema.json +63 -0
- package/templates/schemas/UpdateStatusListConfigDto.schema.json +85 -0
- package/templates/schemas/UpdateStatusListDto.schema.json +33 -0
- package/templates/schemas/UpdateTenantDto.schema.json +96 -0
- package/templates/schemas/UpdateWebhookEndpointDto.schema.json +93 -0
- package/templates/schemas/VCT.schema.json +37 -0
- package/templates/schemas/WebhookConfig.schema.json +80 -0
- package/templates/schemas/WebhookEndpointConfigFile.schema.json +37 -0
- package/templates/schemas.manifest.json +35 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# EUDIPLO CLI
|
|
2
2
|
|
|
3
3
|
The EUDIPLO CLI provides deployment-neutral commands for inspecting an EUDIPLO
|
|
4
|
-
instance and deployment-driver commands for local
|
|
4
|
+
instance and deployment-driver commands for local Compose demos.
|
|
5
5
|
|
|
6
6
|
For installation, command reference, configuration validation, standalone
|
|
7
|
-
releases, and local development, see the [CLI documentation](
|
|
7
|
+
releases, and local development, see the [CLI documentation](../docs/docs/deployment/cli.md).
|
|
8
8
|
|
|
9
9
|
## Quick Start
|
|
10
10
|
|
|
@@ -17,6 +17,9 @@ installer instead: `curl -fsSL https://eudiplo.dev/install.sh | bash`
|
|
|
17
17
|
```bash
|
|
18
18
|
npx @eudiplo/cli demo ./eudiplo-demo
|
|
19
19
|
npx @eudiplo/cli instance add production --url https://eudiplo.example.com
|
|
20
|
+
npx @eudiplo/cli instance ls
|
|
21
|
+
npx @eudiplo/cli instance show production
|
|
22
|
+
npx @eudiplo/cli instance use production
|
|
20
23
|
npx @eudiplo/cli doctor --instance production
|
|
21
24
|
```
|
|
22
25
|
|
|
@@ -36,7 +39,9 @@ preserved unless you pass `--force`.
|
|
|
36
39
|
|
|
37
40
|
The standalone CLI and this npm package are two distributions of the same
|
|
38
41
|
`eudiplo` command. The standalone CLI removes the Node.js requirement, but
|
|
39
|
-
Docker and Docker Compose are still required for
|
|
42
|
+
Docker and Docker Compose, or Podman and Podman Compose, are still required for
|
|
43
|
+
the demo deployment. Docker is preferred by default; set
|
|
44
|
+
`EUDIPLO_CONTAINER_RUNTIME=podman` to force Podman.
|
|
40
45
|
|
|
41
46
|
## Package and Binary Names
|
|
42
47
|
|
|
@@ -52,6 +57,24 @@ pnpm add -D @eudiplo/cli
|
|
|
52
57
|
pnpm eudiplo status
|
|
53
58
|
```
|
|
54
59
|
|
|
60
|
+
## Uninstall
|
|
61
|
+
|
|
62
|
+
Use the removal path that matches how the CLI was installed:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Standalone Linux/macOS installer
|
|
66
|
+
rm "${EUDIPLO_INSTALL_DIR:-$HOME/.local/bin}/eudiplo"
|
|
67
|
+
|
|
68
|
+
# npm global install
|
|
69
|
+
npm uninstall -g @eudiplo/cli
|
|
70
|
+
|
|
71
|
+
# project dependency
|
|
72
|
+
pnpm remove @eudiplo/cli
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The CLI stores instance metadata in `~/.eudiplo/config.json` by default. Remove
|
|
76
|
+
`~/.eudiplo` only if you also want to delete local CLI instance registrations.
|
|
77
|
+
|
|
55
78
|
## Compose Driver Commands
|
|
56
79
|
|
|
57
80
|
Compose driver commands require a `compose` instance:
|
|
@@ -95,7 +118,7 @@ stored under `config/<tenant-id>/`. The demo tenant is excluded by default and
|
|
|
95
118
|
can be added with `--demo-tenant`.
|
|
96
119
|
|
|
97
120
|
`init --target compose --demo` writes demo-specific assets (`.eudiplo.demo.env`
|
|
98
|
-
and `config/demo`) without starting
|
|
121
|
+
and `config/demo`) without starting the Compose runtime. Add `--no-client`
|
|
99
122
|
to generate a small Compose override that skips the web client container.
|
|
100
123
|
|
|
101
124
|
`demo --reset --force` stops the managed demo stack, removes managed demo
|
|
@@ -131,10 +154,30 @@ EUDIPLO_CLI_HOME=/tmp/eudiplo-cli eudiplo config validate
|
|
|
131
154
|
EUDIPLO_CLI_CONFIG=/tmp/eudiplo-cli/config.json eudiplo config validate
|
|
132
155
|
```
|
|
133
156
|
|
|
157
|
+
Print the resolved file path or inspect the validated configuration with:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
eudiplo config path
|
|
161
|
+
eudiplo config show
|
|
162
|
+
eudiplo config show --json
|
|
163
|
+
```
|
|
164
|
+
|
|
134
165
|
Do not store secrets in the CLI config. Commands that need authenticated API
|
|
135
166
|
access read credentials from environment variables such as `EUDIPLO_CLIENT_ID`
|
|
136
167
|
and `EUDIPLO_CLIENT_SECRET`.
|
|
137
168
|
|
|
169
|
+
## Shell Completion
|
|
170
|
+
|
|
171
|
+
The CLI generates completion scripts for Bash, Zsh, Fish, and PowerShell. For
|
|
172
|
+
the current shell session, use one of:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
source <(eudiplo completion bash)
|
|
176
|
+
source <(eudiplo completion zsh)
|
|
177
|
+
eudiplo completion fish | source
|
|
178
|
+
eudiplo completion powershell | Out-String | Invoke-Expression
|
|
179
|
+
```
|
|
180
|
+
|
|
138
181
|
## Single Executable Application
|
|
139
182
|
|
|
140
183
|
To produce a standalone CLI binary with Node.js SEA support, run:
|
|
@@ -181,9 +224,9 @@ running it:
|
|
|
181
224
|
sha256sum -c SHA256SUMS.txt
|
|
182
225
|
```
|
|
183
226
|
|
|
184
|
-
The standalone binary does not replace Docker or
|
|
185
|
-
|
|
186
|
-
installation just to use the CLI itself.
|
|
227
|
+
The standalone binary does not replace Docker, Podman, or Compose. You still
|
|
228
|
+
need a container runtime to run the local deployment stack, but you do not need a
|
|
229
|
+
local Node.js installation just to use the CLI itself.
|
|
187
230
|
|
|
188
231
|
## Developing and Extending the CLI
|
|
189
232
|
|
|
@@ -209,6 +252,26 @@ when testing changes that require a different backend or client build:
|
|
|
209
252
|
pnpm --filter @eudiplo/cli dev demo ./eudiplo-demo --image-tag main
|
|
210
253
|
```
|
|
211
254
|
|
|
255
|
+
Install the JSON Schemas bundled with the CLI into a VS Code workspace and
|
|
256
|
+
associate them with the local tenant configuration tree:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
eudiplo config editor setup . --config-directory ./config
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The command merges `.vscode/settings.json` without removing unrelated settings
|
|
263
|
+
or JSONC comments and can safely be rerun after a CLI upgrade.
|
|
264
|
+
|
|
265
|
+
List the complete command tree or render the same reference as Markdown:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
eudiplo commands
|
|
269
|
+
eudiplo commands --format markdown
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The documentation prebuild uses the Markdown renderer directly, keeping the
|
|
273
|
+
published command reference synchronized with Commander definitions.
|
|
274
|
+
|
|
212
275
|
Use a new project directory or add `--force` when regenerating an existing
|
|
213
276
|
project, because the CLI preserves managed environment files by default. The
|
|
214
277
|
`version` command still reports the CLI package version, but that value is not
|
|
@@ -229,6 +292,7 @@ src/
|
|
|
229
292
|
│ │ └── action.ts # instance persistence
|
|
230
293
|
│ └── config/
|
|
231
294
|
│ ├── index.ts # config group
|
|
295
|
+
│ ├── editor/ # VS Code schema setup command module
|
|
232
296
|
│ ├── validate/ # validation command module
|
|
233
297
|
│ └── tenant/ # tenant-config command module
|
|
234
298
|
├── services/
|
|
@@ -248,34 +312,34 @@ truth.
|
|
|
248
312
|
|
|
249
313
|
```ts
|
|
250
314
|
// commands/example/index.ts
|
|
251
|
-
import { Command } from
|
|
252
|
-
import type { CommandContext } from
|
|
253
|
-
import type { SetExitCode } from
|
|
254
|
-
import { runExample } from
|
|
315
|
+
import { Command } from 'commander';
|
|
316
|
+
import type { CommandContext } from '../../types.js';
|
|
317
|
+
import type { SetExitCode } from '../shared.js';
|
|
318
|
+
import { runExample } from './action.js';
|
|
255
319
|
|
|
256
320
|
export function createExampleCommand(
|
|
257
|
-
|
|
258
|
-
|
|
321
|
+
context: CommandContext,
|
|
322
|
+
setExitCode: SetExitCode,
|
|
259
323
|
): Command {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
324
|
+
return new Command('example')
|
|
325
|
+
.description('Describe what the command does')
|
|
326
|
+
.requiredOption('--input <path>', 'input file')
|
|
327
|
+
.action(async (options) => {
|
|
328
|
+
setExitCode(await runExample(options.input, context));
|
|
329
|
+
});
|
|
266
330
|
}
|
|
267
331
|
```
|
|
268
332
|
|
|
269
333
|
```ts
|
|
270
334
|
// commands/example/action.ts
|
|
271
|
-
import type { CommandContext } from
|
|
335
|
+
import type { CommandContext } from '../../types.js';
|
|
272
336
|
|
|
273
337
|
export async function runExample(
|
|
274
|
-
|
|
275
|
-
|
|
338
|
+
input: string,
|
|
339
|
+
context: CommandContext,
|
|
276
340
|
): Promise<number> {
|
|
277
|
-
|
|
278
|
-
|
|
341
|
+
context.stdout.write(`Processing ${input}\n`);
|
|
342
|
+
return 0;
|
|
279
343
|
}
|
|
280
344
|
```
|
|
281
345
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMrD,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,OAAO,GAC1B,OAAO,CAaT"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
|
+
import { renderCommandReference, } from "./render.js";
|
|
3
|
+
export function createCommandsCommand(context, getProgram) {
|
|
4
|
+
return new Command("commands")
|
|
5
|
+
.description("List every available CLI command")
|
|
6
|
+
.addOption(new Option("--format <text|markdown>", "output format")
|
|
7
|
+
.choices(["text", "markdown"])
|
|
8
|
+
.default("text"))
|
|
9
|
+
.action((options) => {
|
|
10
|
+
context.stdout.write(renderCommandReference(getProgram(), options.format));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAEH,sBAAsB,GACzB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,qBAAqB,CACjC,OAAuB,EACvB,UAAyB;IAEzB,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;SACzB,WAAW,CAAC,kCAAkC,CAAC;SAC/C,SAAS,CACN,IAAI,MAAM,CAAC,0BAA0B,EAAE,eAAe,CAAC;SAClD,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SAC7B,OAAO,CAAC,MAAM,CAAC,CACvB;SACA,MAAM,CAAC,CAAC,OAA2C,EAAE,EAAE;QACpD,OAAO,CAAC,MAAM,CAAC,KAAK,CAChB,sBAAsB,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CACvD,CAAC;IACN,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/commands/commands/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEzD,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,sBAAsB,GAC/B,MAAM,CAIR"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function renderCommandReference(program, format) {
|
|
2
|
+
return format === "markdown"
|
|
3
|
+
? renderMarkdownReference(program)
|
|
4
|
+
: renderTextReference(program);
|
|
5
|
+
}
|
|
6
|
+
function renderTextReference(program) {
|
|
7
|
+
const commands = collectCommands(program).slice(1);
|
|
8
|
+
const rows = commands.map((command) => ({
|
|
9
|
+
invocation: usageLine(command),
|
|
10
|
+
description: command.description(),
|
|
11
|
+
}));
|
|
12
|
+
const invocationWidth = Math.max(...rows.map((row) => row.invocation.length));
|
|
13
|
+
const lines = rows.map((row) => ` ${row.invocation.padEnd(invocationWidth)} ${row.description}`.trimEnd());
|
|
14
|
+
return `Available commands:\n\n${lines.join("\n")}\n`;
|
|
15
|
+
}
|
|
16
|
+
function renderMarkdownReference(program) {
|
|
17
|
+
const sections = collectCommands(program).map((command, index) => {
|
|
18
|
+
const heading = index === 0
|
|
19
|
+
? "# EUDIPLO CLI command reference"
|
|
20
|
+
: `## \`${commandPath(command)}\``;
|
|
21
|
+
const description = index === 0
|
|
22
|
+
? "Generated from the CLI command definitions. Do not edit this page manually."
|
|
23
|
+
: command.description();
|
|
24
|
+
return `${heading}\n\n${description}\n\n\`\`\`text\n${command.helpInformation().trim()}\n\`\`\``;
|
|
25
|
+
});
|
|
26
|
+
return `${sections.join("\n\n")}\n`;
|
|
27
|
+
}
|
|
28
|
+
function collectCommands(program) {
|
|
29
|
+
const commands = [program];
|
|
30
|
+
for (const child of program.commands) {
|
|
31
|
+
if (child.name() === "help" ||
|
|
32
|
+
child._hidden === true) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
commands.push(...collectCommands(child));
|
|
36
|
+
}
|
|
37
|
+
return commands;
|
|
38
|
+
}
|
|
39
|
+
function usageLine(command) {
|
|
40
|
+
const firstLine = command.helpInformation().split("\n", 1)[0];
|
|
41
|
+
return firstLine.replace(/^Usage:\s*/, "");
|
|
42
|
+
}
|
|
43
|
+
function commandPath(command) {
|
|
44
|
+
const names = [];
|
|
45
|
+
let current = command;
|
|
46
|
+
while (current) {
|
|
47
|
+
names.unshift(current.name());
|
|
48
|
+
current = current.parent;
|
|
49
|
+
}
|
|
50
|
+
return names.join(" ");
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/commands/commands/render.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,sBAAsB,CAClC,OAAgB,EAChB,MAA8B;IAE9B,OAAO,MAAM,KAAK,UAAU;QACxB,CAAC,CAAC,uBAAuB,CAAC,OAAO,CAAC;QAClC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAgB;IACzC,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpC,UAAU,EAAE,SAAS,CAAC,OAAO,CAAC;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;KACrC,CAAC,CAAC,CAAC;IACJ,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAC5B,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAC9C,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,E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O,CAAC,eAAe,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,WAAW,CAAC,OAAgB;IACjC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAmB,OAAO,CAAC;IACtC,OAAO,OAAO,EAAE,CAAC;QACb,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9B,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { CommandContext } from "../../types.js";
|
|
3
|
+
export type CompletionShell = "bash" | "zsh" | "fish" | "powershell";
|
|
4
|
+
export declare function runCompletion(shell: CompletionShell, context: CommandContext): number;
|
|
5
|
+
export declare function runCompletionCandidates(root: Command, words: string[], context: CommandContext): number;
|
|
6
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/completion/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;AAErE,wBAAgB,aAAa,CACzB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,cAAc,GACxB,MAAM,CAGR;AAED,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,cAAc,GACxB,MAAM,CAKR"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export function runCompletion(shell, context) {
|
|
2
|
+
context.stdout.write(`${completionScript(shell)}\n`);
|
|
3
|
+
return 0;
|
|
4
|
+
}
|
|
5
|
+
export function runCompletionCandidates(root, words, context) {
|
|
6
|
+
for (const candidate of completionCandidates(root, words)) {
|
|
7
|
+
context.stdout.write(`${candidate}\n`);
|
|
8
|
+
}
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
function completionScript(shell) {
|
|
12
|
+
switch (shell) {
|
|
13
|
+
case "bash":
|
|
14
|
+
return bashCompletion();
|
|
15
|
+
case "zsh":
|
|
16
|
+
return zshCompletion();
|
|
17
|
+
case "fish":
|
|
18
|
+
return fishCompletion();
|
|
19
|
+
case "powershell":
|
|
20
|
+
return powershellCompletion();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function completionCandidates(root, words) {
|
|
24
|
+
let current = root;
|
|
25
|
+
let skipOptionValue = false;
|
|
26
|
+
for (const word of words) {
|
|
27
|
+
if (skipOptionValue) {
|
|
28
|
+
skipOptionValue = false;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const option = findOption(current, word);
|
|
32
|
+
if (option) {
|
|
33
|
+
skipOptionValue = option.required || option.optional;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (word.startsWith("-")) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const child = current.commands.find((command) => command.name() === word || command.aliases().includes(word));
|
|
40
|
+
if (child) {
|
|
41
|
+
current = child;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const lastOption = findOption(current, words.at(-1));
|
|
45
|
+
if (lastOption) {
|
|
46
|
+
const choices = optionChoices(lastOption);
|
|
47
|
+
if (choices.length > 0) {
|
|
48
|
+
return choices;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const candidates = ["-h", "--help"];
|
|
52
|
+
for (const command of current.commands) {
|
|
53
|
+
if (command.name() !== "_complete") {
|
|
54
|
+
candidates.push(command.name(), ...command.aliases());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const option of current.options) {
|
|
58
|
+
if (option.short) {
|
|
59
|
+
candidates.push(option.short);
|
|
60
|
+
}
|
|
61
|
+
if (option.long) {
|
|
62
|
+
candidates.push(option.long);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (current.commands.length === 0 && words.at(-1) === current.name()) {
|
|
66
|
+
candidates.push(...(current.registeredArguments[0]?.argChoices ?? []));
|
|
67
|
+
}
|
|
68
|
+
return [...new Set(candidates)];
|
|
69
|
+
}
|
|
70
|
+
function findOption(command, word) {
|
|
71
|
+
if (!word) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const flag = word.includes("=") ? word.slice(0, word.indexOf("=")) : word;
|
|
75
|
+
return command.options.find((option) => option.short === flag || option.long === flag);
|
|
76
|
+
}
|
|
77
|
+
function optionChoices(option) {
|
|
78
|
+
if (option.argChoices) {
|
|
79
|
+
return option.argChoices;
|
|
80
|
+
}
|
|
81
|
+
const placeholder = option.flags.match(/[<[]([^>\]]+)[>\]]/u)?.[1];
|
|
82
|
+
return placeholder?.includes("|") ? placeholder.split("|") : [];
|
|
83
|
+
}
|
|
84
|
+
function bashCompletion() {
|
|
85
|
+
return [
|
|
86
|
+
"_eudiplo_completion() {",
|
|
87
|
+
" local current candidates",
|
|
88
|
+
" local -a args",
|
|
89
|
+
' current="${COMP_WORDS[COMP_CWORD]}"',
|
|
90
|
+
' args=("${COMP_WORDS[@]:1:$((COMP_CWORD - 1))}")',
|
|
91
|
+
' candidates="$(eudiplo _complete "${args[@]}" 2>/dev/null)"',
|
|
92
|
+
' COMPREPLY=($(compgen -W "$candidates" -- "$current"))',
|
|
93
|
+
"}",
|
|
94
|
+
"complete -F _eudiplo_completion eudiplo",
|
|
95
|
+
].join("\n");
|
|
96
|
+
}
|
|
97
|
+
function zshCompletion() {
|
|
98
|
+
return [
|
|
99
|
+
"#compdef eudiplo",
|
|
100
|
+
"_eudiplo() {",
|
|
101
|
+
" local -a args candidates",
|
|
102
|
+
' args=("${words[@]:2:$((CURRENT - 2))}")',
|
|
103
|
+
' candidates=("${(@f)$(eudiplo _complete "${args[@]}" 2>/dev/null)}")',
|
|
104
|
+
" compadd -- $candidates",
|
|
105
|
+
"}",
|
|
106
|
+
"compdef _eudiplo eudiplo",
|
|
107
|
+
].join("\n");
|
|
108
|
+
}
|
|
109
|
+
function fishCompletion() {
|
|
110
|
+
return [
|
|
111
|
+
"function __eudiplo_candidates",
|
|
112
|
+
" set -l tokens (commandline -opc)",
|
|
113
|
+
" set -e tokens[1]",
|
|
114
|
+
" eudiplo _complete $tokens 2>/dev/null",
|
|
115
|
+
"end",
|
|
116
|
+
"complete -c eudiplo -f -a '(__eudiplo_candidates)'",
|
|
117
|
+
].join("\n");
|
|
118
|
+
}
|
|
119
|
+
function powershellCompletion() {
|
|
120
|
+
return [
|
|
121
|
+
"Register-ArgumentCompleter -Native -CommandName eudiplo -ScriptBlock {",
|
|
122
|
+
" param($wordToComplete, $commandAst, $cursorPosition)",
|
|
123
|
+
" $arguments = @($commandAst.CommandElements | Select-Object -Skip 1 | ForEach-Object { $_.ToString() })",
|
|
124
|
+
" if ($wordToComplete -and $arguments.Count -gt 0) {",
|
|
125
|
+
" $arguments = @($arguments | Select-Object -First ($arguments.Count - 1))",
|
|
126
|
+
" }",
|
|
127
|
+
" eudiplo _complete @arguments 2>$null | Where-Object { $_ -like \"$wordToComplete*\" } | ForEach-Object {",
|
|
128
|
+
" [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)",
|
|
129
|
+
" }",
|
|
130
|
+
"}",
|
|
131
|
+
].join("\n");
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","s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A8B;QAC9B,mBAAmB;QACnB,yCAAyC;QACzC,qDAAqD;QACrD,gEAAgE;QAChE,2DAA2D;QAC3D,GAAG;QACH,yCAAyC;KAC5C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,aAAa;IAClB,OAAO;QACH,kBAAkB;QAClB,cAAc;QACd,8BAA8B;QAC9B,6CAA6C;QAC7C,yEAAyE;QACzE,4BAA4B;QAC5B,GAAG;QACH,0BAA0B;KAC7B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,cAAc;IACnB,OAAO;QACH,+BAA+B;QAC/B,sCAAsC;QACtC,sBAAsB;QACtB,2CAA2C;QAC3C,KAAK;QACL,oDAAoD;KACvD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,oBAAoB;IACzB,OAAO;QACH,wEAAwE;QACxE,0DAA0D;QAC1D,4GAA4G;QAC5G,wDAAwD;QACxD,kFAAkF;QAClF,OAAO;QACP,8GAA8G;QAC9G,4FAA4F;QAC5F,OAAO;QACP,GAAG;KACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CommandContext } from "../../types.js";
|
|
3
|
+
import type { SetExitCode } from "../shared.js";
|
|
4
|
+
export declare function createCompletionCommand(context: CommandContext, setExitCode: SetExitCode): Command;
|
|
5
|
+
export declare function createCompletionCandidatesCommand(context: CommandContext, setExitCode: SetExitCode): Command;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/completion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,OAAO,EAAqB,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAShD,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,GACzB,OAAO,CAWT;AAED,wBAAgB,iCAAiC,CAC7C,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,GACzB,OAAO,CAUT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Argument, Command } from "commander";
|
|
2
|
+
import { runCompletion, runCompletionCandidates, } from "./action.js";
|
|
3
|
+
const supportedShells = ["bash", "zsh", "fish", "powershell"];
|
|
4
|
+
export function createCompletionCommand(context, setExitCode) {
|
|
5
|
+
return new Command("completion")
|
|
6
|
+
.description("Generate shell completion scripts")
|
|
7
|
+
.addArgument(new Argument("<shell>", "shell to generate completion for").choices(supportedShells))
|
|
8
|
+
.action((shell) => {
|
|
9
|
+
setExitCode(runCompletion(shell, context));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function createCompletionCandidatesCommand(context, setExitCode) {
|
|
13
|
+
return new Command("_complete")
|
|
14
|
+
.argument("[words...]")
|
|
15
|
+
.allowUnknownOption(true)
|
|
16
|
+
.action((words, _options, command) => {
|
|
17
|
+
if (!command.parent) {
|
|
18
|
+
throw new Error("Completion command is not attached to the CLI root.");
|
|
19
|
+
}
|
|
20
|
+
setExitCode(runCompletionCandidates(command.parent, words, context));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/completion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAC;AAGjE,OAAO,EACH,aAAa,EACb,uBAAuB,GAE1B,MAAM,aAAa,CAAC;AAErB,MAAM,eAAe,GAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAEjF,MAAM,UAAU,uBAAuB,CACnC,OAAuB,EACvB,WAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC;SAC3B,WAAW,CAAC,mCAAmC,CAAC;SAChD,WAAW,CACR,IAAI,QAAQ,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC,OAAO,CAC/D,eAAe,CAClB,CACJ;SACA,MAAM,CAAC,CAAC,KAAsB,EAAE,EAAE;QAC/B,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC7C,OAAuB,EACvB,WAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;SAC1B,QAAQ,CAAC,YAAY,CAAC;SACtB,kBAAkB,CAAC,IAAI,CAAC;SACxB,MAAM,CAAC,CAAC,KAAe,EAAE,QAAsB,EAAE,OAAgB,EAAE,EAAE;QAClE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAC3E,CAAC;QACD,WAAW,CAAC,uBAAuB,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CliConfig, CommandContext } from "../../types.js";
|
|
2
|
+
export declare function runConfigPath(context: CommandContext): number;
|
|
3
|
+
export declare function runConfigShow(configPath: string, config: CliConfig, json: boolean, context: CommandContext): number;
|
|
4
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/config/action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAEhF,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAG7D;AAED,wBAAgB,aAAa,CACzB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,cAAc,GACxB,MAAM,CAuBR"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { resolveConfigPath } from "../../services/cli-config.js";
|
|
2
|
+
export function runConfigPath(context) {
|
|
3
|
+
context.stdout.write(`${resolveConfigPath(context.env)}\n`);
|
|
4
|
+
return 0;
|
|
5
|
+
}
|
|
6
|
+
export function runConfigShow(configPath, config, json, context) {
|
|
7
|
+
if (json) {
|
|
8
|
+
context.stdout.write(`${JSON.stringify(config, null, 2)}\n`);
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
context.stdout.write(`Config: ${configPath}\n`);
|
|
12
|
+
context.stdout.write(`Default instance: ${config.defaultInstance ?? "none"}\n`);
|
|
13
|
+
const instances = Object.entries(config.instances).sort(([left], [right]) => left.localeCompare(right));
|
|
14
|
+
if (instances.length === 0) {
|
|
15
|
+
context.stdout.write("Instances: none\n");
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
context.stdout.write("Instances:\n");
|
|
19
|
+
for (const [name, instance] of instances) {
|
|
20
|
+
const defaultLabel = name === config.defaultInstance ? " (default)" : "";
|
|
21
|
+
context.stdout.write(`- ${name}${defaultLabel}\n`);
|
|
22
|
+
writeInstance(instance, context);
|
|
23
|
+
}
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
function writeInstance(instance, context) {
|
|
27
|
+
for (const [key, value] of Object.entries(instance)) {
|
|
28
|
+
if (value !== undefined) {
|
|
29
|
+
context.stdout.write(` ${key}: ${Array.isArray(value) ? value.join(", ") : value}\n`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=action.js.map
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