@kjanat/dreamcli 4.2.0 → 5.1.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 (45) hide show
  1. package/README.md +3 -1
  2. package/dist/completion-B4oRc2Ae.mjs +59 -0
  3. package/dist/completion.d.mts +11 -11
  4. package/dist/completion.mjs +1 -1
  5. package/dist/config-DSh3QJpX.mjs +1 -0
  6. package/dist/config.d.mts +11 -1
  7. package/dist/config.mjs +1 -1
  8. package/dist/core-BZx351-p.mjs +21 -0
  9. package/dist/dynamic-BK2lQF2M.mjs +1 -0
  10. package/dist/{index-C5CYWtxn.d.mts → index-CLtWJqwn.d.mts} +50 -10
  11. package/dist/{index-B6oD4_8b.d.mts → index-CuhI1Ynv.d.mts} +638 -47
  12. package/dist/{index-B3_9MlHz.d.mts → index-D683D09G.d.mts} +0 -2
  13. package/dist/{index-B_1Dmsdq.d.mts → index-DDhRLoTu.d.mts} +157 -21
  14. package/dist/{index-Cj7kXwQH.d.mts → index-DIWRV_wp.d.mts} +1 -7
  15. package/dist/{index-eF7SkQzQ.d.mts → index-Vjl2_m23.d.mts} +66 -15
  16. package/dist/{index-CaRNJH2R.d.mts → index-aTmg9yfl.d.mts} +14 -12
  17. package/dist/index.d.mts +41 -12
  18. package/dist/index.mjs +1 -1
  19. package/dist/json-schema-CYgq_hFu.mjs +59 -0
  20. package/dist/json-schema.d.mts +10 -2
  21. package/dist/json-schema.mjs +1 -1
  22. package/dist/{package-json-fYhxDdWD.mjs → package-json-hqUWeazy.mjs} +1 -1
  23. package/dist/prompt.d.mts +13 -8
  24. package/dist/prompt.mjs +1 -1
  25. package/dist/rolldown-runtime-DOYBPklu.mjs +1 -0
  26. package/dist/runtime.d.mts +20 -2
  27. package/dist/runtime.mjs +1 -1
  28. package/dist/session-BEKj0yLA.mjs +1 -0
  29. package/dist/{terminal-cbye9mKF.mjs → terminal-Dws_b5UK.mjs} +1 -1
  30. package/dist/test-prompter-euLYzWWO.mjs +1 -0
  31. package/dist/testkit.d.mts +18 -7
  32. package/dist/testkit.mjs +1 -1
  33. package/dist/version.d.mts +1 -3
  34. package/dist/version.mjs +1 -1
  35. package/dreamcli.schema.json +151 -2
  36. package/package.json +11 -11
  37. package/skills/cli-creation/SKILL.md +1 -1
  38. package/dist/adapter-DsmEc0WO.d.mts +0 -285
  39. package/dist/completion-BYhuYn2Q.mjs +0 -6
  40. package/dist/config-BgJZ-X4r.mjs +0 -1
  41. package/dist/core-B4Twhd48.mjs +0 -18
  42. package/dist/json-schema-DVyfq4bA.mjs +0 -52
  43. package/dist/rolldown-runtime-G4Kt5YOX.mjs +0 -1
  44. package/dist/session-CQsnVijE.mjs +0 -1
  45. package/dist/test-prompter-Ddkt9n5A.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -1,12 +1,34 @@
1
- import { $ as ArgDefinitionOverrides, $t as StringElementConfig, A as Out, An as PasswordPromptConfig, At as BooleanFlagDefinition, B as MiddlewareHandler, Bn as HelpTheme, Bt as FlagDefinitionByKind, Cn as StandardSchemaV1Props, Ct as SourceSplitBinding, D as InteractiveParams, Dn as ConfirmPromptConfig, Dt as SplitPolicy, En as StandardSchemaV1Types, Et as SplitOptions, F as InputSources, Fn as SelectChoice, Ft as EnumFlagDefinition, Gn as ProgressOptions, Gt as FlagParseFn, H as middleware, Hn as ActivityEvent, Ht as FlagFactory, I as ResolutionProvenance, In as SelectPromptConfig, It as FlagBuilder, J as ArgConfig, Jn as TableColumn, Jt as InferFlag, K as Verbosity, Kn as SpinnerHandle, Kt as FlagPresence, L as SourcesOf, Ln as NumberConstraintViolation, Lt as FlagConfig, M as createCommandSchema, Mn as PromptConfigBase, Mt as CustomFlagDefinition, N as group, Nn as PromptKind, Nt as DefaultValueOptions, O as InteractiveResolver, On as InputPromptConfig, Ot as SplitSetting, P as resolveExampleCommand, Pn as PromptResult, Pt as DuplicatePolicy, Q as ArgDefinitionByKind, Qt as ResolvedValue, R as wasExplicit, Rn as NumberConstraints, Rt as FlagDefinition, S as DeriveParams, Sn as StandardSchemaV1PathSegment, St as SPLIT_FORMATS, T as ExampleMeta, Tn as StandardSchemaV1SuccessResult, Tt as SplitFormat, U as Ask, Un as Fallback, Ut as FlagKind, V as MiddlewareParams, Vn as HelpThemeFactory, Vt as FlagDefinitionOverrides, W as InferPrompt, Wn as ProgressHandle, Wt as FlagNegation, X as ArgDefinition, Xn as TableOptions, Xt as KeyValueFlagDefinition, Y as ArgDefaultValue, Yn as TableFormat, Yt as InferFlags, Z as ArgDefinitionBase, Zn as TableStream, Zt as NumberFlagDefinition, _ as CommandDefinition, _n as InferStandardOutput, _t as WithoutArgElementEligibility, a as WriteFn, an as getFlagNegatedName, at as BooleanArgDefinition, b as CommandSchema, bn as StandardSchemaV1Issue, bt as DUPLICATE_KEYS, c as ResolvedMultiselectPromptConfig, cn as PathFlagOptions, ct as InferArg, d as resolvePromptConfig, dn as StringConstraints, dt as NumberArgDefinition, en as StringFlagDefinition, et as ArgFactory, f as ActionHandler, fn as StdinBinding, ft as ResolvedArgValue, g as CommandBuilder, gn as InferStandardInput, gt as WithVariadic, h as CommandArgEntryDefinition, hn as StdinWhen, ht as WithArgPresence, i as createOutput, in as flag, it as ArgSchema, j as command, jn as PromptConfig, jt as CountFlagDefinition, k as InteractiveResult, kn as MultiselectPromptConfig, kt as ArrayFlagDefinition, l as ResolvedPromptConfig, ln as UrlFlagOptions, lt as InferArgs, m as CommandArgEntry, mn as StdinOptions, mt as StringArgElementConfig, n as OutputOptions, nn as WithoutElementEligibility, nt as ArgParseFn, o as PromptEngine, on as DateFlagOptions, ot as CustomArgDefinition, p as ActionParams, pn as StdinConsume, pt as StringArgDefinition, q as ArgBuilder, qn as SpinnerOptions, qt as FlagSchema, rn as createFlagSchema, rt as ArgPresence, s as ReadFn, sn as PathChecks, st as EnumArgDefinition, tn as WithPresence, tt as ArgKind, u as ResolvedSelectPromptConfig, un as StringConstraintViolation, ut as KeyValueArgDefinition, v as CommandExample, vn as StandardSchemaV1, vt as arg, w as ExampleCommand, wn as StandardSchemaV1Result, wt as SplitBinding, x as DeriveHandler, xn as StandardSchemaV1Options, xt as DuplicateKeys, y as CommandMeta, yn as StandardSchemaV1FailureResult, yt as createArgSchema, z as Middleware, zn as HelpDescription, zt as FlagDefinitionBase } from "./index-B6oD4_8b.mjs";
2
- import { A as BuiltinsConfig, C as includesBeforeSeparator, D as BuiltinMode, E as tokenize, O as BuiltinName, S as Token, T as stripBeforeSeparator, _ as ResolutionProvenanceRecord, b as ParseOptions, c as formatHelp, d as CLIPluginHooks, f as PluginCommandContext, g as DeprecationWarning, h as resolve, k as Builtins, l as BeforeParseParams, m as plugin, n as RunResult, p as ResolvedCommandParams, s as HelpOptions, u as CLIPlugin, v as ResolveOptions, w as parse, x as ParseResult, y as ResolveResult } from "./index-B_1Dmsdq.mjs";
3
- import { a as ParseError, c as ValidationError, d as isCLIError, f as isParseError, i as ErrorCode, l as ValidationErrorCode, n as CLIErrorJSON, o as ParseErrorCode, p as isValidationError, r as CLIErrorOptions, s as ParseErrorOptions, t as CLIError, u as ValidationErrorOptions } from "./index-B3_9MlHz.mjs";
4
- import { C as SHELLS, S as HelpLinks, T as CompletionOptions, _ as ResolvedManifestSettings, a as CLIRunOptions, b as isMainModule, c as CompletionsFlagConfig, d as DefaultCommandOptions, f as HelpConfig, g as RenderContextOptions, h as RenderContext, i as CLIOptions, l as ConfigSettings, m as ManifestSettings, n as CLIDefinition, o as CLISchema, p as InferNameOption, r as CLIExecuteOptions, s as CompletionRegistrationOptions, t as CLIBuilder, u as ConfigSettingsDefinition, v as cli, w as Shell, x as resolveRenderContext, y as createCLISchema } from "./index-eF7SkQzQ.mjs";
5
- import { n as RuntimeAdapter } from "./adapter-DsmEc0WO.mjs";
6
- import { a as ConfigNotFound, d as PackageRepositoryUrlOptions, g as PackageRepository, h as PackageJsonData, i as ConfigFound, m as PackageJsonAdapter, n as ConfigDiscoveryOptions, o as ConfigSearchPathOptions, p as ManifestDiscoveryOptions, r as ConfigDiscoveryResult, s as FormatLoader, t as ConfigAdapter } from "./index-Cj7kXwQH.mjs";
7
- import { D as DEFINITION_SCHEMA_URL, O as DEFINITION_SCHEMA_VERSION, S as StdinBindingFragmentV1, _ as JsonSchemaOptions, a as CommandDefinitionFragmentV1, b as SourceSplitFragmentV1, c as ExampleDefinitionFragmentV1, d as FlagNegationFragmentV1, f as FlagPathChecksFragmentV1, g as InputSchemaProperty, h as InputSchemaDocument, i as CommandDefinitionDocumentV1, l as FlagDefinitionFragmentV1, m as InputSchemaBranch, n as ArgElementFragmentV1, o as DefinitionDocument, p as FlagStringConstraintsFragmentV1, r as CommandDefinitionDocument, s as DefinitionDocumentV1, t as ArgDefinitionFragmentV1, u as FlagElementFragmentV1, v as PromptChoiceFragmentV1, x as SplitPolicyFragmentV1, y as PromptDefinitionFragmentV1 } from "./index-C5CYWtxn.mjs";
1
+ /**
2
+ * DreamCLI — Schema-first, fully typed TypeScript CLI framework.
3
+ *
4
+ * Start here for most applications:
5
+ * - {@link cli} to define a program
6
+ * - {@link command} to define commands and groups
7
+ * - {@link flag} and {@link arg} to describe inputs
8
+ *
9
+ * This root entrypoint also re-exports lower-level building blocks such as
10
+ * parsing, resolution, and help formatting. Those are useful for advanced
11
+ * integrations, custom tooling, or focused tests, but they are not the
12
+ * typical starting point for application code.
13
+ *
14
+ * Optional features live on their own subpaths and the builder loads them on
15
+ * demand: completion scripts (`@kjanat/dreamcli/completion`), definition and
16
+ * input schemas (`@kjanat/dreamcli/json-schema`), config and manifest
17
+ * discovery (`@kjanat/dreamcli/config`), and the terminal prompter
18
+ * (`@kjanat/dreamcli/prompt`). Test utilities (runCommand,
19
+ * createCaptureOutput, createTestPrompter, etc.) are available from
20
+ * `@kjanat/dreamcli/testkit`. Runtime adapters (createAdapter,
21
+ * RuntimeAdapter, etc.) are available from `@kjanat/dreamcli/runtime`.
22
+ *
23
+ * @module @kjanat/dreamcli
24
+ */
25
+ import { C as SHELLS, S as HelpLinks, T as CompletionOptions, _ as ResolvedManifestSettings, a as CLIRunOptions, b as isMainModule, c as CompletionsFlagConfig, d as DefaultCommandOptions, f as HelpConfig, g as RenderContextOptions, h as RenderContext, i as CLIOptions, l as ConfigSettings, m as ManifestSettings, n as CLIDefinition, o as CLISchema, p as InferNameOption, r as CLIExecuteOptions, s as CompletionRegistrationOptions, t as CLIBuilder, u as ConfigSettingsDefinition, v as cli, w as Shell, x as resolveRenderContext, y as createCLISchema } from "./index-Vjl2_m23.mjs";
26
+ import { a as ConfigNotFound, d as PackageRepositoryUrlOptions, g as PackageRepository, h as PackageJsonData, i as ConfigFound, m as PackageJsonAdapter, n as ConfigDiscoveryOptions, o as ConfigSearchPathOptions, p as ManifestDiscoveryOptions, r as ConfigDiscoveryResult, s as FormatLoader, t as ConfigAdapter } from "./index-DIWRV_wp.mjs";
27
+ import { a as ParseError, c as ValidationError, d as isCLIError, f as isParseError, i as ErrorCode, l as ValidationErrorCode, n as CLIErrorJSON, o as ParseErrorCode, p as isValidationError, r as CLIErrorOptions, s as ParseErrorOptions, t as CLIError, u as ValidationErrorOptions } from "./index-D683D09G.mjs";
28
+ import { A as Builtins, C as Token, D as tokenize, E as stripBeforeSeparator, O as BuiltinMode, S as ParseResult, T as parse, _ as ResolutionProvenanceRecord, b as SkippedPathCheck, c as formatHelp, d as CLIPluginHooks, f as PluginCommandContext, g as DeprecationWarning, h as resolve, j as BuiltinsConfig, k as BuiltinName, l as BeforeParseParams, m as plugin, n as RunResult, p as ResolvedCommandParams, s as HelpOptions, u as CLIPlugin, v as ResolveOptions, w as includesBeforeSeparator, x as ParseOptions, y as ResolveResult } from "./index-DDhRLoTu.mjs";
29
+ import { C as StdinBindingFragmentV1, O as DEFINITION_SCHEMA_URL, S as SplitPolicyFragmentV1, _ as InputSchemaProperty, a as CommandDefinitionFragmentV1, b as PromptDefinitionFragmentV1, c as EnvIndexedFragmentV1, d as FlagElementFragmentV1, f as FlagNegationFragmentV1, g as InputSchemaDocument, h as InputSchemaBranch, i as CommandDefinitionDocumentV1, k as DEFINITION_SCHEMA_VERSION, l as ExampleDefinitionFragmentV1, m as FlagStringConstraintsFragmentV1, n as ArgElementFragmentV1, o as DefinitionDocument, p as FlagPathChecksFragmentV1, r as CommandDefinitionDocument, s as DefinitionDocumentV1, t as ArgDefinitionFragmentV1, u as FlagDefinitionFragmentV1, v as JsonSchemaOptions, x as SourceSplitFragmentV1, y as PromptChoiceFragmentV1 } from "./index-CLtWJqwn.mjs";
30
+ import { $ as ArgConfig, $n as ActivityEvent, $t as InferFlag, A as ExampleMeta, An as StandardSchemaV1SuccessResult, At as SplitFormat, B as InputSources, Bn as SelectChoice, Bt as EnumFlagDefinition, C as CommandExample, Cn as StandardSchemaV1, Ct as arg, D as DeriveParams, Dn as StandardSchemaV1PathSegment, Dt as SPLIT_FORMATS, E as DeriveHandler, En as StandardSchemaV1Options, Et as DuplicateKeys, F as Out, Fn as PasswordPromptConfig, Ft as BooleanFlagDefinition, G as MiddlewareHandler, Gn as IndexedEnvBinding, Gt as FlagDefinitionByKind, H as SourcesOf, Hn as NumberConstraintViolation, Ht as FlagConfig, I as command, In as PromptConfig, It as CountFlagDefinition, J as Ask, Jn as CompletionContext, Jt as FlagKind, K as MiddlewareParams, Kn as IndexedRecordEnvBinding, Kt as FlagDefinitionOverrides, L as createCommandSchema, Ln as PromptConfigBase, Lt as CustomFlagDefinition, M as InteractiveParams, Mn as ConfirmPromptConfig, Mt as SplitPolicy, N as InteractiveResolver, Nn as InputPromptConfig, Nt as SplitSetting, On as StandardSchemaV1Props, Ot as SourceSplitBinding, P as InteractiveResult, Pn as MultiselectPromptConfig, Pt as ArrayFlagDefinition, Q as ArgBuilder, Qn as HelpThemeFactory, Qt as FlagSchema, R as group, Rn as PromptKind, Rt as DefaultValueOptions, S as CommandDefinition, Sn as InferStandardOutput, St as WithoutArgElementEligibility, T as CommandSchema, Tn as StandardSchemaV1Issue, Tt as DUPLICATE_KEYS, U as wasExplicit, Un as NumberConstraints, Ut as FlagDefinition, V as ResolutionProvenance, Vn as SelectPromptConfig, Vt as FlagBuilder, W as Middleware, Wn as EnvOptions, Wt as FlagDefinitionBase, Xn as HelpDescription, Xt as FlagParseFn, Y as InferPrompt, Yn as CompletionHandler, Yt as FlagNegation, Z as Verbosity, Zn as HelpTheme, Zt as FlagPresence, _ as ActionHandler, _n as StdinBinding, _t as ResolvedArgValue, a as WriteFn, an as StringFlagDefinition, ar as TableColumn, at as ArgFactory, b as CommandArgEntryDefinition, bn as StdinWhen, bt as WithArgPresence, cn as createFlagSchema, cr as TableStream, ct as ArgPresence, d as PromptEngine, dn as DateFlagOptions, dt as CustomArgDefinition, en as InferFlags, er as Fallback, et as ArgDefaultValue, f as ReadFn, fn as PathChecks, ft as EnumArgDefinition, g as resolvePromptConfig, gn as StringConstraints, gt as NumberArgDefinition, h as ResolvedSelectPromptConfig, hn as StringConstraintViolation, ht as KeyValueArgDefinition, i as createOutput, in as StringElementConfig, ir as SpinnerOptions, it as ArgDefinitionOverrides, jn as StandardSchemaV1Types, jt as SplitOptions, k as ExampleCommand, kn as StandardSchemaV1Result, kt as SplitBinding, ln as flag, lt as ArgSchema, m as ResolvedPromptConfig, mn as UrlFlagOptions, mt as InferArgs, n as OutputOptions, nn as NumberFlagDefinition, nr as ProgressOptions, nt as ArgDefinitionBase, on as WithPresence, or as TableFormat, ot as ArgKind, p as ResolvedMultiselectPromptConfig, pn as PathFlagOptions, pt as InferArg, q as middleware, qn as IndexedValueEnvBinding, qt as FlagFactory, rn as ResolvedValue, rr as SpinnerHandle, rt as ArgDefinitionByKind, s as RuntimeAdapter, sn as WithoutElementEligibility, sr as TableOptions, st as ArgParseFn, tn as KeyValueFlagDefinition, tr as ProgressHandle, tt as ArgDefinition, un as getFlagNegatedName, ut as BooleanArgDefinition, v as ActionParams, vn as StdinConsume, vt as StringArgDefinition, w as CommandMeta, wn as StandardSchemaV1FailureResult, wt as createArgSchema, x as CommandBuilder, xn as InferStandardInput, xt as WithVariadic, y as CommandArgEntry, yn as StdinOptions, yt as StringArgElementConfig, z as resolveExampleCommand, zn as PromptResult, zt as DuplicatePolicy } from "./index-CuhI1Ynv.mjs";
8
31
  import { Colors } from "ansispeck";
