@outfitter/cli 0.2.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 (261) hide show
  1. package/README.md +47 -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 +4 -5
  13. package/dist/input.d.ts +3 -26
  14. package/dist/input.js +1 -31
  15. package/dist/output.d.ts +3 -3
  16. package/dist/output.js +4 -3
  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-8gg0hck1.js → cli-7wp5nj0s.js} +16 -12
  21. package/dist/shared/@outfitter/{cli-72kg550t.d.ts → cli-f79bwzsp.d.ts} +30 -2
  22. package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
  23. package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
  24. package/dist/shared/@outfitter/{cli-efy6jfcj.js → cli-zahqsaby.js} +33 -10
  25. package/dist/terminal/detection.js +1 -5
  26. package/dist/terminal/index.js +1 -6
  27. package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
  28. package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
  29. package/dist/types.d.ts +2 -2
  30. package/dist/types.js +0 -2
  31. package/package.json +35 -213
  32. package/dist/borders/index.d.ts +0 -3
  33. package/dist/borders/index.js +0 -13
  34. package/dist/box/index.d.ts +0 -4
  35. package/dist/box/index.js +0 -13
  36. package/dist/demo/index.d.ts +0 -78
  37. package/dist/demo/index.js +0 -148
  38. package/dist/demo/registry.d.ts +0 -7
  39. package/dist/demo/registry.js +0 -28
  40. package/dist/demo/renderers/borders.d.ts +0 -7
  41. package/dist/demo/renderers/borders.js +0 -17
  42. package/dist/demo/renderers/box.d.ts +0 -7
  43. package/dist/demo/renderers/box.js +0 -18
  44. package/dist/demo/renderers/colors.d.ts +0 -7
  45. package/dist/demo/renderers/colors.js +0 -18
  46. package/dist/demo/renderers/indicators.d.ts +0 -7
  47. package/dist/demo/renderers/indicators.js +0 -17
  48. package/dist/demo/renderers/list.d.ts +0 -7
  49. package/dist/demo/renderers/list.js +0 -19
  50. package/dist/demo/renderers/markdown.d.ts +0 -7
  51. package/dist/demo/renderers/markdown.js +0 -18
  52. package/dist/demo/renderers/progress.d.ts +0 -7
  53. package/dist/demo/renderers/progress.js +0 -17
  54. package/dist/demo/renderers/spinner.d.ts +0 -7
  55. package/dist/demo/renderers/spinner.js +0 -19
  56. package/dist/demo/renderers/table.d.ts +0 -7
  57. package/dist/demo/renderers/table.js +0 -19
  58. package/dist/demo/renderers/text.d.ts +0 -7
  59. package/dist/demo/renderers/text.js +0 -16
  60. package/dist/demo/renderers/tree.d.ts +0 -7
  61. package/dist/demo/renderers/tree.js +0 -18
  62. package/dist/demo/section.d.ts +0 -5
  63. package/dist/demo/section.js +0 -23
  64. package/dist/demo/templates.d.ts +0 -4
  65. package/dist/demo/templates.js +0 -10
  66. package/dist/demo/types.d.ts +0 -3
  67. package/dist/demo/types.js +0 -8
  68. package/dist/list/index.d.ts +0 -3
  69. package/dist/list/index.js +0 -9
  70. package/dist/preset/full.d.ts +0 -14
  71. package/dist/preset/full.js +0 -41
  72. package/dist/preset/standard.d.ts +0 -11
  73. package/dist/preset/standard.js +0 -30
  74. package/dist/prompt/confirm.d.ts +0 -4
  75. package/dist/prompt/confirm.js +0 -9
  76. package/dist/prompt/group.d.ts +0 -4
  77. package/dist/prompt/group.js +0 -9
  78. package/dist/prompt/index.d.ts +0 -7
  79. package/dist/prompt/index.js +0 -32
  80. package/dist/prompt/select.d.ts +0 -4
  81. package/dist/prompt/select.js +0 -11
  82. package/dist/prompt/text.d.ts +0 -4
  83. package/dist/prompt/text.js +0 -11
  84. package/dist/prompt/types.d.ts +0 -3
  85. package/dist/prompt/types.js +0 -8
  86. package/dist/prompt/validators.d.ts +0 -2
  87. package/dist/prompt/validators.js +0 -8
  88. package/dist/render/borders.d.ts +0 -2
  89. package/dist/render/borders.js +0 -15
  90. package/dist/render/box.d.ts +0 -3
  91. package/dist/render/box.js +0 -23
  92. package/dist/render/date.d.ts +0 -2
  93. package/dist/render/date.js +0 -12
  94. package/dist/render/format-relative.d.ts +0 -2
  95. package/dist/render/format-relative.js +0 -8
  96. package/dist/render/format.d.ts +0 -2
  97. package/dist/render/format.js +0 -10
  98. package/dist/render/heading.d.ts +0 -3
  99. package/dist/render/heading.js +0 -14
  100. package/dist/render/index.d.ts +0 -32
  101. package/dist/render/index.js +0 -235
  102. package/dist/render/indicators.d.ts +0 -2
  103. package/dist/render/indicators.js +0 -16
  104. package/dist/render/json.d.ts +0 -2
  105. package/dist/render/json.js +0 -10
  106. package/dist/render/layout.d.ts +0 -5
  107. package/dist/render/layout.js +0 -25
  108. package/dist/render/list.d.ts +0 -2
  109. package/dist/render/list.js +0 -8
  110. package/dist/render/markdown.d.ts +0 -2
  111. package/dist/render/markdown.js +0 -10
  112. package/dist/render/progress.d.ts +0 -2
  113. package/dist/render/progress.js +0 -8
  114. package/dist/render/separator.d.ts +0 -3
  115. package/dist/render/separator.js +0 -14
  116. package/dist/render/shapes.d.ts +0 -2
  117. package/dist/render/shapes.js +0 -35
  118. package/dist/render/spinner.d.ts +0 -2
  119. package/dist/render/spinner.js +0 -12
  120. package/dist/render/stack.d.ts +0 -3
  121. package/dist/render/stack.js +0 -38
  122. package/dist/render/table.d.ts +0 -3
  123. package/dist/render/table.js +0 -12
  124. package/dist/render/text.d.ts +0 -2
  125. package/dist/render/text.js +0 -27
  126. package/dist/render/tree.d.ts +0 -2
  127. package/dist/render/tree.js +0 -10
  128. package/dist/render/types.d.ts +0 -2
  129. package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
  130. package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
  131. package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
  132. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
  133. package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
  134. package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
  135. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
  136. package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
  137. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
  138. package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
  139. package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
  140. package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
  141. package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
  142. package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
  143. package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
  144. package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
  145. package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
  146. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
  147. package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
  148. package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
  149. package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
  150. package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
  151. package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
  152. package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
  153. package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
  154. package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
  155. package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
  156. package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
  157. package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
  158. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
  159. package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
  160. package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
  161. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
  162. package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
  163. package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
  164. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
  165. package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
  166. package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
  167. package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
  168. package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
  169. package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
  170. package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
  171. package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
  172. package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
  173. package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
  174. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
  175. package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
  176. package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
  177. package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
  178. package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
  179. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
  180. package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
  181. package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
  182. package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
  183. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
  184. package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
  185. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
  186. package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
  187. package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
  188. package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
  189. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
  190. package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
  191. package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
  192. package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
  193. package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
  194. package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
  195. package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
  196. package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
  197. package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
  198. package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
  199. package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
  200. package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
  201. package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
  202. package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
  203. package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
  204. package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
  205. package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
  206. package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
  207. package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
  208. package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
  209. package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
  210. package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
  211. package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
  212. package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
  213. package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
  214. package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
  215. package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
  216. package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
  217. package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
  218. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
  219. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
  220. package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
  221. package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
  222. package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
  223. package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
  224. package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
  225. package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
  226. package/dist/shared/@outfitter/cli-znc47004.js +0 -134
  227. package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
  228. package/dist/streaming/ansi.d.ts +0 -2
  229. package/dist/streaming/ansi.js +0 -8
  230. package/dist/streaming/index.d.ts +0 -4
  231. package/dist/streaming/index.js +0 -17
  232. package/dist/streaming/spinner.d.ts +0 -3
  233. package/dist/streaming/spinner.js +0 -10
  234. package/dist/streaming/writer.d.ts +0 -2
  235. package/dist/streaming/writer.js +0 -9
  236. package/dist/table/index.d.ts +0 -4
  237. package/dist/table/index.js +0 -13
  238. package/dist/theme/context.d.ts +0 -9
  239. package/dist/theme/context.js +0 -14
  240. package/dist/theme/create.d.ts +0 -8
  241. package/dist/theme/create.js +0 -12
  242. package/dist/theme/index.d.ts +0 -17
  243. package/dist/theme/index.js +0 -42
  244. package/dist/theme/presets/bold.d.ts +0 -8
  245. package/dist/theme/presets/bold.js +0 -12
  246. package/dist/theme/presets/default.d.ts +0 -8
  247. package/dist/theme/presets/default.js +0 -11
  248. package/dist/theme/presets/index.d.ts +0 -12
  249. package/dist/theme/presets/index.js +0 -24
  250. package/dist/theme/presets/minimal.d.ts +0 -8
  251. package/dist/theme/presets/minimal.js +0 -12
  252. package/dist/theme/presets/rounded.d.ts +0 -8
  253. package/dist/theme/presets/rounded.js +0 -12
  254. package/dist/theme/resolve.d.ts +0 -8
  255. package/dist/theme/resolve.js +0 -11
  256. package/dist/theme/types.d.ts +0 -7
  257. package/dist/theme/types.js +0 -1
  258. package/dist/tree/index.d.ts +0 -3
  259. package/dist/tree/index.js +0 -11
  260. /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
  261. /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
