@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.
Files changed (91) hide show
  1. package/dist/bin/build-rig-binaries.d.ts +2 -0
  2. package/dist/bin/rig.d.ts +2 -0
  3. package/dist/bin/rig.js +10214 -9309
  4. package/dist/src/app/board.d.ts +23 -0
  5. package/dist/src/app/board.js +1786 -0
  6. package/dist/src/app/drone-ui.d.ts +37 -0
  7. package/dist/src/app/drone-ui.js +294 -0
  8. package/dist/src/app/theme.d.ts +47 -0
  9. package/dist/src/{commands/_tui-theme.js → app/theme.js} +16 -1
  10. package/dist/src/commands/_async-ui.d.ts +13 -0
  11. package/dist/src/commands/_async-ui.js +74 -3
  12. package/dist/src/commands/_authority-runs.d.ts +22 -0
  13. package/dist/src/commands/_cli-format.d.ts +49 -0
  14. package/dist/src/commands/_cli-format.js +26 -8
  15. package/dist/src/commands/_connection-state.d.ts +44 -0
  16. package/dist/src/commands/_doctor-checks.d.ts +52 -0
  17. package/dist/src/commands/_doctor-checks.js +3 -1
  18. package/dist/src/commands/_help-catalog.d.ts +51 -0
  19. package/dist/src/commands/_help-catalog.js +9 -70
  20. package/dist/src/commands/_json-output.d.ts +11 -0
  21. package/dist/src/commands/_operator-surface.d.ts +34 -0
  22. package/dist/src/commands/_operator-view.d.ts +30 -0
  23. package/dist/src/commands/_operator-view.js +184 -7
  24. package/dist/src/commands/_parsers.d.ts +15 -0
  25. package/dist/src/commands/_paths.d.ts +11 -0
  26. package/dist/src/commands/_pi-frontend.d.ts +27 -0
  27. package/dist/src/commands/_pi-frontend.js +184 -7
  28. package/dist/src/commands/_pi-install.d.ts +42 -0
  29. package/dist/src/commands/_pi-install.js +1 -1
  30. package/dist/src/commands/_policy.d.ts +8 -0
  31. package/dist/src/commands/_preflight.d.ts +22 -0
  32. package/dist/src/commands/_preflight.js +3 -1
  33. package/dist/src/commands/_probes.d.ts +1 -0
  34. package/dist/src/commands/_run-driver-helpers.d.ts +99 -0
  35. package/dist/src/commands/_run-replay.d.ts +24 -0
  36. package/dist/src/commands/_server-client.d.ts +186 -0
  37. package/dist/src/commands/_server-client.js +3 -1
  38. package/dist/src/commands/_snapshot-upload.d.ts +39 -0
  39. package/dist/src/commands/_snapshot-upload.js +3 -1
  40. package/dist/src/commands/_spinner.d.ts +25 -0
  41. package/dist/src/commands/_task-picker.d.ts +9 -0
  42. package/dist/src/commands/_task-picker.js +132 -7
  43. package/dist/src/commands/agent.d.ts +3 -0
  44. package/dist/src/commands/browser.d.ts +65 -0
  45. package/dist/src/commands/browser.js +306 -30
  46. package/dist/src/commands/connect.d.ts +7 -0
  47. package/dist/src/commands/connect.js +130 -64
  48. package/dist/src/commands/dist.d.ts +28 -0
  49. package/dist/src/commands/doctor.d.ts +3 -0
  50. package/dist/src/commands/doctor.js +77 -4
  51. package/dist/src/commands/github.d.ts +3 -0
  52. package/dist/src/commands/github.js +77 -4
  53. package/dist/src/commands/inbox.d.ts +30 -0
  54. package/dist/src/commands/inbox.js +101 -78
  55. package/dist/src/commands/init.d.ts +74 -0
  56. package/dist/src/commands/init.js +350 -10
  57. package/dist/src/commands/inspect.d.ts +3 -0
  58. package/dist/src/commands/inspect.js +77 -4
  59. package/dist/src/commands/inspector.d.ts +3 -0
  60. package/dist/src/commands/pi.d.ts +3 -0
  61. package/dist/src/commands/plugin.d.ts +16 -0
  62. package/dist/src/commands/profile-and-review.d.ts +4 -0
  63. package/dist/src/commands/queue.d.ts +3 -0
  64. package/dist/src/commands/remote.d.ts +3 -0
  65. package/dist/src/commands/repo-git-harness.d.ts +5 -0
  66. package/dist/src/commands/run.d.ts +3 -0
  67. package/dist/src/commands/run.js +195 -69
  68. package/dist/src/commands/server.d.ts +7 -0
  69. package/dist/src/commands/server.js +133 -65
  70. package/dist/src/commands/setup.d.ts +16 -0
  71. package/dist/src/commands/setup.js +77 -4
  72. package/dist/src/commands/stats.d.ts +12 -0
  73. package/dist/src/commands/stats.js +57 -113
  74. package/dist/src/commands/task-report-bug.d.ts +19 -0
  75. package/dist/src/commands/task-report-bug.js +231 -40
  76. package/dist/src/commands/task-run-driver.d.ts +132 -0
  77. package/dist/src/commands/task-run-driver.js +26 -3
  78. package/dist/src/commands/task.d.ts +14 -0
  79. package/dist/src/commands/task.js +341 -229
  80. package/dist/src/commands/test.d.ts +3 -0
  81. package/dist/src/commands/workspace.d.ts +3 -0
  82. package/dist/src/commands.d.ts +29 -0
  83. package/dist/src/commands.js +10194 -9289
  84. package/dist/src/index.d.ts +4 -0
  85. package/dist/src/index.js +10200 -9295
  86. package/dist/src/launcher.d.ts +61 -0
  87. package/dist/src/report-bug.d.ts +44 -0
  88. package/dist/src/runner.d.ts +47 -0
  89. package/dist/src/withMutedConsole.d.ts +2 -0
  90. package/package.json +10 -9
  91. package/dist/src/commands/_operator-board.js +0 -730
