@kjanat/dreamcli 4.0.0-rc.3 → 4.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 (212) hide show
  1. package/README.md +5 -7
  2. package/dist/{runtime/adapter.d.mts → adapter-YM5QGi3M.d.mts} +4 -4
  3. package/dist/completion-CUMeOnAz.mjs +6 -0
  4. package/dist/completion.d.mts +90 -0
  5. package/dist/completion.mjs +1 -0
  6. package/dist/config-CrlScpYX.mjs +1 -0
  7. package/dist/config.d.mts +2 -0
  8. package/dist/config.mjs +1 -0
  9. package/dist/core-DvXUolc_.mjs +17 -0
  10. package/dist/{core/json-schema/index.d.mts → index-3l8uj16E.d.mts} +43 -34
  11. package/dist/{core/cli/index.d.mts → index-BAj2y70U.d.mts} +116 -57
  12. package/dist/index-BziI2aKc.d.mts +5440 -0
  13. package/dist/index-Cap0MA2V.d.mts +277 -0
  14. package/dist/index-Cp9kt2t-.d.mts +370 -0
  15. package/dist/index-DWsnGZlx.d.mts +831 -0
  16. package/dist/index.d.mts +190 -41
  17. package/dist/index.mjs +1 -26
  18. package/dist/json-schema-DRlrz_IV.mjs +52 -0
  19. package/dist/json-schema.d.mts +2 -0
  20. package/dist/json-schema.mjs +1 -0
  21. package/dist/package-json-BgE9YjjQ.mjs +3 -0
  22. package/dist/prompt.d.mts +48 -0
  23. package/dist/prompt.mjs +1 -0
  24. package/dist/rolldown-runtime-G4Kt5YOX.mjs +1 -0
  25. package/dist/runtime.d.mts +2 -6
  26. package/dist/runtime.mjs +1 -6
  27. package/dist/terminal-C8KTXjv5.mjs +6 -0
  28. package/dist/test-prompter-v__jT2yG.mjs +1 -0
  29. package/dist/testkit.d.mts +54 -6
  30. package/dist/testkit.mjs +1 -5
  31. package/dist/version.mjs +1 -7
  32. package/dreamcli.schema.json +697 -538
  33. package/package.json +29 -7
  34. package/skills/cli-creation/SKILL.md +16 -11
  35. package/CHANGELOG.md +0 -1116
  36. package/dist/core/cli/builtins.d.mts +0 -117
  37. package/dist/core/cli/builtins.mjs +0 -135
  38. package/dist/core/cli/compiled.d.mts +0 -66
  39. package/dist/core/cli/compiled.mjs +0 -76
  40. package/dist/core/cli/dispatch.d.mts +0 -115
  41. package/dist/core/cli/dispatch.mjs +0 -205
  42. package/dist/core/cli/help-links.d.mts +0 -27
  43. package/dist/core/cli/help-links.mjs +0 -41
  44. package/dist/core/cli/index.mjs +0 -1271
  45. package/dist/core/cli/planner.d.mts +0 -174
  46. package/dist/core/cli/planner.mjs +0 -323
  47. package/dist/core/cli/plugin.d.mts +0 -94
  48. package/dist/core/cli/plugin.mjs +0 -41
  49. package/dist/core/cli/propagate.d.mts +0 -39
  50. package/dist/core/cli/propagate.mjs +0 -57
  51. package/dist/core/cli/reserved-flags.d.mts +0 -19
  52. package/dist/core/cli/reserved-flags.mjs +0 -158
  53. package/dist/core/cli/root-help.d.mts +0 -53
  54. package/dist/core/cli/root-help.mjs +0 -221
  55. package/dist/core/cli/root-output-flags.d.mts +0 -74
  56. package/dist/core/cli/root-output-flags.mjs +0 -169
  57. package/dist/core/cli/root-surface.d.mts +0 -64
  58. package/dist/core/cli/root-surface.mjs +0 -28
  59. package/dist/core/cli/runtime-preflight.d.mts +0 -213
  60. package/dist/core/cli/runtime-preflight.mjs +0 -221
  61. package/dist/core/completion/index.d.mts +0 -76
  62. package/dist/core/completion/index.mjs +0 -90
  63. package/dist/core/completion/shells/bash.d.mts +0 -23
  64. package/dist/core/completion/shells/bash.mjs +0 -312
  65. package/dist/core/completion/shells/fish.d.mts +0 -19
  66. package/dist/core/completion/shells/fish.mjs +0 -164
  67. package/dist/core/completion/shells/powershell.d.mts +0 -13
  68. package/dist/core/completion/shells/powershell.mjs +0 -360
  69. package/dist/core/completion/shells/shared.d.mts +0 -164
  70. package/dist/core/completion/shells/shared.mjs +0 -147
  71. package/dist/core/completion/shells/zsh.d.mts +0 -23
  72. package/dist/core/completion/shells/zsh.mjs +0 -256
  73. package/dist/core/config/index.d.mts +0 -191
  74. package/dist/core/config/index.mjs +0 -285
  75. package/dist/core/config/package-json.d.mts +0 -179
  76. package/dist/core/config/package-json.mjs +0 -353
  77. package/dist/core/errors/index.d.mts +0 -125
  78. package/dist/core/errors/index.mjs +0 -87
  79. package/dist/core/execution/index.d.mts +0 -61
  80. package/dist/core/execution/index.mjs +0 -220
  81. package/dist/core/help/ansi.d.mts +0 -84
  82. package/dist/core/help/ansi.mjs +0 -121
  83. package/dist/core/help/index.d.mts +0 -149
  84. package/dist/core/help/index.mjs +0 -418
  85. package/dist/core/help/theme.d.mts +0 -86
  86. package/dist/core/help/theme.mjs +0 -69
  87. package/dist/core/json-schema/index.mjs +0 -1008
  88. package/dist/core/json-schema/meta-descriptions.generated.d.mts +0 -274
  89. package/dist/core/json-schema/meta-descriptions.generated.mjs +0 -136
  90. package/dist/core/output/activity.d.mts +0 -193
  91. package/dist/core/output/activity.mjs +0 -452
  92. package/dist/core/output/bind.d.mts +0 -37
  93. package/dist/core/output/bind.mjs +0 -56
  94. package/dist/core/output/contracts.d.mts +0 -82
  95. package/dist/core/output/contracts.mjs +0 -57
  96. package/dist/core/output/display-value.d.mts +0 -19
  97. package/dist/core/output/display-value.mjs +0 -32
  98. package/dist/core/output/index.d.mts +0 -344
  99. package/dist/core/output/index.mjs +0 -514
  100. package/dist/core/output/renderers.d.mts +0 -45
  101. package/dist/core/output/renderers.mjs +0 -46
  102. package/dist/core/output/writer.d.mts +0 -39
  103. package/dist/core/output/writer.mjs +0 -12
  104. package/dist/core/parse/index.d.mts +0 -178
  105. package/dist/core/parse/index.mjs +0 -850
  106. package/dist/core/parse/occurrences.d.mts +0 -90
  107. package/dist/core/parse/occurrences.mjs +0 -114
  108. package/dist/core/prompt/index.d.mts +0 -213
  109. package/dist/core/prompt/index.mjs +0 -348
  110. package/dist/core/read-flags/index.d.mts +0 -150
  111. package/dist/core/read-flags/index.mjs +0 -217
  112. package/dist/core/resolve/args.d.mts +0 -39
  113. package/dist/core/resolve/args.mjs +0 -182
  114. package/dist/core/resolve/coerce.d.mts +0 -79
  115. package/dist/core/resolve/coerce.mjs +0 -900
  116. package/dist/core/resolve/config.d.mts +0 -10
  117. package/dist/core/resolve/config.mjs +0 -19
  118. package/dist/core/resolve/contracts.d.mts +0 -146
  119. package/dist/core/resolve/errors.d.mts +0 -10
  120. package/dist/core/resolve/errors.mjs +0 -148
  121. package/dist/core/resolve/flags.d.mts +0 -74
  122. package/dist/core/resolve/flags.mjs +0 -246
  123. package/dist/core/resolve/index.d.mts +0 -44
  124. package/dist/core/resolve/index.mjs +0 -123
  125. package/dist/core/resolve/path-checks.d.mts +0 -48
  126. package/dist/core/resolve/path-checks.mjs +0 -102
  127. package/dist/core/resolve/redaction.d.mts +0 -13
  128. package/dist/core/resolve/redaction.mjs +0 -14
  129. package/dist/core/resolve/stages.d.mts +0 -86
  130. package/dist/core/resolve/stages.mjs +0 -170
  131. package/dist/core/resolve/standard.d.mts +0 -26
  132. package/dist/core/resolve/standard.mjs +0 -212
  133. package/dist/core/schema/activity.d.mts +0 -189
  134. package/dist/core/schema/arg.d.mts +0 -1461
  135. package/dist/core/schema/arg.mjs +0 -1139
  136. package/dist/core/schema/brand.d.mts +0 -17
  137. package/dist/core/schema/cardinality.d.mts +0 -302
  138. package/dist/core/schema/cardinality.mjs +0 -514
  139. package/dist/core/schema/command.d.mts +0 -1132
  140. package/dist/core/schema/command.mjs +0 -999
  141. package/dist/core/schema/flag.d.mts +0 -1495
  142. package/dist/core/schema/flag.mjs +0 -1207
  143. package/dist/core/schema/index.d.mts +0 -15
  144. package/dist/core/schema/index.mjs +0 -10
  145. package/dist/core/schema/middleware.d.mts +0 -129
  146. package/dist/core/schema/middleware.mjs +0 -41
  147. package/dist/core/schema/number-constraints.d.mts +0 -96
  148. package/dist/core/schema/number-constraints.mjs +0 -60
  149. package/dist/core/schema/prompt.d.mts +0 -135
  150. package/dist/core/schema/provenance.d.mts +0 -99
  151. package/dist/core/schema/provenance.mjs +0 -28
  152. package/dist/core/schema/run.d.mts +0 -211
  153. package/dist/core/schema/source.d.mts +0 -180
  154. package/dist/core/schema/source.mjs +0 -206
  155. package/dist/core/schema/standard.d.mts +0 -100
  156. package/dist/core/schema/standard.mjs +0 -15
  157. package/dist/core/schema/stdin.d.mts +0 -97
  158. package/dist/core/schema/stdin.mjs +0 -91
  159. package/dist/core/schema/string-constraints.d.mts +0 -108
  160. package/dist/core/schema/string-constraints.mjs +0 -86
  161. package/dist/core/schema/value-parsers.d.mts +0 -150
  162. package/dist/core/schema/value-parsers.mjs +0 -160
  163. package/dist/core/schema/value.d.mts +0 -243
  164. package/dist/core/schema/value.mjs +0 -573
  165. package/dist/core/testkit/index.d.mts +0 -63
  166. package/dist/core/testkit/index.mjs +0 -102
  167. package/dist/runtime/adapter.mjs +0 -92
  168. package/dist/runtime/auto.d.mts +0 -25
  169. package/dist/runtime/auto.mjs +0 -45
  170. package/dist/runtime/deno.d.mts +0 -99
  171. package/dist/runtime/deno.mjs +0 -265
  172. package/dist/runtime/detect.d.mts +0 -86
  173. package/dist/runtime/detect.mjs +0 -45
  174. package/dist/runtime/index.d.mts +0 -6
  175. package/dist/runtime/node.d.mts +0 -71
  176. package/dist/runtime/node.mjs +0 -228
  177. package/dist/runtime/paths.d.mts +0 -31
  178. package/dist/runtime/paths.mjs +0 -48
  179. package/dist/strings.d.mts +0 -27
  180. package/dist/strings.mjs +0 -22
  181. package/examples/basic.ts +0 -37
  182. package/examples/flag-types.ts +0 -79
  183. package/examples/gh/package.json +0 -45
  184. package/examples/gh/src/commands/auth.ts +0 -66
  185. package/examples/gh/src/commands/issue.ts +0 -120
  186. package/examples/gh/src/commands/pr.ts +0 -125
  187. package/examples/gh/src/data/issues.yaml +0 -5
  188. package/examples/gh/src/data/issues.yaml.d.ts +0 -17
  189. package/examples/gh/src/data/pull-requests.yaml +0 -7
  190. package/examples/gh/src/data/pull-requests.yaml.d.ts +0 -18
  191. package/examples/gh/src/docs.ts +0 -11
  192. package/examples/gh/src/lib/auth.ts +0 -37
  193. package/examples/gh/src/lib/utils.ts +0 -17
  194. package/examples/gh/src/main.test.ts +0 -307
  195. package/examples/gh/src/main.ts +0 -46
  196. package/examples/help-config.ts +0 -43
  197. package/examples/interactive.ts +0 -67
  198. package/examples/json-mode.ts +0 -95
  199. package/examples/middleware.ts +0 -71
  200. package/examples/multi-command.ts +0 -66
  201. package/examples/output-extras.ts +0 -46
  202. package/examples/parser-control.ts +0 -40
  203. package/examples/pwsh-demo/README.md +0 -40
  204. package/examples/pwsh-demo/package.json +0 -41
  205. package/examples/pwsh-demo/pwsh-demo.cmd +0 -3
  206. package/examples/pwsh-demo/smoke-powershell.ps1 +0 -218
  207. package/examples/pwsh-demo/src/main.test.ts +0 -45
  208. package/examples/pwsh-demo/src/main.ts +0 -140
  209. package/examples/spinner-progress.ts +0 -49
  210. package/examples/standard-schema.ts +0 -45
  211. package/examples/testing.ts +0 -147
  212. package/examples/transport-launcher.ts +0 -85
