@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 +153 -150
- package/dist/src/commands/_cli-format.js +84 -24
- package/dist/src/commands/connect.js +74 -14
- package/dist/src/commands/inbox.js +73 -13
- package/dist/src/commands/run.js +76 -16
- package/dist/src/commands/server.js +74 -14
- package/dist/src/commands/stats.js +61 -2
- package/dist/src/commands/task.js +73 -13
- package/dist/src/commands.js +153 -150
- package/dist/src/index.js +153 -150
- package/package.json +8 -8
|
@@ -117,6 +117,66 @@ function writeRepoConnection(projectRoot, state) {
|
|
|
117
117
|
// packages/cli/src/commands/_cli-format.ts
|
|
118
118
|
import { log, note } from "@clack/prompts";
|
|
119
119
|
import pc from "picocolors";
|
|
120
|
+
|
|
121
|
+
// packages/cli/src/commands/_tui-theme.ts
|
|
122
|
+
var RIG_PALETTE = {
|
|
123
|
+
ink: "#f2f3f6",
|
|
124
|
+
ink2: "#aeb0ba",
|
|
125
|
+
ink3: "#6c6e79",
|
|
126
|
+
ink4: "#44464f",
|
|
127
|
+
accent: "#ccff4d",
|
|
128
|
+
accentDim: "#a9d63f",
|
|
129
|
+
cyan: "#56d8ff",
|
|
130
|
+
red: "#ff5d5d",
|
|
131
|
+
yellow: "#ffd24d"
|
|
132
|
+
};
|
|
133
|
+
function hexToRgb(hex) {
|
|
134
|
+
const value = hex.replace("#", "");
|
|
135
|
+
return [
|
|
136
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
137
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
138
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
function fg(hex) {
|
|
142
|
+
const [r, g, b] = hexToRgb(hex);
|
|
143
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
144
|
+
}
|
|
145
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
146
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
147
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
148
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
149
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
150
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
151
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
152
|
+
var red = fg(RIG_PALETTE.red);
|
|
153
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
154
|
+
var DRONE_ART = [
|
|
155
|
+
" .-=-. .-=-. ",
|
|
156
|
+
" ( !!! ) ( !!! ) ",
|
|
157
|
+
" '-=-'._ _.'-=-' ",
|
|
158
|
+
" '._ _.' ",
|
|
159
|
+
" '=$$$$$$$=.' ",
|
|
160
|
+
" =$$$$$$$$$$$= ",
|
|
161
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
162
|
+
" $$$@@ @@$$$ ",
|
|
163
|
+
" $$@ ? @$$$ ",
|
|
164
|
+
" $$$@ '-' @$$$ ",
|
|
165
|
+
" $$$@@ @@$$$ ",
|
|
166
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
167
|
+
" =$$$$$$$$$$$= ",
|
|
168
|
+
" '=$$$$$$$=.' ",
|
|
169
|
+
" _.' '._ ",
|
|
170
|
+
" .-=-.' '.-=-. ",
|
|
171
|
+
" ( !!! ) ( !!! ) ",
|
|
172
|
+
" '-=-' '-=-' "
|
|
173
|
+
];
|
|
174
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
175
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
176
|
+
|
|
177
|
+
// packages/cli/src/commands/_cli-format.ts
|
|
178
|
+
var themeDim = (value) => ink3(value);
|
|
179
|
+
var themeFaint = (value) => ink4(value);
|
|
120
180
|
function truncate(value, width) {
|
|
121
181
|
if (value.length <= width)
|
|
122
182
|
return value;
|
|
@@ -129,32 +189,32 @@ function pad(value, width) {
|
|
|
129
189
|
}
|
|
130
190
|
function statusColor(status) {
|
|
131
191
|
const normalized = status.toLowerCase();
|
|
132
|
-
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
|
|
133
|
-
return
|
|
192
|
+
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved", "running"].includes(normalized))
|
|
193
|
+
return accent;
|
|
134
194
|
if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
|
|
135
|
-
return
|
|
136
|
-
if (["
|
|
137
|
-
return
|
|
138
|
-
if (["ready", "open", "queued", "created", "
|
|
139
|
-
return
|
|
140
|
-
return
|
|
195
|
+
return red;
|
|
196
|
+
if (["reviewing", "validating", "in_progress", "in-progress", "remote", "preparing", "closing-out"].includes(normalized))
|
|
197
|
+
return cyan;
|
|
198
|
+
if (["ready", "open", "queued", "created", "local", "pending"].includes(normalized))
|
|
199
|
+
return yellow;
|
|
200
|
+
return themeDim;
|
|
141
201
|
}
|
|
142
202
|
function formatStatusPill(status) {
|
|
143
203
|
const label = status || "unknown";
|
|
144
204
|
return statusColor(label)(`\u25CF ${label}`);
|
|
145
205
|
}
|
|
146
206
|
function formatSection(title, subtitle) {
|
|
147
|
-
return `${pc.bold(
|
|
207
|
+
return `${pc.bold(accent("\u25C6"))} ${pc.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
|
|
148
208
|
}
|
|
149
209
|
function formatSuccessCard(title, rows = []) {
|
|
150
|
-
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${
|
|
210
|
+
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${themeFaint("\u2502")} ${themeDim(key.padEnd(12))} ${value}`);
|
|
151
211
|
return [formatSection(title), ...body].join(`
|
|
152
212
|
`);
|
|
153
213
|
}
|
|
154
214
|
function formatNextSteps(steps) {
|
|
155
215
|
if (steps.length === 0)
|
|
156
216
|
return [];
|
|
157
|
-
return [pc.bold("Next"), ...steps.map((step) => `${
|
|
217
|
+
return [pc.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
|
|
158
218
|
}
|
|
159
219
|
function formatConnectionList(connections) {
|
|
160
220
|
const rows = [["local", { kind: "local", mode: "auto" }], ...Object.entries(connections)];
|
|
@@ -172,9 +232,9 @@ function formatConnectionStatus(selected, connections) {
|
|
|
172
232
|
const target = !connection ? "not configured" : connection.kind === "remote" ? connection.baseUrl : "local";
|
|
173
233
|
return [
|
|
174
234
|
formatSection("Rig server", "selected for this repo"),
|
|
175
|
-
`${
|
|
176
|
-
`${
|
|
177
|
-
`${
|
|
235
|
+
`${themeFaint("\u2502")} ${themeDim("selected ")} ${pc.bold(selected)}`,
|
|
236
|
+
`${themeFaint("\u2502")} ${themeDim("kind ")} ${formatStatusPill(connection?.kind ?? "unknown")}`,
|
|
237
|
+
`${themeFaint("\u2502")} ${themeDim("target ")} ${target ?? "not configured"}`,
|
|
178
238
|
"",
|
|
179
239
|
...formatNextSteps(["Change: `rig server use <alias|local>`", "List saved servers: `rig server list`"])
|
|
180
240
|
].join(`
|
|
@@ -44,21 +44,81 @@ Usage: ${usage}`);
|
|
|
44
44
|
// packages/cli/src/commands/_cli-format.ts
|
|
45
45
|
import { log, note } from "@clack/prompts";
|
|
46
46
|
import pc from "picocolors";
|
|
47
|
+
|
|
48
|
+
// packages/cli/src/commands/_tui-theme.ts
|
|
49
|
+
var RIG_PALETTE = {
|
|
50
|
+
ink: "#f2f3f6",
|
|
51
|
+
ink2: "#aeb0ba",
|
|
52
|
+
ink3: "#6c6e79",
|
|
53
|
+
ink4: "#44464f",
|
|
54
|
+
accent: "#ccff4d",
|
|
55
|
+
accentDim: "#a9d63f",
|
|
56
|
+
cyan: "#56d8ff",
|
|
57
|
+
red: "#ff5d5d",
|
|
58
|
+
yellow: "#ffd24d"
|
|
59
|
+
};
|
|
60
|
+
function hexToRgb(hex) {
|
|
61
|
+
const value = hex.replace("#", "");
|
|
62
|
+
return [
|
|
63
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
64
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
65
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
function fg(hex) {
|
|
69
|
+
const [r, g, b] = hexToRgb(hex);
|
|
70
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
71
|
+
}
|
|
72
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
73
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
74
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
75
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
76
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
77
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
78
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
79
|
+
var red = fg(RIG_PALETTE.red);
|
|
80
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
81
|
+
var DRONE_ART = [
|
|
82
|
+
" .-=-. .-=-. ",
|
|
83
|
+
" ( !!! ) ( !!! ) ",
|
|
84
|
+
" '-=-'._ _.'-=-' ",
|
|
85
|
+
" '._ _.' ",
|
|
86
|
+
" '=$$$$$$$=.' ",
|
|
87
|
+
" =$$$$$$$$$$$= ",
|
|
88
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
89
|
+
" $$$@@ @@$$$ ",
|
|
90
|
+
" $$@ ? @$$$ ",
|
|
91
|
+
" $$$@ '-' @$$$ ",
|
|
92
|
+
" $$$@@ @@$$$ ",
|
|
93
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
94
|
+
" =$$$$$$$$$$$= ",
|
|
95
|
+
" '=$$$$$$$=.' ",
|
|
96
|
+
" _.' '._ ",
|
|
97
|
+
" .-=-.' '.-=-. ",
|
|
98
|
+
" ( !!! ) ( !!! ) ",
|
|
99
|
+
" '-=-' '-=-' "
|
|
100
|
+
];
|
|
101
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
102
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
103
|
+
|
|
104
|
+
// packages/cli/src/commands/_cli-format.ts
|
|
105
|
+
var themeDim = (value) => ink3(value);
|
|
106
|
+
var themeFaint = (value) => ink4(value);
|
|
47
107
|
function stringField(record, key, fallback = "") {
|
|
48
108
|
const value = record[key];
|
|
49
109
|
return typeof value === "string" && value.trim() ? value.trim() : fallback;
|
|
50
110
|
}
|
|
51
111
|
function statusColor(status) {
|
|
52
112
|
const normalized = status.toLowerCase();
|
|
53
|
-
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
|
|
54
|
-
return
|
|
113
|
+
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved", "running"].includes(normalized))
|
|
114
|
+
return accent;
|
|
55
115
|
if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
|
|
56
|
-
return
|
|
57
|
-
if (["
|
|
58
|
-
return
|
|
59
|
-
if (["ready", "open", "queued", "created", "
|
|
60
|
-
return
|
|
61
|
-
return
|
|
116
|
+
return red;
|
|
117
|
+
if (["reviewing", "validating", "in_progress", "in-progress", "remote", "preparing", "closing-out"].includes(normalized))
|
|
118
|
+
return cyan;
|
|
119
|
+
if (["ready", "open", "queued", "created", "local", "pending"].includes(normalized))
|
|
120
|
+
return yellow;
|
|
121
|
+
return themeDim;
|
|
62
122
|
}
|
|
63
123
|
function firstString(record, keys, fallback = "") {
|
|
64
124
|
for (const key of keys) {
|
|
@@ -89,19 +149,19 @@ function formatStatusPill(status) {
|
|
|
89
149
|
return statusColor(label)(`\u25CF ${label}`);
|
|
90
150
|
}
|
|
91
151
|
function formatSection(title, subtitle) {
|
|
92
|
-
return `${pc.bold(
|
|
152
|
+
return `${pc.bold(accent("\u25C6"))} ${pc.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
|
|
93
153
|
}
|
|
94
154
|
function formatNextSteps(steps) {
|
|
95
155
|
if (steps.length === 0)
|
|
96
156
|
return [];
|
|
97
|
-
return [pc.bold("Next"), ...steps.map((step) => `${
|
|
157
|
+
return [pc.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
|
|
98
158
|
}
|
|
99
159
|
function formatInboxList(kind, entries) {
|
|
100
160
|
const title = kind === "approvals" ? "Approval inbox" : "Input inbox";
|
|
101
161
|
if (entries.length === 0) {
|
|
102
162
|
return [
|
|
103
163
|
formatSection(title, "empty"),
|
|
104
|
-
|
|
164
|
+
themeDim(kind === "approvals" ? "No pending approvals." : "No pending user-input requests."),
|
|
105
165
|
"",
|
|
106
166
|
...formatNextSteps(["Check runs: `rig run status`", "Start work: `rig task run --next`"])
|
|
107
167
|
].join(`
|
|
@@ -115,8 +175,8 @@ function formatInboxList(kind, entries) {
|
|
|
115
175
|
const requestId = requestIdOf(record);
|
|
116
176
|
const status = firstString(record, ["status", "state"], "pending");
|
|
117
177
|
const prompt = firstString(record, ["prompt", "message", "reason", "title", "summary"], kind === "approvals" ? "Approval requested" : "Input requested");
|
|
118
|
-
lines.push(`${
|
|
119
|
-
lines.push(`${
|
|
178
|
+
lines.push(`${themeFaint("\u2502")} ${pc.bold(requestId)} ${formatStatusPill(status)} ${prompt}`);
|
|
179
|
+
lines.push(`${themeFaint("\u2502")} ${themeDim("run ")} ${runId || "(unknown-run)"}${taskId ? themeDim(` task ${taskId}`) : ""}`);
|
|
120
180
|
}
|
|
121
181
|
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`"]));
|
|
122
182
|
return lines.join(`
|
package/dist/src/commands/run.js
CHANGED
|
@@ -1127,6 +1127,66 @@ async function attachRunOperatorView(context, input) {
|
|
|
1127
1127
|
// packages/cli/src/commands/_cli-format.ts
|
|
1128
1128
|
import { log, note } from "@clack/prompts";
|
|
1129
1129
|
import pc2 from "picocolors";
|
|
1130
|
+
|
|
1131
|
+
// packages/cli/src/commands/_tui-theme.ts
|
|
1132
|
+
var RIG_PALETTE = {
|
|
1133
|
+
ink: "#f2f3f6",
|
|
1134
|
+
ink2: "#aeb0ba",
|
|
1135
|
+
ink3: "#6c6e79",
|
|
1136
|
+
ink4: "#44464f",
|
|
1137
|
+
accent: "#ccff4d",
|
|
1138
|
+
accentDim: "#a9d63f",
|
|
1139
|
+
cyan: "#56d8ff",
|
|
1140
|
+
red: "#ff5d5d",
|
|
1141
|
+
yellow: "#ffd24d"
|
|
1142
|
+
};
|
|
1143
|
+
function hexToRgb(hex) {
|
|
1144
|
+
const value = hex.replace("#", "");
|
|
1145
|
+
return [
|
|
1146
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
1147
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
1148
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
1149
|
+
];
|
|
1150
|
+
}
|
|
1151
|
+
function fg(hex) {
|
|
1152
|
+
const [r, g, b] = hexToRgb(hex);
|
|
1153
|
+
return (text2) => `\x1B[38;2;${r};${g};${b}m${text2}\x1B[39m`;
|
|
1154
|
+
}
|
|
1155
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
1156
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
1157
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
1158
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
1159
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
1160
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
1161
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
1162
|
+
var red = fg(RIG_PALETTE.red);
|
|
1163
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
1164
|
+
var DRONE_ART = [
|
|
1165
|
+
" .-=-. .-=-. ",
|
|
1166
|
+
" ( !!! ) ( !!! ) ",
|
|
1167
|
+
" '-=-'._ _.'-=-' ",
|
|
1168
|
+
" '._ _.' ",
|
|
1169
|
+
" '=$$$$$$$=.' ",
|
|
1170
|
+
" =$$$$$$$$$$$= ",
|
|
1171
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
1172
|
+
" $$$@@ @@$$$ ",
|
|
1173
|
+
" $$@ ? @$$$ ",
|
|
1174
|
+
" $$$@ '-' @$$$ ",
|
|
1175
|
+
" $$$@@ @@$$$ ",
|
|
1176
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
1177
|
+
" =$$$$$$$$$$$= ",
|
|
1178
|
+
" '=$$$$$$$=.' ",
|
|
1179
|
+
" _.' '._ ",
|
|
1180
|
+
" .-=-.' '.-=-. ",
|
|
1181
|
+
" ( !!! ) ( !!! ) ",
|
|
1182
|
+
" '-=-' '-=-' "
|
|
1183
|
+
];
|
|
1184
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
1185
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
1186
|
+
|
|
1187
|
+
// packages/cli/src/commands/_cli-format.ts
|
|
1188
|
+
var themeDim = (value) => ink3(value);
|
|
1189
|
+
var themeFaint = (value) => ink4(value);
|
|
1130
1190
|
function stringField(record, key, fallback = "") {
|
|
1131
1191
|
const value = record[key];
|
|
1132
1192
|
return typeof value === "string" && value.trim() ? value.trim() : fallback;
|
|
@@ -1147,15 +1207,15 @@ function pad(value, width) {
|
|
|
1147
1207
|
}
|
|
1148
1208
|
function statusColor(status) {
|
|
1149
1209
|
const normalized = status.toLowerCase();
|
|
1150
|
-
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
|
|
1151
|
-
return
|
|
1210
|
+
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved", "running"].includes(normalized))
|
|
1211
|
+
return accent;
|
|
1152
1212
|
if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
|
|
1153
|
-
return
|
|
1154
|
-
if (["
|
|
1155
|
-
return
|
|
1156
|
-
if (["ready", "open", "queued", "created", "
|
|
1157
|
-
return
|
|
1158
|
-
return
|
|
1213
|
+
return red;
|
|
1214
|
+
if (["reviewing", "validating", "in_progress", "in-progress", "remote", "preparing", "closing-out"].includes(normalized))
|
|
1215
|
+
return cyan;
|
|
1216
|
+
if (["ready", "open", "queued", "created", "local", "pending"].includes(normalized))
|
|
1217
|
+
return yellow;
|
|
1218
|
+
return themeDim;
|
|
1159
1219
|
}
|
|
1160
1220
|
function compactDate(value) {
|
|
1161
1221
|
if (!value.trim())
|
|
@@ -1200,23 +1260,23 @@ function formatStatusPill(status) {
|
|
|
1200
1260
|
return statusColor(label)(`\u25CF ${label}`);
|
|
1201
1261
|
}
|
|
1202
1262
|
function formatSection(title, subtitle) {
|
|
1203
|
-
return `${pc2.bold(
|
|
1263
|
+
return `${pc2.bold(accent("\u25C6"))} ${pc2.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
|
|
1204
1264
|
}
|
|
1205
1265
|
function formatSuccessCard(title, rows = []) {
|
|
1206
|
-
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${
|
|
1266
|
+
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${themeFaint("\u2502")} ${themeDim(key.padEnd(12))} ${value}`);
|
|
1207
1267
|
return [formatSection(title), ...body].join(`
|
|
1208
1268
|
`);
|
|
1209
1269
|
}
|
|
1210
1270
|
function formatNextSteps(steps) {
|
|
1211
1271
|
if (steps.length === 0)
|
|
1212
1272
|
return [];
|
|
1213
|
-
return [pc2.bold("Next"), ...steps.map((step) => `${
|
|
1273
|
+
return [pc2.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
|
|
1214
1274
|
}
|
|
1215
1275
|
function formatRunList(runs, options = {}) {
|
|
1216
1276
|
if (runs.length === 0) {
|
|
1217
1277
|
return [
|
|
1218
1278
|
formatSection("Runs", "none recorded"),
|
|
1219
|
-
options.source === "server" ?
|
|
1279
|
+
options.source === "server" ? themeDim("No runs recorded on the selected Rig server.") : themeDim("No runs recorded in .rig/runs."),
|
|
1220
1280
|
"",
|
|
1221
1281
|
...formatNextSteps(["Start one: `rig task run --next`", "Check server: `rig server status`"])
|
|
1222
1282
|
].join(`
|
|
@@ -1236,7 +1296,7 @@ function formatRunList(runs, options = {}) {
|
|
|
1236
1296
|
const body = rows.map((row) => [
|
|
1237
1297
|
pc2.bold(pad(truncate(row.runId, idWidth), idWidth)),
|
|
1238
1298
|
statusColor(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
|
|
1239
|
-
`${row.title}${row.runtime ?
|
|
1299
|
+
`${row.title}${row.runtime ? themeDim(` ${row.runtime}`) : ""}`
|
|
1240
1300
|
].join(" "));
|
|
1241
1301
|
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(`
|
|
1242
1302
|
`);
|
|
@@ -1289,7 +1349,7 @@ function formatRunStatus(summary, options = {}) {
|
|
|
1289
1349
|
const lines = [formatSection("Run status", options.source === "server" ? "selected server" : "local state")];
|
|
1290
1350
|
lines.push("", pc2.bold(`Active runs (${activeRuns.length})`));
|
|
1291
1351
|
if (activeRuns.length === 0) {
|
|
1292
|
-
lines.push(
|
|
1352
|
+
lines.push(themeDim("No active runs."));
|
|
1293
1353
|
} else {
|
|
1294
1354
|
for (const run of activeRuns) {
|
|
1295
1355
|
lines.push(formatRunSummaryLine(run));
|
|
@@ -1297,7 +1357,7 @@ function formatRunStatus(summary, options = {}) {
|
|
|
1297
1357
|
}
|
|
1298
1358
|
lines.push("", pc2.bold(`Recent runs (${recentRuns.length})`));
|
|
1299
1359
|
if (recentRuns.length === 0) {
|
|
1300
|
-
lines.push(
|
|
1360
|
+
lines.push(themeDim("No recent terminal runs."));
|
|
1301
1361
|
} else {
|
|
1302
1362
|
for (const run of recentRuns.slice(0, 10)) {
|
|
1303
1363
|
lines.push(formatRunSummaryLine(run));
|
|
@@ -1315,7 +1375,7 @@ function formatRunSummaryLine(run) {
|
|
|
1315
1375
|
const title = runTitleOf(record);
|
|
1316
1376
|
const runtime = firstString(record, ["runtimeAdapter", "runtime", "adapter"]);
|
|
1317
1377
|
const descriptor = [taskId, title].filter(Boolean).join(" \xB7 ");
|
|
1318
|
-
return `${
|
|
1378
|
+
return `${themeFaint("\u2502")} ${pc2.bold(runId)} ${formatStatusPill(status)} ${descriptor}${runtime ? themeDim(` ${runtime}`) : ""}`;
|
|
1319
1379
|
}
|
|
1320
1380
|
|
|
1321
1381
|
// packages/cli/src/commands/inbox.ts
|
|
@@ -184,6 +184,66 @@ function writeRepoServerProjectRoot(projectRoot, serverProjectRoot) {
|
|
|
184
184
|
// packages/cli/src/commands/_cli-format.ts
|
|
185
185
|
import { log, note } from "@clack/prompts";
|
|
186
186
|
import pc from "picocolors";
|
|
187
|
+
|
|
188
|
+
// packages/cli/src/commands/_tui-theme.ts
|
|
189
|
+
var RIG_PALETTE = {
|
|
190
|
+
ink: "#f2f3f6",
|
|
191
|
+
ink2: "#aeb0ba",
|
|
192
|
+
ink3: "#6c6e79",
|
|
193
|
+
ink4: "#44464f",
|
|
194
|
+
accent: "#ccff4d",
|
|
195
|
+
accentDim: "#a9d63f",
|
|
196
|
+
cyan: "#56d8ff",
|
|
197
|
+
red: "#ff5d5d",
|
|
198
|
+
yellow: "#ffd24d"
|
|
199
|
+
};
|
|
200
|
+
function hexToRgb(hex) {
|
|
201
|
+
const value = hex.replace("#", "");
|
|
202
|
+
return [
|
|
203
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
204
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
205
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
function fg(hex) {
|
|
209
|
+
const [r, g, b] = hexToRgb(hex);
|
|
210
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
211
|
+
}
|
|
212
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
213
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
214
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
215
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
216
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
217
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
218
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
219
|
+
var red = fg(RIG_PALETTE.red);
|
|
220
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
221
|
+
var DRONE_ART = [
|
|
222
|
+
" .-=-. .-=-. ",
|
|
223
|
+
" ( !!! ) ( !!! ) ",
|
|
224
|
+
" '-=-'._ _.'-=-' ",
|
|
225
|
+
" '._ _.' ",
|
|
226
|
+
" '=$$$$$$$=.' ",
|
|
227
|
+
" =$$$$$$$$$$$= ",
|
|
228
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
229
|
+
" $$$@@ @@$$$ ",
|
|
230
|
+
" $$@ ? @$$$ ",
|
|
231
|
+
" $$$@ '-' @$$$ ",
|
|
232
|
+
" $$$@@ @@$$$ ",
|
|
233
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
234
|
+
" =$$$$$$$$$$$= ",
|
|
235
|
+
" '=$$$$$$$=.' ",
|
|
236
|
+
" _.' '._ ",
|
|
237
|
+
" .-=-.' '.-=-. ",
|
|
238
|
+
" ( !!! ) ( !!! ) ",
|
|
239
|
+
" '-=-' '-=-' "
|
|
240
|
+
];
|
|
241
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
242
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
243
|
+
|
|
244
|
+
// packages/cli/src/commands/_cli-format.ts
|
|
245
|
+
var themeDim = (value) => ink3(value);
|
|
246
|
+
var themeFaint = (value) => ink4(value);
|
|
187
247
|
function truncate(value, width) {
|
|
188
248
|
if (value.length <= width)
|
|
189
249
|
return value;
|
|
@@ -196,32 +256,32 @@ function pad(value, width) {
|
|
|
196
256
|
}
|
|
197
257
|
function statusColor(status) {
|
|
198
258
|
const normalized = status.toLowerCase();
|
|
199
|
-
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
|
|
200
|
-
return
|
|
259
|
+
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved", "running"].includes(normalized))
|
|
260
|
+
return accent;
|
|
201
261
|
if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
|
|
202
|
-
return
|
|
203
|
-
if (["
|
|
204
|
-
return
|
|
205
|
-
if (["ready", "open", "queued", "created", "
|
|
206
|
-
return
|
|
207
|
-
return
|
|
262
|
+
return red;
|
|
263
|
+
if (["reviewing", "validating", "in_progress", "in-progress", "remote", "preparing", "closing-out"].includes(normalized))
|
|
264
|
+
return cyan;
|
|
265
|
+
if (["ready", "open", "queued", "created", "local", "pending"].includes(normalized))
|
|
266
|
+
return yellow;
|
|
267
|
+
return themeDim;
|
|
208
268
|
}
|
|
209
269
|
function formatStatusPill(status) {
|
|
210
270
|
const label = status || "unknown";
|
|
211
271
|
return statusColor(label)(`\u25CF ${label}`);
|
|
212
272
|
}
|
|
213
273
|
function formatSection(title, subtitle) {
|
|
214
|
-
return `${pc.bold(
|
|
274
|
+
return `${pc.bold(accent("\u25C6"))} ${pc.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
|
|
215
275
|
}
|
|
216
276
|
function formatSuccessCard(title, rows = []) {
|
|
217
|
-
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${
|
|
277
|
+
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${themeFaint("\u2502")} ${themeDim(key.padEnd(12))} ${value}`);
|
|
218
278
|
return [formatSection(title), ...body].join(`
|
|
219
279
|
`);
|
|
220
280
|
}
|
|
221
281
|
function formatNextSteps(steps) {
|
|
222
282
|
if (steps.length === 0)
|
|
223
283
|
return [];
|
|
224
|
-
return [pc.bold("Next"), ...steps.map((step) => `${
|
|
284
|
+
return [pc.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
|
|
225
285
|
}
|
|
226
286
|
function formatConnectionList(connections) {
|
|
227
287
|
const rows = [["local", { kind: "local", mode: "auto" }], ...Object.entries(connections)];
|
|
@@ -239,9 +299,9 @@ function formatConnectionStatus(selected, connections) {
|
|
|
239
299
|
const target = !connection ? "not configured" : connection.kind === "remote" ? connection.baseUrl : "local";
|
|
240
300
|
return [
|
|
241
301
|
formatSection("Rig server", "selected for this repo"),
|
|
242
|
-
`${
|
|
243
|
-
`${
|
|
244
|
-
`${
|
|
302
|
+
`${themeFaint("\u2502")} ${themeDim("selected ")} ${pc.bold(selected)}`,
|
|
303
|
+
`${themeFaint("\u2502")} ${themeDim("kind ")} ${formatStatusPill(connection?.kind ?? "unknown")}`,
|
|
304
|
+
`${themeFaint("\u2502")} ${themeDim("target ")} ${target ?? "not configured"}`,
|
|
245
305
|
"",
|
|
246
306
|
...formatNextSteps(["Change: `rig server use <alias|local>`", "List saved servers: `rig server list`"])
|
|
247
307
|
].join(`
|
|
@@ -364,6 +364,65 @@ var RESUMABLE_RUN_STATUSES = new Set([
|
|
|
364
364
|
// packages/cli/src/commands/_cli-format.ts
|
|
365
365
|
import { log, note } from "@clack/prompts";
|
|
366
366
|
import pc from "picocolors";
|
|
367
|
+
|
|
368
|
+
// packages/cli/src/commands/_tui-theme.ts
|
|
369
|
+
var RIG_PALETTE = {
|
|
370
|
+
ink: "#f2f3f6",
|
|
371
|
+
ink2: "#aeb0ba",
|
|
372
|
+
ink3: "#6c6e79",
|
|
373
|
+
ink4: "#44464f",
|
|
374
|
+
accent: "#ccff4d",
|
|
375
|
+
accentDim: "#a9d63f",
|
|
376
|
+
cyan: "#56d8ff",
|
|
377
|
+
red: "#ff5d5d",
|
|
378
|
+
yellow: "#ffd24d"
|
|
379
|
+
};
|
|
380
|
+
function hexToRgb(hex) {
|
|
381
|
+
const value = hex.replace("#", "");
|
|
382
|
+
return [
|
|
383
|
+
Number.parseInt(value.slice(0, 2), 16),
|
|
384
|
+
Number.parseInt(value.slice(2, 4), 16),
|
|
385
|
+
Number.parseInt(value.slice(4, 6), 16)
|
|
386
|
+
];
|
|
387
|
+
}
|
|
388
|
+
function fg(hex) {
|
|
389
|
+
const [r, g, b] = hexToRgb(hex);
|
|
390
|
+
return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
391
|
+
}
|
|
392
|
+
var ink = fg(RIG_PALETTE.ink);
|
|
393
|
+
var ink2 = fg(RIG_PALETTE.ink2);
|
|
394
|
+
var ink3 = fg(RIG_PALETTE.ink3);
|
|
395
|
+
var ink4 = fg(RIG_PALETTE.ink4);
|
|
396
|
+
var accent = fg(RIG_PALETTE.accent);
|
|
397
|
+
var accentDim = fg(RIG_PALETTE.accentDim);
|
|
398
|
+
var cyan = fg(RIG_PALETTE.cyan);
|
|
399
|
+
var red = fg(RIG_PALETTE.red);
|
|
400
|
+
var yellow = fg(RIG_PALETTE.yellow);
|
|
401
|
+
var DRONE_ART = [
|
|
402
|
+
" .-=-. .-=-. ",
|
|
403
|
+
" ( !!! ) ( !!! ) ",
|
|
404
|
+
" '-=-'._ _.'-=-' ",
|
|
405
|
+
" '._ _.' ",
|
|
406
|
+
" '=$$$$$$$=.' ",
|
|
407
|
+
" =$$$$$$$$$$$= ",
|
|
408
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
409
|
+
" $$$@@ @@$$$ ",
|
|
410
|
+
" $$@ ? @$$$ ",
|
|
411
|
+
" $$$@ '-' @$$$ ",
|
|
412
|
+
" $$$@@ @@$$$ ",
|
|
413
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
414
|
+
" =$$$$$$$$$$$= ",
|
|
415
|
+
" '=$$$$$$$=.' ",
|
|
416
|
+
" _.' '._ ",
|
|
417
|
+
" .-=-.' '.-=-. ",
|
|
418
|
+
" ( !!! ) ( !!! ) ",
|
|
419
|
+
" '-=-' '-=-' "
|
|
420
|
+
];
|
|
421
|
+
var DRONE_WIDTH = DRONE_ART[0].length;
|
|
422
|
+
var DRONE_HEIGHT = DRONE_ART.length;
|
|
423
|
+
|
|
424
|
+
// packages/cli/src/commands/_cli-format.ts
|
|
425
|
+
var themeDim = (value) => ink3(value);
|
|
367
426
|
function shouldUseClackOutput() {
|
|
368
427
|
return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
|
|
369
428
|
}
|
|
@@ -378,12 +437,12 @@ function printFormattedOutput(message, options = {}) {
|
|
|
378
437
|
log.message(message);
|
|
379
438
|
}
|
|
380
439
|
function formatSection(title, subtitle) {
|
|
381
|
-
return `${pc.bold(
|
|
440
|
+
return `${pc.bold(accent("\u25C6"))} ${pc.bold(title)}${subtitle ? themeDim(` \u2014 ${subtitle}`) : ""}`;
|
|
382
441
|
}
|
|
383
442
|
function formatNextSteps(steps) {
|
|
384
443
|
if (steps.length === 0)
|
|
385
444
|
return [];
|
|
386
|
-
return [pc.bold("Next"), ...steps.map((step) => `${
|
|
445
|
+
return [pc.bold("Next"), ...steps.map((step) => `${accent("\u203A")} ${step}`)];
|
|
387
446
|
}
|
|
388
447
|
|
|
389
448
|
// packages/cli/src/commands/_async-ui.ts
|