@outfitter/cli 0.3.0 → 0.4.1

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 (269) hide show
  1. package/README.md +48 -4
  2. package/dist/actions.js +0 -2
  3. package/dist/cli.d.ts +1 -1
  4. package/dist/cli.js +1 -2
  5. package/dist/{render → colors}/colors.d.ts +1 -1
  6. package/dist/{render → colors}/colors.js +2 -6
  7. package/dist/colors/index.d.ts +1 -1
  8. package/dist/colors/index.js +3 -4
  9. package/dist/command.d.ts +2 -2
  10. package/dist/command.js +11 -2
  11. package/dist/completion.d.ts +36 -0
  12. package/dist/completion.js +91 -0
  13. package/dist/flags.d.ts +167 -0
  14. package/dist/flags.js +31 -0
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +5 -4
  17. package/dist/input.d.ts +3 -26
  18. package/dist/input.js +1 -31
  19. package/dist/output.d.ts +2 -2
  20. package/dist/output.js +0 -1
  21. package/dist/pagination.d.ts +1 -1
  22. package/dist/pagination.js +0 -2
  23. package/dist/query.d.ts +50 -0
  24. package/dist/query.js +51 -0
  25. package/dist/shared/@outfitter/cli-b2zk8fb3.js +357 -0
  26. package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
  27. package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-k0yvzn6d.d.ts} +1 -1
  28. package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-md9347gn.d.ts} +155 -13
  29. package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
  30. package/dist/shared/@outfitter/{cli-4h4rpdra.js → cli-zahqsaby.js} +32 -10
  31. package/dist/terminal/detection.js +1 -5
  32. package/dist/terminal/index.js +1 -6
  33. package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
  34. package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
  35. package/dist/types.d.ts +2 -2
  36. package/dist/types.js +0 -2
  37. package/dist/verbs.d.ts +50 -0
  38. package/dist/verbs.js +61 -0
  39. package/package.json +50 -204
  40. package/dist/borders/index.d.ts +0 -3
  41. package/dist/borders/index.js +0 -13
  42. package/dist/box/index.d.ts +0 -4
  43. package/dist/box/index.js +0 -13
  44. package/dist/demo/index.d.ts +0 -78
  45. package/dist/demo/index.js +0 -148
  46. package/dist/demo/registry.d.ts +0 -7
  47. package/dist/demo/registry.js +0 -28
  48. package/dist/demo/renderers/borders.d.ts +0 -7
  49. package/dist/demo/renderers/borders.js +0 -17
  50. package/dist/demo/renderers/box.d.ts +0 -7
  51. package/dist/demo/renderers/box.js +0 -18
  52. package/dist/demo/renderers/colors.d.ts +0 -7
  53. package/dist/demo/renderers/colors.js +0 -18
  54. package/dist/demo/renderers/indicators.d.ts +0 -7
  55. package/dist/demo/renderers/indicators.js +0 -17
  56. package/dist/demo/renderers/list.d.ts +0 -7
  57. package/dist/demo/renderers/list.js +0 -19
  58. package/dist/demo/renderers/markdown.d.ts +0 -7
  59. package/dist/demo/renderers/markdown.js +0 -18
  60. package/dist/demo/renderers/progress.d.ts +0 -7
  61. package/dist/demo/renderers/progress.js +0 -17
  62. package/dist/demo/renderers/spinner.d.ts +0 -7
  63. package/dist/demo/renderers/spinner.js +0 -19
  64. package/dist/demo/renderers/table.d.ts +0 -7
  65. package/dist/demo/renderers/table.js +0 -19
  66. package/dist/demo/renderers/text.d.ts +0 -7
  67. package/dist/demo/renderers/text.js +0 -16
  68. package/dist/demo/renderers/tree.d.ts +0 -7
  69. package/dist/demo/renderers/tree.js +0 -18
  70. package/dist/demo/section.d.ts +0 -5
  71. package/dist/demo/section.js +0 -23
  72. package/dist/demo/templates.d.ts +0 -4
  73. package/dist/demo/templates.js +0 -10
  74. package/dist/demo/types.d.ts +0 -3
  75. package/dist/demo/types.js +0 -8
  76. package/dist/list/index.d.ts +0 -3
  77. package/dist/list/index.js +0 -9
  78. package/dist/preset/full.d.ts +0 -14
  79. package/dist/preset/full.js +0 -41
  80. package/dist/preset/standard.d.ts +0 -11
  81. package/dist/preset/standard.js +0 -30
  82. package/dist/prompt/confirm.d.ts +0 -4
  83. package/dist/prompt/confirm.js +0 -9
  84. package/dist/prompt/group.d.ts +0 -4
  85. package/dist/prompt/group.js +0 -9
  86. package/dist/prompt/index.d.ts +0 -7
  87. package/dist/prompt/index.js +0 -32
  88. package/dist/prompt/select.d.ts +0 -4
  89. package/dist/prompt/select.js +0 -11
  90. package/dist/prompt/text.d.ts +0 -4
  91. package/dist/prompt/text.js +0 -11
  92. package/dist/prompt/types.d.ts +0 -3
  93. package/dist/prompt/types.js +0 -8
  94. package/dist/prompt/validators.d.ts +0 -2
  95. package/dist/prompt/validators.js +0 -8
  96. package/dist/render/borders.d.ts +0 -2
  97. package/dist/render/borders.js +0 -15
  98. package/dist/render/box.d.ts +0 -3
  99. package/dist/render/box.js +0 -23
  100. package/dist/render/date.d.ts +0 -2
  101. package/dist/render/date.js +0 -12
  102. package/dist/render/format-relative.d.ts +0 -2
  103. package/dist/render/format-relative.js +0 -8
  104. package/dist/render/format.d.ts +0 -2
  105. package/dist/render/format.js +0 -10
  106. package/dist/render/heading.d.ts +0 -3
  107. package/dist/render/heading.js +0 -14
  108. package/dist/render/index.d.ts +0 -32
  109. package/dist/render/index.js +0 -235
  110. package/dist/render/indicators.d.ts +0 -2
  111. package/dist/render/indicators.js +0 -16
  112. package/dist/render/json.d.ts +0 -2
  113. package/dist/render/json.js +0 -10
  114. package/dist/render/layout.d.ts +0 -5
  115. package/dist/render/layout.js +0 -25
  116. package/dist/render/list.d.ts +0 -2
  117. package/dist/render/list.js +0 -8
  118. package/dist/render/markdown.d.ts +0 -2
  119. package/dist/render/markdown.js +0 -10
  120. package/dist/render/progress.d.ts +0 -2
  121. package/dist/render/progress.js +0 -8
  122. package/dist/render/separator.d.ts +0 -3
  123. package/dist/render/separator.js +0 -14
  124. package/dist/render/shapes.d.ts +0 -2
  125. package/dist/render/shapes.js +0 -35
  126. package/dist/render/spinner.d.ts +0 -2
  127. package/dist/render/spinner.js +0 -12
  128. package/dist/render/stack.d.ts +0 -3
  129. package/dist/render/stack.js +0 -38
  130. package/dist/render/table.d.ts +0 -3
  131. package/dist/render/table.js +0 -12
  132. package/dist/render/text.d.ts +0 -2
  133. package/dist/render/text.js +0 -27
  134. package/dist/render/tree.d.ts +0 -2
  135. package/dist/render/tree.js +0 -10
  136. package/dist/render/types.d.ts +0 -2
  137. package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
  138. package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
  139. package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
  140. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
  141. package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
  142. package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
  143. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
  144. package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
  145. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
  146. package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
  147. package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
  148. package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
  149. package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
  150. package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
  151. package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
  152. package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
  153. package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
  154. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
  155. package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
  156. package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
  157. package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
  158. package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
  159. package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
  160. package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
  161. package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
  162. package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
  163. package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
  164. package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
  165. package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
  166. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
  167. package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
  168. package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
  169. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
  170. package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
  171. package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
  172. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
  173. package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
  174. package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
  175. package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
  176. package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
  177. package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
  178. package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
  179. package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
  180. package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
  181. package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
  182. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
  183. package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
  184. package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
  185. package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
  186. package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
  187. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
  188. package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
  189. package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
  190. package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
  191. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
  192. package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
  193. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
  194. package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
  195. package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
  196. package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
  197. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
  198. package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
  199. package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
  200. package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
  201. package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
  202. package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
  203. package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
  204. package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
  205. package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
  206. package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
  207. package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
  208. package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
  209. package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
  210. package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
  211. package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
  212. package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
  213. package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
  214. package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
  215. package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
  216. package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
  217. package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
  218. package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
  219. package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
  220. package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
  221. package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
  222. package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
  223. package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
  224. package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
  225. package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
  226. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
  227. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
  228. package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
  229. package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
  230. package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
  231. package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
  232. package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
  233. package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
  234. package/dist/shared/@outfitter/cli-znc47004.js +0 -134
  235. package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
  236. package/dist/streaming/ansi.d.ts +0 -2
  237. package/dist/streaming/ansi.js +0 -8
  238. package/dist/streaming/index.d.ts +0 -4
  239. package/dist/streaming/index.js +0 -17
  240. package/dist/streaming/spinner.d.ts +0 -3
  241. package/dist/streaming/spinner.js +0 -10
  242. package/dist/streaming/writer.d.ts +0 -2
  243. package/dist/streaming/writer.js +0 -9
  244. package/dist/table/index.d.ts +0 -4
  245. package/dist/table/index.js +0 -13
  246. package/dist/theme/context.d.ts +0 -9
  247. package/dist/theme/context.js +0 -14
  248. package/dist/theme/create.d.ts +0 -8
  249. package/dist/theme/create.js +0 -12
  250. package/dist/theme/index.d.ts +0 -17
  251. package/dist/theme/index.js +0 -42
  252. package/dist/theme/presets/bold.d.ts +0 -8
  253. package/dist/theme/presets/bold.js +0 -12
  254. package/dist/theme/presets/default.d.ts +0 -8
  255. package/dist/theme/presets/default.js +0 -11
  256. package/dist/theme/presets/index.d.ts +0 -12
  257. package/dist/theme/presets/index.js +0 -24
  258. package/dist/theme/presets/minimal.d.ts +0 -8
  259. package/dist/theme/presets/minimal.js +0 -12
  260. package/dist/theme/presets/rounded.d.ts +0 -8
  261. package/dist/theme/presets/rounded.js +0 -12
  262. package/dist/theme/resolve.d.ts +0 -8
  263. package/dist/theme/resolve.js +0 -11
  264. package/dist/theme/types.d.ts +0 -7
  265. package/dist/theme/types.js +0 -1
  266. package/dist/tree/index.d.ts +0 -3
  267. package/dist/tree/index.js +0 -11
  268. /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
  269. /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
