politty 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/docs/index.d.ts +44 -2
  3. package/dist/docs/index.js +827 -43
  4. package/dist/index.js +1 -1
  5. package/dist/{runner-D43SkHt5.js → runner-APRZYXUS.js} +74 -3
  6. package/package.json +22 -67
  7. package/dist/arg-registry-DDJpsUea.d.cts +0 -942
  8. package/dist/arg-registry-DDJpsUea.d.cts.map +0 -1
  9. package/dist/arg-registry-DDJpsUea.d.ts.map +0 -1
  10. package/dist/augment.cjs +0 -0
  11. package/dist/augment.d.cts +0 -17
  12. package/dist/augment.d.cts.map +0 -1
  13. package/dist/augment.d.ts.map +0 -1
  14. package/dist/cli.cjs +0 -54
  15. package/dist/cli.cjs.map +0 -1
  16. package/dist/cli.d.cts +0 -1
  17. package/dist/cli.js.map +0 -1
  18. package/dist/completion/index.cjs +0 -23
  19. package/dist/completion/index.d.cts +0 -3
  20. package/dist/completion-CLHO3Xaz.cjs +0 -5769
  21. package/dist/completion-CLHO3Xaz.cjs.map +0 -1
  22. package/dist/completion-DHnVx9Zk.js.map +0 -1
  23. package/dist/docs/index.cjs +0 -2343
  24. package/dist/docs/index.cjs.map +0 -1
  25. package/dist/docs/index.d.cts +0 -710
  26. package/dist/docs/index.d.cts.map +0 -1
  27. package/dist/docs/index.d.ts.map +0 -1
  28. package/dist/docs/index.js.map +0 -1
  29. package/dist/index-DKGn3lIl.d.ts.map +0 -1
  30. package/dist/index-WyViqW59.d.cts +0 -663
  31. package/dist/index-WyViqW59.d.cts.map +0 -1
  32. package/dist/index.cjs +0 -45
  33. package/dist/index.d.cts +0 -685
  34. package/dist/index.d.cts.map +0 -1
  35. package/dist/index.d.ts.map +0 -1
  36. package/dist/log-collector-DK32-73m.js.map +0 -1
  37. package/dist/log-collector-DUqC427m.cjs +0 -185
  38. package/dist/log-collector-DUqC427m.cjs.map +0 -1
  39. package/dist/prompt/clack/index.cjs +0 -33
  40. package/dist/prompt/clack/index.cjs.map +0 -1
  41. package/dist/prompt/clack/index.d.cts +0 -18
  42. package/dist/prompt/clack/index.d.cts.map +0 -1
  43. package/dist/prompt/clack/index.d.ts.map +0 -1
  44. package/dist/prompt/clack/index.js.map +0 -1
  45. package/dist/prompt/index.cjs +0 -7
  46. package/dist/prompt/index.d.cts +0 -108
  47. package/dist/prompt/index.d.cts.map +0 -1
  48. package/dist/prompt/index.d.ts.map +0 -1
  49. package/dist/prompt/inquirer/index.cjs +0 -48
  50. package/dist/prompt/inquirer/index.cjs.map +0 -1
  51. package/dist/prompt/inquirer/index.d.cts +0 -18
  52. package/dist/prompt/inquirer/index.d.cts.map +0 -1
  53. package/dist/prompt/inquirer/index.d.ts.map +0 -1
  54. package/dist/prompt/inquirer/index.js.map +0 -1
  55. package/dist/prompt-Bs9e-Em3.cjs +0 -196
  56. package/dist/prompt-Bs9e-Em3.cjs.map +0 -1
  57. package/dist/prompt-Cc8Tfmdv.js.map +0 -1
  58. package/dist/runner-D43SkHt5.js.map +0 -1
  59. package/dist/runner-DvFvokV6.cjs +0 -2865
  60. package/dist/runner-DvFvokV6.cjs.map +0 -1
  61. package/dist/schema-extractor-BxSRwLrx.cjs +0 -710
  62. package/dist/schema-extractor-BxSRwLrx.cjs.map +0 -1
  63. package/dist/schema-extractor-Dqe7_kyQ.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as renderMarkdown, D as styles, E as setColorEnabled, O as symbols, S as renderInline, T as logger, _ as DuplicateFieldError, a as parseArgv, b as ReservedAliasError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as DuplicateAliasError, h as CaseVariantCollisionError, i as formatValidationErrors, k as createDualCaseProxy, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateNegationError, w as isColorEnabled, x as generateHelp, y as PositionalConfigError } from "./runner-D43SkHt5.js";
