@h-rig/cli 0.0.6-alpha.3 → 0.0.6-alpha.30

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 (47) hide show
  1. package/dist/bin/rig.js +3606 -1172
  2. package/dist/src/commands/_authority-runs.js +1 -0
  3. package/dist/src/commands/_cli-format.js +369 -0
  4. package/dist/src/commands/_connection-state.js +1 -3
  5. package/dist/src/commands/_doctor-checks.js +13 -27
  6. package/dist/src/commands/_help-catalog.js +388 -0
  7. package/dist/src/commands/_operator-surface.js +204 -0
  8. package/dist/src/commands/_operator-view.js +861 -56
  9. package/dist/src/commands/_parsers.js +0 -2
  10. package/dist/src/commands/_pi-frontend.js +841 -0
  11. package/dist/src/commands/_pi-install.js +4 -3
  12. package/dist/src/commands/_pi-worker-bridge-extension.js +759 -0
  13. package/dist/src/commands/_policy.js +0 -2
  14. package/dist/src/commands/_preflight.js +32 -109
  15. package/dist/src/commands/_run-driver-helpers.js +0 -2
  16. package/dist/src/commands/_server-client.js +161 -31
  17. package/dist/src/commands/_snapshot-upload.js +8 -23
  18. package/dist/src/commands/_task-picker.js +44 -16
  19. package/dist/src/commands/agent.js +9 -9
  20. package/dist/src/commands/browser.js +4 -6
  21. package/dist/src/commands/connect.js +132 -25
  22. package/dist/src/commands/dist.js +4 -6
  23. package/dist/src/commands/doctor.js +13 -27
  24. package/dist/src/commands/github.js +10 -25
  25. package/dist/src/commands/inbox.js +351 -31
  26. package/dist/src/commands/init.js +298 -71
  27. package/dist/src/commands/inspect.js +10 -12
  28. package/dist/src/commands/inspector.js +2 -4
  29. package/dist/src/commands/plugin.js +76 -22
  30. package/dist/src/commands/profile-and-review.js +8 -10
  31. package/dist/src/commands/queue.js +2 -3
  32. package/dist/src/commands/remote.js +18 -20
  33. package/dist/src/commands/repo-git-harness.js +6 -8
  34. package/dist/src/commands/run.js +1157 -122
  35. package/dist/src/commands/server.js +217 -33
  36. package/dist/src/commands/setup.js +17 -37
  37. package/dist/src/commands/task-report-bug.js +5 -7
  38. package/dist/src/commands/task-run-driver.js +660 -73
  39. package/dist/src/commands/task.js +1542 -252
  40. package/dist/src/commands/test.js +3 -5
  41. package/dist/src/commands/workspace.js +4 -6
  42. package/dist/src/commands.js +3599 -1159
  43. package/dist/src/index.js +3646 -1215
  44. package/dist/src/launcher.js +5 -3
  45. package/dist/src/report-bug.js +3 -3
  46. package/dist/src/runner.js +5 -19
  47. package/package.json +6 -4