@@ -1,48 +0,0 @@
1
- // @bun
2
- import {
3
- defaultTheme
4
- } from "./cli-z78mkrc7.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 };
@@ -1,67 +0,0 @@
1
- // @bun
2
- import {
3
- SPINNERS,
4
- getSpinnerFrame,
5
- renderSpinner
6
- } from "./cli-n9dbh0hp.js";
7
- import {
8
- SPINNER_STYLE_META,
9
- getSpinnerStyles
10
- } from "./cli-d8ahdd9d.js";
11
- import {
12
- getExample
13
- } from "./cli-xep6v2c0.js";
14
- import {
15
- demoSection
16
- } from "./cli-sam2sq50.js";
17
-
18
- // packages/cli/src/demo/renderers/spinner.ts
19
- function renderSpinnerDemo(config, theme) {
20
- const showCode = config.showCode ?? true;
21
- const showDescriptions = config.showDescriptions ?? true;
22
- const lines = [];
23
- lines.push(demoSection("Spinner Styles"));
24
- lines.push("");
25
- if (showCode) {
26
- lines.push('import { renderSpinner, SPINNERS } from "@outfitter/cli/render";');
27
- lines.push("");
28
- }
29
- const message = getExample("spinnerMessage", config.examples);
30
- const styles = getSpinnerStyles();
31
- for (const style of styles) {
32
- const meta = SPINNER_STYLE_META[style];
33
- const spinner = SPINNERS[style];
34
- lines.push(`${meta.label.toUpperCase()} (${style})`);
35
- if (showDescriptions) {
36
- lines.push(theme.muted(meta.description));
37
- }
38
- const frameDisplay = spinner.frames.join(" ");
39
- lines.push(` Frames: ${frameDisplay}`);
40
- lines.push(` Interval: ${spinner.interval}ms`);
41
- const output = renderSpinner(style, message);
42
- lines.push(` Example: ${output}`);
43
- lines.push("");
44
- }
45
- lines.push(demoSection("Usage"));
46
- lines.push("");
47
- if (showCode) {
48
- lines.push("// Static render (for logs/non-TTY)");
49
- lines.push(`renderSpinner("dots", "${message}");`);
50
- lines.push("");
51
- lines.push("// Get frame at specific time");
52
- lines.push('getSpinnerFrame("dots", 0); // First frame');
53
- lines.push('getSpinnerFrame("dots", 160); // Third frame');
54
- lines.push("");
55
- }
56
- lines.push("Frame progression (dots style):");
57
- const dotSpinner = SPINNERS.dots;
58
- for (let i = 0;i < Math.min(5, dotSpinner.frames.length); i++) {
59
- const elapsed = i * dotSpinner.interval;
60
- const frame = getSpinnerFrame("dots", elapsed);
61
- lines.push(` ${elapsed}ms \u2192 ${frame}`);
62
- }
63
- return lines.join(`
64
- `);
65
- }
66
-
67
- export { renderSpinnerDemo };
@@ -1,126 +0,0 @@
1
- // @bun
2
- import {
3
- renderList
4
- } from "./cli-xg5y5fhk.js";
5
- import {
6
- LIST_STYLE_META,
7
- getListStyles
8
- } from "./cli-d8ahdd9d.js";
9
- import {
10
- getExample
11
- } from "./cli-xep6v2c0.js";
12
- import {
13
- demoSection
14
- } from "./cli-sam2sq50.js";
15
-
16
- // packages/cli/src/demo/renderers/list.ts
17
- function renderListDemo(config, theme) {
18
- const showCode = config.showCode ?? true;
19
- const showDescriptions = config.showDescriptions ?? true;
20
- const lines = [];
21
- lines.push(demoSection("List Styles"));
22
- lines.push("");
23
- if (showCode) {
24
- lines.push('import { renderList } from "@outfitter/cli/render";');
25
- lines.push("");
26
- }
27
- const items = getExample("listItems", config.examples);
28
- const styles = getListStyles();
29
- for (const style of styles) {
30
- const meta = LIST_STYLE_META[style];
31
- lines.push(`${meta.label.toUpperCase()} STYLE`);
32
- if (showDescriptions) {
33
- lines.push(theme.muted(meta.description));
34
- }
35
- lines.push("");
36
- if (showCode) {
37
- lines.push(`renderList(items, { style: "${style}" })`);
38
- lines.push("");
39
- }
40
- if (style === "checkbox") {
41
- const output = renderList(items, {
42
- style,
43
- checked: new Set([1])
44
- });
45
- lines.push(output);
46
- } else {
47
- const output = renderList(items, { style });
48
- lines.push(output);
49
- }
50
- lines.push("");
51
- }
52
- lines.push(demoSection("Nested Lists"));
53
- lines.push("");
54
- const nestedItems = [
55
- "Top level item",
56
- {
57
- text: "Parent with children",
58
- children: ["Child one", "Child two"]
59
- },
60
- "Another top level"
61
- ];
62
- if (showCode) {
63
- lines.push("renderList([");
64
- lines.push(' "Top level item",');
65
- lines.push(' { text: "Parent with children", children: ["Child one", "Child two"] },');
66
- lines.push(' "Another top level",');
67
- lines.push("])");
68
- lines.push("");
69
- }
70
- lines.push(renderList(nestedItems));
71
- lines.push("");
72
- lines.push(demoSection("Numbered with Nesting"));
73
- lines.push("");
74
- const numberedNested = [
75
- {
76
- text: "First section",
77
- children: [
78
- {
79
- text: "Subsection A",
80
- children: ["Detail i", "Detail ii"]
81
- },
82
- "Subsection B"
83
- ]
84
- },
85
- "Second section"
86
- ];
87
- if (showCode) {
88
- lines.push('renderList(items, { style: "number" })');
89
- lines.push("");
90
- }
91
- lines.push(renderList(numberedNested, { style: "number" }));
92
- lines.push("");
93
- lines.push(demoSection("Mixed Styles"));
94
- lines.push("");
95
- if (showDescriptions) {
96
- lines.push(theme.muted("Use childStyle to override style for children"));
97
- lines.push("");
98
- }
99
- const mixedItems = [
100
- {
101
- text: "Requirements",
102
- childStyle: "bullet",
103
- children: ["Must be fast", "Must be reliable"]
104
- },
105
- {
106
- text: "Tasks",
107
- childStyle: "checkbox",
108
- children: [
109
- { text: "Write tests", checked: true },
110
- { text: "Deploy to prod", checked: false }
111
- ]
112
- }
113
- ];
114
- if (showCode) {
115
- lines.push("renderList([");
116
- lines.push(' { text: "Requirements", childStyle: "bullet", children: [...] },');
117
- lines.push(' { text: "Tasks", childStyle: "checkbox", children: [...] },');
118
- lines.push('], { style: "number" })');
119
- lines.push("");
120
- }
121
- lines.push(renderList(mixedItems, { style: "number" }));
122
- return lines.join(`
123
- `);
124
- }
125
-
126
- export { renderListDemo };
@@ -1,328 +0,0 @@
1
- import { TreeGuideStyle } from "./cli-3b7ed3rm";
2
- /**
3
- * Delimiter set with unicode and fallback representations.
4
- */
5
- interface DelimiterSet {
6
- /** Unicode character for modern terminals */
7
- unicode: string;
8
- /** ASCII fallback for limited terminals */
9
- fallback: string;
10
- }
11
- /**
12
- * Available delimiter names.
13
- */
14
- type DelimiterName = keyof typeof DELIMITERS;
15
- /**
16
- * Registry of delimiter characters with unicode and fallback support.
17
- *
18
- * @example
19
- * ```typescript
20
- * import { DELIMITERS, getDelimiter } from "@outfitter/cli/render/stack";
21
- *
22
- * // Access directly
23
- * console.log(DELIMITERS.bullet.unicode); // "•"
24
- *
25
- * // Or use helper
26
- * console.log(getDelimiter("bullet")); // "•" or "*"
27
- * ```
28
- */
29
- declare const DELIMITERS: {
30
- readonly space: {
31
- readonly unicode: " ";
32
- readonly fallback: " ";
33
- };
34
- readonly bullet: {
35
- readonly unicode: "•";
36
- readonly fallback: "*";
37
- };
38
- readonly dot: {
39
- readonly unicode: "·";
40
- readonly fallback: ".";
41
- };
42
- readonly pipe: {
43
- readonly unicode: "│";
44
- readonly fallback: "|";
45
- };
46
- readonly arrow: {
47
- readonly unicode: "→";
48
- readonly fallback: "->";
49
- };
50
- readonly slash: {
51
- readonly unicode: "/";
52
- readonly fallback: "/";
53
- };
54
- readonly colon: {
55
- readonly unicode: ":";
56
- readonly fallback: ":";
57
- };
58
- };
59
- /**
60
- * Gets a delimiter character with automatic unicode/fallback selection.
61
- *
62
- * @param name - The delimiter name
63
- * @param forceUnicode - Override unicode detection
64
- * @returns The appropriate delimiter character
65
- *
66
- * @example
67
- * ```typescript
68
- * getDelimiter("bullet"); // "•" (in unicode terminal)
69
- * getDelimiter("bullet", false); // "*" (force fallback)
70
- * ```
71
- */
72
- declare function getDelimiter(name: DelimiterName, forceUnicode?: boolean): string;
73
- /**
74
- * Known marker names from INDICATORS.marker.
75
- */
76
- type MarkerName = "circleDot" | "circleOutline" | "circle" | "checkbox" | "checkboxChecked" | "pointer" | "dash";
77
- /**
78
- * Gets a marker character, either from INDICATORS or as a custom string.
79
- *
80
- * @param nameOrChar - Marker name from INDICATORS.marker or custom string
81
- * @param forceUnicode - Override unicode detection
82
- * @returns The marker character
83
- *
84
- * @example
85
- * ```typescript
86
- * getMarker("circleDot"); // "◉"
87
- * getMarker("circleDot", false); // "(*)"
88
- * getMarker("★"); // "★" (custom, returned as-is)
89
- * ```
90
- */
91
- declare function getMarker(nameOrChar: MarkerName | string, forceUnicode?: boolean): string;
92
- /**
93
- * Vertical stack display modes.
94
- *
95
- * - `plain`: Simple newlines, no guides
96
- * - `guide`: Vertical guide continuation (│)
97
- * - `tree`: Tree-style with fork/end markers (├/└)
98
- * - `boxed`: Each item wrapped in a box
99
- * - `compact`: Single line per item using compact representation
100
- */
101
- type VStackMode = "plain" | "guide" | "tree" | "boxed" | "compact";
102
- /**
103
- * Semantic states for stack items.
104
- * Theme maps these to visual markers.
105
- */
106
- type ItemState = "default" | "current" | "focused" | "checked" | "disabled";
107
- /**
108
- * Theme configuration for stack rendering.
109
- * Maps semantic states to visual representation.
110
- */
111
- interface StackTheme {
112
- /** Map semantic states to marker names */
113
- markers: Record<ItemState, MarkerName>;
114
- /** Default delimiter for compact mode */
115
- delimiter?: DelimiterName;
116
- /** Default guide style */
117
- guide?: TreeGuideStyle;
118
- }
119
- /**
120
- * Default theme for stack rendering.
121
- */
122
- declare const DEFAULT_STACK_THEME: StackTheme;
123
- /**
124
- * An item in a stack with optional metadata.
125
- */
126
- interface StackItem {
127
- /** Full content (header + body lines) */
128
- content: string | string[];
129
- /** Compact single-line representation */
130
- compact?: string;
131
- /** Semantic state (resolved via theme) */
132
- state?: ItemState;
133
- /** Explicit marker (bypasses theme) */
134
- marker?: MarkerName | string;
135
- /** Style function to apply to content */
136
- style?: (s: string) => string;
137
- }
138
- /**
139
- * A rendered block with metadata for composition.
140
- * Both Box and StackBox satisfy this interface.
141
- */
142
- interface Renderable {
143
- /** Rendered string representation */
144
- readonly output: string;
145
- /** Width in characters */
146
- readonly width: number;
147
- /** Height in lines */
148
- readonly height: number;
149
- }
150
- /**
151
- * A rendered stack with metadata for composition.
152
- * Alias for Renderable (for semantic clarity when returning from stack functions).
153
- */
154
- type StackBox = Renderable;
155
- /**
156
- * Type guard to check if a value is a Renderable (Box or StackBox).
157
- */
158
- declare function isRenderable(value: unknown): value is Renderable;
159
- /**
160
- * Options for horizontal stack.
161
- */
162
- interface HStackOptions {
163
- /** Delimiter between items (name or custom string) */
164
- delimiter?: DelimiterName | string;
165
- /** Gap (spaces) around delimiter */
166
- gap?: number;
167
- /** Vertical alignment for multi-line items */
168
- align?: "top" | "center" | "bottom";
169
- }
170
- /**
171
- * Options for vertical stack.
172
- */
173
- interface VStackOptions {
174
- /** Display mode */
175
- mode?: VStackMode;
176
- /** Gap (lines) between items */
177
- gap?: number;
178
- /** Theme for marker resolution */
179
- theme?: Partial<StackTheme>;
180
- /** Shorthand for theme.guide */
181
- guide?: TreeGuideStyle;
182
- }
183
- /**
184
- * Input type for stack functions.
185
- * Accepts strings, StackItems, or Renderables (Box/StackBox).
186
- */
187
- type StackInput = string | StackItem | Renderable;
188
- /**
189
- * Joins items horizontally with a delimiter.
190
- *
191
- * @param items - Items to join (strings or StackItems)
192
- * @param options - Configuration options
193
- * @returns Joined string
194
- *
195
- * @example
196
- * ```typescript
197
- * // Simple delimiter
198
- * hstack(["a", "b", "c"], { delimiter: "bullet", gap: 1 });
199
- * // → "a • b • c"
200
- *
201
- * // Multi-line with alignment
202
- * hstack(["Line1\nLine2", "Single"], { delimiter: "pipe", align: "center" });
203
- * ```
204
- */
205
- declare function hstack(items: StackInput[], options?: HStackOptions): string;
206
- /**
207
- * Creates a horizontal stack with metadata for composition.
208
- *
209
- * @param items - Items to join
210
- * @param options - Configuration options
211
- * @returns StackBox with output, width, and height
212
- */
213
- declare function createHStack(items: StackInput[], options?: HStackOptions): StackBox;
214
- /**
215
- * Creates a stack item with header and optional body.
216
- *
217
- * @param header - Header line
218
- * @param body - Optional body lines
219
- * @param options - Item options (state, marker, compact, style)
220
- * @returns StackItem
221
- *
222
- * @example
223
- * ```typescript
224
- * vstackItem("feature/auth", ["PR #190 (Draft)", "2 hours ago"], {
225
- * state: "current",
226
- * compact: "feature/auth • Draft • 2h ago"
227
- * });
228
- * ```
229
- */
230
- declare function vstackItem(header: string, body?: string[], options?: {
231
- state?: ItemState;
232
- marker?: MarkerName | string;
233
- compact?: string;
234
- style?: (s: string) => string;
235
- }): StackItem;
236
- /**
237
- * Stacks items vertically with configurable display mode.
238
- *
239
- * @param items - Items to stack (strings or StackItems)
240
- * @param options - Configuration options
241
- * @returns Formatted string
242
- *
243
- * @example
244
- * ```typescript
245
- * // Guide mode (gt log style)
246
- * vstack([
247
- * vstackItem("feature/auth", ["PR #190"], { state: "current" }),
248
- * vstackItem("feature/api", ["PR #189"]),
249
- * ], { mode: "guide" });
250
- * // → ◉ feature/auth
251
- * // │ PR #190
252
- * // │
253
- * // ○ feature/api
254
- * // │ PR #189
255
- *
256
- * // Compact mode
257
- * vstack(items, { mode: "compact" });
258
- * // → ◉ feature/auth • Draft • 2h ago
259
- * // ○ feature/api • 1d ago
260
- * ```
261
- */
262
- declare function vstack(items: StackInput[], options?: VStackOptions): string;
263
- /**
264
- * Creates a vertical stack with metadata for composition.
265
- *
266
- * @param items - Items to stack
267
- * @param options - Configuration options
268
- * @returns StackBox with output, width, and height
269
- */
270
- declare function createVStack(items: StackInput[], options?: VStackOptions): StackBox;
271
- /**
272
- * Options for boxify helper.
273
- */
274
- interface BoxifyOptions {
275
- /** Box title */
276
- title?: string;
277
- /** Border style */
278
- border?: "single" | "double" | "rounded" | "heavy" | "none";
279
- /** Padding inside the box */
280
- padding?: number;
281
- }
282
- /**
283
- * Wraps content in a box for visual grouping.
284
- *
285
- * Convenience wrapper around createBox that accepts any Renderable,
286
- * string, or string array.
287
- *
288
- * @param content - Content to wrap (Renderable, string, or string[])
289
- * @param options - Box options (title, border, padding)
290
- * @returns Renderable box that can be used in stacks or nested
291
- *
292
- * @example
293
- * ```typescript
294
- * // Boxify a stack
295
- * const stack = createVStack([...], { mode: "guide" });
296
- * const boxed = boxify(stack, { title: "Branches", border: "rounded" });
297
- *
298
- * // Boxify plain text
299
- * const box = boxify("Hello World", { border: "double" });
300
- *
301
- * // Use in composition
302
- * hstack([boxify(stack1), boxify(stack2)], { gap: 2 });
303
- * ```
304
- */
305
- declare function boxify(content: Renderable | string | string[], options?: BoxifyOptions): Renderable;
306
- /**
307
- * Extracts the raw output string from a Renderable.
308
- *
309
- * Useful when you need the string representation without the metadata,
310
- * or when passing to functions that only accept strings.
311
- *
312
- * @param content - Renderable or string
313
- * @returns The output string
314
- *
315
- * @example
316
- * ```typescript
317
- * const stack = createVStack([...], { mode: "guide" });
318
- * const raw = unbox(stack); // Just the string, no metadata
319
- *
320
- * // Useful for logging or string manipulation
321
- * console.log(unbox(boxedContent));
322
- *
323
- * // Pass-through for strings
324
- * unbox("already a string"); // Returns "already a string"
325
- * ```
326
- */
327
- declare function unbox(content: Renderable | string): string;
328
- export { DelimiterSet, DelimiterName, DELIMITERS, getDelimiter, MarkerName, getMarker, VStackMode, ItemState, StackTheme, DEFAULT_STACK_THEME, StackItem, Renderable, StackBox, isRenderable, HStackOptions, VStackOptions, StackInput, hstack, createHStack, vstackItem, vstack, createVStack, BoxifyOptions, boxify, unbox };
@@ -1,30 +0,0 @@
1
- // @bun
2
- // packages/cli/src/render/format.ts
3
- function formatDuration(ms) {
4
- if (ms < 1000)
5
- return `${ms}ms`;
6
- const seconds = Math.floor(ms / 1000) % 60;
7
- const minutes = Math.floor(ms / 60000) % 60;
8
- const hours = Math.floor(ms / 3600000);
9
- const parts = [];
10
- if (hours > 0)
11
- parts.push(`${hours}h`);
12
- if (minutes > 0)
13
- parts.push(`${minutes}m`);
14
- if (seconds > 0 || parts.length === 0)
15
- parts.push(`${seconds}s`);
16
- return parts.join(" ");
17
- }
18
- function formatBytes(bytes) {
19
- const units = ["B", "KB", "MB", "GB", "TB"];
20
- let unitIndex = 0;
21
- let size = bytes;
22
- while (size >= 1024 && unitIndex < units.length - 1) {
23
- size /= 1024;
24
- unitIndex++;
25
- }
26
- const formatted = unitIndex === 0 ? size.toString() : size.toFixed(1).replace(/\.0$/, "");
27
- return `${formatted} ${units[unitIndex]}`;
28
- }
29
-
30
- export { formatDuration, formatBytes };
@@ -1,85 +0,0 @@
1
- // @bun
2
- import {
3
- ANSI
4
- } from "./cli-p3dqm1vd.js";
5
-
6
- // packages/cli/src/streaming/writer.ts
7
- function createStreamWriter(options = {}) {
8
- const stream = options.stream ?? process.stdout;
9
- const isTTY = stream.isTTY ?? false;
10
- let currentLineCount = 0;
11
- let hasContent = false;
12
- const write = (content) => {
13
- if (!isTTY) {
14
- stream.write(content);
15
- hasContent = true;
16
- return;
17
- }
18
- if (hasContent) {
19
- clear();
20
- }
21
- stream.write(content);
22
- currentLineCount = content.split(`
23
- `).length;
24
- hasContent = true;
25
- };
26
- const update = (content) => {
27
- if (!isTTY) {
28
- stream.write(`
29
- ${content}`);
30
- hasContent = true;
31
- return;
32
- }
33
- if (currentLineCount > 0) {
34
- stream.write(ANSI.carriageReturn);
35
- if (currentLineCount > 1) {
36
- stream.write(ANSI.cursorUp(currentLineCount - 1));
37
- }
38
- for (let i = 0;i < currentLineCount; i++) {
39
- stream.write(ANSI.clearLine);
40
- if (i < currentLineCount - 1) {
41
- stream.write(ANSI.cursorDown(1));
42
- }
43
- }
44
- if (currentLineCount > 1) {
45
- stream.write(ANSI.cursorUp(currentLineCount - 1));
46
- }
47
- stream.write(ANSI.carriageReturn);
48
- }
49
- stream.write(content);
50
- currentLineCount = content.split(`
51
- `).length;
52
- hasContent = true;
53
- };
54
- const persist = () => {
55
- if (!hasContent)
56
- return;
57
- stream.write(`
58
- `);
59
- currentLineCount = 0;
60
- hasContent = false;
61
- };
62
- const clear = () => {
63
- if (!(isTTY && hasContent)) {
64
- hasContent = false;
65
- currentLineCount = 0;
66
- return;
67
- }
68
- stream.write(ANSI.carriageReturn);
69
- if (currentLineCount > 1) {
70
- stream.write(ANSI.cursorUp(currentLineCount - 1));
71
- }
72
- stream.write(ANSI.clearLine);
73
- for (let i = 1;i < currentLineCount; i++) {
74
- stream.write(ANSI.cursorDown(1) + ANSI.clearLine);
75
- }
76
- if (currentLineCount > 1) {
77
- stream.write(ANSI.cursorUp(currentLineCount - 1));
78
- }
79
- currentLineCount = 0;
80
- hasContent = false;
81
- };
82
- return { write, update, persist, clear };
83
- }
84
-
85
- export { createStreamWriter };