9
- //#region src/core/help/ansi.d.ts
10
32
  /**
11
33
  * Measure the visible column width of `text`, ignoring ANSI/OSC escapes.
12
34
  *
@@ -45,8 +67,6 @@ declare function visibleWidth(text: string): number;
45
67
  * ```
46
68
  */
47
69
  declare function osc8(url: string | URL, text?: string): string;
48
- //#endregion
49
- //#region src/core/read-flags/index.d.ts
50
70
  /**
51
71
  * A record of flag definitions keyed by canonical flag name.
52
72
  *
@@ -102,6 +122,16 @@ interface ReadFlagsOptions<F extends FlagMap = FlagMap> extends ResolveOptions {
102
122
  * @defaultValue `'on'`
103
123
  */
104
124
  readonly help?: 'on' | 'off';
125
+ /**
126
+ * Spelling of long flag names, aliases, and negations in generated help.
127
+ *
128
+ * `'kebab'` shows `--wasm-path` for a definition keyed `wasmPath`, which
129
+ * still resolves as `wasmPath`. A spelling stays as declared when the
130
+ * parser would not accept its kebab form for the same flag, such as with
131
+ * `parse: { caseParity: false }`.
132
+ * @defaultValue `'declared'`
133
+ */
134
+ readonly flagSpelling?: 'declared' | 'kebab';
105
135
  /**
106
136
  * Receiver for notices produced by `.deprecated()` flags.
107
137
  * @defaultValue `undefined`, which drops the notices
@@ -188,5 +218,4 @@ interface ReadFlagsOptions<F extends FlagMap = FlagMap> extends ResolveOptions {
188
218
  * ```
189
219
  */
190
220
  declare function readFlags<const F extends FlagMap>(definitions: F, options?: ReadFlagsOptions<F>): Promise<InferFlags<F>>;