@@ -1,6 +1,324 @@
1
1
  // @bun
2
+ var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true,
12
+ configurable: true,
13
+ set: __exportSetter.bind(all, name)
14
+ });
15
+ };
16
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
2
17
  var __require = import.meta.require;
3
18
 
19
+ // packages/cli/src/app/theme.ts
20
+ function hexToRgb(hex) {
21
+ const value = hex.replace("#", "");
22
+ return [
23
+ Number.parseInt(value.slice(0, 2), 16),
24
+ Number.parseInt(value.slice(2, 4), 16),
25
+ Number.parseInt(value.slice(4, 6), 16)
26
+ ];
27
+ }
28
+ function fg(hex) {
29
+ const [r, g, b] = hexToRgb(hex);
30
+ return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
31
+ }
32
+ function bold(text) {
33
+ return `\x1B[1m${text}\x1B[22m`;
34
+ }
35
+ function microDroneFrame(tick) {
36
+ const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
37
+ const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
38
+ return `(${blade})${eye}(${blade})`;
39
+ }
40
+ function renderMicroDroneFrame(tick) {
41
+ const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
42
+ const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
43
+ return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
44
+ }
45
+ var RIG_PALETTE, ink, ink2, ink3, ink4, accent, accentDim, cyan, red, yellow, DRONE_ART, EYE_FRAMES, DRONE_WIDTH, DRONE_HEIGHT, MICRO_BLADES, MICRO_DRONE_FRAMES;
46
+ var init_theme = __esm(() => {
47
+ RIG_PALETTE = {
48
+ ink: "#f2f3f6",
49
+ ink2: "#aeb0ba",
50
+ ink3: "#6c6e79",
51
+ ink4: "#44464f",
52
+ accent: "#ccff4d",
53
+ accentDim: "#a9d63f",
54
+ cyan: "#56d8ff",
55
+ red: "#ff5d5d",
56
+ yellow: "#ffd24d"
57
+ };
58
+ ink = fg(RIG_PALETTE.ink);
59
+ ink2 = fg(RIG_PALETTE.ink2);
60
+ ink3 = fg(RIG_PALETTE.ink3);
61
+ ink4 = fg(RIG_PALETTE.ink4);
62
+ accent = fg(RIG_PALETTE.accent);
63
+ accentDim = fg(RIG_PALETTE.accentDim);
64
+ cyan = fg(RIG_PALETTE.cyan);
65
+ red = fg(RIG_PALETTE.red);
66
+ yellow = fg(RIG_PALETTE.yellow);
67
+ DRONE_ART = [
68
+ " .-=-. .-=-. ",
69
+ " ( !!! ) ( !!! ) ",
70
+ " '-=-'._ _.'-=-' ",
71
+ " '._ _.' ",
72
+ " '=$$$$$$$=.' ",
73
+ " =$$$$$$$$$$$= ",
74
+ " $$$@@@@@@@@@@$$$ ",
75
+ " $$$@@ @@$$$ ",
76
+ " $$@ ? @$$$ ",
77
+ " $$$@ '-' @$$$ ",
78
+ " $$$@@ @@$$$ ",
79
+ " $$$@@@@@@@@@@$$$ ",
80
+ " =$$$$$$$$$$$= ",
81
+ " '=$$$$$$$=.' ",
82
+ " _.' '._ ",
83
+ " .-=-.' '.-=-. ",
84
+ " ( !!! ) ( !!! ) ",
85
+ " '-=-' '-=-' "
86
+ ];
87
+ EYE_FRAMES = ["@", "o", "."];
88
+ DRONE_WIDTH = DRONE_ART[0].length;
89
+ DRONE_HEIGHT = DRONE_ART.length;
90
+ MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
91
+ MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => microDroneFrame(index));
92
+ });
93
+
94
+ // packages/cli/src/commands/_spinner.ts
95
+ function createTtySpinner(input) {
96
+ const output = input.output ?? process.stdout;
97
+ const isTty = output.isTTY === true;
98
+ const frames = input.frames && input.frames.length > 0 ? input.frames : SPINNER_FRAMES;
99
+ let label = input.label;
100
+ let frame = 0;
101
+ let paused = false;
102
+ let stopped = false;
103
+ let lastPrintedLabel = "";
104
+ const render = () => {
105
+ if (stopped || paused)
106
+ return;
107
+ if (!isTty) {
108
+ if (label !== lastPrintedLabel) {
109
+ output.write(`${label}
110
+ `);
111
+ lastPrintedLabel = label;
112
+ }
113
+ return;
114
+ }
115
+ frame = (frame + 1) % frames.length;
116
+ const glyph = frames[frame] ?? frames[0] ?? "";
117
+ output.write(`\r\x1B[2K${input.styleFrame ? input.styleFrame(glyph) : glyph} ${label}`);
118
+ };
119
+ const clearLine = () => {
120
+ if (isTty)
121
+ output.write("\r\x1B[2K");
122
+ };
123
+ render();
124
+ const timer = isTty ? setInterval(render, input.intervalMs ?? 120) : null;
125
+ return {
126
+ setLabel(next) {
127
+ label = next;
128
+ render();
129
+ },
130
+ pause() {
131
+ paused = true;
132
+ clearLine();
133
+ },
134
+ resume() {
135
+ if (stopped)
136
+ return;
137
+ paused = false;
138
+ render();
139
+ },
140
+ stop(finalLine) {
141
+ if (stopped)
142
+ return;
143
+ stopped = true;
144
+ if (timer)
145
+ clearInterval(timer);
146
+ clearLine();
147
+ if (finalLine)
148
+ output.write(`${finalLine}
149
+ `);
150
+ }
151
+ };
152
+ }
153
+ var SPINNER_FRAMES;
154
+ var init__spinner = __esm(() => {
155
+ SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
156
+ });
157
+
158
+ // packages/cli/src/app/drone-ui.ts
159
+ var exports_drone_ui = {};
160
+ __export(exports_drone_ui, {
161
+ droneWarn: () => droneWarn,
162
+ droneText: () => droneText,
163
+ droneStep: () => droneStep,
164
+ droneSpinner: () => droneSpinner,
165
+ droneSelect: () => droneSelect,
166
+ droneOutro: () => droneOutro,
167
+ droneNote: () => droneNote,
168
+ droneIntro: () => droneIntro,
169
+ droneInfo: () => droneInfo,
170
+ droneError: () => droneError,
171
+ droneConfirm: () => droneConfirm,
172
+ droneCancel: () => droneCancel
173
+ });
174
+ import { ProcessTerminal, TUI, Text, Input, SelectList, matchesKey } from "@earendil-works/pi-tui";
175
+ function hairline(width = Math.min(process.stdout.columns ?? 80, 100)) {
176
+ return ink4("\u2500".repeat(Math.max(10, width)));
177
+ }
178
+ function droneIntro(title, subtitle) {
179
+ console.log("");
180
+ console.log(` ${accent("\u258D")}${bold(ink(title))}${subtitle ? ink3(` \u2014 ${subtitle}`) : ""}`);
181
+ console.log(hairline());
182
+ }
183
+ function droneOutro(text) {
184
+ console.log(hairline());
185
+ console.log(` ${accent("\u25C6")} ${ink2(text)}`);
186
+ console.log("");
187
+ }
188
+ function droneNote(message, title) {
189
+ if (title)
190
+ console.log(` ${accentDim("\u25C7")} ${bold(ink2(title))}`);
191
+ for (const line of message.split(`
192
+ `)) {
193
+ console.log(` ${ink4("\u2502")} ${line}`);
194
+ }
195
+ }
196
+ function droneStep(text) {
197
+ console.log(` ${accent("\u203A")} ${ink(text)}`);
198
+ }
199
+ function droneInfo(text) {
200
+ console.log(` ${cyan("\xB7")} ${ink2(text)}`);
201
+ }
202
+ function droneWarn(text) {
203
+ console.log(` ${yellow("\u25B2")} ${ink2(text)}`);
204
+ }
205
+ function droneError(text) {
206
+ console.log(` ${red("\u2716")} ${ink2(text)}`);
207
+ }
208
+ function droneCancel(text) {
209
+ console.log(` ${red("\u2716")} ${ink3(text)}`);
210
+ }
211
+ function droneSpinner() {
212
+ let active = null;
213
+ return {
214
+ start(message) {
215
+ active = createTtySpinner({
216
+ label: message,
217
+ frames: MICRO_DRONE_FRAMES,
218
+ styleFrame: (frame) => renderMicroDroneFrame(Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame)))
219
+ });
220
+ },
221
+ stop(message) {
222
+ active?.stop(message ? ` ${accent("\u25C6")} ${ink2(message)}` : undefined);
223
+ active = null;
224
+ },
225
+ error(message) {
226
+ active?.stop(message ? ` ${red("\u2716")} ${ink2(message)}` : undefined);
227
+ active = null;
228
+ }
229
+ };
230
+ }
231
+ async function runMiniTui(build) {
232
+ const terminal = new ProcessTerminal;
233
+ const tui = new TUI(terminal);
234
+ let settled = false;
235
+ return await new Promise((resolve6) => {
236
+ const finish = (result) => {
237
+ if (settled)
238
+ return;
239
+ settled = true;
240
+ tui.stop();
241
+ resolve6(result);
242
+ };
243
+ build(tui, finish);
244
+ tui.start();
245
+ });
246
+ }
247
+ async function droneSelect(input) {
248
+ if (!isTty() || input.options.length === 0) {
249
+ return input.initialValue ?? input.options[0]?.value ?? null;
250
+ }
251
+ return runMiniTui((tui, finish) => {
252
+ tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}`));
253
+ const items = input.options.map((option) => ({
254
+ value: option.value,
255
+ label: option.label,
256
+ ...option.hint ? { description: option.hint } : {}
257
+ }));
258
+ const list = new SelectList(items, Math.min(items.length, 12), SELECT_THEME);
259
+ const initialIndex = input.initialValue ? items.findIndex((item) => item.value === input.initialValue) : -1;
260
+ if (initialIndex > 0)
261
+ list.setSelectedIndex(initialIndex);
262
+ list.onSelect = (item) => finish(item.value);
263
+ list.onCancel = () => finish(null);
264
+ tui.addChild(list);
265
+ tui.addChild(new Text(ink4(" \u2191\u2193 navigate \xB7 enter select \xB7 esc cancel")));
266
+ tui.setFocus(list);
267
+ tui.addInputListener((data) => {
268
+ if (matchesKey(data, "ctrl+c") || matchesKey(data, "escape")) {
269
+ finish(null);
270
+ return { consume: true };
271
+ }
272
+ return;
273
+ });
274
+ });
275
+ }
276
+ async function droneText(input) {
277
+ if (!isTty())
278
+ return input.initialValue ?? null;
279
+ return runMiniTui((tui, finish) => {
280
+ tui.addChild(new Text(` ${accent("\u258D")}${bold(ink(input.message))}${input.placeholder ? ink4(` (${input.placeholder})`) : ""}`));
281
+ const field = new Input;
282
+ if (input.initialValue)
283
+ field.setValue(input.initialValue);
284
+ field.onSubmit = (value) => finish(value);
285
+ field.onEscape = () => finish(null);
286
+ tui.addChild(field);
287
+ tui.addChild(new Text(ink4(" enter submit \xB7 esc cancel")));
288
+ tui.setFocus(field);
289
+ tui.addInputListener((data) => {
290
+ if (matchesKey(data, "ctrl+c")) {
291
+ finish(null);
292
+ return { consume: true };
293
+ }
294
+ return;
295
+ });
296
+ });
297
+ }
298
+ async function droneConfirm(input) {
299
+ const answer = await droneSelect({
300
+ message: input.message,
301
+ options: [
302
+ { value: "yes", label: "Yes" },
303
+ { value: "no", label: "No" }
304
+ ],
305
+ initialValue: input.initialValue === false ? "no" : "yes"
306
+ });
307
+ return answer === null ? null : answer === "yes";
308
+ }
309
+ var isTty = () => Boolean(process.stdout.isTTY), SELECT_THEME;
310
+ var init_drone_ui = __esm(() => {
311
+ init_theme();
312
+ init__spinner();
313
+ SELECT_THEME = {
314
+ selectedPrefix: (text) => accent(text),
315
+ selectedText: (text) => bold(ink(text)),
316
+ description: (text) => ink3(text),
317
+ scrollInfo: (text) => ink4(text),
318
+ noMatch: (text) => ink3(text)
319
+ };
320
+ });
321
+
4
322
  // packages/cli/src/commands/init.ts
5
323
  import { appendFileSync, existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
6
324
  import { spawnSync } from "child_process";
@@ -361,7 +679,9 @@ ${failure.contextLine}`, 1, { hint: failure.hint });
361
679
  })() : null;
