@h-rig/cli 0.0.6-alpha.27 → 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.
Files changed (38) hide show
  1. package/dist/bin/rig.js +1038 -620
  2. package/dist/src/commands/_cli-format.js +211 -6
  3. package/dist/src/commands/_connection-state.js +1 -1
  4. package/dist/src/commands/_doctor-checks.js +3 -3
  5. package/dist/src/commands/_help-catalog.js +225 -64
  6. package/dist/src/commands/_operator-view.js +1 -1
  7. package/dist/src/commands/_pi-frontend.js +1 -1
  8. package/dist/src/commands/_pi-worker-bridge-extension.js +1 -1
  9. package/dist/src/commands/_preflight.js +2 -2
  10. package/dist/src/commands/_server-client.js +1 -1
  11. package/dist/src/commands/_snapshot-upload.js +1 -1
  12. package/dist/src/commands/agent.js +7 -7
  13. package/dist/src/commands/browser.js +4 -4
  14. package/dist/src/commands/connect.js +5 -4
  15. package/dist/src/commands/dist.js +4 -4
  16. package/dist/src/commands/doctor.js +3 -3
  17. package/dist/src/commands/github.js +1 -1
  18. package/dist/src/commands/inbox.js +351 -29
  19. package/dist/src/commands/init.js +3 -3
  20. package/dist/src/commands/inspect.js +10 -10
  21. package/dist/src/commands/inspector.js +2 -2
  22. package/dist/src/commands/plugin.js +3 -3
  23. package/dist/src/commands/profile-and-review.js +8 -8
  24. package/dist/src/commands/queue.js +1 -1
  25. package/dist/src/commands/remote.js +18 -18
  26. package/dist/src/commands/repo-git-harness.js +4 -4
  27. package/dist/src/commands/run.js +157 -37
  28. package/dist/src/commands/server.js +6 -5
  29. package/dist/src/commands/setup.js +8 -8
  30. package/dist/src/commands/task-report-bug.js +5 -5
  31. package/dist/src/commands/task-run-driver.js +1 -1
  32. package/dist/src/commands/task.js +451 -45
  33. package/dist/src/commands/test.js +3 -3
  34. package/dist/src/commands/workspace.js +4 -4
  35. package/dist/src/commands.js +1038 -620
  36. package/dist/src/index.js +1038 -620
  37. package/dist/src/report-bug.js +3 -3
  38. package/package.json +6 -6
