@kjanat/dreamcli 0.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.
Files changed (205) hide show
  1. package/CHANGELOG.md +706 -0
  2. package/LICENSE +22 -0
  3. package/README.md +502 -0
  4. package/dist/core/cli/dispatch.d.mts +85 -0
  5. package/dist/core/cli/dispatch.mjs +1 -0
  6. package/dist/core/cli/index.d.mts +418 -0
  7. package/dist/core/cli/index.mjs +1 -0
  8. package/dist/core/cli/planner.d.mts +143 -0
  9. package/dist/core/cli/planner.mjs +1 -0
  10. package/dist/core/cli/plugin.d.mts +94 -0
  11. package/dist/core/cli/plugin.mjs +1 -0
  12. package/dist/core/cli/propagate.d.mts +39 -0
  13. package/dist/core/cli/propagate.mjs +1 -0
  14. package/dist/core/cli/root-help.d.mts +28 -0
  15. package/dist/core/cli/root-help.mjs +7 -0
  16. package/dist/core/cli/root-surface.d.mts +42 -0
  17. package/dist/core/cli/root-surface.mjs +1 -0
  18. package/dist/core/cli/runtime-preflight.d.mts +149 -0
  19. package/dist/core/cli/runtime-preflight.mjs +1 -0
  20. package/dist/core/completion/index.d.mts +46 -0
  21. package/dist/core/completion/index.mjs +1 -0
  22. package/dist/core/completion/shells/bash.d.mts +24 -0
  23. package/dist/core/completion/shells/bash.mjs +3 -0
  24. package/dist/core/completion/shells/fish.d.mts +20 -0
  25. package/dist/core/completion/shells/fish.mjs +2 -0
  26. package/dist/core/completion/shells/powershell.d.mts +14 -0
  27. package/dist/core/completion/shells/powershell.mjs +2 -0
  28. package/dist/core/completion/shells/shared.d.mts +139 -0
  29. package/dist/core/completion/shells/shared.mjs +1 -0
  30. package/dist/core/completion/shells/zsh.d.mts +24 -0
  31. package/dist/core/completion/shells/zsh.mjs +2 -0
  32. package/dist/core/config/index.d.mts +161 -0
  33. package/dist/core/config/index.mjs +1 -0
  34. package/dist/core/config/package-json.d.mts +68 -0
  35. package/dist/core/config/package-json.mjs +1 -0
  36. package/dist/core/errors/index.d.mts +126 -0
  37. package/dist/core/errors/index.mjs +1 -0
  38. package/dist/core/execution/index.d.mts +49 -0
  39. package/dist/core/execution/index.mjs +1 -0
  40. package/dist/core/help/index.d.mts +49 -0
  41. package/dist/core/help/index.mjs +8 -0
  42. package/dist/core/json-schema/index.d.mts +109 -0
  43. package/dist/core/json-schema/index.mjs +55 -0
  44. package/dist/core/json-schema/meta-descriptions.generated.d.mts +185 -0
  45. package/dist/core/json-schema/meta-descriptions.generated.mjs +28 -0
  46. package/dist/core/output/activity.d.mts +194 -0
  47. package/dist/core/output/activity.mjs +1 -0
  48. package/dist/core/output/contracts.d.mts +88 -0
  49. package/dist/core/output/contracts.mjs +1 -0
  50. package/dist/core/output/display-value.d.mts +19 -0
  51. package/dist/core/output/display-value.mjs +1 -0
  52. package/dist/core/output/index.d.mts +280 -0
  53. package/dist/core/output/index.mjs +2 -0
  54. package/dist/core/output/renderers.d.mts +46 -0
  55. package/dist/core/output/renderers.mjs +1 -0
  56. package/dist/core/output/writer.d.mts +40 -0
  57. package/dist/core/output/writer.mjs +1 -0
  58. package/dist/core/parse/index.d.mts +79 -0
  59. package/dist/core/parse/index.mjs +1 -0
  60. package/dist/core/prompt/index.d.mts +205 -0
  61. package/dist/core/prompt/index.mjs +6 -0
  62. package/dist/core/resolve/args.d.mts +8 -0
  63. package/dist/core/resolve/args.mjs +1 -0
  64. package/dist/core/resolve/coerce.d.mts +22 -0
  65. package/dist/core/resolve/coerce.mjs +1 -0
  66. package/dist/core/resolve/config.d.mts +10 -0
  67. package/dist/core/resolve/config.mjs +1 -0
  68. package/dist/core/resolve/contracts.d.mts +112 -0
  69. package/dist/core/resolve/errors.d.mts +11 -0
  70. package/dist/core/resolve/errors.mjs +2 -0
  71. package/dist/core/resolve/flags.d.mts +10 -0
  72. package/dist/core/resolve/flags.mjs +1 -0
  73. package/dist/core/resolve/index.d.mts +42 -0
  74. package/dist/core/resolve/index.mjs +1 -0
  75. package/dist/core/resolve/property.d.mts +47 -0
  76. package/dist/core/resolve/property.mjs +1 -0
  77. package/dist/core/schema/activity.d.mts +169 -0
  78. package/dist/core/schema/arg.d.mts +559 -0
  79. package/dist/core/schema/arg.mjs +1 -0
  80. package/dist/core/schema/command.d.mts +960 -0
  81. package/dist/core/schema/command.mjs +1 -0
  82. package/dist/core/schema/flag.d.mts +491 -0
  83. package/dist/core/schema/flag.mjs +1 -0
  84. package/dist/core/schema/index.d.mts +8 -0
  85. package/dist/core/schema/middleware.d.mts +122 -0
  86. package/dist/core/schema/middleware.mjs +1 -0
  87. package/dist/core/schema/prompt.d.mts +117 -0
  88. package/dist/core/schema/run.d.mts +171 -0
  89. package/dist/core/schema-dsl/runtime.d.mts +144 -0
  90. package/dist/core/schema-dsl/runtime.mjs +2 -0
  91. package/dist/core/schema-dsl/to-json-schema.d.mts +30 -0
  92. package/dist/core/schema-dsl/to-json-schema.mjs +1 -0
  93. package/dist/core/testkit/index.d.mts +54 -0
  94. package/dist/core/testkit/index.mjs +1 -0
  95. package/dist/index.d.mts +28 -0
  96. package/dist/index.mjs +1 -0
  97. package/dist/runtime/adapter.d.mts +212 -0
  98. package/dist/runtime/adapter.mjs +1 -0
  99. package/dist/runtime/auto.d.mts +26 -0
  100. package/dist/runtime/auto.mjs +1 -0
  101. package/dist/runtime/bun.d.mts +28 -0
  102. package/dist/runtime/bun.mjs +1 -0
  103. package/dist/runtime/deno.d.mts +76 -0
  104. package/dist/runtime/deno.mjs +2 -0
  105. package/dist/runtime/detect.d.mts +86 -0
  106. package/dist/runtime/detect.mjs +1 -0
  107. package/dist/runtime/index.d.mts +7 -0
  108. package/dist/runtime/node.d.mts +65 -0
  109. package/dist/runtime/node.mjs +2 -0
  110. package/dist/runtime/paths.d.mts +31 -0
  111. package/dist/runtime/paths.mjs +1 -0
  112. package/dist/runtime/support.d.mts +42 -0
  113. package/dist/runtime/support.mjs +1 -0
  114. package/dist/runtime.d.mts +7 -0
  115. package/dist/runtime.mjs +1 -0
  116. package/dist/testkit.d.mts +6 -0
  117. package/dist/testkit.mjs +1 -0
  118. package/dist/version.d.mts +16 -0
  119. package/dist/version.mjs +1 -0
  120. package/dreamcli.schema.json +338 -0
  121. package/examples/basic.ts +33 -0
  122. package/examples/gh/package.json +44 -0
  123. package/examples/gh/src/commands/auth.ts +66 -0
  124. package/examples/gh/src/commands/issue.ts +120 -0
  125. package/examples/gh/src/commands/pr.ts +125 -0
  126. package/examples/gh/src/data/issues.yaml +5 -0
  127. package/examples/gh/src/data/issues.yaml.d.ts +17 -0
  128. package/examples/gh/src/data/pull-requests.yaml +7 -0
  129. package/examples/gh/src/data/pull-requests.yaml.d.ts +18 -0
  130. package/examples/gh/src/docs.ts +11 -0
  131. package/examples/gh/src/lib/auth.ts +37 -0
  132. package/examples/gh/src/lib/utils.ts +17 -0
  133. package/examples/gh/src/main.test.ts +307 -0
  134. package/examples/gh/src/main.ts +40 -0
  135. package/examples/interactive.ts +66 -0
  136. package/examples/json-mode.ts +91 -0
  137. package/examples/middleware.ts +71 -0
  138. package/examples/multi-command.ts +66 -0
  139. package/examples/spinner-progress.ts +49 -0
  140. package/examples/testing.ts +147 -0
  141. package/package.json +149 -2
  142. package/src/core/cli/dispatch.ts +286 -0
  143. package/src/core/cli/index.ts +978 -0
  144. package/src/core/cli/planner.ts +413 -0
  145. package/src/core/cli/plugin.ts +117 -0
  146. package/src/core/cli/propagate.ts +97 -0
  147. package/src/core/cli/root-help.ts +269 -0
  148. package/src/core/cli/root-surface.ts +74 -0
  149. package/src/core/cli/runtime-preflight.ts +409 -0
  150. package/src/core/completion/index.ts +88 -0
  151. package/src/core/completion/shells/bash.ts +459 -0
  152. package/src/core/completion/shells/fish.ts +259 -0
  153. package/src/core/completion/shells/powershell.ts +405 -0
  154. package/src/core/completion/shells/shared.ts +283 -0
  155. package/src/core/completion/shells/zsh.ts +381 -0
  156. package/src/core/config/index.ts +407 -0
  157. package/src/core/config/package-json.ts +220 -0
  158. package/src/core/errors/index.ts +193 -0
  159. package/src/core/execution/index.ts +270 -0
  160. package/src/core/help/index.ts +557 -0
  161. package/src/core/json-schema/index.ts +891 -0
  162. package/src/core/json-schema/meta-descriptions.generated.ts +202 -0
  163. package/src/core/output/activity.ts +568 -0
  164. package/src/core/output/contracts.ts +194 -0
  165. package/src/core/output/display-value.ts +48 -0
  166. package/src/core/output/index.ts +669 -0
  167. package/src/core/output/renderers.ts +125 -0
  168. package/src/core/output/writer.ts +46 -0
  169. package/src/core/parse/index.ts +661 -0
  170. package/src/core/prompt/index.ts +583 -0
  171. package/src/core/resolve/args.ts +144 -0
  172. package/src/core/resolve/coerce.ts +432 -0
  173. package/src/core/resolve/config.ts +26 -0
  174. package/src/core/resolve/contracts.ts +135 -0
  175. package/src/core/resolve/errors.ts +227 -0
  176. package/src/core/resolve/flags.ts +205 -0
  177. package/src/core/resolve/index.ts +108 -0
  178. package/src/core/resolve/property.ts +99 -0
  179. package/src/core/schema/activity.ts +240 -0
  180. package/src/core/schema/arg.ts +719 -0
  181. package/src/core/schema/command.ts +1490 -0
  182. package/src/core/schema/flag.ts +756 -0
  183. package/src/core/schema/index.ts +91 -0
  184. package/src/core/schema/middleware.ts +171 -0
  185. package/src/core/schema/prompt.ts +156 -0
  186. package/src/core/schema/run.ts +195 -0
  187. package/src/core/schema-dsl/index.ts +109 -0
  188. package/src/core/schema-dsl/parse.ts +262 -0
  189. package/src/core/schema-dsl/runtime.ts +609 -0
  190. package/src/core/schema-dsl/to-json-schema.ts +102 -0
  191. package/src/core/testkit/index.ts +123 -0
  192. package/src/index.ts +170 -0
  193. package/src/runtime/adapter.ts +303 -0
  194. package/src/runtime/auto.ts +110 -0
  195. package/src/runtime/bun.ts +55 -0
  196. package/src/runtime/deno.ts +369 -0
  197. package/src/runtime/detect.ts +105 -0
  198. package/src/runtime/index.ts +21 -0
  199. package/src/runtime/node-builtins.d.ts +23 -0
  200. package/src/runtime/node.ts +300 -0
  201. package/src/runtime/paths.ts +62 -0
  202. package/src/runtime/support.ts +135 -0
  203. package/src/runtime.ts +31 -0
  204. package/src/testkit.ts +25 -0
  205. package/src/version.ts +20 -0
