politty 0.4.15 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{arg-registry-CB5gGtzp.d.cts → arg-registry-Cd6xnjHa.d.ts} +116 -4
  2. package/dist/arg-registry-Cd6xnjHa.d.ts.map +1 -0
  3. package/dist/{arg-registry-Dw0f11Zc.d.ts → arg-registry-MVWOAcvw.d.cts} +116 -4
  4. package/dist/arg-registry-MVWOAcvw.d.cts.map +1 -0
  5. package/dist/augment.d.cts +1 -1
  6. package/dist/augment.d.cts.map +1 -1
  7. package/dist/augment.d.ts +1 -1
  8. package/dist/augment.d.ts.map +1 -1
  9. package/dist/completion/index.cjs +2 -1
  10. package/dist/completion/index.d.cts +2 -2
  11. package/dist/completion/index.d.ts +2 -2
  12. package/dist/completion/index.js +2 -2
  13. package/dist/{completion-Ca5ESJlG.js → completion-B04iiki9.js} +512 -18
  14. package/dist/completion-B04iiki9.js.map +1 -0
  15. package/dist/{completion-B5fgnUGm.cjs → completion-BlZxMSeU.cjs} +516 -16
  16. package/dist/completion-BlZxMSeU.cjs.map +1 -0
  17. package/dist/docs/index.cjs +82 -22
  18. package/dist/docs/index.cjs.map +1 -1
  19. package/dist/docs/index.d.cts +1 -1
  20. package/dist/docs/index.d.cts.map +1 -1
  21. package/dist/docs/index.d.ts +1 -1
  22. package/dist/docs/index.d.ts.map +1 -1
  23. package/dist/docs/index.js +92 -31
  24. package/dist/docs/index.js.map +1 -1
  25. package/dist/{index-Dg9Fpz0R.d.ts → index-CPebddth.d.cts} +56 -4
  26. package/dist/index-CPebddth.d.cts.map +1 -0
  27. package/dist/{index-C1gGgUeB.d.cts → index-DR9HLxIP.d.ts} +56 -4
  28. package/dist/index-DR9HLxIP.d.ts.map +1 -0
  29. package/dist/index.cjs +5 -3
  30. package/dist/index.d.cts +36 -4
  31. package/dist/index.d.cts.map +1 -1
  32. package/dist/index.d.ts +36 -4
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +4 -4
  35. package/dist/log-collector-Cd2_mv87.cjs.map +1 -1
  36. package/dist/log-collector-Cu6MCtAx.js.map +1 -1
  37. package/dist/prompt/clack/index.cjs.map +1 -1
  38. package/dist/prompt/clack/index.d.cts +1 -1
  39. package/dist/prompt/clack/index.d.cts.map +1 -1
  40. package/dist/prompt/clack/index.d.ts +1 -1
  41. package/dist/prompt/clack/index.d.ts.map +1 -1
  42. package/dist/prompt/clack/index.js.map +1 -1
  43. package/dist/prompt/index.d.cts +1 -1
  44. package/dist/prompt/index.d.cts.map +1 -1
  45. package/dist/prompt/index.d.ts +1 -1
  46. package/dist/prompt/index.d.ts.map +1 -1
  47. package/dist/prompt/inquirer/index.cjs.map +1 -1
  48. package/dist/prompt/inquirer/index.d.cts +1 -1
  49. package/dist/prompt/inquirer/index.d.cts.map +1 -1
  50. package/dist/prompt/inquirer/index.d.ts +1 -1
  51. package/dist/prompt/inquirer/index.d.ts.map +1 -1
  52. package/dist/prompt/inquirer/index.js.map +1 -1
  53. package/dist/prompt-BKHqGrFw.js.map +1 -1
  54. package/dist/prompt-aXfSf27y.cjs.map +1 -1
  55. package/dist/{runner-DKAQBNNh.js → runner-BHeCMEa5.js} +309 -45
  56. package/dist/runner-BHeCMEa5.js.map +1 -0
  57. package/dist/{runner-CriXJlm4.cjs → runner-BcyR6Z8r.cjs} +320 -44
  58. package/dist/runner-BcyR6Z8r.cjs.map +1 -0
  59. package/dist/{subcommand-router-CqZX3orq.cjs → subcommand-router-DQy0KZU-.cjs} +41 -3
  60. package/dist/subcommand-router-DQy0KZU-.cjs.map +1 -0
  61. package/dist/{subcommand-router-ENeCymvX.js → subcommand-router-XZBWe8HN.js} +41 -3
  62. package/dist/subcommand-router-XZBWe8HN.js.map +1 -0
  63. package/package.json +16 -16
  64. package/dist/arg-registry-CB5gGtzp.d.cts.map +0 -1
  65. package/dist/arg-registry-Dw0f11Zc.d.ts.map +0 -1
  66. package/dist/completion-B5fgnUGm.cjs.map +0 -1
  67. package/dist/completion-Ca5ESJlG.js.map +0 -1
  68. package/dist/index-C1gGgUeB.d.cts.map +0 -1
  69. package/dist/index-Dg9Fpz0R.d.ts.map +0 -1
  70. package/dist/runner-CriXJlm4.cjs.map +0 -1
  71. package/dist/runner-DKAQBNNh.js.map +0 -1
  72. package/dist/subcommand-router-CqZX3orq.cjs.map +0 -1
  73. package/dist/subcommand-router-ENeCymvX.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_log_collector = require('../log-collector-Cd2_mv87.cjs');
