@h-rig/cli 0.0.6-alpha.27 → 0.0.6-alpha.29

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 (42) hide show
  1. package/dist/bin/rig.js +1505 -907
  2. package/dist/src/commands/_cli-format.js +211 -6
  3. package/dist/src/commands/_connection-state.js +1 -3
  4. package/dist/src/commands/_doctor-checks.js +3 -5
  5. package/dist/src/commands/_help-catalog.js +251 -66
  6. package/dist/src/commands/_operator-view.js +1 -3
  7. package/dist/src/commands/_parsers.js +0 -2
  8. package/dist/src/commands/_pi-frontend.js +1 -3
  9. package/dist/src/commands/_pi-worker-bridge-extension.js +1 -3
  10. package/dist/src/commands/_policy.js +0 -2
  11. package/dist/src/commands/_preflight.js +2 -4
  12. package/dist/src/commands/_run-driver-helpers.js +0 -2
  13. package/dist/src/commands/_server-client.js +1 -3
  14. package/dist/src/commands/_snapshot-upload.js +1 -3
  15. package/dist/src/commands/agent.js +7 -9
  16. package/dist/src/commands/browser.js +4 -6
  17. package/dist/src/commands/connect.js +5 -6
  18. package/dist/src/commands/dist.js +4 -6
  19. package/dist/src/commands/doctor.js +3 -5
  20. package/dist/src/commands/github.js +1 -3
  21. package/dist/src/commands/inbox.js +351 -31
  22. package/dist/src/commands/init.js +3 -5
  23. package/dist/src/commands/inspect.js +10 -12
  24. package/dist/src/commands/inspector.js +2 -4
  25. package/dist/src/commands/plugin.js +76 -22
  26. package/dist/src/commands/profile-and-review.js +8 -10
  27. package/dist/src/commands/queue.js +1 -3
  28. package/dist/src/commands/remote.js +18 -20
  29. package/dist/src/commands/repo-git-harness.js +6 -8
  30. package/dist/src/commands/run.js +159 -41
  31. package/dist/src/commands/server.js +6 -7
  32. package/dist/src/commands/setup.js +7 -15
  33. package/dist/src/commands/task-report-bug.js +5 -7
  34. package/dist/src/commands/task-run-driver.js +1 -3
  35. package/dist/src/commands/task.js +483 -50
  36. package/dist/src/commands/test.js +3 -5
  37. package/dist/src/commands/workspace.js +4 -6
  38. package/dist/src/commands.js +1508 -901
  39. package/dist/src/index.js +1511 -916
  40. package/dist/src/report-bug.js +3 -3
  41. package/dist/src/runner.js +2 -17
  42. 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
+ ]
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
+ ]
21
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,15 +82,20 @@ 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." },
89
+ { command: "details --task <id>", description: "Show full task info from the configured source." },
90
+ { command: "reopen [--task <id> | --all] [--reason <text>]", description: "Reopen closed task(s) in the configured source." },
91
+ { command: "reset --task <id>", description: "Compatibility spelling of `reopen --task <id>`." },
53
92
  { command: "artifacts|artifact-dir|artifact-write", description: "Inspect or write task artifacts." },
54
93
  { command: "report-bug", description: "Create a structured bug report/task." }
55
94
  ],
