@h-rig/cli 0.0.6-alpha.36 → 0.0.6-alpha.38

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 CHANGED
@@ -531,7 +531,8 @@ import { loadPolicy as loadPolicy3 } from "@rig/runtime/control-plane/runtime/gu
531
531
  // packages/cli/src/commands.ts
532
532
  init_runner();
533
533
  import {
534
- existsSync as existsSync16
534
+ existsSync as existsSync16,
535
+ readFileSync as readFileSync12
535
536
  } from "fs";
536
537
  import { resolve as resolve25 } from "path";
537
538
  import { readBuildConfig } from "@rig/runtime/build-time-config";
@@ -6305,6 +6306,7 @@ ${acceptance}` : null,
6305
6306
  ${sourceContractLines.join(`
6306
6307
  `)}` : null,
6307
6308
  scopeText || renderSourceScopeValidation(sourceTask, sourceValidation) || null,
6309
+ readPriorPrProgressForPrompt(input.projectRoot, input.taskId),
6308
6310
  initialPrompt ? `Additional operator guidance:
6309
6311
  ${initialPrompt}` : null,
6310
6312
  providerLines.length > 0 ? `Provider-specific runtime tooling:
@@ -6314,6 +6316,26 @@ ${providerLines.join(" ")}` : null,
6314
6316
 
6315
6317
  `);
6316
6318
  }
6319
+ function readPriorPrProgressForPrompt(projectRoot, taskId) {
6320
+ for (const candidate of [
6321
+ resolve20(projectRoot, ".worktrees", taskId, "artifacts", taskId, "pr-state.json"),
6322
+ resolve20(projectRoot, "artifacts", taskId, "pr-state.json")
6323
+ ]) {
6324
+ try {
6325
+ const raw = JSON.parse(readFileSync8(candidate, "utf8"));
6326
+ const entries = Array.isArray(raw) ? raw : [raw];
6327
+ const first = entries.find((entry) => entry && typeof entry === "object" && typeof entry.url === "string");
6328
+ if (!first)
6329
+ continue;
6330
+ return [
6331
+ `Prior progress exists for this task: PR ${first.url}${first.branch ? ` (branch ${first.branch})` : ""} was opened by an earlier run.`,
6332
+ "Check its current state first (diff, checks, review). If the work is already complete and checks are green,",
6333
+ "run `rig-agent completion-verification` to merge and close instead of re-implementing anything."
6334
+ ].join(" ");
6335
+ } catch {}
6336
+ }
6337
+ return null;
6338
+ }
6317
6339
  function firstPromptString(...values) {
6318
6340
  for (const value of values) {
6319
6341
  const trimmed = typeof value === "string" ? value.trim() : "";
@@ -8715,52 +8737,50 @@ import { intro as intro3, log as log4, note as note4, outro as outro3 } from "@c
8715
8737
  import pc4 from "picocolors";
8716
8738
  var TOP_LEVEL_SECTIONS = [
8717
8739
  {
8718
- title: "Server",
8719
- subtitle: "choose the local or remote Rig server that owns this repo",
8740
+ title: "Start here",
8741
+ subtitle: "one-time setup for a repo",
8720
8742
  commands: [
8721
- { command: "rig server status", description: "Show the selected local/remote server for this repo." },
8722
- { command: "rig server use local", description: "Switch this repo back to the local Rig server." },
8723
- { command: "rig server add <alias> <url>", description: "Save a remote Rig server alias." },
8724
- { command: "rig server use <alias>", description: "Switch this repo to a saved remote server." },
8725
- { command: "rig server list", description: "Show saved server aliases, including local." }
8743
+ { command: "rig init", description: "Wizard: config, GitHub auth, task source, server, Pi wiring." },
8744
+ { command: "rig doctor", description: "Check every part of the wiring \u2014 run this when anything feels off." },
8745
+ { command: "rig server use <alias|local>", description: "Pick which Rig server owns this repo (`rig server list` to see them)." }
8726
8746
  ]
8727
8747
  },
8728
8748
  {
8729
- title: "Tasks",
8730
- subtitle: "find work, inspect it, and submit Pi-backed workers",
8749
+ title: "Work",
8750
+ subtitle: "find a task and put an agent on it",
8731
8751
  commands: [
8732
- { command: "rig task list", description: "List tasks from the selected task source/server." },
8733
- { command: "rig task next", description: "Show the next matching task as a selected-task card." },
8734
- { command: "rig task show <id>", description: "Show a human task summary; add --raw or --json for the full payload." },
8735
- { command: "rig task run <id|--next> [--detach]", description: "Submit a task run; interactive mode follows with bundled Pi." }
8752
+ { command: "rig task list", description: "What's on the board (from the selected source/server)." },
8753
+ { command: "rig task next", description: "The next ready task, as a card." },
8754
+ { command: "rig task run --next", description: "Dispatch an agent; interactive mode opens the native Pi session." },
8755
+ { command: "rig task run <id> --detach", description: "Fire-and-forget a specific task." }
8736
8756
  ]
8737
8757
  },
8738
8758
  {
8739
- title: "Runs",
8740
- subtitle: "observe, attach to, and stop live or recent runs",
8759
+ title: "Watch & steer",
8760
+ subtitle: "live runs are observable and steerable, attached or not",
8741
8761
  commands: [
8742
- { command: "rig run list", description: "List recent runs from the selected server or local state." },
8743
- { command: "rig run show <id>", description: "Show a human run summary; add --raw or --json for the full payload." },
8744
- { command: "rig run attach <id> --follow", description: "Open the native bundled Pi live view for a worker run." },
8745
- { command: "rig run stop <id>", description: "Request cancellation for a running worker." }
8762
+ { command: "rig run status", description: "Active and recent runs at a glance." },
8763
+ { command: "rig run attach <id> --follow", description: "Join the live Pi session (worker keeps running if you /detach)." },
8764
+ { command: "rig run steer <id> -m <text>", description: "Drop a message into a live worker without attaching." },
8765
+ { command: "rig run stop <id>", description: "Cancel a running worker." }
8746
8766
  ]
8747
8767
  },
8748
8768
  {
8749
- title: "Review / inbox",
8750
- subtitle: "clear blocked runs and configure completion review",
8769
+ title: "Unblock & gate",
8770
+ subtitle: "answer what workers ask; control what merges",
8751
8771
  commands: [
8752
- { command: "rig inbox approvals", description: "List pending approval requests from local/server run state." },
8753
- { command: "rig inbox inputs", description: "List pending user-input requests from local/server run state." },
8754
- { command: "rig review show|set", description: "Inspect or change the review gate policy." }
8772
+ { command: "rig inbox approvals", description: "Approvals workers are waiting on (then `rig inbox approve \u2026`)." },
8773
+ { command: "rig inbox inputs", description: "Questions workers asked (then `rig inbox respond \u2026`)." },
8774
+ { command: "rig review show|set", description: "The completion review gate (Greptile is mandatory on merges)." }
8755
8775
  ]
8756
8776
  },
8757
8777
  {
8758
- title: "Health / setup",
8759
- subtitle: "bootstrap and diagnose the repo/server/GitHub/Pi path",
8778
+ title: "Extend",
8779
+ subtitle: "more Pi, more plugins",
8760
8780
  commands: [
8761
- { command: "rig init", description: "Interactive setup: config, GitHub auth, task source, server, checkout, Pi." },
8762
- { command: "rig doctor", description: "Diagnose project/server/GitHub/task/Pi wiring." },
8763
- { command: "rig github auth status", description: "Show GitHub auth state on the selected Rig server." }
8781
+ { command: "rig pi search <term>", description: "Discover community Pi extensions on npm." },
8782
+ { command: "rig pi add <pkg>", description: "Add a Pi extension to this project (workers pick it up too)." },
8783
+ { command: "rig plugin list", description: "What the rig.config.ts plugins contribute." }
8764
8784
  ]
8765
8785
  }
8766
8786
  ];
@@ -8910,7 +8930,19 @@ var PRIMARY_GROUPS = [
8910
8930
  var ADVANCED_GROUPS = [
8911
8931
  { 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." }] },
8912
8932
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
8913
- { 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." }] },
8933
+ {
8934
+ name: "inspect",
8935
+ summary: "Inspect logs, artifacts, graphs, failures for a task.",
8936
+ usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff> --task <id>"],
8937
+ commands: [
8938
+ { command: "logs --task <id>", description: "Latest run log for a task (local or selected server)." },
8939
+ { command: "artifacts --task <id>", description: "List the task's completion artifacts." },
8940
+ { command: "failures --task <id>", description: "Recorded failures for a task." },
8941
+ { command: "graph", description: "Task dependency graph." },
8942
+ { command: "audit", description: "Controlled-command audit trail." },
8943
+ { command: "diff --task <id>", description: "Changed files for a task." }
8944
+ ]
8945
+ },
8914
8946
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
8915
8947
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
8916
8948
  {
@@ -8961,13 +8993,32 @@ var ADVANCED_GROUPS = [
8961
8993
  var ADVANCED_COMMANDS = [
8962
8994
  { command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
8963
8995
  { command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
8964
- { command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
8996
+ { command: "rig run start|start-serial|start-parallel", description: "Local epic queue starters (server-owned tasks use `rig task run ...`)." },
8965
8997
  { command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
8966
8998
  ];
8967
8999
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
8968
9000
  function heading(title) {
8969
9001
  return pc4.bold(pc4.cyan(title));
8970
9002
  }
9003
+ function renderRigBanner(version) {
9004
+ const m = (s) => pc4.bold(pc4.magenta(s));
9005
+ const c = (s) => pc4.bold(pc4.cyan(s));
9006
+ const y = (s) => pc4.yellow(s);
9007
+ const d = (s) => pc4.dim(s);
9008
+ const lines = [
9009
+ m(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ") + d(" \u2591\u2592\u2593\u2588 "),
9010
+ m(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D ") + d("\u2593\u2592\u2591"),
9011
+ c(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557") + d(" \u2591\u2592"),
9012
+ c(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551") + d(" \u2588\u2593\u2591"),
9013
+ y(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D") + d(" \u2592\u2591"),
9014
+ y(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D "),
9015
+ "",
9016
+ ` ${c("\u25E2\u25E4")} ${pc4.bold("the control rig for autonomous coding agents")} ${m("//")} ${d("you are the operator")}`,
9017
+ version ? ` ${d(`v${version} \xB7 jack in: rig task run --next`)}` : ` ${d("jack in: rig task run --next")}`
9018
+ ];
9019
+ return lines.join(`
9020
+ `);
9021
+ }
8971
9022
  function commandLine(command, description) {
8972
9023
  const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
8973
9024
  return `${pc4.dim("\u2502")} ${pc4.bold(commandColumn)} ${description}`;
@@ -9041,12 +9092,25 @@ function renderGroupHelp(groupName) {
9041
9092
  function shouldUseClackOutput2() {
9042
9093
  return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
9043
9094
  }
9044
- function printTopLevelHelp() {
9095
+ function printTopLevelHelp(state = {}) {
9045
9096
  if (!shouldUseClackOutput2()) {
9046
9097
  console.log(renderTopLevelHelp());
9047
9098
  return;
9048
9099
  }
9049
- intro3("rig");
9100
+ console.log(renderRigBanner(state.version));
9101
+ console.log("");
9102
+ if (state.projectInitialized === false) {
9103
+ intro3("no rig project in this directory");
9104
+ note4([
9105
+ commandLine("rig init", "Set this repo up: config, GitHub auth, task source, server, Pi."),
9106
+ commandLine("rig init --yes", "Same, non-interactive, sensible defaults."),
9107
+ commandLine("rig doctor", "Already initialized somewhere else? Check the wiring.")
9108
+ ].join(`
9109
+ `), "Get started");
9110
+ outro3("After init: rig task run --next puts an agent on your next task.");
9111
+ return;
9112
+ }
9113
+ intro3(state.selectedServer ? `server: ${state.selectedServer}` : "rig");
9050
9114
  for (const section of TOP_LEVEL_SECTIONS) {
9051
9115
  note4(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
9052
9116
  }
@@ -9057,7 +9121,7 @@ function printTopLevelHelp() {
9057
9121
  commandLine("--dry-run", "Print the command plan without mutating state.")
9058
9122
  ].join(`
