@h-rig/cli 0.0.6-alpha.83 → 0.0.6-alpha.84
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 +22085 -14618
- package/dist/src/app/board.js +155 -28
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
- package/dist/src/app-opentui/adapters/doctor.js +1 -25
- package/dist/src/app-opentui/adapters/family.d.ts +62 -0
- package/dist/src/app-opentui/adapters/family.js +14305 -0
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
- package/dist/src/app-opentui/adapters/fleet.js +6 -40
- package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
- package/dist/src/app-opentui/adapters/inbox.js +54 -59
- package/dist/src/app-opentui/adapters/init.d.ts +0 -2
- package/dist/src/app-opentui/adapters/init.js +0 -26
- package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
- package/dist/src/app-opentui/adapters/inspect.js +1024 -0
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
- package/dist/src/app-opentui/adapters/pi-attach.js +348 -93
- package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
- package/dist/src/app-opentui/adapters/pi.js +363 -0
- package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
- package/dist/src/app-opentui/adapters/plugin.js +544 -0
- package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
- package/dist/src/app-opentui/adapters/repo.js +186 -0
- package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
- package/dist/src/app-opentui/adapters/run-detail.js +97 -44
- package/dist/src/app-opentui/adapters/server.d.ts +10 -2
- package/dist/src/app-opentui/adapters/server.js +96 -27
- package/dist/src/app-opentui/adapters/tasks.d.ts +0 -2
- package/dist/src/app-opentui/adapters/tasks.js +437 -105
- package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
- package/dist/src/app-opentui/adapters/workspace.js +333 -0
- package/dist/src/app-opentui/autocomplete.d.ts +20 -0
- package/dist/src/app-opentui/autocomplete.js +576 -0
- package/dist/src/app-opentui/bootstrap.js +24296 -16919
- package/dist/src/app-opentui/command-palette.d.ts +3 -0
- package/dist/src/app-opentui/command-palette.js +1010 -0
- package/dist/src/app-opentui/drone.js +8 -6
- package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
- package/dist/src/app-opentui/fleet-stats.js +114 -0
- package/dist/src/app-opentui/index.js +3438 -1724
- package/dist/src/app-opentui/intent.js +71 -48
- package/dist/src/app-opentui/keymap.d.ts +6 -5
- package/dist/src/app-opentui/keymap.js +1064 -23
- package/dist/src/app-opentui/layout.d.ts +7 -0
- package/dist/src/app-opentui/layout.js +13 -6
- package/dist/src/app-opentui/list-search.d.ts +24 -0
- package/dist/src/app-opentui/list-search.js +88 -1
- package/dist/src/app-opentui/pi-host-child.js +33 -1
- package/dist/src/app-opentui/pi-pty-host.d.ts +5 -0
- package/dist/src/app-opentui/pi-pty-host.js +21 -3
- package/dist/src/app-opentui/react/App.d.ts +9 -0
- package/dist/src/app-opentui/react/App.js +5144 -0
- package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
- package/dist/src/app-opentui/react/Backdrop.js +1834 -0
- package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
- package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
- package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
- package/dist/src/app-opentui/react/context.d.ts +17 -0
- package/dist/src/app-opentui/react/context.js +37 -0
- package/dist/src/app-opentui/react/launch.d.ts +2 -0
- package/dist/src/app-opentui/react/launch.js +5743 -0
- package/dist/src/app-opentui/react/nav.d.ts +18 -0
- package/dist/src/app-opentui/react/nav.js +54 -0
- package/dist/src/app-opentui/react/scroll.d.ts +12 -0
- package/dist/src/app-opentui/react/scroll.js +21 -0
- package/dist/src/app-opentui/react/syntax.d.ts +2 -0
- package/dist/src/app-opentui/react/syntax.js +64 -0
- package/dist/src/app-opentui/registry.js +19923 -5151
- package/dist/src/app-opentui/render/constants.d.ts +31 -0
- package/dist/src/app-opentui/render/constants.js +66 -0
- package/dist/src/app-opentui/render/graphics.d.ts +2 -1
- package/dist/src/app-opentui/render/graphics.js +106 -39
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +108 -20
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +7 -0
- package/dist/src/app-opentui/render/image-visual-layer.js +109 -20
- package/dist/src/app-opentui/render/native-host.d.ts +37 -0
- package/dist/src/app-opentui/render/native-host.js +179 -0
- package/dist/src/app-opentui/render/panels.js +18 -11
- package/dist/src/app-opentui/render/preloader.js +8 -6
- package/dist/src/app-opentui/render/scene.d.ts +50 -1
- package/dist/src/app-opentui/render/scene.js +183 -6
- package/dist/src/app-opentui/render/text.d.ts +7 -1
- package/dist/src/app-opentui/render/text.js +10 -7
- package/dist/src/app-opentui/render/type-bar.js +69 -30
- package/dist/src/app-opentui/runtime.d.ts +44 -1
- package/dist/src/app-opentui/runtime.js +3231 -1363
- package/dist/src/app-opentui/scenes/command.js +20 -6
- package/dist/src/app-opentui/scenes/doctor.js +176 -11
- package/dist/src/app-opentui/scenes/error.js +20 -10
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
- package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
- package/dist/src/app-opentui/scenes/family.d.ts +3 -0
- package/dist/src/app-opentui/scenes/family.js +2144 -0
- package/dist/src/app-opentui/scenes/fleet.js +521 -31
- package/dist/src/app-opentui/scenes/handoff.js +204 -12
- package/dist/src/app-opentui/scenes/help.js +609 -40
- package/dist/src/app-opentui/scenes/inbox.js +278 -17
- package/dist/src/app-opentui/scenes/init.js +84 -39
- package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
- package/dist/src/app-opentui/scenes/inspect.js +793 -0
- package/dist/src/app-opentui/scenes/main.js +218 -39
- package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
- package/dist/src/app-opentui/scenes/pi.js +508 -0
- package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
- package/dist/src/app-opentui/scenes/plugin.js +486 -0
- package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
- package/dist/src/app-opentui/scenes/repo.js +424 -0
- package/dist/src/app-opentui/scenes/run-detail.js +333 -20
- package/dist/src/app-opentui/scenes/server.js +181 -15
- package/dist/src/app-opentui/scenes/tasks.js +486 -31
- package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
- package/dist/src/app-opentui/scenes/workspace.js +426 -0
- package/dist/src/app-opentui/selectable.d.ts +19 -0
- package/dist/src/app-opentui/selectable.js +79 -0
- package/dist/src/app-opentui/state.js +83 -30
- package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
- package/dist/src/app-opentui/surface-catalog.js +540 -0
- package/dist/src/app-opentui/theme.d.ts +28 -6
- package/dist/src/app-opentui/theme.js +61 -8
- package/dist/src/app-opentui/types.d.ts +121 -4
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +2 -12
- package/dist/src/commands/_help-catalog.js +95 -15
- package/dist/src/commands/_operator-view.js +34 -2
- package/dist/src/commands/_pi-frontend.d.ts +2 -0
- package/dist/src/commands/_pi-frontend.js +34 -0
- package/dist/src/commands/_server-events.d.ts +26 -0
- package/dist/src/commands/_server-events.js +310 -0
- package/dist/src/commands/agent.js +2 -12
- package/dist/src/commands/run.js +34 -2
- package/dist/src/commands/server.js +2 -12
- package/dist/src/commands/stats.js +95 -15
- package/dist/src/commands/task-run-driver.js +2 -12
- package/dist/src/commands/task.js +131 -29
- package/dist/src/commands.js +192 -31
- package/dist/src/index.js +192 -31
- package/package.json +11 -9
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/app-opentui/theme.ts
|
|
3
|
+
import {
|
|
4
|
+
bold as otuiBold,
|
|
5
|
+
dim as otuiDim,
|
|
6
|
+
fg as otuiFg,
|
|
7
|
+
t,
|
|
8
|
+
TextAttributes
|
|
9
|
+
} from "@opentui/core";
|
|
10
|
+
var RIG_UI = {
|
|
11
|
+
bg: "#070809",
|
|
12
|
+
bg2: "#0b0c0e",
|
|
13
|
+
panel: "#101115",
|
|
14
|
+
panel2: "#14161b",
|
|
15
|
+
glass: "#1e2230",
|
|
16
|
+
border: "#2a2e3a",
|
|
17
|
+
ink: "#f4f5f8",
|
|
18
|
+
ink2: "#c7c9d3",
|
|
19
|
+
ink3: "#9aa0ae",
|
|
20
|
+
ink4: "#787b86",
|
|
21
|
+
lime: "#ccff4d",
|
|
22
|
+
limeDim: "#a9d63f",
|
|
23
|
+
cyan: "#56d8ff",
|
|
24
|
+
cyanDim: "#3f9fbd",
|
|
25
|
+
red: "#ff5d5d",
|
|
26
|
+
yellow: "#ffd24d",
|
|
27
|
+
magenta: "#ff79b0"
|
|
28
|
+
};
|
|
29
|
+
var styles = {
|
|
30
|
+
ink: otuiFg(RIG_UI.ink),
|
|
31
|
+
ink2: otuiFg(RIG_UI.ink2),
|
|
32
|
+
ink3: otuiFg(RIG_UI.ink3),
|
|
33
|
+
ink4: otuiFg(RIG_UI.ink4),
|
|
34
|
+
lime: otuiFg(RIG_UI.lime),
|
|
35
|
+
limeDim: otuiFg(RIG_UI.limeDim),
|
|
36
|
+
cyan: otuiFg(RIG_UI.cyan),
|
|
37
|
+
red: otuiFg(RIG_UI.red),
|
|
38
|
+
yellow: otuiFg(RIG_UI.yellow),
|
|
39
|
+
magenta: otuiFg(RIG_UI.magenta)
|
|
40
|
+
};
|
|
41
|
+
function statusColor(status) {
|
|
42
|
+
switch (status) {
|
|
43
|
+
case "success":
|
|
44
|
+
case "completed":
|
|
45
|
+
case "merged":
|
|
46
|
+
return RIG_UI.lime;
|
|
47
|
+
case "running":
|
|
48
|
+
case "preparing":
|
|
49
|
+
case "created":
|
|
50
|
+
case "validating":
|
|
51
|
+
case "reviewing":
|
|
52
|
+
case "closing-out":
|
|
53
|
+
case "stopping":
|
|
54
|
+
case "loading":
|
|
55
|
+
case "action":
|
|
56
|
+
return RIG_UI.cyan;
|
|
57
|
+
case "needs-attention":
|
|
58
|
+
case "needs_attention":
|
|
59
|
+
return RIG_UI.yellow;
|
|
60
|
+
case "failed":
|
|
61
|
+
case "error":
|
|
62
|
+
return RIG_UI.red;
|
|
63
|
+
default:
|
|
64
|
+
return RIG_UI.ink3;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function statusGlyph(status) {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case "success":
|
|
70
|
+
case "completed":
|
|
71
|
+
case "merged":
|
|
72
|
+
return "\u2713";
|
|
73
|
+
case "running":
|
|
74
|
+
return "\u25CF";
|
|
75
|
+
case "preparing":
|
|
76
|
+
case "created":
|
|
77
|
+
case "validating":
|
|
78
|
+
case "reviewing":
|
|
79
|
+
case "closing-out":
|
|
80
|
+
case "stopping":
|
|
81
|
+
case "loading":
|
|
82
|
+
case "action":
|
|
83
|
+
return "\u25D0";
|
|
84
|
+
case "needs-attention":
|
|
85
|
+
case "needs_attention":
|
|
86
|
+
return "\u26A0";
|
|
87
|
+
case "failed":
|
|
88
|
+
case "error":
|
|
89
|
+
return "\u2717";
|
|
90
|
+
default:
|
|
91
|
+
return "\xB7";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function noColorActive() {
|
|
95
|
+
const noColor = process.env.NO_COLOR;
|
|
96
|
+
if (noColor !== undefined && noColor !== "") {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return process.env.RIG_NO_COLOR !== undefined;
|
|
100
|
+
}
|
|
101
|
+
function statusLabel(status) {
|
|
102
|
+
return {
|
|
103
|
+
glyph: statusGlyph(status),
|
|
104
|
+
color: noColorActive() ? RIG_UI.ink : statusColor(status)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// packages/cli/src/app-opentui/drone.ts
|
|
109
|
+
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
110
|
+
var COLOR = {
|
|
111
|
+
body: RGBA.fromHex(RIG_UI.lime),
|
|
112
|
+
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
113
|
+
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
114
|
+
path: RGBA.fromHex(RIG_UI.cyan),
|
|
115
|
+
eye: RGBA.fromHex(RIG_UI.ink),
|
|
116
|
+
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
117
|
+
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// packages/cli/src/app-opentui/render/scene.ts
|
|
121
|
+
function line(text, options = {}) {
|
|
122
|
+
return { text, ...options };
|
|
123
|
+
}
|
|
124
|
+
function blank() {
|
|
125
|
+
return { text: "" };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
129
|
+
var ACTIVE_STATUSES = new Set([
|
|
130
|
+
"running",
|
|
131
|
+
"preparing",
|
|
132
|
+
"created",
|
|
133
|
+
"validating",
|
|
134
|
+
"reviewing",
|
|
135
|
+
"closing-out",
|
|
136
|
+
"stopping",
|
|
137
|
+
"loading"
|
|
138
|
+
]);
|
|
139
|
+
|
|
140
|
+
// packages/cli/src/app-opentui/scenes/family-domains/kit.ts
|
|
141
|
+
function actionItemFor(family, sub) {
|
|
142
|
+
const base = sub.base.join(" ");
|
|
143
|
+
if (sub.direct) {
|
|
144
|
+
const label = `run rig ${family} ${base}`.trim();
|
|
145
|
+
return {
|
|
146
|
+
id: `action:${sub.id}`,
|
|
147
|
+
label,
|
|
148
|
+
intent: { scene: "command", argv: [family, ...sub.base], action: { kind: "command-run", label: `Run rig ${family} ${base}`.trim(), payload: { argv: [family, ...sub.base], family } } },
|
|
149
|
+
message: label
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
id: `action:${sub.id}`,
|
|
154
|
+
label: `configure ${family} ${base}`.trim(),
|
|
155
|
+
intent: { scene: "family", argv: [family], action: { kind: "refresh", label: `Configure ${sub.template}`, payload: { family, formSub: sub.id } } },
|
|
156
|
+
message: `configure & run rig ${family} ${sub.template}`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function actionDetail(sub) {
|
|
160
|
+
return sub.direct ? sub.description : `${sub.description} \xB7 ${sub.fields.length} field${sub.fields.length === 1 ? "" : "s"}`;
|
|
161
|
+
}
|
|
162
|
+
function actionDeck(ctx, subs, heading = "ACTIONS") {
|
|
163
|
+
const out = [line(heading, { fg: RIG_UI.ink3, bold: true })];
|
|
164
|
+
for (const sub of subs) {
|
|
165
|
+
out.push(ctx.cursor.deck({ label: sub.base.join(" ") || ctx.family, detail: actionDetail(sub) }, actionItemFor(ctx.family, sub)));
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
function detailText(details, key) {
|
|
170
|
+
const value = details?.[key];
|
|
171
|
+
if (value === undefined || value === null)
|
|
172
|
+
return;
|
|
173
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
174
|
+
return String(value);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
function metric(label, value, opts = {}) {
|
|
178
|
+
return line(` ${label.padEnd(22)} ${value}`, { fg: opts.fg ?? RIG_UI.ink2, bold: opts.bold });
|
|
179
|
+
}
|
|
180
|
+
function heading(text) {
|
|
181
|
+
return line(text, { fg: RIG_UI.ink, bold: true });
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// packages/cli/src/app-opentui/scenes/family-domains/review.ts
|
|
185
|
+
var GATE_MODES = ["off", "advisory", "required"];
|
|
186
|
+
function setModeArgv(mode, provider) {
|
|
187
|
+
const argv = ["review", "set", mode];
|
|
188
|
+
if (provider)
|
|
189
|
+
argv.push("--provider", provider);
|
|
190
|
+
return argv;
|
|
191
|
+
}
|
|
192
|
+
function gateModeSegment(ctx, currentMode, provider) {
|
|
193
|
+
const active = currentMode ? currentMode.toLowerCase() : null;
|
|
194
|
+
const out = [heading("SET GATE MODE")];
|
|
195
|
+
for (const mode of GATE_MODES) {
|
|
196
|
+
const isActive = mode === active;
|
|
197
|
+
const argv = setModeArgv(mode, provider);
|
|
198
|
+
const label = isActive ? `[\u25CF ${mode}]` : `[ ${mode}]`;
|
|
199
|
+
const item = {
|
|
200
|
+
id: `review-mode:${mode}`,
|
|
201
|
+
label: `set gate ${mode}`,
|
|
202
|
+
intent: { scene: "command", argv, action: { kind: "command-run", label: `rig review set ${mode}`, payload: { argv: [...argv], family: ctx.family } } },
|
|
203
|
+
message: `set completion-review gate to ${mode}${provider ? ` (provider ${provider})` : ""}`
|
|
204
|
+
};
|
|
205
|
+
const content = line(` ${label.padEnd(16)} ${MODE_META[mode]?.gate ?? ""}`, {
|
|
206
|
+
fg: isActive ? RIG_UI.bg : RIG_UI.ink2,
|
|
207
|
+
bg: isActive ? RIG_UI.lime : undefined,
|
|
208
|
+
bold: isActive
|
|
209
|
+
});
|
|
210
|
+
out.push(ctx.cursor.row(content, item));
|
|
211
|
+
}
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
214
|
+
var MODE_META = {
|
|
215
|
+
off: { status: "needs-attention", gate: "NO GATE \xB7 completions are not reviewed" },
|
|
216
|
+
advisory: { status: "reviewing", gate: "ADVISORY \xB7 review runs, does not block completion" },
|
|
217
|
+
required: { status: "completed", gate: "ENFORCED \xB7 review must pass before completion" }
|
|
218
|
+
};
|
|
219
|
+
function strOrNull(value) {
|
|
220
|
+
return value && value.length > 0 ? value : null;
|
|
221
|
+
}
|
|
222
|
+
function fromLines(lines, key) {
|
|
223
|
+
const prefix = `${key}:`;
|
|
224
|
+
for (const raw of lines) {
|
|
225
|
+
const trimmed = raw.trim();
|
|
226
|
+
if (trimmed.toLowerCase().startsWith(prefix)) {
|
|
227
|
+
const value = trimmed.slice(prefix.length).trim();
|
|
228
|
+
if (value.length > 0)
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
function readPolicy(details, lines) {
|
|
235
|
+
return {
|
|
236
|
+
mode: strOrNull(detailText(details, "mode")) ?? fromLines(lines, "mode"),
|
|
237
|
+
provider: strOrNull(detailText(details, "provider")) ?? fromLines(lines, "provider"),
|
|
238
|
+
file: strOrNull(detailText(details, "file")) ?? fromLines(lines, "file")
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
var renderReview = (ctx) => {
|
|
242
|
+
const lines = [];
|
|
243
|
+
const policy = readPolicy(ctx.details, ctx.state.lines);
|
|
244
|
+
lines.push(line("COMPLETION REVIEW GATE", { fg: RIG_UI.lime, bold: true }));
|
|
245
|
+
lines.push(blank());
|
|
246
|
+
if (ctx.state.ran && policy.mode) {
|
|
247
|
+
const modeKey = policy.mode.toLowerCase();
|
|
248
|
+
const meta = MODE_META[modeKey] ?? { status: "default", gate: "unrecognized gate mode" };
|
|
249
|
+
const { glyph, color } = statusLabel(meta.status);
|
|
250
|
+
lines.push(heading("POLICY"));
|
|
251
|
+
lines.push(metric("gate mode", `${glyph} ${policy.mode.toUpperCase()}`, { fg: color, bold: true }));
|
|
252
|
+
lines.push(line(` ${meta.gate}`, { fg: RIG_UI.ink3 }));
|
|
253
|
+
lines.push(blank());
|
|
254
|
+
lines.push(heading("PROVIDER"));
|
|
255
|
+
lines.push(metric("review provider", policy.provider ?? "\u2014", { fg: policy.provider ? RIG_UI.cyan : RIG_UI.ink4 }));
|
|
256
|
+
lines.push(blank());
|
|
257
|
+
if (policy.file) {
|
|
258
|
+
lines.push(heading("SOURCE"));
|
|
259
|
+
lines.push(metric("policy file", policy.file, { fg: RIG_UI.ink2 }));
|
|
260
|
+
lines.push(blank());
|
|
261
|
+
}
|
|
262
|
+
} else if (ctx.state.ran && ctx.state.lines.length > 0) {
|
|
263
|
+
lines.push(heading("POLICY"));
|
|
264
|
+
for (const text of ctx.state.lines.slice(0, 40))
|
|
265
|
+
lines.push(line(` ${text}`, { fg: RIG_UI.ink2 }));
|
|
266
|
+
lines.push(blank());
|
|
267
|
+
} else {
|
|
268
|
+
lines.push(line(" gate policy not captured yet \u2014 run `review show`", { fg: RIG_UI.ink4 }));
|
|
269
|
+
lines.push(blank());
|
|
270
|
+
}
|
|
271
|
+
lines.push(...gateModeSegment(ctx, policy.mode, policy.provider));
|
|
272
|
+
lines.push(blank());
|
|
273
|
+
lines.push(...actionDeck(ctx, ctx.snap.subcommands, "ACTIONS"));
|
|
274
|
+
lines.push(blank());
|
|
275
|
+
lines.push(line("pick a gate-mode cell above to set it \xB7 show re-reads policy \xB7 set opens the full form", { fg: RIG_UI.ink4 }));
|
|
276
|
+
return lines;
|
|
277
|
+
};
|
|
278
|
+
export {
|
|
279
|
+
renderReview
|
|
280
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/app-opentui/theme.ts
|
|
3
|
+
import {
|
|
4
|
+
bold as otuiBold,
|
|
5
|
+
dim as otuiDim,
|
|
6
|
+
fg as otuiFg,
|
|
7
|
+
t,
|
|
8
|
+
TextAttributes
|
|
9
|
+
} from "@opentui/core";
|
|
10
|
+
var RIG_UI = {
|
|
11
|
+
bg: "#070809",
|
|
12
|
+
bg2: "#0b0c0e",
|
|
13
|
+
panel: "#101115",
|
|
14
|
+
panel2: "#14161b",
|
|
15
|
+
glass: "#1e2230",
|
|
16
|
+
border: "#2a2e3a",
|
|
17
|
+
ink: "#f4f5f8",
|
|
18
|
+
ink2: "#c7c9d3",
|
|
19
|
+
ink3: "#9aa0ae",
|
|
20
|
+
ink4: "#787b86",
|
|
21
|
+
lime: "#ccff4d",
|
|
22
|
+
limeDim: "#a9d63f",
|
|
23
|
+
cyan: "#56d8ff",
|
|
24
|
+
cyanDim: "#3f9fbd",
|
|
25
|
+
red: "#ff5d5d",
|
|
26
|
+
yellow: "#ffd24d",
|
|
27
|
+
magenta: "#ff79b0"
|
|
28
|
+
};
|
|
29
|
+
var styles = {
|
|
30
|
+
ink: otuiFg(RIG_UI.ink),
|
|
31
|
+
ink2: otuiFg(RIG_UI.ink2),
|
|
32
|
+
ink3: otuiFg(RIG_UI.ink3),
|
|
33
|
+
ink4: otuiFg(RIG_UI.ink4),
|
|
34
|
+
lime: otuiFg(RIG_UI.lime),
|
|
35
|
+
limeDim: otuiFg(RIG_UI.limeDim),
|
|
36
|
+
cyan: otuiFg(RIG_UI.cyan),
|
|
37
|
+
red: otuiFg(RIG_UI.red),
|
|
38
|
+
yellow: otuiFg(RIG_UI.yellow),
|
|
39
|
+
magenta: otuiFg(RIG_UI.magenta)
|
|
40
|
+
};
|
|
41
|
+
function statusColor(status) {
|
|
42
|
+
switch (status) {
|
|
43
|
+
case "success":
|
|
44
|
+
case "completed":
|
|
45
|
+
case "merged":
|
|
46
|
+
return RIG_UI.lime;
|
|
47
|
+
case "running":
|
|
48
|
+
case "preparing":
|
|
49
|
+
case "created":
|
|
50
|
+
case "validating":
|
|
51
|
+
case "reviewing":
|
|
52
|
+
case "closing-out":
|
|
53
|
+
case "stopping":
|
|
54
|
+
case "loading":
|
|
55
|
+
case "action":
|
|
56
|
+
return RIG_UI.cyan;
|
|
57
|
+
case "needs-attention":
|
|
58
|
+
case "needs_attention":
|
|
59
|
+
return RIG_UI.yellow;
|
|
60
|
+
case "failed":
|
|
61
|
+
case "error":
|
|
62
|
+
return RIG_UI.red;
|
|
63
|
+
default:
|
|
64
|
+
return RIG_UI.ink3;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function statusGlyph(status) {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case "success":
|
|
70
|
+
case "completed":
|
|
71
|
+
case "merged":
|
|
72
|
+
return "\u2713";
|
|
73
|
+
case "running":
|
|
74
|
+
return "\u25CF";
|
|
75
|
+
case "preparing":
|
|
76
|
+
case "created":
|
|
77
|
+
case "validating":
|
|
78
|
+
case "reviewing":
|
|
79
|
+
case "closing-out":
|
|
80
|
+
case "stopping":
|
|
81
|
+
case "loading":
|
|
82
|
+
case "action":
|
|
83
|
+
return "\u25D0";
|
|
84
|
+
case "needs-attention":
|
|
85
|
+
case "needs_attention":
|
|
86
|
+
return "\u26A0";
|
|
87
|
+
case "failed":
|
|
88
|
+
case "error":
|
|
89
|
+
return "\u2717";
|
|
90
|
+
default:
|
|
91
|
+
return "\xB7";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function noColorActive() {
|
|
95
|
+
const noColor = process.env.NO_COLOR;
|
|
96
|
+
if (noColor !== undefined && noColor !== "") {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return process.env.RIG_NO_COLOR !== undefined;
|
|
100
|
+
}
|
|
101
|
+
function statusLabel(status) {
|
|
102
|
+
return {
|
|
103
|
+
glyph: statusGlyph(status),
|
|
104
|
+
color: noColorActive() ? RIG_UI.ink : statusColor(status)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// packages/cli/src/app-opentui/drone.ts
|
|
109
|
+
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
110
|
+
var COLOR = {
|
|
111
|
+
body: RGBA.fromHex(RIG_UI.lime),
|
|
112
|
+
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
113
|
+
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
114
|
+
path: RGBA.fromHex(RIG_UI.cyan),
|
|
115
|
+
eye: RGBA.fromHex(RIG_UI.ink),
|
|
116
|
+
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
117
|
+
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// packages/cli/src/app-opentui/render/scene.ts
|
|
121
|
+
function line(text, options = {}) {
|
|
122
|
+
return { text, ...options };
|
|
123
|
+
}
|
|
124
|
+
function blank() {
|
|
125
|
+
return { text: "" };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
129
|
+
var ACTIVE_STATUSES = new Set([
|
|
130
|
+
"running",
|
|
131
|
+
"preparing",
|
|
132
|
+
"created",
|
|
133
|
+
"validating",
|
|
134
|
+
"reviewing",
|
|
135
|
+
"closing-out",
|
|
136
|
+
"stopping",
|
|
137
|
+
"loading"
|
|
138
|
+
]);
|
|
139
|
+
|
|
140
|
+
// packages/cli/src/app-opentui/scenes/family-domains/kit.ts
|
|
141
|
+
function actionItemFor(family, sub) {
|
|
142
|
+
const base = sub.base.join(" ");
|
|
143
|
+
if (sub.direct) {
|
|
144
|
+
const label = `run rig ${family} ${base}`.trim();
|
|
145
|
+
return {
|
|
146
|
+
id: `action:${sub.id}`,
|
|
147
|
+
label,
|
|
148
|
+
intent: { scene: "command", argv: [family, ...sub.base], action: { kind: "command-run", label: `Run rig ${family} ${base}`.trim(), payload: { argv: [family, ...sub.base], family } } },
|
|
149
|
+
message: label
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
id: `action:${sub.id}`,
|
|
154
|
+
label: `configure ${family} ${base}`.trim(),
|
|
155
|
+
intent: { scene: "family", argv: [family], action: { kind: "refresh", label: `Configure ${sub.template}`, payload: { family, formSub: sub.id } } },
|
|
156
|
+
message: `configure & run rig ${family} ${sub.template}`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function actionDetail(sub) {
|
|
160
|
+
return sub.direct ? sub.description : `${sub.description} \xB7 ${sub.fields.length} field${sub.fields.length === 1 ? "" : "s"}`;
|
|
161
|
+
}
|
|
162
|
+
function actionDeck(ctx, subs, heading = "ACTIONS") {
|
|
163
|
+
const out = [line(heading, { fg: RIG_UI.ink3, bold: true })];
|
|
164
|
+
for (const sub of subs) {
|
|
165
|
+
out.push(ctx.cursor.deck({ label: sub.base.join(" ") || ctx.family, detail: actionDetail(sub) }, actionItemFor(ctx.family, sub)));
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
function metric(label, value, opts = {}) {
|
|
170
|
+
return line(` ${label.padEnd(22)} ${value}`, { fg: opts.fg ?? RIG_UI.ink2, bold: opts.bold });
|
|
171
|
+
}
|
|
172
|
+
function heading(text) {
|
|
173
|
+
return line(text, { fg: RIG_UI.ink, bold: true });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// packages/cli/src/app-opentui/scenes/family-domains/setup.ts
|
|
177
|
+
function strOrNull(value) {
|
|
178
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
179
|
+
}
|
|
180
|
+
function statusToken(status) {
|
|
181
|
+
switch (status) {
|
|
182
|
+
case "pass":
|
|
183
|
+
return "success";
|
|
184
|
+
case "warn":
|
|
185
|
+
return "needs-attention";
|
|
186
|
+
case "fail":
|
|
187
|
+
return "failed";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function readStatus(value) {
|
|
191
|
+
return value === "pass" || value === "warn" || value === "fail" ? value : null;
|
|
192
|
+
}
|
|
193
|
+
function readCheck(raw) {
|
|
194
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
195
|
+
return null;
|
|
196
|
+
const record = raw;
|
|
197
|
+
const status = readStatus(record.status);
|
|
198
|
+
const label = strOrNull(record.label);
|
|
199
|
+
if (!status || !label)
|
|
200
|
+
return null;
|
|
201
|
+
return {
|
|
202
|
+
id: strOrNull(record.id) ?? label,
|
|
203
|
+
label,
|
|
204
|
+
status,
|
|
205
|
+
detail: strOrNull(record.detail),
|
|
206
|
+
remediation: strOrNull(record.remediation)
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function readChecks(details) {
|
|
210
|
+
if (!details)
|
|
211
|
+
return null;
|
|
212
|
+
const raw = details.checks;
|
|
213
|
+
if (!Array.isArray(raw))
|
|
214
|
+
return null;
|
|
215
|
+
const checks = [];
|
|
216
|
+
for (const entry of raw) {
|
|
217
|
+
const check = readCheck(entry);
|
|
218
|
+
if (check)
|
|
219
|
+
checks.push(check);
|
|
220
|
+
}
|
|
221
|
+
return checks.length > 0 ? checks : null;
|
|
222
|
+
}
|
|
223
|
+
var renderSetup = (ctx) => {
|
|
224
|
+
const lines = [];
|
|
225
|
+
const checks = readChecks(ctx.details);
|
|
226
|
+
if (checks) {
|
|
227
|
+
const passed = checks.filter((c) => c.status === "pass").length;
|
|
228
|
+
const warned = checks.filter((c) => c.status === "warn").length;
|
|
229
|
+
const failed = checks.filter((c) => c.status === "fail").length;
|
|
230
|
+
const ok = failed === 0;
|
|
231
|
+
const headline = statusLabel(ok ? "success" : "failed");
|
|
232
|
+
lines.push(line(`${headline.glyph} SETUP STATUS \xB7 ${passed}/${checks.length} ready`, { fg: headline.color, bold: true }));
|
|
233
|
+
lines.push(blank());
|
|
234
|
+
lines.push(metric("ready", String(passed), { fg: RIG_UI.lime, bold: passed > 0 }));
|
|
235
|
+
lines.push(metric("attention", String(warned), { fg: warned > 0 ? RIG_UI.yellow : RIG_UI.ink2 }));
|
|
236
|
+
lines.push(metric("missing", String(failed), { fg: failed > 0 ? RIG_UI.red : RIG_UI.ink2 }));
|
|
237
|
+
lines.push(blank());
|
|
238
|
+
lines.push(heading("CHECKLIST"));
|
|
239
|
+
for (const check of checks) {
|
|
240
|
+
const label = statusLabel(statusToken(check.status));
|
|
241
|
+
const detail = check.detail ? ` ${check.detail}` : "";
|
|
242
|
+
lines.push(line(` ${label.glyph} ${check.label}${detail}`, { fg: label.color, bold: check.status === "fail" }));
|
|
243
|
+
if (check.status !== "pass" && check.remediation) {
|
|
244
|
+
lines.push(line(` \u2192 ${check.remediation}`, { fg: RIG_UI.ink3 }));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
lines.push(blank());
|
|
248
|
+
} else if (ctx.state.ran && ctx.state.lines.length > 0) {
|
|
249
|
+
const headline = statusLabel(ctx.state.ok ? "success" : "failed");
|
|
250
|
+
lines.push(line(`${headline.glyph} SETUP STATUS`, { fg: headline.color, bold: true }));
|
|
251
|
+
lines.push(blank());
|
|
252
|
+
for (const text of ctx.state.lines.slice(0, 80))
|
|
253
|
+
lines.push(line(` ${text}`, { fg: RIG_UI.ink2 }));
|
|
254
|
+
lines.push(blank());
|
|
255
|
+
} else {
|
|
256
|
+
lines.push(line("SETUP STATUS", { fg: RIG_UI.lime, bold: true }));
|
|
257
|
+
lines.push(line(" no setup check captured yet \u2014 run `setup check` below", { fg: RIG_UI.ink4 }));
|
|
258
|
+
lines.push(blank());
|
|
259
|
+
}
|
|
260
|
+
lines.push(...actionDeck(ctx, ctx.snap.subcommands, "ACTIONS"));
|
|
261
|
+
lines.push(blank());
|
|
262
|
+
lines.push(line("enter a row: direct commands run \xB7 parameterized commands open a form", { fg: RIG_UI.ink4 }));
|
|
263
|
+
return lines;
|
|
264
|
+
};
|
|
265
|
+
export {
|
|
266
|
+
renderSetup
|
|
267
|
+
};
|