politty 0.4.12 → 0.4.14
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 +11 -8
- package/dist/{arg-registry-BlXeCM4p.d.cts → arg-registry-CkPDokIu.d.ts} +236 -13
- package/dist/arg-registry-CkPDokIu.d.ts.map +1 -0
- package/dist/{arg-registry-D0MimRYf.d.ts → arg-registry-r5wYN6qd.d.cts} +236 -13
- package/dist/arg-registry-r5wYN6qd.d.cts.map +1 -0
- package/dist/augment.d.cts +3 -2
- package/dist/augment.d.cts.map +1 -1
- package/dist/augment.d.ts +3 -2
- package/dist/augment.d.ts.map +1 -1
- package/dist/completion/index.cjs +1 -2
- package/dist/completion/index.d.cts +1 -1
- package/dist/completion/index.d.ts +1 -1
- package/dist/completion/index.js +1 -2
- package/dist/{completion-BADAzqT9.cjs → completion-CAekGYS4.cjs} +24 -14
- package/dist/completion-CAekGYS4.cjs.map +1 -0
- package/dist/{completion-Dj7ytbLu.js → completion-yHz8Pdr7.js} +23 -13
- package/dist/completion-yHz8Pdr7.js.map +1 -0
- package/dist/docs/index.cjs +50 -19
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +1 -2
- package/dist/docs/index.d.cts.map +1 -1
- package/dist/docs/index.d.ts +1 -2
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +50 -19
- package/dist/docs/index.js.map +1 -1
- package/dist/{index-CBGSQVm9.d.ts → index-BLySW_2k.d.ts} +7 -5
- package/dist/index-BLySW_2k.d.ts.map +1 -0
- package/dist/{index-f2-VIfCo.d.cts → index-DPswv0Vt.d.cts} +7 -5
- package/dist/index-DPswv0Vt.d.cts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{lazy-B_E2X0KR.cjs → lazy-AGV9Pkt5.cjs} +40 -4
- package/dist/lazy-AGV9Pkt5.cjs.map +1 -0
- package/dist/{lazy-D6nL_iKJ.js → lazy-DiMJSDMB.js} +34 -4
- package/dist/lazy-DiMJSDMB.js.map +1 -0
- package/dist/prompt/clack/index.cjs +34 -0
- package/dist/prompt/clack/index.cjs.map +1 -0
- package/dist/prompt/clack/index.d.cts +18 -0
- package/dist/prompt/clack/index.d.cts.map +1 -0
- package/dist/prompt/clack/index.d.ts +18 -0
- package/dist/prompt/clack/index.d.ts.map +1 -0
- package/dist/prompt/clack/index.js +32 -0
- package/dist/prompt/clack/index.js.map +1 -0
- package/dist/prompt/index.cjs +7 -0
- package/dist/prompt/index.d.cts +108 -0
- package/dist/prompt/index.d.cts.map +1 -0
- package/dist/prompt/index.d.ts +108 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +3 -0
- package/dist/prompt/inquirer/index.cjs +49 -0
- package/dist/prompt/inquirer/index.cjs.map +1 -0
- package/dist/prompt/inquirer/index.d.cts +18 -0
- package/dist/prompt/inquirer/index.d.cts.map +1 -0
- package/dist/prompt/inquirer/index.d.ts +18 -0
- package/dist/prompt/inquirer/index.d.ts.map +1 -0
- package/dist/prompt/inquirer/index.js +47 -0
- package/dist/prompt/inquirer/index.js.map +1 -0
- package/dist/prompt-BKHqGrFw.js +172 -0
- package/dist/prompt-BKHqGrFw.js.map +1 -0
- package/dist/prompt-aXfSf27y.cjs +196 -0
- package/dist/prompt-aXfSf27y.cjs.map +1 -0
- package/dist/{runner-U86FIDHT.cjs → runner-CY5fOsSh.cjs} +90 -38
- package/dist/runner-CY5fOsSh.cjs.map +1 -0
- package/dist/{runner-Bx2S6_Id.js → runner-DSZw1AsW.js} +90 -38
- package/dist/runner-DSZw1AsW.js.map +1 -0
- package/dist/{subcommand-router-Bu3YTw_f.js → subcommand-router--EUt6ftA.js} +2 -2
- package/dist/{subcommand-router-Bu3YTw_f.js.map → subcommand-router--EUt6ftA.js.map} +1 -1
- package/dist/{subcommand-router-BTOzDQnY.cjs → subcommand-router-C9ONv6Nq.cjs} +2 -2
- package/dist/{subcommand-router-BTOzDQnY.cjs.map → subcommand-router-C9ONv6Nq.cjs.map} +1 -1
- package/package.json +53 -11
- package/dist/arg-registry-BlXeCM4p.d.cts.map +0 -1
- package/dist/arg-registry-D0MimRYf.d.ts.map +0 -1
- package/dist/completion-BADAzqT9.cjs.map +0 -1
- package/dist/completion-Dj7ytbLu.js.map +0 -1
- package/dist/index-CBGSQVm9.d.ts.map +0 -1
- package/dist/index-f2-VIfCo.d.cts.map +0 -1
- package/dist/lazy-B_E2X0KR.cjs.map +0 -1
- package/dist/lazy-D6nL_iKJ.js.map +0 -1
- package/dist/runner-Bx2S6_Id.js.map +0 -1
- package/dist/runner-U86FIDHT.cjs.map +0 -1
- package/dist/schema-extractor-CAZi3kK1.d.ts +0 -117
- package/dist/schema-extractor-CAZi3kK1.d.ts.map +0 -1
- package/dist/schema-extractor-D-eGlm4W.d.cts +0 -117
- package/dist/schema-extractor-D-eGlm4W.d.cts.map +0 -1
|
@@ -1,5 +1,128 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
+
//#region src/core/schema-extractor.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolved metadata for an argument field
|
|
6
|
+
*/
|
|
7
|
+
interface ResolvedFieldMeta {
|
|
8
|
+
/** Field name (camelCase, as defined in schema) */
|
|
9
|
+
name: string;
|
|
10
|
+
/** CLI option name (kebab-case, for command line usage) */
|
|
11
|
+
cliName: string;
|
|
12
|
+
/**
|
|
13
|
+
* Aliases for this option, normalized to an array.
|
|
14
|
+
* 1-char entries are short aliases (`-v`); multi-char entries are long
|
|
15
|
+
* aliases (`--to-be`).
|
|
16
|
+
*/
|
|
17
|
+
alias?: string[] | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Aliases that are accepted at parse time but hidden from help,
|
|
20
|
+
* generated docs, and shell completion.
|
|
21
|
+
*/
|
|
22
|
+
hiddenAlias?: string[] | undefined;
|
|
23
|
+
/** Argument description */
|
|
24
|
+
description?: string | undefined;
|
|
25
|
+
/** Whether this is a positional argument */
|
|
26
|
+
positional: boolean;
|
|
27
|
+
/** Placeholder for help display */
|
|
28
|
+
placeholder?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Environment variable name(s) to read value from.
|
|
31
|
+
* If an array, earlier entries take priority.
|
|
32
|
+
*/
|
|
33
|
+
env?: string | string[] | undefined;
|
|
34
|
+
/** Whether this argument is required */
|
|
35
|
+
required: boolean;
|
|
36
|
+
/** Default value if any */
|
|
37
|
+
defaultValue?: unknown;
|
|
38
|
+
/** Detected type from schema */
|
|
39
|
+
type: "string" | "number" | "boolean" | "array" | "unknown";
|
|
40
|
+
/** Original Zod schema */
|
|
41
|
+
schema: z.ZodType;
|
|
42
|
+
/** True if this overrides built-in aliases (-h, -H) */
|
|
43
|
+
overrideBuiltinAlias?: true;
|
|
44
|
+
/** Enum values if detected from schema (z.enum) */
|
|
45
|
+
enumValues?: string[] | undefined;
|
|
46
|
+
/** Completion metadata from arg() */
|
|
47
|
+
completion?: CompletionMeta | undefined;
|
|
48
|
+
/** Prompt metadata from arg() for interactive input */
|
|
49
|
+
prompt?: PromptMeta | undefined;
|
|
50
|
+
/** Side-effect callback from arg() metadata */
|
|
51
|
+
effect?: ((value: unknown, context: EffectContext) => void | PromiseLike<void>) | undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Extracted fields from a schema
|
|
55
|
+
*/
|
|
56
|
+
interface ExtractedFields {
|
|
57
|
+
/** All field definitions */
|
|
58
|
+
fields: ResolvedFieldMeta[];
|
|
59
|
+
/** Original schema for validation */
|
|
60
|
+
schema: ArgsSchema;
|
|
61
|
+
/** Schema type */
|
|
62
|
+
schemaType: "object" | "discriminatedUnion" | "union" | "xor" | "intersection";
|
|
63
|
+
/** Discriminator key (for discriminatedUnion) */
|
|
64
|
+
discriminator?: string;
|
|
65
|
+
/** Variants (for discriminatedUnion) */
|
|
66
|
+
variants?: Array<{
|
|
67
|
+
discriminatorValue: string;
|
|
68
|
+
fields: ResolvedFieldMeta[];
|
|
69
|
+
description?: string;
|
|
70
|
+
}>;
|
|
71
|
+
/** Options (for union) */
|
|
72
|
+
unionOptions?: ExtractedFields[];
|
|
73
|
+
/** Schema description */
|
|
74
|
+
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Unknown keys handling mode
|
|
77
|
+
* - "strict": Unknown keys cause validation errors (z.strictObject or z.object().strict())
|
|
78
|
+
* - "strip": Unknown keys trigger warnings (default, z.object())
|
|
79
|
+
* - "passthrough": Unknown keys are silently ignored (z.looseObject or z.object().passthrough())
|
|
80
|
+
*/
|
|
81
|
+
unknownKeysMode: UnknownKeysMode;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Unknown keys handling mode for object schemas
|
|
85
|
+
* - "strict": Unknown keys cause validation errors
|
|
86
|
+
* - "strip": Unknown keys are silently ignored (default)
|
|
87
|
+
* - "passthrough": Unknown keys are passed through
|
|
88
|
+
*/
|
|
89
|
+
type UnknownKeysMode = "strict" | "strip" | "passthrough";
|
|
90
|
+
/**
|
|
91
|
+
* Detect unknown keys handling mode from a Zod object schema
|
|
92
|
+
*
|
|
93
|
+
* In Zod v4:
|
|
94
|
+
* - Default (strip): _def.catchall is undefined
|
|
95
|
+
* - strict: _def.catchall is ZodNever (type = "never")
|
|
96
|
+
* - passthrough: _def.catchall is ZodUnknown (type = "unknown")
|
|
97
|
+
*/
|
|
98
|
+
declare function getUnknownKeysMode(schema: z.ZodType): UnknownKeysMode;
|
|
99
|
+
/**
|
|
100
|
+
* Convert camelCase to kebab-case
|
|
101
|
+
* @example toKebabCase("dryRun") => "dry-run"
|
|
102
|
+
* @example toKebabCase("outputDir") => "output-dir"
|
|
103
|
+
* @example toKebabCase("XMLParser") => "xml-parser"
|
|
104
|
+
*/
|
|
105
|
+
declare function toKebabCase(str: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* Convert hyphen-separated sequences to camelCase.
|
|
108
|
+
*
|
|
109
|
+
* Replaces `-x` (hyphen followed by a lowercase letter) with the uppercase
|
|
110
|
+
* variant. Non-hyphenated input (e.g., already camelCase) is returned as-is.
|
|
111
|
+
*
|
|
112
|
+
* @param str - A string that may contain hyphens
|
|
113
|
+
* @example toCamelCase("dry-run") => "dryRun"
|
|
114
|
+
* @example toCamelCase("output-dir") => "outputDir"
|
|
115
|
+
* @example toCamelCase("dryRun") => "dryRun"
|
|
116
|
+
*/
|
|
117
|
+
declare function toCamelCase(str: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* Extract all fields from a schema
|
|
120
|
+
*
|
|
121
|
+
* @param schema - The args schema (ZodObject, ZodDiscriminatedUnion, etc.)
|
|
122
|
+
* @returns Extracted field information
|
|
123
|
+
*/
|
|
124
|
+
declare function extractFields(schema: ArgsSchema): ExtractedFields;
|
|
125
|
+
//#endregion
|
|
3
126
|
//#region src/lazy.d.ts
|
|
4
127
|
/**
|
|
5
128
|
* A lazily-loaded command that carries synchronous metadata for
|
|
@@ -184,6 +307,12 @@ type SubCommandValue = AnyCommand | (() => Promise<AnyCommand>) | LazyCommand;
|
|
|
184
307
|
* Record of subcommands indexed by name
|
|
185
308
|
*/
|
|
186
309
|
type SubCommandsRecord = Record<string, SubCommandValue>;
|
|
310
|
+
/**
|
|
311
|
+
* Async callback to resolve missing argument values interactively.
|
|
312
|
+
* Called after env fallback, before Zod validation.
|
|
313
|
+
* Provided by adapter subpath modules (e.g. `politty/prompt/clack`).
|
|
314
|
+
*/
|
|
315
|
+
type PromptResolver = (rawArgs: Record<string, unknown>, extracted: ExtractedFields) => Promise<Record<string, unknown>>;
|
|
187
316
|
/**
|
|
188
317
|
* Options for runMain (CLI entry point)
|
|
189
318
|
*/
|
|
@@ -206,6 +335,8 @@ interface MainOptions {
|
|
|
206
335
|
cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
|
|
207
336
|
/** Whether to display errors to stderr before process.exit (default: true) */
|
|
208
337
|
displayErrors?: boolean;
|
|
338
|
+
/** Prompt resolver for interactive missing-arg prompts (e.g. from `politty/prompt/clack`). */
|
|
339
|
+
prompt?: PromptResolver | undefined;
|
|
209
340
|
}
|
|
210
341
|
/**
|
|
211
342
|
* Options for runCommand (programmatic/test usage)
|
|
@@ -225,6 +356,8 @@ interface RunCommandOptions {
|
|
|
225
356
|
setup?: ((context: GlobalSetupContext) => void | Promise<void>) | undefined;
|
|
226
357
|
/** Global cleanup hook (runs after command execution, always executes even on error) */
|
|
227
358
|
cleanup?: ((context: GlobalCleanupContext) => void | Promise<void>) | undefined;
|
|
359
|
+
/** Prompt resolver for interactive missing-arg prompts (e.g. from `politty/prompt/clack`). */
|
|
360
|
+
prompt?: PromptResolver | undefined;
|
|
228
361
|
}
|
|
229
362
|
/**
|
|
230
363
|
* Log level type
|
|
@@ -344,6 +477,52 @@ type CompletionMeta = {
|
|
|
344
477
|
/** Glob patterns for file matching (only applies when type is "file") */matcher?: string[];
|
|
345
478
|
extensions?: never;
|
|
346
479
|
});
|
|
480
|
+
/**
|
|
481
|
+
* Prompt input type for interactive prompts
|
|
482
|
+
*
|
|
483
|
+
* - "text": free-form text input (default for string schemas)
|
|
484
|
+
* - "password": masked text input
|
|
485
|
+
* - "confirm": yes/no prompt (default for boolean schemas)
|
|
486
|
+
* - "select": single selection from choices (default for enum schemas)
|
|
487
|
+
* - "file": file path input (inherited from completion type)
|
|
488
|
+
* - "directory": directory path input (inherited from completion type)
|
|
489
|
+
*/
|
|
490
|
+
type PromptType = "text" | "password" | "confirm" | "select" | "file" | "directory";
|
|
491
|
+
/**
|
|
492
|
+
* Prompt metadata for interactive input when a value is missing.
|
|
493
|
+
* Used by the `politty/prompt` module to request user input for unresolved arguments.
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* ```ts
|
|
497
|
+
* // Custom prompt message
|
|
498
|
+
* name: arg(z.string(), {
|
|
499
|
+
* prompt: { message: "What is your name?" }
|
|
500
|
+
* })
|
|
501
|
+
*
|
|
502
|
+
* // Password input (masked)
|
|
503
|
+
* token: arg(z.string(), {
|
|
504
|
+
* prompt: { type: "password", message: "Enter API token" }
|
|
505
|
+
* })
|
|
506
|
+
*
|
|
507
|
+
* // Select with custom choices
|
|
508
|
+
* region: arg(z.string(), {
|
|
509
|
+
* prompt: { choices: ["us-east-1", "eu-west-1", "ap-northeast-1"] }
|
|
510
|
+
* })
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
interface PromptMeta {
|
|
514
|
+
/** Prompt message shown to the user. Defaults to the field's description or name. */
|
|
515
|
+
message?: string;
|
|
516
|
+
/** Explicit prompt type. Overrides auto-detection from schema/completion. */
|
|
517
|
+
type?: PromptType;
|
|
518
|
+
/** Choices for select prompt. Overrides enum values from schema. */
|
|
519
|
+
choices?: Array<string | {
|
|
520
|
+
label: string;
|
|
521
|
+
value: string;
|
|
522
|
+
}>;
|
|
523
|
+
/** Whether to enable prompting for this field (default: true when prompt is set) */
|
|
524
|
+
enabled?: boolean;
|
|
525
|
+
}
|
|
347
526
|
/**
|
|
348
527
|
* Context provided to effect callbacks.
|
|
349
528
|
* When GlobalArgs is extended via declaration merging, `globalArgs` is typed accordingly.
|
|
@@ -383,6 +562,20 @@ interface BaseArgMeta<TValue = unknown> {
|
|
|
383
562
|
env?: string | string[];
|
|
384
563
|
/** Completion configuration for shell tab-completion */
|
|
385
564
|
completion?: CompletionMeta;
|
|
565
|
+
/**
|
|
566
|
+
* Interactive prompt configuration for missing values.
|
|
567
|
+
* When set, the `politty/prompt` module will prompt the user interactively
|
|
568
|
+
* if this argument is not provided via CLI args or environment variables.
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* ```ts
|
|
572
|
+
* name: arg(z.string(), {
|
|
573
|
+
* description: "User name",
|
|
574
|
+
* prompt: { message: "What is your name?" },
|
|
575
|
+
* })
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
prompt?: PromptMeta;
|
|
386
579
|
/**
|
|
387
580
|
* Side-effect callback executed after argument parsing and validation.
|
|
388
581
|
* Runs before the command lifecycle (setup/run/cleanup).
|
|
@@ -402,17 +595,34 @@ interface BaseArgMeta<TValue = unknown> {
|
|
|
402
595
|
}
|
|
403
596
|
/**
|
|
404
597
|
* Metadata for regular arguments (non-builtin aliases)
|
|
598
|
+
*
|
|
599
|
+
* `alias` accepts either a single string or an array of strings.
|
|
600
|
+
* Single-character entries become short options (e.g. `-v`); multi-character
|
|
601
|
+
* entries become additional long options (e.g. `--to-be` for `--tobe`).
|
|
405
602
|
*/
|
|
406
603
|
interface RegularArgMeta<TValue = unknown> extends BaseArgMeta<TValue> {
|
|
407
|
-
/**
|
|
408
|
-
|
|
604
|
+
/**
|
|
605
|
+
* Alias name(s) for this option.
|
|
606
|
+
* - 1-char string → short alias (`-v`)
|
|
607
|
+
* - >1-char string → long alias (`--long-name`)
|
|
608
|
+
* - array → multiple aliases of either kind
|
|
609
|
+
*/
|
|
610
|
+
alias?: string | string[] | readonly string[];
|
|
611
|
+
/**
|
|
612
|
+
* Alias name(s) that are accepted by the parser but hidden from help,
|
|
613
|
+
* generated docs, and shell completion. Useful for legacy or deprecated
|
|
614
|
+
* names that should still work without being advertised.
|
|
615
|
+
*/
|
|
616
|
+
hiddenAlias?: string | string[] | readonly string[];
|
|
409
617
|
}
|
|
410
618
|
/**
|
|
411
619
|
* Metadata for overriding built-in aliases (-h, -H)
|
|
412
620
|
*/
|
|
413
621
|
interface BuiltinOverrideArgMeta<TValue = unknown> extends BaseArgMeta<TValue> {
|
|
414
|
-
/** Built-in alias to override ('h' or 'H') */
|
|
415
|
-
alias: "h" | "H"
|
|
622
|
+
/** Built-in alias to override ('h' or 'H'), optionally combined with extra aliases */
|
|
623
|
+
alias: "h" | "H" | Array<"h" | "H" | string> | ReadonlyArray<"h" | "H" | string>;
|
|
624
|
+
/** Hidden aliases (accepted but not surfaced in help/docs/completion) */
|
|
625
|
+
hiddenAlias?: string | string[] | readonly string[];
|
|
416
626
|
/** Must be true to override built-in aliases */
|
|
417
627
|
overrideBuiltinAlias: true;
|
|
418
628
|
}
|
|
@@ -444,18 +654,31 @@ type ArgMeta<TValue = unknown> = RegularArgMeta<TValue> | BuiltinOverrideArgMeta
|
|
|
444
654
|
* ```
|
|
445
655
|
*/
|
|
446
656
|
/**
|
|
447
|
-
*
|
|
448
|
-
*
|
|
657
|
+
* Detect whether `A` contains a reserved alias ("h" or "H"), for either a
|
|
658
|
+
* plain string or a tuple/array of strings. Uses `[A] extends [never]` to
|
|
659
|
+
* prevent distribution returning `never` for missing fields.
|
|
660
|
+
*/
|
|
661
|
+
type ContainsReservedAlias<A> = [A] extends [never] ? false : A extends "h" | "H" ? true : A extends readonly (infer E)[] ? [Extract<E, "h" | "H">] extends [never] ? false : true : false;
|
|
662
|
+
type ReservedAliasTypeError<M> = { [K in keyof M]: M[K] } & {
|
|
663
|
+
__typeError: "Alias 'h' or 'H' requires overrideBuiltinAlias: true";
|
|
664
|
+
};
|
|
665
|
+
type AliasFieldOf<M> = M extends {
|
|
666
|
+
alias: infer A;
|
|
667
|
+
} ? A : never;
|
|
668
|
+
type HiddenAliasFieldOf<M> = M extends {
|
|
669
|
+
hiddenAlias: infer H;
|
|
670
|
+
} ? H : never;
|
|
671
|
+
/**
|
|
672
|
+
* Type helper to validate ArgMeta.
|
|
673
|
+
* Forces a type error when a reserved alias ("h" / "H") is used without
|
|
674
|
+
* `overrideBuiltinAlias: true`, whether the alias is provided as a string
|
|
675
|
+
* or as part of an array, and whether it appears in `alias` or `hiddenAlias`.
|
|
449
676
|
*/
|
|
450
677
|
type ValidateArgMeta<M> = M extends {
|
|
451
|
-
alias: "h" | "H";
|
|
452
|
-
} ? M extends {
|
|
453
678
|
overrideBuiltinAlias: true;
|
|
454
|
-
} ? M :
|
|
455
|
-
__typeError: "Alias 'h' or 'H' requires overrideBuiltinAlias: true";
|
|
456
|
-
} : M;
|
|
679
|
+
} ? M : ContainsReservedAlias<AliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ContainsReservedAlias<HiddenAliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : M;
|
|
457
680
|
declare function arg<T extends z.ZodType>(schema: T): T;
|
|
458
681
|
declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M>): T;
|
|
459
682
|
//#endregion
|
|
460
|
-
export {
|
|
461
|
-
//# sourceMappingURL=arg-registry-
|
|
683
|
+
export { RunResultSuccess as A, UnknownKeysMode as B, Logger as C, RunCommandOptions as D, PromptResolver as E, LazyCommand as F, getUnknownKeysMode as H, isLazyCommand as I, lazy as L, SetupContext as M, SubCommandValue as N, RunResult as O, SubCommandsRecord as P, ExtractedFields as R, LogStream as S, NonRunnableCommand as T, toCamelCase as U, extractFields as V, toKebabCase as W, GlobalCleanupContext as _, EffectContext as a, LogEntry as b, arg as c, CleanupContext as d, CollectedLogs as f, GlobalArgs as g, Example as h, CustomCompletion as i, RunnableCommand as j, RunResultFailure as k, AnyCommand as l, CommandBase as m, CompletionMeta as n, PromptMeta as o, Command as p, CompletionType as r, PromptType as s, ArgMeta as t, ArgsSchema as u, GlobalSetupContext as v, MainOptions as w, LogLevel as x, IsEmpty as y, ResolvedFieldMeta as z };
|
|
684
|
+
//# sourceMappingURL=arg-registry-r5wYN6qd.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg-registry-r5wYN6qd.d.cts","names":[],"sources":["../src/core/schema-extractor.ts","../src/lazy.ts","../src/types.ts","../src/core/arg-registry.ts"],"mappings":";;;AAwCA;;;AAAA,UAAiB,iBAAA;EAwCF;EAtCb,IAAA;EA0CoC;EAxCpC,OAAA;EAwCwE;;;;;EAlCxE,KAAA;EAOA;;;;EAFA,WAAA;EAeA;EAbA,WAAA;EAiBA;EAfA,UAAA;EAeU;EAbV,WAAA;EAiBA;;;;EAZA,GAAA;EAkBA;EAhBA,QAAA;EAgBoC;EAdpC,YAAA;EA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CAAO,CAAA,GAAA,CAClE,MAAA,EAAQ,CAAA,EACR,IAAA,EAAM,eAAA,CAAgB,CAAA,IACrB,CAAA"}
|
package/dist/augment.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ArgMeta } from "./arg-registry-
|
|
1
|
+
import { t as ArgMeta } from "./arg-registry-r5wYN6qd.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/augment.d.ts
|
|
4
4
|
declare module "zod" {
|
|
@@ -9,7 +9,8 @@ declare module "zod" {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
positional?: boolean;
|
|
11
11
|
placeholder?: string;
|
|
12
|
-
alias?: string;
|
|
12
|
+
alias?: string | string[] | readonly string[];
|
|
13
|
+
hiddenAlias?: string | string[] | readonly string[];
|
|
13
14
|
overrideBuiltinAlias?: boolean;
|
|
14
15
|
}
|
|
15
16
|
}
|
package/dist/augment.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment.d.cts","names":[],"sources":["../src/augment.ts"],"mappings":";;;;YAiBY,UAAA;IACR,OAAA,GAAU,OAAA;EAAA;EAAA,UAGF,UAAA;IACR,WAAA;IACA,UAAA;IACA,WAAA;IACA,KAAA;IACA,oBAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"augment.d.cts","names":[],"sources":["../src/augment.ts"],"mappings":";;;;YAiBY,UAAA;IACR,OAAA,GAAU,OAAA;EAAA;EAAA,UAGF,UAAA;IACR,WAAA;IACA,UAAA;IACA,WAAA;IACA,KAAA;IACA,WAAA;IACA,oBAAA;EAAA;AAAA"}
|
package/dist/augment.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ArgMeta } from "./arg-registry-
|
|
1
|
+
import { t as ArgMeta } from "./arg-registry-CkPDokIu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/augment.d.ts
|
|
4
4
|
declare module "zod" {
|
|
@@ -9,7 +9,8 @@ declare module "zod" {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
positional?: boolean;
|
|
11
11
|
placeholder?: string;
|
|
12
|
-
alias?: string;
|
|
12
|
+
alias?: string | string[] | readonly string[];
|
|
13
|
+
hiddenAlias?: string | string[] | readonly string[];
|
|
13
14
|
overrideBuiltinAlias?: boolean;
|
|
14
15
|
}
|
|
15
16
|
}
|
package/dist/augment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment.d.ts","names":[],"sources":["../src/augment.ts"],"mappings":";;;;YAiBY,UAAA;IACR,OAAA,GAAU,OAAA;EAAA;EAAA,UAGF,UAAA;IACR,WAAA;IACA,UAAA;IACA,WAAA;IACA,KAAA;IACA,oBAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"augment.d.ts","names":[],"sources":["../src/augment.ts"],"mappings":";;;;YAiBY,UAAA;IACR,OAAA,GAAU,OAAA;EAAA;EAAA,UAGF,UAAA;IACR,WAAA;IACA,UAAA;IACA,WAAA;IACA,KAAA;IACA,WAAA;IACA,oBAAA;EAAA;AAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('../
|
|
3
|
-
const require_completion = require('../completion-BADAzqT9.cjs');
|
|
2
|
+
const require_completion = require('../completion-CAekGYS4.cjs');
|
|
4
3
|
|
|
5
4
|
exports.CompletionDirective = require_completion.CompletionDirective;
|
|
6
5
|
exports.createCompletionCommand = require_completion.createCompletionCommand;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-
|
|
1
|
+
import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-DPswv0Vt.cjs";
|
|
2
2
|
export { CandidateResult, CompletableOption, CompletableSubcommand, CompletionCandidate, CompletionContext, CompletionData, CompletionDirective, CompletionGenerator, CompletionOptions, CompletionResult, CompletionType, ShellFormatOptions, ShellType, ValueCompletionField, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-
|
|
1
|
+
import { C as CompletableSubcommand, D as CompletionResult, E as CompletionOptions, O as ShellType, S as CompletableOption, T as CompletionGenerator, _ as CompletionDirective, a as getSupportedShells, b as CompletionType, c as resolveValueCompletion, d as ShellFormatOptions, f as formatForShell, g as CompletionCandidate, h as CandidateResult, i as generateCompletion, l as extractCompletionData, m as hasCompleteCommand, n as createCompletionCommand, o as withCompletionCommand, p as createDynamicCompleteCommand, r as detectShell, s as ValueCompletionField, t as WithCompletionOptions, u as extractPositionals, v as generateCandidates, w as CompletionData, x as parseCompletionContext, y as CompletionContext } from "../index-BLySW_2k.js";
|
|
2
2
|
export { CandidateResult, CompletableOption, CompletableSubcommand, CompletionCandidate, CompletionContext, CompletionData, CompletionDirective, CompletionGenerator, CompletionOptions, CompletionResult, CompletionType, ShellFormatOptions, ShellType, ValueCompletionField, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|
package/dist/completion/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { a as withCompletionCommand, c as formatForShell, d as generateCandidates, f as extractCompletionData, i as getSupportedShells, l as parseCompletionContext, m as resolveValueCompletion, n as detectShell, o as createDynamicCompleteCommand, p as extractPositionals, r as generateCompletion, s as hasCompleteCommand, t as createCompletionCommand, u as CompletionDirective } from "../completion-Dj7ytbLu.js";
|
|
1
|
+
import { a as withCompletionCommand, c as formatForShell, d as generateCandidates, f as extractCompletionData, i as getSupportedShells, l as parseCompletionContext, m as resolveValueCompletion, n as detectShell, o as createDynamicCompleteCommand, p as extractPositionals, r as generateCompletion, s as hasCompleteCommand, t as createCompletionCommand, u as CompletionDirective } from "../completion-yHz8Pdr7.js";
|
|
3
2
|
|
|
4
3
|
export { CompletionDirective, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_subcommand_router = require('./subcommand-router-
|
|
2
|
-
const require_lazy = require('./lazy-
|
|
1
|
+
const require_subcommand_router = require('./subcommand-router-C9ONv6Nq.cjs');
|
|
2
|
+
const require_lazy = require('./lazy-AGV9Pkt5.cjs');
|
|
3
3
|
let zod = require("zod");
|
|
4
4
|
let node_child_process = require("node:child_process");
|
|
5
5
|
|
|
@@ -192,7 +192,7 @@ function optTakesValueEntries(sub, parentPath) {
|
|
|
192
192
|
const lines = [];
|
|
193
193
|
for (const opt of sub.options) if (opt.takesValue) {
|
|
194
194
|
const patterns = [`${parentPath}:--${opt.cliName}`];
|
|
195
|
-
if (opt.alias) patterns.push(`${parentPath}
|
|
195
|
+
if (opt.alias) for (const a of opt.alias) patterns.push(`${parentPath}:${a.length === 1 ? `-${a}` : `--${a}`}`);
|
|
196
196
|
lines.push(` ${patterns.join("|")}) return 0 ;;`);
|
|
197
197
|
}
|
|
198
198
|
for (const child of getVisibleSubs(sub.subcommands)) lines.push(...optTakesValueEntries(child, joinPrefix(parentPath, child.name, ":")));
|
|
@@ -332,7 +332,7 @@ function optionValueCases$2(options, inline) {
|
|
|
332
332
|
const valLines = bashValueLines(opt.valueCompletion, inline);
|
|
333
333
|
if (valLines.length === 0) continue;
|
|
334
334
|
const patterns = [`--${opt.cliName}`];
|
|
335
|
-
if (opt.alias) patterns.push(`-${
|
|
335
|
+
if (opt.alias) for (const a of opt.alias) patterns.push(a.length === 1 ? `-${a}` : `--${a}`);
|
|
336
336
|
const patternStr = patterns.join("|");
|
|
337
337
|
lines.push(` ${patternStr})`);
|
|
338
338
|
for (const vl of valLines) lines.push(` ${vl}`);
|
|
@@ -382,7 +382,7 @@ function availableOptionLines$2(options, fn) {
|
|
|
382
382
|
for (const opt of options) if (opt.valueType === "array") lines.push(` _avail+=(--${opt.cliName})`);
|
|
383
383
|
else {
|
|
384
384
|
const patterns = [`"--${opt.cliName}"`];
|
|
385
|
-
if (opt.alias) patterns.push(`"-${
|
|
385
|
+
if (opt.alias) for (const a of opt.alias) patterns.push(a.length === 1 ? `"-${a}"` : `"--${a}"`);
|
|
386
386
|
lines.push(` __${fn}_not_used ${patterns.join(" ")} && _avail+=(--${opt.cliName})`);
|
|
387
387
|
}
|
|
388
388
|
lines.push(` __${fn}_not_used "--help" && _avail+=(--help)`);
|
|
@@ -693,7 +693,9 @@ function generateOptionNameCandidates(context) {
|
|
|
693
693
|
const directive = CompletionDirective.FilterPrefix;
|
|
694
694
|
const availableOptions = context.options.filter((opt) => {
|
|
695
695
|
if (opt.valueType === "array") return true;
|
|
696
|
-
|
|
696
|
+
if (context.usedOptions.has(opt.cliName)) return false;
|
|
697
|
+
if (opt.alias && opt.alias.some((a) => context.usedOptions.has(a))) return false;
|
|
698
|
+
return true;
|
|
697
699
|
});
|
|
698
700
|
for (const opt of availableOptions) candidates.push({
|
|
699
701
|
value: `--${opt.cliName}`,
|
|
@@ -831,7 +833,15 @@ function hasInlineValue(word) {
|
|
|
831
833
|
* Find option by name or alias
|
|
832
834
|
*/
|
|
833
835
|
function findOption(options, nameOrAlias) {
|
|
834
|
-
return options.find((opt) =>
|
|
836
|
+
return options.find((opt) => {
|
|
837
|
+
if (opt.cliName === nameOrAlias) return true;
|
|
838
|
+
if (opt.alias?.includes(nameOrAlias)) return true;
|
|
839
|
+
if (nameOrAlias.length > 1) {
|
|
840
|
+
if (opt.cliName.includes("-") && require_lazy.toCamelCase(opt.cliName) === nameOrAlias) return true;
|
|
841
|
+
if (opt.alias?.some((a) => a.includes("-") && require_lazy.toCamelCase(a) === nameOrAlias)) return true;
|
|
842
|
+
}
|
|
843
|
+
return false;
|
|
844
|
+
});
|
|
835
845
|
}
|
|
836
846
|
/**
|
|
837
847
|
* Parse completion context from command line arguments
|
|
@@ -860,7 +870,7 @@ function parseCompletionContext(argv, rootCommand) {
|
|
|
860
870
|
const opt = findOption(options, optName);
|
|
861
871
|
if (opt) {
|
|
862
872
|
usedOptions.add(opt.cliName);
|
|
863
|
-
if (opt.alias)
|
|
873
|
+
if (opt.alias) for (const a of opt.alias) usedOptions.add(a);
|
|
864
874
|
if (opt.takesValue && !hasInlineValue(word)) i++;
|
|
865
875
|
}
|
|
866
876
|
i++;
|
|
@@ -1150,7 +1160,7 @@ function optionValueCases$1(options) {
|
|
|
1150
1160
|
const valLines = fishValueLines(opt.valueCompletion);
|
|
1151
1161
|
if (valLines.length === 0) continue;
|
|
1152
1162
|
const conditions = [`test "$_prev" = "--${opt.cliName}"`];
|
|
1153
|
-
if (opt.alias) conditions.push(`test "$_prev" = "
|
|
1163
|
+
if (opt.alias) for (const a of opt.alias) conditions.push(`test "$_prev" = "${a.length === 1 ? `-${a}` : `--${a}`}"`);
|
|
1154
1164
|
const cond = conditions.join("; or ");
|
|
1155
1165
|
lines.push(` if ${cond}`);
|
|
1156
1166
|
for (const vl of valLines) lines.push(` ${vl}`);
|
|
@@ -1182,7 +1192,7 @@ function availableOptionLines$1(options, fn) {
|
|
|
1182
1192
|
if (opt.valueType === "array") lines.push(` echo "--${opt.cliName}\t${desc}"`);
|
|
1183
1193
|
else {
|
|
1184
1194
|
const checks = [`"--${opt.cliName}"`];
|
|
1185
|
-
if (opt.alias) checks.push(`"-${
|
|
1195
|
+
if (opt.alias) for (const a of opt.alias) checks.push(a.length === 1 ? `"-${a}"` : `"--${a}"`);
|
|
1186
1196
|
lines.push(` __${fn}_not_used ${checks.join(" ")}; and echo "--${opt.cliName}\t${desc}"`);
|
|
1187
1197
|
}
|
|
1188
1198
|
}
|
|
@@ -1232,7 +1242,7 @@ function optTakesValueCases(sub, parentPath) {
|
|
|
1232
1242
|
const lines = [];
|
|
1233
1243
|
for (const opt of sub.options) if (opt.takesValue) {
|
|
1234
1244
|
const patterns = [`"${parentPath}:--${opt.cliName}"`];
|
|
1235
|
-
if (opt.alias) patterns.push(`"${parentPath}
|
|
1245
|
+
if (opt.alias) for (const a of opt.alias) patterns.push(`"${parentPath}:${a.length === 1 ? `-${a}` : `--${a}`}"`);
|
|
1236
1246
|
lines.push(` case ${patterns.join(" ")}`);
|
|
1237
1247
|
lines.push(` return 0`);
|
|
1238
1248
|
}
|
|
@@ -1407,7 +1417,7 @@ function optionValueCases(options, fn) {
|
|
|
1407
1417
|
const valLines = zshValueLines(opt.valueCompletion, fn);
|
|
1408
1418
|
if (valLines.length === 0) continue;
|
|
1409
1419
|
const patterns = [`--${opt.cliName}`];
|
|
1410
|
-
if (opt.alias) patterns.push(`-${
|
|
1420
|
+
if (opt.alias) for (const a of opt.alias) patterns.push(a.length === 1 ? `-${a}` : `--${a}`);
|
|
1411
1421
|
lines.push(` ${patterns.join("|")})`);
|
|
1412
1422
|
for (const vl of valLines) lines.push(` ${vl}`);
|
|
1413
1423
|
lines.push(` return 0 ;;`);
|
|
@@ -1448,7 +1458,7 @@ function availableOptionLines(options, fn) {
|
|
|
1448
1458
|
if (opt.valueType === "array") lines.push(` _opts+=("--${opt.cliName}${desc}")`);
|
|
1449
1459
|
else {
|
|
1450
1460
|
const patterns = [`"--${opt.cliName}"`];
|
|
1451
|
-
if (opt.alias) patterns.push(`"-${
|
|
1461
|
+
if (opt.alias) for (const a of opt.alias) patterns.push(a.length === 1 ? `"-${a}"` : `"--${a}"`);
|
|
1452
1462
|
lines.push(` __${fn}_not_used ${patterns.join(" ")} && _opts+=("--${opt.cliName}${desc}")`);
|
|
1453
1463
|
}
|
|
1454
1464
|
}
|
|
@@ -1872,4 +1882,4 @@ Object.defineProperty(exports, 'withCompletionCommand', {
|
|
|
1872
1882
|
return withCompletionCommand;
|
|
1873
1883
|
}
|
|
1874
1884
|
});
|
|
1875
|
-
//# sourceMappingURL=completion-
|
|
1885
|
+
//# sourceMappingURL=completion-CAekGYS4.cjs.map
|