@@ -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};
@@ -0,0 +1,28 @@
1
+ import { ActivityEvent, Fallback, ProgressHandle, ProgressOptions, SpinnerHandle, SpinnerOptions, TableColumn, TableFormat, TableOptions, TableStream } from "./core/schema/activity.mjs";
2
+ import { ArgBuilder, ArgConfig, ArgFactory, ArgKind, ArgParseFn, ArgPresence, ArgSchema, InferArg, InferArgs, ResolvedArgValue, WithArgPresence, WithVariadic, arg, createArgSchema } from "./core/schema/arg.mjs";
3
+ import { ConfirmPromptConfig, InputPromptConfig, MultiselectPromptConfig, PromptConfig, PromptConfigBase, PromptKind, PromptResult, SelectChoice, SelectPromptConfig } from "./core/schema/prompt.mjs";
4
+ import { FlagBuilder, FlagConfig, FlagFactory, FlagKind, FlagParseFn, FlagPresence, FlagSchema, InferFlag, InferFlags, ResolvedValue, WithPresence, createSchema, flag } from "./core/schema/flag.mjs";
5
+ import { Middleware, MiddlewareHandler, MiddlewareParams, middleware } from "./core/schema/middleware.mjs";
6
+ import { ParseResult, Token, parse, tokenize } from "./core/parse/index.mjs";
7
+ import { WriteFn } from "./core/output/writer.mjs";
8
+ import { Verbosity } from "./core/output/contracts.mjs";
9
+ import { OutputOptions, createOutput } from "./core/output/index.mjs";
10
+ import { PromptEngine, ReadFn, ResolvedMultiselectPromptConfig, ResolvedPromptConfig, ResolvedSelectPromptConfig, createTerminalPrompter, resolvePromptConfig } from "./core/prompt/index.mjs";
11
+ import { DeprecationWarning, ResolveOptions, ResolveResult } from "./core/resolve/contracts.mjs";
12
+ import { resolve } from "./core/resolve/index.mjs";
13
+ import { BeforeParseParams, CLIPlugin, CLIPluginHooks, PluginCommandContext, ResolvedCommandParams, plugin } from "./core/cli/plugin.mjs";
14
+ import { CLIError, CLIErrorJSON, CLIErrorOptions, ErrorCode, ParseError, ParseErrorCode, ParseErrorOptions, ValidationError, ValidationErrorCode, ValidationErrorOptions, isCLIError, isParseError, isValidationError } from "./core/errors/index.mjs";
15
+ import { HelpOptions, formatHelp } from "./core/help/index.mjs";
16
+ import { RunResult } from "./core/schema/run.mjs";
17
+ import { ActionHandler, ActionParams, AnyCommandBuilder, CommandArgEntry, CommandBuilder, CommandConfig, CommandExample, CommandMeta, CommandSchema, DeriveHandler, DeriveParams, InteractiveParams, InteractiveResolver, InteractiveResult, Out, command, group } from "./core/schema/command.mjs";
18
+ import { CompletionOptions } from "./core/completion/shells/shared.mjs";
19
+ import { generateBashCompletion } from "./core/completion/shells/bash.mjs";
20
+ import { generateFishCompletion } from "./core/completion/shells/fish.mjs";
21
+ import { generatePowerShellCompletion } from "./core/completion/shells/powershell.mjs";
22
+ import { generateZshCompletion } from "./core/completion/shells/zsh.mjs";
23
+ import { SHELLS, Shell, generateCompletion } from "./core/completion/index.mjs";
24
+ import { PackageJsonAdapter, PackageJsonData, discoverPackageJson, inferCliName } from "./core/config/package-json.mjs";
25
+ import { ConfigAdapter, ConfigDiscoveryOptions, ConfigDiscoveryResult, ConfigFound, ConfigNotFound, FormatLoader, buildConfigSearchPaths, configFormat, discoverConfig } from "./core/config/index.mjs";
26
+ import { CLIBuilder, CLIOptions, CLIRunOptions, CLISchema, ConfigSettings, PackageJsonSettings, cli } from "./core/cli/index.mjs";
27
+ import { JsonSchemaOptions, definitionMetaSchema, generateInputSchema, generateSchema } from "./core/json-schema/index.mjs";
28
+ export { type ActionHandler, type ActionParams, type ActivityEvent, type AnyCommandBuilder, ArgBuilder, type ArgConfig, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type BeforeParseParams, CLIBuilder, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type CommandArgEntry, CommandBuilder, type CommandConfig, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSettings, type ConfirmPromptConfig, type DeprecationWarning, type DeriveHandler, type DeriveParams, type ErrorCode, type Fallback, FlagBuilder, type FlagConfig, type FlagFactory, type FlagKind, type FlagParseFn, type FlagPresence, type FlagSchema, type FormatLoader, type HelpOptions, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InputPromptConfig, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageJsonSettings, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseResult, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptConfig, type PromptConfigBase, type PromptEngine, type PromptKind, type PromptResult, type ReadFn, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, type SelectChoice, type SelectPromptConfig, type Shell, type SpinnerHandle, type SpinnerOptions, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WriteFn, arg, buildConfigSearchPaths, cli, command, configFormat, createArgSchema, createOutput, createSchema, createTerminalPrompter, definitionMetaSchema, discoverConfig, discoverPackageJson, flag, formatHelp, generateBashCompletion, generateCompletion, generateFishCompletion, generateInputSchema, generatePowerShellCompletion, generateSchema, generateZshCompletion, group, inferCliName, isCLIError, isParseError, isValidationError, middleware, parse, plugin, resolve, resolvePromptConfig, tokenize };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{FlagBuilder as e,createSchema as t,flag as n}from"./core/schema/flag.mjs";import{generateBashCompletion as r}from"./core/completion/shells/bash.mjs";import{generateFishCompletion as i}from"./core/completion/shells/fish.mjs";import{generatePowerShellCompletion as a}from"./core/completion/shells/powershell.mjs";import{CLIError as o,ParseError as s,ValidationError as c,isCLIError as l,isParseError as u,isValidationError as d}from"./core/errors/index.mjs";import{generateZshCompletion as f}from"./core/completion/shells/zsh.mjs";import{SHELLS as p,generateCompletion as m}from"./core/completion/index.mjs";import{formatHelp as h}from"./core/help/index.mjs";import{parse as g,tokenize as _}from"./core/parse/index.mjs";import{createTerminalPrompter as v,resolvePromptConfig as y}from"./core/prompt/index.mjs";import{resolve as b}from"./core/resolve/index.mjs";import{createOutput as x}from"./core/output/index.mjs";import{ArgBuilder as S,arg as C,createArgSchema as w}from"./core/schema/arg.mjs";import{CommandBuilder as T,command as E,group as D}from"./core/schema/command.mjs";import{plugin as O}from"./core/cli/plugin.mjs";import{discoverPackageJson as k,inferCliName as A}from"./core/config/package-json.mjs";import{buildConfigSearchPaths as j,configFormat as M,discoverConfig as N}from"./core/config/index.mjs";import{CLIBuilder as P,cli as F}from"./core/cli/index.mjs";import{definitionMetaSchema as I,generateInputSchema as L,generateSchema as R}from"./core/json-schema/index.mjs";import{middleware as z}from"./core/schema/middleware.mjs";export{S as ArgBuilder,P as CLIBuilder,o as CLIError,T as CommandBuilder,e as FlagBuilder,s as ParseError,p as SHELLS,c as ValidationError,C as arg,j as buildConfigSearchPaths,F as cli,E as command,M as configFormat,w as createArgSchema,x as createOutput,t as createSchema,v as createTerminalPrompter,I as definitionMetaSchema,N as discoverConfig,k as discoverPackageJson,n as flag,h as formatHelp,r as generateBashCompletion,m as generateCompletion,i as generateFishCompletion,L as generateInputSchema,a as generatePowerShellCompletion,R as generateSchema,f as generateZshCompletion,D as group,A as inferCliName,l as isCLIError,u as isParseError,d as isValidationError,z as middleware,g as parse,O as plugin,b as resolve,y as resolvePromptConfig,_ as tokenize};