@silvery/commander 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +719 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +582 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plain.d.mts +3 -0
- package/dist/plain.mjs +3 -0
- package/dist/presets-DGCyXjnC.mjs +141 -0
- package/dist/presets-DGCyXjnC.mjs.map +1 -0
- package/dist/presets-DTzPdB8a.d.mts +89 -0
- package/dist/presets-DTzPdB8a.d.mts.map +1 -0
- package/package.json +3 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
import { a as date, c as int, d as path, f as port, h as url, i as csv, l as intRange, m as uint, n as StandardSchemaV1, o as email, p as regex, r as bool, s as float, t as CLIType, u as json } from "./presets-DTzPdB8a.mjs";
|
|
2
|
+
import { Argument, Command as Command$1, CommanderError, Help, InvalidArgumentError, Option, OptionValues } from "commander";
|
|
3
|
+
import * as zod from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/command.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Broad structural type for schema objects that have a `~standard` property.
|
|
8
|
+
* Matches both our `StandardSchemaV1<T>`, Zod v4's async-capable Standard Schema,
|
|
9
|
+
* and any other library implementing Standard Schema v1.
|
|
10
|
+
*
|
|
11
|
+
* Type extraction works via the `types` property (Standard Schema v1 convention).
|
|
12
|
+
*/
|
|
13
|
+
interface AnyStandardSchema {
|
|
14
|
+
readonly "~standard": {
|
|
15
|
+
readonly version: 1;
|
|
16
|
+
readonly vendor: string;
|
|
17
|
+
readonly validate: (value: unknown, ...args: any[]) => any;
|
|
18
|
+
readonly types?: {
|
|
19
|
+
readonly output: unknown;
|
|
20
|
+
} | undefined;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Extract the output type from a Standard Schema v1 object. */
|
|
24
|
+
type SchemaOutput<S extends AnyStandardSchema> = NonNullable<S["~standard"]["types"]>["output"];
|
|
25
|
+
/**
|
|
26
|
+
* Extract the long option name from a flags string.
|
|
27
|
+
*
|
|
28
|
+
* Examples:
|
|
29
|
+
* "-v, --verbose" → "verbose"
|
|
30
|
+
* "--port <n>" → "port"
|
|
31
|
+
* "--dry-run" → "dry-run"
|
|
32
|
+
* "--no-color" → "no-color"
|
|
33
|
+
* "-o, --output [path]" → "output"
|
|
34
|
+
*/
|
|
35
|
+
type ExtractLongName<S extends string> = S extends `${string}--${infer Rest}` ? Rest extends `${infer Name} ${string}` ? Name : Rest : S extends `-${infer C}, ${infer Rest}` ? Rest extends `${infer Name} ${string}` ? Name : Rest : S extends `-${infer C}` ? C : never;
|
|
36
|
+
/**
|
|
37
|
+
* Convert kebab-case to camelCase (matching Commander's attributeName()).
|
|
38
|
+
*
|
|
39
|
+
* "dry-run" → "dryRun"
|
|
40
|
+
* "terminal-name" → "terminalName"
|
|
41
|
+
* "verbose" → "verbose"
|
|
42
|
+
*/
|
|
43
|
+
type CamelCase<S extends string> = S extends `${infer A}-${infer B}${infer Rest}` ? `${A}${Uppercase<B>}${CamelCase<Rest>}` : S;
|
|
44
|
+
/**
|
|
45
|
+
* Extract the argument name from a flags string.
|
|
46
|
+
*
|
|
47
|
+
* Examples:
|
|
48
|
+
* "<service>" → "service"
|
|
49
|
+
* "[env]" → "env"
|
|
50
|
+
* "<files...>" → "files"
|
|
51
|
+
* "<service-name>" → "service-name"
|
|
52
|
+
*/
|
|
53
|
+
type ExtractArgName<S extends string> = S extends `<${infer Name}...>` ? Name : S extends `<${infer Name}>` ? Name : S extends `[${infer Name}...]` ? Name : S extends `[${infer Name}]` ? Name : never;
|
|
54
|
+
/** Is the argument required (wrapped in `<...>`)? */
|
|
55
|
+
type IsArgRequired<S extends string> = S extends `<${string}>` ? true : false;
|
|
56
|
+
/** Is the argument variadic (ends with `...>` or `...]`)? */
|
|
57
|
+
type IsArgVariadic<S extends string> = S extends `${string}...${string}` ? true : false;
|
|
58
|
+
/**
|
|
59
|
+
* Derive the property key from an argument flags string.
|
|
60
|
+
* Applies: extract name → camelCase.
|
|
61
|
+
*/
|
|
62
|
+
type ArgKey<S extends string> = CamelCase<ExtractArgName<S>>;
|
|
63
|
+
/**
|
|
64
|
+
* Parse positional arguments embedded in a command name string.
|
|
65
|
+
*
|
|
66
|
+
* Commander.js accepts argument syntax inline with command names:
|
|
67
|
+
* `"deploy <service>"` → 1 required arg
|
|
68
|
+
* `"deploy <service> [env]"` → 1 required + 1 optional
|
|
69
|
+
* `"deploy <files...>"` → 1 required variadic
|
|
70
|
+
*
|
|
71
|
+
* `ParseCommandString<S>` returns `[Args tuple, ArgsRecord]` so the typed
|
|
72
|
+
* `command<S>()` overload can produce a `Command<{}, Args, ArgsRecord>` with
|
|
73
|
+
* the same type information you'd get from chaining `.argument()` calls.
|
|
74
|
+
*
|
|
75
|
+
* Limitations: only plain string types — `<svc>` is `string`, `[env]` is
|
|
76
|
+
* `string | undefined`, `<files...>` is `string[]`. Parsers, schemas, and
|
|
77
|
+
* choices still require `.argument()` because the inline string syntax can't
|
|
78
|
+
* express them. Mixing inline args with `.argument()` calls is allowed:
|
|
79
|
+
* the inline ones come first in the tuple, the `.argument()` ones append.
|
|
80
|
+
*/
|
|
81
|
+
/** Split a command name string at the first space. `"deploy <service>"` → `["deploy", "<service>"]` */
|
|
82
|
+
type SplitCommandHead<S extends string> = S extends `${infer Name} ${infer Rest}` ? [Name, Rest] : [S, ""];
|
|
83
|
+
/** Walk the tail tokens after the command name and build [Args tuple, ArgsRecord]. */
|
|
84
|
+
type ParseInlineArgs<S extends string, Tuple extends any[] = [], Rec = {}> = S extends "" ? [Tuple, Rec] : S extends `${infer Tok} ${infer Rest}` ? Tok extends `<${infer Name}...>` ? ParseInlineArgs<Rest, [...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>> : Tok extends `<${infer Name}>` ? ParseInlineArgs<Rest, [...Tuple, string], Rec & Record<CamelCase<Name>, string>> : Tok extends `[${infer Name}...]` ? ParseInlineArgs<Rest, [...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>> : Tok extends `[${infer Name}]` ? ParseInlineArgs<Rest, [...Tuple, string | undefined], Rec & Record<CamelCase<Name>, string | undefined>> : ParseInlineArgs<Rest, Tuple, Rec> : S extends `<${infer Name}...>` ? [[...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>] : S extends `<${infer Name}>` ? [[...Tuple, string], Rec & Record<CamelCase<Name>, string>] : S extends `[${infer Name}...]` ? [[...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>] : S extends `[${infer Name}]` ? [[...Tuple, string | undefined], Rec & Record<CamelCase<Name>, string | undefined>] : [Tuple, Rec];
|
|
85
|
+
/** Top-level: parse a `command(name)` string into [Args tuple, ArgsRecord]. */
|
|
86
|
+
type ParseCommandString<S extends string> = SplitCommandHead<S> extends [infer _Name, infer Tail extends string] ? Tail extends "" ? [[], {}] : ParseInlineArgs<Tail> : [[], {}];
|
|
87
|
+
/**
|
|
88
|
+
* Infer the value type for an argument based on its flags string and
|
|
89
|
+
* the optional parser/choices/schema.
|
|
90
|
+
*
|
|
91
|
+
* Rules:
|
|
92
|
+
* <required> → string
|
|
93
|
+
* [optional] → string | undefined
|
|
94
|
+
* <variadic...> → string[]
|
|
95
|
+
* [variadic...] → string[]
|
|
96
|
+
* with parser fn → ReturnType<parser> (+ | undefined if optional)
|
|
97
|
+
* with CLIType<T> → T (+ | undefined if optional)
|
|
98
|
+
* with StandardSchema → T (+ | undefined if optional)
|
|
99
|
+
* with choices[] → choices[number] (+ | undefined if optional)
|
|
100
|
+
*/
|
|
101
|
+
type InferArgType<Flags extends string, ParseArg = undefined> = IsArgVariadic<Flags> extends true ? ParseArg extends readonly (infer C)[] ? C[] : ParseArg extends CLIType<infer T> ? T[] : ParseArg extends StandardSchemaV1<infer T> ? T[] : ParseArg extends ((value: string, ...args: any[]) => infer R) ? R[] : string[] : IsArgRequired<Flags> extends true ? ParseArg extends readonly (infer C)[] ? C : ParseArg extends CLIType<infer T> ? T : ParseArg extends StandardSchemaV1<infer T> ? T : ParseArg extends ((value: string, ...args: any[]) => infer R) ? R : string : ParseArg extends readonly (infer C)[] ? C | undefined : ParseArg extends CLIType<infer T> ? T | undefined : ParseArg extends StandardSchemaV1<infer T> ? T | undefined : ParseArg extends ((value: string, ...args: any[]) => infer R) ? R | undefined : string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Strip "no-" prefix from negated flags.
|
|
104
|
+
* "--no-color" → long name "no-color" → stripped to "color"
|
|
105
|
+
*/
|
|
106
|
+
type StripNo<S extends string> = S extends `no-${infer Rest}` ? Rest : S;
|
|
107
|
+
/**
|
|
108
|
+
* Derive the property key from a flags string.
|
|
109
|
+
* Applies: extract long name → strip "no-" → camelCase.
|
|
110
|
+
*/
|
|
111
|
+
type FlagKey<S extends string> = CamelCase<StripNo<ExtractLongName<S>>>;
|
|
112
|
+
/**
|
|
113
|
+
* Does the flags string contain a required value argument `<...>`?
|
|
114
|
+
*/
|
|
115
|
+
type HasRequiredArg<S extends string> = S extends `${string}<${string}>${string}` ? true : false;
|
|
116
|
+
/**
|
|
117
|
+
* Does the flags string contain an optional value argument `[...]`?
|
|
118
|
+
*/
|
|
119
|
+
type HasOptionalArg<S extends string> = S extends `${string}[${string}]${string}` ? true : false;
|
|
120
|
+
/**
|
|
121
|
+
* Does the flags string start with `--no-`?
|
|
122
|
+
*/
|
|
123
|
+
type IsNegated<S extends string> = ExtractLongName<S> extends `no-${string}` ? true : false;
|
|
124
|
+
/**
|
|
125
|
+
* Infer the value type for a flag based on the flags string and the
|
|
126
|
+
* optional third argument (parser function, Standard Schema, choices array).
|
|
127
|
+
*
|
|
128
|
+
* Rules (mirroring Commander runtime behavior):
|
|
129
|
+
* --flag → boolean | undefined
|
|
130
|
+
* --no-flag → boolean
|
|
131
|
+
* --flag <value> → string | undefined (or parser return type)
|
|
132
|
+
* --flag [value] → string | boolean | undefined (or parser return type | boolean)
|
|
133
|
+
* --flag <value>, parser fn → ReturnType<parser> | undefined
|
|
134
|
+
* --flag <value>, CLIType<T> / StandardSchemaV1<T> → T | undefined
|
|
135
|
+
* --flag <value>, choices[] → choices[number] | undefined
|
|
136
|
+
*/
|
|
137
|
+
type InferOptionType<Flags extends string, ParseArg = undefined> = IsNegated<Flags> extends true ? boolean : HasRequiredArg<Flags> extends true ? ParseArg extends readonly (infer C)[] ? C | undefined : ParseArg extends CLIType<infer T> ? T | undefined : ParseArg extends StandardSchemaV1<infer T> ? T | undefined : ParseArg extends ((value: string, ...args: any[]) => infer R) ? R | undefined : string | undefined : HasOptionalArg<Flags> extends true ? ParseArg extends readonly (infer C)[] ? C | boolean | undefined : ParseArg extends CLIType<infer T> ? T | boolean | undefined : ParseArg extends StandardSchemaV1<infer T> ? T | boolean | undefined : ParseArg extends ((value: string, ...args: any[]) => infer R) ? R | boolean | undefined : string | boolean | undefined : boolean | undefined;
|
|
138
|
+
/** Position for help sections — mirrors Commander's addHelpText positions. */
|
|
139
|
+
type HelpSectionPosition = "beforeAll" | "before" | "after" | "afterAll";
|
|
140
|
+
/** Content for a help section: rows of [term, description] pairs, or free-form text. */
|
|
141
|
+
type HelpSectionContent = [string, string][] | string;
|
|
142
|
+
declare class _CommandBase extends Command$1 {
|
|
143
|
+
private _helpSectionList;
|
|
144
|
+
private _helpSectionsInstalled;
|
|
145
|
+
/** Argument names registered via typed .argument() — used by .action() to merge into opts. */
|
|
146
|
+
_typedArgNames: string[];
|
|
147
|
+
constructor(name?: string);
|
|
148
|
+
/**
|
|
149
|
+
* Add an option with smart third-argument detection.
|
|
150
|
+
*
|
|
151
|
+
* The third argument is detected in order:
|
|
152
|
+
* 1. **Array** -- treated as choices (Commander `.choices()`)
|
|
153
|
+
* 2. **Standard Schema v1** -- wrapped as a parser function
|
|
154
|
+
* 3. **Legacy Zod** (pre-3.24, has `_def` + `parse`) -- wrapped as a parser
|
|
155
|
+
* 4. **Function** -- passed through as Commander's parser function
|
|
156
|
+
* 5. **Anything else** -- passed through as a default value
|
|
157
|
+
*/
|
|
158
|
+
option(flags: string, description?: string, parseArgOrDefault?: any, defaultValue?: any): this;
|
|
159
|
+
/**
|
|
160
|
+
* Add an argument with smart third-argument detection.
|
|
161
|
+
*
|
|
162
|
+
* Same detection as `.option()`: array → choices, Standard Schema → parser,
|
|
163
|
+
* legacy Zod → parser, function → parser, anything else → default value.
|
|
164
|
+
* Tracks argument names for `.action()` merging.
|
|
165
|
+
*/
|
|
166
|
+
argument(flags: string, description?: string, parseArgOrDefault?: any, defaultValue?: any): this;
|
|
167
|
+
/**
|
|
168
|
+
* Register an action callback with a named-parameter object instead of positional args.
|
|
169
|
+
*
|
|
170
|
+
* The handler receives a single object containing all positional arguments
|
|
171
|
+
* (merged by name) and all options, plus the Command instance as a second arg.
|
|
172
|
+
* Argument names come from the typed `.argument()` calls, camelCased.
|
|
173
|
+
*
|
|
174
|
+
* This is a convenience wrapper over `.action()` — `.action()` itself remains
|
|
175
|
+
* Commander-native `(...args, opts, command) => ...`. Prefer `.action()` for
|
|
176
|
+
* single-arg commands (where positional is more ergonomic) and `.actionMerged()`
|
|
177
|
+
* for multi-arg commands (where a flat named object is nicer).
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* new Command("deploy")
|
|
182
|
+
* .argument("<service>")
|
|
183
|
+
* .argument("[env]")
|
|
184
|
+
* .option("-p, --port <n>", port)
|
|
185
|
+
* .actionMerged(({ service, env, port }, cmd) => {
|
|
186
|
+
* // service, env, port are all typed
|
|
187
|
+
* // cmd is the Command instance
|
|
188
|
+
* })
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
actionMerged(fn: (params: any, cmd: any) => any): this;
|
|
192
|
+
/**
|
|
193
|
+
* Add a styled help section — like Commander's `addHelpText` but with
|
|
194
|
+
* structured content that participates in global column alignment.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* // Rows with aligned descriptions (default position: "after")
|
|
199
|
+
* program.addHelpSection("Getting Started:", [
|
|
200
|
+
* ["myapp init", "Initialize a new project"],
|
|
201
|
+
* ["myapp serve", "Start the dev server"],
|
|
202
|
+
* ])
|
|
203
|
+
*
|
|
204
|
+
* // Free-form text
|
|
205
|
+
* program.addHelpSection("Note:", "Requires Node.js 23+")
|
|
206
|
+
*
|
|
207
|
+
* // Explicit position
|
|
208
|
+
* program.addHelpSection("before", "Prerequisites:", [
|
|
209
|
+
* ["node >= 23", "Required runtime"],
|
|
210
|
+
* ])
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
addHelpSection(title: string, content: HelpSectionContent): this;
|
|
214
|
+
addHelpSection(position: HelpSectionPosition, title: string, content: HelpSectionContent): this;
|
|
215
|
+
createCommand(name?: string): _CommandBase;
|
|
216
|
+
/**
|
|
217
|
+
* Override Commander's `command()` to mirror inline-arg names (from
|
|
218
|
+
* `command("deploy <service>")`) into our `_typedArgNames`. This keeps
|
|
219
|
+
* `.actionMerged()` working on subcommands declared with the inline form,
|
|
220
|
+
* since the merged dispatch reads from `_typedArgNames` to know which
|
|
221
|
+
* positional indices map to which key.
|
|
222
|
+
*
|
|
223
|
+
* Both forms now coexist:
|
|
224
|
+
* .command("deploy <service>") // inline — names from string
|
|
225
|
+
* .command("deploy").argument("<service>") // explicit — names from .argument()
|
|
226
|
+
* Both produce equivalent runtime + type behavior.
|
|
227
|
+
*/
|
|
228
|
+
command(...args: any[]): any;
|
|
229
|
+
/**
|
|
230
|
+
* Auto-detect capitalization from user-provided descriptions and match it
|
|
231
|
+
* for built-in options (-V/--version, -h/--help).
|
|
232
|
+
*/
|
|
233
|
+
private _capitalizeBuiltinDescriptions;
|
|
234
|
+
/**
|
|
235
|
+
* Render sections for a given position using the help formatter.
|
|
236
|
+
*
|
|
237
|
+
* Handles multi-line term entries (terms containing `\n`) by emitting one
|
|
238
|
+
* row per line. The description column is **top-aligned**: it appears only
|
|
239
|
+
* on the first line of a multi-line term, with subsequent lines holding
|
|
240
|
+
* just the styled term and an empty description column.
|
|
241
|
+
*/
|
|
242
|
+
private _renderSections;
|
|
243
|
+
/** Install hooks once — merges with existing configureHelp, adds addHelpText for before/afterAll. */
|
|
244
|
+
private _installHelpSectionHooks;
|
|
245
|
+
}
|
|
246
|
+
interface Command<Opts extends Record<string, unknown> = {}, Args extends any[] = [], ArgsRecord extends Record<string, unknown> = {}> extends _CommandBase {
|
|
247
|
+
/** Return option values with full type inference. */
|
|
248
|
+
opts(): Opts;
|
|
249
|
+
/** Accept any `Command<...>` variant as a subcommand. */
|
|
250
|
+
addCommand(cmd: Command<any, any, any>, opts?: {
|
|
251
|
+
isDefault?: boolean;
|
|
252
|
+
hidden?: boolean;
|
|
253
|
+
noHelp?: boolean;
|
|
254
|
+
}): this;
|
|
255
|
+
/** Factory for subcommands — returns a fresh `Command<{}>`. */
|
|
256
|
+
createCommand(name?: string): Command<{}, [], {}>;
|
|
257
|
+
/** Set command description (preserves typed chain). */
|
|
258
|
+
description(str: string): this;
|
|
259
|
+
/** Get command description. */
|
|
260
|
+
description(): string;
|
|
261
|
+
/** Set command alias (preserves typed chain). */
|
|
262
|
+
alias(alias: string): this;
|
|
263
|
+
/** Get command alias. */
|
|
264
|
+
alias(): string;
|
|
265
|
+
/** Set command version (preserves typed chain). */
|
|
266
|
+
version(str: string, flags?: string, description?: string): this;
|
|
267
|
+
/** Add a choices option: `--env <e>`, `["dev", "staging", "prod"]` */
|
|
268
|
+
option<F extends string, const C extends readonly string[]>(flags: F, description: string, choices: C): Command<Opts & Record<FlagKey<F>, C[number] | undefined>, Args, ArgsRecord>;
|
|
269
|
+
/** Add an option with a CLIType preset (port, csv, uint, etc.) */
|
|
270
|
+
option<F extends string, T>(flags: F, description: string, schema: CLIType<T>, defaultValue?: T): Command<Opts & Record<FlagKey<F>, T | undefined>, Args, ArgsRecord>;
|
|
271
|
+
/** Add an option with a Standard Schema v1 validator (Zod, Valibot, ArkType) */
|
|
272
|
+
option<F extends string, S extends AnyStandardSchema>(flags: F, description: string, schema: S, defaultValue?: SchemaOutput<S>): Command<Opts & Record<FlagKey<F>, SchemaOutput<S> | undefined>, Args, ArgsRecord>;
|
|
273
|
+
/** Add an option with a parser function */
|
|
274
|
+
option<F extends string, T>(flags: F, description: string, parseArg: (value: string, previous: T) => T, defaultValue?: T): Command<Opts & Record<FlagKey<F>, T | undefined>, Args, ArgsRecord>;
|
|
275
|
+
/** Add a boolean flag or string-value option (no parser) */
|
|
276
|
+
option<F extends string>(flags: F, description?: string, defaultValue?: string | boolean): Command<Opts & Record<FlagKey<F>, InferOptionType<F>>, Args, ArgsRecord>;
|
|
277
|
+
/**
|
|
278
|
+
* Fallback: accepts any third argument (legacy Zod, unknown schemas, etc.)
|
|
279
|
+
* that doesn't match the more specific overloads above.
|
|
280
|
+
*/
|
|
281
|
+
option<F extends string>(flags: F, description: string, parseArgOrDefault: any, defaultValue?: any): Command<Opts, Args, ArgsRecord>;
|
|
282
|
+
/** Add a choices argument: `<env>`, `["dev", "staging", "prod"]` */
|
|
283
|
+
argument<F extends string, const C extends readonly string[]>(flags: F, description: string, choices: C): Command<Opts, [...Args, IsArgVariadic<F> extends true ? C[number][] : IsArgRequired<F> extends true ? C[number] : C[number] | undefined], ArgsRecord & Record<ArgKey<F>, IsArgVariadic<F> extends true ? C[number][] : IsArgRequired<F> extends true ? C[number] : C[number] | undefined>>;
|
|
284
|
+
/** Add an argument with a CLIType preset (port, csv, uint, etc.) */
|
|
285
|
+
argument<F extends string, T>(flags: F, description: string, schema: CLIType<T>, defaultValue?: T): Command<Opts, [...Args, InferArgType<F, CLIType<T>>], ArgsRecord & Record<ArgKey<F>, InferArgType<F, CLIType<T>>>>;
|
|
286
|
+
/** Add an argument with a Standard Schema v1 validator (Zod, Valibot, ArkType) */
|
|
287
|
+
argument<F extends string, S extends AnyStandardSchema>(flags: F, description: string, schema: S, defaultValue?: SchemaOutput<S>): Command<Opts, [...Args, InferArgType<F, StandardSchemaV1<SchemaOutput<S>>>], ArgsRecord & Record<ArgKey<F>, InferArgType<F, StandardSchemaV1<SchemaOutput<S>>>>>;
|
|
288
|
+
/** Add an argument with a parser function */
|
|
289
|
+
argument<F extends string, T>(flags: F, description: string, parseArg: (value: string, previous: T) => T, defaultValue?: T): Command<Opts, [...Args, InferArgType<F, (value: string, previous: T) => T>], ArgsRecord & Record<ArgKey<F>, InferArgType<F, (value: string, previous: T) => T>>>;
|
|
290
|
+
/** Add a string argument (no parser) — required, optional, or variadic */
|
|
291
|
+
argument<F extends string>(flags: F, description?: string, defaultValue?: string): Command<Opts, [...Args, InferArgType<F>], ArgsRecord & Record<ArgKey<F>, InferArgType<F>>>;
|
|
292
|
+
/** Fallback: accepts any third argument */
|
|
293
|
+
argument<F extends string>(flags: F, description: string, parseArgOrDefault: any, defaultValue?: any): Command<Opts, Args, ArgsRecord>;
|
|
294
|
+
/**
|
|
295
|
+
* Register an action handler — Commander-native positional form.
|
|
296
|
+
* Receives `(...positionalArgs, opts, command)`. The command instance is
|
|
297
|
+
* appended last so it can be safely ignored by handlers that don't need it.
|
|
298
|
+
*/
|
|
299
|
+
action(fn: (...args: [...Args, Opts, Command<Opts, Args, ArgsRecord>]) => void | Promise<void>): this;
|
|
300
|
+
/**
|
|
301
|
+
* Register an action handler — merged named-object form.
|
|
302
|
+
* Receives `(params, command)` where `params` is a flat object of
|
|
303
|
+
* args merged with options, keyed by argument/option name.
|
|
304
|
+
*
|
|
305
|
+
* Use this when you prefer a single destructured object to multiple positional
|
|
306
|
+
* parameters — especially for commands with 2+ arguments.
|
|
307
|
+
*/
|
|
308
|
+
actionMerged(fn: (params: Opts & ArgsRecord, cmd: Command<Opts, Args, ArgsRecord>) => void | Promise<void>): this;
|
|
309
|
+
/**
|
|
310
|
+
* Create a subcommand. Returns a fresh `Command<{}, ParsedArgs, ParsedArgsRecord>`.
|
|
311
|
+
*
|
|
312
|
+
* Positional arguments embedded in the command name string (`"deploy <service>"`)
|
|
313
|
+
* are parsed at the type level and contribute to the returned `Args` tuple and
|
|
314
|
+
* `ArgsRecord`. The same shape as if you'd chained `.argument("<service>")`.
|
|
315
|
+
*
|
|
316
|
+
* For typed parsers, schemas, or choices, use `.argument()` on the returned
|
|
317
|
+
* command — the inline string syntax can only express plain string args.
|
|
318
|
+
* Mixing both forms is allowed: inline args come first in the tuple, then
|
|
319
|
+
* `.argument()` calls append.
|
|
320
|
+
*/
|
|
321
|
+
command<S extends string>(nameAndArgs: S, opts?: {
|
|
322
|
+
isDefault?: boolean;
|
|
323
|
+
hidden?: boolean;
|
|
324
|
+
noHelp?: boolean;
|
|
325
|
+
}): ParseCommandString<S> extends [infer A extends any[], infer R extends Record<string, unknown>] ? Command<{}, A, R> : Command<{}, [], {}>;
|
|
326
|
+
/** Overload for command with description (attached-action subcommand, returns parent). */
|
|
327
|
+
command<S extends string>(nameAndArgs: S, description: string, opts?: {
|
|
328
|
+
isDefault?: boolean;
|
|
329
|
+
hidden?: boolean;
|
|
330
|
+
noHelp?: boolean;
|
|
331
|
+
executableFile?: string;
|
|
332
|
+
}): this;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Type-safe Commander Command with auto-colorized help, Standard Schema support,
|
|
336
|
+
* array-as-choices detection, and inferred option types.
|
|
337
|
+
*
|
|
338
|
+
* Use `.action()` for Commander-native positional form — `(arg1, arg2, opts, cmd) => ...`.
|
|
339
|
+
* Use `.actionMerged()` for a flat destructured form — `({ arg1, arg2, opt1 }, cmd) => ...`.
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* new Command("deploy")
|
|
344
|
+
* .argument("<service>", "Service to deploy")
|
|
345
|
+
* .argument("[env]", "Environment", ["dev", "staging", "prod"] as const)
|
|
346
|
+
* .option("--verbose", "Verbose output")
|
|
347
|
+
* .action((service, env, opts) => { ... })
|
|
348
|
+
* // or: .actionMerged(({ service, env, verbose }) => { ... })
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
declare const Command: {
|
|
352
|
+
new (name?: string): Command<{}, [], {}>;
|
|
353
|
+
};
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region src/colorize.d.ts
|
|
356
|
+
/**
|
|
357
|
+
* Commander.js help colorization using @silvery/ansi.
|
|
358
|
+
*
|
|
359
|
+
* Uses Commander's built-in style hooks (styleTitle, styleOptionText, etc.)
|
|
360
|
+
* rather than regex post-processing.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* import { Command } from "@silvery/commander"
|
|
365
|
+
* // Command auto-colorizes in its constructor — no manual call needed.
|
|
366
|
+
* // For plain Commander:
|
|
367
|
+
* import { colorizeHelp } from "@silvery/commander"
|
|
368
|
+
* colorizeHelp(program)
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
/**
|
|
372
|
+
* Check if color output should be enabled.
|
|
373
|
+
* Delegates to @silvery/ansi's auto-detection (NO_COLOR, FORCE_COLOR, TERM).
|
|
374
|
+
*/
|
|
375
|
+
declare function shouldColorize(): boolean;
|
|
376
|
+
/**
|
|
377
|
+
* Minimal interface for Commander's Command — avoids requiring Commander
|
|
378
|
+
* as a direct dependency. Works with both `commander` and
|
|
379
|
+
* `@silvery/commander`.
|
|
380
|
+
*/
|
|
381
|
+
interface CommandLike {
|
|
382
|
+
configureHelp(...args: any[]): any;
|
|
383
|
+
configureOutput(...args: any[]): any;
|
|
384
|
+
readonly commands: readonly any[];
|
|
385
|
+
}
|
|
386
|
+
/** Color scheme for help output. Each value is a styling function (text → styled text). */
|
|
387
|
+
interface ColorizeHelpOptions {
|
|
388
|
+
/** Style for command/subcommand names. Default: primary (yellow without theme) */
|
|
389
|
+
commands?: (text: string) => string;
|
|
390
|
+
/** Style for --flags and -short options. Default: secondary (cyan without theme) */
|
|
391
|
+
flags?: (text: string) => string;
|
|
392
|
+
/** Style for description text. Default: unstyled (normal foreground) */
|
|
393
|
+
description?: (text: string) => string;
|
|
394
|
+
/** Style for section headings (Usage:, Options:, etc.). Default: bold */
|
|
395
|
+
heading?: (text: string) => string;
|
|
396
|
+
/** Style for <required> and [optional] argument brackets. Default: accent (magenta without theme) */
|
|
397
|
+
brackets?: (text: string) => string;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Apply colorized help output to a Commander.js program and all its subcommands.
|
|
401
|
+
*
|
|
402
|
+
* Uses Commander's built-in `configureHelp()` style hooks rather than
|
|
403
|
+
* post-processing the formatted string.
|
|
404
|
+
*
|
|
405
|
+
* @param program - A Commander Command instance (or compatible object)
|
|
406
|
+
* @param options - Override default style functions for each element
|
|
407
|
+
*/
|
|
408
|
+
declare function colorizeHelp(program: CommandLike, options?: ColorizeHelpOptions): void;
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/z.d.ts
|
|
411
|
+
declare const z: {
|
|
412
|
+
port: zod.z.ZodCoercedNumber<unknown>;
|
|
413
|
+
int: zod.z.ZodCoercedNumber<unknown>;
|
|
414
|
+
uint: zod.z.ZodCoercedNumber<unknown>;
|
|
415
|
+
float: zod.z.ZodCoercedNumber<unknown>;
|
|
416
|
+
csv: zod.ZodPipe<zod.ZodString, zod.ZodTransform<string[], string>>;
|
|
417
|
+
url: zod.ZodString;
|
|
418
|
+
path: zod.ZodString;
|
|
419
|
+
email: zod.ZodString;
|
|
420
|
+
date: zod.z.ZodCoercedDate<unknown>;
|
|
421
|
+
json: zod.ZodPipe<zod.ZodString, zod.ZodTransform<any, string>>;
|
|
422
|
+
bool: zod.ZodPipe<zod.ZodEnum<{
|
|
423
|
+
true: "true";
|
|
424
|
+
0: "0";
|
|
425
|
+
false: "false";
|
|
426
|
+
1: "1";
|
|
427
|
+
yes: "yes";
|
|
428
|
+
no: "no";
|
|
429
|
+
y: "y";
|
|
430
|
+
n: "n";
|
|
431
|
+
}>, zod.ZodTransform<boolean, "true" | "0" | "false" | "1" | "yes" | "no" | "y" | "n">>;
|
|
432
|
+
intRange: (min: number, max: number) => zod.z.ZodCoercedNumber<unknown>;
|
|
433
|
+
z: typeof zod.z;
|
|
434
|
+
default: typeof zod.z;
|
|
435
|
+
core: typeof zod.core;
|
|
436
|
+
globalRegistry: zod.z.core.$ZodRegistry<zod.z.core.GlobalMeta, zod.z.core.$ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
437
|
+
registry: typeof zod.core.registry;
|
|
438
|
+
config: typeof zod.core.config;
|
|
439
|
+
$output: typeof zod.core.$output;
|
|
440
|
+
$input: typeof zod.core.$input;
|
|
441
|
+
$brand: typeof zod.core.$brand;
|
|
442
|
+
clone: typeof zod.core.util.clone;
|
|
443
|
+
regexes: typeof zod.core.regexes;
|
|
444
|
+
treeifyError: typeof zod.core.treeifyError;
|
|
445
|
+
prettifyError: typeof zod.core.prettifyError;
|
|
446
|
+
formatError: typeof zod.core.formatError;
|
|
447
|
+
flattenError: typeof zod.core.flattenError;
|
|
448
|
+
TimePrecision: {
|
|
449
|
+
readonly Any: null;
|
|
450
|
+
readonly Minute: -1;
|
|
451
|
+
readonly Second: 0;
|
|
452
|
+
readonly Millisecond: 3;
|
|
453
|
+
readonly Microsecond: 6;
|
|
454
|
+
};
|
|
455
|
+
util: typeof zod.core.util;
|
|
456
|
+
NEVER: never;
|
|
457
|
+
toJSONSchema: typeof zod.core.toJSONSchema;
|
|
458
|
+
fromJSONSchema: typeof zod.fromJSONSchema;
|
|
459
|
+
locales: typeof zod.core.locales;
|
|
460
|
+
ZodISODateTime: zod.z.core.$constructor<zod.z.ZodISODateTime, zod.z.core.$ZodISODateTimeDef>;
|
|
461
|
+
ZodISODate: zod.z.core.$constructor<zod.z.ZodISODate, zod.z.core.$ZodStringFormatDef<"date">>;
|
|
462
|
+
ZodISOTime: zod.z.core.$constructor<zod.z.ZodISOTime, zod.z.core.$ZodISOTimeDef>;
|
|
463
|
+
ZodISODuration: zod.z.core.$constructor<zod.z.ZodISODuration, zod.z.core.$ZodStringFormatDef<"duration">>;
|
|
464
|
+
iso: typeof zod.iso;
|
|
465
|
+
coerce: typeof zod.coerce;
|
|
466
|
+
string(params?: string | zod.z.core.$ZodStringParams): zod.ZodString;
|
|
467
|
+
string<T extends string>(params?: string | zod.z.core.$ZodStringParams): zod.z.core.$ZodType<T, T>;
|
|
468
|
+
guid(params?: string | zod.z.core.$ZodGUIDParams): zod.ZodGUID;
|
|
469
|
+
uuid(params?: string | zod.z.core.$ZodUUIDParams): zod.ZodUUID;
|
|
470
|
+
uuidv4(params?: string | zod.z.core.$ZodUUIDv4Params): zod.ZodUUID;
|
|
471
|
+
uuidv6(params?: string | zod.z.core.$ZodUUIDv6Params): zod.ZodUUID;
|
|
472
|
+
uuidv7(params?: string | zod.z.core.$ZodUUIDv7Params): zod.ZodUUID;
|
|
473
|
+
httpUrl(params?: string | Omit<zod.z.core.$ZodURLParams, "protocol" | "hostname">): zod.ZodURL;
|
|
474
|
+
emoji(params?: string | zod.z.core.$ZodEmojiParams): zod.ZodEmoji;
|
|
475
|
+
nanoid(params?: string | zod.z.core.$ZodNanoIDParams): zod.ZodNanoID;
|
|
476
|
+
cuid(params?: string | zod.z.core.$ZodCUIDParams): zod.ZodCUID;
|
|
477
|
+
cuid2(params?: string | zod.z.core.$ZodCUID2Params): zod.ZodCUID2;
|
|
478
|
+
ulid(params?: string | zod.z.core.$ZodULIDParams): zod.ZodULID;
|
|
479
|
+
xid(params?: string | zod.z.core.$ZodXIDParams): zod.ZodXID;
|
|
480
|
+
ksuid(params?: string | zod.z.core.$ZodKSUIDParams): zod.ZodKSUID;
|
|
481
|
+
ipv4(params?: string | zod.z.core.$ZodIPv4Params): zod.ZodIPv4;
|
|
482
|
+
mac(params?: string | zod.z.core.$ZodMACParams): zod.ZodMAC;
|
|
483
|
+
ipv6(params?: string | zod.z.core.$ZodIPv6Params): zod.ZodIPv6;
|
|
484
|
+
cidrv4(params?: string | zod.z.core.$ZodCIDRv4Params): zod.ZodCIDRv4;
|
|
485
|
+
cidrv6(params?: string | zod.z.core.$ZodCIDRv6Params): zod.ZodCIDRv6;
|
|
486
|
+
base64(params?: string | zod.z.core.$ZodBase64Params): zod.ZodBase64;
|
|
487
|
+
base64url(params?: string | zod.z.core.$ZodBase64URLParams): zod.ZodBase64URL;
|
|
488
|
+
e164(params?: string | zod.z.core.$ZodE164Params): zod.ZodE164;
|
|
489
|
+
jwt(params?: string | zod.z.core.$ZodJWTParams): zod.ZodJWT;
|
|
490
|
+
stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => zod.z.core.util.MaybeAsync<unknown>) | RegExp, _params?: string | zod.z.core.$ZodStringFormatParams): zod.ZodCustomStringFormat<Format>;
|
|
491
|
+
hostname(_params?: string | zod.z.core.$ZodStringFormatParams): zod.ZodCustomStringFormat<"hostname">;
|
|
492
|
+
hex(_params?: string | zod.z.core.$ZodStringFormatParams): zod.ZodCustomStringFormat<"hex">;
|
|
493
|
+
hash<Alg extends zod.z.core.util.HashAlgorithm, Enc extends zod.z.core.util.HashEncoding = "hex">(alg: Alg, params?: {
|
|
494
|
+
enc?: Enc;
|
|
495
|
+
} & zod.z.core.$ZodStringFormatParams): zod.ZodCustomStringFormat<`${Alg}_${Enc}`>;
|
|
496
|
+
number(params?: string | zod.z.core.$ZodNumberParams): zod.ZodNumber;
|
|
497
|
+
float32(params?: string | zod.z.core.$ZodCheckNumberFormatParams): zod.ZodFloat32;
|
|
498
|
+
float64(params?: string | zod.z.core.$ZodCheckNumberFormatParams): zod.ZodFloat64;
|
|
499
|
+
int32(params?: string | zod.z.core.$ZodCheckNumberFormatParams): zod.ZodInt32;
|
|
500
|
+
uint32(params?: string | zod.z.core.$ZodCheckNumberFormatParams): zod.ZodUInt32;
|
|
501
|
+
boolean(params?: string | zod.z.core.$ZodBooleanParams): zod.ZodBoolean;
|
|
502
|
+
bigint(params?: string | zod.z.core.$ZodBigIntParams): zod.ZodBigInt;
|
|
503
|
+
int64(params?: string | zod.z.core.$ZodBigIntFormatParams): zod.ZodBigIntFormat;
|
|
504
|
+
uint64(params?: string | zod.z.core.$ZodBigIntFormatParams): zod.ZodBigIntFormat;
|
|
505
|
+
symbol(params?: string | zod.z.core.$ZodSymbolParams): zod.ZodSymbol;
|
|
506
|
+
any(): zod.ZodAny;
|
|
507
|
+
unknown(): zod.ZodUnknown;
|
|
508
|
+
never(params?: string | zod.z.core.$ZodNeverParams): zod.ZodNever;
|
|
509
|
+
array<T extends zod.z.core.SomeType>(element: T, params?: string | zod.z.core.$ZodArrayParams): zod.ZodArray<T>;
|
|
510
|
+
keyof<T extends zod.ZodObject>(schema: T): zod.ZodEnum<zod.z.core.util.KeysEnum<T["_zod"]["output"]>>;
|
|
511
|
+
object<T extends zod.z.core.$ZodLooseShape = Partial<Record<never, zod.z.core.SomeType>>>(shape?: T, params?: string | zod.z.core.$ZodObjectParams): zod.ZodObject<zod.z.core.util.Writeable<T>, zod.z.core.$strip>;
|
|
512
|
+
strictObject<T extends zod.z.core.$ZodLooseShape>(shape: T, params?: string | zod.z.core.$ZodObjectParams): zod.ZodObject<T, zod.z.core.$strict>;
|
|
513
|
+
looseObject<T extends zod.z.core.$ZodLooseShape>(shape: T, params?: string | zod.z.core.$ZodObjectParams): zod.ZodObject<T, zod.z.core.$loose>;
|
|
514
|
+
union<const T extends readonly zod.z.core.SomeType[]>(options: T, params?: string | zod.z.core.$ZodUnionParams): zod.ZodUnion<T>;
|
|
515
|
+
xor<const T extends readonly zod.z.core.SomeType[]>(options: T, params?: string | zod.z.core.$ZodXorParams): zod.ZodXor<T>;
|
|
516
|
+
discriminatedUnion<Types extends readonly [zod.z.core.$ZodTypeDiscriminable, ...zod.z.core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | zod.z.core.$ZodDiscriminatedUnionParams): zod.ZodDiscriminatedUnion<Types, Disc>;
|
|
517
|
+
intersection<T extends zod.z.core.SomeType, U extends zod.z.core.SomeType>(left: T, right: U): zod.ZodIntersection<T, U>;
|
|
518
|
+
tuple<T extends readonly [zod.z.core.SomeType, ...zod.z.core.SomeType[]]>(items: T, params?: string | zod.z.core.$ZodTupleParams): zod.ZodTuple<T, null>;
|
|
519
|
+
tuple<T extends readonly [zod.z.core.SomeType, ...zod.z.core.SomeType[]], Rest extends zod.z.core.SomeType>(items: T, rest: Rest, params?: string | zod.z.core.$ZodTupleParams): zod.ZodTuple<T, Rest>;
|
|
520
|
+
tuple(items: [], params?: string | zod.z.core.$ZodTupleParams): zod.ZodTuple<[], null>;
|
|
521
|
+
record<Key extends zod.z.core.$ZodRecordKey, Value extends zod.z.core.SomeType>(keyType: Key, valueType: Value, params?: string | zod.z.core.$ZodRecordParams): zod.ZodRecord<Key, Value>;
|
|
522
|
+
partialRecord<Key extends zod.z.core.$ZodRecordKey, Value extends zod.z.core.SomeType>(keyType: Key, valueType: Value, params?: string | zod.z.core.$ZodRecordParams): zod.ZodRecord<Key & zod.z.core.$partial, Value>;
|
|
523
|
+
looseRecord<Key extends zod.z.core.$ZodRecordKey, Value extends zod.z.core.SomeType>(keyType: Key, valueType: Value, params?: string | zod.z.core.$ZodRecordParams): zod.ZodRecord<Key, Value>;
|
|
524
|
+
map<Key extends zod.z.core.SomeType, Value extends zod.z.core.SomeType>(keyType: Key, valueType: Value, params?: string | zod.z.core.$ZodMapParams): zod.ZodMap<Key, Value>;
|
|
525
|
+
set<Value extends zod.z.core.SomeType>(valueType: Value, params?: string | zod.z.core.$ZodSetParams): zod.ZodSet<Value>;
|
|
526
|
+
nativeEnum<T extends zod.z.core.util.EnumLike>(entries: T, params?: string | zod.z.core.$ZodEnumParams): zod.ZodEnum<T>;
|
|
527
|
+
literal<const T extends ReadonlyArray<zod.z.core.util.Literal>>(value: T, params?: string | zod.z.core.$ZodLiteralParams): zod.ZodLiteral<T[number]>;
|
|
528
|
+
literal<const T extends zod.z.core.util.Literal>(value: T, params?: string | zod.z.core.$ZodLiteralParams): zod.ZodLiteral<T>;
|
|
529
|
+
file(params?: string | zod.z.core.$ZodFileParams): zod.ZodFile;
|
|
530
|
+
transform<I = unknown, O = I>(fn: (input: I, ctx: zod.z.core.ParsePayload) => O): zod.ZodTransform<Awaited<O>, I>;
|
|
531
|
+
optional<T extends zod.z.core.SomeType>(innerType: T): zod.ZodOptional<T>;
|
|
532
|
+
exactOptional<T extends zod.z.core.SomeType>(innerType: T): zod.ZodExactOptional<T>;
|
|
533
|
+
nullable<T extends zod.z.core.SomeType>(innerType: T): zod.ZodNullable<T>;
|
|
534
|
+
nullish<T extends zod.z.core.SomeType>(innerType: T): zod.ZodOptional<zod.ZodNullable<T>>;
|
|
535
|
+
_default<T extends zod.z.core.SomeType>(innerType: T, defaultValue: zod.z.core.util.NoUndefined<zod.z.core.output<T>> | (() => zod.z.core.util.NoUndefined<zod.z.core.output<T>>)): zod.ZodDefault<T>;
|
|
536
|
+
prefault<T extends zod.z.core.SomeType>(innerType: T, defaultValue: zod.z.core.input<T> | (() => zod.z.core.input<T>)): zod.ZodPrefault<T>;
|
|
537
|
+
nonoptional<T extends zod.z.core.SomeType>(innerType: T, params?: string | zod.z.core.$ZodNonOptionalParams): zod.ZodNonOptional<T>;
|
|
538
|
+
success<T extends zod.z.core.SomeType>(innerType: T): zod.ZodSuccess<T>;
|
|
539
|
+
nan(params?: string | zod.z.core.$ZodNaNParams): zod.ZodNaN;
|
|
540
|
+
pipe<const A extends zod.z.core.SomeType, B extends zod.z.core.$ZodType<unknown, zod.z.core.output<A>> = zod.z.core.$ZodType<unknown, zod.z.core.output<A>, zod.z.core.$ZodTypeInternals<unknown, zod.z.core.output<A>>>>(in_: A, out: B | zod.z.core.$ZodType<unknown, zod.z.core.output<A>>): zod.ZodPipe<A, B>;
|
|
541
|
+
codec<const A extends zod.z.core.SomeType, B extends zod.z.core.SomeType = zod.z.core.$ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>>(in_: A, out: B, params: {
|
|
542
|
+
decode: (value: zod.z.core.output<A>, payload: zod.z.core.ParsePayload<zod.z.core.output<A>>) => zod.z.core.util.MaybeAsync<zod.z.core.input<B>>;
|
|
543
|
+
encode: (value: zod.z.core.input<B>, payload: zod.z.core.ParsePayload<zod.z.core.input<B>>) => zod.z.core.util.MaybeAsync<zod.z.core.output<A>>;
|
|
544
|
+
}): zod.ZodCodec<A, B>;
|
|
545
|
+
readonly<T extends zod.z.core.SomeType>(innerType: T): zod.ZodReadonly<T>;
|
|
546
|
+
templateLiteral<const Parts extends zod.z.core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | zod.z.core.$ZodTemplateLiteralParams): zod.ZodTemplateLiteral<zod.z.core.$PartsToTemplateLiteral<Parts>>;
|
|
547
|
+
lazy<T extends zod.z.core.SomeType>(getter: () => T): zod.ZodLazy<T>;
|
|
548
|
+
promise<T extends zod.z.core.SomeType>(innerType: T): zod.ZodPromise<T>;
|
|
549
|
+
_function(): zod.ZodFunction;
|
|
550
|
+
_function<const In extends ReadonlyArray<zod.z.core.$ZodType>>(params: {
|
|
551
|
+
input: In;
|
|
552
|
+
}): zod.ZodFunction<zod.ZodTuple<In, null>, zod.z.core.$ZodFunctionOut>;
|
|
553
|
+
_function<const In extends ReadonlyArray<zod.z.core.$ZodType>, const Out extends zod.z.core.$ZodFunctionOut = zod.z.core.$ZodFunctionOut>(params: {
|
|
554
|
+
input: In;
|
|
555
|
+
output: Out;
|
|
556
|
+
}): zod.ZodFunction<zod.ZodTuple<In, null>, Out>;
|
|
557
|
+
_function<const In extends zod.z.core.$ZodFunctionIn = zod.z.core.$ZodFunctionArgs>(params: {
|
|
558
|
+
input: In;
|
|
559
|
+
}): zod.ZodFunction<In, zod.z.core.$ZodFunctionOut>;
|
|
560
|
+
_function<const Out extends zod.z.core.$ZodFunctionOut = zod.z.core.$ZodFunctionOut>(params: {
|
|
561
|
+
output: Out;
|
|
562
|
+
}): zod.ZodFunction<zod.z.core.$ZodFunctionIn, Out>;
|
|
563
|
+
_function<In extends zod.z.core.$ZodFunctionIn = zod.z.core.$ZodFunctionArgs, Out extends zod.z.core.$ZodType = zod.z.core.$ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>>(params?: {
|
|
564
|
+
input: In;
|
|
565
|
+
output: Out;
|
|
566
|
+
}): zod.ZodFunction<In, Out>;
|
|
567
|
+
check<O = unknown>(fn: zod.z.core.CheckFn<O>): zod.z.core.$ZodCheck<O>;
|
|
568
|
+
custom<O>(fn?: (data: unknown) => unknown, _params?: string | zod.z.core.$ZodCustomParams | undefined): zod.ZodCustom<O, O>;
|
|
569
|
+
refine<T>(fn: (arg: NoInfer<T>) => zod.z.core.util.MaybeAsync<unknown>, _params?: string | zod.z.core.$ZodCustomParams): zod.z.core.$ZodCheck<T>;
|
|
570
|
+
superRefine<T>(fn: (arg: T, payload: zod.z.core.$RefinementCtx<T>) => void | Promise<void>): zod.z.core.$ZodCheck<T>;
|
|
571
|
+
preprocess<A, U extends zod.z.core.SomeType, B = unknown>(fn: (arg: B, ctx: zod.z.core.$RefinementCtx) => A, schema: U): zod.ZodPipe<zod.ZodTransform<A, B>, U>;
|
|
572
|
+
ZodType: zod.z.core.$constructor<zod.ZodType>;
|
|
573
|
+
_ZodString: zod.z.core.$constructor<zod._ZodString>;
|
|
574
|
+
ZodString: zod.z.core.$constructor<zod.ZodString>;
|
|
575
|
+
ZodStringFormat: zod.z.core.$constructor<zod.ZodStringFormat>;
|
|
576
|
+
ZodEmail: zod.z.core.$constructor<zod.ZodEmail>;
|
|
577
|
+
ZodGUID: zod.z.core.$constructor<zod.ZodGUID>;
|
|
578
|
+
ZodUUID: zod.z.core.$constructor<zod.ZodUUID>;
|
|
579
|
+
ZodURL: zod.z.core.$constructor<zod.ZodURL>;
|
|
580
|
+
ZodEmoji: zod.z.core.$constructor<zod.ZodEmoji>;
|
|
581
|
+
ZodNanoID: zod.z.core.$constructor<zod.ZodNanoID>;
|
|
582
|
+
ZodCUID: zod.z.core.$constructor<zod.ZodCUID>;
|
|
583
|
+
ZodCUID2: zod.z.core.$constructor<zod.ZodCUID2>;
|
|
584
|
+
ZodULID: zod.z.core.$constructor<zod.ZodULID>;
|
|
585
|
+
ZodXID: zod.z.core.$constructor<zod.ZodXID>;
|
|
586
|
+
ZodKSUID: zod.z.core.$constructor<zod.ZodKSUID>;
|
|
587
|
+
ZodIPv4: zod.z.core.$constructor<zod.ZodIPv4>;
|
|
588
|
+
ZodMAC: zod.z.core.$constructor<zod.ZodMAC>;
|
|
589
|
+
ZodIPv6: zod.z.core.$constructor<zod.ZodIPv6>;
|
|
590
|
+
ZodCIDRv4: zod.z.core.$constructor<zod.ZodCIDRv4>;
|
|
591
|
+
ZodCIDRv6: zod.z.core.$constructor<zod.ZodCIDRv6>;
|
|
592
|
+
ZodBase64: zod.z.core.$constructor<zod.ZodBase64>;
|
|
593
|
+
ZodBase64URL: zod.z.core.$constructor<zod.ZodBase64URL>;
|
|
594
|
+
ZodE164: zod.z.core.$constructor<zod.ZodE164>;
|
|
595
|
+
ZodJWT: zod.z.core.$constructor<zod.ZodJWT>;
|
|
596
|
+
ZodCustomStringFormat: zod.z.core.$constructor<zod.ZodCustomStringFormat>;
|
|
597
|
+
ZodNumber: zod.z.core.$constructor<zod.ZodNumber>;
|
|
598
|
+
ZodNumberFormat: zod.z.core.$constructor<zod.ZodNumberFormat>;
|
|
599
|
+
ZodBoolean: zod.z.core.$constructor<zod.ZodBoolean>;
|
|
600
|
+
ZodBigInt: zod.z.core.$constructor<zod.ZodBigInt>;
|
|
601
|
+
ZodBigIntFormat: zod.z.core.$constructor<zod.ZodBigIntFormat>;
|
|
602
|
+
ZodSymbol: zod.z.core.$constructor<zod.ZodSymbol>;
|
|
603
|
+
ZodUndefined: zod.z.core.$constructor<zod.ZodUndefined>;
|
|
604
|
+
undefined: typeof zod.undefined;
|
|
605
|
+
ZodNull: zod.z.core.$constructor<zod.ZodNull>;
|
|
606
|
+
null: typeof zod.null;
|
|
607
|
+
ZodAny: zod.z.core.$constructor<zod.ZodAny>;
|
|
608
|
+
ZodUnknown: zod.z.core.$constructor<zod.ZodUnknown>;
|
|
609
|
+
ZodNever: zod.z.core.$constructor<zod.ZodNever>;
|
|
610
|
+
ZodVoid: zod.z.core.$constructor<zod.ZodVoid>;
|
|
611
|
+
void: typeof zod.void;
|
|
612
|
+
ZodDate: zod.z.core.$constructor<zod.ZodDate>;
|
|
613
|
+
ZodArray: zod.z.core.$constructor<zod.ZodArray>;
|
|
614
|
+
ZodObject: zod.z.core.$constructor<zod.ZodObject>;
|
|
615
|
+
ZodUnion: zod.z.core.$constructor<zod.ZodUnion>;
|
|
616
|
+
ZodXor: zod.z.core.$constructor<zod.ZodXor>;
|
|
617
|
+
ZodDiscriminatedUnion: zod.z.core.$constructor<zod.ZodDiscriminatedUnion>;
|
|
618
|
+
ZodIntersection: zod.z.core.$constructor<zod.ZodIntersection>;
|
|
619
|
+
ZodTuple: zod.z.core.$constructor<zod.ZodTuple>;
|
|
620
|
+
ZodRecord: zod.z.core.$constructor<zod.ZodRecord>;
|
|
621
|
+
ZodMap: zod.z.core.$constructor<zod.ZodMap>;
|
|
622
|
+
ZodSet: zod.z.core.$constructor<zod.ZodSet>;
|
|
623
|
+
ZodEnum: zod.z.core.$constructor<zod.ZodEnum>;
|
|
624
|
+
enum: typeof zod.enum;
|
|
625
|
+
ZodLiteral: zod.z.core.$constructor<zod.ZodLiteral>;
|
|
626
|
+
ZodFile: zod.z.core.$constructor<zod.ZodFile>;
|
|
627
|
+
ZodTransform: zod.z.core.$constructor<zod.ZodTransform>;
|
|
628
|
+
ZodOptional: zod.z.core.$constructor<zod.ZodOptional>;
|
|
629
|
+
ZodExactOptional: zod.z.core.$constructor<zod.ZodExactOptional>;
|
|
630
|
+
ZodNullable: zod.z.core.$constructor<zod.ZodNullable>;
|
|
631
|
+
ZodDefault: zod.z.core.$constructor<zod.ZodDefault>;
|
|
632
|
+
ZodPrefault: zod.z.core.$constructor<zod.ZodPrefault>;
|
|
633
|
+
ZodNonOptional: zod.z.core.$constructor<zod.ZodNonOptional>;
|
|
634
|
+
ZodSuccess: zod.z.core.$constructor<zod.ZodSuccess>;
|
|
635
|
+
ZodCatch: zod.z.core.$constructor<zod.ZodCatch>;
|
|
636
|
+
catch: typeof zod.catch;
|
|
637
|
+
ZodNaN: zod.z.core.$constructor<zod.ZodNaN>;
|
|
638
|
+
ZodPipe: zod.z.core.$constructor<zod.ZodPipe>;
|
|
639
|
+
ZodCodec: zod.z.core.$constructor<zod.ZodCodec>;
|
|
640
|
+
ZodReadonly: zod.z.core.$constructor<zod.ZodReadonly>;
|
|
641
|
+
ZodTemplateLiteral: zod.z.core.$constructor<zod.ZodTemplateLiteral>;
|
|
642
|
+
ZodLazy: zod.z.core.$constructor<zod.ZodLazy>;
|
|
643
|
+
ZodPromise: zod.z.core.$constructor<zod.ZodPromise>;
|
|
644
|
+
ZodFunction: zod.z.core.$constructor<zod.ZodFunction>;
|
|
645
|
+
function: typeof zod._function;
|
|
646
|
+
ZodCustom: zod.z.core.$constructor<zod.ZodCustom>;
|
|
647
|
+
describe: typeof zod.core.describe;
|
|
648
|
+
meta: typeof zod.core.meta;
|
|
649
|
+
instanceof: typeof zod.instanceof;
|
|
650
|
+
stringbool: (_params?: string | zod.z.core.$ZodStringBoolParams) => zod.ZodCodec<zod.ZodString, zod.ZodBoolean>;
|
|
651
|
+
lt: typeof zod.core._lt;
|
|
652
|
+
lte: typeof zod.core._lte;
|
|
653
|
+
gt: typeof zod.core._gt;
|
|
654
|
+
gte: typeof zod.core._gte;
|
|
655
|
+
positive: typeof zod.core._positive;
|
|
656
|
+
negative: typeof zod.core._negative;
|
|
657
|
+
nonpositive: typeof zod.core._nonpositive;
|
|
658
|
+
nonnegative: typeof zod.core._nonnegative;
|
|
659
|
+
multipleOf: typeof zod.core._multipleOf;
|
|
660
|
+
maxSize: typeof zod.core._maxSize;
|
|
661
|
+
minSize: typeof zod.core._minSize;
|
|
662
|
+
size: typeof zod.core._size;
|
|
663
|
+
maxLength: typeof zod.core._maxLength;
|
|
664
|
+
minLength: typeof zod.core._minLength;
|
|
665
|
+
length: typeof zod.core._length;
|
|
666
|
+
regex: typeof zod.core._regex;
|
|
667
|
+
lowercase: typeof zod.core._lowercase;
|
|
668
|
+
uppercase: typeof zod.core._uppercase;
|
|
669
|
+
includes: typeof zod.core._includes;
|
|
670
|
+
startsWith: typeof zod.core._startsWith;
|
|
671
|
+
endsWith: typeof zod.core._endsWith;
|
|
672
|
+
property: typeof zod.core._property;
|
|
673
|
+
mime: typeof zod.core._mime;
|
|
674
|
+
overwrite: typeof zod.core._overwrite;
|
|
675
|
+
normalize: typeof zod.core._normalize;
|
|
676
|
+
trim: typeof zod.core._trim;
|
|
677
|
+
toLowerCase: typeof zod.core._toLowerCase;
|
|
678
|
+
toUpperCase: typeof zod.core._toUpperCase;
|
|
679
|
+
slugify: typeof zod.core._slugify;
|
|
680
|
+
ZodError: zod.z.core.$constructor<zod.ZodError>;
|
|
681
|
+
ZodRealError: zod.z.core.$constructor<zod.ZodError>;
|
|
682
|
+
parse: <T extends zod.z.core.$ZodType>(schema: T, value: unknown, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>, _params?: {
|
|
683
|
+
callee?: zod.z.core.util.AnyFunc;
|
|
684
|
+
Err?: zod.z.core.$ZodErrorClass;
|
|
685
|
+
}) => zod.z.core.output<T>;
|
|
686
|
+
parseAsync: <T extends zod.z.core.$ZodType>(schema: T, value: unknown, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>, _params?: {
|
|
687
|
+
callee?: zod.z.core.util.AnyFunc;
|
|
688
|
+
Err?: zod.z.core.$ZodErrorClass;
|
|
689
|
+
}) => Promise<zod.z.core.output<T>>;
|
|
690
|
+
safeParse: <T extends zod.z.core.$ZodType>(schema: T, value: unknown, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => zod.ZodSafeParseResult<zod.z.core.output<T>>;
|
|
691
|
+
safeParseAsync: <T extends zod.z.core.$ZodType>(schema: T, value: unknown, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => Promise<zod.ZodSafeParseResult<zod.z.core.output<T>>>;
|
|
692
|
+
encode: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.output<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => zod.z.core.input<T>;
|
|
693
|
+
decode: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.input<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => zod.z.core.output<T>;
|
|
694
|
+
encodeAsync: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.output<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => Promise<zod.z.core.input<T>>;
|
|
695
|
+
decodeAsync: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.input<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => Promise<zod.z.core.output<T>>;
|
|
696
|
+
safeEncode: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.output<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => zod.ZodSafeParseResult<zod.z.core.input<T>>;
|
|
697
|
+
safeDecode: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.input<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => zod.ZodSafeParseResult<zod.z.core.output<T>>;
|
|
698
|
+
safeEncodeAsync: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.output<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => Promise<zod.ZodSafeParseResult<zod.z.core.input<T>>>;
|
|
699
|
+
safeDecodeAsync: <T extends zod.z.core.$ZodType>(schema: T, value: zod.z.core.input<T>, _ctx?: zod.z.core.ParseContext<zod.z.core.$ZodIssue>) => Promise<zod.ZodSafeParseResult<zod.z.core.output<T>>>;
|
|
700
|
+
setErrorMap(map: zod.z.core.$ZodErrorMap): void;
|
|
701
|
+
getErrorMap(): zod.z.core.$ZodErrorMap<zod.z.core.$ZodIssue> | undefined;
|
|
702
|
+
ZodIssueCode: {
|
|
703
|
+
readonly invalid_type: "invalid_type";
|
|
704
|
+
readonly too_big: "too_big";
|
|
705
|
+
readonly too_small: "too_small";
|
|
706
|
+
readonly invalid_format: "invalid_format";
|
|
707
|
+
readonly not_multiple_of: "not_multiple_of";
|
|
708
|
+
readonly unrecognized_keys: "unrecognized_keys";
|
|
709
|
+
readonly invalid_union: "invalid_union";
|
|
710
|
+
readonly invalid_key: "invalid_key";
|
|
711
|
+
readonly invalid_element: "invalid_element";
|
|
712
|
+
readonly invalid_value: "invalid_value";
|
|
713
|
+
readonly custom: "custom";
|
|
714
|
+
};
|
|
715
|
+
ZodFirstPartyTypeKind: typeof zod.ZodFirstPartyTypeKind;
|
|
716
|
+
};
|
|
717
|
+
//#endregion
|
|
718
|
+
export { Argument, type CLIType, type ColorizeHelpOptions, Command, type CommandLike, CommanderError, Help, type HelpSectionContent, type HelpSectionPosition, InvalidArgumentError, Option, type OptionValues, type StandardSchemaV1, bool, colorizeHelp, csv, date, email, float, int, intRange, json, path, port, regex, shouldColorize, uint, url, z };
|
|
719
|
+
//# sourceMappingURL=index.d.mts.map
|