@h-rig/cli 0.0.6-alpha.76 → 0.0.6-alpha.77

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/rig.js CHANGED
@@ -1119,6 +1119,125 @@ var init__server_client = __esm(() => {
1119
1119
  ]);
1120
1120
  });
1121
1121
 
1122
+ // packages/cli/src/commands/_tui-theme.ts
1123
+ function hexToRgb(hex) {
1124
+ const value = hex.replace("#", "");
1125
+ return [
1126
+ Number.parseInt(value.slice(0, 2), 16),
1127
+ Number.parseInt(value.slice(2, 4), 16),
1128
+ Number.parseInt(value.slice(4, 6), 16)
1129
+ ];
1130
+ }
1131
+ function fg(hex) {
1132
+ const [r, g, b] = hexToRgb(hex);
1133
+ return (text2) => `\x1B[38;2;${r};${g};${b}m${text2}\x1B[39m`;
1134
+ }
1135
+ function bold(text2) {
1136
+ return `\x1B[1m${text2}\x1B[22m`;
1137
+ }
1138
+ function statusColor(status) {
1139
+ switch (status) {
1140
+ case "running":
1141
+ return accent;
1142
+ case "preparing":
1143
+ case "created":
1144
+ case "validating":
1145
+ case "reviewing":
1146
+ case "closing-out":
1147
+ return cyan;
1148
+ case "needs-attention":
1149
+ case "needs_attention":
1150
+ return yellow;
1151
+ case "failed":
1152
+ return red;
1153
+ default:
1154
+ return ink3;
1155
+ }
1156
+ }
1157
+ function droneCharColor(char) {
1158
+ if (char === "$" || char === "@")
1159
+ return accent;
1160
+ if (char === "=" || char === "%")
1161
+ return accentDim;
1162
+ if (char === "\\" || char === "/")
1163
+ return ink3;
1164
+ return ink4;
1165
+ }
1166
+ function renderDroneFrame(tick) {
1167
+ const blade = BLADE_FRAMES[Math.floor(tick / 4) % BLADE_FRAMES.length];
1168
+ const pulse = Math.sin(tick * 0.07);
1169
+ const eye = pulse > 0.45 ? EYE_FRAMES[0] : pulse > -0.1 ? EYE_FRAMES[1] : EYE_FRAMES[2];
1170
+ return DRONE_ART.map((line) => {
1171
+ let out = "";
1172
+ let index = 0;
1173
+ while (index < line.length) {
1174
+ if (line.startsWith("!!!", index)) {
1175
+ out += cyan(blade);
1176
+ index += 3;
1177
+ continue;
1178
+ }
1179
+ const char = line[index];
1180
+ if (char === "?") {
1181
+ out += bold(cyan(eye));
1182
+ } else if (char !== " ") {
1183
+ out += droneCharColor(char)(char);
1184
+ } else {
1185
+ out += " ";
1186
+ }
1187
+ index += 1;
1188
+ }
1189
+ return out;
1190
+ });
1191
+ }
1192
+ var RIG_PALETTE, ink, ink2, ink3, ink4, accent, accentDim, cyan, red, yellow, RIG_SPINNER_FRAMES, DRONE_ART, BLADE_FRAMES, EYE_FRAMES, DRONE_WIDTH, DRONE_HEIGHT;
1193
+ var init__tui_theme = __esm(() => {
1194
+ RIG_PALETTE = {
1195
+ ink: "#f2f3f6",
1196
+ ink2: "#aeb0ba",
1197
+ ink3: "#6c6e79",
1198
+ ink4: "#44464f",
1199
+ accent: "#ccff4d",
1200
+ accentDim: "#a9d63f",
1201
+ cyan: "#56d8ff",
1202
+ red: "#ff5d5d",
1203
+ yellow: "#ffd24d"
1204
+ };
1205
+ ink = fg(RIG_PALETTE.ink);
1206
+ ink2 = fg(RIG_PALETTE.ink2);
1207
+ ink3 = fg(RIG_PALETTE.ink3);
1208
+ ink4 = fg(RIG_PALETTE.ink4);
1209
+ accent = fg(RIG_PALETTE.accent);
1210
+ accentDim = fg(RIG_PALETTE.accentDim);
1211
+ cyan = fg(RIG_PALETTE.cyan);
1212
+ red = fg(RIG_PALETTE.red);
1213
+ yellow = fg(RIG_PALETTE.yellow);
1214
+ RIG_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
1215
+ DRONE_ART = [
1216
+ " .-=-. .-=-. ",
1217
+ " ( !!! ) ( !!! ) ",
1218
+ " '-=-'._ _.'-=-' ",
1219
+ " '._ _.' ",
1220
+ " '=$$$$$$$=.' ",
1221
+ " =$$$$$$$$$$$= ",
1222
+ " $$$@@@@@@@@@@$$$ ",
1223
+ " $$$@@ @@$$$ ",
1224
+ " $$@ ? @$$$ ",
1225
+ " $$$@ '-' @$$$ ",
1226
+ " $$$@@ @@$$$ ",
1227
+ " $$$@@@@@@@@@@$$$ ",
1228
+ " =$$$$$$$$$$$= ",
1229
+ " '=$$$$$$$=.' ",
1230
+ " _.' '._ ",
1231
+ " .-=-.' '.-=-. ",
1232
+ " ( !!! ) ( !!! ) ",
1233
+ " '-=-' '-=-' "
1234
+ ];
1235
+ BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
1236
+ EYE_FRAMES = ["@", "o", "."];
1237
+ DRONE_WIDTH = DRONE_ART[0].length;
1238
+ DRONE_HEIGHT = DRONE_ART.length;
1239
+ });
1240
+
1122
1241
  // packages/cli/src/commands/_cli-format.ts
