@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,54 @@
1
+ /**
2
+ * ANSI escape sequences for terminal control.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /**
7
+ * ANSI escape sequences for cursor and screen control.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { ANSI } from "@outfitter/cli/streaming";
12
+ *
13
+ * // Move cursor up 2 lines and clear
14
+ * process.stdout.write(ANSI.cursorUp(2) + ANSI.clearLine);
15
+ *
16
+ * // Hide cursor during animation
17
+ * process.stdout.write(ANSI.hideCursor);
18
+ * // ... do animation ...
19
+ * process.stdout.write(ANSI.showCursor);
20
+ * ```
21
+ */
22
+ declare const ANSI: {
23
+ /** Move cursor up n lines */
24
+ readonly cursorUp: (n: number) => string;
25
+ /** Move cursor down n lines */
26
+ readonly cursorDown: (n: number) => string;
27
+ /** Move cursor right n columns */
28
+ readonly cursorRight: (n: number) => string;
29
+ /** Move cursor left n columns */
30
+ readonly cursorLeft: (n: number) => string;
31
+ /** Move cursor to beginning of line */
32
+ readonly cursorToStart: "\x1B[G";
33
+ /** Clear entire line */
34
+ readonly clearLine: "\x1B[2K";
35
+ /** Clear from cursor to end of screen */
36
+ readonly clearToEnd: "\x1B[0J";
37
+ /** Clear from cursor to beginning of screen */
38
+ readonly clearToStart: "\x1B[1J";
39
+ /** Clear entire screen */
40
+ readonly clearScreen: "\x1B[2J";
41
+ /** Hide cursor */
42
+ readonly hideCursor: "\x1B[?25l";
43
+ /** Show cursor */
44
+ readonly showCursor: "\x1B[?25h";
45
+ /** Save cursor position */
46
+ readonly saveCursor: "\x1B[s";
47
+ /** Restore cursor position */
48
+ readonly restoreCursor: "\x1B[u";
49
+ /** Carriage return (move to start of line) */
50
+ readonly carriageReturn: "\r";
51
+ /** New line */
52
+ readonly newLine: "\n";
53
+ };
54
+ export { ANSI };
@@ -0,0 +1,20 @@
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/presets/rounded.ts
11
+ init_borders();
12
+ var roundedTheme = {
13
+ ...defaultTheme,
14
+ name: "rounded",
15
+ border: "rounded",
16
+ borderChars: BORDERS.rounded,
17
+ treeGuide: "rounded"
18
+ };
19
+
20
+ export { roundedTheme };
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,52 @@
1
+ // @bun
2
+ // packages/cli/src/demo/templates.ts
3
+ var DEFAULT_EXAMPLES = {
4
+ success: "Operation completed",
5
+ warning: "Proceed with caution",
6
+ error: "Something went wrong",
7
+ info: "For your information",
8
+ primary: "Main content",
9
+ secondary: "Supporting text",
10
+ muted: "(optional)",
11
+ accent: "Highlighted item",
12
+ highlight: "Important",
13
+ link: "https://example.com",
14
+ destructive: "Delete forever",
15
+ subtle: "Fine print",
16
+ bold: "Strong emphasis",
17
+ italic: "Subtle emphasis",
18
+ underline: "Underlined text",
19
+ dim: "De-emphasized",
20
+ boxContent: "Hello, world!",
21
+ boxTitle: "Status",
22
+ spinnerMessage: "Loading...",
23
+ progressLabel: "Progress",
24
+ listItems: ["First item", "Second item", "Third item"],
25
+ tableData: [
26
+ { id: 1, name: "Alice", status: "Active" },
27
+ { id: 2, name: "Bob", status: "Pending" }
28
+ ],
29
+ treeData: {
30
+ src: {
31
+ components: {
32
+ Button: null,
33
+ Input: null
34
+ },
35
+ utils: null
36
+ },
37
+ tests: null
38
+ },
39
+ markdownSample: `# Heading
40
+
41
+ Some **bold** and *italic* text.
42
+
43
+ Use \`npm install\` to install.`
44
+ };
45
+ function getExample(key, custom) {
46
+ if (custom?.[key] !== undefined) {
47
+ return custom[key];
48
+ }
49
+ return DEFAULT_EXAMPLES[key];
50
+ }
51
+
52
+ export { DEFAULT_EXAMPLES, getExample };
@@ -0,0 +1,86 @@
1
+ // @bun
2
+ // packages/cli/src/render/list.ts
3
+ function toLetter(n) {
4
+ return String.fromCharCode(96 + n);
5
+ }
6
+ function toRoman(n) {
7
+ const numerals = [
8
+ [10, "x"],
9
+ [9, "ix"],
10
+ [5, "v"],
11
+ [4, "iv"],
12
+ [1, "i"]
13
+ ];
14
+ let result = "";
15
+ let remaining = n;
16
+ for (const [value, symbol] of numerals) {
17
+ while (remaining >= value) {
18
+ result += symbol;
19
+ remaining -= value;
20
+ }
21
+ }
22
+ return result;
23
+ }
24
+ function getMarker(style, depth, index, isChecked) {
25
+ switch (style) {
26
+ case "bullet":
27
+ return "\u2022";
28
+ case "dash":
29
+ return "-";
30
+ case "number":
31
+ if (depth === 0) {
32
+ return `${index + 1}.`;
33
+ }
34
+ if (depth === 1) {
35
+ return `${toLetter(index + 1)}.`;
36
+ }
37
+ return `${toRoman(index + 1)}.`;
38
+ case "checkbox":
39
+ return isChecked ? "\u2611" : "\u2610";
40
+ default: {
41
+ const _exhaustive = style;
42
+ return _exhaustive;
43
+ }
44
+ }
45
+ }
46
+ function renderList(items, options) {
47
+ const style = options?.style ?? "dash";
48
+ const checkedSet = options?.checked ?? new Set;
49
+ const baseIndent = options?.indent ?? 2;
50
+ const lines = [];
51
+ let _globalIndex = 0;
52
+ const renderItem = (item, currentIndent, depth, indexAtDepth, currentStyle) => {
53
+ const indentStr = " ".repeat(currentIndent);
54
+ const text = typeof item === "string" ? item : item.text;
55
+ let isChecked = false;
56
+ if (currentStyle === "checkbox") {
57
+ if (typeof item !== "string" && item.checked !== undefined) {
58
+ isChecked = item.checked;
59
+ } else if (depth === 0) {
60
+ isChecked = checkedSet.has(indexAtDepth);
61
+ }
62
+ }
63
+ const marker = getMarker(currentStyle, depth, indexAtDepth, isChecked);
64
+ lines.push(`${indentStr}${marker} ${text}`);
65
+ _globalIndex++;
66
+ if (typeof item !== "string" && item.children) {
67
+ const childStyle = typeof item !== "string" && item.childStyle ? item.childStyle : currentStyle;
68
+ const childIndent = currentStyle === "number" ? currentIndent + marker.length + 1 : currentIndent + baseIndent;
69
+ const childDepth = childStyle !== currentStyle ? 0 : depth + 1;
70
+ let childIndex = 0;
71
+ for (const child of item.children) {
72
+ renderItem(child, childIndent, childDepth, childIndex, childStyle);
73
+ childIndex++;
74
+ }
75
+ }
76
+ };
77
+ let topIndex = 0;
78
+ for (const item of items) {
79
+ renderItem(item, 0, 0, topIndex, style);
80
+ topIndex++;
81
+ }
82
+ return lines.join(`
83
+ `);
84
+ }
85
+
86
+ export { renderList };
@@ -6,6 +6,7 @@ declare const ANSI: {
6
6
  readonly bold: "\x1B[1m";
7
7
  readonly dim: "\x1B[2m";
8
8
  readonly italic: "\x1B[3m";
9
+ readonly underline: "\x1B[4m";
9
10
  readonly green: "\x1B[32m";
10
11
  readonly yellow: "\x1B[33m";
11
12
  readonly red: "\x1B[31m";
@@ -14,6 +15,11 @@ declare const ANSI: {
14
15
  readonly magenta: "\x1B[35m";
15
16
  readonly white: "\x1B[37m";
16
17
  readonly gray: "\x1B[90m";
18
+ readonly brightCyan: "\x1B[96m";
19
+ readonly brightRed: "\x1B[91m";
20
+ readonly brightYellow: "\x1B[93m";
21
+ readonly brightGreen: "\x1B[92m";
22
+ readonly brightBlue: "\x1B[94m";
17
23
  };
18
24
  /**
19
25
  * Theme interface with semantic and text color functions.
@@ -44,6 +50,24 @@ interface Theme {
44
50
  secondary: (text: string) => string;
45
51
  /** Applies dim styling for de-emphasized text */
46
52
  muted: (text: string) => string;
53
+ /** Applies cyan color for interactive elements and highlights */
54
+ accent: (text: string) => string;
55
+ /** Applies bold for strong emphasis */
56
+ highlight: (text: string) => string;
57
+ /** Applies cyan + underline for URLs and clickable references */
58
+ link: (text: string) => string;
59
+ /** Applies bright red for dangerous actions */
60
+ destructive: (text: string) => string;
61
+ /** Applies dim gray for less prominent text than muted */
62
+ subtle: (text: string) => string;
63
+ /** Applies bold styling */
64
+ bold: (text: string) => string;
65
+ /** Applies italic styling */
66
+ italic: (text: string) => string;
67
+ /** Applies underline styling */
68
+ underline: (text: string) => string;
69
+ /** Applies dim styling (alias for muted style) */
70
+ dim: (text: string) => string;
47
71
  }
