politty 0.3.1 → 0.3.2

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 (60) hide show
  1. package/README.md +84 -2
  2. package/dist/{arg-registry-w5mMKJkZ.d.ts → arg-registry-B4a4Fj7f.d.cts} +51 -2
  3. package/dist/arg-registry-B4a4Fj7f.d.cts.map +1 -0
  4. package/dist/{arg-registry-i6SA4l-E.d.cts → arg-registry-C3GP-5C9.d.ts} +51 -2
  5. package/dist/arg-registry-C3GP-5C9.d.ts.map +1 -0
  6. package/dist/augment.d.cts +1 -1
  7. package/dist/augment.d.ts +1 -1
  8. package/dist/completion/index.cjs +23 -460
  9. package/dist/completion/index.cjs.map +1 -1
  10. package/dist/completion/index.d.cts +13 -91
  11. package/dist/completion/index.d.cts.map +1 -1
  12. package/dist/completion/index.d.ts +13 -91
  13. package/dist/completion/index.d.ts.map +1 -1
  14. package/dist/completion/index.js +12 -455
  15. package/dist/completion/index.js.map +1 -1
  16. package/dist/docs/index.cjs +2 -2
  17. package/dist/docs/index.d.cts +2 -1
  18. package/dist/docs/index.d.cts.map +1 -1
  19. package/dist/docs/index.d.ts +2 -1
  20. package/dist/docs/index.d.ts.map +1 -1
  21. package/dist/docs/index.js +2 -2
  22. package/dist/extractor-B7bOwpvP.cjs +970 -0
  23. package/dist/extractor-B7bOwpvP.cjs.map +1 -0
  24. package/dist/extractor-CCi4rjSI.d.ts +238 -0
  25. package/dist/extractor-CCi4rjSI.d.ts.map +1 -0
  26. package/dist/extractor-DsJ6hYqQ.d.cts +238 -0
  27. package/dist/extractor-DsJ6hYqQ.d.cts.map +1 -0
  28. package/dist/extractor-JfoYSoMk.js +898 -0
  29. package/dist/extractor-JfoYSoMk.js.map +1 -0
  30. package/dist/index.cjs +8 -5
  31. package/dist/index.d.cts +5 -3
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.ts +5 -3
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +5 -4
  36. package/dist/{runner-B38UBqhv.cjs → runner-BFKk3Arg.cjs} +25 -13
  37. package/dist/runner-BFKk3Arg.cjs.map +1 -0
  38. package/dist/{runner-CUN50BqK.js → runner-ElQbBn1U.js} +25 -13
  39. package/dist/runner-ElQbBn1U.js.map +1 -0
  40. package/dist/{schema-extractor-B9D3Rf22.cjs → schema-extractor-BU705qpC.cjs} +43 -4
  41. package/dist/schema-extractor-BU705qpC.cjs.map +1 -0
  42. package/dist/{schema-extractor-CXeUTW_Z.d.cts → schema-extractor-CHiBRT39.d.ts} +6 -1
  43. package/dist/schema-extractor-CHiBRT39.d.ts.map +1 -0
  44. package/dist/{schema-extractor-1YXqFSDT.js → schema-extractor-CP3ar0Wi.js} +43 -4
  45. package/dist/schema-extractor-CP3ar0Wi.js.map +1 -0
  46. package/dist/{schema-extractor-Cl_D04BX.d.ts → schema-extractor-DyfK21m_.d.cts} +6 -1
  47. package/dist/schema-extractor-DyfK21m_.d.cts.map +1 -0
  48. package/package.json +6 -6
  49. package/dist/arg-registry-i6SA4l-E.d.cts.map +0 -1
  50. package/dist/arg-registry-w5mMKJkZ.d.ts.map +0 -1
  51. package/dist/command-Bgd-yIwv.cjs +0 -25
  52. package/dist/command-Bgd-yIwv.cjs.map +0 -1
  53. package/dist/command-D-P2Pc3J.js +0 -20
  54. package/dist/command-D-P2Pc3J.js.map +0 -1
  55. package/dist/runner-B38UBqhv.cjs.map +0 -1
  56. package/dist/runner-CUN50BqK.js.map +0 -1
  57. package/dist/schema-extractor-1YXqFSDT.js.map +0 -1
  58. package/dist/schema-extractor-B9D3Rf22.cjs.map +0 -1
  59. package/dist/schema-extractor-CXeUTW_Z.d.cts.map +0 -1
  60. package/dist/schema-extractor-Cl_D04BX.d.ts.map +0 -1
@@ -1,456 +1,7 @@
1
- import { a as arg, t as extractFields } from "../schema-extractor-1YXqFSDT.js";
2
- import { t as defineCommand } from "../command-D-P2Pc3J.js";
1
+ import { a as arg } from "../schema-extractor-CP3ar0Wi.js";
2
+ import { a as createDynamicCompleteCommand, c as CompletionDirective, d as generateBashCompletion, f as defineCommand, i as generateFishCompletion, l as formatOutput, n as extractPositionals, o as hasCompleteCommand, r as generateZshCompletion, s as parseCompletionContext, t as extractCompletionData, u as generateCandidates } from "../extractor-JfoYSoMk.js";
3
3
  import { z } from "zod";
4
4
 
