politty 0.4.14 → 0.4.16
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 +7 -1
- package/dist/{arg-registry-CkPDokIu.d.ts → arg-registry-Cd6xnjHa.d.ts} +118 -4
- package/dist/arg-registry-Cd6xnjHa.d.ts.map +1 -0
- package/dist/{arg-registry-r5wYN6qd.d.cts → arg-registry-MVWOAcvw.d.cts} +118 -4
- package/dist/arg-registry-MVWOAcvw.d.cts.map +1 -0
- package/dist/augment.d.cts +1 -1
- package/dist/augment.d.cts.map +1 -1
- package/dist/augment.d.ts +1 -1
- package/dist/augment.d.ts.map +1 -1
- package/dist/completion/index.cjs +2 -1
- package/dist/completion/index.d.cts +2 -2
- package/dist/completion/index.d.ts +2 -2
- package/dist/completion/index.js +2 -2
- package/dist/{completion-yHz8Pdr7.js → completion-B04iiki9.js} +580 -31
- package/dist/completion-B04iiki9.js.map +1 -0
- package/dist/{completion-CAekGYS4.cjs → completion-BlZxMSeU.cjs} +598 -43
- package/dist/completion-BlZxMSeU.cjs.map +1 -0
- package/dist/docs/index.cjs +121 -65
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +5 -1
- package/dist/docs/index.d.cts.map +1 -1
- package/dist/docs/index.d.ts +5 -1
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +124 -67
- package/dist/docs/index.js.map +1 -1
- package/dist/{index-DPswv0Vt.d.cts → index-CPebddth.d.cts} +58 -4
- package/dist/index-CPebddth.d.cts.map +1 -0
- package/dist/{index-BLySW_2k.d.ts → index-DR9HLxIP.d.ts} +58 -4
- package/dist/index-DR9HLxIP.d.ts.map +1 -0
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +39 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +39 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{subcommand-router-C9ONv6Nq.cjs → log-collector-Cd2_mv87.cjs} +1 -59
- package/dist/log-collector-Cd2_mv87.cjs.map +1 -0
- package/dist/{subcommand-router--EUt6ftA.js → log-collector-Cu6MCtAx.js} +2 -43
- package/dist/log-collector-Cu6MCtAx.js.map +1 -0
- package/dist/prompt/clack/index.cjs +1 -1
- package/dist/prompt/clack/index.cjs.map +1 -1
- package/dist/prompt/clack/index.d.cts +1 -1
- package/dist/prompt/clack/index.d.cts.map +1 -1
- package/dist/prompt/clack/index.d.ts +1 -1
- package/dist/prompt/clack/index.d.ts.map +1 -1
- package/dist/prompt/clack/index.js.map +1 -1
- package/dist/prompt/index.d.cts +1 -1
- package/dist/prompt/index.d.cts.map +1 -1
- package/dist/prompt/index.d.ts +1 -1
- package/dist/prompt/index.d.ts.map +1 -1
- package/dist/prompt/inquirer/index.cjs +1 -1
- package/dist/prompt/inquirer/index.cjs.map +1 -1
- package/dist/prompt/inquirer/index.d.cts +1 -1
- package/dist/prompt/inquirer/index.d.cts.map +1 -1
- package/dist/prompt/inquirer/index.d.ts +1 -1
- package/dist/prompt/inquirer/index.d.ts.map +1 -1
- package/dist/prompt/inquirer/index.js.map +1 -1
- package/dist/prompt-BKHqGrFw.js.map +1 -1
- package/dist/prompt-aXfSf27y.cjs.map +1 -1
- package/dist/{runner-DSZw1AsW.js → runner-BHeCMEa5.js} +383 -57
- package/dist/runner-BHeCMEa5.js.map +1 -0
- package/dist/{runner-CY5fOsSh.cjs → runner-BcyR6Z8r.cjs} +434 -96
- package/dist/runner-BcyR6Z8r.cjs.map +1 -0
- package/dist/{lazy-AGV9Pkt5.cjs → subcommand-router-DQy0KZU-.cjs} +148 -4
- package/dist/subcommand-router-DQy0KZU-.cjs.map +1 -0
- package/dist/{lazy-DiMJSDMB.js → subcommand-router-XZBWe8HN.js} +118 -4
- package/dist/subcommand-router-XZBWe8HN.js.map +1 -0
- package/package.json +16 -16
- package/dist/arg-registry-CkPDokIu.d.ts.map +0 -1
- package/dist/arg-registry-r5wYN6qd.d.cts.map +0 -1
- package/dist/completion-CAekGYS4.cjs.map +0 -1
- package/dist/completion-yHz8Pdr7.js.map +0 -1
- package/dist/index-BLySW_2k.d.ts.map +0 -1
- package/dist/index-DPswv0Vt.d.cts.map +0 -1
- package/dist/lazy-AGV9Pkt5.cjs.map +0 -1
- package/dist/lazy-DiMJSDMB.js.map +0 -1
- package/dist/runner-CY5fOsSh.cjs.map +0 -1
- package/dist/runner-DSZw1AsW.js.map +0 -1
- package/dist/subcommand-router--EUt6ftA.js.map +0 -1
- package/dist/subcommand-router-C9ONv6Nq.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ From simple scripts to complex CLI tools with subcommands, validation, and auto-
|
|
|
9
9
|
- **Zod Native**: Use Zod schemas directly for argument definition and validation
|
|
10
10
|
- **Type Safety**: Full TypeScript support with automatic type inference for parsed arguments
|
|
11
11
|
- **Flexible Argument Definition**: Support for positional arguments, flags, aliases, arrays, and environment variable fallbacks
|
|
12
|
-
- **Subcommands**: Build Git-style nested subcommands (with lazy loading support)
|
|
12
|
+
- **Subcommands**: Build Git-style nested subcommands (with lazy loading and alias support)
|
|
13
13
|
- **Lifecycle Management**: Guaranteed `setup` → `run` → `cleanup` execution order
|
|
14
14
|
- **Signal Handling**: Proper SIGINT/SIGTERM handling with guaranteed cleanup execution
|
|
15
15
|
- **Auto Help Generation**: Automatically generate help text from definitions
|
|
@@ -149,6 +149,7 @@ import { arg, defineCommand, runMain } from "politty";
|
|
|
149
149
|
const initCommand = defineCommand({
|
|
150
150
|
name: "init",
|
|
151
151
|
description: "Initialize a project",
|
|
152
|
+
aliases: ["i"],
|
|
152
153
|
args: z.object({
|
|
153
154
|
template: arg(z.string().default("default"), {
|
|
154
155
|
alias: "t",
|
|
@@ -163,6 +164,7 @@ const initCommand = defineCommand({
|
|
|
163
164
|
const buildCommand = defineCommand({
|
|
164
165
|
name: "build",
|
|
165
166
|
description: "Build the project",
|
|
167
|
+
aliases: ["b"],
|
|
166
168
|
args: z.object({
|
|
167
169
|
output: arg(z.string().default("dist"), {
|
|
168
170
|
alias: "o",
|
|
@@ -194,7 +196,9 @@ Example usage:
|
|
|
194
196
|
|
|
195
197
|
```bash
|
|
196
198
|
$ my-cli init -t react
|
|
199
|
+
$ my-cli i -t react # alias for init
|
|
197
200
|
$ my-cli build -o out -m
|
|
201
|
+
$ my-cli b -o out -m # alias for build
|
|
198
202
|
$ my-cli --help
|
|
199
203
|
```
|
|
200
204
|
|
|
@@ -246,6 +250,7 @@ Define a command.
|
|
|
246
250
|
| `name` | `string` | Command name |
|
|
247
251
|
| `description` | `string?` | Command description |
|
|
248
252
|
| `args` | `ZodSchema` | Argument schema |
|
|
253
|
+
| `aliases` | `string[]?` | Command aliases |
|
|
249
254
|
| `subCommands` | `Record<string, Command>?` | Subcommands |
|
|
250
255
|
| `setup` | `(context) => Promise<void>?` | Setup hook |
|
|
251
256
|
| `run` | `(args) => T?` | Run function |
|
|
@@ -393,6 +398,7 @@ The `playground/` directory contains many examples:
|
|
|
393
398
|
- `10-subcommands` - Subcommands
|
|
394
399
|
- `12-discriminated-union` - Discriminated Union
|
|
395
400
|
- `21-lazy-subcommands` - Lazy loading
|
|
401
|
+
- `26-command-alias` - Command aliases
|
|
396
402
|
|
|
397
403
|
## License
|
|
398
404
|
|
|
@@ -47,6 +47,30 @@ interface ResolvedFieldMeta {
|
|
|
47
47
|
completion?: CompletionMeta | undefined;
|
|
48
48
|
/** Prompt metadata from arg() for interactive input */
|
|
49
49
|
prompt?: PromptMeta | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Negation configuration for this boolean field.
|
|
52
|
+
*
|
|
53
|
+
* - String (e.g. `"disable-cache"`): the default `--no-<cliName>` form is
|
|
54
|
+
* suppressed and only `--<negation>` (plus its camelCase variant) is
|
|
55
|
+
* accepted as the negation flag.
|
|
56
|
+
* - `true`: the default `--no-<cliName>` form is accepted **and** shown in
|
|
57
|
+
* help, generated docs, and shell completions.
|
|
58
|
+
* - `false`: neither the default `--no-<cliName>` nor any custom name is
|
|
59
|
+
* accepted; the field only responds to the positive flag.
|
|
60
|
+
* - `undefined`: the default `--no-<cliName>` is accepted by the parser
|
|
61
|
+
* but hidden from help/docs/completions.
|
|
62
|
+
*
|
|
63
|
+
* Only applies to boolean fields; populated as `undefined` otherwise.
|
|
64
|
+
*/
|
|
65
|
+
negation?: string | boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Derived display name (no `--` prefix) for the negation flag in help,
|
|
68
|
+
* generated docs, and shell completions. `undefined` means the negation
|
|
69
|
+
* is hidden from those surfaces. Computed from `negation` + `cliName`.
|
|
70
|
+
*/
|
|
71
|
+
negationDisplay?: string | undefined;
|
|
72
|
+
/** Description shown for the negation option in help/docs. */
|
|
73
|
+
negationDescription?: string | undefined;
|
|
50
74
|
/** Side-effect callback from arg() metadata */
|
|
51
75
|
effect?: ((value: unknown, context: EffectContext) => void | PromiseLike<void>) | undefined;
|
|
52
76
|
}
|
|
@@ -246,6 +270,8 @@ interface CommandBase<TArgsSchema extends ArgsSchema | undefined = undefined, TA
|
|
|
246
270
|
name: string;
|
|
247
271
|
/** Command description */
|
|
248
272
|
description?: string | undefined;
|
|
273
|
+
/** Alternative names for this command (used as subcommand aliases) */
|
|
274
|
+
aliases?: string[] | undefined;
|
|
249
275
|
/** Argument schema (preserves the original Zod schema type) */
|
|
250
276
|
args: TArgsSchema;
|
|
251
277
|
/** Subcommands */
|
|
@@ -258,6 +284,13 @@ interface CommandBase<TArgsSchema extends ArgsSchema | undefined = undefined, TA
|
|
|
258
284
|
notes?: string | undefined;
|
|
259
285
|
/** Example usages for this command */
|
|
260
286
|
examples?: Example[] | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
* Hook invoked once at the top of `runMain`, before any parsing. Used
|
|
290
|
+
* by `withCompletionCommand` to fire its detached background-refresh
|
|
291
|
+
* spawn. Best-effort; never throws.
|
|
292
|
+
*/
|
|
293
|
+
runMainHook?: ((argv: readonly string[]) => void) | undefined;
|
|
261
294
|
}
|
|
262
295
|
/**
|
|
263
296
|
* A command with a run function
|
|
@@ -576,6 +609,58 @@ interface BaseArgMeta<TValue = unknown> {
|
|
|
576
609
|
* ```
|
|
577
610
|
*/
|
|
578
611
|
prompt?: PromptMeta;
|
|
612
|
+
/**
|
|
613
|
+
* Control the boolean negation option.
|
|
614
|
+
*
|
|
615
|
+
* Boolean fields automatically accept `--no-<cliName>` (and the camelCase
|
|
616
|
+
* `--no<Name>` form) to set the value to `false`. By default this form is
|
|
617
|
+
* accepted by the parser but hidden from help, generated docs, and shell
|
|
618
|
+
* completions. This option lets you customize or expose that behavior:
|
|
619
|
+
*
|
|
620
|
+
* - `string` — replaces the auto-generated `--no-*` form with a custom
|
|
621
|
+
* name. The default `--no-*` is no longer recognized.
|
|
622
|
+
* - `true` — opt-in to advertising the default `--no-<cliName>` form in
|
|
623
|
+
* help, generated docs, and shell completions. Parser behavior is
|
|
624
|
+
* unchanged.
|
|
625
|
+
* - `false` — disables negation entirely; neither the default `--no-*`
|
|
626
|
+
* nor any custom name is accepted.
|
|
627
|
+
*
|
|
628
|
+
* String values follow the same naming conventions as `cliName`
|
|
629
|
+
* (kebab-case is recommended). Only valid on boolean fields; setting
|
|
630
|
+
* `negation` on a non-boolean field is a type error and raises a
|
|
631
|
+
* runtime error during command parsing.
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```ts
|
|
635
|
+
* // Custom negation name
|
|
636
|
+
* cache: arg(z.boolean().default(true), {
|
|
637
|
+
* description: "Enable caching",
|
|
638
|
+
* negation: "disable-cache",
|
|
639
|
+
* })
|
|
640
|
+
* // Accepts: --cache (true), --disable-cache (false)
|
|
641
|
+
* // No longer accepts: --no-cache
|
|
642
|
+
*
|
|
643
|
+
* // Expose default `--no-X` in help/docs/completion
|
|
644
|
+
* verbose: arg(z.boolean().default(false), {
|
|
645
|
+
* negation: true,
|
|
646
|
+
* })
|
|
647
|
+
* // Help shows `--verbose / --no-verbose`
|
|
648
|
+
*
|
|
649
|
+
* // Disable negation entirely
|
|
650
|
+
* dryRun: arg(z.boolean().default(false), {
|
|
651
|
+
* negation: false,
|
|
652
|
+
* })
|
|
653
|
+
* // Accepts: --dry-run (true)
|
|
654
|
+
* // No longer accepts: --no-dry-run
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
negation?: string | boolean;
|
|
658
|
+
/**
|
|
659
|
+
* Description shown for the negation option in help and generated docs.
|
|
660
|
+
* Only meaningful when `negation` is set to a custom name string or `true`.
|
|
661
|
+
* Disallowed when `negation` is `false`.
|
|
662
|
+
*/
|
|
663
|
+
negationDescription?: string;
|
|
579
664
|
/**
|
|
580
665
|
* Side-effect callback executed after argument parsing and validation.
|
|
581
666
|
* Runs before the command lifecycle (setup/run/cleanup).
|
|
@@ -662,23 +747,52 @@ type ContainsReservedAlias<A> = [A] extends [never] ? false : A extends "h" | "H
|
|
|
662
747
|
type ReservedAliasTypeError<M> = { [K in keyof M]: M[K] } & {
|
|
663
748
|
__typeError: "Alias 'h' or 'H' requires overrideBuiltinAlias: true";
|
|
664
749
|
};
|
|
750
|
+
type NegationTypeError<M> = { [K in keyof M]: M[K] } & {
|
|
751
|
+
__typeError: "negation/negationDescription can only be used on boolean fields";
|
|
752
|
+
};
|
|
665
753
|
type AliasFieldOf<M> = M extends {
|
|
666
754
|
alias: infer A;
|
|
667
755
|
} ? A : never;
|
|
668
756
|
type HiddenAliasFieldOf<M> = M extends {
|
|
669
757
|
hiddenAlias: infer H;
|
|
670
758
|
} ? H : never;
|
|
759
|
+
/**
|
|
760
|
+
* Check whether a Zod output type is a (possibly optional) boolean.
|
|
761
|
+
* Strips `undefined` to allow `z.boolean().optional()`. Requires both
|
|
762
|
+
* `boolean extends NonNullable<T>` (so `z.literal(true)` is rejected — the full
|
|
763
|
+
* `boolean` domain is needed) and `NonNullable<T> extends boolean` (so unions
|
|
764
|
+
* such as `z.union([z.boolean(), z.string()])` are rejected at the type level
|
|
765
|
+
* to match the runtime check).
|
|
766
|
+
*/
|
|
767
|
+
type IsBooleanField<T> = boolean extends NonNullable<T> ? ([NonNullable<T>] extends [boolean] ? true : false) : false;
|
|
768
|
+
/**
|
|
769
|
+
* Detect whether `M` has `K` set to a non-undefined value.
|
|
770
|
+
*
|
|
771
|
+
* When `M` is inferred from a literal such as `{ negation: "off" }`,
|
|
772
|
+
* `M["negation"]` is `"off"` (without `undefined`), so this returns `true`.
|
|
773
|
+
* When `M` is the wider `ArgMeta` type, `M["negation"]` is
|
|
774
|
+
* `string | boolean | undefined`, so this returns `false` and avoids
|
|
775
|
+
* false-positive type errors on broadly-typed meta values.
|
|
776
|
+
*/
|
|
777
|
+
type HasExplicit<M, K extends string> = K extends keyof M ? undefined extends M[K] ? false : true : false;
|
|
778
|
+
/**
|
|
779
|
+
* Reject `negation` / `negationDescription` on non-boolean fields.
|
|
780
|
+
* Uses {@link HasExplicit} so the error only fires when the user explicitly
|
|
781
|
+
* sets the field on a narrowly-inferred meta literal.
|
|
782
|
+
*/
|
|
783
|
+
type ValidateNegation<M, TValue> = HasExplicit<M, "negation"> extends true ? IsBooleanField<TValue> extends true ? M : NegationTypeError<M> : HasExplicit<M, "negationDescription"> extends true ? IsBooleanField<TValue> extends true ? M : NegationTypeError<M> : M;
|
|
671
784
|
/**
|
|
672
785
|
* Type helper to validate ArgMeta.
|
|
673
786
|
* Forces a type error when a reserved alias ("h" / "H") is used without
|
|
674
787
|
* `overrideBuiltinAlias: true`, whether the alias is provided as a string
|
|
675
788
|
* or as part of an array, and whether it appears in `alias` or `hiddenAlias`.
|
|
789
|
+
* Also rejects `negation` / `negationDescription` on non-boolean fields.
|
|
676
790
|
*/
|
|
677
|
-
type ValidateArgMeta<M> = M extends {
|
|
791
|
+
type ValidateArgMeta<M, TValue = unknown> = M extends {
|
|
678
792
|
overrideBuiltinAlias: true;
|
|
679
|
-
} ? M : ContainsReservedAlias<AliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ContainsReservedAlias<HiddenAliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : M
|
|
793
|
+
} ? ValidateNegation<M, TValue> : ContainsReservedAlias<AliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ContainsReservedAlias<HiddenAliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ValidateNegation<M, TValue>;
|
|
680
794
|
declare function arg<T extends z.ZodType>(schema: T): T;
|
|
681
|
-
declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M
|
|
795
|
+
declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M, z.output<T>>): T;
|
|
682
796
|
//#endregion
|
|
683
797
|
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-
|
|
798
|
+
//# sourceMappingURL=arg-registry-Cd6xnjHa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg-registry-Cd6xnjHa.d.ts","names":[],"sources":["../src/core/schema-extractor.ts","../src/lazy.ts","../src/types.ts","../src/core/arg-registry.ts"],"mappings":";;;AA8CA;;;AAAA,UAAiB,iBAAA;EAwCF;EAtCb,IAAA;EAkEoC;EAhEpC,OAAA;E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AAA"}
|
|
@@ -47,6 +47,30 @@ interface ResolvedFieldMeta {
|
|
|
47
47
|
completion?: CompletionMeta | undefined;
|
|
48
48
|
/** Prompt metadata from arg() for interactive input */
|
|
49
49
|
prompt?: PromptMeta | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Negation configuration for this boolean field.
|
|
52
|
+
*
|
|
53
|
+
* - String (e.g. `"disable-cache"`): the default `--no-<cliName>` form is
|
|
54
|
+
* suppressed and only `--<negation>` (plus its camelCase variant) is
|
|
55
|
+
* accepted as the negation flag.
|
|
56
|
+
* - `true`: the default `--no-<cliName>` form is accepted **and** shown in
|
|
57
|
+
* help, generated docs, and shell completions.
|
|
58
|
+
* - `false`: neither the default `--no-<cliName>` nor any custom name is
|
|
59
|
+
* accepted; the field only responds to the positive flag.
|
|
60
|
+
* - `undefined`: the default `--no-<cliName>` is accepted by the parser
|
|
61
|
+
* but hidden from help/docs/completions.
|
|
62
|
+
*
|
|
63
|
+
* Only applies to boolean fields; populated as `undefined` otherwise.
|
|
64
|
+
*/
|
|
65
|
+
negation?: string | boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Derived display name (no `--` prefix) for the negation flag in help,
|
|
68
|
+
* generated docs, and shell completions. `undefined` means the negation
|
|
69
|
+
* is hidden from those surfaces. Computed from `negation` + `cliName`.
|
|
70
|
+
*/
|
|
71
|
+
negationDisplay?: string | undefined;
|
|
72
|
+
/** Description shown for the negation option in help/docs. */
|
|
73
|
+
negationDescription?: string | undefined;
|
|
50
74
|
/** Side-effect callback from arg() metadata */
|
|
51
75
|
effect?: ((value: unknown, context: EffectContext) => void | PromiseLike<void>) | undefined;
|
|
52
76
|
}
|
|
@@ -246,6 +270,8 @@ interface CommandBase<TArgsSchema extends ArgsSchema | undefined = undefined, TA
|
|
|
246
270
|
name: string;
|
|
247
271
|
/** Command description */
|
|
248
272
|
description?: string | undefined;
|
|
273
|
+
/** Alternative names for this command (used as subcommand aliases) */
|
|
274
|
+
aliases?: string[] | undefined;
|
|
249
275
|
/** Argument schema (preserves the original Zod schema type) */
|
|
250
276
|
args: TArgsSchema;
|
|
251
277
|
/** Subcommands */
|
|
@@ -258,6 +284,13 @@ interface CommandBase<TArgsSchema extends ArgsSchema | undefined = undefined, TA
|
|
|
258
284
|
notes?: string | undefined;
|
|
259
285
|
/** Example usages for this command */
|
|
260
286
|
examples?: Example[] | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
* Hook invoked once at the top of `runMain`, before any parsing. Used
|
|
290
|
+
* by `withCompletionCommand` to fire its detached background-refresh
|
|
291
|
+
* spawn. Best-effort; never throws.
|
|
292
|
+
*/
|
|
293
|
+
runMainHook?: ((argv: readonly string[]) => void) | undefined;
|
|
261
294
|
}
|
|
262
295
|
/**
|
|
263
296
|
* A command with a run function
|
|
@@ -576,6 +609,58 @@ interface BaseArgMeta<TValue = unknown> {
|
|
|
576
609
|
* ```
|
|
577
610
|
*/
|
|
578
611
|
prompt?: PromptMeta;
|
|
612
|
+
/**
|
|
613
|
+
* Control the boolean negation option.
|
|
614
|
+
*
|
|
615
|
+
* Boolean fields automatically accept `--no-<cliName>` (and the camelCase
|
|
616
|
+
* `--no<Name>` form) to set the value to `false`. By default this form is
|
|
617
|
+
* accepted by the parser but hidden from help, generated docs, and shell
|
|
618
|
+
* completions. This option lets you customize or expose that behavior:
|
|
619
|
+
*
|
|
620
|
+
* - `string` — replaces the auto-generated `--no-*` form with a custom
|
|
621
|
+
* name. The default `--no-*` is no longer recognized.
|
|
622
|
+
* - `true` — opt-in to advertising the default `--no-<cliName>` form in
|
|
623
|
+
* help, generated docs, and shell completions. Parser behavior is
|
|
624
|
+
* unchanged.
|
|
625
|
+
* - `false` — disables negation entirely; neither the default `--no-*`
|
|
626
|
+
* nor any custom name is accepted.
|
|
627
|
+
*
|
|
628
|
+
* String values follow the same naming conventions as `cliName`
|
|
629
|
+
* (kebab-case is recommended). Only valid on boolean fields; setting
|
|
630
|
+
* `negation` on a non-boolean field is a type error and raises a
|
|
631
|
+
* runtime error during command parsing.
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```ts
|
|
635
|
+
* // Custom negation name
|
|
636
|
+
* cache: arg(z.boolean().default(true), {
|
|
637
|
+
* description: "Enable caching",
|
|
638
|
+
* negation: "disable-cache",
|
|
639
|
+
* })
|
|
640
|
+
* // Accepts: --cache (true), --disable-cache (false)
|
|
641
|
+
* // No longer accepts: --no-cache
|
|
642
|
+
*
|
|
643
|
+
* // Expose default `--no-X` in help/docs/completion
|
|
644
|
+
* verbose: arg(z.boolean().default(false), {
|
|
645
|
+
* negation: true,
|
|
646
|
+
* })
|
|
647
|
+
* // Help shows `--verbose / --no-verbose`
|
|
648
|
+
*
|
|
649
|
+
* // Disable negation entirely
|
|
650
|
+
* dryRun: arg(z.boolean().default(false), {
|
|
651
|
+
* negation: false,
|
|
652
|
+
* })
|
|
653
|
+
* // Accepts: --dry-run (true)
|
|
654
|
+
* // No longer accepts: --no-dry-run
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
negation?: string | boolean;
|
|
658
|
+
/**
|
|
659
|
+
* Description shown for the negation option in help and generated docs.
|
|
660
|
+
* Only meaningful when `negation` is set to a custom name string or `true`.
|
|
661
|
+
* Disallowed when `negation` is `false`.
|
|
662
|
+
*/
|
|
663
|
+
negationDescription?: string;
|
|
579
664
|
/**
|
|
580
665
|
* Side-effect callback executed after argument parsing and validation.
|
|
581
666
|
* Runs before the command lifecycle (setup/run/cleanup).
|
|
@@ -662,23 +747,52 @@ type ContainsReservedAlias<A> = [A] extends [never] ? false : A extends "h" | "H
|
|
|
662
747
|
type ReservedAliasTypeError<M> = { [K in keyof M]: M[K] } & {
|
|
663
748
|
__typeError: "Alias 'h' or 'H' requires overrideBuiltinAlias: true";
|
|
664
749
|
};
|
|
750
|
+
type NegationTypeError<M> = { [K in keyof M]: M[K] } & {
|
|
751
|
+
__typeError: "negation/negationDescription can only be used on boolean fields";
|
|
752
|
+
};
|
|
665
753
|
type AliasFieldOf<M> = M extends {
|
|
666
754
|
alias: infer A;
|
|
667
755
|
} ? A : never;
|
|
668
756
|
type HiddenAliasFieldOf<M> = M extends {
|
|
669
757
|
hiddenAlias: infer H;
|
|
670
758
|
} ? H : never;
|
|
759
|
+
/**
|
|
760
|
+
* Check whether a Zod output type is a (possibly optional) boolean.
|
|
761
|
+
* Strips `undefined` to allow `z.boolean().optional()`. Requires both
|
|
762
|
+
* `boolean extends NonNullable<T>` (so `z.literal(true)` is rejected — the full
|
|
763
|
+
* `boolean` domain is needed) and `NonNullable<T> extends boolean` (so unions
|
|
764
|
+
* such as `z.union([z.boolean(), z.string()])` are rejected at the type level
|
|
765
|
+
* to match the runtime check).
|
|
766
|
+
*/
|
|
767
|
+
type IsBooleanField<T> = boolean extends NonNullable<T> ? ([NonNullable<T>] extends [boolean] ? true : false) : false;
|
|
768
|
+
/**
|
|
769
|
+
* Detect whether `M` has `K` set to a non-undefined value.
|
|
770
|
+
*
|
|
771
|
+
* When `M` is inferred from a literal such as `{ negation: "off" }`,
|
|
772
|
+
* `M["negation"]` is `"off"` (without `undefined`), so this returns `true`.
|
|
773
|
+
* When `M` is the wider `ArgMeta` type, `M["negation"]` is
|
|
774
|
+
* `string | boolean | undefined`, so this returns `false` and avoids
|
|
775
|
+
* false-positive type errors on broadly-typed meta values.
|
|
776
|
+
*/
|
|
777
|
+
type HasExplicit<M, K extends string> = K extends keyof M ? undefined extends M[K] ? false : true : false;
|
|
778
|
+
/**
|
|
779
|
+
* Reject `negation` / `negationDescription` on non-boolean fields.
|
|
780
|
+
* Uses {@link HasExplicit} so the error only fires when the user explicitly
|
|
781
|
+
* sets the field on a narrowly-inferred meta literal.
|
|
782
|
+
*/
|
|
783
|
+
type ValidateNegation<M, TValue> = HasExplicit<M, "negation"> extends true ? IsBooleanField<TValue> extends true ? M : NegationTypeError<M> : HasExplicit<M, "negationDescription"> extends true ? IsBooleanField<TValue> extends true ? M : NegationTypeError<M> : M;
|
|
671
784
|
/**
|
|
672
785
|
* Type helper to validate ArgMeta.
|
|
673
786
|
* Forces a type error when a reserved alias ("h" / "H") is used without
|
|
674
787
|
* `overrideBuiltinAlias: true`, whether the alias is provided as a string
|
|
675
788
|
* or as part of an array, and whether it appears in `alias` or `hiddenAlias`.
|
|
789
|
+
* Also rejects `negation` / `negationDescription` on non-boolean fields.
|
|
676
790
|
*/
|
|
677
|
-
type ValidateArgMeta<M> = M extends {
|
|
791
|
+
type ValidateArgMeta<M, TValue = unknown> = M extends {
|
|
678
792
|
overrideBuiltinAlias: true;
|
|
679
|
-
} ? M : ContainsReservedAlias<AliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ContainsReservedAlias<HiddenAliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : M
|
|
793
|
+
} ? ValidateNegation<M, TValue> : ContainsReservedAlias<AliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ContainsReservedAlias<HiddenAliasFieldOf<M>> extends true ? ReservedAliasTypeError<M> : ValidateNegation<M, TValue>;
|
|
680
794
|
declare function arg<T extends z.ZodType>(schema: T): T;
|
|
681
|
-
declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M
|
|
795
|
+
declare function arg<T extends z.ZodType, M extends ArgMeta<z.output<T>>>(schema: T, meta: ValidateArgMeta<M, z.output<T>>): T;
|
|
682
796
|
//#endregion
|
|
683
797
|
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-
|
|
798
|
+
//# sourceMappingURL=arg-registry-MVWOAcvw.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg-registry-MVWOAcvw.d.cts","names":[],"sources":["../src/core/schema-extractor.ts","../src/lazy.ts","../src/types.ts","../src/core/arg-registry.ts"],"mappings":";;;AA8CA;;;AAAA,UAAiB,iBAAA;EAwCF;EAtCb,IAAA;EAkEoC;EAhEpC,OAAA;EAgEwE;;;;;EA1DxE,KAAA;EAOA;;;;EAFA,WAAA;EAeA;EAbA,WAAA;EAiBA;EAfA,UAAA;EAeU;EAbV,WAAA;EAiBA;;;;EAZA,GAAA;EAgCA;EA9BA,QAAA;EAsCA;EApCA,YAAA;EAsCW;EApCX,IAAA;EAoC2B;EAlC3B,MAAA,EAAQ,CAAA,CAAE,OAAA;EAkC8D;EAhCxE,oBAAA;EAsCe;EApCf,UAAA;;EAEA,UAAA,GAAa,cAAA;EAsCL;EApCR,MAAA,GAAS,UAAA;EA0CE;;;;;;;;;;;;;;;EA1BX,QAAA;EA6BE;;;;;EAvBF,eAAA;EAmCgC;EAjChC,mBAAA;EA0CU;EAxCV,MAAA,KAAW,KAAA,WAAgB,OAAA,EAAS,aAAA,YAAyB,WAAA;AAAA;;AAwCpC;AA6C3B;UA/EiB,eAAA;;EAEf,MAAA,EAAQ,iBAAA;EA6EiC;EA3EzC,MAAA,EAAQ,UAAA;EA2EyB;EAzEjC,UAAA;EAyEoE;EAvEpE,aAAA;EA2Nc;EAzNd,QAAA,GAAW,KAAA;IACT,kBAAA;IACA,MAAA,EAAQ,iBAAA;IACR,WAAA;EAAA;EAwOuB;EArOzB,YAAA,GAAe,eAAA;EAqOsB;EAnOrC,WAAA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AAsB,YAAA,CAAa,CAAA,kBACjC,sBAAA,CAAuB,CAAA,IACvB,qBAAA,CAAsB,kBAAA,CAAmB,CAAA,kBACvC,sBAAA,CAAuB,CAAA,IACvB,gBAAA,CAAiB,CAAA,EAAG,MAAA;AAAA,iBAEZ,GAAA,WAAc,CAAA,CAAE,OAAA,CAAA,CAAS,MAAA,EAAQ,CAAA,GAAI,CAAA;AAAA,iBACrC,GAAA,WAAc,CAAA,CAAE,OAAA,YAAmB,OAAA,CAAQ,CAAA,CAAE,MAAA,CAAO,CAAA,GAAA,CAClE,MAAA,EAAQ,CAAA,EACR,IAAA,EAAM,eAAA,CAAgB,CAAA,EAAG,CAAA,CAAE,MAAA,CAAO,CAAA,KACjC,CAAA"}
|
package/dist/augment.d.cts
CHANGED
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,
|
|
1
|
+
{"version":3,"file":"augment.d.cts","names":[],"sources":["../src/augment.ts"],"mappings":";;;;YAiBY,UAAA;IACR,OAAA,GAAU,OAAO;EAAA;EAAA,UAGT,UAAA;IACR,WAAA;IACA,UAAA;IACA,WAAA;IACA,KAAA;IACA,WAAA;IACA,oBAAA;EAAA;AAAA"}
|
package/dist/augment.d.ts
CHANGED
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,
|
|
1
|
+
{"version":3,"file":"augment.d.ts","names":[],"sources":["../src/augment.ts"],"mappings":";;;;YAiBY,UAAA;IACR,OAAA,GAAU,OAAO;EAAA;EAAA,UAGT,UAAA;IACR,WAAA;IACA,UAAA;IACA,WAAA;IACA,KAAA;IACA,WAAA;IACA,oBAAA;EAAA;AAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_completion = require('../completion-
|
|
2
|
+
const require_completion = require('../completion-BlZxMSeU.cjs');
|
|
3
3
|
|
|
4
4
|
exports.CompletionDirective = require_completion.CompletionDirective;
|
|
5
5
|
exports.createCompletionCommand = require_completion.createCompletionCommand;
|
|
6
6
|
exports.createDynamicCompleteCommand = require_completion.createDynamicCompleteCommand;
|
|
7
|
+
exports.createRefreshCompletionCommand = require_completion.createRefreshCompletionCommand;
|
|
7
8
|
exports.detectShell = require_completion.detectShell;
|
|
8
9
|
exports.extractCompletionData = require_completion.extractCompletionData;
|
|
9
10
|
exports.extractPositionals = require_completion.extractPositionals;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
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
|
+
import { C as CompletableOption, D as CompletionOptions, E as CompletionGenerator, O as CompletionResult, S as parseCompletionContext, T as CompletionData, _ as CompletionCandidate, a as generateCompletion, b as CompletionContext, c as ValueCompletionField, d as extractPositionals, f as ShellFormatOptions, g as CandidateResult, h as hasCompleteCommand, i as detectShell, k as ShellType, l as resolveValueCompletion, m as createDynamicCompleteCommand, n as createCompletionCommand, o as getSupportedShells, p as formatForShell, r as createRefreshCompletionCommand, s as withCompletionCommand, t as WithCompletionOptions, u as extractCompletionData, v as CompletionDirective, w as CompletableSubcommand, x as CompletionType, y as generateCandidates } from "../index-CPebddth.cjs";
|
|
2
|
+
export { type CandidateResult, type CompletableOption, type CompletableSubcommand, type CompletionCandidate, type CompletionContext, type CompletionData, CompletionDirective, type CompletionGenerator, type CompletionOptions, type CompletionResult, type CompletionType, type ShellFormatOptions, type ShellType, type ValueCompletionField, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, createRefreshCompletionCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
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
|
+
import { C as CompletableOption, D as CompletionOptions, E as CompletionGenerator, O as CompletionResult, S as parseCompletionContext, T as CompletionData, _ as CompletionCandidate, a as generateCompletion, b as CompletionContext, c as ValueCompletionField, d as extractPositionals, f as ShellFormatOptions, g as CandidateResult, h as hasCompleteCommand, i as detectShell, k as ShellType, l as resolveValueCompletion, m as createDynamicCompleteCommand, n as createCompletionCommand, o as getSupportedShells, p as formatForShell, r as createRefreshCompletionCommand, s as withCompletionCommand, t as WithCompletionOptions, u as extractCompletionData, v as CompletionDirective, w as CompletableSubcommand, x as CompletionType, y as generateCandidates } from "../index-DR9HLxIP.js";
|
|
2
|
+
export { type CandidateResult, type CompletableOption, type CompletableSubcommand, type CompletionCandidate, type CompletionContext, type CompletionData, CompletionDirective, type CompletionGenerator, type CompletionOptions, type CompletionResult, type CompletionType, type ShellFormatOptions, type ShellType, type ValueCompletionField, WithCompletionOptions, createCompletionCommand, createDynamicCompleteCommand, createRefreshCompletionCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|
package/dist/completion/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as getSupportedShells, c as hasCompleteCommand, d as CompletionDirective, f as generateCandidates, h as resolveValueCompletion, i as generateCompletion, l as formatForShell, m as extractPositionals, n as createRefreshCompletionCommand, o as withCompletionCommand, p as extractCompletionData, r as detectShell, s as createDynamicCompleteCommand, t as createCompletionCommand, u as parseCompletionContext } from "../completion-B04iiki9.js";
|
|
2
2
|
|
|
3
|
-
export { CompletionDirective, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|
|
3
|
+
export { CompletionDirective, createCompletionCommand, createDynamicCompleteCommand, createRefreshCompletionCommand, detectShell, extractCompletionData, extractPositionals, formatForShell, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, resolveValueCompletion, withCompletionCommand };
|