@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,71 +0,0 @@
1
- import { BorderStyle } from "./cli-fakncnjp";
2
- /**
3
- * Configuration options for {@link renderTable}.
4
- *
5
- * @example
6
- * ```typescript
7
- * const options: TableOptions = {
8
- * headers: { id: "ID", name: "Name" },
9
- * columnWidths: { description: 20 },
10
- * border: "rounded",
11
- * };
12
- * ```
13
- */
14
- interface TableOptions {
15
- /**
16
- * Fixed column widths by key.
17
- * If not specified, column width is calculated from content.
18
- */
19
- columnWidths?: Record<string, number>;
20
- /**
21
- * Custom header labels by key.
22
- * If not specified, the object key is used as the header.
23
- */
24
- headers?: Record<string, string>;
25
- /**
26
- * Border style for the table.
27
- * @default "single"
28
- */
29
- border?: BorderStyle;
30
- /**
31
- * Compact mode removes all borders and uses space separators.
32
- * When true, overrides the border option.
33
- * @default false
34
- */
35
- compact?: boolean;
36
- }
37
- /**
38
- * Renders an array of objects as a table with Unicode box-drawing borders.
39
- *
40
- * Automatically calculates column widths based on content unless
41
- * overridden in options. Supports custom header labels, border styles,
42
- * and truncates cell content that exceeds column width.
43
- *
44
- * @param data - Array of objects to render as rows
45
- * @param options - Table rendering options
46
- * @returns Formatted table string with borders
47
- *
48
- * @example
49
- * ```typescript
50
- * const table = renderTable(
51
- * [
52
- * { id: 1, name: "Alice", status: "Active" },
53
- * { id: 2, name: "Bob", status: "Inactive" },
54
- * ],
55
- * {
56
- * headers: { id: "ID", name: "Name" },
57
- * columnWidths: { status: 10 },
58
- * }
59
- * );
60
- *
61
- * console.log(table);
62
- * // ┌────┬───────┬──────────┐
63
- * // │ ID │ Name │ status │
64
- * // ├────┼───────┼──────────┤
65
- * // │ 1 │ Alice │ Active │
66
- * // │ 2 │ Bob │ Inactive │
67
- * // └────┴───────┴──────────┘
68
- * ```
69
- */
70
- declare function renderTable(data: Record<string, unknown>[], options?: TableOptions): string;
71
- export { TableOptions, renderTable };
@@ -1,26 +0,0 @@
1
- import { VisualTheme } from "./cli-8hngbjyr";
2
- /**
3
- * Minimal visual theme.
4
- *
5
- * Features:
6
- * - ASCII-only borders (+, -, |)
7
- * - ASCII-safe list bullets and checkboxes
8
- * - Line spinner (ASCII-compatible)
9
- * - No unicode characters anywhere
10
- *
11
- * Use this theme when targeting terminals without unicode support
12
- * or when running in CI/log environments.
13
- *
14
- * @example
15
- * ```typescript
16
- * import { minimalTheme } from "@outfitter/cli/theme/presets";
17
- *
18
- * // Use ASCII-safe styling
19
- * const box = renderBox("Hello", { border: minimalTheme.border });
20
- * // +-------+
21
- * // | Hello |
22
- * // +-------+
23
- * ```
24
- */
25
- declare const minimalTheme: VisualTheme;
26
- export { minimalTheme };
@@ -1,59 +0,0 @@
1
- import { GlyphPair, SemanticState, VisualTheme } from "./cli-8hngbjyr";
2
- /**
3
- * Resolves a glyph pair to a single character based on terminal capability.
4
- *
5
- * Uses terminal detection to choose between unicode and fallback characters.
6
- * Can be overridden with the `forceUnicode` parameter.
7
- *
8
- * @param glyph - The glyph pair to resolve
9
- * @param forceUnicode - Override terminal detection (true = unicode, false = fallback)
10
- * @returns The appropriate character for the terminal
11
- *
12
- * @example
13
- * ```typescript
14
- * const bullet: GlyphPair = { unicode: "•", fallback: "*" };
15
- *
16
- * // Auto-detect terminal capability
17
- * resolveGlyph(bullet); // "•" or "*" based on terminal
18
- *
19
- * // Force unicode
20
- * resolveGlyph(bullet, true); // "•"
21
- *
22
- * // Force fallback
23
- * resolveGlyph(bullet, false); // "*"
24
- * ```
25
- */
26
- declare function resolveGlyph(glyph: GlyphPair, forceUnicode?: boolean): string;
27
- /**
28
- * Resolves a semantic state to its visual marker character.
29
- *
30
- * Looks up the marker specification in the theme and returns the
31
- * appropriate character. Supports both indicator-type markers (from
32
- * the INDICATORS registry) and custom glyph pairs.
33
- *
34
- * @param theme - The visual theme containing marker definitions
35
- * @param state - The semantic state to resolve
36
- * @param forceUnicode - Override terminal detection
37
- * @returns The marker character for the given state
38
- *
39
- * @example
40
- * ```typescript
41
- * import { defaultTheme, resolveStateMarker } from "@outfitter/cli/theme";
42
- *
43
- * // Resolve success marker (indicator-type)
44
- * resolveStateMarker(defaultTheme, "success", true); // "✔"
45
- * resolveStateMarker(defaultTheme, "success", false); // "[ok]"
46
- *
47
- * // Resolve with custom theme marker
48
- * const theme = createVisualTheme({
49
- * overrides: {
50
- * markers: {
51
- * current: { type: "custom", glyph: { unicode: "★", fallback: "*" } }
52
- * }
53
- * }
54
- * });
55
- * resolveStateMarker(theme, "current", true); // "★"
56
- * ```
57
- */
58
- declare function resolveStateMarker(theme: VisualTheme, state: SemanticState, forceUnicode?: boolean): string;
59
- export { resolveGlyph, resolveStateMarker };
@@ -1,37 +0,0 @@
1
- // @bun
2
- import {
3
- renderHeading
4
- } from "./cli-3hk2xf3c.js";
5
- import {
6
- joinVertical
7
- } from "./cli-aem6v4c8.js";
8
-
9
- // packages/cli/src/demo/section.ts
10
- function demoSection(title, options) {
11
- return renderHeading(title, {
12
- separator: options?.separator ?? "\u2500",
13
- case: options?.case ?? "title"
14
- });
15
- }
16
- function demoSubsection(title, options) {
17
- return renderHeading(title, {
18
- separator: options?.separator ?? "\u2500",
19
- case: options?.case ?? "title"
20
- });
21
- }
22
- function codeBlock(lines, show = true) {
23
- if (!show)
24
- return [];
25
- return lines;
26
- }
27
- function description(text, theme, show = true) {
28
- if (!show)
29
- return [];
30
- return [theme.muted(text)];
31
- }
32
- function demoContent(blocks, gap = 1) {
33
- const filtered = blocks.filter((b) => b !== "");
34
- return joinVertical(filtered, { gap });
35
- }
36
-
37
- export { demoSection, demoSubsection, codeBlock, description, demoContent };
@@ -1,43 +0,0 @@
1
- // @bun
2
- import {
3
- createCancelledError
4
- } from "./cli-8bwaw3pz.js";
5
-
6
- // packages/cli/src/prompt/text.ts
7
- import { isCancel, password, text } from "@clack/prompts";
8
- import { Result } from "better-result";
9
- async function promptText(options) {
10
- const textOptions = {
11
- message: options.message
12
- };
13
- if (options.placeholder !== undefined) {
14
- textOptions.placeholder = options.placeholder;
15
- }
16
- if (options.defaultValue !== undefined) {
17
- textOptions.defaultValue = options.defaultValue;
18
- }
19
- if (options.validate !== undefined) {
20
- textOptions.validate = options.validate;
21
- }
22
- const result = await text(textOptions);
23
- if (isCancel(result)) {
24
- return Result.err(createCancelledError());
25
- }
26
- return Result.ok(result);
27
- }
28
- async function promptPassword(options) {
29
- const passwordOptions = {
30
- message: options.message,
31
- mask: options.mask ?? "\u2022"
32
- };
33
- if (options.validate !== undefined) {
34
- passwordOptions.validate = options.validate;
35
- }
36
- const result = await password(passwordOptions);
37
- if (isCancel(result)) {
38
- return Result.err(createCancelledError());
39
- }
40
- return Result.ok(result);
41
- }
42
-
43
- export { promptText, promptPassword };
@@ -1,20 +0,0 @@
1
- // @bun
2
- import {
3
- getIndicator,
4
- isUnicodeSupported
5
- } from "./cli-6ty1nvws.js";
6
-
7
- // packages/cli/src/theme/resolve.ts
8
- function resolveGlyph(glyph, forceUnicode) {
9
- const useUnicode = forceUnicode ?? isUnicodeSupported();
10
- return useUnicode ? glyph.unicode : glyph.fallback;
11
- }
12
- function resolveStateMarker(theme, state, forceUnicode) {
13
- const markerSpec = theme.markers[state] ?? theme.markers.default;
14
- if (markerSpec.type === "indicator") {
15
- return getIndicator(markerSpec.category, markerSpec.name, forceUnicode);
16
- }
17
- return resolveGlyph(markerSpec.glyph, forceUnicode);
18
- }
19
-
20
- export { resolveGlyph, resolveStateMarker };
@@ -1,20 +0,0 @@
1
- // @bun
2
- // packages/cli/src/demo/types.ts
3
- function isPrimitiveId(value) {
4
- const validIds = [
5
- "colors",
6
- "borders",
7
- "spinner",
8
- "list",
9
- "box",
10
- "table",
11
- "progress",
12
- "tree",
13
- "text",
14
- "markdown",
15
- "indicators"
16
- ];
17
- return validIds.includes(value);
18
- }
19
-
20
- export { isPrimitiveId };
@@ -1,32 +0,0 @@
1
- // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
- var __require = import.meta.require;
31
-
32
- export { __toCommonJS, __export, __esm, __require };
@@ -1 +0,0 @@
1
- // @bun
@@ -1,41 +0,0 @@
1
- import { PasswordPromptOptions, PromptResult, TextPromptOptions } from "./cli-9bcm4zhf";
2
- /**
3
- * Prompts for text input with Result wrapping.
4
- *
5
- * @param options - Text prompt options
6
- * @returns Ok with value or Err with CancelledError
7
- *
8
- * @example
9
- * ```typescript
10
- * import { promptText } from "@outfitter/cli/prompt";
11
- *
12
- * const result = await promptText({
13
- * message: "What is your name?",
14
- * placeholder: "Enter your name",
15
- * validate: (v) => v.length > 0 || "Name is required",
16
- * });
17
- *
18
- * if (result.isOk()) {
19
- * console.log(`Hello, ${result.value}!`);
20
- * }
21
- * ```
22
- */
23
- declare function promptText(options: TextPromptOptions): PromptResult<string>;
24
- /**
25
- * Prompts for password input with Result wrapping.
26
- *
27
- * @param options - Password prompt options
28
- * @returns Ok with value or Err with CancelledError
29
- *
30
- * @example
31
- * ```typescript
32
- * import { promptPassword } from "@outfitter/cli/prompt";
33
- *
34
- * const result = await promptPassword({
35
- * message: "Enter your password:",
36
- * validate: (v) => v.length >= 8 || "Password too short",
37
- * });
38
- * ```
39
- */
40
- declare function promptPassword(options: PasswordPromptOptions): PromptResult<string>;
41
- export { promptText, promptPassword };
@@ -1,74 +0,0 @@
1
- /**
2
- * Validator factories for prompt input validation.
3
- *
4
- * @packageDocumentation
5
- */
6
- /**
7
- * A validator function that returns an error message or undefined.
8
- */
9
- type Validator = (value: string) => string | undefined;
10
- /**
11
- * Collection of validator factory functions.
12
- *
13
- * @example
14
- * ```typescript
15
- * import { validators } from "@outfitter/cli/prompt";
16
- *
17
- * const validate = validators.compose(
18
- * validators.required(),
19
- * validators.minLength(3),
20
- * validators.email()
21
- * );
22
- *
23
- * const error = validate("ab");
24
- * // "Minimum 3 characters"
25
- * ```
26
- */
27
- declare const validators: {
28
- /**
29
- * Requires a non-empty value.
30
- *
31
- * @param message - Custom error message
32
- * @returns Validator function
33
- */
34
- required: (message?: string) => Validator;
35
- /**
36
- * Requires minimum character length.
37
- *
38
- * @param length - Minimum length
39
- * @param message - Custom error message
40
- * @returns Validator function
41
- */
42
- minLength: (length: number, message?: string) => Validator;
43
- /**
44
- * Requires maximum character length.
45
- *
46
- * @param length - Maximum length
47
- * @param message - Custom error message
48
- * @returns Validator function
49
- */
50
- maxLength: (length: number, message?: string) => Validator;
51
- /**
52
- * Requires value to match a regex pattern.
53
- *
54
- * @param regex - Pattern to match
55
- * @param message - Error message when pattern doesn't match
56
- * @returns Validator function
57
- */
58
- pattern: (regex: RegExp, message: string) => Validator;
59
- /**
60
- * Validates email format.
61
- *
62
- * @param message - Custom error message
63
- * @returns Validator function
64
- */
65
- email: (message?: string) => Validator;
66
- /**
67
- * Composes multiple validators, returning the first error.
68
- *
69
- * @param fns - Validators to compose
70
- * @returns Combined validator function
71
- */
72
- compose: (...fns: Validator[]) => Validator;
73
- };
74
- export { Validator, validators };
@@ -1,54 +0,0 @@
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 };
@@ -1 +0,0 @@
1
- // @bun
@@ -1,52 +0,0 @@
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 };
@@ -1,86 +0,0 @@
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 };
@@ -1,30 +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/presets/minimal.ts
11
- init_borders();
12
- var minimalTheme = {
13
- ...defaultTheme,
14
- name: "minimal",
15
- border: "ascii",
16
- borderChars: BORDERS.ascii,
17
- treeGuide: "single",
18
- delimiter: "bullet",
19
- markers: {
20
- ...defaultTheme.markers
21
- },
22
- listBullet: { unicode: "-", fallback: "-" },
23
- checkbox: {
24
- checked: { unicode: "[x]", fallback: "[x]" },
25
- unchecked: { unicode: "[ ]", fallback: "[ ]" }
26
- },
27
- spinner: "line"
28
- };
29
-
30
- export { minimalTheme };