@h-rig/cli 0.0.6-alpha.9 → 0.0.6-alpha.91
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/README.md +18 -19
- package/dist/bin/build-rig-binaries.d.ts +2 -0
- package/dist/bin/build-rig-binaries.js +22 -10
- package/dist/bin/rig.d.ts +72 -0
- package/dist/bin/rig.js +15637 -7344
- package/dist/config/rig-default-config.yml +5 -0
- package/dist/src/app/drone-ui.d.ts +34 -0
- package/dist/src/app/drone-ui.js +278 -0
- package/dist/src/commands/_async-ui.d.ts +10 -0
- package/dist/src/commands/_async-ui.js +121 -0
- package/dist/src/commands/_cli-format.d.ts +56 -0
- package/dist/src/commands/_cli-format.js +319 -0
- package/dist/src/commands/_connection-state.d.ts +54 -0
- package/dist/src/commands/_connection-state.js +75 -11
- package/dist/src/commands/_doctor-checks.d.ts +46 -0
- package/dist/src/commands/_doctor-checks.js +100 -267
- package/dist/src/commands/_help-catalog.d.ts +51 -0
- package/dist/src/commands/_help-catalog.js +502 -0
- package/dist/src/commands/_inprocess-services.d.ts +33 -0
- package/dist/src/commands/_inprocess-services.js +102 -0
- package/dist/src/commands/_json-output.d.ts +11 -0
- package/dist/src/commands/_json-output.js +60 -0
- package/dist/src/commands/_lazy-reconcile.d.ts +34 -0
- package/dist/src/commands/_lazy-reconcile.js +102 -0
- package/dist/src/commands/_parsers.d.ts +15 -0
- package/dist/src/commands/_parsers.js +18 -11
- package/dist/src/commands/_paths.d.ts +11 -0
- package/dist/src/commands/_paths.js +1 -1
- package/dist/src/commands/_pi-frontend.d.ts +35 -0
- package/dist/src/commands/_pi-frontend.js +64 -0
- package/dist/src/commands/_pi-install.d.ts +42 -0
- package/dist/src/commands/_pi-install.js +19 -36
- package/dist/src/commands/_policy.d.ts +8 -0
- package/dist/src/commands/_policy.js +67 -19
- package/dist/src/commands/_probes.d.ts +1 -0
- package/dist/src/commands/_run-bridge.d.ts +114 -0
- package/dist/src/commands/_run-bridge.js +387 -0
- package/dist/src/commands/_run-diagnostics.d.ts +9 -0
- package/dist/src/commands/_run-diagnostics.js +51 -0
- package/dist/src/commands/_run-driver-helpers.d.ts +26 -0
- package/dist/src/commands/_run-driver-helpers.js +79 -230
- package/dist/src/commands/_run-projection.d.ts +50 -0
- package/dist/src/commands/_run-projection.js +349 -0
- package/dist/src/commands/_run-subcommands.d.ts +3 -0
- package/dist/src/commands/_run-subcommands.js +31 -0
- package/dist/src/commands/_spinner.d.ts +25 -0
- package/dist/src/commands/_spinner.js +65 -0
- package/dist/src/commands/agent.d.ts +3 -0
- package/dist/src/commands/agent.js +8575 -236
- package/dist/src/commands/dist.d.ts +28 -0
- package/dist/src/commands/dist.js +44 -29
- package/dist/src/commands/doctor.d.ts +3 -0
- package/dist/src/commands/doctor.js +219 -268
- package/dist/src/commands/github.d.ts +3 -0
- package/dist/src/commands/github.js +236 -188
- package/dist/src/commands/inbox.d.ts +28 -0
- package/dist/src/commands/inbox.js +530 -111
- package/dist/src/commands/init.d.ts +64 -0
- package/dist/src/commands/init.js +912 -705
- package/dist/src/commands/inspect.d.ts +20 -0
- package/dist/src/commands/inspect.js +709 -119
- package/dist/src/commands/pi.d.ts +3 -0
- package/dist/src/commands/pi.js +177 -0
- package/dist/src/commands/plugin.d.ts +16 -0
- package/dist/src/commands/plugin.js +576 -29
- package/dist/src/commands/profile-and-review.d.ts +4 -0
- package/dist/src/commands/profile-and-review.js +112 -67
- package/dist/src/commands/queue.d.ts +3 -0
- package/dist/src/commands/queue.js +20 -20
- package/dist/src/commands/remote.d.ts +3 -0
- package/dist/src/commands/remote.js +880 -50
- package/dist/src/commands/repo-git-harness.d.ts +5 -0
- package/dist/src/commands/repo-git-harness.js +78 -28
- package/dist/src/commands/run.d.ts +21 -0
- package/dist/src/commands/run.js +17701 -661
- package/dist/src/commands/server.d.ts +3 -0
- package/dist/src/commands/server.js +166 -303
- package/dist/src/commands/setup.d.ts +16 -0
- package/dist/src/commands/setup.js +244 -299
- package/dist/src/commands/stats.d.ts +15 -0
- package/dist/src/commands/stats.js +979 -0
- package/dist/src/commands/task-run-driver.d.ts +94 -0
- package/dist/src/commands/task-run-driver.js +116 -1961
- package/dist/src/commands/task.d.ts +35 -0
- package/dist/src/commands/task.js +676 -1201
- package/dist/src/commands/test.d.ts +3 -0
- package/dist/src/commands/test.js +15 -8
- package/dist/src/commands/triage.d.ts +11 -0
- package/dist/src/commands/triage.js +227 -0
- package/dist/src/commands/workspace.d.ts +3 -0
- package/dist/src/commands/workspace.js +18 -11
- package/dist/src/commands.d.ts +13 -0
- package/dist/src/commands.js +16792 -8055
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +16862 -8450
- package/dist/src/launcher.d.ts +61 -0
- package/dist/src/launcher.js +81 -13
- package/dist/src/operator-cli.d.ts +2 -0
- package/dist/src/operator-cli.js +17837 -0
- package/dist/src/operator-entry.d.ts +1 -0
- package/dist/src/operator-entry.js +3 -0
- package/dist/src/runner.d.ts +47 -0
- package/dist/src/runner.js +16 -22
- package/dist/src/withMutedConsole.d.ts +2 -0
- package/package.json +21 -8
- package/dist/src/commands/_authority-runs.js +0 -111
- package/dist/src/commands/_operator-view.js +0 -340
- package/dist/src/commands/_preflight.js +0 -478
- package/dist/src/commands/_server-client.js +0 -382
- package/dist/src/commands/_snapshot-upload.js +0 -331
- package/dist/src/commands/_task-picker.js +0 -48
- package/dist/src/commands/browser.js +0 -890
- package/dist/src/commands/connect.js +0 -180
- package/dist/src/commands/inspector.js +0 -256
- package/dist/src/commands/task-report-bug.js +0 -1083
- package/dist/src/report-bug.js +0 -260
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
// packages/cli/src/commands/profile-and-review.ts
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
4
|
+
|
|
2
5
|
// packages/cli/src/runner.ts
|
|
3
6
|
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
4
|
-
import { CliError } from "@rig/runtime/control-plane/errors";
|
|
7
|
+
import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
|
|
5
8
|
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
9
|
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
class CliError extends RuntimeCliError {
|
|
12
|
+
hint;
|
|
13
|
+
constructor(message, exitCode = 1, options = {}) {
|
|
14
|
+
super(message, exitCode);
|
|
15
|
+
if (options.hint?.trim()) {
|
|
16
|
+
this.hint = options.hint.trim();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
function takeOption(args, option) {
|
|
11
21
|
const rest = [];
|
|
12
22
|
let value;
|
|
@@ -15,7 +25,7 @@ function takeOption(args, option) {
|
|
|
15
25
|
if (current === option) {
|
|
16
26
|
const next = args[index + 1];
|
|
17
27
|
if (!next || next.startsWith("-")) {
|
|
18
|
-
throw new CliError(`Missing value for ${option}`);
|
|
28
|
+
throw new CliError(`Missing value for ${option}`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} <value>\`.` });
|
|
19
29
|
}
|
|
20
30
|
value = next;
|
|
21
31
|
index += 1;
|
|
@@ -34,14 +44,6 @@ Usage: ${usage}`);
|
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
|
|
37
|
-
// packages/cli/src/commands/profile-and-review.ts
|
|
38
|
-
import {
|
|
39
|
-
setProfile,
|
|
40
|
-
setReviewProfile,
|
|
41
|
-
showProfile,
|
|
42
|
-
showReviewProfile
|
|
43
|
-
} from "@rig/runtime/control-plane/native/profile-ops";
|
|
44
|
-
|
|
45
47
|
// packages/cli/src/withMutedConsole.ts
|
|
46
48
|
function isPromise(value) {
|
|
47
49
|
if (typeof value !== "object" && typeof value !== "function") {
|
|
@@ -81,95 +83,138 @@ function withMutedConsole(mute, fn) {
|
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
// packages/cli/src/commands/_paths.ts
|
|
87
|
+
import { resolve } from "path";
|
|
88
|
+
import { resolveMonorepoRoot } from "@rig/runtime/layout";
|
|
89
|
+
function resolveControlPlaneHostStateRoot(projectRoot) {
|
|
90
|
+
return resolve(projectRoot, ".rig");
|
|
91
|
+
}
|
|
92
|
+
function resolveControlPlaneHostStateDir(projectRoot) {
|
|
93
|
+
return resolve(resolveControlPlaneHostStateRoot(projectRoot), "state");
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
// packages/cli/src/commands/profile-and-review.ts
|
|
97
|
+
var DEFAULT_AGENT_PROFILE = {
|
|
98
|
+
model: "pi",
|
|
99
|
+
runtime: "pi",
|
|
100
|
+
agent_plugin: "pi",
|
|
101
|
+
updated_at: new Date().toISOString()
|
|
102
|
+
};
|
|
103
|
+
function agentProfilePath(projectRoot) {
|
|
104
|
+
return `${resolveControlPlaneHostStateDir(projectRoot)}/agent-profile.json`;
|
|
105
|
+
}
|
|
106
|
+
function reviewProfilePath(projectRoot) {
|
|
107
|
+
return `${resolveControlPlaneHostStateDir(projectRoot)}/review-profile.json`;
|
|
108
|
+
}
|
|
109
|
+
function readJson(path) {
|
|
110
|
+
if (!existsSync(path))
|
|
111
|
+
return null;
|
|
112
|
+
try {
|
|
113
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function showProfile(projectRoot) {
|
|
119
|
+
const profile = { ...DEFAULT_AGENT_PROFILE, ...readJson(agentProfilePath(projectRoot)), model: "pi", runtime: "pi", agent_plugin: "pi" };
|
|
120
|
+
console.log("Execution Profile:");
|
|
121
|
+
console.log(` model: ${profile.model}`);
|
|
122
|
+
console.log(` runtime: ${profile.runtime}`);
|
|
123
|
+
console.log(` plugin: ${profile.agent_plugin}`);
|
|
124
|
+
}
|
|
125
|
+
async function setProfile(projectRoot) {
|
|
126
|
+
mkdirSync(resolveControlPlaneHostStateDir(projectRoot), { recursive: true });
|
|
127
|
+
writeFileSync(agentProfilePath(projectRoot), `${JSON.stringify({ ...DEFAULT_AGENT_PROFILE, updated_at: new Date().toISOString() }, null, 2)}
|
|
128
|
+
`, "utf8");
|
|
129
|
+
await showProfile(projectRoot);
|
|
130
|
+
}
|
|
131
|
+
async function showReviewProfile(projectRoot) {
|
|
132
|
+
const parsed = readJson(reviewProfilePath(projectRoot));
|
|
133
|
+
const profile = {
|
|
134
|
+
mode: parsed?.mode === "off" || parsed?.mode === "required" || parsed?.mode === "advisory" ? parsed.mode : "advisory",
|
|
135
|
+
provider: "greptile",
|
|
136
|
+
updated_at: typeof parsed?.updated_at === "string" ? parsed.updated_at : new Date().toISOString()
|
|
137
|
+
};
|
|
138
|
+
console.log("AI Review Profile:");
|
|
139
|
+
console.log(` mode: ${profile.mode}`);
|
|
140
|
+
console.log(` provider: ${profile.provider}`);
|
|
141
|
+
console.log(` file: ${reviewProfilePath(projectRoot)}`);
|
|
142
|
+
}
|
|
143
|
+
async function setReviewProfile(projectRoot, mode, provider) {
|
|
144
|
+
if (mode !== "off" && mode !== "advisory" && mode !== "required") {
|
|
145
|
+
throw new Error(`Invalid mode: ${mode}. Use off|advisory|required.`);
|
|
146
|
+
}
|
|
147
|
+
if (provider && provider !== "greptile") {
|
|
148
|
+
throw new Error(`Invalid provider: ${provider}. Supported: greptile.`);
|
|
149
|
+
}
|
|
150
|
+
mkdirSync(resolveControlPlaneHostStateDir(projectRoot), { recursive: true });
|
|
151
|
+
writeFileSync(reviewProfilePath(projectRoot), `${JSON.stringify({ mode, provider: "greptile", updated_at: new Date().toISOString() }, null, 2)}
|
|
152
|
+
`, "utf8");
|
|
153
|
+
await showReviewProfile(projectRoot);
|
|
154
|
+
}
|
|
85
155
|
async function executeProfile(context, args) {
|
|
86
156
|
const [command = "show", ...rest] = args;
|
|
87
157
|
switch (command) {
|
|
88
158
|
case "show":
|
|
89
|
-
requireNoExtraArgs(rest, "
|
|
159
|
+
requireNoExtraArgs(rest, "rig profile show");
|
|
90
160
|
await withMutedConsole(context.outputMode === "json", () => showProfile(context.projectRoot));
|
|
91
161
|
return { ok: true, group: "profile", command };
|
|
92
162
|
case "set": {
|
|
93
|
-
if (rest.length === 0) {
|
|
94
|
-
throw new CliError2("Usage: bun run rig profile set <claude-code|codex-cli|pi> or set [--model ...] [--runtime ...] [--plugin ...]");
|
|
95
|
-
}
|
|
96
|
-
const preset = rest[0];
|
|
97
|
-
if (preset && !preset.startsWith("-")) {
|
|
98
|
-
if (rest.length !== 1) {
|
|
99
|
-
throw new CliError2("Usage: bun run rig profile set <claude-code|codex-cli|pi>");
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
await withMutedConsole(context.outputMode === "json", () => setProfile(context.projectRoot, { preset }));
|
|
103
|
-
} catch (error) {
|
|
104
|
-
throw new CliError2(error instanceof Error ? error.message : String(error), 2);
|
|
105
|
-
}
|
|
106
|
-
return { ok: true, group: "profile", command, details: { preset } };
|
|
107
|
-
}
|
|
108
163
|
let pending = rest;
|
|
164
|
+
const presetResult = takeOption(pending, "--preset");
|
|
165
|
+
pending = presetResult.rest;
|
|
109
166
|
const modelResult = takeOption(pending, "--model");
|
|
110
167
|
pending = modelResult.rest;
|
|
111
168
|
const runtimeResult = takeOption(pending, "--runtime");
|
|
112
169
|
pending = runtimeResult.rest;
|
|
113
170
|
const pluginResult = takeOption(pending, "--plugin");
|
|
114
171
|
pending = pluginResult.rest;
|
|
115
|
-
requireNoExtraArgs(pending, "
|
|
116
|
-
if (!modelResult.value && !runtimeResult.value && !pluginResult.value) {
|
|
117
|
-
throw new
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
await withMutedConsole(context.outputMode === "json", () => setProfile(context.projectRoot, {
|
|
121
|
-
model: modelResult.value,
|
|
122
|
-
runtime: runtimeResult.value,
|
|
123
|
-
plugin: pluginResult.value
|
|
124
|
-
}));
|
|
125
|
-
} catch (error) {
|
|
126
|
-
throw new CliError2(error instanceof Error ? error.message : String(error), 2);
|
|
172
|
+
requireNoExtraArgs(pending, "rig profile set [--model ...] [--runtime ...] [--plugin ...]");
|
|
173
|
+
if (!presetResult.value && !modelResult.value && !runtimeResult.value && !pluginResult.value && rest.length === 0) {
|
|
174
|
+
throw new CliError("Provide at least one of --model, --runtime, or --plugin.", 1, {
|
|
175
|
+
hint: "Example: `rig profile set --model pi`. See current values with `rig profile show`."
|
|
176
|
+
});
|
|
127
177
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
group: "profile",
|
|
131
|
-
command,
|
|
132
|
-
details: {
|
|
133
|
-
model: modelResult.value || null,
|
|
134
|
-
runtime: runtimeResult.value || null,
|
|
135
|
-
plugin: pluginResult.value || null
|
|
136
|
-
}
|
|
137
|
-
};
|
|
178
|
+
await withMutedConsole(context.outputMode === "json", () => setProfile(context.projectRoot));
|
|
179
|
+
return { ok: true, group: "profile", command, details: { lockedTo: "pi" } };
|
|
138
180
|
}
|
|
139
181
|
default:
|
|
140
|
-
throw new
|
|
182
|
+
throw new CliError(`Unknown profile command: ${command}`, 1, { hint: "Run `rig profile --help` \u2014 commands are show|set." });
|
|
141
183
|
}
|
|
142
184
|
}
|
|
143
185
|
async function executeReview(context, args) {
|
|
144
186
|
const [command = "show", ...rest] = args;
|
|
145
187
|
switch (command) {
|
|
146
188
|
case "show":
|
|
147
|
-
requireNoExtraArgs(rest, "
|
|
189
|
+
requireNoExtraArgs(rest, "rig review show");
|
|
148
190
|
await withMutedConsole(context.outputMode === "json", () => showReviewProfile(context.projectRoot));
|
|
149
191
|
return { ok: true, group: "review", command };
|
|
150
192
|
case "set": {
|
|
151
|
-
|
|
152
|
-
|
|
193
|
+
let pending = rest;
|
|
194
|
+
const modeResult = takeOption(pending, "--mode");
|
|
195
|
+
pending = modeResult.rest;
|
|
196
|
+
const providerResult = takeOption(pending, "--provider");
|
|
197
|
+
pending = providerResult.rest;
|
|
198
|
+
const positionalMode = pending[0];
|
|
199
|
+
if (modeResult.value && positionalMode) {
|
|
200
|
+
throw new CliError("Usage: rig review set <off|advisory|required> [--provider greptile]", 1, {
|
|
201
|
+
hint: "Pass the mode positionally, or use --mode as a compatibility alias, but not both."
|
|
202
|
+
});
|
|
153
203
|
}
|
|
154
|
-
|
|
204
|
+
requireNoExtraArgs(positionalMode ? pending.slice(1) : pending, "rig review set <off|advisory|required> [--provider greptile]");
|
|
205
|
+
const mode = modeResult.value ?? positionalMode;
|
|
155
206
|
if (!mode) {
|
|
156
|
-
throw new
|
|
207
|
+
throw new CliError("Usage: rig review set <off|advisory|required> [--provider greptile]", 1);
|
|
157
208
|
}
|
|
158
|
-
let pending = rest.slice(1);
|
|
159
|
-
const providerResult = takeOption(pending, "--provider");
|
|
160
|
-
pending = providerResult.rest;
|
|
161
|
-
requireNoExtraArgs(pending, "bun run rig review set <off|advisory|required> [--provider greptile]");
|
|
162
209
|
try {
|
|
163
|
-
await withMutedConsole(context.outputMode === "json", () =>
|
|
164
|
-
return setReviewProfile(context.projectRoot, mode, providerResult.value);
|
|
165
|
-
});
|
|
210
|
+
await withMutedConsole(context.outputMode === "json", () => setReviewProfile(context.projectRoot, mode, providerResult.value));
|
|
166
211
|
} catch (error) {
|
|
167
|
-
throw new
|
|
212
|
+
throw new CliError(error instanceof Error ? error.message : String(error), 2);
|
|
168
213
|
}
|
|
169
|
-
return { ok: true, group: "review", command, details: { mode, provider:
|
|
214
|
+
return { ok: true, group: "review", command, details: { mode, provider: "greptile" } };
|
|
170
215
|
}
|
|
171
216
|
default:
|
|
172
|
-
throw new
|
|
217
|
+
throw new CliError(`Unknown review command: ${command}`, 1, { hint: "Run `rig review --help` \u2014 commands are show|set." });
|
|
173
218
|
}
|
|
174
219
|
}
|
|
175
220
|
export {
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli/src/runner.ts
|
|
3
3
|
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
4
|
-
import { CliError } from "@rig/runtime/control-plane/errors";
|
|
4
|
+
import { CliError as RuntimeCliError } 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
|
+
|
|
8
|
+
class CliError extends RuntimeCliError {
|
|
9
|
+
hint;
|
|
10
|
+
constructor(message, exitCode = 1, options = {}) {
|
|
11
|
+
super(message, exitCode);
|
|
12
|
+
if (options.hint?.trim()) {
|
|
13
|
+
this.hint = options.hint.trim();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
10
17
|
function takeFlag(args, flag) {
|
|
11
18
|
const rest = [];
|
|
12
19
|
let value = false;
|
|
@@ -27,7 +34,7 @@ function takeOption(args, option) {
|
|
|
27
34
|
if (current === option) {
|
|
28
35
|
const next = args[index + 1];
|
|
29
36
|
if (!next || next.startsWith("-")) {
|
|
30
|
-
throw new CliError(`Missing value for ${option}`);
|
|
37
|
+
throw new CliError(`Missing value for ${option}`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} <value>\`.` });
|
|
31
38
|
}
|
|
32
39
|
value = next;
|
|
33
40
|
index += 1;
|
|
@@ -56,7 +63,7 @@ function parsePositiveInt(value, option, fallback) {
|
|
|
56
63
|
}
|
|
57
64
|
const parsed = Number.parseInt(value, 10);
|
|
58
65
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
59
|
-
throw new
|
|
66
|
+
throw new CliError(`Invalid ${option} value: ${value}`, 1, { hint: `Pass a positive integer, e.g. \`${option} 10\`.` });
|
|
60
67
|
}
|
|
61
68
|
return parsed;
|
|
62
69
|
}
|
|
@@ -70,7 +77,7 @@ function parseAction(value) {
|
|
|
70
77
|
if (value === "pipeline") {
|
|
71
78
|
return "pipeline";
|
|
72
79
|
}
|
|
73
|
-
throw new
|
|
80
|
+
throw new CliError(`Invalid --action value: ${value}. Use validate, verify, or pipeline.`);
|
|
74
81
|
}
|
|
75
82
|
function parseIsolationMode(value, allowOff) {
|
|
76
83
|
if (!value) {
|
|
@@ -82,16 +89,11 @@ function parseIsolationMode(value, allowOff) {
|
|
|
82
89
|
if (allowOff && value === "off") {
|
|
83
90
|
return value;
|
|
84
91
|
}
|
|
85
|
-
throw new
|
|
92
|
+
throw new CliError(`Invalid isolation mode: ${value}. Use ${allowOff ? "off|" : ""}worktree.`);
|
|
86
93
|
}
|
|
87
94
|
|
|
88
|
-
// packages/cli/src/commands/
|
|
95
|
+
// packages/cli/src/commands/queue.ts
|
|
89
96
|
import { ensureProjectMainFreshBeforeRun } from "@rig/runtime/control-plane/project-main-pre-run-sync";
|
|
90
|
-
|
|
91
|
-
// packages/cli/src/commands/_server-client.ts
|
|
92
|
-
import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
|
|
93
|
-
|
|
94
|
-
// packages/cli/src/commands/_preflight.ts
|
|
95
97
|
async function runProjectMainSyncPreflight(context, options) {
|
|
96
98
|
if (context.dryRun) {
|
|
97
99
|
if (context.outputMode === "text" && !options.disabled) {
|
|
@@ -105,7 +107,7 @@ async function runProjectMainSyncPreflight(context, options) {
|
|
|
105
107
|
runBootstrap: async () => {
|
|
106
108
|
const bootstrap = await context.runCommand(["bun", "run", "bootstrap"]);
|
|
107
109
|
if (bootstrap.exitCode !== 0) {
|
|
108
|
-
throw new
|
|
110
|
+
throw new CliError(bootstrap.stderr || bootstrap.stdout || "bun run bootstrap failed during project pre-run sync", bootstrap.exitCode || 1);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
});
|
|
@@ -129,8 +131,6 @@ async function runProjectMainSyncPreflight(context, options) {
|
|
|
129
131
|
break;
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
// packages/cli/src/commands/queue.ts
|
|
134
134
|
async function executeQueue(context, args) {
|
|
135
135
|
const [command = "run", ...rest] = args;
|
|
136
136
|
switch (command) {
|
|
@@ -150,7 +150,7 @@ async function executeQueue(context, args) {
|
|
|
150
150
|
pending = failFastResult.rest;
|
|
151
151
|
const skipProjectSyncResult = takeFlag(pending, "--skip-project-sync");
|
|
152
152
|
pending = skipProjectSyncResult.rest;
|
|
153
|
-
requireNoExtraArgs(pending, "
|
|
153
|
+
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
154
|
const workers = parsePositiveInt(workersResult.value, "--workers", 2);
|
|
155
155
|
const maxTasks = parsePositiveInt(maxTasksResult.value, "--max-tasks", 10);
|
|
156
156
|
const action = parseAction(actionResult.value);
|
|
@@ -171,7 +171,7 @@ async function executeQueue(context, args) {
|
|
|
171
171
|
console.log(`Failed: ${summary.failed}`);
|
|
172
172
|
}
|
|
173
173
|
if (summary.failed > 0) {
|
|
174
|
-
throw new
|
|
174
|
+
throw new CliError(`Queue finished with ${summary.failed} failed task(s).`, 3, { hint: "Inspect the failures with `rig inspect failures`, then re-run `rig queue run`." });
|
|
175
175
|
}
|
|
176
176
|
return {
|
|
177
177
|
ok: true,
|
|
@@ -189,7 +189,7 @@ async function executeQueue(context, args) {
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
default:
|
|
192
|
-
throw new
|
|
192
|
+
throw new CliError(`Unknown queue command: ${command}`, 1, { hint: "Run `rig queue --help` \u2014 the primary command is `rig queue run`." });
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
export {
|