@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,59 @@
1
+ // @bun
2
+ import {
3
+ BORDERS,
4
+ init_borders
5
+ } from "./cli-85fg2vr5.js";
6
+ import {
7
+ ANSI,
8
+ init_colors
9
+ } from "./cli-9nbyj2bt.js";
10
+
11
+ // packages/cli/src/theme/presets/default.ts
12
+ init_borders();
13
+ init_colors();
14
+ var defaultTheme = {
15
+ name: "default",
16
+ border: "single",
17
+ borderChars: BORDERS.single,
18
+ treeGuide: "single",
19
+ delimiter: "bullet",
20
+ markers: {
21
+ default: { type: "indicator", category: "marker", name: "circleOutline" },
22
+ current: { type: "indicator", category: "marker", name: "circleDot" },
23
+ focused: { type: "indicator", category: "marker", name: "pointer" },
24
+ checked: { type: "indicator", category: "marker", name: "checkboxChecked" },
25
+ disabled: { type: "indicator", category: "marker", name: "dash" },
26
+ success: { type: "indicator", category: "status", name: "success" },
27
+ warning: { type: "indicator", category: "status", name: "warning" },
28
+ error: { type: "indicator", category: "status", name: "error" },
29
+ info: { type: "indicator", category: "status", name: "info" }
30
+ },
31
+ listBullet: { unicode: "\u2022", fallback: "-" },
32
+ checkbox: {
33
+ checked: { unicode: "\u2611", fallback: "[x]" },
34
+ unchecked: { unicode: "\u2610", fallback: "[ ]" }
35
+ },
36
+ colors: {
37
+ success: ANSI.green,
38
+ warning: ANSI.yellow,
39
+ error: ANSI.red,
40
+ info: ANSI.blue,
41
+ primary: "",
42
+ secondary: ANSI.gray,
43
+ muted: ANSI.dim,
44
+ accent: ANSI.cyan,
45
+ highlight: ANSI.bold,
46
+ link: `${ANSI.cyan}${ANSI.underline}`,
47
+ destructive: ANSI.brightRed,
48
+ subtle: `${ANSI.dim}${ANSI.gray}`
49
+ },
50
+ spacing: {
51
+ boxPadding: 1,
52
+ listIndent: 2,
53
+ stackGap: 0,
54
+ horizontalGap: 1
55
+ },
56
+ spinner: "dots"
57
+ };
58
+
59
+ export { defaultTheme };
@@ -0,0 +1,128 @@
1
+ import { CaseMode, SeparatorStyle } from "./cli-6bztk73z";
2
+ import { Theme } from "./cli-xsaheemc";
3
+ /**
4
+ * Options for creating a demo section.
5
+ */
6
+ interface SectionOptions {
7
+ /** Separator character style (default: "─") */
8
+ separator?: SeparatorStyle;
9
+ /** Case transformation (default: "title") */
10
+ case?: CaseMode;
11
+ }
12
+ /**
13
+ * Options for creating a subsection.
14
+ */
15
+ interface SubsectionOptions {
16
+ /** Separator character style (default: "─") */
17
+ separator?: SeparatorStyle;
18
+ /** Case transformation (default: "title") */
19
+ case?: CaseMode;
20
+ }
21
+ /**
22
+ * Creates a demo section heading.
23
+ *
24
+ * Sections are major divisions in a demo, rendered with title case text
25
+ * and thin Unicode line separators by default.
26
+ *
27
+ * @param title - The section title
28
+ * @param options - Optional rendering options
29
+ * @returns Formatted section heading string
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { demoSection } from "@outfitter/cli/demo";
34
+ *
35
+ * console.log(demoSection("Theme Colors"));
36
+ * // Theme Colors
37
+ * // ────────────
38
+ * ```
39
+ */
40
+ declare function demoSection(title: string, options?: SectionOptions): string;
41
+ /**
42
+ * Creates a demo subsection heading.
43
+ *
44
+ * Subsections are minor divisions within a section, rendered with title case
45
+ * text and thin Unicode line separators by default.
46
+ *
47
+ * @param title - The subsection title
48
+ * @param options - Optional rendering options
49
+ * @returns Formatted subsection heading string
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * import { demoSubsection } from "@outfitter/cli/demo";
54
+ *
55
+ * console.log(demoSubsection("Status"));
56
+ * // Status
57
+ * // ──────
58
+ * ```
59
+ */
60
+ declare function demoSubsection(title: string, options?: SubsectionOptions): string;
61
+ /**
62
+ * Creates a code block for demo sections.
63
+ *
64
+ * Code blocks are displayed when `showCode` is enabled and provide
65
+ * usage examples for the primitives being demonstrated.
66
+ *
67
+ * @param lines - Lines of code to display
68
+ * @param show - Whether to show the code block (default: true)
69
+ * @returns Array of code lines, or empty array if hidden
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * import { codeBlock } from "@outfitter/cli/demo";
74
+ *
75
+ * const code = codeBlock([
76
+ * 'import { renderBox } from "@outfitter/cli/render";',
77
+ * "",
78
+ * 'renderBox("Hello")',
79
+ * ], true);
80
+ * ```
81
+ */
82
+ declare function codeBlock(lines: string[], show?: boolean): string[];
83
+ /**
84
+ * Creates a description line styled with muted theme.
85
+ *
86
+ * Descriptions provide contextual information about a demo section
87
+ * when `showDescriptions` is enabled.
88
+ *
89
+ * @param text - The description text
90
+ * @param theme - Theme for styling
91
+ * @param show - Whether to show the description (default: true)
92
+ * @returns Array with styled description, or empty array if hidden
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * import { description } from "@outfitter/cli/demo";
97
+ *
98
+ * const desc = description(
99
+ * "Control padding per side with an object.",
100
+ * theme,
101
+ * true
102
+ * );
103
+ * ```
104
+ */
105
+ declare function description(text: string, theme: Theme, show?: boolean): string[];
106
+ /**
107
+ * Joins demo content with vertical spacing.
108
+ *
109
+ * Wraps `joinVertical` with demo-appropriate defaults.
110
+ *
111
+ * @param blocks - Content blocks to join
112
+ * @param gap - Lines of spacing between blocks (default: 1)
113
+ * @returns Combined string with blocks stacked
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * import { demoSection, demoContent } from "@outfitter/cli/demo";
118
+ *
119
+ * const output = demoContent([
120
+ * demoSection("Colors"),
121
+ * "Color examples here...",
122
+ * demoSection("Borders"),
123
+ * "Border examples here...",
124
+ * ]);
125
+ * ```
126
+ */
127
+ declare function demoContent(blocks: string[], gap?: number): string;
128
+ export { SectionOptions, SubsectionOptions, demoSection, demoSubsection, codeBlock, description, demoContent };
@@ -0,0 +1,75 @@
1
+ // @bun
2
+ import {
3
+ __esm
4
+ } from "./cli-v1tzwxkt.js";
5
+
6
+ // packages/cli/src/terminal/detection.ts
7
+ import { getEnvBoolean } from "@outfitter/config";
8
+ function getEnvValue(key) {
9
+ return process.env[key];
10
+ }
11
+ function hasNoColorEnv() {
12
+ return getEnvValue("NO_COLOR") !== undefined;
13
+ }
14
+ function resolveForceColorEnv() {
15
+ const value = getEnvValue("FORCE_COLOR");
16
+ if (value === undefined) {
17
+ return;
18
+ }
19
+ if (value === "") {
20
+ return true;
21
+ }
22
+ const numeric = Number(value);
23
+ if (!Number.isNaN(numeric)) {
24
+ return numeric > 0;
25
+ }
26
+ return true;
27
+ }
28
+ function resolveColorEnv(options) {
29
+ const forced = resolveForceColorEnv();
30
+ const noColor = hasNoColorEnv();
31
+ if (options?.forceColorFirst) {
32
+ if (forced !== undefined) {
33
+ return forced;
34
+ }
35
+ if (noColor) {
36
+ return false;
37
+ }
38
+ } else {
39
+ if (noColor) {
40
+ return false;
41
+ }
42
+ if (forced !== undefined) {
43
+ return forced;
44
+ }
45
+ }
46
+ return;
47
+ }
48
+ function supportsColor(options) {
49
+ const env = resolveColorEnv();
50
+ if (env !== undefined) {
51
+ return env;
52
+ }
53
+ if (options?.isTTY !== undefined) {
54
+ return options.isTTY;
55
+ }
56
+ return process.stdout.isTTY ?? false;
57
+ }
58
+ function getTerminalWidth(options) {
59
+ const isTTY = options?.isTTY ?? process.stdout.isTTY ?? false;
60
+ if (!isTTY) {
61
+ return 80;
62
+ }
63
+ return process.stdout.columns ?? 80;
64
+ }
65
+ function isInteractive(options) {
66
+ const isCI = options?.isCI ?? getEnvBoolean("CI") === true;
67
+ if (isCI) {
68
+ return false;
69
+ }
70
+ const isTTY = options?.isTTY ?? process.stdout.isTTY ?? false;
71
+ return isTTY;
72
+ }
73
+ var init_detection = () => {};
74
+
75
+ export { getEnvValue, hasNoColorEnv, resolveForceColorEnv, resolveColorEnv, supportsColor, getTerminalWidth, isInteractive, init_detection };
@@ -0,0 +1,61 @@
1
+ // @bun
2
+ import {
3
+ renderProgress
4
+ } from "./cli-bc17qeh2.js";
5
+ import {
6
+ demoSection
7
+ } from "./cli-34fqr7bp.js";
8
+
9
+ // packages/cli/src/demo/renderers/progress.ts
10
+ function renderProgressDemo(config, _theme) {
11
+ const showCode = config.showCode ?? true;
12
+ const lines = [];
13
+ lines.push(demoSection("Basic Progress Bar"));
14
+ lines.push("");
15
+ if (showCode) {
16
+ lines.push('import { renderProgress } from "@outfitter/cli/render";');
17
+ lines.push("");
18
+ }
19
+ const percentages = [0, 25, 50, 75, 100];
20
+ for (const pct of percentages) {
21
+ const bar = renderProgress({ current: pct, total: 100 });
22
+ lines.push(`${pct.toString().padStart(3)}% ${bar}`);
23
+ }
24
+ lines.push("");
25
+ lines.push(demoSection("With Percentage Display"));
26
+ lines.push("");
27
+ if (showCode) {
28
+ lines.push("renderProgress({ current: 75, total: 100, showPercent: true })");
29
+ lines.push("");
30
+ }
31
+ lines.push(renderProgress({ current: 75, total: 100, showPercent: true }));
32
+ lines.push("");
33
+ lines.push(demoSection("Custom Width"));
34
+ lines.push("");
35
+ const widths = [10, 20, 30, 40];
36
+ for (const width of widths) {
37
+ if (showCode) {
38
+ lines.push(`renderProgress({ current: 50, total: 100, width: ${width} })`);
39
+ }
40
+ const bar = renderProgress({ current: 50, total: 100, width });
41
+ lines.push(` ${bar}`);
42
+ lines.push("");
43
+ }
44
+ lines.push(demoSection("Edge Cases"));
45
+ lines.push("");
46
+ lines.push("Empty (0%):");
47
+ lines.push(` ${renderProgress({ current: 0, total: 100 })}`);
48
+ lines.push("");
49
+ lines.push("Full (100%):");
50
+ lines.push(` ${renderProgress({ current: 100, total: 100 })}`);
51
+ lines.push("");
52
+ lines.push("Over 100% (capped):");
53
+ lines.push(` ${renderProgress({ current: 150, total: 100, showPercent: true })}`);
54
+ lines.push("");
55
+ lines.push("Negative (floored to 0%):");
56
+ lines.push(` ${renderProgress({ current: -10, total: 100, showPercent: true })}`);
57
+ return lines.join(`
58
+ `);
59
+ }
60
+
61
+ export { renderProgressDemo };
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Spinner rendering utilities.
3
+ *
4
+ * Provides animated spinner frames for async operations with
5
+ * multiple styles and graceful degradation for non-TTY contexts.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Available spinner animation styles.
11
+ *
12
+ * - `dots`: Braille dots animation (default, smooth)
13
+ * - `line`: Classic ASCII spinner (-\|/)
14
+ * - `arc`: Corner arc rotation
15
+ * - `circle`: Half-filled circle rotation
16
+ * - `bounce`: Bouncing dot (vertical)
17
+ * - `ping`: Bouncing dot in brackets (horizontal)
18
+ */
19
+ type SpinnerStyle = "dots" | "line" | "arc" | "circle" | "bounce" | "ping";
20
+ /**
21
+ * Spinner animation frame definition.
22
+ */
23
+ interface SpinnerFrames {
24
+ /** Array of characters to cycle through */
25
+ frames: string[];
26
+ /** Milliseconds between frame changes */
27
+ interval: number;
28
+ }
29
+ /**
30
+ * Predefined spinner animations.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const dotsSpinner = SPINNERS.dots;
35
+ * console.log(dotsSpinner.frames[0]); // "⠋"
36
+ * console.log(dotsSpinner.interval); // 80
37
+ * ```
38
+ */
39
+ declare const SPINNERS: Record<SpinnerStyle, SpinnerFrames>;
40
+ /**
41
+ * Gets the spinner frame for a given elapsed time.
42
+ *
43
+ * Calculates which frame to display based on elapsed milliseconds
44
+ * and the spinner's interval setting. Automatically wraps around
45
+ * when the elapsed time exceeds a full cycle.
46
+ *
47
+ * @param style - The spinner style to use
48
+ * @param elapsed - Elapsed time in milliseconds since spinner started
49
+ * @returns The frame character to display
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // Get frame at start
54
+ * getSpinnerFrame("dots", 0); // "⠋"
55
+ *
56
+ * // Get frame after 160ms
57
+ * getSpinnerFrame("dots", 160); // "⠹" (third frame)
58
+ *
59
+ * // Frames wrap around automatically
60
+ * const fullCycle = SPINNERS.dots.interval * SPINNERS.dots.frames.length;
61
+ * getSpinnerFrame("dots", fullCycle); // "⠋" (back to first)
62
+ * ```
63
+ */
64
+ declare function getSpinnerFrame(style: SpinnerStyle, elapsed: number): string;
65
+ /**
66
+ * Renders a static spinner frame with optional message.
67
+ *
68
+ * This is the non-interactive version for logging and non-TTY contexts.
69
+ * For animated spinners, use the elapsed parameter with `getSpinnerFrame()`.
70
+ *
71
+ * @param style - The spinner style to use
72
+ * @param message - Optional message to display after the spinner
73
+ * @returns Formatted spinner string
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * // Simple spinner
78
+ * console.log(renderSpinner("dots"));
79
+ * // "⠋"
80
+ *
81
+ * // Spinner with message
82
+ * console.log(renderSpinner("dots", "Loading..."));
83
+ * // "⠋ Loading..."
84
+ *
85
+ * // For logs (non-TTY)
86
+ * logger.info(renderSpinner("line", "Fetching data"));
87
+ * // "- Fetching data"
88
+ * ```
89
+ */
90
+ declare function renderSpinner(style: SpinnerStyle, message?: string): string;
91
+ export { SpinnerStyle, SpinnerFrames, SPINNERS, getSpinnerFrame, renderSpinner };
@@ -0,0 +1,93 @@
1
+ import { VisualTheme } from "./cli-s0kkx9m1";
2
+ import { LayoutContext } from "./cli-2g8bx1aq";
3
+ /**
4
+ * Layout context extended with theme information.
5
+ *
6
+ * Allows themes to cascade through component hierarchies. Children
7
+ * inherit their parent's theme unless explicitly overridden.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { createThemedContext, roundedTheme } from "@outfitter/cli/theme";
12
+ *
13
+ * // Create root context with theme
14
+ * const ctx = createThemedContext({ theme: roundedTheme, width: 80 });
15
+ *
16
+ * // Child inherits theme from parent
17
+ * const childCtx = createThemedContext({ width: 40, parent: ctx });
18
+ * console.log(childCtx.theme.border); // "rounded" (inherited)
19
+ *
20
+ * // Child can override theme
21
+ * const overrideCtx = createThemedContext({
22
+ * theme: boldTheme,
23
+ * width: 40,
24
+ * parent: ctx
25
+ * });
26
+ * console.log(overrideCtx.theme.border); // "heavy"
27
+ * ```
28
+ */
29
+ interface ThemedLayoutContext extends LayoutContext {
30
+ /** The visual theme for this context */
31
+ readonly theme: VisualTheme;
32
+ }
33
+ /**
34
+ * Options for creating a themed layout context.
35
+ */
36
+ interface ThemedContextOptions {
37
+ /** Visual theme (inherited from parent if not specified) */
38
+ theme?: VisualTheme;
39
+ /** Available width in characters */
40
+ width?: number;
41
+ /** Parent context for inheritance */
42
+ parent?: ThemedLayoutContext;
43
+ }
44
+ /**
45
+ * Creates a themed layout context with cascading inheritance.
46
+ *
47
+ * Theme inheritance rules:
48
+ * 1. Explicit theme → use it
49
+ * 2. Parent exists → inherit parent's theme
50
+ * 3. No theme or parent → use defaultTheme
51
+ *
52
+ * Width inheritance rules:
53
+ * 1. Explicit width → use it
54
+ * 2. Parent exists → inherit parent's width
55
+ * 3. No width or parent → use terminal width (via getTerminalWidth)
56
+ *
57
+ * @param options - Context configuration
58
+ * @returns A ThemedLayoutContext with resolved theme and width
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Root context with explicit theme and width
63
+ * const root = createThemedContext({ theme: roundedTheme, width: 100 });
64
+ *
65
+ * // Child with inherited theme, explicit width
66
+ * const child = createThemedContext({ width: 50, parent: root });
67
+ *
68
+ * // Nested child with overridden theme
69
+ * const nested = createThemedContext({
70
+ * theme: boldTheme,
71
+ * parent: child
72
+ * });
73
+ * ```
74
+ */
75
+ declare function createThemedContext(options: ThemedContextOptions): ThemedLayoutContext;
76
+ /**
77
+ * Gets the theme from a context, with fallback to defaultTheme.
78
+ *
79
+ * Useful when you have an optional context and need a theme.
80
+ *
81
+ * @param ctx - Optional themed context
82
+ * @returns The context's theme or defaultTheme if no context
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * function renderComponent(ctx?: ThemedLayoutContext) {
87
+ * const theme = getContextTheme(ctx);
88
+ * // theme is always defined
89
+ * }
90
+ * ```
91
+ */
92
+ declare function getContextTheme(ctx?: ThemedLayoutContext): VisualTheme;
93
+ export { ThemedLayoutContext, ThemedContextOptions, createThemedContext, getContextTheme };
@@ -0,0 +1,52 @@
1
+ // @bun
2
+ // packages/cli/src/cli.ts
3
+ import { Command } from "commander";
4
+ function isCommanderHelp(error) {
5
+ return error.code === "commander.helpDisplayed" || error.code === "commander.version" || error.code === "commander.help";
6
+ }
7
+ function createCLI(config) {
8
+ const program = new Command;
9
+ program.name(config.name).version(config.version);
10
+ if (config.description) {
11
+ program.description(config.description);
12
+ }
13
+ const exit = config.onExit ?? ((code) => process.exit(code));
14
+ program.exitOverride((error) => {
15
+ if (isCommanderHelp(error)) {
16
+ exit(0);
17
+ }
18
+ if (config.onError) {
19
+ config.onError(error);
20
+ }
21
+ const exitCode = typeof error.exitCode === "number" && Number.isFinite(error.exitCode) ? error.exitCode : 1;
22
+ exit(exitCode);
23
+ });
24
+ const parse = async (argv) => {
25
+ try {
26
+ await program.parseAsync(argv ?? process.argv);
27
+ } catch (error) {
28
+ const err = error instanceof Error ? error : new Error(String(error));
29
+ if (config.onError) {
30
+ config.onError(err);
31
+ }
32
+ const errorExitCode = error.exitCode;
33
+ const exitCode = typeof errorExitCode === "number" ? errorExitCode : 1;
34
+ exit(exitCode);
35
+ }
36
+ };
37
+ const cli = {
38
+ program,
39
+ register: (builderOrCommand) => {
40
+ if ("build" in builderOrCommand) {
41
+ program.addCommand(builderOrCommand.build());
42
+ } else {
43
+ program.addCommand(builderOrCommand);
44
+ }
45
+ return cli;
46
+ },
47
+ parse
48
+ };
49
+ return cli;
50
+ }
51
+
52
+ export { createCLI };
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,48 @@
1
+ // @bun
2
+ import {
3
+ defaultTheme
4
+ } from "./cli-cs45xd6q.js";
5
+ import {
6
+ BORDERS,
7
+ init_borders
8
+ } from "./cli-85fg2vr5.js";
9
+
10
+ // packages/cli/src/theme/create.ts
11
+ init_borders();
12
+ function createVisualTheme(options) {
13
+ const base = options?.extends ?? defaultTheme;
14
+ const overrides = options?.overrides ?? {};
15
+ const border = overrides.border ?? base.border;
16
+ const borderChars = overrides.borderChars ?? (overrides.border ? BORDERS[overrides.border] : base.borderChars);
17
+ const colors = {
18
+ ...base.colors,
19
+ ...overrides.colors
20
+ };
21
+ const spacing = {
22
+ ...base.spacing,
23
+ ...overrides.spacing
24
+ };
25
+ const markers = {
26
+ ...base.markers,
27
+ ...overrides.markers
28
+ };
29
+ const checkbox = {
30
+ checked: overrides.checkbox?.checked ?? base.checkbox.checked,
31
+ unchecked: overrides.checkbox?.unchecked ?? base.checkbox.unchecked
32
+ };
33
+ return {
34
+ name: overrides.name ?? base.name,
35
+ border,
36
+ borderChars,
37
+ treeGuide: overrides.treeGuide ?? base.treeGuide,
38
+ delimiter: overrides.delimiter ?? base.delimiter,
39
+ markers,
40
+ listBullet: overrides.listBullet ?? base.listBullet,
41
+ checkbox,
42
+ colors,
43
+ spacing,
44
+ spinner: overrides.spinner ?? base.spinner
45
+ };
46
+ }
47
+
48
+ export { createVisualTheme };