@@ -1,34 +1,70 @@
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";
4
- var PRIMARY_GROUPS = [
5
+ var TOP_LEVEL_SECTIONS = [
5
6
  {
6
- name: "init",
7
- summary: "Set up Rig for this repo: server, GitHub auth, checkout strategy, task source, and Pi wiring.",
8
- usage: ["rig init [--yes] [--server local|remote] [--repo owner/repo] [--remote-url <url>]"],
7
+ title: "Server",
8
+ subtitle: "choose the local or remote Rig server that owns this repo",
9
9
  commands: [
10
- { command: "init", description: "Interactive setup wizard for a new or existing Rig repo.", primary: true },
11
- { command: "init --yes", description: "Non-interactive setup using detected/default settings.", primary: true },
12
- { command: "init --server remote --remote-url <url>", description: "Link this repo to a remote Rig server.", primary: true },
13
- { command: "init --repair", description: "Repair missing private state without replacing project config." }
14
- ],
15
- examples: [
16
- "rig init",
17
- "rig init --yes --repo humanity-org/humanwork",
18
- "rig init --server remote --remote-url https://where.rig-does.work --repo owner/repo"
19
- ],
20
- next: ["After init, run `rig server status`.", "Then use `rig task list` and `rig task run --next` for day-to-day work."]
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
+ ]
21
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
+ ];
56
+ var PRIMARY_GROUPS = [
22
57
  {
23
58
  name: "server",
24
59
  summary: "Choose, inspect, and start the Rig server that owns tasks and runs.",
25
60
  usage: ["rig server <status|list|add|use|start> [options]"],
26
61
  commands: [
27
62
  { command: "status", description: "Show the selected server for this repo.", primary: true },
28
- { command: "list", description: "List saved local/remote server aliases.", primary: true },
63
+ { command: "use local", description: "Switch this repo to the local Rig server.", primary: true },
29
64
  { command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
30
- { command: "use [alias|local]", description: "Select a server; prompts in an interactive TTY.", primary: true },
31
- { command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process.", primary: true }
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." }
32
68
  ],
33
69
  examples: [
34
70
  "rig server status",
@@ -46,8 +82,8 @@ var PRIMARY_GROUPS = [
46
82
  usage: ["rig task <list|next|show|run> [options]"],
47
83
  commands: [
48
84
  { command: "list [--assignee <login|@me>] [--state open|closed]", description: "List tasks from the selected server/source.", primary: true },
49
- { command: "next [filters]", description: "Pick the next matching task.", primary: true },
50
- { command: "show <id>|--task <id>", description: "Show task details.", primary: true },
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 },
51
87
  { command: "run [#<issue>|<task-id>|--next|--task <id>]", description: "Submit a task run; interactive follows with bundled Pi.", primary: true },
52
88
  { command: "validate|verify [--task <id>]", description: "Run configured task checks/review gates." },
53
89
  { command: "artifacts|artifact-dir|artifact-write", description: "Inspect or write task artifacts." },
@@ -55,6 +91,8 @@ var PRIMARY_GROUPS = [
55
91
  ],
56
92
  examples: [
57
93
  "rig task list --assignee @me --limit 20",
94
+ "rig task next",
95
+ "rig task show 123 --raw",
58
96
  "rig task run --next",
59
97
  "rig task run #123 --runtime-adapter pi",
60
98
  "rig task run --title 'Investigate deploy drift' --initial-prompt 'Check server health'"
@@ -67,31 +105,97 @@ var PRIMARY_GROUPS = [
67
105
  usage: ["rig run <list|status|show|attach|stop> [options]"],
68
106
  commands: [
69
107
  { command: "list", description: "List recent runs from the selected server or local state.", primary: true },
70
- { command: "status", description: "Summarize active and recent runs.", primary: true },
71
- { command: "show --run <id>", description: "Show one run record.", primary: true },
72
- { command: "attach <run-id>|--run <id> [--follow]", description: "Attach to the run; `--follow` launches native bundled Pi for live Pi runs.", primary: true },
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 },
73
111
  { command: "stop [<run-id>|--run <id>]", description: "Request stop for one run or local active runs.", primary: true },
74
112
  { command: "timeline --run <id> [--follow]", description: "Stream raw run timeline events." },
75
113
  { command: "delete|cleanup", description: "Remove completed run records/artifacts." }
76
114
  ],
77
115
  examples: [
78
116
  "rig run list",
79
- "rig run attach 01234567-89ab-cdef-0123-456789abcdef --follow",
80
- "rig run show --run <run-id>",
117
+ "rig run status",
118
+ "rig run show <run-id>",
119
+ "rig run attach <run-id> --follow",
81
120
  "rig run stop <run-id>"
82
121
  ],
83
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`."]
84
191
  }
85
192
  ];
86
193
  var ADVANCED_GROUPS = [
87
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." }] },
88
- { name: "github", summary: "GitHub auth helpers.", usage: ["rig github auth <status|import-gh|token>"], commands: [{ command: "auth status", description: "Show GitHub auth state." }] },
89
- { name: "doctor", summary: "Diagnostics for project/server/GitHub/Pi state.", usage: ["rig doctor [check|run|shared|...]"], commands: [{ command: "check", description: "Run diagnostics." }] },
90
195
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
91
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." }] },
92
197
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
93
198
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
94
- { name: "review", summary: "Review policy configuration.", usage: ["rig review <show|set>"], commands: [{ command: "show", description: "Show review settings." }] },
95
199
  { name: "browser", summary: "Browser/app diagnostics.", usage: ["rig browser <help|explain|demo|app>"], commands: [{ command: "help", description: "Browser command help." }] },
96
200
  { name: "plugin", summary: "Plugin validation/listing.", usage: ["rig plugin <list|validate>"], commands: [{ command: "list", description: "List plugins." }] },
97
201
  { name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
@@ -99,20 +203,30 @@ var ADVANCED_GROUPS = [
99
203
  { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
100
204
  { name: "dist", summary: "Build/install packaged Rig CLI.", usage: ["rig dist <build|install|doctor>"], commands: [{ command: "build", description: "Build distribution." }] },
101
205
  { name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
102
- { name: "remote", summary: "Legacy remote orchestration controls.", usage: ["rig remote <status|watch|pause|resume|...>"], commands: [{ command: "status", description: "Show remote state." }] },
103
- { 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." }] },
104
207
  { name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
105
208
  { name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
106
209
  { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
107
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
+ ];
108
218
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
109
219
  function heading(title) {
110
220
  return pc.bold(pc.cyan(title));
111
221
  }
112
222
  function commandLine(command, description) {
113
- const commandColumn = command.length >= 34 ? `${command} ` : command.padEnd(34);
223
+ const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
114
224
  return `${pc.dim("\u2502")} ${pc.bold(commandColumn)} ${description}`;
115
225
  }
226
+ function renderCommandBlock(commands) {
227
+ return commands.map((entry) => commandLine(entry.command, entry.description)).join(`
228
+ `);
229
+ }
116
230
  function renderGroup(group) {
117
231
  const lines = [
118
232
  `${heading(`rig ${group.name}`)} \u2014 ${group.summary}`,
@@ -138,53 +252,36 @@ function renderGroup(group) {
138
252
  function renderTopLevelHelp() {
139
253
  return [
140
254
  `${heading("rig")} ${pc.dim("\u2014 server-owned task/run control plane for Pi-backed engineering work")}`,
141
- pc.dim("A repo-local CLI for setup, server selection, task runs, live attach, and completion review."),
142
- "",
143
- `${pc.bold(pc.magenta("\u25C7 Start here"))} \u2014 ${pc.dim("bootstrap a repo and choose where Rig runs")}`,
144
- commandLine("rig init", "Interactive setup: project config, GitHub auth, task source, server, checkout, Pi."),
145
- commandLine("rig init --yes", "Non-interactive setup using detected defaults; good for repeatable installs."),
146
- commandLine("rig server status", "Show whether this repo is using local Rig or a remote server."),
147
- commandLine("rig server use <alias|local>", "Switch the server that owns task/run state for this repo."),
148
- "",
149
- `${pc.bold(pc.magenta("\u25C7 Daily task loop"))} \u2014 ${pc.dim("find work, start a worker, and rejoin it later")}`,
150
- commandLine("rig task list", "List tasks from the selected task source/server with status, labels, and source."),
151
- commandLine("rig task next", "Pick the next matching task without starting it."),
152
- commandLine("rig task run --next", "Start the next task and attach to the live bundled Pi frontend."),
153
- commandLine("rig task run #123 --detach", "Submit a specific issue/task and return immediately."),
154
- "",
155
- `${pc.bold(pc.magenta("\u25C7 Live run control"))} \u2014 ${pc.dim("observe, steer, stop, or inspect active runs")}`,
156
- commandLine("rig run list", "Show recent/active runs from the selected server or local state."),
157
- commandLine("rig run attach <run-id> --follow", "Open the native Pi live view for a worker-backed run."),
158
- commandLine("rig run show --run <id>", "Print one run record; add `--json` for automation."),
159
- commandLine("rig run stop <run-id>", "Request cancellation for a running worker."),
160
- "",
161
- `${pc.bold(pc.magenta("\u25C7 Core groups"))} \u2014 ${pc.dim("run `rig <group> --help` for detailed commands and examples")}`,
162
- ...PRIMARY_GROUPS.map((group) => commandLine(group.name, group.summary)),
163
- commandLine("doctor", "Diagnose project/server/GitHub/task/Pi wiring when setup or runs misbehave."),
255
+ pc.dim("Current path: select a server, choose a task, submit a run, attach with native Pi, clear inbox/review gates."),
164
256
  "",
165
- `${pc.bold(pc.magenta("\u25C7 More"))}`,
166
- commandLine("rig help --advanced", "Legacy, dev, diagnostics, browser, queue, agent, remote, git, harness commands."),
167
- commandLine("rig <group> --help", "Rich per-group help with usage, descriptions, examples, and next steps."),
168
- commandLine("rig --version", "Print the installed Rig CLI 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."),
169
263
  "",
170
- `${pc.bold(pc.magenta("\u25C7 Global options"))}`,
264
+ pc.bold("Global options"),
171
265
  commandLine("--project <path>", "Use a project root instead of auto-discovery."),
172
266
  commandLine("--json", "Emit structured output for scripts/agents."),
173
267
  commandLine("--dry-run", "Print the command plan without mutating state.")
174
268
  ].join(`
175
- `);
269
+ `).trimEnd();
176
270
  }
177
271
  function renderAdvancedHelp() {
178
272
  return [
179
- `${heading("rig advanced")} \u2014 legacy, dev, and compatibility groups`,
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",
180
277
  "",
181
- pc.bold("Primary groups are still"),
182
- " init, server, task, run",
278
+ pc.bold("Advanced commands"),
279
+ ...ADVANCED_COMMANDS.map((entry) => commandLine(entry.command, entry.description)),
183
280
  "",
184
281
  pc.bold("Advanced groups"),
185
282
  ...ADVANCED_GROUPS.map((group) => commandLine(group.name, group.summary)),
186
283
  "",
187
- pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, and `rig run` for day-to-day work.")
284
+ pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, `rig run`, `rig inbox`, and `rig review` for day-to-day work.")
188
285
  ].join(`
189
286
  `);
190
287
  }
@@ -195,9 +292,73 @@ function renderGroupHelp(groupName) {
195
292
  function listHelpGroups() {
196
293
  return ALL_GROUPS.map((group) => group.name);
197
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
+ }
198
356
  export {
199
357
  renderTopLevelHelp,
200
358
  renderGroupHelp,
201
359
  renderAdvancedHelp,
360
+ printTopLevelHelp,
361
+ printGroupHelpDocument,
362
+ printAdvancedHelp,
202
363
  listHelpGroups
203
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 connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
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 connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
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 connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
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 connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
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 connection", 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 connection", legacyServerCompatibility ? "warn" : "fail", "missing .rig/state/connection.json", "Run `rig init` or `rig connect use <alias|local>`."));
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 connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
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 connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
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, "bun run rig agent list");
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, "bun run rig agent prepare --task <id> [--id <id>] [--mode worktree]");
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: bun run rig agent prepare --task <id> [--id <id>] [--mode worktree]");
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: bun run rig agent run [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
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, "bun run rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
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: bun run rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
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, "bun run rig agent cleanup (--id <id> | --all)");
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, "bun run rig browser explain");
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, `bun run rig browser ${command} ${subcommand}`);
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, `bun run rig browser ${command}`);
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, "bun run rig browser demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]");
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(9))} ${value}`);
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, "bun run rig dist build [--output-dir <dir>]");
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, "bun run rig dist install [--scope user|system] [--path <dir>]");
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, "bun run rig dist doctor");
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, "bun run rig dist rebuild-agent");
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");