@h-rig/cli 0.0.6-alpha.90 → 0.0.6-alpha.92
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 +18 -19
- package/dist/bin/build-rig-binaries.js +22 -10
- package/dist/bin/rig.d.ts +71 -1
- package/dist/bin/rig.js +15078 -11169
- package/dist/config/rig-default-config.yml +5 -0
- package/dist/src/app/drone-ui.d.ts +11 -14
- package/dist/src/app/drone-ui.js +70 -86
- package/dist/src/commands/_async-ui.d.ts +1 -4
- package/dist/src/commands/_async-ui.js +9 -111
- package/dist/src/commands/_cli-format.d.ts +16 -9
- package/dist/src/commands/_cli-format.js +167 -295
- package/dist/src/commands/_connection-state.d.ts +11 -1
- package/dist/src/commands/_connection-state.js +50 -5
- package/dist/src/commands/_doctor-checks.d.ts +0 -6
- package/dist/src/commands/_doctor-checks.js +79 -382
- package/dist/src/commands/_help-catalog.d.ts +1 -1
- package/dist/src/commands/_help-catalog.js +217 -157
- package/dist/src/commands/_inprocess-services.d.ts +33 -0
- package/dist/src/commands/_inprocess-services.js +102 -0
- package/dist/src/commands/_json-output.js +4 -0
- package/dist/src/commands/_lazy-reconcile.d.ts +34 -0
- package/dist/src/commands/_lazy-reconcile.js +102 -0
- package/dist/src/commands/_paths.js +1 -1
- package/dist/src/commands/_pi-frontend.d.ts +18 -10
- package/dist/src/commands/_pi-frontend.js +37 -715
- package/dist/src/commands/_pi-install.js +18 -36
- package/dist/src/commands/_policy.d.ts +1 -1
- package/dist/src/commands/_policy.js +56 -15
- package/dist/src/commands/_run-bridge.d.ts +114 -0
- package/dist/src/commands/_run-bridge.js +387 -0
- package/dist/src/commands/_run-diagnostics.d.ts +9 -0
- package/dist/src/commands/_run-diagnostics.js +51 -0
- package/dist/src/commands/_run-driver-helpers.d.ts +8 -81
- package/dist/src/commands/_run-driver-helpers.js +79 -283
- package/dist/src/commands/_run-projection.d.ts +50 -0
- package/dist/src/commands/_run-projection.js +349 -0
- package/dist/src/commands/_run-subcommands.d.ts +3 -0
- package/dist/src/commands/_run-subcommands.js +31 -0
- package/dist/src/commands/_spinner.js +1 -1
- package/dist/src/commands/agent.d.ts +1 -1
- package/dist/src/commands/agent.js +8559 -239
- package/dist/src/commands/dist.d.ts +1 -1
- package/dist/src/commands/dist.js +27 -19
- package/dist/src/commands/doctor.d.ts +1 -1
- package/dist/src/commands/doctor.js +93 -475
- package/dist/src/commands/github.d.ts +1 -1
- package/dist/src/commands/github.js +113 -387
- package/dist/src/commands/inbox.d.ts +22 -24
- package/dist/src/commands/inbox.js +420 -691
- package/dist/src/commands/init.d.ts +6 -16
- package/dist/src/commands/init.js +334 -971
- package/dist/src/commands/inspect.d.ts +19 -2
- package/dist/src/commands/inspect.js +644 -610
- package/dist/src/commands/pi.d.ts +1 -1
- package/dist/src/commands/plugin.d.ts +1 -1
- package/dist/src/commands/plugin.js +486 -7
- package/dist/src/commands/profile-and-review.d.ts +1 -1
- package/dist/src/commands/profile-and-review.js +94 -56
- package/dist/src/commands/queue.js +1 -21
- package/dist/src/commands/remote.d.ts +1 -1
- package/dist/src/commands/remote.js +837 -14
- package/dist/src/commands/repo-git-harness.d.ts +1 -1
- package/dist/src/commands/repo-git-harness.js +57 -14
- package/dist/src/commands/run.d.ts +20 -2
- package/dist/src/commands/run.js +17579 -1759
- package/dist/src/commands/server.d.ts +2 -6
- package/dist/src/commands/server.js +141 -723
- package/dist/src/commands/setup.d.ts +1 -1
- package/dist/src/commands/setup.js +102 -484
- package/dist/src/commands/stats.d.ts +13 -10
- package/dist/src/commands/stats.js +689 -761
- package/dist/src/commands/task-run-driver.d.ts +50 -88
- package/dist/src/commands/task-run-driver.js +116 -2717
- package/dist/src/commands/task.d.ts +34 -13
- package/dist/src/commands/task.js +668 -2523
- package/dist/src/commands/test.d.ts +1 -1
- package/dist/src/commands/triage.d.ts +11 -0
- package/dist/src/commands/triage.js +227 -0
- package/dist/src/commands/workspace.d.ts +1 -1
- package/dist/src/commands.d.ts +0 -16
- package/dist/src/commands.js +16657 -12250
- package/dist/src/index.js +16528 -12497
- package/dist/src/launcher.js +4 -0
- package/dist/src/operator-cli.d.ts +2 -0
- package/dist/src/operator-cli.js +17837 -0
- package/dist/src/operator-entry.d.ts +1 -0
- package/dist/src/operator-entry.js +3 -0
- package/package.json +18 -12
- package/dist/src/app/board.d.ts +0 -23
- package/dist/src/app/board.js +0 -1786
- package/dist/src/app/theme.d.ts +0 -47
- package/dist/src/app/theme.js +0 -150
- package/dist/src/commands/_authority-runs.d.ts +0 -22
- package/dist/src/commands/_authority-runs.js +0 -110
- package/dist/src/commands/_operator-surface.d.ts +0 -34
- package/dist/src/commands/_operator-surface.js +0 -220
- package/dist/src/commands/_operator-view.d.ts +0 -30
- package/dist/src/commands/_operator-view.js +0 -1070
- package/dist/src/commands/_preflight.d.ts +0 -22
- package/dist/src/commands/_preflight.js +0 -540
- package/dist/src/commands/_run-replay.d.ts +0 -24
- package/dist/src/commands/_run-replay.js +0 -142
- package/dist/src/commands/_server-client.d.ts +0 -186
- package/dist/src/commands/_server-client.js +0 -681
- package/dist/src/commands/_snapshot-upload.d.ts +0 -39
- package/dist/src/commands/_snapshot-upload.js +0 -455
- package/dist/src/commands/_task-picker.d.ts +0 -9
- package/dist/src/commands/_task-picker.js +0 -201
- package/dist/src/commands/browser.d.ts +0 -65
- package/dist/src/commands/browser.js +0 -1173
- package/dist/src/commands/connect.d.ts +0 -7
- package/dist/src/commands/connect.js +0 -419
- package/dist/src/commands/inspector.d.ts +0 -3
- package/dist/src/commands/inspector.js +0 -263
- package/dist/src/commands/task-report-bug.d.ts +0 -19
- package/dist/src/commands/task-report-bug.js +0 -1281
- package/dist/src/report-bug.d.ts +0 -44
- package/dist/src/report-bug.js +0 -260
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
type DroneSelectOption<T extends string> = {
|
|
2
|
+
readonly value: T;
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly hint?: string;
|
|
5
|
+
};
|
|
6
|
+
type DroneSpinner = {
|
|
7
|
+
start(message: string): void;
|
|
8
|
+
stop(message?: string): void;
|
|
9
|
+
error(message?: string): void;
|
|
10
|
+
};
|
|
1
11
|
export declare function droneIntro(title: string, subtitle?: string): void;
|
|
2
12
|
export declare function droneOutro(text: string): void;
|
|
3
13
|
export declare function droneNote(message: string, title?: string): void;
|
|
@@ -6,30 +16,17 @@ export declare function droneInfo(text: string): void;
|
|
|
6
16
|
export declare function droneWarn(text: string): void;
|
|
7
17
|
export declare function droneError(text: string): void;
|
|
8
18
|
export declare function droneCancel(text: string): void;
|
|
9
|
-
|
|
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). */
|
|
19
|
+
export declare function droneSpinner(): DroneSpinner;
|
|
21
20
|
export declare function droneSelect<T extends string>(input: {
|
|
22
21
|
readonly message: string;
|
|
23
22
|
readonly options: readonly DroneSelectOption<T>[];
|
|
24
23
|
readonly initialValue?: T;
|
|
25
24
|
}): Promise<T | null>;
|
|
26
|
-
/** Drone-styled text input. Returns null on cancel. */
|
|
27
25
|
export declare function droneText(input: {
|
|
28
26
|
readonly message: string;
|
|
29
27
|
readonly placeholder?: string;
|
|
30
28
|
readonly initialValue?: string;
|
|
31
29
|
}): Promise<string | null>;
|
|
32
|
-
/** Drone-styled yes/no. Returns null on cancel. */
|
|
33
30
|
export declare function droneConfirm(input: {
|
|
34
31
|
readonly message: string;
|
|
35
32
|
readonly initialValue?: boolean;
|
package/dist/src/app/drone-ui.js
CHANGED
|
@@ -1,78 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli/src/app/drone-ui.ts
|
|
3
|
-
import {
|
|
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
|
-
}
|
|
3
|
+
import { Input, matchesKey, ProcessTerminal, SelectList, Text, TUI } from "@oh-my-pi/pi-tui";
|
|
76
4
|
|
|
77
5
|
// packages/cli/src/commands/_spinner.ts
|
|
78
6
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -105,7 +33,7 @@ function createTtySpinner(input) {
|
|
|
105
33
|
output.write("\r\x1B[2K");
|
|
106
34
|
};
|
|
107
35
|
render();
|
|
108
|
-
const timer = isTty ? setInterval(render, input.intervalMs ??
|
|
36
|
+
const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
|
|
109
37
|
return {
|
|
110
38
|
setLabel(next) {
|
|
111
39
|
label = next;
|
|
@@ -136,7 +64,54 @@ function createTtySpinner(input) {
|
|
|
136
64
|
}
|
|
137
65
|
|
|
138
66
|
// packages/cli/src/app/drone-ui.ts
|
|
139
|
-
var
|
|
67
|
+
var PALETTE = {
|
|
68
|
+
ink: "#f2f3f6",
|
|
69
|
+
ink2: "#aeb0ba",
|
|
70
|
+
ink3: "#6c6e79",
|
|
71
|
+
ink4: "#44464f",
|
|
72
|
+
accent: "#ccff4d",
|
|
73
|
+
accentDim: "#a9d63f",
|
|
74
|
+
cyan: "#56d8ff",
|
|
75
|
+
red: "#ff5d5d",
|
|
76
|
+
yellow: "#ffd24d"
|
|
77
|
+
};
|
|
78
|
+
function hexToRgb(hex) {
|
|
79
|
+
const value = hex.charCodeAt(0) === 35 ? hex.slice(1) : hex;
|
|
80
|
+
return [
|
|
81
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
82
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
83
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
function fg(hex) {
|
|
87
|
+
const [r, g, b] = hexToRgb(hex);
|
|
88
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
89
|
+
}
|
|
90
|
+
var ink = fg(PALETTE.ink);
|
|
91
|
+
var ink2 = fg(PALETTE.ink2);
|
|
92
|
+
var ink3 = fg(PALETTE.ink3);
|
|
93
|
+
var ink4 = fg(PALETTE.ink4);
|
|
94
|
+
var accent = fg(PALETTE.accent);
|
|
95
|
+
var accentDim = fg(PALETTE.accentDim);
|
|
96
|
+
var cyan = fg(PALETTE.cyan);
|
|
97
|
+
var red = fg(PALETTE.red);
|
|
98
|
+
var yellow = fg(PALETTE.yellow);
|
|
99
|
+
var MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
|
|
100
|
+
var EYE_FRAMES = ["@", "o", "."];
|
|
101
|
+
var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => {
|
|
102
|
+
const blade = MICRO_BLADES[index % MICRO_BLADES.length];
|
|
103
|
+
const eye = EYE_FRAMES[Math.floor(index / 2) % EYE_FRAMES.length];
|
|
104
|
+
return `(${blade})${eye}(${blade})`;
|
|
105
|
+
});
|
|
106
|
+
function bold(text) {
|
|
107
|
+
return `\x1B[1m${text}\x1B[22m`;
|
|
108
|
+
}
|
|
109
|
+
function renderMicroDroneFrame(frame) {
|
|
110
|
+
const tick = Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame));
|
|
111
|
+
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
112
|
+
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
113
|
+
return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
|
|
114
|
+
}
|
|
140
115
|
function hairline(width = Math.min(process.stdout.columns ?? 80, 100)) {
|
|
141
116
|
return ink4("\u2500".repeat(Math.max(10, width)));
|
|
142
117
|
}
|
|
@@ -154,9 +129,8 @@ function droneNote(message, title) {
|
|
|
154
129
|
if (title)
|
|
155
130
|
console.log(` ${accentDim("\u25C7")} ${bold(ink2(title))}`);
|
|
156
131
|
for (const line of message.split(`
|
|
157
|
-
`))
|
|
132
|
+
`))
|
|
158
133
|
console.log(` ${ink4("\u2502")} ${line}`);
|
|
159
|
-
}
|
|
160
134
|
}
|
|
161
135
|
function droneStep(text) {
|
|
162
136
|
console.log(` ${accent("\u203A")} ${ink(text)}`);
|
|
@@ -180,7 +154,7 @@ function droneSpinner() {
|
|
|
180
154
|
active = createTtySpinner({
|
|
181
155
|
label: message,
|
|
182
156
|
frames: MICRO_DRONE_FRAMES,
|
|
183
|
-
styleFrame:
|
|
157
|
+
styleFrame: renderMicroDroneFrame
|
|
184
158
|
});
|
|
185
159
|
},
|
|
186
160
|
stop(message) {
|
|
@@ -193,16 +167,27 @@ function droneSpinner() {
|
|
|
193
167
|
}
|
|
194
168
|
};
|
|
195
169
|
}
|
|
196
|
-
var
|
|
170
|
+
var DRONE_SYMBOLS = {
|
|
171
|
+
cursor: "\u2192",
|
|
172
|
+
inputCursor: "\u258F",
|
|
173
|
+
boxRound: { topLeft: "\u256D", topRight: "\u256E", bottomLeft: "\u2570", bottomRight: "\u256F", horizontal: "\u2500", vertical: "\u2502" },
|
|
174
|
+
boxSharp: { topLeft: "\u250C", topRight: "\u2510", bottomLeft: "\u2514", bottomRight: "\u2518", horizontal: "\u2500", vertical: "\u2502", teeDown: "\u252C", teeUp: "\u2534", teeLeft: "\u2524", teeRight: "\u251C", cross: "\u253C" },
|
|
175
|
+
table: { topLeft: "\u250C", topRight: "\u2510", bottomLeft: "\u2514", bottomRight: "\u2518", horizontal: "\u2500", vertical: "\u2502", teeDown: "\u252C", teeUp: "\u2534", teeLeft: "\u2524", teeRight: "\u251C", cross: "\u253C" },
|
|
176
|
+
quoteBorder: "\u2502",
|
|
177
|
+
hrChar: "\u2500",
|
|
178
|
+
spinnerFrames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"]
|
|
179
|
+
};
|
|
180
|
+
var DRONE_SELECT_THEME = {
|
|
197
181
|
selectedPrefix: (text) => accent(text),
|
|
198
182
|
selectedText: (text) => bold(ink(text)),
|
|
199
183
|
description: (text) => ink3(text),
|
|
200
184
|
scrollInfo: (text) => ink4(text),
|
|
201
|
-
noMatch: (text) => ink3(text)
|
|
185
|
+
noMatch: (text) => ink3(text),
|
|
186
|
+
symbols: DRONE_SYMBOLS,
|
|
187
|
+
hovered: (text) => bold(ink(text))
|
|
202
188
|
};
|
|
203
189
|
async function runMiniTui(build) {
|
|
204
|
-
const
|
|
205
|
-
const tui = new TUI(terminal);
|
|
190
|
+
const tui = new TUI(new ProcessTerminal);
|
|
206
191
|
let settled = false;
|
|
207
192
|
return await new Promise((resolve) => {
|
|
208
193
|
const finish = (result) => {
|
|
@@ -217,9 +202,8 @@ async function runMiniTui(build) {
|
|
|
217
202
|
});
|
|
218
203
|
}
|
|
219
204
|
async function droneSelect(input) {
|
|
220
|
-
if (!
|
|
205
|
+
if (!process.stdout.isTTY || input.options.length === 0)
|
|
221
206
|
return input.initialValue ?? input.options[0]?.value ?? null;
|
|
222
|
-
}
|
|
223
207
|
return runMiniTui((tui, finish) => {
|
|
224
208
|
tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}`));
|
|
225
209
|
const items = input.options.map((option) => ({
|
|
@@ -227,7 +211,7 @@ async function droneSelect(input) {
|
|
|
227
211
|
label: option.label,
|
|
228
212
|
...option.hint ? { description: option.hint } : {}
|
|
229
213
|
}));
|
|
230
|
-
const list = new SelectList(items, Math.min(items.length, 12),
|
|
214
|
+
const list = new SelectList(items, Math.min(items.length, 12), DRONE_SELECT_THEME);
|
|
231
215
|
const initialIndex = input.initialValue ? items.findIndex((item) => item.value === input.initialValue) : -1;
|
|
232
216
|
if (initialIndex > 0)
|
|
233
217
|
list.setSelectedIndex(initialIndex);
|
|
@@ -246,7 +230,7 @@ async function droneSelect(input) {
|
|
|
246
230
|
});
|
|
247
231
|
}
|
|
248
232
|
async function droneText(input) {
|
|
249
|
-
if (!
|
|
233
|
+
if (!process.stdout.isTTY)
|
|
250
234
|
return input.initialValue ?? null;
|
|
251
235
|
return runMiniTui((tui, finish) => {
|
|
252
236
|
tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}${input.placeholder ? ink4(` (${input.placeholder})`) : ""}`));
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { OutputMode } from "@rig/runtime
|
|
1
|
+
import type { OutputMode } from "@rig/runtime";
|
|
2
2
|
export type SpinnerOutput = Pick<NodeJS.WriteStream, "write"> & {
|
|
3
3
|
readonly isTTY?: boolean;
|
|
4
4
|
};
|
|
5
5
|
export type WithSpinnerOptions = {
|
|
6
|
-
/** Final line left behind on success. Default: the spinner line is erased. */
|
|
7
6
|
readonly doneLabel?: string;
|
|
8
|
-
/** Pass context.outputMode; "json" suppresses all spinner output. */
|
|
9
7
|
readonly outputMode?: OutputMode;
|
|
10
|
-
/** Stream override for tests. Defaults to process.stderr. */
|
|
11
8
|
readonly output?: SpinnerOutput;
|
|
12
9
|
};
|
|
13
10
|
export declare function withSpinner<T>(label: string, work: (update: (label: string) => void) => Promise<T>, options?: WithSpinnerOptions): Promise<T>;
|
|
@@ -33,7 +33,7 @@ function createTtySpinner(input) {
|
|
|
33
33
|
output.write("\r\x1B[2K");
|
|
34
34
|
};
|
|
35
35
|
render();
|
|
36
|
-
const timer = isTty ? setInterval(render, input.intervalMs ??
|
|
36
|
+
const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
|
|
37
37
|
return {
|
|
38
38
|
setLabel(next) {
|
|
39
39
|
label = next;
|
|
@@ -63,118 +63,20 @@ function createTtySpinner(input) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// packages/cli/src/runner.ts
|
|
67
|
-
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
68
|
-
import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
|
|
69
|
-
import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
|
|
70
|
-
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
71
|
-
|
|
72
|
-
// packages/cli/src/commands/_server-client.ts
|
|
73
|
-
import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
|
|
74
|
-
var scopedGitHubBearerTokens = new Map;
|
|
75
|
-
var serverPhaseListener = null;
|
|
76
|
-
function setServerPhaseListener(listener) {
|
|
77
|
-
const previous = serverPhaseListener;
|
|
78
|
-
serverPhaseListener = listener;
|
|
79
|
-
return previous;
|
|
80
|
-
}
|
|
81
|
-
var serverReachabilityCache = new Map;
|
|
82
|
-
var RESUMABLE_RUN_STATUSES = new Set([
|
|
83
|
-
"created",
|
|
84
|
-
"preparing",
|
|
85
|
-
"running",
|
|
86
|
-
"validating",
|
|
87
|
-
"reviewing",
|
|
88
|
-
"stopped",
|
|
89
|
-
"failed",
|
|
90
|
-
"needs-attention",
|
|
91
|
-
"needs_attention"
|
|
92
|
-
]);
|
|
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
|
-
|
|
166
66
|
// packages/cli/src/commands/_async-ui.ts
|
|
67
|
+
var FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
|
|
167
68
|
var DONE_SYMBOL = pc.green("\u25C7");
|
|
168
69
|
var FAIL_SYMBOL = pc.red("\u25A0");
|
|
169
70
|
var activeUpdate = null;
|
|
170
71
|
async function withSpinner(label, work, options = {}) {
|
|
171
72
|
if (options.outputMode === "json") {
|
|
172
|
-
return work(() => {
|
|
73
|
+
return work(() => {
|
|
74
|
+
return;
|
|
75
|
+
});
|
|
173
76
|
}
|
|
174
77
|
if (activeUpdate) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return work(outer);
|
|
78
|
+
activeUpdate(label);
|
|
79
|
+
return work(activeUpdate);
|
|
178
80
|
}
|
|
179
81
|
const output = options.output ?? process.stderr;
|
|
180
82
|
const isTty = output.isTTY === true;
|
|
@@ -186,26 +88,23 @@ async function withSpinner(label, work, options = {}) {
|
|
|
186
88
|
lastLabel = next;
|
|
187
89
|
};
|
|
188
90
|
activeUpdate = update2;
|
|
189
|
-
const previousListener2 = setServerPhaseListener(update2);
|
|
190
91
|
try {
|
|
191
92
|
return await work(update2);
|
|
192
93
|
} finally {
|
|
193
94
|
activeUpdate = null;
|
|
194
|
-
setServerPhaseListener(previousListener2);
|
|
195
95
|
}
|
|
196
96
|
}
|
|
197
97
|
const spinner = createTtySpinner({
|
|
198
98
|
label,
|
|
199
99
|
output,
|
|
200
|
-
frames:
|
|
201
|
-
styleFrame: (frame) =>
|
|
100
|
+
frames: FRAMES,
|
|
101
|
+
styleFrame: (frame) => pc.cyan(frame)
|
|
202
102
|
});
|
|
203
103
|
const update = (next) => {
|
|
204
104
|
lastLabel = next;
|
|
205
105
|
spinner.setLabel(next);
|
|
206
106
|
};
|
|
207
107
|
activeUpdate = update;
|
|
208
|
-
const previousListener = setServerPhaseListener(update);
|
|
209
108
|
try {
|
|
210
109
|
const result = await work(update);
|
|
211
110
|
spinner.stop(options.doneLabel ? `${DONE_SYMBOL} ${options.doneLabel}` : undefined);
|
|
@@ -215,7 +114,6 @@ async function withSpinner(label, work, options = {}) {
|
|
|
215
114
|
throw error;
|
|
216
115
|
} finally {
|
|
217
116
|
activeUpdate = null;
|
|
218
|
-
setServerPhaseListener(previousListener);
|
|
219
117
|
}
|
|
220
118
|
}
|
|
221
119
|
export {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export type CliTaskLike = Record<string, unknown>;
|
|
2
2
|
export type CliRunLike = Record<string, unknown>;
|
|
3
|
-
export declare function printFormattedOutput(message: string
|
|
4
|
-
title?: string;
|
|
5
|
-
}): void;
|
|
3
|
+
export declare function printFormattedOutput(message: string): void;
|
|
6
4
|
export declare function formatStatusPill(status: string): string;
|
|
7
5
|
export declare function formatSection(title: string, subtitle?: string): string;
|
|
8
6
|
export declare function formatSuccessCard(title: string, rows?: Array<[string, string | number | null | undefined]>): string;
|
|
@@ -20,11 +18,9 @@ export declare function formatRunList(runs: readonly CliRunLike[], options?: {
|
|
|
20
18
|
}): string;
|
|
21
19
|
export declare function formatSubmittedRun(input: {
|
|
22
20
|
runId: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
interactionMode?: string | null;
|
|
27
|
-
detached?: boolean;
|
|
21
|
+
taskId?: string | null;
|
|
22
|
+
title?: string | null;
|
|
23
|
+
queuePosition?: number | null;
|
|
28
24
|
}): string;
|
|
29
25
|
export declare function formatRunCard(run: CliRunLike, options?: {
|
|
30
26
|
title?: string;
|
|
@@ -46,4 +42,15 @@ export declare function formatConnectionStatus(selected: string, connections: Re
|
|
|
46
42
|
kind: string;
|
|
47
43
|
baseUrl?: string;
|
|
48
44
|
mode?: string;
|
|
49
|
-
}
|
|
45
|
+
}>, repo?: {
|
|
46
|
+
project?: string;
|
|
47
|
+
serverProjectRoot?: string;
|
|
48
|
+
} | null, remoteProjectLink?: {
|
|
49
|
+
ok?: boolean;
|
|
50
|
+
status?: string;
|
|
51
|
+
serverProjectRoot?: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
hint?: string;
|
|
54
|
+
} | null): string;
|
|
55
|
+
export declare function formatStatsTable(rows: Array<[string, unknown]>): string;
|
|
56
|
+
export declare function readOptionalCount(record: Record<string, unknown>, key: string): number | null;
|