@outfitter/cli 0.1.0-rc.2 → 0.1.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 (250) hide show
  1. package/README.md +21 -32
  2. package/dist/actions.d.ts +12 -1
  3. package/dist/actions.js +170 -3
  4. package/dist/borders/index.d.ts +3 -0
  5. package/dist/borders/index.js +13 -0
  6. package/dist/box/index.d.ts +4 -0
  7. package/dist/box/index.js +13 -0
  8. package/dist/cli.js +1 -1
  9. package/dist/colors/index.d.ts +3 -0
  10. package/dist/colors/index.js +18 -0
  11. package/dist/command.d.ts +40 -3
  12. package/dist/command.js +45 -3
  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 -8
  46. package/dist/index.js +9 -43
  47. package/dist/input.d.ts +163 -2
  48. package/dist/input.js +425 -11
  49. package/dist/list/index.d.ts +3 -0
  50. package/dist/list/index.js +9 -0
  51. package/dist/output.js +1 -1
  52. package/dist/pagination.d.ts +62 -2
  53. package/dist/pagination.js +84 -6
  54. package/dist/preset/full.d.ts +14 -0
  55. package/dist/preset/full.js +41 -0
  56. package/dist/preset/standard.d.ts +11 -0
  57. package/dist/preset/standard.js +30 -0
  58. package/dist/prompt/confirm.d.ts +4 -0
  59. package/dist/prompt/confirm.js +9 -0
  60. package/dist/prompt/group.d.ts +4 -0
  61. package/dist/prompt/group.js +9 -0
  62. package/dist/prompt/index.d.ts +7 -0
  63. package/dist/prompt/index.js +32 -0
  64. package/dist/prompt/select.d.ts +4 -0
  65. package/dist/prompt/select.js +11 -0
  66. package/dist/prompt/text.d.ts +4 -0
  67. package/dist/prompt/text.js +11 -0
  68. package/dist/prompt/types.d.ts +3 -0
  69. package/dist/prompt/types.js +8 -0
  70. package/dist/prompt/validators.d.ts +2 -0
  71. package/dist/prompt/validators.js +8 -0
  72. package/dist/render/borders.d.ts +2 -0
  73. package/dist/render/borders.js +15 -0
  74. package/dist/render/box.d.ts +3 -0
  75. package/dist/render/box.js +23 -0
  76. package/dist/render/colors.d.ts +1 -1
  77. package/dist/render/colors.js +6 -3
  78. package/dist/render/date.js +1 -1
  79. package/dist/render/format-relative.js +1 -1
  80. package/dist/render/format.js +1 -1
  81. package/dist/render/heading.d.ts +3 -0
  82. package/dist/render/heading.js +14 -0
  83. package/dist/render/index.d.ts +26 -7
  84. package/dist/render/index.js +160 -26
  85. package/dist/render/indicators.d.ts +2 -0
  86. package/dist/render/indicators.js +14 -0
  87. package/dist/render/json.js +1 -1
  88. package/dist/render/layout.d.ts +5 -0
  89. package/dist/render/layout.js +25 -0
  90. package/dist/render/list.d.ts +2 -2
  91. package/dist/render/list.js +2 -2
  92. package/dist/render/markdown.js +4 -4
  93. package/dist/render/progress.js +1 -1
  94. package/dist/render/separator.d.ts +3 -0
  95. package/dist/render/separator.js +14 -0
  96. package/dist/render/shapes.js +10 -9
  97. package/dist/render/spinner.d.ts +2 -0
  98. package/dist/render/spinner.js +12 -0
  99. package/dist/render/stack.d.ts +3 -0
  100. package/dist/render/stack.js +38 -0
  101. package/dist/render/table.d.ts +2 -1
  102. package/dist/render/table.js +6 -5
  103. package/dist/render/text.d.ts +1 -1
  104. package/dist/render/text.js +7 -4
  105. package/dist/render/tree.d.ts +2 -2
  106. package/dist/render/tree.js +5 -3
  107. package/dist/render/types.d.ts +2 -0
  108. package/dist/render/types.js +1 -0
  109. package/dist/shared/@outfitter/cli-0ggcy7fa.js +20 -0
  110. package/dist/shared/@outfitter/cli-0psys2vm.js +7 -0
  111. package/dist/shared/@outfitter/cli-1bghjef6.js +352 -0
  112. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +45 -0
  113. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +50 -0
  114. package/dist/shared/@outfitter/cli-34fqr7bp.js +37 -0
  115. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +97 -0
  116. package/dist/shared/@outfitter/cli-3dxmmy4c.d.ts +20 -0
  117. package/dist/shared/@outfitter/cli-3f12z5kf.d.ts +83 -0
  118. package/dist/shared/@outfitter/cli-3t2zaenc.d.ts +59 -0
  119. package/dist/shared/@outfitter/{cli-dds0qqvm.d.ts → cli-4cb5g831.d.ts} +2 -0
  120. package/dist/shared/@outfitter/cli-4w2a1rfy.d.ts +23 -0
  121. package/dist/shared/@outfitter/cli-4x6pqnez.js +20 -0
  122. package/dist/shared/@outfitter/cli-671sxkhj.js +146 -0
  123. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +51 -0
  124. package/dist/shared/@outfitter/cli-6fxffp8k.js +1 -0
  125. package/dist/shared/@outfitter/cli-6j9qynm8.js +118 -0
  126. package/dist/shared/@outfitter/cli-6m988kh0.d.ts +61 -0
  127. package/dist/shared/@outfitter/cli-74ba31gz.js +134 -0
  128. package/dist/shared/@outfitter/cli-7gnrb8cr.js +214 -0
  129. package/dist/shared/@outfitter/cli-7nm6edvh.d.ts +17 -0
  130. package/dist/shared/@outfitter/cli-85fg2vr5.js +123 -0
  131. package/dist/shared/@outfitter/cli-8a8xrzhy.js +20 -0
  132. package/dist/shared/@outfitter/cli-8bwaw3pz.js +7 -0
  133. package/dist/shared/@outfitter/cli-8rx4g3s5.d.ts +41 -0
  134. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +223 -0
  135. package/dist/shared/@outfitter/cli-96b2p4td.d.ts +56 -0
  136. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +190 -0
  137. package/dist/shared/@outfitter/cli-9mtjjykw.js +67 -0
  138. package/dist/shared/@outfitter/{cli-ag0w4pk0.js → cli-9nbyj2bt.js} +60 -21
  139. package/dist/shared/@outfitter/{cli-azzk8a1d.js → cli-afhjqmg3.js} +7 -3
  140. package/dist/shared/@outfitter/cli-an9j0h80.js +117 -0
  141. package/dist/shared/@outfitter/cli-ay411nbr.js +122 -0
  142. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +132 -0
  143. package/dist/shared/@outfitter/cli-b5c2k0d7.js +39 -0
  144. package/dist/shared/@outfitter/cli-b5epywry.js +1 -0
  145. package/dist/shared/@outfitter/cli-bcmcaz1b.js +23 -0
  146. package/dist/shared/@outfitter/cli-bf3vma4q.js +61 -0
  147. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +53 -0
  148. package/dist/shared/@outfitter/cli-cs45xd6q.js +59 -0
  149. package/dist/shared/@outfitter/cli-d7jpshq5.d.ts +128 -0
  150. package/dist/shared/@outfitter/{cli-jbj78ac5.js → cli-d9ad0rqj.js} +6 -1
  151. package/dist/shared/@outfitter/cli-daw296mv.js +61 -0
  152. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +91 -0
  153. package/dist/shared/@outfitter/cli-e73v3qqy.d.ts +93 -0
  154. package/dist/shared/@outfitter/cli-en6zn6sj.js +1 -0
  155. package/dist/shared/@outfitter/cli-ep2cvtk8.js +48 -0
  156. package/dist/shared/@outfitter/cli-f75h8e94.js +7 -0
  157. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +106 -0
  158. package/dist/shared/@outfitter/cli-feb5j90n.js +94 -0
  159. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +66 -0
  160. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +328 -0
  161. package/dist/shared/@outfitter/cli-j4n8gaf3.js +95 -0
  162. package/dist/shared/@outfitter/cli-jejfypgf.js +85 -0
  163. package/dist/shared/@outfitter/{cli-wqc652mx.js → cli-jhcdwvpn.js} +8 -8
  164. package/dist/shared/@outfitter/{cli-v9mjsvjh.js → cli-jjemfdta.js} +13 -46
  165. package/dist/shared/@outfitter/cli-kc84wmch.js +267 -0
  166. package/dist/shared/@outfitter/cli-ktqme80d.js +7 -0
  167. package/dist/shared/@outfitter/cli-mq0jp15z.js +1 -0
  168. package/dist/shared/@outfitter/cli-mymyavvj.d.ts +26 -0
  169. package/dist/shared/@outfitter/cli-n17gt1dz.js +19 -0
  170. package/dist/shared/@outfitter/cli-n9dbh0hp.js +51 -0
  171. package/dist/shared/@outfitter/cli-nvvc92c8.js +128 -0
  172. package/dist/shared/@outfitter/cli-p1m5dhrs.js +169 -0
  173. package/dist/shared/@outfitter/cli-p38sfxyk.js +25 -0
  174. package/dist/shared/@outfitter/cli-p3dqm1vd.js +22 -0
  175. package/dist/shared/@outfitter/cli-p9j1phge.js +20 -0
  176. package/dist/shared/@outfitter/cli-pkxmzavm.js +62 -0
  177. package/dist/shared/@outfitter/cli-q8r6jarq.d.ts +24 -0
  178. package/dist/shared/@outfitter/{cli-2y3kxew8.d.ts → cli-qj83y5wj.d.ts} +22 -9
  179. package/dist/shared/@outfitter/cli-qjfc3j11.d.ts +112 -0
  180. package/dist/shared/@outfitter/cli-qp4cbhqr.js +70 -0
  181. package/dist/shared/@outfitter/cli-s0kkx9m1.d.ts +164 -0
  182. package/dist/shared/@outfitter/cli-snxj55n6.js +43 -0
  183. package/dist/shared/@outfitter/cli-swwxvjvm.d.ts +24 -0
  184. package/dist/shared/@outfitter/cli-sx67mmfx.d.ts +98 -0
  185. package/dist/shared/@outfitter/cli-tarpsa8a.js +30 -0
  186. package/dist/shared/@outfitter/cli-thvzhjd1.js +126 -0
  187. package/dist/shared/@outfitter/cli-tqewy503.d.ts +36 -0
  188. package/dist/shared/@outfitter/cli-tvw1xrdj.js +20 -0
  189. package/dist/shared/@outfitter/cli-v1tzwxkt.js +32 -0
  190. package/dist/shared/@outfitter/cli-vd60dj65.js +1 -0
  191. package/dist/shared/@outfitter/cli-vp88gxev.js +279 -0
  192. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +74 -0
  193. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +54 -0
  194. package/dist/shared/@outfitter/cli-w5y3xepp.js +20 -0
  195. package/dist/shared/@outfitter/cli-x4cavvc0.js +1 -0
  196. package/dist/shared/@outfitter/cli-xep6v2c0.js +52 -0
  197. package/dist/shared/@outfitter/cli-xg5y5fhk.js +86 -0
  198. package/dist/shared/@outfitter/{cli-n51t773m.d.ts → cli-xsaheemc.d.ts} +44 -4
  199. package/dist/shared/@outfitter/cli-xvqtqjxk.js +82 -0
  200. package/dist/shared/@outfitter/cli-y25tt8nc.d.ts +48 -0
  201. package/dist/streaming/ansi.d.ts +2 -0
  202. package/dist/streaming/ansi.js +8 -0
  203. package/dist/streaming/index.d.ts +4 -0
  204. package/dist/streaming/index.js +17 -0
  205. package/dist/streaming/spinner.d.ts +3 -0
  206. package/dist/streaming/spinner.js +10 -0
  207. package/dist/streaming/writer.d.ts +2 -0
  208. package/dist/streaming/writer.js +9 -0
  209. package/dist/table/index.d.ts +4 -0
  210. package/dist/table/index.js +13 -0
  211. package/dist/terminal/detection.js +5 -2
  212. package/dist/terminal/index.js +6 -2
  213. package/dist/theme/context.d.ts +9 -0
  214. package/dist/theme/context.js +14 -0
  215. package/dist/theme/create.d.ts +8 -0
  216. package/dist/theme/create.js +12 -0
  217. package/dist/theme/index.d.ts +17 -0
  218. package/dist/theme/index.js +42 -0
  219. package/dist/theme/presets/bold.d.ts +8 -0
  220. package/dist/theme/presets/bold.js +12 -0
  221. package/dist/theme/presets/default.d.ts +8 -0
  222. package/dist/theme/presets/default.js +11 -0
  223. package/dist/theme/presets/index.d.ts +12 -0
  224. package/dist/theme/presets/index.js +24 -0
  225. package/dist/theme/presets/minimal.d.ts +8 -0
  226. package/dist/theme/presets/minimal.js +12 -0
  227. package/dist/theme/presets/rounded.d.ts +8 -0
  228. package/dist/theme/presets/rounded.js +12 -0
  229. package/dist/theme/resolve.d.ts +8 -0
  230. package/dist/theme/resolve.js +11 -0
  231. package/dist/theme/types.d.ts +7 -0
  232. package/dist/theme/types.js +1 -0
  233. package/dist/tree/index.d.ts +3 -0
  234. package/dist/tree/index.js +11 -0
  235. package/dist/types.js +1 -1
  236. package/package.json +168 -54
  237. package/dist/shared/@outfitter/cli-2vs2gxa8.js +0 -429
  238. package/dist/shared/@outfitter/cli-2yq94zst.d.ts +0 -39
  239. package/dist/shared/@outfitter/cli-6xc869x1.js +0 -26
  240. package/dist/shared/@outfitter/cli-7km1e58p.js +0 -85
  241. package/dist/shared/@outfitter/cli-8r0bnyyx.js +0 -43
  242. package/dist/shared/@outfitter/cli-afecwfrn.d.ts +0 -13
  243. package/dist/shared/@outfitter/cli-bt423m6y.js +0 -4
  244. package/dist/shared/@outfitter/cli-d4fegbad.d.ts +0 -66
  245. package/dist/shared/@outfitter/cli-e0ecw3x1.js +0 -64
  246. package/dist/shared/@outfitter/cli-fheaaa6b.js +0 -25
  247. package/dist/shared/@outfitter/cli-j361wp3g.d.ts +0 -41
  248. package/dist/shared/@outfitter/cli-p0m2fc51.js +0 -172
  249. package/dist/shared/@outfitter/cli-tyajr8qa.d.ts +0 -63
  250. package/dist/shared/@outfitter/cli-zs6jy1am.d.ts +0 -164
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ import {
3
+ getTerminalWidth
4
+ } from "./cli-671sxkhj.js";
5
+
6
+ // packages/cli/src/render/separator.ts
7
+ function renderSeparator(options) {
8
+ const style = options?.style ?? "\u2500";
9
+ const widthMode = options?.width ?? 40;
10
+ let width;
11
+ if (widthMode === "text") {
12
+ width = 40;
13
+ } else if (widthMode === "full") {
14
+ width = getTerminalWidth();
15
+ } else {
16
+ width = widthMode;
17
+ }
18
+ if (style.length === 2) {
19
+ const repetitions = Math.ceil(width / 2);
20
+ return style.repeat(repetitions).slice(0, width);
21
+ }
22
+ return style.repeat(width);
23
+ }
24
+
25
+ export { renderSeparator };
@@ -0,0 +1,22 @@
1
+ // @bun
2
+ // packages/cli/src/streaming/ansi.ts
3
+ var ANSI = {
4
+ cursorUp: (n) => `\x1B[${n}A`,
5
+ cursorDown: (n) => `\x1B[${n}B`,
6
+ cursorRight: (n) => `\x1B[${n}C`,
7
+ cursorLeft: (n) => `\x1B[${n}D`,
8
+ cursorToStart: "\x1B[G",
9
+ clearLine: "\x1B[2K",
10
+ clearToEnd: "\x1B[0J",
11
+ clearToStart: "\x1B[1J",
12
+ clearScreen: "\x1B[2J",
13
+ hideCursor: "\x1B[?25l",
14
+ showCursor: "\x1B[?25h",
15
+ saveCursor: "\x1B[s",
16
+ restoreCursor: "\x1B[u",
17
+ carriageReturn: "\r",
18
+ newLine: `
19
+ `
20
+ };
21
+
22
+ export { ANSI };
@@ -0,0 +1,20 @@
1
+ // @bun
2
+ import {
3
+ defaultTheme
4
+ } from "./cli-cs45xd6q.js";
5
+
6
+ // packages/cli/src/theme/context.ts
7
+ function createThemedContext(options) {
8
+ const theme = options.theme ?? options.parent?.theme ?? defaultTheme;
9
+ const width = options.width ?? options.parent?.width ?? process.stdout.columns ?? 80;
10
+ return {
11
+ width,
12
+ theme,
13
+ ...options.parent && { parent: options.parent }
14
+ };
15
+ }
16
+ function getContextTheme(ctx) {
17
+ return ctx?.theme ?? defaultTheme;
18
+ }
19
+
20
+ export { createThemedContext, getContextTheme };
@@ -0,0 +1,62 @@
1
+ // @bun
2
+ import {
3
+ BORDER_STYLE_META,
4
+ getBorderStyles
5
+ } from "./cli-kc84wmch.js";
6
+ import {
7
+ demoSection
8
+ } from "./cli-34fqr7bp.js";
9
+ import {
10
+ BORDERS,
11
+ drawHorizontalLine,
12
+ init_borders
13
+ } from "./cli-85fg2vr5.js";
14
+
15
+ // packages/cli/src/demo/renderers/borders.ts
16
+ init_borders();
17
+ function renderBordersDemo(config, theme) {
18
+ const showCode = config.showCode ?? true;
19
+ const showDescriptions = config.showDescriptions ?? true;
20
+ const lines = [];
21
+ lines.push(demoSection("Border Styles"));
22
+ lines.push("");
23
+ if (showCode) {
24
+ lines.push('import { BORDERS, getBorderCharacters } from "@outfitter/cli/render";');
25
+ lines.push("");
26
+ }
27
+ const styles = getBorderStyles().filter((s) => s !== "none");
28
+ for (const style of styles) {
29
+ const meta = BORDER_STYLE_META[style];
30
+ const chars = BORDERS[style];
31
+ lines.push(`${meta.label.toUpperCase()} (${style})`);
32
+ if (showDescriptions) {
33
+ lines.push(theme.muted(meta.description));
34
+ }
35
+ lines.push("");
36
+ const width = 20;
37
+ lines.push(drawHorizontalLine(width, chars, "top"));
38
+ lines.push(`${chars.vertical}${" ".repeat(width)}${chars.vertical}`);
39
+ lines.push(`${chars.vertical}${" Content here".padEnd(width)}${chars.vertical}`);
40
+ lines.push(`${chars.vertical}${" ".repeat(width)}${chars.vertical}`);
41
+ lines.push(drawHorizontalLine(width, chars, "bottom"));
42
+ lines.push("");
43
+ }
44
+ lines.push(demoSection("Characters Reference"));
45
+ lines.push("");
46
+ for (const style of styles) {
47
+ const chars = BORDERS[style];
48
+ const meta = BORDER_STYLE_META[style];
49
+ lines.push(`${meta.label}:`);
50
+ const charDisplay = [
51
+ ` Corners: ${chars.topLeft} ${chars.topRight} ${chars.bottomLeft} ${chars.bottomRight}`,
52
+ ` Lines: ${chars.horizontal} ${chars.vertical}`,
53
+ ` T's: ${chars.topT} ${chars.bottomT} ${chars.leftT} ${chars.rightT} Cross: ${chars.cross}`
54
+ ];
55
+ lines.push(...charDisplay);
56
+ lines.push("");
57
+ }
58
+ return lines.join(`
59
+ `);
60
+ }
61
+
62
+ export { renderBordersDemo };
@@ -0,0 +1,24 @@
1
+ import { VisualTheme } from "./cli-s0kkx9m1";
2
+ /**
3
+ * Bold visual theme.
4
+ *
5
+ * Features:
6
+ * - Heavy/thick box-drawing borders (┏━┓)
7
+ * - Heavy tree guide style
8
+ * - Strong visual weight
9
+ *
10
+ * Inherits all other properties from {@link defaultTheme}.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { boldTheme } from "@outfitter/cli/theme/presets";
15
+ *
16
+ * // Use bold styling
17
+ * const box = renderBox("Hello", { border: boldTheme.border });
18
+ * // ┏━━━━━━━┓
19
+ * // ┃ Hello ┃
20
+ * // ┗━━━━━━━┛
21
+ * ```
22
+ */
23
+ declare const boldTheme: VisualTheme;
24
+ export { boldTheme };
@@ -1,3 +1,4 @@
1
+ import { BorderStyle } from "./cli-fakncnjp";
1
2
  /**
2
3
  * Configuration options for {@link renderTable}.
3
4
  *
@@ -6,6 +7,7 @@
6
7
  * const options: TableOptions = {
7
8
  * headers: { id: "ID", name: "Name" },
8
9
  * columnWidths: { description: 20 },
10
+ * border: "rounded",
9
11
  * };
10
12
  * ```
11
13
  */
