@kjanat/dreamcli 2.2.1 → 2.4.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 (38) hide show
  1. package/CHANGELOG.md +42 -1
  2. package/README.md +94 -34
  3. package/dist/core/cli/dispatch.d.mts +30 -2
  4. package/dist/core/cli/dispatch.mjs +1 -1
  5. package/dist/core/cli/index.mjs +1 -1
  6. package/dist/core/cli/planner.mjs +1 -1
  7. package/dist/core/config/package-json.mjs +1 -1
  8. package/dist/core/execution/index.mjs +1 -1
  9. package/dist/core/json-schema/meta-descriptions.generated.d.mts +59 -59
  10. package/dist/core/output/activity.mjs +1 -1
  11. package/dist/core/output/index.d.mts +6 -1
  12. package/dist/core/output/index.mjs +2 -2
  13. package/dist/core/parse/index.d.mts +31 -1
  14. package/dist/core/parse/index.mjs +1 -1
  15. package/dist/core/schema/activity.d.mts +1 -1
  16. package/dist/core/schema/command.d.mts +8 -0
  17. package/dist/core/schema/run.d.mts +8 -5
  18. package/dist/core/schema-dsl/runtime.mjs +1 -1
  19. package/dist/core/testkit/index.mjs +1 -1
  20. package/dist/index.mjs +1 -1
  21. package/dist/runtime/paths.mjs +1 -1
  22. package/dist/strings.d.mts +27 -0
  23. package/dist/strings.mjs +1 -0
  24. package/dist/testkit.mjs +1 -1
  25. package/dist/version.mjs +1 -1
  26. package/package.json +37 -25
  27. package/src/core/cli/dispatch.ts +70 -7
  28. package/src/core/cli/index.ts +13 -4
  29. package/src/core/cli/planner.ts +80 -6
  30. package/src/core/config/package-json.ts +3 -2
  31. package/src/core/execution/index.ts +8 -10
  32. package/src/core/help/index.ts +2 -2
  33. package/src/core/output/index.ts +29 -0
  34. package/src/core/parse/index.ts +23 -3
  35. package/src/core/schema/command.ts +8 -0
  36. package/src/core/schema/run.ts +8 -5
  37. package/src/runtime/paths.ts +4 -2
  38. package/src/strings.ts +34 -0