1
+ import { C as renderMarkdown, D as styles, E as setColorEnabled, O as symbols, S as renderInline, T as logger, _ as DuplicateFieldError, a as parseArgv, b as ReservedAliasError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as DuplicateAliasError, h as CaseVariantCollisionError, i as formatValidationErrors, k as createDualCaseProxy, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateNegationError, w as isColorEnabled, x as generateHelp, y as PositionalConfigError } from "./runner-APRZYXUS.js";
2
2
  import { a as toCamelCase, f as isLazyCommand, h as arg, i as getUnknownKeysMode, o as toKebabCase, p as lazy, t as extractFields } from "./schema-extractor-Dqe7_kyQ.js";
3
3
  import { S as defineCommand, a as generateCompletion, p as generateBundledCompletionWorker, s as withCompletionCommand, x as createDefineCommand } from "./completion-DHnVx9Zk.js";
4
4
 
@@ -1,7 +1,6 @@
1
1
  import { a as toCamelCase, c as listSubCommands, d as resolveSubcommandWithAlias, f as isLazyCommand, l as resolveLazyCommand, m as resolveSubCommandMeta, n as getAllAliases, o as toKebabCase, r as getExtractedFields, s as listSubCommandNamesWithAliases, t as extractFields } from "./schema-extractor-Dqe7_kyQ.js";
2
2
  import { n as emptyLogs, r as mergeLogs, t as createLogCollector } from "./log-collector-DK32-73m.js";
3
- import { styleText } from "node:util";
4
- import stringWidth from "string-width";
3
+ import { stripVTControlCharacters, styleText } from "node:util";
5
4
 
6
5
  //#region \0rolldown/runtime.js
7
6
  var __defProp = Object.defineProperty;
@@ -280,6 +279,78 @@ const logger = {
280
279
  }
281
280
  };
282
281
 
