politty 0.4.16 → 0.5.1

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.
Files changed (52) hide show
  1. package/dist/{arg-registry-MVWOAcvw.d.cts → arg-registry--NRaNFJM.d.cts} +123 -3
  2. package/dist/arg-registry--NRaNFJM.d.cts.map +1 -0
  3. package/dist/{arg-registry-Cd6xnjHa.d.ts → arg-registry-6E0WHOh_.d.ts} +123 -3
  4. package/dist/arg-registry-6E0WHOh_.d.ts.map +1 -0
  5. package/dist/augment.d.cts +1 -1
  6. package/dist/augment.d.ts +1 -1
  7. package/dist/completion/index.cjs +1 -1
  8. package/dist/completion/index.d.cts +3 -2
  9. package/dist/completion/index.d.ts +3 -2
  10. package/dist/completion/index.js +1 -1
  11. package/dist/completion-BFOAOg95.cjs +4294 -0
  12. package/dist/completion-BFOAOg95.cjs.map +1 -0
  13. package/dist/completion-K5LGh1hO.js +4192 -0
  14. package/dist/completion-K5LGh1hO.js.map +1 -0
  15. package/dist/docs/index.cjs +9 -9
  16. package/dist/docs/index.cjs.map +1 -1
  17. package/dist/docs/index.d.cts +1 -1
  18. package/dist/docs/index.d.ts +1 -1
  19. package/dist/docs/index.js +2 -2
  20. package/dist/{index-DR9HLxIP.d.ts → index-Cg8qstsT.d.cts} +136 -15
  21. package/dist/index-Cg8qstsT.d.cts.map +1 -0
  22. package/dist/{index-CPebddth.d.cts → index-O3yn97Ed.d.ts} +136 -15
  23. package/dist/index-O3yn97Ed.d.ts.map +1 -0
  24. package/dist/index.cjs +10 -10
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +3 -3
  28. package/dist/prompt/clack/index.d.cts +1 -1
  29. package/dist/prompt/clack/index.d.ts +1 -1
  30. package/dist/prompt/index.d.cts +1 -1
  31. package/dist/prompt/index.d.ts +1 -1
  32. package/dist/prompt/inquirer/index.d.cts +1 -1
  33. package/dist/prompt/inquirer/index.d.ts +1 -1
  34. package/dist/{runner-BHeCMEa5.js → runner-BmSEiD9A.js} +12 -9
  35. package/dist/{runner-BHeCMEa5.js.map → runner-BmSEiD9A.js.map} +1 -1
  36. package/dist/{runner-BcyR6Z8r.cjs → runner-CRZ_7Y9i.cjs} +56 -53
  37. package/dist/{runner-BcyR6Z8r.cjs.map → runner-CRZ_7Y9i.cjs.map} +1 -1
  38. package/dist/{subcommand-router-XZBWe8HN.js → schema-extractor-C50R-1re.js} +135 -135
  39. package/dist/schema-extractor-C50R-1re.js.map +1 -0
  40. package/dist/{subcommand-router-DQy0KZU-.cjs → schema-extractor-SLPgBNgZ.cjs} +134 -134
  41. package/dist/schema-extractor-SLPgBNgZ.cjs.map +1 -0
  42. package/package.json +8 -8
  43. package/dist/arg-registry-Cd6xnjHa.d.ts.map +0 -1
  44. package/dist/arg-registry-MVWOAcvw.d.cts.map +0 -1
  45. package/dist/completion-B04iiki9.js +0 -2338
  46. package/dist/completion-B04iiki9.js.map +0 -1
  47. package/dist/completion-BlZxMSeU.cjs +0 -2440
  48. package/dist/completion-BlZxMSeU.cjs.map +0 -1
  49. package/dist/index-CPebddth.d.cts.map +0 -1
  50. package/dist/index-DR9HLxIP.d.ts.map +0 -1
  51. package/dist/subcommand-router-DQy0KZU-.cjs.map +0 -1
  52. package/dist/subcommand-router-XZBWe8HN.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { N as SubCommandValue, R as ExtractedFields, h as Example, l as AnyCommand, u as ArgsSchema, z as ResolvedFieldMeta } from "../arg-registry-MVWOAcvw.cjs";
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
 
@@ -1,4 +1,4 @@
1
- import { N as SubCommandValue, R as ExtractedFields, h as Example, l as AnyCommand, u as ArgsSchema, z as ResolvedFieldMeta } from "../arg-registry-Cd6xnjHa.js";
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
 