@@ -1,82 +0,0 @@
1
- // @bun
2
- import {
3
- getTerminalWidth
4
- } from "./cli-aem6v4c8.js";
5
-
6
- // packages/cli/src/render/heading.ts
7
- var ANSI_PATTERN = /\x1b\[[0-9;]*m/g;
8
- function toTitleCase(text) {
9
- return text.replace(/\w\S*/g, (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());
10
- }
11
- function applyCase(text, caseMode) {
12
- if (caseMode === "none") {
13
- return text;
14
- }
15
- const hasAnsi = ANSI_PATTERN.test(text);
16
- ANSI_PATTERN.lastIndex = 0;
17
- if (!hasAnsi) {
18
- switch (caseMode) {
19
- case "upper":
20
- return text.toUpperCase();
21
- case "lower":
22
- return text.toLowerCase();
23
- case "title":
24
- return toTitleCase(text);
25
- default: {
26
- const _exhaustive = caseMode;
27
- return _exhaustive;
28
- }
29
- }
30
- }
31
- const sequences = [];
32
- for (const match of text.matchAll(ANSI_PATTERN)) {
33
- sequences.push({ index: match.index, seq: match[0] });
34
- }
35
- const stripped = Bun.stripANSI(text);
36
- let transformed;
37
- switch (caseMode) {
38
- case "upper":
39
- transformed = stripped.toUpperCase();
40
- break;
41
- case "lower":
42
- transformed = stripped.toLowerCase();
43
- break;
44
- case "title":
45
- transformed = toTitleCase(stripped);
46
- break;
47
- default: {
48
- const _exhaustive = caseMode;
49
- return _exhaustive;
50
- }
51
- }
52
- let result = transformed;
53
- let offset = 0;
54
- for (const { index, seq } of sequences) {
55
- const insertPos = index + offset;
56
- result = result.slice(0, insertPos) + seq + result.slice(insertPos);
57
- offset += seq.length;
58
- }
59
- return result;
60
- }
61
- function getTextWidth(text) {
62
- return Bun.stringWidth(text);
63
- }
64
- function renderHeading(text, options) {
65
- const separator = options?.separator ?? "=";
66
- const widthMode = options?.width ?? "text";
67
- const caseMode = options?.case ?? "upper";
68
- const transformedText = applyCase(text, caseMode);
69
- let width;
70
- if (widthMode === "text") {
71
- width = getTextWidth(transformedText);
72
- } else if (widthMode === "full") {
73
- width = getTerminalWidth();
74
- } else {
75
- width = widthMode;
76
- }
77
- const separatorLine = separator.repeat(width);
78
- return `${transformedText}
79
- ${separatorLine}`;
80
- }
81
-
82
- export { renderHeading };
@@ -1,11 +0,0 @@
1
- // @bun
2
- // packages/cli/src/render/json.ts
3
- function renderJson(data) {
4
- const json = JSON.stringify(data, null, 2);
5
- return json;
6
- }
7
- function renderText(text) {
8
- return text;
9
- }
10
-
11
- export { renderJson, renderText };
@@ -1,7 +0,0 @@
1
- // @bun
2
- import {
3
- init_colors
4
- } from "./cli-5g6rkv3d.js";
5
-
6
- // packages/cli/src/colors/index.ts
7
- init_colors();
@@ -1,36 +0,0 @@
1
- import { CancelledError, PromptResult } from "./cli-9bcm4zhf";
2
- import { Result } from "better-result";
3
- /**
4
- * A step in a prompt group.
5
- */
6
- type PromptStep<T> = () => PromptResult<T>;
7
- /**
8
- * Collects multiple prompts into a single result object.
9
- *
10
- * If any prompt is cancelled, the entire group fails with CancelledError.
11
- *
12
- * @param steps - Object of named prompt steps
13
- * @returns Ok with collected values or Err with CancelledError
14
- *
15
- * @example
16
- * ```typescript
17
- * import { promptGroup, promptText, promptSelect } from "@outfitter/cli/prompt";
18
- *
19
- * const result = await promptGroup({
20
- * name: () => promptText({ message: "Name:" }),
21
- * role: () => promptSelect({
22
- * message: "Role:",
23
- * options: [
24
- * { value: "admin", label: "Admin" },
25
- * { value: "user", label: "User" },
26
- * ],
27
- * }),
28
- * });
29
- *
30
- * if (result.isOk()) {
31
- * console.log(`Creating ${result.value.role}: ${result.value.name}`);
32
- * }
33
- * ```
34
- */
35
- declare function promptGroup<T extends Record<string, unknown>>(steps: { [K in keyof T] : PromptStep<T[K]> }): Promise<Result<T, CancelledError>>;
36
- export { PromptStep, promptGroup };
@@ -1,70 +0,0 @@
1
- // @bun
2
- import {
3
- renderMarkdown
4
- } from "./cli-ndem6tz8.js";
5
- import {
6
- getExample
7
- } from "./cli-xep6v2c0.js";
8
- import {
9
- demoSection
10
- } from "./cli-sam2sq50.js";
11
-
12
- // packages/cli/src/demo/renderers/markdown.ts
13
- function renderMarkdownDemo(config, theme) {
14
- const showCode = config.showCode ?? true;
15
- const lines = [];
16
- lines.push(demoSection("Markdown Rendering"));
17
- lines.push("");
18
- if (showCode) {
19
- lines.push('import { renderMarkdown } from "@outfitter/cli/render";');
20
- lines.push("");
21
- }
22
- const sample = getExample("markdownSample", config.examples);
23
- lines.push("Input:");
24
- lines.push(theme.muted("\u2500".repeat(40)));
25
- for (const line of sample.split(`
26
- `)) {
27
- lines.push(theme.muted(line));
28
- }
29
- lines.push(theme.muted("\u2500".repeat(40)));
30
- lines.push("");
31
- lines.push("Output:");
32
- lines.push("\u2500".repeat(40));
33
- lines.push(renderMarkdown(sample));
34
- lines.push("\u2500".repeat(40));
35
- lines.push("");
36
- lines.push(demoSection("Supported Elements"));
37
- lines.push("");
38
- const elements = [
39
- {
40
- name: "Headings",
41
- markdown: `# Heading 1
42
- ## Heading 2`,
43
- desc: "Rendered bold"
44
- },
45
- { name: "Bold", markdown: "**bold text**", desc: "Rendered bold" },
46
- { name: "Italic", markdown: "*italic text*", desc: "Rendered italic" },
47
- { name: "Inline code", markdown: "`code`", desc: "Rendered cyan" },
48
- {
49
- name: "Code block",
50
- markdown: "```\ncode block\n```",
51
- desc: "Rendered dim"
52
- }
53
- ];
54
- for (const el of elements) {
55
- lines.push(`${el.name}:`);
56
- lines.push(theme.muted(` ${el.desc}`));
57
- lines.push(` Input: ${el.markdown.replace(/\n/g, "\\n")}`);
58
- lines.push(` Output: ${renderMarkdown(el.markdown).replace(/\n/g, " ")}`);
59
- lines.push("");
60
- }
61
- lines.push(demoSection("Color Support"));
62
- lines.push("");
63
- lines.push("\u2022 Colors applied when terminal supports ANSI");
64
- lines.push("\u2022 Respects NO_COLOR environment variable");
65
- lines.push("\u2022 Markdown syntax stripped when colors disabled");
66
- return lines.join(`
67
- `);
68
- }
69
-
70
- export { renderMarkdownDemo };
@@ -1,20 +0,0 @@
1
- // @bun
2
- import {
3
- createCancelledError
4
- } from "./cli-8bwaw3pz.js";
5
-
6
- // packages/cli/src/prompt/group.ts
7
- import { Result as R } from "better-result";
8
- async function promptGroup(steps) {
9
- const result = {};
10
- for (const [key, step] of Object.entries(steps)) {
11
- const stepResult = await step();
12
- if (stepResult.isErr()) {
13
- return R.err(createCancelledError(stepResult.error.message));
14
- }
15
- result[key] = stepResult.value;
16
- }
17
- return R.ok(result);
18
- }
19
-
20
- export { promptGroup };
@@ -1,61 +0,0 @@
1
- import { PartialVisualTheme, VisualTheme } from "./cli-8hngbjyr";
2
- /**
3
- * Options for creating a visual theme.
4
- */
5
- interface CreateVisualThemeOptions {
6
- /**
7
- * Base theme to extend from.
8
- * Properties not overridden will be inherited from this theme.
9
- * @default defaultTheme
10
- */
11
- extends?: VisualTheme;
12
- /**
13
- * Properties to override on the base/extended theme.
14
- * Supports partial overrides for nested objects (colors, spacing, markers).
15
- */
16
- overrides?: PartialVisualTheme;
17
- }
18
- /**
19
- * Creates a visual theme by extending and/or overriding a base theme.
20
- *
21
- * This is the primary factory for creating custom themes. You can:
22
- * - Start from scratch (no options → defaultTheme)
23
- * - Extend an existing preset
24
- * - Override specific properties
25
- * - Combine extension and overrides
26
- *
27
- * When changing the `border` property, `borderChars` is automatically
28
- * updated to match the new border style.
29
- *
30
- * @param options - Configuration for theme creation
31
- * @returns A complete VisualTheme
32
- *
33
- * @example
34
- * ```typescript
35
- * // Start with defaults
36
- * const theme = createVisualTheme();
37
- *
38
- * // Extend a preset
39
- * const rounded = createVisualTheme({ extends: roundedTheme });
40
- *
41
- * // Override specific properties
42
- * const custom = createVisualTheme({
43
- * overrides: {
44
- * border: "double",
45
- * colors: { success: "\x1b[38;5;82m" },
46
- * spacing: { boxPadding: 2 }
47
- * }
48
- * });
49
- *
50
- * // Extend and override
51
- * const brandTheme = createVisualTheme({
52
- * extends: roundedTheme,
53
- * overrides: {
54
- * name: "brand",
55
- * colors: { accent: "\x1b[38;5;39m" }
56
- * }
57
- * });
58
- * ```
59
- */
60
- declare function createVisualTheme(options?: CreateVisualThemeOptions): VisualTheme;
61
- export { CreateVisualThemeOptions, createVisualTheme };
@@ -1,20 +0,0 @@
1
- // @bun
2
- import {
3
- defaultTheme
4
- } from "./cli-z78mkrc7.js";
5
-
6
- // packages/cli/src/theme/context.ts
7
- function createThemedContext(options) {
8
- const theme = options.theme ?? options.parent?.theme ?? defaultTheme;
9
- const width = options.width ?? options.parent?.width ?? process.stdout.columns ?? 80;
10
- return {
11
- width,
12
- theme,
13
- ...options.parent && { parent: options.parent }
14
- };
15
- }
16
- function getContextTheme(ctx) {
17
- return ctx?.theme ?? defaultTheme;
18
- }
19
-
20
- export { createThemedContext, getContextTheme };
@@ -1,51 +0,0 @@
1
- import { WidthMode } from "./cli-2g8bx1aq";
2
- /**
3
- * Separator style for headings.
4
- */
5
- type SeparatorStyle = "=" | "-" | "─" | "━" | "═";
6
- /**
7
- * Width mode for headings.
8
- *
9
- * Note: Headings only support "text", "full", and numeric widths.
10
- * Use the shared WidthMode type for full container-relative support.
11
- *
12
- * @see WidthMode for the complete type definition
13
- */
14
- type HeadingWidthMode = Extract<WidthMode, "text" | "full" | number>;
15
- /**
16
- * Case transformation for heading text.
17
- */
18
- type CaseMode = "upper" | "lower" | "title" | "none";
19
- /**
20
- * Options for rendering a heading.
21
- */
22
- interface HeadingOptions {
23
- /** Separator character/style (default: "=") */
24
- separator?: SeparatorStyle;
25
- /** Width mode (default: "text") */
26
- width?: HeadingWidthMode;
27
- /** Case transformation (default: "upper") */
28
- case?: CaseMode;
29
- }
30
- /**
31
- * Renders a section heading with a separator line below.
32
- *
33
- * @param text - The heading text
34
- * @param options - Rendering options
35
- * @returns Formatted heading string
36
- *
37
- * @example
38
- * ```typescript
39
- * import { renderHeading } from "@outfitter/cli/render";
40
- *
41
- * console.log(renderHeading("Theme Colors"));
42
- * // THEME COLORS
43
- * // ============
44
- *
45
- * console.log(renderHeading("Status", { separator: "─", case: "none" }));
46
- * // Status
47
- * // ──────
48
- * ```
49
- */
50
- declare function renderHeading(text: string, options?: HeadingOptions): string;
51
- export { SeparatorStyle, HeadingWidthMode, CaseMode, HeadingOptions, renderHeading };
@@ -1 +0,0 @@
1
- // @bun
@@ -1,93 +0,0 @@
1
- import { VisualTheme } from "./cli-8hngbjyr";
2
- import { LayoutContext } from "./cli-2g8bx1aq";
3
- /**
4
- * Layout context extended with theme information.
5
- *
6
- * Allows themes to cascade through component hierarchies. Children
7
- * inherit their parent's theme unless explicitly overridden.
8
- *
9
- * @example
10
- * ```typescript
11
- * import { createThemedContext, roundedTheme } from "@outfitter/cli/theme";
12
- *
13
- * // Create root context with theme
14
- * const ctx = createThemedContext({ theme: roundedTheme, width: 80 });
15
- *
16
- * // Child inherits theme from parent
17
- * const childCtx = createThemedContext({ width: 40, parent: ctx });
18
- * console.log(childCtx.theme.border); // "rounded" (inherited)
19
- *
20
- * // Child can override theme
21
- * const overrideCtx = createThemedContext({
22
- * theme: boldTheme,
23
- * width: 40,
24
- * parent: ctx
25
- * });
26
- * console.log(overrideCtx.theme.border); // "heavy"
27
- * ```
28
- */
29
- interface ThemedLayoutContext extends LayoutContext {
30
- /** The visual theme for this context */
31
- readonly theme: VisualTheme;
32
- }
33
- /**
34
- * Options for creating a themed layout context.
35
- */
36
- interface ThemedContextOptions {
37
- /** Visual theme (inherited from parent if not specified) */
38
- theme?: VisualTheme;
39
- /** Available width in characters */
40
- width?: number;
41
- /** Parent context for inheritance */
42
- parent?: ThemedLayoutContext;
43
- }
44
- /**
45
- * Creates a themed layout context with cascading inheritance.
46
- *
47
- * Theme inheritance rules:
48
- * 1. Explicit theme → use it
49
- * 2. Parent exists → inherit parent's theme
50
- * 3. No theme or parent → use defaultTheme
51
- *
52
- * Width inheritance rules:
53
- * 1. Explicit width → use it
54
- * 2. Parent exists → inherit parent's width
55
- * 3. No width or parent → use terminal width (via getTerminalWidth)
56
- *
57
- * @param options - Context configuration
58
- * @returns A ThemedLayoutContext with resolved theme and width
59
- *
60
- * @example
61
- * ```typescript
62
- * // Root context with explicit theme and width
63
- * const root = createThemedContext({ theme: roundedTheme, width: 100 });
64
- *
65
- * // Child with inherited theme, explicit width
66
- * const child = createThemedContext({ width: 50, parent: root });
67
- *
68
- * // Nested child with overridden theme
69
- * const nested = createThemedContext({
70
- * theme: boldTheme,
71
- * parent: child
72
- * });
73
- * ```
74
- */
75
- declare function createThemedContext(options: ThemedContextOptions): ThemedLayoutContext;
76
- /**
77
- * Gets the theme from a context, with fallback to defaultTheme.
78
- *
79
- * Useful when you have an optional context and need a theme.
80
- *
81
- * @param ctx - Optional themed context
82
- * @returns The context's theme or defaultTheme if no context
83
- *
84
- * @example
85
- * ```typescript
86
- * function renderComponent(ctx?: ThemedLayoutContext) {
87
- * const theme = getContextTheme(ctx);
88
- * // theme is always defined
89
- * }
90
- * ```
91
- */
92
- declare function getContextTheme(ctx?: ThemedLayoutContext): VisualTheme;
93
- export { ThemedLayoutContext, ThemedContextOptions, createThemedContext, getContextTheme };
@@ -1,62 +0,0 @@
1
- // @bun
2
- import {
3
- BORDER_STYLE_META,
4
- getBorderStyles
5
- } from "./cli-d8ahdd9d.js";
6
- import {
7
- demoSection
8
- } from "./cli-sam2sq50.js";
9
- import {
10
- BORDERS,
11
- drawHorizontalLine,
12
- init_borders
13
- } from "./cli-85fg2vr5.js";
14
-
15
- // packages/cli/src/demo/renderers/borders.ts
16
- init_borders();
17
- function renderBordersDemo(config, theme) {
18
- const showCode = config.showCode ?? true;
19
- const showDescriptions = config.showDescriptions ?? true;
20
- const lines = [];
21
- lines.push(demoSection("Border Styles"));
22
- lines.push("");
23
- if (showCode) {
24
- lines.push('import { BORDERS, getBorderCharacters } from "@outfitter/cli/render";');
25
- lines.push("");
26
- }
27
- const styles = getBorderStyles().filter((s) => s !== "none");
28
- for (const style of styles) {
29
- const meta = BORDER_STYLE_META[style];
30
- const chars = BORDERS[style];
31
- lines.push(`${meta.label.toUpperCase()} (${style})`);
32
- if (showDescriptions) {
33
- lines.push(theme.muted(meta.description));
34
- }
35
- lines.push("");
36
- const width = 20;
37
- lines.push(drawHorizontalLine(width, chars, "top"));
38
- lines.push(`${chars.vertical}${" ".repeat(width)}${chars.vertical}`);
39
- lines.push(`${chars.vertical}${" Content here".padEnd(width)}${chars.vertical}`);
40
- lines.push(`${chars.vertical}${" ".repeat(width)}${chars.vertical}`);
41
- lines.push(drawHorizontalLine(width, chars, "bottom"));
42
- lines.push("");
43
- }
44
- lines.push(demoSection("Characters Reference"));
45
- lines.push("");
46
- for (const style of styles) {
47
- const chars = BORDERS[style];
48
- const meta = BORDER_STYLE_META[style];
49
- lines.push(`${meta.label}:`);
50
- const charDisplay = [
51
- ` Corners: ${chars.topLeft} ${chars.topRight} ${chars.bottomLeft} ${chars.bottomRight}`,
52
- ` Lines: ${chars.horizontal} ${chars.vertical}`,
53
- ` T's: ${chars.topT} ${chars.bottomT} ${chars.leftT} ${chars.rightT} Cross: ${chars.cross}`
54
- ];
55
- lines.push(...charDisplay);
56
- lines.push("");
57
- }
58
- return lines.join(`
59
- `);
60
- }
61
-
62
- export { renderBordersDemo };