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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as AnyCommand, p as Command, u as ArgsSchema, z as ResolvedFieldMeta } from "./arg-registry-
|
|
1
|
+
import { l as AnyCommand, p as Command, u as ArgsSchema, z as ResolvedFieldMeta } from "./arg-registry-MVWOAcvw.cjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/completion/types.d.ts
|
|
@@ -20,6 +20,19 @@ interface CompletionOptions {
|
|
|
20
20
|
includeDescriptions?: boolean;
|
|
21
21
|
/** Global args schema for deriving global options in completion */
|
|
22
22
|
globalArgsSchema?: ArgsSchema;
|
|
23
|
+
/**
|
|
24
|
+
* Path to the binary whose mtime is the freshness signature.
|
|
25
|
+
* Defaults to `process.argv[1]`.
|
|
26
|
+
*/
|
|
27
|
+
binPath?: string;
|
|
28
|
+
/** Program version to embed in the script header. */
|
|
29
|
+
programVersion?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Cache directory for the loader to write the regenerated script into.
|
|
32
|
+
* Defaults to `${XDG_CACHE_HOME:-$HOME/.cache}/<programName>` at runtime.
|
|
33
|
+
* Setting this hardcodes the location into the generated loader.
|
|
34
|
+
*/
|
|
35
|
+
cacheDir?: string;
|
|
23
36
|
}
|
|
24
37
|
/**
|
|
25
38
|
* Value completion specification for shell scripts
|
|
@@ -48,6 +61,13 @@ interface CompletableOption {
|
|
|
48
61
|
* 1-char entries are short (`-v`); multi-char entries are long (`--to-be`).
|
|
49
62
|
*/
|
|
50
63
|
alias?: string[] | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Negation name to advertise in shell completions (no `--` prefix),
|
|
66
|
+
* or `undefined` to hide the negation. Mirrors `ResolvedFieldMeta.negationDisplay`.
|
|
67
|
+
*/
|
|
68
|
+
negation?: string | undefined;
|
|
69
|
+
/** Description for the negation option (when distinct from the main description) */
|
|
70
|
+
negationDescription?: string | undefined;
|
|
51
71
|
/** Description for completion */
|
|
52
72
|
description?: string | undefined;
|
|
53
73
|
/** Whether this option takes a value */
|
|
@@ -86,6 +106,8 @@ interface CompletableSubcommand {
|
|
|
86
106
|
name: string;
|
|
87
107
|
/** Subcommand description */
|
|
88
108
|
description?: string | undefined;
|
|
109
|
+
/** Alternative names (aliases) for this subcommand */
|
|
110
|
+
aliases?: string[] | undefined;
|
|
89
111
|
/** Nested subcommands */
|
|
90
112
|
subcommands: CompletableSubcommand[];
|
|
91
113
|
/** Options for this subcommand */
|
|
@@ -320,8 +342,18 @@ declare const completionArgsSchema: z.ZodObject<{
|
|
|
320
342
|
fish: "fish";
|
|
321
343
|
}>>;
|
|
322
344
|
instructions: z.ZodDefault<z.ZodBoolean>;
|
|
345
|
+
loader: z.ZodDefault<z.ZodBoolean>;
|
|
346
|
+
install: z.ZodDefault<z.ZodBoolean>;
|
|
323
347
|
}, z.core.$strip>;
|
|
324
348
|
type CompletionArgs = z.infer<typeof completionArgsSchema>;
|
|
349
|
+
declare const refreshArgsSchema: z.ZodObject<{
|
|
350
|
+
shell: z.ZodEnum<{
|
|
351
|
+
bash: "bash";
|
|
352
|
+
zsh: "zsh";
|
|
353
|
+
fish: "fish";
|
|
354
|
+
}>;
|
|
355
|
+
}, z.core.$strip>;
|
|
356
|
+
type RefreshArgs = z.infer<typeof refreshArgsSchema>;
|
|
325
357
|
/**
|
|
326
358
|
* Create a completion subcommand for your CLI
|
|
327
359
|
*
|
|
@@ -337,7 +369,20 @@ type CompletionArgs = z.infer<typeof completionArgsSchema>;
|
|
|
337
369
|
* });
|
|
338
370
|
* ```
|
|
339
371
|
*/
|
|
340
|
-
declare function createCompletionCommand(rootCommand: AnyCommand, programName?: string, globalArgsSchema?: ArgsSchema
|
|
372
|
+
declare function createCompletionCommand(rootCommand: AnyCommand, programName?: string, globalArgsSchema?: ArgsSchema, extra?: {
|
|
373
|
+
cacheDir?: string;
|
|
374
|
+
programVersion?: string;
|
|
375
|
+
}): Command<typeof completionArgsSchema, CompletionArgs, any>;
|
|
376
|
+
/**
|
|
377
|
+
* Hidden subcommand that the runMain background hook spawns. It does
|
|
378
|
+
* the same stat-compare + atomic rewrite as the rc loader, but in a
|
|
379
|
+
* detached child process so it's invisible to the user.
|
|
380
|
+
*/
|
|
381
|
+
declare function createRefreshCompletionCommand(rootCommand: AnyCommand, programName: string, extra?: {
|
|
382
|
+
cacheDir?: string;
|
|
383
|
+
programVersion?: string;
|
|
384
|
+
globalArgsSchema?: ArgsSchema;
|
|
385
|
+
}): Command<typeof refreshArgsSchema, RefreshArgs, any>;
|
|
341
386
|
/**
|
|
342
387
|
* Options for withCompletionCommand
|
|
343
388
|
*/
|
|
@@ -346,6 +391,15 @@ interface WithCompletionOptions {
|
|
|
346
391
|
programName?: string;
|
|
347
392
|
/** Global args schema for deriving global options in completion */
|
|
348
393
|
globalArgsSchema?: ArgsSchema;
|
|
394
|
+
/**
|
|
395
|
+
* Hardcode the cache directory used by the rc loader and the
|
|
396
|
+
* background refresh. When omitted, the loader derives
|
|
397
|
+
* `${XDG_CACHE_HOME:-$HOME/.cache}/<programName>` at runtime, which
|
|
398
|
+
* is the right answer for almost every CLI.
|
|
399
|
+
*/
|
|
400
|
+
cacheDir?: string;
|
|
401
|
+
/** Program version embedded in the script header. */
|
|
402
|
+
programVersion?: string;
|
|
349
403
|
}
|
|
350
404
|
/**
|
|
351
405
|
* Wrap a command with a completion subcommand
|
|
@@ -369,5 +423,5 @@ interface WithCompletionOptions {
|
|
|
369
423
|
*/
|
|
370
424
|
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
371
425
|
//#endregion
|
|
372
|
-
export {
|
|
373
|
-
//# sourceMappingURL=index-
|
|
426
|
+
export { CompletableOption as C, CompletionOptions as D, CompletionGenerator as E, CompletionResult as O, parseCompletionContext as S, CompletionData as T, CompletionCandidate as _, generateCompletion as a, CompletionContext as b, ValueCompletionField as c, extractPositionals as d, ShellFormatOptions as f, CandidateResult as g, hasCompleteCommand as h, detectShell as i, ShellType as k, resolveValueCompletion as l, createDynamicCompleteCommand as m, createCompletionCommand as n, getSupportedShells as o, formatForShell as p, createRefreshCompletionCommand as r, withCompletionCommand as s, WithCompletionOptions as t, extractCompletionData as u, CompletionDirective as v, CompletableSubcommand as w, CompletionType as x, generateCandidates as y };
|
|
427
|
+
//# sourceMappingURL=index-CPebddth.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CPebddth.d.cts","names":[],"sources":["../src/completion/types.ts","../src/completion/dynamic/context-parser.ts","../src/completion/dynamic/candidate-generator.ts","../src/completion/dynamic/complete-command.ts","../src/completion/dynamic/shell-formatter.ts","../src/completion/extractor.ts","../src/completion/value-completion-resolver.ts","../src/completion/index.ts"],"mappings":";;;;AASA;;;AAAA,KAAY,SAAA;AAAS;AAKrB;;AALqB,UAKJ,iBAAA;EAUc;EAR7B,KAAA,EAAO,SAAA;EAAA;EAEP,WAAA;EAEA;EAAA,kBAAA;EAIA;EAFA,mBAAA;EAOA;EALA,gBAAA,GAAmB,UAAU;EAa7B;;AAAQ;AAMV;EAdE,OAAA;;EAEA,cAAA;EAcA;;;;;EARA,QAAA;AAAA;;AAiBc;AAOhB;KAlBY,eAAA;wBAEV,IAAA,yDAkBA;EAhBA,OAAA,aAuBA;EArBA,YAAA;AAAA;EAEoD,UAAA;EAAuB,OAAA;AAAA;EAkC3E,wDAhC6D,OAAA;EACzD,UAAA;AAAA;;AAiC6B;AAMnC;UAhCi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sSchema, z as ResolvedFieldMeta } from "./arg-registry-
|
|
1
|
+
import { l as AnyCommand, p as Command, u as ArgsSchema, z as ResolvedFieldMeta } from "./arg-registry-Cd6xnjHa.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/completion/types.d.ts
|
|
@@ -20,6 +20,19 @@ interface CompletionOptions {
|
|
|
20
20
|
includeDescriptions?: boolean;
|
|
21
21
|
/** Global args schema for deriving global options in completion */
|
|
22
22
|
globalArgsSchema?: ArgsSchema;
|
|
23
|
+
/**
|
|
24
|
+
* Path to the binary whose mtime is the freshness signature.
|
|
25
|
+
* Defaults to `process.argv[1]`.
|
|
26
|
+
*/
|
|
27
|
+
binPath?: string;
|
|
28
|
+
/** Program version to embed in the script header. */
|
|
29
|
+
programVersion?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Cache directory for the loader to write the regenerated script into.
|
|
32
|
+
* Defaults to `${XDG_CACHE_HOME:-$HOME/.cache}/<programName>` at runtime.
|
|
33
|
+
* Setting this hardcodes the location into the generated loader.
|
|
34
|
+
*/
|
|
35
|
+
cacheDir?: string;
|
|
23
36
|
}
|
|
24
37
|
/**
|
|
25
38
|
* Value completion specification for shell scripts
|
|
@@ -48,6 +61,13 @@ interface CompletableOption {
|
|
|
48
61
|
* 1-char entries are short (`-v`); multi-char entries are long (`--to-be`).
|
|
49
62
|
*/
|
|
50
63
|
alias?: string[] | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Negation name to advertise in shell completions (no `--` prefix),
|
|
66
|
+
* or `undefined` to hide the negation. Mirrors `ResolvedFieldMeta.negationDisplay`.
|
|
67
|
+
*/
|
|
68
|
+
negation?: string | undefined;
|
|
69
|
+
/** Description for the negation option (when distinct from the main description) */
|
|
70
|
+
negationDescription?: string | undefined;
|
|
51
71
|
/** Description for completion */
|
|
52
72
|
description?: string | undefined;
|
|
53
73
|
/** Whether this option takes a value */
|
|
@@ -86,6 +106,8 @@ interface CompletableSubcommand {
|
|
|
86
106
|
name: string;
|
|
87
107
|
/** Subcommand description */
|
|
88
108
|
description?: string | undefined;
|
|
109
|
+
/** Alternative names (aliases) for this subcommand */
|
|
110
|
+
aliases?: string[] | undefined;
|
|
89
111
|
/** Nested subcommands */
|
|
90
112
|
subcommands: CompletableSubcommand[];
|
|
91
113
|
/** Options for this subcommand */
|
|
@@ -320,8 +342,18 @@ declare const completionArgsSchema: z.ZodObject<{
|
|
|
320
342
|
fish: "fish";
|
|
321
343
|
}>>;
|
|
322
344
|
instructions: z.ZodDefault<z.ZodBoolean>;
|
|
345
|
+
loader: z.ZodDefault<z.ZodBoolean>;
|
|
346
|
+
install: z.ZodDefault<z.ZodBoolean>;
|
|
323
347
|
}, z.core.$strip>;
|
|
324
348
|
type CompletionArgs = z.infer<typeof completionArgsSchema>;
|
|
349
|
+
declare const refreshArgsSchema: z.ZodObject<{
|
|
350
|
+
shell: z.ZodEnum<{
|
|
351
|
+
bash: "bash";
|
|
352
|
+
zsh: "zsh";
|
|
353
|
+
fish: "fish";
|
|
354
|
+
}>;
|
|
355
|
+
}, z.core.$strip>;
|
|
356
|
+
type RefreshArgs = z.infer<typeof refreshArgsSchema>;
|
|
325
357
|
/**
|
|
326
358
|
* Create a completion subcommand for your CLI
|
|
327
359
|
*
|
|
@@ -337,7 +369,20 @@ type CompletionArgs = z.infer<typeof completionArgsSchema>;
|
|
|
337
369
|
* });
|
|
338
370
|
* ```
|
|
339
371
|
*/
|
|
340
|
-
declare function createCompletionCommand(rootCommand: AnyCommand, programName?: string, globalArgsSchema?: ArgsSchema
|
|
372
|
+
declare function createCompletionCommand(rootCommand: AnyCommand, programName?: string, globalArgsSchema?: ArgsSchema, extra?: {
|
|
373
|
+
cacheDir?: string;
|
|
374
|
+
programVersion?: string;
|
|
375
|
+
}): Command<typeof completionArgsSchema, CompletionArgs, any>;
|
|
376
|
+
/**
|
|
377
|
+
* Hidden subcommand that the runMain background hook spawns. It does
|
|
378
|
+
* the same stat-compare + atomic rewrite as the rc loader, but in a
|
|
379
|
+
* detached child process so it's invisible to the user.
|
|
380
|
+
*/
|
|
381
|
+
declare function createRefreshCompletionCommand(rootCommand: AnyCommand, programName: string, extra?: {
|
|
382
|
+
cacheDir?: string;
|
|
383
|
+
programVersion?: string;
|
|
384
|
+
globalArgsSchema?: ArgsSchema;
|
|
385
|
+
}): Command<typeof refreshArgsSchema, RefreshArgs, any>;
|
|
341
386
|
/**
|
|
342
387
|
* Options for withCompletionCommand
|
|
343
388
|
*/
|
|
@@ -346,6 +391,15 @@ interface WithCompletionOptions {
|
|
|
346
391
|
programName?: string;
|
|
347
392
|
/** Global args schema for deriving global options in completion */
|
|
348
393
|
globalArgsSchema?: ArgsSchema;
|
|
394
|
+
/**
|
|
395
|
+
* Hardcode the cache directory used by the rc loader and the
|
|
396
|
+
* background refresh. When omitted, the loader derives
|
|
397
|
+
* `${XDG_CACHE_HOME:-$HOME/.cache}/<programName>` at runtime, which
|
|
398
|
+
* is the right answer for almost every CLI.
|
|
399
|
+
*/
|
|
400
|
+
cacheDir?: string;
|
|
401
|
+
/** Program version embedded in the script header. */
|
|
402
|
+
programVersion?: string;
|
|
349
403
|
}
|
|
350
404
|
/**
|
|
351
405
|
* Wrap a command with a completion subcommand
|
|
@@ -369,5 +423,5 @@ interface WithCompletionOptions {
|
|
|
369
423
|
*/
|
|
370
424
|
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
371
425
|
//#endregion
|
|
372
|
-
export {
|
|
373
|
-
//# sourceMappingURL=index-
|
|
426
|
+
export { CompletableOption as C, CompletionOptions as D, CompletionGenerator as E, CompletionResult as O, parseCompletionContext as S, CompletionData as T, CompletionCandidate as _, generateCompletion as a, CompletionContext as b, ValueCompletionField as c, extractPositionals as d, ShellFormatOptions as f, CandidateResult as g, hasCompleteCommand as h, detectShell as i, ShellType as k, resolveValueCompletion as l, createDynamicCompleteCommand as m, createCompletionCommand as n, getSupportedShells as o, formatForShell as p, createRefreshCompletionCommand as r, withCompletionCommand as s, WithCompletionOptions as t, extractCompletionData as u, CompletionDirective as v, CompletableSubcommand as w, CompletionType as x, generateCandidates as y };
|
|
427
|
+
//# sourceMappingURL=index-DR9HLxIP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DR9HLxIP.d.ts","names":[],"sources":["../src/completion/types.ts","../src/completion/dynamic/context-parser.ts","../src/completion/dynamic/candidate-generator.ts","../src/completion/dynamic/complete-command.ts","../src/completion/dynamic/shell-formatter.ts","../src/completion/extractor.ts","../src/completion/value-completion-resolver.ts","../src/completion/index.ts"],"mappings":";;;;AASA;;;AAAA,KAAY,SAAA;AAAS;AAKrB;;AALqB,UAKJ,iBAAA;EAUc;EAR7B,KAAA,EAAO,SAAA;EAAA;EAEP,WAAA;EAEA;EAAA,kBAAA;EAIA;EAFA,mBAAA;EAOA;EALA,gBAAA,GAAmB,UAAU;EAa7B;;AAAQ;AAMV;EAdE,OAAA;;EAEA,cAAA;EAcA;;;;;EARA,QAAA;AAAA;;AAiBc;AAOhB;KAlBY,eAAA;wBAEV,IAAA,yDAkBA;EAhBA,OAAA,aAuBA;EArBA,YAAA;AAAA;EAEoD,UAAA;EAAuB,OAAA;AAAA;EAkC3E,wDAhC6D,OAAA;EACzD,UAAA;AAAA;;AAiC6B;AAMnC;UAhCiB,iBAAA;;EAEf,IAAA;EAgCA;EA9BA,OAAA;EAkCA;;;;EA7BA,KAAA;EAqCkB;;AAAe;AAMnC;EAtCE,QAAA;;EAEA,mBAAA;EA8CS;EA5CT,WAAA;EA8CkC;EA5ClC,UAAA;EAkCA;EAhCA,SAAA;EAoCA;EAlCA,QAAA;EAoCa;EAlCb,eAAA,GAAkB,eAAe;AAAA;;;;UAMlB,qBAAA;EAsCA;EApCf,IAAA;;EAEA,OAAA;EAoCA;EAlCA,QAAA;EAoCA;EAlCA,WAAA;EAoCe;EAlCf,QAAA;EAkCgC;EAhChC,QAAA;EAsC+B;EApC/B,eAAA,GAAkB,e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AQ,oBAAA;AAAA,cAE/B,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;KAQlB,WAAA,GAAc,CAAA,CAAE,KAAK,QAAQ,iBAAA;;;APlDC;AAMnC;;;;;;;;;;;;iBO6DgB,uBAAA,CACd,WAAA,EAAa,UAAA,EACb,WAAA,WACA,gBAAA,GAAmB,UAAA,EACnB,KAAA;EAAS,QAAA;EAAmB,cAAA;AAAA,IAE3B,OAAA,QAAe,oBAAA,EAAsB,cAAA;;;APvDJ;AAMpC;;iBOqKgB,8BAAA,CACd,WAAA,EAAa,UAAA,EACb,WAAA,UACA,KAAA;EAAS,QAAA;EAAmB,cAAA;EAAyB,gBAAA,GAAmB,UAAA;AAAA,IAEvE,OAAA,QAAe,iBAAA,EAAmB,WAAA;;;;UAcpB,qBAAA;EP5KA;EO8Kf,WAAA;;EAEA,gBAAA,GAAmB,UAAU;EP9K7B;;;;;AAImB;EOiLnB,QAAA;EP3K6B;EO6K7B,cAAA;AAAA;;;;;;;;;;;AP1KmB;;;;AChJrB;;;;AAA0B;AAS1B;iBMwUgB,qBAAA,WAAgC,UAAA,CAAA,CAC9C,OAAA,EAAS,CAAA,EACT,OAAA,YAAmB,qBAAA,GAClB,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const require_completion = require('./completion-
|
|
4
|
-
const require_runner = require('./runner-
|
|
2
|
+
const require_subcommand_router = require('./subcommand-router-DQy0KZU-.cjs');
|
|
3
|
+
const require_completion = require('./completion-BlZxMSeU.cjs');
|
|
4
|
+
const require_runner = require('./runner-BcyR6Z8r.cjs');
|
|
5
5
|
|
|
6
6
|
exports.CaseVariantCollisionError = require_runner.CaseVariantCollisionError;
|
|
7
7
|
exports.DuplicateAliasError = require_runner.DuplicateAliasError;
|
|
8
8
|
exports.DuplicateFieldError = require_runner.DuplicateFieldError;
|
|
9
|
+
exports.DuplicateNegationError = require_runner.DuplicateNegationError;
|
|
9
10
|
exports.PositionalConfigError = require_runner.PositionalConfigError;
|
|
10
11
|
exports.ReservedAliasError = require_runner.ReservedAliasError;
|
|
11
|
-
exports.arg =
|
|
12
|
+
exports.arg = require_subcommand_router.arg;
|
|
12
13
|
exports.createDefineCommand = require_completion.createDefineCommand;
|
|
13
14
|
exports.createDualCaseProxy = require_runner.createDualCaseProxy;
|
|
14
15
|
exports.defineCommand = require_completion.defineCommand;
|
|
15
|
-
exports.extractFields =
|
|
16
|
+
exports.extractFields = require_subcommand_router.extractFields;
|
|
16
17
|
exports.formatCommandValidationErrors = require_runner.formatCommandValidationErrors;
|
|
17
18
|
exports.formatValidationErrors = require_runner.formatValidationErrors;
|
|
18
19
|
exports.generateCompletion = require_completion.generateCompletion;
|
|
19
20
|
exports.generateHelp = require_runner.generateHelp;
|
|
20
|
-
exports.getUnknownKeysMode =
|
|
21
|
+
exports.getUnknownKeysMode = require_subcommand_router.getUnknownKeysMode;
|
|
21
22
|
exports.isColorEnabled = require_runner.isColorEnabled;
|
|
22
|
-
exports.isLazyCommand =
|
|
23
|
-
exports.lazy =
|
|
23
|
+
exports.isLazyCommand = require_subcommand_router.isLazyCommand;
|
|
24
|
+
exports.lazy = require_subcommand_router.lazy;
|
|
24
25
|
exports.logger = require_runner.logger;
|
|
25
26
|
exports.parseArgv = require_runner.parseArgv;
|
|
26
27
|
exports.renderInline = require_runner.renderInline;
|
|
@@ -30,13 +31,14 @@ exports.runMain = require_runner.runMain;
|
|
|
30
31
|
exports.setColorEnabled = require_runner.setColorEnabled;
|
|
31
32
|
exports.styles = require_runner.styles;
|
|
32
33
|
exports.symbols = require_runner.symbols;
|
|
33
|
-
exports.toCamelCase =
|
|
34
|
-
exports.toKebabCase =
|
|
34
|
+
exports.toCamelCase = require_subcommand_router.toCamelCase;
|
|
35
|
+
exports.toKebabCase = require_subcommand_router.toKebabCase;
|
|
35
36
|
exports.validateCaseVariantCollisions = require_runner.validateCaseVariantCollisions;
|
|
36
37
|
exports.validateCommand = require_runner.validateCommand;
|
|
37
38
|
exports.validateCrossSchemaCollisions = require_runner.validateCrossSchemaCollisions;
|
|
38
39
|
exports.validateDuplicateAliases = require_runner.validateDuplicateAliases;
|
|
39
40
|
exports.validateDuplicateFields = require_runner.validateDuplicateFields;
|
|
41
|
+
exports.validateDuplicateNegations = require_runner.validateDuplicateNegations;
|
|
40
42
|
exports.validatePositionalConfig = require_runner.validatePositionalConfig;
|
|
41
43
|
exports.validateReservedAliases = require_runner.validateReservedAliases;
|
|
42
44
|
exports.withCompletionCommand = require_completion.withCompletionCommand;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as RunResultSuccess, B as UnknownKeysMode, C as Logger, D as RunCommandOptions, E as PromptResolver, F as LazyCommand, H as getUnknownKeysMode, I as isLazyCommand, L as lazy, M as SetupContext, N as SubCommandValue, O as RunResult, P as SubCommandsRecord, R as ExtractedFields, S as LogStream, T as NonRunnableCommand, U as toCamelCase, V as extractFields, W as toKebabCase, _ as GlobalCleanupContext, a as EffectContext, b as LogEntry, c as arg, d as CleanupContext, f as CollectedLogs, g as GlobalArgs, h as Example, i as CustomCompletion, j as RunnableCommand, k as RunResultFailure, l as AnyCommand, m as CommandBase, n as CompletionMeta, o as PromptMeta, p as Command, r as CompletionType, s as PromptType, t as ArgMeta, u as ArgsSchema, v as GlobalSetupContext, w as MainOptions, x as LogLevel, y as IsEmpty, z as ResolvedFieldMeta } from "./arg-registry-
|
|
2
|
-
import { D as
|
|
1
|
+
import { A as RunResultSuccess, B as UnknownKeysMode, C as Logger, D as RunCommandOptions, E as PromptResolver, F as LazyCommand, H as getUnknownKeysMode, I as isLazyCommand, L as lazy, M as SetupContext, N as SubCommandValue, O as RunResult, P as SubCommandsRecord, R as ExtractedFields, S as LogStream, T as NonRunnableCommand, U as toCamelCase, V as extractFields, W as toKebabCase, _ as GlobalCleanupContext, a as EffectContext, b as LogEntry, c as arg, d as CleanupContext, f as CollectedLogs, g as GlobalArgs, h as Example, i as CustomCompletion, j as RunnableCommand, k as RunResultFailure, l as AnyCommand, m as CommandBase, n as CompletionMeta, o as PromptMeta, p as Command, r as CompletionType, s as PromptType, t as ArgMeta, u as ArgsSchema, v as GlobalSetupContext, w as MainOptions, x as LogLevel, y as IsEmpty, z as ResolvedFieldMeta } from "./arg-registry-MVWOAcvw.cjs";
|
|
2
|
+
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-CPebddth.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -95,6 +95,7 @@ type ResolvedArgs<TArgsSchema, TGlobalArgs> = MergedArgs<InferArgs<TArgsSchema>,
|
|
|
95
95
|
interface DefineCommandConfig<TArgsSchema extends ArgsSchema | undefined, TResult, TGlobalArgs> {
|
|
96
96
|
name: string;
|
|
97
97
|
description?: string;
|
|
98
|
+
aliases?: string[];
|
|
98
99
|
args?: TArgsSchema;
|
|
99
100
|
subCommands?: SubCommandsRecord;
|
|
100
101
|
setup?: (context: {
|
|
@@ -235,6 +236,11 @@ declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string
|
|
|
235
236
|
* - Uses process.argv for arguments
|
|
236
237
|
* - Handles SIGINT/SIGTERM signals
|
|
237
238
|
* - Calls process.exit with the appropriate exit code
|
|
239
|
+
* - Invokes `command.runMainHook` once before parsing if set, so plug-ins
|
|
240
|
+
* like `withCompletionCommand` can fire detached background work
|
|
241
|
+
* - Bypasses user `setup`/`cleanup`/`prompt` and required `globalArgs`
|
|
242
|
+
* for registered hidden subcommands whose name starts with `__`
|
|
243
|
+
* (e.g. `__refresh-completion`)
|
|
238
244
|
*
|
|
239
245
|
* @param command - The command to run
|
|
240
246
|
* @param options - Main options (version, debug)
|
|
@@ -277,6 +283,8 @@ interface CommandContext {
|
|
|
277
283
|
rootVersion?: string | undefined;
|
|
278
284
|
/** Extracted fields from global args schema */
|
|
279
285
|
globalExtracted?: ExtractedFields | undefined;
|
|
286
|
+
/** When the command was accessed via an alias, the canonical command name */
|
|
287
|
+
aliasFor?: string | undefined;
|
|
280
288
|
}
|
|
281
289
|
/**
|
|
282
290
|
* Options for help generation
|
|
@@ -443,6 +451,18 @@ interface ParserOptions {
|
|
|
443
451
|
* boolean negation of `flag`.
|
|
444
452
|
*/
|
|
445
453
|
definedNames?: Set<string>;
|
|
454
|
+
/**
|
|
455
|
+
* Map from a custom negation CLI name (and camelCase variant) to the
|
|
456
|
+
* canonical field name. Used to recognize user-defined boolean negation
|
|
457
|
+
* options (e.g. `--disable-cache` → `{ cache: false }`).
|
|
458
|
+
*/
|
|
459
|
+
negationMap?: Map<string, string>;
|
|
460
|
+
/**
|
|
461
|
+
* Canonical field names that have a custom `negation` configured.
|
|
462
|
+
* For these fields the default `--no-<name>` / `--no<Name>` negation
|
|
463
|
+
* forms are suppressed.
|
|
464
|
+
*/
|
|
465
|
+
customNegatedFields?: Set<string>;
|
|
446
466
|
}
|
|
447
467
|
/**
|
|
448
468
|
* Parse argv into a flat record
|
|
@@ -498,6 +518,14 @@ declare class DuplicateAliasError extends Error {
|
|
|
498
518
|
declare class CaseVariantCollisionError extends Error {
|
|
499
519
|
constructor(message: string);
|
|
500
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Error thrown when a custom boolean negation name collides with another
|
|
523
|
+
* field's name, cliName, alias, or another field's negation (including
|
|
524
|
+
* derived camelCase variants).
|
|
525
|
+
*/
|
|
526
|
+
declare class DuplicateNegationError extends Error {
|
|
527
|
+
constructor(message: string);
|
|
528
|
+
}
|
|
501
529
|
//#endregion
|
|
502
530
|
//#region src/validator/command-validator.d.ts
|
|
503
531
|
/**
|
|
@@ -507,7 +535,7 @@ interface CommandValidationError {
|
|
|
507
535
|
/** Path to the command (e.g., ["cli", "build", "watch"]) */
|
|
508
536
|
commandPath: string[];
|
|
509
537
|
/** Error type */
|
|
510
|
-
type: "duplicate_field" | "duplicate_alias" | "positional_config" | "reserved_alias" | "case_variant_collision";
|
|
538
|
+
type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "case_variant_collision" | "duplicate_negation";
|
|
511
539
|
/** Error message */
|
|
512
540
|
message: string;
|
|
513
541
|
/** Related field name (if applicable) */
|
|
@@ -572,6 +600,13 @@ declare function validatePositionalConfig(extracted: ExtractedFields): void;
|
|
|
572
600
|
* @throws {ReservedAliasError} If a reserved alias is used without override flag
|
|
573
601
|
*/
|
|
574
602
|
declare function validateReservedAliases(extracted: ExtractedFields, _hasSubCommands: boolean): void;
|
|
603
|
+
/**
|
|
604
|
+
* Validate that custom boolean negation names do not collide with anything
|
|
605
|
+
*
|
|
606
|
+
* @param extracted - Extracted fields from schema
|
|
607
|
+
* @throws {DuplicateNegationError} If a colliding negation is found
|
|
608
|
+
*/
|
|
609
|
+
declare function validateDuplicateNegations(extracted: ExtractedFields): void;
|
|
575
610
|
/**
|
|
576
611
|
* Validate that no case-variant collisions exist
|
|
577
612
|
*
|
|
@@ -646,5 +681,5 @@ type ValidationResult<T> = {
|
|
|
646
681
|
*/
|
|
647
682
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
648
683
|
//#endregion
|
|
649
|
-
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, type EffectContext, type Example, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
684
|
+
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type EffectContext, type Example, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
650
685
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA,CAAU,KAAA,IACtB,KAAA,OACI,SAAA,CAAU,KAAA,MAChB,KAAA,SAAc,SAAA,CAAU,KAAA,OACnB,KAAA,GAAQ,cAAA,CAAe,IAAA,MAC1B,IAAA,wCACE,IAAA,SAAa,SAAA,CAAU,IAAA,QACjB,SAAA,CAAU,KAAA,IAAS,IAAA,GAAO,cAAA,CAAe,IAAA,SAC1C,SAAA,CAAU,KAAA,IAAS,cAAA,CAAe,IAAA,UACnC,SAAA,CAAU,KAAA,MACpB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,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EAAW,eAAe,EAC1B,eAAA;;;;;;;iBAuBc,0BAAA,CAA2B,SAA0B,EAAf,eAAe;;;;;;;iBAcrD,6BAAA,CAA8B,SAA0B,EAAf,eAAe;;;;;;AT3anE;AAAA;;iBS2bW,6BAAA,CACd,UAAA,EAAY,eAAA,EACZ,UAAA,EAAY,eAAe;;;;;;;;ATxb8C;AAU3E;;;;;;;;;;iBSujBsB,eAAA,CACpB,OAAA,EAAS,UAAA,EACT,OAAA,GAAS,sBAAA,GACR,OAAA,CAAQ,uBAAA;;;AT1jBkE;AAc7E;;;iBSolBgB,6BAAA,CAA8B,MAAgC,EAAxB,sBAAsB;;;;;;UCtpB3D,eAAA;EVQI;EUNnB,IAAA;EVMwC;EUJxC,OAAA;EVKmB;EUHnB,IAAA;EVGkC;EUDlC,QAAA;EVEE;EUAF,QAAA;AAAA;;;;KAMU,gBAAA;EACN,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EACrB,OAAA;EAAgB,MAAA,EAAQ,eAAe;AAAA;;;;iBA4C7B,sBAAA,CAAuB,MAAyB,EAAjB,eAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as RunResultSuccess, B as UnknownKeysMode, C as Logger, D as RunCommandOptions, E as PromptResolver, F as LazyCommand, H as getUnknownKeysMode, I as isLazyCommand, L as lazy, M as SetupContext, N as SubCommandValue, O as RunResult, P as SubCommandsRecord, R as ExtractedFields, S as LogStream, T as NonRunnableCommand, U as toCamelCase, V as extractFields, W as toKebabCase, _ as GlobalCleanupContext, a as EffectContext, b as LogEntry, c as arg, d as CleanupContext, f as CollectedLogs, g as GlobalArgs, h as Example, i as CustomCompletion, j as RunnableCommand, k as RunResultFailure, l as AnyCommand, m as CommandBase, n as CompletionMeta, o as PromptMeta, p as Command, r as CompletionType, s as PromptType, t as ArgMeta, u as ArgsSchema, v as GlobalSetupContext, w as MainOptions, x as LogLevel, y as IsEmpty, z as ResolvedFieldMeta } from "./arg-registry-
|
|
2
|
-
import { D as
|
|
1
|
+
import { A as RunResultSuccess, B as UnknownKeysMode, C as Logger, D as RunCommandOptions, E as PromptResolver, F as LazyCommand, H as getUnknownKeysMode, I as isLazyCommand, L as lazy, M as SetupContext, N as SubCommandValue, O as RunResult, P as SubCommandsRecord, R as ExtractedFields, S as LogStream, T as NonRunnableCommand, U as toCamelCase, V as extractFields, W as toKebabCase, _ as GlobalCleanupContext, a as EffectContext, b as LogEntry, c as arg, d as CleanupContext, f as CollectedLogs, g as GlobalArgs, h as Example, i as CustomCompletion, j as RunnableCommand, k as RunResultFailure, l as AnyCommand, m as CommandBase, n as CompletionMeta, o as PromptMeta, p as Command, r as CompletionType, s as PromptType, t as ArgMeta, u as ArgsSchema, v as GlobalSetupContext, w as MainOptions, x as LogLevel, y as IsEmpty, z as ResolvedFieldMeta } from "./arg-registry-Cd6xnjHa.js";
|
|
2
|
+
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-DR9HLxIP.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -95,6 +95,7 @@ type ResolvedArgs<TArgsSchema, TGlobalArgs> = MergedArgs<InferArgs<TArgsSchema>,
|
|
|
95
95
|
interface DefineCommandConfig<TArgsSchema extends ArgsSchema | undefined, TResult, TGlobalArgs> {
|
|
96
96
|
name: string;
|
|
97
97
|
description?: string;
|
|
98
|
+
aliases?: string[];
|
|
98
99
|
args?: TArgsSchema;
|
|
99
100
|
subCommands?: SubCommandsRecord;
|
|
100
101
|
setup?: (context: {
|
|
@@ -235,6 +236,11 @@ declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string
|
|
|
235
236
|
* - Uses process.argv for arguments
|
|
236
237
|
* - Handles SIGINT/SIGTERM signals
|
|
237
238
|
* - Calls process.exit with the appropriate exit code
|
|
239
|
+
* - Invokes `command.runMainHook` once before parsing if set, so plug-ins
|
|
240
|
+
* like `withCompletionCommand` can fire detached background work
|
|
241
|
+
* - Bypasses user `setup`/`cleanup`/`prompt` and required `globalArgs`
|
|
242
|
+
* for registered hidden subcommands whose name starts with `__`
|
|
243
|
+
* (e.g. `__refresh-completion`)
|
|
238
244
|
*
|
|
239
245
|
* @param command - The command to run
|
|
240
246
|
* @param options - Main options (version, debug)
|
|
@@ -277,6 +283,8 @@ interface CommandContext {
|
|
|
277
283
|
rootVersion?: string | undefined;
|
|
278
284
|
/** Extracted fields from global args schema */
|
|
279
285
|
globalExtracted?: ExtractedFields | undefined;
|
|
286
|
+
/** When the command was accessed via an alias, the canonical command name */
|
|
287
|
+
aliasFor?: string | undefined;
|
|
280
288
|
}
|
|
281
289
|
/**
|
|
282
290
|
* Options for help generation
|
|
@@ -443,6 +451,18 @@ interface ParserOptions {
|
|
|
443
451
|
* boolean negation of `flag`.
|
|
444
452
|
*/
|
|
445
453
|
definedNames?: Set<string>;
|
|
454
|
+
/**
|
|
455
|
+
* Map from a custom negation CLI name (and camelCase variant) to the
|
|
456
|
+
* canonical field name. Used to recognize user-defined boolean negation
|
|
457
|
+
* options (e.g. `--disable-cache` → `{ cache: false }`).
|
|
458
|
+
*/
|
|
459
|
+
negationMap?: Map<string, string>;
|
|
460
|
+
/**
|
|
461
|
+
* Canonical field names that have a custom `negation` configured.
|
|
462
|
+
* For these fields the default `--no-<name>` / `--no<Name>` negation
|
|
463
|
+
* forms are suppressed.
|
|
464
|
+
*/
|
|
465
|
+
customNegatedFields?: Set<string>;
|
|
446
466
|
}
|
|
447
467
|
/**
|
|
448
468
|
* Parse argv into a flat record
|
|
@@ -498,6 +518,14 @@ declare class DuplicateAliasError extends Error {
|
|
|
498
518
|
declare class CaseVariantCollisionError extends Error {
|
|
499
519
|
constructor(message: string);
|
|
500
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Error thrown when a custom boolean negation name collides with another
|
|
523
|
+
* field's name, cliName, alias, or another field's negation (including
|
|
524
|
+
* derived camelCase variants).
|
|
525
|
+
*/
|
|
526
|
+
declare class DuplicateNegationError extends Error {
|
|
527
|
+
constructor(message: string);
|
|
528
|
+
}
|
|
501
529
|
//#endregion
|
|
502
530
|
//#region src/validator/command-validator.d.ts
|
|
503
531
|
/**
|
|
@@ -507,7 +535,7 @@ interface CommandValidationError {
|
|
|
507
535
|
/** Path to the command (e.g., ["cli", "build", "watch"]) */
|
|
508
536
|
commandPath: string[];
|
|
509
537
|
/** Error type */
|
|
510
|
-
type: "duplicate_field" | "duplicate_alias" | "positional_config" | "reserved_alias" | "case_variant_collision";
|
|
538
|
+
type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "case_variant_collision" | "duplicate_negation";
|
|
511
539
|
/** Error message */
|
|
512
540
|
message: string;
|
|
513
541
|
/** Related field name (if applicable) */
|
|
@@ -572,6 +600,13 @@ declare function validatePositionalConfig(extracted: ExtractedFields): void;
|
|
|
572
600
|
* @throws {ReservedAliasError} If a reserved alias is used without override flag
|
|
573
601
|
*/
|
|
574
602
|
declare function validateReservedAliases(extracted: ExtractedFields, _hasSubCommands: boolean): void;
|
|
603
|
+
/**
|
|
604
|
+
* Validate that custom boolean negation names do not collide with anything
|
|
605
|
+
*
|
|
606
|
+
* @param extracted - Extracted fields from schema
|
|
607
|
+
* @throws {DuplicateNegationError} If a colliding negation is found
|
|
608
|
+
*/
|
|
609
|
+
declare function validateDuplicateNegations(extracted: ExtractedFields): void;
|
|
575
610
|
/**
|
|
576
611
|
* Validate that no case-variant collisions exist
|
|
577
612
|
*
|
|
@@ -646,5 +681,5 @@ type ValidationResult<T> = {
|
|
|
646
681
|
*/
|
|
647
682
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
648
683
|
//#endregion
|
|
649
|
-
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, type EffectContext, type Example, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
684
|
+
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type EffectContext, type Example, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
650
685
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA,CAAU,KAAA,IACtB,KAAA,OACI,SAAA,CAAU,KAAA,MAChB,KAAA,SAAc,SAAA,CAAU,KAAA,OACnB,KAAA,GAAQ,cAAA,CAAe,IAAA,MAC1B,IAAA,wCACE,IAAA,SAAa,SAAA,CAAU,IAAA,QACjB,SAAA,CAAU,KAAA,IAAS,IAAA,GAAO,cAAA,CAAe,IAAA,SAC1C,SAAA,CAAU,KAAA,IAAS,cAAA,CAAe,IAAA,UACnC,SAAA,CAAU,KAAA,MACpB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA,CAAU,KAAA,IACtB,KAAA,OACI,SAAA,CAAU,KAAA,MAChB,KAAA,SAAc,SAAA,CAAU,KAAA,OACnB,KAAA,GAAQ,cAAA,CAAe,IAAA,MAC1B,IAAA,wCACE,IAAA,SAAa,SAAA,CAAU,IAAA,QACjB,SAAA,CAAU,KAAA,IAAS,IAAA,GAAO,cAAA,CAAe,IAAA,SAC1C,SAAA,CAAU,KAAA,IAAS,cAAA,CAAe,IAAA,UACnC,SAAA,CAAU,KAAA,MACpB,CAAA;;AA3BC;AAAC;KAgCD,kBAAA,qBAAuC,CAAA,yBAA0B,CAAA,GAAI,CAAC;;;;;;;;;KAU/D,SAAA,qBAA8B,kBAAA,CAAmB,cAAA,CAAe,CAAA;;;;;;;;;;;;;KAchE,gBAAA,MAAsB,CAAA,mBAC9B,CAAA,iBACc,CAAA,IAAK,SAAA,CAAU,CAAA,aAAc,CAAA,CAAE,CAAA,oBAE/B,CAAA,IAAK,SAAA,CAAU,CAAA,aAAc,CAAA,CAAE,CAAA;;;;;;;AA9DjD;;;;;iBCFgB,mBAAA,WAA8B,MAAA,kBAAA,CAC5C,GAAA,EAAK,CAAA,GACJ,gBAAA,CAAiB,CAAA;;;;;ADApB;;KEGK,SAAA,gBAAyB,WAAA,SAAoB,C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,MAAA,EAAQ,sBAAsB;AAAA;;;;UAKjC,sBAAA;ET5BZ;ES8BH,WAAW;AAAA;;;;;;;iBAuTG,uBAAA,CAAwB,SAA0B,EAAf,eAAe;;;;;;;;;iBAkBlD,wBAAA,CAAyB,SAA0B,EAAf,eAAe;;;;;;;;;;;;;iBAoBnD,wBAAA,CAAyB,SAA0B,EAAf,eAAe;;;;;;;;;;;;;;iBAqBnD,uBAAA,CACd,SAAA,EAAW,eAAe,EAC1B,eAAA;;;;;;;iBAuBc,0BAAA,CAA2B,SAA0B,EAAf,eAAe;;;;;;;iBAcrD,6BAAA,CAA8B,SAA0B,EAAf,eAAe;;;;;;AT3anE;AAAA;;iBS2bW,6BAAA,CACd,UAAA,EAAY,eAAA,EACZ,UAAA,EAAY,eAAe;;;;;;;;ATxb8C;AAU3E;;;;;;;;;;iBSujBsB,eAAA,CACpB,OAAA,EAAS,UAAA,EACT,OAAA,GAAS,sBAAA,GACR,OAAA,CAAQ,uBAAA;;;AT1jBkE;AAc7E;;;iBSolBgB,6BAAA,CAA8B,MAAgC,EAAxB,sBAAsB;;;;;;UCtpB3D,eAAA;EVQI;EUNnB,IAAA;EVMwC;EUJxC,OAAA;EVKmB;EUHnB,IAAA;EVGkC;EUDlC,QAAA;EVEE;EUAF,QAAA;AAAA;;;;KAMU,gBAAA;EACN,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EACrB,OAAA;EAAgB,MAAA,EAAQ,eAAe;AAAA;;;;iBA4C7B,sBAAA,CAAuB,MAAyB,EAAjB,eAAe"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as renderMarkdown, D as styles, E as setColorEnabled, O as symbols, S as renderInline, T as logger, _ as DuplicateFieldError, a as parseArgv, b as ReservedAliasError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as DuplicateAliasError, h as CaseVariantCollisionError, i as formatValidationErrors, k as createDualCaseProxy, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateNegationError, w as isColorEnabled, x as generateHelp, y as PositionalConfigError } from "./runner-BHeCMEa5.js";
|
|
2
|
+
import { f as getUnknownKeysMode, h as arg, l as extractFields, m as toKebabCase, o as isLazyCommand, p as toCamelCase, s as lazy } from "./subcommand-router-XZBWe8HN.js";
|
|
3
|
+
import { _ as defineCommand, g as createDefineCommand, i as generateCompletion, o as withCompletionCommand } from "./completion-B04iiki9.js";
|
|
4
4
|
|
|
5
|
-
export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, PositionalConfigError, ReservedAliasError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
5
|
+
export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, PositionalConfigError, ReservedAliasError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|