9059
9123
  `), "Global options");
9060
- outro3("Server \u2192 task \u2192 run \u2192 inbox/review.");
9124
+ outro3("init \u2192 task run \u2192 watch/steer \u2192 inbox/review \u2192 merged.");
9061
9125
  }
9062
9126
  function printAdvancedHelp() {
9063
9127
  if (!shouldUseClackOutput2()) {
@@ -11923,9 +11987,23 @@ function isHelpArg(arg) {
11923
11987
  function helpText() {
11924
11988
  return renderTopLevelHelp();
11925
11989
  }
11990
+ function resolveTopLevelLaunchState(context) {
11991
+ const projectInitialized = hasInitializedRigProject(context.projectRoot);
11992
+ let selectedServer = null;
11993
+ if (projectInitialized) {
11994
+ try {
11995
+ const statePath = resolve25(context.projectRoot, ".rig", "state", "connection.json");
11996
+ if (existsSync16(statePath)) {
11997
+ const parsed = JSON.parse(readFileSync12(statePath, "utf-8"));
11998
+ selectedServer = parsed.remoteUrl || parsed.url || parsed.selected || null;
11999
+ }
12000
+ } catch {}
12001
+ }
12002
+ return { projectInitialized, selectedServer, version: process.env.RIG_CLI_VERSION || readBuildConfig().RIG_CLI_VERSION || undefined };
12003
+ }
11926
12004
  async function execute(context, args) {
11927
12005
  if (args.length === 0) {
11928
- printTopLevelHelp();
12006
+ printTopLevelHelp(resolveTopLevelLaunchState(context));
11929
12007
  return { ok: true, group: "help", command: "show" };
11930
12008
  }
11931
12009
  const [first, ...rest] = args;
@@ -4,52 +4,50 @@ import { intro, log, note, outro } from "@clack/prompts";
4
4
  import pc from "picocolors";
5
5
  var TOP_LEVEL_SECTIONS = [
6
6
  {
7
- title: "Server",
8
- subtitle: "choose the local or remote Rig server that owns this repo",
7
+ title: "Start here",
8
+ subtitle: "one-time setup for a repo",
9
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." }
10
+ { command: "rig init", description: "Wizard: config, GitHub auth, task source, server, Pi wiring." },
11
+ { command: "rig doctor", description: "Check every part of the wiring \u2014 run this when anything feels off." },
12
+ { command: "rig server use <alias|local>", description: "Pick which Rig server owns this repo (`rig server list` to see them)." }
15
13
  ]
16
14
  },
17
15
  {
18
- title: "Tasks",
19
- subtitle: "find work, inspect it, and submit Pi-backed workers",
16
+ title: "Work",
17
+ subtitle: "find a task and put an agent on it",
20
18
  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." }
19
+ { command: "rig task list", description: "What's on the board (from the selected source/server)." },
20
+ { command: "rig task next", description: "The next ready task, as a card." },
21
+ { command: "rig task run --next", description: "Dispatch an agent; interactive mode opens the native Pi session." },
22
+ { command: "rig task run <id> --detach", description: "Fire-and-forget a specific task." }
25
23
  ]
26
24
  },
27
25
  {
28
- title: "Runs",
29
- subtitle: "observe, attach to, and stop live or recent runs",
26
+ title: "Watch & steer",
27
+ subtitle: "live runs are observable and steerable, attached or not",
30
28
  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." }
29
+ { command: "rig run status", description: "Active and recent runs at a glance." },
30
+ { command: "rig run attach <id> --follow", description: "Join the live Pi session (worker keeps running if you /detach)." },
31
+ { command: "rig run steer <id> -m <text>", description: "Drop a message into a live worker without attaching." },
32
+ { command: "rig run stop <id>", description: "Cancel a running worker." }
35
33
  ]
36
34
  },
37
35
  {
38
- title: "Review / inbox",
39
- subtitle: "clear blocked runs and configure completion review",
36
+ title: "Unblock & gate",
37
+ subtitle: "answer what workers ask; control what merges",
40
38
  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." }
39
+ { command: "rig inbox approvals", description: "Approvals workers are waiting on (then `rig inbox approve \u2026`)." },
40
+ { command: "rig inbox inputs", description: "Questions workers asked (then `rig inbox respond \u2026`)." },
41
+ { command: "rig review show|set", description: "The completion review gate (Greptile is mandatory on merges)." }
44
42
  ]
45
43
  },
46
44
  {
47
- title: "Health / setup",
48
- subtitle: "bootstrap and diagnose the repo/server/GitHub/Pi path",
45
+ title: "Extend",
46
+ subtitle: "more Pi, more plugins",
49
47
  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." }
48
+ { command: "rig pi search <term>", description: "Discover community Pi extensions on npm." },
49
+ { command: "rig pi add <pkg>", description: "Add a Pi extension to this project (workers pick it up too)." },
50
+ { command: "rig plugin list", description: "What the rig.config.ts plugins contribute." }
53
51
  ]
54
52
  }
55
53
  ];
@@ -199,7 +197,19 @@ var PRIMARY_GROUPS = [
199
197
  var ADVANCED_GROUPS = [
200
198
  { 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." }] },
201
199
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
202
- { 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." }] },
200
+ {
201
+ name: "inspect",
202
+ summary: "Inspect logs, artifacts, graphs, failures for a task.",
203
+ usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff> --task <id>"],
204
+ commands: [
205
+ { command: "logs --task <id>", description: "Latest run log for a task (local or selected server)." },
206
+ { command: "artifacts --task <id>", description: "List the task's completion artifacts." },
207
+ { command: "failures --task <id>", description: "Recorded failures for a task." },
208
+ { command: "graph", description: "Task dependency graph." },
209
+ { command: "audit", description: "Controlled-command audit trail." },
210
+ { command: "diff --task <id>", description: "Changed files for a task." }
211
+ ]
212
+ },
203
213
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
204
214
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
205
215
  {
@@ -250,13 +260,32 @@ var ADVANCED_GROUPS = [
250
260
  var ADVANCED_COMMANDS = [
251
261
  { command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
252
262
  { command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
253
- { command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
263
+ { command: "rig run start|start-serial|start-parallel", description: "Local epic queue starters (server-owned tasks use `rig task run ...`)." },
254
264
  { command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
255
265
  ];
256
266
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
257
267
  function heading(title) {
258
268
  return pc.bold(pc.cyan(title));
259
269
  }
270
+ function renderRigBanner(version) {
271
+ const m = (s) => pc.bold(pc.magenta(s));
272
+ const c = (s) => pc.bold(pc.cyan(s));
273
+ const y = (s) => pc.yellow(s);
274
+ const d = (s) => pc.dim(s);
275
+ const lines = [
276
+ m(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ") + d(" \u2591\u2592\u2593\u2588 "),
277
+ m(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D ") + d("\u2593\u2592\u2591"),
278
+ c(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557") + d(" \u2591\u2592"),
279
+ c(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551") + d(" \u2588\u2593\u2591"),
280
+ y(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D") + d(" \u2592\u2591"),
281
+ y(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D "),
282
+ "",
283
+ ` ${c("\u25E2\u25E4")} ${pc.bold("the control rig for autonomous coding agents")} ${m("//")} ${d("you are the operator")}`,
284
+ version ? ` ${d(`v${version} \xB7 jack in: rig task run --next`)}` : ` ${d("jack in: rig task run --next")}`
285
+ ];
286
+ return lines.join(`
287
+ `);
288
+ }
260
289
  function commandLine(command, description) {
261
290
  const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
262
291
  return `${pc.dim("\u2502")} ${pc.bold(commandColumn)} ${description}`;
@@ -333,12 +362,25 @@ function listHelpGroups() {
333
362
  function shouldUseClackOutput() {
334
363
  return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
335
364
  }
336
- function printTopLevelHelp() {
365
+ function printTopLevelHelp(state = {}) {
337
366
  if (!shouldUseClackOutput()) {
338
367
  console.log(renderTopLevelHelp());
339
368
  return;
340
369
  }
341
- intro("rig");
370
+ console.log(renderRigBanner(state.version));
371
+ console.log("");
372
+ if (state.projectInitialized === false) {
373
+ intro("no rig project in this directory");
374
+ note([
375
+ commandLine("rig init", "Set this repo up: config, GitHub auth, task source, server, Pi."),
376
+ commandLine("rig init --yes", "Same, non-interactive, sensible defaults."),
377
+ commandLine("rig doctor", "Already initialized somewhere else? Check the wiring.")
378
+ ].join(`
379
+ `), "Get started");
380
+ outro("After init: rig task run --next puts an agent on your next task.");
381
+ return;
382
+ }
383
+ intro(state.selectedServer ? `server: ${state.selectedServer}` : "rig");
342
384
  for (const section of TOP_LEVEL_SECTIONS) {
343
385
  note(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
344
386
  }
@@ -349,7 +391,7 @@ function printTopLevelHelp() {
349
391
  commandLine("--dry-run", "Print the command plan without mutating state.")
350
392
  ].join(`