48
72
  /**
49
73
  * Available color names for the {@link applyColor} function.
@@ -85,14 +109,30 @@ interface Tokens {
85
109
  error: string;
86
110
  /** Blue color for informational messages */
87
111
  info: string;
88
- /** Dim/gray color for de-emphasized text */
89
- muted: string;
90
- /** Bright/highlight color for emphasis */
91
- accent: string;
92
112
  /** Default text color (typically empty string) */
93
113
  primary: string;
94
114
  /** Subdued color for secondary text */
95
115
  secondary: string;
116
+ /** Dim/gray color for de-emphasized text */
117
+ muted: string;
118
+ /** Cyan color for interactive elements and highlights */
119
+ accent: string;
120
+ /** Bold for strong emphasis */
121
+ highlight: string;
122
+ /** Cyan + underline for URLs and clickable references */
123
+ link: string;
124
+ /** Bright red for dangerous actions */
125
+ destructive: string;
126
+ /** Dim gray for less prominent text than muted */
127
+ subtle: string;
128
+ /** Bold styling */
129
+ bold: string;
130
+ /** Italic styling */
131
+ italic: string;
132
+ /** Underline styling */
133
+ underline: string;
134
+ /** Dim styling */
135
+ dim: string;
96
136
  }
97
137
  /**
98
138
  * Configuration options for {@link createTokens}.
@@ -0,0 +1,82 @@
1
+ // @bun
2
+ import {
3
+ getTerminalWidth
4
+ } from "./cli-671sxkhj.js";
5
+
6
+ // packages/cli/src/render/heading.ts
7
+ var ANSI_PATTERN = /\x1b\[[0-9;]*m/g;
8
+ function toTitleCase(text) {
9
+ return text.replace(/\w\S*/g, (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());
10
+ }
11
+ function applyCase(text, caseMode) {
12
+ if (caseMode === "none") {
13
+ return text;
14
+ }
15
+ const hasAnsi = ANSI_PATTERN.test(text);
16
+ ANSI_PATTERN.lastIndex = 0;
17
+ if (!hasAnsi) {
18
+ switch (caseMode) {
19
+ case "upper":
20
+ return text.toUpperCase();
21
+ case "lower":
22
+ return text.toLowerCase();
23
+ case "title":
24
+ return toTitleCase(text);
25
+ default: {
26
+ const _exhaustive = caseMode;
27
+ return _exhaustive;
28
+ }
29
+ }
30
+ }
31
+ const sequences = [];
32
+ for (const match of text.matchAll(ANSI_PATTERN)) {
33
+ sequences.push({ index: match.index, seq: match[0] });
34
+ }
35
+ const stripped = Bun.stripANSI(text);
36
+ let transformed;
37
+ switch (caseMode) {
38
+ case "upper":
39
+ transformed = stripped.toUpperCase();
40
+ break;
41
+ case "lower":
42
+ transformed = stripped.toLowerCase();
43
+ break;
44
+ case "title":
45
+ transformed = toTitleCase(stripped);
46
+ break;
47
+ default: {
48
+ const _exhaustive = caseMode;
49
+ return _exhaustive;
50
+ }
51
+ }
52
+ let result = transformed;
53
+ let offset = 0;
54
+ for (const { index, seq } of sequences) {
55
+ const insertPos = index + offset;
56
+ result = result.slice(0, insertPos) + seq + result.slice(insertPos);
57
+ offset += seq.length;
58
+ }
59
+ return result;
60
+ }
61
+ function getTextWidth(text) {
62
+ return Bun.stringWidth(text);
63
+ }
64
+ function renderHeading(text, options) {
65
+ const separator = options?.separator ?? "=";
66
+ const widthMode = options?.width ?? "text";
67
+ const caseMode = options?.case ?? "upper";
68
+ const transformedText = applyCase(text, caseMode);
69
+ let width;
70
+ if (widthMode === "text") {
71
+ width = getTextWidth(transformedText);
72
+ } else if (widthMode === "full") {
73
+ width = getTerminalWidth();
74
+ } else {
75
+ width = widthMode;
76
+ }
77
+ const separatorLine = separator.repeat(width);
78
+ return `${transformedText}
79
+ ${separatorLine}`;
80
+ }
81
+
82
+ export { renderHeading };
@@ -0,0 +1,48 @@
1
+ import { MultiSelectPromptOptions, PromptResult, SelectPromptOptions } from "./cli-3f12z5kf";
2
+ /**
3
+ * Prompts for single selection with Result wrapping.
4
+ *
5
+ * @param options - Select prompt options
6
+ * @returns Ok with selected value or Err with CancelledError
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { promptSelect } from "@outfitter/cli/prompt";
11
+ *
12
+ * const result = await promptSelect({
13
+ * message: "Pick a color:",
14
+ * options: [
15
+ * { value: "red", label: "Red", hint: "A warm color" },
16
+ * { value: "blue", label: "Blue", hint: "A cool color" },
17
+ * ],
18
+ * });
19
+ *
20
+ * if (result.isOk()) {
21
+ * console.log(`You picked: ${result.value}`);
22
+ * }
23
+ * ```
24
+ */
25
+ declare function promptSelect<T>(options: SelectPromptOptions<T>): PromptResult<T>;
26
+ /**
27
+ * Prompts for multiple selections with Result wrapping.
28
+ *
29
+ * @param options - Multi-select prompt options
30
+ * @returns Ok with array of selected values or Err with CancelledError
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { promptMultiSelect } from "@outfitter/cli/prompt";
35
+ *
36
+ * const result = await promptMultiSelect({
37
+ * message: "Select toppings:",
38
+ * options: [
39
+ * { value: "cheese", label: "Cheese" },
40
+ * { value: "pepperoni", label: "Pepperoni" },
41
+ * { value: "mushrooms", label: "Mushrooms" },
42
+ * ],
43
+ * required: true,
44
+ * });
45
+ * ```
46
+ */
47
+ declare function promptMultiSelect<T>(options: MultiSelectPromptOptions<T>): PromptResult<T[]>;
48
+ export { promptSelect, promptMultiSelect };
@@ -0,0 +1,2 @@
1
+ import { ANSI } from "../shared/@outfitter/cli-vtg0sqk2";
2
+ export { ANSI };
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ import {
3
+ ANSI
4
+ } from "../shared/@outfitter/cli-p3dqm1vd.js";
5
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
6
+ export {
7
+ ANSI
8
+ };
@@ -0,0 +1,4 @@
1
+ import { Spinner, SpinnerOptions, SpinnerStyle, createSpinner } from "../shared/@outfitter/cli-h20jc0bs";
2
+ import { StreamWriter, StreamWriterOptions, WritableStream, createStreamWriter } from "../shared/@outfitter/cli-cf1xexgn";
3
+ import { ANSI } from "../shared/@outfitter/cli-vtg0sqk2";
4
+ export { createStreamWriter, createSpinner, WritableStream, StreamWriterOptions, StreamWriter, SpinnerStyle, SpinnerOptions, Spinner, ANSI };
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ import {
3
+ createStreamWriter
4
+ } from "../shared/@outfitter/cli-jejfypgf.js";
5
+ import {
6
+ createSpinner
7
+ } from "../shared/@outfitter/cli-j4n8gaf3.js";
8
+ import {
9
+ ANSI
10
+ } from "../shared/@outfitter/cli-p3dqm1vd.js";
11
+ import"../shared/@outfitter/cli-p1m5dhrs.js";
12
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
13
+ export {
14
+ createStreamWriter,
15
+ createSpinner,
16
+ ANSI
17
+ };
@@ -0,0 +1,3 @@
1
+ import { Spinner, SpinnerOptions, SpinnerStyle, createSpinner } from "../shared/@outfitter/cli-h20jc0bs";
2
+ import "../shared/@outfitter/cli-cf1xexgn";
3
+ export { createSpinner, SpinnerStyle, SpinnerOptions, Spinner };
@@ -0,0 +1,10 @@
1
+ // @bun
2
+ import {
3
+ createSpinner
4
+ } from "../shared/@outfitter/cli-j4n8gaf3.js";
5
+ import"../shared/@outfitter/cli-p3dqm1vd.js";
6
+ import"../shared/@outfitter/cli-p1m5dhrs.js";
7
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
8
+ export {
9
+ createSpinner
10
+ };
@@ -0,0 +1,2 @@
1
+ import { StreamWriter, StreamWriterOptions, WritableStream, createStreamWriter } from "../shared/@outfitter/cli-cf1xexgn";
2
+ export { createStreamWriter, WritableStream, StreamWriterOptions, StreamWriter };
@@ -0,0 +1,9 @@
1
+ // @bun
2
+ import {
3
+ createStreamWriter
4
+ } from "../shared/@outfitter/cli-jejfypgf.js";
5
+ import"../shared/@outfitter/cli-p3dqm1vd.js";
6
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
7
+ export {
8
+ createStreamWriter
9
+ };
@@ -0,0 +1,4 @@
1
+ import "../shared/@outfitter/cli-mn8f7rh4";
2
+ import { TableOptions, renderTable } from "../shared/@outfitter/cli-qj83y5wj";
3
+ import "../shared/@outfitter/cli-fakncnjp";
4
+ export { renderTable, TableOptions };
@@ -0,0 +1,13 @@
1
+ // @bun
2
+ import"../shared/@outfitter/cli-mq0jp15z.js";
3
+ import {
4
+ renderTable
5
+ } from "../shared/@outfitter/cli-an9j0h80.js";
6
+ import"../shared/@outfitter/cli-jjemfdta.js";
7
+ import"../shared/@outfitter/cli-85fg2vr5.js";
8
+ import"../shared/@outfitter/cli-9nbyj2bt.js";
9
+ import"../shared/@outfitter/cli-d9ad0rqj.js";
10
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
11
+ export {
12
+ renderTable
13
+ };
@@ -3,12 +3,15 @@ import {
3
3
  getEnvValue,
4
4
  getTerminalWidth,
5
5
  hasNoColorEnv,
6
+ init_detection,
6
7
  isInteractive,
7
8
  resolveColorEnv,
8
9
  resolveForceColorEnv,
9
10
  supportsColor
10
- } from "../shared/@outfitter/cli-jbj78ac5.js";
11
- import"../shared/@outfitter/cli-bt423m6y.js";
11
+ } from "../shared/@outfitter/cli-d9ad0rqj.js";
12
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
13
+ init_detection();
14
+
12
15
  export {
13
16
  supportsColor,
14
17
  resolveForceColorEnv,
@@ -3,12 +3,16 @@ import {
3
3
  getEnvValue,
4
4
  getTerminalWidth,
5
5
  hasNoColorEnv,
6
+ init_detection,
6
7
  isInteractive,
7
8
  resolveColorEnv,
8
9
  resolveForceColorEnv,
9
10
  supportsColor
10
- } from "../shared/@outfitter/cli-jbj78ac5.js";
11
- import"../shared/@outfitter/cli-bt423m6y.js";
11
+ } from "../shared/@outfitter/cli-d9ad0rqj.js";
12
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
13
+
14
+ // packages/cli/src/terminal/index.ts
15
+ init_detection();
12
16
  export {
13
17
  supportsColor,
14
18
  resolveForceColorEnv,
@@ -0,0 +1,9 @@
1
+ import { ThemedContextOptions, ThemedLayoutContext, createThemedContext, getContextTheme } from "../shared/@outfitter/cli-e73v3qqy";
2
+ import "../shared/@outfitter/cli-s0kkx9m1";
3
+ import "../shared/@outfitter/cli-sx67mmfx";
4
+ import "../shared/@outfitter/cli-hnpbqmc8";
5
+ import "../shared/@outfitter/cli-3b7ed3rm";
6
+ import "../shared/@outfitter/cli-e5ms1y0x";
7
+ import "../shared/@outfitter/cli-fakncnjp";
8
+ import "../shared/@outfitter/cli-2g8bx1aq";
9
+ export { getContextTheme, createThemedContext, ThemedLayoutContext, ThemedContextOptions };
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ import {
3
+ createThemedContext,
4
+ getContextTheme
5
+ } from "../shared/@outfitter/cli-p9j1phge.js";
6
+ import"../shared/@outfitter/cli-cs45xd6q.js";
7
+ import"../shared/@outfitter/cli-85fg2vr5.js";
8
+ import"../shared/@outfitter/cli-9nbyj2bt.js";
9
+ import"../shared/@outfitter/cli-d9ad0rqj.js";
10
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
11
+ export {
12
+ getContextTheme,
13
+ createThemedContext
14
+ };
@@ -0,0 +1,8 @@
1
+ import { CreateVisualThemeOptions, createVisualTheme } from "../shared/@outfitter/cli-6m988kh0";
2
+ import "../shared/@outfitter/cli-s0kkx9m1";
3
+ import "../shared/@outfitter/cli-sx67mmfx";
4
+ import "../shared/@outfitter/cli-hnpbqmc8";
5
+ import "../shared/@outfitter/cli-3b7ed3rm";
6
+ import "../shared/@outfitter/cli-e5ms1y0x";
7
+ import "../shared/@outfitter/cli-fakncnjp";
8
+ export { createVisualTheme, CreateVisualThemeOptions };
@@ -0,0 +1,12 @@
1
+ // @bun
2
+ import {
3
+ createVisualTheme
4
+ } from "../shared/@outfitter/cli-ep2cvtk8.js";
5
+ import"../shared/@outfitter/cli-cs45xd6q.js";
6
+ import"../shared/@outfitter/cli-85fg2vr5.js";
7
+ import"../shared/@outfitter/cli-9nbyj2bt.js";
8
+ import"../shared/@outfitter/cli-d9ad0rqj.js";
9
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
10
+ export {
11
+ createVisualTheme
12
+ };
@@ -0,0 +1,17 @@
1
+ import "../shared/@outfitter/cli-m8vv6kd6";
2
+ import "../shared/@outfitter/cli-5ppp2a7c";
3
+ import { minimalTheme } from "../shared/@outfitter/cli-mymyavvj";
4
+ import { CreateVisualThemeOptions, createVisualTheme } from "../shared/@outfitter/cli-6m988kh0";
5
+ import { ThemedContextOptions, ThemedLayoutContext, createThemedContext, getContextTheme } from "../shared/@outfitter/cli-e73v3qqy";
6
+ import { resolveGlyph, resolveStateMarker } from "../shared/@outfitter/cli-3t2zaenc";
7
+ import { defaultTheme } from "../shared/@outfitter/cli-3dxmmy4c";
8
+ import { boldTheme } from "../shared/@outfitter/cli-q8r6jarq";
9
+ import { roundedTheme } from "../shared/@outfitter/cli-swwxvjvm";
10
+ import { GlyphPair, MarkerSpec, PartialVisualTheme, SemanticState, ThemeColors, ThemeSpacing, VisualTheme } from "../shared/@outfitter/cli-s0kkx9m1";
11
+ import "../shared/@outfitter/cli-sx67mmfx";
12
+ import "../shared/@outfitter/cli-hnpbqmc8";
13
+ import "../shared/@outfitter/cli-3b7ed3rm";
14
+ import "../shared/@outfitter/cli-e5ms1y0x";
15
+ import "../shared/@outfitter/cli-fakncnjp";
16
+ import "../shared/@outfitter/cli-2g8bx1aq";
17
+ export { roundedTheme, resolveStateMarker, resolveGlyph, minimalTheme, getContextTheme, defaultTheme, createVisualTheme, createThemedContext, boldTheme, VisualTheme, ThemedLayoutContext, ThemedContextOptions, ThemeSpacing, ThemeColors, SemanticState, PartialVisualTheme, MarkerSpec, GlyphPair, CreateVisualThemeOptions };
@@ -0,0 +1,42 @@
1
+ // @bun
2
+ import"../shared/@outfitter/cli-6fxffp8k.js";
3
+ import"../shared/@outfitter/cli-vd60dj65.js";
4
+ import {
5
+ minimalTheme
6
+ } from "../shared/@outfitter/cli-tarpsa8a.js";
7
+ import {
8
+ createVisualTheme
9
+ } from "../shared/@outfitter/cli-ep2cvtk8.js";
10
+ import {
11
+ createThemedContext,
12
+ getContextTheme
13
+ } from "../shared/@outfitter/cli-p9j1phge.js";
14
+ import {
15
+ resolveGlyph,
16
+ resolveStateMarker
17
+ } from "../shared/@outfitter/cli-0ggcy7fa.js";
18
+ import {
19
+ boldTheme
20
+ } from "../shared/@outfitter/cli-8a8xrzhy.js";
21
+ import {
22
+ roundedTheme
23
+ } from "../shared/@outfitter/cli-w5y3xepp.js";
24
+ import {
25
+ defaultTheme
26
+ } from "../shared/@outfitter/cli-cs45xd6q.js";
27
+ import"../shared/@outfitter/cli-p1m5dhrs.js";
28
+ import"../shared/@outfitter/cli-85fg2vr5.js";
29
+ import"../shared/@outfitter/cli-9nbyj2bt.js";
30
+ import"../shared/@outfitter/cli-d9ad0rqj.js";
31
+ import"../shared/@outfitter/cli-v1tzwxkt.js";
32
+ export {
33
+ roundedTheme,
34
+ resolveStateMarker,
35
+ resolveGlyph,
36
+ minimalTheme,
37
+ getContextTheme,
38
+ defaultTheme,
39
+ createVisualTheme,
40
+ createThemedContext,
41
+ boldTheme
42
+ };