5
- //#region src/completion/extractor.ts
6
- /**
7
- * Extract completion data from commands
8
- */
9
- /**
10
- * Convert a resolved field to a completable option
11
- */
12
- function fieldToOption(field) {
13
- return {
14
- name: field.name,
15
- cliName: field.cliName,
16
- alias: field.alias,
17
- description: field.description,
18
- takesValue: field.type !== "boolean",
19
- valueType: field.type,
20
- required: field.required
21
- };
22
- }
23
- /**
24
- * Extract options from a command's args schema
25
- */
26
- function extractOptions(command) {
27
- if (!command.args) return [];
28
- return extractFields(command.args).fields.filter((field) => !field.positional).map(fieldToOption);
29
- }
30
- /**
31
- * Extract positional arguments from a command
32
- */
33
- function extractPositionals(command) {
34
- if (!command.args) return [];
35
- return extractFields(command.args).fields.filter((field) => field.positional);
36
- }
37
- /**
38
- * Extract a completable subcommand from a command
39
- */
40
- function extractSubcommand(name, command) {
41
- const subcommands = [];
42
- if (command.subCommands) for (const [subName, subCommand] of Object.entries(command.subCommands)) if (typeof subCommand === "function") subcommands.push({
43
- name: subName,
44
- description: "(lazy loaded)",
45
- subcommands: [],
46
- options: []
47
- });
48
- else subcommands.push(extractSubcommand(subName, subCommand));
49
- return {
50
- name,
51
- description: command.description,
52
- subcommands,
53
- options: extractOptions(command)
54
- };
55
- }
56
- /**
57
- * Extract completion data from a command tree
58
- */
59
- function extractCompletionData(command, programName) {
60
- const rootSubcommand = extractSubcommand(programName, command);
61
- return {
62
- command: rootSubcommand,
63
- programName,
64
- globalOptions: rootSubcommand.options
65
- };
66
- }
67
-
68
- //#endregion
69
- //#region src/completion/bash.ts
70
- /**
71
- * Generate option completions for bash
72
- */
73
- function generateOptionCompletions$1(options) {
74
- const completions = [];
75
- for (const opt of options) {
76
- completions.push(`--${opt.cliName}`);
77
- if (opt.alias) completions.push(`-${opt.alias}`);
78
- }
79
- return completions;
80
- }
81
- /**
82
- * Generate subcommand completions for bash
83
- */
84
- function generateSubcommandCompletions$1(subcommands) {
85
- return subcommands.map((sub) => sub.name);
86
- }
87
- /**
88
- * Generate the bash completion script
89
- */
90
- function generateBashScript(command, programName) {
91
- const allOptions = collectAllOptions(command);
92
- const optionList = generateOptionCompletions$1(allOptions).join(" ");
93
- const subcommandList = generateSubcommandCompletions$1(command.subcommands).join(" ");
94
- const subcommandCases = buildSubcommandCases(command.subcommands);
95
- return `# Bash completion for ${programName}
96
- # Generated by politty
97
-
98
- _${programName}_completions() {
99
- local cur prev words cword
100
- _init_completion || return
101
-
102
- local commands="${subcommandList}"
103
- local global_opts="${optionList}"
104
-
105
- # Handle subcommand-specific completions
106
- local cmd_index=1
107
- local cmd=""
108
-
109
- # Find the subcommand
110
- for ((i=1; i < cword; i++)); do
111
- case "\${words[i]}" in
112
- -*)
113
- # Skip options and their values
114
- if [[ "\${words[i]}" == *=* ]]; then
115
- continue
116
- fi
117
- # Check if next word is the option's value
118
- local opt="\${words[i]}"
119
- case "$opt" in
120
- ${allOptions.filter((o) => o.takesValue).map((o) => `--${o.cliName}|-${o.alias || ""}`).join("|") || "--*"}
121
- ((i++))
122
- ;;
123
- esac
124
- ;;
125
- *)
126
- # Found a subcommand
127
- cmd="\${words[i]}"
128
- cmd_index=$i
129
- break
130
- ;;
131
- esac
132
- done
133
-
134
- # Subcommand-specific completions
135
- case "$cmd" in
136
- ${subcommandCases}
137
- *)
138
- # Root level completions
139
- if [[ "$cur" == -* ]]; then
140
- COMPREPLY=($(compgen -W "$global_opts" -- "$cur"))
141
- else
142
- COMPREPLY=($(compgen -W "$commands" -- "$cur"))
143
- fi
144
- ;;
145
- esac
146
-
147
- return 0
148
- }
149
-
150
- # Register the completion function
151
- complete -F _${programName}_completions ${programName}
152
- `;
153
- }
154
- /**
155
- * Build case statements for subcommand-specific completions
156
- */
157
- function buildSubcommandCases(subcommands) {
158
- if (subcommands.length === 0) return "";
159
- let cases = "";
160
- for (const sub of subcommands) {
161
- const completions = [generateOptionCompletions$1(sub.options).join(" "), generateSubcommandCompletions$1(sub.subcommands).join(" ")].filter(Boolean).join(" ");
162
- cases += ` ${sub.name})\n`;
163
- cases += ` COMPREPLY=($(compgen -W "${completions}" -- "$cur"))\n`;
164
- cases += ` ;;\n`;
165
- if (sub.subcommands.length > 0) {
166
- const nestedCases = buildSubcommandCases(sub.subcommands);
167
- if (nestedCases) cases += nestedCases;
168
- }
169
- }
170
- return cases;
171
- }
172
- /**
173
- * Collect all options from a command tree
174
- */
175
- function collectAllOptions(command) {
176
- const options = [...command.options];
177
- for (const sub of command.subcommands) options.push(...collectAllOptions(sub));
178
- const seen = /* @__PURE__ */ new Set();
179
- return options.filter((opt) => {
180
- if (seen.has(opt.name)) return false;
181
- seen.add(opt.name);
182
- return true;
183
- });
184
- }
185
- /**
186
- * Generate bash completion script for a command
187
- */
188
- function generateBashCompletion(command, options) {
189
- return {
190
- script: generateBashScript(extractCompletionData(command, options.programName).command, options.programName),
191
- shell: "bash",
192
- installInstructions: `# To enable completions, add the following to your ~/.bashrc:
193
-
194
- # Option 1: Source directly
195
- eval "$(${options.programName} completion bash)"
196
-
197
- # Option 2: Save to a file
198
- ${options.programName} completion bash > ~/.local/share/bash-completion/completions/${options.programName}
199
-
200
- # Then reload your shell or run:
201
- source ~/.bashrc`
202
- };
203
- }
204
-
205
- //#endregion
206
- //#region src/completion/fish.ts
207
- /**
208
- * Escape a string for use in fish completion descriptions
209
- */
210
- function escapeForFish(str) {
211
- return str.replace(/'/g, "\\'").replace(/"/g, "\\\"");
212
- }
213
- /**
214
- * Generate completion entries for options
215
- */
216
- function generateOptionCompletions(options, programName, condition, includeDescriptions) {
217
- const completions = [];
218
- for (const opt of options) {
219
- let cmd = `complete -c ${programName}`;
220
- if (condition) cmd += ` -n '${condition}'`;
221
- cmd += ` -l ${opt.cliName}`;
222
- if (opt.alias) cmd += ` -s ${opt.alias}`;
223
- if (opt.takesValue) cmd += " -r";
224
- else cmd += " -f";
225
- if (includeDescriptions && opt.description) cmd += ` -d '${escapeForFish(opt.description)}'`;
226
- completions.push(cmd);
227
- }
228
- return completions;
229
- }
230
- /**
231
- * Generate completion entries for subcommands
232
- */
233
- function generateSubcommandCompletions(subcommands, programName, condition, includeDescriptions) {
234
- const completions = [];
235
- for (const sub of subcommands) {
236
- let cmd = `complete -c ${programName}`;
237
- if (condition) cmd += ` -n '${condition}'`;
238
- cmd += ` -f -a ${sub.name}`;
239
- if (includeDescriptions && sub.description) cmd += ` -d '${escapeForFish(sub.description)}'`;
240
- completions.push(cmd);
241
- }
242
- return completions;
243
- }
244
- /**
245
- * Generate helper functions for fish
246
- */
247
- function generateHelperFunctions(programName) {
248
- return `# Helper function to check if using subcommand
249
- function __fish_use_subcommand_${programName}
250
- set -l cmd (commandline -opc)
251
- if test (count $cmd) -eq 1
252
- return 0
253
- end
254
- return 1
255
- end
256
-
257
- # Helper function to check current subcommand
258
- function __fish_${programName}_using_command
259
- set -l cmd (commandline -opc)
260
- if contains -- $argv[1] $cmd
261
- return 0
262
- end
263
- return 1
264
- end
265
- `;
266
- }
267
- /**
268
- * Recursively generate completions for a command and its subcommands
269
- */
270
- function generateCommandCompletions(command, programName, includeDescriptions, parentCommands = []) {
271
- const completions = [];
272
- const optionCondition = parentCommands.length === 0 ? "" : `__fish_${programName}_using_command ${parentCommands[parentCommands.length - 1]}`;
273
- const subcommandCondition = parentCommands.length === 0 ? `__fish_use_subcommand_${programName}` : `__fish_${programName}_using_command ${parentCommands[parentCommands.length - 1]}`;
274
- completions.push(...generateOptionCompletions(command.options, programName, optionCondition, includeDescriptions));
275
- if (command.subcommands.length > 0) {
276
- completions.push(...generateSubcommandCompletions(command.subcommands, programName, subcommandCondition, includeDescriptions));
277
- for (const sub of command.subcommands) completions.push(...generateCommandCompletions(sub, programName, includeDescriptions, [...parentCommands, sub.name]));
278
- }
279
- return completions;
280
- }
281
- /**
282
- * Generate the fish completion script
283
- */
284
- function generateFishScript(command, programName, includeDescriptions) {
285
- const helpers = generateHelperFunctions(programName);
286
- const completions = generateCommandCompletions(command, programName, includeDescriptions);
287
- return `# Fish completion for ${programName}
288
- # Generated by politty
289
-
290
- ${helpers}
291
-
292
- # Clear existing completions
293
- complete -e -c ${programName}
294
-
295
- # Built-in options
296
- ${[`complete -c ${programName} -l help -s h -d 'Show help information'`, `complete -c ${programName} -l version -d 'Show version information'`].join("\n")}
297
-
298
- # Command-specific completions
299
- ${completions.join("\n")}
300
- `;
301
- }
302
- /**
303
- * Generate fish completion script for a command
304
- */
305
- function generateFishCompletion(command, options) {
306
- const data = extractCompletionData(command, options.programName);
307
- const includeDescriptions = options.includeDescriptions ?? true;
308
- return {
309
- script: generateFishScript(data.command, options.programName, includeDescriptions),
310
- shell: "fish",
311
- installInstructions: `# To enable completions, run one of the following:
312
-
313
- # Option 1: Source directly
314
- ${options.programName} completion fish | source
315
-
316
- # Option 2: Save to the fish completions directory
317
- ${options.programName} completion fish > ~/.config/fish/completions/${options.programName}.fish
318
-
319
- # The completion will be available immediately in new shell sessions.
320
- # To use in the current session, run:
321
- source ~/.config/fish/completions/${options.programName}.fish`
322
- };
323
- }
324
-
325
- //#endregion
326
- //#region src/completion/zsh.ts
327
- /**
328
- * Escape a string for use in zsh completion descriptions
329
- */
330
- function escapeForZsh(str) {
331
- return str.replace(/'/g, "''").replace(/\[/g, "\\[").replace(/\]/g, "\\]");
332
- }
333
- /**
334
- * Generate option specs for zsh _arguments
335
- */
336
- function generateOptionSpecs(options, includeDescriptions) {
337
- const specs = [];
338
- for (const opt of options) {
339
- const desc = includeDescriptions && opt.description ? escapeForZsh(opt.description) : "";
340
- const valueSpec = opt.takesValue ? ":" : "";
341
- if (desc) specs.push(`'--${opt.cliName}[${desc}]${valueSpec}'`);
342
- else specs.push(`'--${opt.cliName}${valueSpec}'`);
343
- if (opt.alias) if (desc) specs.push(`'-${opt.alias}[${desc}]${valueSpec}'`);
344
- else specs.push(`'-${opt.alias}${valueSpec}'`);
345
- }
346
- return specs;
347
- }
348
- /**
349
- * Generate subcommand descriptions for zsh
350
- */
351
- function generateSubcommandDescriptions(subcommands, includeDescriptions) {
352
- if (subcommands.length === 0) return "";
353
- return subcommands.map((sub) => {
354
- const desc = includeDescriptions && sub.description ? escapeForZsh(sub.description) : sub.name;
355
- return `'${sub.name}:${desc}'`;
356
- }).join("\n ");
357
- }
358
- /**
359
- * Generate a zsh function for a subcommand
360
- */
361
- function generateSubcommandFunction(command, programName, includeDescriptions, parentPath = []) {
362
- const currentPath = [...parentPath, command.name];
363
- const funcName = parentPath.length === 0 ? `_${programName}` : `_${programName}_${currentPath.slice(1).join("_")}`;
364
- const optionSpecs = generateOptionSpecs(command.options, includeDescriptions);
365
- const hasSubcommands = command.subcommands.length > 0;
366
- let func = `${funcName}() {\n`;
367
- func += ` local -a args\n`;
368
- if (hasSubcommands) {
369
- const subcommandDesc = generateSubcommandDescriptions(command.subcommands, includeDescriptions);
370
- func += ` local -a subcommands\n`;
371
- func += ` subcommands=(\n`;
372
- func += ` ${subcommandDesc}\n`;
373
- func += ` )\n\n`;
374
- }
375
- func += ` args=(\n`;
376
- if (hasSubcommands) {
377
- func += ` '1:command:->command'\n`;
378
- func += ` '*::arg:->args'\n`;
379
- }
380
- for (const spec of optionSpecs) func += ` ${spec}\n`;
381
- func += ` )\n\n`;
382
- func += ` _arguments -s -S $args\n\n`;
383
- if (hasSubcommands) {
384
- func += ` case "$state" in\n`;
385
- func += ` command)\n`;
386
- func += ` _describe -t commands 'command' subcommands\n`;
387
- func += ` ;;\n`;
388
- func += ` args)\n`;
389
- func += ` case $words[1] in\n`;
390
- for (const sub of command.subcommands) {
391
- const subFuncName = `_${programName}_${[...currentPath.slice(1), sub.name].join("_")}`;
392
- func += ` ${sub.name})\n`;
393
- func += ` ${subFuncName}\n`;
394
- func += ` ;;\n`;
395
- }
396
- func += ` esac\n`;
397
- func += ` ;;\n`;
398
- func += ` esac\n`;
399
- }
400
- func += `}\n`;
401
- return func;
402
- }
403
- /**
404
- * Collect all subcommand functions recursively
405
- */
406
- function collectSubcommandFunctions(command, programName, includeDescriptions, parentPath = []) {
407
- const functions = [];
408
- functions.push(generateSubcommandFunction(command, programName, includeDescriptions, parentPath));
409
- const currentPath = parentPath.length === 0 ? [command.name] : [...parentPath, command.name];
410
- for (const sub of command.subcommands) functions.push(...collectSubcommandFunctions(sub, programName, includeDescriptions, currentPath));
411
- return functions;
412
- }
413
- /**
414
- * Generate the zsh completion script
415
- */
416
- function generateZshScript(command, programName, includeDescriptions) {
417
- return `#compdef ${programName}
418
-
419
- # Zsh completion for ${programName}
420
- # Generated by politty
421
-
422
- ${collectSubcommandFunctions(command, programName, includeDescriptions).join("\n")}
423
-
424
- compdef _${programName} ${programName}
425
- `;
426
- }
427
- /**
428
- * Generate zsh completion script for a command
429
- */
430
- function generateZshCompletion(command, options) {
431
- const data = extractCompletionData(command, options.programName);
432
- const includeDescriptions = options.includeDescriptions ?? true;
433
- return {
434
- script: generateZshScript(data.command, options.programName, includeDescriptions),
435
- shell: "zsh",
436
- installInstructions: `# To enable completions, add the following to your ~/.zshrc:
437
-
438
- # Option 1: Source directly (add before compinit)
439
- eval "$(${options.programName} completion zsh)"
440
-
441
- # Option 2: Save to a file in your fpath
442
- ${options.programName} completion zsh > ~/.zsh/completions/_${options.programName}
443
-
444
- # Make sure your fpath includes the completions directory:
445
- # fpath=(~/.zsh/completions $fpath)
446
- # autoload -Uz compinit && compinit
447
-
448
- # Then reload your shell or run:
449
- source ~/.zshrc`
450
- };
451
- }
452
-
453
- //#endregion
454
5
  //#region src/completion/index.ts
455
6
  /**
456
7
  * Shell completion generation module
@@ -543,6 +94,10 @@ const completionArgsSchema = z.object({
543
94
  */
544
95
  function createCompletionCommand(rootCommand, programName) {
545
96
  const resolvedProgramName = programName ?? rootCommand.name;
97
+ if (!rootCommand.subCommands?.__complete) rootCommand.subCommands = {
98
+ ...rootCommand.subCommands,
99
+ __complete: createDynamicCompleteCommand(rootCommand, resolvedProgramName)
100
+ };
546
101
  return defineCommand({
547
102
  name: "completion",
548
103
  description: "Generate shell completion script",
@@ -571,7 +126,7 @@ function createCompletionCommand(rootCommand, programName) {
571
126
  * in its subCommands (e.g., for completion generation).
572
127
  *
573
128
  * @param command - The command to wrap
574
- * @param programName - Override the program name (defaults to command.name)
129
+ * @param options - Options including programName
575
130
  * @returns A new command with the completion subcommand added
576
131
  *
577
132
  * @example
@@ -584,15 +139,17 @@ function createCompletionCommand(rootCommand, programName) {
584
139
  * );
585
140
  * ```
586
141
  */
587
- function withCompletionCommand(command, programName) {
142
+ function withCompletionCommand(command, options) {
143
+ const { programName } = typeof options === "string" ? { programName: options } : options ?? {};
588
144
  const wrappedCommand = { ...command };
589
145
  wrappedCommand.subCommands = {
590
146
  ...command.subCommands,
591
- completion: createCompletionCommand(wrappedCommand, programName)
147
+ completion: createCompletionCommand(wrappedCommand, programName),
148
+ __complete: createDynamicCompleteCommand(wrappedCommand, programName)
592
149
  };
593
150
  return wrappedCommand;
594
151
  }
595
152
 
596
153
  //#endregion
597
- export { createCompletionCommand, detectShell, extractCompletionData, extractPositionals, generateCompletion, getSupportedShells, withCompletionCommand };
154
+ export { CompletionDirective, createCompletionCommand, createDynamicCompleteCommand, detectShell, extractCompletionData, extractPositionals, formatOutput, generateCandidates, generateCompletion, getSupportedShells, hasCompleteCommand, parseCompletionContext, withCompletionCommand };
598
155
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["generateOptionCompletions","generateSubcommandCompletions"],"sources":["../../src/completion/extractor.ts","../../src/completion/bash.ts","../../src/completion/fish.ts","../../src/completion/zsh.ts","../../src/completion/index.ts"],"sourcesContent":["/**\n * Extract completion data from commands\n */\n\nimport { extractFields, type ResolvedFieldMeta } from \"../core/schema-extractor.js\";\nimport type { AnyCommand } from \"../types.js\";\nimport type { CompletableOption, CompletableSubcommand, CompletionData } from \"./types.js\";\n\n/**\n * Convert a resolved field to a completable option\n */\nfunction fieldToOption(field: ResolvedFieldMeta): CompletableOption {\n return {\n name: field.name,\n cliName: field.cliName,\n alias: field.alias,\n description: field.description,\n // Booleans are flags that don't require a value\n takesValue: field.type !== \"boolean\",\n valueType: field.type,\n required: field.required,\n };\n}\n\n/**\n * Extract options from a command's args schema\n */\nfunction extractOptions(command: AnyCommand): CompletableOption[] {\n if (!command.args) {\n return [];\n }\n\n const extracted = extractFields(command.args);\n return extracted.fields\n .filter((field) => !field.positional) // Only include flags/options, not positionals\n .map(fieldToOption);\n}\n\n/**\n * Extract positional arguments from a command\n */\nexport function extractPositionals(command: AnyCommand): ResolvedFieldMeta[] {\n if (!command.args) {\n return [];\n }\n\n const extracted = extractFields(command.args);\n return extracted.fields.filter((field) => field.positional);\n}\n\n/**\n * Extract a completable subcommand from a command\n */\nfunction extractSubcommand(name: string, command: AnyCommand): CompletableSubcommand {\n const subcommands: CompletableSubcommand[] = [];\n\n // Extract subcommands recursively (only sync subcommands for now)\n if (command.subCommands) {\n for (const [subName, subCommand] of Object.entries(command.subCommands)) {\n // Skip async subcommands as we can't inspect them statically\n if (typeof subCommand === \"function\") {\n // For async subcommands, add a placeholder\n subcommands.push({\n name: subName,\n description: \"(lazy loaded)\",\n subcommands: [],\n options: [],\n });\n } else {\n subcommands.push(extractSubcommand(subName, subCommand));\n }\n }\n }\n\n return {\n name,\n description: command.description,\n subcommands,\n options: extractOptions(command),\n };\n}\n\n/**\n * Extract completion data from a command tree\n */\nexport function extractCompletionData(command: AnyCommand, programName: string): CompletionData {\n const rootSubcommand = extractSubcommand(programName, command);\n\n return {\n command: rootSubcommand,\n programName,\n // Global options are the options defined on the root command\n globalOptions: rootSubcommand.options,\n };\n}\n","/**\n * Bash completion script generator\n */\n\nimport type { AnyCommand } from \"../types.js\";\nimport { extractCompletionData } from \"./extractor.js\";\nimport type {\n CompletableOption,\n CompletableSubcommand,\n CompletionOptions,\n CompletionResult,\n} from \"./types.js\";\n\n/**\n * Generate option completions for bash\n */\nfunction generateOptionCompletions(options: CompletableOption[]): string[] {\n const completions: string[] = [];\n\n for (const opt of options) {\n completions.push(`--${opt.cliName}`);\n if (opt.alias) {\n completions.push(`-${opt.alias}`);\n }\n }\n\n return completions;\n}\n\n/**\n * Generate subcommand completions for bash\n */\nfunction generateSubcommandCompletions(subcommands: CompletableSubcommand[]): string[] {\n return subcommands.map((sub) => sub.name);\n}\n\n/**\n * Generate the bash completion script\n */\nfunction generateBashScript(command: CompletableSubcommand, programName: string): string {\n const allOptions = collectAllOptions(command);\n\n const optionList = generateOptionCompletions(allOptions).join(\" \");\n const subcommandList = generateSubcommandCompletions(command.subcommands).join(\" \");\n\n // Build subcommand-specific completions\n const subcommandCases = buildSubcommandCases(command.subcommands);\n\n return `# Bash completion for ${programName}\n# Generated by politty\n\n_${programName}_completions() {\n local cur prev words cword\n _init_completion || return\n\n local commands=\"${subcommandList}\"\n local global_opts=\"${optionList}\"\n\n # Handle subcommand-specific completions\n local cmd_index=1\n local cmd=\"\"\n\n # Find the subcommand\n for ((i=1; i < cword; i++)); do\n case \"\\${words[i]}\" in\n -*)\n # Skip options and their values\n if [[ \"\\${words[i]}\" == *=* ]]; then\n continue\n fi\n # Check if next word is the option's value\n local opt=\"\\${words[i]}\"\n case \"$opt\" in\n ${\n allOptions\n .filter((o) => o.takesValue)\n .map((o) => `--${o.cliName}|-${o.alias || \"\"}`)\n .join(\"|\") || \"--*\"\n }\n ((i++))\n ;;\n esac\n ;;\n *)\n # Found a subcommand\n cmd=\"\\${words[i]}\"\n cmd_index=$i\n break\n ;;\n esac\n done\n\n # Subcommand-specific completions\n case \"$cmd\" in\n${subcommandCases}\n *)\n # Root level completions\n if [[ \"$cur\" == -* ]]; then\n COMPREPLY=($(compgen -W \"$global_opts\" -- \"$cur\"))\n else\n COMPREPLY=($(compgen -W \"$commands\" -- \"$cur\"))\n fi\n ;;\n esac\n\n return 0\n}\n\n# Register the completion function\ncomplete -F _${programName}_completions ${programName}\n`;\n}\n\n/**\n * Build case statements for subcommand-specific completions\n */\nfunction buildSubcommandCases(subcommands: CompletableSubcommand[]): string {\n if (subcommands.length === 0) {\n return \"\";\n }\n\n let cases = \"\";\n\n for (const sub of subcommands) {\n const options = generateOptionCompletions(sub.options).join(\" \");\n const nestedSubcommands = generateSubcommandCompletions(sub.subcommands).join(\" \");\n const completions = [options, nestedSubcommands].filter(Boolean).join(\" \");\n\n cases += ` ${sub.name})\\n`;\n cases += ` COMPREPLY=($(compgen -W \"${completions}\" -- \"$cur\"))\\n`;\n cases += ` ;;\\n`;\n\n // Add nested subcommand cases if any\n if (sub.subcommands.length > 0) {\n const nestedCases = buildSubcommandCases(sub.subcommands);\n if (nestedCases) {\n cases += nestedCases;\n }\n }\n }\n\n return cases;\n}\n\n/**\n * Collect all options from a command tree\n */\nfunction collectAllOptions(command: CompletableSubcommand): CompletableOption[] {\n const options = [...command.options];\n\n for (const sub of command.subcommands) {\n options.push(...collectAllOptions(sub));\n }\n\n // Deduplicate by name\n const seen = new Set<string>();\n return options.filter((opt) => {\n if (seen.has(opt.name)) {\n return false;\n }\n seen.add(opt.name);\n return true;\n });\n}\n\n/**\n * Generate bash completion script for a command\n */\nexport function generateBashCompletion(\n command: AnyCommand,\n options: CompletionOptions,\n): CompletionResult {\n const data = extractCompletionData(command, options.programName);\n\n const script = generateBashScript(data.command, options.programName);\n\n return {\n script,\n shell: \"bash\",\n installInstructions: `# To enable completions, add the following to your ~/.bashrc:\n\n# Option 1: Source directly\neval \"$(${options.programName} completion bash)\"\n\n# Option 2: Save to a file\n${options.programName} completion bash > ~/.local/share/bash-completion/completions/${options.programName}\n\n# Then reload your shell or run:\nsource ~/.bashrc`,\n };\n}\n","/**\n * Fish completion script generator\n */\n\nimport type { AnyCommand } from \"../types.js\";\nimport { extractCompletionData } from \"./extractor.js\";\nimport type {\n CompletableOption,\n CompletableSubcommand,\n CompletionOptions,\n CompletionResult,\n} from \"./types.js\";\n\n/**\n * Escape a string for use in fish completion descriptions\n */\nfunction escapeForFish(str: string): string {\n return str.replace(/'/g, \"\\\\'\").replace(/\"/g, '\\\\\"');\n}\n\n/**\n * Generate completion entries for options\n */\nfunction generateOptionCompletions(\n options: CompletableOption[],\n programName: string,\n condition: string,\n includeDescriptions: boolean,\n): string[] {\n const completions: string[] = [];\n\n for (const opt of options) {\n let cmd = `complete -c ${programName}`;\n\n // Add condition if specified\n if (condition) {\n cmd += ` -n '${condition}'`;\n }\n\n // Add long option\n cmd += ` -l ${opt.cliName}`;\n\n // Add short option if exists\n if (opt.alias) {\n cmd += ` -s ${opt.alias}`;\n }\n\n // Add flag for options that take values\n if (opt.takesValue) {\n cmd += \" -r\"; // Require argument\n } else {\n cmd += \" -f\"; // No argument (flag)\n }\n\n // Add description\n if (includeDescriptions && opt.description) {\n cmd += ` -d '${escapeForFish(opt.description)}'`;\n }\n\n completions.push(cmd);\n }\n\n return completions;\n}\n\n/**\n * Generate completion entries for subcommands\n */\nfunction generateSubcommandCompletions(\n subcommands: CompletableSubcommand[],\n programName: string,\n condition: string,\n includeDescriptions: boolean,\n): string[] {\n const completions: string[] = [];\n\n for (const sub of subcommands) {\n let cmd = `complete -c ${programName}`;\n\n // Add condition\n if (condition) {\n cmd += ` -n '${condition}'`;\n }\n\n // Subcommands are exclusive (no prefix)\n cmd += ` -f -a ${sub.name}`;\n\n // Add description\n if (includeDescriptions && sub.description) {\n cmd += ` -d '${escapeForFish(sub.description)}'`;\n }\n\n completions.push(cmd);\n }\n\n return completions;\n}\n\n/**\n * Generate helper functions for fish\n */\nfunction generateHelperFunctions(programName: string): string {\n return `# Helper function to check if using subcommand\nfunction __fish_use_subcommand_${programName}\n set -l cmd (commandline -opc)\n if test (count $cmd) -eq 1\n return 0\n end\n return 1\nend\n\n# Helper function to check current subcommand\nfunction __fish_${programName}_using_command\n set -l cmd (commandline -opc)\n if contains -- $argv[1] $cmd\n return 0\n end\n return 1\nend\n`;\n}\n\n/**\n * Recursively generate completions for a command and its subcommands\n */\nfunction generateCommandCompletions(\n command: CompletableSubcommand,\n programName: string,\n includeDescriptions: boolean,\n parentCommands: string[] = [],\n): string[] {\n const completions: string[] = [];\n\n // Build condition for this level\n const optionCondition =\n parentCommands.length === 0\n ? \"\"\n : `__fish_${programName}_using_command ${parentCommands[parentCommands.length - 1]}`;\n\n const subcommandCondition =\n parentCommands.length === 0\n ? `__fish_use_subcommand_${programName}`\n : `__fish_${programName}_using_command ${parentCommands[parentCommands.length - 1]}`;\n\n // Add option completions\n completions.push(\n ...generateOptionCompletions(\n command.options,\n programName,\n optionCondition,\n includeDescriptions,\n ),\n );\n\n // Add subcommand completions\n if (command.subcommands.length > 0) {\n completions.push(\n ...generateSubcommandCompletions(\n command.subcommands,\n programName,\n subcommandCondition,\n includeDescriptions,\n ),\n );\n\n // Recursively add completions for subcommands\n for (const sub of command.subcommands) {\n completions.push(\n ...generateCommandCompletions(sub, programName, includeDescriptions, [\n ...parentCommands,\n sub.name,\n ]),\n );\n }\n }\n\n return completions;\n}\n\n/**\n * Generate the fish completion script\n */\nfunction generateFishScript(\n command: CompletableSubcommand,\n programName: string,\n includeDescriptions: boolean,\n): string {\n const helpers = generateHelperFunctions(programName);\n const completions = generateCommandCompletions(command, programName, includeDescriptions);\n\n // Add built-in options (help and version)\n const builtinCompletions = [\n `complete -c ${programName} -l help -s h -d 'Show help information'`,\n `complete -c ${programName} -l version -d 'Show version information'`,\n ];\n\n return `# Fish completion for ${programName}\n# Generated by politty\n\n${helpers}\n\n# Clear existing completions\ncomplete -e -c ${programName}\n\n# Built-in options\n${builtinCompletions.join(\"\\n\")}\n\n# Command-specific completions\n${completions.join(\"\\n\")}\n`;\n}\n\n/**\n * Generate fish completion script for a command\n */\nexport function generateFishCompletion(\n command: AnyCommand,\n options: CompletionOptions,\n): CompletionResult {\n const data = extractCompletionData(command, options.programName);\n const includeDescriptions = options.includeDescriptions ?? true;\n\n const script = generateFishScript(data.command, options.programName, includeDescriptions);\n\n return {\n script,\n shell: \"fish\",\n installInstructions: `# To enable completions, run one of the following:\n\n# Option 1: Source directly\n${options.programName} completion fish | source\n\n# Option 2: Save to the fish completions directory\n${options.programName} completion fish > ~/.config/fish/completions/${options.programName}.fish\n\n# The completion will be available immediately in new shell sessions.\n# To use in the current session, run:\nsource ~/.config/fish/completions/${options.programName}.fish`,\n };\n}\n","/**\n * Zsh completion script generator\n */\n\nimport type { AnyCommand } from \"../types.js\";\nimport { extractCompletionData } from \"./extractor.js\";\nimport type {\n CompletableOption,\n CompletableSubcommand,\n CompletionOptions,\n CompletionResult,\n} from \"./types.js\";\n\n/**\n * Escape a string for use in zsh completion descriptions\n */\nfunction escapeForZsh(str: string): string {\n return str.replace(/'/g, \"''\").replace(/\\[/g, \"\\\\[\").replace(/\\]/g, \"\\\\]\");\n}\n\n/**\n * Generate option specs for zsh _arguments\n */\nfunction generateOptionSpecs(options: CompletableOption[], includeDescriptions: boolean): string[] {\n const specs: string[] = [];\n\n for (const opt of options) {\n const desc = includeDescriptions && opt.description ? escapeForZsh(opt.description) : \"\";\n const valueSpec = opt.takesValue ? \":\" : \"\";\n\n // Long option\n if (desc) {\n specs.push(`'--${opt.cliName}[${desc}]${valueSpec}'`);\n } else {\n specs.push(`'--${opt.cliName}${valueSpec}'`);\n }\n\n // Short option (alias)\n if (opt.alias) {\n if (desc) {\n specs.push(`'-${opt.alias}[${desc}]${valueSpec}'`);\n } else {\n specs.push(`'-${opt.alias}${valueSpec}'`);\n }\n }\n }\n\n return specs;\n}\n\n/**\n * Generate subcommand descriptions for zsh\n */\nfunction generateSubcommandDescriptions(\n subcommands: CompletableSubcommand[],\n includeDescriptions: boolean,\n): string {\n if (subcommands.length === 0) {\n return \"\";\n }\n\n const lines = subcommands.map((sub) => {\n const desc = includeDescriptions && sub.description ? escapeForZsh(sub.description) : sub.name;\n return `'${sub.name}:${desc}'`;\n });\n\n return lines.join(\"\\n \");\n}\n\n/**\n * Generate a zsh function for a subcommand\n */\nfunction generateSubcommandFunction(\n command: CompletableSubcommand,\n programName: string,\n includeDescriptions: boolean,\n parentPath: string[] = [],\n): string {\n const currentPath = [...parentPath, command.name];\n const funcName =\n parentPath.length === 0\n ? `_${programName}`\n : `_${programName}_${currentPath.slice(1).join(\"_\")}`;\n\n const optionSpecs = generateOptionSpecs(command.options, includeDescriptions);\n const hasSubcommands = command.subcommands.length > 0;\n\n let func = `${funcName}() {\\n`;\n func += ` local -a args\\n`;\n\n if (hasSubcommands) {\n const subcommandDesc = generateSubcommandDescriptions(command.subcommands, includeDescriptions);\n func += ` local -a subcommands\\n`;\n func += ` subcommands=(\\n`;\n func += ` ${subcommandDesc}\\n`;\n func += ` )\\n\\n`;\n }\n\n func += ` args=(\\n`;\n\n if (hasSubcommands) {\n func += ` '1:command:->command'\\n`;\n func += ` '*::arg:->args'\\n`;\n }\n\n for (const spec of optionSpecs) {\n func += ` ${spec}\\n`;\n }\n\n func += ` )\\n\\n`;\n\n func += ` _arguments -s -S $args\\n\\n`;\n\n if (hasSubcommands) {\n func += ` case \"$state\" in\\n`;\n func += ` command)\\n`;\n func += ` _describe -t commands 'command' subcommands\\n`;\n func += ` ;;\\n`;\n func += ` args)\\n`;\n func += ` case $words[1] in\\n`;\n\n for (const sub of command.subcommands) {\n const subFuncName = `_${programName}_${[...currentPath.slice(1), sub.name].join(\"_\")}`;\n func += ` ${sub.name})\\n`;\n func += ` ${subFuncName}\\n`;\n func += ` ;;\\n`;\n }\n\n func += ` esac\\n`;\n func += ` ;;\\n`;\n func += ` esac\\n`;\n }\n\n func += `}\\n`;\n\n return func;\n}\n\n/**\n * Collect all subcommand functions recursively\n */\nfunction collectSubcommandFunctions(\n command: CompletableSubcommand,\n programName: string,\n includeDescriptions: boolean,\n parentPath: string[] = [],\n): string[] {\n const functions: string[] = [];\n\n // Generate function for this command\n functions.push(generateSubcommandFunction(command, programName, includeDescriptions, parentPath));\n\n // Generate functions for subcommands\n const currentPath = parentPath.length === 0 ? [command.name] : [...parentPath, command.name];\n\n for (const sub of command.subcommands) {\n functions.push(\n ...collectSubcommandFunctions(sub, programName, includeDescriptions, currentPath),\n );\n }\n\n return functions;\n}\n\n/**\n * Generate the zsh completion script\n */\nfunction generateZshScript(\n command: CompletableSubcommand,\n programName: string,\n includeDescriptions: boolean,\n): string {\n const functions = collectSubcommandFunctions(command, programName, includeDescriptions);\n\n return `#compdef ${programName}\n\n# Zsh completion for ${programName}\n# Generated by politty\n\n${functions.join(\"\\n\")}\n\ncompdef _${programName} ${programName}\n`;\n}\n\n/**\n * Generate zsh completion script for a command\n */\nexport function generateZshCompletion(\n command: AnyCommand,\n options: CompletionOptions,\n): CompletionResult {\n const data = extractCompletionData(command, options.programName);\n const includeDescriptions = options.includeDescriptions ?? true;\n\n const script = generateZshScript(data.command, options.programName, includeDescriptions);\n\n return {\n script,\n shell: \"zsh\",\n installInstructions: `# To enable completions, add the following to your ~/.zshrc:\n\n# Option 1: Source directly (add before compinit)\neval \"$(${options.programName} completion zsh)\"\n\n# Option 2: Save to a file in your fpath\n${options.programName} completion zsh > ~/.zsh/completions/_${options.programName}\n\n# Make sure your fpath includes the completions directory:\n# fpath=(~/.zsh/completions $fpath)\n# autoload -Uz compinit && compinit\n\n# Then reload your shell or run:\nsource ~/.zshrc`,\n };\n}\n","/**\n * Shell completion generation module\n *\n * Provides utilities to generate shell completion scripts for bash, zsh, and fish.\n *\n * @example\n * ```typescript\n * import { generateCompletion, createCompletionCommand } from \"politty/completion\";\n *\n * // Generate completion script directly\n * const result = generateCompletion(myCommand, {\n * shell: \"bash\",\n * programName: \"mycli\"\n * });\n * console.log(result.script);\n *\n * // Or add a completion subcommand to your CLI\n * const mainCommand = withCompletionCommand(\n * defineCommand({\n * name: \"mycli\",\n * subCommands: { ... },\n * }),\n * );\n * ```\n */\n\nimport { z } from \"zod\";\nimport { arg } from \"../core/arg-registry.js\";\nimport { defineCommand } from \"../core/command.js\";\nimport type { AnyCommand, Command } from \"../types.js\";\nimport { generateBashCompletion } from \"./bash.js\";\nimport { generateFishCompletion } from \"./fish.js\";\nimport type { CompletionOptions, CompletionResult, ShellType } from \"./types.js\";\nimport { generateZshCompletion } from \"./zsh.js\";\n\n// Re-export types\n// Re-export extractor\nexport { extractCompletionData, extractPositionals } from \"./extractor.js\";\nexport type {\n CompletableOption,\n CompletableSubcommand,\n CompletionData,\n CompletionGenerator,\n CompletionOptions,\n CompletionResult,\n ShellType,\n} from \"./types.js\";\n\n/**\n * Generate completion script for the specified shell\n */\nexport function generateCompletion(\n command: AnyCommand,\n options: CompletionOptions,\n): CompletionResult {\n switch (options.shell) {\n case \"bash\":\n return generateBashCompletion(command, options);\n case \"zsh\":\n return generateZshCompletion(command, options);\n case \"fish\":\n return generateFishCompletion(command, options);\n default:\n throw new Error(`Unsupported shell: ${options.shell}`);\n }\n}\n\n/**\n * Get the list of supported shells\n */\nexport function getSupportedShells(): ShellType[] {\n return [\"bash\", \"zsh\", \"fish\"];\n}\n\n/**\n * Detect the current shell from environment\n */\nexport function detectShell(): ShellType | null {\n const shell = process.env.SHELL || \"\";\n const shellName = shell.split(\"/\").pop()?.toLowerCase() || \"\";\n\n if (shellName.includes(\"bash\")) {\n return \"bash\";\n }\n if (shellName.includes(\"zsh\")) {\n return \"zsh\";\n }\n if (shellName.includes(\"fish\")) {\n return \"fish\";\n }\n\n return null;\n}\n\n/**\n * Schema for the completion command arguments\n */\nconst completionArgsSchema = z.object({\n shell: arg(\n z\n .enum([\"bash\", \"zsh\", \"fish\"])\n .optional()\n .describe(\"Shell type (auto-detected if not specified)\"),\n {\n positional: true,\n description: \"Shell type (bash, zsh, or fish)\",\n placeholder: \"SHELL\",\n },\n ),\n instructions: arg(z.boolean().default(false), {\n alias: \"i\",\n description: \"Show installation instructions\",\n }),\n});\n\ntype CompletionArgs = z.infer<typeof completionArgsSchema>;\n\n/**\n * Create a completion subcommand for your CLI\n *\n * This creates a ready-to-use subcommand that generates completion scripts.\n *\n * @example\n * ```typescript\n * const mainCommand = defineCommand({\n * name: \"mycli\",\n * subCommands: {\n * completion: createCompletionCommand(mainCommand)\n * }\n * });\n * ```\n */\nexport function createCompletionCommand(\n rootCommand: AnyCommand,\n programName?: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Command<typeof completionArgsSchema, CompletionArgs, any> {\n const resolvedProgramName = programName ?? rootCommand.name;\n return defineCommand({\n name: \"completion\",\n description: \"Generate shell completion script\",\n args: completionArgsSchema,\n run(args) {\n // Detect shell if not specified\n const shellType = args.shell || detectShell();\n\n if (!shellType) {\n console.error(\"Could not detect shell type. Please specify one of: bash, zsh, fish\");\n process.exitCode = 1;\n return;\n }\n\n const result = generateCompletion(rootCommand, {\n shell: shellType,\n programName: resolvedProgramName,\n includeDescriptions: true,\n });\n\n if (args.instructions) {\n console.log(result.installInstructions);\n } else {\n console.log(result.script);\n }\n },\n });\n}\n\n/**\n * Wrap a command with a completion subcommand\n *\n * This avoids circular references that occur when a command references itself\n * in its subCommands (e.g., for completion generation).\n *\n * @param command - The command to wrap\n * @param programName - Override the program name (defaults to command.name)\n * @returns A new command with the completion subcommand added\n *\n * @example\n * ```typescript\n * const mainCommand = withCompletionCommand(\n * defineCommand({\n * name: \"mycli\",\n * subCommands: { ... },\n * }),\n * );\n * ```\n */\nexport function withCompletionCommand<T extends AnyCommand>(command: T, programName?: string): T {\n const wrappedCommand = {\n ...command,\n } as T;\n\n wrappedCommand.subCommands = {\n ...command.subCommands,\n completion: createCompletionCommand(wrappedCommand, programName),\n };\n\n return wrappedCommand;\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,cAAc,OAA6C;AAClE,QAAO;EACL,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,OAAO,MAAM;EACb,aAAa,MAAM;EAEnB,YAAY,MAAM,SAAS;EAC3B,WAAW,MAAM;EACjB,UAAU,MAAM;EACjB;;;;;AAMH,SAAS,eAAe,SAA0C;AAChE,KAAI,CAAC,QAAQ,KACX,QAAO,EAAE;AAIX,QADkB,cAAc,QAAQ,KAAK,CA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;AAED,gBAAe,cAAc;EAC3B,GAAG,QAAQ;EACX,YAAY,wBAAwB,gBAAgB,YAAY;EACjE;AAED,QAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/completion/index.ts"],"sourcesContent":["/**\n * Shell completion generation module\n *\n * Provides utilities to generate shell completion scripts for bash, zsh, and fish.\n *\n * @example\n * ```typescript\n * import { generateCompletion, createCompletionCommand } from \"politty/completion\";\n *\n * // Generate completion script directly\n * const result = generateCompletion(myCommand, {\n * shell: \"bash\",\n * programName: \"mycli\"\n * });\n * console.log(result.script);\n *\n * // Or add a completion subcommand to your CLI\n * const mainCommand = withCompletionCommand(\n * defineCommand({\n * name: \"mycli\",\n * subCommands: { ... },\n * }),\n * );\n * ```\n */\n\nimport { z } from \"zod\";\nimport { arg } from \"../core/arg-registry.js\";\nimport { defineCommand } from \"../core/command.js\";\nimport type { AnyCommand, Command } from \"../types.js\";\nimport { generateBashCompletion } from \"./bash.js\";\nimport { createDynamicCompleteCommand } from \"./dynamic/index.js\";\nimport { generateFishCompletion } from \"./fish.js\";\nimport type { CompletionOptions, CompletionResult, ShellType } from \"./types.js\";\nimport { generateZshCompletion } from \"./zsh.js\";\n\n// Re-export types\n// Re-export extractor\n// Re-export dynamic completion\nexport {\n CompletionDirective,\n createDynamicCompleteCommand,\n formatOutput,\n generateCandidates,\n hasCompleteCommand,\n parseCompletionContext,\n type CandidateResult,\n type CompletionCandidate,\n type CompletionContext,\n type CompletionType,\n} from \"./dynamic/index.js\";\nexport { extractCompletionData, extractPositionals } from \"./extractor.js\";\nexport type {\n CompletableOption,\n CompletableSubcommand,\n CompletionData,\n CompletionGenerator,\n CompletionOptions,\n CompletionResult,\n ShellType,\n} from \"./types.js\";\n\n/**\n * Generate completion script for the specified shell\n */\nexport function generateCompletion(\n command: AnyCommand,\n options: CompletionOptions,\n): CompletionResult {\n switch (options.shell) {\n case \"bash\":\n return generateBashCompletion(command, options);\n case \"zsh\":\n return generateZshCompletion(command, options);\n case \"fish\":\n return generateFishCompletion(command, options);\n default:\n throw new Error(`Unsupported shell: ${options.shell}`);\n }\n}\n\n/**\n * Get the list of supported shells\n */\nexport function getSupportedShells(): ShellType[] {\n return [\"bash\", \"zsh\", \"fish\"];\n}\n\n/**\n * Detect the current shell from environment\n */\nexport function detectShell(): ShellType | null {\n const shell = process.env.SHELL || \"\";\n const shellName = shell.split(\"/\").pop()?.toLowerCase() || \"\";\n\n if (shellName.includes(\"bash\")) {\n return \"bash\";\n }\n if (shellName.includes(\"zsh\")) {\n return \"zsh\";\n }\n if (shellName.includes(\"fish\")) {\n return \"fish\";\n }\n\n return null;\n}\n\n/**\n * Schema for the completion command arguments\n */\nconst completionArgsSchema = z.object({\n shell: arg(\n z\n .enum([\"bash\", \"zsh\", \"fish\"])\n .optional()\n .describe(\"Shell type (auto-detected if not specified)\"),\n {\n positional: true,\n description: \"Shell type (bash, zsh, or fish)\",\n placeholder: \"SHELL\",\n },\n ),\n instructions: arg(z.boolean().default(false), {\n alias: \"i\",\n description: \"Show installation instructions\",\n }),\n});\n\ntype CompletionArgs = z.infer<typeof completionArgsSchema>;\n\n/**\n * Create a completion subcommand for your CLI\n *\n * This creates a ready-to-use subcommand that generates completion scripts.\n *\n * @example\n * ```typescript\n * const mainCommand = defineCommand({\n * name: \"mycli\",\n * subCommands: {\n * completion: createCompletionCommand(mainCommand)\n * }\n * });\n * ```\n */\nexport function createCompletionCommand(\n rootCommand: AnyCommand,\n programName?: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Command<typeof completionArgsSchema, CompletionArgs, any> {\n const resolvedProgramName = programName ?? rootCommand.name;\n\n if (!rootCommand.subCommands?.__complete) {\n rootCommand.subCommands = {\n ...rootCommand.subCommands,\n __complete: createDynamicCompleteCommand(rootCommand, resolvedProgramName),\n };\n }\n\n return defineCommand({\n name: \"completion\",\n description: \"Generate shell completion script\",\n args: completionArgsSchema,\n run(args) {\n // Detect shell if not specified\n const shellType = args.shell || detectShell();\n\n if (!shellType) {\n console.error(\"Could not detect shell type. Please specify one of: bash, zsh, fish\");\n process.exitCode = 1;\n return;\n }\n\n const result = generateCompletion(rootCommand, {\n shell: shellType,\n programName: resolvedProgramName,\n includeDescriptions: true,\n });\n\n if (args.instructions) {\n console.log(result.installInstructions);\n } else {\n console.log(result.script);\n }\n },\n });\n}\n\n/**\n * Options for withCompletionCommand\n */\nexport interface WithCompletionOptions {\n /** Override the program name (defaults to command.name) */\n programName?: string;\n}\n\n/**\n * Wrap a command with a completion subcommand\n *\n * This avoids circular references that occur when a command references itself\n * in its subCommands (e.g., for completion generation).\n *\n * @param command - The command to wrap\n * @param options - Options including programName\n * @returns A new command with the completion subcommand added\n *\n * @example\n * ```typescript\n * const mainCommand = withCompletionCommand(\n * defineCommand({\n * name: \"mycli\",\n * subCommands: { ... },\n * }),\n * );\n * ```\n */\nexport function withCompletionCommand<T extends AnyCommand>(\n command: T,\n options?: string | WithCompletionOptions,\n): T {\n // Support both string (programName) and options object for backwards compatibility\n const opts: WithCompletionOptions =\n typeof options === \"string\" ? { programName: options } : (options ?? {});\n\n const { programName } = opts;\n\n const wrappedCommand = {\n ...command,\n } as T;\n\n wrappedCommand.subCommands = {\n ...command.subCommands,\n completion: createCompletionCommand(wrappedCommand, programName),\n __complete: createDynamicCompleteCommand(wrappedCommand, programName),\n };\n\n return wrappedCommand;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,SAAgB,mBACd,SACA,SACkB;AAClB,SAAQ,QAAQ,OAAhB;EACE,KAAK,OACH,QAAO,uBAAuB,SAAS,QAAQ;EACjD,KAAK,MACH,QAAO,sBAAsB,SAAS,QAAQ;EAChD,KAAK,OACH,QAAO,uBAAuB,SAAS,QAAQ;EACjD,QACE,OAAM,IAAI,MAAM,sBAAsB,QAAQ,QAAQ;;;;;;AAO5D,SAAgB,qBAAkC;AAChD,QAAO;EAAC;EAAQ;EAAO;EAAO;;;;;AAMhC,SAAgB,cAAgC;CAE9C,MA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BAAe,cAAc;EAC3B,GAAG,QAAQ;EACX,YAAY,wBAAwB,gBAAgB,YAAY;EAChE,YAAY,6BAA6B,gBAAgB,YAAY;EACtE;AAED,QAAO"}
@@ -39,7 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
  }) : target, mod));
40
40
 
41
41
  //#endregion
42
- const require_schema_extractor = require('../schema-extractor-B9D3Rf22.cjs');
42
+ const require_schema_extractor = require('../schema-extractor-BU705qpC.cjs');
43
43
  const require_subcommand_router = require('../subcommand-router-Vf-0w9P4.cjs');
44
44
  let zod = require("zod");
45
45
  let node_util = require("node:util");
@@ -695,7 +695,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
695
695
  collector.start();
696
696
  let success = true;
697
697
  try {
698
- const { runCommand } = await Promise.resolve().then(() => require("../runner-B38UBqhv.cjs")).then((n) => n.runner_exports);
698
+ const { runCommand } = await Promise.resolve().then(() => require("../runner-BFKk3Arg.cjs")).then((n) => n.runner_exports);
699
699
  const result = await runCommand(rootCommand, argv);
700
700
  success = result.success;
701
701
  if (!result.success && result.error) console.error(result.error.message);
@@ -1,4 +1,5 @@
1
- import { n as ResolvedFieldMeta, p as Example, s as AnyCommand, t as ExtractedFields } from "../schema-extractor-CXeUTW_Z.cjs";
1
+ import "../arg-registry-B4a4Fj7f.cjs";
2
+ import { n as ResolvedFieldMeta, p as Example, s as AnyCommand, t as ExtractedFields } from "../schema-extractor-DyfK21m_.cjs";
2
3
  import { z } from "zod";
3
4
  import * as fs from "node:fs";
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/executor/subcommand-router.ts","../../src/docs/render-args.ts","../../src/docs/types.ts","../../src/docs/default-renderers.ts","../../src/docs/doc-comparator.ts","../../src/docs/doc-generator.ts","../../src/docs/example-executor.ts","../../src/docs/golden-test.ts","../../src/docs/render-index.ts"],"mappings":";;;;;;;;;AAQA;;iBAAsB,kBAAA,CACpB,GAAA,EAAK,UA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3,"file":"index.d.cts","names":[],"sources":["../../src/executor/subcommand-router.ts","../../src/docs/render-args.ts","../../src/docs/types.ts","../../src/docs/default-renderers.ts","../../src/docs/doc-comparator.ts","../../src/docs/doc-generator.ts","../../src/docs/example-executor.ts","../../src/docs/golden-test.ts","../../src/docs/render-index.ts"],"mappings":";;;;;;;;;;;AAQA;iBAAsB,kBAAA,CACpB,GAAA,EAAK,UAAA,UAAoB,OAAA,CAAQ,UAAA,KAChC,OAAA,CAAQ,UAAA;;;;;;;KCFC,SAAA,GAAY,MAAA,SAAe,CAAA,CAAE,OAAA;ADAzC;;;AAAA,KCKY,gBAAA;EDJuB,6DCMjC,OAAA;AAAA;;;;;;;;;;;;;;;AAPF;;;;;;;;;iBA8CgB,eAAA,CAAgB,IAAA,EAAM,SAAA,EAAW,OAAA,GAAU,gBAAA;;;;KCjD/C,YAAA;;AFGZ;;KEEY,mBAAA;EFDL,4DEGL,YAAA,GAAe,YAAA,EFHU;EEKzB,QAAA;AAAA;;;;UAMe,WAAA;EFXkB;EEajC,IAAA;EFZC;EEcD,WAAA;EFdmB;EEgBnB,eAAA;;EAEA,WAAA;;EAEA,KAAA;EDtBmB;ECwBnB,cAAA,EAAgB,iBAAA;EDxBY;EC0B5B,OAAA,EAAS,iBAAA;ED1B4B;EC4BrC,WAAA,EAAa,cAAA;ED5BiC;EC8B9C,SAAA,EAAW,eAAA;EDzBD;EC2BV,OAAA,EAAS,UAAA;;EAET,KAAA;ED3BO;EC6BP,QAAA;EDU6B;ECR7B,OAAA,GAAU,MAAA;EDQ+D;ECNzE,QAAA,GAAW,OAAA;EDMmB;ECJ9B,cAAA,GAAiB,sBAAA;AAAA;;;;UAMF,cAAA;;EAEf,IAAA;EArDsB;EAuDtB,WAAA;EAvDsB;EAyDtB,QAAA;AAAA;;;;UAMe,sBAAA;EAxDA;EA0Df,GAAA;EAxDQ;EA0DR,IAAA;EApDe;EAsDf,cAAA;;EAEA,MAAA;EA1CS;EA4CT,MAAA;EAxCW;E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