3
- const require_subcommand_router = require('../subcommand-router-CqZX3orq.cjs');
3
+ const require_subcommand_router = require('../subcommand-router-DQy0KZU-.cjs');
4
4
  let zod = require("zod");
5
- let node_util = require("node:util");
6
5
  let node_fs = require("node:fs");
7
6
  node_fs = require_log_collector.__toESM(node_fs, 1);
8
7
  let node_path = require("node:path");
9
8
  node_path = require_log_collector.__toESM(node_path, 1);
9
+ let node_util = require("node:util");
10
10
 
11
11
  //#region src/docs/types.ts
12
12
  /**
@@ -114,6 +114,13 @@ function escapeTableCell$2(str) {
114
114
  return str.replace(/\|/g, "\\|").replace(/\n/g, " ");
115
115
  }
116
116
  /**
117
+ * Marker appended to a custom negation row/line so readers can see which
118
+ * positive flag it negates (e.g. `--monochrome` → `(↔ \`--color\`)`).
119
+ */
120
+ function negationRelationMarker(opt) {
121
+ return `(↔ \`--${opt.cliName}\`)`;
122
+ }
123
+ /**
117
124
  * Format default value for display
118
125
  */
119
126
  function formatDefaultValue$1(value) {
@@ -174,25 +181,39 @@ function resolvePlaceholder(opt) {
174
181
  }
175
182
  /**
176
183
  * Format option name for table display (e.g., `--dry-run` or `--port <PORT>`)
184
+ *
185
+ * Boolean fields with a custom inline `negation` (no separate description) are
186
+ * shown as `\`--cache\` / \`--disable-cache\``.
177
187
  */
178
188
  function formatOptionName(opt) {
179
189
  const placeholder = resolvePlaceholder(opt);
180
- return opt.type === "boolean" ? `\`--${opt.cliName}\`` : `\`--${opt.cliName} <${placeholder}>\``;
190
+ if (opt.type === "boolean") {
191
+ const positive = `\`--${opt.cliName}\``;
192
+ if (opt.negationDisplay && !opt.negationDescription) return `${positive} / \`--${opt.negationDisplay}\``;
193
+ return positive;
194
+ }
195
+ return `\`--${opt.cliName} <${placeholder}>\``;
181
196
  }
182
197
  /**
183
- * Format option flags for list display (uses kebab-case cliName)
198
+ * Format option flags for list display (uses kebab-case cliName).
199
+ * Aliases are joined with `, `; the inline negation (when no separate
200
+ * `negationDescription` is set) is appended with ` / ` so it stays
201
+ * visually distinct from aliases, matching help and table output.
184
202
  */
185
203
  function formatOptionFlags(opt) {
186
204
  const placeholder = resolvePlaceholder(opt);
187
205
  const longFlag = opt.type === "boolean" ? `--${opt.cliName}` : `--${opt.cliName} <${placeholder}>`;
188
- if (!opt.alias || opt.alias.length === 0) return `\`${longFlag}\``;
189
- const shortParts = opt.alias.filter((a) => a.length === 1).map((a) => `\`-${a}\``);
190
- const longParts = opt.alias.filter((a) => a.length > 1).map((a) => `\`--${a}\``);
191
- return [
192
- ...shortParts,
193
- `\`${longFlag}\``,
194
- ...longParts
195
- ].join(", ");
206
+ const parts = [];
207
+ if (opt.alias) {
208
+ for (const a of opt.alias) if (a.length === 1) parts.push(`\`-${a}\``);
209
+ }
210
+ parts.push(`\`${longFlag}\``);
211
+ if (opt.alias) {
212
+ for (const a of opt.alias) if (a.length > 1) parts.push(`\`--${a}\``);
213
+ }
214
+ const aliasJoined = parts.join(", ");
215
+ if (opt.type === "boolean" && opt.negationDisplay && !opt.negationDescription) return `${aliasJoined} / \`--${opt.negationDisplay}\``;
216
+ return aliasJoined;
196
217
  }
197
218
  /**
198
219
  * Format aliases for a markdown table cell
@@ -244,6 +265,12 @@ function renderOptionsTable(info) {
244
265
  const envNames = formatEnvNames(opt.env);
245
266
  lines.push(`| ${optionName} | ${alias} | ${desc} | ${required} | ${defaultVal} | ${envNames} |`);
246
267
  } else lines.push(`| ${optionName} | ${alias} | ${desc} | ${required} | ${defaultVal} |`);
268
+ if (opt.type === "boolean" && opt.negationDisplay && opt.negationDescription) {
269
+ const negName = `\`--${opt.negationDisplay}\``;
270
+ const negDesc = `${escapeTableCell$2(opt.negationDescription)} ${negationRelationMarker(opt)}`;
271
+ if (hasEnv) lines.push(`| ${negName} | - | ${negDesc} | ${required} | - | - |`);
272
+ else lines.push(`| ${negName} | - | ${negDesc} | ${required} | - |`);
273
+ }
247
274
  }
248
275
  return lines.join("\n");
249
276
  }
@@ -268,6 +295,7 @@ function renderOptionsList(info) {
268
295
  const defaultVal = opt.defaultValue !== void 0 ? ` (default: ${JSON.stringify(opt.defaultValue)})` : "";
269
296
  const envInfo = formatEnvInfo(opt.env);
270
297
  lines.push(`- ${flags}${desc}${required}${defaultVal}${envInfo}`);
298
+ if (opt.type === "boolean" && opt.negationDisplay && opt.negationDescription) lines.push(`- \`--${opt.negationDisplay}\` - ${opt.negationDescription} ${negationRelationMarker(opt)}`);
271
299
  }
272
300
  return lines.join("\n");
273
301
  }
@@ -278,15 +306,13 @@ function generateAnchor$1(commandPath) {
278
306
  return commandPath.join("-").toLowerCase();
279
307
  }
280
308
  /**
281
- * Generate relative path from one file to another
309
+ * Generate relative path from one file to another.
310
+ * Always emits forward slashes so Markdown links remain portable across OSes.
282
311
  */
283
312
  function getRelativePath(from, to) {
284
- const fromParts = from.split("/").slice(0, -1);
285
- const toParts = to.split("/");
286
- let commonLength = 0;
287
- while (commonLength < fromParts.length && commonLength < toParts.length - 1 && fromParts[commonLength] === toParts[commonLength]) commonLength++;
288
- const upCount = fromParts.length - commonLength;
289
- return [...Array(upCount).fill(".."), ...toParts.slice(commonLength)].join("/") || (toParts[toParts.length - 1] ?? "");
313
+ const fromPosix = from.replace(/\\/g, "/");
314
+ const toPosix = to.replace(/\\/g, "/");
315
+ return node_path.default.posix.relative(node_path.default.posix.dirname(fromPosix), toPosix);
290
316
  }
291
317
  /**
292
318
  * Render subcommands as table
@@ -318,6 +344,12 @@ function renderOptionsTableFromArray(options) {
318
344
  const envNames = formatEnvNames(opt.env);
319
345
  lines.push(`| ${optionName} | ${alias} | ${desc} | ${required} | ${defaultVal} | ${envNames} |`);
320
346
  } else lines.push(`| ${optionName} | ${alias} | ${desc} | ${required} | ${defaultVal} |`);
347
+ if (opt.type === "boolean" && opt.negationDisplay && opt.negationDescription) {
348
+ const negName = `\`--${opt.negationDisplay}\``;
349
+ const negDesc = `${escapeTableCell$2(opt.negationDescription)} ${negationRelationMarker(opt)}`;
350
+ if (hasEnv) lines.push(`| ${negName} | - | ${negDesc} | ${required} | - | - |`);
351
+ else lines.push(`| ${negName} | - | ${negDesc} | ${required} | - |`);
352
+ }
321
353
  }
322
354
  return lines.join("\n");
323
355
  }
@@ -399,6 +431,7 @@ function renderOptionsListFromArray(options) {
399
431
  const defaultVal = opt.defaultValue !== void 0 ? ` (default: ${JSON.stringify(opt.defaultValue)})` : "";
400
432
  const envInfo = formatEnvInfo(opt.env);
401
433
  lines.push(`- ${flags}${desc}${required}${defaultVal}${envInfo}`);
434
+ if (opt.type === "boolean" && opt.negationDisplay && opt.negationDescription) lines.push(`- \`--${opt.negationDisplay}\` - ${opt.negationDescription} ${negationRelationMarker(opt)}`);
402
435
  }
403
436
  return lines.join("\n");
404
437
  }
@@ -650,8 +683,11 @@ function createCommandRenderer(options = {}) {
650
683
  * Default renderers presets
651
684
  */
652
685
  const defaultRenderers = {
686
+ /** Standard command documentation */
653
687
  command: (options) => createCommandRenderer(options),
688
+ /** Table style options (default) */
654
689
  tableStyle: createCommandRenderer({ optionStyle: "table" }),
690
+ /** List style options */
655
691
  listStyle: createCommandRenderer({ optionStyle: "list" })
656
692
  };
657
693
 
@@ -837,7 +873,7 @@ async function executeSingleExample(example, rootCommand, commandPath) {
837
873
  collector.start();
838
874
  let success = true;
839
875
  try {
840
- const { runCommand } = await Promise.resolve().then(() => require("../runner-CriXJlm4.cjs")).then((n) => n.runner_exports);
876
+ const { runCommand } = await Promise.resolve().then(() => require("../runner-BcyR6Z8r.cjs")).then((n) => n.runner_exports);
841
877
  const result = await runCommand(rootCommand, argv);
842
878
  success = result.success;
843
879
  if (!result.success && result.error) console.error(result.error.message);
@@ -985,7 +1021,11 @@ function renderFilteredTable(options, columns) {
985
1021
  for (const col of columns) switch (col) {
986
1022
  case "option": {
987
1023
  const placeholder = opt.placeholder ?? opt.cliName.toUpperCase().replace(/-/g, "_");
988
- const optionName = opt.type === "boolean" ? `\`--${opt.cliName}\`` : `\`--${opt.cliName} <${placeholder}>\``;
1024
+ let optionName;
1025
+ if (opt.type === "boolean") {
1026
+ optionName = `\`--${opt.cliName}\``;
1027
+ if (opt.negationDisplay && !opt.negationDescription) optionName += ` / \`--${opt.negationDisplay}\``;
1028
+ } else optionName = `\`--${opt.cliName} <${placeholder}>\``;
989
1029
  cells.push(optionName);
990
1030
  break;
991
1031
  }
@@ -1008,6 +1048,26 @@ function renderFilteredTable(options, columns) {
1008
1048
  }
1009
1049
  }
1010
1050
  lines.push(`| ${cells.join(" | ")} |`);
1051
+ if (opt.type === "boolean" && opt.negationDisplay && opt.negationDescription) {
1052
+ const negCells = [];
1053
+ for (const col of columns) switch (col) {
1054
+ case "option":
1055
+ negCells.push(`\`--${opt.negationDisplay}\``);
1056
+ break;
1057
+ case "description":
1058
+ negCells.push(`${escapeTableCell$1(opt.negationDescription)} ${negationRelationMarker(opt)}`);
1059
+ break;
1060
+ case "required":
1061
+ negCells.push(opt.required ? "Yes" : "No");
1062
+ break;
1063
+ case "alias":
1064
+ case "default":
1065
+ case "env":
1066
+ negCells.push("-");
1067
+ break;
1068
+ }
1069
+ lines.push(`| ${negCells.join(" | ")} |`);
1070
+ }
1011
1071
  }
1012
1072
  return lines.join("\n");
1013
1073
  }
@@ -2175,7 +2235,7 @@ async function generateDoc(config) {
2175
2235
  if (globalOptionsResult.wasUpdated) markerUpdated = true;
2176
2236
  }
2177
2237
  const derivedCategories = deriveIndexFromFiles(files, rootDocFilePath, allCommands, ignores);
2178
- const indexScope = node_path.relative(process.cwd(), rootDocFilePath);
2238
+ const indexScope = node_path.relative(process.cwd(), rootDocFilePath).replace(/\\/g, "/");
2179
2239
  const indexResult = await processIndexMarker(content, derivedCategories, command, indexScope, updateMode, formatter, rootDoc.index);
2180
2240
  content = indexResult.content;
2181
2241
  rootDocDiffs.push(...indexResult.diffs);