@outfitter/cli 0.3.0 → 0.4.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 (260) hide show
  1. package/README.md +23 -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 +1 -1
  10. package/dist/command.js +1 -2
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +3 -4
  13. package/dist/input.d.ts +3 -26
  14. package/dist/input.js +1 -31
  15. package/dist/output.d.ts +2 -2
  16. package/dist/output.js +0 -1
  17. package/dist/pagination.d.ts +1 -1
  18. package/dist/pagination.js +0 -2
  19. package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-02kyvj7h.d.ts} +2 -13
  20. package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-f79bwzsp.d.ts} +1 -1
  21. package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
  22. package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
  23. package/dist/shared/@outfitter/{cli-4h4rpdra.js → cli-zahqsaby.js} +32 -10
  24. package/dist/terminal/detection.js +1 -5
  25. package/dist/terminal/index.js +1 -6
  26. package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
  27. package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
  28. package/dist/types.d.ts +2 -2
  29. package/dist/types.js +0 -2
  30. package/package.json +35 -213
  31. package/dist/borders/index.d.ts +0 -3
  32. package/dist/borders/index.js +0 -13
  33. package/dist/box/index.d.ts +0 -4
  34. package/dist/box/index.js +0 -13
  35. package/dist/demo/index.d.ts +0 -78
  36. package/dist/demo/index.js +0 -148
  37. package/dist/demo/registry.d.ts +0 -7
  38. package/dist/demo/registry.js +0 -28
  39. package/dist/demo/renderers/borders.d.ts +0 -7
  40. package/dist/demo/renderers/borders.js +0 -17
  41. package/dist/demo/renderers/box.d.ts +0 -7
  42. package/dist/demo/renderers/box.js +0 -18
  43. package/dist/demo/renderers/colors.d.ts +0 -7
  44. package/dist/demo/renderers/colors.js +0 -18
  45. package/dist/demo/renderers/indicators.d.ts +0 -7
  46. package/dist/demo/renderers/indicators.js +0 -17
  47. package/dist/demo/renderers/list.d.ts +0 -7
  48. package/dist/demo/renderers/list.js +0 -19
  49. package/dist/demo/renderers/markdown.d.ts +0 -7
  50. package/dist/demo/renderers/markdown.js +0 -18
  51. package/dist/demo/renderers/progress.d.ts +0 -7
  52. package/dist/demo/renderers/progress.js +0 -17
  53. package/dist/demo/renderers/spinner.d.ts +0 -7
  54. package/dist/demo/renderers/spinner.js +0 -19
  55. package/dist/demo/renderers/table.d.ts +0 -7
  56. package/dist/demo/renderers/table.js +0 -19
  57. package/dist/demo/renderers/text.d.ts +0 -7
  58. package/dist/demo/renderers/text.js +0 -16
  59. package/dist/demo/renderers/tree.d.ts +0 -7
  60. package/dist/demo/renderers/tree.js +0 -18
  61. package/dist/demo/section.d.ts +0 -5
  62. package/dist/demo/section.js +0 -23
  63. package/dist/demo/templates.d.ts +0 -4
  64. package/dist/demo/templates.js +0 -10
  65. package/dist/demo/types.d.ts +0 -3
  66. package/dist/demo/types.js +0 -8
  67. package/dist/list/index.d.ts +0 -3
  68. package/dist/list/index.js +0 -9
  69. package/dist/preset/full.d.ts +0 -14
  70. package/dist/preset/full.js +0 -41
  71. package/dist/preset/standard.d.ts +0 -11
  72. package/dist/preset/standard.js +0 -30
  73. package/dist/prompt/confirm.d.ts +0 -4
  74. package/dist/prompt/confirm.js +0 -9
  75. package/dist/prompt/group.d.ts +0 -4
  76. package/dist/prompt/group.js +0 -9
  77. package/dist/prompt/index.d.ts +0 -7
  78. package/dist/prompt/index.js +0 -32
  79. package/dist/prompt/select.d.ts +0 -4
  80. package/dist/prompt/select.js +0 -11
  81. package/dist/prompt/text.d.ts +0 -4
  82. package/dist/prompt/text.js +0 -11
  83. package/dist/prompt/types.d.ts +0 -3
  84. package/dist/prompt/types.js +0 -8
  85. package/dist/prompt/validators.d.ts +0 -2
  86. package/dist/prompt/validators.js +0 -8
  87. package/dist/render/borders.d.ts +0 -2
  88. package/dist/render/borders.js +0 -15
  89. package/dist/render/box.d.ts +0 -3
  90. package/dist/render/box.js +0 -23
  91. package/dist/render/date.d.ts +0 -2
  92. package/dist/render/date.js +0 -12
  93. package/dist/render/format-relative.d.ts +0 -2
  94. package/dist/render/format-relative.js +0 -8
  95. package/dist/render/format.d.ts +0 -2
  96. package/dist/render/format.js +0 -10
  97. package/dist/render/heading.d.ts +0 -3
  98. package/dist/render/heading.js +0 -14
  99. package/dist/render/index.d.ts +0 -32
  100. package/dist/render/index.js +0 -235
  101. package/dist/render/indicators.d.ts +0 -2
  102. package/dist/render/indicators.js +0 -16
  103. package/dist/render/json.d.ts +0 -2
  104. package/dist/render/json.js +0 -10
  105. package/dist/render/layout.d.ts +0 -5
  106. package/dist/render/layout.js +0 -25
  107. package/dist/render/list.d.ts +0 -2
  108. package/dist/render/list.js +0 -8
  109. package/dist/render/markdown.d.ts +0 -2
  110. package/dist/render/markdown.js +0 -10
  111. package/dist/render/progress.d.ts +0 -2
  112. package/dist/render/progress.js +0 -8
  113. package/dist/render/separator.d.ts +0 -3
  114. package/dist/render/separator.js +0 -14
  115. package/dist/render/shapes.d.ts +0 -2
  116. package/dist/render/shapes.js +0 -35
  117. package/dist/render/spinner.d.ts +0 -2
  118. package/dist/render/spinner.js +0 -12
  119. package/dist/render/stack.d.ts +0 -3
  120. package/dist/render/stack.js +0 -38
  121. package/dist/render/table.d.ts +0 -3
  122. package/dist/render/table.js +0 -12
  123. package/dist/render/text.d.ts +0 -2
  124. package/dist/render/text.js +0 -27
  125. package/dist/render/tree.d.ts +0 -2
  126. package/dist/render/tree.js +0 -10
  127. package/dist/render/types.d.ts +0 -2
  128. package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
  129. package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
  130. package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
  131. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
  132. package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
  133. package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
  134. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
  135. package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
  136. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
  137. package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
  138. package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
  139. package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
  140. package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
  141. package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
  142. package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
  143. package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
  144. package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
  145. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
  146. package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
  147. package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
  148. package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
  149. package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
  150. package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
  151. package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
  152. package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
  153. package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
  154. package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
  155. package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
  156. package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
  157. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
  158. package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
  159. package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
  160. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
  161. package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
  162. package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
  163. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
  164. package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
  165. package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
  166. package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
  167. package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
  168. package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
  169. package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
  170. package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
  171. package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
  172. package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
  173. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
  174. package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
  175. package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
  176. package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
  177. package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
  178. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
  179. package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
  180. package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
  181. package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
  182. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
  183. package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
  184. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
  185. package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
  186. package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
  187. package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
  188. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
  189. package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
  190. package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
  191. package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
  192. package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
  193. package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
  194. package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
  195. package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
  196. package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
  197. package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
  198. package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
  199. package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
  200. package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
  201. package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
  202. package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
  203. package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
  204. package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
  205. package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
  206. package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
  207. package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
  208. package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
  209. package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
  210. package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
  211. package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
  212. package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
  213. package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
  214. package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
  215. package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
  216. package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
  217. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
  218. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
  219. package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
  220. package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
  221. package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
  222. package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
  223. package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
  224. package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
  225. package/dist/shared/@outfitter/cli-znc47004.js +0 -134
  226. package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
  227. package/dist/streaming/ansi.d.ts +0 -2
  228. package/dist/streaming/ansi.js +0 -8
  229. package/dist/streaming/index.d.ts +0 -4
  230. package/dist/streaming/index.js +0 -17
  231. package/dist/streaming/spinner.d.ts +0 -3
  232. package/dist/streaming/spinner.js +0 -10
  233. package/dist/streaming/writer.d.ts +0 -2
  234. package/dist/streaming/writer.js +0 -9
  235. package/dist/table/index.d.ts +0 -4
  236. package/dist/table/index.js +0 -13
  237. package/dist/theme/context.d.ts +0 -9
  238. package/dist/theme/context.js +0 -14
  239. package/dist/theme/create.d.ts +0 -8
  240. package/dist/theme/create.js +0 -12
  241. package/dist/theme/index.d.ts +0 -17
  242. package/dist/theme/index.js +0 -42
  243. package/dist/theme/presets/bold.d.ts +0 -8
  244. package/dist/theme/presets/bold.js +0 -12
  245. package/dist/theme/presets/default.d.ts +0 -8
  246. package/dist/theme/presets/default.js +0 -11
  247. package/dist/theme/presets/index.d.ts +0 -12
  248. package/dist/theme/presets/index.js +0 -24
  249. package/dist/theme/presets/minimal.d.ts +0 -8
  250. package/dist/theme/presets/minimal.js +0 -12
  251. package/dist/theme/presets/rounded.d.ts +0 -8
  252. package/dist/theme/presets/rounded.js +0 -12
  253. package/dist/theme/resolve.d.ts +0 -8
  254. package/dist/theme/resolve.js +0 -11
  255. package/dist/theme/types.d.ts +0 -7
  256. package/dist/theme/types.js +0 -1
  257. package/dist/tree/index.d.ts +0 -3
  258. package/dist/tree/index.js +0 -11
  259. /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
  260. /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
@@ -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 };