56
95
  examples: [
57
96
  "rig task list --assignee @me --limit 20",
97
+ "rig task next",
98
+ "rig task show 123 --raw",
58
99
  "rig task run --next",
59
100
  "rig task run #123 --runtime-adapter pi",
60
101
  "rig task run --title 'Investigate deploy drift' --initial-prompt 'Check server health'"
@@ -67,52 +108,149 @@ var PRIMARY_GROUPS = [
67
108
  usage: ["rig run <list|status|show|attach|stop> [options]"],
68
109
  commands: [
69
110
  { 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 },
111
+ { command: "status", description: "Render active and recent run groups.", primary: true },
112
+ { command: "show <id>|--run <id> [--raw]", description: "Show a human run summary; --raw prints the full payload.", primary: true },
113
+ { command: "attach <run-id>|--run <id> [--follow]", description: "Attach to the run; --follow launches native bundled Pi for live Pi runs.", primary: true },
73
114
  { command: "stop [<run-id>|--run <id>]", description: "Request stop for one run or local active runs.", primary: true },
74
115
  { command: "timeline --run <id> [--follow]", description: "Stream raw run timeline events." },
116
+ { command: "resume", description: "Resume the most recent interrupted local run." },
117
+ { command: "restart", description: "Restart the most recent local run from a clean runtime." },
75
118
  { command: "delete|cleanup", description: "Remove completed run records/artifacts." }
76
119
  ],
77
120
  examples: [
78
121
  "rig run list",
79
- "rig run attach 01234567-89ab-cdef-0123-456789abcdef --follow",
80
- "rig run show --run <run-id>",
122
+ "rig run status",
123
+ "rig run show <run-id>",
124
+ "rig run attach <run-id> --follow",
81
125
  "rig run stop <run-id>"
82
126
  ],
83
127
  next: ["Use `rig task run --next` to create a new run.", "Use `--json` when scripts need the full structured record."]
128
+ },
129
+ {
130
+ name: "inbox",
131
+ summary: "Review approval and user-input requests that block worker runs.",
132
+ usage: ["rig inbox <approvals|approve|inputs|respond> [options]"],
133
+ commands: [
134
+ { command: "approvals [--run <id>] [--task <id>]", description: "List pending approvals.", primary: true },
135
+ { command: "inputs [--run <id>] [--task <id>]", description: "List pending user-input requests.", primary: true },
136
+ { command: "approve --run <id> --request <id> --decision approve|reject", description: "Resolve an approval request." },
137
+ { command: "respond --run <id> --request <id> --answer key=value", description: "Answer a user-input request." }
138
+ ],
139
+ examples: [
140
+ "rig inbox approvals",
141
+ "rig inbox inputs --run <run-id>",
142
+ "rig inbox approve --run <run-id> --request <request-id> --decision approve"
143
+ ],
144
+ next: ["Rejoin the run after resolving a block: `rig run attach <run-id> --follow`."]
145
+ },
146
+ {
147
+ name: "review",
148
+ summary: "Inspect or change completion review gate policy.",
149
+ usage: ["rig review <show|set>"],
150
+ commands: [
151
+ { command: "show", description: "Show current review gate settings.", primary: true },
152
+ { command: "set <off|advisory|required> [--provider greptile]", description: "Change review strictness/provider.", primary: true }
153
+ ],
154
+ examples: ["rig review show", "rig review set required --provider greptile"],
155
+ next: ["Use `rig inbox approvals` for blocked run handoffs."]
156
+ },
157
+ {
158
+ name: "init",
159
+ summary: "Set up Rig for this repo: server, GitHub auth, checkout strategy, task source, and Pi wiring.",
160
+ usage: ["rig init [--yes] [--server local|remote] [--repo owner/repo] [--remote-url <url>]"],
161
+ commands: [
162
+ { command: "init", description: "Interactive setup wizard for a new or existing Rig repo.", primary: true },
163
+ { command: "init --yes", description: "Non-interactive setup using detected/default settings.", primary: true },
164
+ { command: "init --server remote --remote-url <url>", description: "Link this repo to a remote Rig server.", primary: true },
165
+ { command: "init --repair", description: "Repair missing private state without replacing project config." }
166
+ ],
167
+ examples: [
168
+ "rig init",
169
+ "rig init --yes --repo humanity-org/humanwork",
170
+ "rig init --server remote --remote-url https://where.rig-does.work --repo owner/repo"
171
+ ],
172
+ next: ["After init, run `rig server status`.", "Then use `rig task list` and `rig task run --next` for day-to-day work."]
173
+ },
174
+ {
175
+ name: "doctor",
176
+ summary: "Diagnostics for project/server/GitHub/Pi state.",
177
+ usage: ["rig doctor"],
178
+ commands: [
179
+ { command: "doctor", description: "Run setup and runtime diagnostics.", primary: true },
180
+ { command: "check", description: "Compatibility spelling for diagnostics." }
181
+ ],
182
+ examples: ["rig doctor", "rig doctor --json"],
183
+ next: ["Use `rig server status` and `rig github auth status` to inspect common failure points."]
184
+ },
185
+ {
186
+ name: "github",
187
+ summary: "GitHub auth helpers for the selected Rig server.",
188
+ usage: ["rig github auth <status|import-gh|token>"],
189
+ commands: [
190
+ { command: "auth status", description: "Show GitHub auth state.", primary: true },
191
+ { command: "auth import-gh", description: "Import the current `gh` token into the selected server." },
192
+ { command: "auth token --token <token>", description: "Store a token on the selected server." }
193
+ ],
194
+ examples: ["rig github auth status", "rig github auth import-gh"],
195
+ next: ["After auth is valid, use `rig task run --next`."]
84
196
  }
85
197
  ];
