@silvery/commander 0.18.2 → 0.19.1
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/package.json +2 -2
- package/dist/index.d.mts +0 -719
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -582
- package/dist/index.mjs.map +0 -1
- package/dist/plain.d.mts +0 -3
- package/dist/plain.mjs +0 -3
- package/dist/presets-DGCyXjnC.mjs +0 -141
- package/dist/presets-DGCyXjnC.mjs.map +0 -1
- package/dist/presets-DTzPdB8a.d.mts +0 -89
- package/dist/presets-DTzPdB8a.d.mts.map +0 -1
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["BaseCommand","Option","Help"],"sources":["../src/colorize.ts","../src/tokenize.ts","../src/command.ts","../src/z.ts"],"sourcesContent":["/**\n * Commander.js help colorization using @silvery/ansi.\n *\n * Uses Commander's built-in style hooks (styleTitle, styleOptionText, etc.)\n * rather than regex post-processing.\n *\n * @example\n * ```ts\n * import { Command } from \"@silvery/commander\"\n * // Command auto-colorizes in its constructor — no manual call needed.\n * // For plain Commander:\n * import { colorizeHelp } from \"@silvery/commander\"\n * colorizeHelp(program)\n * ```\n */\n\nimport { createStyle } from \"@silvery/ansi\"\n\n// Auto-detect terminal color level for shouldColorize() checks.\nconst autoStyle = createStyle()\n\n// Forced basic-color style for explicit colorizeHelp() calls.\n// When a user explicitly calls colorizeHelp(), they want color regardless\n// of terminal detection. The function name means \"add color\" — if you\n// don't want color, don't call it.\nconst s = createStyle({ level: \"basic\" })\n\n/**\n * Check if color output should be enabled.\n * Delegates to @silvery/ansi's auto-detection (NO_COLOR, FORCE_COLOR, TERM).\n */\nexport function shouldColorize(): boolean {\n return autoStyle.level > 0\n}\n\n/**\n * Minimal interface for Commander's Command — avoids requiring Commander\n * as a direct dependency. Works with both `commander` and\n * `@silvery/commander`.\n */\nexport interface CommandLike {\n // biome-ignore lint: permissive to match Commander's overloaded signatures\n configureHelp(...args: any[]): any\n // biome-ignore lint: permissive to match Commander's overloaded signatures\n configureOutput(...args: any[]): any\n // biome-ignore lint: permissive to match Commander's Command[] structurally\n readonly commands: readonly any[]\n}\n\n/** Color scheme for help output. Each value is a styling function (text → styled text). */\nexport interface ColorizeHelpOptions {\n /** Style for command/subcommand names. Default: primary (yellow without theme) */\n commands?: (text: string) => string\n /** Style for --flags and -short options. Default: secondary (cyan without theme) */\n flags?: (text: string) => string\n /** Style for description text. Default: unstyled (normal foreground) */\n description?: (text: string) => string\n /** Style for section headings (Usage:, Options:, etc.). Default: bold */\n heading?: (text: string) => string\n /** Style for <required> and [optional] argument brackets. Default: accent (magenta without theme) */\n brackets?: (text: string) => string\n}\n\n/**\n * Apply colorized help output to a Commander.js program and all its subcommands.\n *\n * Uses Commander's built-in `configureHelp()` style hooks rather than\n * post-processing the formatted string.\n *\n * @param program - A Commander Command instance (or compatible object)\n * @param options - Override default style functions for each element\n */\nexport function colorizeHelp(program: CommandLike, options?: ColorizeHelpOptions): void {\n // Semantic token fallback: theme token → named color\n const cmds = options?.commands ?? ((t: string) => s.primary(t))\n const flags = options?.flags ?? ((t: string) => s.secondary(t))\n const desc = options?.description ?? ((t: string) => t)\n const heading = options?.heading ?? ((t: string) => s.bold(t))\n const brackets = options?.brackets ?? ((t: string) => s.accent(t))\n\n const helpConfig: Record<string, unknown> = {\n styleTitle: (str: string) => heading(str),\n styleCommandText: (str: string) => cmds(str),\n styleOptionText: (str: string) => flags(str),\n styleSubcommandText: (str: string) => cmds(str),\n styleArgumentText: (str: string) => brackets(str),\n styleDescriptionText: (str: string) => desc(str),\n styleCommandDescription: (str: string) => s.bold.primary(str),\n }\n\n program.configureHelp(helpConfig)\n\n // Tell Commander that color output is supported, even when stdout is not\n // a TTY. Without this, Commander strips ANSI codes from helpInformation().\n program.configureOutput({\n getOutHasColors: () => true,\n getErrHasColors: () => true,\n })\n\n // Apply recursively to all existing subcommands\n for (const sub of program.commands) {\n colorizeHelp(sub, options)\n }\n}\n","/**\n * Shell command-line tokenizer for help-section term styling.\n *\n * Walks a single line of shell-like text and classifies each token so the\n * default text help renderer can style it without re-running the regex\n * machinery on every render. Pure function — no ANSI, no styling.\n *\n * Internal: not exported from index.ts. Used only by command.ts's\n * styleSectionTerm() / _renderSections().\n *\n * Example:\n * tokenizeCmdline(\"$ termless play -o demo.gif demo.tape\")\n * →\n * [\n * { kind: \"prompt\", text: \"$ \" },\n * { kind: \"program\", text: \"termless\" },\n * { kind: \"whitespace\", text: \" \" },\n * { kind: \"subcommand\", text: \"play\" },\n * { kind: \"whitespace\", text: \" \" },\n * { kind: \"flag\", text: \"-o\" },\n * { kind: \"whitespace\", text: \" \" },\n * { kind: \"value\", text: \"demo.gif\" },\n * { kind: \"whitespace\", text: \" \" },\n * { kind: \"value\", text: \"demo.tape\" },\n * ]\n */\n\nexport type CmdlineToken =\n | { kind: \"prompt\"; text: string }\n | { kind: \"program\"; text: string }\n | { kind: \"subcommand\"; text: string }\n | { kind: \"flag\"; text: string }\n | { kind: \"arg-bracket\"; text: string }\n | { kind: \"quoted\"; text: string }\n | { kind: \"value\"; text: string }\n | { kind: \"whitespace\"; text: string }\n\n/** Detect a shell prompt at the start of a line. Supports `$ `, `# `, `> `, `❯ `. */\nconst PROMPT_RE = /^([$#>❯]\\s+)/\n\n/** Match one of: long/short flag, bracket arg, quoted string, bare token, whitespace. */\nconst TOKEN_RE = /(--?\\S+)|(<[^>]+>|\\[[^\\]]+\\])|('[^']*'|\"[^\"]*\")|(\\S+)|(\\s+)/g\n\n/** Bare command-word pattern (letters/digits/dash, no dots or slashes). */\nconst BARE_WORD_RE = /^[a-z][\\w-]*$/i\n\n/**\n * Tokenize a single line of shell-like text.\n *\n * Classification (matches the original styleSectionTerm contract):\n * - First non-whitespace bare word after the prompt is `program`.\n * - The IMMEDIATELY-FOLLOWING bare word (the second bare word) is `subcommand`,\n * IF it looks like a command word (lowercase letter start, no dots/slashes).\n * - All subsequent bare words are `value`s (filenames, package names, etc.).\n * - Flags (`--foo`, `-f`), bracket args (`<x>`, `[y]`), and quoted strings end\n * the \"command portion\" — anything after them is a value.\n *\n * The \"max 1 subcommand\" rule keeps `$ npm install foo` correctly classified\n * as program/subcommand/value (not program/subcommand/subcommand). For nested\n * commands (`$ git remote add ...`), only the first subcommand level is styled.\n *\n * If the line has no shell prompt, the same classification still applies —\n * the leading word is `program`, etc.\n */\nexport function tokenizeCmdline(line: string): CmdlineToken[] {\n const tokens: CmdlineToken[] = []\n\n // Detect and emit the prompt as a separate token\n const promptMatch = line.match(PROMPT_RE)\n let body = line\n if (promptMatch) {\n tokens.push({ kind: \"prompt\", text: promptMatch[1]! })\n body = line.slice(promptMatch[1]!.length)\n }\n\n // Tokenize the rest with contextual classification\n const matches = body.match(TOKEN_RE) ?? []\n let commandWords = 0\n let doneWithCommand = false\n\n for (const token of matches) {\n if (/^\\s+$/.test(token)) {\n tokens.push({ kind: \"whitespace\", text: token })\n continue\n }\n if (/^--?\\S/.test(token)) {\n doneWithCommand = true\n tokens.push({ kind: \"flag\", text: token })\n continue\n }\n if (/^[<[]/.test(token)) {\n doneWithCommand = true\n tokens.push({ kind: \"arg-bracket\", text: token })\n continue\n }\n if (/^[\"']/.test(token)) {\n doneWithCommand = true\n tokens.push({ kind: \"quoted\", text: token })\n continue\n }\n // Bare word: the first becomes `program`, the second (if it looks like a\n // command word — bare lowercase word, no dots/slashes) becomes `subcommand`,\n // and everything else becomes `value`.\n if (!doneWithCommand && commandWords === 0) {\n commandWords++\n tokens.push({ kind: \"program\", text: token })\n continue\n }\n if (!doneWithCommand && commandWords === 1 && BARE_WORD_RE.test(token)) {\n commandWords++\n tokens.push({ kind: \"subcommand\", text: token })\n continue\n }\n // Plain values (filenames, version strings, package names, anything else)\n doneWithCommand = true\n tokens.push({ kind: \"value\", text: token })\n }\n\n return tokens\n}\n\n/** Returns true if the line starts with a recognized shell prompt. */\nexport function isShellLine(line: string): boolean {\n return PROMPT_RE.test(line)\n}\n","/**\n * Enhanced Commander Command with auto-colorized help, Standard Schema support,\n * array-as-choices detection, and **type-safe option + argument inference**.\n *\n * Subclasses Commander's Command so `new Command(\"app\")` just works --\n * it's Commander with auto-colorized help, automatic Standard Schema /\n * legacy Zod detection, and array choices in `.option()` and `.argument()`.\n *\n * Each `.option()` call narrows the return type so that `.action()`, `.opts()`,\n * and `.actionMerged()` know exactly which options exist and what types they have.\n * Each `.argument()` call appends to both a positional tuple (for `.action()`)\n * and a named record (for `.actionMerged()`).\n *\n * `.action(fn)` is Commander-native: positional args, then options, then command.\n * `.actionMerged(fn)` is an opt-in helper that merges args and options into a\n * single named object — nicer for commands with many positional arguments.\n *\n * @example\n * ```ts\n * import { Command, port, csv } from \"@silvery/commander\"\n *\n * // Commander-native: positional args, then options\n * new Command(\"deploy\")\n * .argument(\"<service>\", \"Service to deploy\")\n * .argument(\"[env]\", \"Environment\", [\"dev\", \"staging\", \"prod\"])\n * .option(\"-p, --port <n>\", \"Port\", port)\n * .option(\"--verbose\", \"Verbose output\")\n * .action((service, env, opts) => {\n * service // string\n * env // \"dev\" | \"staging\" | \"prod\" | undefined\n * opts.port // number | undefined\n * opts.verbose // boolean | undefined\n * })\n *\n * // Merged form: flat named object with args and options merged\n * new Command(\"deploy\")\n * .argument(\"<service>\")\n * .argument(\"[env]\", [\"dev\", \"staging\", \"prod\"] as const)\n * .option(\"-p, --port <n>\", \"Port\", port)\n * .actionMerged(({ service, env, port }) => { ... })\n *\n * program.parse()\n * ```\n */\n\nimport { Command as BaseCommand, Help, Option } from \"commander\"\nimport { colorizeHelp, shouldColorize } from \"./colorize.ts\"\nimport type { CLIType, StandardSchemaV1 } from \"./presets.ts\"\nimport { tokenizeCmdline, isShellLine, type CmdlineToken } from \"./tokenize.ts\"\n\n/**\n * Broad structural type for schema objects that have a `~standard` property.\n * Matches both our `StandardSchemaV1<T>`, Zod v4's async-capable Standard Schema,\n * and any other library implementing Standard Schema v1.\n *\n * Type extraction works via the `types` property (Standard Schema v1 convention).\n */\ninterface AnyStandardSchema {\n readonly \"~standard\": {\n readonly version: 1\n readonly vendor: string\n readonly validate: (value: unknown, ...args: any[]) => any\n readonly types?: { readonly output: unknown } | undefined\n }\n}\n\n/** Extract the output type from a Standard Schema v1 object. */\ntype SchemaOutput<S extends AnyStandardSchema> = NonNullable<S[\"~standard\"][\"types\"]>[\"output\"]\n\n// ────────────────────────────────────────────────────────────────\n// Type-level flag parsing utilities\n// ────────────────────────────────────────────────────────────────\n\n/**\n * Extract the long option name from a flags string.\n *\n * Examples:\n * \"-v, --verbose\" → \"verbose\"\n * \"--port <n>\" → \"port\"\n * \"--dry-run\" → \"dry-run\"\n * \"--no-color\" → \"no-color\"\n * \"-o, --output [path]\" → \"output\"\n */\ntype ExtractLongName<S extends string> = S extends `${string}--${infer Rest}`\n ? Rest extends `${infer Name} ${string}`\n ? Name\n : Rest\n : S extends `-${infer C}, ${infer Rest}`\n ? Rest extends `${infer Name} ${string}`\n ? Name\n : Rest\n : S extends `-${infer C}`\n ? C\n : never\n\n/**\n * Convert kebab-case to camelCase (matching Commander's attributeName()).\n *\n * \"dry-run\" → \"dryRun\"\n * \"terminal-name\" → \"terminalName\"\n * \"verbose\" → \"verbose\"\n */\ntype CamelCase<S extends string> = S extends `${infer A}-${infer B}${infer Rest}`\n ? `${A}${Uppercase<B>}${CamelCase<Rest>}`\n : S\n\n// ────────────────────────────────────────────────────────────────\n// Type-level argument parsing utilities\n// ────────────────────────────────────────────────────────────────\n\n/**\n * Extract the argument name from a flags string.\n *\n * Examples:\n * \"<service>\" → \"service\"\n * \"[env]\" → \"env\"\n * \"<files...>\" → \"files\"\n * \"<service-name>\" → \"service-name\"\n */\ntype ExtractArgName<S extends string> = S extends `<${infer Name}...>`\n ? Name\n : S extends `<${infer Name}>`\n ? Name\n : S extends `[${infer Name}...]`\n ? Name\n : S extends `[${infer Name}]`\n ? Name\n : never\n\n/** Is the argument required (wrapped in `<...>`)? */\ntype IsArgRequired<S extends string> = S extends `<${string}>` ? true : false\n\n/** Is the argument variadic (ends with `...>` or `...]`)? */\ntype IsArgVariadic<S extends string> = S extends `${string}...${string}` ? true : false\n\n/**\n * Derive the property key from an argument flags string.\n * Applies: extract name → camelCase.\n */\ntype ArgKey<S extends string> = CamelCase<ExtractArgName<S>>\n\n/**\n * Parse positional arguments embedded in a command name string.\n *\n * Commander.js accepts argument syntax inline with command names:\n * `\"deploy <service>\"` → 1 required arg\n * `\"deploy <service> [env]\"` → 1 required + 1 optional\n * `\"deploy <files...>\"` → 1 required variadic\n *\n * `ParseCommandString<S>` returns `[Args tuple, ArgsRecord]` so the typed\n * `command<S>()` overload can produce a `Command<{}, Args, ArgsRecord>` with\n * the same type information you'd get from chaining `.argument()` calls.\n *\n * Limitations: only plain string types — `<svc>` is `string`, `[env]` is\n * `string | undefined`, `<files...>` is `string[]`. Parsers, schemas, and\n * choices still require `.argument()` because the inline string syntax can't\n * express them. Mixing inline args with `.argument()` calls is allowed:\n * the inline ones come first in the tuple, the `.argument()` ones append.\n */\n\n/** Split a command name string at the first space. `\"deploy <service>\"` → `[\"deploy\", \"<service>\"]` */\ntype SplitCommandHead<S extends string> = S extends `${infer Name} ${infer Rest}` ? [Name, Rest] : [S, \"\"]\n\n/** Walk the tail tokens after the command name and build [Args tuple, ArgsRecord]. */\ntype ParseInlineArgs<S extends string, Tuple extends any[] = [], Rec = {}> = S extends \"\"\n ? [Tuple, Rec]\n : S extends `${infer Tok} ${infer Rest}`\n ? Tok extends `<${infer Name}...>`\n ? ParseInlineArgs<Rest, [...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>>\n : Tok extends `<${infer Name}>`\n ? ParseInlineArgs<Rest, [...Tuple, string], Rec & Record<CamelCase<Name>, string>>\n : Tok extends `[${infer Name}...]`\n ? ParseInlineArgs<Rest, [...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>>\n : Tok extends `[${infer Name}]`\n ? ParseInlineArgs<Rest, [...Tuple, string | undefined], Rec & Record<CamelCase<Name>, string | undefined>>\n : ParseInlineArgs<Rest, Tuple, Rec> // skip non-arg tokens\n : // Last token (no trailing space)\n S extends `<${infer Name}...>`\n ? [[...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>]\n : S extends `<${infer Name}>`\n ? [[...Tuple, string], Rec & Record<CamelCase<Name>, string>]\n : S extends `[${infer Name}...]`\n ? [[...Tuple, string[]], Rec & Record<CamelCase<Name>, string[]>]\n : S extends `[${infer Name}]`\n ? [[...Tuple, string | undefined], Rec & Record<CamelCase<Name>, string | undefined>]\n : [Tuple, Rec]\n\n/** Top-level: parse a `command(name)` string into [Args tuple, ArgsRecord]. */\ntype ParseCommandString<S extends string> =\n SplitCommandHead<S> extends [infer _Name, infer Tail extends string]\n ? Tail extends \"\"\n ? [[], {}]\n : ParseInlineArgs<Tail>\n : [[], {}]\n\n/**\n * Infer the value type for an argument based on its flags string and\n * the optional parser/choices/schema.\n *\n * Rules:\n * <required> → string\n * [optional] → string | undefined\n * <variadic...> → string[]\n * [variadic...] → string[]\n * with parser fn → ReturnType<parser> (+ | undefined if optional)\n * with CLIType<T> → T (+ | undefined if optional)\n * with StandardSchema → T (+ | undefined if optional)\n * with choices[] → choices[number] (+ | undefined if optional)\n */\ntype InferArgType<Flags extends string, ParseArg = undefined> =\n IsArgVariadic<Flags> extends true\n ? ParseArg extends readonly (infer C)[]\n ? C[]\n : ParseArg extends CLIType<infer T>\n ? T[]\n : ParseArg extends StandardSchemaV1<infer T>\n ? T[]\n : ParseArg extends (value: string, ...args: any[]) => infer R\n ? R[]\n : string[]\n : IsArgRequired<Flags> extends true\n ? ParseArg extends readonly (infer C)[]\n ? C\n : ParseArg extends CLIType<infer T>\n ? T\n : ParseArg extends StandardSchemaV1<infer T>\n ? T\n : ParseArg extends (value: string, ...args: any[]) => infer R\n ? R\n : string\n : ParseArg extends readonly (infer C)[]\n ? C | undefined\n : ParseArg extends CLIType<infer T>\n ? T | undefined\n : ParseArg extends StandardSchemaV1<infer T>\n ? T | undefined\n : ParseArg extends (value: string, ...args: any[]) => infer R\n ? R | undefined\n : string | undefined\n\n/**\n * Strip \"no-\" prefix from negated flags.\n * \"--no-color\" → long name \"no-color\" → stripped to \"color\"\n */\ntype StripNo<S extends string> = S extends `no-${infer Rest}` ? Rest : S\n\n/**\n * Derive the property key from a flags string.\n * Applies: extract long name → strip \"no-\" → camelCase.\n */\ntype FlagKey<S extends string> = CamelCase<StripNo<ExtractLongName<S>>>\n\n/**\n * Does the flags string contain a required value argument `<...>`?\n */\ntype HasRequiredArg<S extends string> = S extends `${string}<${string}>${string}` ? true : false\n\n/**\n * Does the flags string contain an optional value argument `[...]`?\n */\ntype HasOptionalArg<S extends string> = S extends `${string}[${string}]${string}` ? true : false\n\n/**\n * Does the flags string start with `--no-`?\n */\ntype IsNegated<S extends string> = ExtractLongName<S> extends `no-${string}` ? true : false\n\n/**\n * Infer the value type for a flag based on the flags string and the\n * optional third argument (parser function, Standard Schema, choices array).\n *\n * Rules (mirroring Commander runtime behavior):\n * --flag → boolean | undefined\n * --no-flag → boolean\n * --flag <value> → string | undefined (or parser return type)\n * --flag [value] → string | boolean | undefined (or parser return type | boolean)\n * --flag <value>, parser fn → ReturnType<parser> | undefined\n * --flag <value>, CLIType<T> / StandardSchemaV1<T> → T | undefined\n * --flag <value>, choices[] → choices[number] | undefined\n */\ntype InferOptionType<Flags extends string, ParseArg = undefined> =\n IsNegated<Flags> extends true\n ? boolean\n : HasRequiredArg<Flags> extends true\n ? ParseArg extends readonly (infer C)[]\n ? C | undefined\n : ParseArg extends CLIType<infer T>\n ? T | undefined\n : ParseArg extends StandardSchemaV1<infer T>\n ? T | undefined\n : ParseArg extends (value: string, ...args: any[]) => infer R\n ? R | undefined\n : string | undefined\n : HasOptionalArg<Flags> extends true\n ? ParseArg extends readonly (infer C)[]\n ? C | boolean | undefined\n : ParseArg extends CLIType<infer T>\n ? T | boolean | undefined\n : ParseArg extends StandardSchemaV1<infer T>\n ? T | boolean | undefined\n : ParseArg extends (value: string, ...args: any[]) => infer R\n ? R | boolean | undefined\n : string | boolean | undefined\n : boolean | undefined\n\n// --- Standard Schema support ---\n\n/** Runtime check: is this value a Standard Schema v1 object? */\nfunction isStandardSchema(value: unknown): value is StandardSchemaV1 {\n return typeof value === \"object\" && value !== null && \"~standard\" in (value as any)\n}\n\n/** Wrap a Standard Schema as a Commander parser function */\nfunction standardSchemaParser<T>(schema: StandardSchemaV1<T>): (value: string) => T {\n return (value: string) => {\n const result = schema[\"~standard\"].validate(value)\n if (\"issues\" in result) {\n const msg = result.issues.map((i) => i.message).join(\", \")\n throw new Error(msg)\n }\n return result.value\n }\n}\n\n// --- Legacy Zod support (pre-3.24, no ~standard) ---\n\ninterface ZodLike<T = any> {\n parse(value: unknown): T\n _def: unknown\n}\n\nfunction isLegacyZodSchema(value: unknown): value is ZodLike {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as any).parse === \"function\" &&\n \"_def\" in (value as any) &&\n !(\"~standard\" in (value as any))\n )\n}\n\nfunction legacyZodParser<T>(schema: ZodLike<T>): (value: string) => T {\n return (value: string) => {\n try {\n return schema.parse(value)\n } catch (err: any) {\n if (err?.issues) {\n const messages = err.issues.map((i: any) => i.message).join(\", \")\n throw new Error(messages)\n }\n throw err\n }\n }\n}\n\n// --- Help Section Types ---\n\n/** Position for help sections — mirrors Commander's addHelpText positions. */\nexport type HelpSectionPosition = \"beforeAll\" | \"before\" | \"after\" | \"afterAll\"\n\n/** Content for a help section: rows of [term, description] pairs, or free-form text. */\nexport type HelpSectionContent = [string, string][] | string\n\n// Internal storage\ninterface StoredSection {\n position: HelpSectionPosition\n title: string\n content: HelpSectionContent\n}\n\n/**\n * Style a SINGLE-LINE section term using Commander's style hooks.\n *\n * Three modes:\n * - Shell command line (`$ termless play demo.tape`): tokenize via tokenizeCmdline()\n * and style each token by kind (dim prompt, primary program/subcommand,\n * secondary flags, accent brackets, dim quoted strings, plain values)\n * - Option-like (`-f, --flag`): entire term styled as option\n * - Plain text: command words + argument brackets\n *\n * For multi-line terms, callers split on \\n and call this per line — see\n * _renderSections().\n */\nfunction styleSectionTerm(term: string, helper: any): string {\n // Shell command terms (start with \"$ \", \"# \", \"> \", \"❯ \")\n if (isShellLine(term)) {\n return styleCmdlineTokens(tokenizeCmdline(term), helper)\n }\n\n // Option-like terms: entire term styled as option\n if (/^\\s*-/.test(term)) return helper.styleOptionText(term)\n\n // Command-like terms: style command words with primary, <brackets> with accent\n // Split into bracket groups and non-bracket parts\n const parts = term.split(/(<[^>]+>|\\[[^\\]]+\\])/g)\n if (parts.length === 1) {\n // No brackets — style entire term as command\n return helper.styleCommandText(term)\n }\n // Mix of command text and brackets\n return parts\n .map((part) => {\n if (/^[<[]/.test(part)) return helper.styleArgumentText(part)\n if (part) return helper.styleCommandText(part)\n return part\n })\n .join(\"\")\n}\n\n/**\n * Apply style hooks to a stream of CmdlineTokens.\n *\n * Each token kind maps to one of Commander's style hooks (or a manual ANSI\n * dim escape for prompts/quoted strings, since Commander's style hook set\n * doesn't have a \"dim\" entry).\n */\nfunction styleCmdlineTokens(tokens: CmdlineToken[], helper: any): string {\n const dim = (text: string) => (shouldColorize() ? `\\x1b[2m${text}\\x1b[22m` : text)\n return tokens\n .map((t) => {\n switch (t.kind) {\n case \"prompt\":\n return dim(t.text)\n case \"program\":\n case \"subcommand\":\n return helper.styleCommandText(t.text)\n case \"flag\":\n return helper.styleOptionText(t.text)\n case \"arg-bracket\":\n return helper.styleArgumentText(t.text)\n case \"quoted\":\n return dim(t.text)\n case \"value\":\n case \"whitespace\":\n return t.text\n }\n })\n .join(\"\")\n}\n\n/**\n * Compute the longest visual width of any line within a (possibly multi-line) term.\n * Used for column alignment when terms span multiple lines.\n */\nfunction maxLineWidth(term: string): number {\n let max = 0\n for (const line of term.split(\"\\n\")) {\n if (line.length > max) max = line.length\n }\n return max\n}\n\n// ────────────────────────────────────────────────────────────────\n// Command class — runtime implementation (non-generic)\n//\n// The class itself is NOT generic. Type-safe option inference is\n// layered on via interface merging below (see `TypedOptionOverloads`).\n// This keeps the class fully compatible with Commander's base Command\n// (no `noImplicitOverride` or structural assignability issues).\n// ────────────────────────────────────────────────────────────────\n\nclass _CommandBase extends BaseCommand {\n private _helpSectionList: StoredSection[] = []\n private _helpSectionsInstalled = false\n\n /** Argument names registered via typed .argument() — used by .action() to merge into opts. */\n _typedArgNames: string[] = []\n\n constructor(name?: string) {\n super(name)\n colorizeHelp(this as any)\n this._capitalizeBuiltinDescriptions()\n }\n\n /**\n * Add an option with smart third-argument detection.\n *\n * The third argument is detected in order:\n * 1. **Array** -- treated as choices (Commander `.choices()`)\n * 2. **Standard Schema v1** -- wrapped as a parser function\n * 3. **Legacy Zod** (pre-3.24, has `_def` + `parse`) -- wrapped as a parser\n * 4. **Function** -- passed through as Commander's parser function\n * 5. **Anything else** -- passed through as a default value\n */\n override option(flags: string, description?: string, parseArgOrDefault?: any, defaultValue?: any): this {\n if (Array.isArray(parseArgOrDefault)) {\n const opt = new Option(flags, description ?? \"\").choices(parseArgOrDefault as string[])\n this.addOption(opt)\n return this\n }\n if (isStandardSchema(parseArgOrDefault)) {\n return super.option(flags, description ?? \"\", standardSchemaParser(parseArgOrDefault), defaultValue)\n }\n if (isLegacyZodSchema(parseArgOrDefault)) {\n return super.option(flags, description ?? \"\", legacyZodParser(parseArgOrDefault), defaultValue)\n }\n if (typeof parseArgOrDefault === \"function\") {\n return super.option(flags, description ?? \"\", parseArgOrDefault, defaultValue)\n }\n return super.option(flags, description ?? \"\", parseArgOrDefault)\n }\n\n /**\n * Add an argument with smart third-argument detection.\n *\n * Same detection as `.option()`: array → choices, Standard Schema → parser,\n * legacy Zod → parser, function → parser, anything else → default value.\n * Tracks argument names for `.action()` merging.\n */\n override argument(flags: string, description?: string, parseArgOrDefault?: any, defaultValue?: any): this {\n // Extract the camelCase name from the flags string for action() merging\n const rawName = flags.replace(/[<\\[\\]>.]/g, \"\").trim()\n const camelName = rawName.replace(/-([a-z])/g, (_: string, c: string) => c.toUpperCase())\n this._typedArgNames.push(camelName)\n\n if (Array.isArray(parseArgOrDefault)) {\n const arg = this.createArgument(flags, description ?? \"\")\n arg.choices(parseArgOrDefault as string[])\n this.addArgument(arg)\n return this\n }\n if (isStandardSchema(parseArgOrDefault)) {\n return super.argument(flags, description ?? \"\", standardSchemaParser(parseArgOrDefault), defaultValue)\n }\n if (isLegacyZodSchema(parseArgOrDefault)) {\n return super.argument(flags, description ?? \"\", legacyZodParser(parseArgOrDefault), defaultValue)\n }\n if (typeof parseArgOrDefault === \"function\") {\n return super.argument(flags, description ?? \"\", parseArgOrDefault, defaultValue)\n }\n return super.argument(flags, description ?? \"\", parseArgOrDefault)\n }\n\n /**\n * Register an action callback with a named-parameter object instead of positional args.\n *\n * The handler receives a single object containing all positional arguments\n * (merged by name) and all options, plus the Command instance as a second arg.\n * Argument names come from the typed `.argument()` calls, camelCased.\n *\n * This is a convenience wrapper over `.action()` — `.action()` itself remains\n * Commander-native `(...args, opts, command) => ...`. Prefer `.action()` for\n * single-arg commands (where positional is more ergonomic) and `.actionMerged()`\n * for multi-arg commands (where a flat named object is nicer).\n *\n * @example\n * ```ts\n * new Command(\"deploy\")\n * .argument(\"<service>\")\n * .argument(\"[env]\")\n * .option(\"-p, --port <n>\", port)\n * .actionMerged(({ service, env, port }, cmd) => {\n * // service, env, port are all typed\n * // cmd is the Command instance\n * })\n * ```\n */\n actionMerged(fn: (params: any, cmd: any) => any): this {\n const argNames = this._typedArgNames\n return super.action((...args: any[]) => {\n // Commander passes: (arg1, arg2, ..., opts, command)\n const cmd = args[args.length - 1]\n const opts = args[args.length - 2] ?? {}\n const merged: Record<string, unknown> = { ...opts }\n for (let i = 0; i < argNames.length; i++) {\n merged[argNames[i]!] = args[i]\n }\n return fn(merged, cmd)\n })\n }\n\n /**\n * Add a styled help section — like Commander's `addHelpText` but with\n * structured content that participates in global column alignment.\n *\n * @example\n * ```ts\n * // Rows with aligned descriptions (default position: \"after\")\n * program.addHelpSection(\"Getting Started:\", [\n * [\"myapp init\", \"Initialize a new project\"],\n * [\"myapp serve\", \"Start the dev server\"],\n * ])\n *\n * // Free-form text\n * program.addHelpSection(\"Note:\", \"Requires Node.js 23+\")\n *\n * // Explicit position\n * program.addHelpSection(\"before\", \"Prerequisites:\", [\n * [\"node >= 23\", \"Required runtime\"],\n * ])\n * ```\n */\n addHelpSection(title: string, content: HelpSectionContent): this\n addHelpSection(position: HelpSectionPosition, title: string, content: HelpSectionContent): this\n addHelpSection(\n positionOrTitle: HelpSectionPosition | string,\n titleOrContent: string | HelpSectionContent,\n content?: HelpSectionContent,\n ): this {\n let position: HelpSectionPosition\n let title: string\n let body: HelpSectionContent\n\n if (content !== undefined) {\n // 3-arg: addHelpSection(position, title, content)\n position = positionOrTitle as HelpSectionPosition\n title = titleOrContent as string\n body = content\n } else {\n // 2-arg: addHelpSection(title, content) — defaults to \"after\"\n position = \"after\"\n title = positionOrTitle\n body = titleOrContent as HelpSectionContent\n }\n\n this._helpSectionList.push({ position, title, content: body })\n this._installHelpSectionHooks()\n return this\n }\n\n // Subcommands also get colorized help, Standard Schema, and array choices\n override createCommand(name?: string): _CommandBase {\n return new _CommandBase(name)\n }\n\n /**\n * Override Commander's `command()` to mirror inline-arg names (from\n * `command(\"deploy <service>\")`) into our `_typedArgNames`. This keeps\n * `.actionMerged()` working on subcommands declared with the inline form,\n * since the merged dispatch reads from `_typedArgNames` to know which\n * positional indices map to which key.\n *\n * Both forms now coexist:\n * .command(\"deploy <service>\") // inline — names from string\n * .command(\"deploy\").argument(\"<service>\") // explicit — names from .argument()\n * Both produce equivalent runtime + type behavior.\n */\n override command(...args: any[]): any {\n // biome-ignore lint: variadic forwarding\n const result = (super.command as any).apply(this, args)\n // The newly-created subcommand is always the last entry in this.commands\n // (Commander appends after createCommand). Its _args field has been populated\n // by Commander's own parsing of the name string.\n const sub = this.commands[this.commands.length - 1] as _CommandBase | undefined\n if (sub && Array.isArray((sub as any)._args)) {\n for (const arg of (sub as any)._args as Array<{ name(): string }>) {\n const argName = arg.name()\n const camel = argName.replace(/-([a-z])/g, (_: string, c: string) => c.toUpperCase())\n if (!sub._typedArgNames.includes(camel)) {\n sub._typedArgNames.push(camel)\n }\n }\n }\n return result\n }\n\n /**\n * Auto-detect capitalization from user-provided descriptions and match it\n * for built-in options (-V/--version, -h/--help).\n */\n private _capitalizeBuiltinDescriptions(): void {\n const origHelp = this.helpInformation.bind(this)\n this.helpInformation = () => {\n const builtinFlags = new Set([\"-V, --version\", \"-h, --help\"])\n const userDescs = this.options\n .filter((opt) => !builtinFlags.has(opt.flags) && opt.description && /^[a-zA-Z]/.test(opt.description))\n .map((opt) => opt.description!)\n for (const cmd of this.commands) {\n if (cmd.description() && /^[a-zA-Z]/.test(cmd.description())) {\n userDescs.push(cmd.description())\n }\n }\n if (userDescs.length > 0) {\n const capitalCount = userDescs.filter((d) => /^[A-Z]/.test(d)).length\n if (capitalCount > userDescs.length / 2) {\n for (const opt of this.options) {\n if (builtinFlags.has(opt.flags) && opt.description && /^[a-z]/.test(opt.description)) {\n opt.description = opt.description[0]!.toUpperCase() + opt.description.slice(1)\n }\n }\n const helpOpt = (this as any)._helpOption\n if (helpOpt?.description && /^[a-z]/.test(helpOpt.description)) {\n helpOpt.description = helpOpt.description[0]!.toUpperCase() + helpOpt.description.slice(1)\n }\n }\n }\n return origHelp()\n }\n }\n\n /**\n * Render sections for a given position using the help formatter.\n *\n * Handles multi-line term entries (terms containing `\\n`) by emitting one\n * row per line. The description column is **top-aligned**: it appears only\n * on the first line of a multi-line term, with subsequent lines holding\n * just the styled term and an empty description column.\n */\n private _renderSections(position: HelpSectionPosition, helper: any, termWidth: number): string {\n const sections = this._helpSectionList.filter((s) => s.position === position)\n if (sections.length === 0) return \"\"\n\n const lines: string[] = []\n for (const section of sections) {\n lines.push(\"\")\n lines.push(helper.styleTitle(section.title))\n if (typeof section.content === \"string\") {\n for (const line of section.content.split(\"\\n\")) {\n lines.push(` ${line}`)\n }\n } else {\n for (const [term, desc] of section.content) {\n // Multi-line term support: split on \\n, emit one row per line.\n // First line carries the description; subsequent lines have empty desc.\n const termLines = term.split(\"\\n\")\n for (let i = 0; i < termLines.length; i++) {\n const lineText = termLines[i]!\n const styledTerm = styleSectionTerm(lineText, helper)\n const lineDesc = i === 0 ? helper.styleDescriptionText(desc) : \"\"\n lines.push(helper.formatItem(styledTerm, termWidth, lineDesc, helper))\n }\n }\n }\n }\n lines.push(\"\")\n return lines.join(\"\\n\")\n }\n\n /** Install hooks once — merges with existing configureHelp, adds addHelpText for before/afterAll. */\n private _installHelpSectionHooks(): void {\n if (this._helpSectionsInstalled) return\n this._helpSectionsInstalled = true\n\n const self = this\n const existing = (this as any)._helpConfiguration ?? {}\n const origPadWidth = existing.padWidth\n const origFormatHelp = existing.formatHelp\n const protoFormatHelp = Help.prototype.formatHelp\n\n this.configureHelp({\n ...existing,\n // Include section term widths in global column alignment\n padWidth(cmd: any, helper: any) {\n const base = origPadWidth\n ? origPadWidth(cmd, helper)\n : Math.max(\n helper.longestOptionTermLength(cmd, helper),\n helper.longestGlobalOptionTermLength?.(cmd, helper) ?? 0,\n helper.longestSubcommandTermLength(cmd, helper),\n helper.longestArgumentTermLength(cmd, helper),\n )\n if (cmd !== self) return base\n let sectionMax = 0\n for (const section of self._helpSectionList) {\n if (typeof section.content !== \"string\") {\n for (const [term] of section.content) {\n // For multi-line terms, use the LONGEST line, not the total length.\n const w = maxLineWidth(term)\n if (w > sectionMax) sectionMax = w\n }\n }\n }\n return Math.max(base, sectionMax)\n },\n // Render \"before\" and \"after\" sections inside formatHelp\n formatHelp(cmd: any, helper: any) {\n const baseHelp = origFormatHelp ? origFormatHelp(cmd, helper) : protoFormatHelp.call(helper, cmd, helper)\n // Only render THIS command's sections. configureHelp is inherited by\n // subcommands, so without this guard parent sections leak into subcommand help.\n // Subcommands with their own sections install their own hooks.\n if (cmd !== self) return baseHelp\n const termWidth = helper.padWidth(cmd, helper)\n const before = self._renderSections(\"before\", helper, termWidth)\n const after = self._renderSections(\"after\", helper, termWidth)\n\n // \"before\" goes after the Usage+Description but before Options.\n // Since we can't inject mid-formatHelp easily, prepend before baseHelp.\n // \"after\" appends at the end.\n return (before ? before + \"\\n\" : \"\") + baseHelp + after\n },\n })\n\n // \"beforeAll\" and \"afterAll\" use Commander's addHelpText (propagates to subcommands)\n this.addHelpText(\"beforeAll\", () => {\n const helper = this.createHelp()\n const termWidth = helper.padWidth(this, helper)\n return this._renderSections(\"beforeAll\", helper, termWidth)\n })\n this.addHelpText(\"afterAll\", () => {\n const helper = this.createHelp()\n const termWidth = helper.padWidth(this, helper)\n return this._renderSections(\"afterAll\", helper, termWidth)\n })\n }\n}\n\n// ────────────────────────────────────────────────────────────────\n// Type-safe option inference layer\n//\n// The `Command` type wraps `_CommandBase` with three generic parameters:\n// - `Opts` — accumulated options (from `.option()`)\n// - `Args` — tuple of positional arg types (from `.argument()`)\n// - `ArgsRecord` — record mapping arg names to types (for merged form)\n//\n// Each `.option()` overload narrows `Opts`.\n// Each `.argument()` overload appends to both `Args` and `ArgsRecord`.\n// The runtime class is `_CommandBase` — `Command` is just a type alias\n// with a constructor wrapper.\n// ────────────────────────────────────────────────────────────────\n\n// ────────────────────────────────────────────────────────────────\n// Public type: Command<Opts, Args, ArgsRecord>\n//\n// Interface merging adds typed `.option()`, `.argument()`, `.opts()`,\n// and `.action()` overloads on top of `_CommandBase`. The `@ts-expect-error`\n// suppresses the `opts()` return type conflict (we intentionally narrow it\n// from Commander's generic `<T>() => T` to a concrete `() => Opts`).\n// ────────────────────────────────────────────────────────────────\n\n// @ts-expect-error — opts() intentionally narrows from base <T>() => T to () => Opts\nexport interface Command<\n Opts extends Record<string, unknown> = {},\n Args extends any[] = [],\n ArgsRecord extends Record<string, unknown> = {},\n> extends _CommandBase {\n /** Return option values with full type inference. */\n opts(): Opts\n\n /** Accept any `Command<...>` variant as a subcommand. */\n addCommand(cmd: Command<any, any, any>, opts?: { isDefault?: boolean; hidden?: boolean; noHelp?: boolean }): this\n\n /** Factory for subcommands — returns a fresh `Command<{}>`. */\n createCommand(name?: string): Command<{}, [], {}>\n\n // -- Chain-preserving overrides for inherited Commander methods --\n // Without these, calling .description(), .alias(), or .version() loses the\n // generic type parameters (falls back to base Commander's `this`).\n\n /** Set command description (preserves typed chain). */\n description(str: string): this\n /** Get command description. */\n description(): string\n\n /** Set command alias (preserves typed chain). */\n alias(alias: string): this\n /** Get command alias. */\n alias(): string\n\n /** Set command version (preserves typed chain). */\n version(str: string, flags?: string, description?: string): this\n\n // -- Typed option overloads --\n\n /** Add a choices option: `--env <e>`, `[\"dev\", \"staging\", \"prod\"]` */\n option<F extends string, const C extends readonly string[]>(\n flags: F,\n description: string,\n choices: C,\n ): Command<Opts & Record<FlagKey<F>, C[number] | undefined>, Args, ArgsRecord>\n\n /** Add an option with a CLIType preset (port, csv, uint, etc.) */\n option<F extends string, T>(\n flags: F,\n description: string,\n schema: CLIType<T>,\n defaultValue?: T,\n ): Command<Opts & Record<FlagKey<F>, T | undefined>, Args, ArgsRecord>\n\n /** Add an option with a Standard Schema v1 validator (Zod, Valibot, ArkType) */\n option<F extends string, S extends AnyStandardSchema>(\n flags: F,\n description: string,\n schema: S,\n defaultValue?: SchemaOutput<S>,\n ): Command<Opts & Record<FlagKey<F>, SchemaOutput<S> | undefined>, Args, ArgsRecord>\n\n /** Add an option with a parser function */\n option<F extends string, T>(\n flags: F,\n description: string,\n parseArg: (value: string, previous: T) => T,\n defaultValue?: T,\n ): Command<Opts & Record<FlagKey<F>, T | undefined>, Args, ArgsRecord>\n\n /** Add a boolean flag or string-value option (no parser) */\n option<F extends string>(\n flags: F,\n description?: string,\n defaultValue?: string | boolean,\n ): Command<Opts & Record<FlagKey<F>, InferOptionType<F>>, Args, ArgsRecord>\n\n /**\n * Fallback: accepts any third argument (legacy Zod, unknown schemas, etc.)\n * that doesn't match the more specific overloads above.\n */\n option<F extends string>(\n flags: F,\n description: string,\n parseArgOrDefault: any,\n defaultValue?: any,\n ): Command<Opts, Args, ArgsRecord>\n\n // -- Typed argument overloads --\n // Arguments append to the Args tuple (for native .action()) AND to ArgsRecord\n // (for .actionMerged()). They do NOT merge into Opts — Opts is strictly options-only.\n\n /** Add a choices argument: `<env>`, `[\"dev\", \"staging\", \"prod\"]` */\n argument<F extends string, const C extends readonly string[]>(\n flags: F,\n description: string,\n choices: C,\n ): Command<\n Opts,\n [\n ...Args,\n IsArgVariadic<F> extends true ? C[number][] : IsArgRequired<F> extends true ? C[number] : C[number] | undefined,\n ],\n ArgsRecord &\n Record<\n ArgKey<F>,\n IsArgVariadic<F> extends true ? C[number][] : IsArgRequired<F> extends true ? C[number] : C[number] | undefined\n >\n >\n\n /** Add an argument with a CLIType preset (port, csv, uint, etc.) */\n argument<F extends string, T>(\n flags: F,\n description: string,\n schema: CLIType<T>,\n defaultValue?: T,\n ): Command<Opts, [...Args, InferArgType<F, CLIType<T>>], ArgsRecord & Record<ArgKey<F>, InferArgType<F, CLIType<T>>>>\n\n /** Add an argument with a Standard Schema v1 validator (Zod, Valibot, ArkType) */\n argument<F extends string, S extends AnyStandardSchema>(\n flags: F,\n description: string,\n schema: S,\n defaultValue?: SchemaOutput<S>,\n ): Command<\n Opts,\n [...Args, InferArgType<F, StandardSchemaV1<SchemaOutput<S>>>],\n ArgsRecord & Record<ArgKey<F>, InferArgType<F, StandardSchemaV1<SchemaOutput<S>>>>\n >\n\n /** Add an argument with a parser function */\n argument<F extends string, T>(\n flags: F,\n description: string,\n parseArg: (value: string, previous: T) => T,\n defaultValue?: T,\n ): Command<\n Opts,\n [...Args, InferArgType<F, (value: string, previous: T) => T>],\n ArgsRecord & Record<ArgKey<F>, InferArgType<F, (value: string, previous: T) => T>>\n >\n\n /** Add a string argument (no parser) — required, optional, or variadic */\n argument<F extends string>(\n flags: F,\n description?: string,\n defaultValue?: string,\n ): Command<Opts, [...Args, InferArgType<F>], ArgsRecord & Record<ArgKey<F>, InferArgType<F>>>\n\n /** Fallback: accepts any third argument */\n argument<F extends string>(\n flags: F,\n description: string,\n parseArgOrDefault: any,\n defaultValue?: any,\n ): Command<Opts, Args, ArgsRecord>\n\n // -- Typed action overloads --\n\n /**\n * Register an action handler — Commander-native positional form.\n * Receives `(...positionalArgs, opts, command)`. The command instance is\n * appended last so it can be safely ignored by handlers that don't need it.\n */\n action(fn: (...args: [...Args, Opts, Command<Opts, Args, ArgsRecord>]) => void | Promise<void>): this\n\n /**\n * Register an action handler — merged named-object form.\n * Receives `(params, command)` where `params` is a flat object of\n * args merged with options, keyed by argument/option name.\n *\n * Use this when you prefer a single destructured object to multiple positional\n * parameters — especially for commands with 2+ arguments.\n */\n actionMerged(fn: (params: Opts & ArgsRecord, cmd: Command<Opts, Args, ArgsRecord>) => void | Promise<void>): this\n\n // -- Typed command overload --\n\n /**\n * Create a subcommand. Returns a fresh `Command<{}, ParsedArgs, ParsedArgsRecord>`.\n *\n * Positional arguments embedded in the command name string (`\"deploy <service>\"`)\n * are parsed at the type level and contribute to the returned `Args` tuple and\n * `ArgsRecord`. The same shape as if you'd chained `.argument(\"<service>\")`.\n *\n * For typed parsers, schemas, or choices, use `.argument()` on the returned\n * command — the inline string syntax can only express plain string args.\n * Mixing both forms is allowed: inline args come first in the tuple, then\n * `.argument()` calls append.\n */\n command<S extends string>(\n nameAndArgs: S,\n opts?: { isDefault?: boolean; hidden?: boolean; noHelp?: boolean },\n ): ParseCommandString<S> extends [infer A extends any[], infer R extends Record<string, unknown>]\n ? Command<{}, A, R>\n : Command<{}, [], {}>\n\n /** Overload for command with description (attached-action subcommand, returns parent). */\n command<S extends string>(\n nameAndArgs: S,\n description: string,\n opts?: { isDefault?: boolean; hidden?: boolean; noHelp?: boolean; executableFile?: string },\n ): this\n}\n\n/**\n * Type-safe Commander Command with auto-colorized help, Standard Schema support,\n * array-as-choices detection, and inferred option types.\n *\n * Use `.action()` for Commander-native positional form — `(arg1, arg2, opts, cmd) => ...`.\n * Use `.actionMerged()` for a flat destructured form — `({ arg1, arg2, opt1 }, cmd) => ...`.\n *\n * @example\n * ```ts\n * new Command(\"deploy\")\n * .argument(\"<service>\", \"Service to deploy\")\n * .argument(\"[env]\", \"Environment\", [\"dev\", \"staging\", \"prod\"] as const)\n * .option(\"--verbose\", \"Verbose output\")\n * .action((service, env, opts) => { ... })\n * // or: .actionMerged(({ service, env, verbose }) => { ... })\n * ```\n */\nexport const Command = _CommandBase as unknown as {\n new (name?: string): Command<{}, [], {}>\n}\n","/**\n * Extended Zod object with CLI types.\n *\n * Spreads all of Zod's exports and adds CLI-specific schemas.\n * Tree-shakeable -- only evaluated if user imports `z`.\n *\n * @example\n * ```ts\n * import { z, Command } from \"@silvery/commander\"\n *\n * new Command(\"deploy\")\n * .option(\"-p, --port <n>\", \"Port\", z.port)\n * .option(\"--tags <t>\", \"Tags\", z.csv)\n * .option(\"-e, --env <e>\", \"Env\", [\"dev\", \"staging\", \"prod\"])\n *\n * program.parse()\n * ```\n */\n\nimport * as zod from \"zod\"\n\nexport const z = {\n ...zod,\n // CLI types (built on Zod schemas)\n port: zod.coerce.number().int().min(1).max(65535),\n int: zod.coerce.number().int(),\n uint: zod.coerce.number().int().min(0),\n float: zod.coerce.number(),\n csv: zod.string().transform((v: string) =>\n v\n .split(\",\")\n .map((s: string) => s.trim())\n .filter(Boolean),\n ),\n url: zod.string().url(),\n path: zod.string().min(1),\n email: zod.string().email(),\n date: zod.coerce.date(),\n json: zod.string().transform((v: string) => JSON.parse(v)),\n bool: zod\n .enum([\"true\", \"false\", \"1\", \"0\", \"yes\", \"no\", \"y\", \"n\"] as const)\n .transform((v: string) => [\"true\", \"1\", \"yes\", \"y\"].includes(v)),\n intRange: (min: number, max: number) => zod.coerce.number().int().min(min).max(max),\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAY,aAAa;AAM/B,MAAM,IAAI,YAAY,EAAE,OAAO,SAAS,CAAC;;;;;AAMzC,SAAgB,iBAA0B;AACxC,QAAO,UAAU,QAAQ;;;;;;;;;;;AAwC3B,SAAgB,aAAa,SAAs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AW,MAAc,KAAK,MAAM,EAAE,CAAC;CAC1D,MAAM,IACH,KAAK;EAAC;EAAQ;EAAS;EAAK;EAAK;EAAO;EAAM;EAAK;EAAI,CAAU,CACjE,WAAW,MAAc;EAAC;EAAQ;EAAK;EAAO;EAAI,CAAC,SAAS,EAAE,CAAC;CAClE,WAAW,KAAa,QAAgB,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI;CACpF"}
|
package/dist/plain.d.mts
DELETED
package/dist/plain.mjs
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
//#region src/presets.ts
|
|
2
|
-
function createType(vendor, validate) {
|
|
3
|
-
const schema = {
|
|
4
|
-
"~standard": {
|
|
5
|
-
version: 1,
|
|
6
|
-
vendor,
|
|
7
|
-
validate: (value) => {
|
|
8
|
-
try {
|
|
9
|
-
return { value: validate(value) };
|
|
10
|
-
} catch (e) {
|
|
11
|
-
return { issues: [{ message: e.message }] };
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
parse(value) {
|
|
16
|
-
const result = schema["~standard"].validate(value);
|
|
17
|
-
if ("issues" in result) throw new Error(result.issues[0]?.message ?? "Validation failed");
|
|
18
|
-
return result.value;
|
|
19
|
-
},
|
|
20
|
-
safeParse(value) {
|
|
21
|
-
const result = schema["~standard"].validate(value);
|
|
22
|
-
if ("issues" in result) return {
|
|
23
|
-
success: false,
|
|
24
|
-
issues: [...result.issues]
|
|
25
|
-
};
|
|
26
|
-
return {
|
|
27
|
-
success: true,
|
|
28
|
-
value: result.value
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
return schema;
|
|
33
|
-
}
|
|
34
|
-
const VENDOR = "@silvery/commander";
|
|
35
|
-
/** Integer (coerced from string). */
|
|
36
|
-
const int = createType(VENDOR, (v) => {
|
|
37
|
-
const s = String(v).trim();
|
|
38
|
-
if (s === "") throw new Error(`Expected integer, got "${v}"`);
|
|
39
|
-
const n = Number(s);
|
|
40
|
-
if (!Number.isInteger(n)) throw new Error(`Expected integer, got "${v}"`);
|
|
41
|
-
return n;
|
|
42
|
-
});
|
|
43
|
-
/** Unsigned integer (>= 0, coerced from string). */
|
|
44
|
-
const uint = createType(VENDOR, (v) => {
|
|
45
|
-
const s = String(v).trim();
|
|
46
|
-
if (s === "") throw new Error(`Expected unsigned integer (>= 0), got "${v}"`);
|
|
47
|
-
const n = Number(s);
|
|
48
|
-
if (!Number.isInteger(n) || n < 0) throw new Error(`Expected unsigned integer (>= 0), got "${v}"`);
|
|
49
|
-
return n;
|
|
50
|
-
});
|
|
51
|
-
/** Float (coerced from string). */
|
|
52
|
-
const float = createType(VENDOR, (v) => {
|
|
53
|
-
const s = String(v).trim();
|
|
54
|
-
if (s === "" || s === "NaN") throw new Error(`Expected number, got "${v}"`);
|
|
55
|
-
const n = Number(s);
|
|
56
|
-
if (Number.isNaN(n)) throw new Error(`Expected number, got "${v}"`);
|
|
57
|
-
return n;
|
|
58
|
-
});
|
|
59
|
-
/** Port number (1-65535). */
|
|
60
|
-
const port = createType(VENDOR, (v) => {
|
|
61
|
-
const n = Number(v);
|
|
62
|
-
if (!Number.isInteger(n) || n < 1 || n > 65535) throw new Error(`Expected port (1-65535), got "${v}"`);
|
|
63
|
-
return n;
|
|
64
|
-
});
|
|
65
|
-
/** URL (validated via URL constructor). */
|
|
66
|
-
const url = createType(VENDOR, (v) => {
|
|
67
|
-
const s = String(v);
|
|
68
|
-
try {
|
|
69
|
-
new URL(s);
|
|
70
|
-
return s;
|
|
71
|
-
} catch {
|
|
72
|
-
throw new Error(`Expected valid URL, got "${v}"`);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
/** File path (non-empty string). */
|
|
76
|
-
const path = createType(VENDOR, (v) => {
|
|
77
|
-
const s = String(v);
|
|
78
|
-
if (!s) throw new Error("Expected non-empty path");
|
|
79
|
-
return s;
|
|
80
|
-
});
|
|
81
|
-
/** Comma-separated values to string[]. */
|
|
82
|
-
const csv = createType(VENDOR, (v) => {
|
|
83
|
-
return String(v).split(",").map((s) => s.trim()).filter(Boolean);
|
|
84
|
-
});
|
|
85
|
-
/** JSON string to parsed value. */
|
|
86
|
-
const json = createType(VENDOR, (v) => {
|
|
87
|
-
try {
|
|
88
|
-
return JSON.parse(String(v));
|
|
89
|
-
} catch {
|
|
90
|
-
throw new Error(`Expected valid JSON, got "${v}"`);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
/** Boolean string ("true"/"false"/"1"/"0"/"yes"/"no"). */
|
|
94
|
-
const bool = createType(VENDOR, (v) => {
|
|
95
|
-
const s = String(v).toLowerCase();
|
|
96
|
-
if ([
|
|
97
|
-
"true",
|
|
98
|
-
"1",
|
|
99
|
-
"yes",
|
|
100
|
-
"y"
|
|
101
|
-
].includes(s)) return true;
|
|
102
|
-
if ([
|
|
103
|
-
"false",
|
|
104
|
-
"0",
|
|
105
|
-
"no",
|
|
106
|
-
"n"
|
|
107
|
-
].includes(s)) return false;
|
|
108
|
-
throw new Error(`Expected boolean (true/false/yes/no/1/0), got "${v}"`);
|
|
109
|
-
});
|
|
110
|
-
/** Date string to Date object. */
|
|
111
|
-
const date = createType(VENDOR, (v) => {
|
|
112
|
-
const d = new Date(String(v));
|
|
113
|
-
if (isNaN(d.getTime())) throw new Error(`Expected valid date, got "${v}"`);
|
|
114
|
-
return d;
|
|
115
|
-
});
|
|
116
|
-
/** Email address (basic validation). */
|
|
117
|
-
const email = createType(VENDOR, (v) => {
|
|
118
|
-
const s = String(v);
|
|
119
|
-
if (!s.includes("@") || !s.includes(".")) throw new Error(`Expected email address, got "${v}"`);
|
|
120
|
-
return s;
|
|
121
|
-
});
|
|
122
|
-
/** Regex pattern string to RegExp. */
|
|
123
|
-
const regex = createType(VENDOR, (v) => {
|
|
124
|
-
try {
|
|
125
|
-
return new RegExp(String(v));
|
|
126
|
-
} catch {
|
|
127
|
-
throw new Error(`Expected valid regex, got "${v}"`);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
/** Integer with min/max bounds (factory). */
|
|
131
|
-
function intRange(min, max) {
|
|
132
|
-
return createType(VENDOR, (v) => {
|
|
133
|
-
const n = Number(v);
|
|
134
|
-
if (!Number.isInteger(n) || n < min || n > max) throw new Error(`Expected integer ${min}-${max}, got "${v}"`);
|
|
135
|
-
return n;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
139
|
-
export { float as a, json as c, regex as d, uint as f, email as i, path as l, csv as n, int as o, url as p, date as r, intRange as s, bool as t, port as u };
|
|
140
|
-
|
|
141
|
-
//# sourceMappingURL=presets-DGCyXjnC.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"presets-DGCyXjnC.mjs","names":[],"sources":["../src/presets.ts"],"sourcesContent":["/**\n * Built-in CLI types — Standard Schema v1 validators for common CLI argument patterns.\n *\n * Zero dependencies — validation is manual, no Zod/Valibot/ArkType required.\n * Each type implements Standard Schema v1 for interop with any schema library,\n * plus standalone `.parse()` and `.safeParse()` convenience methods.\n *\n * @example\n * ```ts\n * import { Command, port, csv } from \"@silvery/commander\"\n *\n * new Command(\"deploy\")\n * .option(\"-p, --port <n>\", \"Port\", port) // number (1-65535)\n * .option(\"-r, --retries <n>\", \"Retries\", int) // number (integer)\n * .option(\"--tags <t>\", \"Tags\", csv) // string[]\n * .option(\"-e, --env <e>\", \"Env\", [\"dev\", \"staging\", \"prod\"])\n *\n * // Standalone usage (outside Commander)\n * port.parse(\"3000\") // 3000\n * port.safeParse(\"abc\") // { success: false, issues: [{ message: \"...\" }] }\n * ```\n */\n\n/**\n * Standard Schema v1 interface — the universal schema interop protocol.\n * Supports any schema library that implements Standard Schema (Zod >=3.24,\n * Valibot >=1.0, ArkType >=2.0, etc.).\n *\n * Inlined to avoid any dependency on @standard-schema/spec.\n * See: https://github.com/standard-schema/standard-schema\n */\nexport interface StandardSchemaV1<T = unknown> {\n readonly \"~standard\": {\n readonly version: 1\n readonly vendor: string\n readonly validate: (\n value: unknown,\n ) => { value: T } | { issues: ReadonlyArray<{ message: string; path?: ReadonlyArray<unknown> }> }\n }\n}\n\n/** A Standard Schema v1 CLI type with standalone parse/safeParse methods. */\nexport interface CLIType<T> extends StandardSchemaV1<T> {\n /** Parse and validate a value, throwing on failure. */\n parse(value: unknown): T\n /** Parse and validate a value, returning a result object. */\n safeParse(value: unknown): { success: true; value: T } | { success: false; issues: Array<{ message: string }> }\n}\n\nfunction createType<T>(vendor: string, validate: (value: unknown) => T): CLIType<T> {\n const schema: CLIType<T> = {\n \"~standard\": {\n version: 1,\n vendor,\n validate: (value) => {\n try {\n return { value: validate(value) }\n } catch (e: any) {\n return { issues: [{ message: e.message }] }\n }\n },\n },\n parse(value: unknown): T {\n const result = schema[\"~standard\"].validate(value)\n if (\"issues\" in result) throw new Error(result.issues[0]?.message ?? \"Validation failed\")\n return result.value\n },\n safeParse(value: unknown) {\n const result = schema[\"~standard\"].validate(value)\n if (\"issues\" in result) return { success: false as const, issues: [...result.issues] }\n return { success: true as const, value: result.value }\n },\n }\n return schema\n}\n\nconst VENDOR = \"@silvery/commander\"\n\n/** Integer (coerced from string). */\nexport const int = createType<number>(VENDOR, (v) => {\n const s = String(v).trim()\n if (s === \"\") throw new Error(`Expected integer, got \"${v}\"`)\n const n = Number(s)\n if (!Number.isInteger(n)) throw new Error(`Expected integer, got \"${v}\"`)\n return n\n})\n\n/** Unsigned integer (>= 0, coerced from string). */\nexport const uint = createType<number>(VENDOR, (v) => {\n const s = String(v).trim()\n if (s === \"\") throw new Error(`Expected unsigned integer (>= 0), got \"${v}\"`)\n const n = Number(s)\n if (!Number.isInteger(n) || n < 0) throw new Error(`Expected unsigned integer (>= 0), got \"${v}\"`)\n return n\n})\n\n/** Float (coerced from string). */\nexport const float = createType<number>(VENDOR, (v) => {\n const s = String(v).trim()\n if (s === \"\" || s === \"NaN\") throw new Error(`Expected number, got \"${v}\"`)\n const n = Number(s)\n if (Number.isNaN(n)) throw new Error(`Expected number, got \"${v}\"`)\n return n\n})\n\n/** Port number (1-65535). */\nexport const port = createType<number>(VENDOR, (v) => {\n const n = Number(v)\n if (!Number.isInteger(n) || n < 1 || n > 65535) throw new Error(`Expected port (1-65535), got \"${v}\"`)\n return n\n})\n\n/** URL (validated via URL constructor). */\nexport const url = createType<string>(VENDOR, (v) => {\n const s = String(v)\n try {\n new URL(s)\n return s\n } catch {\n throw new Error(`Expected valid URL, got \"${v}\"`)\n }\n})\n\n/** File path (non-empty string). */\nexport const path = createType<string>(VENDOR, (v) => {\n const s = String(v)\n if (!s) throw new Error(\"Expected non-empty path\")\n return s\n})\n\n/** Comma-separated values to string[]. */\nexport const csv = createType<string[]>(VENDOR, (v) => {\n return String(v)\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean)\n})\n\n/** JSON string to parsed value. */\nexport const json = createType<unknown>(VENDOR, (v) => {\n try {\n return JSON.parse(String(v))\n } catch {\n throw new Error(`Expected valid JSON, got \"${v}\"`)\n }\n})\n\n/** Boolean string (\"true\"/\"false\"/\"1\"/\"0\"/\"yes\"/\"no\"). */\nexport const bool = createType<boolean>(VENDOR, (v) => {\n const s = String(v).toLowerCase()\n if ([\"true\", \"1\", \"yes\", \"y\"].includes(s)) return true\n if ([\"false\", \"0\", \"no\", \"n\"].includes(s)) return false\n throw new Error(`Expected boolean (true/false/yes/no/1/0), got \"${v}\"`)\n})\n\n/** Date string to Date object. */\nexport const date = createType<Date>(VENDOR, (v) => {\n const d = new Date(String(v))\n if (isNaN(d.getTime())) throw new Error(`Expected valid date, got \"${v}\"`)\n return d\n})\n\n/** Email address (basic validation). */\nexport const email = createType<string>(VENDOR, (v) => {\n const s = String(v)\n if (!s.includes(\"@\") || !s.includes(\".\")) throw new Error(`Expected email address, got \"${v}\"`)\n return s\n})\n\n/** Regex pattern string to RegExp. */\nexport const regex = createType<RegExp>(VENDOR, (v) => {\n try {\n return new RegExp(String(v))\n } catch {\n throw new Error(`Expected valid regex, got \"${v}\"`)\n }\n})\n\n/** Integer with min/max bounds (factory). */\nexport function intRange(min: number, max: number): CLIType<number> {\n return createType<number>(VENDOR, (v) => {\n const n = Number(v)\n if (!Number.isInteger(n) || n < min || n > max) throw new Error(`Expected integer ${min}-${max}, got \"${v}\"`)\n return n\n })\n}\n"],"mappings":";AAiDA,SAAS,WAAc,QAAgB,UAA6C;CAClF,MAAM,SAAqB;EACzB,aAAa;GACX,SAAS;GACT;GACA,WAAW,UAAU;AACnB,QAAI;AACF,YAAO,EAAE,OAAO,SAAS,MAAM,EAAE;aAC1B,GAAQ;AACf,YAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE;;;GAGhD;EACD,MAAM,OAAmB;GACvB,MAAM,SAAS,OAAO,aAAa,SAAS,MAAM;AAClD,OAAI,YAAY,OAAQ,OAAM,IAAI,MAAM,OAAO,OAAO,IAAI,WAAW,oBAAoB;AACzF,UAAO,OAAO;;EAEhB,UAAU,OAAgB;GACxB,MAAM,SAAS,OAAO,aAAa,SAAS,MAAM;AAClD,OAAI,YAAY,OAAQ,QAAO;IAAE,SAAS;IAAgB,QAAQ,CAAC,GAAG,OAAO,OAAO;IAAE;AACtF,UAAO;IAAE,SAAS;IAAe,OAAO,OAAO;IAAO;;EAEzD;AACD,QAAO;;AAGT,MAAM,SAAS;;AAGf,MAAa,MAAM,WAAmB,SAAS,MAAM;CACnD,MAAM,IAAI,OAAO,EAAE,CAAC,MAAM;AAC1B,KAAI,MAAM,GAAI,OAAM,IAAI,MAAM,0BAA0B,EAAE,GAAG;CAC7D,MAAM,IAAI,OAAO,EAAE;AACnB,KAAI,CAAC,OAAO,UAAU,EAAE,CAAE,OAAM,IAAI,MAAM,0BAA0B,EAAE,GAAG;AACzE,QAAO;EACP;;AAGF,MAAa,OAAO,WAAmB,SAAS,MAAM;CACpD,MAAM,IAAI,OAAO,EAAE,CAAC,MAAM;AAC1B,KAAI,MAAM,GAAI,OAAM,IAAI,MAAM,0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,MAAa,OAAO,WAAoB,SAAS,MAAM;CACrD,MAAM,IAAI,OAAO,EAAE,CAAC,aAAa;AACjC,KAAI;EAAC;EAAQ;EAAK;EAAO;EAAI,CAAC,SAAS,EAAE,CAAE,QAAO;AAClD,KAAI;EAAC;EAAS;EAAK;EAAM;EAAI,CAAC,SAAS,EAAE,CAAE,QAAO;AAClD,OAAM,IAAI,MAAM,kDAAkD,EAAE,GAAG;EACvE;;AAGF,MAAa,OAAO,WAAiB,SAAS,MAAM;CAClD,MAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;AAC7B,KAAI,MAAM,EAAE,SAAS,CAAC,CAAE,OAAM,IAAI,MAAM,6BAA6B,EAAE,GAAG;AAC1E,QAAO;EACP;;AAGF,MAAa,QAAQ,WAAmB,SAAS,MAAM;CACrD,MAAM,IAAI,OAAO,EAAE;AACnB,KAAI,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,EAAE,SAAS,IAAI,CAAE,OAAM,IAAI,MAAM,gCAAgC,EAAE,GAAG;AAC/F,QAAO;EACP;;AAGF,MAAa,QAAQ,WAAmB,SAAS,MAAM;AACrD,KAAI;AACF,SAAO,IAAI,OAAO,OAAO,EAAE,CAAC;SACtB;AACN,QAAM,IAAI,MAAM,8BAA8B,EAAE,GAAG;;EAErD;;AAGF,SAAgB,SAAS,KAAa,KAA8B;AAClE,QAAO,WAAmB,SAAS,MAAM;EACvC,MAAM,IAAI,OAAO,EAAE;AACnB,MAAI,CAAC,OAAO,UAAU,EAAE,IAAI,IAAI,OAAO,IAAI,IAAK,OAAM,IAAI,MAAM,oBAAoB,IAAI,GAAG,IAAI,SAAS,EAAE,GAAG;AAC7G,SAAO;GACP"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
//#region src/presets.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Built-in CLI types — Standard Schema v1 validators for common CLI argument patterns.
|
|
4
|
-
*
|
|
5
|
-
* Zero dependencies — validation is manual, no Zod/Valibot/ArkType required.
|
|
6
|
-
* Each type implements Standard Schema v1 for interop with any schema library,
|
|
7
|
-
* plus standalone `.parse()` and `.safeParse()` convenience methods.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { Command, port, csv } from "@silvery/commander"
|
|
12
|
-
*
|
|
13
|
-
* new Command("deploy")
|
|
14
|
-
* .option("-p, --port <n>", "Port", port) // number (1-65535)
|
|
15
|
-
* .option("-r, --retries <n>", "Retries", int) // number (integer)
|
|
16
|
-
* .option("--tags <t>", "Tags", csv) // string[]
|
|
17
|
-
* .option("-e, --env <e>", "Env", ["dev", "staging", "prod"])
|
|
18
|
-
*
|
|
19
|
-
* // Standalone usage (outside Commander)
|
|
20
|
-
* port.parse("3000") // 3000
|
|
21
|
-
* port.safeParse("abc") // { success: false, issues: [{ message: "..." }] }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Standard Schema v1 interface — the universal schema interop protocol.
|
|
26
|
-
* Supports any schema library that implements Standard Schema (Zod >=3.24,
|
|
27
|
-
* Valibot >=1.0, ArkType >=2.0, etc.).
|
|
28
|
-
*
|
|
29
|
-
* Inlined to avoid any dependency on @standard-schema/spec.
|
|
30
|
-
* See: https://github.com/standard-schema/standard-schema
|
|
31
|
-
*/
|
|
32
|
-
interface StandardSchemaV1<T = unknown> {
|
|
33
|
-
readonly "~standard": {
|
|
34
|
-
readonly version: 1;
|
|
35
|
-
readonly vendor: string;
|
|
36
|
-
readonly validate: (value: unknown) => {
|
|
37
|
-
value: T;
|
|
38
|
-
} | {
|
|
39
|
-
issues: ReadonlyArray<{
|
|
40
|
-
message: string;
|
|
41
|
-
path?: ReadonlyArray<unknown>;
|
|
42
|
-
}>;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/** A Standard Schema v1 CLI type with standalone parse/safeParse methods. */
|
|
47
|
-
interface CLIType<T> extends StandardSchemaV1<T> {
|
|
48
|
-
/** Parse and validate a value, throwing on failure. */
|
|
49
|
-
parse(value: unknown): T;
|
|
50
|
-
/** Parse and validate a value, returning a result object. */
|
|
51
|
-
safeParse(value: unknown): {
|
|
52
|
-
success: true;
|
|
53
|
-
value: T;
|
|
54
|
-
} | {
|
|
55
|
-
success: false;
|
|
56
|
-
issues: Array<{
|
|
57
|
-
message: string;
|
|
58
|
-
}>;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
/** Integer (coerced from string). */
|
|
62
|
-
declare const int: CLIType<number>;
|
|
63
|
-
/** Unsigned integer (>= 0, coerced from string). */
|
|
64
|
-
declare const uint: CLIType<number>;
|
|
65
|
-
/** Float (coerced from string). */
|
|
66
|
-
declare const float: CLIType<number>;
|
|
67
|
-
/** Port number (1-65535). */
|
|
68
|
-
declare const port: CLIType<number>;
|
|
69
|
-
/** URL (validated via URL constructor). */
|
|
70
|
-
declare const url: CLIType<string>;
|
|
71
|
-
/** File path (non-empty string). */
|
|
72
|
-
declare const path: CLIType<string>;
|
|
73
|
-
/** Comma-separated values to string[]. */
|
|
74
|
-
declare const csv: CLIType<string[]>;
|
|
75
|
-
/** JSON string to parsed value. */
|
|
76
|
-
declare const json: CLIType<unknown>;
|
|
77
|
-
/** Boolean string ("true"/"false"/"1"/"0"/"yes"/"no"). */
|
|
78
|
-
declare const bool: CLIType<boolean>;
|
|
79
|
-
/** Date string to Date object. */
|
|
80
|
-
declare const date: CLIType<Date>;
|
|
81
|
-
/** Email address (basic validation). */
|
|
82
|
-
declare const email: CLIType<string>;
|
|
83
|
-
/** Regex pattern string to RegExp. */
|
|
84
|
-
declare const regex: CLIType<RegExp>;
|
|
85
|
-
/** Integer with min/max bounds (factory). */
|
|
86
|
-
declare function intRange(min: number, max: number): CLIType<number>;
|
|
87
|
-
//#endregion
|
|
88
|
-
export { date as a, int as c, path as d, port as f, url as h, csv as i, intRange as l, uint as m, StandardSchemaV1 as n, email as o, regex as p, bool as r, float as s, CLIType as t, json as u };
|
|
89
|
-
//# sourceMappingURL=presets-DTzPdB8a.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"presets-DTzPdB8a.d.mts","names":[],"sources":["../src/presets.ts"],"mappings":";;AA+BA;;;;;;;;;;;;;;;;;;;;;;;AAWA;;;;;;UAXiB,gBAAA;EAAA,SACN,WAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,QAAA,GACP,KAAA;MACK,KAAA,EAAO,CAAA;IAAA;MAAQ,MAAA,EAAQ,aAAA;QAAgB,OAAA;QAAiB,IAAA,GAAO,aAAA;MAAA;IAAA;EAAA;AAAA;;UAKzD,OAAA,YAAmB,gBAAA,CAAiB,CAAA;EAIwB;EAF3E,KAAA,CAAM,KAAA,YAAiB,CAAA;EAEoE;EAA3F,SAAA,CAAU,KAAA;IAAmB,OAAA;IAAe,KAAA,EAAO,CAAA;EAAA;IAAQ,OAAA;IAAgB,MAAA,EAAQ,KAAA;MAAQ,OAAA;IAAA;EAAA;AAAA;;cAiChF,GAAA,EAAG,OAAA;AAkBhB;AAAA,cATa,IAAA,EAAI,OAAA;;cASJ,KAAA,EAAK,OAAA;;cASL,IAAA,EAAI,OAAA;;cAOJ,GAAA,EAAG,OAAA;;cAWH,IAAA,EAAI,OAAA;AAXjB;AAAA,cAkBa,GAAA,EAAG,OAAA;;cAQH,IAAA,EAAI,OAAA;;cASJ,IAAA,EAAI,OAAA;;cAQJ,IAAA,EAAI,OAAA,CAAA,IAAA;;cAOJ,KAAA,EAAK,OAAA;AAhClB;AAAA,cAuCa,KAAA,EAAK,OAAA,CAAA,MAAA;;iBASF,QAAA,CAAS,GAAA,UAAa,GAAA,WAAc,OAAA"}
|