@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
@@ -6,8 +6,6 @@ import { resolve as resolve2 } from "path";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function takeFlag(args, flag) {
@@ -290,7 +288,7 @@ async function executeAgent(context, args) {
290
288
  const [command = "list", ...rest] = args;
291
289
  switch (command) {
292
290
  case "list": {
293
- requireNoExtraArgs(rest, "bun run rig agent list");
291
+ requireNoExtraArgs(rest, "rig agent list");
294
292
  const runtimes = await listAgentRuntimes(context.projectRoot);
295
293
  if (context.outputMode === "text") {
296
294
  if (runtimes.length === 0) {
@@ -311,12 +309,12 @@ async function executeAgent(context, args) {
311
309
  pending = modeResult.rest;
312
310
  const taskResult = takeOption(pending, "--task");
313
311
  pending = taskResult.rest;
314
- requireNoExtraArgs(pending, "bun run rig agent prepare --task <id> [--id <id>] [--mode worktree]");
312
+ requireNoExtraArgs(pending, "rig agent prepare --task <id> [--id <id>] [--mode worktree]");
315
313
  const mode = parseIsolationMode(modeResult.value, false);
316
314
  const id = idResult.value || agentId("agent");
317
315
  const taskId = taskResult.value?.trim();
318
316
  if (!taskId) {
319
- throw new CliError2("Usage: bun run rig agent prepare --task <id> [--id <id>] [--mode worktree]");
317
+ throw new CliError2("Usage: rig agent prepare --task <id> [--id <id>] [--mode worktree]");
320
318
  }
321
319
  const runtime = await withMutedConsole(context.outputMode === "json", () => ensureAgentRuntime({
322
320
  projectRoot: context.projectRoot,
@@ -334,7 +332,7 @@ async function executeAgent(context, args) {
334
332
  case "run": {
335
333
  const { options, commandParts } = splitAtDoubleDash(rest);
336
334
  if (commandParts.length === 0) {
337
- throw new CliError2("Usage: bun run rig agent run [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
335
+ throw new CliError2("Usage: rig agent run [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
338
336
  }
339
337
  let pending = options;
340
338
  const idResult = takeOption(pending, "--id");
@@ -345,12 +343,12 @@ async function executeAgent(context, args) {
345
343
  pending = taskResult.rest;
346
344
  const skipProjectSyncResult = takeFlag(pending, "--skip-project-sync");
347
345
  pending = skipProjectSyncResult.rest;
348
- requireNoExtraArgs(pending, "bun run rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
346
+ requireNoExtraArgs(pending, "rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
349
347
  const mode = parseIsolationMode(modeResult.value, false);
350
348
  const id = idResult.value || agentId("agent-run");
351
349
  const taskId = taskResult.value?.trim();
352
350
  if (!taskId) {
353
- throw new CliError2("Usage: bun run rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
351
+ throw new CliError2("Usage: rig agent run --task <id> [--id <id>] [--mode worktree] [--skip-project-sync] -- <command...>");
354
352
  }
355
353
  await runProjectMainSyncPreflight(context, { disabled: skipProjectSyncResult.value });
356
354
  const createdAt = new Date().toISOString();
@@ -464,7 +462,7 @@ ${result.stderr.trim()}` : ""}`, result.exitCode);
464
462
  pending = allResult.rest;
465
463
  const idResult = takeOption(pending, "--id");
466
464
  pending = idResult.rest;
467
- requireNoExtraArgs(pending, "bun run rig agent cleanup (--id <id> | --all)");
465
+ requireNoExtraArgs(pending, "rig agent cleanup (--id <id> | --all)");
468
466
  if (!allResult.value && !idResult.value) {
469
467
  throw new CliError2("Provide --id <id> or --all.");
470
468
  }
@@ -12,8 +12,6 @@ import pc2 from "picocolors";
12
12
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
13
13
  import { CliError } from "@rig/runtime/control-plane/errors";
14
14
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
15
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
16
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
17
15
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
18
16
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
19
17
  function takeFlag(args, flag) {
@@ -351,7 +349,7 @@ async function executeBrowser(context, args) {
351
349
  return { ok: true, group: "browser", command: "help" };
352
350
  }
353
351
  if (command === "explain") {
354
- requireNoExtraArgs(rest, "bun run rig browser explain");
352
+ requireNoExtraArgs(rest, "rig browser explain");
355
353
  console.log(browserAgentUsageText());
356
354
  return { ok: true, group: "browser", command: "explain" };
357
355
  }
@@ -377,7 +375,7 @@ ${browserHelpText()}`);
377
375
 
378
376
  ${browserHelpText()}`);
379
377
  }
380
- requireNoExtraArgs(appRest, `bun run rig browser ${command} ${subcommand}`);
378
+ requireNoExtraArgs(appRest, `rig browser ${command} ${subcommand}`);
381
379
  await context.runCommand(["bun", "run", `app:${subcommand}:browser:${appSlug}`]);
382
380
  return { ok: true, group: "browser", command: `${command}-${subcommand}` };
383
381
  }
@@ -389,7 +387,7 @@ ${browserHelpText()}`);
389
387
  };
390
388
  const packageScript = packageScripts[command];
391
389
  if (packageScript) {
392
- requireNoExtraArgs(rest, `bun run rig browser ${command}`);
390
+ requireNoExtraArgs(rest, `rig browser ${command}`);
393
391
  await context.runCommand(["bun", "run", "--filter=@rig/browser", packageScript]);
394
392
  return { ok: true, group: "browser", command };
395
393
  }
@@ -416,7 +414,7 @@ async function executeBrowserDemo(context, args) {
416
414
  pending = keepOpenFlag.rest;
417
415
  const noBuildFlag = takeFlag(pending, "--no-build");
418
416
  pending = noBuildFlag.rest;
419
- requireNoExtraArgs(pending, "bun run rig browser demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]");
417
+ requireNoExtraArgs(pending, "rig browser demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]");
420
418
  if (context.outputMode !== "text" || !process.stdin.isTTY || !process.stdout.isTTY) {
421
419
  throw new CliError2("rig browser demo requires an interactive TTY in text mode.");
422
420
  }
@@ -6,8 +6,6 @@ import { cancel, isCancel, select } from "@clack/prompts";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function requireNoExtraArgs(args, usage) {
@@ -107,6 +105,7 @@ function writeRepoConnection(projectRoot, state) {
107
105
  }
108
106
 
109
107
  // packages/cli/src/commands/_cli-format.ts
108
+ import { log, note } from "@clack/prompts";
110
109
  import pc from "picocolors";
111
110
  function truncate(value, width) {
112
111
  if (value.length <= width)
@@ -120,13 +119,13 @@ function pad(value, width) {
120
119
  }
121
120
  function statusColor(status) {
122
121
  const normalized = status.toLowerCase();
123
- if (["completed", "merged", "closed", "done", "accepted", "pass", "selected"].includes(normalized))
122
+ if (["completed", "merged", "closed", "done", "accepted", "pass", "selected", "approved"].includes(normalized))
124
123
  return pc.green;
125
- if (["failed", "needs_attention", "needs-attention", "blocked", "error"].includes(normalized))
124
+ if (["failed", "needs_attention", "needs-attention", "blocked", "error", "rejected"].includes(normalized))
126
125
  return pc.red;
127
126
  if (["running", "reviewing", "validating", "in_progress", "in-progress", "remote"].includes(normalized))
128
127
  return pc.cyan;
129
- if (["ready", "open", "queued", "created", "preparing", "local"].includes(normalized))
128
+ if (["ready", "open", "queued", "created", "preparing", "local", "pending"].includes(normalized))
130
129
  return pc.yellow;
131
130
  return pc.dim;
132
131
  }
@@ -138,7 +137,7 @@ function formatSection(title, subtitle) {
138
137
  return `${pc.bold(pc.cyan("\u25C6"))} ${pc.bold(title)}${subtitle ? pc.dim(` \u2014 ${subtitle}`) : ""}`;
139
138
  }
140
139
  function formatSuccessCard(title, rows = []) {
141
- const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${pc.dim("\u2502")} ${pc.dim(key.padEnd(9))} ${value}`);
140
+ const body = rows.filter(([, value]) => value !== undefined && value !== null && String(value).length > 0).map(([key, value]) => `${pc.dim("\u2502")} ${pc.dim(key.padEnd(12))} ${value}`);
142
141
  return [formatSection(title), ...body].join(`
143
142
  `);
144
143
  }
@@ -19,8 +19,6 @@ import { resolve as resolve3 } from "path";
19
19
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
20
20
  import { CliError } from "@rig/runtime/control-plane/errors";
21
21
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
22
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
23
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
24
22
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
25
23
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
26
24
  function takeOption(args, option) {
@@ -185,7 +183,7 @@ async function executeDist(context, args) {
185
183
  switch (command) {
186
184
  case "build": {
187
185
  const { value: outputDir, rest: pending } = takeOption(rest, "--output-dir");
188
- requireNoExtraArgs(pending, "bun run rig dist build [--output-dir <dir>]");
186
+ requireNoExtraArgs(pending, "rig dist build [--output-dir <dir>]");
189
187
  const commandParts = ["bun", "run", "packages/cli/bin/build-rig-binaries.ts"];
190
188
  if (outputDir) {
191
189
  commandParts.push("--output-dir", outputDir);
@@ -199,7 +197,7 @@ async function executeDist(context, args) {
199
197
  pending = scopeResult.rest;
200
198
  const pathResult = takeOption(pending, "--path");
201
199
  pending = pathResult.rest;
202
- requireNoExtraArgs(pending, "bun run rig dist install [--scope user|system] [--path <dir>]");
200
+ requireNoExtraArgs(pending, "rig dist install [--scope user|system] [--path <dir>]");
203
201
  const scope = parseInstallScope(scopeResult.value);
204
202
  const installDir = resolveInstallDir(scope, pathResult.value);
205
203
  mkdirSync(installDir, { recursive: true });
@@ -242,7 +240,7 @@ async function executeDist(context, args) {
242
240
  };
243
241
  }
244
242
  case "doctor": {
245
- requireNoExtraArgs(rest, "bun run rig dist doctor");
243
+ requireNoExtraArgs(rest, "rig dist doctor");
246
244
  const details = await runDistDoctor(context.projectRoot);
247
245
  if (context.outputMode === "text") {
248
246
  console.log(`bun: ${details.bun.available ? `ok (${details.bun.version})` : "missing"}`);
@@ -253,7 +251,7 @@ async function executeDist(context, args) {
253
251
  return { ok: true, group: "dist", command, details };
254
252
  }
255
253
  case "rebuild-agent": {
256
- requireNoExtraArgs(rest, "bun run rig dist rebuild-agent");
254
+ requireNoExtraArgs(rest, "rig dist rebuild-agent");
257
255
  const fp = await computeRuntimeImageFingerprint(context.projectRoot);
258
256
  const currentId = computeRuntimeImageId(fp);
259
257
  const imagesDir = resolve3(resolveControlPlaneMonorepoRuntimeDir(context.projectRoot), "images");
@@ -5,8 +5,6 @@ var __require = import.meta.require;
5
5
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
6
6
  import { CliError } from "@rig/runtime/control-plane/errors";
7
7
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
8
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
9
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
10
8
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
11
9
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
12
10
  function requireNoExtraArgs(args, usage) {
@@ -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
  }
@@ -409,7 +407,7 @@ async function runRigDoctorChecks(options) {
409
407
  const taskSourceKind = config?.taskSource?.kind;
410
408
  checks.push(taskSourceKind ? check("task-source", "task source configured", "pass", taskSourceKind) : check("task-source", "task source configured", "fail", "missing taskSource", "Configure taskSource in rig.config.ts."));
411
409
  const repo = readRepoConnection(projectRoot);
412
- checks.push(repo ? check("project-link", "repo selected Rig connection", repo.project ? "pass" : "warn", `${repo.selected}${repo.project ? ` -> ${repo.project}` : ""}`, "Run `rig init --yes --repo owner/repo` to link this checkout to a GitHub repo slug.") : check("project-link", "repo selected Rig connection", "fail", "missing .rig/state/connection.json", "Run `rig init` or `rig connect use <alias|local>`."));
410
+ checks.push(repo ? check("project-link", "repo selected Rig server", repo.project ? "pass" : "warn", `${repo.selected}${repo.project ? ` -> ${repo.project}` : ""}`, "Run `rig init --yes --repo owner/repo` to link this checkout to a GitHub repo slug.") : check("project-link", "repo selected Rig server", "fail", "missing .rig/state/connection.json", "Run `rig init` or `rig server use <alias|local>`."));
413
411
  const selected = (() => {
414
412
  try {
415
413
  return resolveSelectedConnection(projectRoot);
@@ -417,7 +415,7 @@ async function runRigDoctorChecks(options) {
417
415
  return null;
418
416
  }
419
417
  })();
420
- checks.push(selected ? check("connection", "selected server connection", "pass", selected.connection.kind === "remote" ? selected.connection.baseUrl : "local auto") : check("connection", "selected server connection", repo ? "fail" : "warn", repo ? "selected alias is missing" : "will auto-start local server", repo ? "Run `rig connect list` and `rig connect use <alias|local>`." : undefined));
418
+ checks.push(selected ? check("connection", "selected server connection", "pass", selected.connection.kind === "remote" ? selected.connection.baseUrl : "local auto") : check("connection", "selected server", repo ? "fail" : "warn", repo ? "selected alias is missing" : "will auto-start local server", repo ? "Run `rig server list` and `rig server use <alias|local>`." : undefined));
421
419
  let server = null;
422
420
  try {
423
421
  server = await (options.resolveServer ?? ensureServerForCli)(projectRoot);
@@ -6,8 +6,6 @@ import { spawnSync } from "child_process";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function takeOption(args, option) {
@@ -113,7 +111,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
113
111
  const global = readGlobalConnections(options);
114
112
  const connection = global.connections[repo.selected];
115
113
  if (!connection) {
116
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
114
+ throw new CliError2(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
117
115
  }
118
116
  return { alias: repo.selected, connection };
119
117
  }