@@ -1,4 +1,4 @@
1
- import { d as getExtractedFields, l as extractFields, r as resolveLazyCommand } from "../subcommand-router-XZBWe8HN.js";
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-BHeCMEa5.js").then((n) => n.r);
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 { l as AnyCommand, p as Command, u as ArgsSchema, z as ResolvedFieldMeta } from "./arg-registry-Cd6xnjHa.js";
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
- * Generate completion candidates based on context
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
- * Priority:
316
- * 1. Explicit custom completion (choices or shellCommand)
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
  /**
@@ -352,6 +472,7 @@ declare const refreshArgsSchema: z.ZodObject<{
352
472
  zsh: "zsh";
353
473
  fish: "fish";
354
474
  }>;
475
+ target: z.ZodOptional<z.ZodString>;
355
476
  }, z.core.$strip>;
356
477
  type RefreshArgs = z.infer<typeof refreshArgsSchema>;
357
478
  /**
@@ -424,4 +545,4 @@ interface WithCompletionOptions {
424
545
  declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
425
546
  //#endregion
426
547
  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
548
+ //# sourceMappingURL=index-Cg8qstsT.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Cg8qstsT.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;E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S,UAAA,EACT,OAAA,EAAS,iBAAA,GACR,gBAAA;;;;iBAgBa,kBAAA,CAAA,GAAsB,SAAS;;;;iBAwB/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;;;;;;;;KAalB,WAAA,GAAc,CAAA,CAAE,KAAK,QAAQ,iBAAA;APxElC;;;;;;;;;;;;;;;AAAA,iBOyFgB,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/CxC;;;;;AAAA,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;;;;UAsBpB,qBAAA;EP5KA;EO8Kf,WAAA;;EAEA,gBAAA,GAAmB,UAAU;EPtKpB;;;;;;EO6KT,QAAA;EP/KA;EOiLA,cAAA;AAAA;;;;;AP7KkC;AAMpC;;;;;;;;;;AAMkC;AAMlC;;;;iBOkLgB,qBAAA,WAAgC,UAAA,CAAA,CAC9C,OAAA,EAAS,CAAA,EACT,OAAA,YAAmB,qBAAA,GAClB,CAAA"}
@@ -1,7 +1,19 @@
1
- import { l as AnyCommand, p as Command, u as ArgsSchema, z as ResolvedFieldMeta } from "./arg-registry-MVWOAcvw.cjs";
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
- * Generate completion candidates based on context
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
- * Priority:
316
- * 1. Explicit custom completion (choices or shellCommand)
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
  /**
@@ -352,6 +472,7 @@ declare const refreshArgsSchema: z.ZodObject<{
352
472
  zsh: "zsh";
353
473
  fish: "fish";
354
474
  }>;
475
+ target: z.ZodOptional<z.ZodString>;
355
476
  }, z.core.$strip>;
356
477
  type RefreshArgs = z.infer<typeof refreshArgsSchema>;
357
478
  /**
@@ -424,4 +545,4 @@ interface WithCompletionOptions {
424
545
  declare function withCompletionCommand<T extends AnyCommand>(command: T, options?: string | WithCompletionOptions): T;
425
546
  //#endregion
426
547
  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
548
+ //# sourceMappingURL=index-O3yn97Ed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-O3yn97Ed.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;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;EAqES;;;;EAhET,QAAA;EAwEe;EAtEf,mBAAA;;;;;;;;;EASA,uBAAA;EAyEe;EAvEf,WAAA;;;;;;;EAOA,QAAA;EAsEmB;EApEnB,UAAA;EA0E6B;EAxE7B,SAAA;EAyES;EAvET,QAAA;EAyEG;EAvEH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AA,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 require_subcommand_router = require('./subcommand-router-DQy0KZU-.cjs');
3
- const require_completion = require('./completion-BlZxMSeU.cjs');
4
- const require_runner = require('./runner-BcyR6Z8r.cjs');
2
+ const require_schema_extractor = require('./schema-extractor-SLPgBNgZ.cjs');
3
+ const require_completion = require('./completion-BFOAOg95.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 = require_subcommand_router.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 = require_subcommand_router.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 = require_subcommand_router.getUnknownKeysMode;
21
+ exports.getUnknownKeysMode = require_schema_extractor.getUnknownKeysMode;
22
22
  exports.isColorEnabled = require_runner.isColorEnabled;
23
- exports.isLazyCommand = require_subcommand_router.isLazyCommand;
24
- exports.lazy = require_subcommand_router.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 = require_subcommand_router.toCamelCase;
35
- exports.toKebabCase = require_subcommand_router.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 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";
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-Cg8qstsT.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