@silvery/commander 0.19.2 → 0.23.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/README.md +6 -0
- package/dist/index.d.mts +30 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +82 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -71,6 +71,12 @@ Options with [Zod](https://github.com/colinhacks/zod) schemas or built-in types
|
|
|
71
71
|
- Any [Standard Schema](https://github.com/standard-schema/standard-schema) library — [Valibot](https://github.com/fabian-hiller/valibot), [ArkType](https://github.com/arktypeio/arktype)
|
|
72
72
|
- All types usable standalone via `.parse()`/`.safeParse()`
|
|
73
73
|
|
|
74
|
+
## Help composition and silent aliases
|
|
75
|
+
|
|
76
|
+
Enhanced `Command.configureHelp({...})` shallow-merges with the current help configuration, so partial customizations preserve Silvery's installed color hooks; supplied keys win. `@silvery/commander/plain` keeps Commander's replacement behavior.
|
|
77
|
+
|
|
78
|
+
Use `.silentAlias("queues")` for a compatibility spelling that should parse without appearing in help, usage, or typo suggestions. Ordinary `.alias()` and `.aliases()` remain visible and otherwise keep Commander semantics.
|
|
79
|
+
|
|
74
80
|
## Docs
|
|
75
81
|
|
|
76
82
|
Full reference, type table, and API details at **[silvery.dev/reference/commander](https://silvery.dev/reference/commander)**.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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";
|
|
2
|
+
import { Argument, Command as Command$1, CommandOptions, CommanderError, Help, HelpConfiguration, InvalidArgumentError, Option, OptionValues } from "commander";
|
|
3
3
|
import * as zod from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/command.d.ts
|
|
@@ -145,6 +145,23 @@ declare class _CommandBase extends Command$1 {
|
|
|
145
145
|
/** Argument names registered via typed .argument() — used by .action() to merge into opts. */
|
|
146
146
|
_typedArgNames: string[];
|
|
147
147
|
constructor(name?: string);
|
|
148
|
+
/** Compose help customizations while preserving the enhanced command's installed hooks. */
|
|
149
|
+
configureHelp(configuration: HelpConfiguration): this;
|
|
150
|
+
configureHelp(): HelpConfiguration;
|
|
151
|
+
/** Return every spelling accepted for a command, including parse-only aliases. */
|
|
152
|
+
private _commandIdentities;
|
|
153
|
+
private _silentAliasesFor;
|
|
154
|
+
private _addSilentAlias;
|
|
155
|
+
/** Match the executable-child forwarding used by Commander's alias(). */
|
|
156
|
+
private _aliasTarget;
|
|
157
|
+
/** Parent lookup used by Commander parsing; silent aliases never enter normal alias metadata. */
|
|
158
|
+
_findCommand(name?: string): Command$1 | undefined;
|
|
159
|
+
private _assertAliasAvailable;
|
|
160
|
+
alias(alias: string): this;
|
|
161
|
+
alias(): string;
|
|
162
|
+
/** Add an accepted command spelling which is omitted from help, usage, and suggestions. */
|
|
163
|
+
silentAlias(alias: string): this;
|
|
164
|
+
addCommand(command: Command$1, opts?: CommandOptions): this;
|
|
148
165
|
/**
|
|
149
166
|
* Add an option with smart third-argument detection.
|
|
150
167
|
*
|
|
@@ -246,8 +263,8 @@ declare class _CommandBase extends Command$1 {
|
|
|
246
263
|
interface Command<Opts extends Record<string, unknown> = {}, Args extends any[] = [], ArgsRecord extends Record<string, unknown> = {}> extends _CommandBase {
|
|
247
264
|
/** Return option values with full type inference. */
|
|
248
265
|
opts(): Opts;
|
|
249
|
-
/** Accept any `Command<...>` variant
|
|
250
|
-
addCommand(cmd: Command<any, any, any>, opts?: {
|
|
266
|
+
/** Accept raw Commander commands and any enhanced `Command<...>` variant. */
|
|
267
|
+
addCommand(cmd: Command$1 | Command<any, any, any>, opts?: {
|
|
251
268
|
isDefault?: boolean;
|
|
252
269
|
hidden?: boolean;
|
|
253
270
|
noHelp?: boolean;
|
|
@@ -262,6 +279,8 @@ interface Command<Opts extends Record<string, unknown> = {}, Args extends any[]
|
|
|
262
279
|
alias(alias: string): this;
|
|
263
280
|
/** Get command alias. */
|
|
264
281
|
alias(): string;
|
|
282
|
+
/** Add a parse-only alias omitted from help, usage, and suggestions. */
|
|
283
|
+
silentAlias(alias: string): this;
|
|
265
284
|
/** Set command version (preserves typed chain). */
|
|
266
285
|
version(str: string, flags?: string, description?: string): this;
|
|
267
286
|
/** Add a choices option: `--env <e>`, `["dev", "staging", "prod"]` */
|
|
@@ -509,11 +528,11 @@ declare const z: {
|
|
|
509
528
|
array<T extends zod.z.core.SomeType>(element: T, params?: string | zod.z.core.$ZodArrayParams): zod.ZodArray<T>;
|
|
510
529
|
keyof<T extends zod.ZodObject>(schema: T): zod.ZodEnum<zod.z.core.util.KeysEnum<T["_zod"]["output"]>>;
|
|
511
530
|
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
|
|
513
|
-
looseObject<T extends zod.z.core.$ZodLooseShape>(shape: T, params?: string | zod.z.core.$ZodObjectParams): zod.ZodObject<T
|
|
531
|
+
strictObject<T extends zod.z.core.$ZodLooseShape>(shape: T, params?: string | zod.z.core.$ZodObjectParams): zod.ZodObject<zod.z.core.util.Writeable<T>, zod.z.core.$strict>;
|
|
532
|
+
looseObject<T extends zod.z.core.$ZodLooseShape>(shape: T, params?: string | zod.z.core.$ZodObjectParams): zod.ZodObject<zod.z.core.util.Writeable<T>, zod.z.core.$loose>;
|
|
514
533
|
union<const T extends readonly zod.z.core.SomeType[]>(options: T, params?: string | zod.z.core.$ZodUnionParams): zod.ZodUnion<T>;
|
|
515
534
|
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
|
|
535
|
+
discriminatedUnion<Types extends readonly [zod.z.core.$ZodTypeDiscriminable<Disc>, ...zod.z.core.$ZodTypeDiscriminable<Disc>[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | zod.z.core.$ZodDiscriminatedUnionParams): zod.ZodDiscriminatedUnion<Types, Disc>;
|
|
517
536
|
intersection<T extends zod.z.core.SomeType, U extends zod.z.core.SomeType>(left: T, right: U): zod.ZodIntersection<T, U>;
|
|
518
537
|
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
538
|
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>;
|
|
@@ -527,7 +546,7 @@ declare const z: {
|
|
|
527
546
|
literal<const T extends ReadonlyArray<zod.z.core.util.Literal>>(value: T, params?: string | zod.z.core.$ZodLiteralParams): zod.ZodLiteral<T[number]>;
|
|
528
547
|
literal<const T extends zod.z.core.util.Literal>(value: T, params?: string | zod.z.core.$ZodLiteralParams): zod.ZodLiteral<T>;
|
|
529
548
|
file(params?: string | zod.z.core.$ZodFileParams): zod.ZodFile;
|
|
530
|
-
transform<I = unknown, O = I>(fn: (input: I, ctx: zod.z.core
|
|
549
|
+
transform<I = unknown, O = I>(fn: (input: I, ctx: zod.z.core.$RefinementCtx) => O): zod.ZodTransform<Awaited<O>, I>;
|
|
531
550
|
optional<T extends zod.z.core.SomeType>(innerType: T): zod.ZodOptional<T>;
|
|
532
551
|
exactOptional<T extends zod.z.core.SomeType>(innerType: T): zod.ZodExactOptional<T>;
|
|
533
552
|
nullable<T extends zod.z.core.SomeType>(innerType: T): zod.ZodNullable<T>;
|
|
@@ -542,6 +561,7 @@ declare const z: {
|
|
|
542
561
|
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
562
|
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
563
|
}): zod.ZodCodec<A, B>;
|
|
564
|
+
invertCodec<A extends zod.z.core.SomeType, B extends zod.z.core.SomeType>(codec: zod.ZodCodec<A, B>): zod.ZodCodec<B, A>;
|
|
545
565
|
readonly<T extends zod.z.core.SomeType>(innerType: T): zod.ZodReadonly<T>;
|
|
546
566
|
templateLiteral<const Parts extends zod.z.core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | zod.z.core.$ZodTemplateLiteralParams): zod.ZodTemplateLiteral<zod.z.core.$PartsToTemplateLiteral<Parts>>;
|
|
547
567
|
lazy<T extends zod.z.core.SomeType>(getter: () => T): zod.ZodLazy<T>;
|
|
@@ -567,8 +587,8 @@ declare const z: {
|
|
|
567
587
|
check<O = unknown>(fn: zod.z.core.CheckFn<O>): zod.z.core.$ZodCheck<O>;
|
|
568
588
|
custom<O>(fn?: (data: unknown) => unknown, _params?: string | zod.z.core.$ZodCustomParams | undefined): zod.ZodCustom<O, O>;
|
|
569
589
|
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
|
|
571
|
-
preprocess<A, U extends zod.z.core.SomeType, B = unknown>(fn: (arg: B, ctx: zod.z.core.$RefinementCtx) => A, schema: U): zod.
|
|
590
|
+
superRefine<T>(fn: (arg: T, payload: zod.z.core.$RefinementCtx<T>) => void | Promise<void>, params?: zod.z.core.$ZodSuperRefineParams): zod.z.core.$ZodCheck<T>;
|
|
591
|
+
preprocess<A, U extends zod.z.core.SomeType, B = unknown>(fn: (arg: B, ctx: zod.z.core.$RefinementCtx) => A, schema: U): zod.ZodPreprocess<U>;
|
|
572
592
|
ZodType: zod.z.core.$constructor<zod.ZodType>;
|
|
573
593
|
_ZodString: zod.z.core.$constructor<zod._ZodString>;
|
|
574
594
|
ZodString: zod.z.core.$constructor<zod.ZodString>;
|
|
@@ -637,6 +657,7 @@ declare const z: {
|
|
|
637
657
|
ZodNaN: zod.z.core.$constructor<zod.ZodNaN>;
|
|
638
658
|
ZodPipe: zod.z.core.$constructor<zod.ZodPipe>;
|
|
639
659
|
ZodCodec: zod.z.core.$constructor<zod.ZodCodec>;
|
|
660
|
+
ZodPreprocess: zod.z.core.$constructor<zod.ZodPreprocess>;
|
|
640
661
|
ZodReadonly: zod.z.core.$constructor<zod.ZodReadonly>;
|
|
641
662
|
ZodTemplateLiteral: zod.z.core.$constructor<zod.ZodTemplateLiteral>;
|
|
642
663
|
ZodLazy: zod.z.core.$constructor<zod.ZodLazy>;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/command.ts","../src/colorize.ts","../src/z.ts"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/command.ts","../src/colorize.ts","../src/z.ts"],"mappings":";;;;;;;;;;;;UA+DU,iBAAA;EAAA,SACC,WAAA;IAAA,SACE,OAAA;IAAA,SACA,MAAA;IAAA,SACA,QAAA,GAAW,KAAA,cAAmB,IAAA;IAAA,SAC9B,KAAA;MAAA,SAAmB,MAAA;IAAA;EAAA;AAAA;;KAK3B,YAAA,WAAuB,iBAAA,IAAqB,WAAA,CAAY,CAAA;;;;;;;;;;;KAgBxD,eAAA,qBAAoC,CAAA,sCACrC,IAAA,qCACE,IAAA,GACA,IA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
|
|
20
20
|
*/
|
|
21
21
|
const autoStyle = createStyle();
|
|
22
|
-
const s = createStyle({ level: "
|
|
22
|
+
const s = createStyle({ level: "ansi16" });
|
|
23
23
|
/**
|
|
24
24
|
* Check if color output should be enabled.
|
|
25
25
|
* Delegates to @silvery/ansi's auto-detection (NO_COLOR, FORCE_COLOR, TERM).
|
|
@@ -42,7 +42,7 @@ function colorizeHelp(program, options) {
|
|
|
42
42
|
const desc = options?.description ?? ((t) => t);
|
|
43
43
|
const heading = options?.heading ?? ((t) => s.bold(t));
|
|
44
44
|
const brackets = options?.brackets ?? ((t) => s.accent(t));
|
|
45
|
-
|
|
45
|
+
const helpConfig = {
|
|
46
46
|
styleTitle: (str) => heading(str),
|
|
47
47
|
styleCommandText: (str) => cmds(str),
|
|
48
48
|
styleOptionText: (str) => flags(str),
|
|
@@ -50,6 +50,11 @@ function colorizeHelp(program, options) {
|
|
|
50
50
|
styleArgumentText: (str) => brackets(str),
|
|
51
51
|
styleDescriptionText: (str) => desc(str),
|
|
52
52
|
styleCommandDescription: (str) => s.bold.primary(str)
|
|
53
|
+
};
|
|
54
|
+
const existingHelp = program.configureHelp();
|
|
55
|
+
program.configureHelp({
|
|
56
|
+
...existingHelp,
|
|
57
|
+
...helpConfig
|
|
53
58
|
});
|
|
54
59
|
program.configureOutput({
|
|
55
60
|
getOutHasColors: () => true,
|
|
@@ -289,6 +294,7 @@ function maxLineWidth(term) {
|
|
|
289
294
|
for (const line of term.split("\n")) if (line.length > max) max = line.length;
|
|
290
295
|
return max;
|
|
291
296
|
}
|
|
297
|
+
const silentAliasesSymbol = Symbol("silvery.commander.silentAliases");
|
|
292
298
|
/**
|
|
293
299
|
* Type-safe Commander Command with auto-colorized help, Standard Schema support,
|
|
294
300
|
* array-as-choices detection, and inferred option types.
|
|
@@ -313,9 +319,81 @@ const Command = class _CommandBase extends Command$1 {
|
|
|
313
319
|
_typedArgNames = [];
|
|
314
320
|
constructor(name) {
|
|
315
321
|
super(name);
|
|
316
|
-
colorizeHelp(this);
|
|
322
|
+
if (shouldColorize()) colorizeHelp(this);
|
|
317
323
|
this._capitalizeBuiltinDescriptions();
|
|
318
324
|
}
|
|
325
|
+
configureHelp(configuration) {
|
|
326
|
+
if (configuration === void 0) return super.configureHelp();
|
|
327
|
+
return super.configureHelp({
|
|
328
|
+
...super.configureHelp(),
|
|
329
|
+
...configuration
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/** Return every spelling accepted for a command, including parse-only aliases. */
|
|
333
|
+
_commandIdentities(command) {
|
|
334
|
+
return [
|
|
335
|
+
command.name(),
|
|
336
|
+
...command.aliases(),
|
|
337
|
+
...this._silentAliasesFor(command)
|
|
338
|
+
];
|
|
339
|
+
}
|
|
340
|
+
_silentAliasesFor(command) {
|
|
341
|
+
return command[silentAliasesSymbol] ?? [];
|
|
342
|
+
}
|
|
343
|
+
_addSilentAlias(command, alias) {
|
|
344
|
+
const target = command;
|
|
345
|
+
const aliases = target[silentAliasesSymbol];
|
|
346
|
+
if (aliases) {
|
|
347
|
+
aliases.push(alias);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
Object.defineProperty(target, silentAliasesSymbol, { value: [alias] });
|
|
351
|
+
}
|
|
352
|
+
/** Match the executable-child forwarding used by Commander's alias(). */
|
|
353
|
+
_aliasTarget() {
|
|
354
|
+
const lastCommand = this.commands[this.commands.length - 1];
|
|
355
|
+
return lastCommand?._executableHandler ? lastCommand : this;
|
|
356
|
+
}
|
|
357
|
+
/** Parent lookup used by Commander parsing; silent aliases never enter normal alias metadata. */
|
|
358
|
+
_findCommand(name) {
|
|
359
|
+
if (!name) return void 0;
|
|
360
|
+
return this.commands.find((command) => this._commandIdentities(command).includes(name));
|
|
361
|
+
}
|
|
362
|
+
_assertAliasAvailable(command, alias) {
|
|
363
|
+
if (alias === command.name()) throw new Error("Command alias can't be the same as its name");
|
|
364
|
+
const matchingCommand = [...command.aliases(), ...this._silentAliasesFor(command)].includes(alias) ? command : command.parent?.commands.find((candidate) => this._commandIdentities(candidate).includes(alias));
|
|
365
|
+
if (matchingCommand) {
|
|
366
|
+
const existingCommand = this._commandIdentities(matchingCommand).join("|");
|
|
367
|
+
throw new Error(`cannot add alias '${alias}' to command '${command.name()}' as already have command '${existingCommand}'`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
alias(alias) {
|
|
371
|
+
if (alias === void 0) return super.alias();
|
|
372
|
+
this._assertAliasAvailable(this._aliasTarget(), alias);
|
|
373
|
+
return super.alias(alias);
|
|
374
|
+
}
|
|
375
|
+
/** Add an accepted command spelling which is omitted from help, usage, and suggestions. */
|
|
376
|
+
silentAlias(alias) {
|
|
377
|
+
const command = this._aliasTarget();
|
|
378
|
+
this._assertAliasAvailable(command, alias);
|
|
379
|
+
this._addSilentAlias(command, alias);
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
addCommand(command, opts) {
|
|
383
|
+
if (!command.name()) return super.addCommand(command, opts);
|
|
384
|
+
const identities = this._commandIdentities(command);
|
|
385
|
+
const seen = /* @__PURE__ */ new Set();
|
|
386
|
+
for (const identity of identities) {
|
|
387
|
+
const matchingCommand = seen.has(identity) ? command : this._findCommand(identity);
|
|
388
|
+
if (matchingCommand) {
|
|
389
|
+
const existingCommand = this._commandIdentities(matchingCommand).join("|");
|
|
390
|
+
const newCommand = identities.join("|");
|
|
391
|
+
throw new Error(`cannot add command '${newCommand}' as already have command '${existingCommand}'`);
|
|
392
|
+
}
|
|
393
|
+
seen.add(identity);
|
|
394
|
+
}
|
|
395
|
+
return super.addCommand(command, opts);
|
|
396
|
+
}
|
|
319
397
|
/**
|
|
320
398
|
* Add an option with smart third-argument detection.
|
|
321
399
|
*
|
|
@@ -345,7 +423,7 @@ const Command = class _CommandBase extends Command$1 {
|
|
|
345
423
|
* Tracks argument names for `.action()` merging.
|
|
346
424
|
*/
|
|
347
425
|
argument(flags, description, parseArgOrDefault, defaultValue) {
|
|
348
|
-
const camelName = flags.replace(/[
|
|
426
|
+
const camelName = flags.replace(/[<[\]>.]/g, "").trim().replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
349
427
|
this._typedArgNames.push(camelName);
|
|
350
428
|
if (Array.isArray(parseArgOrDefault)) {
|
|
351
429
|
const arg = this.createArgument(flags, description ?? "");
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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}`\n ? [Name, Rest]\n : [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<\n Rest,\n [...Tuple, string | undefined],\n Rec & Record<CamelCase<Name>, string | undefined>\n >\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(\n flags: string,\n description?: string,\n parseArgOrDefault?: any,\n defaultValue?: any,\n ): 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(\n flags,\n description ?? \"\",\n standardSchemaParser(parseArgOrDefault),\n defaultValue,\n )\n }\n if (isLegacyZodSchema(parseArgOrDefault)) {\n return super.option(\n flags,\n description ?? \"\",\n legacyZodParser(parseArgOrDefault),\n defaultValue,\n )\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(\n flags: string,\n description?: string,\n parseArgOrDefault?: any,\n defaultValue?: any,\n ): 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(\n flags,\n description ?? \"\",\n standardSchemaParser(parseArgOrDefault),\n defaultValue,\n )\n }\n if (isLegacyZodSchema(parseArgOrDefault)) {\n return super.argument(\n flags,\n description ?? \"\",\n legacyZodParser(parseArgOrDefault),\n defaultValue,\n )\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(\n (opt) =>\n !builtinFlags.has(opt.flags) && opt.description && /^[a-zA-Z]/.test(opt.description),\n )\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 =\n 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\n ? origFormatHelp(cmd, helper)\n : 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(\n cmd: Command<any, any, any>,\n opts?: { isDefault?: boolean; hidden?: boolean; noHelp?: boolean },\n ): 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\n ? C[number][]\n : IsArgRequired<F> extends true\n ? C[number]\n : C[number] | undefined,\n ],\n ArgsRecord &\n Record<\n ArgKey<F>,\n IsArgVariadic<F> extends true\n ? C[number][]\n : IsArgRequired<F> extends true\n ? C[number]\n : 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<\n Opts,\n [...Args, InferArgType<F, CLIType<T>>],\n ArgsRecord & Record<ArgKey<F>, InferArgType<F, CLIType<T>>>\n >\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(\n fn: (...args: [...Args, Opts, Command<Opts, Args, ArgsRecord>]) => void | Promise<void>,\n ): 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(\n fn: (params: Opts & ArgsRecord, cmd: Command<Opts, Args, ArgsRecord>) => void | Promise<void>,\n ): 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,SAAsB,SAAqC;CAEtF,MAAM,OAAO,SAAS,cAAc,MAAc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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"}
|
|
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: \"ansi16\" })\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 const existingHelp = program.configureHelp()\n program.configureHelp({ ...existingHelp, ...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 {\n Command as BaseCommand,\n Help,\n Option,\n type CommandOptions,\n type HelpConfiguration,\n} 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}`\n ? [Name, Rest]\n : [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<\n Rest,\n [...Tuple, string | undefined],\n Rec & Record<CamelCase<Name>, string | undefined>\n >\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\nconst silentAliasesSymbol = Symbol(\"silvery.commander.silentAliases\")\ntype CommandWithSilentAliases = BaseCommand & { [silentAliasesSymbol]?: string[] }\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 // Auto-colorize only when color detection says the output supports it.\n // Unconditional colorization here shipped ANSI codes to pipes and ignored\n // NO_COLOR (found by gitbay's CLI tests, 2026-07-07): colorizeHelp() is\n // the explicit \"force color\" path, so the AUTO path must gate on the same\n // detection shouldColorize() already exposes.\n if (shouldColorize()) colorizeHelp(this as any)\n this._capitalizeBuiltinDescriptions()\n }\n\n /** Compose help customizations while preserving the enhanced command's installed hooks. */\n override configureHelp(configuration: HelpConfiguration): this\n override configureHelp(): HelpConfiguration\n override configureHelp(configuration?: HelpConfiguration): this | HelpConfiguration {\n if (configuration === undefined) return super.configureHelp()\n return super.configureHelp({ ...super.configureHelp(), ...configuration })\n }\n\n /** Return every spelling accepted for a command, including parse-only aliases. */\n private _commandIdentities(command: BaseCommand): string[] {\n return [command.name(), ...command.aliases(), ...this._silentAliasesFor(command)]\n }\n\n private _silentAliasesFor(command: BaseCommand): string[] {\n return (command as CommandWithSilentAliases)[silentAliasesSymbol] ?? []\n }\n\n private _addSilentAlias(command: BaseCommand, alias: string): void {\n const target = command as CommandWithSilentAliases\n const aliases = target[silentAliasesSymbol]\n if (aliases) {\n aliases.push(alias)\n return\n }\n Object.defineProperty(target, silentAliasesSymbol, { value: [alias] })\n }\n\n /** Match the executable-child forwarding used by Commander's alias(). */\n private _aliasTarget(): BaseCommand {\n const lastCommand = this.commands[this.commands.length - 1] as\n | (BaseCommand & { _executableHandler?: boolean })\n | undefined\n return lastCommand?._executableHandler ? lastCommand : this\n }\n\n /** Parent lookup used by Commander parsing; silent aliases never enter normal alias metadata. */\n _findCommand(name?: string): BaseCommand | undefined {\n if (!name) return undefined\n return this.commands.find((command) => this._commandIdentities(command).includes(name))\n }\n\n private _assertAliasAvailable(command: BaseCommand, alias: string): void {\n if (alias === command.name()) {\n throw new Error(\"Command alias can't be the same as its name\")\n }\n\n const ownAliases = [...command.aliases(), ...this._silentAliasesFor(command)]\n const matchingCommand = ownAliases.includes(alias)\n ? command\n : command.parent?.commands.find((candidate) =>\n this._commandIdentities(candidate).includes(alias),\n )\n if (matchingCommand) {\n const existingCommand = this._commandIdentities(matchingCommand).join(\"|\")\n throw new Error(\n `cannot add alias '${alias}' to command '${command.name()}' as already have command '${existingCommand}'`,\n )\n }\n }\n\n override alias(alias: string): this\n override alias(): string\n override alias(alias?: string): this | string {\n if (alias === undefined) return super.alias()\n this._assertAliasAvailable(this._aliasTarget(), alias)\n return super.alias(alias)\n }\n\n /** Add an accepted command spelling which is omitted from help, usage, and suggestions. */\n silentAlias(alias: string): this {\n const command = this._aliasTarget()\n this._assertAliasAvailable(command, alias)\n this._addSilentAlias(command, alias)\n return this\n }\n\n override addCommand(command: BaseCommand, opts?: CommandOptions): this {\n if (!command.name()) return super.addCommand(command, opts)\n\n const identities = this._commandIdentities(command)\n const seen = new Set<string>()\n for (const identity of identities) {\n const matchingCommand = seen.has(identity) ? command : this._findCommand(identity)\n if (matchingCommand) {\n const existingCommand = this._commandIdentities(matchingCommand).join(\"|\")\n const newCommand = identities.join(\"|\")\n throw new Error(\n `cannot add command '${newCommand}' as already have command '${existingCommand}'`,\n )\n }\n seen.add(identity)\n }\n\n return super.addCommand(command, opts)\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(\n flags: string,\n description?: string,\n parseArgOrDefault?: any,\n defaultValue?: any,\n ): 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(\n flags,\n description ?? \"\",\n standardSchemaParser(parseArgOrDefault),\n defaultValue,\n )\n }\n if (isLegacyZodSchema(parseArgOrDefault)) {\n return super.option(\n flags,\n description ?? \"\",\n legacyZodParser(parseArgOrDefault),\n defaultValue,\n )\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(\n flags: string,\n description?: string,\n parseArgOrDefault?: any,\n defaultValue?: any,\n ): 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(\n flags,\n description ?? \"\",\n standardSchemaParser(parseArgOrDefault),\n defaultValue,\n )\n }\n if (isLegacyZodSchema(parseArgOrDefault)) {\n return super.argument(\n flags,\n description ?? \"\",\n legacyZodParser(parseArgOrDefault),\n defaultValue,\n )\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(\n (opt) =>\n !builtinFlags.has(opt.flags) && opt.description && /^[a-zA-Z]/.test(opt.description),\n )\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 =\n 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\n ? origFormatHelp(cmd, helper)\n : 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 raw Commander commands and any enhanced `Command<...>` variant. */\n addCommand(\n cmd: BaseCommand | Command<any, any, any>,\n opts?: { isDefault?: boolean; hidden?: boolean; noHelp?: boolean },\n ): 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 /** Add a parse-only alias omitted from help, usage, and suggestions. */\n silentAlias(alias: string): this\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\n ? C[number][]\n : IsArgRequired<F> extends true\n ? C[number]\n : C[number] | undefined,\n ],\n ArgsRecord &\n Record<\n ArgKey<F>,\n IsArgVariadic<F> extends true\n ? C[number][]\n : IsArgRequired<F> extends true\n ? C[number]\n : 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<\n Opts,\n [...Args, InferArgType<F, CLIType<T>>],\n ArgsRecord & Record<ArgKey<F>, InferArgType<F, CLIType<T>>>\n >\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(\n fn: (...args: [...Args, Opts, Command<Opts, Args, ArgsRecord>]) => void | Promise<void>,\n ): 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(\n fn: (params: Opts & ArgsRecord, cmd: Command<Opts, Args, ArgsRecord>) => void | Promise<void>,\n ): 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,UAAU,CAAC;;;;;AAM1C,SAAgB,iBAA0B;AACxC,QAAO,UAAU,QAAQ;;;;;;;;;;;AAwC3B,SAAgB,aAAa,SAAsB,SAAqC;CAEtF,MAAM,OAAO,SAAS,cAAc,MAAc,EAAE,QAAQ,EAAE;CAC9D,MAAM,QAAQ,SAAS,WAAW,MAAc,EAAE,UAAU,EAAE;CAC9D,MAAM,OAAO,SAAS,iBAAiB,MAAc;CACrD,MAAM,UAAU,SAAS,aAAa,MAAc,EAAE,KAAK,EAAE;CAC7D,MAAM,WAAW,SAAS,cAAc,MAAc,EAAE,OAAO,EAAE;CAEjE,MAAM,aAAsC;EAC1C,aAAa,QAAgB,QAAQ,IAAI;EACzC,mBAAmB,QAAgB,KAAK,IAAI;EAC5C,kBAAkB,QAAgB,MAAM,IAAI;EAC5C,sBAAsB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AM;CACjD,KAAK,IAAI,OAAO,QAAQ,CAAC,KAAK;CAC9B,MAAM,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE;CACtC,OAAO,IAAI,OAAO,QAAQ;CAC1B,KAAK,IAAI,QAAQ,CAAC,WAAW,MAC3B,EACG,MAAM,IAAI,CACV,KAAK,MAAc,EAAE,MAAM,CAAC,CAC5B,OAAO,QAAQ,CACnB;CACD,KAAK,IAAI,QAAQ,CAAC,KAAK;CACvB,MAAM,IAAI,QAAQ,CAAC,IAAI,EAAE;CACzB,OAAO,IAAI,QAAQ,CAAC,OAAO;CAC3B,MAAM,IAAI,OAAO,MAAM;CACvB,MAAM,IAAI,QAAQ,CAAC,WAAW,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silvery/commander",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Colorized Commander.js help output using ANSI escape codes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ansi",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@silvery/ansi": "0.
|
|
39
|
-
"commander": ">=
|
|
38
|
+
"@silvery/ansi": "0.23.0",
|
|
39
|
+
"commander": ">=15.0.0",
|
|
40
40
|
"zod": ">=3.0.0"
|
|
41
41
|
},
|
|
42
42
|
"tsdown": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"format": "esm"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
57
|
+
"node": ">=24.0.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown"
|