@h-rig/cli 0.0.6-alpha.7 → 0.0.6-alpha.70
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 +1 -1
- package/dist/bin/rig.js +4507 -1506
- package/dist/src/commands/_async-ui.js +152 -0
- package/dist/src/commands/_authority-runs.js +2 -3
- package/dist/src/commands/_cli-format.js +369 -0
- package/dist/src/commands/_connection-state.js +30 -11
- package/dist/src/commands/_doctor-checks.js +177 -43
- package/dist/src/commands/_help-catalog.js +485 -0
- package/dist/src/commands/_json-output.js +56 -0
- package/dist/src/commands/_operator-surface.js +220 -0
- package/dist/src/commands/_operator-view.js +595 -72
- package/dist/src/commands/_parsers.js +18 -11
- package/dist/src/commands/_pi-frontend.js +411 -0
- package/dist/src/commands/_pi-install.js +4 -3
- package/dist/src/commands/_policy.js +12 -5
- package/dist/src/commands/_preflight.js +187 -127
- package/dist/src/commands/_run-driver-helpers.js +75 -22
- package/dist/src/commands/_run-replay.js +142 -0
- package/dist/src/commands/_server-client.js +343 -60
- package/dist/src/commands/_snapshot-upload.js +160 -38
- package/dist/src/commands/_spinner.js +65 -0
- package/dist/src/commands/_task-picker.js +44 -16
- package/dist/src/commands/agent.js +39 -20
- package/dist/src/commands/browser.js +28 -21
- package/dist/src/commands/connect.js +146 -33
- package/dist/src/commands/dist.js +19 -12
- package/dist/src/commands/doctor.js +304 -44
- package/dist/src/commands/github.js +301 -52
- package/dist/src/commands/inbox.js +679 -72
- package/dist/src/commands/init.js +622 -118
- package/dist/src/commands/inspect.js +515 -32
- package/dist/src/commands/inspector.js +20 -13
- package/dist/src/commands/pi.js +177 -0
- package/dist/src/commands/plugin.js +95 -27
- package/dist/src/commands/profile-and-review.js +26 -19
- package/dist/src/commands/queue.js +32 -12
- package/dist/src/commands/remote.js +43 -36
- package/dist/src/commands/repo-git-harness.js +22 -15
- package/dist/src/commands/run.js +1162 -158
- package/dist/src/commands/server.js +373 -56
- package/dist/src/commands/setup.js +316 -62
- package/dist/src/commands/stats.js +1030 -0
- package/dist/src/commands/task-report-bug.js +29 -22
- package/dist/src/commands/task-run-driver.js +862 -129
- package/dist/src/commands/task.js +1423 -311
- package/dist/src/commands/test.js +15 -8
- package/dist/src/commands/workspace.js +18 -11
- package/dist/src/commands.js +4446 -1499
- package/dist/src/index.js +4502 -1504
- package/dist/src/launcher.js +77 -13
- package/dist/src/report-bug.js +3 -3
- package/dist/src/runner.js +16 -22
- package/package.json +10 -5
|
@@ -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 requireNoExtraArgs(args, usage) {
|
|
11
18
|
if (args.length > 0) {
|
|
12
19
|
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
@@ -19,19 +26,19 @@ async function executeTest(context, args) {
|
|
|
19
26
|
const [command = "unit", ...rest] = args;
|
|
20
27
|
switch (command) {
|
|
21
28
|
case "unit":
|
|
22
|
-
requireNoExtraArgs(rest, "
|
|
29
|
+
requireNoExtraArgs(rest, "rig test unit");
|
|
23
30
|
await context.runCommand(["bun", "test", "tests/harness/", "--ignore", "tests/harness/e2e/**"]);
|
|
24
31
|
return { ok: true, group: "test", command };
|
|
25
32
|
case "e2e":
|
|
26
|
-
requireNoExtraArgs(rest, "
|
|
33
|
+
requireNoExtraArgs(rest, "rig test e2e");
|
|
27
34
|
await context.runCommand(["bun", "test", "tests/harness/e2e/"]);
|
|
28
35
|
return { ok: true, group: "test", command };
|
|
29
36
|
case "all":
|
|
30
|
-
requireNoExtraArgs(rest, "
|
|
37
|
+
requireNoExtraArgs(rest, "rig test all");
|
|
31
38
|
await context.runCommand(["bun", "test", "tests/harness/"]);
|
|
32
39
|
return { ok: true, group: "test", command };
|
|
33
40
|
default:
|
|
34
|
-
throw new
|
|
41
|
+
throw new CliError(`Unknown test command: ${command}`, 1, { hint: "Run `rig test --help` \u2014 commands are unit|e2e|all." });
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
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 takeOption(args, option) {
|
|
11
18
|
const rest = [];
|
|
12
19
|
let value;
|
|
@@ -15,7 +22,7 @@ function takeOption(args, option) {
|
|
|
15
22
|
if (current === option) {
|
|
16
23
|
const next = args[index + 1];
|
|
17
24
|
if (!next || next.startsWith("-")) {
|
|
18
|
-
throw new CliError(`Missing value for ${option}`);
|
|
25
|
+
throw new CliError(`Missing value for ${option}`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} <value>\`.` });
|
|
19
26
|
}
|
|
20
27
|
value = next;
|
|
21
28
|
index += 1;
|
|
@@ -45,7 +52,7 @@ async function executeWorkspace(context, args) {
|
|
|
45
52
|
const [command = "summary", ...rest] = args;
|
|
46
53
|
switch (command) {
|
|
47
54
|
case "summary": {
|
|
48
|
-
requireNoExtraArgs(rest, "
|
|
55
|
+
requireNoExtraArgs(rest, "rig workspace summary");
|
|
49
56
|
const summary = await readWorkspaceSummary(context.projectRoot);
|
|
50
57
|
if (context.outputMode === "text") {
|
|
51
58
|
console.log("Workspace Summary");
|
|
@@ -70,7 +77,7 @@ Warnings:`);
|
|
|
70
77
|
return { ok: true, group: "workspace", command, details: summary };
|
|
71
78
|
}
|
|
72
79
|
case "topology": {
|
|
73
|
-
requireNoExtraArgs(rest, "
|
|
80
|
+
requireNoExtraArgs(rest, "rig workspace topology");
|
|
74
81
|
const topology = readWorkspaceTopology(context.projectRoot);
|
|
75
82
|
if (context.outputMode === "text") {
|
|
76
83
|
console.log(`Topology: ${topology.status}`);
|
|
@@ -83,7 +90,7 @@ Warnings:`);
|
|
|
83
90
|
return { ok: true, group: "workspace", command, details: topology };
|
|
84
91
|
}
|
|
85
92
|
case "remote-hosts": {
|
|
86
|
-
requireNoExtraArgs(rest, "
|
|
93
|
+
requireNoExtraArgs(rest, "rig workspace remote-hosts");
|
|
87
94
|
const fleet = readWorkspaceRemoteFleet(context.projectRoot);
|
|
88
95
|
if (context.outputMode === "text") {
|
|
89
96
|
console.log(`Remote Hosts: ${fleet.status}`);
|
|
@@ -98,9 +105,9 @@ Warnings:`);
|
|
|
98
105
|
let pending = serviceRest;
|
|
99
106
|
const services = takeOption(pending, "--service");
|
|
100
107
|
pending = services.rest;
|
|
101
|
-
requireNoExtraArgs(pending, "
|
|
108
|
+
requireNoExtraArgs(pending, "rig workspace service-fabric <status|up|verify|down> [--service <name>]");
|
|
102
109
|
if (action !== "status" && action !== "up" && action !== "verify" && action !== "down") {
|
|
103
|
-
throw new
|
|
110
|
+
throw new CliError(`Unknown workspace service-fabric action: ${action}`, 1, { hint: "Use one of: `rig workspace service-fabric status|up|verify|down`." });
|
|
104
111
|
}
|
|
105
112
|
const selectedServices = services.value ? services.value.split(",").map((entry) => entry.trim()).filter(Boolean) : [];
|
|
106
113
|
const summary = action === "status" ? await mutateWorkspaceServiceFabric(context.projectRoot, "verify", selectedServices) : await mutateWorkspaceServiceFabric(context.projectRoot, action, selectedServices);
|
|
@@ -115,7 +122,7 @@ Warnings:`);
|
|
|
115
122
|
};
|
|
116
123
|
}
|
|
117
124
|
default:
|
|
118
|
-
throw new
|
|
125
|
+
throw new CliError(`Unknown workspace command: ${command}`, 1, { hint: "Run `rig workspace --help` \u2014 commands are summary|topology|remote-hosts|service-fabric." });
|
|
119
126
|
}
|
|
120
127
|
}
|
|
121
128
|
export {
|