@h-rig/cli 0.0.6-alpha.77 → 0.0.6-alpha.79
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/dist/bin/build-rig-binaries.d.ts +2 -0
- package/dist/bin/rig.d.ts +2 -0
- package/dist/bin/rig.js +10214 -9309
- 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/{commands/_tui-theme.js → app/theme.js} +16 -1
- package/dist/src/commands/_async-ui.d.ts +13 -0
- package/dist/src/commands/_async-ui.js +74 -3
- package/dist/src/commands/_authority-runs.d.ts +22 -0
- package/dist/src/commands/_cli-format.d.ts +49 -0
- package/dist/src/commands/_cli-format.js +26 -8
- package/dist/src/commands/_connection-state.d.ts +44 -0
- package/dist/src/commands/_doctor-checks.d.ts +52 -0
- package/dist/src/commands/_doctor-checks.js +3 -1
- package/dist/src/commands/_help-catalog.d.ts +51 -0
- package/dist/src/commands/_help-catalog.js +9 -70
- package/dist/src/commands/_json-output.d.ts +11 -0
- package/dist/src/commands/_operator-surface.d.ts +34 -0
- package/dist/src/commands/_operator-view.d.ts +30 -0
- package/dist/src/commands/_operator-view.js +184 -7
- package/dist/src/commands/_parsers.d.ts +15 -0
- 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 +184 -7
- package/dist/src/commands/_pi-install.d.ts +42 -0
- package/dist/src/commands/_pi-install.js +1 -1
- package/dist/src/commands/_policy.d.ts +8 -0
- package/dist/src/commands/_preflight.d.ts +22 -0
- package/dist/src/commands/_preflight.js +3 -1
- 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-replay.d.ts +24 -0
- package/dist/src/commands/_server-client.d.ts +186 -0
- package/dist/src/commands/_server-client.js +3 -1
- package/dist/src/commands/_snapshot-upload.d.ts +39 -0
- package/dist/src/commands/_snapshot-upload.js +3 -1
- package/dist/src/commands/_spinner.d.ts +25 -0
- package/dist/src/commands/_task-picker.d.ts +9 -0
- package/dist/src/commands/_task-picker.js +132 -7
- package/dist/src/commands/agent.d.ts +3 -0
- package/dist/src/commands/browser.d.ts +65 -0
- package/dist/src/commands/browser.js +306 -30
- package/dist/src/commands/connect.d.ts +7 -0
- package/dist/src/commands/connect.js +130 -64
- package/dist/src/commands/dist.d.ts +28 -0
- package/dist/src/commands/doctor.d.ts +3 -0
- package/dist/src/commands/doctor.js +77 -4
- package/dist/src/commands/github.d.ts +3 -0
- package/dist/src/commands/github.js +77 -4
- package/dist/src/commands/inbox.d.ts +30 -0
- package/dist/src/commands/inbox.js +101 -78
- package/dist/src/commands/init.d.ts +74 -0
- package/dist/src/commands/init.js +350 -10
- package/dist/src/commands/inspect.d.ts +3 -0
- package/dist/src/commands/inspect.js +77 -4
- package/dist/src/commands/inspector.d.ts +3 -0
- package/dist/src/commands/pi.d.ts +3 -0
- package/dist/src/commands/plugin.d.ts +16 -0
- package/dist/src/commands/profile-and-review.d.ts +4 -0
- package/dist/src/commands/queue.d.ts +3 -0
- package/dist/src/commands/remote.d.ts +3 -0
- package/dist/src/commands/repo-git-harness.d.ts +5 -0
- package/dist/src/commands/run.d.ts +3 -0
- package/dist/src/commands/run.js +195 -69
- package/dist/src/commands/server.d.ts +7 -0
- package/dist/src/commands/server.js +133 -65
- package/dist/src/commands/setup.d.ts +16 -0
- package/dist/src/commands/setup.js +77 -4
- package/dist/src/commands/stats.d.ts +12 -0
- package/dist/src/commands/stats.js +57 -113
- package/dist/src/commands/task-report-bug.d.ts +19 -0
- package/dist/src/commands/task-report-bug.js +231 -40
- package/dist/src/commands/task-run-driver.d.ts +132 -0
- package/dist/src/commands/task-run-driver.js +26 -3
- package/dist/src/commands/task.d.ts +14 -0
- package/dist/src/commands/task.js +341 -229
- package/dist/src/commands/test.d.ts +3 -0
- package/dist/src/commands/workspace.d.ts +3 -0
- package/dist/src/commands.d.ts +29 -0
- package/dist/src/commands.js +10194 -9289
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +10200 -9295
- package/dist/src/launcher.d.ts +61 -0
- package/dist/src/report-bug.d.ts +44 -0
- package/dist/src/runner.d.ts +47 -0
- package/dist/src/withMutedConsole.d.ts +2 -0
- package/package.json +10 -9
- package/dist/src/commands/_operator-board.js +0 -730
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// packages/cli/src/
|
|
2
|
+
// packages/cli/src/app/theme.ts
|
|
3
3
|
var RIG_PALETTE = {
|
|
4
4
|
ink: "#f2f3f6",
|
|
5
5
|
ink2: "#aeb0ba",
|
|
@@ -114,11 +114,25 @@ function renderDroneFrame(tick) {
|
|
|
114
114
|
}
|
|
115
115
|
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
116
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
|
+
}
|
|
117
129
|
export {
|
|
118
130
|
yellow,
|
|
119
131
|
statusColor,
|
|
132
|
+
renderMicroDroneFrame,
|
|
120
133
|
renderDroneFrame,
|
|
121
134
|
red,
|
|
135
|
+
microDroneFrame,
|
|
122
136
|
ink4,
|
|
123
137
|
ink3,
|
|
124
138
|
ink2,
|
|
@@ -130,6 +144,7 @@ export {
|
|
|
130
144
|
accent,
|
|
131
145
|
RIG_SPINNER_FRAMES,
|
|
132
146
|
RIG_PALETTE,
|
|
147
|
+
MICRO_DRONE_FRAMES,
|
|
133
148
|
DRONE_WIDTH,
|
|
134
149
|
DRONE_HEIGHT
|
|
135
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>;
|
|
@@ -91,8 +91,79 @@ var RESUMABLE_RUN_STATUSES = new Set([
|
|
|
91
91
|
"needs_attention"
|
|
92
92
|
]);
|
|
93
93
|
|
|
94
|
+
// packages/cli/src/app/theme.ts
|
|
95
|
+
var RIG_PALETTE = {
|
|
96
|
+
ink: "#f2f3f6",
|
|
97
|
+
ink2: "#aeb0ba",
|
|
98
|
+
ink3: "#6c6e79",
|
|
99
|
+
ink4: "#44464f",
|
|
100
|
+
accent: "#ccff4d",
|
|
101
|
+
accentDim: "#a9d63f",
|
|
102
|
+
cyan: "#56d8ff",
|
|
103
|
+
red: "#ff5d5d",
|
|
104
|
+
yellow: "#ffd24d"
|
|
105
|
+
};
|
|
106
|
+
function hexToRgb(hex) {
|
|
107
|
+
const value = hex.replace("#", "");
|
|
108
|
+
return [
|
|
109
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
110
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
111
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
function fg(hex) {
|
|
115
|
+
const [r, g, b] = hexToRgb(hex);
|
|
116
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
117
|
+
}
|
|
118
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
119
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
120
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
121
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
122
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
123
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
124
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
125
|
+
var red = fg(RIG_PALETTE.red);
|
|
126
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
127
|
+
function bold(text) {
|
|
128
|
+
return `\x1B[1m${text}\x1B[22m`;
|
|
129
|
+
}
|
|
130
|
+
var DRONE_ART = [
|
|
131
|
+
" .-=-. .-=-. ",
|
|
132
|
+
" ( !!! ) ( !!! ) ",
|
|
133
|
+
" '-=-'._ _.'-=-' ",
|
|
134
|
+
" '._ _.' ",
|
|
135
|
+
" '=$$$$$$$=.' ",
|
|
136
|
+
" =$$$$$$$$$$$= ",
|
|
137
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
138
|
+
" $$$@@ @@$$$ ",
|
|
139
|
+
" $$@ ? @$$$ ",
|
|
140
|
+
" $$$@ '-' @$$$ ",
|
|
141
|
+
" $$$@@ @@$$$ ",
|
|
142
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
143
|
+
" =$$$$$$$$$$$= ",
|
|
144
|
+
" '=$$$$$$$=.' ",
|
|
145
|
+
" _.' '._ ",
|
|
146
|
+
" .-=-.' '.-=-. ",
|
|
147
|
+
" ( !!! ) ( !!! ) ",
|
|
148
|
+
" '-=-' '-=-' "
|
|
149
|
+
];
|
|
150
|
+
var EYE_FRAMES = ["@", "o", "."];
|
|
151
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
152
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
153
|
+
var MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
|
|
154
|
+
function microDroneFrame(tick) {
|
|
155
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
156
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
157
|
+
return `(${blade})${eye}(${blade})`;
|
|
158
|
+
}
|
|
159
|
+
var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => microDroneFrame(index));
|
|
160
|
+
function renderMicroDroneFrame(tick) {
|
|
161
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
162
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
163
|
+
return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
|
|
164
|
+
}
|
|
165
|
+
|
|
94
166
|
// packages/cli/src/commands/_async-ui.ts
|
|
95
|
-
var CLACK_SPINNER_FRAMES = ["\u25D2", "\u25D0", "\u25D3", "\u25D1"];
|
|
96
167
|
var DONE_SYMBOL = pc.green("\u25C7");
|
|
97
168
|
var FAIL_SYMBOL = pc.red("\u25A0");
|
|
98
169
|
var activeUpdate = null;
|
|
@@ -126,8 +197,8 @@ async function withSpinner(label, work, options = {}) {
|
|
|
126
197
|
const spinner = createTtySpinner({
|
|
127
198
|
label,
|
|
128
199
|
output,
|
|
129
|
-
frames:
|
|
130
|
-
styleFrame: (frame) =>
|
|
200
|
+
frames: MICRO_DRONE_FRAMES,
|
|
201
|
+
styleFrame: (frame) => renderMicroDroneFrame(Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame)))
|
|
131
202
|
});
|
|
132
203
|
const update = (next) => {
|
|
133
204
|
lastLabel = next;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type AuthorityRunRecord } from "@rig/runtime/control-plane/authority-files";
|
|
2
|
+
import type { RunStatus } from "@rig/contracts";
|
|
3
|
+
export declare const RIG_WORKSPACE_ID = "rig-local-workspace";
|
|
4
|
+
export type RuntimeAdapter = "claude-code" | "codex" | "pi";
|
|
5
|
+
export declare function normalizeRuntimeAdapter(value: string | undefined): RuntimeAdapter;
|
|
6
|
+
export declare function readLatestBeadRecord(projectRoot: string, taskId: string): Record<string, unknown> | null;
|
|
7
|
+
export declare function upsertAgentAuthorityRun(projectRoot: string, input: {
|
|
8
|
+
runId: string;
|
|
9
|
+
taskId: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
runtimeAdapter?: string;
|
|
12
|
+
status: RunStatus;
|
|
13
|
+
startedAt?: string | null;
|
|
14
|
+
completedAt?: string | null;
|
|
15
|
+
worktreePath?: string | null;
|
|
16
|
+
artifactRoot?: string | null;
|
|
17
|
+
logRoot?: string | null;
|
|
18
|
+
sessionPath?: string | null;
|
|
19
|
+
sessionLogPath?: string | null;
|
|
20
|
+
pid?: number | null;
|
|
21
|
+
errorText?: string | null;
|
|
22
|
+
}): AuthorityRunRecord & Record<string, unknown>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type CliTaskLike = Record<string, unknown>;
|
|
2
|
+
export type CliRunLike = Record<string, unknown>;
|
|
3
|
+
export declare function printFormattedOutput(message: string, options?: {
|
|
4
|
+
title?: string;
|
|
5
|
+
}): void;
|
|
6
|
+
export declare function formatStatusPill(status: string): string;
|
|
7
|
+
export declare function formatSection(title: string, subtitle?: string): string;
|
|
8
|
+
export declare function formatSuccessCard(title: string, rows?: Array<[string, string | number | null | undefined]>): string;
|
|
9
|
+
export declare function formatNextSteps(steps: readonly string[]): string[];
|
|
10
|
+
export declare function formatTaskList(tasks: readonly CliTaskLike[], options?: {
|
|
11
|
+
raw?: boolean;
|
|
12
|
+
}): string;
|
|
13
|
+
export declare function formatTaskCard(task: CliTaskLike, options?: {
|
|
14
|
+
title?: string;
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
}): string;
|
|
17
|
+
export declare function formatTaskDetails(task: CliTaskLike): string;
|
|
18
|
+
export declare function formatRunList(runs: readonly CliRunLike[], options?: {
|
|
19
|
+
source?: "local" | "server";
|
|
20
|
+
}): string;
|
|
21
|
+
export declare function formatSubmittedRun(input: {
|
|
22
|
+
runId: string;
|
|
23
|
+
task?: CliTaskLike | null;
|
|
24
|
+
runtimeAdapter?: string | null;
|
|
25
|
+
runtimeMode?: string | null;
|
|
26
|
+
interactionMode?: string | null;
|
|
27
|
+
detached?: boolean;
|
|
28
|
+
}): string;
|
|
29
|
+
export declare function formatRunCard(run: CliRunLike, options?: {
|
|
30
|
+
title?: string;
|
|
31
|
+
}): string;
|
|
32
|
+
export declare function formatRunStatus(summary: {
|
|
33
|
+
activeRuns?: CliRunLike[];
|
|
34
|
+
recentRuns?: CliRunLike[];
|
|
35
|
+
runs?: CliRunLike[];
|
|
36
|
+
}, options?: {
|
|
37
|
+
source?: "local" | "server";
|
|
38
|
+
}): string;
|
|
39
|
+
export declare function formatInboxList(kind: "approvals" | "inputs", entries: readonly Record<string, unknown>[]): string;
|
|
40
|
+
export declare function formatConnectionList(connections: Record<string, {
|
|
41
|
+
kind: string;
|
|
42
|
+
baseUrl?: string;
|
|
43
|
+
mode?: string;
|
|
44
|
+
}>): string;
|
|
45
|
+
export declare function formatConnectionStatus(selected: string, connections: Record<string, {
|
|
46
|
+
kind: string;
|
|
47
|
+
baseUrl?: string;
|
|
48
|
+
mode?: string;
|
|
49
|
+
}>): string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// packages/cli/src/
|
|
3
|
-
import {
|
|
4
|
-
import pc from "picocolors";
|
|
2
|
+
// packages/cli/src/app/drone-ui.ts
|
|
3
|
+
import { ProcessTerminal, TUI, Text, Input, SelectList, matchesKey } from "@earendil-works/pi-tui";
|
|
5
4
|
|
|
6
|
-
// packages/cli/src/
|
|
5
|
+
// packages/cli/src/app/theme.ts
|
|
7
6
|
var RIG_PALETTE = {
|
|
8
7
|
ink: "#f2f3f6",
|
|
9
8
|
ink2: "#aeb0ba",
|
|
@@ -36,6 +35,9 @@ var accentDim = fg(RIG_PALETTE.accentDim);
|
|
|
36
35
|
var cyan = fg(RIG_PALETTE.cyan);
|
|
37
36
|
var red = fg(RIG_PALETTE.red);
|
|
38
37
|
var yellow = fg(RIG_PALETTE.yellow);
|
|
38
|
+
function bold(text) {
|
|
39
|
+
return `\x1B[1m${text}\x1B[22m`;
|
|
40
|
+
}
|
|
39
41
|
var DRONE_ART = [
|
|
40
42
|
" .-=-. .-=-. ",
|
|
41
43
|
" ( !!! ) ( !!! ) ",
|
|
@@ -56,10 +58,29 @@ var DRONE_ART = [
|
|
|
56
58
|
" ( !!! ) ( !!! ) ",
|
|
57
59
|
" '-=-' '-=-' "
|
|
58
60
|
];
|
|
61
|
+
var EYE_FRAMES = ["@", "o", "."];
|
|
59
62
|
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
60
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
|
+
|
|
72
|
+
// packages/cli/src/app/drone-ui.ts
|
|
73
|
+
function droneNote(message, title) {
|
|
74
|
+
if (title)
|
|
75
|
+
console.log(` ${accentDim("\u25C7")} ${bold(ink2(title))}`);
|
|
76
|
+
for (const line of message.split(`
|
|
77
|
+
`)) {
|
|
78
|
+
console.log(` ${ink4("\u2502")} ${line}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
61
81
|
|
|
62
82
|
// packages/cli/src/commands/_cli-format.ts
|
|
83
|
+
import pc from "picocolors";
|
|
63
84
|
var themeDim = (value) => ink3(value);
|
|
64
85
|
var themeFaint = (value) => ink4(value);
|
|
65
86
|
function stringField(record, key, fallback = "") {
|
|
@@ -147,10 +168,7 @@ function printFormattedOutput(message, options = {}) {
|
|
|
147
168
|
console.log(message);
|
|
148
169
|
return;
|
|
149
170
|
}
|
|
150
|
-
|
|
151
|
-
note(message, options.title);
|
|
152
|
-
else
|
|
153
|
-
log.message(message);
|
|
171
|
+
droneNote(message, options.title);
|
|
154
172
|
}
|
|
155
173
|
function formatStatusPill(status) {
|
|
156
174
|
const label = status || "unknown";
|