@outfitter/cli 0.1.0-rc.1 → 0.1.0-rc.3
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.
- package/README.md +21 -32
- package/dist/actions.js +1 -1
- package/dist/borders/index.d.ts +3 -0
- package/dist/borders/index.js +13 -0
- package/dist/box/index.d.ts +4 -0
- package/dist/box/index.js +13 -0
- package/dist/cli.d.ts +2 -103
- package/dist/cli.js +4 -51
- package/dist/colors/index.d.ts +3 -0
- package/dist/colors/index.js +18 -0
- package/dist/command.d.ts +3 -37
- package/dist/command.js +5 -1
- package/dist/demo/index.d.ts +78 -0
- package/dist/demo/index.js +148 -0
- package/dist/demo/registry.d.ts +7 -0
- package/dist/demo/registry.js +28 -0
- package/dist/demo/renderers/borders.d.ts +7 -0
- package/dist/demo/renderers/borders.js +17 -0
- package/dist/demo/renderers/box.d.ts +7 -0
- package/dist/demo/renderers/box.js +18 -0
- package/dist/demo/renderers/colors.d.ts +7 -0
- package/dist/demo/renderers/colors.js +18 -0
- package/dist/demo/renderers/indicators.d.ts +7 -0
- package/dist/demo/renderers/indicators.js +17 -0
- package/dist/demo/renderers/list.d.ts +7 -0
- package/dist/demo/renderers/list.js +19 -0
- package/dist/demo/renderers/markdown.d.ts +7 -0
- package/dist/demo/renderers/markdown.js +18 -0
- package/dist/demo/renderers/progress.d.ts +7 -0
- package/dist/demo/renderers/progress.js +17 -0
- package/dist/demo/renderers/spinner.d.ts +7 -0
- package/dist/demo/renderers/spinner.js +19 -0
- package/dist/demo/renderers/table.d.ts +7 -0
- package/dist/demo/renderers/table.js +19 -0
- package/dist/demo/renderers/text.d.ts +7 -0
- package/dist/demo/renderers/text.js +16 -0
- package/dist/demo/renderers/tree.d.ts +7 -0
- package/dist/demo/renderers/tree.js +18 -0
- package/dist/demo/section.d.ts +5 -0
- package/dist/demo/section.js +23 -0
- package/dist/demo/templates.d.ts +4 -0
- package/dist/demo/templates.js +10 -0
- package/dist/demo/types.d.ts +3 -0
- package/dist/demo/types.js +8 -0
- package/dist/index.d.ts +5 -607
- package/dist/index.js +10 -44
- package/dist/input.d.ts +9 -123
- package/dist/input.js +2 -3
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.js +9 -0
- package/dist/output.d.ts +2 -68
- package/dist/output.js +4 -150
- package/dist/pagination.d.ts +1 -34
- package/dist/pagination.js +1 -1
- package/dist/preset/full.d.ts +14 -0
- package/dist/preset/full.js +41 -0
- package/dist/preset/standard.d.ts +11 -0
- package/dist/preset/standard.js +30 -0
- package/dist/prompt/confirm.d.ts +4 -0
- package/dist/prompt/confirm.js +9 -0
- package/dist/prompt/group.d.ts +4 -0
- package/dist/prompt/group.js +9 -0
- package/dist/prompt/index.d.ts +7 -0
- package/dist/prompt/index.js +32 -0
- package/dist/prompt/select.d.ts +4 -0
- package/dist/prompt/select.js +11 -0
- package/dist/prompt/text.d.ts +4 -0
- package/dist/prompt/text.js +11 -0
- package/dist/prompt/types.d.ts +3 -0
- package/dist/prompt/types.js +8 -0
- package/dist/prompt/validators.d.ts +2 -0
- package/dist/prompt/validators.js +8 -0
- package/dist/render/borders.d.ts +2 -0
- package/dist/render/borders.js +15 -0
- package/dist/render/box.d.ts +3 -0
- package/dist/render/box.js +23 -0
- package/dist/render/colors.d.ts +2 -0
- package/dist/render/colors.js +20 -0
- package/dist/render/date.d.ts +2 -0
- package/dist/render/date.js +12 -0
- package/dist/render/format-relative.d.ts +2 -0
- package/dist/render/format-relative.js +8 -0
- package/dist/render/format.d.ts +2 -0
- package/dist/render/format.js +10 -0
- package/dist/render/heading.d.ts +3 -0
- package/dist/render/heading.js +14 -0
- package/dist/render/index.d.ts +32 -0
- package/dist/render/index.js +235 -0
- package/dist/render/indicators.d.ts +2 -0
- package/dist/render/indicators.js +14 -0
- package/dist/render/json.d.ts +2 -0
- package/dist/render/json.js +10 -0
- package/dist/render/layout.d.ts +5 -0
- package/dist/render/layout.js +25 -0
- package/dist/render/list.d.ts +2 -0
- package/dist/render/list.js +8 -0
- package/dist/render/markdown.d.ts +2 -0
- package/dist/render/markdown.js +10 -0
- package/dist/render/progress.d.ts +2 -0
- package/dist/render/progress.js +8 -0
- package/dist/render/separator.d.ts +3 -0
- package/dist/render/separator.js +14 -0
- package/dist/render/shapes.d.ts +2 -0
- package/dist/render/shapes.js +35 -0
- package/dist/render/spinner.d.ts +2 -0
- package/dist/render/spinner.js +12 -0
- package/dist/render/stack.d.ts +3 -0
- package/dist/render/stack.js +38 -0
- package/dist/render/table.d.ts +3 -0
- package/dist/render/table.js +12 -0
- package/dist/render/text.d.ts +2 -0
- package/dist/render/text.js +27 -0
- package/dist/render/tree.d.ts +2 -0
- package/dist/render/tree.js +10 -0
- package/dist/render/types.d.ts +2 -0
- package/dist/render/types.js +1 -0
- package/dist/shared/@outfitter/cli-0ggcy7fa.js +20 -0
- package/dist/shared/@outfitter/cli-0psys2vm.js +7 -0
- package/dist/shared/@outfitter/cli-1bghjef6.js +352 -0
- package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +45 -0
- package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +50 -0
- package/dist/shared/@outfitter/cli-33e97cjs.d.ts +42 -0
- package/dist/shared/@outfitter/cli-34fqr7bp.js +37 -0
- package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +97 -0
- package/dist/shared/@outfitter/cli-3dxmmy4c.d.ts +20 -0
- package/dist/shared/@outfitter/cli-3f12z5kf.d.ts +83 -0
- package/dist/shared/@outfitter/cli-3hp8qwx3.js +11 -0
- package/dist/shared/@outfitter/cli-3t2zaenc.d.ts +59 -0
- package/dist/shared/@outfitter/cli-4cb5g831.d.ts +147 -0
- package/dist/shared/@outfitter/cli-4w2a1rfy.d.ts +23 -0
- package/dist/shared/@outfitter/cli-4x6pqnez.js +20 -0
- package/dist/shared/@outfitter/cli-671sxkhj.js +146 -0
- package/dist/shared/@outfitter/cli-6bztk73z.d.ts +51 -0
- package/dist/shared/@outfitter/cli-6fxffp8k.js +1 -0
- package/dist/shared/@outfitter/cli-6j9qynm8.js +118 -0
- package/dist/shared/@outfitter/cli-6m988kh0.d.ts +61 -0
- package/dist/shared/@outfitter/cli-72kg550t.d.ts +53 -0
- package/dist/shared/@outfitter/cli-74ba31gz.js +134 -0
- package/dist/shared/@outfitter/cli-7gnrb8cr.js +214 -0
- package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +59 -0
- package/dist/shared/@outfitter/cli-7nm6edvh.d.ts +17 -0
- package/dist/shared/@outfitter/cli-85fg2vr5.js +123 -0
- package/dist/shared/@outfitter/cli-8a8xrzhy.js +20 -0
- package/dist/shared/@outfitter/cli-8aa1vhdn.d.ts +119 -0
- package/dist/shared/@outfitter/cli-8bwaw3pz.js +7 -0
- package/dist/shared/@outfitter/cli-8j5k6mr3.js +71 -0
- package/dist/shared/@outfitter/cli-8rx4g3s5.d.ts +41 -0
- package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +223 -0
- package/dist/shared/@outfitter/cli-96b2p4td.d.ts +56 -0
- package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +190 -0
- package/dist/shared/@outfitter/cli-9mtjjykw.js +67 -0
- package/dist/shared/@outfitter/cli-9nbyj2bt.js +128 -0
- package/dist/shared/@outfitter/cli-a4q87517.d.ts +64 -0
- package/dist/shared/@outfitter/cli-afhjqmg3.js +63 -0
- package/dist/shared/@outfitter/cli-an9j0h80.js +117 -0
- package/dist/shared/@outfitter/cli-ay411nbr.js +122 -0
- package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +132 -0
- package/dist/shared/@outfitter/cli-b5c2k0d7.js +39 -0
- package/dist/shared/@outfitter/cli-b5epywry.js +1 -0
- package/dist/shared/@outfitter/cli-bc17qeh2.js +19 -0
- package/dist/shared/@outfitter/cli-bcmcaz1b.js +23 -0
- package/dist/shared/@outfitter/cli-bf3vma4q.js +61 -0
- package/dist/shared/@outfitter/cli-c8q4f71g.js +144 -0
- package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +30 -0
- package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +53 -0
- package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +42 -0
- package/dist/shared/@outfitter/cli-cs45xd6q.js +59 -0
- package/dist/shared/@outfitter/cli-d7jpshq5.d.ts +128 -0
- package/dist/shared/@outfitter/cli-d9ad0rqj.js +75 -0
- package/dist/shared/@outfitter/cli-daw296mv.js +61 -0
- package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +91 -0
- package/dist/shared/@outfitter/cli-e73v3qqy.d.ts +93 -0
- package/dist/shared/@outfitter/cli-efy6jfcj.js +52 -0
- package/dist/shared/@outfitter/cli-en6zn6sj.js +1 -0
- package/dist/shared/@outfitter/cli-ep2cvtk8.js +48 -0
- package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +300 -0
- package/dist/shared/@outfitter/cli-f75h8e94.js +7 -0
- package/dist/shared/@outfitter/cli-fakncnjp.d.ts +106 -0
- package/dist/shared/@outfitter/cli-feb5j90n.js +94 -0
- package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +66 -0
- package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +328 -0
- package/dist/shared/@outfitter/cli-j19a91ck.js +30 -0
- package/dist/shared/@outfitter/cli-j4n8gaf3.js +95 -0
- package/dist/shared/@outfitter/cli-jejfypgf.js +85 -0
- package/dist/shared/@outfitter/cli-jhcdwvpn.js +135 -0
- package/dist/shared/@outfitter/cli-jjemfdta.js +85 -0
- package/dist/shared/@outfitter/cli-kc84wmch.js +267 -0
- package/dist/shared/@outfitter/cli-ktqme80d.js +7 -0
- package/dist/shared/@outfitter/cli-mhamvbty.d.ts +34 -0
- package/dist/shared/@outfitter/cli-mq0jp15z.js +1 -0
- package/dist/shared/@outfitter/cli-mymyavvj.d.ts +26 -0
- package/dist/shared/@outfitter/cli-n17gt1dz.js +19 -0
- package/dist/shared/@outfitter/cli-n9dbh0hp.js +51 -0
- package/dist/shared/@outfitter/cli-nvvc92c8.js +128 -0
- package/dist/shared/@outfitter/cli-p1m5dhrs.js +169 -0
- package/dist/shared/@outfitter/cli-p38sfxyk.js +25 -0
- package/dist/shared/@outfitter/cli-p3dqm1vd.js +22 -0
- package/dist/shared/@outfitter/cli-p9j1phge.js +20 -0
- package/dist/shared/@outfitter/cli-pkxmzavm.js +62 -0
- package/dist/shared/@outfitter/cli-q8r6jarq.d.ts +24 -0
- package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +71 -0
- package/dist/shared/@outfitter/cli-qjfc3j11.d.ts +112 -0
- package/dist/shared/@outfitter/cli-qp4cbhqr.js +70 -0
- package/dist/shared/@outfitter/cli-s0kkx9m1.d.ts +164 -0
- package/dist/shared/@outfitter/cli-snxj55n6.js +43 -0
- package/dist/shared/@outfitter/cli-swwxvjvm.d.ts +24 -0
- package/dist/shared/@outfitter/cli-sx67mmfx.d.ts +98 -0
- package/dist/shared/@outfitter/cli-tarpsa8a.js +30 -0
- package/dist/shared/@outfitter/cli-thvzhjd1.js +126 -0
- package/dist/shared/@outfitter/cli-tqewy503.d.ts +36 -0
- package/dist/shared/@outfitter/cli-ttt7r0j7.d.ts +253 -0
- package/dist/shared/@outfitter/cli-tvw1xrdj.js +20 -0
- package/dist/shared/@outfitter/cli-v1tzwxkt.js +32 -0
- package/dist/shared/@outfitter/cli-vd60dj65.js +1 -0
- package/dist/shared/@outfitter/cli-vp88gxev.js +279 -0
- package/dist/shared/@outfitter/cli-vstbkzky.d.ts +74 -0
- package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +54 -0
- package/dist/shared/@outfitter/cli-w5y3xepp.js +20 -0
- package/dist/shared/@outfitter/cli-x4cavvc0.js +1 -0
- package/dist/shared/@outfitter/cli-xep6v2c0.js +52 -0
- package/dist/shared/@outfitter/cli-xg5y5fhk.js +86 -0
- package/dist/shared/@outfitter/cli-xsaheemc.d.ts +248 -0
- package/dist/shared/@outfitter/cli-xvqtqjxk.js +82 -0
- package/dist/shared/@outfitter/cli-y25tt8nc.d.ts +48 -0
- package/dist/shared/@outfitter/cli-zact3325.js +152 -0
- package/dist/shared/@outfitter/cli-zx598p8q.d.ts +26 -0
- package/dist/streaming/ansi.d.ts +2 -0
- package/dist/streaming/ansi.js +8 -0
- package/dist/streaming/index.d.ts +4 -0
- package/dist/streaming/index.js +17 -0
- package/dist/streaming/spinner.d.ts +3 -0
- package/dist/streaming/spinner.js +10 -0
- package/dist/streaming/writer.d.ts +2 -0
- package/dist/streaming/writer.js +9 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +13 -0
- package/dist/terminal/detection.d.ts +2 -0
- package/dist/terminal/detection.js +23 -0
- package/dist/terminal/index.d.ts +2 -0
- package/dist/terminal/index.js +24 -0
- package/dist/theme/context.d.ts +9 -0
- package/dist/theme/context.js +14 -0
- package/dist/theme/create.d.ts +8 -0
- package/dist/theme/create.js +12 -0
- package/dist/theme/index.d.ts +17 -0
- package/dist/theme/index.js +42 -0
- package/dist/theme/presets/bold.d.ts +8 -0
- package/dist/theme/presets/bold.js +12 -0
- package/dist/theme/presets/default.d.ts +8 -0
- package/dist/theme/presets/default.js +11 -0
- package/dist/theme/presets/index.d.ts +12 -0
- package/dist/theme/presets/index.js +24 -0
- package/dist/theme/presets/minimal.d.ts +8 -0
- package/dist/theme/presets/minimal.js +12 -0
- package/dist/theme/presets/rounded.d.ts +8 -0
- package/dist/theme/presets/rounded.js +12 -0
- package/dist/theme/resolve.d.ts +8 -0
- package/dist/theme/resolve.js +11 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/types.js +1 -0
- package/dist/tree/index.d.ts +3 -0
- package/dist/tree/index.js +11 -0
- package/dist/types.d.ts +1 -252
- package/dist/types.js +1 -1
- package/package.json +228 -20
- package/dist/shared/@outfitter/cli-4yy82cmp.js +0 -20
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { IndicatorCategory } from "./cli-sx67mmfx";
|
|
2
|
+
import { DelimiterName } from "./cli-hnpbqmc8";
|
|
3
|
+
import { TreeGuideStyle } from "./cli-3b7ed3rm";
|
|
4
|
+
import { SpinnerStyle } from "./cli-e5ms1y0x";
|
|
5
|
+
import { BorderCharacters, BorderStyle } from "./cli-fakncnjp";
|
|
6
|
+
/**
|
|
7
|
+
* A glyph with unicode and ASCII fallback representations.
|
|
8
|
+
*
|
|
9
|
+
* Used for characters that may not be available in all terminals.
|
|
10
|
+
* The appropriate character is selected at runtime based on terminal capability.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const bullet: GlyphPair = { unicode: "•", fallback: "*" };
|
|
15
|
+
* const checkbox: GlyphPair = { unicode: "☑", fallback: "[x]" };
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
interface GlyphPair {
|
|
19
|
+
/** Unicode character for modern terminals */
|
|
20
|
+
unicode: string;
|
|
21
|
+
/** ASCII fallback for limited terminals */
|
|
22
|
+
fallback: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Semantic states that can be mapped to visual markers.
|
|
26
|
+
*
|
|
27
|
+
* These represent the logical state of an item, which themes translate
|
|
28
|
+
* to specific visual representations.
|
|
29
|
+
*/
|
|
30
|
+
type SemanticState = "default" | "current" | "focused" | "checked" | "disabled" | "success" | "warning" | "error" | "info";
|
|
31
|
+
/**
|
|
32
|
+
* Specification for how to render a semantic state marker.
|
|
33
|
+
*
|
|
34
|
+
* Can either reference an existing indicator from the INDICATORS registry,
|
|
35
|
+
* or provide a custom glyph pair.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Reference existing indicator
|
|
40
|
+
* const successMarker: MarkerSpec = {
|
|
41
|
+
* type: "indicator",
|
|
42
|
+
* category: "status",
|
|
43
|
+
* name: "success"
|
|
44
|
+
* };
|
|
45
|
+
*
|
|
46
|
+
* // Custom glyph
|
|
47
|
+
* const starMarker: MarkerSpec = {
|
|
48
|
+
* type: "custom",
|
|
49
|
+
* glyph: { unicode: "★", fallback: "*" }
|
|
50
|
+
* };
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
type MarkerSpec = {
|
|
54
|
+
type: "indicator";
|
|
55
|
+
category: IndicatorCategory;
|
|
56
|
+
name: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: "custom";
|
|
59
|
+
glyph: GlyphPair;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Semantic color tokens as ANSI escape codes.
|
|
63
|
+
*
|
|
64
|
+
* Colors are stored as raw ANSI codes and can be empty strings
|
|
65
|
+
* when colors are disabled.
|
|
66
|
+
*/
|
|
67
|
+
interface ThemeColors {
|
|
68
|
+
/** Green - success messages, completed items */
|
|
69
|
+
success: string;
|
|
70
|
+
/** Yellow - warnings, caution */
|
|
71
|
+
warning: string;
|
|
72
|
+
/** Red - errors, failures */
|
|
73
|
+
error: string;
|
|
74
|
+
/** Blue - informational messages */
|
|
75
|
+
info: string;
|
|
76
|
+
/** Default text color (typically empty string) */
|
|
77
|
+
primary: string;
|
|
78
|
+
/** Gray - secondary text */
|
|
79
|
+
secondary: string;
|
|
80
|
+
/** Dim - de-emphasized text */
|
|
81
|
+
muted: string;
|
|
82
|
+
/** Cyan - interactive elements, highlights */
|
|
83
|
+
accent: string;
|
|
84
|
+
/** Bold - strong emphasis */
|
|
85
|
+
highlight: string;
|
|
86
|
+
/** Cyan + underline - URLs, clickable references */
|
|
87
|
+
link: string;
|
|
88
|
+
/** Bright red - dangerous actions */
|
|
89
|
+
destructive: string;
|
|
90
|
+
/** Dim gray - less prominent than muted */
|
|
91
|
+
subtle: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Default spacing values for various components.
|
|
95
|
+
*/
|
|
96
|
+
interface ThemeSpacing {
|
|
97
|
+
/** Default padding inside boxes (characters) */
|
|
98
|
+
boxPadding: number;
|
|
99
|
+
/** Indentation for nested list items (characters) */
|
|
100
|
+
listIndent: number;
|
|
101
|
+
/** Gap between items in vertical stacks (lines) */
|
|
102
|
+
stackGap: number;
|
|
103
|
+
/** Gap between items in horizontal stacks (characters) */
|
|
104
|
+
horizontalGap: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Complete visual theme configuration.
|
|
108
|
+
*
|
|
109
|
+
* Consolidates all visual primitives (borders, delimiters, markers, guides,
|
|
110
|
+
* colors) into a cohesive design system. Themes can be used as-is (presets)
|
|
111
|
+
* or customized via {@link createVisualTheme}.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* import { defaultTheme, roundedTheme, createVisualTheme } from "@outfitter/cli/theme";
|
|
116
|
+
*
|
|
117
|
+
* // Use a preset
|
|
118
|
+
* const box = renderBox("Hello", { theme: roundedTheme });
|
|
119
|
+
*
|
|
120
|
+
* // Create a custom theme
|
|
121
|
+
* const brandTheme = createVisualTheme({
|
|
122
|
+
* extends: roundedTheme,
|
|
123
|
+
* overrides: {
|
|
124
|
+
* colors: { accent: "\x1b[38;5;39m" },
|
|
125
|
+
* spacing: { boxPadding: 2 }
|
|
126
|
+
* }
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
interface VisualTheme {
|
|
131
|
+
/** Theme identifier */
|
|
132
|
+
name: string;
|
|
133
|
+
/** Border style preset name */
|
|
134
|
+
border: BorderStyle;
|
|
135
|
+
/** Derived border characters for the border style */
|
|
136
|
+
borderChars: BorderCharacters;
|
|
137
|
+
/** Tree guide style for hierarchical displays */
|
|
138
|
+
treeGuide: TreeGuideStyle;
|
|
139
|
+
/** Default delimiter for inline separators */
|
|
140
|
+
delimiter: DelimiterName;
|
|
141
|
+
/** Map of semantic states to marker specifications */
|
|
142
|
+
markers: Record<SemanticState, MarkerSpec>;
|
|
143
|
+
/** Default list bullet glyph */
|
|
144
|
+
listBullet: GlyphPair;
|
|
145
|
+
/** Checkbox glyphs for checked/unchecked states */
|
|
146
|
+
checkbox: {
|
|
147
|
+
checked: GlyphPair;
|
|
148
|
+
unchecked: GlyphPair;
|
|
149
|
+
};
|
|
150
|
+
/** Semantic color tokens */
|
|
151
|
+
colors: ThemeColors;
|
|
152
|
+
/** Default spacing values */
|
|
153
|
+
spacing: ThemeSpacing;
|
|
154
|
+
/** Default spinner animation style */
|
|
155
|
+
spinner: SpinnerStyle;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Partial theme for overriding specific properties.
|
|
159
|
+
*
|
|
160
|
+
* Used by {@link createVisualTheme} to allow partial customization
|
|
161
|
+
* while inheriting defaults.
|
|
162
|
+
*/
|
|
163
|
+
type PartialVisualTheme = { [K in keyof VisualTheme]? : K extends "colors" ? Partial<ThemeColors> : K extends "spacing" ? Partial<ThemeSpacing> : K extends "markers" ? Partial<Record<SemanticState, MarkerSpec>> : K extends "checkbox" ? Partial<VisualTheme["checkbox"]> : VisualTheme[K] };
|
|
164
|
+
export { GlyphPair, SemanticState, MarkerSpec, ThemeColors, ThemeSpacing, VisualTheme, PartialVisualTheme };
|
|
@@ -0,0 +1,43 @@
|
|
|
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 };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { VisualTheme } from "./cli-s0kkx9m1";
|
|
2
|
+
/**
|
|
3
|
+
* Rounded visual theme.
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Rounded box-drawing corners (╭─╮)
|
|
7
|
+
* - Rounded tree guide style
|
|
8
|
+
* - Softer visual aesthetic
|
|
9
|
+
*
|
|
10
|
+
* Inherits all other properties from {@link defaultTheme}.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { roundedTheme } from "@outfitter/cli/theme/presets";
|
|
15
|
+
*
|
|
16
|
+
* // Use rounded styling
|
|
17
|
+
* const box = renderBox("Hello", { border: roundedTheme.border });
|
|
18
|
+
* // ╭───────╮
|
|
19
|
+
* // │ Hello │
|
|
20
|
+
* // ╰───────╯
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const roundedTheme: VisualTheme;
|
|
24
|
+
export { roundedTheme };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Indicator primitives for CLI output.
|
|
3
|
+
*
|
|
4
|
+
* Provides status symbols, selection indicators, list bullets, and progress
|
|
5
|
+
* markers with unicode and ASCII fallback support.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Categories of indicators available.
|
|
11
|
+
*/
|
|
12
|
+
type IndicatorCategory = "status" | "marker" | "progress" | "triangle" | "special" | "directional" | "math";
|
|
13
|
+
/**
|
|
14
|
+
* An indicator with unicode and fallback representations.
|
|
15
|
+
*/
|
|
16
|
+
interface IndicatorSet {
|
|
17
|
+
/** Unicode character for modern terminals */
|
|
18
|
+
unicode: string;
|
|
19
|
+
/** ASCII fallback for limited terminals */
|
|
20
|
+
fallback: string;
|
|
21
|
+
/** Optional semantic color name */
|
|
22
|
+
color?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* All available indicators organized by category.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { INDICATORS, getIndicator } from "@outfitter/cli/render";
|
|
30
|
+
*
|
|
31
|
+
* // Access directly
|
|
32
|
+
* console.log(INDICATORS.status.success.unicode); // "✔"
|
|
33
|
+
*
|
|
34
|
+
* // Or use helper
|
|
35
|
+
* console.log(getIndicator("status", "success")); // "✔" or "[ok]"
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare const INDICATORS: Record<IndicatorCategory, Record<string, IndicatorSet>>;
|
|
39
|
+
/**
|
|
40
|
+
* Detects if the terminal supports Unicode characters.
|
|
41
|
+
*
|
|
42
|
+
* Checks for:
|
|
43
|
+
* - CI environments (usually support unicode)
|
|
44
|
+
* - Windows Terminal / ConEmu
|
|
45
|
+
* - TERM containing xterm/vt100
|
|
46
|
+
* - Locale settings
|
|
47
|
+
*
|
|
48
|
+
* @returns true if unicode is likely supported
|
|
49
|
+
*/
|
|
50
|
+
declare function isUnicodeSupported(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Gets an indicator character with automatic unicode/fallback selection.
|
|
53
|
+
*
|
|
54
|
+
* @param category - The indicator category
|
|
55
|
+
* @param name - The indicator name within the category
|
|
56
|
+
* @param forceUnicode - Override unicode detection (useful for testing)
|
|
57
|
+
* @returns The appropriate character for the current terminal
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Automatic detection
|
|
62
|
+
* console.log(getIndicator("status", "success"));
|
|
63
|
+
*
|
|
64
|
+
* // Force unicode
|
|
65
|
+
* console.log(getIndicator("status", "success", true)); // "✔"
|
|
66
|
+
*
|
|
67
|
+
* // Force fallback
|
|
68
|
+
* console.log(getIndicator("status", "success", false)); // "[ok]"
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function getIndicator(category: IndicatorCategory, name: string, forceUnicode?: boolean): string;
|
|
72
|
+
/**
|
|
73
|
+
* Progress indicator styles.
|
|
74
|
+
*/
|
|
75
|
+
type ProgressStyle = "circle" | "vertical" | "horizontal" | "shade";
|
|
76
|
+
/**
|
|
77
|
+
* Gets a progress indicator based on current/max values.
|
|
78
|
+
*
|
|
79
|
+
* @param style - The progress style (circle, vertical, horizontal, shade)
|
|
80
|
+
* @param current - Current progress value
|
|
81
|
+
* @param max - Maximum progress value
|
|
82
|
+
* @param forceUnicode - Override unicode detection
|
|
83
|
+
* @returns The appropriate progress indicator character
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Circle progress at 50%
|
|
88
|
+
* getProgressIndicator("circle", 50, 100); // "◑"
|
|
89
|
+
*
|
|
90
|
+
* // Vertical block at 75%
|
|
91
|
+
* getProgressIndicator("vertical", 6, 8); // "▆"
|
|
92
|
+
*
|
|
93
|
+
* // Horizontal bar at 100%
|
|
94
|
+
* getProgressIndicator("horizontal", 1, 1); // "█"
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function getProgressIndicator(style: ProgressStyle, current: number, max: number, forceUnicode?: boolean): string;
|
|
98
|
+
export { IndicatorCategory, IndicatorSet, INDICATORS, isUnicodeSupported, getIndicator, ProgressStyle, getProgressIndicator };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
defaultTheme
|
|
4
|
+
} from "./cli-cs45xd6q.js";
|
|
5
|
+
import {
|
|
6
|
+
BORDERS,
|
|
7
|
+
init_borders
|
|
8
|
+
} from "./cli-85fg2vr5.js";
|
|
9
|
+
|
|
10
|
+
// packages/cli/src/theme/presets/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 };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
renderList
|
|
4
|
+
} from "./cli-xg5y5fhk.js";
|
|
5
|
+
import {
|
|
6
|
+
LIST_STYLE_META,
|
|
7
|
+
getListStyles
|
|
8
|
+
} from "./cli-kc84wmch.js";
|
|
9
|
+
import {
|
|
10
|
+
getExample
|
|
11
|
+
} from "./cli-xep6v2c0.js";
|
|
12
|
+
import {
|
|
13
|
+
demoSection
|
|
14
|
+
} from "./cli-34fqr7bp.js";
|
|
15
|
+
|
|
16
|
+
// packages/cli/src/demo/renderers/list.ts
|
|
17
|
+
function renderListDemo(config, theme) {
|
|
18
|
+
const showCode = config.showCode ?? true;
|
|
19
|
+
const showDescriptions = config.showDescriptions ?? true;
|
|
20
|
+
const lines = [];
|
|
21
|
+
lines.push(demoSection("List Styles"));
|
|
22
|
+
lines.push("");
|
|
23
|
+
if (showCode) {
|
|
24
|
+
lines.push('import { renderList } from "@outfitter/cli/render";');
|
|
25
|
+
lines.push("");
|
|
26
|
+
}
|
|
27
|
+
const items = getExample("listItems", config.examples);
|
|
28
|
+
const styles = getListStyles();
|
|
29
|
+
for (const style of styles) {
|
|
30
|
+
const meta = LIST_STYLE_META[style];
|
|
31
|
+
lines.push(`${meta.label.toUpperCase()} STYLE`);
|
|
32
|
+
if (showDescriptions) {
|
|
33
|
+
lines.push(theme.muted(meta.description));
|
|
34
|
+
}
|
|
35
|
+
lines.push("");
|
|
36
|
+
if (showCode) {
|
|
37
|
+
lines.push(`renderList(items, { style: "${style}" })`);
|
|
38
|
+
lines.push("");
|
|
39
|
+
}
|
|
40
|
+
if (style === "checkbox") {
|
|
41
|
+
const output = renderList(items, {
|
|
42
|
+
style,
|
|
43
|
+
checked: new Set([1])
|
|
44
|
+
});
|
|
45
|
+
lines.push(output);
|
|
46
|
+
} else {
|
|
47
|
+
const output = renderList(items, { style });
|
|
48
|
+
lines.push(output);
|
|
49
|
+
}
|
|
50
|
+
lines.push("");
|
|
51
|
+
}
|
|
52
|
+
lines.push(demoSection("Nested Lists"));
|
|
53
|
+
lines.push("");
|
|
54
|
+
const nestedItems = [
|
|
55
|
+
"Top level item",
|
|
56
|
+
{
|
|
57
|
+
text: "Parent with children",
|
|
58
|
+
children: ["Child one", "Child two"]
|
|
59
|
+
},
|
|
60
|
+
"Another top level"
|
|
61
|
+
];
|
|
62
|
+
if (showCode) {
|
|
63
|
+
lines.push("renderList([");
|
|
64
|
+
lines.push(' "Top level item",');
|
|
65
|
+
lines.push(' { text: "Parent with children", children: ["Child one", "Child two"] },');
|
|
66
|
+
lines.push(' "Another top level",');
|
|
67
|
+
lines.push("])");
|
|
68
|
+
lines.push("");
|
|
69
|
+
}
|
|
70
|
+
lines.push(renderList(nestedItems));
|
|
71
|
+
lines.push("");
|
|
72
|
+
lines.push(demoSection("Numbered with Nesting"));
|
|
73
|
+
lines.push("");
|
|
74
|
+
const numberedNested = [
|
|
75
|
+
{
|
|
76
|
+
text: "First section",
|
|
77
|
+
children: [
|
|
78
|
+
{
|
|
79
|
+
text: "Subsection A",
|
|
80
|
+
children: ["Detail i", "Detail ii"]
|
|
81
|
+
},
|
|
82
|
+
"Subsection B"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"Second section"
|
|
86
|
+
];
|
|
87
|
+
if (showCode) {
|
|
88
|
+
lines.push('renderList(items, { style: "number" })');
|
|
89
|
+
lines.push("");
|
|
90
|
+
}
|
|
91
|
+
lines.push(renderList(numberedNested, { style: "number" }));
|
|
92
|
+
lines.push("");
|
|
93
|
+
lines.push(demoSection("Mixed Styles"));
|
|
94
|
+
lines.push("");
|
|
95
|
+
if (showDescriptions) {
|
|
96
|
+
lines.push(theme.muted("Use childStyle to override style for children"));
|
|
97
|
+
lines.push("");
|
|
98
|
+
}
|
|
99
|
+
const mixedItems = [
|
|
100
|
+
{
|
|
101
|
+
text: "Requirements",
|
|
102
|
+
childStyle: "bullet",
|
|
103
|
+
children: ["Must be fast", "Must be reliable"]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
text: "Tasks",
|
|
107
|
+
childStyle: "checkbox",
|
|
108
|
+
children: [
|
|
109
|
+
{ text: "Write tests", checked: true },
|
|
110
|
+
{ text: "Deploy to prod", checked: false }
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
if (showCode) {
|
|
115
|
+
lines.push("renderList([");
|
|
116
|
+
lines.push(' { text: "Requirements", childStyle: "bullet", children: [...] },');
|
|
117
|
+
lines.push(' { text: "Tasks", childStyle: "checkbox", children: [...] },');
|
|
118
|
+
lines.push('], { style: "number" })');
|
|
119
|
+
lines.push("");
|
|
120
|
+
}
|
|
121
|
+
lines.push(renderList(mixedItems, { style: "number" }));
|
|
122
|
+
return lines.join(`
|
|
123
|
+
`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { renderListDemo };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CancelledError, PromptResult } from "./cli-3f12z5kf";
|
|
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 };
|