@@ -20,13 +22,24 @@ interface TableOptions {
20
22
  * If not specified, the object key is used as the header.
21
23
  */
22
24
  headers?: Record<string, string>;
25
+ /**
26
+ * Border style for the table.
27
+ * @default "single"
28
+ */
29
+ border?: BorderStyle;
30
+ /**
31
+ * Compact mode removes all borders and uses space separators.
32
+ * When true, overrides the border option.
33
+ * @default false
34
+ */
35
+ compact?: boolean;
23
36
  }
24
37
  /**
25
- * Renders an array of objects as an ASCII table with borders.
38
+ * Renders an array of objects as a table with Unicode box-drawing borders.
26
39
  *
27
40
  * Automatically calculates column widths based on content unless
28
- * overridden in options. Supports custom header labels and
29
- * truncates cell content that exceeds column width.
41
+ * overridden in options. Supports custom header labels, border styles,
42
+ * and truncates cell content that exceeds column width.
30
43
  *
31
44
  * @param data - Array of objects to render as rows
32
45
  * @param options - Table rendering options
@@ -46,12 +59,12 @@ interface TableOptions {
46
59
  * );
47
60
  *
48
61
  * console.log(table);
49
- * // +----+-------+----------+
50
- * // | ID | Name | status |
51
- * // +----+-------+----------+
52
- * // | 1 | Alice | Active |
53
- * // | 2 | Bob | Inactive |
54
- * // +----+-------+----------+
62
+ * // ┌────┬───────┬──────────┐
63
+ * // ID Name status
64
+ * // ├────┼───────┼──────────┤
65
+ * // 1 Alice Active
66
+ * // 2 Bob Inactive
67
+ * // └────┴───────┴──────────┘
55
68
  * ```
56
69
  */
