@outfitter/cli 0.1.0-rc.1 → 0.1.0-rc.3

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 (266) hide show
  1. package/README.md +21 -32
  2. package/dist/actions.js +1 -1
  3. package/dist/borders/index.d.ts +3 -0
  4. package/dist/borders/index.js +13 -0
  5. package/dist/box/index.d.ts +4 -0
  6. package/dist/box/index.js +13 -0
  7. package/dist/cli.d.ts +2 -103
  8. package/dist/cli.js +4 -51
  9. package/dist/colors/index.d.ts +3 -0
  10. package/dist/colors/index.js +18 -0
  11. package/dist/command.d.ts +3 -37
  12. package/dist/command.js +5 -1
  13. package/dist/demo/index.d.ts +78 -0
  14. package/dist/demo/index.js +148 -0
  15. package/dist/demo/registry.d.ts +7 -0
  16. package/dist/demo/registry.js +28 -0
  17. package/dist/demo/renderers/borders.d.ts +7 -0
  18. package/dist/demo/renderers/borders.js +17 -0
  19. package/dist/demo/renderers/box.d.ts +7 -0
  20. package/dist/demo/renderers/box.js +18 -0
  21. package/dist/demo/renderers/colors.d.ts +7 -0
  22. package/dist/demo/renderers/colors.js +18 -0
  23. package/dist/demo/renderers/indicators.d.ts +7 -0
  24. package/dist/demo/renderers/indicators.js +17 -0
  25. package/dist/demo/renderers/list.d.ts +7 -0
  26. package/dist/demo/renderers/list.js +19 -0
  27. package/dist/demo/renderers/markdown.d.ts +7 -0
  28. package/dist/demo/renderers/markdown.js +18 -0
  29. package/dist/demo/renderers/progress.d.ts +7 -0
  30. package/dist/demo/renderers/progress.js +17 -0
  31. package/dist/demo/renderers/spinner.d.ts +7 -0
  32. package/dist/demo/renderers/spinner.js +19 -0
  33. package/dist/demo/renderers/table.d.ts +7 -0
  34. package/dist/demo/renderers/table.js +19 -0
  35. package/dist/demo/renderers/text.d.ts +7 -0
  36. package/dist/demo/renderers/text.js +16 -0
  37. package/dist/demo/renderers/tree.d.ts +7 -0
  38. package/dist/demo/renderers/tree.js +18 -0
  39. package/dist/demo/section.d.ts +5 -0
  40. package/dist/demo/section.js +23 -0
  41. package/dist/demo/templates.d.ts +4 -0
  42. package/dist/demo/templates.js +10 -0
  43. package/dist/demo/types.d.ts +3 -0
  44. package/dist/demo/types.js +8 -0
  45. package/dist/index.d.ts +5 -607
  46. package/dist/index.js +10 -44
  47. package/dist/input.d.ts +9 -123
  48. package/dist/input.js +2 -3
  49. package/dist/list/index.d.ts +3 -0
  50. package/dist/list/index.js +9 -0
  51. package/dist/output.d.ts +2 -68
  52. package/dist/output.js +4 -150
  53. package/dist/pagination.d.ts +1 -34
  54. package/dist/pagination.js +1 -1
  55. package/dist/preset/full.d.ts +14 -0
  56. package/dist/preset/full.js +41 -0
  57. package/dist/preset/standard.d.ts +11 -0
  58. package/dist/preset/standard.js +30 -0
  59. package/dist/prompt/confirm.d.ts +4 -0
  60. package/dist/prompt/confirm.js +9 -0
  61. package/dist/prompt/group.d.ts +4 -0
  62. package/dist/prompt/group.js +9 -0
  63. package/dist/prompt/index.d.ts +7 -0
  64. package/dist/prompt/index.js +32 -0
  65. package/dist/prompt/select.d.ts +4 -0
  66. package/dist/prompt/select.js +11 -0
  67. package/dist/prompt/text.d.ts +4 -0
  68. package/dist/prompt/text.js +11 -0
  69. package/dist/prompt/types.d.ts +3 -0
  70. package/dist/prompt/types.js +8 -0
  71. package/dist/prompt/validators.d.ts +2 -0
  72. package/dist/prompt/validators.js +8 -0
  73. package/dist/render/borders.d.ts +2 -0
  74. package/dist/render/borders.js +15 -0
  75. package/dist/render/box.d.ts +3 -0
  76. package/dist/render/box.js +23 -0
  77. package/dist/render/colors.d.ts +2 -0
  78. package/dist/render/colors.js +20 -0
  79. package/dist/render/date.d.ts +2 -0
  80. package/dist/render/date.js +12 -0
  81. package/dist/render/format-relative.d.ts +2 -0
  82. package/dist/render/format-relative.js +8 -0
  83. package/dist/render/format.d.ts +2 -0
  84. package/dist/render/format.js +10 -0
  85. package/dist/render/heading.d.ts +3 -0
  86. package/dist/render/heading.js +14 -0
  87. package/dist/render/index.d.ts +32 -0
  88. package/dist/render/index.js +235 -0
  89. package/dist/render/indicators.d.ts +2 -0
  90. package/dist/render/indicators.js +14 -0
  91. package/dist/render/json.d.ts +2 -0
  92. package/dist/render/json.js +10 -0
  93. package/dist/render/layout.d.ts +5 -0
  94. package/dist/render/layout.js +25 -0
  95. package/dist/render/list.d.ts +2 -0
  96. package/dist/render/list.js +8 -0
  97. package/dist/render/markdown.d.ts +2 -0
  98. package/dist/render/markdown.js +10 -0
  99. package/dist/render/progress.d.ts +2 -0
  100. package/dist/render/progress.js +8 -0
  101. package/dist/render/separator.d.ts +3 -0
  102. package/dist/render/separator.js +14 -0
  103. package/dist/render/shapes.d.ts +2 -0
  104. package/dist/render/shapes.js +35 -0
  105. package/dist/render/spinner.d.ts +2 -0
  106. package/dist/render/spinner.js +12 -0
  107. package/dist/render/stack.d.ts +3 -0
  108. package/dist/render/stack.js +38 -0
  109. package/dist/render/table.d.ts +3 -0
  110. package/dist/render/table.js +12 -0
  111. package/dist/render/text.d.ts +2 -0
  112. package/dist/render/text.js +27 -0
  113. package/dist/render/tree.d.ts +2 -0
  114. package/dist/render/tree.js +10 -0
  115. package/dist/render/types.d.ts +2 -0
  116. package/dist/render/types.js +1 -0
  117. package/dist/shared/@outfitter/cli-0ggcy7fa.js +20 -0
  118. package/dist/shared/@outfitter/cli-0psys2vm.js +7 -0
  119. package/dist/shared/@outfitter/cli-1bghjef6.js +352 -0
  120. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +45 -0
  121. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +50 -0
  122. package/dist/shared/@outfitter/cli-33e97cjs.d.ts +42 -0
  123. package/dist/shared/@outfitter/cli-34fqr7bp.js +37 -0
  124. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +97 -0
  125. package/dist/shared/@outfitter/cli-3dxmmy4c.d.ts +20 -0
  126. package/dist/shared/@outfitter/cli-3f12z5kf.d.ts +83 -0
  127. package/dist/shared/@outfitter/cli-3hp8qwx3.js +11 -0
  128. package/dist/shared/@outfitter/cli-3t2zaenc.d.ts +59 -0
  129. package/dist/shared/@outfitter/cli-4cb5g831.d.ts +147 -0
  130. package/dist/shared/@outfitter/cli-4w2a1rfy.d.ts +23 -0
  131. package/dist/shared/@outfitter/cli-4x6pqnez.js +20 -0
  132. package/dist/shared/@outfitter/cli-671sxkhj.js +146 -0
  133. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +51 -0
  134. package/dist/shared/@outfitter/cli-6fxffp8k.js +1 -0
  135. package/dist/shared/@outfitter/cli-6j9qynm8.js +118 -0
  136. package/dist/shared/@outfitter/cli-6m988kh0.d.ts +61 -0
  137. package/dist/shared/@outfitter/cli-72kg550t.d.ts +53 -0
  138. package/dist/shared/@outfitter/cli-74ba31gz.js +134 -0
  139. package/dist/shared/@outfitter/cli-7gnrb8cr.js +214 -0
  140. package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +59 -0
  141. package/dist/shared/@outfitter/cli-7nm6edvh.d.ts +17 -0
  142. package/dist/shared/@outfitter/cli-85fg2vr5.js +123 -0
  143. package/dist/shared/@outfitter/cli-8a8xrzhy.js +20 -0
  144. package/dist/shared/@outfitter/cli-8aa1vhdn.d.ts +119 -0
  145. package/dist/shared/@outfitter/cli-8bwaw3pz.js +7 -0
  146. package/dist/shared/@outfitter/cli-8j5k6mr3.js +71 -0
  147. package/dist/shared/@outfitter/cli-8rx4g3s5.d.ts +41 -0
  148. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +223 -0
  149. package/dist/shared/@outfitter/cli-96b2p4td.d.ts +56 -0
  150. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +190 -0
  151. package/dist/shared/@outfitter/cli-9mtjjykw.js +67 -0
  152. package/dist/shared/@outfitter/cli-9nbyj2bt.js +128 -0
  153. package/dist/shared/@outfitter/cli-a4q87517.d.ts +64 -0
  154. package/dist/shared/@outfitter/cli-afhjqmg3.js +63 -0
  155. package/dist/shared/@outfitter/cli-an9j0h80.js +117 -0
  156. package/dist/shared/@outfitter/cli-ay411nbr.js +122 -0
  157. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +132 -0
  158. package/dist/shared/@outfitter/cli-b5c2k0d7.js +39 -0
  159. package/dist/shared/@outfitter/cli-b5epywry.js +1 -0
  160. package/dist/shared/@outfitter/cli-bc17qeh2.js +19 -0
  161. package/dist/shared/@outfitter/cli-bcmcaz1b.js +23 -0
  162. package/dist/shared/@outfitter/cli-bf3vma4q.js +61 -0
  163. package/dist/shared/@outfitter/cli-c8q4f71g.js +144 -0
  164. package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +30 -0
  165. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +53 -0
  166. package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +42 -0
  167. package/dist/shared/@outfitter/cli-cs45xd6q.js +59 -0
  168. package/dist/shared/@outfitter/cli-d7jpshq5.d.ts +128 -0
  169. package/dist/shared/@outfitter/cli-d9ad0rqj.js +75 -0
  170. package/dist/shared/@outfitter/cli-daw296mv.js +61 -0
  171. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +91 -0
  172. package/dist/shared/@outfitter/cli-e73v3qqy.d.ts +93 -0
  173. package/dist/shared/@outfitter/cli-efy6jfcj.js +52 -0
  174. package/dist/shared/@outfitter/cli-en6zn6sj.js +1 -0
  175. package/dist/shared/@outfitter/cli-ep2cvtk8.js +48 -0
  176. package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +300 -0
  177. package/dist/shared/@outfitter/cli-f75h8e94.js +7 -0
  178. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +106 -0
  179. package/dist/shared/@outfitter/cli-feb5j90n.js +94 -0
  180. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +66 -0
  181. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +328 -0
  182. package/dist/shared/@outfitter/cli-j19a91ck.js +30 -0
  183. package/dist/shared/@outfitter/cli-j4n8gaf3.js +95 -0
  184. package/dist/shared/@outfitter/cli-jejfypgf.js +85 -0
  185. package/dist/shared/@outfitter/cli-jhcdwvpn.js +135 -0
  186. package/dist/shared/@outfitter/cli-jjemfdta.js +85 -0
  187. package/dist/shared/@outfitter/cli-kc84wmch.js +267 -0
  188. package/dist/shared/@outfitter/cli-ktqme80d.js +7 -0
  189. package/dist/shared/@outfitter/cli-mhamvbty.d.ts +34 -0
  190. package/dist/shared/@outfitter/cli-mq0jp15z.js +1 -0
  191. package/dist/shared/@outfitter/cli-mymyavvj.d.ts +26 -0
  192. package/dist/shared/@outfitter/cli-n17gt1dz.js +19 -0
  193. package/dist/shared/@outfitter/cli-n9dbh0hp.js +51 -0
  194. package/dist/shared/@outfitter/cli-nvvc92c8.js +128 -0
  195. package/dist/shared/@outfitter/cli-p1m5dhrs.js +169 -0
  196. package/dist/shared/@outfitter/cli-p38sfxyk.js +25 -0
  197. package/dist/shared/@outfitter/cli-p3dqm1vd.js +22 -0
  198. package/dist/shared/@outfitter/cli-p9j1phge.js +20 -0
  199. package/dist/shared/@outfitter/cli-pkxmzavm.js +62 -0
  200. package/dist/shared/@outfitter/cli-q8r6jarq.d.ts +24 -0
  201. package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +71 -0
  202. package/dist/shared/@outfitter/cli-qjfc3j11.d.ts +112 -0
  203. package/dist/shared/@outfitter/cli-qp4cbhqr.js +70 -0
  204. package/dist/shared/@outfitter/cli-s0kkx9m1.d.ts +164 -0
  205. package/dist/shared/@outfitter/cli-snxj55n6.js +43 -0
  206. package/dist/shared/@outfitter/cli-swwxvjvm.d.ts +24 -0
  207. package/dist/shared/@outfitter/cli-sx67mmfx.d.ts +98 -0
  208. package/dist/shared/@outfitter/cli-tarpsa8a.js +30 -0
  209. package/dist/shared/@outfitter/cli-thvzhjd1.js +126 -0
  210. package/dist/shared/@outfitter/cli-tqewy503.d.ts +36 -0
  211. package/dist/shared/@outfitter/cli-ttt7r0j7.d.ts +253 -0
  212. package/dist/shared/@outfitter/cli-tvw1xrdj.js +20 -0
  213. package/dist/shared/@outfitter/cli-v1tzwxkt.js +32 -0
  214. package/dist/shared/@outfitter/cli-vd60dj65.js +1 -0
  215. package/dist/shared/@outfitter/cli-vp88gxev.js +279 -0
  216. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +74 -0
  217. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +54 -0
  218. package/dist/shared/@outfitter/cli-w5y3xepp.js +20 -0
  219. package/dist/shared/@outfitter/cli-x4cavvc0.js +1 -0
  220. package/dist/shared/@outfitter/cli-xep6v2c0.js +52 -0
  221. package/dist/shared/@outfitter/cli-xg5y5fhk.js +86 -0
  222. package/dist/shared/@outfitter/cli-xsaheemc.d.ts +248 -0
  223. package/dist/shared/@outfitter/cli-xvqtqjxk.js +82 -0
  224. package/dist/shared/@outfitter/cli-y25tt8nc.d.ts +48 -0
  225. package/dist/shared/@outfitter/cli-zact3325.js +152 -0
  226. package/dist/shared/@outfitter/cli-zx598p8q.d.ts +26 -0
  227. package/dist/streaming/ansi.d.ts +2 -0
  228. package/dist/streaming/ansi.js +8 -0
  229. package/dist/streaming/index.d.ts +4 -0
  230. package/dist/streaming/index.js +17 -0
  231. package/dist/streaming/spinner.d.ts +3 -0
  232. package/dist/streaming/spinner.js +10 -0
  233. package/dist/streaming/writer.d.ts +2 -0
  234. package/dist/streaming/writer.js +9 -0
  235. package/dist/table/index.d.ts +4 -0
  236. package/dist/table/index.js +13 -0
  237. package/dist/terminal/detection.d.ts +2 -0
  238. package/dist/terminal/detection.js +23 -0
  239. package/dist/terminal/index.d.ts +2 -0
  240. package/dist/terminal/index.js +24 -0
  241. package/dist/theme/context.d.ts +9 -0
  242. package/dist/theme/context.js +14 -0
  243. package/dist/theme/create.d.ts +8 -0
  244. package/dist/theme/create.js +12 -0
  245. package/dist/theme/index.d.ts +17 -0
  246. package/dist/theme/index.js +42 -0
  247. package/dist/theme/presets/bold.d.ts +8 -0
  248. package/dist/theme/presets/bold.js +12 -0
  249. package/dist/theme/presets/default.d.ts +8 -0
  250. package/dist/theme/presets/default.js +11 -0
  251. package/dist/theme/presets/index.d.ts +12 -0
  252. package/dist/theme/presets/index.js +24 -0
  253. package/dist/theme/presets/minimal.d.ts +8 -0
  254. package/dist/theme/presets/minimal.js +12 -0
  255. package/dist/theme/presets/rounded.d.ts +8 -0
  256. package/dist/theme/presets/rounded.js +12 -0
  257. package/dist/theme/resolve.d.ts +8 -0
  258. package/dist/theme/resolve.js +11 -0
  259. package/dist/theme/types.d.ts +7 -0
  260. package/dist/theme/types.js +1 -0
  261. package/dist/tree/index.d.ts +3 -0
  262. package/dist/tree/index.js +11 -0
  263. package/dist/types.d.ts +1 -252
  264. package/dist/types.js +1 -1
  265. package/package.json +228 -20
  266. package/dist/shared/@outfitter/cli-4yy82cmp.js +0 -20