@@ -7,8 +7,6 @@ import { resolve } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
  function takeOption(args, option) {
@@ -60,8 +58,8 @@ async function executeInspect(context, args) {
60
58
  switch (command) {
61
59
  case "logs": {
62
60
  const { value: task, rest: remaining } = takeOption(rest, "--task");
63
- requireNoExtraArgs(remaining, "bun run rig inspect logs --task <beads-id>");
64
- const requiredTask = requireTask(task, "bun run rig inspect logs --task <beads-id>");
61
+ requireNoExtraArgs(remaining, "rig inspect logs --task <task-id>");
62
+ const requiredTask = requireTask(task, "rig inspect logs --task <task-id>");
65
63
  const latestRun = listAuthorityRuns(context.projectRoot).map((entry) => readAuthorityRun(context.projectRoot, entry.runId)).filter((run) => Boolean(run)).filter((run) => run.taskId === requiredTask).sort((left, right) => String(right.updatedAt ?? "").localeCompare(String(left.updatedAt ?? "")))[0];
66
64
  if (!latestRun) {
67
65
  throw new CliError2(`No runs found for ${requiredTask}.`);
@@ -75,8 +73,8 @@ async function executeInspect(context, args) {
75
73
  }
76
74
  case "artifacts": {
77
75
  const { value: task, rest: remaining } = takeOption(rest, "--task");
78
- requireNoExtraArgs(remaining, "bun run rig inspect artifacts --task <beads-id>");
79
- const requiredTask = requireTask(task, "bun run rig inspect artifacts --task <beads-id>");
76
+ requireNoExtraArgs(remaining, "rig inspect artifacts --task <task-id>");
77
+ const requiredTask = requireTask(task, "rig inspect artifacts --task <task-id>");
80
78
  const artifactRoot = resolveTaskArtifactDirs(context.projectRoot, requiredTask).find((path) => existsSync(path));
81
79
  if (!artifactRoot) {
82
80
  throw new CliError2(`No artifacts found for ${requiredTask}.`);
@@ -90,8 +88,8 @@ async function executeInspect(context, args) {
90
88
  previewPending = task.rest;
91
89
  const file = takeOption(previewPending, "--file");
92
90
  previewPending = file.rest;
93
- requireNoExtraArgs(previewPending, "bun run rig inspect artifact --task <beads-id> --file <name>");
94
- const requiredTask = requireTask(task.value, "bun run rig inspect artifact --task <beads-id> --file <name>");
91
+ requireNoExtraArgs(previewPending, "rig inspect artifact --task <task-id> --file <name>");
92
+ const requiredTask = requireTask(task.value, "rig inspect artifact --task <task-id> --file <name>");
95
93
  if (!file.value) {
96
94
  throw new CliError2("Missing --file for rig inspect artifact.");
97
95
  }
@@ -120,7 +118,7 @@ async function executeInspect(context, args) {
120
118
  }
121
119
  case "diff": {
122
120
  const { value: task, rest: remaining } = takeOption(rest, "--task");
123
- requireNoExtraArgs(remaining, "bun run rig inspect diff [--task <beads-id>]");
121
+ requireNoExtraArgs(remaining, "rig inspect diff [--task <task-id>]");
124
122
  if (task) {
125
123
  const files = changedFilesForTask(context.projectRoot, task, false);
126
124
  for (const file of files) {
@@ -132,7 +130,7 @@ async function executeInspect(context, args) {
132
130
  return { ok: true, group: "inspect", command, details: { task: task || null } };
133
131
  }
134
132
  case "failures": {
135
- requireNoExtraArgs(rest, "bun run rig inspect failures");
133
+ requireNoExtraArgs(rest, "rig inspect failures");
136
134
  const failed = resolveHarnessPaths(context.projectRoot).failedApproachesPath;
137
135
  if (!existsSync(failed)) {
138
136
  console.log("No failures recorded.");
@@ -142,7 +140,7 @@ async function executeInspect(context, args) {
142
140
  return { ok: true, group: "inspect", command };
143
141
  }
144
142
  case "graph":
145
- requireNoExtraArgs(rest, "bun run rig inspect graph");
143
+ requireNoExtraArgs(rest, "rig inspect graph");
146
144
  {
147
145
  const monorepoRoot = resolveMonorepoRoot(context.projectRoot);
148
146
  const result = runCapture(["br", "--no-db", "list", "--pretty"], monorepoRoot);
@@ -153,7 +151,7 @@ async function executeInspect(context, args) {
153
151
  }
154
152
  return { ok: true, group: "inspect", command };
155
153
  case "audit": {
156
- requireNoExtraArgs(rest, "bun run rig inspect audit");
154
+ requireNoExtraArgs(rest, "rig inspect audit");
157
155
  const auditPath = resolve(resolveHarnessPaths(context.projectRoot).logsDir, "audit.jsonl");
158
156
  if (!existsSync(auditPath)) {
159
157
  console.log("No audit log found.");
@@ -6,8 +6,6 @@ import { iterateServerSentEvents } from "@rig/client";
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) {
@@ -104,7 +102,7 @@ async function executeInspector(context, args) {
104
102
  pending = secondsResult.rest;
105
103
  const pollMsResult = takeOption(pending, "--poll-ms");
106
104
  pending = pollMsResult.rest;
107
- requireNoExtraArgs(pending, "bun run rig inspector stream [--once] [--seconds <n>] [--poll-ms <n>]");
105
+ requireNoExtraArgs(pending, "rig inspector stream [--once] [--seconds <n>] [--poll-ms <n>]");
108
106
  const seconds = secondsResult.value ? parseRequiredPositiveInt(secondsResult.value, "--seconds") : null;
109
107
  const pollMs = pollMsResult.value ? parseRequiredPositiveInt(pollMsResult.value, "--poll-ms") : null;
110
108
  if (context.outputMode === "json" && !onceResult.value && !seconds) {
@@ -198,7 +196,7 @@ async function executeInspector(context, args) {
198
196
  let pending = rest;
199
197
  const scanIdResult = takeOption(pending, "--scan-id");
200
198
  pending = scanIdResult.rest;
201
- requireNoExtraArgs(pending, "bun run rig inspector scan-upstream-drift [--scan-id <id>]");
199
+ requireNoExtraArgs(pending, "rig inspector scan-upstream-drift [--scan-id <id>]");
202
200
  const connection = await ensureLocalRigServerConnection(context.projectRoot);
203
201
  const response = await fetch(new URL("/api/inspector/tools/invoke", connection.baseUrl), {
204
202
  method: "POST",
@@ -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 takeOption(args, option) {
@@ -43,6 +41,9 @@ Usage: ${usage}`);
43
41
  return taskId;
44
42
  }
45
43
 
44
+ // packages/cli/src/commands/plugin.ts
45
+ import { buildPluginHostContext } from "@rig/runtime/control-plane/plugin-host-context";
46
+
46
47
  // packages/cli/src/commands/_parsers.ts
47
48
  async function loadRigConfigOrNull(projectRoot) {
48
49
  try {
@@ -58,8 +59,7 @@ async function executePlugin(context, args) {
58
59
  const [command = "list", ...rest] = args;
59
60
  switch (command) {
60
61
  case "list": {
61
- requireNoExtraArgs(rest, "bun run rig plugin list");
62
- const legacyPlugins = context.plugins.list();
62
+ requireNoExtraArgs(rest, "rig plugin list");
63
63
  const declarative = [];
64
64
  const config = await loadRigConfigOrNull(context.projectRoot);
65
65
  if (config && Array.isArray(config.plugins)) {
@@ -75,16 +75,15 @@ async function executePlugin(context, args) {
75
75
  taskSources: (c.taskSources ?? []).map((s) => s.id),
76
76
  skills: (c.skills ?? []).map((s) => s.id),
77
77
  taskFieldExtensions: (c.taskFieldSchemas ?? []).map((f) => f.id),
78
- cliCommands: (c.cliCommands ?? []).map((c2) => c2.id)
78
+ cliCommands: (c.cliCommands ?? []).map((entry) => entry.id)
79
79
  });
80
80
  }
81
81
  }
82
82
  if (context.outputMode === "text") {
83
- if (legacyPlugins.length === 0 && declarative.length === 0) {
84
- console.log("No plugins loaded.");
85
- }
86
- if (declarative.length > 0) {
87
- console.log("Declarative plugins (rig.config.ts):");
83
+ if (declarative.length === 0) {
84
+ console.log("No plugins loaded. Declare plugins in rig.config.ts.");
85
+ } else {
86
+ console.log("Plugins (rig.config.ts):");
88
87
  for (const p of declarative) {
89
88
  console.log(` ${p.name}@${p.version}`);
90
89
  const lines = [];
@@ -103,31 +102,45 @@ async function executePlugin(context, args) {
103
102
  if (p.taskFieldExtensions.length)
104
103
  lines.push(` task-fields: ${p.taskFieldExtensions.join(", ")}`);
105
104
  if (p.cliCommands.length)
106
- lines.push(` cli-commands: ${p.cliCommands.join(", ")}`);
105
+ lines.push(` cli-commands: ${p.cliCommands.join(", ")} (run with \`rig plugin run <id>\`)`);
107
106
  for (const line of lines)
108
107
  console.log(line);
109
108
  }
110
109
  }
111
- if (legacyPlugins.length > 0) {
112
- console.log("Legacy disk-scan plugins (rig/plugins/):");
113
- for (const plugin of legacyPlugins) {
114
- const validators = plugin.validators.length > 0 ? plugin.validators.join(", ") : "none";
115
- console.log(` ${plugin.name} (validators: ${validators})`);
116
- }
117
- }
118
110
  }
119
111
  return {
120
112
  ok: true,
121
113
  group: "plugin",
122
114
  command,
123
- details: { declarative, legacy: legacyPlugins }
115
+ details: { declarative }
124
116
  };
125
117
  }
126
118
  case "validate": {
127
119
  const { value: task, rest: remaining } = takeOption(rest, "--task");
128
- requireNoExtraArgs(remaining, "bun run rig plugin validate --task <beads-id>");
129
- const taskId = requireTask(task, "bun run rig plugin validate --task <beads-id>");
130
- const results = await context.plugins.runValidators(taskId);
120
+ requireNoExtraArgs(remaining, "rig plugin validate --task <task-id>");
121
+ const taskId = requireTask(task, "rig plugin validate --task <task-id>");
122
+ const hostCtx = await buildPluginHostContext(context.projectRoot);
123
+ if (!hostCtx) {
124
+ throw new CliError2(`No rig.config found at ${context.projectRoot}. Run \`rig init\` to set up plugins.`, 2);
125
+ }
126
+ const validators = hostCtx.validatorRegistry.list();
127
+ const results = [];
128
+ for (const validator of validators) {
129
+ try {
130
+ results.push(await validator.run({
131
+ taskId,
132
+ workspaceRoot: context.projectRoot,
133
+ scope: []
134
+ }));
135
+ } catch (error) {
136
+ results.push({
137
+ id: validator.id,
138
+ passed: false,
139
+ summary: `${validator.id} failed unexpectedly`,
140
+ details: `${error}`
141
+ });
142
+ }
143
+ }
131
144
  const passed = results.filter((result) => result.passed).length;
132
145
  const failed = results.length - passed;
133
146
  if (context.outputMode === "text") {
@@ -158,10 +171,51 @@ async function executePlugin(context, args) {
158
171
  }
159
172
  };
160
173
  }
174
+ case "run": {
175
+ const [commandId, ...commandArgs] = rest;
176
+ if (!commandId) {
177
+ throw new CliError2("Usage: rig plugin run <command-id> [args...]");
178
+ }
179
+ const hostCtx = await buildPluginHostContext(context.projectRoot);
180
+ if (!hostCtx) {
181
+ throw new CliError2(`No rig.config found at ${context.projectRoot}. Run \`rig init\` to set up plugins.`, 2);
182
+ }
183
+ const registration = resolvePluginCliCommand(hostCtx.pluginHost.listCliCommands(), commandId);
184
+ if (!registration) {
185
+ const available = hostCtx.pluginHost.listCliCommands().map((entry) => entry.id);
186
+ throw new CliError2(available.length > 0 ? `Unknown plugin command "${commandId}". Available: ${available.join(", ")}` : `No plugin CLI commands are registered. Plugins contribute them via contributes.cliCommands.`, 2);
187
+ }
188
+ if (context.dryRun) {
189
+ if (context.outputMode === "text") {
190
+ console.log(`[dry-run] ${registration.command}${commandArgs.length ? ` ${commandArgs.join(" ")}` : ""}`);
191
+ }
192
+ return { ok: true, group: "plugin", command, details: { id: registration.id, dryRun: true } };
193
+ }
194
+ const proc = Bun.spawn(["bash", "-c", `${registration.command} "$@"`, registration.id, ...commandArgs], {
195
+ cwd: context.projectRoot,
196
+ env: process.env,
197
+ stdin: "inherit",
198
+ stdout: "inherit",
199
+ stderr: "inherit"
200
+ });
201
+ const exitCode = await proc.exited;
202
+ if (exitCode !== 0) {
203
+ throw new CliError2(`Plugin command "${registration.id}" exited with code ${exitCode}.`, exitCode);
204
+ }
205
+ return { ok: true, group: "plugin", command, details: { id: registration.id, exitCode } };
206
+ }
161
207
  default:
162
208
  throw new CliError2(`Unknown plugin command: ${command}`);
163
209
  }
164
210
  }
211
+ function resolvePluginCliCommand(commands, requested) {
212
+ const exact = commands.find((entry) => entry.id === requested);
213
+ if (exact)
214
+ return exact;
215
+ const byLocalPart = commands.filter((entry) => entry.id.split(":").slice(1).join(":") === requested);
216
+ return byLocalPart.length === 1 ? byLocalPart[0] : undefined;
217
+ }
165
218
  export {
219
+ resolvePluginCliCommand,
166
220
  executePlugin
167
221
  };
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeOption(args, option) {
@@ -86,17 +84,17 @@ async function executeProfile(context, args) {
86
84
  const [command = "show", ...rest] = args;
87
85
  switch (command) {
88
86
  case "show":
89
- requireNoExtraArgs(rest, "bun run rig profile show");
87
+ requireNoExtraArgs(rest, "rig profile show");
90
88
  await withMutedConsole(context.outputMode === "json", () => showProfile(context.projectRoot));
91
89
  return { ok: true, group: "profile", command };
92
90
  case "set": {
93
91
  if (rest.length === 0) {
94
- throw new CliError2("Usage: bun run rig profile set <claude-code|codex-cli|pi> or set [--model ...] [--runtime ...] [--plugin ...]");
92
+ throw new CliError2("Usage: rig profile set <claude-code|codex-cli|pi> or set [--model ...] [--runtime ...] [--plugin ...]");
95
93
  }
96
94
  const preset = rest[0];
97
95
  if (preset && !preset.startsWith("-")) {
98
96
  if (rest.length !== 1) {
99
- throw new CliError2("Usage: bun run rig profile set <claude-code|codex-cli|pi>");
97
+ throw new CliError2("Usage: rig profile set <claude-code|codex-cli|pi>");
100
98
  }
101
99
  try {
102
100
  await withMutedConsole(context.outputMode === "json", () => setProfile(context.projectRoot, { preset }));
@@ -112,7 +110,7 @@ async function executeProfile(context, args) {
112
110
  pending = runtimeResult.rest;
113
111
  const pluginResult = takeOption(pending, "--plugin");
114
112
  pending = pluginResult.rest;
115
- requireNoExtraArgs(pending, "bun run rig profile set [--model ...] [--runtime ...] [--plugin ...]");
113
+ requireNoExtraArgs(pending, "rig profile set [--model ...] [--runtime ...] [--plugin ...]");
116
114
  if (!modelResult.value && !runtimeResult.value && !pluginResult.value) {
117
115
  throw new CliError2("Provide at least one of --model, --runtime, or --plugin.");
118
116
  }
@@ -144,21 +142,21 @@ async function executeReview(context, args) {
144
142
  const [command = "show", ...rest] = args;
145
143
  switch (command) {
146
144
  case "show":
147
- requireNoExtraArgs(rest, "bun run rig review show");
145
+ requireNoExtraArgs(rest, "rig review show");
148
146
  await withMutedConsole(context.outputMode === "json", () => showReviewProfile(context.projectRoot));
149
147
  return { ok: true, group: "review", command };
150
148
  case "set": {
151
149
  if (rest.length === 0) {
152
- throw new CliError2("Usage: bun run rig review set <off|advisory|required> [--provider greptile]");
150
+ throw new CliError2("Usage: rig review set <off|advisory|required> [--provider greptile]");
153
151
  }
154
152
  const mode = rest[0];
155
153
  if (!mode) {
156
- throw new CliError2("Usage: bun run rig review set <off|advisory|required> [--provider greptile]");
154
+ throw new CliError2("Usage: rig review set <off|advisory|required> [--provider greptile]");
157
155
  }
158
156
  let pending = rest.slice(1);
159
157
  const providerResult = takeOption(pending, "--provider");
160
158
  pending = providerResult.rest;
161
- requireNoExtraArgs(pending, "bun run rig review set <off|advisory|required> [--provider greptile]");
159
+ requireNoExtraArgs(pending, "rig review set <off|advisory|required> [--provider greptile]");
162
160
  try {
163
161
  await withMutedConsole(context.outputMode === "json", () => {
164
162
  return setReviewProfile(context.projectRoot, mode, providerResult.value);
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeFlag(args, flag) {
@@ -90,6 +88,7 @@ import { ensureProjectMainFreshBeforeRun } from "@rig/runtime/control-plane/proj
90
88
 
91
89
  // packages/cli/src/commands/_server-client.ts
92
90
  import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
91
+ var scopedGitHubBearerTokens = new Map;
93
92
 
94
93
  // packages/cli/src/commands/_preflight.ts
95
94
  async function runProjectMainSyncPreflight(context, options) {
@@ -150,7 +149,7 @@ async function executeQueue(context, args) {
150
149
  pending = failFastResult.rest;
151
150
  const skipProjectSyncResult = takeFlag(pending, "--skip-project-sync");
152
151
  pending = skipProjectSyncResult.rest;
153
- requireNoExtraArgs(pending, "bun run rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]");
152
+ requireNoExtraArgs(pending, "rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]");
154
153
  const workers = parsePositiveInt(workersResult.value, "--workers", 2);
155
154
  const maxTasks = parsePositiveInt(maxTasksResult.value, "--max-tasks", 10);
156
155
  const action = parseAction(actionResult.value);
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeFlag(args, flag) {
@@ -134,7 +132,7 @@ async function executeRemote(context, args) {
134
132
  const [subcommand = "list", ...subRest] = rest;
135
133
  switch (subcommand) {
136
134
  case "list": {
137
- requireNoExtraArgs(subRest, "bun run rig remote endpoint list");
135
+ requireNoExtraArgs(subRest, "rig remote endpoint list");
138
136
  const endpoints = listManagedRemoteEndpoints(undefined, context.projectRoot);
139
137
  const redactedEndpoints = endpoints.map((endpoint2) => redactRemoteEndpoint(endpoint2));
140
138
  if (context.outputMode === "text") {
@@ -158,7 +156,7 @@ async function executeRemote(context, args) {
158
156
  pending2 = port.rest;
159
157
  const token = takeOption(pending2, "--token");
160
158
  pending2 = token.rest;
161
- requireNoExtraArgs(pending2, "bun run rig remote endpoint add --alias <a> --host <h> --port <n> --token <t>");
159
+ requireNoExtraArgs(pending2, "rig remote endpoint add --alias <a> --host <h> --port <n> --token <t>");
162
160
  if (!alias.value || !host.value || !token.value || !port.value) {
163
161
  throw new CliError2("remote endpoint add requires --alias, --host, --port, and --token.");
164
162
  }
@@ -185,7 +183,7 @@ async function executeRemote(context, args) {
185
183
  pending2 = port.rest;
186
184
  const token = takeOption(pending2, "--token");
187
185
  pending2 = token.rest;
188
- requireNoExtraArgs(pending2, "bun run rig remote endpoint update --id <id> [--alias <a>] [--host <h>] [--port <n>] [--token <t>]");
186
+ requireNoExtraArgs(pending2, "rig remote endpoint update --id <id> [--alias <a>] [--host <h>] [--port <n>] [--token <t>]");
189
187
  if (!endpointId.value && !alias.value) {
190
188
  throw new CliError2("remote endpoint update requires --id <id> or --alias <a>.");
191
189
  }
@@ -208,7 +206,7 @@ async function executeRemote(context, args) {
208
206
  let pending2 = subRest;
209
207
  const alias = takeOption(pending2, "--alias");
210
208
  pending2 = alias.rest;
211
- requireNoExtraArgs(pending2, "bun run rig remote endpoint remove --alias <a>");
209
+ requireNoExtraArgs(pending2, "rig remote endpoint remove --alias <a>");
212
210
  if (!alias.value) {
213
211
  throw new CliError2("remote endpoint remove requires --alias.");
214
212
  }
@@ -225,7 +223,7 @@ async function executeRemote(context, args) {
225
223
  let pending2 = subRest;
226
224
  const alias = takeOption(pending2, "--alias");
227
225
  pending2 = alias.rest;
228
- requireNoExtraArgs(pending2, "bun run rig remote endpoint test --alias <a>");
226
+ requireNoExtraArgs(pending2, "rig remote endpoint test --alias <a>");
229
227
  if (!alias.value) {
230
228
  throw new CliError2("remote endpoint test requires --alias.");
231
229
  }
@@ -256,7 +254,7 @@ async function executeRemote(context, args) {
256
254
  }
257
255
  }
258
256
  case "migrate": {
259
- requireNoExtraArgs(subRest, "bun run rig remote endpoint migrate");
257
+ requireNoExtraArgs(subRest, "rig remote endpoint migrate");
260
258
  const result = migrateManagedRemoteEndpoints(context.projectRoot);
261
259
  if (context.outputMode === "text") {
262
260
  console.log(`Imported ${result.imported} endpoint(s) from ${result.sourcePath}${result.skipped > 0 ? `, skipped ${result.skipped}` : ""}.`);
@@ -264,7 +262,7 @@ async function executeRemote(context, args) {
264
262
  return { ok: true, group: "remote", command: "endpoint migrate", details: result };
265
263
  }
266
264
  case "doctor": {
267
- requireNoExtraArgs(subRest, "bun run rig remote endpoint doctor");
265
+ requireNoExtraArgs(subRest, "rig remote endpoint doctor");
268
266
  const result = doctorManagedRemoteEndpoints(context.projectRoot);
269
267
  if (context.outputMode === "text") {
270
268
  console.log(JSON.stringify(result, null, 2));
@@ -317,17 +315,17 @@ async function executeRemote(context, args) {
317
315
  try {
318
316
  switch (command) {
319
317
  case "test": {
320
- requireNoExtraArgs(pending, "bun run rig remote test [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
318
+ requireNoExtraArgs(pending, "rig remote test [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
321
319
  const response = await withClient((client) => client.ping());
322
320
  return { ok: true, group: "remote", command, details: toDetails(response) };
323
321
  }
324
322
  case "status": {
325
- requireNoExtraArgs(pending, "bun run rig remote status [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
323
+ requireNoExtraArgs(pending, "rig remote status [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
326
324
  const response = await withClient((client) => client.getState());
327
325
  return { ok: true, group: "remote", command, details: toDetails(response) };
328
326
  }
329
327
  case "tasks": {
330
- requireNoExtraArgs(pending, "bun run rig remote tasks [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
328
+ requireNoExtraArgs(pending, "rig remote tasks [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
331
329
  const response = await withClient((client) => client.getTasks());
332
330
  return { ok: true, group: "remote", command, details: toDetails(response) };
333
331
  }
@@ -337,7 +335,7 @@ async function executeRemote(context, args) {
337
335
  watchPending = secondsResult.rest;
338
336
  const eventResult = takeOption(watchPending, "--event");
339
337
  watchPending = eventResult.rest;
340
- requireNoExtraArgs(watchPending, "bun run rig remote watch [--seconds <n>] [--event <type>] [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
338
+ requireNoExtraArgs(watchPending, "rig remote watch [--seconds <n>] [--event <type>] [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]");
341
339
  const seconds = parseOptionalPositiveInt(secondsResult.value, "--seconds");
342
340
  const eventFilter = eventResult.value || undefined;
343
341
  if (context.outputMode === "json" && !seconds) {
@@ -406,7 +404,7 @@ async function executeRemote(context, args) {
406
404
  case "stop":
407
405
  case "continue":
408
406
  case "refresh": {
409
- requireNoExtraArgs(pending, `bun run rig remote ${command} [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
407
+ requireNoExtraArgs(pending, `rig remote ${command} [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
410
408
  const response = await withClient(async (client) => {
411
409
  switch (command) {
412
410
  case "pause":
@@ -429,7 +427,7 @@ async function executeRemote(context, args) {
429
427
  let countPending = pending;
430
428
  const countResult = takeOption(countPending, "--count");
431
429
  countPending = countResult.rest;
432
- requireNoExtraArgs(countPending, `bun run rig remote ${command} --count <n> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
430
+ requireNoExtraArgs(countPending, `rig remote ${command} --count <n> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
433
431
  const count = parseRequiredPositiveInt(countResult.value, "--count");
434
432
  const response = await withClient(async (client) => command === "add-iterations" ? await client.addIterations(count) : await client.removeIterations(count));
435
433
  assertRemoteOperationSuccess(command, response);
@@ -440,8 +438,8 @@ async function executeRemote(context, args) {
440
438
  let taskPending = pending;
441
439
  const taskResult = takeOption(taskPending, "--task");
442
440
  taskPending = taskResult.rest;
443
- requireNoExtraArgs(taskPending, `bun run rig remote ${command} --task <id> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
444
- const taskId = requireTask(taskResult.value, `bun run rig remote ${command} --task <id>`);
441
+ requireNoExtraArgs(taskPending, `rig remote ${command} --task <id> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
442
+ const taskId = requireTask(taskResult.value, `rig remote ${command} --task <id>`);
445
443
  const response = await withClient(async (client) => command === "prompt-preview" ? await client.getPromptPreview(taskId) : await client.getIterationOutput(taskId));
446
444
  assertRemoteOperationSuccess(command, response);
447
445
  return { ok: true, group: "remote", command, details: toDetails(response) };
@@ -454,7 +452,7 @@ async function executeRemote(context, args) {
454
452
  orchestrationPending = maxIterationsResult.rest;
455
453
  const directMergeResult = takeFlag(orchestrationPending, "--direct-merge");
456
454
  orchestrationPending = directMergeResult.rest;
457
- requireNoExtraArgs(orchestrationPending, "bun run rig remote orchestrate-start [--max-workers <n>] [--max-iterations <n>] [--direct-merge]");
455
+ requireNoExtraArgs(orchestrationPending, "rig remote orchestrate-start [--max-workers <n>] [--max-iterations <n>] [--direct-merge]");
458
456
  const response = await withClient((client) => client.startOrchestration({
459
457
  maxWorkers: parseOptionalPositiveInt(maxWorkersResult.value, "--max-workers"),
460
458
  maxIterations: parseOptionalPositiveInt(maxIterationsResult.value, "--max-iterations"),
@@ -475,8 +473,8 @@ async function executeRemote(context, args) {
475
473
  let orchestrationPending = pending;
476
474
  const idResult = takeOption(orchestrationPending, "--id");
477
475
  orchestrationPending = idResult.rest;
478
- requireNoExtraArgs(orchestrationPending, `bun run rig remote ${command} --id <orch-id> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
479
- const orchestrationId = requireTask(idResult.value, `bun run rig remote ${command} --id <orch-id> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
476
+ requireNoExtraArgs(orchestrationPending, `rig remote ${command} --id <orch-id> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
477
+ const orchestrationId = requireTask(idResult.value, `rig remote ${command} --id <orch-id> [--remote <alias>] [--host <host>] [--port <n>] [--token <token>]`);
480
478
  const response = await withClient(async (client) => {
481
479
  switch (command) {
482
480
  case "orchestrate-pause":
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function formatCommand(parts) {
@@ -158,13 +156,13 @@ async function executeRepo(context, args) {
158
156
  switch (command) {
159
157
  case "sync": {
160
158
  const { value: task, rest: remaining } = takeOption(rest, "--task");
161
- requireNoExtraArgs(remaining, "bun run rig repo sync [--task <beads-id>]");
159
+ requireNoExtraArgs(remaining, "rig repo sync [--task <task-id>]");
162
160
  withMutedConsole(context.outputMode === "json", () => repoEnsure(context.projectRoot, task || undefined));
163
161
  return { ok: true, group: "repo", command, details: { task: task || null } };
164
162
  }
165
163
  case "reset-baseline": {
166
164
  const { value: keepTaskStatusFlag, rest: remaining } = takeFlag(rest, "--keep-task-status");
167
- requireNoExtraArgs(remaining, "bun run rig repo reset-baseline [--keep-task-status]");
165
+ requireNoExtraArgs(remaining, "rig repo reset-baseline [--keep-task-status]");
168
166
  withMutedConsole(context.outputMode === "json", () => resetBaseline(context.projectRoot, keepTaskStatusFlag));
169
167
  return { ok: true, group: "repo", command, details: { keepTaskStatus: keepTaskStatusFlag } };
170
168
  }
@@ -174,7 +172,7 @@ async function executeRepo(context, args) {
174
172
  }
175
173
  async function executeGit(context, args) {
176
174
  if (args.length === 0) {
177
- throw new CliError2("Usage: bun run rig git <git-flow args...>");
175
+ throw new CliError2("Usage: rig git <git-flow args...>");
178
176
  }
179
177
  await enforceNativeCommandPolicy(context, args, {
180
178
  commandPrefix: "rig-agent git",
@@ -187,7 +185,7 @@ async function executeGit(context, args) {
187
185
  return { ok: true, group: "git", command: args[0] ?? "git" };
188
186
  }
189
187
  try {
190
- await executeHarnessCommand(context.projectRoot, context.plugins, ["git", ...args]);
188
+ await executeHarnessCommand(context.projectRoot, ["git", ...args]);
191
189
  } catch (error) {
192
190
  throw new CliError2(error instanceof Error ? error.message : String(error), 2);
193
191
  }
@@ -195,7 +193,7 @@ async function executeGit(context, args) {
195
193
  }
196
194
  async function executeHarness(context, args) {
197
195
  if (args.length === 0) {
198
- throw new CliError2("Usage: bun run rig harness <harness args...>");
196
+ throw new CliError2("Usage: rig harness <harness args...>");
199
197
  }
200
198
  await enforceNativeCommandPolicy(context, args, {
201
199
  commandPrefix: "rig-agent",
@@ -208,7 +206,7 @@ async function executeHarness(context, args) {
208
206
  return { ok: true, group: "harness", command: args[0] ?? "harness" };
209
207
  }
210
208
  try {
211
- await executeHarnessCommand(context.projectRoot, context.plugins, args);
209
+ await executeHarnessCommand(context.projectRoot, args);
212
210
  } catch (error) {
213
211
  throw new CliError2(error instanceof Error ? error.message : String(error), 2);
214
212
  }