57
70
  declare function renderTable(data: Record<string, unknown>[], options?: TableOptions): string;
@@ -0,0 +1,112 @@
1
+ import { Theme } from "./cli-xsaheemc";
2
+ /**
3
+ * Available primitive types for demos.
4
+ */
5
+ type PrimitiveId = "colors" | "borders" | "spinner" | "list" | "box" | "table" | "progress" | "tree" | "text" | "markdown" | "indicators";
6
+ /**
7
+ * Categorization for theme methods.
8
+ */
9
+ type ThemeMethodCategory = "semantic" | "utility";
10
+ /**
11
+ * Metadata for a theme method.
12
+ */
13
+ interface ThemeMethodMeta {
14
+ /** Method category (semantic or utility) */
15
+ category: ThemeMethodCategory;
16
+ /** Human-readable description */
17
+ description: string;
18
+ /** Default example text */
19
+ defaultExample: string;
20
+ }
21
+ /**
22
+ * Metadata for a primitive variant (spinner styles, border styles, etc).
23
+ */
24
+ interface VariantMeta<T extends string> {
25
+ /** The variant value */
26
+ value: T;
27
+ /** Human-readable label */
28
+ label: string;
29
+ /** Description of the variant */
30
+ description: string;
31
+ }
32
+ /**
33
+ * Metadata describing a primitive for demo generation.
34
+ */
35
+ interface PrimitiveMeta {
36
+ /** Primitive identifier */
37
+ id: PrimitiveId;
38
+ /** Human-readable name */
39
+ name: string;
40
+ /** Brief description */
41
+ description: string;
42
+ /** Import statement example */
43
+ importExample: string;
44
+ }
45
+ /**
46
+ * Customizable example texts for demos.
47
+ *
48
+ * Keys correspond to theme method names and other example contexts.
49
+ */
50
+ interface ExampleTexts {
51
+ success: string;
52
+ warning: string;
53
+ error: string;
54
+ info: string;
55
+ primary: string;
56
+ secondary: string;
57
+ muted: string;
58
+ accent: string;
59
+ highlight: string;
60
+ link: string;
61
+ destructive: string;
62
+ subtle: string;
63
+ bold: string;
64
+ italic: string;
65
+ underline: string;
66
+ dim: string;
67
+ boxContent: string;
68
+ boxTitle: string;
69
+ spinnerMessage: string;
70
+ progressLabel: string;
71
+ listItems: string[];
72
+ tableData: Record<string, unknown>[];
73
+ treeData: Record<string, unknown>;
74
+ markdownSample: string;
75
+ }
76
+ /**
77
+ * Configuration for demo rendering.
78
+ */
79
+ interface DemoConfig {
80
+ /**
81
+ * Override default example texts.
82
+ */
83
+ examples?: Partial<ExampleTexts>;
84
+ /**
85
+ * Whether to show import statements.
86
+ * @default true
87
+ */
88
+ showCode?: boolean;
89
+ /**
90
+ * Whether to show method/variant descriptions.
91
+ * @default true
92
+ */
93
+ showDescriptions?: boolean;
94
+ }
95
+ /**
96
+ * Function that renders a demo section for a primitive.
97
+ */
98
+ type DemoRenderer = (config: DemoConfig, theme: Theme) => string;
99
+ /**
100
+ * Registry entry for a primitive demo.
101
+ */
102
+ interface DemoRegistryEntry {
103
+ /** Primitive metadata */
104
+ meta: PrimitiveMeta;
105
+ /** Render function */
106
+ render: DemoRenderer;
107
+ }
108
+ /**
109
+ * Checks if a string is a valid PrimitiveId.
110
+ */
111
+ declare function isPrimitiveId(value: string): value is PrimitiveId;
112
+ export { PrimitiveId, ThemeMethodCategory, ThemeMethodMeta, VariantMeta, PrimitiveMeta, ExampleTexts, DemoConfig, DemoRenderer, DemoRegistryEntry, isPrimitiveId };
@@ -0,0 +1,70 @@
1
+ // @bun
2
+ import {
3
+ renderMarkdown
4
+ } from "./cli-afhjqmg3.js";
5
+ import {
6
+ getExample
7
+ } from "./cli-xep6v2c0.js";
8
+ import {
9
+ demoSection
10
+ } from "./cli-34fqr7bp.js";
11
+
12
+ // packages/cli/src/demo/renderers/markdown.ts
13
+ function renderMarkdownDemo(config, theme) {
14
+ const showCode = config.showCode ?? true;
15
+ const lines = [];
16
+ lines.push(demoSection("Markdown Rendering"));
17
+ lines.push("");
18
+ if (showCode) {
19
+ lines.push('import { renderMarkdown } from "@outfitter/cli/render";');
20
+ lines.push("");
21
+ }
22
+ const sample = getExample("markdownSample", config.examples);
23
+ lines.push("Input:");
24
+ lines.push(theme.muted("\u2500".repeat(40)));
25
+ for (const line of sample.split(`
26
+ `)) {
27
+ lines.push(theme.muted(line));
28
+ }
29
+ lines.push(theme.muted("\u2500".repeat(40)));
30
+ lines.push("");
31
+ lines.push("Output:");
32
+ lines.push("\u2500".repeat(40));
33
+ lines.push(renderMarkdown(sample));
34
+ lines.push("\u2500".repeat(40));
35
+ lines.push("");
36
+ lines.push(demoSection("Supported Elements"));
37
+ lines.push("");
38
+ const elements = [
39
+ {
40
+ name: "Headings",
41
+ markdown: `# Heading 1
42
+ ## Heading 2`,
43
+ desc: "Rendered bold"
44
+ },
45
+ { name: "Bold", markdown: "**bold text**", desc: "Rendered bold" },
46
+ { name: "Italic", markdown: "*italic text*", desc: "Rendered italic" },
47
+ { name: "Inline code", markdown: "`code`", desc: "Rendered cyan" },
48
+ {
49
+ name: "Code block",
50
+ markdown: "```\ncode block\n```",
51
+ desc: "Rendered dim"
52
+ }
53
+ ];
54
+ for (const el of elements) {
55
+ lines.push(`${el.name}:`);
56
+ lines.push(theme.muted(` ${el.desc}`));
57
+ lines.push(` Input: ${el.markdown.replace(/\n/g, "\\n")}`);
58
+ lines.push(` Output: ${renderMarkdown(el.markdown).replace(/\n/g, " ")}`);
59
+ lines.push("");
60
+ }
61
+ lines.push(demoSection("Color Support"));
62
+ lines.push("");
63
+ lines.push("\u2022 Colors applied when terminal supports ANSI");
64
+ lines.push("\u2022 Respects NO_COLOR environment variable");
65
+ lines.push("\u2022 Markdown syntax stripped when colors disabled");
66
+ return lines.join(`
67
+ `);
68
+ }
69
+
70
+ export { renderMarkdownDemo };
@@ -0,0 +1,164 @@
1
+ import { IndicatorCategory } from "./cli-sx67mmfx";
2
+ import { DelimiterName } from "./cli-hnpbqmc8";
3
+ import { TreeGuideStyle } from "./cli-3b7ed3rm";
4
+ import { SpinnerStyle } from "./cli-e5ms1y0x";
5
+ import { BorderCharacters, BorderStyle } from "./cli-fakncnjp";
6
+ /**
7
+ * A glyph with unicode and ASCII fallback representations.
8
+ *
9
+ * Used for characters that may not be available in all terminals.
10
+ * The appropriate character is selected at runtime based on terminal capability.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const bullet: GlyphPair = { unicode: "•", fallback: "*" };
15
+ * const checkbox: GlyphPair = { unicode: "☑", fallback: "[x]" };
16
+ * ```
17
+ */
18
+ interface GlyphPair {
19
+ /** Unicode character for modern terminals */
20
+ unicode: string;
21
+ /** ASCII fallback for limited terminals */
22
+ fallback: string;
23
+ }
24
+ /**
25
+ * Semantic states that can be mapped to visual markers.
26
+ *
27
+ * These represent the logical state of an item, which themes translate
28
+ * to specific visual representations.
29
+ */
30
+ type SemanticState = "default" | "current" | "focused" | "checked" | "disabled" | "success" | "warning" | "error" | "info";
31
+ /**
32
+ * Specification for how to render a semantic state marker.
33
+ *
34
+ * Can either reference an existing indicator from the INDICATORS registry,
35
+ * or provide a custom glyph pair.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Reference existing indicator
40
+ * const successMarker: MarkerSpec = {
41
+ * type: "indicator",
42
+ * category: "status",
43
+ * name: "success"
44
+ * };
45
+ *
46
+ * // Custom glyph
47
+ * const starMarker: MarkerSpec = {
48
+ * type: "custom",
49
+ * glyph: { unicode: "★", fallback: "*" }
50
+ * };
51
+ * ```
52
+ */
53
+ type MarkerSpec = {
54
+ type: "indicator";
55
+ category: IndicatorCategory;
56
+ name: string;
57
+ } | {
58
+ type: "custom";
59
+ glyph: GlyphPair;
60
+ };
61
+ /**
62
+ * Semantic color tokens as ANSI escape codes.
63
+ *
64
+ * Colors are stored as raw ANSI codes and can be empty strings
65
+ * when colors are disabled.
66
+ */
67
+ interface ThemeColors {
68
+ /** Green - success messages, completed items */
69
+ success: string;
70
+ /** Yellow - warnings, caution */
71
+ warning: string;
72
+ /** Red - errors, failures */
73
+ error: string;
74
+ /** Blue - informational messages */
75
+ info: string;
76
+ /** Default text color (typically empty string) */
77
+ primary: string;
78
+ /** Gray - secondary text */
79
+ secondary: string;
80
+ /** Dim - de-emphasized text */
81
+ muted: string;
82
+ /** Cyan - interactive elements, highlights */
83
+ accent: string;
84
+ /** Bold - strong emphasis */
85
+ highlight: string;
86
+ /** Cyan + underline - URLs, clickable references */
87
+ link: string;
88
+ /** Bright red - dangerous actions */
89
+ destructive: string;
90
+ /** Dim gray - less prominent than muted */
91
+ subtle: string;
92
+ }
93
+ /**
94
+ * Default spacing values for various components.
95
+ */
96
+ interface ThemeSpacing {
97
+ /** Default padding inside boxes (characters) */
98
+ boxPadding: number;
99
+ /** Indentation for nested list items (characters) */
100
+ listIndent: number;
101
+ /** Gap between items in vertical stacks (lines) */
102
+ stackGap: number;
103
+ /** Gap between items in horizontal stacks (characters) */
104
+ horizontalGap: number;
105
+ }
106
+ /**
107
+ * Complete visual theme configuration.
108
+ *
109
+ * Consolidates all visual primitives (borders, delimiters, markers, guides,
110
+ * colors) into a cohesive design system. Themes can be used as-is (presets)
111
+ * or customized via {@link createVisualTheme}.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { defaultTheme, roundedTheme, createVisualTheme } from "@outfitter/cli/theme";
116
+ *
117
+ * // Use a preset
118
+ * const box = renderBox("Hello", { theme: roundedTheme });
119
+ *
120
+ * // Create a custom theme
121
+ * const brandTheme = createVisualTheme({
122
+ * extends: roundedTheme,
123
+ * overrides: {
124
+ * colors: { accent: "\x1b[38;5;39m" },
125
+ * spacing: { boxPadding: 2 }
126
+ * }
127
+ * });
128
+ * ```
129
+ */
130
+ interface VisualTheme {
131
+ /** Theme identifier */
132
+ name: string;
133
+ /** Border style preset name */
134
+ border: BorderStyle;
135
+ /** Derived border characters for the border style */
136
+ borderChars: BorderCharacters;
137
+ /** Tree guide style for hierarchical displays */
138
+ treeGuide: TreeGuideStyle;
139
+ /** Default delimiter for inline separators */
140
+ delimiter: DelimiterName;
141
+ /** Map of semantic states to marker specifications */
142
+ markers: Record<SemanticState, MarkerSpec>;
143
+ /** Default list bullet glyph */
144
+ listBullet: GlyphPair;
145
+ /** Checkbox glyphs for checked/unchecked states */
146
+ checkbox: {
147
+ checked: GlyphPair;
148
+ unchecked: GlyphPair;
149
+ };
150
+ /** Semantic color tokens */
151
+ colors: ThemeColors;
152
+ /** Default spacing values */
153
+ spacing: ThemeSpacing;
154
+ /** Default spinner animation style */
155
+ spinner: SpinnerStyle;
156
+ }
157
+ /**
158
+ * Partial theme for overriding specific properties.
159
+ *
160
+ * Used by {@link createVisualTheme} to allow partial customization
161
+ * while inheriting defaults.
162
+ */
163
+ type PartialVisualTheme = { [K in keyof VisualTheme]? : K extends "colors" ? Partial<ThemeColors> : K extends "spacing" ? Partial<ThemeSpacing> : K extends "markers" ? Partial<Record<SemanticState, MarkerSpec>> : K extends "checkbox" ? Partial<VisualTheme["checkbox"]> : VisualTheme[K] };
164
+ export { GlyphPair, SemanticState, MarkerSpec, ThemeColors, ThemeSpacing, VisualTheme, PartialVisualTheme };
@@ -0,0 +1,43 @@
1
+ // @bun
2
+ import {
3
+ createCancelledError
4
+ } from "./cli-8bwaw3pz.js";
5
+
6
+ // packages/cli/src/prompt/text.ts
7
+ import { isCancel, password, text } from "@clack/prompts";
8
+ import { Result } from "better-result";
9
+ async function promptText(options) {
10
+ const textOptions = {
11
+ message: options.message
12
+ };
13
+ if (options.placeholder !== undefined) {
14
+ textOptions.placeholder = options.placeholder;
15
+ }
16
+ if (options.defaultValue !== undefined) {
17
+ textOptions.defaultValue = options.defaultValue;
18
+ }
19
+ if (options.validate !== undefined) {
20
+ textOptions.validate = options.validate;
21
+ }
22
+ const result = await text(textOptions);
23
+ if (isCancel(result)) {
24
+ return Result.err(createCancelledError());
25
+ }
26
+ return Result.ok(result);
27
+ }
28
+ async function promptPassword(options) {
29
+ const passwordOptions = {
30
+ message: options.message,
31
+ mask: options.mask ?? "\u2022"
32
+ };
33
+ if (options.validate !== undefined) {
34
+ passwordOptions.validate = options.validate;
35
+ }
36
+ const result = await password(passwordOptions);
37
+ if (isCancel(result)) {
38
+ return Result.err(createCancelledError());
39
+ }
40
+ return Result.ok(result);
41
+ }
42
+
43
+ export { promptText, promptPassword };
@@ -0,0 +1,24 @@
1
+ import { VisualTheme } from "./cli-s0kkx9m1";
2
+ /**
3
+ * Rounded visual theme.
4
+ *
5
+ * Features:
6
+ * - Rounded box-drawing corners (╭─╮)
7
+ * - Rounded tree guide style
8
+ * - Softer visual aesthetic
9
+ *
10
+ * Inherits all other properties from {@link defaultTheme}.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { roundedTheme } from "@outfitter/cli/theme/presets";
15
+ *
16
+ * // Use rounded styling
17
+ * const box = renderBox("Hello", { border: roundedTheme.border });
18
+ * // ╭───────╮
19
+ * // │ Hello │
20
+ * // ╰───────╯
21
+ * ```
22
+ */
23
+ declare const roundedTheme: VisualTheme;
24
+ export { roundedTheme };