191
- //#endregion
192
- export { type ActionHandler, type ActionParams, type ActivityEvent, ArgBuilder, type ArgConfig, type ArgDefaultValue, type ArgDefinition, type ArgDefinitionBase, type ArgDefinitionByKind, type ArgDefinitionFragmentV1, type ArgDefinitionOverrides, type ArgElementFragmentV1, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type ArrayFlagDefinition, type Ask, type BeforeParseParams, type BooleanArgDefinition, type BooleanFlagDefinition, type BuiltinMode, type BuiltinName, type Builtins, type BuiltinsConfig, CLIBuilder, type CLIDefinition, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIExecuteOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, type CommandArgEntryDefinition, CommandBuilder, type CommandDefinition, type CommandDefinitionDocument, type CommandDefinitionDocumentV1, type CommandDefinitionFragmentV1, type CommandExample, type CommandMeta, type CommandSchema, type CompletionOptions, type CompletionRegistrationOptions, type CompletionsFlagConfig, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSearchPathOptions, type ConfigSettings, type ConfigSettingsDefinition, type ConfirmPromptConfig, type CountFlagDefinition, type CustomArgDefinition, type CustomFlagDefinition, DEFINITION_SCHEMA_URL, DEFINITION_SCHEMA_VERSION, DUPLICATE_KEYS, type DateFlagOptions, type DefaultCommandOptions, type DefaultValueOptions, type DefinitionDocument, type DefinitionDocumentV1, type DeprecationWarning, type DeriveHandler, type DeriveParams, type DuplicateKeys, type DuplicatePolicy, type EnumArgDefinition, type EnumFlagDefinition, type ErrorCode, type ExampleCommand, type ExampleDefinitionFragmentV1, type ExampleMeta, type Fallback, FlagBuilder, type FlagConfig, type FlagDefinition, type FlagDefinitionBase, type FlagDefinitionByKind, type FlagDefinitionFragmentV1, type FlagDefinitionOverrides, type FlagElementFragmentV1, type FlagFactory, type FlagKind, type FlagMap, type FlagNegation, type FlagNegationFragmentV1, type FlagParseFn, type FlagPathChecksFragmentV1, type FlagPresence, type FlagSchema, type FlagStringConstraintsFragmentV1, type FormatLoader, type HelpConfig, type HelpDescription, type HelpLinks, type HelpOptions, type HelpTheme, type HelpThemeFactory, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InferPrompt, type InferStandardInput, type InferStandardOutput, type InputPromptConfig, type InputSchemaBranch, type InputSchemaDocument, type InputSchemaProperty, type InputSources, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type KeyValueArgDefinition, type KeyValueFlagDefinition, type ManifestDiscoveryOptions, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberArgDefinition, type NumberConstraintViolation, type NumberConstraints, type NumberFlagDefinition, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageRepository, type PackageRepositoryUrlOptions, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseOptions, type ParseResult, type PasswordPromptConfig, type PathChecks, type PathFlagOptions, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptChoiceFragmentV1, type PromptConfig, type PromptConfigBase, type PromptDefinitionFragmentV1, type PromptEngine, type PromptKind, type PromptResult, type ReadFlagsOptions, type ReadFn, type RenderContext, type RenderContextOptions, type ResolutionProvenance, type ResolutionProvenanceRecord, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, SPLIT_FORMATS, type SelectChoice, type SelectPromptConfig, type Shell, type SourceSplitBinding, type SourceSplitFragmentV1, type SourcesOf, type SpinnerHandle, type SpinnerOptions, type SplitBinding, type SplitFormat, type SplitOptions, type SplitPolicy, type SplitPolicyFragmentV1, type SplitSetting, type StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, type StdinBinding, type StdinBindingFragmentV1, type StdinConsume, type StdinOptions, type StdinWhen, type StringArgDefinition, type StringArgElementConfig, type StringConstraintViolation, type StringConstraints, type StringElementConfig, type StringFlagDefinition, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, type UrlFlagOptions, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WithoutArgElementEligibility, type WithoutElementEligibility, type WriteFn, arg, cli, command, createArgSchema, createCLISchema, createCommandSchema, createFlagSchema, createOutput, flag, formatHelp, getFlagNegatedName, group, includesBeforeSeparator, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, parse, plugin, readFlags, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, tokenize, visibleWidth, wasExplicit };
221
+ export { type ActionHandler, type ActionParams, type ActivityEvent, ArgBuilder, type ArgConfig, type ArgDefaultValue, type ArgDefinition, type ArgDefinitionBase, type ArgDefinitionByKind, type ArgDefinitionFragmentV1, type ArgDefinitionOverrides, type ArgElementFragmentV1, type ArgFactory, type ArgKind, type ArgParseFn, type ArgPresence, type ArgSchema, type ArrayFlagDefinition, type Ask, type BeforeParseParams, type BooleanArgDefinition, type BooleanFlagDefinition, type BuiltinMode, type BuiltinName, type Builtins, type BuiltinsConfig, CLIBuilder, type CLIDefinition, CLIError, type CLIErrorJSON, type CLIErrorOptions, type CLIExecuteOptions, type CLIOptions, type CLIPlugin, type CLIPluginHooks, type CLIRunOptions, type CLISchema, type Colors, type CommandArgEntry, type CommandArgEntryDefinition, CommandBuilder, type CommandDefinition, type CommandDefinitionDocument, type CommandDefinitionDocumentV1, type CommandDefinitionFragmentV1, type CommandExample, type CommandMeta, type CommandSchema, type CompletionContext, type CompletionHandler, type CompletionOptions, type CompletionRegistrationOptions, type CompletionsFlagConfig, type ConfigAdapter, type ConfigDiscoveryOptions, type ConfigDiscoveryResult, type ConfigFound, type ConfigNotFound, type ConfigSearchPathOptions, type ConfigSettings, type ConfigSettingsDefinition, type ConfirmPromptConfig, type CountFlagDefinition, type CustomArgDefinition, type CustomFlagDefinition, DEFINITION_SCHEMA_URL, DEFINITION_SCHEMA_VERSION, DUPLICATE_KEYS, type DateFlagOptions, type DefaultCommandOptions, type DefaultValueOptions, type DefinitionDocument, type DefinitionDocumentV1, type DeprecationWarning, type DeriveHandler, type DeriveParams, type DuplicateKeys, type DuplicatePolicy, type EnumArgDefinition, type EnumFlagDefinition, type EnvIndexedFragmentV1, type EnvOptions, type ErrorCode, type ExampleCommand, type ExampleDefinitionFragmentV1, type ExampleMeta, type Fallback, FlagBuilder, type FlagConfig, type FlagDefinition, type FlagDefinitionBase, type FlagDefinitionByKind, type FlagDefinitionFragmentV1, type FlagDefinitionOverrides, type FlagElementFragmentV1, type FlagFactory, type FlagKind, type FlagMap, type FlagNegation, type FlagNegationFragmentV1, type FlagParseFn, type FlagPathChecksFragmentV1, type FlagPresence, type FlagSchema, type FlagStringConstraintsFragmentV1, type FormatLoader, type HelpConfig, type HelpDescription, type HelpLinks, type HelpOptions, type HelpTheme, type HelpThemeFactory, type IndexedEnvBinding, type IndexedRecordEnvBinding, type IndexedValueEnvBinding, type InferArg, type InferArgs, type InferFlag, type InferFlags, type InferNameOption, type InferPrompt, type InferStandardInput, type InferStandardOutput, type InputPromptConfig, type InputSchemaBranch, type InputSchemaDocument, type InputSchemaProperty, type InputSources, type InteractiveParams, type InteractiveResolver, type InteractiveResult, type JsonSchemaOptions, type KeyValueArgDefinition, type KeyValueFlagDefinition, type ManifestDiscoveryOptions, type ManifestSettings, type Middleware, type MiddlewareHandler, type MiddlewareParams, type MultiselectPromptConfig, type NumberArgDefinition, type NumberConstraintViolation, type NumberConstraints, type NumberFlagDefinition, type Out, type OutputOptions, type PackageJsonAdapter, type PackageJsonData, type PackageRepository, type PackageRepositoryUrlOptions, ParseError, type ParseErrorCode, type ParseErrorOptions, type ParseOptions, type ParseResult, type PasswordPromptConfig, type PathChecks, type PathFlagOptions, type PluginCommandContext, type ProgressHandle, type ProgressOptions, type PromptChoiceFragmentV1, type PromptConfig, type PromptConfigBase, type PromptDefinitionFragmentV1, type PromptEngine, type PromptKind, type PromptResult, type ReadFlagsOptions, type ReadFn, type RenderContext, type RenderContextOptions, type ResolutionProvenance, type ResolutionProvenanceRecord, type ResolveOptions, type ResolveResult, type ResolvedArgValue, type ResolvedCommandParams, type ResolvedManifestSettings, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type ResolvedValue, type RunResult, SHELLS, SPLIT_FORMATS, type SelectChoice, type SelectPromptConfig, type Shell, type SkippedPathCheck, type SourceSplitBinding, type SourceSplitFragmentV1, type SourcesOf, type SpinnerHandle, type SpinnerOptions, type SplitBinding, type SplitFormat, type SplitOptions, type SplitPolicy, type SplitPolicyFragmentV1, type SplitSetting, type StandardSchemaV1, type StandardSchemaV1FailureResult, type StandardSchemaV1Issue, type StandardSchemaV1Options, type StandardSchemaV1PathSegment, type StandardSchemaV1Props, type StandardSchemaV1Result, type StandardSchemaV1SuccessResult, type StandardSchemaV1Types, type StdinBinding, type StdinBindingFragmentV1, type StdinConsume, type StdinOptions, type StdinWhen, type StringArgDefinition, type StringArgElementConfig, type StringConstraintViolation, type StringConstraints, type StringElementConfig, type StringFlagDefinition, type TableColumn, type TableFormat, type TableOptions, type TableStream, type Token, type UrlFlagOptions, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, type Verbosity, type WithArgPresence, type WithPresence, type WithVariadic, type WithoutArgElementEligibility, type WithoutElementEligibility, type WriteFn, arg, cli, command, createArgSchema, createCLISchema, createCommandSchema, createFlagSchema, createOutput, flag, formatHelp, getFlagNegatedName, group, includesBeforeSeparator, isCLIError, isMainModule, isParseError, isValidationError, middleware, osc8, parse, plugin, readFlags, resolve, resolveExampleCommand, resolvePromptConfig, resolveRenderContext, stripBeforeSeparator, tokenize, visibleWidth, wasExplicit };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{Y as ArgBuilder,s as CLIBuilder,tt as CLIError,z as CommandBuilder,a as DEFINITION_SCHEMA_URL,o as DEFINITION_SCHEMA_VERSION,Q as DUPLICATE_KEYS,W as FlagBuilder,nt as ParseError,st as SHELLS,$ as SPLIT_FORMATS,rt as ValidationError,X as arg,c as cli,B as command,Z as createArgSchema,l as createCLISchema,V as createCommandSchema,G as createFlagSchema,P as createOutput,K as flag,F as formatHelp,J as getFlagNegatedName,H as group,D as includesBeforeSeparator,it as isCLIError,u as isMainModule,at as isParseError,ot as isValidationError,M as middleware,L as osc8,O as parse,p as plugin,i as readFlags,C as resolve,U as resolveExampleCommand,w as resolvePromptConfig,d as resolveRenderContext,k as stripBeforeSeparator,A as tokenize,R as visibleWidth,j as wasExplicit}from"./core-B4Twhd48.mjs";
1
+ export{Z as ArgBuilder,s as CLIBuilder,pt as CLIError,K as CommandBuilder,a as DEFINITION_SCHEMA_URL,o as DEFINITION_SCHEMA_VERSION,ot as DUPLICATE_KEYS,et as FlagBuilder,mt as ParseError,yt as SHELLS,st as SPLIT_FORMATS,ht as ValidationError,Q as arg,c as cli,q as command,$ as createArgSchema,l as createCLISchema,J as createCommandSchema,tt as createFlagSchema,N as createOutput,nt as flag,P as formatHelp,it as getFlagNegatedName,Y as group,B as includesBeforeSeparator,gt as isCLIError,u as isMainModule,_t as isParseError,vt as isValidationError,G as middleware,I as osc8,V as parse,m as plugin,i as readFlags,k as resolve,X as resolveExampleCommand,A as resolvePromptConfig,d as resolveRenderContext,H as stripBeforeSeparator,U as tokenize,L as visibleWidth,W as wasExplicit}from"./core-BZx351-p.mjs";
@@ -0,0 +1,59 @@
1
+ import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{F as resolvePlainHelpDescription,X as resolveExampleCommand,a as DEFINITION_SCHEMA_URL,ot as DUPLICATE_KEYS,rt as getFlagAliasNames}from"./core-BZx351-p.mjs";const definitionMetaSchemaDescriptions={root:{description:`Runtime descriptor for the CLI program.
2
+
3
+ Stores the program name, version, description, and registered command schemas.\\
4
+ Sealed by createCLISchema and rebuilt by each CLIBuilder step.`,properties:{name:{description:`Program name (used in help text, usage lines, and completion scripts).`},version:{description:"Program version (shown by `--version`)."},description:{description:`Program description (shown in root help).`},envPrefix:{description:"CLI-wide environment namespace prepended to every relative env binding\n(`undefined` when none is set). `.env('TOKEN')` reads `<envPrefix>TOKEN`;\na binding declared with `{ absolute: true }` is read as written.\n\nSet via the .envPrefix() builder method\nor the `envPrefix` field of CLIDefinition. Fixed when declared, so\nneither manifest name inference nor an inherited invocation name changes it."},defaultCommand:{description:`Schema of the default command dispatched when no subcommand matches.
5
+
6
+ When set, the CLI root behaves like a hybrid command group: subcommands
7
+ dispatch by name as usual, but empty argv or flags-only argv falls
8
+ through to this command instead of showing root help.
9
+
10
+ Set via the .default() builder method
11
+ or the \`defaultCommand\` field of CLIDefinition.`},commands:{description:`Schemas of the registered commands, in registration order.`}}},defs:{command:{description:`Runtime descriptor produced by CommandBuilder.
12
+
13
+ Consumers (parser, help generator, CLI dispatcher) read this to
14
+ understand the command's shape — flags, args, aliases, subcommands,
15
+ and interactive resolver.`,properties:{name:{description:"The command name (used for dispatch, e.g. `'deploy'`)."},description:{description:`Human-readable description for help text.`},details:{description:`Longer explanation shown only in this command's help, with paragraphs wrapped to its width.`},aliases:{description:`Alternative names for this command.`},hidden:{description:`Whether this command is hidden from help listings.`},examples:{description:`Usage examples for help text.`},flags:{description:`Named flag schemas, keyed by flag name.`},args:{description:`Ordered positional arg entries (name + schema).`},commands:{description:"Nested subcommand schemas (for help rendering and completion).\n\nPure data — no execution closures. Populated by `.command()` on\n`CommandBuilder`. Empty for leaf commands."}}},commandDocument:{description:`A single-command definition document, version 1.
16
+
17
+ Produced by generateCommandSchema. Same shape as a
18
+ CommandDefinitionFragmentV1 plus the \`schemaVersion\` every standalone
19
+ document carries.`,properties:{schemaVersion:{description:"Version of the definition document format emitted by `generateSchema()`\nand `generateCommandSchema()` from `@kjanat/dreamcli/json-schema`."},envPrefix:{description:"CLI-wide environment namespace prepended to every relative env binding\n(`undefined` when none is set). `.env('TOKEN')` reads `<envPrefix>TOKEN`;\na binding declared with `{ absolute: true }` is read as written.\n\nSet via the .envPrefix() builder method\nor the `envPrefix` field of CLIDefinition. Fixed when declared, so\nneither manifest name inference nor an inherited invocation name changes it."},name:{description:`The command name used for dispatch.`},description:{description:`Human-readable description for help text.`},details:{description:`Longer explanation shown only in this command's help.`},aliases:{description:`Alternative names accepted for this command.`},hidden:{description:`Whether the command is omitted from help listings.`},examples:{description:`Usage examples attached to the command.`},flags:{description:`Named flag definitions keyed by flag name.`},args:{description:`Positional argument definitions in CLI order.`},commands:{description:`Nested subcommand definitions.`}}},flag:{description:`The runtime descriptor stored inside every FlagBuilder. Consumers (parser,
20
+ help generator, resolution chain) read this to understand the flag's shape
21
+ without touching generics.`,properties:{kind:{description:`What kind of value this flag accepts.`},presence:{description:"Presence describes whether a flag value is guaranteed to exist when the\naction handler runs:\n\n- `'optional'` — not required; unresolved value follows the kind-specific\n optional fallback (`undefined` for most flags, `[]` for arrays)\n- `'required'` — must be supplied; error if missing\n- `'defaulted'` — always present (falls back to default value)"},defaultValue:{description:`Runtime default value (if any).`},aliases:{description:"Short/long aliases (e.g. `[{ name: 'f', hidden: false }]` for `--force`)."},stdin:{description:"Stdin binding set by `.stdin()` (`undefined` when the flag never reads\nstdin). See StdinBinding."},envVar:{description:`Environment variable name for v0.2+ resolution.`},envIndexed:{description:"Indexed environment family read as the env source, set by `.env()` with an\nIndexedEnvBinding (`undefined` otherwise). A flag declares at most\none env source, so this and FlagSchema.envVar are never both set."},envAbsolute:{description:"Whether the env source is read exactly as written, outside the CLI-wide\nnamespace set by `CLIBuilder.envPrefix()` (set by `.env(…, { absolute:\ntrue })`). Applies to FlagSchema.envVar and\nFlagSchema.envIndexed alike.\n\nDefault: `false`"},configPath:{description:"Dotted config path for v0.2+ resolution (e.g. `'deploy.region'`)."},description:{description:`Human-readable description for help text.`},enumValues:{description:"Allowed literal values when `kind === 'enum'`."},elementSchema:{description:"Element schema when `kind === 'array'` or `kind === 'keyValue'`."},prompt:{description:`Interactive prompt configuration for v0.3+ resolution.`},deprecated:{description:"Deprecation marker.\n\n- `undefined` — not deprecated (default)\n- `true` — deprecated with no migration message\n- `string` — deprecated with a reason/migration message\n\nWhen a deprecated flag is used, a warning is emitted to stderr.\nHelp text shows `[deprecated]` or `[deprecated: <reason>]`."},propagate:{description:`Whether this flag propagates to subcommands in nested command trees.
22
+
23
+ When \`true\`, the flag is automatically available to all descendant
24
+ commands. A child command that defines a flag with the same name
25
+ shadows the propagated parent flag.
26
+
27
+ Default: \`false\``},negation:{description:"Negation settings when `kind === 'boolean'` and `.negatable()` was\ncalled (`undefined` otherwise). See FlagNegation."},duplicates:{description:"How repeated CLI occurrences of a singleton flag combine.\n\n- `'last'` — last occurrence wins (matches historic behavior)\n- `'first'` — first occurrence wins; later ones parse but are ignored\n- `'error'` — a second occurrence is a `ParseError` (`DUPLICATE_FLAG`)\n\nApplies to CLI token occurrences only — env/config/prompt/default\nresolution keeps its precedence semantics and never raises duplicates.\nOccurrences are counted per *logical* flag: aliases and the negated\nspelling all count toward the same flag.\n\nDefault: `'last'`"},defaultDescription:{description:"Human-readable replacement for the default value in help, or `false` to\nomit the default annotation."},sensitive:{description:`Whether values from this input must be kept out of user-facing projections.`}}},flagElement:{description:"Element schema when `kind === 'array'` or `kind === 'keyValue'`.",properties:{kind:{description:`What kind of value this flag accepts.`},presence:{description:"Presence describes whether a flag value is guaranteed to exist when the\naction handler runs:\n\n- `'optional'` — not required; unresolved value follows the kind-specific\n optional fallback (`undefined` for most flags, `[]` for arrays)\n- `'required'` — must be supplied; error if missing\n- `'defaulted'` — always present (falls back to default value)"},defaultValue:{description:`Runtime default value (if any).`},aliases:{description:"Short/long aliases (e.g. `[{ name: 'f', hidden: false }]` for `--force`)."},stdin:{description:"Stdin binding set by `.stdin()` (`undefined` when the flag never reads\nstdin). See StdinBinding."},envVar:{description:`Environment variable name for v0.2+ resolution.`},envIndexed:{description:"Indexed environment family read as the env source, set by `.env()` with an\nIndexedEnvBinding (`undefined` otherwise). A flag declares at most\none env source, so this and FlagSchema.envVar are never both set."},envAbsolute:{description:"Whether the env source is read exactly as written, outside the CLI-wide\nnamespace set by `CLIBuilder.envPrefix()` (set by `.env(…, { absolute:\ntrue })`). Applies to FlagSchema.envVar and\nFlagSchema.envIndexed alike.\n\nDefault: `false`"},configPath:{description:"Dotted config path for v0.2+ resolution (e.g. `'deploy.region'`)."},description:{description:`Human-readable description for help text.`},enumValues:{description:"Allowed literal values when `kind === 'enum'`."},elementSchema:{description:"Element schema when `kind === 'array'` or `kind === 'keyValue'`."},prompt:{description:`Interactive prompt configuration for v0.3+ resolution.`},deprecated:{description:"Deprecation marker.\n\n- `undefined` — not deprecated (default)\n- `true` — deprecated with no migration message\n- `string` — deprecated with a reason/migration message\n\nWhen a deprecated flag is used, a warning is emitted to stderr.\nHelp text shows `[deprecated]` or `[deprecated: <reason>]`."},propagate:{description:`Whether this flag propagates to subcommands in nested command trees.
28
+
29
+ When \`true\`, the flag is automatically available to all descendant
30
+ commands. A child command that defines a flag with the same name
31
+ shadows the propagated parent flag.
32
+
33
+ Default: \`false\``},negation:{description:"Negation settings when `kind === 'boolean'` and `.negatable()` was\ncalled (`undefined` otherwise). See FlagNegation."},duplicates:{description:"How repeated CLI occurrences of a singleton flag combine.\n\n- `'last'` — last occurrence wins (matches historic behavior)\n- `'first'` — first occurrence wins; later ones parse but are ignored\n- `'error'` — a second occurrence is a `ParseError` (`DUPLICATE_FLAG`)\n\nApplies to CLI token occurrences only — env/config/prompt/default\nresolution keeps its precedence semantics and never raises duplicates.\nOccurrences are counted per *logical* flag: aliases and the negated\nspelling all count toward the same flag.\n\nDefault: `'last'`"}}},stdin:{description:`The normalized stdin axis of a flag or an arg.`,properties:{when:{description:`When this input reads the stdin stream.`},consume:{description:`Whether this input consumes the stream alone.`},trim:{description:`Whether one trailing line terminator is dropped from a single value.`}}},envIndexed:{description:`A numbered family of environment variables read as one input's env source.
34
+
35
+ Pass it to \`.env()\` in place of a variable name. The count variable decides
36
+ whether the env stage supplied a value at all, and how many entries it owns;
37
+ a declared entry with a missing member is an error, never a fallback to a
38
+ later source.`,properties:{count:{description:`Variable holding how many entries the family declares, as a canonical
39
+ non-negative integer. When it is unset the env source supplies nothing;
40
+ \`0\` supplies an explicit empty list.`},value:{description:"Variable template for one entry, with `{index}` standing for the zero-based index."},fields:{description:"One variable template per record field, each with `{index}` standing for\nthe zero-based index. Every field is required for every declared entry."}}},negation:{description:`Negation settings for a boolean flag (set by \`.negatable()\`).
41
+
42
+ The negated spelling and the positive form are two spellings of ONE
43
+ logical flag: they share duplicate policy, and the last CLI occurrence
44
+ wins across both. The negated spelling is presence-only — \`--no-foo=x\`
45
+ is rejected.`,properties:{alias:{description:"Explicit negated spelling without the `--` prefix (e.g. `'no-sandbox'`).\n`undefined` synthesizes `no-<flagName>` wherever the flag name is known."},hidden:{description:`Hide the negated spelling from help, completions, and suggestions.`}}},arg:{description:`The runtime descriptor stored inside every ArgBuilder. Consumers (parser,
46
+ help generator) read this to understand the arg's shape without touching
47
+ generics.`,properties:{name:{description:`A named positional argument entry in the command schema.
48
+
49
+ Pairs a user-facing arg name with its ArgSchema descriptor.
50
+ The array ordering in CommandSchema.args determines CLI position.`},kind:{description:`What kind of value this arg accepts.`},presence:{description:"Presence describes whether a positional arg is guaranteed to exist when the\naction handler runs:\n\n- `'required'` — must be supplied; error if missing (default)\n- `'optional'` — may be `undefined` if not supplied\n- `'defaulted'` — always present (falls back to default value)"},variadic:{description:`Whether this arg consumes all remaining positionals.`},stdin:{description:"Stdin binding set by `.stdin()` (`undefined` when the arg never reads\nstdin). See StdinBinding."},defaultValue:{description:`Runtime default value (if any).`},defaultDescription:{description:"Human-readable replacement for the default value in help, or `false` to\nomit the default annotation."},sensitive:{description:`Whether values from this input must be kept out of user-facing projections.`},description:{description:`Human-readable description for help text.`},envVar:{description:`Environment variable name for env resolution.
51
+
52
+ When set and the CLI value is absent, the resolver reads this env var
53
+ and coerces the string to the arg's declared kind.`},envIndexed:{description:"Indexed environment family read as the env source, set by `.env()` with an\nIndexedEnvBinding (`undefined` otherwise). An arg declares at most\none env source, so this and ArgSchema.envVar are never both set."},envAbsolute:{description:"Whether the env source is read exactly as written, outside the CLI-wide\nnamespace set by `CLIBuilder.envPrefix()` (set by `.env(…, { absolute:\ntrue })`). Applies to ArgSchema.envVar and\nArgSchema.envIndexed alike.\n\nDefault: `false`"},configPath:{description:"Dotted config path for config resolution (e.g. `'deploy.region'`)."},prompt:{description:`Interactive prompt configuration.`},enumValues:{description:"Allowed literal values when `kind === 'enum'`."},elementSchema:{description:"Element schema when `kind === 'keyValue'`.\n\nDescribes the value of each entry, so `arg.keyValue(arg.number())` decodes\n`A=1` to the number `1`. `undefined` leaves entry values as strings."},deprecated:{description:"Deprecation marker.\n\n- `undefined` — not deprecated (default)\n- `true` — deprecated with no migration message\n- `string` — deprecated with a reason/migration message\n\nWhen a deprecated arg is used, a warning is emitted to stderr.\nHelp text shows `[deprecated]` or `[deprecated: <reason>]`."}}},argElement:{description:"Element schema when `kind === 'keyValue'`.\n\nDescribes the value of each entry, so `arg.keyValue(arg.number())` decodes\n`A=1` to the number `1`. `undefined` leaves entry values as strings.",properties:{kind:{description:`What kind of value this arg accepts.`},presence:{description:`Entry values are required once their containing key-value argument is present.`},enumValues:{description:"Allowed literal values when `kind === 'enum'`."}}},prompt:{description:"Discriminated union of all prompt configurations.\n\nUse the `kind` field to narrow:\n```ts\nif (config.kind === 'select') {\n config.choices // readonly SelectChoice[] | undefined\n}\n```",properties:{kind:{description:"The kind of interactive prompt to present.\n\n- `'confirm'` — yes/no boolean question\n- `'input'` — free-text string input\n- `'password'` — hidden text input, preserving whitespace\n- `'select'` — single selection from a list\n- `'multiselect'` — multiple selections from a list"},message:{description:`The question displayed to the user.`},placeholder:{description:`Placeholder text shown before user types (informational only).`},choices:{description:"Available choices. When omitted for `enum` flags, the enum values\nfrom the flag schema are used automatically."},min:{description:`Minimum number of selections required.
54
+
55
+ Default: \`0\``},max:{description:`Maximum number of selections allowed.
56
+
57
+ Default: \`Infinity\``}}},choice:{description:`A selectable option for SelectPromptConfig and MultiselectPromptConfig prompts.`,properties:{value:{description:`The value returned when this choice is selected.`},label:{description:`Display label shown to the user.
58
+
59
+ Default: value`},description:{description:`Optional description shown alongside the choice.`}}},example:{description:`A single usage example shown in help text.`,properties:{command:{description:"The command invocation (e.g. `'deploy production --force'`)."},description:{description:`Optional description of what this example does.`}}}}};var json_schema_exports=/* @__PURE__ */ __exportAll({generateCommandSchema:()=>generateCommandSchema,generateSchema:()=>generateSchema});function resolveOptions(e){return{includeHidden:e?.includeHidden??!0,includePrompts:e?.includePrompts??!0,envPrefix:e?.envPrefix}}const JSON_SCHEMA_DRAFT=`https://json-schema.org/draft/2020-12/schema`;function generateSchema(e,t,n){let r=resolveOptions(t),i=r.envPrefix??e.envPrefix,a=n??{name:e.name,version:e.version},o=e.defaultCommand!==void 0&&(r.includeHidden||!e.defaultCommand.hidden)?serializeCommand(e.defaultCommand,r,a):void 0;return{$schema:DEFINITION_SCHEMA_URL,schemaVersion:1,name:e.name,...e.version===void 0?{}:{version:e.version},...e.description===void 0?{}:{description:resolvePlainHelpDescription(e.description)},...i===void 0?{}:{envPrefix:i},...o===void 0?{}:{defaultCommand:o},commands:e.commands.filter(e=>r.includeHidden||!e.hidden).map(e=>serializeCommand(e,r,a))}}function generateCommandSchema(e,t,n){let r=n??{name:e.name,version:void 0},i=resolveOptions(t);return{schemaVersion:1,...i.envPrefix===void 0?{}:{envPrefix:i.envPrefix},...serializeCommand(e,i,r)}}function serializeCommand(e,t,n){let r={};for(let[n,i]of Object.entries(e.flags))r[n]=serializeFlag(i,t);return{name:e.name,...e.description===void 0?{}:{description:resolvePlainHelpDescription(e.description)},...e.details===void 0?{}:{details:resolvePlainHelpDescription(e.details)},...e.aliases.length>0?{aliases:[...e.aliases]}:{},...e.hidden?{hidden:!0}:{},...e.examples.length>0?{examples:e.examples.map(e=>serializeExample(e,n))}:{},flags:r,args:e.args.map(e=>serializeArgEntry(e,t)),commands:e.commands.filter(e=>t.includeHidden||!e.hidden).map(e=>serializeCommand(e,t,n))}}function serializeFlag(e,t,n=!1){let r=getFlagAliasNames(e),i=e.stringConstraints,a=e.pathChecks,o=e.negation,s=n||e.sensitive;return{kind:e.kind,presence:e.presence,...!s&&isJsonSerializable(e.defaultValue)?{defaultValue:e.defaultValue}:{},...e.defaultDescription===void 0?{}:{defaultDescription:e.defaultDescription},...e.sensitive?{sensitive:!0}:{},...r.length>0?{aliases:[...r]}:{},...e.stdin===void 0?{}:{stdin:serializeStdin(e.stdin)},...e.envVar===void 0?{}:{envVar:e.envVar},...e.envIndexed===void 0?{}:{envIndexed:serializeEnvIndexed(e.envIndexed)},...e.envAbsolute?{envAbsolute:!0}:{},...e.configPath===void 0?{}:{configPath:e.configPath},...e.description===void 0?{}:{description:resolvePlainHelpDescription(e.description)},...e.enumValues===void 0?{}:{enumValues:[...e.enumValues]},...e.numberConstraints===void 0?{}:{numberConstraints:{...e.numberConstraints}},...i===void 0?{}:{stringConstraints:serializeStringConstraints(i)},...e.elementSchema===void 0?{}:{elementSchema:serializeFlag(e.elementSchema,t,s)},...e.separator===void 0?{}:{separator:e.separator},...e.split===void 0?{}:{split:serializeSplit(e.split)},...e.duplicateKeys===`last`?{}:{duplicateKeys:e.duplicateKeys},...e.unique?{unique:!0}:{},...a===void 0?{}:{pathChecks:serializePathChecks(a)},...e.valueHint===void 0?{}:{valueHint:e.valueHint},...t.includePrompts&&e.prompt!==void 0?{prompt:serializePrompt(e.prompt)}:{},...e.deprecated===void 0?{}:{deprecated:e.deprecated},...e.propagate?{propagate:!0}:{},...o===void 0?{}:{negation:{...o.alias===void 0?{}:{alias:o.alias},...o.hidden?{hidden:!0}:{}}},...e.duplicates===`last`?{}:{duplicates:e.duplicates}}}function serializeStringConstraints(e){let t=e.pattern;return{...e.nonEmpty===void 0?{}:{nonEmpty:e.nonEmpty},...e.minLength===void 0?{}:{minLength:e.minLength},...e.maxLength===void 0?{}:{maxLength:e.maxLength},...t===void 0?{}:{pattern:{source:t.source,flags:t.flags}}}}function serializeEnvIndexed(e){return e.fields===void 0?{count:e.count,value:e.value}:{count:e.count,fields:{...e.fields}}}function serializePathChecks(e){return{mustExist:e.mustExist,...e.type===void 0?{}:{type:e.type},...e.create?{create:!0}:{}}}function serializeArgEntry(e,t){return{name:e.name,...serializeArgValue(e.schema,t)}}function serializeArgValue(e,t){let n=e.stringConstraints,r=e.pathChecks;return{kind:e.kind,presence:e.presence,...e.variadic?{variadic:!0}:{},...e.stdin===void 0?{}:{stdin:serializeStdin(e.stdin)},...!e.sensitive&&isJsonSerializable(e.defaultValue)?{defaultValue:e.defaultValue}:{},...e.defaultDescription===void 0?{}:{defaultDescription:e.defaultDescription},...e.sensitive?{sensitive:!0}:{},...e.description===void 0?{}:{description:resolvePlainHelpDescription(e.description)},...e.envVar===void 0?{}:{envVar:e.envVar},...e.envIndexed===void 0?{}:{envIndexed:serializeEnvIndexed(e.envIndexed)},...e.envAbsolute?{envAbsolute:!0}:{},...e.configPath===void 0?{}:{configPath:e.configPath},...e.enumValues===void 0?{}:{enumValues:[...e.enumValues]},...e.elementSchema===void 0?{}:{elementSchema:serializeArgElementValue(e.elementSchema)},...e.numberConstraints===void 0?{}:{numberConstraints:{...e.numberConstraints}},...n===void 0?{}:{stringConstraints:serializeStringConstraints(n)},...r===void 0?{}:{pathChecks:serializePathChecks(r)},...e.valueHint===void 0?{}:{valueHint:e.valueHint},...e.separator===void 0?{}:{separator:e.separator},...e.split===void 0?{}:{split:serializeSplit(e.split)},...e.duplicateKeys===`last`?{}:{duplicateKeys:e.duplicateKeys},...e.unique?{unique:!0}:{},...t.includePrompts&&e.prompt!==void 0?{prompt:serializePrompt(e.prompt)}:{},...e.deprecated===void 0?{}:{deprecated:e.deprecated}}}function serializeArgElementValue(e){if(e.kind===`keyValue`)throw TypeError(`Arg element schema kind 'keyValue' is not supported`);return{kind:e.kind,presence:`required`,...e.enumValues===void 0?{}:{enumValues:[...e.enumValues]},...e.numberConstraints===void 0?{}:{numberConstraints:{...e.numberConstraints}},...e.stringConstraints===void 0?{}:{stringConstraints:serializeStringConstraints(e.stringConstraints)},...e.pathChecks===void 0?{}:{pathChecks:serializePathChecks(e.pathChecks)},...e.valueHint===void 0?{}:{valueHint:e.valueHint}}}function serializeSplit(e){return{...e.env===void 0?{}:{env:{...e.env}},...e.stdin===void 0?{}:{stdin:{...e.stdin}}}}function serializeStdin(e){return{when:e.when,consume:e.consume,trim:e.trim,...e.argv===!1?{argv:!1}:{}}}function serializePrompt(e){let t={...e.sensitive===!0||e.kind===`password`?{sensitive:!0}:{}};switch(e.kind){case`input`:return{kind:e.kind,message:e.message,...t,...e.empty===void 0?{}:{empty:e.empty},...e.trim===void 0?{}:{trim:e.trim},...e.placeholder===void 0?{}:{placeholder:e.placeholder}};case`password`:return{kind:e.kind,message:e.message,...t,...e.empty===void 0?{}:{empty:e.empty}};case`select`:return{kind:e.kind,message:e.message,...t,...e.choices===void 0?{}:{choices:e.choices.map(serializeChoice)}};case`multiselect`:return{kind:e.kind,message:e.message,...t,...e.choices===void 0?{}:{choices:e.choices.map(serializeChoice)},...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case`confirm`:return{kind:e.kind,message:e.message,...t}}}function serializeChoice(e){return{value:e.value,...e.label===void 0?{}:{label:e.label},...e.description===void 0?{}:{description:e.description}}}function serializeExample(e,t){return{command:resolveExampleCommand(e.command,t),...e.description===void 0?{}:{description:e.description}}}function generateInputSchema(e,t){let n=resolveOptions(t);if(isCommandSchema(e))return{$schema:JSON_SCHEMA_DRAFT,...commandToInputSchema(e)};let r=[];e.defaultCommand!==void 0&&(n.includeHidden||!e.defaultCommand.hidden)&&collectInputBranches(e.defaultCommand,``,r,n);for(let t of e.commands)t!==e.defaultCommand&&t.name!==e.defaultCommand?.name&&(n.includeHidden||!t.hidden)&&collectInputBranches(t,``,r,n);let[i]=r;if(r.length===1&&i!==void 0)return{$schema:JSON_SCHEMA_DRAFT,...stripCommandDiscriminator(i)};if(r.length>0){let t=e.defaultCommand!==void 0&&(n.includeHidden||!e.defaultCommand.hidden)?e.defaultCommand.name:void 0,i=t===void 0?r:r.map(e=>getBranchCommandDiscriminator(e)===t?stripCommandDiscriminator(e):e);return{$schema:JSON_SCHEMA_DRAFT,oneOf:i}}return{$schema:JSON_SCHEMA_DRAFT,type:`object`}}function isCommandSchema(e){return`flags`in e&&`args`in e&&`hasAction`in e}function collectInputBranches(e,t,n,r){let i=t?`${t}.${e.name}`:e.name;e.hasAction&&n.push(commandToInputSchema(e,i));for(let t of e.commands)(r.includeHidden||!t.hidden)&&collectInputBranches(t,i,n,r)}function commandToInputSchema(e,t){let n={},r=[];t!==void 0&&(n.command={const:t},r.push(`command`));for(let[t,i]of Object.entries(e.flags))n[t]=flagToJsonSchemaType(i),i.presence===`required`&&r.push(t);for(let t of e.args)n[t.name]=argToJsonSchemaType(t.schema),t.schema.presence===`required`&&r.push(t.name);return{type:`object`,properties:n,additionalProperties:!1,...r.length>0?{required:r}:{}}}function stripCommandDiscriminator(e){let{command:t,...n}=e.properties,r=e.required?.filter(e=>e!==`command`);return{type:e.type,properties:n,additionalProperties:e.additionalProperties,...r!==void 0&&r.length>0?{required:r}:{}}}function getBranchCommandDiscriminator(e){let t=e.properties.command;if(t===void 0)return;let n=t.const;return typeof n==`string`?n:void 0}function stringConstraintsToJsonSchemaProperties(e){let t={},n=e?.nonEmpty===!0?Math.max(e.minLength??1,1):e?.minLength;return n!==void 0&&(t.minLength=n),e?.maxLength!==void 0&&(t.maxLength=e.maxLength),e?.pattern!==void 0&&(t.pattern=e.pattern.source),t}function flagToJsonSchemaType(e,t=!1){let n={},r=t||e.sensitive;switch(e.kind){case`string`:n.type=`string`,Object.assign(n,stringConstraintsToJsonSchemaProperties(e.stringConstraints));break;case`number`:{let t=e.numberConstraints;n.type=t?.int===!0?`integer`:`number`,t?.min!==void 0&&(n.minimum=t.min),t?.max!==void 0&&(n.maximum=t.max);break}case`boolean`:n.type=`boolean`;break;case`enum`:n.type=`string`,e.enumValues!==void 0&&(n.enum=[...e.enumValues]);break;case`array`:n.type=`array`,e.elementSchema!==void 0&&(n.items=flagToJsonSchemaType(e.elementSchema,r));break;case`custom`:break;case`count`:n.type=`integer`,n.minimum=0;break;case`keyValue`:n.type=`object`,n.additionalProperties=e.elementSchema===void 0?{type:`string`}:flagToJsonSchemaType(e.elementSchema,r)}return e.description!==void 0&&(n.description=resolvePlainHelpDescription(e.description)),e.sensitive&&(n.writeOnly=!0),!r&&isJsonSerializable(e.defaultValue)&&(n.default=e.defaultValue),e.deprecated!==void 0&&(n.deprecated=e.deprecated),n}function argToJsonSchemaType(e){let t=argKindToType(e),n=e.variadic&&e.kind!==`keyValue`?{type:`array`,items:t}:{...t};return e.description!==void 0&&(n.description=resolvePlainHelpDescription(e.description)),e.sensitive&&(n.writeOnly=!0),!e.sensitive&&isJsonSerializable(e.defaultValue)&&(n.default=e.defaultValue),e.deprecated!==void 0&&(n.deprecated=e.deprecated),n}function argKindToType(e){switch(e.kind){case`string`:return{type:`string`,...stringConstraintsToJsonSchemaProperties(e.stringConstraints)};case`number`:{let t=e.numberConstraints,n={type:t?.int===!0?`integer`:`number`};return t?.min!==void 0&&(n.minimum=t.min),t?.max!==void 0&&(n.maximum=t.max),n}case`enum`:{let t={type:`string`};return e.enumValues!==void 0&&(t.enum=[...e.enumValues]),t}case`boolean`:return{type:`boolean`};case`keyValue`:return{type:`object`,additionalProperties:e.elementSchema===void 0?{type:`string`}:argKindToType(e.elementSchema)};case`custom`:return{}}}function isJsonSerializable(e,t=/* @__PURE__ */ new WeakSet){if(e===void 0)return!1;if(e===null)return!0;let n=typeof e;if(n===`string`||n===`boolean`)return!0;if(n===`number`)return Number.isFinite(e);if(n===`function`||n===`symbol`||n===`bigint`)return!1;if(Array.isArray(e)){if(t.has(e))return!1;t.add(e);try{return e.every(e=>isJsonSerializable(e,t))}finally{t.delete(e)}}if(n===`object`){let n=e;if(!isPlainJsonObject(n)||t.has(n))return!1;t.add(n);try{return Object.values(n).every(e=>isJsonSerializable(e,t))}finally{t.delete(n)}}return!1}function isPlainJsonObject(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function withDefinitionDescriptions(e,t){let n=e.properties,r=typeof n==`object`&&n&&isPlainJsonObject(n)&&t.properties!==void 0?Object.fromEntries(Object.entries(n).map(([e,n])=>{let r=t.properties?.[e];return r===void 0||typeof n!=`object`||!n||!isPlainJsonObject(n)?[e,n]:[e,withDefinitionDescriptions(n,r)]})):void 0;return{...e,...t.description===void 0?{}:{description:t.description},...r===void 0?{}:{properties:r}}}function withDefinitionMetaSchemaDescriptions(e,t){let n=withDefinitionDescriptions(e,t.root),r=n.$defs;return typeof r!=`object`||!r||!isPlainJsonObject(r)?n:{...n,$defs:Object.fromEntries(Object.entries(r).map(([e,n])=>{let r=t.defs[e];return r===void 0||typeof n!=`object`||!n||!isPlainJsonObject(n)?[e,n]:[e,withDefinitionDescriptions(n,r)]}))}}const ENV_PREFIX_PROPERTY={type:`string`,minLength:1,not:{pattern:`[={}]`}},commandFragmentProperties={name:{type:`string`},description:{type:`string`},details:{type:`string`},aliases:{type:`array`,items:{type:`string`}},hidden:{const:!0},examples:{type:`array`,items:{$ref:`#/$defs/example`}},flags:{type:`object`,additionalProperties:{$ref:`#/$defs/flag`}},args:{type:`array`,items:{$ref:`#/$defs/arg`}},commands:{type:`array`,items:{$ref:`#/$defs/command`}}},argValueFragmentProperties={kind:{enum:[`string`,`number`,`boolean`,`enum`,`custom`,`keyValue`]},presence:{enum:[`required`,`optional`,`defaulted`]},variadic:{const:!0},stdin:{$ref:`#/$defs/stdin`},defaultValue:{},defaultDescription:{oneOf:[{type:`string`},{const:!1}]},sensitive:{const:!0},description:{type:`string`},envVar:{type:`string`},envIndexed:{$ref:`#/$defs/envIndexed`},envAbsolute:{const:!0},configPath:{type:`string`},enumValues:{type:`array`,items:{type:`string`}},elementSchema:{$ref:`#/$defs/argElement`},numberConstraints:{$ref:`#/$defs/numberConstraints`},stringConstraints:{$ref:`#/$defs/stringConstraints`},pathChecks:{$ref:`#/$defs/pathChecks`},valueHint:{type:`string`},separator:{type:`string`,minLength:1},split:{$ref:`#/$defs/split`},duplicateKeys:{enum:[...DUPLICATE_KEYS]},unique:{const:!0},prompt:{$ref:`#/$defs/prompt`},deprecated:{oneOf:[{type:`string`},{const:!0}]}},argElementFragmentProperties={kind:{enum:[`string`,`number`,`boolean`,`enum`,`custom`]},presence:{const:`required`},enumValues:{type:`array`,items:{type:`string`}},numberConstraints:{$ref:`#/$defs/numberConstraints`},stringConstraints:{$ref:`#/$defs/stringConstraints`},pathChecks:{$ref:`#/$defs/pathChecks`},valueHint:{type:`string`}},flagElementFragmentProperties={kind:{enum:[`string`,`number`,`boolean`,`enum`,`array`,`custom`,`count`,`keyValue`]},presence:{enum:[`optional`,`required`,`defaulted`]},defaultValue:{},aliases:{type:`array`,items:{type:`string`}},stdin:{$ref:`#/$defs/stdin`},envVar:{type:`string`},envIndexed:{$ref:`#/$defs/envIndexed`},envAbsolute:{const:!0},configPath:{type:`string`},description:{type:`string`},enumValues:{type:`array`,items:{type:`string`}},numberConstraints:{$ref:`#/$defs/numberConstraints`},stringConstraints:{$ref:`#/$defs/stringConstraints`},elementSchema:{$ref:`#/$defs/flagElement`},separator:{type:`string`,minLength:1},split:{$ref:`#/$defs/split`},duplicateKeys:{enum:[...DUPLICATE_KEYS]},unique:{const:!0},pathChecks:{$ref:`#/$defs/pathChecks`},valueHint:{type:`string`},prompt:{$ref:`#/$defs/prompt`},deprecated:{oneOf:[{type:`string`},{const:!0}]},propagate:{const:!0},negation:{$ref:`#/$defs/negation`},duplicates:{enum:[`last`,`first`,`error`]}},flagFragmentProperties={...flagElementFragmentProperties,defaultDescription:{oneOf:[{type:`string`},{const:!1}]},sensitive:{const:!0}},definitionMetaSchema=withDefinitionMetaSchemaDescriptions({$schema:JSON_SCHEMA_DRAFT,$id:DEFINITION_SCHEMA_URL,title:`@kjanat/dreamcli definition schema`,description:`Describes the structure of a CLI built with dreamcli — commands, flags, args, types, constraints, env bindings, and prompts.`,type:`object`,additionalProperties:!1,properties:{$schema:{const:DEFINITION_SCHEMA_URL},schemaVersion:{const:1},name:{type:`string`},version:{type:`string`},description:{type:`string`},envPrefix:ENV_PREFIX_PROPERTY,defaultCommand:{$ref:`#/$defs/command`},commands:{type:`array`,items:{$ref:`#/$defs/command`}}},required:[`$schema`,`schemaVersion`,`name`,`commands`],$defs:{command:{type:`object`,additionalProperties:!1,properties:commandFragmentProperties,required:[`name`,`flags`,`args`,`commands`]},commandDocument:{type:`object`,additionalProperties:!1,properties:{schemaVersion:{const:1},envPrefix:ENV_PREFIX_PROPERTY,...commandFragmentProperties},required:[`schemaVersion`,`name`,`flags`,`args`,`commands`]},flag:{type:`object`,additionalProperties:!1,properties:flagFragmentProperties,required:[`kind`,`presence`],not:{required:[`envVar`,`envIndexed`]},dependentSchemas:{envAbsolute:{$ref:`#/$defs/envBound`}}},flagElement:{type:`object`,additionalProperties:!1,properties:flagElementFragmentProperties,required:[`kind`,`presence`]},envBound:{anyOf:[{required:[`envVar`]},{required:[`envIndexed`]}]},envIndexed:{type:`object`,additionalProperties:!1,properties:{count:{type:`string`,minLength:1,not:{pattern:`[{}=]`}},value:{$ref:`#/$defs/envIndexedTemplate`},fields:{type:`object`,minProperties:1,propertyNames:{minLength:1},additionalProperties:{$ref:`#/$defs/envIndexedTemplate`}}},required:[`count`],oneOf:[{required:[`value`],not:{required:[`fields`]}},{required:[`fields`],not:{required:[`value`]}}]},envIndexedTemplate:{type:`string`,pattern:`\\{index\\}`,not:{pattern:`=`}},stdin:{type:`object`,additionalProperties:!1,properties:{when:{enum:[`dash`,`missing`,`dash-or-missing`]},consume:{enum:[`exclusive`,`broadcast`]},trim:{type:`boolean`},argv:{const:!1}},required:[`when`,`consume`]},split:{type:`object`,additionalProperties:!1,properties:{env:{$ref:`#/$defs/splitPolicy`},stdin:{$ref:`#/$defs/splitPolicy`}}},splitPolicy:{type:`object`,additionalProperties:!1,properties:{format:{enum:[`whole`,`delimiter`,`lines`,`json`]},delimiter:{type:`string`,minLength:1}},required:[`format`],oneOf:[{properties:{format:{const:`delimiter`}},required:[`format`,`delimiter`]},{properties:{format:{enum:[`whole`,`lines`,`json`]}},not:{required:[`delimiter`]}}]},negation:{type:`object`,additionalProperties:!1,properties:{alias:{type:`string`},hidden:{const:!0}}},numberConstraints:{type:`object`,additionalProperties:!1,properties:{min:{type:`number`},max:{type:`number`},int:{type:`boolean`},finite:{type:`boolean`}}},stringConstraints:{type:`object`,additionalProperties:!1,properties:{nonEmpty:{type:`boolean`},minLength:{type:`integer`,minimum:0},maxLength:{type:`integer`,minimum:0},pattern:{type:`object`,additionalProperties:!1,properties:{source:{type:`string`},flags:{type:`string`}},required:[`source`,`flags`]}}},pathChecks:{type:`object`,additionalProperties:!1,properties:{mustExist:{type:`boolean`},type:{enum:[`file`,`directory`]},create:{const:!0}},required:[`mustExist`]},argElement:{type:`object`,additionalProperties:!1,properties:argElementFragmentProperties,required:[`kind`,`presence`]},arg:{type:`object`,additionalProperties:!1,properties:{name:{type:`string`},...argValueFragmentProperties},required:[`name`,`kind`,`presence`],anyOf:[{not:{required:[`elementSchema`]}},{properties:{kind:{const:`keyValue`}},required:[`kind`]}],not:{required:[`envVar`,`envIndexed`]},dependentSchemas:{envAbsolute:{$ref:`#/$defs/envBound`}}},prompt:{type:`object`,additionalProperties:!1,properties:{kind:{enum:[`confirm`,`input`,`password`,`select`,`multiselect`]},message:{type:`string`},placeholder:{type:`string`},trim:{type:`boolean`},empty:{enum:[`skip`,`accept`,`retry`]},sensitive:{const:!0},choices:{type:`array`,items:{$ref:`#/$defs/choice`}},min:{type:`integer`},max:{type:`integer`}},required:[`kind`,`message`]},choice:{type:`object`,additionalProperties:!1,properties:{value:{type:`string`},label:{type:`string`},description:{type:`string`}},required:[`value`]},example:{type:`object`,additionalProperties:!1,properties:{command:{type:`string`},description:{type:`string`}},required:[`command`]}}},definitionMetaSchemaDescriptions);export{json_schema_exports as a,generateSchema as i,generateCommandSchema as n,generateInputSchema as r,definitionMetaSchema as t};
@@ -1,2 +1,10 @@
1
- import { C as definitionMetaSchema, D as DEFINITION_SCHEMA_URL, E as generateSchema, O as DEFINITION_SCHEMA_VERSION, S as StdinBindingFragmentV1, T as generateInputSchema, _ as JsonSchemaOptions, a as CommandDefinitionFragmentV1, b as SourceSplitFragmentV1, c as ExampleDefinitionFragmentV1, d as FlagNegationFragmentV1, f as FlagPathChecksFragmentV1, g as InputSchemaProperty, h as InputSchemaDocument, i as CommandDefinitionDocumentV1, l as FlagDefinitionFragmentV1, m as InputSchemaBranch, n as ArgElementFragmentV1, o as DefinitionDocument, p as FlagStringConstraintsFragmentV1, r as CommandDefinitionDocument, s as DefinitionDocumentV1, t as ArgDefinitionFragmentV1, u as FlagElementFragmentV1, v as PromptChoiceFragmentV1, w as generateCommandSchema, x as SplitPolicyFragmentV1, y as PromptDefinitionFragmentV1 } from "./index-C5CYWtxn.mjs";
2
- export { type ArgDefinitionFragmentV1, type ArgElementFragmentV1, type CommandDefinitionDocument, type CommandDefinitionDocumentV1, type CommandDefinitionFragmentV1, DEFINITION_SCHEMA_URL, DEFINITION_SCHEMA_VERSION, type DefinitionDocument, type DefinitionDocumentV1, type ExampleDefinitionFragmentV1, type FlagDefinitionFragmentV1, type FlagElementFragmentV1, type FlagNegationFragmentV1, type FlagPathChecksFragmentV1, type FlagStringConstraintsFragmentV1, type InputSchemaBranch, type InputSchemaDocument, type InputSchemaProperty, type JsonSchemaOptions, type PromptChoiceFragmentV1, type PromptDefinitionFragmentV1, type SourceSplitFragmentV1, type SplitPolicyFragmentV1, type StdinBindingFragmentV1, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema };
1
+ /**
2
+ * Definition documents and input JSON Schema generation.
3
+ *
4
+ * `--help --json` loads this module on demand. Import it directly to emit
5
+ * definition documents or input schemas from build scripts and tooling.
6
+ *
7
+ * @module @kjanat/dreamcli/json-schema
8
+ */
9
+ import { C as StdinBindingFragmentV1, D as generateSchema, E as generateInputSchema, O as DEFINITION_SCHEMA_URL, S as SplitPolicyFragmentV1, T as generateCommandSchema, _ as InputSchemaProperty, a as CommandDefinitionFragmentV1, b as PromptDefinitionFragmentV1, c as EnvIndexedFragmentV1, d as FlagElementFragmentV1, f as FlagNegationFragmentV1, g as InputSchemaDocument, h as InputSchemaBranch, i as CommandDefinitionDocumentV1, k as DEFINITION_SCHEMA_VERSION, l as ExampleDefinitionFragmentV1, m as FlagStringConstraintsFragmentV1, n as ArgElementFragmentV1, o as DefinitionDocument, p as FlagPathChecksFragmentV1, r as CommandDefinitionDocument, s as DefinitionDocumentV1, t as ArgDefinitionFragmentV1, u as FlagDefinitionFragmentV1, v as JsonSchemaOptions, w as definitionMetaSchema, x as SourceSplitFragmentV1, y as PromptChoiceFragmentV1 } from "./index-CLtWJqwn.mjs";
10
+ export { type ArgDefinitionFragmentV1, type ArgElementFragmentV1, type CommandDefinitionDocument, type CommandDefinitionDocumentV1, type CommandDefinitionFragmentV1, DEFINITION_SCHEMA_URL, DEFINITION_SCHEMA_VERSION, type DefinitionDocument, type DefinitionDocumentV1, type EnvIndexedFragmentV1, type ExampleDefinitionFragmentV1, type FlagDefinitionFragmentV1, type FlagElementFragmentV1, type FlagNegationFragmentV1, type FlagPathChecksFragmentV1, type FlagStringConstraintsFragmentV1, type InputSchemaBranch, type InputSchemaDocument, type InputSchemaProperty, type JsonSchemaOptions, type PromptChoiceFragmentV1, type PromptDefinitionFragmentV1, type SourceSplitFragmentV1, type SplitPolicyFragmentV1, type StdinBindingFragmentV1, definitionMetaSchema, generateCommandSchema, generateInputSchema, generateSchema };
@@ -1 +1 @@
1
- import{a as DEFINITION_SCHEMA_URL,o as DEFINITION_SCHEMA_VERSION}from"./core-B4Twhd48.mjs";import{i as generateSchema,n as generateCommandSchema,r as generateInputSchema,t as definitionMetaSchema}from"./json-schema-DVyfq4bA.mjs";export{DEFINITION_SCHEMA_URL,DEFINITION_SCHEMA_VERSION,definitionMetaSchema,generateCommandSchema,generateInputSchema,generateSchema};
1
+ import{a as DEFINITION_SCHEMA_URL,o as DEFINITION_SCHEMA_VERSION}from"./core-BZx351-p.mjs";import{i as generateSchema,n as generateCommandSchema,r as generateInputSchema,t as definitionMetaSchema}from"./json-schema-CYgq_hFu.mjs";export{DEFINITION_SCHEMA_URL,DEFINITION_SCHEMA_VERSION,definitionMetaSchema,generateCommandSchema,generateInputSchema,generateSchema};
@@ -1,3 +1,3 @@
1
- import{t as __exportAll}from"./rolldown-runtime-G4Kt5YOX.mjs";var package_json_exports=/* @__PURE__ */ __exportAll({discoverManifest:()=>discoverManifest,inferCliName:()=>inferCliName});function isPlainObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function parentDir(e){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(`\\`),r=Math.max(t,n),i=n>t?`\\`:`/`;if(r<0)return;if(r===0)return e.length>1?i:void 0;let a=e.slice(0,r);if(a.length===2&&a[1]===`:`){let t=`${a}${i}`;return t===e?void 0:t}return a}function joinPath(e,t){let n=e.includes(`\\`)?`\\`:`/`;return e.endsWith(n)?`${e}${t}`:`${e}${n}${t}`}const DEFAULT_MANIFEST_FILES=[`package.json`];function manifestHasMetadata(e){return e.name!==void 0||e.version!==void 0||e.description!==void 0||e.bin!==void 0||e.homepage!==void 0||e.repository!==void 0}async function discoverManifest(e,t={}){let n=t.files??DEFAULT_MANIFEST_FILES,r=t.startDir??e.cwd;for(;r!==void 0;){for(let t of n){let n=null;try{n=await e.readFile(joinPath(r,t))}catch{}if(n!==null){let e=parsePackageJson(n);if(e!==null&&manifestHasMetadata(e))return e}}r=parentDir(r)}return null}function isJsonWhitespace(e){return e===` `||e===` `||e===`
1
+ import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";var package_json_exports=/* @__PURE__ */ __exportAll({discoverManifest:()=>discoverManifest,inferCliName:()=>inferCliName});function isPlainObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function parentDir(e){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(`\\`),r=Math.max(t,n),i=n>t?`\\`:`/`;if(r<0)return;if(r===0)return e.length>1?i:void 0;let a=e.slice(0,r);if(a.length===2&&a[1]===`:`){let t=`${a}${i}`;return t===e?void 0:t}return a}function joinPath(e,t){let n=e.includes(`\\`)?`\\`:`/`;return e.endsWith(n)?`${e}${t}`:`${e}${n}${t}`}const DEFAULT_MANIFEST_FILES=[`package.json`];function manifestHasMetadata(e){return e.name!==void 0||e.version!==void 0||e.description!==void 0||e.bin!==void 0||e.homepage!==void 0||e.repository!==void 0}async function discoverManifest(e,t={}){let n=t.files??DEFAULT_MANIFEST_FILES,r=t.startDir??e.cwd;for(;r!==void 0;){for(let t of n){let n=null;try{n=await e.readFile(joinPath(r,t))}catch{}if(n!==null){let e=parsePackageJson(n);if(e!==null&&manifestHasMetadata(e))return e}}r=parentDir(r)}return null}function isJsonWhitespace(e){return e===` `||e===` `||e===`
2
2
  `||e===`\r`}function stripJsonc(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i]??``;if(n)t+=a,r?r=!1:a===`\\`?r=!0:a===`"`&&(n=!1);else if(a===`"`)n=!0,t+=a;else if(a===`/`&&e[i+1]===`/`){for(i+=2;i<e.length&&e[i]!==`
3
3
  `;)i+=1;--i}else if(a===`/`&&e[i+1]===`*`){for(i+=2;i<e.length&&(e[i]!==`*`||e[i+1]!==`/`);)i+=1;i+=1}else t+=a}let i=``;n=!1,r=!1;for(let e=0;e<t.length;e+=1){let a=t[e]??``;if(n)i+=a,r?r=!1:a===`\\`?r=!0:a===`"`&&(n=!1);else if(a===`"`)n=!0,i+=a;else{if(a===`,`){let n=e+1;for(;n<t.length&&isJsonWhitespace(t[n]??``);)n+=1;let r=t[n];if(r===`}`||r===`]`)continue}i+=a}}return i}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{try{t=JSON.parse(stripJsonc(e))}catch{return null}}try{if(!isPlainObject(t))return null;let e=typeof t.name==`string`?t.name:void 0,n=typeof t.version==`string`?t.version:void 0,r=typeof t.description==`string`?t.description:void 0,i=parseBinField(t.bin),a=typeof t.homepage==`string`?t.homepage:void 0,o=parseRepositoryField(t.repository);return{...e===void 0?{}:{name:e},...n===void 0?{}:{version:n},...r===void 0?{}:{description:r},...i===void 0?{}:{bin:i},...a===void 0?{}:{homepage:a},...o===void 0?{}:{repository:o}}}catch{return null}}function parseBinField(e){if(typeof e==`string`)return e;if(!isPlainObject(e))return;let t={};for(let[n,r]of Object.entries(e)){if(typeof r!=`string`)return;t[n]=r}return t}function parseRepositoryField(e){if(typeof e==`string`)return e;if(!isPlainObject(e))return;let t=typeof e.type==`string`?e.type:void 0,n=typeof e.url==`string`?e.url:void 0,r=typeof e.directory==`string`?e.directory:void 0;if(t!==void 0||n!==void 0||r!==void 0)return{...t===void 0?{}:{type:t},...n===void 0?{}:{url:n},...r===void 0?{}:{directory:r}}}function inferCliName(e,t={}){if(typeof e.bin==`object`){let t=Object.keys(e.bin);if(t.length>0&&t[0]!==void 0)return t[0]}if(e.name!==void 0){if(t.stripScope===!1)return e.name;let n=e.name.indexOf(`/`);return n>=0?e.name.slice(n+1):e.name}}export{inferCliName as n,package_json_exports as r,discoverManifest as t};
package/dist/prompt.d.mts CHANGED
@@ -1,6 +1,16 @@
1
- import { An as PasswordPromptConfig, G as prompt, U as Ask, W as InferPrompt, a as WriteFn, c as ResolvedMultiselectPromptConfig, d as resolvePromptConfig, l as ResolvedPromptConfig, o as PromptEngine, s as ReadFn, u as ResolvedSelectPromptConfig } from "./index-B6oD4_8b.mjs";
2
- import { t as CLIError } from "./index-B3_9MlHz.mjs";
3
- //#region src/core/prompt/errors.d.ts
1
+ /**
2
+ * Prompt engines.
3
+ *
4
+ * When stdin is a TTY and no prompter was injected, `CLIBuilder.run()` installs
5
+ * a thin engine that imports the terminal prompter the first time a prompt is
6
+ * presented; a run that never prompts never loads it. Import this module to
7
+ * drive prompts from a custom host or to build a prompt engine of your own
8
+ * against {@link PromptEngine}.
9
+ *
10
+ * @module @kjanat/dreamcli/prompt
11
+ */
12
+ import { Fn as PasswordPromptConfig, J as Ask, X as prompt, Y as InferPrompt, a as WriteFn, d as PromptEngine, f as ReadFn, g as resolvePromptConfig, h as ResolvedSelectPromptConfig, m as ResolvedPromptConfig, p as ResolvedMultiselectPromptConfig } from "./index-CuhI1Ynv.mjs";
13
+ import { t as CLIError } from "./index-D683D09G.mjs";
4
14
  /** The user stopped an interaction. Unlike a skipped schema prompt, this aborts execution. */
5
15
  export declare class PromptCancelledError extends CLIError {
6
16
  /** Structured error class name. */
@@ -10,8 +20,6 @@ export declare class PromptCancelledError extends CLIError {
10
20
  /** Create an interaction cancellation with the conventional interrupt exit code. */
11
21
  constructor(reason?: PromptCancelledError['reason']);
12
22
  }
13
- //#endregion
14
- //#region src/core/prompt/session.d.ts
15
23
  /** Injectable host for a standalone interaction. No host is opened implicitly. */
16
24
  interface PromptSessionOptions {
17
25
  /** Engine also used for schema-bound prompts in a command invocation. */
@@ -26,8 +34,6 @@ interface PromptSession {
26
34
  }
27
35
  /** Create an isolated interaction session over a custom, terminal, or scripted engine. */
28
36
  export declare function createPromptSession(options: PromptSessionOptions): PromptSession;
29
- //#endregion
30
- //#region src/core/prompt/terminal.d.ts
31
37
  /** Optional terminal capabilities. Hidden input must never fall back to an ordinary reader. */
32
38
  interface TerminalPrompterOptions {
33
39
  /** Read without terminal echo; restore terminal state before settling. */
@@ -77,5 +83,4 @@ interface TerminalPrompterOptions {
77
83
  * ```
78
84
  */
79
85
  declare function createTerminalPrompter(read: ReadFn, write: WriteFn, options?: TerminalPrompterOptions): PromptEngine;
80
- //#endregion
81
86
  export { type Ask, type InferPrompt, type PasswordPromptConfig, type PromptEngine, type PromptSession, type PromptSessionOptions, type ReadFn, type ResolvedMultiselectPromptConfig, type ResolvedPromptConfig, type ResolvedSelectPromptConfig, type TerminalPrompterOptions, createTerminalPrompter, prompt, resolvePromptConfig };
package/dist/prompt.mjs CHANGED
@@ -1 +1 @@
1
- import{T as PromptCancelledError,r as prompt,w as resolvePromptConfig}from"./core-B4Twhd48.mjs";import{t as createPromptSession}from"./session-CQsnVijE.mjs";import{t as createTerminalPrompter}from"./terminal-cbye9mKF.mjs";export{PromptCancelledError,createPromptSession,createTerminalPrompter,prompt,resolvePromptConfig};
1
+ import{A as resolvePromptConfig,j as PromptCancelledError,r as prompt}from"./core-BZx351-p.mjs";import{t as createPromptSession}from"./session-BEKj0yLA.mjs";import{t as createTerminalPrompter}from"./terminal-Dws_b5UK.mjs";export{PromptCancelledError,createPromptSession,createTerminalPrompter,prompt,resolvePromptConfig};
@@ -0,0 +1 @@
1
+ var __defProp=Object.defineProperty,__exportAll=(e,t)=>{let n=Object.setPrototypeOf({},null);for(var r in e)__defProp(n,r,{get:e[r],enumerable:!0});return t&1||__defProp(n,Symbol.toStringTag,{value:`Module`}),t&2?n:Object.preventExtensions(n)};export{__exportAll as t};
@@ -1,3 +1,21 @@
1
- import { n as RuntimeAdapter, r as TerminalSize, t as ExitError } from "./adapter-DsmEc0WO.mjs";
2
- import { a as createAdapter, c as Runtime, i as createDenoAdapter, l as detectRuntime, n as createNodeAdapter, o as GlobalForDetect, r as DenoNamespace, s as RUNTIMES, t as NodeProcess } from "./index-CaRNJH2R.mjs";
1
+ /**
2
+ * Runtime adapters for platform portability (Node, Bun, Deno).
3
+ *
4
+ * Provides the {@link RuntimeAdapter} interface and concrete adapter
5
+ * factories for each supported platform.
6
+ *
7
+ * Start here when embedding DreamCLI in a real host runtime:
8
+ * - {@link createAdapter} for normal auto-detected production use
9
+ * - {@link createNodeAdapter} or {@link createDenoAdapter} when the runtime
10
+ * must be selected explicitly (Bun uses the Node adapter — its `process` is
11
+ * Node-compatible — so there is no separate Bun factory)
12
+ *
13
+ * Most applications do not need this subpath unless they are wiring DreamCLI
14
+ * into a custom host, testing runtime behavior directly, or building their own
15
+ * process/bootstrap layer.
16
+ *
17
+ * @module @kjanat/dreamcli/runtime
18
+ */
19
+ import { c as TerminalSize, o as ExitError, s as RuntimeAdapter } from "./index-CuhI1Ynv.mjs";
20
+ import { a as createAdapter, c as Runtime, i as createDenoAdapter, l as detectRuntime, n as createNodeAdapter, o as GlobalForDetect, r as DenoNamespace, s as RUNTIMES, t as NodeProcess } from "./index-aTmg9yfl.mjs";
3
21
  export { type DenoNamespace, ExitError, type GlobalForDetect, type NodeProcess, RUNTIMES, type Runtime, type RuntimeAdapter, type TerminalSize, createAdapter, createDenoAdapter, createNodeAdapter, detectRuntime };
package/dist/runtime.mjs CHANGED
@@ -1 +1 @@
1
- export{x as ExitError,v as RUNTIMES,g as createAdapter,b as createDenoAdapter,_ as createNodeAdapter,y as detectRuntime}from"./core-B4Twhd48.mjs";
1
+ export{D as ExitError,w as RUNTIMES,S as createAdapter,E as createDenoAdapter,C as createNodeAdapter,T as detectRuntime}from"./core-BZx351-p.mjs";
@@ -0,0 +1 @@
1
+ import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{A as resolvePromptConfig,j as PromptCancelledError,n as prepareTextAnswer,pt as CLIError}from"./core-BZx351-p.mjs";var session_exports=/* @__PURE__ */ __exportAll({createPromptSession:()=>createPromptSession});function createPromptSession(e){let t=!1;return{ask:async n=>{if(t)throw new CLIError(`A prompt is already active in this session`,{code:`PROMPT_BUSY`});if(e.prompter===void 0)throw new CLIError(`Interactive input is unavailable`,{code:`PROMPT_UNAVAILABLE`,suggest:`Supply input through command arguments, environment, or config, or run in an interactive terminal`});t=!0;try{let t=resolvePromptConfig(n,void 0),r={...t};(r.kind===`input`||r.kind===`password`)&&(delete r.validate,r.empty=`accept`,r.kind===`input`&&(r.trim=!1,r.default!==void 0&&(r.sensitive||(r.placeholder=[r.placeholder,`default: ${r.default}`].filter(e=>e!==void 0).join(`, `)),delete r.default)));for(let i=0;i<10;i++){let i=await e.prompter.promptOne(r);if(!i.answered)throw i.reason===`invalid`?new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2}):new PromptCancelledError;let a=i.value,o;if(n.kind===`input`||n.kind===`password`){if(typeof a!=`string`)o=`Please enter text.`;else{let e=await prepareTextAnswer(n,a);e.ok?a=e.value:o=e.message}}else if(n.kind===`confirm`)typeof a!=`boolean`&&(o=`Please answer yes or no.`);else{let e=t.kind===`select`||t.kind===`multiselect`?t.choices:[];if(n.kind===`select`)e.some(e=>e.value===a)||(o=`Please select an available choice.`);else if(!Array.isArray(a)||!a.every(t=>e.some(e=>e.value===t)))o=`Please select available choices.`;else{let e=[...new Set(a)];a=e,n.min!==void 0&&e.length<n.min&&(o=`Please select at least ${n.min}.`),n.max!==void 0&&e.length>n.max&&(o=`Please select at most ${n.max}.`)}}if(o===void 0)return a;e.write?.(`${o}\n`)}throw new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2})}finally{t=!1}}}}export{session_exports as n,createPromptSession as t};
@@ -1,4 +1,4 @@
1
- import{t as __exportAll}from"./rolldown-runtime-G4Kt5YOX.mjs";import{T as PromptCancelledError,n as prepareTextAnswer,tt as CLIError}from"./core-B4Twhd48.mjs";var terminal_exports=/* @__PURE__ */ __exportAll({createTerminalPrompter:()=>createTerminalPrompter});function createTerminalPrompter(e,t,n){return{promptOne(r){switch(r.kind){case`confirm`:return promptConfirm(r,e,t);case`input`:return promptInput(r,e,t);case`password`:{let e=n?.readSecret;return e===void 0?Promise.reject(new CLIError(`Hidden password input is unavailable`,{code:`PROMPT_UNSUPPORTED`,suggest:`Use a runtime adapter or prompt engine with hidden-input support`})):promptInput(r,async()=>{try{let t=await e();if(t===null)throw new PromptCancelledError(`eof`);return t}finally{t(`
1
+ import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{j as PromptCancelledError,n as prepareTextAnswer,pt as CLIError}from"./core-BZx351-p.mjs";var terminal_exports=/* @__PURE__ */ __exportAll({createTerminalPrompter:()=>createTerminalPrompter});function createTerminalPrompter(e,t,n){return{promptOne(r){switch(r.kind){case`confirm`:return promptConfirm(r,e,t);case`input`:return promptInput(r,e,t);case`password`:{let e=n?.readSecret;return e===void 0?Promise.reject(new CLIError(`Hidden password input is unavailable`,{code:`PROMPT_UNSUPPORTED`,suggest:`Use a runtime adapter or prompt engine with hidden-input support`})):promptInput(r,async()=>{try{let t=await e();if(t===null)throw new PromptCancelledError(`eof`);return t}finally{t(`
2
2
  `)}},t)}case`select`:return promptSelect(r,e,t);case`multiselect`:return promptMultiselect(r,e,t)}}}}async function promptConfirm(e,t,n){let r=e.default??!0,i=0;for(;i<10;){let a=e.sensitive?`(y/n)`:r?`(Y/n)`:`(y/N)`;n(`${e.message} ${a} `);let o=await t();if(o===null)return{answered:!1};let s=o.trim().toLowerCase();if(s===``)return{answered:!0,value:r};if(s===`y`||s===`yes`)return{answered:!0,value:!0};if(s===`n`||s===`no`)return{answered:!0,value:!1};n(`Please answer y or n.
3
3
  `),i+=1}return n(`Too many invalid attempts.
4
4
  `),{answered:!1,reason:`invalid`}}async function promptInput(e,t,n){let r=0,i=[];e.kind===`input`&&e.placeholder!==void 0&&i.push(e.placeholder),e.kind===`input`&&e.default!==void 0&&!e.sensitive&&i.push(`default: ${e.default}`);let a=i.length>0?` (${i.join(`, `)})`:``;for(;r<10;){n(`${e.message}${a}: `);let i=await t();if(i===null)return{answered:!1};let o=await prepareTextAnswer(e,i);if(o.ok)return{answered:!0,value:o.value};n(`${o.message}\n`),r+=1}if(e.kind===`password`)throw new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2});return n(`Too many invalid attempts.
@@ -0,0 +1 @@
1
+ import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{j as PromptCancelledError,n as prepareTextAnswer,pt as CLIError}from"./core-BZx351-p.mjs";var test_prompter_exports=/* @__PURE__ */ __exportAll({createTestPrompter:()=>createTestPrompter});const PROMPT_CANCEL=Symbol.for(`dreamcli.prompt.cancel`);function createTestPrompter(e,t){let n=0;return{async promptOne(r){for(let i=0;i<10;i++){if(n>=e.length)return t?.onExhausted===`cancel`?Promise.resolve({answered:!1}):Promise.reject(/* @__PURE__ */ Error(`Test prompter exhausted: expected at most ${e.length} prompts, got prompt #${n+1}`));let i=e[n];if(n+=1,i===PROMPT_CANCEL){if(r.kind===`password`)throw new PromptCancelledError;return Promise.resolve({answered:!1})}if((r.kind===`input`||r.kind===`password`)&&typeof i==`string`){let e=await prepareTextAnswer(r,i);if(!e.ok&&(r.kind===`password`||e.reason===`empty`))continue;return e.ok?{answered:!0,value:e.value}:{answered:!1}}return Promise.resolve({answered:!0,value:i})}if(r.kind!==`password`)return{answered:!1,reason:`invalid`};throw new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2})}}}export{createTestPrompter as n,test_prompter_exports as r,PROMPT_CANCEL as t};
@@ -1,8 +1,20 @@
1
- import { It as FlagBuilder, J as ArgConfig, Lt as FlagConfig, g as CommandBuilder, q as ArgBuilder, r as createCaptureOutput, t as CapturedOutput } from "./index-B6oD4_8b.mjs";
2
- import { A as BuiltinsConfig, a as TestPrompterOptions, i as TestAnswer, n as RunResult, o as createTestPrompter, r as PROMPT_CANCEL, t as RunOptions } from "./index-B_1Dmsdq.mjs";
3
- import { a as createTestAdapter, i as TestAdapterOptions } from "./adapter-DsmEc0WO.mjs";
4
- import "./index-CaRNJH2R.mjs";
5
- //#region src/core/testkit/index.d.ts
1
+ /**
2
+ * Test utilities for DreamCLI commands.
3
+ *
4
+ * Provides {@linkcode runCommand | runCommand()} — the in-process test harness — plus test doubles
5
+ * for output capture, prompt simulation, and runtime adaptation.
6
+ *
7
+ * Start here for most tests:
8
+ * - {@link runCommand} to execute a command in-process
9
+ * - {@link createCaptureOutput} to assert on raw output behavior
10
+ * - {@link createTestPrompter} to script interactive answers
11
+ * - {@link createTestAdapter} when you need adapter-level control
12
+ *
13
+ * @module @kjanat/dreamcli/testkit
14
+ */
15
+ import { $ as ArgConfig, Ht as FlagConfig, Q as ArgBuilder, Vt as FlagBuilder, l as TestAdapterOptions, r as createCaptureOutput, t as CapturedOutput, u as createTestAdapter, x as CommandBuilder } from "./index-CuhI1Ynv.mjs";
16
+ import { a as TestPrompterOptions, b as SkippedPathCheck, i as TestAnswer, j as BuiltinsConfig, n as RunResult, o as createTestPrompter, r as PROMPT_CANCEL, t as RunOptions } from "./index-DDhRLoTu.mjs";
17
+ import "./index-aTmg9yfl.mjs";
6
18
  /**
7
19
  * Options for {@linkcode runCommand}.
8
20
  *
@@ -51,5 +63,4 @@ interface RunCommandOptions extends RunOptions {
51
63
  * @returns Structured run result with exit code and captured output
52
64
  */
53
65
  declare function runCommand<F extends Record<string, FlagBuilder<FlagConfig>>, A extends Record<string, ArgBuilder<ArgConfig>>, C extends Record<string, unknown> = Record<string, never>>(cmd: CommandBuilder<F, A, C>, argv: readonly string[], options?: RunCommandOptions): Promise<RunResult>;
54
- //#endregion
55
- export { type CapturedOutput, PROMPT_CANCEL, type RunCommandOptions, type RunOptions, type RunResult, type TestAdapterOptions, type TestAnswer, type TestPrompterOptions, createCaptureOutput, createTestAdapter, createTestPrompter, runCommand };
66
+ export { type CapturedOutput, PROMPT_CANCEL, type RunCommandOptions, type RunOptions, type RunResult, type SkippedPathCheck, type TestAdapterOptions, type TestAnswer, type TestPrompterOptions, createCaptureOutput, createTestAdapter, createTestPrompter, runCommand };
package/dist/testkit.mjs CHANGED
@@ -1 +1 @@
1
- import{N as createCaptureOutput,S as createTestAdapter,t as runCommand}from"./core-B4Twhd48.mjs";import{n as createTestPrompter,t as PROMPT_CANCEL}from"./test-prompter-Ddkt9n5A.mjs";export{PROMPT_CANCEL,createCaptureOutput,createTestAdapter,createTestPrompter,runCommand};
1
+ import{M as createCaptureOutput,O as createTestAdapter,t as runCommand}from"./core-BZx351-p.mjs";import{n as createTestPrompter,t as PROMPT_CANCEL}from"./test-prompter-euLYzWWO.mjs";export{PROMPT_CANCEL,createCaptureOutput,createTestAdapter,createTestPrompter,runCommand};
@@ -1,4 +1,3 @@
1
- //#region src/version.d.ts
2
1
  /**
3
2
  * DreamCLI's own build-time version constants.
4
3
  *
@@ -15,5 +14,4 @@
15
14
  /** Package version (e.g. `"0.9.1"`). `"dev"` when running unbundled. */
16
15
  export declare const DREAMCLI_VERSION: string;
17
16
  /** Git short SHA (e.g. `"f9b5f1a"`). `"dev"` when running unbundled. */
18
- export declare const DREAMCLI_REVISION: string;
19
- //#endregion
17
+ export declare const DREAMCLI_REVISION: string;
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- const DREAMCLI_VERSION=`4.2.0`,DREAMCLI_REVISION=`14ab8d1`;export{DREAMCLI_REVISION,DREAMCLI_VERSION};
1
+ const DREAMCLI_VERSION=`5.1.0`,DREAMCLI_REVISION=`c92105a`;export{DREAMCLI_REVISION,DREAMCLI_VERSION};