politty 0.4.16 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{arg-registry-MVWOAcvw.d.cts → arg-registry--NRaNFJM.d.cts} +123 -3
- package/dist/arg-registry--NRaNFJM.d.cts.map +1 -0
- package/dist/{arg-registry-Cd6xnjHa.d.ts → arg-registry-6E0WHOh_.d.ts} +123 -3
- package/dist/arg-registry-6E0WHOh_.d.ts.map +1 -0
- package/dist/augment.d.cts +1 -1
- package/dist/augment.d.ts +1 -1
- package/dist/completion/index.cjs +1 -1
- package/dist/completion/index.d.cts +3 -2
- package/dist/completion/index.d.ts +3 -2
- package/dist/completion/index.js +1 -1
- package/dist/completion-BA5JMvVG.js +4067 -0
- package/dist/completion-BA5JMvVG.js.map +1 -0
- package/dist/completion-Cqs1Ja7C.cjs +4169 -0
- package/dist/completion-Cqs1Ja7C.cjs.map +1 -0
- package/dist/docs/index.cjs +9 -9
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +1 -1
- package/dist/docs/index.d.ts +1 -1
- package/dist/docs/index.js +2 -2
- package/dist/{index-CPebddth.d.cts → index-DBMfKZ34.d.ts} +135 -15
- package/dist/index-DBMfKZ34.d.ts.map +1 -0
- package/dist/{index-DR9HLxIP.d.ts → index-DJp8k5Bq.d.cts} +135 -15
- package/dist/index-DJp8k5Bq.d.cts.map +1 -0
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/prompt/clack/index.d.cts +1 -1
- package/dist/prompt/clack/index.d.ts +1 -1
- package/dist/prompt/index.d.cts +1 -1
- package/dist/prompt/index.d.ts +1 -1
- package/dist/prompt/inquirer/index.d.cts +1 -1
- package/dist/prompt/inquirer/index.d.ts +1 -1
- package/dist/{runner-BHeCMEa5.js → runner-BmSEiD9A.js} +12 -9
- package/dist/{runner-BHeCMEa5.js.map → runner-BmSEiD9A.js.map} +1 -1
- package/dist/{runner-BcyR6Z8r.cjs → runner-CRZ_7Y9i.cjs} +56 -53
- package/dist/{runner-BcyR6Z8r.cjs.map → runner-CRZ_7Y9i.cjs.map} +1 -1
- package/dist/{subcommand-router-XZBWe8HN.js → schema-extractor-C50R-1re.js} +135 -135
- package/dist/schema-extractor-C50R-1re.js.map +1 -0
- package/dist/{subcommand-router-DQy0KZU-.cjs → schema-extractor-SLPgBNgZ.cjs} +134 -134
- package/dist/schema-extractor-SLPgBNgZ.cjs.map +1 -0
- package/package.json +5 -5
- package/dist/arg-registry-Cd6xnjHa.d.ts.map +0 -1
- package/dist/arg-registry-MVWOAcvw.d.cts.map +0 -1
- package/dist/completion-B04iiki9.js +0 -2338
- package/dist/completion-B04iiki9.js.map +0 -1
- package/dist/completion-BlZxMSeU.cjs +0 -2440
- package/dist/completion-BlZxMSeU.cjs.map +0 -1
- package/dist/index-CPebddth.d.cts.map +0 -1
- package/dist/index-DR9HLxIP.d.ts.map +0 -1
- package/dist/subcommand-router-DQy0KZU-.cjs.map +0 -1
- package/dist/subcommand-router-XZBWe8HN.js.map +0 -1
package/dist/docs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Example, K as ExtractedFields, V as SubCommandValue, _ as AnyCommand, q as ResolvedFieldMeta, v as ArgsSchema } from "../arg-registry--NRaNFJM.cjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Example, K as ExtractedFields, V as SubCommandValue, _ as AnyCommand, q as ResolvedFieldMeta, v as ArgsSchema } from "../arg-registry-6E0WHOh_.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
|
package/dist/docs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as resolveLazyCommand, r as getExtractedFields, t as extractFields } from "../schema-extractor-C50R-1re.js";
|
|
2
2
|
import { t as createLogCollector } from "../log-collector-Cu6MCtAx.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as fs from "node:fs";
|
|
@@ -871,7 +871,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
|
|
|
871
871
|
collector.start();
|
|
872
872
|
let success = true;
|
|
873
873
|
try {
|
|
874
|
-
const { runCommand } = await import("../runner-
|
|
874
|
+
const { runCommand } = await import("../runner-BmSEiD9A.js").then((n) => n.r);
|
|
875
875
|
const result = await runCommand(rootCommand, argv);
|
|
876
876
|
success = result.success;
|
|
877
877
|
if (!result.success && result.error) console.error(result.error.message);
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as AnyCommand, d as ResolvedExpandCandidate, h as DynamicCompletionResolver, q as ResolvedFieldMeta, u as ExpandCompletion, v as ArgsSchema, x as Command } from "./arg-registry-6E0WHOh_.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/completion/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A single resolved entry in an "expand" lookup table.
|
|
7
|
+
*
|
|
8
|
+
* `key` is the tuple of `dependsOn` values that triggers this entry, in the
|
|
9
|
+
* same order as the originating `dependsOn` array. `candidates` is the
|
|
10
|
+
* (already deduplicated) list returned by the user's `enumerate` callback
|
|
11
|
+
* for that combination.
|
|
12
|
+
*/
|
|
13
|
+
interface ExpandTableEntry {
|
|
14
|
+
readonly key: readonly string[];
|
|
15
|
+
readonly candidates: readonly ResolvedExpandCandidate[];
|
|
16
|
+
}
|
|
5
17
|
/**
|
|
6
18
|
* Supported shell types for completion
|
|
7
19
|
*/
|
|
@@ -35,19 +47,53 @@ interface CompletionOptions {
|
|
|
35
47
|
cacheDir?: string;
|
|
36
48
|
}
|
|
37
49
|
/**
|
|
38
|
-
* Value completion specification for shell scripts
|
|
50
|
+
* Value completion specification for shell scripts.
|
|
51
|
+
*
|
|
52
|
+
* Discriminated by `type`. The `dynamic` variant carries a JS resolver that
|
|
53
|
+
* the static shell scripts delegate to via `<program> __complete`. All
|
|
54
|
+
* variants share the same optional metadata fields (left undefined where
|
|
55
|
+
* inapplicable) so consumers can read `vc.choices`/`vc.extensions`/etc.
|
|
56
|
+
* without narrowing first.
|
|
39
57
|
*/
|
|
40
|
-
type ValueCompletion = {
|
|
58
|
+
type ValueCompletion = ({
|
|
41
59
|
/** Completion type */type: "choices" | "file" | "directory" | "command" | "none"; /** List of valid choices (for "choices" type) */
|
|
42
60
|
choices?: string[]; /** Shell command for dynamic completion (for "command" type) */
|
|
43
61
|
shellCommand?: string;
|
|
62
|
+
resolve?: never;
|
|
63
|
+
dependsOn?: never;
|
|
64
|
+
table?: never;
|
|
44
65
|
} & ({
|
|
45
66
|
extensions?: string[];
|
|
46
67
|
matcher?: never;
|
|
47
68
|
} | {
|
|
48
69
|
/** Glob patterns for file matching (for "file" type) */matcher?: string[];
|
|
49
70
|
extensions?: never;
|
|
50
|
-
})
|
|
71
|
+
})) | {
|
|
72
|
+
/** In-process dynamic completion via JS callback. */type: "dynamic";
|
|
73
|
+
resolve: DynamicCompletionResolver;
|
|
74
|
+
choices?: never;
|
|
75
|
+
shellCommand?: never;
|
|
76
|
+
extensions?: never;
|
|
77
|
+
matcher?: never;
|
|
78
|
+
dependsOn?: never;
|
|
79
|
+
table?: never;
|
|
80
|
+
} | {
|
|
81
|
+
/**
|
|
82
|
+
* Pre-enumerated completion baked into the generated shell script.
|
|
83
|
+
* The `table` is the cartesian product of the `dependsOn` arg values
|
|
84
|
+
* (each having a static `choices` or enum schema). At completion time
|
|
85
|
+
* the shell dispatches on the runtime values of those args — no Node
|
|
86
|
+
* is spawned.
|
|
87
|
+
*/
|
|
88
|
+
type: "expand";
|
|
89
|
+
dependsOn: readonly string[];
|
|
90
|
+
table: readonly ExpandTableEntry[];
|
|
91
|
+
choices?: never;
|
|
92
|
+
shellCommand?: never;
|
|
93
|
+
resolve?: never;
|
|
94
|
+
extensions?: never;
|
|
95
|
+
matcher?: never;
|
|
96
|
+
};
|
|
51
97
|
/**
|
|
52
98
|
* Information about a completable option
|
|
53
99
|
*/
|
|
@@ -68,8 +114,24 @@ interface CompletableOption {
|
|
|
68
114
|
negation?: string | undefined;
|
|
69
115
|
/** Description for the negation option (when distinct from the main description) */
|
|
70
116
|
negationDescription?: string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the runtime parser accepts the implicit `--no-<cliName>` (and
|
|
119
|
+
* camelCase) form for this boolean option. False when the user set
|
|
120
|
+
* `negation: false` (suppressed) or `negation: <custom name>` (only the
|
|
121
|
+
* custom name is accepted). Used by the completion context parser so
|
|
122
|
+
* dynamic resolvers see the same `parsedArgs` state the runtime would
|
|
123
|
+
* compute.
|
|
124
|
+
*/
|
|
125
|
+
defaultNegationAccepted?: boolean;
|
|
71
126
|
/** Description for completion */
|
|
72
127
|
description?: string | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* True when this option originates from a `globalArgsSchema` and was
|
|
130
|
+
* propagated into every subcommand frame. The runtime parser keeps
|
|
131
|
+
* global values visible across subcommand descent, so shell generators
|
|
132
|
+
* must keep their tracker buckets separate from per-frame state.
|
|
133
|
+
*/
|
|
134
|
+
isGlobal?: boolean;
|
|
73
135
|
/** Whether this option takes a value */
|
|
74
136
|
takesValue: boolean;
|
|
75
137
|
/** Type of value expected */
|
|
@@ -175,15 +237,31 @@ interface CompletionContext {
|
|
|
175
237
|
usedOptions: Set<string>;
|
|
176
238
|
/** Number of positional arguments already provided */
|
|
177
239
|
providedPositionalCount: number;
|
|
240
|
+
/**
|
|
241
|
+
* Best-effort parsed values for the CURRENT command, keyed by camelCase
|
|
242
|
+
* field name. Includes positionals (single value or string[] for variadic
|
|
243
|
+
* positionals) and options (string for scalars, string[] for array
|
|
244
|
+
* options). Zod validation is NOT applied — values are raw strings.
|
|
245
|
+
*/
|
|
246
|
+
parsedArgs: Record<string, unknown>;
|
|
247
|
+
/**
|
|
248
|
+
* Values already supplied for the option/positional currently being
|
|
249
|
+
* completed (for de-duplicating array options and oneof exclusivity in
|
|
250
|
+
* dynamic resolvers).
|
|
251
|
+
*/
|
|
252
|
+
previousValues: string[];
|
|
178
253
|
}
|
|
179
254
|
/**
|
|
180
255
|
* Parse completion context from command line arguments
|
|
181
256
|
*
|
|
182
257
|
* @param argv - Arguments after the program name (e.g., ["build", "--fo"])
|
|
183
258
|
* @param rootCommand - The root command
|
|
259
|
+
* @param globalArgsSchema - Optional global args. When provided, options
|
|
260
|
+
* derived from this schema are merged into every command level so dynamic
|
|
261
|
+
* resolvers attached to global options can be reached from any subcommand.
|
|
184
262
|
* @returns Completion context
|
|
185
263
|
*/
|
|
186
|
-
declare function parseCompletionContext(argv: string[], rootCommand: AnyCommand): CompletionContext;
|
|
264
|
+
declare function parseCompletionContext(argv: string[], rootCommand: AnyCommand, globalArgsSchema?: ArgsSchema): CompletionContext;
|
|
187
265
|
//#endregion
|
|
188
266
|
//#region src/completion/dynamic/candidate-generator.d.ts
|
|
189
267
|
/**
|
|
@@ -224,9 +302,27 @@ interface CandidateResult {
|
|
|
224
302
|
fileMatchers?: string[] | undefined;
|
|
225
303
|
}
|
|
226
304
|
/**
|
|
227
|
-
*
|
|
305
|
+
* Options for candidate generation.
|
|
306
|
+
*/
|
|
307
|
+
interface GenerateCandidatesOptions {
|
|
308
|
+
/**
|
|
309
|
+
* Target shell. Forwarded to dynamic resolvers so they can vary output
|
|
310
|
+
* (e.g. include descriptions only for shells that render them).
|
|
311
|
+
*/
|
|
312
|
+
shell: ShellType;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Generate completion candidates based on context.
|
|
316
|
+
*
|
|
317
|
+
* Async because dynamic resolvers may return promises. Sync completion
|
|
318
|
+
* sources (choices/file/directory/command/none, subcommand, option name)
|
|
319
|
+
* still resolve synchronously and the await is a no-op for them.
|
|
320
|
+
*
|
|
321
|
+
* Inline option-value prefixes (`--field=foo`) on the option-value path
|
|
322
|
+
* are stripped here so resolvers and post-processing always see the
|
|
323
|
+
* value portion regardless of whether the caller pre-normalized.
|
|
228
324
|
*/
|
|
229
|
-
declare function generateCandidates(context: CompletionContext): CandidateResult
|
|
325
|
+
declare function generateCandidates(context: CompletionContext, options: GenerateCandidatesOptions): Promise<CandidateResult>;
|
|
230
326
|
//#endregion
|
|
231
327
|
//#region src/completion/dynamic/complete-command.d.ts
|
|
232
328
|
/**
|
|
@@ -246,9 +342,12 @@ type CompleteArgs = z.infer<typeof completeArgsSchema>;
|
|
|
246
342
|
*
|
|
247
343
|
* @param rootCommand - The root command to generate completions for
|
|
248
344
|
* @param programName - The program name (optional, defaults to rootCommand.name)
|
|
345
|
+
* @param globalArgsSchema - Global args schema. Forwarded to
|
|
346
|
+
* `parseCompletionContext` so resolvers attached to global options remain
|
|
347
|
+
* reachable at every subcommand level.
|
|
249
348
|
* @returns A command that outputs completion candidates
|
|
250
349
|
*/
|
|
251
|
-
declare function createDynamicCompleteCommand(rootCommand: AnyCommand, _programName?: string): Command<typeof completeArgsSchema, CompleteArgs, any>;
|
|
350
|
+
declare function createDynamicCompleteCommand(rootCommand: AnyCommand, _programName?: string, globalArgsSchema?: ArgsSchema): Command<typeof completeArgsSchema, CompleteArgs, any>;
|
|
252
351
|
/**
|
|
253
352
|
* Check if a command tree contains the __complete command
|
|
254
353
|
*/
|
|
@@ -289,6 +388,18 @@ declare function extractPositionals(command: AnyCommand): ResolvedFieldMeta[];
|
|
|
289
388
|
declare function extractCompletionData(command: AnyCommand, programName: string, globalArgsSchema?: ArgsSchema): CompletionData;
|
|
290
389
|
//#endregion
|
|
291
390
|
//#region src/completion/value-completion-resolver.d.ts
|
|
391
|
+
/**
|
|
392
|
+
* Sentinel returned when a field uses `completion.custom.expand`. The static
|
|
393
|
+
* extractor recognises this and replaces it with a fully resolved
|
|
394
|
+
* `{ type: "expand", ... }` ValueCompletion after sibling args' static
|
|
395
|
+
* values are known. Internal: never assigned onto `CompletableOption` /
|
|
396
|
+
* `CompletablePositional` directly; callers stash it in a side map keyed by
|
|
397
|
+
* field name and patch the resolved spec in afterwards.
|
|
398
|
+
*/
|
|
399
|
+
interface PendingExpandValueCompletion {
|
|
400
|
+
type: "pending-expand";
|
|
401
|
+
spec: ExpandCompletion;
|
|
402
|
+
}
|
|
292
403
|
/**
|
|
293
404
|
* Minimal field interface needed for resolving value completion.
|
|
294
405
|
* Both ResolvedFieldMeta and inline context-parser types satisfy this.
|
|
@@ -299,6 +410,8 @@ interface ValueCompletionField {
|
|
|
299
410
|
custom?: {
|
|
300
411
|
choices?: string[];
|
|
301
412
|
shellCommand?: string;
|
|
413
|
+
resolve?: DynamicCompletionResolver;
|
|
414
|
+
expand?: ExpandCompletion;
|
|
302
415
|
};
|
|
303
416
|
} & ({
|
|
304
417
|
extensions?: string[];
|
|
@@ -308,16 +421,23 @@ interface ValueCompletionField {
|
|
|
308
421
|
extensions?: never;
|
|
309
422
|
})) | undefined;
|
|
310
423
|
enumValues?: string[] | undefined;
|
|
424
|
+
/** Field name surfaced in error messages when custom variants are mixed. */
|
|
425
|
+
name?: string;
|
|
311
426
|
}
|
|
312
427
|
/**
|
|
313
|
-
* Resolve value completion from field metadata
|
|
428
|
+
* Resolve value completion from field metadata.
|
|
429
|
+
*
|
|
430
|
+
* Priority (within `custom`): `expand` > `resolve` > `choices` > `shellCommand`.
|
|
431
|
+
* Specifying more than one of these on the same field throws so the
|
|
432
|
+
* misconfiguration surfaces at command-definition time rather than at
|
|
433
|
+
* completion time. The `expand` variant returns a sentinel — the extractor
|
|
434
|
+
* resolves it against sibling fields and replaces the sentinel with a
|
|
435
|
+
* `{ type: "expand", table, dependsOn }` entry.
|
|
314
436
|
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* 2. Explicit completion type (file, directory, none)
|
|
318
|
-
* 3. Auto-detected enum values from schema
|
|
437
|
+
* Outside `custom`: explicit `type` (file/directory/none) > auto-detected
|
|
438
|
+
* enum values from the schema.
|
|
319
439
|
*/
|
|
320
|
-
declare function resolveValueCompletion(field: ValueCompletionField): ValueCompletion | undefined;
|
|
440
|
+
declare function resolveValueCompletion(field: ValueCompletionField): ValueCompletion | PendingExpandValueCompletion | undefined;
|
|
321
441
|
//#endregion
|
|
322
442
|
//#region src/completion/index.d.ts
|
|
323
443
|
/**
|
|
@@ -424,4 +544,4 @@ interface WithCompletionOptions {
|
|
|
424
544
|
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
425
545
|
//#endregion
|
|
426
546
|
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-
|
|
547
|
+
//# sourceMappingURL=index-DBMfKZ34.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DBMfKZ34.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":";;;;;;;;;;AAkBuD;AAMvD;UARiB,gBAAA;EAAA,SACN,GAAA;EAAA,SACA,UAAA,WAAqB,uBAAuB;AAAA;AAWvD;;;AAAA,KALY,SAAA;;;;UAKK,iBAAA;EAQf;EAN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,UAAA,EACT,OAAA,EAAS,iBAAA,GACR,gBAAA;;;;iBAgBa,kBAAA,CAAA,GAAsB,SAAS;;;;iBAO/B,WAAA,CAAA,GAAe,SAAS;;;;cAoBlC,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;KA0BrB,cAAA,GAAiB,CAAA,CAAE,KAAK,QAAQ,oBAAA;AAAA,cAE/B,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;KAQlB,WAAA,GAAc,CAAA,CAAE,KAAK,QAAQ,iBAAA;APxDrB;AAMb;;;;;;;;;;;;;;AANa,iBOyEG,uBAAA,CACd,WAAA,EAAa,UAAA,EACb,WAAA,WACA,gBAAA,GAAmB,UAAA,EACnB,KAAA;EAAS,QAAA;EAAmB,cAAA;AAAA,IAE3B,OAAA,QAAe,oBAAA,EAAsB,cAAA;AP/BL;AAMnC;;;;AANmC,iBOmJnB,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;EPlJkB;EOoJjC,WAAA;EP9IoC;EOgJpC,gBAAA,GAAmB,UAAU;EPxIhB;;;;;;EO+Ib,QAAA;EPjJA;EOmJA,cAAA;AAAA;;;;;;AP7IkC;AAMpC;;;;;;;;;;AAMkC;AAMlC;;;iBOkJgB,qBAAA,WAAgC,UAAA,CAAA,CAC9C,OAAA,EAAS,CAAA,EACT,OAAA,YAAmB,qBAAA,GAClB,CAAA"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as AnyCommand, d as ResolvedExpandCandidate, h as DynamicCompletionResolver, q as ResolvedFieldMeta, u as ExpandCompletion, v as ArgsSchema, x as Command } from "./arg-registry--NRaNFJM.cjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/completion/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A single resolved entry in an "expand" lookup table.
|
|
7
|
+
*
|
|
8
|
+
* `key` is the tuple of `dependsOn` values that triggers this entry, in the
|
|
9
|
+
* same order as the originating `dependsOn` array. `candidates` is the
|
|
10
|
+
* (already deduplicated) list returned by the user's `enumerate` callback
|
|
11
|
+
* for that combination.
|
|
12
|
+
*/
|
|
13
|
+
interface ExpandTableEntry {
|
|
14
|
+
readonly key: readonly string[];
|
|
15
|
+
readonly candidates: readonly ResolvedExpandCandidate[];
|
|
16
|
+
}
|
|
5
17
|
/**
|
|
6
18
|
* Supported shell types for completion
|
|
7
19
|
*/
|
|
@@ -35,19 +47,53 @@ interface CompletionOptions {
|
|
|
35
47
|
cacheDir?: string;
|
|
36
48
|
}
|
|
37
49
|
/**
|
|
38
|
-
* Value completion specification for shell scripts
|
|
50
|
+
* Value completion specification for shell scripts.
|
|
51
|
+
*
|
|
52
|
+
* Discriminated by `type`. The `dynamic` variant carries a JS resolver that
|
|
53
|
+
* the static shell scripts delegate to via `<program> __complete`. All
|
|
54
|
+
* variants share the same optional metadata fields (left undefined where
|
|
55
|
+
* inapplicable) so consumers can read `vc.choices`/`vc.extensions`/etc.
|
|
56
|
+
* without narrowing first.
|
|
39
57
|
*/
|
|
40
|
-
type ValueCompletion = {
|
|
58
|
+
type ValueCompletion = ({
|
|
41
59
|
/** Completion type */type: "choices" | "file" | "directory" | "command" | "none"; /** List of valid choices (for "choices" type) */
|
|
42
60
|
choices?: string[]; /** Shell command for dynamic completion (for "command" type) */
|
|
43
61
|
shellCommand?: string;
|
|
62
|
+
resolve?: never;
|
|
63
|
+
dependsOn?: never;
|
|
64
|
+
table?: never;
|
|
44
65
|
} & ({
|
|
45
66
|
extensions?: string[];
|
|
46
67
|
matcher?: never;
|
|
47
68
|
} | {
|
|
48
69
|
/** Glob patterns for file matching (for "file" type) */matcher?: string[];
|
|
49
70
|
extensions?: never;
|
|
50
|
-
})
|
|
71
|
+
})) | {
|
|
72
|
+
/** In-process dynamic completion via JS callback. */type: "dynamic";
|
|
73
|
+
resolve: DynamicCompletionResolver;
|
|
74
|
+
choices?: never;
|
|
75
|
+
shellCommand?: never;
|
|
76
|
+
extensions?: never;
|
|
77
|
+
matcher?: never;
|
|
78
|
+
dependsOn?: never;
|
|
79
|
+
table?: never;
|
|
80
|
+
} | {
|
|
81
|
+
/**
|
|
82
|
+
* Pre-enumerated completion baked into the generated shell script.
|
|
83
|
+
* The `table` is the cartesian product of the `dependsOn` arg values
|
|
84
|
+
* (each having a static `choices` or enum schema). At completion time
|
|
85
|
+
* the shell dispatches on the runtime values of those args — no Node
|
|
86
|
+
* is spawned.
|
|
87
|
+
*/
|
|
88
|
+
type: "expand";
|
|
89
|
+
dependsOn: readonly string[];
|
|
90
|
+
table: readonly ExpandTableEntry[];
|
|
91
|
+
choices?: never;
|
|
92
|
+
shellCommand?: never;
|
|
93
|
+
resolve?: never;
|
|
94
|
+
extensions?: never;
|
|
95
|
+
matcher?: never;
|
|
96
|
+
};
|
|
51
97
|
/**
|
|
52
98
|
* Information about a completable option
|
|
53
99
|
*/
|
|
@@ -68,8 +114,24 @@ interface CompletableOption {
|
|
|
68
114
|
negation?: string | undefined;
|
|
69
115
|
/** Description for the negation option (when distinct from the main description) */
|
|
70
116
|
negationDescription?: string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the runtime parser accepts the implicit `--no-<cliName>` (and
|
|
119
|
+
* camelCase) form for this boolean option. False when the user set
|
|
120
|
+
* `negation: false` (suppressed) or `negation: <custom name>` (only the
|
|
121
|
+
* custom name is accepted). Used by the completion context parser so
|
|
122
|
+
* dynamic resolvers see the same `parsedArgs` state the runtime would
|
|
123
|
+
* compute.
|
|
124
|
+
*/
|
|
125
|
+
defaultNegationAccepted?: boolean;
|
|
71
126
|
/** Description for completion */
|
|
72
127
|
description?: string | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* True when this option originates from a `globalArgsSchema` and was
|
|
130
|
+
* propagated into every subcommand frame. The runtime parser keeps
|
|
131
|
+
* global values visible across subcommand descent, so shell generators
|
|
132
|
+
* must keep their tracker buckets separate from per-frame state.
|
|
133
|
+
*/
|
|
134
|
+
isGlobal?: boolean;
|
|
73
135
|
/** Whether this option takes a value */
|
|
74
136
|
takesValue: boolean;
|
|
75
137
|
/** Type of value expected */
|
|
@@ -175,15 +237,31 @@ interface CompletionContext {
|
|
|
175
237
|
usedOptions: Set<string>;
|
|
176
238
|
/** Number of positional arguments already provided */
|
|
177
239
|
providedPositionalCount: number;
|
|
240
|
+
/**
|
|
241
|
+
* Best-effort parsed values for the CURRENT command, keyed by camelCase
|
|
242
|
+
* field name. Includes positionals (single value or string[] for variadic
|
|
243
|
+
* positionals) and options (string for scalars, string[] for array
|
|
244
|
+
* options). Zod validation is NOT applied — values are raw strings.
|
|
245
|
+
*/
|
|
246
|
+
parsedArgs: Record<string, unknown>;
|
|
247
|
+
/**
|
|
248
|
+
* Values already supplied for the option/positional currently being
|
|
249
|
+
* completed (for de-duplicating array options and oneof exclusivity in
|
|
250
|
+
* dynamic resolvers).
|
|
251
|
+
*/
|
|
252
|
+
previousValues: string[];
|
|
178
253
|
}
|
|
179
254
|
/**
|
|
180
255
|
* Parse completion context from command line arguments
|
|
181
256
|
*
|
|
182
257
|
* @param argv - Arguments after the program name (e.g., ["build", "--fo"])
|
|
183
258
|
* @param rootCommand - The root command
|
|
259
|
+
* @param globalArgsSchema - Optional global args. When provided, options
|
|
260
|
+
* derived from this schema are merged into every command level so dynamic
|
|
261
|
+
* resolvers attached to global options can be reached from any subcommand.
|
|
184
262
|
* @returns Completion context
|
|
185
263
|
*/
|
|
186
|
-
declare function parseCompletionContext(argv: string[], rootCommand: AnyCommand): CompletionContext;
|
|
264
|
+
declare function parseCompletionContext(argv: string[], rootCommand: AnyCommand, globalArgsSchema?: ArgsSchema): CompletionContext;
|
|
187
265
|
//#endregion
|
|
188
266
|
//#region src/completion/dynamic/candidate-generator.d.ts
|
|
189
267
|
/**
|
|
@@ -224,9 +302,27 @@ interface CandidateResult {
|
|
|
224
302
|
fileMatchers?: string[] | undefined;
|
|
225
303
|
}
|
|
226
304
|
/**
|
|
227
|
-
*
|
|
305
|
+
* Options for candidate generation.
|
|
306
|
+
*/
|
|
307
|
+
interface GenerateCandidatesOptions {
|
|
308
|
+
/**
|
|
309
|
+
* Target shell. Forwarded to dynamic resolvers so they can vary output
|
|
310
|
+
* (e.g. include descriptions only for shells that render them).
|
|
311
|
+
*/
|
|
312
|
+
shell: ShellType;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Generate completion candidates based on context.
|
|
316
|
+
*
|
|
317
|
+
* Async because dynamic resolvers may return promises. Sync completion
|
|
318
|
+
* sources (choices/file/directory/command/none, subcommand, option name)
|
|
319
|
+
* still resolve synchronously and the await is a no-op for them.
|
|
320
|
+
*
|
|
321
|
+
* Inline option-value prefixes (`--field=foo`) on the option-value path
|
|
322
|
+
* are stripped here so resolvers and post-processing always see the
|
|
323
|
+
* value portion regardless of whether the caller pre-normalized.
|
|
228
324
|
*/
|
|
229
|
-
declare function generateCandidates(context: CompletionContext): CandidateResult
|
|
325
|
+
declare function generateCandidates(context: CompletionContext, options: GenerateCandidatesOptions): Promise<CandidateResult>;
|
|
230
326
|
//#endregion
|
|
231
327
|
//#region src/completion/dynamic/complete-command.d.ts
|
|
232
328
|
/**
|
|
@@ -246,9 +342,12 @@ type CompleteArgs = z.infer<typeof completeArgsSchema>;
|
|
|
246
342
|
*
|
|
247
343
|
* @param rootCommand - The root command to generate completions for
|
|
248
344
|
* @param programName - The program name (optional, defaults to rootCommand.name)
|
|
345
|
+
* @param globalArgsSchema - Global args schema. Forwarded to
|
|
346
|
+
* `parseCompletionContext` so resolvers attached to global options remain
|
|
347
|
+
* reachable at every subcommand level.
|
|
249
348
|
* @returns A command that outputs completion candidates
|
|
250
349
|
*/
|
|
251
|
-
declare function createDynamicCompleteCommand(rootCommand: AnyCommand, _programName?: string): Command<typeof completeArgsSchema, CompleteArgs, any>;
|
|
350
|
+
declare function createDynamicCompleteCommand(rootCommand: AnyCommand, _programName?: string, globalArgsSchema?: ArgsSchema): Command<typeof completeArgsSchema, CompleteArgs, any>;
|
|
252
351
|
/**
|
|
253
352
|
* Check if a command tree contains the __complete command
|
|
254
353
|
*/
|
|
@@ -289,6 +388,18 @@ declare function extractPositionals(command: AnyCommand): ResolvedFieldMeta[];
|
|
|
289
388
|
declare function extractCompletionData(command: AnyCommand, programName: string, globalArgsSchema?: ArgsSchema): CompletionData;
|
|
290
389
|
//#endregion
|
|
291
390
|
//#region src/completion/value-completion-resolver.d.ts
|
|
391
|
+
/**
|
|
392
|
+
* Sentinel returned when a field uses `completion.custom.expand`. The static
|
|
393
|
+
* extractor recognises this and replaces it with a fully resolved
|
|
394
|
+
* `{ type: "expand", ... }` ValueCompletion after sibling args' static
|
|
395
|
+
* values are known. Internal: never assigned onto `CompletableOption` /
|
|
396
|
+
* `CompletablePositional` directly; callers stash it in a side map keyed by
|
|
397
|
+
* field name and patch the resolved spec in afterwards.
|
|
398
|
+
*/
|
|
399
|
+
interface PendingExpandValueCompletion {
|
|
400
|
+
type: "pending-expand";
|
|
401
|
+
spec: ExpandCompletion;
|
|
402
|
+
}
|
|
292
403
|
/**
|
|
293
404
|
* Minimal field interface needed for resolving value completion.
|
|
294
405
|
* Both ResolvedFieldMeta and inline context-parser types satisfy this.
|
|
@@ -299,6 +410,8 @@ interface ValueCompletionField {
|
|
|
299
410
|
custom?: {
|
|
300
411
|
choices?: string[];
|
|
301
412
|
shellCommand?: string;
|
|
413
|
+
resolve?: DynamicCompletionResolver;
|
|
414
|
+
expand?: ExpandCompletion;
|
|
302
415
|
};
|
|
303
416
|
} & ({
|
|
304
417
|
extensions?: string[];
|
|
@@ -308,16 +421,23 @@ interface ValueCompletionField {
|
|
|
308
421
|
extensions?: never;
|
|
309
422
|
})) | undefined;
|
|
310
423
|
enumValues?: string[] | undefined;
|
|
424
|
+
/** Field name surfaced in error messages when custom variants are mixed. */
|
|
425
|
+
name?: string;
|
|
311
426
|
}
|
|
312
427
|
/**
|
|
313
|
-
* Resolve value completion from field metadata
|
|
428
|
+
* Resolve value completion from field metadata.
|
|
429
|
+
*
|
|
430
|
+
* Priority (within `custom`): `expand` > `resolve` > `choices` > `shellCommand`.
|
|
431
|
+
* Specifying more than one of these on the same field throws so the
|
|
432
|
+
* misconfiguration surfaces at command-definition time rather than at
|
|
433
|
+
* completion time. The `expand` variant returns a sentinel — the extractor
|
|
434
|
+
* resolves it against sibling fields and replaces the sentinel with a
|
|
435
|
+
* `{ type: "expand", table, dependsOn }` entry.
|
|
314
436
|
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* 2. Explicit completion type (file, directory, none)
|
|
318
|
-
* 3. Auto-detected enum values from schema
|
|
437
|
+
* Outside `custom`: explicit `type` (file/directory/none) > auto-detected
|
|
438
|
+
* enum values from the schema.
|
|
319
439
|
*/
|
|
320
|
-
declare function resolveValueCompletion(field: ValueCompletionField): ValueCompletion | undefined;
|
|
440
|
+
declare function resolveValueCompletion(field: ValueCompletionField): ValueCompletion | PendingExpandValueCompletion | undefined;
|
|
321
441
|
//#endregion
|
|
322
442
|
//#region src/completion/index.d.ts
|
|
323
443
|
/**
|
|
@@ -424,4 +544,4 @@ interface WithCompletionOptions {
|
|
|
424
544
|
declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
|
|
425
545
|
//#endregion
|
|
426
546
|
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-
|
|
547
|
+
//# sourceMappingURL=index-DJp8k5Bq.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DJp8k5Bq.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":";;;;;;;;;;AAkBuD;AAMvD;UARiB,gBAAA;EAAA,SACN,GAAA;EAAA,SACA,UAAA,WAAqB,uBAAuB;AAAA;AAWvD;;;AAAA,KALY,SAAA;;;;UAKK,iBAAA;EAQf;EANA,KAAA,EAAO,SAAA;EAQY;EANnB,WAAA;EAaA;EAXA,kBAAA;EAiBQ;EAfR,mBAAA;EA2BU;EAzBV,gBAAA,GAAmB,UAAU;;;;;EAK7B,OAAA;EA4BI;EA1BJ,cAAA;EA4BI;;;;;EAtBJ,QAAA;AAAA;;;;;;;;;;KAYU,eAAA;EAuCU,sBApChB,IAAA,yDAsCA;EApCA,OAAA,aAsCA;EApCA,YAAA;EACA,OAAA;EACA,SAAA;EACA,KAAA;AAAA;EAEoD,UAAA;EAAuB,OAAA;AAAA;EA0C/E,wDAxCiE,OAAA;EACzD,UAAA;AAAA;EAmDR,qDA9CI,IAAA;EACA,OAAA,EAAS,yBAAA;EACT,OAAA;EACA,YAAA;EACA,UAAA;EACA,OAAA;EACA,SAAA;EACA,KAAA;AAAA;EAiE6B;AAMnC;;;;;;EA7DM,IAAA;EACA,SAAA;EACA,KAAA,WAAgB,gBAAgB;EAChC,OAAA;EACA,YAAA;EACA,OAAA;EACA,UAAA;EACA,OAAA;AAAA;;;;UAMW,iBAAA;EAgFF;EA9Eb,IAAA;EA8EkC;EA5ElC,OAAA;EAoEA;;;;EA/DA,KAAA;EA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AAA;EPlJkB;EOoJjC,WAAA;EP9IoC;EOgJpC,gBAAA,GAAmB,UAAU;EPxIhB;;;;;;EO+Ib,QAAA;EPjJA;EOmJA,cAAA;AAAA;;;;;;AP7IkC;AAMpC;;;;;;;;;;AAMkC;AAMlC;;;iBOkJgB,qBAAA,WAAgC,UAAA,CAAA,CAC9C,OAAA,EAAS,CAAA,EACT,OAAA,YAAmB,qBAAA,GAClB,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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_schema_extractor = require('./schema-extractor-SLPgBNgZ.cjs');
|
|
3
|
+
const require_completion = require('./completion-Cqs1Ja7C.cjs');
|
|
4
|
+
const require_runner = require('./runner-CRZ_7Y9i.cjs');
|
|
5
5
|
|
|
6
6
|
exports.CaseVariantCollisionError = require_runner.CaseVariantCollisionError;
|
|
7
7
|
exports.DuplicateAliasError = require_runner.DuplicateAliasError;
|
|
@@ -9,19 +9,19 @@ exports.DuplicateFieldError = require_runner.DuplicateFieldError;
|
|
|
9
9
|
exports.DuplicateNegationError = require_runner.DuplicateNegationError;
|
|
10
10
|
exports.PositionalConfigError = require_runner.PositionalConfigError;
|
|
11
11
|
exports.ReservedAliasError = require_runner.ReservedAliasError;
|
|
12
|
-
exports.arg =
|
|
12
|
+
exports.arg = require_schema_extractor.arg;
|
|
13
13
|
exports.createDefineCommand = require_completion.createDefineCommand;
|
|
14
14
|
exports.createDualCaseProxy = require_runner.createDualCaseProxy;
|
|
15
15
|
exports.defineCommand = require_completion.defineCommand;
|
|
16
|
-
exports.extractFields =
|
|
16
|
+
exports.extractFields = require_schema_extractor.extractFields;
|
|
17
17
|
exports.formatCommandValidationErrors = require_runner.formatCommandValidationErrors;
|
|
18
18
|
exports.formatValidationErrors = require_runner.formatValidationErrors;
|
|
19
19
|
exports.generateCompletion = require_completion.generateCompletion;
|
|
20
20
|
exports.generateHelp = require_runner.generateHelp;
|
|
21
|
-
exports.getUnknownKeysMode =
|
|
21
|
+
exports.getUnknownKeysMode = require_schema_extractor.getUnknownKeysMode;
|
|
22
22
|
exports.isColorEnabled = require_runner.isColorEnabled;
|
|
23
|
-
exports.isLazyCommand =
|
|
24
|
-
exports.lazy =
|
|
23
|
+
exports.isLazyCommand = require_schema_extractor.isLazyCommand;
|
|
24
|
+
exports.lazy = require_schema_extractor.lazy;
|
|
25
25
|
exports.logger = require_runner.logger;
|
|
26
26
|
exports.parseArgv = require_runner.parseArgv;
|
|
27
27
|
exports.renderInline = require_runner.renderInline;
|
|
@@ -31,8 +31,8 @@ exports.runMain = require_runner.runMain;
|
|
|
31
31
|
exports.setColorEnabled = require_runner.setColorEnabled;
|
|
32
32
|
exports.styles = require_runner.styles;
|
|
33
33
|
exports.symbols = require_runner.symbols;
|
|
34
|
-
exports.toCamelCase =
|
|
35
|
-
exports.toKebabCase =
|
|
34
|
+
exports.toCamelCase = require_schema_extractor.toCamelCase;
|
|
35
|
+
exports.toKebabCase = require_schema_extractor.toKebabCase;
|
|
36
36
|
exports.validateCaseVariantCollisions = require_runner.validateCaseVariantCollisions;
|
|
37
37
|
exports.validateCommand = require_runner.validateCommand;
|
|
38
38
|
exports.validateCrossSchemaCollisions = require_runner.validateCrossSchemaCollisions;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-
|
|
1
|
+
import { A as LogStream, B as SetupContext, C as Example, D as IsEmpty, E as GlobalSetupContext, F as RunCommandOptions, G as lazy, H as SubCommandsRecord, I as RunResult, J as UnknownKeysMode, K as ExtractedFields, L as RunResultFailure, M as MainOptions, N as NonRunnableCommand, O as LogEntry, P as PromptResolver, Q as toKebabCase, R as RunResultSuccess, S as CommandBase, T as GlobalCleanupContext, U as LazyCommand, V as SubCommandValue, W as isLazyCommand, X as getUnknownKeysMode, Y as extractFields, Z as toCamelCase, _ as AnyCommand, a as EffectContext, b as CollectedLogs, c as arg, d as ResolvedExpandCandidate, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as Logger, k as LogLevel, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as ResolvedFieldMeta, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgsSchema, w as GlobalArgs, x as Command, y as CleanupContext, z as RunnableCommand } from "./arg-registry--NRaNFJM.cjs";
|
|
2
|
+
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-DJp8k5Bq.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -681,5 +681,5 @@ type ValidationResult<T> = {
|
|
|
681
681
|
*/
|
|
682
682
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
683
683
|
//#endregion
|
|
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 };
|
|
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 CompletionDirectiveMask, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type EffectContext, type Example, type ExpandCandidate, type ExpandCompletion, 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 ResolvedExpandCandidate, 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 };
|
|
685
685
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-
|
|
1
|
+
import { A as LogStream, B as SetupContext, C as Example, D as IsEmpty, E as GlobalSetupContext, F as RunCommandOptions, G as lazy, H as SubCommandsRecord, I as RunResult, J as UnknownKeysMode, K as ExtractedFields, L as RunResultFailure, M as MainOptions, N as NonRunnableCommand, O as LogEntry, P as PromptResolver, Q as toKebabCase, R as RunResultSuccess, S as CommandBase, T as GlobalCleanupContext, U as LazyCommand, V as SubCommandValue, W as isLazyCommand, X as getUnknownKeysMode, Y as extractFields, Z as toCamelCase, _ as AnyCommand, a as EffectContext, b as CollectedLogs, c as arg, d as ResolvedExpandCandidate, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as Logger, k as LogLevel, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as ResolvedFieldMeta, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgsSchema, w as GlobalArgs, x as Command, y as CleanupContext, z as RunnableCommand } from "./arg-registry-6E0WHOh_.js";
|
|
2
|
+
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-DBMfKZ34.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -681,5 +681,5 @@ type ValidationResult<T> = {
|
|
|
681
681
|
*/
|
|
682
682
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
683
683
|
//#endregion
|
|
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 };
|
|
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 CompletionDirectiveMask, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type EffectContext, type Example, type ExpandCandidate, type ExpandCompletion, 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 ResolvedExpandCandidate, 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 };
|
|
685
685
|
//# sourceMappingURL=index.d.ts.map
|