86
198
  var ADVANCED_GROUPS = [
87
199
  { 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
200
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
91
201
  { 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
202
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
93
203
  { 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
- { name: "browser", summary: "Browser/app diagnostics.", usage: ["rig browser <help|explain|demo|app>"], commands: [{ command: "help", description: "Browser command help." }] },
96
- { name: "plugin", summary: "Plugin validation/listing.", usage: ["rig plugin <list|validate>"], commands: [{ command: "list", description: "List plugins." }] },
204
+ {
205
+ name: "browser",
206
+ summary: "Browser/app diagnostics for browser-required tasks.",
207
+ usage: ["rig browser <help|explain|demo|app|hp-next> [options]"],
208
+ commands: [
209
+ { command: "help", description: "Rich browser command help (canonical: `rig browser help`)." },
210
+ { command: "explain", description: "Explain the browser-required task contract." },
211
+ { command: "demo", description: "Run browser demo flows against a local page." },
212
+ { command: "app", description: "Launch the Rig Browser workstation app." },
213
+ { command: "hp-next <dev|check|e2e|reset>", description: "Drive the hp-next browser test harness." }
214
+ ]
215
+ },
216
+ {
217
+ name: "plugin",
218
+ summary: "Plugin listing, validation, and plugin-contributed commands.",
219
+ usage: ["rig plugin <list|validate|run> [options]"],
220
+ commands: [
221
+ { command: "list", description: "List plugins declared in rig.config.ts and their contributions." },
222
+ { command: "validate --task <id>", description: "Run plugin-contributed validators for a task." },
223
+ { command: "run <command-id> [args...]", description: "Execute a plugin-contributed CLI command (also callable as `rig <command-id>`)." }
224
+ ]
225
+ },
97
226
  { name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
98
227
  { name: "agent", summary: "Runtime agent workspace helpers.", usage: ["rig agent <list|prepare|run|cleanup>"], commands: [{ command: "list", description: "List prepared agents." }] },
99
228
  { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
100
229
  { name: "dist", summary: "Build/install packaged Rig CLI.", usage: ["rig dist <build|install|doctor>"], commands: [{ command: "build", description: "Build distribution." }] },
101
230
  { 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." }] },
231
+ { name: "remote", summary: "Compatibility remote orchestration controls.", usage: ["rig remote <status|watch|pause|resume|...>"], commands: [{ command: "status", description: "Show remote state." }] },
104
232
  { name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
105
233
  { name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
106
234
  { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
107
235
  ];
236
+ var ADVANCED_COMMANDS = [
237
+ { command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
238
+ { command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
239
+ { command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
240
+ { command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
241
+ ];
108
242
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
109
243
  function heading(title) {
110
244
  return pc.bold(pc.cyan(title));
111
245
  }
112
246
  function commandLine(command, description) {
113
- const commandColumn = command.length >= 34 ? `${command} ` : command.padEnd(34);
247
+ const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
114
248
  return `${pc.dim("\u2502")} ${pc.bold(commandColumn)} ${description}`;
115
249
  }
250
+ function renderCommandBlock(commands) {
251
+ return commands.map((entry) => commandLine(entry.command, entry.description)).join(`
252
+ `);
253
+ }
116
254
  function renderGroup(group) {
117
255
  const lines = [
118
256
  `${heading(`rig ${group.name}`)} \u2014 ${group.summary}`,
@@ -138,53 +276,36 @@ function renderGroup(group) {
138
276
  function renderTopLevelHelp() {
139
277
  return [
140
278
  `${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."),
279
+ pc.dim("Current path: select a server, choose a task, submit a run, attach with native Pi, clear inbox/review gates."),
160
280
  "",
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."),
281
+ ...TOP_LEVEL_SECTIONS.flatMap((section) => [
282
+ `${pc.bold(pc.magenta(`\u25C7 ${section.title}`))} \u2014 ${pc.dim(section.subtitle)}`,
283
+ renderCommandBlock(section.commands),
284
+ ""
285
+ ]),
286
+ pc.dim("More: `rig help --advanced` for dev/compatibility commands; `rig <group> --help` for rich per-group help; `rig --version` for the installed version."),
164
287
  "",
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."),
169
- "",
170
- `${pc.bold(pc.magenta("\u25C7 Global options"))}`,
288
+ pc.bold("Global options"),
171
289
  commandLine("--project <path>", "Use a project root instead of auto-discovery."),
172
290
  commandLine("--json", "Emit structured output for scripts/agents."),
173
291
  commandLine("--dry-run", "Print the command plan without mutating state.")
174
292
  ].join(`
175
- `);
293
+ `).trimEnd();
176
294
  }
177
295
  function renderAdvancedHelp() {
178
296
  return [
179
- `${heading("rig advanced")} \u2014 legacy, dev, and compatibility groups`,
297
+ `${heading("rig advanced")} \u2014 compatibility, diagnostics, and internal surfaces`,
298
+ "",
299
+ pc.bold("Primary groups"),
300
+ " server, task, run, inbox, review, init, doctor, github",
180
301
  "",
181
- pc.bold("Primary groups are still"),
182
- " init, server, task, run",
302
+ pc.bold("Advanced commands"),
303
+ ...ADVANCED_COMMANDS.map((entry) => commandLine(entry.command, entry.description)),
183
304
  "",
184
305
  pc.bold("Advanced groups"),
185
306
  ...ADVANCED_GROUPS.map((group) => commandLine(group.name, group.summary)),
186
307
  "",
187
- pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, and `rig run` for day-to-day work.")
308
+ pc.dim("All groups remain callable. Prefer `rig server`, `rig task`, `rig run`, `rig inbox`, and `rig review` for day-to-day work.")
188
309
  ].join(`
189
310
  `);
190
311
  }
@@ -195,9 +316,73 @@ function renderGroupHelp(groupName) {
195
316
  function listHelpGroups() {
196
317
  return ALL_GROUPS.map((group) => group.name);
197
318
  }
319
+ function shouldUseClackOutput() {
320
+ return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
321
+ }
322
+ function printTopLevelHelp() {
323
+ if (!shouldUseClackOutput()) {
324
+ console.log(renderTopLevelHelp());
325
+ return;
326
+ }
327
+ intro("rig");
328
+ for (const section of TOP_LEVEL_SECTIONS) {
329
+ note(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
330
+ }
331
+ log.info("More: rig help --advanced \xB7 rig <group> --help \xB7 rig --version");
332
+ note([
333
+ commandLine("--project <path>", "Use a project root instead of auto-discovery."),
334
+ commandLine("--json", "Emit structured output for scripts/agents."),
335
+ commandLine("--dry-run", "Print the command plan without mutating state.")
336
+ ].join(`
337
+ `), "Global options");
338
+ outro("Server \u2192 task \u2192 run \u2192 inbox/review.");
339
+ }
340
+ function printAdvancedHelp() {
341
+ if (!shouldUseClackOutput()) {
342
+ console.log(renderAdvancedHelp());
343
+ return;
344
+ }
345
+ intro("rig advanced");
346
+ note(ADVANCED_COMMANDS.map((entry) => commandLine(entry.command, entry.description)).join(`
347
+ `), "Advanced commands");
348
+ note(ADVANCED_GROUPS.map((group) => commandLine(group.name, group.summary)).join(`
349
+ `), "Advanced groups");
350
+ outro("Primary daily flow: rig server \xB7 rig task \xB7 rig run \xB7 rig inbox \xB7 rig review.");
351
+ }
352
+ function printGroupHelpDocument(groupName) {
353
+ const rendered = renderGroupHelp(groupName) ?? renderTopLevelHelp();
354
+ if (!shouldUseClackOutput()) {
355
+ console.log(rendered);
356
+ return;
357
+ }
358
+ const group = ALL_GROUPS.find((candidate) => candidate.name === groupName);
359
+ if (!group) {
360
+ printTopLevelHelp();
361
+ return;
362
+ }
363
+ intro(`rig ${group.name}`);
364
+ note(group.summary, "Purpose");
365
+ note(group.usage.join(`
366
+ `), "Usage");
367
+ note(group.commands.map((entry) => commandLine(entry.command, entry.description)).join(`
368
+ `), "Commands");
369
+ if (group.examples?.length)
370
+ note(group.examples.map((line) => `$ ${line}`).join(`
371
+ `), "Examples");
372
+ if (group.next?.length)
373
+ note(group.next.map((line) => `\u203A ${line}`).join(`
374
+ `), "Next steps");
375
+ if (group.advanced?.length)
376
+ log.info(group.advanced.join(`
377
+ `));
378
+ outro("Run with --json when scripts need structured output.");
379
+ }
198
380
  export {
199
381
  renderTopLevelHelp,
200
382
  renderGroupHelp,
201
383
  renderAdvancedHelp,
384
+ printTopLevelHelp,
385
+ printGroupHelpDocument,
386
+ printAdvancedHelp,
202
387
  listHelpGroups
203
388
  };
@@ -7,8 +7,6 @@ import { resolve as resolve2 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -92,7 +90,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
92
90
  const global = readGlobalConnections(options);
93
91
  const connection = global.connections[repo.selected];
94
92
  if (!connection) {
95
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
93
+ throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
96
94
  }
97
95
  return { alias: repo.selected, connection };
98
96
  }
@@ -9,8 +9,6 @@ import { resolve } from "path";
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
10
  import { CliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
13
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
16
14
 
@@ -13,8 +13,6 @@ import { resolve as resolve2 } from "path";
13
13
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
14
14
  import { CliError } from "@rig/runtime/control-plane/errors";
15
15
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
16
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
17
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
18
16
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
19
17
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
20
18
 
@@ -98,7 +96,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
98
96
  const global = readGlobalConnections(options);
99
97
  const connection = global.connections[repo.selected];
100
98
  if (!connection) {
101
- 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);
102
100
  }
103
101
  return { alias: repo.selected, connection };
104
102
  }
@@ -7,8 +7,6 @@ import { resolve as resolve2 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -92,7 +90,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
92
90
  const global = readGlobalConnections(options);
93
91
  const connection = global.connections[repo.selected];
94
92
  if (!connection) {
95
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
93
+ throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
96
94
  }
97
95
  return { alias: repo.selected, connection };
98
96
  }
@@ -7,8 +7,6 @@ import { resolve } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
  function formatCommand(parts) {
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
 
@@ -88,7 +86,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
88
86
  const global = readGlobalConnections(options);
89
87
  const connection = global.connections[repo.selected];
90
88
  if (!connection) {
91
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
89
+ throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
92
90
  }
93
91
  return { alias: repo.selected, connection };
94
92
  }
@@ -300,7 +298,7 @@ async function runFastTaskRunPreflight(context, options = {}) {
300
298
  }
301
299
  }
302
300
  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>`."));
301
+ 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
302
  try {
305
303
  const auth = await request("/api/github/auth/status");
306
304
  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>`."));
@@ -7,8 +7,6 @@ import { resolve as resolve3 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -7,8 +7,6 @@ import { resolve as resolve2 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -92,7 +90,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
92
90
  const global = readGlobalConnections(options);
93
91
  const connection = global.connections[repo.selected];
94
92
  if (!connection) {
95
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
93
+ throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
96
94
  }
97
95
  return { alias: repo.selected, connection };
98
96
  }
@@ -11,8 +11,6 @@ import { resolve as resolve2 } from "path";
11
11
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
12
12
  import { CliError } from "@rig/runtime/control-plane/errors";
13
13
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
14
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
15
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
16
14
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
17
15
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
18
16
 
@@ -96,7 +94,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
96
94
  const global = readGlobalConnections(options);
97
95
  const connection = global.connections[repo.selected];
98
96
  if (!connection) {
99
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
97
+ throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
100
98
  }
101
99
  return { alias: repo.selected, connection };
102
100
  }