1123
1242
  import { log as log3, note as note3 } from "@clack/prompts";
1124
1243
  import pc3 from "picocolors";
@@ -1148,17 +1267,17 @@ function truncate(value, width) {
1148
1267
  function pad(value, width) {
1149
1268
  return value.length >= width ? value : `${value}${" ".repeat(width - value.length)}`;
1150
1269
  }
1151
- function statusColor(status) {
1270
+ function statusColor2(status) {
1152
1271
  const normalized = status.toLowerCase();
1153
- if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
1154
- return pc3.green;
1272
+ if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved", "running"].includes(normalized))
1273
+ return accent;
1155
1274
  if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
1156
- return pc3.red;
1157
- if (["running", "reviewing", "validating", "in_progress", "in-progress", "remote"].includes(normalized))
1158
- return pc3.cyan;
1159
- if (["ready", "open", "queued", "created", "preparing", "local", "pending"].includes(normalized))
1160
- return pc3.yellow;
1161
- return pc3.dim;
1275
+ return red;
1276
+ if (["reviewing", "validating", "in_progress", "in-progress", "remote", "preparing", "closing-out"].includes(normalized))
1277
+ return cyan;
1278
+ if (["ready", "open", "queued", "created", "local", "pending"].includes(normalized))
1279
+ return yellow;
1280
+ return themeDim;
1162
1281
  }
1163
1282
  function compactDate(value) {
1164
1283
  if (!value.trim())
@@ -1214,20 +1333,20 @@ function printFormattedOutput(message2, options = {}) {
1214
1333
  }
1215
1334
  function formatStatusPill(status) {
1216
1335
  const label = status || "unknown";
1217
- return statusColor(label)(`\u25CF ${label}`);
1336
+ return statusColor2(label)(`\u25CF ${label}`);
1218
1337
  }
1219
1338
  function formatSection(title, subtitle) {
1220
- return `${pc3.bold(pc3.cyan("\u25C6"))} ${pc3.bold(title)}${subtitle ? pc3.dim(` \u2014 ${subtitle}`) : ""}`;
1339
+ return `${pc3.bold(accent("\u25C6"))} ${pc3.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
1221
1340
  }
1222
1341
  function formatSuccessCard(title, rows = []) {
1223
- const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${pc3.dim("\u2502")} ${pc3.dim(key.padEnd(12))} ${value}`);
1342
+ const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${themeFaint("\u2502")} ${themeDim(key.padEnd(12))} ${value}`);
1224
1343
  return [formatSection(title), ...body].join(`
1225
1344
  `);
1226
1345
  }
1227
1346
  function formatNextSteps(steps) {
1228
1347
  if (steps.length === 0)
1229
1348
  return [];
1230
- return [pc3.bold("Next"), ...steps.map((step) => `${pc3.dim("\u203A")} ${step}`)];
1349
+ return [pc3.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
1231
1350
  }
1232
1351
  function formatTaskList(tasks, options = {}) {
1233
1352
  if (options.raw)
@@ -1249,11 +1368,11 @@ function formatTaskList(tasks, options = {}) {
1249
1368
  const statusWidth = Math.min(16, Math.max(6, ...rows.map((row) => row.status.length)));
1250
1369
  const header = `${pc3.bold(pad("TASK", idWidth))} ${pc3.bold(pad("STATUS", statusWidth))} ${pc3.bold("TITLE")}`;
1251
1370
  const body = rows.map((row) => {
1252
- const labels = row.labels.length > 0 ? pc3.dim(` ${row.labels.slice(0, 4).map((label) => `#${label}`).join(" ")}`) : "";
1253
- const source = row.source ? pc3.dim(` ${row.source}`) : "";
1371
+ const labels = row.labels.length > 0 ? themeDim(` ${row.labels.slice(0, 4).map((label) => `#${label}`).join(" ")}`) : "";
1372
+ const source = row.source ? themeDim(` ${row.source}`) : "";
1254
1373
  return [
1255
1374
  pc3.bold(pad(truncate(row.id, idWidth), idWidth)),
1256
- statusColor(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
1375
+ statusColor2(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
1257
1376
  `${row.title}${labels}${source}`
1258
1377
  ].join(" ");
1259
1378
  });
@@ -1298,7 +1417,7 @@ function formatRunList(runs, options = {}) {
1298
1417
  if (runs.length === 0) {
1299
1418
  return [
1300
1419
  formatSection("Runs", "none recorded"),
1301
- options.source === "server" ? pc3.dim("No runs recorded on the selected Rig server.") : pc3.dim("No runs recorded in .rig/runs."),
1420
+ options.source === "server" ? themeDim("No runs recorded on the selected Rig server.") : themeDim("No runs recorded in .rig/runs."),
1302
1421
  "",
1303
1422
  ...formatNextSteps(["Start one: `rig task run --next`", "Check server: `rig server status`"])
1304
1423
  ].join(`
@@ -1317,8 +1436,8 @@ function formatRunList(runs, options = {}) {
1317
1436
  const header = `${pc3.bold(pad("RUN", idWidth))} ${pc3.bold(pad("STATUS", statusWidth))} ${pc3.bold("TITLE")}`;
1318
1437
  const body = rows.map((row) => [
1319
1438
  pc3.bold(pad(truncate(row.runId, idWidth), idWidth)),
1320
- statusColor(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
1321
- `${row.title}${row.runtime ? pc3.dim(` ${row.runtime}`) : ""}`
1439
+ statusColor2(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
1440
+ `${row.title}${row.runtime ? themeDim(` ${row.runtime}`) : ""}`
1322
1441
  ].join(" "));
1323
1442
  return [formatSection("Runs", options.source === "server" ? "selected server" : "local state"), header, ...body, "", ...formatNextSteps(["Follow live: `rig run attach <run-id> --follow`", "Details: `rig run show <run-id>`"])].join(`
1324
1443
  `);
@@ -1392,7 +1511,7 @@ function formatRunStatus(summary, options = {}) {
1392
1511
  const lines = [formatSection("Run status", options.source === "server" ? "selected server" : "local state")];
1393
1512
  lines.push("", pc3.bold(`Active runs (${activeRuns.length})`));
1394
1513
  if (activeRuns.length === 0) {
1395
- lines.push(pc3.dim("No active runs."));
1514
+ lines.push(themeDim("No active runs."));
1396
1515
  } else {
1397
1516
  for (const run of activeRuns) {
1398
1517
  lines.push(formatRunSummaryLine(run));
@@ -1400,7 +1519,7 @@ function formatRunStatus(summary, options = {}) {
1400
1519
  }
1401
1520
  lines.push("", pc3.bold(`Recent runs (${recentRuns.length})`));
1402
1521
  if (recentRuns.length === 0) {
1403
- lines.push(pc3.dim("No recent terminal runs."));
1522
+ lines.push(themeDim("No recent terminal runs."));
1404
1523
  } else {
1405
1524
  for (const run of recentRuns.slice(0, 10)) {
1406
1525
  lines.push(formatRunSummaryLine(run));
@@ -1418,14 +1537,14 @@ function formatRunSummaryLine(run) {
1418
1537
  const title = runTitleOf(record);
1419
1538
  const runtime = firstString(record, ["runtimeAdapter", "runtime", "adapter"]);
1420
1539
  const descriptor = [taskId, title].filter(Boolean).join(" \xB7 ");
1421
- return `${pc3.dim("\u2502")} ${pc3.bold(runId)} ${formatStatusPill(status)} ${descriptor}${runtime ? pc3.dim(` ${runtime}`) : ""}`;
1540
+ return `${themeFaint("\u2502")} ${pc3.bold(runId)} ${formatStatusPill(status)} ${descriptor}${runtime ? themeDim(` ${runtime}`) : ""}`;
1422
1541
  }
1423
1542
  function formatInboxList(kind, entries) {
1424
1543
  const title = kind === "approvals" ? "Approval inbox" : "Input inbox";
1425
1544
  if (entries.length === 0) {
1426
1545
  return [
1427
1546
  formatSection(title, "empty"),
1428
- pc3.dim(kind === "approvals" ? "No pending approvals." : "No pending user-input requests."),
1547
+ themeDim(kind === "approvals" ? "No pending approvals." : "No pending user-input requests."),
1429
1548
  "",
1430
1549
  ...formatNextSteps(["Check runs: `rig run status`", "Start work: `rig task run --next`"])
1431
1550
  ].join(`
@@ -1439,8 +1558,8 @@ function formatInboxList(kind, entries) {
1439
1558
  const requestId = requestIdOf(record);
1440
1559
  const status = firstString(record, ["status", "state"], "pending");
1441
1560
  const prompt = firstString(record, ["prompt", "message", "reason", "title", "summary"], kind === "approvals" ? "Approval requested" : "Input requested");
1442
- lines.push(`${pc3.dim("\u2502")} ${pc3.bold(requestId)} ${formatStatusPill(status)} ${prompt}`);
1443
- lines.push(`${pc3.dim("\u2502")} ${pc3.dim("run ")} ${runId || "(unknown-run)"}${taskId ? pc3.dim(` task ${taskId}`) : ""}`);
1561
+ lines.push(`${themeFaint("\u2502")} ${pc3.bold(requestId)} ${formatStatusPill(status)} ${prompt}`);
1562
+ lines.push(`${themeFaint("\u2502")} ${themeDim("run ")} ${runId || "(unknown-run)"}${taskId ? themeDim(` task ${taskId}`) : ""}`);
1444
1563
  }
1445
1564
  lines.push("", ...formatNextSteps(kind === "approvals" ? ["Resolve: `rig inbox approve --run <run-id> --request <request-id> --decision approve|reject`", "Rejoin: `rig run attach <run-id> --follow`"] : ["Respond: `rig inbox respond --run <run-id> --request <request-id> --answer key=value`", "Rejoin: `rig run attach <run-id> --follow`"]));
1446
1565
  return lines.join(`
@@ -1462,15 +1581,18 @@ function formatConnectionStatus(selected, connections) {
1462
1581
  const target = !connection ? "not configured" : connection.kind === "remote" ? connection.baseUrl : "local";
1463
1582
  return [
1464
1583
  formatSection("Rig server", "selected for this repo"),
1465
- `${pc3.dim("\u2502")} ${pc3.dim("selected ")} ${pc3.bold(selected)}`,
1466
- `${pc3.dim("\u2502")} ${pc3.dim("kind ")} ${formatStatusPill(connection?.kind ?? "unknown")}`,
1467
- `${pc3.dim("\u2502")} ${pc3.dim("target ")} ${target ?? "not configured"}`,
1584
+ `${themeFaint("\u2502")} ${themeDim("selected ")} ${pc3.bold(selected)}`,
1585
+ `${themeFaint("\u2502")} ${themeDim("kind ")} ${formatStatusPill(connection?.kind ?? "unknown")}`,
1586
+ `${themeFaint("\u2502")} ${themeDim("target ")} ${target ?? "not configured"}`,
1468
1587
  "",
1469
1588
  ...formatNextSteps(["Change: `rig server use <alias|local>`", "List saved servers: `rig server list`"])
1470
1589
  ].join(`
1471
1590
  `);
1472
1591
  }
1473
- var init__cli_format = () => {};
1592
+ var themeDim = (value) => ink3(value), themeFaint = (value) => ink4(value);
1593
+ var init__cli_format = __esm(() => {
1594
+ init__tui_theme();
1595
+ });
1474
1596
 
1475
1597
  // packages/cli/src/commands/_spinner.ts
1476
1598
  function createTtySpinner(input) {
@@ -1920,125 +2042,6 @@ var init__pi_frontend = __esm(() => {
1920
2042
  init__async_ui();
1921
2043
  });
1922
2044
 
1923
- // packages/cli/src/commands/_tui-theme.ts
1924
- function hexToRgb(hex) {
1925
- const value = hex.replace("#", "");
1926
- return [
1927
- Number.parseInt(value.slice(0, 2), 16),
1928
- Number.parseInt(value.slice(2, 4), 16),
1929
- Number.parseInt(value.slice(4, 6), 16)
1930
- ];
1931
- }
1932
- function fg(hex) {
1933
- const [r, g, b] = hexToRgb(hex);
1934
- return (text3) => `\x1B[38;2;${r};${g};${b}m${text3}\x1B[39m`;
1935
- }
1936
- function bold(text3) {
1937
- return `\x1B[1m${text3}\x1B[22m`;
1938
- }
1939
- function statusColor2(status) {
1940
- switch (status) {
1941
- case "running":
1942
- return accent;
1943
- case "preparing":
1944
- case "created":
1945
- case "validating":
1946
- case "reviewing":
1947
- case "closing-out":
1948
- return cyan;
1949
- case "needs-attention":
1950
- case "needs_attention":
1951
- return yellow;
1952
- case "failed":
1953
- return red;
1954
- default:
1955
- return ink3;
1956
- }
1957
- }
1958
- function droneCharColor(char) {
1959
- if (char === "$" || char === "@")
1960
- return accent;
1961
- if (char === "=" || char === "%")
1962
- return accentDim;
1963
- if (char === "\\" || char === "/")
1964
- return ink3;
1965
- return ink4;
1966
- }
1967
- function renderDroneFrame(tick) {
1968
- const blade = BLADE_FRAMES[Math.floor(tick / 4) % BLADE_FRAMES.length];
1969
- const pulse = Math.sin(tick * 0.07);
1970
- const eye = pulse > 0.45 ? EYE_FRAMES[0] : pulse > -0.1 ? EYE_FRAMES[1] : EYE_FRAMES[2];
1971
- return DRONE_ART.map((line) => {
1972
- let out = "";
1973
- let index = 0;
1974
- while (index < line.length) {
1975
- if (line.startsWith("!!!", index)) {
1976
- out += cyan(blade);
1977
- index += 3;
1978
- continue;
1979
- }
1980
- const char = line[index];
1981
- if (char === "?") {
1982
- out += bold(cyan(eye));
1983
- } else if (char !== " ") {
1984
- out += droneCharColor(char)(char);
1985
- } else {
1986
- out += " ";
1987
- }
1988
- index += 1;
1989
- }
1990
- return out;
1991
- });
1992
- }
1993
- var RIG_PALETTE, ink, ink2, ink3, ink4, accent, accentDim, cyan, red, yellow, RIG_SPINNER_FRAMES, DRONE_ART, BLADE_FRAMES, EYE_FRAMES, DRONE_WIDTH, DRONE_HEIGHT;
1994
- var init__tui_theme = __esm(() => {
1995
- RIG_PALETTE = {
1996
- ink: "#f2f3f6",
1997
- ink2: "#aeb0ba",
1998
- ink3: "#6c6e79",
1999
- ink4: "#44464f",
2000
- accent: "#ccff4d",
2001
- accentDim: "#a9d63f",
2002
- cyan: "#56d8ff",
2003
- red: "#ff5d5d",
2004
- yellow: "#ffd24d"
2005
- };
2006
- ink = fg(RIG_PALETTE.ink);
2007
- ink2 = fg(RIG_PALETTE.ink2);
2008
- ink3 = fg(RIG_PALETTE.ink3);
2009
- ink4 = fg(RIG_PALETTE.ink4);
2010
- accent = fg(RIG_PALETTE.accent);
2011
- accentDim = fg(RIG_PALETTE.accentDim);
2012
- cyan = fg(RIG_PALETTE.cyan);
2013
- red = fg(RIG_PALETTE.red);
2014
- yellow = fg(RIG_PALETTE.yellow);
2015
- RIG_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
2016
- DRONE_ART = [
2017
- " .-=-. .-=-. ",
2018
- " ( !!! ) ( !!! ) ",
2019
- " '-=-'._ _.'-=-' ",
2020
- " '._ _.' ",
2021
- " '=$$$$$$$=.' ",
2022
- " =$$$$$$$$$$$= ",
2023
- " $$$@@@@@@@@@@$$$ ",
2024
- " $$$@@ @@$$$ ",
2025
- " $$@ ? @$$$ ",
2026
- " $$$@ '-' @$$$ ",
2027
- " $$$@@ @@$$$ ",
2028
- " $$$@@@@@@@@@@$$$ ",
2029
- " =$$$$$$$$$$$= ",
2030
- " '=$$$$$$$=.' ",
2031
- " _.' '._ ",
2032
- " .-=-.' '.-=-. ",
2033
- " ( !!! ) ( !!! ) ",
2034
- " '-=-' '-=-' "
2035
- ];
2036
- BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
2037
- EYE_FRAMES = ["@", "o", "."];
2038
- DRONE_WIDTH = DRONE_ART[0].length;
2039
- DRONE_HEIGHT = DRONE_ART.length;
2040
- });
2041
-
2042
2045
  // packages/cli/src/commands/_operator-board.ts
2043
2046
  var exports__operator_board = {};
2044
2047
  __export(exports__operator_board, {
@@ -2109,9 +2112,9 @@ class RunsList {
2109
2112
  const lines = visible.map((run, index) => {
2110
2113
  const absolute = start + index;
2111
2114
  const isSelected = absolute === this.selected;
2112
- const dot = statusColor2(run.status)(isSelected ? "\u25CF" : "\xB7");
2115
+ const dot = statusColor(run.status)(isSelected ? "\u25CF" : "\xB7");
2113
2116
  const id = run.runId.slice(0, 8);
2114
- const status = statusColor2(run.status)(run.status.padEnd(16));
2117
+ const status = statusColor(run.status)(run.status.padEnd(16));
2115
2118
  const title = truncateToWidth(run.title, Math.max(8, width - 36));
2116
2119
  const row = ` ${dot} ${isSelected ? bold(ink(id)) : ink3(id)} ${status} ${isSelected ? ink(title) : ink2(title)}`;
2117
2120
  return isSelected ? accent("\u258C") + row : " " + row;
@@ -2,6 +2,66 @@
2
2
  // packages/cli/src/commands/_cli-format.ts
3
3
  import { log, note } from "@clack/prompts";
4
4
  import pc from "picocolors";
5
+
6
+ // packages/cli/src/commands/_tui-theme.ts
7
+ var RIG_PALETTE = {
8
+ ink: "#f2f3f6",
9
+ ink2: "#aeb0ba",
10
+ ink3: "#6c6e79",
11
+ ink4: "#44464f",
12
+ accent: "#ccff4d",
13
+ accentDim: "#a9d63f",
14
+ cyan: "#56d8ff",
15
+ red: "#ff5d5d",
16
+ yellow: "#ffd24d"
17
+ };
18
+ function hexToRgb(hex) {
19
+ const value = hex.replace("#", "");
20
+ return [
21
+ Number.parseInt(value.slice(0, 2), 16),
22
+ Number.parseInt(value.slice(2, 4), 16),
23
+ Number.parseInt(value.slice(4, 6), 16)
24
+ ];
25
+ }
26
+ function fg(hex) {
27
+ const [r, g, b] = hexToRgb(hex);
28
+ return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
29
+ }
30
+ var ink = fg(RIG_PALETTE.ink);
31
+ var ink2 = fg(RIG_PALETTE.ink2);
32
+ var ink3 = fg(RIG_PALETTE.ink3);
33
+ var ink4 = fg(RIG_PALETTE.ink4);
34
+ var accent = fg(RIG_PALETTE.accent);
35
+ var accentDim = fg(RIG_PALETTE.accentDim);
36
+ var cyan = fg(RIG_PALETTE.cyan);
37
+ var red = fg(RIG_PALETTE.red);
38
+ var yellow = fg(RIG_PALETTE.yellow);
39
+ var DRONE_ART = [
40
+ " .-=-. .-=-. ",
41
+ " ( !!! ) ( !!! ) ",
42
+ " '-=-'._ _.'-=-' ",
43
+ " '._ _.' ",
44
+ " '=$$$$$$$=.' ",
45
+ " =$$$$$$$$$$$= ",
46
+ " $$$@@@@@@@@@@$$$ ",
47
+ " $$$@@ @@$$$ ",
48
+ " $$@ ? @$$$ ",
49
+ " $$$@ '-' @$$$ ",
50
+ " $$$@@ @@$$$ ",
51
+ " $$$@@@@@@@@@@$$$ ",
52
+ " =$$$$$$$$$$$= ",
53
+ " '=$$$$$$$=.' ",
54
+ " _.' '._ ",
55
+ " .-=-.' '.-=-. ",
56
+ " ( !!! ) ( !!! ) ",
57
+ " '-=-' '-=-' "
58
+ ];
59
+ var DRONE_WIDTH = DRONE_ART[0].length;
60
+ var DRONE_HEIGHT = DRONE_ART.length;
61
+
62
+ // packages/cli/src/commands/_cli-format.ts
63
+ var themeDim = (value) => ink3(value);
64
+ var themeFaint = (value) => ink4(value);
5
65
  function stringField(record, key, fallback = "") {
6
66
  const value = record[key];
7
67
  return typeof value === "string" && value.trim() ? value.trim() : fallback;
@@ -30,15 +90,15 @@ function pad(value, width) {
30
90
  }
31
91
  function statusColor(status) {
32
92
  const normalized = status.toLowerCase();
33
- if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
34
- return pc.green;
93
+ if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved", "running"].includes(normalized))
94
+ return accent;
35
95
  if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
36
- return pc.red;
37
- if (["running", "reviewing", "validating", "in_progress", "in-progress", "remote"].includes(normalized))
38
- return pc.cyan;
39
- if (["ready", "open", "queued", "created", "preparing", "local", "pending"].includes(normalized))
40
- return pc.yellow;
41
- return pc.dim;
96
+ return red;
97
+ if (["reviewing", "validating", "in_progress", "in-progress", "remote", "preparing", "closing-out"].includes(normalized))
98
+ return cyan;
99
+ if (["ready", "open", "queued", "created", "local", "pending"].includes(normalized))
100
+ return yellow;
101
+ return themeDim;
42
102
  }
43
103
  function compactDate(value) {
44
104
  if (!value.trim())
@@ -97,17 +157,17 @@ function formatStatusPill(status) {
97
157
  return statusColor(label)(`\u25CF ${label}`);
98
158
  }
99
159
  function formatSection(title, subtitle) {
100
- return `${pc.bold(pc.cyan("\u25C6"))} ${pc.bold(title)}${subtitle ? pc.dim(` \u2014 ${subtitle}`) : ""}`;
160
+ return `${pc.bold(accent("\u25C6"))} ${pc.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
101
161
  }
102
162
  function formatSuccessCard(title, rows = []) {
103
- const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${pc.dim("\u2502")} ${pc.dim(key.padEnd(12))} ${value}`);
163
+ const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${themeFaint("\u2502")} ${themeDim(key.padEnd(12))} ${value}`);
104
164
  return [formatSection(title), ...body].join(`
105
165
  `);
106
166
  }
107
167
  function formatNextSteps(steps) {
108
168
  if (steps.length === 0)
109
169
  return [];
110
- return [pc.bold("Next"), ...steps.map((step) => `${pc.dim("\u203A")} ${step}`)];
170
+ return [pc.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
111
171
  }
112
172
  function formatTaskList(tasks, options = {}) {
113
173
  if (options.raw)
@@ -129,8 +189,8 @@ function formatTaskList(tasks, options = {}) {
129
189
  const statusWidth = Math.min(16, Math.max(6, ...rows.map((row) => row.status.length)));
130
190
  const header = `${pc.bold(pad("TASK", idWidth))} ${pc.bold(pad("STATUS", statusWidth))} ${pc.bold("TITLE")}`;
131
191
  const body = rows.map((row) => {
132
- const labels = row.labels.length > 0 ? pc.dim(` ${row.labels.slice(0, 4).map((label) => `#${label}`).join(" ")}`) : "";
133
- const source = row.source ? pc.dim(` ${row.source}`) : "";
192
+ const labels = row.labels.length > 0 ? themeDim(` ${row.labels.slice(0, 4).map((label) => `#${label}`).join(" ")}`) : "";
193
+ const source = row.source ? themeDim(` ${row.source}`) : "";
134
194
  return [
135
195
  pc.bold(pad(truncate(row.id, idWidth), idWidth)),
136
196
  statusColor(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
@@ -178,7 +238,7 @@ function formatRunList(runs, options = {}) {
178
238
  if (runs.length === 0) {
179
239
  return [
180
240
  formatSection("Runs", "none recorded"),
181
- options.source === "server" ? pc.dim("No runs recorded on the selected Rig server.") : pc.dim("No runs recorded in .rig/runs."),
241
+ options.source === "server" ? themeDim("No runs recorded on the selected Rig server.") : themeDim("No runs recorded in .rig/runs."),
182
242
  "",
183
243
  ...formatNextSteps(["Start one: `rig task run --next`", "Check server: `rig server status`"])
184
244
  ].join(`
@@ -198,7 +258,7 @@ function formatRunList(runs, options = {}) {
198
258
  const body = rows.map((row) => [
199
259
  pc.bold(pad(truncate(row.runId, idWidth), idWidth)),
200
260
  statusColor(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
201
- `${row.title}${row.runtime ? pc.dim(` ${row.runtime}`) : ""}`
261
+ `${row.title}${row.runtime ? themeDim(` ${row.runtime}`) : ""}`
202
262
  ].join(" "));
203
263
  return [formatSection("Runs", options.source === "server" ? "selected server" : "local state"), header, ...body, "", ...formatNextSteps(["Follow live: `rig run attach <run-id> --follow`", "Details: `rig run show <run-id>`"])].join(`
204
264
  `);
@@ -272,7 +332,7 @@ function formatRunStatus(summary, options = {}) {
272
332
  const lines = [formatSection("Run status", options.source === "server" ? "selected server" : "local state")];
273
333
  lines.push("", pc.bold(`Active runs (${activeRuns.length})`));
274
334
  if (activeRuns.length === 0) {
275
- lines.push(pc.dim("No active runs."));
335
+ lines.push(themeDim("No active runs."));
276
336
  } else {
277
337
  for (const run of activeRuns) {
278
338
  lines.push(formatRunSummaryLine(run));
@@ -280,7 +340,7 @@ function formatRunStatus(summary, options = {}) {
280
340
  }
281
341
  lines.push("", pc.bold(`Recent runs (${recentRuns.length})`));
282
342
  if (recentRuns.length === 0) {
283
- lines.push(pc.dim("No recent terminal runs."));
343
+ lines.push(themeDim("No recent terminal runs."));
284
344
  } else {
285
345
  for (const run of recentRuns.slice(0, 10)) {
286
346
  lines.push(formatRunSummaryLine(run));
@@ -298,14 +358,14 @@ function formatRunSummaryLine(run) {
298
358
  const title = runTitleOf(record);
299
359
  const runtime = firstString(record, ["runtimeAdapter", "runtime", "adapter"]);
300
360
  const descriptor = [taskId, title].filter(Boolean).join(" \xB7 ");
301
- return `${pc.dim("\u2502")} ${pc.bold(runId)} ${formatStatusPill(status)} ${descriptor}${runtime ? pc.dim(` ${runtime}`) : ""}`;
361
+ return `${themeFaint("\u2502")} ${pc.bold(runId)} ${formatStatusPill(status)} ${descriptor}${runtime ? themeDim(` ${runtime}`) : ""}`;
302
362
  }
303
363
  function formatInboxList(kind, entries) {
304
364
  const title = kind === "approvals" ? "Approval inbox" : "Input inbox";
305
365
  if (entries.length === 0) {
306
366
  return [
307
367
  formatSection(title, "empty"),
308
- pc.dim(kind === "approvals" ? "No pending approvals." : "No pending user-input requests."),
368
+ themeDim(kind === "approvals" ? "No pending approvals." : "No pending user-input requests."),
309
369
  "",
310
370
  ...formatNextSteps(["Check runs: `rig run status`", "Start work: `rig task run --next`"])
311
371
  ].join(`
@@ -319,8 +379,8 @@ function formatInboxList(kind, entries) {
319
379
  const requestId = requestIdOf(record);
320
380
  const status = firstString(record, ["status", "state"], "pending");
321
381
  const prompt = firstString(record, ["prompt", "message", "reason", "title", "summary"], kind === "approvals" ? "Approval requested" : "Input requested");
322
- lines.push(`${pc.dim("\u2502")} ${pc.bold(requestId)} ${formatStatusPill(status)} ${prompt}`);
323
- lines.push(`${pc.dim("\u2502")} ${pc.dim("run ")} ${runId || "(unknown-run)"}${taskId ? pc.dim(` task ${taskId}`) : ""}`);
382
+ lines.push(`${themeFaint("\u2502")} ${pc.bold(requestId)} ${formatStatusPill(status)} ${prompt}`);
383
+ lines.push(`${themeFaint("\u2502")} ${themeDim("run ")} ${runId || "(unknown-run)"}${taskId ? themeDim(` task ${taskId}`) : ""}`);
324
384
  }
325
385
  lines.push("", ...formatNextSteps(kind === "approvals" ? ["Resolve: `rig inbox approve --run <run-id> --request <request-id> --decision approve|reject`", "Rejoin: `rig run attach <run-id> --follow`"] : ["Respond: `rig inbox respond --run <run-id> --request <request-id> --answer key=value`", "Rejoin: `rig run attach <run-id> --follow`"]));
326
386
  return lines.join(`
@@ -342,9 +402,9 @@ function formatConnectionStatus(selected, connections) {
342
402
  const target = !connection ? "not configured" : connection.kind === "remote" ? connection.baseUrl : "local";
343
403
  return [
344
404
  formatSection("Rig server", "selected for this repo"),
345
- `${pc.dim("\u2502")} ${pc.dim("selected ")} ${pc.bold(selected)}`,
346
- `${pc.dim("\u2502")} ${pc.dim("kind ")} ${formatStatusPill(connection?.kind ?? "unknown")}`,
347
- `${pc.dim("\u2502")} ${pc.dim("target ")} ${target ?? "not configured"}`,
405
+ `${themeFaint("\u2502")} ${themeDim("selected ")} ${pc.bold(selected)}`,
406
+ `${themeFaint("\u2502")} ${themeDim("kind ")} ${formatStatusPill(connection?.kind ?? "unknown")}`,
407
+ `${themeFaint("\u2502")} ${themeDim("target ")} ${target ?? "not configured"}`,
348
408
  "",
349
409
  ...formatNextSteps(["Change: `rig server use <alias|local>`", "List saved servers: `rig server list`"])
350
410
  ].join(`