@h-rig/cli 0.0.6-alpha.9 → 0.0.6-alpha.90
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 +1 -1
- package/dist/bin/build-rig-binaries.d.ts +2 -0
- package/dist/bin/rig.d.ts +2 -0
- package/dist/bin/rig.js +11052 -6668
- package/dist/src/app/board.d.ts +23 -0
- package/dist/src/app/board.js +1786 -0
- package/dist/src/app/drone-ui.d.ts +37 -0
- package/dist/src/app/drone-ui.js +294 -0
- package/dist/src/app/theme.d.ts +47 -0
- package/dist/src/app/theme.js +150 -0
- package/dist/src/commands/_async-ui.d.ts +13 -0
- package/dist/src/commands/_async-ui.js +223 -0
- package/dist/src/commands/_authority-runs.d.ts +22 -0
- package/dist/src/commands/_authority-runs.js +2 -3
- package/dist/src/commands/_cli-format.d.ts +49 -0
- package/dist/src/commands/_cli-format.js +447 -0
- package/dist/src/commands/_connection-state.d.ts +44 -0
- package/dist/src/commands/_connection-state.js +30 -11
- package/dist/src/commands/_doctor-checks.d.ts +52 -0
- package/dist/src/commands/_doctor-checks.js +180 -44
- package/dist/src/commands/_help-catalog.d.ts +51 -0
- package/dist/src/commands/_help-catalog.js +442 -0
- package/dist/src/commands/_json-output.d.ts +11 -0
- package/dist/src/commands/_json-output.js +56 -0
- package/dist/src/commands/_operator-surface.d.ts +34 -0
- package/dist/src/commands/_operator-surface.js +220 -0
- package/dist/src/commands/_operator-view.d.ts +30 -0
- package/dist/src/commands/_operator-view.js +803 -73
- package/dist/src/commands/_parsers.d.ts +15 -0
- package/dist/src/commands/_parsers.js +18 -11
- package/dist/src/commands/_paths.d.ts +11 -0
- package/dist/src/commands/_pi-frontend.d.ts +27 -0
- package/dist/src/commands/_pi-frontend.js +742 -0
- package/dist/src/commands/_pi-install.d.ts +42 -0
- package/dist/src/commands/_pi-install.js +5 -4
- package/dist/src/commands/_policy.d.ts +8 -0
- package/dist/src/commands/_policy.js +12 -5
- package/dist/src/commands/_preflight.d.ts +22 -0
- package/dist/src/commands/_preflight.js +190 -128
- package/dist/src/commands/_probes.d.ts +1 -0
- package/dist/src/commands/_run-driver-helpers.d.ts +99 -0
- package/dist/src/commands/_run-driver-helpers.js +75 -22
- package/dist/src/commands/_run-replay.d.ts +24 -0
- package/dist/src/commands/_run-replay.js +142 -0
- package/dist/src/commands/_server-client.d.ts +186 -0
- package/dist/src/commands/_server-client.js +360 -61
- package/dist/src/commands/_snapshot-upload.d.ts +39 -0
- package/dist/src/commands/_snapshot-upload.js +163 -39
- package/dist/src/commands/_spinner.d.ts +25 -0
- package/dist/src/commands/_spinner.js +65 -0
- package/dist/src/commands/_task-picker.d.ts +9 -0
- package/dist/src/commands/_task-picker.js +172 -19
- package/dist/src/commands/agent.d.ts +3 -0
- package/dist/src/commands/agent.js +39 -20
- package/dist/src/commands/browser.d.ts +65 -0
- package/dist/src/commands/browser.js +334 -51
- package/dist/src/commands/connect.d.ts +7 -0
- package/dist/src/commands/connect.js +272 -33
- package/dist/src/commands/dist.d.ts +28 -0
- package/dist/src/commands/dist.js +19 -12
- package/dist/src/commands/doctor.d.ts +3 -0
- package/dist/src/commands/doctor.js +378 -45
- package/dist/src/commands/github.d.ts +3 -0
- package/dist/src/commands/github.js +375 -53
- package/dist/src/commands/inbox.d.ts +30 -0
- package/dist/src/commands/inbox.js +760 -70
- package/dist/src/commands/init.d.ts +74 -0
- package/dist/src/commands/init.js +963 -119
- package/dist/src/commands/inspect.d.ts +3 -0
- package/dist/src/commands/inspect.js +588 -32
- package/dist/src/commands/inspector.d.ts +3 -0
- package/dist/src/commands/inspector.js +20 -13
- package/dist/src/commands/pi.d.ts +3 -0
- package/dist/src/commands/pi.js +177 -0
- package/dist/src/commands/plugin.d.ts +16 -0
- package/dist/src/commands/plugin.js +95 -27
- package/dist/src/commands/profile-and-review.d.ts +4 -0
- package/dist/src/commands/profile-and-review.js +26 -19
- package/dist/src/commands/queue.d.ts +3 -0
- package/dist/src/commands/queue.js +32 -12
- package/dist/src/commands/remote.d.ts +3 -0
- package/dist/src/commands/remote.js +43 -36
- package/dist/src/commands/repo-git-harness.d.ts +5 -0
- package/dist/src/commands/repo-git-harness.js +22 -15
- package/dist/src/commands/run.d.ts +3 -0
- package/dist/src/commands/run.js +1379 -159
- package/dist/src/commands/server.d.ts +7 -0
- package/dist/src/commands/server.js +502 -57
- package/dist/src/commands/setup.d.ts +16 -0
- package/dist/src/commands/setup.js +390 -63
- package/dist/src/commands/stats.d.ts +12 -0
- package/dist/src/commands/stats.js +1051 -0
- package/dist/src/commands/task-report-bug.d.ts +19 -0
- package/dist/src/commands/task-report-bug.js +260 -62
- package/dist/src/commands/task-run-driver.d.ts +132 -0
- package/dist/src/commands/task-run-driver.js +886 -130
- package/dist/src/commands/task.d.ts +14 -0
- package/dist/src/commands/task.js +1644 -314
- package/dist/src/commands/test.d.ts +3 -0
- package/dist/src/commands/test.js +15 -8
- package/dist/src/commands/workspace.d.ts +3 -0
- package/dist/src/commands/workspace.js +18 -11
- package/dist/src/commands.d.ts +29 -0
- package/dist/src/commands.js +10967 -6637
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +10168 -5787
- package/dist/src/launcher.d.ts +61 -0
- package/dist/src/launcher.js +77 -13
- package/dist/src/report-bug.d.ts +44 -0
- package/dist/src/report-bug.js +3 -3
- package/dist/src/runner.d.ts +47 -0
- package/dist/src/runner.js +16 -22
- package/dist/src/withMutedConsole.d.ts +2 -0
- package/package.json +13 -6
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare function droneIntro(title: string, subtitle?: string): void;
|
|
2
|
+
export declare function droneOutro(text: string): void;
|
|
3
|
+
export declare function droneNote(message: string, title?: string): void;
|
|
4
|
+
export declare function droneStep(text: string): void;
|
|
5
|
+
export declare function droneInfo(text: string): void;
|
|
6
|
+
export declare function droneWarn(text: string): void;
|
|
7
|
+
export declare function droneError(text: string): void;
|
|
8
|
+
export declare function droneCancel(text: string): void;
|
|
9
|
+
/** Clack-spinner-shaped adapter over the micro-drone TTY spinner. */
|
|
10
|
+
export declare function droneSpinner(): {
|
|
11
|
+
start(message: string): void;
|
|
12
|
+
stop(message?: string): void;
|
|
13
|
+
error(message?: string): void;
|
|
14
|
+
};
|
|
15
|
+
type DroneSelectOption<T extends string> = {
|
|
16
|
+
value: T;
|
|
17
|
+
label: string;
|
|
18
|
+
hint?: string;
|
|
19
|
+
};
|
|
20
|
+
/** Drone-styled select. Returns null on cancel (esc / ctrl+c / q). */
|
|
21
|
+
export declare function droneSelect<T extends string>(input: {
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly options: readonly DroneSelectOption<T>[];
|
|
24
|
+
readonly initialValue?: T;
|
|
25
|
+
}): Promise<T | null>;
|
|
26
|
+
/** Drone-styled text input. Returns null on cancel. */
|
|
27
|
+
export declare function droneText(input: {
|
|
28
|
+
readonly message: string;
|
|
29
|
+
readonly placeholder?: string;
|
|
30
|
+
readonly initialValue?: string;
|
|
31
|
+
}): Promise<string | null>;
|
|
32
|
+
/** Drone-styled yes/no. Returns null on cancel. */
|
|
33
|
+
export declare function droneConfirm(input: {
|
|
34
|
+
readonly message: string;
|
|
35
|
+
readonly initialValue?: boolean;
|
|
36
|
+
}): Promise<boolean | null>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/app/drone-ui.ts
|
|
3
|
+
import { ProcessTerminal, TUI, Text, Input, SelectList, matchesKey } from "@earendil-works/pi-tui";
|
|
4
|
+
|
|
5
|
+
// packages/cli/src/app/theme.ts
|
|
6
|
+
var RIG_PALETTE = {
|
|
7
|
+
ink: "#f2f3f6",
|
|
8
|
+
ink2: "#aeb0ba",
|
|
9
|
+
ink3: "#6c6e79",
|
|
10
|
+
ink4: "#44464f",
|
|
11
|
+
accent: "#ccff4d",
|
|
12
|
+
accentDim: "#a9d63f",
|
|
13
|
+
cyan: "#56d8ff",
|
|
14
|
+
red: "#ff5d5d",
|
|
15
|
+
yellow: "#ffd24d"
|
|
16
|
+
};
|
|
17
|
+
function hexToRgb(hex) {
|
|
18
|
+
const value = hex.replace("#", "");
|
|
19
|
+
return [
|
|
20
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
21
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
22
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
function fg(hex) {
|
|
26
|
+
const [r, g, b] = hexToRgb(hex);
|
|
27
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
28
|
+
}
|
|
29
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
30
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
31
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
32
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
33
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
34
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
35
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
36
|
+
var red = fg(RIG_PALETTE.red);
|
|
37
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
38
|
+
function bold(text) {
|
|
39
|
+
return `\x1B[1m${text}\x1B[22m`;
|
|
40
|
+
}
|
|
41
|
+
var DRONE_ART = [
|
|
42
|
+
" .-=-. .-=-. ",
|
|
43
|
+
" ( !!! ) ( !!! ) ",
|
|
44
|
+
" '-=-'._ _.'-=-' ",
|
|
45
|
+
" '._ _.' ",
|
|
46
|
+
" '=$$$$$$$=.' ",
|
|
47
|
+
" =$$$$$$$$$$$= ",
|
|
48
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
49
|
+
" $$$@@ @@$$$ ",
|
|
50
|
+
" $$@ ? @$$$ ",
|
|
51
|
+
" $$$@ '-' @$$$ ",
|
|
52
|
+
" $$$@@ @@$$$ ",
|
|
53
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
54
|
+
" =$$$$$$$$$$$= ",
|
|
55
|
+
" '=$$$$$$$=.' ",
|
|
56
|
+
" _.' '._ ",
|
|
57
|
+
" .-=-.' '.-=-. ",
|
|
58
|
+
" ( !!! ) ( !!! ) ",
|
|
59
|
+
" '-=-' '-=-' "
|
|
60
|
+
];
|
|
61
|
+
var EYE_FRAMES = ["@", "o", "."];
|
|
62
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
63
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
64
|
+
var MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
|
|
65
|
+
function microDroneFrame(tick) {
|
|
66
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
67
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
68
|
+
return `(${blade})${eye}(${blade})`;
|
|
69
|
+
}
|
|
70
|
+
var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => microDroneFrame(index));
|
|
71
|
+
function renderMicroDroneFrame(tick) {
|
|
72
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
73
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
74
|
+
return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// packages/cli/src/commands/_spinner.ts
|
|
78
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
79
|
+
function createTtySpinner(input) {
|
|
80
|
+
const output = input.output ?? process.stdout;
|
|
81
|
+
const isTty = output.isTTY === true;
|
|
82
|
+
const frames = input.frames && input.frames.length > 0 ? input.frames : SPINNER_FRAMES;
|
|
83
|
+
let label = input.label;
|
|
84
|
+
let frame = 0;
|
|
85
|
+
let paused = false;
|
|
86
|
+
let stopped = false;
|
|
87
|
+
let lastPrintedLabel = "";
|
|
88
|
+
const render = () => {
|
|
89
|
+
if (stopped || paused)
|
|
90
|
+
return;
|
|
91
|
+
if (!isTty) {
|
|
92
|
+
if (label !== lastPrintedLabel) {
|
|
93
|
+
output.write(`${label}
|
|
94
|
+
`);
|
|
95
|
+
lastPrintedLabel = label;
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
frame = (frame + 1) % frames.length;
|
|
100
|
+
const glyph = frames[frame] ?? frames[0] ?? "";
|
|
101
|
+
output.write(`\r\x1B[2K${input.styleFrame ? input.styleFrame(glyph) : glyph} ${label}`);
|
|
102
|
+
};
|
|
103
|
+
const clearLine = () => {
|
|
104
|
+
if (isTty)
|
|
105
|
+
output.write("\r\x1B[2K");
|
|
106
|
+
};
|
|
107
|
+
render();
|
|
108
|
+
const timer = isTty ? setInterval(render, input.intervalMs ?? 120) : null;
|
|
109
|
+
return {
|
|
110
|
+
setLabel(next) {
|
|
111
|
+
label = next;
|
|
112
|
+
render();
|
|
113
|
+
},
|
|
114
|
+
pause() {
|
|
115
|
+
paused = true;
|
|
116
|
+
clearLine();
|
|
117
|
+
},
|
|
118
|
+
resume() {
|
|
119
|
+
if (stopped)
|
|
120
|
+
return;
|
|
121
|
+
paused = false;
|
|
122
|
+
render();
|
|
123
|
+
},
|
|
124
|
+
stop(finalLine) {
|
|
125
|
+
if (stopped)
|
|
126
|
+
return;
|
|
127
|
+
stopped = true;
|
|
128
|
+
if (timer)
|
|
129
|
+
clearInterval(timer);
|
|
130
|
+
clearLine();
|
|
131
|
+
if (finalLine)
|
|
132
|
+
output.write(`${finalLine}
|
|
133
|
+
`);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// packages/cli/src/app/drone-ui.ts
|
|
139
|
+
var isTty = () => Boolean(process.stdout.isTTY);
|
|
140
|
+
function hairline(width = Math.min(process.stdout.columns ?? 80, 100)) {
|
|
141
|
+
return ink4("\u2500".repeat(Math.max(10, width)));
|
|
142
|
+
}
|
|
143
|
+
function droneIntro(title, subtitle) {
|
|
144
|
+
console.log("");
|
|
145
|
+
console.log(` ${accent("\u258D")}${bold(ink(title))}${subtitle ? ink3(` \u2014 ${subtitle}`) : ""}`);
|
|
146
|
+
console.log(hairline());
|
|
147
|
+
}
|
|
148
|
+
function droneOutro(text) {
|
|
149
|
+
console.log(hairline());
|
|
150
|
+
console.log(` ${accent("\u25C6")} ${ink2(text)}`);
|
|
151
|
+
console.log("");
|
|
152
|
+
}
|
|
153
|
+
function droneNote(message, title) {
|
|
154
|
+
if (title)
|
|
155
|
+
console.log(` ${accentDim("\u25C7")} ${bold(ink2(title))}`);
|
|
156
|
+
for (const line of message.split(`
|
|
157
|
+
`)) {
|
|
158
|
+
console.log(` ${ink4("\u2502")} ${line}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function droneStep(text) {
|
|
162
|
+
console.log(` ${accent("\u203A")} ${ink(text)}`);
|
|
163
|
+
}
|
|
164
|
+
function droneInfo(text) {
|
|
165
|
+
console.log(` ${cyan("\xB7")} ${ink2(text)}`);
|
|
166
|
+
}
|
|
167
|
+
function droneWarn(text) {
|
|
168
|
+
console.log(` ${yellow("\u25B2")} ${ink2(text)}`);
|
|
169
|
+
}
|
|
170
|
+
function droneError(text) {
|
|
171
|
+
console.log(` ${red("\u2716")} ${ink2(text)}`);
|
|
172
|
+
}
|
|
173
|
+
function droneCancel(text) {
|
|
174
|
+
console.log(` ${red("\u2716")} ${ink3(text)}`);
|
|
175
|
+
}
|
|
176
|
+
function droneSpinner() {
|
|
177
|
+
let active = null;
|
|
178
|
+
return {
|
|
179
|
+
start(message) {
|
|
180
|
+
active = createTtySpinner({
|
|
181
|
+
label: message,
|
|
182
|
+
frames: MICRO_DRONE_FRAMES,
|
|
183
|
+
styleFrame: (frame) => renderMicroDroneFrame(Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame)))
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
stop(message) {
|
|
187
|
+
active?.stop(message ? ` ${accent("\u25C6")} ${ink2(message)}` : undefined);
|
|
188
|
+
active = null;
|
|
189
|
+
},
|
|
190
|
+
error(message) {
|
|
191
|
+
active?.stop(message ? ` ${red("\u2716")} ${ink2(message)}` : undefined);
|
|
192
|
+
active = null;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
var SELECT_THEME = {
|
|
197
|
+
selectedPrefix: (text) => accent(text),
|
|
198
|
+
selectedText: (text) => bold(ink(text)),
|
|
199
|
+
description: (text) => ink3(text),
|
|
200
|
+
scrollInfo: (text) => ink4(text),
|
|
201
|
+
noMatch: (text) => ink3(text)
|
|
202
|
+
};
|
|
203
|
+
async function runMiniTui(build) {
|
|
204
|
+
const terminal = new ProcessTerminal;
|
|
205
|
+
const tui = new TUI(terminal);
|
|
206
|
+
let settled = false;
|
|
207
|
+
return await new Promise((resolve) => {
|
|
208
|
+
const finish = (result) => {
|
|
209
|
+
if (settled)
|
|
210
|
+
return;
|
|
211
|
+
settled = true;
|
|
212
|
+
tui.stop();
|
|
213
|
+
resolve(result);
|
|
214
|
+
};
|
|
215
|
+
build(tui, finish);
|
|
216
|
+
tui.start();
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
async function droneSelect(input) {
|
|
220
|
+
if (!isTty() || input.options.length === 0) {
|
|
221
|
+
return input.initialValue ?? input.options[0]?.value ?? null;
|
|
222
|
+
}
|
|
223
|
+
return runMiniTui((tui, finish) => {
|
|
224
|
+
tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}`));
|
|
225
|
+
const items = input.options.map((option) => ({
|
|
226
|
+
value: option.value,
|
|
227
|
+
label: option.label,
|
|
228
|
+
...option.hint ? { description: option.hint } : {}
|
|
229
|
+
}));
|
|
230
|
+
const list = new SelectList(items, Math.min(items.length, 12), SELECT_THEME);
|
|
231
|
+
const initialIndex = input.initialValue ? items.findIndex((item) => item.value === input.initialValue) : -1;
|
|
232
|
+
if (initialIndex > 0)
|
|
233
|
+
list.setSelectedIndex(initialIndex);
|
|
234
|
+
list.onSelect = (item) => finish(item.value);
|
|
235
|
+
list.onCancel = () => finish(null);
|
|
236
|
+
tui.addChild(list);
|
|
237
|
+
tui.addChild(new Text(ink4(" \u2191\u2193 navigate \xB7 enter select \xB7 esc cancel")));
|
|
238
|
+
tui.setFocus(list);
|
|
239
|
+
tui.addInputListener((data) => {
|
|
240
|
+
if (matchesKey(data, "ctrl+c") || matchesKey(data, "escape")) {
|
|
241
|
+
finish(null);
|
|
242
|
+
return { consume: true };
|
|
243
|
+
}
|
|
244
|
+
return;
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
async function droneText(input) {
|
|
249
|
+
if (!isTty())
|
|
250
|
+
return input.initialValue ?? null;
|
|
251
|
+
return runMiniTui((tui, finish) => {
|
|
252
|
+
tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}${input.placeholder ? ink4(` (${input.placeholder})`) : ""}`));
|
|
253
|
+
const field = new Input;
|
|
254
|
+
if (input.initialValue)
|
|
255
|
+
field.setValue(input.initialValue);
|
|
256
|
+
field.onSubmit = (value) => finish(value);
|
|
257
|
+
field.onEscape = () => finish(null);
|
|
258
|
+
tui.addChild(field);
|
|
259
|
+
tui.addChild(new Text(ink4(" enter submit \xB7 esc cancel")));
|
|
260
|
+
tui.setFocus(field);
|
|
261
|
+
tui.addInputListener((data) => {
|
|
262
|
+
if (matchesKey(data, "ctrl+c")) {
|
|
263
|
+
finish(null);
|
|
264
|
+
return { consume: true };
|
|
265
|
+
}
|
|
266
|
+
return;
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
async function droneConfirm(input) {
|
|
271
|
+
const answer = await droneSelect({
|
|
272
|
+
message: input.message,
|
|
273
|
+
options: [
|
|
274
|
+
{ value: "yes", label: "Yes" },
|
|
275
|
+
{ value: "no", label: "No" }
|
|
276
|
+
],
|
|
277
|
+
initialValue: input.initialValue === false ? "no" : "yes"
|
|
278
|
+
});
|
|
279
|
+
return answer === null ? null : answer === "yes";
|
|
280
|
+
}
|
|
281
|
+
export {
|
|
282
|
+
droneWarn,
|
|
283
|
+
droneText,
|
|
284
|
+
droneStep,
|
|
285
|
+
droneSpinner,
|
|
286
|
+
droneSelect,
|
|
287
|
+
droneOutro,
|
|
288
|
+
droneNote,
|
|
289
|
+
droneIntro,
|
|
290
|
+
droneInfo,
|
|
291
|
+
droneError,
|
|
292
|
+
droneConfirm,
|
|
293
|
+
droneCancel
|
|
294
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const RIG_PALETTE: {
|
|
2
|
+
/** --ink: primary text */
|
|
3
|
+
readonly ink: "#f2f3f6";
|
|
4
|
+
/** --ink-2: body text */
|
|
5
|
+
readonly ink2: "#aeb0ba";
|
|
6
|
+
/** --ink-3: muted */
|
|
7
|
+
readonly ink3: "#6c6e79";
|
|
8
|
+
/** --ink-4: faint */
|
|
9
|
+
readonly ink4: "#44464f";
|
|
10
|
+
/** --ac: acid green accent */
|
|
11
|
+
readonly accent: "#ccff4d";
|
|
12
|
+
/** --ac-dim */
|
|
13
|
+
readonly accentDim: "#a9d63f";
|
|
14
|
+
/** --ac-2: cyan secondary */
|
|
15
|
+
readonly cyan: "#56d8ff";
|
|
16
|
+
/** status colors tuned to sit on the dark site bg */
|
|
17
|
+
readonly red: "#ff5d5d";
|
|
18
|
+
readonly yellow: "#ffd24d";
|
|
19
|
+
};
|
|
20
|
+
/** 24-bit foreground colorizer. */
|
|
21
|
+
export declare function fg(hex: string): (text: string) => string;
|
|
22
|
+
export declare const ink: (text: string) => string;
|
|
23
|
+
export declare const ink2: (text: string) => string;
|
|
24
|
+
export declare const ink3: (text: string) => string;
|
|
25
|
+
export declare const ink4: (text: string) => string;
|
|
26
|
+
export declare const accent: (text: string) => string;
|
|
27
|
+
export declare const accentDim: (text: string) => string;
|
|
28
|
+
export declare const cyan: (text: string) => string;
|
|
29
|
+
export declare const red: (text: string) => string;
|
|
30
|
+
export declare const yellow: (text: string) => string;
|
|
31
|
+
export declare function bold(text: string): string;
|
|
32
|
+
/** Run-status color, matching the site's pipeline color story. */
|
|
33
|
+
export declare function statusColor(status: string): (text: string) => string;
|
|
34
|
+
/** The braille spinner the site's hero terminal mirrors. */
|
|
35
|
+
export declare const RIG_SPINNER_FRAMES: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
36
|
+
/**
|
|
37
|
+
* Render one animation frame of the drone. `tick` drives rotor rotation and
|
|
38
|
+
* the eye pulse — call with an incrementing counter (the site advances the
|
|
39
|
+
* rotor every 4 ticks and pulses the eye on a sine).
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderDroneFrame(tick: number): string[];
|
|
42
|
+
export declare const DRONE_WIDTH: number;
|
|
43
|
+
export declare const DRONE_HEIGHT: 18;
|
|
44
|
+
export declare function microDroneFrame(tick: number): string;
|
|
45
|
+
export declare const MICRO_DRONE_FRAMES: readonly string[];
|
|
46
|
+
/** Truecolor micro-drone: cyan rotors, acid eye — site colors. */
|
|
47
|
+
export declare function renderMicroDroneFrame(tick: number): string;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/app/theme.ts
|
|
3
|
+
var RIG_PALETTE = {
|
|
4
|
+
ink: "#f2f3f6",
|
|
5
|
+
ink2: "#aeb0ba",
|
|
6
|
+
ink3: "#6c6e79",
|
|
7
|
+
ink4: "#44464f",
|
|
8
|
+
accent: "#ccff4d",
|
|
9
|
+
accentDim: "#a9d63f",
|
|
10
|
+
cyan: "#56d8ff",
|
|
11
|
+
red: "#ff5d5d",
|
|
12
|
+
yellow: "#ffd24d"
|
|
13
|
+
};
|
|
14
|
+
function hexToRgb(hex) {
|
|
15
|
+
const value = hex.replace("#", "");
|
|
16
|
+
return [
|
|
17
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
18
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
19
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
function fg(hex) {
|
|
23
|
+
const [r, g, b] = hexToRgb(hex);
|
|
24
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
25
|
+
}
|
|
26
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
27
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
28
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
29
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
30
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
31
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
32
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
33
|
+
var red = fg(RIG_PALETTE.red);
|
|
34
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
35
|
+
function bold(text) {
|
|
36
|
+
return `\x1B[1m${text}\x1B[22m`;
|
|
37
|
+
}
|
|
38
|
+
function statusColor(status) {
|
|
39
|
+
switch (status) {
|
|
40
|
+
case "running":
|
|
41
|
+
return accent;
|
|
42
|
+
case "preparing":
|
|
43
|
+
case "created":
|
|
44
|
+
case "validating":
|
|
45
|
+
case "reviewing":
|
|
46
|
+
case "closing-out":
|
|
47
|
+
return cyan;
|
|
48
|
+
case "needs-attention":
|
|
49
|
+
case "needs_attention":
|
|
50
|
+
return yellow;
|
|
51
|
+
case "failed":
|
|
52
|
+
return red;
|
|
53
|
+
default:
|
|
54
|
+
return ink3;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
var RIG_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
58
|
+
var DRONE_ART = [
|
|
59
|
+
" .-=-. .-=-. ",
|
|
60
|
+
" ( !!! ) ( !!! ) ",
|
|
61
|
+
" '-=-'._ _.'-=-' ",
|
|
62
|
+
" '._ _.' ",
|
|
63
|
+
" '=$$$$$$$=.' ",
|
|
64
|
+
" =$$$$$$$$$$$= ",
|
|
65
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
66
|
+
" $$$@@ @@$$$ ",
|
|
67
|
+
" $$@ ? @$$$ ",
|
|
68
|
+
" $$$@ '-' @$$$ ",
|
|
69
|
+
" $$$@@ @@$$$ ",
|
|
70
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
71
|
+
" =$$$$$$$$$$$= ",
|
|
72
|
+
" '=$$$$$$$=.' ",
|
|
73
|
+
" _.' '._ ",
|
|
74
|
+
" .-=-.' '.-=-. ",
|
|
75
|
+
" ( !!! ) ( !!! ) ",
|
|
76
|
+
" '-=-' '-=-' "
|
|
77
|
+
];
|
|
78
|
+
var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
|
|
79
|
+
var EYE_FRAMES = ["@", "o", "."];
|
|
80
|
+
function droneCharColor(char) {
|
|
81
|
+
if (char === "$" || char === "@")
|
|
82
|
+
return accent;
|
|
83
|
+
if (char === "=" || char === "%")
|
|
84
|
+
return accentDim;
|
|
85
|
+
if (char === "\\" || char === "/")
|
|
86
|
+
return ink3;
|
|
87
|
+
return ink4;
|
|
88
|
+
}
|
|
89
|
+
function renderDroneFrame(tick) {
|
|
90
|
+
const blade = BLADE_FRAMES[Math.floor(tick / 4) % BLADE_FRAMES.length];
|
|
91
|
+
const pulse = Math.sin(tick * 0.07);
|
|
92
|
+
const eye = pulse > 0.45 ? EYE_FRAMES[0] : pulse > -0.1 ? EYE_FRAMES[1] : EYE_FRAMES[2];
|
|
93
|
+
return DRONE_ART.map((line) => {
|
|
94
|
+
let out = "";
|
|
95
|
+
let index = 0;
|
|
96
|
+
while (index < line.length) {
|
|
97
|
+
if (line.startsWith("!!!", index)) {
|
|
98
|
+
out += cyan(blade);
|
|
99
|
+
index += 3;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const char = line[index];
|
|
103
|
+
if (char === "?") {
|
|
104
|
+
out += bold(cyan(eye));
|
|
105
|
+
} else if (char !== " ") {
|
|
106
|
+
out += droneCharColor(char)(char);
|
|
107
|
+
} else {
|
|
108
|
+
out += " ";
|
|
109
|
+
}
|
|
110
|
+
index += 1;
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
116
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
117
|
+
var MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
|
|
118
|
+
function microDroneFrame(tick) {
|
|
119
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
120
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
121
|
+
return `(${blade})${eye}(${blade})`;
|
|
122
|
+
}
|
|
123
|
+
var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => microDroneFrame(index));
|
|
124
|
+
function renderMicroDroneFrame(tick) {
|
|
125
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
126
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
127
|
+
return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
yellow,
|
|
131
|
+
statusColor,
|
|
132
|
+
renderMicroDroneFrame,
|
|
133
|
+
renderDroneFrame,
|
|
134
|
+
red,
|
|
135
|
+
microDroneFrame,
|
|
136
|
+
ink4,
|
|
137
|
+
ink3,
|
|
138
|
+
ink2,
|
|
139
|
+
ink,
|
|
140
|
+
fg,
|
|
141
|
+
cyan,
|
|
142
|
+
bold,
|
|
143
|
+
accentDim,
|
|
144
|
+
accent,
|
|
145
|
+
RIG_SPINNER_FRAMES,
|
|
146
|
+
RIG_PALETTE,
|
|
147
|
+
MICRO_DRONE_FRAMES,
|
|
148
|
+
DRONE_WIDTH,
|
|
149
|
+
DRONE_HEIGHT
|
|
150
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OutputMode } from "@rig/runtime/control-plane/runtime/types";
|
|
2
|
+
export type SpinnerOutput = Pick<NodeJS.WriteStream, "write"> & {
|
|
3
|
+
readonly isTTY?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type WithSpinnerOptions = {
|
|
6
|
+
/** Final line left behind on success. Default: the spinner line is erased. */
|
|
7
|
+
readonly doneLabel?: string;
|
|
8
|
+
/** Pass context.outputMode; "json" suppresses all spinner output. */
|
|
9
|
+
readonly outputMode?: OutputMode;
|
|
10
|
+
/** Stream override for tests. Defaults to process.stderr. */
|
|
11
|
+
readonly output?: SpinnerOutput;
|
|
12
|
+
};
|
|
13
|
+
export declare function withSpinner<T>(label: string, work: (update: (label: string) => void) => Promise<T>, options?: WithSpinnerOptions): Promise<T>;
|