282
+ //#endregion
283
+ //#region src/output/string-width.ts
284
+ /**
285
+ * Lightweight replacement for the `string-width` package.
286
+ *
287
+ * Computes the visual (terminal) width of a string by:
288
+ * 1. Stripping ANSI escape codes (via Node's `stripVTControlCharacters`)
289
+ * 2. Skipping zero-width characters (combining marks, control chars, etc.)
290
+ * 3. Counting East Asian wide / fullwidth characters and most emoji as 2
291
+ * 4. Counting everything else as 1
292
+ *
293
+ * This covers the cases the markdown renderer cares about (CJK text, emoji,
294
+ * and already-styled ANSI strings) without pulling in an external dependency.
295
+ */
296
+ /**
297
+ * Whether a code point has no visual width (combining marks, zero-width
298
+ * spaces/joiners, variation selectors, control characters).
299
+ */
300
+ function isZeroWidth(cp) {
301
+ return cp <= 31 || cp >= 127 && cp <= 159 || cp >= 768 && cp <= 879 || cp >= 6832 && cp <= 6911 || cp >= 7616 && cp <= 7679 || cp >= 8400 && cp <= 8447 || cp >= 65056 && cp <= 65071 || cp === 8203 || cp >= 8204 && cp <= 8207 || cp === 65279 || cp >= 65024 && cp <= 65039 || cp >= 917760 && cp <= 917999;
302
+ }
303
+ /**
304
+ * Whether a code point is rendered at double (full) width in a terminal.
305
+ * Based on Unicode East Asian Width (Wide/Fullwidth) plus common emoji ranges.
306
+ */
307
+ function isFullWidth(cp) {
308
+ return cp >= 4352 && cp <= 4447 || cp >= 11904 && cp <= 12350 || cp >= 12353 && cp <= 13311 || cp >= 13312 && cp <= 19903 || cp >= 19968 && cp <= 40959 || cp >= 40960 && cp <= 42191 || cp >= 43360 && cp <= 43391 || cp >= 44032 && cp <= 55203 || cp >= 63744 && cp <= 64255 || cp >= 65040 && cp <= 65049 || cp >= 65072 && cp <= 65135 || cp >= 65280 && cp <= 65376 || cp >= 65504 && cp <= 65510 || cp >= 110592 && cp <= 110959 || cp >= 127488 && cp <= 127569 || cp >= 131072 && cp <= 262141 || cp >= 9728 && cp <= 10175 || cp >= 126976 && cp <= 129791;
309
+ }
310
+ /**
311
+ * Visual width of a single grapheme cluster (a user-perceived character).
312
+ *
313
+ * Iterating by code point would over-count multi-code-point clusters such as
314
+ * ZWJ emoji sequences (👨‍👩‍👧), regional-indicator flags (🇯🇵), and emoji with
315
+ * skin-tone modifiers (👍🏽). These render as a single glyph, so the whole
316
+ * cluster contributes width 0/1/2 once.
317
+ */
318
+ function graphemeWidth(grapheme) {
319
+ let hasVisible = false;
320
+ let hasWide = false;
321
+ let hasEmojiVariation = false;
322
+ for (const char of grapheme) {
323
+ const cp = char.codePointAt(0);
324
+ if (cp === 65039) {
325
+ hasEmojiVariation = true;
326
+ continue;
327
+ }
328
+ if (isZeroWidth(cp)) continue;
329
+ hasVisible = true;
330
+ if (isFullWidth(cp)) hasWide = true;
331
+ }
332
+ if (!hasVisible) return 0;
333
+ return hasWide || hasEmojiVariation ? 2 : 1;
334
+ }
335
+ const segmenter = (() => {
336
+ try {
337
+ return new Intl.Segmenter("en", { granularity: "grapheme" });
338
+ } catch {
339
+ return;
340
+ }
341
+ })();
342
+ /**
343
+ * Compute the visual width of a string as rendered in a terminal.
344
+ */
345
+ function stringWidth(input) {
346
+ if (input.length === 0) return 0;
347
+ const str = input.includes("\x1B") || input.includes("›") ? stripVTControlCharacters(input) : input;
348
+ let width = 0;
349
+ if (segmenter) for (const { segment } of segmenter.segment(str)) width += graphemeWidth(segment);
350
+ else for (const char of str) width += graphemeWidth(char);
351
+ return width;
352
+ }
353
+
283
354
  //#endregion
284
355
  //#region src/output/markdown-renderer.ts
285
356
  /**
@@ -2705,4 +2776,4 @@ function extractAndValidateGlobal(options) {
2705
2776
 
2706
2777
  //#endregion
2707
2778
  export { renderMarkdown as C, styles as D, setColorEnabled as E, symbols as O, renderInline as S, logger as T, DuplicateFieldError as _, parseArgv as a, ReservedAliasError as b, validateCommand as c, validateDuplicateFields as d, validateDuplicateNegations as f, DuplicateAliasError as g, CaseVariantCollisionError as h, formatValidationErrors as i, createDualCaseProxy as k, validateCrossSchemaCollisions as l, validateReservedAliases as m, runMain as n, formatCommandValidationErrors as o, validatePositionalConfig as p, runner_exports as r, validateCaseVariantCollisions as s, runCommand as t, validateDuplicateAliases as u, DuplicateNegationError as v, isColorEnabled as w, generateHelp as x, PositionalConfigError as y };
2708
- //# sourceMappingURL=runner-D43SkHt5.js.map
2779
+ //# sourceMappingURL=runner-APRZYXUS.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "politty",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "A lightweight CLI framework inspired by citty with zod v4 registry integration for type-safe metadata management",
5
5
  "keywords": [
6
6
  "argument-parser",
@@ -20,100 +20,55 @@
20
20
  "politty": "./dist/cli.js"
21
21
  },
22
22
  "files": [
23
- "dist"
23
+ "dist/**/*.js",
24
+ "dist/**/*.d.ts"
24
25
  ],
25
26
  "type": "module",
26
- "main": "./dist/index.cjs",
27
- "module": "./dist/index.js",
27
+ "main": "./dist/index.js",
28
28
  "types": "./dist/index.d.ts",