362
680
  if (!response.ok) {
363
681
  const diagnostics = diagnosticMessage(payload);
364
- const detail = diagnostics ?? (text || response.statusText);
682
+ const rawDetail = diagnostics ?? (text || response.statusText);
683
+ const detail = diagnostics ? rawDetail : rawDetail.split(`
684
+ `).map((line) => line.trim()).find((line) => line.length > 0)?.slice(0, 200) ?? response.statusText;
365
685
  const failure = await buildServerFailureContext(context.projectRoot, server);
366
686
  throw new CliError(`Rig server request failed (${response.status}): ${detail}
367
687
  ${failure.contextLine}`, 1, { hint: failure.hint });
@@ -515,7 +835,7 @@ async function ensurePiBinaryAvailable(input) {
515
835
  }
516
836
  return { ok: true, detail: (current.stdout || current.stderr).trim() || undefined };
517
837
  }
518
- const installCommand = process.env.RIG_PI_INSTALL_COMMAND?.trim() || "bunx @earendil-works/pi@latest install";
838
+ const installCommand = process.env.RIG_PI_INSTALL_COMMAND?.trim() || "bunx @earendil-works/pi-coding-agent@latest install";
519
839
  const parts = splitInstallCommand(installCommand);
520
840
  if (parts.length === 0) {
521
841
  return { ok: false, error: (current.stderr || current.stdout).trim() || "pi --version failed" };
@@ -1079,18 +1399,38 @@ function refreshGhProjectScopesAndReadToken() {
1079
1399
  return null;
1080
1400
  }
1081
1401
  }