351
393
  `), "Global options");
352
- outro("Server \u2192 task \u2192 run \u2192 inbox/review.");
394
+ outro("init \u2192 task run \u2192 watch/steer \u2192 inbox/review \u2192 merged.");
353
395
  }
354
396
  function printAdvancedHelp() {
355
397
  if (!shouldUseClackOutput()) {
@@ -393,6 +435,7 @@ function printGroupHelpDocument(groupName) {
393
435
  }
394
436
  export {
395
437
  renderTopLevelHelp,
438
+ renderRigBanner,
396
439
  renderGroupHelp,
397
440
  renderAdvancedHelp,
398
441
  printTopLevelHelp,
@@ -205,6 +205,7 @@ ${acceptance}` : null,
205
205
  ${sourceContractLines.join(`
206
206
  `)}` : null,
207
207
  scopeText || renderSourceScopeValidation(sourceTask, sourceValidation) || null,
208
+ readPriorPrProgressForPrompt(input.projectRoot, input.taskId),
208
209
  initialPrompt ? `Additional operator guidance:
209
210
  ${initialPrompt}` : null,
210
211
  providerLines.length > 0 ? `Provider-specific runtime tooling:
@@ -214,6 +215,26 @@ ${providerLines.join(" ")}` : null,
214
215
 
215
216
  `);
216
217
  }