29
29
  "exports": {
30
30
  ".": {
31
- "import": {
32
- "types": "./dist/index.d.ts",
33
- "default": "./dist/index.js"
34
- },
35
- "require": {
36
- "types": "./dist/index.d.cts",
37
- "default": "./dist/index.cjs"
38
- }
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
39
33
  },
40
34
  "./augment": {
41
- "import": {
42
- "types": "./dist/augment.d.ts",
43
- "default": "./dist/augment.js"
44
- },
45
- "require": {
46
- "types": "./dist/augment.d.cts",
47
- "default": "./dist/augment.cjs"
48
- }
35
+ "types": "./dist/augment.d.ts",
36
+ "default": "./dist/augment.js"
49
37
  },
50
38
  "./docs": {
51
- "import": {
52
- "types": "./dist/docs/index.d.ts",
53
- "default": "./dist/docs/index.js"
54
- },
55
- "require": {
56
- "types": "./dist/docs/index.d.cts",
57
- "default": "./dist/docs/index.cjs"
58
- }
39
+ "types": "./dist/docs/index.d.ts",
40
+ "default": "./dist/docs/index.js"
59
41
  },
60
42
  "./completion": {
61
- "import": {
62
- "types": "./dist/completion/index.d.ts",
63
- "default": "./dist/completion/index.js"
64
- },
65
- "require": {
66
- "types": "./dist/completion/index.d.cts",
67
- "default": "./dist/completion/index.cjs"
68
- }
43
+ "types": "./dist/completion/index.d.ts",
44
+ "default": "./dist/completion/index.js"
69
45
  },
70
46
  "./prompt": {
71
- "import": {
72
- "types": "./dist/prompt/index.d.ts",
73
- "default": "./dist/prompt/index.js"
74
- },
75
- "require": {
76
- "types": "./dist/prompt/index.d.cts",
77
- "default": "./dist/prompt/index.cjs"
78
- }
47
+ "types": "./dist/prompt/index.d.ts",
48
+ "default": "./dist/prompt/index.js"
79
49
  },
80
50
  "./prompt/clack": {
81
- "import": {
82
- "types": "./dist/prompt/clack/index.d.ts",
83
- "default": "./dist/prompt/clack/index.js"
84
- },
85
- "require": {
86
- "types": "./dist/prompt/clack/index.d.cts",
87
- "default": "./dist/prompt/clack/index.cjs"
88
- }
51
+ "types": "./dist/prompt/clack/index.d.ts",
52
+ "default": "./dist/prompt/clack/index.js"
89
53
  },
90
54
  "./prompt/inquirer": {
91
- "import": {
92
- "types": "./dist/prompt/inquirer/index.d.ts",
93
- "default": "./dist/prompt/inquirer/index.js"
94
- },
95
- "require": {
96
- "types": "./dist/prompt/inquirer/index.d.cts",
97
- "default": "./dist/prompt/inquirer/index.cjs"
98
- }
55
+ "types": "./dist/prompt/inquirer/index.d.ts",
56
+ "default": "./dist/prompt/inquirer/index.js"
99
57
  }
100
58
  },
101
- "dependencies": {
102
- "string-width": "^8.2.0"
103
- },
104
59
  "devDependencies": {
105
60
  "@changesets/cli": "2.31.0",
106
61
  "@clack/prompts": "1.2.0",
107
62
  "@inquirer/prompts": "8.5.2",
108
63
  "@quansync/fs": "1.0.0",
109
- "@types/node": "25.9.2",
110
- "@typescript/native-preview": "7.0.0-dev.20260607.1",
64
+ "@types/node": "25.9.3",
65
+ "@typescript/native-preview": "7.0.0-dev.20260610.1",
111
66
  "@vitest/coverage-v8": "4.1.8",
112
67
  "knip": "6.16.1",
113
68
  "lefthook": "2.1.9",
114
69
  "organize-imports-cli": "1.0.2",
115
- "oxfmt": "0.53.0",
116
- "oxlint": "1.68.0",
70
+ "oxfmt": "0.54.0",
71
+ "oxlint": "1.69.0",
117
72
  "quansync": "1.0.0",
118
73
  "tsdown": "0.22.2",
119
74
  "tsx": "4.22.4",