@h-rig/cli 0.0.6-alpha.0
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 +30 -0
- package/dist/bin/build-rig-binaries.js +107 -0
- package/dist/bin/rig.js +9330 -0
- package/dist/src/commands/_authority-runs.js +110 -0
- package/dist/src/commands/_connection-state.js +123 -0
- package/dist/src/commands/_doctor-checks.js +501 -0
- package/dist/src/commands/_operator-view.js +322 -0
- package/dist/src/commands/_parsers.js +107 -0
- package/dist/src/commands/_paths.js +50 -0
- package/dist/src/commands/_pi-install.js +184 -0
- package/dist/src/commands/_policy.js +79 -0
- package/dist/src/commands/_preflight.js +460 -0
- package/dist/src/commands/_probes.js +13 -0
- package/dist/src/commands/_run-driver-helpers.js +289 -0
- package/dist/src/commands/_server-client.js +364 -0
- package/dist/src/commands/_snapshot-upload.js +313 -0
- package/dist/src/commands/_task-picker.js +48 -0
- package/dist/src/commands/agent.js +497 -0
- package/dist/src/commands/browser.js +890 -0
- package/dist/src/commands/connect.js +180 -0
- package/dist/src/commands/dist.js +402 -0
- package/dist/src/commands/doctor.js +511 -0
- package/dist/src/commands/github.js +276 -0
- package/dist/src/commands/inbox.js +160 -0
- package/dist/src/commands/init.js +1254 -0
- package/dist/src/commands/inspect.js +174 -0
- package/dist/src/commands/inspector.js +256 -0
- package/dist/src/commands/plugin.js +167 -0
- package/dist/src/commands/profile-and-review.js +178 -0
- package/dist/src/commands/queue.js +197 -0
- package/dist/src/commands/remote.js +507 -0
- package/dist/src/commands/repo-git-harness.js +221 -0
- package/dist/src/commands/run.js +753 -0
- package/dist/src/commands/server.js +368 -0
- package/dist/src/commands/setup.js +681 -0
- package/dist/src/commands/task-report-bug.js +1083 -0
- package/dist/src/commands/task-run-driver.js +1933 -0
- package/dist/src/commands/task.js +1325 -0
- package/dist/src/commands/test.js +39 -0
- package/dist/src/commands/workspace.js +123 -0
- package/dist/src/commands.js +9012 -0
- package/dist/src/index.js +9348 -0
- package/dist/src/launcher.js +131 -0
- package/dist/src/report-bug.js +260 -0
- package/dist/src/runner.js +272 -0
- package/dist/src/withMutedConsole.js +42 -0
- package/package.json +31 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/runner.ts
|
|
3
|
+
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
4
|
+
import { CliError } from "@rig/runtime/control-plane/errors";
|
|
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
|
+
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
9
|
+
import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
|
|
10
|
+
function requireNoExtraArgs(args, usage) {
|
|
11
|
+
if (args.length > 0) {
|
|
12
|
+
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
13
|
+
Usage: ${usage}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// packages/cli/src/commands/test.ts
|
|
18
|
+
async function executeTest(context, args) {
|
|
19
|
+
const [command = "unit", ...rest] = args;
|
|
20
|
+
switch (command) {
|
|
21
|
+
case "unit":
|
|
22
|
+
requireNoExtraArgs(rest, "bun run rig test unit");
|
|
23
|
+
await context.runCommand(["bun", "test", "tests/harness/", "--ignore", "tests/harness/e2e/**"]);
|
|
24
|
+
return { ok: true, group: "test", command };
|
|
25
|
+
case "e2e":
|
|
26
|
+
requireNoExtraArgs(rest, "bun run rig test e2e");
|
|
27
|
+
await context.runCommand(["bun", "test", "tests/harness/e2e/"]);
|
|
28
|
+
return { ok: true, group: "test", command };
|
|
29
|
+
case "all":
|
|
30
|
+
requireNoExtraArgs(rest, "bun run rig test all");
|
|
31
|
+
await context.runCommand(["bun", "test", "tests/harness/"]);
|
|
32
|
+
return { ok: true, group: "test", command };
|
|
33
|
+
default:
|
|
34
|
+
throw new CliError2(`Unknown test command: ${command}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
executeTest
|
|
39
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/runner.ts
|
|
3
|
+
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
4
|
+
import { CliError } from "@rig/runtime/control-plane/errors";
|
|
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
|
+
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
9
|
+
import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
|
|
10
|
+
function takeOption(args, option) {
|
|
11
|
+
const rest = [];
|
|
12
|
+
let value;
|
|
13
|
+
for (let index = 0;index < args.length; index += 1) {
|
|
14
|
+
const current = args[index];
|
|
15
|
+
if (current === option) {
|
|
16
|
+
const next = args[index + 1];
|
|
17
|
+
if (!next || next.startsWith("-")) {
|
|
18
|
+
throw new CliError(`Missing value for ${option}`);
|
|
19
|
+
}
|
|
20
|
+
value = next;
|
|
21
|
+
index += 1;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (current !== undefined) {
|
|
25
|
+
rest.push(current);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { value, rest };
|
|
29
|
+
}
|
|
30
|
+
function requireNoExtraArgs(args, usage) {
|
|
31
|
+
if (args.length > 0) {
|
|
32
|
+
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
33
|
+
Usage: ${usage}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// packages/cli/src/commands/workspace.ts
|
|
38
|
+
import {
|
|
39
|
+
mutateWorkspaceServiceFabric,
|
|
40
|
+
readWorkspaceRemoteFleet,
|
|
41
|
+
readWorkspaceSummary,
|
|
42
|
+
readWorkspaceTopology
|
|
43
|
+
} from "@rig/runtime/control-plane/native/workspace-ops";
|
|
44
|
+
async function executeWorkspace(context, args) {
|
|
45
|
+
const [command = "summary", ...rest] = args;
|
|
46
|
+
switch (command) {
|
|
47
|
+
case "summary": {
|
|
48
|
+
requireNoExtraArgs(rest, "bun run rig workspace summary");
|
|
49
|
+
const summary = await readWorkspaceSummary(context.projectRoot);
|
|
50
|
+
if (context.outputMode === "text") {
|
|
51
|
+
console.log("Workspace Summary");
|
|
52
|
+
console.log(` root: ${summary.rootPath}`);
|
|
53
|
+
console.log(` tasks: ${summary.taskCounts.total} total \xB7 ${summary.taskCounts.ready} ready \xB7 ${summary.taskCounts.running} running \xB7 ${summary.taskCounts.blocked} blocked \xB7 ${summary.taskCounts.completed} completed \xB7 ${summary.taskCounts.unknown} unknown`);
|
|
54
|
+
console.log(` runtimes: ${summary.runtimeCount}`);
|
|
55
|
+
console.log(` artifact tasks: ${summary.artifactTaskCount}`);
|
|
56
|
+
console.log(` topology: ${summary.topology.status} \xB7 ${summary.topology.serviceCount} services from ${summary.topology.manifestCount} manifests`);
|
|
57
|
+
console.log(` remote hosts: ${summary.remoteFleet.status} \xB7 ${summary.remoteFleet.onlineHostCount} online of ${summary.remoteFleet.hostCount}`);
|
|
58
|
+
if (summary.serviceFabric) {
|
|
59
|
+
console.log(` service fabric: ${String(summary.serviceFabric.status ?? "unknown")} \xB7 ${String(summary.serviceFabric.healthyServiceCount ?? 0)} healthy of ${String(summary.serviceFabric.serviceCount ?? 0)}`);
|
|
60
|
+
}
|
|
61
|
+
console.log(` failures log: ${summary.failedApproachesPresent ? "present" : "missing"}`);
|
|
62
|
+
if (summary.warnings.length > 0) {
|
|
63
|
+
console.log(`
|
|
64
|
+
Warnings:`);
|
|
65
|
+
for (const warning of summary.warnings) {
|
|
66
|
+
console.log(` - ${warning}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { ok: true, group: "workspace", command, details: summary };
|
|
71
|
+
}
|
|
72
|
+
case "topology": {
|
|
73
|
+
requireNoExtraArgs(rest, "bun run rig workspace topology");
|
|
74
|
+
const topology = readWorkspaceTopology(context.projectRoot);
|
|
75
|
+
if (context.outputMode === "text") {
|
|
76
|
+
console.log(`Topology: ${topology.status}`);
|
|
77
|
+
for (const service of topology.services) {
|
|
78
|
+
const suffix = [service.runtime, service.port != null ? `:${service.port}` : null, service.healthcheck].filter(Boolean).join(" \xB7 ");
|
|
79
|
+
console.log(`- ${service.name}${suffix ? ` (${suffix})` : ""}`);
|
|
80
|
+
console.log(` ${service.relativeRootPath}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { ok: true, group: "workspace", command, details: topology };
|
|
84
|
+
}
|
|
85
|
+
case "remote-hosts": {
|
|
86
|
+
requireNoExtraArgs(rest, "bun run rig workspace remote-hosts");
|
|
87
|
+
const fleet = readWorkspaceRemoteFleet(context.projectRoot);
|
|
88
|
+
if (context.outputMode === "text") {
|
|
89
|
+
console.log(`Remote Hosts: ${fleet.status}`);
|
|
90
|
+
for (const host of fleet.hosts) {
|
|
91
|
+
console.log(`- ${host.name} \xB7 ${host.status} \xB7 ${host.baseUrl}${host.workspacePath ? ` \xB7 ${host.workspacePath}` : ""}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { ok: true, group: "workspace", command, details: fleet };
|
|
95
|
+
}
|
|
96
|
+
case "service-fabric": {
|
|
97
|
+
const [action = "status", ...serviceRest] = rest;
|
|
98
|
+
let pending = serviceRest;
|
|
99
|
+
const services = takeOption(pending, "--service");
|
|
100
|
+
pending = services.rest;
|
|
101
|
+
requireNoExtraArgs(pending, "bun run rig workspace service-fabric <status|up|verify|down> [--service <name>]");
|
|
102
|
+
if (action !== "status" && action !== "up" && action !== "verify" && action !== "down") {
|
|
103
|
+
throw new CliError2(`Unknown workspace service-fabric action: ${action}`);
|
|
104
|
+
}
|
|
105
|
+
const selectedServices = services.value ? services.value.split(",").map((entry) => entry.trim()).filter(Boolean) : [];
|
|
106
|
+
const summary = action === "status" ? await mutateWorkspaceServiceFabric(context.projectRoot, "verify", selectedServices) : await mutateWorkspaceServiceFabric(context.projectRoot, action, selectedServices);
|
|
107
|
+
if (context.outputMode === "text") {
|
|
108
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
ok: true,
|
|
112
|
+
group: "workspace",
|
|
113
|
+
command: `service-fabric:${action}`,
|
|
114
|
+
details: summary
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
default:
|
|
118
|
+
throw new CliError2(`Unknown workspace command: ${command}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
executeWorkspace
|
|
123
|
+
};
|