@@ -0,0 +1,85 @@
1
+ // @bun
2
+ import {
3
+ ANSI,
4
+ init_colors
5
+ } from "./cli-9nbyj2bt.js";
6
+ import {
7
+ __esm
8
+ } from "./cli-v1tzwxkt.js";
9
+
10
+ // packages/cli/src/render/text.ts
11
+ function stripAnsi(text) {
12
+ return text.replace(ANSI_REGEX, "");
13
+ }
14
+ function getStringWidth(text) {
15
+ return Bun.stringWidth(text);
16
+ }
17
+ function wrapText(text, width) {
18
+ return Bun.wrapAnsi(text, width);
19
+ }
20
+ function truncateText(text, maxWidth) {
21
+ const visibleWidth = getStringWidth(text);
22
+ if (visibleWidth <= maxWidth) {
23
+ return text;
24
+ }
25
+ const ellipsis = "...";
26
+ const ellipsisWidth = 3;
27
+ const targetWidth = maxWidth - ellipsisWidth;
28
+ if (targetWidth <= 0) {
29
+ return ellipsis.slice(0, maxWidth);
30
+ }
31
+ const stripped = stripAnsi(text);
32
+ let result = "";
33
+ let currentWidth = 0;
34
+ let textIndex = 0;
35
+ let fullIndex = 0;
36
+ while (currentWidth < targetWidth && textIndex < stripped.length) {
37
+ while (fullIndex < text.length && text[fullIndex] === "\x1B") {
38
+ const match = text.slice(fullIndex).match(/^\x1b\[[0-9;]*m/);
39
+ if (match) {
40
+ result += match[0];
41
+ fullIndex += match[0].length;
42
+ } else {
43
+ break;
44
+ }
45
+ }
46
+ if (fullIndex < text.length) {
47
+ const char = text[fullIndex];
48
+ if (char !== undefined) {
49
+ const charWidth = Bun.stringWidth(char);
50
+ if (currentWidth + charWidth <= targetWidth) {
51
+ result += char;
52
+ currentWidth += charWidth;
53
+ textIndex++;
54
+ fullIndex++;
55
+ } else {
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ }
61
+ const hasAnsi = result.includes("\x1B[");
62
+ return result + (hasAnsi ? ANSI.reset : "") + ellipsis;
63
+ }
64
+ function padText(text, width) {
65
+ const visibleWidth = getStringWidth(text);
66
+ const paddingNeeded = width - visibleWidth;
67
+ if (paddingNeeded <= 0) {
68
+ return text;
69
+ }
70
+ return text + " ".repeat(paddingNeeded);
71
+ }
72
+ function pluralize(count, singular, plural) {
73
+ const word = count === 1 ? singular : plural ?? `${singular}s`;
74
+ return `${count} ${word}`;
75
+ }
76
+ function slugify(text) {
77
+ return text.toLowerCase().replace(/&/g, "and").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
78
+ }
79
+ var ANSI_REGEX;
80
+ var init_text = __esm(() => {
81
+ init_colors();
82
+ ANSI_REGEX = /\x1b\[[0-9;]*m/g;
83
+ });
84
+
85
+ export { ANSI_REGEX, stripAnsi, getStringWidth, wrapText, truncateText, padText, pluralize, slugify, init_text };
@@ -0,0 +1,267 @@
1
+ // @bun
2
+ // packages/cli/src/demo/registry.ts
3
+ var THEME_METHOD_META = {
4
+ success: {
5
+ category: "semantic",
6
+ description: "Green for success messages",
7
+ defaultExample: "Operation completed"
8
+ },
9
+ warning: {
10
+ category: "semantic",
11
+ description: "Yellow for warnings",
12
+ defaultExample: "Proceed with caution"
13
+ },
14
+ error: {
15
+ category: "semantic",
16
+ description: "Red for errors",
17
+ defaultExample: "Something went wrong"
18
+ },
19
+ info: {
20
+ category: "semantic",
21
+ description: "Blue for information",
22
+ defaultExample: "For your information"
23
+ },
24
+ primary: {
25
+ category: "semantic",
26
+ description: "Default text (no color)",
27
+ defaultExample: "Main content"
28
+ },
29
+ secondary: {
30
+ category: "semantic",
31
+ description: "Gray for secondary text",
32
+ defaultExample: "Supporting text"
33
+ },
34
+ muted: {
35
+ category: "semantic",
36
+ description: "Dim for de-emphasized text",
37
+ defaultExample: "(optional)"
38
+ },
39
+ accent: {
40
+ category: "semantic",
41
+ description: "Cyan for highlights",
42
+ defaultExample: "Highlighted item"
43
+ },
44
+ highlight: {
45
+ category: "semantic",
46
+ description: "Bold for emphasis",
47
+ defaultExample: "Important"
48
+ },
49
+ link: {
50
+ category: "semantic",
51
+ description: "Cyan + underline for URLs",
52
+ defaultExample: "https://example.com"
53
+ },
54
+ destructive: {
55
+ category: "semantic",
56
+ description: "Bright red for dangerous actions",
57
+ defaultExample: "Delete forever"
58
+ },
59
+ subtle: {
60
+ category: "semantic",
61
+ description: "Dim gray for fine print",
62
+ defaultExample: "Fine print"
63
+ },
64
+ bold: {
65
+ category: "utility",
66
+ description: "Bold styling",
67
+ defaultExample: "Strong emphasis"
68
+ },
69
+ italic: {
70
+ category: "utility",
71
+ description: "Italic styling",
72
+ defaultExample: "Subtle emphasis"
73
+ },
74
+ underline: {
75
+ category: "utility",
76
+ description: "Underline styling",
77
+ defaultExample: "Underlined text"
78
+ },
79
+ dim: {
80
+ category: "utility",
81
+ description: "Dim styling",
82
+ defaultExample: "De-emphasized"
83
+ }
84
+ };
85
+ function getThemeMethodsByCategory() {
86
+ const semantic = [];
87
+ const utility = [];
88
+ for (const [key, meta] of Object.entries(THEME_METHOD_META)) {
89
+ if (meta.category === "semantic") {
90
+ semantic.push(key);
91
+ } else {
92
+ utility.push(key);
93
+ }
94
+ }
95
+ return { semantic, utility };
96
+ }
97
+ var BORDER_STYLE_META = {
98
+ single: {
99
+ value: "single",
100
+ label: "Single",
101
+ description: "Standard Unicode single-line borders (\u250C\u2500\u2510)"
102
+ },
103
+ double: {
104
+ value: "double",
105
+ label: "Double",
106
+ description: "Double-line borders (\u2554\u2550\u2557)"
107
+ },
108
+ rounded: {
109
+ value: "rounded",
110
+ label: "Rounded",
111
+ description: "Rounded corners with single lines (\u256D\u2500\u256E)"
112
+ },
113
+ heavy: {
114
+ value: "heavy",
115
+ label: "Heavy",
116
+ description: "Thick/heavy borders (\u250F\u2501\u2513)"
117
+ },
118
+ ascii: {
119
+ value: "ascii",
120
+ label: "ASCII",
121
+ description: "ASCII-only fallback (+, -, |)"
122
+ },
123
+ none: {
124
+ value: "none",
125
+ label: "None",
126
+ description: "No borders (empty strings)"
127
+ }
128
+ };
129
+ function getBorderStyles() {
130
+ return Object.keys(BORDER_STYLE_META);
131
+ }
132
+ var SPINNER_STYLE_META = {
133
+ dots: {
134
+ value: "dots",
135
+ label: "Dots",
136
+ description: "Braille dots animation (default, smooth)"
137
+ },
138
+ line: {
139
+ value: "line",
140
+ label: "Line",
141
+ description: "Classic ASCII spinner (-\\|/)"
142
+ },
143
+ arc: {
144
+ value: "arc",
145
+ label: "Arc",
146
+ description: "Corner arc rotation"
147
+ },
148
+ circle: {
149
+ value: "circle",
150
+ label: "Circle",
151
+ description: "Half-filled circle rotation"
152
+ },
153
+ bounce: {
154
+ value: "bounce",
155
+ label: "Bounce",
156
+ description: "Bouncing dot (vertical)"
157
+ },
158
+ ping: {
159
+ value: "ping",
160
+ label: "Ping",
161
+ description: "Bouncing dot in brackets (horizontal)"
162
+ }
163
+ };
164
+ function getSpinnerStyles() {
165
+ return Object.keys(SPINNER_STYLE_META);
166
+ }
167
+ var LIST_STYLE_META = {
168
+ dash: {
169
+ value: "dash",
170
+ label: "Dash",
171
+ description: "Uses - character (default)"
172
+ },
173
+ bullet: {
174
+ value: "bullet",
175
+ label: "Bullet",
176
+ description: "Uses \u2022 character"
177
+ },
178
+ number: {
179
+ value: "number",
180
+ label: "Number",
181
+ description: "Uses 1. for top-level, a. for nested, i. for deeply nested"
182
+ },
183
+ checkbox: {
184
+ value: "checkbox",
185
+ label: "Checkbox",
186
+ description: "Uses \u2610 for unchecked, \u2611 for checked"
187
+ }
188
+ };
189
+ function getListStyles() {
190
+ return Object.keys(LIST_STYLE_META);
191
+ }
192
+ var PRIMITIVE_META = {
193
+ colors: {
194
+ id: "colors",
195
+ name: "Colors",
196
+ description: "Semantic color theme with ANSI support",
197
+ importExample: 'import { createTheme } from "@outfitter/cli/render";'
198
+ },
199
+ borders: {
200
+ id: "borders",
201
+ name: "Borders",
202
+ description: "Box-drawing character sets",
203
+ importExample: 'import { BORDERS, getBorderCharacters } from "@outfitter/cli/render";'
204
+ },
205
+ spinner: {
206
+ id: "spinner",
207
+ name: "Spinner",
208
+ description: "Animated spinners for async operations",
209
+ importExample: 'import { renderSpinner, SPINNERS } from "@outfitter/cli/render";'
210
+ },
211
+ list: {
212
+ id: "list",
213
+ name: "List",
214
+ description: "Bullet, numbered, and checkbox lists",
215
+ importExample: 'import { renderList } from "@outfitter/cli/render";'
216
+ },
217
+ box: {
218
+ id: "box",
219
+ name: "Box",
220
+ description: "Bordered panels with optional titles",
221
+ importExample: 'import { renderBox } from "@outfitter/cli/render";'
222
+ },
223
+ table: {
224
+ id: "table",
225
+ name: "Table",
226
+ description: "Unicode tables with multiple border styles",
227
+ importExample: 'import { renderTable } from "@outfitter/cli/render";'
228
+ },
229
+ progress: {
230
+ id: "progress",
231
+ name: "Progress",
232
+ description: "Progress bars with filled/empty segments",
233
+ importExample: 'import { renderProgress } from "@outfitter/cli/render";'
234
+ },
235
+ tree: {
236
+ id: "tree",
237
+ name: "Tree",
238
+ description: "Hierarchical tree rendering",
239
+ importExample: 'import { renderTree } from "@outfitter/cli/render";'
240
+ },
241
+ text: {
242
+ id: "text",
243
+ name: "Text",
244
+ description: "Text utilities (width, wrap, truncate, pad)",
245
+ importExample: 'import { getStringWidth, wrapText, truncateText, padText } from "@outfitter/cli/render";'
246
+ },
247
+ markdown: {
248
+ id: "markdown",
249
+ name: "Markdown",
250
+ description: "Markdown to terminal ANSI rendering",
251
+ importExample: 'import { renderMarkdown } from "@outfitter/cli/render";'
252
+ },
253
+ indicators: {
254
+ id: "indicators",
255
+ name: "Indicators",
256
+ description: "Status symbols, selection markers, and progress indicators",
257
+ importExample: 'import { getIndicator, INDICATORS } from "@outfitter/cli/render";'
258
+ }
259
+ };
260
+ function getPrimitiveIds() {
261
+ return Object.keys(PRIMITIVE_META);
262
+ }
263
+ function getPrimitiveMeta(id) {
264
+ return PRIMITIVE_META[id];
265
+ }
266
+
267
+ export { THEME_METHOD_META, getThemeMethodsByCategory, BORDER_STYLE_META, getBorderStyles, SPINNER_STYLE_META, getSpinnerStyles, LIST_STYLE_META, getListStyles, PRIMITIVE_META, getPrimitiveIds, getPrimitiveMeta };
@@ -0,0 +1,7 @@
1
+ // @bun
2
+ import {
3
+ init_borders
4
+ } from "./cli-85fg2vr5.js";
5
+
6
+ // packages/cli/src/borders/index.ts
7
+ init_borders();
@@ -0,0 +1,34 @@
1
+ import { CLI, CLIConfig } from "./cli-ttt7r0j7";
2
+ /**
3
+ * Create a new CLI instance with the given configuration.
4
+ *
5
+ * The CLI wraps Commander.js with typed helpers, output contract enforcement,
6
+ * and pagination state management.
7
+ *
8
+ * @param config - CLI configuration options
9
+ * @returns A CLI instance ready for command registration
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { createCLI, command, output } from "@outfitter/cli";
14
+ *
15
+ * const cli = createCLI({
16
+ * name: "waymark",
17
+ * version: "1.0.0",
18
+ * description: "A note management CLI",
19
+ * });
20
+ *
21
+ * cli.register(
22
+ * command("list")
23
+ * .description("List all notes")
24
+ * .action(async () => {
25
+ * const notes = await getNotes();
26
+ * output(notes);
27
+ * })
28
+ * );
29
+ *
30
+ * await cli.parse();
31
+ * ```
32
+ */
33
+ declare function createCLI(config: CLIConfig): CLI;
34
+ export { createCLI };
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,26 @@
1
+ import { VisualTheme } from "./cli-s0kkx9m1";
2
+ /**
3
+ * Minimal visual theme.
4
+ *
5
+ * Features:
6
+ * - ASCII-only borders (+, -, |)
7
+ * - ASCII-safe list bullets and checkboxes
8
+ * - Line spinner (ASCII-compatible)
9
+ * - No unicode characters anywhere
10
+ *
11
+ * Use this theme when targeting terminals without unicode support
12
+ * or when running in CI/log environments.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { minimalTheme } from "@outfitter/cli/theme/presets";
17
+ *
18
+ * // Use ASCII-safe styling
19
+ * const box = renderBox("Hello", { border: minimalTheme.border });
20
+ * // +-------+
21
+ * // | Hello |
22
+ * // +-------+
23
+ * ```
24
+ */
25
+ declare const minimalTheme: VisualTheme;
26
+ export { minimalTheme };
@@ -0,0 +1,19 @@
1
+ // @bun
2
+ // packages/cli/src/prompt/validators.ts
3
+ var validators = {
4
+ required: (message = "Required") => (value) => value.length > 0 ? undefined : message,
5
+ minLength: (length, message) => (value) => value.length >= length ? undefined : message ?? `Minimum ${length} characters`,
6
+ maxLength: (length, message) => (value) => value.length <= length ? undefined : message ?? `Maximum ${length} characters`,
7
+ pattern: (regex, message) => (value) => regex.test(value) ? undefined : message,
8
+ email: (message = "Invalid email") => validators.pattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/, message),
9
+ compose: (...fns) => (value) => {
10
+ for (const fn of fns) {
11
+ const error = fn(value);
12
+ if (error)
13
+ return error;
14
+ }
15
+ return;
16
+ }
17
+ };
18
+
19
+ export { validators };
@@ -0,0 +1,51 @@
1
+ // @bun
2
+ // packages/cli/src/render/spinner.ts
3
+ var SPINNERS = {
4
+ dots: {
5
+ frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
6
+ interval: 80
7
+ },
8
+ line: {
9
+ frames: ["-", "\\", "|", "/"],
10
+ interval: 100
11
+ },
12
+ arc: {
13
+ frames: ["\u25DC", "\u25DD", "\u25DE", "\u25DF"],
14
+ interval: 100
15
+ },
16
+ circle: {
17
+ frames: ["\u25D0", "\u25D3", "\u25D1", "\u25D2"],
18
+ interval: 100
19
+ },
20
+ bounce: {
21
+ frames: ["\u2801", "\u2802", "\u2804", "\u2802"],
22
+ interval: 120
23
+ },
24
+ ping: {
25
+ frames: [
26
+ "(\u25CF )",
27
+ "( \u25CF )",
28
+ "( \u25CF )",
29
+ "( \u25CF )",
30
+ "( \u25CF)",
31
+ "( \u25CF )",
32
+ "( \u25CF )",
33
+ "( \u25CF )"
34
+ ],
35
+ interval: 80
36
+ }
37
+ };
38
+ function getSpinnerFrame(style, elapsed) {
39
+ const spinner = SPINNERS[style];
40
+ const frameIndex = Math.floor(elapsed / spinner.interval) % spinner.frames.length;
41
+ return spinner.frames[frameIndex] ?? spinner.frames[0] ?? "...";
42
+ }
43
+ function renderSpinner(style, message) {
44
+ const frame = getSpinnerFrame(style, 0);
45
+ if (message && message.length > 0) {
46
+ return `${frame} ${message}`;
47
+ }
48
+ return frame;
49
+ }
50
+
51
+ export { SPINNERS, getSpinnerFrame, renderSpinner };
@@ -0,0 +1,128 @@
1
+ // @bun
2
+ import {
3
+ demoSection
4
+ } from "./cli-34fqr7bp.js";
5
+ import {
6
+ getStringWidth,
7
+ init_text,
8
+ padText,
9
+ pluralize,
10
+ slugify,
11
+ truncateText,
12
+ wrapText
13
+ } from "./cli-jjemfdta.js";
14
+
15
+ // packages/cli/src/demo/renderers/text.ts
16
+ init_text();
17
+ function renderTextDemo(config, theme) {
18
+ const showCode = config.showCode ?? true;
19
+ const lines = [];
20
+ lines.push(demoSection("String Width"));
21
+ lines.push("");
22
+ if (showCode) {
23
+ lines.push('import { getStringWidth } from "@outfitter/cli/render";');
24
+ lines.push("");
25
+ }
26
+ const widthExamples = [
27
+ { text: "Hello", expected: 5 },
28
+ { text: "\u4F60\u597D", expected: 4 },
29
+ { text: "\uD83C\uDF89", expected: 2 },
30
+ { text: "\x1B[32mGreen\x1B[0m", expected: 5 }
31
+ ];
32
+ for (const ex of widthExamples) {
33
+ const width = getStringWidth(ex.text);
34
+ const display = ex.text.includes("\x1B") ? '"\\x1b[32mGreen\\x1b[0m"' : `"${ex.text}"`;
35
+ lines.push(`getStringWidth(${display.padEnd(24)}) \u2192 ${width}`);
36
+ }
37
+ lines.push("");
38
+ lines.push(theme.muted("Correctly handles CJK, emoji, and ANSI codes."));
39
+ lines.push("");
40
+ lines.push(demoSection("Text Wrapping"));
41
+ lines.push("");
42
+ if (showCode) {
43
+ lines.push('import { wrapText } from "@outfitter/cli/render";');
44
+ lines.push("");
45
+ }
46
+ const longText = "This is a long sentence that should be wrapped at the specified width.";
47
+ if (showCode) {
48
+ lines.push(`wrapText("${longText}", 30)`);
49
+ lines.push("");
50
+ }
51
+ lines.push("Result:");
52
+ const wrapped = wrapText(longText, 30);
53
+ for (const line of wrapped.split(`
54
+ `)) {
55
+ lines.push(` \u2502${line}\u2502`);
56
+ }
57
+ lines.push("");
58
+ lines.push(demoSection("Truncation"));
59
+ lines.push("");
60
+ if (showCode) {
61
+ lines.push('import { truncateText } from "@outfitter/cli/render";');
62
+ lines.push("");
63
+ }
64
+ const truncExamples = [
65
+ { text: "Hello World", width: 8 },
66
+ { text: "Short", width: 10 },
67
+ { text: "Very long text that will be truncated", width: 15 }
68
+ ];
69
+ for (const ex of truncExamples) {
70
+ const result = truncateText(ex.text, ex.width);
71
+ lines.push(`truncateText("${ex.text}", ${ex.width})`);
72
+ lines.push(` \u2192 "${result}"`);
73
+ lines.push("");
74
+ }
75
+ lines.push(demoSection("Padding"));
76
+ lines.push("");
77
+ if (showCode) {
78
+ lines.push('import { padText } from "@outfitter/cli/render";');
79
+ lines.push("");
80
+ }
81
+ const padExamples = ["Hi", "Hello", "Greetings"];
82
+ for (const text of padExamples) {
83
+ const padded = padText(text, 15);
84
+ lines.push(`padText("${text}", 15) \u2192 "${padded}"`);
85
+ }
86
+ lines.push("");
87
+ lines.push(demoSection("Pluralize"));
88
+ lines.push("");
89
+ if (showCode) {
90
+ lines.push('import { pluralize } from "@outfitter/cli/render";');
91
+ lines.push("");
92
+ }
93
+ const pluralExamples = [
94
+ { count: 0, word: "item" },
95
+ { count: 1, word: "item" },
96
+ { count: 5, word: "item" },
97
+ { count: 1, word: "child", plural: "children" },
98
+ { count: 3, word: "child", plural: "children" }
99
+ ];
100
+ for (const ex of pluralExamples) {
101
+ const result = pluralize(ex.count, ex.word, ex.plural);
102
+ const code = ex.plural ? `pluralize(${ex.count}, "${ex.word}", "${ex.plural}")` : `pluralize(${ex.count}, "${ex.word}")`;
103
+ lines.push(`${code.padEnd(40)} \u2192 "${result}"`);
104
+ }
105
+ lines.push("");
106
+ lines.push(demoSection("Slugify"));
107
+ lines.push("");
108
+ if (showCode) {
109
+ lines.push('import { slugify } from "@outfitter/cli/render";');
110
+ lines.push("");
111
+ }
112
+ const slugExamples = [
113
+ "Hello World!",
114
+ "This & That",
115
+ " Multiple Spaces ",
116
+ "CamelCase"
117
+ ];
118
+ for (const text of slugExamples) {
119
+ const result = slugify(text);
120
+ lines.push(`slugify("${text}")`);
121
+ lines.push(` \u2192 "${result}"`);
122
+ lines.push("");
123
+ }
124
+ return lines.join(`
125
+ `);
126
+ }
127
+
128
+ export { renderTextDemo };