@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.
- package/dist/bin/rig.js +1505 -907
- package/dist/src/commands/_cli-format.js +211 -6
- package/dist/src/commands/_connection-state.js +1 -3
- package/dist/src/commands/_doctor-checks.js +3 -5
- package/dist/src/commands/_help-catalog.js +251 -66
- package/dist/src/commands/_operator-view.js +1 -3
- package/dist/src/commands/_parsers.js +0 -2
- package/dist/src/commands/_pi-frontend.js +1 -3
- package/dist/src/commands/_pi-worker-bridge-extension.js +1 -3
- package/dist/src/commands/_policy.js +0 -2
- package/dist/src/commands/_preflight.js +2 -4
- package/dist/src/commands/_run-driver-helpers.js +0 -2
- package/dist/src/commands/_server-client.js +1 -3
- package/dist/src/commands/_snapshot-upload.js +1 -3
- package/dist/src/commands/agent.js +7 -9
- package/dist/src/commands/browser.js +4 -6
- package/dist/src/commands/connect.js +5 -6
- package/dist/src/commands/dist.js +4 -6
- package/dist/src/commands/doctor.js +3 -5
- package/dist/src/commands/github.js +1 -3
- package/dist/src/commands/inbox.js +351 -31
- package/dist/src/commands/init.js +3 -5
- package/dist/src/commands/inspect.js +10 -12
- package/dist/src/commands/inspector.js +2 -4
- package/dist/src/commands/plugin.js +76 -22
- package/dist/src/commands/profile-and-review.js +8 -10
- package/dist/src/commands/queue.js +1 -3
- package/dist/src/commands/remote.js +18 -20
- package/dist/src/commands/repo-git-harness.js +6 -8
- package/dist/src/commands/run.js +159 -41
- package/dist/src/commands/server.js +6 -7
- package/dist/src/commands/setup.js +7 -15
- package/dist/src/commands/task-report-bug.js +5 -7
- package/dist/src/commands/task-run-driver.js +1 -3
- package/dist/src/commands/task.js +483 -50
- package/dist/src/commands/test.js +3 -5
- package/dist/src/commands/workspace.js +4 -6
- package/dist/src/commands.js +1508 -901
- package/dist/src/index.js +1511 -916
- package/dist/src/report-bug.js +3 -3
- package/dist/src/runner.js +2 -17
- package/package.json +6 -6
|
@@ -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, "
|
|
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((
|
|
78
|
+
cliCommands: (c.cliCommands ?? []).map((entry) => entry.id)
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
if (context.outputMode === "text") {
|
|
83
|
-
if (
|
|
84
|
-
console.log("No plugins loaded.");
|
|
85
|
-
}
|
|
86
|
-
|
|
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
|
|
115
|
+
details: { declarative }
|
|
124
116
|
};
|
|
125
117
|
}
|
|
126
118
|
case "validate": {
|
|
127
119
|
const { value: task, rest: remaining } = takeOption(rest, "--task");
|
|
128
|
-
requireNoExtraArgs(remaining, "
|
|
129
|
-
const taskId = requireTask(task, "
|
|
130
|
-
const
|
|
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, "
|
|
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:
|
|
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:
|
|
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, "
|
|
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, "
|
|
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:
|
|
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:
|
|
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, "
|
|
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) {
|
|
@@ -151,7 +149,7 @@ async function executeQueue(context, args) {
|
|
|
151
149
|
pending = failFastResult.rest;
|
|
152
150
|
const skipProjectSyncResult = takeFlag(pending, "--skip-project-sync");
|
|
153
151
|
pending = skipProjectSyncResult.rest;
|
|
154
|
-
requireNoExtraArgs(pending, "
|
|
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]");
|
|
155
153
|
const workers = parsePositiveInt(workersResult.value, "--workers", 2);
|
|
156
154
|
const maxTasks = parsePositiveInt(maxTasksResult.value, "--max-tasks", 10);
|
|
157
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, `
|
|
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, `
|
|
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, `
|
|
444
|
-
const taskId = requireTask(taskResult.value, `
|
|
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, "
|
|
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, `
|
|
479
|
-
const orchestrationId = requireTask(idResult.value, `
|
|
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, "
|
|
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, "
|
|
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:
|
|
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,
|
|
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:
|
|
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,
|
|
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
|
}
|