1402
+ var DRONE_CANCEL = Symbol("drone-cancel");
1082
1403
  async function loadClackPrompts() {
1083
- return await import("@clack/prompts");
1084
- }
1085
- function clackTextOptions(options) {
1404
+ const drone = await Promise.resolve().then(() => (init_drone_ui(), exports_drone_ui));
1086
1405
  return {
1087
- message: options.message,
1088
- ...options.placeholder ? { placeholder: options.placeholder } : {},
1089
- ...(options.initialValue ?? options.defaultValue)?.trim() ? { initialValue: (options.initialValue ?? options.defaultValue).trim() } : {}
1406
+ intro: (message) => drone.droneIntro(message),
1407
+ outro: (message) => drone.droneOutro(message),
1408
+ cancel: (message) => drone.droneCancel(message),
1409
+ isCancel: (value) => value === DRONE_CANCEL,
1410
+ text: async (options) => {
1411
+ const value = await drone.droneText({
1412
+ message: options.message,
1413
+ ...options.placeholder ? { placeholder: options.placeholder } : {},
1414
+ ...(options.initialValue ?? options.defaultValue)?.trim() ? { initialValue: (options.initialValue ?? options.defaultValue).trim() } : {}
1415
+ });
1416
+ return value === null ? DRONE_CANCEL : value;
1417
+ },
1418
+ select: async (options) => {
1419
+ const value = await drone.droneSelect({
1420
+ message: options.message,
1421
+ options: options.options,
1422
+ ...options.initialValue ? { initialValue: options.initialValue } : {}
1423
+ });
1424
+ return value === null ? DRONE_CANCEL : value;
1425
+ },
1426
+ confirm: async (options) => {
1427
+ const value = await drone.droneConfirm(options);
1428
+ return value === null ? DRONE_CANCEL : value;
1429
+ }
1090
1430
  };
1091
1431
  }