218
+ function readPriorPrProgressForPrompt(projectRoot, taskId) {
219
+ for (const candidate of [
220
+ resolve3(projectRoot, ".worktrees", taskId, "artifacts", taskId, "pr-state.json"),
221
+ resolve3(projectRoot, "artifacts", taskId, "pr-state.json")
222
+ ]) {
223
+ try {
224
+ const raw = JSON.parse(readFileSync(candidate, "utf8"));
225
+ const entries = Array.isArray(raw) ? raw : [raw];
226
+ const first = entries.find((entry) => entry && typeof entry === "object" && typeof entry.url === "string");
227
+ if (!first)
228
+ continue;
229
+ return [
230
+ `Prior progress exists for this task: PR ${first.url}${first.branch ? ` (branch ${first.branch})` : ""} was opened by an earlier run.`,
231
+ "Check its current state first (diff, checks, review). If the work is already complete and checks are green,",
232
+ "run `rig-agent completion-verification` to merge and close instead of re-implementing anything."
233
+ ].join(" ");
234
+ } catch {}
235
+ }
236
+ return null;
237
+ }
217
238
  function firstPromptString(...values) {
218
239
  for (const value of values) {
219
240
  const trimmed = typeof value === "string" ? value.trim() : "";
@@ -314,6 +314,7 @@ ${acceptance}` : null,
314
314
  ${sourceContractLines.join(`
315
315
  `)}` : null,
316
316
  scopeText || renderSourceScopeValidation(sourceTask, sourceValidation) || null,
317
+ readPriorPrProgressForPrompt(input.projectRoot, input.taskId),
317
318
  initialPrompt ? `Additional operator guidance:
318
319
  ${initialPrompt}` : null,
319
320
  providerLines.length > 0 ? `Provider-specific runtime tooling:
@@ -323,6 +324,26 @@ ${providerLines.join(" ")}` : null,
323
324
 
324
325
  `);
325
326
  }
327
+ function readPriorPrProgressForPrompt(projectRoot, taskId) {
328
+ for (const candidate of [
329
+ resolve3(projectRoot, ".worktrees", taskId, "artifacts", taskId, "pr-state.json"),
330
+ resolve3(projectRoot, "artifacts", taskId, "pr-state.json")
331
+ ]) {
332
+ try {
333
+ const raw = JSON.parse(readFileSync(candidate, "utf8"));
334
+ const entries = Array.isArray(raw) ? raw : [raw];
335
+ const first = entries.find((entry) => entry && typeof entry === "object" && typeof entry.url === "string");
336
+ if (!first)
337
+ continue;
338
+ return [
339
+ `Prior progress exists for this task: PR ${first.url}${first.branch ? ` (branch ${first.branch})` : ""} was opened by an earlier run.`,
340
+ "Check its current state first (diff, checks, review). If the work is already complete and checks are green,",
341
+ "run `rig-agent completion-verification` to merge and close instead of re-implementing anything."
342
+ ].join(" ");
343
+ } catch {}
344
+ }
345
+ return null;
346
+ }
326
347
  function firstPromptString(...values) {
327
348
  for (const value of values) {
328
349
  const trimmed = typeof value === "string" ? value.trim() : "";
@@ -1874,52 +1874,50 @@ import { intro, log as log2, note as note2, outro } from "@clack/prompts";
1874
1874
  import pc2 from "picocolors";
1875
1875
  var TOP_LEVEL_SECTIONS = [
1876
1876
  {
1877
- title: "Server",
1878
- subtitle: "choose the local or remote Rig server that owns this repo",
1877
+ title: "Start here",
1878
+ subtitle: "one-time setup for a repo",
1879
1879
  commands: [
1880
- { command: "rig server status", description: "Show the selected local/remote server for this repo." },
1881
- { command: "rig server use local", description: "Switch this repo back to the local Rig server." },
1882
- { command: "rig server add <alias> <url>", description: "Save a remote Rig server alias." },
1883
- { command: "rig server use <alias>", description: "Switch this repo to a saved remote server." },
1884
- { command: "rig server list", description: "Show saved server aliases, including local." }
1880
+ { command: "rig init", description: "Wizard: config, GitHub auth, task source, server, Pi wiring." },
1881
+ { command: "rig doctor", description: "Check every part of the wiring \u2014 run this when anything feels off." },
1882
+ { command: "rig server use <alias|local>", description: "Pick which Rig server owns this repo (`rig server list` to see them)." }
1885
1883
  ]
1886
1884
  },
1887
1885
  {
1888
- title: "Tasks",
1889
- subtitle: "find work, inspect it, and submit Pi-backed workers",
1886
+ title: "Work",
1887
+ subtitle: "find a task and put an agent on it",
1890
1888
  commands: [
1891
- { command: "rig task list", description: "List tasks from the selected task source/server." },
1892
- { command: "rig task next", description: "Show the next matching task as a selected-task card." },
1893
- { command: "rig task show <id>", description: "Show a human task summary; add --raw or --json for the full payload." },
1894
- { command: "rig task run <id|--next> [--detach]", description: "Submit a task run; interactive mode follows with bundled Pi." }
1889
+ { command: "rig task list", description: "What's on the board (from the selected source/server)." },
1890
+ { command: "rig task next", description: "The next ready task, as a card." },
1891
+ { command: "rig task run --next", description: "Dispatch an agent; interactive mode opens the native Pi session." },
1892
+ { command: "rig task run <id> --detach", description: "Fire-and-forget a specific task." }
1895
1893
  ]
1896
1894
  },
1897
1895
  {
1898
- title: "Runs",
1899
- subtitle: "observe, attach to, and stop live or recent runs",
1896
+ title: "Watch & steer",
1897
+ subtitle: "live runs are observable and steerable, attached or not",
1900
1898
  commands: [
1901
- { command: "rig run list", description: "List recent runs from the selected server or local state." },
1902
- { command: "rig run show <id>", description: "Show a human run summary; add --raw or --json for the full payload." },
1903
- { command: "rig run attach <id> --follow", description: "Open the native bundled Pi live view for a worker run." },
1904
- { command: "rig run stop <id>", description: "Request cancellation for a running worker." }
1899
+ { command: "rig run status", description: "Active and recent runs at a glance." },
1900
+ { command: "rig run attach <id> --follow", description: "Join the live Pi session (worker keeps running if you /detach)." },
1901
+ { command: "rig run steer <id> -m <text>", description: "Drop a message into a live worker without attaching." },
1902
+ { command: "rig run stop <id>", description: "Cancel a running worker." }
1905
1903
  ]
1906
1904
  },
1907
1905
  {
1908
- title: "Review / inbox",
1909
- subtitle: "clear blocked runs and configure completion review",
1906
+ title: "Unblock & gate",
1907
+ subtitle: "answer what workers ask; control what merges",
1910
1908
  commands: [
1911
- { command: "rig inbox approvals", description: "List pending approval requests from local/server run state." },
1912
- { command: "rig inbox inputs", description: "List pending user-input requests from local/server run state." },
1913
- { command: "rig review show|set", description: "Inspect or change the review gate policy." }
1909
+ { command: "rig inbox approvals", description: "Approvals workers are waiting on (then `rig inbox approve \u2026`)." },
1910
+ { command: "rig inbox inputs", description: "Questions workers asked (then `rig inbox respond \u2026`)." },
1911
+ { command: "rig review show|set", description: "The completion review gate (Greptile is mandatory on merges)." }
1914
1912
  ]
1915
1913
  },
1916
1914
  {
1917
- title: "Health / setup",
1918
- subtitle: "bootstrap and diagnose the repo/server/GitHub/Pi path",
1915
+ title: "Extend",
1916
+ subtitle: "more Pi, more plugins",
1919
1917
  commands: [
1920
- { command: "rig init", description: "Interactive setup: config, GitHub auth, task source, server, checkout, Pi." },
1921
- { command: "rig doctor", description: "Diagnose project/server/GitHub/task/Pi wiring." },
1922
- { command: "rig github auth status", description: "Show GitHub auth state on the selected Rig server." }
1918
+ { command: "rig pi search <term>", description: "Discover community Pi extensions on npm." },
1919
+ { command: "rig pi add <pkg>", description: "Add a Pi extension to this project (workers pick it up too)." },
1920
+ { command: "rig plugin list", description: "What the rig.config.ts plugins contribute." }
1923
1921
  ]
1924
1922
  }
1925
1923
  ];
@@ -2069,7 +2067,19 @@ var PRIMARY_GROUPS = [
2069
2067
  var ADVANCED_GROUPS = [
2070
2068
  { 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." }] },
2071
2069
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
2072
- { 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." }] },
2070
+ {
2071
+ name: "inspect",
2072
+ summary: "Inspect logs, artifacts, graphs, failures for a task.",
2073
+ usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff> --task <id>"],
2074
+ commands: [
2075
+ { command: "logs --task <id>", description: "Latest run log for a task (local or selected server)." },
2076
+ { command: "artifacts --task <id>", description: "List the task's completion artifacts." },
2077
+ { command: "failures --task <id>", description: "Recorded failures for a task." },
2078
+ { command: "graph", description: "Task dependency graph." },
2079
+ { command: "audit", description: "Controlled-command audit trail." },
2080
+ { command: "diff --task <id>", description: "Changed files for a task." }
2081
+ ]
2082
+ },
2073
2083
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
2074
2084
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
2075
2085
  {
@@ -2121,6 +2131,25 @@ var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
2121
2131
  function heading(title) {
2122
2132
  return pc2.bold(pc2.cyan(title));
2123
2133
  }
2134
+ function renderRigBanner(version) {
2135
+ const m = (s) => pc2.bold(pc2.magenta(s));
2136
+ const c = (s) => pc2.bold(pc2.cyan(s));
2137
+ const y = (s) => pc2.yellow(s);
2138
+ const d = (s) => pc2.dim(s);
2139
+ const lines = [
2140
+ m(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ") + d(" \u2591\u2592\u2593\u2588 "),
2141
+ m(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D ") + d("\u2593\u2592\u2591"),
2142
+ c(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557") + d(" \u2591\u2592"),
2143
+ c(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551") + d(" \u2588\u2593\u2591"),
2144
+ y(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D") + d(" \u2592\u2591"),
2145
+ y(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D "),
2146
+ "",
2147
+ ` ${c("\u25E2\u25E4")} ${pc2.bold("the control rig for autonomous coding agents")} ${m("//")} ${d("you are the operator")}`,
2148
+ version ? ` ${d(`v${version} \xB7 jack in: rig task run --next`)}` : ` ${d("jack in: rig task run --next")}`
2149
+ ];
2150
+ return lines.join(`
2151
+ `);
2152
+ }
2124
2153
  function commandLine(command, description) {
2125
2154
  const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
2126
2155
  return `${pc2.dim("\u2502")} ${pc2.bold(commandColumn)} ${description}`;
@@ -2177,12 +2206,25 @@ function renderGroupHelp(groupName) {
2177
2206
  function shouldUseClackOutput2() {
2178
2207
  return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
2179
2208
  }
2180
- function printTopLevelHelp() {
2209
+ function printTopLevelHelp(state = {}) {
2181
2210
  if (!shouldUseClackOutput2()) {
2182
2211
  console.log(renderTopLevelHelp());
2183
2212
  return;
2184
2213
  }
2185
- intro("rig");
2214
+ console.log(renderRigBanner(state.version));
2215
+ console.log("");
2216
+ if (state.projectInitialized === false) {
2217
+ intro("no rig project in this directory");
2218
+ note2([
2219
+ commandLine("rig init", "Set this repo up: config, GitHub auth, task source, server, Pi."),
2220
+ commandLine("rig init --yes", "Same, non-interactive, sensible defaults."),
2221
+ commandLine("rig doctor", "Already initialized somewhere else? Check the wiring.")
2222
+ ].join(`
2223
+ `), "Get started");
2224
+ outro("After init: rig task run --next puts an agent on your next task.");
2225
+ return;
2226
+ }
2227
+ intro(state.selectedServer ? `server: ${state.selectedServer}` : "rig");
2186
2228
  for (const section of TOP_LEVEL_SECTIONS) {
2187
2229
  note2(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
2188
2230
  }
@@ -2193,7 +2235,7 @@ function printTopLevelHelp() {
2193
2235
  commandLine("--dry-run", "Print the command plan without mutating state.")
2194
2236
  ].join(`
2195
2237
  `), "Global options");
2196
- outro("Server \u2192 task \u2192 run \u2192 inbox/review.");
2238
+ outro("init \u2192 task run \u2192 watch/steer \u2192 inbox/review \u2192 merged.");
2197
2239
  }
2198
2240
  function printGroupHelpDocument(groupName) {
2199
2241
  const rendered = renderGroupHelp(groupName) ?? renderTopLevelHelp();
@@ -337,7 +337,8 @@ var init_plugin = __esm(() => {
337
337
  // packages/cli/src/commands.ts
338
338
  init_runner();
339
339
  import {
340
- existsSync as existsSync15
340
+ existsSync as existsSync15,
341
+ readFileSync as readFileSync12
341
342
  } from "fs";
342
343
  import { resolve as resolve24 } from "path";
343
344
  import { readBuildConfig } from "@rig/runtime/build-time-config";
@@ -6111,6 +6112,7 @@ ${acceptance}` : null,
6111
6112
  ${sourceContractLines.join(`
6112
6113
  `)}` : null,
6113
6114
  scopeText || renderSourceScopeValidation(sourceTask, sourceValidation) || null,
6115
+ readPriorPrProgressForPrompt(input.projectRoot, input.taskId),
6114
6116
  initialPrompt ? `Additional operator guidance:
6115
6117
  ${initialPrompt}` : null,
6116
6118
  providerLines.length > 0 ? `Provider-specific runtime tooling:
@@ -6120,6 +6122,26 @@ ${providerLines.join(" ")}` : null,
6120
6122
 
6121
6123
  `);
6122
6124
  }
