@h-rig/cli 0.0.6-alpha.26 → 0.0.6-alpha.28
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 +1043 -596
- package/dist/src/commands/_cli-format.js +211 -6
- package/dist/src/commands/_connection-state.js +1 -1
- package/dist/src/commands/_doctor-checks.js +3 -3
- package/dist/src/commands/_help-catalog.js +231 -41
- package/dist/src/commands/_operator-view.js +1 -1
- package/dist/src/commands/_pi-frontend.js +1 -1
- package/dist/src/commands/_pi-worker-bridge-extension.js +1 -1
- package/dist/src/commands/_preflight.js +2 -2
- package/dist/src/commands/_server-client.js +1 -1
- package/dist/src/commands/_snapshot-upload.js +1 -1
- package/dist/src/commands/agent.js +7 -7
- package/dist/src/commands/browser.js +4 -4
- package/dist/src/commands/connect.js +5 -4
- package/dist/src/commands/dist.js +4 -4
- package/dist/src/commands/doctor.js +3 -3
- package/dist/src/commands/github.js +1 -1
- package/dist/src/commands/inbox.js +351 -29
- package/dist/src/commands/init.js +3 -3
- package/dist/src/commands/inspect.js +10 -10
- package/dist/src/commands/inspector.js +2 -2
- package/dist/src/commands/plugin.js +3 -3
- package/dist/src/commands/profile-and-review.js +8 -8
- package/dist/src/commands/queue.js +1 -1
- package/dist/src/commands/remote.js +18 -18
- package/dist/src/commands/repo-git-harness.js +4 -4
- package/dist/src/commands/run.js +157 -37
- package/dist/src/commands/server.js +6 -5
- package/dist/src/commands/setup.js +8 -8
- package/dist/src/commands/task-report-bug.js +5 -5
- package/dist/src/commands/task-run-driver.js +1 -1
- package/dist/src/commands/task.js +451 -45
- package/dist/src/commands/test.js +3 -3
- package/dist/src/commands/workspace.js +4 -4
- package/dist/src/commands.js +1043 -596
- package/dist/src/index.js +1043 -596
- package/dist/src/report-bug.js +3 -3
- package/package.json +6 -6
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli/src/commands/_help-catalog.ts
|
|
3
|
+
import { intro, log, note, outro } from "@clack/prompts";
|
|
3
4
|
import pc from "picocolors";
|
|
5
|
+
var TOP_LEVEL_SECTIONS = [
|
|
6
|
+
{
|
|
7
|
+
title: "Server",
|
|
8
|
+
subtitle: "choose the local or remote Rig server that owns this repo",
|
|
9
|
+
commands: [
|
|
10
|
+
{ command: "rig server status", description: "Show the selected local/remote server for this repo." },
|
|
11
|
+
{ command: "rig server use local", description: "Switch this repo back to the local Rig server." },
|
|
12
|
+
{ command: "rig server add <alias> <url>", description: "Save a remote Rig server alias." },
|
|
13
|
+
{ command: "rig server use <alias>", description: "Switch this repo to a saved remote server." },
|
|
14
|
+
{ command: "rig server list", description: "Show saved server aliases, including local." }
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "Tasks",
|
|
19
|
+
subtitle: "find work, inspect it, and submit Pi-backed workers",
|
|
20
|
+
commands: [
|
|
21
|
+
{ command: "rig task list", description: "List tasks from the selected task source/server." },
|
|
22
|
+
{ command: "rig task next", description: "Show the next matching task as a selected-task card." },
|
|
23
|
+
{ command: "rig task show <id>", description: "Show a human task summary; add --raw or --json for the full payload." },
|
|
24
|
+
{ command: "rig task run <id|--next> [--detach]", description: "Submit a task run; interactive mode follows with bundled Pi." }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: "Runs",
|
|
29
|
+
subtitle: "observe, attach to, and stop live or recent runs",
|
|
30
|
+
commands: [
|
|
31
|
+
{ command: "rig run list", description: "List recent runs from the selected server or local state." },
|
|
32
|
+
{ command: "rig run show <id>", description: "Show a human run summary; add --raw or --json for the full payload." },
|
|
33
|
+
{ command: "rig run attach <id> --follow", description: "Open the native bundled Pi live view for a worker run." },
|
|
34
|
+
{ command: "rig run stop <id>", description: "Request cancellation for a running worker." }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "Review / inbox",
|
|
39
|
+
subtitle: "clear blocked runs and configure completion review",
|
|
40
|
+
commands: [
|
|
41
|
+
{ command: "rig inbox approvals", description: "List pending approval requests from local/server run state." },
|
|
42
|
+
{ command: "rig inbox inputs", description: "List pending user-input requests from local/server run state." },
|
|
43
|
+
{ command: "rig review show|set", description: "Inspect or change the review gate policy." }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: "Health / setup",
|
|
48
|
+
subtitle: "bootstrap and diagnose the repo/server/GitHub/Pi path",
|
|
49
|
+
commands: [
|
|
50
|
+
{ command: "rig init", description: "Interactive setup: config, GitHub auth, task source, server, checkout, Pi." },
|
|
51
|
+
{ command: "rig doctor", description: "Diagnose project/server/GitHub/task/Pi wiring." },
|
|
52
|
+
{ command: "rig github auth status", description: "Show GitHub auth state on the selected Rig server." }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
];
|
|
4
56
|
var PRIMARY_GROUPS = [
|
|
5
57
|
{
|
|
6
58
|
name: "server",
|
|
@@ -8,10 +60,11 @@ var PRIMARY_GROUPS = [
|
|
|
8
60
|
usage: ["rig server <status|list|add|use|start> [options]"],
|
|
9
61
|
commands: [
|
|
10
62
|
{ command: "status", description: "Show the selected server for this repo.", primary: true },
|
|
11
|
-
{ command: "
|
|
63
|
+
{ command: "use local", description: "Switch this repo to the local Rig server.", primary: true },
|
|
12
64
|
{ command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
|
|
13
|
-
{ command: "use
|
|
14
|
-
{ command: "
|
|
65
|
+
{ command: "use <alias>", description: "Select a saved remote server alias.", primary: true },
|
|
66
|
+
{ command: "list", description: "List saved local/remote server aliases.", primary: true },
|
|
67
|
+
{ command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process." }
|
|
15
68
|
],
|
|
16
69
|
examples: [
|
|
17
70
|
"rig server status",
|
|
@@ -29,8 +82,8 @@ var PRIMARY_GROUPS = [
|
|
|
29
82
|
usage: ["rig task <list|next|show|run> [options]"],
|
|
30
83
|
commands: [
|
|
31
84
|
{ command: "list [--assignee <login|@me>] [--state open|closed]", description: "List tasks from the selected server/source.", primary: true },
|
|
32
|
-
{ command: "next [filters]", description: "
|
|
33
|
-
{ command: "show <id>|--task <id>", description: "Show task
|
|
85
|
+
{ command: "next [filters]", description: "Render the next matching task as a selected-task card.", primary: true },
|
|
86
|
+
{ command: "show <id>|--task <id> [--raw]", description: "Show a human task summary; --raw prints the full payload.", primary: true },
|
|
34
87
|
{ command: "run [#<issue>|<task-id>|--next|--task <id>]", description: "Submit a task run; interactive follows with bundled Pi.", primary: true },
|
|
35
88
|
{ command: "validate|verify [--task <id>]", description: "Run configured task checks/review gates." },
|
|
36
89
|
{ command: "artifacts|artifact-dir|artifact-write", description: "Inspect or write task artifacts." },
|
|
@@ -38,6 +91,8 @@ var PRIMARY_GROUPS = [
|
|
|
38
91
|
],
|
|
39
92
|
examples: [
|
|
40
93
|
"rig task list --assignee @me --limit 20",
|
|
94
|
+
"rig task next",
|
|
95
|
+
"rig task show 123 --raw",
|
|
41
96
|
"rig task run --next",
|
|
42
97
|
"rig task run #123 --runtime-adapter pi",
|
|
43
98
|
"rig task run --title 'Investigate deploy drift' --initial-prompt 'Check server health'"
|
|
@@ -50,32 +105,97 @@ var PRIMARY_GROUPS = [
|
|
|
50
105
|
usage: ["rig run <list|status|show|attach|stop> [options]"],
|
|
51
106
|
commands: [
|
|
52
107
|
{ command: "list", description: "List recent runs from the selected server or local state.", primary: true },
|
|
53
|
-
{ command: "status", description: "
|
|
54
|
-
{ command: "show
|
|
55
|
-
{ command: "attach <run-id>|--run <id> [--follow]", description: "Attach to the run;
|
|
108
|
+
{ command: "status", description: "Render active and recent run groups.", primary: true },
|
|
109
|
+
{ command: "show <id>|--run <id> [--raw]", description: "Show a human run summary; --raw prints the full payload.", primary: true },
|
|
110
|
+
{ command: "attach <run-id>|--run <id> [--follow]", description: "Attach to the run; --follow launches native bundled Pi for live Pi runs.", primary: true },
|
|
56
111
|
{ command: "stop [<run-id>|--run <id>]", description: "Request stop for one run or local active runs.", primary: true },
|
|
57
112
|
{ command: "timeline --run <id> [--follow]", description: "Stream raw run timeline events." },
|
|
58
113
|
{ command: "delete|cleanup", description: "Remove completed run records/artifacts." }
|
|
59
114
|
],
|
|
60
115
|
examples: [
|
|
61
116
|
"rig run list",
|
|
62
|
-
"rig run
|
|
63
|
-
"rig run show
|
|
117
|
+
"rig run status",
|
|
118
|
+
"rig run show <run-id>",
|
|
119
|
+
"rig run attach <run-id> --follow",
|
|
64
120
|
"rig run stop <run-id>"
|
|
65
121
|
],
|
|
66
122
|
next: ["Use `rig task run --next` to create a new run.", "Use `--json` when scripts need the full structured record."]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "inbox",
|
|
126
|
+
summary: "Review approval and user-input requests that block worker runs.",
|
|
127
|
+
usage: ["rig inbox <approvals|approve|inputs|respond> [options]"],
|
|
128
|
+
commands: [
|
|
129
|
+
{ command: "approvals [--run <id>] [--task <id>]", description: "List pending approvals.", primary: true },
|
|
130
|
+
{ command: "inputs [--run <id>] [--task <id>]", description: "List pending user-input requests.", primary: true },
|
|
131
|
+
{ command: "approve --run <id> --request <id> --decision approve|reject", description: "Resolve an approval request." },
|
|
132
|
+
{ command: "respond --run <id> --request <id> --answer key=value", description: "Answer a user-input request." }
|
|
133
|
+
],
|
|
134
|
+
examples: [
|
|
135
|
+
"rig inbox approvals",
|
|
136
|
+
"rig inbox inputs --run <run-id>",
|
|
137
|
+
"rig inbox approve --run <run-id> --request <request-id> --decision approve"
|
|
138
|
+
],
|
|
139
|
+
next: ["Rejoin the run after resolving a block: `rig run attach <run-id> --follow`."]
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "review",
|
|
143
|
+
summary: "Inspect or change completion review gate policy.",
|
|
144
|
+
usage: ["rig review <show|set>"],
|
|
145
|
+
commands: [
|
|
146
|
+
{ command: "show", description: "Show current review gate settings.", primary: true },
|
|
147
|
+
{ command: "set <off|advisory|required> [--provider greptile]", description: "Change review strictness/provider.", primary: true }
|
|
148
|
+
],
|
|
149
|
+
examples: ["rig review show", "rig review set required --provider greptile"],
|
|
150
|
+
next: ["Use `rig inbox approvals` for blocked run handoffs."]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "init",
|
|
154
|
+
summary: "Set up Rig for this repo: server, GitHub auth, checkout strategy, task source, and Pi wiring.",
|
|
155
|
+
usage: ["rig init [--yes] [--server local|remote] [--repo owner/repo] [--remote-url <url>]"],
|
|
156
|
+
commands: [
|
|
157
|
+
{ command: "init", description: "Interactive setup wizard for a new or existing Rig repo.", primary: true },
|
|
158
|
+
{ command: "init --yes", description: "Non-interactive setup using detected/default settings.", primary: true },
|
|
159
|
+
{ command: "init --server remote --remote-url <url>", description: "Link this repo to a remote Rig server.", primary: true },
|
|
160
|
+
{ command: "init --repair", description: "Repair missing private state without replacing project config." }
|
|
161
|
+
],
|
|
162
|
+
examples: [
|
|
163
|
+
"rig init",
|
|
164
|
+
"rig init --yes --repo humanity-org/humanwork",
|
|
165
|
+
"rig init --server remote --remote-url https://where.rig-does.work --repo owner/repo"
|
|
166
|
+
],
|
|
167
|
+
next: ["After init, run `rig server status`.", "Then use `rig task list` and `rig task run --next` for day-to-day work."]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "doctor",
|
|
171
|
+
summary: "Diagnostics for project/server/GitHub/Pi state.",
|
|
172
|
+
usage: ["rig doctor"],
|
|
173
|
+
commands: [
|
|
174
|
+
{ command: "doctor", description: "Run setup and runtime diagnostics.", primary: true },
|
|
175
|
+
{ command: "check", description: "Compatibility spelling for diagnostics." }
|
|
176
|
+
],
|
|
177
|
+
examples: ["rig doctor", "rig doctor --json"],
|
|
178
|
+
next: ["Use `rig server status` and `rig github auth status` to inspect common failure points."]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "github",
|
|
182
|
+
summary: "GitHub auth helpers for the selected Rig server.",
|
|
183
|
+
usage: ["rig github auth <status|import-gh|token>"],
|
|
184
|
+
commands: [
|
|
185
|
+
{ command: "auth status", description: "Show GitHub auth state.", primary: true },
|
|
186
|
+
{ command: "auth import-gh", description: "Import the current `gh` token into the selected server." },
|
|
187
|
+
{ command: "auth token --token <token>", description: "Store a token on the selected server." }
|
|
188
|
+
],
|
|
189
|
+
examples: ["rig github auth status", "rig github auth import-gh"],
|
|
190
|
+
next: ["After auth is valid, use `rig task run --next`."]
|
|
67
191
|
}
|
|
68
192
|
];
|
|
69
193
|
var ADVANCED_GROUPS = [
|
|
70
|
-
{ name: "init", summary: "Initialize or repair Rig project state.", usage: ["rig init [options]"], commands: [{ command: "init", description: "Configure project/server/GitHub integration." }] },
|
|
71
194
|
{ name: "connect", summary: "Compatibility alias for `rig server` selection commands.", usage: ["rig connect <status|list|add|use>"], commands: [{ command: "status|list|add|use", description: "Use `rig server ...` for the primary UX." }] },
|
|
72
|
-
{ name: "github", summary: "GitHub auth helpers.", usage: ["rig github auth <status|import-gh|token>"], commands: [{ command: "auth status", description: "Show GitHub auth state." }] },
|
|
73
|
-
{ name: "doctor", summary: "Diagnostics for project/server/GitHub/Pi state.", usage: ["rig doctor [check|run|shared|...]"], commands: [{ command: "check", description: "Run diagnostics." }] },
|
|
74
195
|
{ name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
|
|
75
196
|
{ name: "inspect", summary: "Inspect logs, artifacts, graphs, failures.", usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff>"], commands: [{ command: "logs --task <id>", description: "Inspect task logs." }] },
|
|
76
197
|
{ name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
|
|
77
198
|
{ name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
|
|
78
|
-
{ name: "review", summary: "Review policy configuration.", usage: ["rig review <show|set>"], commands: [{ command: "show", description: "Show review settings." }] },
|
|
79
199
|
{ name: "browser", summary: "Browser/app diagnostics.", usage: ["rig browser <help|explain|demo|app>"], commands: [{ command: "help", description: "Browser command help." }] },
|
|
80
200
|
{ name: "plugin", summary: "Plugin validation/listing.", usage: ["rig plugin <list|validate>"], commands: [{ command: "list", description: "List plugins." }] },
|
|
81
201
|
{ name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
|
|
@@ -83,19 +203,29 @@ var ADVANCED_GROUPS = [
|
|
|
83
203
|
{ name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
|
|
84
204
|
{ name: "dist", summary: "Build/install packaged Rig CLI.", usage: ["rig dist <build|install|doctor>"], commands: [{ command: "build", description: "Build distribution." }] },
|
|
85
205
|
{ name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
|
|
86
|
-
{ name: "remote", summary: "
|
|
87
|
-
{ name: "inbox", summary: "Approval/input inbox for blocked runs.", usage: ["rig inbox <approvals|approve|inputs|respond>"], commands: [{ command: "approvals", description: "List pending approvals." }] },
|
|
206
|
+
{ name: "remote", summary: "Compatibility remote orchestration controls.", usage: ["rig remote <status|watch|pause|resume|...>"], commands: [{ command: "status", description: "Show remote state." }] },
|
|
88
207
|
{ name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
|
|
89
208
|
{ name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
|
|
90
209
|
{ name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
|
|
91
210
|
];
|
|
211
|
+
var ADVANCED_COMMANDS = [
|
|
212
|
+
{ command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
|
|
213
|
+
{ command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
|
|
214
|
+
{ command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
|
|
215
|
+
{ command: "rig setup install-agent-shell", description: "Development helper for materializing the agent shell." },
|
|
216
|
+
{ command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
|
|
217
|
+
];
|
|
92
218
|
var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
|
|
93
219
|
function heading(title) {
|
|
94
220
|
return pc.bold(pc.cyan(title));
|
|
95
221
|
}
|
|
96
222
|
function commandLine(command, description) {
|
|
97
|
-
const commandColumn = command.length >=
|
|
98
|
-
return
|
|
223
|
+
const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
|
|
224
|
+
return `${pc.dim("\u2502")} ${pc.bold(commandColumn)} ${description}`;
|
|
225
|
+
}
|
|
226
|
+
function renderCommandBlock(commands) {
|
|
227
|
+
return commands.map((entry) => commandLine(entry.command, entry.description)).join(`
|
|
228
|
+
`);
|
|
99
229
|
}
|
|
100
230
|
function renderGroup(group) {
|
|
101
231
|
const lines = [
|
|
@@ -121,41 +251,37 @@ function renderGroup(group) {
|
|
|
121
251
|
}
|
|
122
252
|
function renderTopLevelHelp() {
|
|
123
253
|
return [
|
|
124
|
-
`${heading("rig")} \u2014 server-owned task/run control plane`,
|
|
254
|
+
`${heading("rig")} ${pc.dim("\u2014 server-owned task/run control plane for Pi-backed engineering work")}`,
|
|
255
|
+
pc.dim("Current path: select a server, choose a task, submit a run, attach with native Pi, clear inbox/review gates."),
|
|
125
256
|
"",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
"",
|
|
133
|
-
pc.bold("Primary groups"),
|
|
134
|
-
...PRIMARY_GROUPS.map((group) => commandLine(group.name, group.summary)),
|
|
135
|
-
"",
|
|
136
|
-
pc.bold("Help"),
|
|
137
|
-
" rig <group> --help Rich help for server, task, run, and other groups",
|
|
138
|
-
" rig help --advanced Legacy/dev/compat command surface",
|
|
139
|
-
" rig --version Print version",
|
|
257
|
+
...TOP_LEVEL_SECTIONS.flatMap((section) => [
|
|
258
|
+
`${pc.bold(pc.magenta(`\u25C7 ${section.title}`))} \u2014 ${pc.dim(section.subtitle)}`,
|
|
259
|
+
renderCommandBlock(section.commands),
|
|
260
|
+
""
|
|
261
|
+
]),
|
|
262
|
+
pc.dim("More: `rig help --advanced` for dev/compatibility commands; `rig <group> --help` for rich per-group help; `rig --version` for the installed version."),
|
|
140
263
|
"",
|
|
141
264
|
pc.bold("Global options"),
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
265
|
+
commandLine("--project <path>", "Use a project root instead of auto-discovery."),
|
|
266
|
+
commandLine("--json", "Emit structured output for scripts/agents."),
|
|
267
|
+
commandLine("--dry-run", "Print the command plan without mutating state.")
|
|
145
268
|
].join(`
|
|
146
|
-
`);
|
|
269
|
+
`).trimEnd();
|
|
147
270
|
}
|
|
148
271
|
function renderAdvancedHelp() {
|
|
149
272
|
return [
|
|
150
|
-
`${heading("rig advanced")} \u2014
|
|
273
|
+
`${heading("rig advanced")} \u2014 compatibility, diagnostics, and internal surfaces`,
|
|
274
|
+
"",
|
|
275
|
+
pc.bold("Primary groups"),
|
|
276
|
+
" server, task, run, inbox, review, init, doctor, github",
|
|
151
277
|
"",
|
|
152
|
-
pc.bold("
|
|
153
|
-
|
|
278
|
+
pc.bold("Advanced commands"),
|
|
279
|
+
...ADVANCED_COMMANDS.map((entry) => commandLine(entry.command, entry.description)),
|
|
154
280
|
"",
|
|
155
281
|
pc.bold("Advanced groups"),
|
|
156
282
|
...ADVANCED_GROUPS.map((group) => commandLine(group.name, group.summary)),
|
|
157
283
|
"",
|
|
158
|
-
pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, and `rig
|
|
284
|
+
pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, `rig run`, `rig inbox`, and `rig review` for day-to-day work.")
|
|
159
285
|
].join(`
|
|
160
286
|
`);
|
|
161
287
|
}
|
|
@@ -166,9 +292,73 @@ function renderGroupHelp(groupName) {
|
|
|
166
292
|
function listHelpGroups() {
|
|
167
293
|
return ALL_GROUPS.map((group) => group.name);
|
|
168
294
|
}
|
|
295
|
+
function shouldUseClackOutput() {
|
|
296
|
+
return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
|
|
297
|
+
}
|
|
298
|
+
function printTopLevelHelp() {
|
|
299
|
+
if (!shouldUseClackOutput()) {
|
|
300
|
+
console.log(renderTopLevelHelp());
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
intro("rig");
|
|
304
|
+
for (const section of TOP_LEVEL_SECTIONS) {
|
|
305
|
+
note(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
|
|
306
|
+
}
|
|
307
|
+
log.info("More: rig help --advanced \xB7 rig <group> --help \xB7 rig --version");
|
|
308
|
+
note([
|
|
309
|
+
commandLine("--project <path>", "Use a project root instead of auto-discovery."),
|
|
310
|
+
commandLine("--json", "Emit structured output for scripts/agents."),
|
|
311
|
+
commandLine("--dry-run", "Print the command plan without mutating state.")
|
|
312
|
+
].join(`
|
|
313
|
+
`), "Global options");
|
|
314
|
+
outro("Server \u2192 task \u2192 run \u2192 inbox/review.");
|
|
315
|
+
}
|
|
316
|
+
function printAdvancedHelp() {
|
|
317
|
+
if (!shouldUseClackOutput()) {
|
|
318
|
+
console.log(renderAdvancedHelp());
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
intro("rig advanced");
|
|
322
|
+
note(ADVANCED_COMMANDS.map((entry) => commandLine(entry.command, entry.description)).join(`
|
|
323
|
+
`), "Advanced commands");
|
|
324
|
+
note(ADVANCED_GROUPS.map((group) => commandLine(group.name, group.summary)).join(`
|
|
325
|
+
`), "Advanced groups");
|
|
326
|
+
outro("Primary daily flow: rig server \xB7 rig task \xB7 rig run \xB7 rig inbox \xB7 rig review.");
|
|
327
|
+
}
|
|
328
|
+
function printGroupHelpDocument(groupName) {
|
|
329
|
+
const rendered = renderGroupHelp(groupName) ?? renderTopLevelHelp();
|
|
330
|
+
if (!shouldUseClackOutput()) {
|
|
331
|
+
console.log(rendered);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const group = ALL_GROUPS.find((candidate) => candidate.name === groupName);
|
|
335
|
+
if (!group) {
|
|
336
|
+
printTopLevelHelp();
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
intro(`rig ${group.name}`);
|
|
340
|
+
note(group.summary, "Purpose");
|
|
341
|
+
note(group.usage.join(`
|
|
342
|
+
`), "Usage");
|
|
343
|
+
note(group.commands.map((entry) => commandLine(entry.command, entry.description)).join(`
|
|
344
|
+
`), "Commands");
|
|
345
|
+
if (group.examples?.length)
|
|
346
|
+
note(group.examples.map((line) => `$ ${line}`).join(`
|
|
347
|
+
`), "Examples");
|
|
348
|
+
if (group.next?.length)
|
|
349
|
+
note(group.next.map((line) => `\u203A ${line}`).join(`
|
|
350
|
+
`), "Next steps");
|
|
351
|
+
if (group.advanced?.length)
|
|
352
|
+
log.info(group.advanced.join(`
|
|
353
|
+
`));
|
|
354
|
+
outro("Run with --json when scripts need structured output.");
|
|
355
|
+
}
|
|
169
356
|
export {
|
|
170
357
|
renderTopLevelHelp,
|
|
171
358
|
renderGroupHelp,
|
|
172
359
|
renderAdvancedHelp,
|
|
360
|
+
printTopLevelHelp,
|
|
361
|
+
printGroupHelpDocument,
|
|
362
|
+
printAdvancedHelp,
|
|
173
363
|
listHelpGroups
|
|
174
364
|
};
|
|
@@ -92,7 +92,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
92
92
|
const global = readGlobalConnections(options);
|
|
93
93
|
const connection = global.connections[repo.selected];
|
|
94
94
|
if (!connection) {
|
|
95
|
-
throw new CliError2(`Selected Rig
|
|
95
|
+
throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
|
|
96
96
|
}
|
|
97
97
|
return { alias: repo.selected, connection };
|
|
98
98
|
}
|
|
@@ -98,7 +98,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
98
98
|
const global = readGlobalConnections(options);
|
|
99
99
|
const connection = global.connections[repo.selected];
|
|
100
100
|
if (!connection) {
|
|
101
|
-
throw new CliError2(`Selected Rig
|
|
101
|
+
throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
|
|
102
102
|
}
|
|
103
103
|
return { alias: repo.selected, connection };
|
|
104
104
|
}
|
|
@@ -92,7 +92,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
92
92
|
const global = readGlobalConnections(options);
|
|
93
93
|
const connection = global.connections[repo.selected];
|
|
94
94
|
if (!connection) {
|
|
95
|
-
throw new CliError2(`Selected Rig
|
|
95
|
+
throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
|
|
96
96
|
}
|
|
97
97
|
return { alias: repo.selected, connection };
|
|
98
98
|
}
|
|
@@ -88,7 +88,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
88
88
|
const global = readGlobalConnections(options);
|
|
89
89
|
const connection = global.connections[repo.selected];
|
|
90
90
|
if (!connection) {
|
|
91
|
-
throw new CliError2(`Selected Rig
|
|
91
|
+
throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
|
|
92
92
|
}
|
|
93
93
|
return { alias: repo.selected, connection };
|
|
94
94
|
}
|
|
@@ -300,7 +300,7 @@ async function runFastTaskRunPreflight(context, options = {}) {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
const repo = readRepoConnection(context.projectRoot);
|
|
303
|
-
checks.push(repo ? preflightCheck("project-link", "project linked to Rig
|
|
303
|
+
checks.push(repo ? preflightCheck("project-link", "project linked to Rig server", repo.project ? "pass" : "warn", `${repo.selected}${repo.project ? ` -> ${repo.project}` : ""}`, "Run `rig init --yes --repo owner/repo` to record the GitHub repo slug.") : preflightCheck("project-link", "project linked to Rig server", legacyServerCompatibility ? "warn" : "fail", "missing .rig/state/connection.json", "Run `rig init` or `rig server use <alias|local>`."));
|
|
304
304
|
try {
|
|
305
305
|
const auth = await request("/api/github/auth/status");
|
|
306
306
|
checks.push(isAuthenticated(auth) ? preflightCheck("github-auth", "GitHub auth valid", "pass") : preflightCheck("github-auth", "GitHub auth valid", legacyServerCompatibility ? "warn" : "fail", "not authenticated", "Run `rig github auth import-gh` or `rig github auth token --token <token>`."));
|
|
@@ -92,7 +92,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
92
92
|
const global = readGlobalConnections(options);
|
|
93
93
|
const connection = global.connections[repo.selected];
|
|
94
94
|
if (!connection) {
|
|
95
|
-
throw new CliError2(`Selected Rig
|
|
95
|
+
throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
|
|
96
96
|
}
|
|
97
97
|
return { alias: repo.selected, connection };
|
|
98
98
|
}
|
|
@@ -96,7 +96,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
96
96
|
const global = readGlobalConnections(options);
|
|
97
97
|
const connection = global.connections[repo.selected];
|
|
98
98
|
if (!connection) {
|
|
99
|
-
throw new CliError2(`Selected Rig
|
|
99
|
+
throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
|
|
100
100
|
}
|
|
101
101
|
return { alias: repo.selected, connection };
|
|
102
102
|
}
|
|
@@ -290,7 +290,7 @@ async function executeAgent(context, args) {
|
|
|
290
290
|
const [command = "list", ...rest] = args;
|
|
291
291
|
switch (command) {
|
|
292
292
|
case "list": {
|
|
293
|
-
requireNoExtraArgs(rest, "
|
|
293
|
+
requireNoExtraArgs(rest, "rig agent list");
|
|
294
294
|
const runtimes = await listAgentRuntimes(context.projectRoot);
|
|
295
295
|
if (context.outputMode === "text") {
|
|
296
296
|
if (runtimes.length === 0) {
|
|
@@ -311,12 +311,12 @@ async function executeAgent(context, args) {
|
|
|
311
311
|
pending = modeResult.rest;
|
|
312
312
|
const taskResult = takeOption(pending, "--task");
|
|
313
313
|
pending = taskResult.rest;
|
|
314
|
-
requireNoExtraArgs(pending, "
|
|
314
|
+
requireNoExtraArgs(pending, "rig agent prepare --task <id> [--id <id>] [--mode worktree]");
|
|
315
315
|
const mode = parseIsolationMode(modeResult.value, false);
|
|
316
316
|
const id = idResult.value || agentId("agent");
|
|
317
317
|
const taskId = taskResult.value?.trim();
|
|
318
318
|
if (!taskId) {
|
|
319
|
-
throw new CliError2("Usage:
|
|
319
|
+
throw new CliError2("Usage: rig agent prepare --task <id> [--id <id>] [--mode worktree]");
|
|
320
320
|
}
|
|
321
321
|
const runtime = await withMutedConsole(context.outputMode === "json", () => ensureAgentRuntime({
|
|
322
322
|
projectRoot: context.projectRoot,
|
|
@@ -334,7 +334,7 @@ async function executeAgent(context, args) {
|
|
|
334
334
|
case "run": {
|
|
335
335
|
const { options, commandParts } = splitAtDoubleDash(rest);
|
|
336
336
|
if (commandParts.length === 0) {
|
|
337
|
-
throw new CliError2("Usage:
|
|
337
|
+
throw new CliError2("Usage: rig agent run [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
|
|
338
338
|
}
|
|
339
339
|
let pending = options;
|
|
340
340
|
const idResult = takeOption(pending, "--id");
|
|
@@ -345,12 +345,12 @@ async function executeAgent(context, args) {
|
|
|
345
345
|
pending = taskResult.rest;
|
|
346
346
|
const skipProjectSyncResult = takeFlag(pending, "--skip-project-sync");
|
|
347
347
|
pending = skipProjectSyncResult.rest;
|
|
348
|
-
requireNoExtraArgs(pending, "
|
|
348
|
+
requireNoExtraArgs(pending, "rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
|
|
349
349
|
const mode = parseIsolationMode(modeResult.value, false);
|
|
350
350
|
const id = idResult.value || agentId("agent-run");
|
|
351
351
|
const taskId = taskResult.value?.trim();
|
|
352
352
|
if (!taskId) {
|
|
353
|
-
throw new CliError2("Usage:
|
|
353
|
+
throw new CliError2("Usage: rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
|
|
354
354
|
}
|
|
355
355
|
await runProjectMainSyncPreflight(context, { disabled: skipProjectSyncResult.value });
|
|
356
356
|
const createdAt = new Date().toISOString();
|
|
@@ -464,7 +464,7 @@ ${result.stderr.trim()}` : ""}`, result.exitCode);
|
|
|
464
464
|
pending = allResult.rest;
|
|
465
465
|
const idResult = takeOption(pending, "--id");
|
|
466
466
|
pending = idResult.rest;
|
|
467
|
-
requireNoExtraArgs(pending, "
|
|
467
|
+
requireNoExtraArgs(pending, "rig agent cleanup (--id <id> | --all)");
|
|
468
468
|
if (!allResult.value && !idResult.value) {
|
|
469
469
|
throw new CliError2("Provide --id <id> or --all.");
|
|
470
470
|
}
|
|
@@ -351,7 +351,7 @@ async function executeBrowser(context, args) {
|
|
|
351
351
|
return { ok: true, group: "browser", command: "help" };
|
|
352
352
|
}
|
|
353
353
|
if (command === "explain") {
|
|
354
|
-
requireNoExtraArgs(rest, "
|
|
354
|
+
requireNoExtraArgs(rest, "rig browser explain");
|
|
355
355
|
console.log(browserAgentUsageText());
|
|
356
356
|
return { ok: true, group: "browser", command: "explain" };
|
|
357
357
|
}
|
|
@@ -377,7 +377,7 @@ ${browserHelpText()}`);
|
|
|
377
377
|
|
|
378
378
|
${browserHelpText()}`);
|
|
379
379
|
}
|
|
380
|
-
requireNoExtraArgs(appRest, `
|
|
380
|
+
requireNoExtraArgs(appRest, `rig browser ${command} ${subcommand}`);
|
|
381
381
|
await context.runCommand(["bun", "run", `app:${subcommand}:browser:${appSlug}`]);
|
|
382
382
|
return { ok: true, group: "browser", command: `${command}-${subcommand}` };
|
|
383
383
|
}
|
|
@@ -389,7 +389,7 @@ ${browserHelpText()}`);
|
|
|
389
389
|
};
|
|
390
390
|
const packageScript = packageScripts[command];
|
|
391
391
|
if (packageScript) {
|
|
392
|
-
requireNoExtraArgs(rest, `
|
|
392
|
+
requireNoExtraArgs(rest, `rig browser ${command}`);
|
|
393
393
|
await context.runCommand(["bun", "run", "--filter=@rig/browser", packageScript]);
|
|
394
394
|
return { ok: true, group: "browser", command };
|
|
395
395
|
}
|
|
@@ -416,7 +416,7 @@ async function executeBrowserDemo(context, args) {
|
|
|
416
416
|
pending = keepOpenFlag.rest;
|
|
417
417
|
const noBuildFlag = takeFlag(pending, "--no-build");
|
|
418
418
|
pending = noBuildFlag.rest;
|
|
419
|
-
requireNoExtraArgs(pending, "
|
|
419
|
+
requireNoExtraArgs(pending, "rig browser demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]");
|
|
420
420
|
if (context.outputMode !== "text" || !process.stdin.isTTY || !process.stdout.isTTY) {
|
|
421
421
|
throw new CliError2("rig browser demo requires an interactive TTY in text mode.");
|
|
422
422
|
}
|
|
@@ -107,6 +107,7 @@ function writeRepoConnection(projectRoot, state) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// packages/cli/src/commands/_cli-format.ts
|
|
110
|
+
import { log, note } from "@clack/prompts";
|
|
110
111
|
import pc from "picocolors";
|
|
111
112
|
function truncate(value, width) {
|
|
112
113
|
if (value.length <= width)
|
|
@@ -120,13 +121,13 @@ function pad(value, width) {
|
|
|
120
121
|
}
|
|
121
122
|
function statusColor(status) {
|
|
122
123
|
const normalized = status.toLowerCase();
|
|
123
|
-
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected"].includes(normalized))
|
|
124
|
+
if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
|
|
124
125
|
return pc.green;
|
|
125
|
-
if (["failed", "needs_attention", "needs-attention", "blocked", "error"].includes(normalized))
|
|
126
|
+
if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
|
|
126
127
|
return pc.red;
|
|
127
128
|
if (["running", "reviewing", "validating", "in_progress", "in-progress", "remote"].includes(normalized))
|
|
128
129
|
return pc.cyan;
|
|
129
|
-
if (["ready", "open", "queued", "created", "preparing", "local"].includes(normalized))
|
|
130
|
+
if (["ready", "open", "queued", "created", "preparing", "local", "pending"].includes(normalized))
|
|
130
131
|
return pc.yellow;
|
|
131
132
|
return pc.dim;
|
|
132
133
|
}
|
|
@@ -138,7 +139,7 @@ function formatSection(title, subtitle) {
|
|
|
138
139
|
return `${pc.bold(pc.cyan("\u25C6"))} ${pc.bold(title)}${subtitle ? pc.dim(` \u2014 ${subtitle}`) : ""}`;
|
|
139
140
|
}
|
|
140
141
|
function formatSuccessCard(title, rows = []) {
|
|
141
|
-
const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${pc.dim("\u2502")} ${pc.dim(key.padEnd(
|
|
142
|
+
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}`);
|
|
142
143
|
return [formatSection(title), ...body].join(`
|
|
143
144
|
`);
|
|
144
145
|
}
|
|
@@ -185,7 +185,7 @@ async function executeDist(context, args) {
|
|
|
185
185
|
switch (command) {
|
|
186
186
|
case "build": {
|
|
187
187
|
const { value: outputDir, rest: pending } = takeOption(rest, "--output-dir");
|
|
188
|
-
requireNoExtraArgs(pending, "
|
|
188
|
+
requireNoExtraArgs(pending, "rig dist build [--output-dir <dir>]");
|
|
189
189
|
const commandParts = ["bun", "run", "packages/cli/bin/build-rig-binaries.ts"];
|
|
190
190
|
if (outputDir) {
|
|
191
191
|
commandParts.push("--output-dir", outputDir);
|
|
@@ -199,7 +199,7 @@ async function executeDist(context, args) {
|
|
|
199
199
|
pending = scopeResult.rest;
|
|
200
200
|
const pathResult = takeOption(pending, "--path");
|
|
201
201
|
pending = pathResult.rest;
|
|
202
|
-
requireNoExtraArgs(pending, "
|
|
202
|
+
requireNoExtraArgs(pending, "rig dist install [--scope user|system] [--path <dir>]");
|
|
203
203
|
const scope = parseInstallScope(scopeResult.value);
|
|
204
204
|
const installDir = resolveInstallDir(scope, pathResult.value);
|
|
205
205
|
mkdirSync(installDir, { recursive: true });
|
|
@@ -242,7 +242,7 @@ async function executeDist(context, args) {
|
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
case "doctor": {
|
|
245
|
-
requireNoExtraArgs(rest, "
|
|
245
|
+
requireNoExtraArgs(rest, "rig dist doctor");
|
|
246
246
|
const details = await runDistDoctor(context.projectRoot);
|
|
247
247
|
if (context.outputMode === "text") {
|
|
248
248
|
console.log(`bun: ${details.bun.available ? `ok (${details.bun.version})` : "missing"}`);
|
|
@@ -253,7 +253,7 @@ async function executeDist(context, args) {
|
|
|
253
253
|
return { ok: true, group: "dist", command, details };
|
|
254
254
|
}
|
|
255
255
|
case "rebuild-agent": {
|
|
256
|
-
requireNoExtraArgs(rest, "
|
|
256
|
+
requireNoExtraArgs(rest, "rig dist rebuild-agent");
|
|
257
257
|
const fp = await computeRuntimeImageFingerprint(context.projectRoot);
|
|
258
258
|
const currentId = computeRuntimeImageId(fp);
|
|
259
259
|
const imagesDir = resolve3(resolveControlPlaneMonorepoRuntimeDir(context.projectRoot), "images");
|