@kjanat/dreamcli 1.0.0 → 2.0.0
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/CHANGELOG.md +45 -6
- package/LICENSE +1 -1
- package/README.md +296 -164
- package/dist/core/cli/dispatch.d.mts +85 -0
- package/dist/core/cli/dispatch.mjs +1 -0
- package/dist/core/cli/index.d.mts +418 -0
- package/dist/core/cli/index.mjs +1 -0
- package/dist/core/cli/planner.d.mts +143 -0
- package/dist/core/cli/planner.mjs +1 -0
- package/dist/core/cli/plugin.d.mts +94 -0
- package/dist/core/cli/plugin.mjs +1 -0
- package/dist/core/cli/propagate.d.mts +39 -0
- package/dist/core/cli/propagate.mjs +1 -0
- package/dist/core/cli/root-help.d.mts +28 -0
- package/dist/core/cli/root-help.mjs +7 -0
- package/dist/core/cli/root-surface.d.mts +42 -0
- package/dist/core/cli/root-surface.mjs +1 -0
- package/dist/core/cli/runtime-preflight.d.mts +149 -0
- package/dist/core/cli/runtime-preflight.mjs +1 -0
- package/dist/core/completion/index.d.mts +46 -0
- package/dist/core/completion/index.mjs +1 -0
- package/dist/core/completion/shells/bash.d.mts +24 -0
- package/dist/core/completion/shells/bash.mjs +3 -0
- package/dist/core/completion/shells/fish.d.mts +20 -0
- package/dist/core/completion/shells/fish.mjs +2 -0
- package/dist/core/completion/shells/powershell.d.mts +14 -0
- package/dist/core/completion/shells/powershell.mjs +2 -0
- package/dist/core/completion/shells/shared.d.mts +139 -0
- package/dist/core/completion/shells/shared.mjs +1 -0
- package/dist/core/completion/shells/zsh.d.mts +24 -0
- package/dist/core/completion/shells/zsh.mjs +2 -0
- package/dist/core/config/index.d.mts +161 -0
- package/dist/core/config/index.mjs +1 -0
- package/dist/core/config/package-json.d.mts +68 -0
- package/dist/core/config/package-json.mjs +1 -0
- package/dist/core/errors/index.d.mts +126 -0
- package/dist/core/errors/index.mjs +1 -0
- package/dist/core/execution/index.d.mts +49 -0
- package/dist/core/execution/index.mjs +1 -0
- package/dist/core/help/index.d.mts +49 -0
- package/dist/core/help/index.mjs +8 -0
- package/dist/core/json-schema/index.d.mts +109 -0
- package/dist/core/json-schema/index.mjs +55 -0
- package/dist/core/json-schema/meta-descriptions.generated.d.mts +185 -0
- package/dist/core/json-schema/meta-descriptions.generated.mjs +28 -0
- package/dist/core/output/activity.d.mts +194 -0
- package/dist/core/output/activity.mjs +1 -0
- package/dist/core/output/contracts.d.mts +88 -0
- package/dist/core/output/contracts.mjs +1 -0
- package/dist/core/output/display-value.d.mts +19 -0
- package/dist/core/output/display-value.mjs +1 -0
- package/dist/core/output/index.d.mts +280 -0
- package/dist/core/output/index.mjs +2 -0
- package/dist/core/output/renderers.d.mts +46 -0
- package/dist/core/output/renderers.mjs +1 -0
- package/dist/core/output/writer.d.mts +40 -0
- package/dist/core/output/writer.mjs +1 -0
- package/dist/core/parse/index.d.mts +79 -0
- package/dist/core/parse/index.mjs +1 -0
- package/dist/core/prompt/index.d.mts +205 -0
- package/dist/core/prompt/index.mjs +6 -0
- package/dist/core/resolve/args.d.mts +8 -0
- package/dist/core/resolve/args.mjs +1 -0
- package/dist/core/resolve/coerce.d.mts +22 -0
- package/dist/core/resolve/coerce.mjs +1 -0
- package/dist/core/resolve/config.d.mts +10 -0
- package/dist/core/resolve/config.mjs +1 -0
- package/dist/core/resolve/contracts.d.mts +112 -0
- package/dist/core/resolve/errors.d.mts +11 -0
- package/dist/core/resolve/errors.mjs +2 -0
- package/dist/core/resolve/flags.d.mts +10 -0
- package/dist/core/resolve/flags.mjs +1 -0
- package/dist/core/resolve/index.d.mts +42 -0
- package/dist/core/resolve/index.mjs +1 -0
- package/dist/core/resolve/property.d.mts +47 -0
- package/dist/core/resolve/property.mjs +1 -0
- package/dist/core/schema/activity.d.mts +169 -0
- package/dist/core/schema/arg.d.mts +559 -0
- package/dist/core/schema/arg.mjs +1 -0
- package/dist/core/schema/command.d.mts +960 -0
- package/dist/core/schema/command.mjs +1 -0
- package/dist/core/schema/flag.d.mts +491 -0
- package/dist/core/schema/flag.mjs +1 -0
- package/dist/core/schema/index.d.mts +8 -0
- package/dist/core/schema/middleware.d.mts +122 -0
- package/dist/core/schema/middleware.mjs +1 -0
- package/dist/core/schema/prompt.d.mts +117 -0
- package/dist/core/schema/run.d.mts +171 -0
- package/dist/core/schema-dsl/runtime.d.mts +144 -0
- package/dist/core/schema-dsl/runtime.mjs +2 -0
- package/dist/core/schema-dsl/to-json-schema.d.mts +30 -0
- package/dist/core/schema-dsl/to-json-schema.mjs +1 -0
- package/dist/core/testkit/index.d.mts +54 -0
- package/dist/core/testkit/index.mjs +1 -0
- package/dist/index.d.mts +28 -920
- package/dist/index.mjs +1 -10
- package/dist/runtime/adapter.d.mts +212 -0
- package/dist/{adapter-B37d9oia.mjs → runtime/adapter.mjs} +1 -1
- package/dist/runtime/auto.d.mts +26 -0
- package/dist/runtime/auto.mjs +1 -0
- package/dist/runtime/bun.d.mts +28 -0
- package/dist/runtime/bun.mjs +1 -0
- package/dist/runtime/deno.d.mts +76 -0
- package/dist/runtime/deno.mjs +2 -0
- package/dist/runtime/detect.d.mts +86 -0
- package/dist/runtime/detect.mjs +1 -0
- package/dist/runtime/index.d.mts +7 -0
- package/dist/runtime/node.d.mts +65 -0
- package/dist/runtime/node.mjs +2 -0
- package/dist/runtime/paths.d.mts +31 -0
- package/dist/runtime/paths.mjs +1 -0
- package/dist/runtime/support.d.mts +42 -0
- package/dist/runtime/support.mjs +1 -0
- package/dist/runtime.d.mts +6 -252
- package/dist/runtime.mjs +1 -1
- package/dist/testkit.d.mts +5 -24
- package/dist/testkit.mjs +1 -1
- package/dist/version.d.mts +16 -0
- package/dist/version.mjs +1 -0
- package/dreamcli.schema.json +338 -0
- package/examples/basic.ts +2 -2
- package/examples/gh/package.json +7 -11
- package/examples/gh/src/commands/auth.ts +2 -2
- package/examples/gh/src/commands/issue.ts +4 -4
- package/examples/gh/src/commands/pr.ts +4 -4
- package/examples/gh/src/docs.ts +11 -0
- package/examples/gh/src/lib/auth.ts +1 -1
- package/examples/gh/src/main.test.ts +6 -5
- package/examples/gh/src/main.ts +8 -6
- package/examples/interactive.ts +3 -3
- package/examples/json-mode.ts +4 -6
- package/examples/middleware.ts +3 -3
- package/examples/multi-command.ts +3 -3
- package/examples/spinner-progress.ts +5 -5
- package/examples/testing.ts +8 -6
- package/package.json +70 -44
- package/src/core/cli/dispatch.ts +4 -0
- package/src/core/cli/index.ts +185 -632
- package/src/core/cli/planner.ts +413 -0
- package/src/core/cli/plugin.ts +7 -1
- package/src/core/cli/propagate.ts +1 -1
- package/src/core/cli/runtime-preflight.ts +409 -0
- package/src/core/completion/index.ts +15 -9
- package/src/core/completion/shells/bash.ts +6 -3
- package/src/core/completion/shells/fish.ts +245 -10
- package/src/core/completion/shells/powershell.ts +390 -9
- package/src/core/completion/shells/shared.ts +4 -4
- package/src/core/completion/shells/zsh.ts +12 -7
- package/src/core/config/index.ts +7 -4
- package/src/core/config/package-json.ts +6 -2
- package/src/core/errors/index.ts +23 -8
- package/src/core/execution/index.ts +270 -0
- package/src/core/help/index.ts +13 -15
- package/src/core/json-schema/index.ts +193 -7
- package/src/core/json-schema/meta-descriptions.generated.ts +202 -0
- package/src/core/output/contracts.ts +194 -0
- package/src/core/output/index.ts +47 -82
- package/src/core/output/renderers.ts +125 -0
- package/src/core/parse/index.ts +39 -21
- package/src/core/prompt/index.ts +44 -27
- package/src/core/resolve/args.ts +144 -0
- package/src/core/resolve/coerce.ts +432 -0
- package/src/core/resolve/config.ts +26 -0
- package/src/core/resolve/contracts.ts +135 -0
- package/src/core/resolve/errors.ts +227 -0
- package/src/core/resolve/flags.ts +205 -0
- package/src/core/resolve/index.ts +41 -1264
- package/src/core/resolve/property.ts +99 -0
- package/src/core/schema/activity.ts +3 -0
- package/src/core/schema/arg.ts +26 -14
- package/src/core/schema/command.ts +265 -38
- package/src/core/schema/flag.ts +120 -15
- package/src/core/schema/index.ts +11 -2
- package/src/core/schema/middleware.ts +6 -6
- package/src/core/schema/prompt.ts +9 -1
- package/src/core/schema/run.ts +25 -17
- package/src/core/schema-dsl/index.ts +109 -0
- package/src/core/schema-dsl/parse.ts +262 -0
- package/src/core/schema-dsl/runtime.ts +609 -0
- package/src/core/schema-dsl/to-json-schema.ts +102 -0
- package/src/core/testkit/index.ts +55 -297
- package/src/index.ts +10 -4
- package/src/runtime/adapter.ts +13 -10
- package/src/runtime/auto.ts +3 -3
- package/src/runtime/bun.ts +4 -4
- package/src/runtime/deno.ts +43 -29
- package/src/runtime/detect.ts +4 -1
- package/src/runtime/index.ts +1 -1
- package/src/runtime/node.ts +43 -21
- package/src/runtime/paths.ts +9 -3
- package/src/runtime/support.ts +20 -4
- package/src/runtime.ts +1 -1
- package/src/testkit.ts +10 -8
- package/dist/adapter-CCSh5juX.cjs +0 -1
- package/dist/adapter-DIwO-q7K.d.mts +0 -3447
- package/dist/adapter-DQnxxLiE.d.cts +0 -3447
- package/dist/auto-5cjZaF9V.mjs +0 -3
- package/dist/auto-B0eSgoDw.cjs +0 -3
- package/dist/index.cjs +0 -10
- package/dist/index.d.cts +0 -920
- package/dist/runtime.cjs +0 -1
- package/dist/runtime.d.cts +0 -253
- package/dist/testkit-CEDYPvhF.mjs +0 -14
- package/dist/testkit-ClIKijxC.cjs +0 -14
- package/dist/testkit.cjs +0 -1
- package/dist/testkit.d.cts +0 -25
- package/examples/gh/tsconfig.json +0 -37
- package/examples/tsconfig.json +0 -17
- package/src/core/cli/AGENTS.md +0 -72
- package/src/core/completion/AGENTS.md +0 -72
- package/src/core/completion/completion-test-helpers.ts +0 -48
- package/src/core/output/AGENTS.md +0 -69
- package/src/core/resolve/AGENTS.md +0 -69
- package/src/core/schema/AGENTS.md +0 -61
- package/src/core/testkit/AGENTS.md +0 -55
- package/src/runtime/AGENTS.md +0 -74
- package/src/runtime/test-helpers.ts +0 -40
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
//#region src/core/schema/prompt.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Prompt type definitions for interactive flag resolution.
|
|
4
|
+
*
|
|
5
|
+
* Prompt configuration is stored on `FlagSchema.prompt` and consumed by the
|
|
6
|
+
* resolution chain (v0.3+) when a flag value is missing after CLI/env/config
|
|
7
|
+
* resolution. The prompt engine reads this config to present the appropriate
|
|
8
|
+
* UI to the user.
|
|
9
|
+
*
|
|
10
|
+
* @module dreamcli/core/schema/prompt
|
|
11
|
+
*/
|
|
12
|
+
/** All prompt kind discriminators as a runtime array. */
|
|
13
|
+
declare const PROMPT_KINDS: readonly ['confirm', 'input', 'select', 'multiselect'];
|
|
14
|
+
/**
|
|
15
|
+
* The kind of interactive prompt to present.
|
|
16
|
+
*
|
|
17
|
+
* - `'confirm'` — yes/no boolean question
|
|
18
|
+
* - `'input'` — free-text string input
|
|
19
|
+
* - `'select'` — single selection from a list
|
|
20
|
+
* - `'multiselect'` — multiple selections from a list
|
|
21
|
+
*/
|
|
22
|
+
type PromptKind = (typeof PROMPT_KINDS)[number];
|
|
23
|
+
/** Shared fields across all prompt kinds. */
|
|
24
|
+
interface PromptConfigBase {
|
|
25
|
+
/** The question displayed to the user. */
|
|
26
|
+
readonly message: string;
|
|
27
|
+
}
|
|
28
|
+
/** Yes/no confirmation prompt — maps to `boolean` flags. Part of {@link PromptConfig}. */
|
|
29
|
+
interface ConfirmPromptConfig extends PromptConfigBase {
|
|
30
|
+
/** Discriminator identifying this as a yes/no confirmation prompt. */
|
|
31
|
+
readonly kind: 'confirm';
|
|
32
|
+
}
|
|
33
|
+
/** Free-text input prompt — maps to `string` and `number` flags. Part of {@link PromptConfig}. */
|
|
34
|
+
interface InputPromptConfig extends PromptConfigBase {
|
|
35
|
+
/** Discriminator identifying this as a free-text input prompt. */
|
|
36
|
+
readonly kind: 'input';
|
|
37
|
+
/** Placeholder text shown before user types (informational only). */
|
|
38
|
+
readonly placeholder?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Inline validation function. Return `true` if valid, or a string
|
|
41
|
+
* error message if invalid. Called before coercion to flag kind.
|
|
42
|
+
*/
|
|
43
|
+
readonly validate?: (value: string) => true | string;
|
|
44
|
+
}
|
|
45
|
+
/** Single-selection prompt — maps to `enum` flags or any flag with {@link SelectChoice choices}. Part of {@link PromptConfig}. */
|
|
46
|
+
interface SelectPromptConfig extends PromptConfigBase {
|
|
47
|
+
/** Discriminator identifying this as a single-selection prompt. */
|
|
48
|
+
readonly kind: 'select';
|
|
49
|
+
/**
|
|
50
|
+
* Available choices. When omitted for `enum` flags, the enum values
|
|
51
|
+
* from the flag schema are used automatically.
|
|
52
|
+
*/
|
|
53
|
+
readonly choices?: readonly SelectChoice[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Multi-selection prompt — maps to `array` flags.
|
|
57
|
+
* Returns an array of selected {@link SelectChoice} values. Part of {@link PromptConfig}.
|
|
58
|
+
*/
|
|
59
|
+
interface MultiselectPromptConfig extends PromptConfigBase {
|
|
60
|
+
/** Discriminator identifying this as a multi-selection prompt. */
|
|
61
|
+
readonly kind: 'multiselect';
|
|
62
|
+
/**
|
|
63
|
+
* Available choices. When omitted for `array` flags with enum elements,
|
|
64
|
+
* the enum values from the element schema are used automatically.
|
|
65
|
+
*/
|
|
66
|
+
readonly choices?: readonly SelectChoice[];
|
|
67
|
+
/**
|
|
68
|
+
* Minimum number of selections required.
|
|
69
|
+
* @defaultValue `0`
|
|
70
|
+
*/
|
|
71
|
+
readonly min?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Maximum number of selections allowed.
|
|
74
|
+
* @defaultValue `Infinity`
|
|
75
|
+
*/
|
|
76
|
+
readonly max?: number;
|
|
77
|
+
}
|
|
78
|
+
/** A selectable option for {@link SelectPromptConfig} and {@link MultiselectPromptConfig} prompts. */
|
|
79
|
+
interface SelectChoice {
|
|
80
|
+
/** The value returned when this choice is selected. */
|
|
81
|
+
readonly value: string;
|
|
82
|
+
/**
|
|
83
|
+
* Display label shown to the user.
|
|
84
|
+
* @defaultValue {@link SelectChoice.value | value}
|
|
85
|
+
*/
|
|
86
|
+
readonly label?: string;
|
|
87
|
+
/** Optional description shown alongside the choice. */
|
|
88
|
+
readonly description?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Discriminated union of all prompt configurations.
|
|
92
|
+
*
|
|
93
|
+
* Use the `kind` field to narrow:
|
|
94
|
+
* ```ts
|
|
95
|
+
* if (config.kind === 'select') {
|
|
96
|
+
* config.choices // readonly SelectChoice[] | undefined
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
type PromptConfig = ConfirmPromptConfig | InputPromptConfig | SelectPromptConfig | MultiselectPromptConfig;
|
|
101
|
+
/**
|
|
102
|
+
* The raw result returned by a prompt engine for a single prompt.
|
|
103
|
+
*
|
|
104
|
+
* - `answered: true` — user provided a value
|
|
105
|
+
* - `answered: false` — user cancelled/aborted (Ctrl+C, ESC, etc.)
|
|
106
|
+
*
|
|
107
|
+
* Coercion to the flag's kind is the resolver's responsibility, not the
|
|
108
|
+
* prompt engine's.
|
|
109
|
+
*/
|
|
110
|
+
type PromptResult = {
|
|
111
|
+
/** User provided a value. */readonly answered: true; /** The raw value from the prompt engine (not yet coerced). */
|
|
112
|
+
readonly value: unknown;
|
|
113
|
+
} | {
|
|
114
|
+
/** User cancelled or aborted (Ctrl+C, ESC, etc.). */readonly answered: false;
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { type ConfirmPromptConfig, type InputPromptConfig, type MultiselectPromptConfig, PROMPT_KINDS, type PromptConfig, type PromptConfigBase, type PromptKind, type PromptResult, type SelectChoice, type SelectPromptConfig };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { ActivityEvent } from "./activity.mjs";
|
|
2
|
+
import { Verbosity } from "../output/contracts.mjs";
|
|
3
|
+
import { CapturedOutput } from "../output/index.mjs";
|
|
4
|
+
import { PromptEngine, TestAnswer } from "../prompt/index.mjs";
|
|
5
|
+
import { CLIPlugin } from "../cli/plugin.mjs";
|
|
6
|
+
import { CLIError } from "../errors/index.mjs";
|
|
7
|
+
import { HelpOptions } from "../help/index.mjs";
|
|
8
|
+
import { CommandMeta, CommandSchema, Out } from "./command.mjs";
|
|
9
|
+
|
|
10
|
+
//#region src/core/schema/run.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Options accepted by `runCommand()` and internal command execution paths.
|
|
13
|
+
*
|
|
14
|
+
* Every field is optional — sensible defaults are applied. This is the
|
|
15
|
+
* primary process-free execution seam: inject env, config, prompt I/O, and
|
|
16
|
+
* dispatch-layer metadata without touching process state.
|
|
17
|
+
*/
|
|
18
|
+
interface RunOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Environment variables for flag resolution.
|
|
21
|
+
*
|
|
22
|
+
* Flags with `.env('VAR')` configured resolve from this record
|
|
23
|
+
* when no CLI value is provided (CLI → env → config → prompt → default).
|
|
24
|
+
*/
|
|
25
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
26
|
+
/**
|
|
27
|
+
* Configuration object for flag resolution.
|
|
28
|
+
*
|
|
29
|
+
* Flags with `.config('path')` configured resolve from this record
|
|
30
|
+
* when no CLI or env value is provided (CLI → env → config → prompt → default).
|
|
31
|
+
* Config is plain JSON — file loading is the caller's responsibility.
|
|
32
|
+
*/
|
|
33
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
34
|
+
/**
|
|
35
|
+
* Full stdin contents for args configured with `.stdin()`.
|
|
36
|
+
*
|
|
37
|
+
* Lets tests inject piped input without a runtime adapter.
|
|
38
|
+
*/
|
|
39
|
+
readonly stdinData?: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Prompt engine for interactive flag resolution.
|
|
42
|
+
*
|
|
43
|
+
* When provided, flags with `.prompt()` configured that have no value
|
|
44
|
+
* after CLI/env/config resolution will be prompted interactively.
|
|
45
|
+
*
|
|
46
|
+
* When absent (and `answers` is also absent), prompting is skipped
|
|
47
|
+
* and resolution falls through to default/required.
|
|
48
|
+
*
|
|
49
|
+
* Takes precedence over `answers` when both are provided.
|
|
50
|
+
*/
|
|
51
|
+
readonly prompter?: PromptEngine;
|
|
52
|
+
/**
|
|
53
|
+
* Pre-configured prompt answers for testing convenience.
|
|
54
|
+
*
|
|
55
|
+
* When provided, a test prompter is created from these answers via
|
|
56
|
+
* `createTestPrompter(answers)`. Each entry is consumed in order —
|
|
57
|
+
* use `PROMPT_CANCEL` to simulate cancellation.
|
|
58
|
+
*
|
|
59
|
+
* Ignored when an explicit `prompter` is provided.
|
|
60
|
+
*/
|
|
61
|
+
readonly answers?: readonly TestAnswer[];
|
|
62
|
+
/**
|
|
63
|
+
* Verbosity level for the output channel.
|
|
64
|
+
* @defaultValue `'normal'`
|
|
65
|
+
*/
|
|
66
|
+
readonly verbosity?: Verbosity;
|
|
67
|
+
/**
|
|
68
|
+
* Enable JSON output mode.
|
|
69
|
+
*
|
|
70
|
+
* When `true`, `log` and `info` messages are redirected to stderr
|
|
71
|
+
* so that stdout is reserved exclusively for structured {@linkcode Out.json | json()} output.
|
|
72
|
+
* Framework-rendered errors are emitted as structured JSON to stdout.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue `false`
|
|
75
|
+
*/
|
|
76
|
+
readonly jsonMode?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether stdout is connected to a TTY.
|
|
79
|
+
*
|
|
80
|
+
* Handlers can check {@linkcode Out.isTTY | out.isTTY} to decide whether to emit decorative
|
|
81
|
+
* output (spinners, progress bars, ANSI codes). Defaults to `false`
|
|
82
|
+
* (safe default for tests — non-TTY until proven otherwise).
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue `false`
|
|
85
|
+
*/
|
|
86
|
+
readonly isTTY?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Output channel override used by live CLI execution.
|
|
89
|
+
*
|
|
90
|
+
* @internal — `CLIBuilder.run()` passes a real output channel so activity renders to
|
|
91
|
+
* the terminal instead of being captured.
|
|
92
|
+
*/
|
|
93
|
+
readonly out?: Out;
|
|
94
|
+
/**
|
|
95
|
+
* Capture buffers override paired with `out`.
|
|
96
|
+
*
|
|
97
|
+
* @internal — when omitted, `runCommand()` creates empty buffers for the
|
|
98
|
+
* returned {@linkcode RunResult} while writing directly to the provided `out`.
|
|
99
|
+
*/
|
|
100
|
+
readonly captured?: CapturedOutput;
|
|
101
|
+
/**
|
|
102
|
+
* Help formatting options (width, binName).
|
|
103
|
+
* Used when `--help` is detected.
|
|
104
|
+
*/
|
|
105
|
+
readonly help?: HelpOptions;
|
|
106
|
+
/**
|
|
107
|
+
* Command schema with propagated flags merged in.
|
|
108
|
+
*
|
|
109
|
+
* When provided, used for parsing and resolution instead of `cmd.schema`.
|
|
110
|
+
* Set by the CLI dispatch layer after collecting propagated flags from
|
|
111
|
+
* the command ancestry path.
|
|
112
|
+
*
|
|
113
|
+
* @internal — set by dispatch layer, not for public use.
|
|
114
|
+
*/
|
|
115
|
+
readonly mergedSchema?: CommandSchema;
|
|
116
|
+
/**
|
|
117
|
+
* CLI program metadata passed to action handlers and middleware.
|
|
118
|
+
*
|
|
119
|
+
* When provided (by CLI dispatch layer), handlers receive this as `meta`.
|
|
120
|
+
* When absent (standalone `runCommand()`), a minimal meta is constructed
|
|
121
|
+
* from the command's own schema.
|
|
122
|
+
*
|
|
123
|
+
* @internal — populated by CLI dispatch, not for public use.
|
|
124
|
+
*/
|
|
125
|
+
readonly meta?: CommandMeta;
|
|
126
|
+
/**
|
|
127
|
+
* CLI plugins registered on the parent `CLIBuilder`.
|
|
128
|
+
*
|
|
129
|
+
* @internal — threaded through from CLI dispatch.
|
|
130
|
+
*/
|
|
131
|
+
readonly plugins?: readonly CLIPlugin[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Structured result from {@linkcode runCommand}.
|
|
135
|
+
*
|
|
136
|
+
* Contains the exit code, captured stdout/stderr output, recorded
|
|
137
|
+
* {@linkcode ActivityEvent | activity events}, and an `error` field
|
|
138
|
+
* that is `undefined` on success and a {@linkcode CLIError} on failure.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* const result = await runCommand(greetCmd, ['World']);
|
|
143
|
+
*
|
|
144
|
+
* expect(result.exitCode).toBe(0);
|
|
145
|
+
* expect(result.stdout).toContain('Hello, World!');
|
|
146
|
+
* expect(result.error).toBeUndefined();
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
interface RunResult {
|
|
150
|
+
/** Process exit code. 0 = success. */
|
|
151
|
+
readonly exitCode: number;
|
|
152
|
+
/** Captured stdout lines (from `out.log` and `out.info`). */
|
|
153
|
+
readonly stdout: readonly string[];
|
|
154
|
+
/** Captured stderr lines (from `out.warn` and `out.error`). */
|
|
155
|
+
readonly stderr: readonly string[];
|
|
156
|
+
/**
|
|
157
|
+
* Captured spinner and progress lifecycle events.
|
|
158
|
+
*
|
|
159
|
+
* Recorded separately from stdout/stderr — handlers that call
|
|
160
|
+
* {@linkcode Out.spinner | out.spinner()} or {@linkcode Out.progress | out.progress()} produce events here, enabling
|
|
161
|
+
* targeted assertions on activity lifecycle without parsing text.
|
|
162
|
+
*/
|
|
163
|
+
readonly activity: readonly ActivityEvent[];
|
|
164
|
+
/**
|
|
165
|
+
* The error that caused a non-zero exit, or `undefined` on success.
|
|
166
|
+
* {@linkcode CLIError} instances are preserved; unknown errors are wrapped.
|
|
167
|
+
*/
|
|
168
|
+
readonly error: CLIError | undefined;
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
export { RunOptions, RunResult };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
//#region src/core/schema-dsl/runtime.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Runtime schema string parser.
|
|
4
|
+
*
|
|
5
|
+
* Parses the same string literals as the compile-time {@link Parse} type,
|
|
6
|
+
* producing a runtime AST ({@link SchemaNode}) that mirrors the inferred
|
|
7
|
+
* TypeScript type. The AST can drive JSON Schema generation, validation,
|
|
8
|
+
* and introspection — all from the same source string.
|
|
9
|
+
*
|
|
10
|
+
* Grammar (matches the type-level parser in `parse.ts`):
|
|
11
|
+
* ```
|
|
12
|
+
* value = union
|
|
13
|
+
* union = postfix ('|' postfix)*
|
|
14
|
+
* postfix = primary ('[]')*
|
|
15
|
+
* primary = object | record | ref | literal | IDENT
|
|
16
|
+
* object = '{' properties '}'
|
|
17
|
+
* properties = (property ';')* property? ';'?
|
|
18
|
+
* property = IDENT '?'? ':' value
|
|
19
|
+
* record = 'Record' '<' value ',' value '>'
|
|
20
|
+
* ref = '@' IDENT
|
|
21
|
+
* literal = "'" CHARS "'"
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @module dreamcli/core/schema-dsl/runtime
|
|
25
|
+
*/
|
|
26
|
+
/** Discriminated union of all schema AST nodes. */
|
|
27
|
+
type SchemaNode = StringNode | NumberNode | IntegerNode | BooleanNode | LiteralTrueNode | LiteralFalseNode | LiteralNullNode | LiteralStringNode | LiteralUndefinedNode | UnknownNode | NeverNode | ArrayNode | ObjectNode | UnionNode | RefNode | RecordNode;
|
|
28
|
+
/** String primitive. */
|
|
29
|
+
interface StringNode {
|
|
30
|
+
/** Identifies this node as a string type. */
|
|
31
|
+
readonly kind: 'string';
|
|
32
|
+
}
|
|
33
|
+
/** Number primitive. */
|
|
34
|
+
interface NumberNode {
|
|
35
|
+
/** Identifies this node as a number type. */
|
|
36
|
+
readonly kind: 'number';
|
|
37
|
+
}
|
|
38
|
+
/** Integer primitive (maps to `number` in TS, `integer` in JSON Schema). */
|
|
39
|
+
interface IntegerNode {
|
|
40
|
+
/** Identifies this node as an integer type. */
|
|
41
|
+
readonly kind: 'integer';
|
|
42
|
+
}
|
|
43
|
+
/** Boolean primitive. */
|
|
44
|
+
interface BooleanNode {
|
|
45
|
+
/** Identifies this node as a boolean type. */
|
|
46
|
+
readonly kind: 'boolean';
|
|
47
|
+
}
|
|
48
|
+
/** Literal `true`. */
|
|
49
|
+
interface LiteralTrueNode {
|
|
50
|
+
/** Identifies this node as the literal `true` value. */
|
|
51
|
+
readonly kind: 'true';
|
|
52
|
+
}
|
|
53
|
+
/** Literal `false`. */
|
|
54
|
+
interface LiteralFalseNode {
|
|
55
|
+
/** Identifies this node as the literal `false` value. */
|
|
56
|
+
readonly kind: 'false';
|
|
57
|
+
}
|
|
58
|
+
/** Literal `null`. */
|
|
59
|
+
interface LiteralNullNode {
|
|
60
|
+
/** Identifies this node as the literal `null` value. */
|
|
61
|
+
readonly kind: 'null';
|
|
62
|
+
}
|
|
63
|
+
/** String literal value (e.g. `'confirm'`). */
|
|
64
|
+
interface LiteralStringNode {
|
|
65
|
+
/** Identifies this node as a string literal. */
|
|
66
|
+
readonly kind: 'literal';
|
|
67
|
+
/** The exact string value this literal represents. */
|
|
68
|
+
readonly value: string;
|
|
69
|
+
}
|
|
70
|
+
/** Literal `undefined`. */
|
|
71
|
+
interface LiteralUndefinedNode {
|
|
72
|
+
/** Identifies this node as the literal `undefined` value. */
|
|
73
|
+
readonly kind: 'undefined';
|
|
74
|
+
}
|
|
75
|
+
/** The `unknown` top type. */
|
|
76
|
+
interface UnknownNode {
|
|
77
|
+
/** Identifies this node as the `unknown` top type. */
|
|
78
|
+
readonly kind: 'unknown';
|
|
79
|
+
}
|
|
80
|
+
/** The `never` bottom type. */
|
|
81
|
+
interface NeverNode {
|
|
82
|
+
/** Identifies this node as the `never` bottom type. */
|
|
83
|
+
readonly kind: 'never';
|
|
84
|
+
}
|
|
85
|
+
/** Array of element type. */
|
|
86
|
+
interface ArrayNode {
|
|
87
|
+
/** Identifies this node as an array type. */
|
|
88
|
+
readonly kind: 'array';
|
|
89
|
+
/** The type of each array element. */
|
|
90
|
+
readonly element: SchemaNode;
|
|
91
|
+
}
|
|
92
|
+
/** Object with named properties. */
|
|
93
|
+
interface ObjectNode {
|
|
94
|
+
/** Identifies this node as an object type. */
|
|
95
|
+
readonly kind: 'object';
|
|
96
|
+
/** Named properties keyed by field name. */
|
|
97
|
+
readonly properties: Readonly<Record<string, PropertyNode>>;
|
|
98
|
+
}
|
|
99
|
+
/** Union of two or more member types. */
|
|
100
|
+
interface UnionNode {
|
|
101
|
+
/** Identifies this node as a union type. */
|
|
102
|
+
readonly kind: 'union';
|
|
103
|
+
/** The constituent types of this union. */
|
|
104
|
+
readonly members: readonly SchemaNode[];
|
|
105
|
+
}
|
|
106
|
+
/** Reference to a named definition (e.g. `@flag` → `$ref: '#/$defs/flag'`). */
|
|
107
|
+
interface RefNode {
|
|
108
|
+
/** Identifies this node as a `$ref` reference. */
|
|
109
|
+
readonly kind: 'ref';
|
|
110
|
+
/** Name of the referenced definition (without the `@` prefix). */
|
|
111
|
+
readonly target: string;
|
|
112
|
+
}
|
|
113
|
+
/** Record/dictionary type (e.g. `Record<string, @flag>`). */
|
|
114
|
+
interface RecordNode {
|
|
115
|
+
/** Identifies this node as a record/dictionary type. */
|
|
116
|
+
readonly kind: 'record';
|
|
117
|
+
/** The type of each record value (keys are always strings). */
|
|
118
|
+
readonly value: SchemaNode;
|
|
119
|
+
}
|
|
120
|
+
/** A named property with optionality flag. */
|
|
121
|
+
interface PropertyNode {
|
|
122
|
+
/** Whether the property is optional (`?` suffix in the schema DSL). */
|
|
123
|
+
readonly optional: boolean;
|
|
124
|
+
/** The property's value type. */
|
|
125
|
+
readonly schema: SchemaNode;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parse a schema source string into a runtime AST.
|
|
129
|
+
*
|
|
130
|
+
* @param source - Schema string (e.g. `"{ name: string; age: number }"`).
|
|
131
|
+
* @returns The root {@link SchemaNode}.
|
|
132
|
+
* @throws {@link SyntaxError} on malformed input.
|
|
133
|
+
*/
|
|
134
|
+
declare function parseSchema(source: string): SchemaNode;
|
|
135
|
+
/**
|
|
136
|
+
* Validate that `input` conforms to the given AST node.
|
|
137
|
+
*
|
|
138
|
+
* @param node - The schema AST to validate against.
|
|
139
|
+
* @param input - The value to check.
|
|
140
|
+
* @returns `true` if the value matches the schema.
|
|
141
|
+
*/
|
|
142
|
+
declare function validateNode(node: SchemaNode, input: unknown): boolean;
|
|
143
|
+
//#endregion
|
|
144
|
+
export { type ArrayNode, type BooleanNode, type IntegerNode, type LiteralFalseNode, type LiteralNullNode, type LiteralStringNode, type LiteralTrueNode, type LiteralUndefinedNode, type NeverNode, type NumberNode, type ObjectNode, type PropertyNode, type RecordNode, type RefNode, type SchemaNode, type StringNode, type UnionNode, type UnknownNode, parseSchema, validateNode };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={"{":`lbrace`,"}":`rbrace`,"[":`lbracket`,"]":`rbracket`,"<":`langle`,">":`rangle`,",":`comma`,":":`colon`,";":`semicolon`,"?":`question`,"|":`pipe`};function t(e){return e===` `||e===`
|
|
2
|
+
`||e===` `||e===`\r`}function n(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`_`||e===`$`}function r(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`||e===`$`}function i(i){let a=[],o=0;for(;o<i.length;){let s=i[o]??``;if(t(s)){o++;continue}let c=e[s];if(c!==void 0){a.push({kind:c,value:s}),o++;continue}if(s===`'`){let e=``;for(o++;o<i.length&&i[o]!==`'`;)e+=i[o],o++;if(o>=i.length)throw SyntaxError(`Unterminated string literal`);o++,a.push({kind:`string_literal`,value:e});continue}if(s===`@`){o++;let e=``;for(;o<i.length;){let t=i[o]??``;if(!n(t))break;e+=t,o++}if(e.length===0)throw SyntaxError(`Expected identifier after '@' at position ${String(o)}`);a.push({kind:`ref`,value:e});continue}if(r(s)){let e=``;for(;o<i.length;){let t=i[o]??``;if(!n(t))break;e+=t,o++}a.push({kind:`ident`,value:e});continue}throw SyntaxError(`Unexpected character '${s}' at position ${String(o)}`)}return a}const a=new Set([`string`,`number`,`integer`,`boolean`,`true`,`false`,`null`,`undefined`,`unknown`,`never`]);function o(e){switch(e){case`string`:return{kind:`string`};case`number`:return{kind:`number`};case`integer`:return{kind:`integer`};case`boolean`:return{kind:`boolean`};case`true`:return{kind:`true`};case`false`:return{kind:`false`};case`null`:return{kind:`null`};case`undefined`:return{kind:`undefined`};case`unknown`:return{kind:`unknown`};case`never`:return{kind:`never`};default:throw SyntaxError(`Unknown type '${e}'`)}}var s=class{pos=0;constructor(e){this.tokens=e}parseRoot(){let e=this.parseValue();if(this.pos<this.tokens.length){let e=this.peek();throw SyntaxError(`Unexpected token '${e?.value??`?`}' at position ${String(this.pos)}`)}return e}parseValue(){return this.parseUnion()}parseUnion(){let e=this.parsePostfix();if(!this.check(`pipe`))return e;let t=[e];for(;this.match(`pipe`);)t.push(this.parsePostfix());return{kind:`union`,members:t}}parsePostfix(){let e=this.parsePrimary();for(;this.check(`lbracket`)&&this.checkAt(this.pos+1,`rbracket`);)this.advance(),this.advance(),e={kind:`array`,element:e};return e}parsePrimary(){if(this.check(`lbrace`))return this.parseObject();if(this.check(`string_literal`))return{kind:`literal`,value:this.advance().value};if(this.check(`ref`))return{kind:`ref`,target:this.advance().value};let e=this.expectIdent();if(e===`Record`){if(this.expect(`langle`),this.parseValue().kind!==`string`)throw SyntaxError(`Record key type must be 'string' because JSON object keys are always strings`);this.expect(`comma`);let e=this.parseValue();return this.expect(`rangle`),{kind:`record`,value:e}}if(!a.has(e))throw SyntaxError(`Unknown type '${e}' at position ${String(this.pos-1)}`);return o(e)}parseObject(){this.expect(`lbrace`);let e={};for(;!this.check(`rbrace`);){let t=this.expectIdent();if(Object.hasOwn(e,t))throw SyntaxError(`Duplicate property '${t}' at position ${String(this.pos-1)}`);let n=this.match(`question`);this.expect(`colon`),e[t]={optional:n,schema:this.parseValue()},this.match(`semicolon`)}return this.expect(`rbrace`),{kind:`object`,properties:e}}peek(){return this.tokens[this.pos]}check(e){return this.peek()?.kind===e}checkAt(e,t){return this.tokens[e]?.kind===t}advance(){let e=this.tokens[this.pos];if(e===void 0)throw SyntaxError(`Unexpected end of input`);return this.pos++,e}match(e){return this.check(e)?(this.pos++,!0):!1}expect(e){if(!this.check(e)){let t=this.peek();throw SyntaxError(t?`Expected '${e}' but got '${t.kind}' ('${t.value}') at position ${String(this.pos)}`:`Expected '${e}' but reached end of input`)}return this.advance()}expectIdent(){return this.expect(`ident`).value}};function c(e){return new s(i(e)).parseRoot()}export{c as parseSchema};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SchemaNode } from "./runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/schema-dsl/to-json-schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Convert a {@link SchemaNode} AST node to a JSON Schema fragment.
|
|
6
|
+
*
|
|
7
|
+
* Mapping:
|
|
8
|
+
* - `string` → `{ type: 'string' }`
|
|
9
|
+
* - `number` → `{ type: 'number' }`
|
|
10
|
+
* - `integer` → `{ type: 'integer' }`
|
|
11
|
+
* - `boolean` → `{ type: 'boolean' }`
|
|
12
|
+
* - `true` → `{ const: true }`
|
|
13
|
+
* - `false` → `{ const: false }`
|
|
14
|
+
* - `null` → `{ type: 'null' }`
|
|
15
|
+
* - `undefined` → throws (JSON Schema has no `undefined` type)
|
|
16
|
+
* - `unknown` → `{}` (accepts any value)
|
|
17
|
+
* - `never` → `{ not: {} }` (rejects all values)
|
|
18
|
+
* - `'literal'` → `{ const: 'literal' }`
|
|
19
|
+
* - `@ref` → `{ $ref: '#/$defs/ref' }`
|
|
20
|
+
* - `T[]` → `{ type: 'array', items: convert(T) }`
|
|
21
|
+
* - `Record<K,V>` → `{ type: 'object', additionalProperties: convert(V) }`
|
|
22
|
+
* - `{...}` → `{ type: 'object', properties: ..., required: [...] }`
|
|
23
|
+
* - `A | B` → `{ enum: [...] }` if all literals, else `{ oneOf: [...] }`
|
|
24
|
+
*
|
|
25
|
+
* @param node - The AST node to convert.
|
|
26
|
+
* @returns A plain JSON Schema fragment.
|
|
27
|
+
*/
|
|
28
|
+
declare function nodeToJsonSchema(node: SchemaNode): Record<string, unknown>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { nodeToJsonSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(t){switch(t.kind){case`string`:return{type:`string`};case`number`:return{type:`number`};case`integer`:return{type:`integer`};case`boolean`:return{type:`boolean`};case`true`:return{const:!0};case`false`:return{const:!1};case`null`:return{type:`null`};case`literal`:return{const:t.value};case`undefined`:throw Error(`Cannot convert 'undefined' type to JSON Schema; model optionality at the parent level`);case`unknown`:return{};case`never`:return{not:{}};case`ref`:return{$ref:`#/$defs/${t.target}`};case`array`:return{type:`array`,items:e(t.element)};case`record`:return{type:`object`,additionalProperties:e(t.value)};case`object`:{let n={},r=[];for(let[i,a]of Object.entries(t.properties))n[i]=e(a.schema),a.optional||r.push(i);let i={type:`object`,additionalProperties:!1,properties:n};return r.length>0&&(i.required=r),i}case`union`:{let n=[],r=!0;for(let e of t.members)e.kind===`literal`?n.push(e.value):r=!1;return r?{enum:n}:{oneOf:t.members.map(e)}}}}export{e as nodeToJsonSchema};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RunOptions, RunResult } from "../schema/run.mjs";
|
|
2
|
+
import { RunnableCommand } from "../schema/command.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/testkit/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Run a command builder against the given argv with injected options.
|
|
7
|
+
*
|
|
8
|
+
* This is the testkit wrapper around the shared executor:
|
|
9
|
+
* 1. Create or reuse capture output
|
|
10
|
+
* 2. Build standalone schema/meta defaults when CLI dispatch did not
|
|
11
|
+
* 3. Delegate parse -> resolve -> execute to the shared executor
|
|
12
|
+
* 4. Return the structured result with captured buffers
|
|
13
|
+
*
|
|
14
|
+
* Errors are normalized by the shared executor into structured {@linkcode RunResult}s
|
|
15
|
+
* with appropriate exit codes. The function never throws.
|
|
16
|
+
*
|
|
17
|
+
* @param cmd - The command builder (must have an action handler)
|
|
18
|
+
* @param argv - Raw argv strings (NOT including the command name itself)
|
|
19
|
+
* @param options - Injectable runtime state
|
|
20
|
+
* @returns Structured run result with exit code and captured output
|
|
21
|
+
*/
|
|
22
|
+
declare function runCommand(cmd: RunnableCommand, argv: readonly string[], options?: RunOptions): Promise<RunResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Options for {@linkcode runCommand} — process-free command execution.
|
|
25
|
+
*
|
|
26
|
+
* Every field is optional. Inject env, config, prompt answers, and
|
|
27
|
+
* output capture without touching process state.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const result = await runCommand(cmd, ['--verbose'], {
|
|
32
|
+
* env: { LOG_LEVEL: 'debug' },
|
|
33
|
+
* config: { theme: 'dark' },
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Structured result from {@linkcode runCommand}.
|
|
39
|
+
*
|
|
40
|
+
* Contains the exit code, captured stdout/stderr output, recorded
|
|
41
|
+
* {@linkcode ActivityEvent | activity events}, and an `error` field
|
|
42
|
+
* that is `undefined` on success and a {@linkcode CLIError} on failure.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const result = await runCommand(greetCmd, ['World']);
|
|
47
|
+
*
|
|
48
|
+
* expect(result.exitCode).toBe(0);
|
|
49
|
+
* expect(result.stdout).toContain('Hello, World!');
|
|
50
|
+
* expect(result.error).toBeUndefined();
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
//#endregion
|
|
54
|
+
export { type RunOptions, type RunResult, runCommand };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{buildRunResult as e,executeCommand as t}from"../execution/index.mjs";import{createCaptureOutput as n}from"../output/index.mjs";async function r(r,i,a){let o,s;if(a?.out!==void 0)o=a.out,s=a.captured??{stdout:[],stderr:[],activity:[]};else{let e={...a?.verbosity===void 0?{}:{verbosity:a.verbosity},...a?.jsonMode===void 0?{}:{jsonMode:a.jsonMode},...a?.isTTY===void 0?{}:{isTTY:a.isTTY}};[o,s]=n(Object.keys(e).length>0?e:void 0)}let c=a?.mergedSchema??r.schema,l=a?.meta??{name:c.name,bin:a?.help?.binName??c.name,version:void 0,command:c.name};return e(await t({command:r,argv:i,out:o,schema:c,meta:l,...a===void 0?{}:{options:a}}),s)}export{r as runCommand};
|