@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,201 +0,0 @@
|
|
|
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
|
-
|
|
72
|
-
// packages/cli/src/app/drone-ui.ts
|
|
73
|
-
var isTty = () => Boolean(process.stdout.isTTY);
|
|
74
|
-
function droneCancel(text) {
|
|
75
|
-
console.log(` ${red("\u2716")} ${ink3(text)}`);
|
|
76
|
-
}
|
|
77
|
-
var SELECT_THEME = {
|
|
78
|
-
selectedPrefix: (text) => accent(text),
|
|
79
|
-
selectedText: (text) => bold(ink(text)),
|
|
80
|
-
description: (text) => ink3(text),
|
|
81
|
-
scrollInfo: (text) => ink4(text),
|
|
82
|
-
noMatch: (text) => ink3(text)
|
|
83
|
-
};
|
|
84
|
-
async function runMiniTui(build) {
|
|
85
|
-
const terminal = new ProcessTerminal;
|
|
86
|
-
const tui = new TUI(terminal);
|
|
87
|
-
let settled = false;
|
|
88
|
-
return await new Promise((resolve) => {
|
|
89
|
-
const finish = (result) => {
|
|
90
|
-
if (settled)
|
|
91
|
-
return;
|
|
92
|
-
settled = true;
|
|
93
|
-
tui.stop();
|
|
94
|
-
resolve(result);
|
|
95
|
-
};
|
|
96
|
-
build(tui, finish);
|
|
97
|
-
tui.start();
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
async function droneSelect(input) {
|
|
101
|
-
if (!isTty() || input.options.length === 0) {
|
|
102
|
-
return input.initialValue ?? input.options[0]?.value ?? null;
|
|
103
|
-
}
|
|
104
|
-
return runMiniTui((tui, finish) => {
|
|
105
|
-
tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}`));
|
|
106
|
-
const items = input.options.map((option) => ({
|
|
107
|
-
value: option.value,
|
|
108
|
-
label: option.label,
|
|
109
|
-
...option.hint ? { description: option.hint } : {}
|
|
110
|
-
}));
|
|
111
|
-
const list = new SelectList(items, Math.min(items.length, 12), SELECT_THEME);
|
|
112
|
-
const initialIndex = input.initialValue ? items.findIndex((item) => item.value === input.initialValue) : -1;
|
|
113
|
-
if (initialIndex > 0)
|
|
114
|
-
list.setSelectedIndex(initialIndex);
|
|
115
|
-
list.onSelect = (item) => finish(item.value);
|
|
116
|
-
list.onCancel = () => finish(null);
|
|
117
|
-
tui.addChild(list);
|
|
118
|
-
tui.addChild(new Text(ink4(" \u2191\u2193 navigate \xB7 enter select \xB7 esc cancel")));
|
|
119
|
-
tui.setFocus(list);
|
|
120
|
-
tui.addInputListener((data) => {
|
|
121
|
-
if (matchesKey(data, "ctrl+c") || matchesKey(data, "escape")) {
|
|
122
|
-
finish(null);
|
|
123
|
-
return { consume: true };
|
|
124
|
-
}
|
|
125
|
-
return;
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// packages/cli/src/commands/_operator-surface.ts
|
|
131
|
-
import { createInterface as createPromptInterface } from "readline/promises";
|
|
132
|
-
function taskId(task) {
|
|
133
|
-
return typeof task.id === "string" && task.id.trim() ? task.id : "<unknown>";
|
|
134
|
-
}
|
|
135
|
-
function taskTitle(task) {
|
|
136
|
-
return typeof task.title === "string" && task.title.trim() ? task.title : "Untitled task";
|
|
137
|
-
}
|
|
138
|
-
function taskStatus(task) {
|
|
139
|
-
return typeof task.status === "string" && task.status.trim() ? task.status : "unknown";
|
|
140
|
-
}
|
|
141
|
-
function renderTaskPickerRows(tasks) {
|
|
142
|
-
return tasks.map((task, index) => `${index + 1}. ${taskId(task)} \xB7 ${taskStatus(task)} \xB7 ${taskTitle(task)}`);
|
|
143
|
-
}
|
|
144
|
-
async function promptForTaskSelection(question) {
|
|
145
|
-
const rl = createPromptInterface({ input: process.stdin, output: process.stdout });
|
|
146
|
-
try {
|
|
147
|
-
return await rl.question(question);
|
|
148
|
-
} finally {
|
|
149
|
-
rl.close();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// packages/cli/src/commands/_task-picker.ts
|
|
154
|
-
function taskId2(task) {
|
|
155
|
-
return typeof task.id === "string" && task.id.trim() ? task.id : "<unknown>";
|
|
156
|
-
}
|
|
157
|
-
async function selectTaskWithTextPicker(tasks, io = {}) {
|
|
158
|
-
if (tasks.length === 0)
|
|
159
|
-
return null;
|
|
160
|
-
if (tasks.length === 1)
|
|
161
|
-
return tasks[0];
|
|
162
|
-
const isTty2 = io.isTty ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
163
|
-
if (!isTty2) {
|
|
164
|
-
throw new Error("task run requires an interactive terminal to pick a task; pass --task <id>, --next, or --detach with a task id.");
|
|
165
|
-
}
|
|
166
|
-
if (io.prompt || io.renderer) {
|
|
167
|
-
const prompt = io.prompt ?? promptForTaskSelection;
|
|
168
|
-
const renderer = io.renderer ?? { writeLine: (line) => process.stdout.write(`${line}
|
|
169
|
-
`) };
|
|
170
|
-
renderer.writeLine("Select Rig task:");
|
|
171
|
-
for (const row of renderTaskPickerRows(tasks))
|
|
172
|
-
renderer.writeLine(` ${row}`);
|
|
173
|
-
const answer2 = (await prompt(`Task [1-${tasks.length}] or id: `)).trim();
|
|
174
|
-
if (!answer2)
|
|
175
|
-
return null;
|
|
176
|
-
if (/^\d+$/.test(answer2)) {
|
|
177
|
-
const index2 = Number.parseInt(answer2, 10) - 1;
|
|
178
|
-
return tasks[index2] ?? null;
|
|
179
|
-
}
|
|
180
|
-
return tasks.find((task) => taskId2(task) === answer2) ?? null;
|
|
181
|
-
}
|
|
182
|
-
const options = tasks.map((task, index2) => ({
|
|
183
|
-
value: `${index2}`,
|
|
184
|
-
label: `${taskId2(task)} \xB7 ${typeof task.title === "string" && task.title.trim() ? task.title.trim() : "Untitled task"}`,
|
|
185
|
-
hint: typeof task.status === "string" && task.status.trim() ? task.status.trim() : undefined
|
|
186
|
-
}));
|
|
187
|
-
const answer = await droneSelect({
|
|
188
|
-
message: "Select Rig task",
|
|
189
|
-
options
|
|
190
|
-
});
|
|
191
|
-
if (answer === null) {
|
|
192
|
-
droneCancel("No task selected.");
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
const index = Number.parseInt(String(answer), 10);
|
|
196
|
-
return Number.isFinite(index) ? tasks[index] ?? null : null;
|
|
197
|
-
}
|
|
198
|
-
export {
|
|
199
|
-
selectTaskWithTextPicker,
|
|
200
|
-
renderTaskPickerRows
|
|
201
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { type RunnerContext } from "../runner";
|
|
2
|
-
import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
|
|
3
|
-
export type BrowserHelpOptions = {
|
|
4
|
-
color?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function browserHelpText(options?: BrowserHelpOptions): string;
|
|
7
|
-
type BrowserDemoRuntimeOptions = {
|
|
8
|
-
port?: number;
|
|
9
|
-
profile?: string;
|
|
10
|
-
stateDir?: string;
|
|
11
|
-
targetUrl?: string;
|
|
12
|
-
};
|
|
13
|
-
type BrowserDemoRuntime = {
|
|
14
|
-
attachUrl: string;
|
|
15
|
-
browserDir: string;
|
|
16
|
-
env: Record<string, string>;
|
|
17
|
-
helperCommands: string[];
|
|
18
|
-
port: number;
|
|
19
|
-
profile: string;
|
|
20
|
-
stateDir: string;
|
|
21
|
-
targetUrl: string;
|
|
22
|
-
};
|
|
23
|
-
type BrowserDemoAgentCommand = {
|
|
24
|
-
accepted: string[];
|
|
25
|
-
primary: string;
|
|
26
|
-
};
|
|
27
|
-
type BrowserDemoAgentCommands = {
|
|
28
|
-
attach: BrowserDemoAgentCommand;
|
|
29
|
-
attachInfo: BrowserDemoAgentCommand;
|
|
30
|
-
check: BrowserDemoAgentCommand;
|
|
31
|
-
launch: BrowserDemoAgentCommand;
|
|
32
|
-
};
|
|
33
|
-
export declare function buildBrowserDemoRuntime(projectRoot: string, options?: BrowserDemoRuntimeOptions): BrowserDemoRuntime;
|
|
34
|
-
export declare function buildBrowserDemoAgentCommands(runtime: Pick<BrowserDemoRuntime, "attachUrl">): BrowserDemoAgentCommands;
|
|
35
|
-
export declare function normalizeBrowserDemoCommand(value: string): string;
|
|
36
|
-
export declare function browserDemoCommandMatches(value: string, command: BrowserDemoAgentCommand): boolean;
|
|
37
|
-
export declare function browserDemoCommandCompletions(line: string, command: BrowserDemoAgentCommand): [string[], string];
|
|
38
|
-
export declare function formatBrowserDemoCommandOutput(command: string, output: string): string;
|
|
39
|
-
export declare function executeBrowser(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
|
|
40
|
-
export declare function executeBrowserDemo(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
|
|
41
|
-
type BrowserDemoVersionInfo = {
|
|
42
|
-
Browser?: string;
|
|
43
|
-
webSocketDebuggerUrl?: string;
|
|
44
|
-
};
|
|
45
|
-
type BrowserDemoTarget = {
|
|
46
|
-
id?: string;
|
|
47
|
-
title?: string;
|
|
48
|
-
type?: string;
|
|
49
|
-
url?: string;
|
|
50
|
-
webSocketDebuggerUrl?: string;
|
|
51
|
-
};
|
|
52
|
-
type BrowserDemoCdpResult = {
|
|
53
|
-
afterDomState: unknown;
|
|
54
|
-
beforeDomState: unknown;
|
|
55
|
-
consoleEvents: unknown[];
|
|
56
|
-
layoutMetrics: unknown;
|
|
57
|
-
mutationEvaluation: unknown;
|
|
58
|
-
title: string | undefined;
|
|
59
|
-
};
|
|
60
|
-
export declare function formatBrowserDemoCheckOutput(runtime: BrowserDemoRuntime, version: BrowserDemoVersionInfo, pageTarget: BrowserDemoTarget, targets: BrowserDemoTarget[]): string;
|
|
61
|
-
export declare function formatBrowserDemoCdpResult(result: BrowserDemoCdpResult): string;
|
|
62
|
-
export declare function findBrowserDemoPageTarget(runtime: Pick<BrowserDemoRuntime, "targetUrl">, targets: BrowserDemoTarget[]): (BrowserDemoTarget & {
|
|
63
|
-
webSocketDebuggerUrl: string;
|
|
64
|
-
}) | null;
|
|
65
|
-
export {};
|