6125
+ function readPriorPrProgressForPrompt(projectRoot, taskId) {
6126
+ for (const candidate of [
6127
+ resolve19(projectRoot, ".worktrees", taskId, "artifacts", taskId, "pr-state.json"),
6128
+ resolve19(projectRoot, "artifacts", taskId, "pr-state.json")
6129
+ ]) {
6130
+ try {
6131
+ const raw = JSON.parse(readFileSync8(candidate, "utf8"));
6132
+ const entries = Array.isArray(raw) ? raw : [raw];
6133
+ const first = entries.find((entry) => entry && typeof entry === "object" && typeof entry.url === "string");
6134
+ if (!first)
6135
+ continue;
6136
+ return [
6137
+ `Prior progress exists for this task: PR ${first.url}${first.branch ? ` (branch ${first.branch})` : ""} was opened by an earlier run.`,
6138
+ "Check its current state first (diff, checks, review). If the work is already complete and checks are green,",
6139
+ "run `rig-agent completion-verification` to merge and close instead of re-implementing anything."
6140
+ ].join(" ");
6141
+ } catch {}
6142
+ }
6143
+ return null;
6144
+ }
6123
6145
  function firstPromptString(...values) {
6124
6146
  for (const value of values) {
6125
6147
  const trimmed = typeof value === "string" ? value.trim() : "";
@@ -8521,52 +8543,50 @@ import { intro as intro3, log as log4, note as note4, outro as outro3 } from "@c
8521
8543
  import pc4 from "picocolors";
8522
8544
  var TOP_LEVEL_SECTIONS = [
8523
8545
  {
8524
- title: "Server",
8525
- subtitle: "choose the local or remote Rig server that owns this repo",
8546
+ title: "Start here",
8547
+ subtitle: "one-time setup for a repo",
8526
8548
  commands: [
8527
- { command: "rig server status", description: "Show the selected local/remote server for this repo." },
8528
- { command: "rig server use local", description: "Switch this repo back to the local Rig server." },
8529
- { command: "rig server add <alias> <url>", description: "Save a remote Rig server alias." },
8530
- { command: "rig server use <alias>", description: "Switch this repo to a saved remote server." },
8531
- { command: "rig server list", description: "Show saved server aliases, including local." }
8549
+ { command: "rig init", description: "Wizard: config, GitHub auth, task source, server, Pi wiring." },
8550
+ { command: "rig doctor", description: "Check every part of the wiring \u2014 run this when anything feels off." },
8551
+ { command: "rig server use <alias|local>", description: "Pick which Rig server owns this repo (`rig server list` to see them)." }
8532
8552
  ]
8533
8553
  },
8534
8554
  {
8535
- title: "Tasks",
8536
- subtitle: "find work, inspect it, and submit Pi-backed workers",
8555
+ title: "Work",
8556
+ subtitle: "find a task and put an agent on it",
8537
8557
  commands: [
8538
- { command: "rig task list", description: "List tasks from the selected task source/server." },
8539
- { command: "rig task next", description: "Show the next matching task as a selected-task card." },
8540
- { command: "rig task show <id>", description: "Show a human task summary; add --raw or --json for the full payload." },
8541
- { command: "rig task run <id|--next> [--detach]", description: "Submit a task run; interactive mode follows with bundled Pi." }
8558
+ { command: "rig task list", description: "What's on the board (from the selected source/server)." },
8559
+ { command: "rig task next", description: "The next ready task, as a card." },
8560
+ { command: "rig task run --next", description: "Dispatch an agent; interactive mode opens the native Pi session." },
8561
+ { command: "rig task run <id> --detach", description: "Fire-and-forget a specific task." }
8542
8562
  ]
8543
8563
  },
8544
8564
  {
8545
- title: "Runs",
8546
- subtitle: "observe, attach to, and stop live or recent runs",
8565
+ title: "Watch & steer",
8566
+ subtitle: "live runs are observable and steerable, attached or not",
8547
8567
  commands: [
8548
- { command: "rig run list", description: "List recent runs from the selected server or local state." },
8549
- { command: "rig run show <id>", description: "Show a human run summary; add --raw or --json for the full payload." },
8550
- { command: "rig run attach <id> --follow", description: "Open the native bundled Pi live view for a worker run." },
8551
- { command: "rig run stop <id>", description: "Request cancellation for a running worker." }
8568
+ { command: "rig run status", description: "Active and recent runs at a glance." },
8569
+ { command: "rig run attach <id> --follow", description: "Join the live Pi session (worker keeps running if you /detach)." },
8570
+ { command: "rig run steer <id> -m <text>", description: "Drop a message into a live worker without attaching." },
8571
+ { command: "rig run stop <id>", description: "Cancel a running worker." }
8552
8572
  ]
8553
8573
  },
8554
8574
  {
8555
- title: "Review / inbox",
8556
- subtitle: "clear blocked runs and configure completion review",
8575
+ title: "Unblock & gate",
8576
+ subtitle: "answer what workers ask; control what merges",
8557
8577
  commands: [
8558
- { command: "rig inbox approvals", description: "List pending approval requests from local/server run state." },
8559
- { command: "rig inbox inputs", description: "List pending user-input requests from local/server run state." },
8560
- { command: "rig review show|set", description: "Inspect or change the review gate policy." }
8578
+ { command: "rig inbox approvals", description: "Approvals workers are waiting on (then `rig inbox approve \u2026`)." },
8579
+ { command: "rig inbox inputs", description: "Questions workers asked (then `rig inbox respond \u2026`)." },
8580
+ { command: "rig review show|set", description: "The completion review gate (Greptile is mandatory on merges)." }
8561
8581
  ]
8562
8582
  },
8563
8583
  {
8564
- title: "Health / setup",
8565
- subtitle: "bootstrap and diagnose the repo/server/GitHub/Pi path",
8584
+ title: "Extend",
8585
+ subtitle: "more Pi, more plugins",
8566
8586
  commands: [
8567
- { command: "rig init", description: "Interactive setup: config, GitHub auth, task source, server, checkout, Pi." },
8568
- { command: "rig doctor", description: "Diagnose project/server/GitHub/task/Pi wiring." },
8569
- { command: "rig github auth status", description: "Show GitHub auth state on the selected Rig server." }
8587
+ { command: "rig pi search <term>", description: "Discover community Pi extensions on npm." },
8588
+ { command: "rig pi add <pkg>", description: "Add a Pi extension to this project (workers pick it up too)." },
8589
+ { command: "rig plugin list", description: "What the rig.config.ts plugins contribute." }
8570
8590
  ]
8571
8591
  }
8572
8592
  ];
@@ -8716,7 +8736,19 @@ var PRIMARY_GROUPS = [
8716
8736
  var ADVANCED_GROUPS = [
8717
8737
  { 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." }] },
8718
8738
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
8719
- { 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." }] },
8739
+ {
8740
+ name: "inspect",
8741
+ summary: "Inspect logs, artifacts, graphs, failures for a task.",
8742
+ usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff> --task <id>"],
8743
+ commands: [
8744
+ { command: "logs --task <id>", description: "Latest run log for a task (local or selected server)." },
8745
+ { command: "artifacts --task <id>", description: "List the task's completion artifacts." },
8746
+ { command: "failures --task <id>", description: "Recorded failures for a task." },
8747
+ { command: "graph", description: "Task dependency graph." },
8748
+ { command: "audit", description: "Controlled-command audit trail." },
8749
+ { command: "diff --task <id>", description: "Changed files for a task." }
8750
+ ]
8751
+ },
8720
8752
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
8721
8753
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
8722
8754
  {
@@ -8767,13 +8799,32 @@ var ADVANCED_GROUPS = [
8767
8799
  var ADVANCED_COMMANDS = [
8768
8800
  { command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
8769
8801
  { command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
8770
- { command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
8802
+ { command: "rig run start|start-serial|start-parallel", description: "Local epic queue starters (server-owned tasks use `rig task run ...`)." },
8771
8803
  { command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
8772
8804
  ];
8773
8805
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
8774
8806
  function heading(title) {
8775
8807
  return pc4.bold(pc4.cyan(title));
8776
8808
  }
8809
+ function renderRigBanner(version) {
8810
+ const m = (s) => pc4.bold(pc4.magenta(s));
8811
+ const c = (s) => pc4.bold(pc4.cyan(s));
8812
+ const y = (s) => pc4.yellow(s);
8813
+ const d = (s) => pc4.dim(s);
8814
+ const lines = [
8815
+ m(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ") + d(" \u2591\u2592\u2593\u2588 "),
8816
+ m(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D ") + d("\u2593\u2592\u2591"),
8817
+ c(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557") + d(" \u2591\u2592"),
8818
+ c(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551") + d(" \u2588\u2593\u2591"),
8819
+ y(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D") + d(" \u2592\u2591"),
8820
+ y(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D "),
8821
+ "",
8822
+ ` ${c("\u25E2\u25E4")} ${pc4.bold("the control rig for autonomous coding agents")} ${m("//")} ${d("you are the operator")}`,
8823
+ version ? ` ${d(`v${version} \xB7 jack in: rig task run --next`)}` : ` ${d("jack in: rig task run --next")}`
8824
+ ];
8825
+ return lines.join(`
8826
+ `);
8827
+ }
8777
8828
  function commandLine(command, description) {
8778
8829
  const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
8779
8830
  return `${pc4.dim("\u2502")} ${pc4.bold(commandColumn)} ${description}`;
@@ -8847,12 +8898,25 @@ function renderGroupHelp(groupName) {
8847
8898
  function shouldUseClackOutput2() {
8848
8899
  return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
8849
8900
  }
8850
- function printTopLevelHelp() {
8901
+ function printTopLevelHelp(state = {}) {
8851
8902
  if (!shouldUseClackOutput2()) {
8852
8903
  console.log(renderTopLevelHelp());
8853
8904
  return;
8854
8905
  }
8855
- intro3("rig");
8906
+ console.log(renderRigBanner(state.version));
8907
+ console.log("");
8908
+ if (state.projectInitialized === false) {
8909
+ intro3("no rig project in this directory");
8910
+ note4([
8911
+ commandLine("rig init", "Set this repo up: config, GitHub auth, task source, server, Pi."),
8912
+ commandLine("rig init --yes", "Same, non-interactive, sensible defaults."),
8913
+ commandLine("rig doctor", "Already initialized somewhere else? Check the wiring.")
8914
+ ].join(`
8915
+ `), "Get started");
8916
+ outro3("After init: rig task run --next puts an agent on your next task.");
8917
+ return;
8918
+ }
8919
+ intro3(state.selectedServer ? `server: ${state.selectedServer}` : "rig");
8856
8920
  for (const section of TOP_LEVEL_SECTIONS) {
8857
8921
  note4(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
8858
8922
  }
@@ -8863,7 +8927,7 @@ function printTopLevelHelp() {
8863
8927
  commandLine("--dry-run", "Print the command plan without mutating state.")
8864
8928
  ].join(`
8865
8929
  `), "Global options");
8866
- outro3("Server \u2192 task \u2192 run \u2192 inbox/review.");
8930
+ outro3("init \u2192 task run \u2192 watch/steer \u2192 inbox/review \u2192 merged.");
8867
8931
  }
8868
8932
  function printAdvancedHelp() {
8869
8933
  if (!shouldUseClackOutput2()) {
@@ -11729,9 +11793,23 @@ function isHelpArg(arg) {
11729
11793
  function helpText() {
11730
11794
  return renderTopLevelHelp();
11731
11795
  }
11796
+ function resolveTopLevelLaunchState(context) {
11797
+ const projectInitialized = hasInitializedRigProject(context.projectRoot);
11798
+ let selectedServer = null;
11799
+ if (projectInitialized) {
11800
+ try {
11801
+ const statePath = resolve24(context.projectRoot, ".rig", "state", "connection.json");
11802
+ if (existsSync15(statePath)) {
11803
+ const parsed = JSON.parse(readFileSync12(statePath, "utf-8"));
11804
+ selectedServer = parsed.remoteUrl || parsed.url || parsed.selected || null;
11805
+ }
11806
+ } catch {}
11807
+ }
11808
+ return { projectInitialized, selectedServer, version: process.env.RIG_CLI_VERSION || readBuildConfig().RIG_CLI_VERSION || undefined };
11809
+ }
11732
11810
  async function execute(context, args) {
11733
11811
  if (args.length === 0) {
11734
- printTopLevelHelp();
11812
+ printTopLevelHelp(resolveTopLevelLaunchState(context));
11735
11813
  return { ok: true, group: "help", command: "show" };
11736
11814
  }
11737
11815
  const [first, ...rest] = args;
package/dist/src/index.js CHANGED
@@ -527,7 +527,8 @@ var init_plugin = __esm(() => {
527
527
  // packages/cli/src/commands.ts
528
528
  init_runner();
529
529
  import {
530
- existsSync as existsSync16
530
+ existsSync as existsSync16,
531
+ readFileSync as readFileSync12
531
532
  } from "fs";
532
533
  import { resolve as resolve25 } from "path";
533
534
  import { readBuildConfig } from "@rig/runtime/build-time-config";
@@ -6301,6 +6302,7 @@ ${acceptance}` : null,
6301
6302
  ${sourceContractLines.join(`
6302
6303
  `)}` : null,
6303
6304
  scopeText || renderSourceScopeValidation(sourceTask, sourceValidation) || null,
6305
+ readPriorPrProgressForPrompt(input.projectRoot, input.taskId),
6304
6306
  initialPrompt ? `Additional operator guidance:
6305
6307
  ${initialPrompt}` : null,
6306
6308
  providerLines.length > 0 ? `Provider-specific runtime tooling:
@@ -6310,6 +6312,26 @@ ${providerLines.join(" ")}` : null,
6310
6312
 
6311
6313
  `);
6312
6314
  }
6315
+ function readPriorPrProgressForPrompt(projectRoot, taskId) {
6316
+ for (const candidate of [
6317
+ resolve20(projectRoot, ".worktrees", taskId, "artifacts", taskId, "pr-state.json"),
6318
+ resolve20(projectRoot, "artifacts", taskId, "pr-state.json")
6319
+ ]) {
6320
+ try {
6321
+ const raw = JSON.parse(readFileSync8(candidate, "utf8"));
6322
+ const entries = Array.isArray(raw) ? raw : [raw];
6323
+ const first = entries.find((entry) => entry && typeof entry === "object" && typeof entry.url === "string");
6324
+ if (!first)
6325
+ continue;
6326
+ return [
6327
+ `Prior progress exists for this task: PR ${first.url}${first.branch ? ` (branch ${first.branch})` : ""} was opened by an earlier run.`,
6328
+ "Check its current state first (diff, checks, review). If the work is already complete and checks are green,",
6329
+ "run `rig-agent completion-verification` to merge and close instead of re-implementing anything."
6330
+ ].join(" ");
6331
+ } catch {}
6332
+ }
6333
+ return null;
6334
+ }
6313
6335
  function firstPromptString(...values) {
6314
6336
  for (const value of values) {
6315
6337
  const trimmed = typeof value === "string" ? value.trim() : "";
@@ -8711,52 +8733,50 @@ import { intro as intro3, log as log4, note as note4, outro as outro3 } from "@c
8711
8733
  import pc4 from "picocolors";
8712
8734
  var TOP_LEVEL_SECTIONS = [
8713
8735
  {
8714
- title: "Server",
8715
- subtitle: "choose the local or remote Rig server that owns this repo",
8736
+ title: "Start here",
8737
+ subtitle: "one-time setup for a repo",
8716
8738
  commands: [
8717
- { command: "rig server status", description: "Show the selected local/remote server for this repo." },
8718
- { command: "rig server use local", description: "Switch this repo back to the local Rig server." },
8719
- { command: "rig server add <alias> <url>", description: "Save a remote Rig server alias." },
8720
- { command: "rig server use <alias>", description: "Switch this repo to a saved remote server." },
8721
- { command: "rig server list", description: "Show saved server aliases, including local." }
8739
+ { command: "rig init", description: "Wizard: config, GitHub auth, task source, server, Pi wiring." },
8740
+ { command: "rig doctor", description: "Check every part of the wiring \u2014 run this when anything feels off." },
8741
+ { command: "rig server use <alias|local>", description: "Pick which Rig server owns this repo (`rig server list` to see them)." }
8722
8742
  ]
8723
8743
  },
8724
8744
  {
8725
- title: "Tasks",
8726
- subtitle: "find work, inspect it, and submit Pi-backed workers",
8745
+ title: "Work",
8746
+ subtitle: "find a task and put an agent on it",
8727
8747
  commands: [
8728
- { command: "rig task list", description: "List tasks from the selected task source/server." },
8729
- { command: "rig task next", description: "Show the next matching task as a selected-task card." },
8730
- { command: "rig task show <id>", description: "Show a human task summary; add --raw or --json for the full payload." },
8731
- { command: "rig task run <id|--next> [--detach]", description: "Submit a task run; interactive mode follows with bundled Pi." }
8748
+ { command: "rig task list", description: "What's on the board (from the selected source/server)." },
8749
+ { command: "rig task next", description: "The next ready task, as a card." },
8750
+ { command: "rig task run --next", description: "Dispatch an agent; interactive mode opens the native Pi session." },
8751
+ { command: "rig task run <id> --detach", description: "Fire-and-forget a specific task." }
8732
8752
  ]
8733
8753
  },
8734
8754
  {
8735
- title: "Runs",
8736
- subtitle: "observe, attach to, and stop live or recent runs",
8755
+ title: "Watch & steer",
8756
+ subtitle: "live runs are observable and steerable, attached or not",
8737
8757
  commands: [
8738
- { command: "rig run list", description: "List recent runs from the selected server or local state." },
8739
- { command: "rig run show <id>", description: "Show a human run summary; add --raw or --json for the full payload." },
8740
- { command: "rig run attach <id> --follow", description: "Open the native bundled Pi live view for a worker run." },
8741
- { command: "rig run stop <id>", description: "Request cancellation for a running worker." }
8758
+ { command: "rig run status", description: "Active and recent runs at a glance." },
8759
+ { command: "rig run attach <id> --follow", description: "Join the live Pi session (worker keeps running if you /detach)." },
8760
+ { command: "rig run steer <id> -m <text>", description: "Drop a message into a live worker without attaching." },
8761
+ { command: "rig run stop <id>", description: "Cancel a running worker." }
8742
8762
  ]
8743
8763
  },
8744
8764
  {
8745
- title: "Review / inbox",
8746
- subtitle: "clear blocked runs and configure completion review",
8765
+ title: "Unblock & gate",
8766
+ subtitle: "answer what workers ask; control what merges",
8747
8767
  commands: [
8748
- { command: "rig inbox approvals", description: "List pending approval requests from local/server run state." },
8749
- { command: "rig inbox inputs", description: "List pending user-input requests from local/server run state." },
8750
- { command: "rig review show|set", description: "Inspect or change the review gate policy." }
8768
+ { command: "rig inbox approvals", description: "Approvals workers are waiting on (then `rig inbox approve \u2026`)." },
8769
+ { command: "rig inbox inputs", description: "Questions workers asked (then `rig inbox respond \u2026`)." },
8770
+ { command: "rig review show|set", description: "The completion review gate (Greptile is mandatory on merges)." }
8751
8771
  ]
8752
8772
  },
8753
8773
  {
8754
- title: "Health / setup",
8755
- subtitle: "bootstrap and diagnose the repo/server/GitHub/Pi path",
8774
+ title: "Extend",
8775
+ subtitle: "more Pi, more plugins",
8756
8776
  commands: [
8757
- { command: "rig init", description: "Interactive setup: config, GitHub auth, task source, server, checkout, Pi." },
8758
- { command: "rig doctor", description: "Diagnose project/server/GitHub/task/Pi wiring." },
8759
- { command: "rig github auth status", description: "Show GitHub auth state on the selected Rig server." }
8777
+ { command: "rig pi search <term>", description: "Discover community Pi extensions on npm." },
8778
+ { command: "rig pi add <pkg>", description: "Add a Pi extension to this project (workers pick it up too)." },
8779
+ { command: "rig plugin list", description: "What the rig.config.ts plugins contribute." }
8760
8780
  ]
8761
8781
  }
8762
8782
  ];
@@ -8906,7 +8926,19 @@ var PRIMARY_GROUPS = [
8906
8926
  var ADVANCED_GROUPS = [
8907
8927
  { 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." }] },
8908
8928
  { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
8909
- { 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." }] },
8929
+ {
8930
+ name: "inspect",
8931
+ summary: "Inspect logs, artifacts, graphs, failures for a task.",
8932
+ usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff> --task <id>"],
8933
+ commands: [
8934
+ { command: "logs --task <id>", description: "Latest run log for a task (local or selected server)." },
8935
+ { command: "artifacts --task <id>", description: "List the task's completion artifacts." },
8936
+ { command: "failures --task <id>", description: "Recorded failures for a task." },
8937
+ { command: "graph", description: "Task dependency graph." },
8938
+ { command: "audit", description: "Controlled-command audit trail." },
8939
+ { command: "diff --task <id>", description: "Changed files for a task." }
8940
+ ]
8941
+ },
8910
8942
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
8911
8943
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
8912
8944
  {
@@ -8957,13 +8989,32 @@ var ADVANCED_GROUPS = [
8957
8989
  var ADVANCED_COMMANDS = [
8958
8990
  { command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
8959
8991
  { command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
8960
- { command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
8992
+ { command: "rig run start|start-serial|start-parallel", description: "Local epic queue starters (server-owned tasks use `rig task run ...`)." },
8961
8993
  { command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
8962
8994
  ];
8963
8995
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
8964
8996
  function heading(title) {
8965
8997
  return pc4.bold(pc4.cyan(title));
8966
8998
  }
8999
+ function renderRigBanner(version) {
9000
+ const m = (s) => pc4.bold(pc4.magenta(s));
9001
+ const c = (s) => pc4.bold(pc4.cyan(s));
9002
+ const y = (s) => pc4.yellow(s);
9003
+ const d = (s) => pc4.dim(s);
9004
+ const lines = [
9005
+ m(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ") + d(" \u2591\u2592\u2593\u2588 "),
9006
+ m(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D ") + d("\u2593\u2592\u2591"),
9007
+ c(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557") + d(" \u2591\u2592"),
9008
+ c(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551") + d(" \u2588\u2593\u2591"),
9009
+ y(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D") + d(" \u2592\u2591"),
9010
+ y(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D "),
9011
+ "",
9012
+ ` ${c("\u25E2\u25E4")} ${pc4.bold("the control rig for autonomous coding agents")} ${m("//")} ${d("you are the operator")}`,
9013
+ version ? ` ${d(`v${version} \xB7 jack in: rig task run --next`)}` : ` ${d("jack in: rig task run --next")}`
9014
+ ];
9015
+ return lines.join(`
9016
+ `);
9017
+ }
8967
9018
  function commandLine(command, description) {
8968
9019
  const commandColumn = command.length >= 38 ? `${command} ` : command.padEnd(38);
8969
9020
  return `${pc4.dim("\u2502")} ${pc4.bold(commandColumn)} ${description}`;
@@ -9037,12 +9088,25 @@ function renderGroupHelp(groupName) {
9037
9088
  function shouldUseClackOutput2() {
9038
9089
  return Boolean(process.stdout.isTTY) && process.env.RIG_CLI_PLAIN_HELP !== "1";
9039
9090
  }
9040
- function printTopLevelHelp() {
9091
+ function printTopLevelHelp(state = {}) {
9041
9092
  if (!shouldUseClackOutput2()) {
9042
9093
  console.log(renderTopLevelHelp());
9043
9094
  return;
9044
9095
  }
9045
- intro3("rig");
9096
+ console.log(renderRigBanner(state.version));
9097
+ console.log("");
9098
+ if (state.projectInitialized === false) {
9099
+ intro3("no rig project in this directory");
9100
+ note4([
9101
+ commandLine("rig init", "Set this repo up: config, GitHub auth, task source, server, Pi."),
9102
+ commandLine("rig init --yes", "Same, non-interactive, sensible defaults."),
9103
+ commandLine("rig doctor", "Already initialized somewhere else? Check the wiring.")
9104
+ ].join(`
9105
+ `), "Get started");
9106
+ outro3("After init: rig task run --next puts an agent on your next task.");
9107
+ return;
9108
+ }
9109
+ intro3(state.selectedServer ? `server: ${state.selectedServer}` : "rig");
9046
9110
  for (const section of TOP_LEVEL_SECTIONS) {
9047
9111
  note4(renderCommandBlock(section.commands), `${section.title} \u2014 ${section.subtitle}`);
9048
9112
  }
@@ -9053,7 +9117,7 @@ function printTopLevelHelp() {
9053
9117
  commandLine("--dry-run", "Print the command plan without mutating state.")
9054
9118
  ].join(`
9055
9119
  `), "Global options");
9056
- outro3("Server \u2192 task \u2192 run \u2192 inbox/review.");
9120
+ outro3("init \u2192 task run \u2192 watch/steer \u2192 inbox/review \u2192 merged.");
9057
9121
  }
9058
9122
  function printAdvancedHelp() {
9059
9123
  if (!shouldUseClackOutput2()) {
@@ -11919,9 +11983,23 @@ function isHelpArg(arg) {
11919
11983
  function helpText() {
11920
11984
  return renderTopLevelHelp();
11921
11985
  }
11986
+ function resolveTopLevelLaunchState(context) {
11987
+ const projectInitialized = hasInitializedRigProject(context.projectRoot);
11988
+ let selectedServer = null;
11989
+ if (projectInitialized) {
11990
+ try {
11991
+ const statePath = resolve25(context.projectRoot, ".rig", "state", "connection.json");
11992
+ if (existsSync16(statePath)) {
11993
+ const parsed = JSON.parse(readFileSync12(statePath, "utf-8"));
11994
+ selectedServer = parsed.remoteUrl || parsed.url || parsed.selected || null;
11995
+ }
11996
+ } catch {}
11997
+ }
11998
+ return { projectInitialized, selectedServer, version: process.env.RIG_CLI_VERSION || readBuildConfig().RIG_CLI_VERSION || undefined };
11999
+ }
11922
12000
  async function execute(context, args) {
11923
12001
  if (args.length === 0) {
11924
- printTopLevelHelp();
12002
+ printTopLevelHelp(resolveTopLevelLaunchState(context));
11925
12003
  return { ok: true, group: "help", command: "show" };
11926
12004
  }
11927
12005
  const [first, ...rest] = args;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.36",
3
+ "version": "0.0.6-alpha.38",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^1.2.0",
26
- "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.36",
27
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.36",
28
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.36",
29
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.36",
30
- "@rig/server": "npm:@h-rig/server@0.0.6-alpha.36",
26
+ "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.38",
27
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.38",
28
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.38",
29
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.38",
30
+ "@rig/server": "npm:@h-rig/server@0.0.6-alpha.38",
31
31
  "picocolors": "^1.1.1"
32
32
  }
33
33
  }