@@ -8,173 +8,173 @@ declare const definitionMetaSchemaDescriptions: {
8
8
  readonly root: {
9
9
  readonly description: "Runtime descriptor for the CLI program.\n\nStores the program name, version, description, and registered commands.\\\nBuilt incrementally by CLIBuilder.";
10
10
  readonly properties: {
11
- readonly "name": {
11
+ readonly name: {
12
12
  readonly description: "Program name (used in help text, usage lines, and completion scripts).";
13
13
  };
14
- readonly "version": {
14
+ readonly version: {
15
15
  readonly description: "Program version (shown by `--version`).";
16
16
  };
17
- readonly "description": {
17
+ readonly description: {
18
18
  readonly description: "Program description (shown in root help).";
19
19
  };
20
- readonly "defaultCommand": {
20
+ readonly defaultCommand: {
21
21
  readonly description: "Default command dispatched when no subcommand matches.\n\nWhen set, the CLI root behaves like a hybrid command group: subcommands\ndispatch by name as usual, but empty argv or flags-only argv falls\nthrough to this command instead of showing root help.\n\nSet via the .default() builder method.";
22
22
  };
23
- readonly "commands": {
23
+ readonly commands: {
24
24
  readonly description: "Registered commands (type-erased for heterogeneous storage).";
25
25
  };
26
26
  };
27
27
  };
28
28
  readonly defs: {
29
- readonly "command": {
30
- readonly description: "Runtime descriptor produced by CommandBuilder.\n\nConsumers (parser, help generator, CLI dispatcher) read this to\nunderstand the command's shape \u2014 flags, args, aliases, subcommands,\nmiddleware, and interactive resolver.";
29
+ readonly command: {
30
+ readonly description: "Runtime descriptor produced by CommandBuilder.\n\nConsumers (parser, help generator, CLI dispatcher) read this to\nunderstand the command's shape — flags, args, aliases, subcommands,\nmiddleware, and interactive resolver.";
31
31
  readonly properties: {
32
- readonly "name": {
32
+ readonly name: {
33
33
  readonly description: "The command name (used for dispatch, e.g. `'deploy'`).";
34
34
  };
35
- readonly "description": {
35
+ readonly description: {
36
36
  readonly description: "Human-readable description for help text.";
37
37
  };
38
- readonly "aliases": {
38
+ readonly aliases: {
39
39
  readonly description: "Alternative names for this command.";
40
40
  };
41
- readonly "hidden": {
41
+ readonly hidden: {
42
42
  readonly description: "Whether this command is hidden from help listings.";
43
43
  };
44
- readonly "examples": {
44
+ readonly examples: {
45
45
  readonly description: "Usage examples for help text.";
46
46
  };
47
- readonly "flags": {
47
+ readonly flags: {
48
48
  readonly description: "Named flag schemas, keyed by flag name.";
49
49
  };
50
- readonly "args": {
50
+ readonly args: {
51
51
  readonly description: "Ordered positional arg entries (name + schema).";
52
52
  };
53
- readonly "commands": {
54
- readonly description: "Nested subcommand schemas (for help rendering and completion).\n\nPure data \u2014 no execution closures. Populated by `.command()` on\n`CommandBuilder`. Empty for leaf commands.";
53
+ readonly commands: {
54
+ readonly 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.";
55
55
  };
56
56
  };
57
57
  };
58
- readonly "flag": {
58
+ readonly flag: {
59
59
  readonly description: "The runtime descriptor stored inside every FlagBuilder. Consumers (parser,\nhelp generator, resolution chain) read this to understand the flag's shape\nwithout touching generics.";
60
60
  readonly properties: {
61
- readonly "kind": {
61
+ readonly kind: {
62
62
  readonly description: "What kind of value this flag accepts.";
63
63
  };
64
- readonly "presence": {
65
- readonly description: "Presence describes whether a flag value is guaranteed to exist when the\naction handler runs:\n\n- `'optional'` \u2014 not required; unresolved value follows the kind-specific\n optional fallback (`undefined` for most flags, `[]` for arrays)\n- `'required'` \u2014 must be supplied; error if missing\n- `'defaulted'` \u2014 always present (falls back to default value)";
64
+ readonly presence: {
65
+ readonly 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)";
66
66
  };
67
- readonly "defaultValue": {
67
+ readonly defaultValue: {
68
68
  readonly description: "Runtime default value (if any).";
69
69
  };
70
- readonly "aliases": {
70
+ readonly aliases: {
71
71
  readonly description: "Short/long aliases (e.g. `[{ name: 'f', hidden: false }]` for `--force`).";
72
72
  };
73
- readonly "envVar": {
73
+ readonly envVar: {
74
74
  readonly description: "Environment variable name for v0.2+ resolution.";
75
75
  };
76
- readonly "configPath": {
76
+ readonly configPath: {
77
77
  readonly description: "Dotted config path for v0.2+ resolution (e.g. `'deploy.region'`).";
78
78
  };
79
- readonly "description": {
79
+ readonly description: {
80
80
  readonly description: "Human-readable description for help text.";
81
81
  };
82
- readonly "enumValues": {
82
+ readonly enumValues: {
83
83
  readonly description: "Allowed literal values when `kind === 'enum'`.";
84
84
  };
85
- readonly "elementSchema": {
85
+ readonly elementSchema: {
86
86
  readonly description: "Element schema when `kind === 'array'`.";
87
87
  };
88
- readonly "prompt": {
88
+ readonly prompt: {
89
89
  readonly description: "Interactive prompt configuration for v0.3+ resolution.";
90
90
  };
91
- readonly "deprecated": {
92
- readonly description: "Deprecation marker.\n\n- `undefined` \u2014 not deprecated (default)\n- `true` \u2014 deprecated with no migration message\n- `string` \u2014 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>]`.";
91
+ readonly deprecated: {
92
+ readonly 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>]`.";
93
93
  };
94
- readonly "propagate": {
94
+ readonly propagate: {
95
95
  readonly description: "Whether this flag propagates to subcommands in nested command trees.\n\nWhen `true`, the flag is automatically available to all descendant\ncommands. A child command that defines a flag with the same name\nshadows the propagated parent flag.";
96
96
  };
97
97
  };
98
98
  };
99
- readonly "arg": {
99
+ readonly arg: {
100
100
  readonly description: "The runtime descriptor stored inside every ArgBuilder. Consumers (parser,\nhelp generator) read this to understand the arg's shape without touching\ngenerics.";
101
101
  readonly properties: {
102
- readonly "name": {
102
+ readonly name: {
103
103
  readonly description: "A named positional argument entry in the command schema.\n\nPairs a user-facing arg name with its ArgSchema descriptor.\nThe array ordering in CommandSchema.args determines CLI position.";
104
104
  };
105
- readonly "kind": {
105
+ readonly kind: {
106
106
  readonly description: "What kind of value this arg accepts.";
107
107
  };
108
- readonly "presence": {
109
- readonly description: "Presence describes whether a positional arg is guaranteed to exist when the\naction handler runs:\n\n- `'required'` \u2014 must be supplied; error if missing (default)\n- `'optional'` \u2014 may be `undefined` if not supplied\n- `'defaulted'` \u2014 always present (falls back to default value)";
108
+ readonly presence: {
109
+ readonly 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)";
110
110
  };
111
- readonly "variadic": {
111
+ readonly variadic: {
112
112
  readonly description: "Whether this arg consumes all remaining positionals.";
113
113
  };
114
- readonly "stdinMode": {
114
+ readonly stdinMode: {
115
115
  readonly description: "Whether this arg may read from stdin during resolution.";
116
116
  };
117
- readonly "defaultValue": {
117
+ readonly defaultValue: {
118
118
  readonly description: "Runtime default value (if any).";
119
119
  };
120
- readonly "description": {
120
+ readonly description: {
121
121
  readonly description: "Human-readable description for help text.";
122
122
  };
123
- readonly "envVar": {
123
+ readonly envVar: {
124
124
  readonly description: "Environment variable name for env resolution.\n\nWhen set and the CLI value is absent, the resolver reads this env var\nand coerces the string to the arg's declared kind.";
125
125
  };
126
- readonly "enumValues": {
126
+ readonly enumValues: {
127
127
  readonly description: "Allowed literal values when `kind === 'enum'`.";
128
128
  };
129
- readonly "deprecated": {
130
- readonly description: "Deprecation marker.\n\n- `undefined` \u2014 not deprecated (default)\n- `true` \u2014 deprecated with no migration message\n- `string` \u2014 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>]`.";
129
+ readonly deprecated: {
130
+ readonly 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>]`.";
131
131
  };
132
132
  };
133
133
  };
134
- readonly "prompt": {
134
+ readonly prompt: {
135
135
  readonly 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```";
136
136
  readonly properties: {
137
- readonly "kind": {
138
- readonly description: "The kind of interactive prompt to present.\n\n- `'confirm'` \u2014 yes/no boolean question\n- `'input'` \u2014 free-text string input\n- `'select'` \u2014 single selection from a list\n- `'multiselect'` \u2014 multiple selections from a list";
137
+ readonly kind: {
138
+ readonly description: "The kind of interactive prompt to present.\n\n- `'confirm'` — yes/no boolean question\n- `'input'` — free-text string input\n- `'select'` — single selection from a list\n- `'multiselect'` — multiple selections from a list";
139
139
  };
140
- readonly "message": {
140
+ readonly message: {
141
141
  readonly description: "The question displayed to the user.";
142
142
  };
143
- readonly "placeholder": {
143
+ readonly placeholder: {
144
144
  readonly description: "Placeholder text shown before user types (informational only).";
145
145
  };
146
- readonly "choices": {
146
+ readonly choices: {
147
147
  readonly description: "Available choices. When omitted for `enum` flags, the enum values\nfrom the flag schema are used automatically.";
148
148
  };
149
- readonly "min": {
149
+ readonly min: {
150
150
  readonly description: "Minimum number of selections required.";
151
151
  };
152
- readonly "max": {
152
+ readonly max: {
153
153
  readonly description: "Maximum number of selections allowed.";
154
154
  };
155
155
  };
156
156
  };
157
- readonly "choice": {
157
+ readonly choice: {
158
158
  readonly description: "A selectable option for SelectPromptConfig and MultiselectPromptConfig prompts.";
159
159
  readonly properties: {
160
- readonly "value": {
160
+ readonly value: {
161
161
  readonly description: "The value returned when this choice is selected.";
162
162
  };
163
- readonly "label": {
163
+ readonly label: {
164
164
  readonly description: "Display label shown to the user.";
165
165
  };
166
- readonly "description": {
166
+ readonly description: {
167
167
  readonly description: "Optional description shown alongside the choice.";
168
168
  };
169
169
  };
170
170
  };
171
- readonly "example": {
171
+ readonly example: {
172
172
  readonly description: "A single usage example shown in help text.";
173
173
  readonly properties: {
174
- readonly "command": {
174
+ readonly command: {
175
175
  readonly description: "The command invocation (e.g. `'deploy production --force'`).";
176
176
  };
177
- readonly "description": {
177
+ readonly description: {
178
178
  readonly description: "Optional description of what this example does.";
179
179
  };
180
180
  };
@@ -1 +1 @@
1
- import{writeLine as e}from"./writer.mjs";const t={update(){},succeed(){},fail(){},stop(){},wrap(e){return e}},n={increment(){},update(){},done(){},fail(){}};var r=class{stopped=!1;constructor(t,n){this.write=n,e(n,t)}update(e){}succeed(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}fail(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}stop(){this.stopped||=!0}async wrap(e,t){try{let n=await e;return this.succeed(t?.succeed),n}catch(e){throw this.fail(t?.fail),e}}},i=class{stopped=!1;constructor(t,n){this.write=n,t!==void 0&&e(n,t)}increment(e){}update(e){}done(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}fail(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}};const a=`\x1B[?25l`,o=`\x1B[?25h`,s=`\x1B[2K`,c=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];var l=class{stopped=!1;timer;frameIndex=0;text;constructor(e,t){this.write=t,this.text=e,t(a),this.render(),this.timer=setInterval(()=>{this.frameIndex=(this.frameIndex+1)%c.length,this.render()},80)}render(){let e=c[this.frameIndex]??c[0];this.write(`\r${s}${e} ${this.text}`)}cleanup(){this.timer!==void 0&&(clearInterval(this.timer),this.timer=void 0),this.write(`\r${s}${o}`)}update(e){this.stopped||(this.text=e,this.render())}succeed(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✓ ${t}`))}fail(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✗ ${t}`))}stop(){this.stopped||(this.stopped=!0,this.cleanup())}async wrap(e,t){try{let n=await e;return this.succeed(t?.succeed),n}catch(e){throw this.fail(t?.fail),e}}},u=class{stopped=!1;timer;current=0;total;label;pulsePos=0;pulseDir=1;constructor(e,t){this.write=t,this.total=e.total,this.label=e.label??``,t(a),this.render(),this.total===void 0&&(this.timer=setInterval(()=>{this.advancePulse(),this.render()},80))}advancePulse(){this.pulsePos+=this.pulseDir,this.pulsePos+3>20?(this.pulseDir=-1,this.pulsePos=17):this.pulsePos<0&&(this.pulseDir=1,this.pulsePos=0)}render(){let e=this.total===void 0?this.renderIndeterminate():this.renderDeterminate(this.total),t=this.label.length>0?` ${this.label}`:``;this.write(`\r${s}${e}${t}`)}renderDeterminate(e){let t=e>0?Math.max(0,Math.min(this.current/e,1)):0,n=Math.round(t*20),r=20-n,i=Math.round(t*100);return`[${`█`.repeat(n)}${`░`.repeat(r)}] ${String(i)}%`}renderIndeterminate(){let e=``;for(let t=0;t<20;t++)e+=t>=this.pulsePos&&t<this.pulsePos+3?`█`:`░`;return`[${e}]`}cleanup(){this.timer!==void 0&&(clearInterval(this.timer),this.timer=void 0),this.write(`\r${s}${o}`)}increment(e){this.stopped||(this.current+=e??1,this.render())}update(e){this.stopped||(this.current=e,this.render())}done(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✓ ${t}`))}fail(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✗ ${t}`))}},d=class{stopped=!1;constructor(e,t){this.events=t,t.push({type:`spinner:start`,text:e})}update(e){this.stopped||this.events.push({type:`spinner:update`,text:e})}succeed(e){this.stopped||(this.stopped=!0,this.events.push({type:`spinner:succeed`,text:e??``}))}fail(e){this.stopped||(this.stopped=!0,this.events.push({type:`spinner:fail`,text:e??``}))}stop(){this.stopped||(this.stopped=!0,this.events.push({type:`spinner:stop`}))}async wrap(e,t){try{let n=await e;return this.succeed(t?.succeed),n}catch(e){throw this.fail(t?.fail),e}}},f=class{stopped=!1;constructor(e,t){this.events=t,t.push({type:`progress:start`,label:e.label??``,total:e.total})}increment(e){this.stopped||this.events.push({type:`progress:increment`,delta:e??1})}update(e){this.stopped||this.events.push({type:`progress:update`,value:e})}done(e){this.stopped||(this.stopped=!0,this.events.push({type:`progress:done`,text:e}))}fail(e){this.stopped||(this.stopped=!0,this.events.push({type:`progress:fail`,text:e}))}};export{f as CaptureProgressHandle,d as CaptureSpinnerHandle,i as StaticProgressHandle,r as StaticSpinnerHandle,u as TTYProgressHandle,l as TTYSpinnerHandle,n as noopProgressHandle,t as noopSpinnerHandle};
1
+ import{writeLine as e}from"./writer.mjs";const t={update(){},succeed(){},fail(){},stop(){},wrap(e){return e}},n={increment(){},update(){},done(){},fail(){}};var r=class{write;stopped=!1;constructor(t,n){this.write=n,e(n,t)}update(e){}succeed(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}fail(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}stop(){this.stopped||=!0}async wrap(e,t){try{let n=await e;return this.succeed(t?.succeed),n}catch(e){throw this.fail(t?.fail),e}}},i=class{write;stopped=!1;constructor(t,n){this.write=n,t!==void 0&&e(n,t)}increment(e){}update(e){}done(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}fail(t){this.stopped||(this.stopped=!0,t!==void 0&&e(this.write,t))}};const a=`\x1B[?25l`,o=`\x1B[?25h`,s=`\x1B[2K`,c=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];var l=class{write;stopped=!1;timer;frameIndex=0;text;constructor(e,t){this.write=t,this.text=e,t(a),this.render(),this.timer=setInterval(()=>{this.frameIndex=(this.frameIndex+1)%c.length,this.render()},80)}render(){let e=c[this.frameIndex]??c[0];this.write(`\r${s}${e} ${this.text}`)}cleanup(){this.timer!==void 0&&(clearInterval(this.timer),this.timer=void 0),this.write(`\r${s}${o}`)}update(e){this.stopped||(this.text=e,this.render())}succeed(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✓ ${t}`))}fail(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✗ ${t}`))}stop(){this.stopped||(this.stopped=!0,this.cleanup())}async wrap(e,t){try{let n=await e;return this.succeed(t?.succeed),n}catch(e){throw this.fail(t?.fail),e}}},u=class{write;stopped=!1;timer;current=0;total;label;pulsePos=0;pulseDir=1;constructor(e,t){this.write=t,this.total=e.total,this.label=e.label??``,t(a),this.render(),this.total===void 0&&(this.timer=setInterval(()=>{this.advancePulse(),this.render()},80))}advancePulse(){this.pulsePos+=this.pulseDir,this.pulsePos+3>20?(this.pulseDir=-1,this.pulsePos=17):this.pulsePos<0&&(this.pulseDir=1,this.pulsePos=0)}render(){let e=this.total===void 0?this.renderIndeterminate():this.renderDeterminate(this.total),t=this.label.length>0?` ${this.label}`:``;this.write(`\r${s}${e}${t}`)}renderDeterminate(e){let t=e>0?Math.max(0,Math.min(this.current/e,1)):0,n=Math.round(t*20),r=20-n,i=Math.round(t*100);return`[${`█`.repeat(n)}${`░`.repeat(r)}] ${String(i)}%`}renderIndeterminate(){let e=``;for(let t=0;t<20;t++)e+=t>=this.pulsePos&&t<this.pulsePos+3?`█`:`░`;return`[${e}]`}cleanup(){this.timer!==void 0&&(clearInterval(this.timer),this.timer=void 0),this.write(`\r${s}${o}`)}increment(e){this.stopped||(this.current+=e??1,this.render())}update(e){this.stopped||(this.current=e,this.render())}done(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✓ ${t}`))}fail(t){this.stopped||(this.stopped=!0,this.cleanup(),t!==void 0&&e(this.write,`✗ ${t}`))}},d=class{events;stopped=!1;constructor(e,t){this.events=t,t.push({type:`spinner:start`,text:e})}update(e){this.stopped||this.events.push({type:`spinner:update`,text:e})}succeed(e){this.stopped||(this.stopped=!0,this.events.push({type:`spinner:succeed`,text:e??``}))}fail(e){this.stopped||(this.stopped=!0,this.events.push({type:`spinner:fail`,text:e??``}))}stop(){this.stopped||(this.stopped=!0,this.events.push({type:`spinner:stop`}))}async wrap(e,t){try{let n=await e;return this.succeed(t?.succeed),n}catch(e){throw this.fail(t?.fail),e}}},f=class{events;stopped=!1;constructor(e,t){this.events=t,t.push({type:`progress:start`,label:e.label??``,total:e.total})}increment(e){this.stopped||this.events.push({type:`progress:increment`,delta:e??1})}update(e){this.stopped||this.events.push({type:`progress:update`,value:e})}done(e){this.stopped||(this.stopped=!0,this.events.push({type:`progress:done`,text:e}))}fail(e){this.stopped||(this.stopped=!0,this.events.push({type:`progress:fail`,text:e}))}};export{f as CaptureProgressHandle,d as CaptureSpinnerHandle,i as StaticProgressHandle,r as StaticSpinnerHandle,u as TTYProgressHandle,l as TTYSpinnerHandle,n as noopProgressHandle,t as noopSpinnerHandle};
@@ -54,6 +54,9 @@ interface ResolvedOutputOptions {
54
54
  readonly verbosity: Verbosity;
55
55
  readonly jsonMode: boolean;
56
56
  }
57
+ declare function setRequestedExitCode(out: Out, code: number): void;
58
+ declare function getRequestedExitCode(out: Out): number | undefined;
59
+ declare function clearRequestedExitCode(out: Out): void;
57
60
  /**
58
61
  * Concrete implementation of the {@linkcode Out} interface.
59
62
  *
@@ -100,6 +103,8 @@ declare class OutputChannel implements Out {
100
103
  warn(message: string): void;
101
104
  /** Error to stderr. Always emitted. */
102
105
  error(message: string): void;
106
+ /** Request a successful-process exit code without writing error output. */
107
+ setExitCode(code: number): void;
103
108
  /**
104
109
  * Emit a structured JSON value to stdout.
105
110
  *
@@ -277,4 +282,4 @@ interface CapturedOutput {
277
282
  */
278
283
  declare function createCaptureOutput(options?: Omit<OutputOptions, 'stdout' | 'stderr'>): [out: Out, captured: CapturedOutput];
279
284
  //#endregion
280
- export { CaptureOutputChannel, CaptureProgressHandle, CaptureSpinnerHandle, type CapturedOutput, OutputChannel, type OutputOptions, StaticProgressHandle, StaticSpinnerHandle, TTYProgressHandle, TTYSpinnerHandle, type Verbosity, type WriteFn, createCaptureOutput, createOutput, noopProgressHandle, noopSpinnerHandle, writeLine };
285
+ export { CaptureOutputChannel, CaptureProgressHandle, CaptureSpinnerHandle, type CapturedOutput, OutputChannel, type OutputOptions, StaticProgressHandle, StaticSpinnerHandle, TTYProgressHandle, TTYSpinnerHandle, type Verbosity, type WriteFn, clearRequestedExitCode, createCaptureOutput, createOutput, getRequestedExitCode, noopProgressHandle, noopSpinnerHandle, setRequestedExitCode, writeLine };
@@ -1,2 +1,2 @@
1
- import{formatDisplayValue as e}from"./display-value.mjs";import{writeLine as t}from"./writer.mjs";import{CaptureProgressHandle as n,CaptureSpinnerHandle as r}from"./activity.mjs";import{resolveOutputPolicy as i,resolveProgressPolicy as a,resolveSpinnerPolicy as o,resolveTableFormat as s,resolveTableTextStream as c,resolveTextStream as l,shouldEmitInfo as u}from"./contracts.mjs";import{createProgressHandleFromPolicy as d,createSpinnerHandleFromPolicy as f,resolveWriterForStream as p}from"./renderers.mjs";const m=()=>{};function h(e){return{stdout:e?.stdout??m,stderr:e?.stderr??m,isTTY:e?.isTTY??!1,verbosity:e?.verbosity??`normal`,jsonMode:e?.jsonMode??!1}}var g=class{options;policy;jsonMode;isTTY;constructor(e){this.options=e,this.policy=i(e),this.jsonMode=e.jsonMode,this.isTTY=e.isTTY}log(e){t(p(this.options,l(this.policy)),e)}info(e){u(this.policy)&&t(p(this.options,l(this.policy)),e)}warn(e){t(this.options.stderr,e)}error(e){t(this.options.stderr,e)}json(e){t(this.options.stdout,JSON.stringify(e))}table(e,n,r){let{columns:i,options:a}=b(n,r),o=s(this.policy,a),c=i??v(e);if(o===`json`){this.json(x(e,c));return}let l=w(e,c);l.length!==0&&t(S(this.options,this.policy,o,a),l)}activeCleanup;stopActive(){this.activeCleanup!==void 0&&(this.activeCleanup(),this.activeCleanup=void 0)}spinner(e,t){let n=f(o(this.policy,t?.fallback??`silent`),e,this.options.stderr);return n.cleanup===void 0?n.handle:(this.stopActive(),this.activeCleanup=n.cleanup,n.handle)}progress(e){let t=d(a(this.policy,e.fallback??`silent`),e,this.options.stderr);return t.cleanup===void 0?t.handle:(this.stopActive(),this.activeCleanup=t.cleanup,t.handle)}},_=class extends g{constructor(e,t){super(e),this.activity=t}spinner(e,t){return new r(e,this.activity)}progress(e){return new n(e,this.activity)}};function v(e){let t=e[0];return t===void 0?[]:Object.keys(t).map(e=>({key:e}))}function y(e){return Array.isArray(e)}function b(e,t){return t===void 0?y(e)?{columns:e,options:t}:{columns:void 0,options:e}:{columns:y(e)?e:void 0,options:t}}function x(e,t){return e.map(e=>Object.fromEntries(t.map(t=>[t.key,e[t.key]])))}function S(e,t,n,r){return n===`json`?e.stdout:p(e,c(t,r))}function C(t){return e(t)}function w(e,t){if(e.length===0||t.length===0)return``;let n=t.map(e=>e.header??e.key),r=e.map(e=>t.map(t=>C(e[t.key]))),i=n.map((e,t)=>{let n=e.length;for(let e of r){let r=e[t];r!==void 0&&r.length>n&&(n=r.length)}return n});return[n.map((e,t)=>e.padEnd(i[t]??0)).join(` `),i.map(e=>`-`.repeat(e)).join(` `),...r.map(e=>e.map((e,t)=>e.padEnd(i[t]??0)).join(` `))].join(`
2
- `)}function T(e){return new g(h(e))}function E(e){let t={stdout:[],stderr:[],activity:[]};return[new _(h({...e,stdout:e=>t.stdout.push(e),stderr:e=>t.stderr.push(e)}),t.activity),t]}export{E as createCaptureOutput,T as createOutput};
1
+ import{formatDisplayValue as e}from"./display-value.mjs";import{writeLine as t}from"./writer.mjs";import{CaptureProgressHandle as n,CaptureSpinnerHandle as r}from"./activity.mjs";import{resolveOutputPolicy as i,resolveProgressPolicy as a,resolveSpinnerPolicy as o,resolveTableFormat as s,resolveTableTextStream as c,resolveTextStream as l,shouldEmitInfo as u}from"./contracts.mjs";import{createProgressHandleFromPolicy as d,createSpinnerHandleFromPolicy as f,resolveWriterForStream as p}from"./renderers.mjs";const m=()=>{},h=new WeakMap;function g(e){if(!Number.isInteger(e)||e<0||e>255)throw RangeError(`Exit code must be an integer from 0 to 255`);return e}function _(e,t){h.set(e,g(t))}function v(e){return h.get(e)}function y(e){h.delete(e)}function b(e){return{stdout:e?.stdout??m,stderr:e?.stderr??m,isTTY:e?.isTTY??!1,verbosity:e?.verbosity??`normal`,jsonMode:e?.jsonMode??!1}}var x=class{options;policy;jsonMode;isTTY;constructor(e){this.options=e,this.policy=i(e),this.jsonMode=e.jsonMode,this.isTTY=e.isTTY}log(e){t(p(this.options,l(this.policy)),e)}info(e){u(this.policy)&&t(p(this.options,l(this.policy)),e)}warn(e){t(this.options.stderr,e)}error(e){t(this.options.stderr,e)}setExitCode(e){_(this,e)}json(e){t(this.options.stdout,JSON.stringify(e))}table(e,n,r){let{columns:i,options:a}=T(n,r),o=s(this.policy,a),c=i??C(e);if(o===`json`){this.json(E(e,c));return}let l=k(e,c);l.length!==0&&t(D(this.options,this.policy,o,a),l)}activeCleanup;stopActive(){this.activeCleanup!==void 0&&(this.activeCleanup(),this.activeCleanup=void 0)}spinner(e,t){let n=f(o(this.policy,t?.fallback??`silent`),e,this.options.stderr);return n.cleanup===void 0?n.handle:(this.stopActive(),this.activeCleanup=n.cleanup,n.handle)}progress(e){let t=d(a(this.policy,e.fallback??`silent`),e,this.options.stderr);return t.cleanup===void 0?t.handle:(this.stopActive(),this.activeCleanup=t.cleanup,t.handle)}},S=class extends x{activity;constructor(e,t){super(e),this.activity=t}spinner(e,t){return new r(e,this.activity)}progress(e){return new n(e,this.activity)}};function C(e){let t=e[0];return t===void 0?[]:Object.keys(t).map(e=>({key:e}))}function w(e){return Array.isArray(e)}function T(e,t){return t===void 0?w(e)?{columns:e,options:t}:{columns:void 0,options:e}:{columns:w(e)?e:void 0,options:t}}function E(e,t){return e.map(e=>Object.fromEntries(t.map(t=>[t.key,e[t.key]])))}function D(e,t,n,r){return n===`json`?e.stdout:p(e,c(t,r))}function O(t){return e(t)}function k(e,t){if(e.length===0||t.length===0)return``;let n=t.map(e=>e.header??e.key),r=e.map(e=>t.map(t=>O(e[t.key]))),i=n.map((e,t)=>{let n=e.length;for(let e of r){let r=e[t];r!==void 0&&r.length>n&&(n=r.length)}return n});return[n.map((e,t)=>e.padEnd(i[t]??0)).join(` `),i.map(e=>`-`.repeat(e)).join(` `),...r.map(e=>e.map((e,t)=>e.padEnd(i[t]??0)).join(` `))].join(`
2
+ `)}function A(e){return new x(b(e))}function j(e){let t={stdout:[],stderr:[],activity:[]};return[new S(b({...e,stdout:e=>t.stdout.push(e),stderr:e=>t.stderr.push(e)}),t.activity),t]}export{y as clearRequestedExitCode,j as createCaptureOutput,A as createOutput,v as getRequestedExitCode};
@@ -1,3 +1,4 @@
1
+ import { FlagSchema } from "../schema/flag.mjs";
1
2
  import { CommandSchema } from "../schema/command.mjs";
2
3
 
3
4
  //#region src/core/parse/index.d.ts
@@ -44,6 +45,19 @@ type Token = {
44
45
  * ```
45
46
  */
46
47
  declare function tokenize(argv: readonly string[]): readonly Token[];
48
+ /**
49
+ * Whether `token` appears in argv before the `--` end-of-options separator.
50
+ *
51
+ * Everything at or after the first `--` is a literal positional, so root-level
52
+ * flag interception (`--help` / `--version` / `--json`) must use this instead of
53
+ * a naive `Array.includes()` — otherwise a post-separator literal (`-- --json`)
54
+ * is wrongly treated as the flag.
55
+ *
56
+ * @param argv - Raw argument strings.
57
+ * @param token - Exact flag token to look for (e.g. `--version`).
58
+ * @returns `true` if `token` occurs before any `--` separator.
59
+ */
60
+ declare function includesBeforeSeparator(argv: readonly string[], token: string): boolean;
47
61
  /**
48
62
  * Raw parsed values before resolution (defaults, env, config, etc.).
49
63
  *
@@ -56,6 +70,22 @@ interface ParseResult {
56
70
  /** Positional arg values keyed by arg name. */
57
71
  readonly args: Readonly<Record<string, unknown>>;
58
72
  }
73
+ /**
74
+ * Build a map from flag name/alias → [canonicalName, {@link FlagSchema}].
75
+ *
76
+ * Supports both long names and single-char aliases for short flag expansion.
77
+ *
78
+ * @param flags - Flag schemas keyed by canonical name
79
+ * @returns Lookup map covering all names and aliases
80
+ */
81
+ declare function buildFlagLookup(flags: Readonly<Record<string, FlagSchema>>): ReadonlyMap<string, readonly [name: string, schema: FlagSchema]>;
82
+ /**
83
+ * Whether a flag kind expects a value argument (vs. being a bare boolean).
84
+ *
85
+ * @param schema - Flag schema to check
86
+ * @returns `true` if the flag expects a value token after it
87
+ */
88
+ declare function flagExpectsValue(schema: FlagSchema): boolean;
59
89
  /**
60
90
  * Parse tokenized argv against a command schema.
61
91
  *
@@ -76,4 +106,4 @@ interface ParseResult {
76
106
  */
77
107
  declare function parse(schema: CommandSchema, argv: readonly string[]): ParseResult;
78
108
  //#endregion
79
- export { type ParseResult, type Token, parse, tokenize };
109
+ export { type ParseResult, type Token, buildFlagLookup, flagExpectsValue, includesBeforeSeparator, parse, tokenize };
@@ -1 +1 @@
1
- import{getFlagAliasNames as e}from"../schema/flag.mjs";import{ParseError as t}from"../errors/index.mjs";function n(e){let t=[],n=!1;for(let r of e){if(n){t.push({kind:`positional`,value:r});continue}if(r===`--`){t.push({kind:`separator`}),n=!0;continue}if(r.startsWith(`--`)){let e=r.indexOf(`=`);e===-1?t.push({kind:`long-flag`,name:r.slice(2),value:void 0}):t.push({kind:`long-flag`,name:r.slice(2,e),value:r.slice(e+1)});continue}if(r.startsWith(`-`)&&r.length>1){t.push({kind:`short-flags`,chars:r.slice(1)});continue}t.push({kind:`positional`,value:r})}return t}function r(t){let n=new Map;for(let[r,i]of Object.entries(t)){n.set(r,[r,i]);for(let t of e(i,{includeHidden:!0}))n.set(t,[r,i])}return n}function i(e){return e.kind!==`boolean`}function a(e,n,r,i=`--${e}`){switch(r.kind){case`string`:return n;case`number`:{let r=Number(n);if(Number.isNaN(r))throw new t(`Invalid number value '${n}' for flag ${i}`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n,expected:`number`}});return r}case`boolean`:if(n===`true`||n===`1`)return!0;if(n===`false`||n===`0`)return!1;throw new t(`Invalid boolean value '${n}' for flag ${i}. Use true/false or 1/0`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n,expected:`boolean`}});case`enum`:{let a=r.enumValues;if(a===void 0)throw new t(`Enum flag --${e} is misconfigured: no allowed values declared`,{code:`INVALID_SCHEMA`,details:{flag:e,kind:`enum`,missing:`enumValues`}});if(!a.includes(n))throw new t(`Invalid value '${n}' for flag ${i}. Allowed: ${a.join(`, `)}`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n,allowed:a}});return n}case`array`:return r.elementSchema?a(e,n,r.elementSchema):n;case`custom`:if(!r.parseFn)return n;try{return r.parseFn(n)}catch(r){throw r instanceof t?r:new t(`Failed to parse flag ${i}: ${r instanceof Error?r.message:String(r)}`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n},cause:r})}}}function o(e,n,r){switch(r.kind){case`string`:return n;case`number`:{let r=Number(n);if(Number.isNaN(r))throw new t(`Invalid number value '${n}' for argument <${e}>`,{code:`INVALID_VALUE`,details:{arg:e,value:n,expected:`number`}});return r}case`enum`:{let i=r.enumValues;if(i===void 0)throw new t(`Enum argument <${e}> is misconfigured: no allowed values declared`,{code:`INVALID_SCHEMA`,details:{arg:e,kind:`enum`,missing:`enumValues`}});if(!i.includes(n))throw new t(`Invalid value '${n}' for argument <${e}>. Allowed: ${i.join(`, `)}`,{code:`INVALID_VALUE`,details:{arg:e,value:n,allowed:i}});return n}case`custom`:if(!r.parseFn)return n;try{return r.parseFn(n)}catch(r){throw r instanceof t?r:new t(`Failed to parse argument <${e}>: ${r instanceof Error?r.message:String(r)}`,{code:`INVALID_VALUE`,details:{arg:e,value:n},cause:r})}}}function s(e,t){let i=n(t),a=r(e.flags),o={},s=[],u=0;for(;u<i.length;){let e=i[u];if(e===void 0)break;if(e.kind===`separator`){u++;continue}if(e.kind===`positional`){s.push(e.value),u++;continue}if(e.kind===`long-flag`){u=c(e,i,u,a,o);continue}u=l(e,i,u,a,o)}return{flags:o,args:d(e.args,s)}}function c(e,n,r,o,s){let c=o.get(e.name);if(!c){let n=f(e.name,o);throw new t(`Unknown flag --${e.name}${n?`. Did you mean --${n}?`:``}`,{code:`UNKNOWN_FLAG`,details:{flag:e.name,...n?{suggestion:n}:{}},...n?{suggest:`--${n}`}:{}})}let[l,d]=c;if(!i(d))return e.value===void 0?s[l]=!0:s[l]=a(l,e.value,d,`--${e.name}`),r+1;if(e.value!==void 0)return u(s,l,d,e.value),r+1;let p=n[r+1];if(!p||p.kind!==`positional`)throw new t(`Flag --${e.name} requires a value`,{code:`MISSING_VALUE`,details:{flag:l,input:e.name,kind:d.kind}});return u(s,l,d,p.value,`--${e.name}`),r+2}function l(e,n,r,a,o){let{chars:s}=e,c=r+1;for(let e=0;e<s.length;e++){let r=s.charAt(e),l=a.get(r);if(!l)throw new t(`Unknown flag -${r}`,{code:`UNKNOWN_FLAG`,details:{flag:r}});let[d,f]=l;if(!i(f)){o[d]=!0;continue}if(e<s.length-1){u(o,d,f,s.slice(e+1),`-${r}`);break}let p=n[c];if(!p||p.kind!==`positional`)throw new t(`Flag -${r} requires a value`,{code:`MISSING_VALUE`,details:{flag:d,input:r,kind:f.kind}});u(o,d,f,p.value,`-${r}`),c++}return c}function u(e,t,n,r,i=`--${t}`){let o=a(t,r,n,i);if(n.kind===`array`){let n=e[t];Array.isArray(n)?n.push(o):e[t]=[o]}else e[t]=o}function d(e,n){let r={},i=0;for(let t of e){if(t.schema.variadic){let e=n.slice(i);r[t.name]=e.map(e=>o(t.name,e,t.schema)),i=n.length;break}let e=n[i];e!==void 0&&(r[t.name]=o(t.name,e,t.schema),i++)}if(i<n.length){let r=n.slice(i);throw new t(`Unexpected positional argument${r.length>1?`s`:``}: ${r.join(`, `)}`,{code:`UNEXPECTED_POSITIONAL`,details:{excess:r,expected:e.length}})}return r}function f(e,t){let n,r=1/0,i=Math.max(2,Math.floor(e.length/2));for(let a of t.keys()){let o=t.get(a);if(o===void 0)continue;let[s,c]=o,l=c.aliases.find(e=>e.name===a);if(a.length<2||a!==s&&l?.hidden)continue;let u=p(e,a);u<r&&u<=i&&(r=u,n=a)}return n}function p(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=e.length<=t.length?e:t,r=e.length<=t.length?t:e,i=n.length,a=r.length,o=Array.from({length:i+1},(e,t)=>t);for(let e=1;e<=a;e++){let t=o[0]??0;o[0]=e;for(let a=1;a<=i;a++){let i=n.charAt(a-1)===r.charAt(e-1)?0:1,s=Math.min((o[a]??0)+1,(o[a-1]??0)+1,t+i);t=o[a]??0,o[a]=s}}return o[i]??0}export{s as parse,n as tokenize};
1
+ import{getFlagAliasNames as e}from"../schema/flag.mjs";import{ParseError as t}from"../errors/index.mjs";function n(e){let t=[],n=!1;for(let r of e){if(n){t.push({kind:`positional`,value:r});continue}if(r===`--`){t.push({kind:`separator`}),n=!0;continue}if(r.startsWith(`--`)){let e=r.indexOf(`=`);e===-1?t.push({kind:`long-flag`,name:r.slice(2),value:void 0}):t.push({kind:`long-flag`,name:r.slice(2,e),value:r.slice(e+1)});continue}if(r.startsWith(`-`)&&r.length>1){t.push({kind:`short-flags`,chars:r.slice(1)});continue}t.push({kind:`positional`,value:r})}return t}function r(e,t){for(let n of e){if(n===`--`)return!1;if(n===t)return!0}return!1}function i(t){let n=new Map;for(let[r,i]of Object.entries(t)){n.set(r,[r,i]);for(let t of e(i,{includeHidden:!0}))n.set(t,[r,i])}return n}function a(e){return e.kind!==`boolean`}function o(e,n,r,i=`--${e}`){switch(r.kind){case`string`:return n;case`number`:{let r=Number(n);if(Number.isNaN(r))throw new t(`Invalid number value '${n}' for flag ${i}`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n,expected:`number`}});return r}case`boolean`:if(n===`true`||n===`1`)return!0;if(n===`false`||n===`0`)return!1;throw new t(`Invalid boolean value '${n}' for flag ${i}. Use true/false or 1/0`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n,expected:`boolean`}});case`enum`:{let a=r.enumValues;if(a===void 0)throw new t(`Enum flag --${e} is misconfigured: no allowed values declared`,{code:`INVALID_SCHEMA`,details:{flag:e,kind:`enum`,missing:`enumValues`}});if(!a.includes(n))throw new t(`Invalid value '${n}' for flag ${i}. Allowed: ${a.join(`, `)}`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n,allowed:a}});return n}case`array`:return r.elementSchema?o(e,n,r.elementSchema):n;case`custom`:if(!r.parseFn)return n;try{return r.parseFn(n)}catch(r){throw r instanceof t?r:new t(`Failed to parse flag ${i}: ${r instanceof Error?r.message:String(r)}`,{code:`INVALID_VALUE`,details:{flag:e,input:i,value:n},cause:r})}}}function s(e,n,r){switch(r.kind){case`string`:return n;case`number`:{let r=Number(n);if(Number.isNaN(r))throw new t(`Invalid number value '${n}' for argument <${e}>`,{code:`INVALID_VALUE`,details:{arg:e,value:n,expected:`number`}});return r}case`enum`:{let i=r.enumValues;if(i===void 0)throw new t(`Enum argument <${e}> is misconfigured: no allowed values declared`,{code:`INVALID_SCHEMA`,details:{arg:e,kind:`enum`,missing:`enumValues`}});if(!i.includes(n))throw new t(`Invalid value '${n}' for argument <${e}>. Allowed: ${i.join(`, `)}`,{code:`INVALID_VALUE`,details:{arg:e,value:n,allowed:i}});return n}case`custom`:if(!r.parseFn)return n;try{return r.parseFn(n)}catch(r){throw r instanceof t?r:new t(`Failed to parse argument <${e}>: ${r instanceof Error?r.message:String(r)}`,{code:`INVALID_VALUE`,details:{arg:e,value:n},cause:r})}}}function c(e,t){let r=n(t),a=i(e.flags),o={},s=[],c=0;for(;c<r.length;){let e=r[c];if(e===void 0)break;if(e.kind===`separator`){c++;continue}if(e.kind===`positional`){s.push(e.value),c++;continue}if(e.kind===`long-flag`){c=l(e,r,c,a,o);continue}c=u(e,r,c,a,o)}return{flags:o,args:f(e.args,s)}}function l(e,n,r,i,s){let c=i.get(e.name);if(!c){let n=p(e.name,i);throw new t(`Unknown flag --${e.name}${n?`. Did you mean --${n}?`:``}`,{code:`UNKNOWN_FLAG`,details:{flag:e.name,...n?{suggestion:n}:{}},...n?{suggest:`--${n}`}:{}})}let[l,u]=c;if(!a(u))return e.value===void 0?s[l]=!0:s[l]=o(l,e.value,u,`--${e.name}`),r+1;if(e.value!==void 0)return d(s,l,u,e.value),r+1;let f=n[r+1];if(f?.kind!==`positional`)throw new t(`Flag --${e.name} requires a value`,{code:`MISSING_VALUE`,details:{flag:l,input:e.name,kind:u.kind}});return d(s,l,u,f.value,`--${e.name}`),r+2}function u(e,n,r,i,o){let{chars:s}=e,c=r+1;for(let e=0;e<s.length;e++){let r=s.charAt(e),l=i.get(r);if(!l)throw new t(`Unknown flag -${r}`,{code:`UNKNOWN_FLAG`,details:{flag:r}});let[u,f]=l;if(!a(f)){o[u]=!0;continue}if(e<s.length-1){d(o,u,f,s.slice(e+1),`-${r}`);break}let p=n[c];if(p?.kind!==`positional`)throw new t(`Flag -${r} requires a value`,{code:`MISSING_VALUE`,details:{flag:u,input:r,kind:f.kind}});d(o,u,f,p.value,`-${r}`),c++}return c}function d(e,t,n,r,i=`--${t}`){let a=o(t,r,n,i);if(n.kind===`array`){let n=e[t];Array.isArray(n)?n.push(a):e[t]=[a]}else e[t]=a}function f(e,n){let r={},i=0;for(let t of e){if(t.schema.variadic){let e=n.slice(i);r[t.name]=e.map(e=>s(t.name,e,t.schema)),i=n.length;break}let e=n[i];e!==void 0&&(r[t.name]=s(t.name,e,t.schema),i++)}if(i<n.length){let r=n.slice(i);throw new t(`Unexpected positional argument${r.length>1?`s`:``}: ${r.join(`, `)}`,{code:`UNEXPECTED_POSITIONAL`,details:{excess:r,expected:e.length}})}return r}function p(e,t){let n,r=1/0,i=Math.max(2,Math.floor(e.length/2));for(let a of t.keys()){let o=t.get(a);if(o===void 0)continue;let[s,c]=o,l=c.aliases.find(e=>e.name===a);if(a.length<2||a!==s&&l?.hidden)continue;let u=m(e,a);u<r&&u<=i&&(r=u,n=a)}return n}function m(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=e.length<=t.length?e:t,r=e.length<=t.length?t:e,i=n.length,a=r.length,o=Array.from({length:i+1},(e,t)=>t);for(let e=1;e<=a;e++){let t=o[0]??0;o[0]=e;for(let a=1;a<=i;a++){let i=n.charAt(a-1)===r.charAt(e-1)?0:1,s=Math.min((o[a]??0)+1,(o[a-1]??0)+1,t+i);t=o[a]??0,o[a]=s}}return o[i]??0}export{i as buildFlagLookup,a as flagExpectsValue,r as includesBeforeSeparator,c as parse,n as tokenize};
@@ -166,4 +166,4 @@ interface TableOptionsText {
166
166
  /** Per-call rendering options for {@link Out.table}. */
167
167
  type TableOptions = TableOptionsAuto | TableOptionsJson | TableOptionsText;
168
168
  //#endregion
169
- export { type ActivityEvent, type Fallback, type ProgressHandle, type ProgressOptions, type SpinnerHandle, type SpinnerOptions, type TableColumn, type TableFormat, type TableOptions, type TableOptionsAuto, type TableOptionsJson, type TableOptionsText, type TableStream };
169
+ export type { ActivityEvent, Fallback, ProgressHandle, ProgressOptions, SpinnerHandle, SpinnerOptions, TableColumn, TableFormat, TableOptions, TableOptionsAuto, TableOptionsJson, TableOptionsText, TableStream };
@@ -116,6 +116,14 @@ interface Out {
116
116
  warn(message: string): void;
117
117
  /** Error to stderr. */
118
118
  error(message: string): void;
119
+ /**
120
+ * Request a process exit code without emitting error-shaped output.
121
+ *
122
+ * Use this for check/status commands that should print normal output but
123
+ * still signal a non-zero status to scripts. This does not stop execution;
124
+ * later calls overwrite earlier calls, and thrown errors still win.
125
+ */
126
+ setExitCode(code: number): void;
119
127
  /**
120
128
  * Emit a structured JSON value to stdout.
121
129
  *
@@ -133,9 +133,10 @@ interface RunOptions {
133
133
  /**
134
134
  * Structured result from {@linkcode runCommand}.
135
135
  *
136
- * Contains the exit code, captured stdout/stderr output, recorded
137
- * {@linkcode ActivityEvent | activity events}, and an `error` field
138
- * that is `undefined` on success and a {@linkcode CLIError} on failure.
136
+ * Contains the exit code, captured stdout/stderr output, recorded
137
+ * {@linkcode ActivityEvent | activity events}, and an `error` field.
138
+ * `error` is `undefined` when execution completed without throwing, even if
139
+ * the handler requested a non-zero status via {@linkcode Out.setExitCode}.
139
140
  *
140
141
  * @example
141
142
  * ```ts
@@ -162,8 +163,10 @@ interface RunResult {
162
163
  */
163
164
  readonly activity: readonly ActivityEvent[];
164
165
  /**
165
- * The error that caused a non-zero exit, or `undefined` on success.
166
- * {@linkcode CLIError} instances are preserved; unknown errors are wrapped.
166
+ * The error that caused a failure, or `undefined` when execution completed.
167
+ * A non-zero `exitCode` can still have no error when a handler calls
168
+ * {@linkcode Out.setExitCode}. {@linkcode CLIError} instances are preserved;
169
+ * unknown errors are wrapped.
167
170
  */
168
171
  readonly error: CLIError | undefined;
169
172
  }
@@ -1,2 +1,2 @@
1
1
  const e={"{":`lbrace`,"}":`rbrace`,"[":`lbracket`,"]":`rbracket`,"<":`langle`,">":`rangle`,",":`comma`,":":`colon`,";":`semicolon`,"?":`question`,"|":`pipe`};function t(e){return e===` `||e===`
2
- `||e===` `||e===`\r`}function n(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`_`||e===`$`}function r(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`||e===`$`}function i(i){let a=[],o=0;for(;o<i.length;){let s=i[o]??``;if(t(s)){o++;continue}let c=e[s];if(c!==void 0){a.push({kind:c,value:s}),o++;continue}if(s===`'`){let e=``;for(o++;o<i.length&&i[o]!==`'`;)e+=i[o],o++;if(o>=i.length)throw SyntaxError(`Unterminated string literal`);o++,a.push({kind:`string_literal`,value:e});continue}if(s===`@`){o++;let e=``;for(;o<i.length;){let t=i[o]??``;if(!n(t))break;e+=t,o++}if(e.length===0)throw SyntaxError(`Expected identifier after '@' at position ${String(o)}`);a.push({kind:`ref`,value:e});continue}if(r(s)){let e=``;for(;o<i.length;){let t=i[o]??``;if(!n(t))break;e+=t,o++}a.push({kind:`ident`,value:e});continue}throw SyntaxError(`Unexpected character '${s}' at position ${String(o)}`)}return a}const a=new Set([`string`,`number`,`integer`,`boolean`,`true`,`false`,`null`,`undefined`,`unknown`,`never`]);function o(e){switch(e){case`string`:return{kind:`string`};case`number`:return{kind:`number`};case`integer`:return{kind:`integer`};case`boolean`:return{kind:`boolean`};case`true`:return{kind:`true`};case`false`:return{kind:`false`};case`null`:return{kind:`null`};case`undefined`:return{kind:`undefined`};case`unknown`:return{kind:`unknown`};case`never`:return{kind:`never`};default:throw SyntaxError(`Unknown type '${e}'`)}}var s=class{pos=0;constructor(e){this.tokens=e}parseRoot(){let e=this.parseValue();if(this.pos<this.tokens.length){let e=this.peek();throw SyntaxError(`Unexpected token '${e?.value??`?`}' at position ${String(this.pos)}`)}return e}parseValue(){return this.parseUnion()}parseUnion(){let e=this.parsePostfix();if(!this.check(`pipe`))return e;let t=[e];for(;this.match(`pipe`);)t.push(this.parsePostfix());return{kind:`union`,members:t}}parsePostfix(){let e=this.parsePrimary();for(;this.check(`lbracket`)&&this.checkAt(this.pos+1,`rbracket`);)this.advance(),this.advance(),e={kind:`array`,element:e};return e}parsePrimary(){if(this.check(`lbrace`))return this.parseObject();if(this.check(`string_literal`))return{kind:`literal`,value:this.advance().value};if(this.check(`ref`))return{kind:`ref`,target:this.advance().value};let e=this.expectIdent();if(e===`Record`){if(this.expect(`langle`),this.parseValue().kind!==`string`)throw SyntaxError(`Record key type must be 'string' because JSON object keys are always strings`);this.expect(`comma`);let e=this.parseValue();return this.expect(`rangle`),{kind:`record`,value:e}}if(!a.has(e))throw SyntaxError(`Unknown type '${e}' at position ${String(this.pos-1)}`);return o(e)}parseObject(){this.expect(`lbrace`);let e={};for(;!this.check(`rbrace`);){let t=this.expectIdent();if(Object.hasOwn(e,t))throw SyntaxError(`Duplicate property '${t}' at position ${String(this.pos-1)}`);let n=this.match(`question`);this.expect(`colon`),e[t]={optional:n,schema:this.parseValue()},this.match(`semicolon`)}return this.expect(`rbrace`),{kind:`object`,properties:e}}peek(){return this.tokens[this.pos]}check(e){return this.peek()?.kind===e}checkAt(e,t){return this.tokens[e]?.kind===t}advance(){let e=this.tokens[this.pos];if(e===void 0)throw SyntaxError(`Unexpected end of input`);return this.pos++,e}match(e){return this.check(e)?(this.pos++,!0):!1}expect(e){if(!this.check(e)){let t=this.peek();throw SyntaxError(t?`Expected '${e}' but got '${t.kind}' ('${t.value}') at position ${String(this.pos)}`:`Expected '${e}' but reached end of input`)}return this.advance()}expectIdent(){return this.expect(`ident`).value}};function c(e){return new s(i(e)).parseRoot()}export{c as parseSchema};
2
+ `||e===` `||e===`\r`}function n(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`_`||e===`$`}function r(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`||e===`$`}function i(i){let a=[],o=0;for(;o<i.length;){let s=i[o]??``;if(t(s)){o++;continue}let c=e[s];if(c!==void 0){a.push({kind:c,value:s}),o++;continue}if(s===`'`){let e=``;for(o++;o<i.length&&i[o]!==`'`;)e+=i[o],o++;if(o>=i.length)throw SyntaxError(`Unterminated string literal`);o++,a.push({kind:`string_literal`,value:e});continue}if(s===`@`){o++;let e=``;for(;o<i.length;){let t=i[o]??``;if(!n(t))break;e+=t,o++}if(e.length===0)throw SyntaxError(`Expected identifier after '@' at position ${String(o)}`);a.push({kind:`ref`,value:e});continue}if(r(s)){let e=``;for(;o<i.length;){let t=i[o]??``;if(!n(t))break;e+=t,o++}a.push({kind:`ident`,value:e});continue}throw SyntaxError(`Unexpected character '${s}' at position ${String(o)}`)}return a}const a=new Set([`string`,`number`,`integer`,`boolean`,`true`,`false`,`null`,`undefined`,`unknown`,`never`]);function o(e){switch(e){case`string`:return{kind:`string`};case`number`:return{kind:`number`};case`integer`:return{kind:`integer`};case`boolean`:return{kind:`boolean`};case`true`:return{kind:`true`};case`false`:return{kind:`false`};case`null`:return{kind:`null`};case`undefined`:return{kind:`undefined`};case`unknown`:return{kind:`unknown`};case`never`:return{kind:`never`};default:throw SyntaxError(`Unknown type '${e}'`)}}var s=class{tokens;pos=0;constructor(e){this.tokens=e}parseRoot(){let e=this.parseValue();if(this.pos<this.tokens.length){let e=this.peek();throw SyntaxError(`Unexpected token '${e?.value??`?`}' at position ${String(this.pos)}`)}return e}parseValue(){return this.parseUnion()}parseUnion(){let e=this.parsePostfix();if(!this.check(`pipe`))return e;let t=[e];for(;this.match(`pipe`);)t.push(this.parsePostfix());return{kind:`union`,members:t}}parsePostfix(){let e=this.parsePrimary();for(;this.check(`lbracket`)&&this.checkAt(this.pos+1,`rbracket`);)this.advance(),this.advance(),e={kind:`array`,element:e};return e}parsePrimary(){if(this.check(`lbrace`))return this.parseObject();if(this.check(`string_literal`))return{kind:`literal`,value:this.advance().value};if(this.check(`ref`))return{kind:`ref`,target:this.advance().value};let e=this.expectIdent();if(e===`Record`){if(this.expect(`langle`),this.parseValue().kind!==`string`)throw SyntaxError(`Record key type must be 'string' because JSON object keys are always strings`);this.expect(`comma`);let e=this.parseValue();return this.expect(`rangle`),{kind:`record`,value:e}}if(!a.has(e))throw SyntaxError(`Unknown type '${e}' at position ${String(this.pos-1)}`);return o(e)}parseObject(){this.expect(`lbrace`);let e={};for(;!this.check(`rbrace`);){let t=this.expectIdent();if(Object.hasOwn(e,t))throw SyntaxError(`Duplicate property '${t}' at position ${String(this.pos-1)}`);let n=this.match(`question`);this.expect(`colon`),e[t]={optional:n,schema:this.parseValue()},this.match(`semicolon`)}return this.expect(`rbrace`),{kind:`object`,properties:e}}peek(){return this.tokens[this.pos]}check(e){return this.peek()?.kind===e}checkAt(e,t){return this.tokens[e]?.kind===t}advance(){let e=this.tokens[this.pos];if(e===void 0)throw SyntaxError(`Unexpected end of input`);return this.pos++,e}match(e){return this.check(e)?(this.pos++,!0):!1}expect(e){if(!this.check(e)){let t=this.peek();throw SyntaxError(t?`Expected '${e}' but got '${t.kind}' ('${t.value}') at position ${String(this.pos)}`:`Expected '${e}' but reached end of input`)}return this.advance()}expectIdent(){return this.expect(`ident`).value}};function c(e){return new s(i(e)).parseRoot()}export{c as parseSchema};
@@ -1 +1 @@
1
- import{buildRunResult as e,executeCommand as t}from"../execution/index.mjs";import{createCaptureOutput as n}from"../output/index.mjs";async function r(r,i,a){let o,s;if(a?.out!==void 0)o=a.out,s=a.captured??{stdout:[],stderr:[],activity:[]};else{let e={...a?.verbosity===void 0?{}:{verbosity:a.verbosity},...a?.jsonMode===void 0?{}:{jsonMode:a.jsonMode},...a?.isTTY===void 0?{}:{isTTY:a.isTTY}};[o,s]=n(Object.keys(e).length>0?e:void 0)}let c=a?.mergedSchema??r.schema,l=a?.meta??{name:c.name,bin:a?.help?.binName??c.name,version:void 0,command:c.name};return e(await t({command:r,argv:i,out:o,schema:c,meta:l,...a===void 0?{}:{options:a}}),s)}export{r as runCommand};
1
+ import{createCaptureOutput as e}from"../output/index.mjs";import{buildRunResult as t,executeCommand as n}from"../execution/index.mjs";async function r(r,i,a){let o,s;if(a?.out!==void 0)o=a.out,s=a.captured??{stdout:[],stderr:[],activity:[]};else{let t={...a?.verbosity===void 0?{}:{verbosity:a.verbosity},...a?.jsonMode===void 0?{}:{jsonMode:a.jsonMode},...a?.isTTY===void 0?{}:{isTTY:a.isTTY}};[o,s]=e(Object.keys(t).length>0?t:void 0)}let c=a?.mergedSchema??r.schema,l=a?.meta??{name:c.name,bin:a?.help?.binName??c.name,version:void 0,command:c.name};return t(await n({command:r,argv:i,out:o,schema:c,meta:l,...a===void 0?{}:{options:a}}),s)}export{r as runCommand};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{FlagBuilder as e,createSchema as t,flag as n}from"./core/schema/flag.mjs";import{generateBashCompletion as r}from"./core/completion/shells/bash.mjs";import{generateFishCompletion as i}from"./core/completion/shells/fish.mjs";import{generatePowerShellCompletion as a}from"./core/completion/shells/powershell.mjs";import{CLIError as o,ParseError as s,ValidationError as c,isCLIError as l,isParseError as u,isValidationError as d}from"./core/errors/index.mjs";import{generateZshCompletion as f}from"./core/completion/shells/zsh.mjs";import{SHELLS as p,generateCompletion as m}from"./core/completion/index.mjs";import{osc8 as h,visibleWidth as g}from"./core/help/ansi.mjs";import{formatHelp as _}from"./core/help/index.mjs";import{parse as v,tokenize as y}from"./core/parse/index.mjs";import{createTerminalPrompter as b,resolvePromptConfig as x}from"./core/prompt/index.mjs";import{resolve as S}from"./core/resolve/index.mjs";import{createOutput as C}from"./core/output/index.mjs";import{ArgBuilder as w,arg as T,createArgSchema as E}from"./core/schema/arg.mjs";import{CommandBuilder as D,command as O,group as k}from"./core/schema/command.mjs";import{discoverPackageJson as A,inferCliName as j,packageRepositoryUrl as M}from"./core/config/package-json.mjs";import{plugin as N}from"./core/cli/plugin.mjs";import{buildConfigSearchPaths as P,configFormat as F,discoverConfig as I}from"./core/config/index.mjs";import{CLIBuilder as L,cli as R}from"./core/cli/index.mjs";import{definitionMetaSchema as z,generateInputSchema as B,generateSchema as V}from"./core/json-schema/index.mjs";import{middleware as H}from"./core/schema/middleware.mjs";export{w as ArgBuilder,L as CLIBuilder,o as CLIError,D as CommandBuilder,e as FlagBuilder,s as ParseError,p as SHELLS,c as ValidationError,T as arg,P as buildConfigSearchPaths,R as cli,O as command,F as configFormat,E as createArgSchema,C as createOutput,t as createSchema,b as createTerminalPrompter,z as definitionMetaSchema,I as discoverConfig,A as discoverPackageJson,n as flag,_ as formatHelp,r as generateBashCompletion,m as generateCompletion,i as generateFishCompletion,B as generateInputSchema,a as generatePowerShellCompletion,V as generateSchema,f as generateZshCompletion,k as group,j as inferCliName,l as isCLIError,u as isParseError,d as isValidationError,H as middleware,h as osc8,M as packageRepositoryUrl,v as parse,N as plugin,S as resolve,x as resolvePromptConfig,y as tokenize,g as visibleWidth};
1
+ import{FlagBuilder as e,createSchema as t,flag as n}from"./core/schema/flag.mjs";import{generateBashCompletion as r}from"./core/completion/shells/bash.mjs";import{generateFishCompletion as i}from"./core/completion/shells/fish.mjs";import{generatePowerShellCompletion as a}from"./core/completion/shells/powershell.mjs";import{CLIError as o,ParseError as s,ValidationError as c,isCLIError as l,isParseError as u,isValidationError as d}from"./core/errors/index.mjs";import{generateZshCompletion as f}from"./core/completion/shells/zsh.mjs";import{SHELLS as p,generateCompletion as m}from"./core/completion/index.mjs";import{osc8 as h,visibleWidth as g}from"./core/help/ansi.mjs";import{formatHelp as _}from"./core/help/index.mjs";import{createOutput as v}from"./core/output/index.mjs";import{parse as y,tokenize as b}from"./core/parse/index.mjs";import{createTerminalPrompter as x,resolvePromptConfig as S}from"./core/prompt/index.mjs";import{resolve as C}from"./core/resolve/index.mjs";import{ArgBuilder as w,arg as T,createArgSchema as E}from"./core/schema/arg.mjs";import{CommandBuilder as D,command as O,group as k}from"./core/schema/command.mjs";import{discoverPackageJson as A,inferCliName as j,packageRepositoryUrl as M}from"./core/config/package-json.mjs";import{plugin as N}from"./core/cli/plugin.mjs";import{buildConfigSearchPaths as P,configFormat as F,discoverConfig as I}from"./core/config/index.mjs";import{CLIBuilder as L,cli as R}from"./core/cli/index.mjs";import{definitionMetaSchema as z,generateInputSchema as B,generateSchema as V}from"./core/json-schema/index.mjs";import{middleware as H}from"./core/schema/middleware.mjs";export{w as ArgBuilder,L as CLIBuilder,o as CLIError,D as CommandBuilder,e as FlagBuilder,s as ParseError,p as SHELLS,c as ValidationError,T as arg,P as buildConfigSearchPaths,R as cli,O as command,F as configFormat,E as createArgSchema,v as createOutput,t as createSchema,x as createTerminalPrompter,z as definitionMetaSchema,I as discoverConfig,A as discoverPackageJson,n as flag,_ as formatHelp,r as generateBashCompletion,m as generateCompletion,i as generateFishCompletion,B as generateInputSchema,a as generatePowerShellCompletion,V as generateSchema,f as generateZshCompletion,k as group,j as inferCliName,l as isCLIError,u as isParseError,d as isValidationError,H as middleware,h as osc8,M as packageRepositoryUrl,y as parse,N as plugin,C as resolve,S as resolvePromptConfig,b as tokenize,g as visibleWidth};
@@ -1 +1 @@
1
- function e(e,t){return t?e.USERPROFILE?e.USERPROFILE:e.HOMEDRIVE&&e.HOMEPATH?e.HOMEDRIVE+e.HOMEPATH:e.HOME||`C:\\`:e.HOME||`/`}function t(e,t,n){if(t)return e.APPDATA!==void 0&&e.APPDATA!==``?e.APPDATA:`${n.replace(/[\\/]+$/,``)||n}\\AppData\\Roaming`;let r=n.replace(/\/+$/,``);return e.XDG_CONFIG_HOME!==void 0&&e.XDG_CONFIG_HOME!==``?e.XDG_CONFIG_HOME:r.length===0?`/.config`:`${r}/.config`}export{t as resolveConfigDirectory,e as resolveHomeDirectory};
1
+ import{stripTrailing as e}from"../strings.mjs";function t(e,t){return t?e.USERPROFILE?e.USERPROFILE:e.HOMEDRIVE&&e.HOMEPATH?e.HOMEDRIVE+e.HOMEPATH:e.HOME||`C:\\`:e.HOME||`/`}function n(t,n,r){if(n)return t.APPDATA!==void 0&&t.APPDATA!==``?t.APPDATA:`${e(r,[47,92])||r}\\AppData\\Roaming`;let i=e(r,[47]);return t.XDG_CONFIG_HOME!==void 0&&t.XDG_CONFIG_HOME!==``?t.XDG_CONFIG_HOME:i.length===0?`/.config`:`${i}/.config`}export{n as resolveConfigDirectory,t as resolveHomeDirectory};
@@ -0,0 +1,27 @@
1
+ //#region src/strings.d.ts
2
+ /**
3
+ * Internal string utilities shared across runtime and core modules.
4
+ *
5
+ * @module dreamcli/strings
6
+ */
7
+ /** Character code for `/` (forward slash). */
8
+ declare const SLASH = 47;
9
+ /** Character code for `\` (backslash). */
10
+ declare const BACKSLASH = 92;
11
+ /**
12
+ * Remove trailing characters whose code points appear in `codes`.
13
+ *
14
+ * Linear-time replacement for trailing-character regexes such as
15
+ * `/[\\/]+$/`. Those patterns are polynomial-ReDoS prone: the engine
16
+ * greedily consumes the run, fails the end anchor, backtracks one
17
+ * character at a time, and repeats that work from every start position —
18
+ * O(n²) on adversarial input. This scan is O(n) with no backtracking.
19
+ *
20
+ * @param input - Source string.
21
+ * @param codes - Character codes to strip from the end of `input`.
22
+ * @returns `input` with all trailing matching characters removed.
23
+ * @internal
24
+ */
25
+ declare function stripTrailing(input: string, codes: readonly number[]): string;
26
+ //#endregion
27
+ export { BACKSLASH, SLASH, stripTrailing };
@@ -0,0 +1 @@
1
+ function e(e,t){let n=e.length;for(;n>0&&t.includes(e.charCodeAt(n-1));)--n;return n===e.length?e:e.slice(0,n)}export{e as stripTrailing};
package/dist/testkit.mjs CHANGED
@@ -1 +1 @@
1
- import{PROMPT_CANCEL as e,createTestPrompter as t}from"./core/prompt/index.mjs";import{createCaptureOutput as n}from"./core/output/index.mjs";import{runCommand as r}from"./core/testkit/index.mjs";import{createTestAdapter as i}from"./runtime/adapter.mjs";export{e as PROMPT_CANCEL,n as createCaptureOutput,i as createTestAdapter,t as createTestPrompter,r as runCommand};
1
+ import{createCaptureOutput as e}from"./core/output/index.mjs";import{PROMPT_CANCEL as t,createTestPrompter as n}from"./core/prompt/index.mjs";import{runCommand as r}from"./core/testkit/index.mjs";import{createTestAdapter as i}from"./runtime/adapter.mjs";export{t as PROMPT_CANCEL,e as createCaptureOutput,i as createTestAdapter,n as createTestPrompter,r as runCommand};
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- const e=`2.2.1`,t=`b084f93`;export{t as DREAMCLI_REVISION,e as DREAMCLI_VERSION};
1
+ const e=`2.4.0`,t=`9e1ac50`;export{t as DREAMCLI_REVISION,e as DREAMCLI_VERSION};