@@ -1,17 +0,0 @@
1
- //#region src/core/schema/brand.d.ts
2
- /**
3
- * Type-only seal for framework-normalized schema values.
4
- *
5
- * The symbol has no runtime value: schema objects never carry the key, so
6
- * spreads, `structuredClone`, and JSON round-trips are unaffected. The brand
7
- * exists purely in the type system — consumers cannot spell the key, so a
8
- * structural literal is never assignable to a sealed schema type, and the
9
- * normalization factories are the only construction path.
10
- *
11
- * @module dreamcli/core/schema/brand
12
- */
13
- declare const schemaBrand: unique symbol;
14
- /** Discriminator literals carried by the sealed schema types. */
15
- type SchemaBrandKind = 'flag' | 'arg' | 'command' | 'cli' | 'config' | 'builtins';
16
- //#endregion
17
- export type { SchemaBrandKind, schemaBrand };
@@ -1,302 +0,0 @@
1
- import { CLIError } from "../errors/index.mjs";
2
- import { StandardSchemaV1 } from "./standard.mjs";
3
- import { FlagSchema } from "./flag.mjs";
4
- import { ValueFailure, ValueSchema } from "./value.mjs";
5
- import { ArgSchema } from "./arg.mjs";
6
- //#region src/core/schema/cardinality.d.ts
7
- /** All split formats as a runtime array. */
8
- declare const SPLIT_FORMATS: readonly ["whole", "delimiter", "lines", "json"];
9
- /** How one source's text decodes into collection elements. */
10
- type SplitFormat = (typeof SPLIT_FORMATS)[number];
11
- /**
12
- * How one source's text decodes into collection elements.
13
- *
14
- * - `'whole'`: the source value is a single element
15
- * - `'delimiter'`: split on a literal delimiter, dropping empty segments
16
- * - `'lines'`: split on `\n`, `\r\n`, or `\r`
17
- * - `'json'`: parse the text as JSON
18
- */
19
- type SplitPolicy = {
20
- readonly format: 'whole';
21
- } | {
22
- readonly format: 'delimiter';
23
- readonly delimiter: string;
24
- } | {
25
- readonly format: 'lines';
26
- } | {
27
- readonly format: 'json';
28
- };
29
- /**
30
- * A split policy, a format name, or a literal delimiter.
31
- *
32
- * The strings `'whole'`, `'lines'`, and `'json'` name their format; every other
33
- * string is the delimiter to split on, so `','` is the comma policy.
34
- */
35
- type SplitSetting = string | SplitPolicy;
36
- /**
37
- * Per-source split settings accepted by `.split()`.
38
- *
39
- * Config values are native arrays and objects; a config string decodes under
40
- * the `env` policy.
41
- */
42
- interface SplitOptions {
43
- /**
44
- * How each CLI token splits. Accepts `'whole'` and a delimiter.
45
- * @defaultValue `'whole'`, or the delimiter set by `.separator()`
46
- */
47
- readonly cli?: SplitSetting | undefined;
48
- /**
49
- * How an environment value splits. Accepts `'whole'`, `'json'`, and a delimiter.
50
- * @defaultValue `{ format: 'delimiter', delimiter: ',' }`
51
- */
52
- readonly env?: SplitSetting | undefined;
53
- /**
54
- * How the stdin buffer splits. Accepts every format.
55
- * @defaultValue `'lines'`
56
- */
57
- readonly stdin?: SplitSetting | undefined;
58
- }
59
- /**
60
- * The non-CLI split policies a schema stores.
61
- *
62
- * The CLI delimiter lives on the `separator` field both schemas already carry,
63
- * so `.separator(',')` and `.split({ cli: ',' })` write the same place.
64
- */
65
- interface SourceSplitBinding {
66
- /** Environment split policy, or `undefined` for the default. */
67
- readonly env: SplitPolicy | undefined;
68
- /** Stdin split policy, or `undefined` for the default. */
69
- readonly stdin: SplitPolicy | undefined;
70
- }
71
- /** The resolved split policy of every source. */
72
- interface SplitBinding {
73
- /** How each CLI token splits. */
74
- readonly cli: SplitPolicy;
75
- /** How an environment value splits. */
76
- readonly env: SplitPolicy;
77
- /** How the stdin buffer splits. */
78
- readonly stdin: SplitPolicy;
79
- }
80
- /**
81
- * Normalize one source's split setting.
82
- *
83
- * @param source - Which source the setting belongs to.
84
- * @param setting - The policy, a format name, or a delimiter.
85
- * @returns The normalized policy.
86
- * @throws {CLIError} With code `'INVALID_SCHEMA'` on a format the source does
87
- * not accept, or an empty delimiter.
88
- */
89
- declare function normalizeSplitPolicy(source: keyof SplitOptions, setting: SplitSetting): SplitPolicy;
90
- /** One source's split setting, split into the CLI carrier and the rest. */
91
- interface NormalizedSplitOptions {
92
- /** The CLI delimiter, or `undefined` when CLI tokens stay whole. */
93
- readonly separator: string | undefined;
94
- /** Whether the options named the CLI source at all. */
95
- readonly setsSeparator: boolean;
96
- /** The stored non-CLI policies. */
97
- readonly split: SourceSplitBinding | undefined;
98
- }
99
- /**
100
- * Normalize `.split()` options into the fields a schema stores.
101
- *
102
- * A source the options leave out keeps the policy already stored, so successive
103
- * `.split()` calls each set one source instead of clearing the others.
104
- *
105
- * @param options - Per-source split settings.
106
- * @param stored - The binding already on the schema, when there is one.
107
- * @returns The CLI delimiter and the stored non-CLI binding.
108
- * @throws {CLIError} With code `'INVALID_SCHEMA'` on a format a source does not
109
- * accept, or an empty delimiter.
110
- */
111
- declare function normalizeSplitOptions(options: SplitOptions, stored?: SourceSplitBinding | undefined): NormalizedSplitOptions;
112
- /**
113
- * Resolve the split policy of every source from the stored fields.
114
- *
115
- * @param separator - The CLI delimiter carrier.
116
- * @param split - The stored non-CLI policies.
117
- * @returns One policy per source, defaults filled in.
118
- */
119
- declare function splitBindingOf(separator: string | undefined, split: SourceSplitBinding | undefined): SplitBinding;
120
- /** All duplicate-key policies as a runtime array. */
121
- declare const DUPLICATE_KEYS: readonly ["first", "last", "error"];
122
- /**
123
- * How a repeated key combines when entries aggregate.
124
- *
125
- * - `'last'`: the later occurrence wins
126
- * - `'first'`: the earlier occurrence wins
127
- * - `'error'`: a repeat is a validation failure
128
- *
129
- * @defaultValue `'last'`
130
- */
131
- type DuplicateKeys = (typeof DUPLICATE_KEYS)[number];
132
- /**
133
- * How many values an input carries and how they combine.
134
- *
135
- * `'one'` is a single value; `'many'` an ordered array; `'entries'` a key/value
136
- * record; `'count'` the number of CLI occurrences.
137
- */
138
- type Cardinality = {
139
- readonly kind: 'one';
140
- } | {
141
- readonly kind: 'many';
142
- readonly unique: boolean;
143
- readonly cliSplit: SplitPolicy;
144
- } | {
145
- readonly kind: 'entries';
146
- readonly duplicateKeys: DuplicateKeys;
147
- readonly cliSplit: SplitPolicy;
148
- } | {
149
- readonly kind: 'count';
150
- };
151
- /**
152
- * Project a flag schema onto its cardinality axis.
153
- *
154
- * @param schema - The flag schema to read.
155
- * @returns How the flag's values combine.
156
- */
157
- declare function flagCardinality(schema: FlagSchema): Cardinality;
158
- /**
159
- * Project an arg schema onto its cardinality axis.
160
- *
161
- * A `keyValue` arg aggregates entries whether or not it is variadic: the
162
- * non-variadic form reads one `k=v` token, the variadic form the whole tail.
163
- *
164
- * @param schema - The arg schema to read.
165
- * @returns How the arg's values combine.
166
- */
167
- declare function argCardinality(schema: ArgSchema): Cardinality;
168
- /** Whether a cardinality aggregates several values. */
169
- declare function isCollection(cardinality: Cardinality): cardinality is Extract<Cardinality, {
170
- readonly kind: 'many' | 'entries';
171
- }>;
172
- /** Why a source's text could not be split into elements. */
173
- type SplitFailure = {
174
- readonly kind: 'json';
175
- readonly error: unknown;
176
- } | {
177
- readonly kind: 'json-shape';
178
- readonly expected: 'array' | 'object';
179
- } | {
180
- readonly kind: 'pair';
181
- readonly raw: string;
182
- };
183
- /** Elements read out of one source, or why the text was unreadable. */
184
- type SplitResult<T> = {
185
- readonly ok: true;
186
- readonly parts: readonly T[];
187
- } | {
188
- readonly ok: false;
189
- readonly failure: SplitFailure;
190
- };
191
- /**
192
- * Split text into the elements of a `many` collection.
193
- *
194
- * @param policy - The source's split policy.
195
- * @param text - The raw source text.
196
- * @returns The elements, or why the text was unreadable.
197
- */
198
- declare function splitManyText(policy: SplitPolicy, text: string): SplitResult<unknown>;
199
- /**
200
- * Split text into the pairs of an `entries` collection.
201
- *
202
- * Delimited and line-separated text carries `KEY=VALUE` segments split at the
203
- * first `=`; JSON text carries an object.
204
- *
205
- * @param policy - The source's split policy.
206
- * @param text - The raw source text.
207
- * @returns The pairs, or why the text was unreadable.
208
- */
209
- declare function splitEntriesText(policy: SplitPolicy, text: string): SplitResult<readonly [string, unknown]>;
210
- /**
211
- * Split one `KEY=VALUE` token at the first `=`.
212
- *
213
- * @param raw - The token to split.
214
- * @returns The pair, or `undefined` when the token has no `=` or an empty key.
215
- */
216
- declare function splitEntryPair(raw: string): readonly [string, string] | undefined;
217
- /**
218
- * Split text on line terminators.
219
- *
220
- * A final terminator frames the last line rather than starting an empty one, so
221
- * the single empty element it produces is removed and genuine blank lines
222
- * survive: `'a\nb\n'` gives `['a', 'b']` and `'a\nb\n\n'` gives `['a', 'b', '']`.
223
- *
224
- * @param text - The raw source text.
225
- * @returns One element per line.
226
- */
227
- declare function splitLines(text: string): readonly string[];
228
- /** Deduplicate a resolved array, preserving first-seen order. */
229
- declare function dedupe(values: readonly unknown[]): readonly unknown[];
230
- /**
231
- * The record entries folded to, or the key a duplicate policy rejected.
232
- *
233
- * `at` is the index of the repeating pair, so a caller that knows where each
234
- * pair came from can name that source in its diagnostic.
235
- */
236
- type FoldResult = {
237
- readonly ok: true;
238
- readonly value: Readonly<Record<string, unknown>>;
239
- } | {
240
- readonly ok: false;
241
- readonly duplicateKey: string;
242
- readonly at: number;
243
- };
244
- /**
245
- * Fold ordered pairs into a record under a duplicate-key policy.
246
- *
247
- * `Object.fromEntries` defines own data properties, so a `'__proto__'` key is
248
- * stored verbatim instead of reaching the prototype setter.
249
- *
250
- * @param pairs - The pairs in occurrence order.
251
- * @param duplicateKeys - What a repeated key means.
252
- * @returns The record, or the key that repeated under `'error'` and where.
253
- */
254
- declare function foldEntries(pairs: readonly (readonly [string, unknown])[], duplicateKeys: DuplicateKeys): FoldResult;
255
- /** Why a declared default value is not a value the input could hold. */
256
- type DefaultViolation = {
257
- readonly kind: 'shape';
258
- readonly expected: 'array' | 'object' | 'count';
259
- } | {
260
- readonly kind: 'element';
261
- readonly at: string | undefined;
262
- readonly value: unknown;
263
- readonly failure: ValueFailure;
264
- } | {
265
- readonly kind: 'standard';
266
- readonly at: string | undefined;
267
- readonly value: unknown;
268
- readonly issues: readonly string[];
269
- };
270
- /**
271
- * Validate a declared default against the value and cardinality axes.
272
- *
273
- * A default is already the typed value, so it is validated rather than decoded.
274
- * Only synchronous verdicts are reachable here: a Standard Schema validator
275
- * that returns a promise is left to the resolution-time pass, as are filesystem
276
- * checks.
277
- *
278
- * @param element - The value axis of each element (of the value itself for `'one'`).
279
- * @param cardinality - How the input's values combine.
280
- * @param aggregate - Standard Schema validator applied to the completed collection.
281
- * @param value - The declared default.
282
- * @returns The violation, or `undefined` when the default is valid so far.
283
- */
284
- declare function validateDefault(element: ValueSchema, cardinality: Cardinality, aggregate: StandardSchemaV1 | undefined, value: unknown): DefaultViolation | undefined;
285
- /**
286
- * The English article that precedes a kind name.
287
- *
288
- * @param word - The kind name a message names an input by.
289
- * @returns `'an'` before a vowel, `'a'` otherwise.
290
- */
291
- declare function indefiniteArticle(word: string): string;
292
- /**
293
- * Build the construction-time error for a default value that cannot hold.
294
- *
295
- * @param subject - How the input is spelled, `--tag` or `<files>`.
296
- * @param details - Structured identification of the input.
297
- * @param violation - What the default failed.
298
- * @returns The error to throw.
299
- */
300
- declare function defaultViolationError(subject: string, details: Readonly<Record<string, unknown>>, violation: DefaultViolation): CLIError;
301
- //#endregion
302
- export { type Cardinality, DUPLICATE_KEYS, type DefaultViolation, type DuplicateKeys, type FoldResult, type NormalizedSplitOptions, SPLIT_FORMATS, type SourceSplitBinding, type SplitBinding, type SplitFailure, type SplitFormat, type SplitOptions, type SplitPolicy, type SplitResult, type SplitSetting, argCardinality, dedupe, defaultViolationError, flagCardinality, foldEntries, indefiniteArticle, isCollection, normalizeSplitOptions, normalizeSplitPolicy, splitBindingOf, splitEntriesText, splitEntryPair, splitLines, splitManyText, validateDefault };