1092
1432
  async function promptRequiredText(prompts, options) {
1093
- const value = await prompts.text(clackTextOptions(options));
1433
+ const value = await prompts.text(options);
1094
1434
  if (prompts.isCancel(value))
1095
1435
  throw new CliError("Init cancelled.", 1);
1096
1436
  const text = String(value ?? "").trim();
@@ -1099,7 +1439,7 @@ async function promptRequiredText(prompts, options) {
1099
1439
  return text;
1100
1440
  }
1101
1441
  async function promptOptionalText(prompts, options) {
1102
- const value = await prompts.text(clackTextOptions(options));
1442
+ const value = await prompts.text(options);
1103
1443
  if (prompts.isCancel(value))
1104
1444
  throw new CliError("Init cancelled.", 1);
1105
1445
  return String(value ?? "").trim();
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeInspect(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -357,7 +357,9 @@ ${failure.contextLine}`, 1, { hint: failure.hint });
357
357
  })() : null;
358
358
  if (!response.ok) {
359
359
  const diagnostics = diagnosticMessage(payload);
360
- const detail = diagnostics ?? (text || response.statusText);
360
+ const rawDetail = diagnostics ?? (text || response.statusText);
361
+ const detail = diagnostics ? rawDetail : rawDetail.split(`
362
+ `).map((line) => line.trim()).find((line) => line.length > 0)?.slice(0, 200) ?? response.statusText;
361
363
  const failure = await buildServerFailureContext(context.projectRoot, server);
362
364
  throw new CliError(`Rig server request failed (${response.status}): ${detail}
363
365
  ${failure.contextLine}`, 1, { hint: failure.hint });
@@ -457,8 +459,79 @@ function createTtySpinner(input) {
457
459
  };
458
460
  }
459
461
 
462
+ // packages/cli/src/app/theme.ts
463
+ var RIG_PALETTE = {
464
+ ink: "#f2f3f6",
465
+ ink2: "#aeb0ba",
466
+ ink3: "#6c6e79",
467
+ ink4: "#44464f",
468
+ accent: "#ccff4d",
469
+ accentDim: "#a9d63f",
470
+ cyan: "#56d8ff",
471
+ red: "#ff5d5d",
472
+ yellow: "#ffd24d"
473
+ };
474
+ function hexToRgb(hex) {
475
+ const value = hex.replace("#", "");
476
+ return [
477
+ Number.parseInt(value.slice(0, 2), 16),
478
+ Number.parseInt(value.slice(2, 4), 16),
479
+ Number.parseInt(value.slice(4, 6), 16)
480
+ ];
481
+ }
482
+ function fg(hex) {
483
+ const [r, g, b] = hexToRgb(hex);
484
+ return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
485
+ }
486
+ var ink = fg(RIG_PALETTE.ink);
487
+ var ink2 = fg(RIG_PALETTE.ink2);
488
+ var ink3 = fg(RIG_PALETTE.ink3);
489
+ var ink4 = fg(RIG_PALETTE.ink4);
490
+ var accent = fg(RIG_PALETTE.accent);
491
+ var accentDim = fg(RIG_PALETTE.accentDim);
492
+ var cyan = fg(RIG_PALETTE.cyan);
493
+ var red = fg(RIG_PALETTE.red);
494
+ var yellow = fg(RIG_PALETTE.yellow);
495
+ function bold(text) {
496
+ return `\x1B[1m${text}\x1B[22m`;
497
+ }
498
+ var DRONE_ART = [
499
+ " .-=-. .-=-. ",
500
+ " ( !!! ) ( !!! ) ",
501
+ " '-=-'._ _.'-=-' ",
502
+ " '._ _.' ",
503
+ " '=$$$$$$$=.' ",
504
+ " =$$$$$$$$$$$= ",
505
+ " $$$@@@@@@@@@@$$$ ",
506
+ " $$$@@ @@$$$ ",
507
+ " $$@ ? @$$$ ",
508
+ " $$$@ '-' @$$$ ",
509
+ " $$$@@ @@$$$ ",
510
+ " $$$@@@@@@@@@@$$$ ",
511
+ " =$$$$$$$$$$$= ",
512
+ " '=$$$$$$$=.' ",
513
+ " _.' '._ ",
514
+ " .-=-.' '.-=-. ",
515
+ " ( !!! ) ( !!! ) ",
516
+ " '-=-' '-=-' "
517
+ ];
518
+ var EYE_FRAMES = ["@", "o", "."];
519
+ var DRONE_WIDTH = DRONE_ART[0].length;
520
+ var DRONE_HEIGHT = DRONE_ART.length;
521
+ var MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
522
+ function microDroneFrame(tick) {
523
+ const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
524
+ const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
525
+ return `(${blade})${eye}(${blade})`;
526
+ }
527
+ var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => microDroneFrame(index));
528
+ function renderMicroDroneFrame(tick) {
529
+ const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
530
+ const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
531
+ return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
532
+ }
533
+
460
534
  // packages/cli/src/commands/_async-ui.ts
461
- var CLACK_SPINNER_FRAMES = ["\u25D2", "\u25D0", "\u25D3", "\u25D1"];
462
535
  var DONE_SYMBOL = pc.green("\u25C7");
463
536
  var FAIL_SYMBOL = pc.red("\u25A0");
464
537
  var activeUpdate = null;
@@ -492,8 +565,8 @@ async function withSpinner(label, work, options = {}) {
492
565
  const spinner = createTtySpinner({
493
566
  label,
494
567
  output,
495
- frames: CLACK_SPINNER_FRAMES,
496
- styleFrame: (frame) => pc.magenta(frame)
568
+ frames: MICRO_DRONE_FRAMES,
569
+ styleFrame: (frame) => renderMicroDroneFrame(Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame)))
497
570
  });
498
571
  const update = (next) => {
499
572
  lastLabel = next;
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeInspector(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executePi(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,16 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executePlugin(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
4
+ /**
5
+ * Resolve a plugin CLI command by exact id ("my-plugin:deploy") or by the
6
+ * unambiguous local part after the namespace colon ("deploy").
7
+ */
8
+ export declare function resolvePluginCliCommand(commands: readonly {
9
+ id: string;
10
+ command: string;
11
+ description?: string;
12
+ }[], requested: string): {
13
+ id: string;
14
+ command: string;
15
+ description?: string;
16
+ } | undefined;
@@ -0,0 +1,4 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeProfile(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
4
+ export declare function executeReview(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeQueue(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeRemote(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,5 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeRepo(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
4
+ export declare function executeGit(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
5
+ export declare function executeHarness(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeRun(context: RunnerContext, args: string[]): Promise<CommandOutcome>;