@h-rig/cli-surface-plugin 0.0.6-alpha.157 → 0.0.6-alpha.159
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/src/app/drone-ui.d.ts +0 -11
- package/dist/src/app/drone-ui.js +0 -114
- package/dist/src/commands/_async-ui.d.ts +1 -1
- package/dist/src/commands/_cli-format.d.ts +0 -29
- package/dist/src/commands/_cli-format.js +59 -113
- package/dist/src/commands/_connection-state.d.ts +6 -33
- package/dist/src/commands/_connection-state.js +654 -138
- package/dist/src/commands/_doctor-checks.d.ts +2 -5
- package/dist/src/commands/_doctor-checks.js +10 -9
- package/dist/src/commands/_help-catalog.d.ts +2 -1
- package/dist/src/commands/_help-catalog.js +654 -7
- package/dist/src/commands/_inprocess-services.d.ts +5 -5
- package/dist/src/commands/_inprocess-services.js +1 -1
- package/dist/src/commands/_parsers.js +651 -12
- package/dist/src/commands/_paths.d.ts +0 -2
- package/dist/src/commands/_paths.js +2 -10
- package/dist/src/commands/_pi-install.d.ts +2 -12
- package/dist/src/commands/_pi-install.js +3 -36
- package/dist/src/commands/_policy.js +659 -20
- package/dist/src/commands/agent.d.ts +1 -1
- package/dist/src/commands/agent.js +675 -24
- package/dist/src/commands/config.d.ts +1 -1
- package/dist/src/commands/config.js +656 -21
- package/dist/src/commands/dist.d.ts +1 -1
- package/dist/src/commands/dist.js +828 -102
- package/dist/src/commands/doctor.d.ts +1 -1
- package/dist/src/commands/doctor.js +658 -12
- package/dist/src/commands/github.d.ts +1 -1
- package/dist/src/commands/github.js +658 -19
- package/dist/src/commands/inbox.d.ts +12 -8
- package/dist/src/commands/inbox.js +741 -22
- package/dist/src/commands/init.d.ts +17 -19
- package/dist/src/commands/init.js +836 -306
- package/dist/src/commands/inspect.d.ts +5 -6
- package/dist/src/commands/inspect.js +754 -42
- package/dist/src/commands/pi.d.ts +1 -1
- package/dist/src/commands/pi.js +655 -16
- package/dist/src/commands/plugin.d.ts +9 -9
- package/dist/src/commands/plugin.js +652 -13
- package/dist/src/commands/profile-and-review.d.ts +1 -1
- package/dist/src/commands/profile-and-review.js +655 -16
- package/dist/src/commands/queue.d.ts +1 -1
- package/dist/src/commands/queue.js +871 -12
- package/dist/src/commands/remote-client.d.ts +152 -0
- package/dist/src/commands/remote-client.js +475 -0
- package/dist/src/commands/remote.d.ts +1 -1
- package/dist/src/commands/remote.js +1100 -29
- package/dist/src/commands/repo-git-harness.d.ts +1 -1
- package/dist/src/commands/repo-git-harness.js +2321 -47
- package/dist/src/commands/run.d.ts +10 -6
- package/dist/src/commands/run.js +830 -50
- package/dist/src/commands/server.d.ts +1 -1
- package/dist/src/commands/server.js +649 -11
- package/dist/src/commands/setup.d.ts +2 -2
- package/dist/src/commands/setup.js +829 -18
- package/dist/src/commands/stats.d.ts +2 -4
- package/dist/src/commands/stats.js +1299 -20
- package/dist/src/commands/test.d.ts +1 -1
- package/dist/src/commands/test.js +648 -9
- package/dist/src/commands/triage.d.ts +2 -3
- package/dist/src/commands/triage.js +657 -11
- package/dist/src/commands/workspace.d.ts +1 -1
- package/dist/src/commands/workspace.js +1280 -15
- package/dist/src/control-plane/agent-binary-build.d.ts +9 -0
- package/dist/src/control-plane/agent-binary-build.js +88 -0
- package/dist/src/control-plane/embedded-native-assets.d.ts +7 -0
- package/dist/src/control-plane/embedded-native-assets.js +6 -0
- package/dist/src/control-plane/guard.d.ts +17 -0
- package/dist/src/control-plane/guard.js +684 -0
- package/dist/src/control-plane/harness-cli.d.ts +12 -0
- package/dist/src/control-plane/harness-cli.js +1623 -0
- package/dist/src/control-plane/native/git-ops.d.ts +67 -0
- package/dist/src/control-plane/native/git-ops.js +1381 -0
- package/dist/src/control-plane/native/github-auth-env.d.ts +1 -0
- package/dist/src/control-plane/native/github-auth-env.js +21 -0
- package/dist/src/control-plane/native/host-git.d.ts +4 -0
- package/dist/src/control-plane/native/host-git.js +51 -0
- package/dist/src/control-plane/priority-queue.d.ts +22 -0
- package/dist/src/control-plane/priority-queue.js +212 -0
- package/dist/src/control-plane/rigfig.d.ts +9 -0
- package/dist/src/control-plane/rigfig.js +70 -0
- package/dist/src/control-plane/scope.d.ts +3 -0
- package/dist/src/control-plane/scope.js +58 -0
- package/dist/src/control-plane/setup-status.d.ts +44 -0
- package/dist/src/control-plane/setup-status.js +164 -0
- package/dist/src/control-plane/task-data.d.ts +2 -0
- package/dist/src/control-plane/task-data.js +12 -0
- package/dist/src/control-plane/workspace-ops.d.ts +79 -0
- package/dist/src/control-plane/workspace-ops.js +639 -0
- package/dist/src/help-catalog-data.d.ts +7 -0
- package/dist/src/help-catalog-data.js +660 -0
- package/dist/src/kernel-dispatch.js +1 -3
- package/dist/src/plugin.js +10072 -30
- package/dist/src/runner.d.ts +7 -9
- package/dist/src/runner.js +750 -30
- package/package.json +12 -13
- package/dist/src/commands/_json-output.d.ts +0 -11
- package/dist/src/commands/_json-output.js +0 -54
- package/dist/src/commands/_pi-frontend.d.ts +0 -35
- package/dist/src/commands/_pi-frontend.js +0 -64
- package/dist/src/commands/_run-driver-helpers.d.ts +0 -26
- package/dist/src/commands/_run-driver-helpers.js +0 -132
- package/dist/src/commands/task-run-driver.d.ts +0 -93
- package/dist/src/commands/task-run-driver.js +0 -136
- package/dist/src/commands/task.d.ts +0 -46
- package/dist/src/commands/task.js +0 -555
- package/dist/src/provider-model.d.ts +0 -34
- package/dist/src/provider-model.js +0 -56
- package/dist/src/rig-config-package-deps.d.ts +0 -10
- package/dist/src/rig-config-package-deps.js +0 -272
- package/dist/src/version.d.ts +0 -8
- package/dist/src/version.js +0 -47
|
@@ -3,20 +3,9 @@ type DroneSelectOption<T extends string> = {
|
|
|
3
3
|
readonly label: string;
|
|
4
4
|
readonly hint?: string;
|
|
5
5
|
};
|
|
6
|
-
type DroneSpinner = {
|
|
7
|
-
start(message: string): void;
|
|
8
|
-
stop(message?: string): void;
|
|
9
|
-
error(message?: string): void;
|
|
10
|
-
};
|
|
11
6
|
export declare function droneIntro(title: string, subtitle?: string): void;
|
|
12
7
|
export declare function droneOutro(text: string): void;
|
|
13
|
-
export declare function droneNote(message: string, title?: string): void;
|
|
14
|
-
export declare function droneStep(text: string): void;
|
|
15
|
-
export declare function droneInfo(text: string): void;
|
|
16
|
-
export declare function droneWarn(text: string): void;
|
|
17
|
-
export declare function droneError(text: string): void;
|
|
18
8
|
export declare function droneCancel(text: string): void;
|
|
19
|
-
export declare function droneSpinner(): DroneSpinner;
|
|
20
9
|
export declare function droneSelect<T extends string>(input: {
|
|
21
10
|
readonly message: string;
|
|
22
11
|
readonly options: readonly DroneSelectOption<T>[];
|
package/dist/src/app/drone-ui.js
CHANGED
|
@@ -1,69 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli-surface-plugin/src/app/drone-ui.ts
|
|
3
3
|
import { Input, matchesKey, ProcessTerminal, SelectList, Text, TUI } from "@oh-my-pi/pi-tui";
|
|
4
|
-
|
|
5
|
-
// packages/cli-surface-plugin/src/commands/_spinner.ts
|
|
6
|
-
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
7
|
-
function createTtySpinner(input) {
|
|
8
|
-
const output = input.output ?? process.stdout;
|
|
9
|
-
const isTty = output.isTTY === true;
|
|
10
|
-
const frames = input.frames && input.frames.length > 0 ? input.frames : SPINNER_FRAMES;
|
|
11
|
-
let label = input.label;
|
|
12
|
-
let frame = 0;
|
|
13
|
-
let paused = false;
|
|
14
|
-
let stopped = false;
|
|
15
|
-
let lastPrintedLabel = "";
|
|
16
|
-
const render = () => {
|
|
17
|
-
if (stopped || paused)
|
|
18
|
-
return;
|
|
19
|
-
if (!isTty) {
|
|
20
|
-
if (label !== lastPrintedLabel) {
|
|
21
|
-
output.write(`${label}
|
|
22
|
-
`);
|
|
23
|
-
lastPrintedLabel = label;
|
|
24
|
-
}
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
frame = (frame + 1) % frames.length;
|
|
28
|
-
const glyph = frames[frame] ?? frames[0] ?? "";
|
|
29
|
-
output.write(`\r\x1B[2K${input.styleFrame ? input.styleFrame(glyph) : glyph} ${label}`);
|
|
30
|
-
};
|
|
31
|
-
const clearLine = () => {
|
|
32
|
-
if (isTty)
|
|
33
|
-
output.write("\r\x1B[2K");
|
|
34
|
-
};
|
|
35
|
-
render();
|
|
36
|
-
const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
|
|
37
|
-
return {
|
|
38
|
-
setLabel(next) {
|
|
39
|
-
label = next;
|
|
40
|
-
render();
|
|
41
|
-
},
|
|
42
|
-
pause() {
|
|
43
|
-
paused = true;
|
|
44
|
-
clearLine();
|
|
45
|
-
},
|
|
46
|
-
resume() {
|
|
47
|
-
if (stopped)
|
|
48
|
-
return;
|
|
49
|
-
paused = false;
|
|
50
|
-
render();
|
|
51
|
-
},
|
|
52
|
-
stop(finalLine) {
|
|
53
|
-
if (stopped)
|
|
54
|
-
return;
|
|
55
|
-
stopped = true;
|
|
56
|
-
if (timer)
|
|
57
|
-
clearInterval(timer);
|
|
58
|
-
clearLine();
|
|
59
|
-
if (finalLine)
|
|
60
|
-
output.write(`${finalLine}
|
|
61
|
-
`);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// packages/cli-surface-plugin/src/app/drone-ui.ts
|
|
67
4
|
var PALETTE = {
|
|
68
5
|
ink: "#f2f3f6",
|
|
69
6
|
ink2: "#aeb0ba",
|
|
@@ -106,12 +43,6 @@ var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => {
|
|
|
106
43
|
function bold(text) {
|
|
107
44
|
return `\x1B[1m${text}\x1B[22m`;
|
|
108
45
|
}
|
|
109
|
-
function renderMicroDroneFrame(frame) {
|
|
110
|
-
const tick = Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame));
|
|
111
|
-
const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
|
|
112
|
-
const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
|
|
113
|
-
return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
|
|
114
|
-
}
|
|
115
46
|
function hairline(width = Math.min(process.stdout.columns ?? 80, 100)) {
|
|
116
47
|
return ink4("\u2500".repeat(Math.max(10, width)));
|
|
117
48
|
}
|
|
@@ -125,48 +56,9 @@ function droneOutro(text) {
|
|
|
125
56
|
console.log(` ${accent("\u25C6")} ${ink2(text)}`);
|
|
126
57
|
console.log("");
|
|
127
58
|
}
|
|
128
|
-
function droneNote(message, title) {
|
|
129
|
-
if (title)
|
|
130
|
-
console.log(` ${accentDim("\u25C7")} ${bold(ink2(title))}`);
|
|
131
|
-
for (const line of message.split(`
|
|
132
|
-
`))
|
|
133
|
-
console.log(` ${ink4("\u2502")} ${line}`);
|
|
134
|
-
}
|
|
135
|
-
function droneStep(text) {
|
|
136
|
-
console.log(` ${accent("\u203A")} ${ink(text)}`);
|
|
137
|
-
}
|
|
138
|
-
function droneInfo(text) {
|
|
139
|
-
console.log(` ${cyan("\xB7")} ${ink2(text)}`);
|
|
140
|
-
}
|
|
141
|
-
function droneWarn(text) {
|
|
142
|
-
console.log(` ${yellow("\u25B2")} ${ink2(text)}`);
|
|
143
|
-
}
|
|
144
|
-
function droneError(text) {
|
|
145
|
-
console.log(` ${red("\u2716")} ${ink2(text)}`);
|
|
146
|
-
}
|
|
147
59
|
function droneCancel(text) {
|
|
148
60
|
console.log(` ${red("\u2716")} ${ink3(text)}`);
|
|
149
61
|
}
|
|
150
|
-
function droneSpinner() {
|
|
151
|
-
let active = null;
|
|
152
|
-
return {
|
|
153
|
-
start(message) {
|
|
154
|
-
active = createTtySpinner({
|
|
155
|
-
label: message,
|
|
156
|
-
frames: MICRO_DRONE_FRAMES,
|
|
157
|
-
styleFrame: renderMicroDroneFrame
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
stop(message) {
|
|
161
|
-
active?.stop(message ? ` ${accent("\u25C6")} ${ink2(message)}` : undefined);
|
|
162
|
-
active = null;
|
|
163
|
-
},
|
|
164
|
-
error(message) {
|
|
165
|
-
active?.stop(message ? ` ${red("\u2716")} ${ink2(message)}` : undefined);
|
|
166
|
-
active = null;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
62
|
var DRONE_SYMBOLS = {
|
|
171
63
|
cursor: "\u2192",
|
|
172
64
|
inputCursor: "\u258F",
|
|
@@ -263,16 +155,10 @@ async function droneConfirm(input) {
|
|
|
263
155
|
return answer === null ? null : answer === "yes";
|
|
264
156
|
}
|
|
265
157
|
export {
|
|
266
|
-
droneWarn,
|
|
267
158
|
droneText,
|
|
268
|
-
droneStep,
|
|
269
|
-
droneSpinner,
|
|
270
159
|
droneSelect,
|
|
271
160
|
droneOutro,
|
|
272
|
-
droneNote,
|
|
273
161
|
droneIntro,
|
|
274
|
-
droneInfo,
|
|
275
|
-
droneError,
|
|
276
162
|
droneConfirm,
|
|
277
163
|
droneCancel
|
|
278
164
|
};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
export type CliTaskLike = Record<string, unknown>;
|
|
2
1
|
export type CliRunLike = Record<string, unknown>;
|
|
3
2
|
export declare function printFormattedOutput(message: string): void;
|
|
4
3
|
export declare function formatStatusPill(status: string): string;
|
|
5
4
|
export declare function formatSection(title: string, subtitle?: string): string;
|
|
6
5
|
export declare function formatSuccessCard(title: string, rows?: Array<[string, string | number | null | undefined]>): string;
|
|
7
6
|
export declare function formatNextSteps(steps: readonly string[]): string[];
|
|
8
|
-
export declare function formatTaskList(tasks: readonly CliTaskLike[], options?: {
|
|
9
|
-
raw?: boolean;
|
|
10
|
-
}): string;
|
|
11
|
-
export declare function formatTaskCard(task: CliTaskLike, options?: {
|
|
12
|
-
title?: string;
|
|
13
|
-
selected?: boolean;
|
|
14
|
-
}): string;
|
|
15
|
-
export declare function formatTaskDetails(task: CliTaskLike): string;
|
|
16
7
|
export declare function formatRunList(runs: readonly CliRunLike[], options?: {
|
|
17
8
|
source?: "local" | "server";
|
|
18
9
|
}): string;
|
|
@@ -33,24 +24,4 @@ export declare function formatRunStatus(summary: {
|
|
|
33
24
|
source?: "local" | "server";
|
|
34
25
|
}): string;
|
|
35
26
|
export declare function formatInboxList(kind: "approvals" | "inputs", entries: readonly Record<string, unknown>[]): string;
|
|
36
|
-
export declare function formatConnectionList(connections: Record<string, {
|
|
37
|
-
kind: string;
|
|
38
|
-
baseUrl?: string;
|
|
39
|
-
mode?: string;
|
|
40
|
-
}>): string;
|
|
41
|
-
export declare function formatConnectionStatus(selected: string, connections: Record<string, {
|
|
42
|
-
kind: string;
|
|
43
|
-
baseUrl?: string;
|
|
44
|
-
mode?: string;
|
|
45
|
-
}>, repo?: {
|
|
46
|
-
project?: string;
|
|
47
|
-
serverProjectRoot?: string;
|
|
48
|
-
} | null, remoteProjectLink?: {
|
|
49
|
-
ok?: boolean;
|
|
50
|
-
status?: string;
|
|
51
|
-
serverProjectRoot?: string;
|
|
52
|
-
message?: string;
|
|
53
|
-
hint?: string;
|
|
54
|
-
} | null): string;
|
|
55
27
|
export declare function formatStatsTable(rows: Array<[string, unknown]>): string;
|
|
56
|
-
export declare function readOptionalCount(record: Record<string, unknown>, key: string): number | null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli-surface-plugin/src/commands/_cli-format.ts
|
|
3
3
|
import pc from "picocolors";
|
|
4
|
-
import { runStatusColorRole, runStatusText, statusColorRole } from "@rig/run-worker/runs";
|
|
5
4
|
var dim = pc.dim;
|
|
6
5
|
var faintBar = pc.dim("\u2502");
|
|
7
6
|
var accent = pc.cyan;
|
|
@@ -9,14 +8,6 @@ function numberField(record, key) {
|
|
|
9
8
|
const value = record[key];
|
|
10
9
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
11
10
|
}
|
|
12
|
-
function arrayField(record, key) {
|
|
13
|
-
const value = record[key];
|
|
14
|
-
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
|
|
15
|
-
}
|
|
16
|
-
function rawObject(record) {
|
|
17
|
-
const value = record.raw;
|
|
18
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : record;
|
|
19
|
-
}
|
|
20
11
|
function truncate(value, width) {
|
|
21
12
|
return value.length <= width ? value : `${value.slice(0, Math.max(0, width - 1))}\u2026`;
|
|
22
13
|
}
|
|
@@ -38,6 +29,52 @@ function colorForRole(role) {
|
|
|
38
29
|
return pc.dim;
|
|
39
30
|
}
|
|
40
31
|
}
|
|
32
|
+
function normalizeStatus(status) {
|
|
33
|
+
const normalized = String(status ?? "").trim().toLowerCase().replace(/[\s_]+/g, "-");
|
|
34
|
+
return normalized === "waiting-input" ? "waiting-user-input" : normalized;
|
|
35
|
+
}
|
|
36
|
+
function statusColorRole(status) {
|
|
37
|
+
switch (normalizeStatus(status)) {
|
|
38
|
+
case "done":
|
|
39
|
+
case "completed":
|
|
40
|
+
case "ready":
|
|
41
|
+
case "healthy":
|
|
42
|
+
case "approved":
|
|
43
|
+
case "merged":
|
|
44
|
+
return "success";
|
|
45
|
+
case "needs-attention":
|
|
46
|
+
case "waiting-approval":
|
|
47
|
+
case "waiting-user-input":
|
|
48
|
+
case "blocked":
|
|
49
|
+
case "paused":
|
|
50
|
+
return "action-yellow";
|
|
51
|
+
case "running":
|
|
52
|
+
case "adopted":
|
|
53
|
+
case "preparing":
|
|
54
|
+
case "created":
|
|
55
|
+
case "queued":
|
|
56
|
+
case "starting":
|
|
57
|
+
case "pending":
|
|
58
|
+
case "in-progress":
|
|
59
|
+
case "active":
|
|
60
|
+
case "booting":
|
|
61
|
+
case "validating":
|
|
62
|
+
case "reviewing":
|
|
63
|
+
case "closing-out":
|
|
64
|
+
return "active-cyan";
|
|
65
|
+
case "failed":
|
|
66
|
+
case "error":
|
|
67
|
+
case "rejected":
|
|
68
|
+
return "failure";
|
|
69
|
+
case "stopped":
|
|
70
|
+
case "cancelled":
|
|
71
|
+
case "canceled":
|
|
72
|
+
case "stale":
|
|
73
|
+
return "muted";
|
|
74
|
+
default:
|
|
75
|
+
return "neutral";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
41
78
|
function statusColor(status) {
|
|
42
79
|
return colorForRole(statusColorRole(status));
|
|
43
80
|
}
|
|
@@ -77,10 +114,20 @@ function requestIdOf(entry) {
|
|
|
77
114
|
return firstString(entry, ["requestId", "id", "approvalId", "inputId"], "(unknown-request)");
|
|
78
115
|
}
|
|
79
116
|
function runLikeStatusText(run) {
|
|
80
|
-
|
|
117
|
+
const record = run;
|
|
118
|
+
const normalized = normalizeStatus(record.status);
|
|
119
|
+
return normalized || (record.live === true && record.stale !== true ? "starting" : "unknown");
|
|
81
120
|
}
|
|
82
121
|
function runLikeStatusColor(run) {
|
|
83
|
-
|
|
122
|
+
const record = run;
|
|
123
|
+
const pendingApprovals = numberField(record, "pendingApprovals") ?? 0;
|
|
124
|
+
const pendingInputs = numberField(record, "pendingInputs") ?? 0;
|
|
125
|
+
const stallCount = numberField(record, "stallCount") ?? 0;
|
|
126
|
+
const status = runLikeStatusText(run);
|
|
127
|
+
if (status !== "completed" && status !== "failed" && status !== "stopped" && (status === "needs-attention" || pendingApprovals + pendingInputs > 0 || stallCount > 0)) {
|
|
128
|
+
return colorForRole("action-yellow");
|
|
129
|
+
}
|
|
130
|
+
return colorForRole(statusColorRole(status));
|
|
84
131
|
}
|
|
85
132
|
function printFormattedOutput(message) {
|
|
86
133
|
console.log(message);
|
|
@@ -105,61 +152,6 @@ function formatNextSteps(steps) {
|
|
|
105
152
|
function formatLegacyAutomationSurface() {
|
|
106
153
|
return [];
|
|
107
154
|
}
|
|
108
|
-
function formatTaskList(tasks, options = {}) {
|
|
109
|
-
if (tasks.length === 0) {
|
|
110
|
-
return [formatSection("Tasks", "empty"), dim("No tasks available."), "", ...formatNextSteps(["Refresh: `rig task list`", "Pick next: `rig task next`"])].join(`
|
|
111
|
-
`);
|
|
112
|
-
}
|
|
113
|
-
if (options.raw) {
|
|
114
|
-
return JSON.stringify(tasks, null, 2);
|
|
115
|
-
}
|
|
116
|
-
const rows = tasks.map((task) => summarizeTaskRow(task));
|
|
117
|
-
const idWidth = Math.max(2, ...rows.map((row) => row.id.length));
|
|
118
|
-
const statusWidth = Math.max(6, ...rows.map((row) => row.status.length));
|
|
119
|
-
const body = rows.map((row) => {
|
|
120
|
-
const labels = row.labels.length > 0 ? dim(` ${row.labels.slice(0, 4).map((label) => `#${label}`).join(" ")}`) : "";
|
|
121
|
-
const source = row.source ? dim(` ${row.source}`) : "";
|
|
122
|
-
return [
|
|
123
|
-
pc.bold(pad(truncate(row.id, idWidth), idWidth)),
|
|
124
|
-
statusColor(row.status)(pad(truncate(row.status, statusWidth), statusWidth)),
|
|
125
|
-
`${row.title}${labels}${source}`
|
|
126
|
-
].join(" ");
|
|
127
|
-
});
|
|
128
|
-
return [formatSection("Tasks", `${tasks.length}`), ...body].join(`
|
|
129
|
-
`);
|
|
130
|
-
}
|
|
131
|
-
function summarizeTaskRow(task) {
|
|
132
|
-
const raw = rawObject(task);
|
|
133
|
-
return {
|
|
134
|
-
id: firstString(task, ["id", "taskId"], "(unknown-task)"),
|
|
135
|
-
title: firstString(task, ["title", "summary", "name"], "(untitled)"),
|
|
136
|
-
status: firstString(task, ["status"], "unknown"),
|
|
137
|
-
labels: arrayField(task, "labels").length > 0 ? arrayField(task, "labels") : arrayField(raw, "labels"),
|
|
138
|
-
source: firstString(task, ["source"], "")
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function formatTaskCard(task, options = {}) {
|
|
142
|
-
const raw = rawObject(task);
|
|
143
|
-
const lines = [formatSection(options.title ?? (options.selected ? "Selected task" : "Task"))];
|
|
144
|
-
for (const [label, value] of [
|
|
145
|
-
["id", firstString(task, ["id", "taskId"], "(unknown-task)")],
|
|
146
|
-
["title", firstString(task, ["title", "summary", "name"], "(untitled)")],
|
|
147
|
-
["status", firstString(task, ["status"], "unknown")],
|
|
148
|
-
["source", firstString(task, ["source"], "")],
|
|
149
|
-
["url", firstString(raw, ["url"], "")]
|
|
150
|
-
]) {
|
|
151
|
-
if (value)
|
|
152
|
-
lines.push(`${faintBar} ${dim(label.padEnd(12))} ${value}`);
|
|
153
|
-
}
|
|
154
|
-
const labels = arrayField(task, "labels");
|
|
155
|
-
if (labels.length > 0)
|
|
156
|
-
lines.push(`${faintBar} ${dim("labels".padEnd(12))} ${labels.map((label) => `#${label}`).join(" ")}`);
|
|
157
|
-
return lines.join(`
|
|
158
|
-
`);
|
|
159
|
-
}
|
|
160
|
-
function formatTaskDetails(task) {
|
|
161
|
-
return formatTaskCard(task, { title: "Task details" });
|
|
162
|
-
}
|
|
163
155
|
function formatRunList(runs, options = {}) {
|
|
164
156
|
if (runs.length === 0) {
|
|
165
157
|
return [
|
|
@@ -267,56 +259,12 @@ function formatInboxList(kind, entries) {
|
|
|
267
259
|
return lines.join(`
|
|
268
260
|
`);
|
|
269
261
|
}
|
|
270
|
-
function formatConnectionList(connections) {
|
|
271
|
-
const names = Object.keys(connections).sort();
|
|
272
|
-
if (names.length === 0) {
|
|
273
|
-
return [formatSection("Rig servers", "empty"), dim("No saved server connections.")].join(`
|
|
274
|
-
`);
|
|
275
|
-
}
|
|
276
|
-
return [formatSection("Rig servers", `${names.length}`), ...names.map((name) => {
|
|
277
|
-
const connection = connections[name];
|
|
278
|
-
const target = connection.kind === "remote" ? connection.baseUrl ?? "(missing url)" : connection.mode ?? "local";
|
|
279
|
-
return `${faintBar} ${pc.bold(name)} ${dim(connection.kind)} ${target}`;
|
|
280
|
-
})].join(`
|
|
281
|
-
`);
|
|
282
|
-
}
|
|
283
|
-
function formatConnectionStatus(selected, connections, repo, remoteProjectLink) {
|
|
284
|
-
const selectedConnection = connections[selected];
|
|
285
|
-
const lines = [formatSection("Rig server", "selected for this repo")];
|
|
286
|
-
lines.push(`${faintBar} ${dim("selected".padEnd(12))} ${pc.bold(selected)}`);
|
|
287
|
-
if (selectedConnection) {
|
|
288
|
-
lines.push(`${faintBar} ${dim("kind".padEnd(12))} ${selectedConnection.kind}`);
|
|
289
|
-
if (selectedConnection.baseUrl)
|
|
290
|
-
lines.push(`${faintBar} ${dim("base url".padEnd(12))} ${selectedConnection.baseUrl}`);
|
|
291
|
-
if (selectedConnection.mode)
|
|
292
|
-
lines.push(`${faintBar} ${dim("mode".padEnd(12))} ${selectedConnection.mode}`);
|
|
293
|
-
}
|
|
294
|
-
if (repo?.project)
|
|
295
|
-
lines.push(`${faintBar} ${dim("project".padEnd(12))} ${repo.project}`);
|
|
296
|
-
if (repo?.serverProjectRoot)
|
|
297
|
-
lines.push(`${faintBar} ${dim("server root".padEnd(12))} ${repo.serverProjectRoot}`);
|
|
298
|
-
if (remoteProjectLink?.status)
|
|
299
|
-
lines.push(`${faintBar} ${dim("link".padEnd(12))} ${remoteProjectLink.status}`);
|
|
300
|
-
if (remoteProjectLink?.message)
|
|
301
|
-
lines.push(`${faintBar} ${dim("message".padEnd(12))} ${remoteProjectLink.message}`);
|
|
302
|
-
if (remoteProjectLink?.hint)
|
|
303
|
-
lines.push(`${faintBar} ${dim("hint".padEnd(12))} ${remoteProjectLink.hint}`);
|
|
304
|
-
return lines.join(`
|
|
305
|
-
`);
|
|
306
|
-
}
|
|
307
262
|
function formatStatsTable(rows) {
|
|
308
263
|
return rows.map(([label, value]) => `${faintBar} ${dim(label.padEnd(20))} ${compactValue(value)}`).join(`
|
|
309
264
|
`);
|
|
310
265
|
}
|
|
311
|
-
function readOptionalCount(record, key) {
|
|
312
|
-
return numberField(record, key);
|
|
313
|
-
}
|
|
314
266
|
export {
|
|
315
|
-
readOptionalCount,
|
|
316
267
|
printFormattedOutput,
|
|
317
|
-
formatTaskList,
|
|
318
|
-
formatTaskDetails,
|
|
319
|
-
formatTaskCard,
|
|
320
268
|
formatSuccessCard,
|
|
321
269
|
formatSubmittedRun,
|
|
322
270
|
formatStatusPill,
|
|
@@ -326,7 +274,5 @@ export {
|
|
|
326
274
|
formatRunList,
|
|
327
275
|
formatRunCard,
|
|
328
276
|
formatNextSteps,
|
|
329
|
-
formatInboxList
|
|
330
|
-
formatConnectionStatus,
|
|
331
|
-
formatConnectionList
|
|
277
|
+
formatInboxList
|
|
332
278
|
};
|
|
@@ -5,50 +5,23 @@ export type RigConnection = {
|
|
|
5
5
|
kind: "remote";
|
|
6
6
|
baseUrl: string;
|
|
7
7
|
};
|
|
8
|
-
export type GlobalConnectionState = {
|
|
9
|
-
connections: Record<string, RigConnection>;
|
|
10
|
-
};
|
|
11
8
|
export type RepoConnectionState = {
|
|
12
9
|
selected: string;
|
|
13
|
-
project?: string;
|
|
14
|
-
linkedAt?: string;
|
|
10
|
+
project?: string | undefined;
|
|
11
|
+
linkedAt?: string | undefined;
|
|
15
12
|
/**
|
|
16
13
|
* The server-host project root this repo scopes to (multi-root serving).
|
|
17
14
|
* Sent as the x-rig-project-root header on every remote request.
|
|
18
15
|
*/
|
|
19
|
-
serverProjectRoot?: string;
|
|
16
|
+
serverProjectRoot?: string | undefined;
|
|
20
17
|
/** The selected alias that produced serverProjectRoot. Prevents cross-alias reuse. */
|
|
21
|
-
serverProjectRootAlias?: string;
|
|
18
|
+
serverProjectRootAlias?: string | undefined;
|
|
22
19
|
/** The remote base URL that produced serverProjectRoot. Prevents same-alias retarget leaks. */
|
|
23
|
-
serverProjectRootBaseUrl?: string;
|
|
20
|
+
serverProjectRootBaseUrl?: string | undefined;
|
|
24
21
|
};
|
|
25
|
-
export declare function resolveGlobalConnectionsPath(env?: NodeJS.ProcessEnv): string;
|
|
26
22
|
export declare function resolveRepoConnectionPath(projectRoot: string): string;
|
|
27
|
-
export declare function readGlobalConnections(options?: {
|
|
28
|
-
env?: NodeJS.ProcessEnv;
|
|
29
|
-
}): GlobalConnectionState;
|
|
30
|
-
export declare function writeGlobalConnections(state: GlobalConnectionState, options?: {
|
|
31
|
-
env?: NodeJS.ProcessEnv;
|
|
32
|
-
}): void;
|
|
33
|
-
export declare function upsertGlobalConnection(alias: string, connection: RigConnection, options?: {
|
|
34
|
-
env?: NodeJS.ProcessEnv;
|
|
35
|
-
}): GlobalConnectionState;
|
|
36
23
|
export declare function readRepoConnection(projectRoot: string): RepoConnectionState | null;
|
|
37
24
|
export declare function writeRepoConnection(projectRoot: string, state: RepoConnectionState): void;
|
|
38
|
-
export declare function resolveSelectedConnection(projectRoot: string, options?: {
|
|
39
|
-
env?: NodeJS.ProcessEnv;
|
|
40
|
-
}): {
|
|
41
|
-
alias: string;
|
|
42
|
-
connection: RigConnection;
|
|
43
|
-
serverProjectRoot?: string;
|
|
44
|
-
} | null;
|
|
45
25
|
/** Persist the server-host project root this repo scopes to (multi-root serving). */
|
|
46
|
-
export declare function writeRepoServerProjectRoot(projectRoot: string, serverProjectRoot: string, metadata?: {
|
|
47
|
-
alias?: string;
|
|
48
|
-
baseUrl?: string;
|
|
49
|
-
project?: string;
|
|
50
|
-
}): void;
|
|
51
26
|
/** Remove a stale server-host root while preserving selected server/repo state. */
|
|
52
|
-
|
|
53
|
-
/** Whether this repo's selected connection targets a remote Rig server. */
|
|
54
|
-
export declare function isRemoteConnectionSelected(projectRoot: string): boolean;
|
|
27
|
+
/** Whether this repo's selected connection targets a remote Rig server. */
|