@h-rig/cli 0.0.6-alpha.94 → 0.0.6-alpha.95
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 +6 -27
- package/bin/rig.js +16 -0
- package/package.json +14 -40
- package/dist/bin/build-rig-binaries.d.ts +0 -2
- package/dist/bin/build-rig-binaries.js +0 -119
- package/dist/bin/rig.d.ts +0 -72
- package/dist/bin/rig.js +0 -17855
- package/dist/config/rig-default-config.yml +0 -5
- package/dist/src/app/drone-ui.d.ts +0 -34
- package/dist/src/app/drone-ui.js +0 -278
- package/dist/src/commands/_async-ui.d.ts +0 -10
- package/dist/src/commands/_async-ui.js +0 -121
- package/dist/src/commands/_cli-format.d.ts +0 -56
- package/dist/src/commands/_cli-format.js +0 -319
- package/dist/src/commands/_connection-state.d.ts +0 -54
- package/dist/src/commands/_connection-state.js +0 -187
- package/dist/src/commands/_doctor-checks.d.ts +0 -46
- package/dist/src/commands/_doctor-checks.js +0 -352
- package/dist/src/commands/_help-catalog.d.ts +0 -51
- package/dist/src/commands/_help-catalog.js +0 -502
- package/dist/src/commands/_inprocess-services.d.ts +0 -33
- package/dist/src/commands/_inprocess-services.js +0 -102
- package/dist/src/commands/_json-output.d.ts +0 -11
- package/dist/src/commands/_json-output.js +0 -60
- package/dist/src/commands/_lazy-reconcile.d.ts +0 -34
- package/dist/src/commands/_lazy-reconcile.js +0 -102
- package/dist/src/commands/_parsers.d.ts +0 -15
- package/dist/src/commands/_parsers.js +0 -114
- package/dist/src/commands/_paths.d.ts +0 -11
- package/dist/src/commands/_paths.js +0 -50
- package/dist/src/commands/_pi-frontend.d.ts +0 -35
- package/dist/src/commands/_pi-frontend.js +0 -64
- package/dist/src/commands/_pi-install.d.ts +0 -42
- package/dist/src/commands/_pi-install.js +0 -167
- package/dist/src/commands/_policy.d.ts +0 -8
- package/dist/src/commands/_policy.js +0 -127
- package/dist/src/commands/_probes.d.ts +0 -1
- package/dist/src/commands/_probes.js +0 -13
- package/dist/src/commands/_run-bridge.d.ts +0 -114
- package/dist/src/commands/_run-bridge.js +0 -387
- package/dist/src/commands/_run-diagnostics.d.ts +0 -9
- package/dist/src/commands/_run-diagnostics.js +0 -51
- package/dist/src/commands/_run-driver-helpers.d.ts +0 -26
- package/dist/src/commands/_run-driver-helpers.js +0 -138
- package/dist/src/commands/_run-projection.d.ts +0 -50
- package/dist/src/commands/_run-projection.js +0 -349
- package/dist/src/commands/_run-subcommands.d.ts +0 -3
- package/dist/src/commands/_run-subcommands.js +0 -31
- package/dist/src/commands/_spinner.d.ts +0 -25
- package/dist/src/commands/_spinner.js +0 -65
- package/dist/src/commands/agent.d.ts +0 -3
- package/dist/src/commands/agent.js +0 -8837
- package/dist/src/commands/dist.d.ts +0 -28
- package/dist/src/commands/dist.js +0 -417
- package/dist/src/commands/doctor.d.ts +0 -3
- package/dist/src/commands/doctor.js +0 -480
- package/dist/src/commands/github.d.ts +0 -3
- package/dist/src/commands/github.js +0 -342
- package/dist/src/commands/inbox.d.ts +0 -28
- package/dist/src/commands/inbox.js +0 -579
- package/dist/src/commands/init.d.ts +0 -64
- package/dist/src/commands/init.js +0 -1541
- package/dist/src/commands/inspect.d.ts +0 -20
- package/dist/src/commands/inspect.js +0 -764
- package/dist/src/commands/pi.d.ts +0 -3
- package/dist/src/commands/pi.js +0 -177
- package/dist/src/commands/plugin.d.ts +0 -16
- package/dist/src/commands/plugin.js +0 -714
- package/dist/src/commands/profile-and-review.d.ts +0 -4
- package/dist/src/commands/profile-and-review.js +0 -223
- package/dist/src/commands/queue.d.ts +0 -3
- package/dist/src/commands/queue.js +0 -197
- package/dist/src/commands/remote.d.ts +0 -3
- package/dist/src/commands/remote.js +0 -1337
- package/dist/src/commands/repo-git-harness.d.ts +0 -5
- package/dist/src/commands/repo-git-harness.js +0 -271
- package/dist/src/commands/run.d.ts +0 -21
- package/dist/src/commands/run.js +0 -17847
- package/dist/src/commands/server.d.ts +0 -3
- package/dist/src/commands/server.js +0 -249
- package/dist/src/commands/setup.d.ts +0 -16
- package/dist/src/commands/setup.js +0 -644
- package/dist/src/commands/stats.d.ts +0 -15
- package/dist/src/commands/stats.js +0 -979
- package/dist/src/commands/task-run-driver.d.ts +0 -94
- package/dist/src/commands/task-run-driver.js +0 -203
- package/dist/src/commands/task.d.ts +0 -35
- package/dist/src/commands/task.js +0 -818
- package/dist/src/commands/test.d.ts +0 -3
- package/dist/src/commands/test.js +0 -46
- package/dist/src/commands/triage.d.ts +0 -11
- package/dist/src/commands/triage.js +0 -227
- package/dist/src/commands/workspace.d.ts +0 -3
- package/dist/src/commands/workspace.js +0 -130
- package/dist/src/commands.d.ts +0 -13
- package/dist/src/commands.js +0 -17979
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.js +0 -17991
- package/dist/src/launcher.d.ts +0 -61
- package/dist/src/launcher.js +0 -199
- package/dist/src/operator-cli.d.ts +0 -2
- package/dist/src/operator-cli.js +0 -17847
- package/dist/src/operator-entry.d.ts +0 -1
- package/dist/src/operator-entry.js +0 -3
- package/dist/src/runner.d.ts +0 -47
- package/dist/src/runner.js +0 -267
- package/dist/src/withMutedConsole.d.ts +0 -2
- package/dist/src/withMutedConsole.js +0 -42
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var __require = import.meta.require;
|
|
3
|
-
|
|
4
|
-
// packages/cli/src/commands/setup.ts
|
|
5
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
6
|
-
import { resolve as resolve5 } from "path";
|
|
7
|
-
|
|
8
|
-
// packages/cli/src/runner.ts
|
|
9
|
-
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
10
|
-
import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
|
|
11
|
-
import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
|
|
12
|
-
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
13
|
-
|
|
14
|
-
class CliError extends RuntimeCliError {
|
|
15
|
-
hint;
|
|
16
|
-
constructor(message, exitCode = 1, options = {}) {
|
|
17
|
-
super(message, exitCode);
|
|
18
|
-
if (options.hint?.trim()) {
|
|
19
|
-
this.hint = options.hint.trim();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function requireNoExtraArgs(args, usage) {
|
|
24
|
-
if (args.length > 0) {
|
|
25
|
-
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
26
|
-
Usage: ${usage}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// packages/cli/src/commands/setup.ts
|
|
31
|
-
import { createPluginHost } from "@rig/core";
|
|
32
|
-
import {
|
|
33
|
-
isSupportedBunVersion as isSupportedBunVersion2,
|
|
34
|
-
MIN_SUPPORTED_BUN_VERSION as MIN_SUPPORTED_BUN_VERSION2
|
|
35
|
-
} from "@rig/runtime/control-plane/setup-version";
|
|
36
|
-
|
|
37
|
-
// packages/cli/src/withMutedConsole.ts
|
|
38
|
-
function isPromise(value) {
|
|
39
|
-
if (typeof value !== "object" && typeof value !== "function") {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
return value !== null && typeof value.then === "function";
|
|
43
|
-
}
|
|
44
|
-
function withMutedConsole(mute, fn) {
|
|
45
|
-
if (!mute) {
|
|
46
|
-
return fn();
|
|
47
|
-
}
|
|
48
|
-
const originalLog = console.log;
|
|
49
|
-
const originalWarn = console.warn;
|
|
50
|
-
const originalInfo = console.info;
|
|
51
|
-
const restore = () => {
|
|
52
|
-
console.log = originalLog;
|
|
53
|
-
console.warn = originalWarn;
|
|
54
|
-
console.info = originalInfo;
|
|
55
|
-
};
|
|
56
|
-
console.log = () => {};
|
|
57
|
-
console.warn = () => {};
|
|
58
|
-
console.info = () => {};
|
|
59
|
-
try {
|
|
60
|
-
const result = fn();
|
|
61
|
-
if (isPromise(result)) {
|
|
62
|
-
return result.finally(restore);
|
|
63
|
-
}
|
|
64
|
-
restore();
|
|
65
|
-
return result;
|
|
66
|
-
} catch (error) {
|
|
67
|
-
restore();
|
|
68
|
-
throw error;
|
|
69
|
-
} finally {
|
|
70
|
-
if (console.log === originalLog) {
|
|
71
|
-
restore();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// packages/cli/src/commands/_parsers.ts
|
|
77
|
-
async function loadRigConfigOrNull(projectRoot) {
|
|
78
|
-
try {
|
|
79
|
-
const { loadConfig } = await import("@rig/core/load-config");
|
|
80
|
-
return await loadConfig(projectRoot);
|
|
81
|
-
} catch {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// packages/cli/src/commands/_paths.ts
|
|
87
|
-
import { resolve } from "path";
|
|
88
|
-
import { resolveMonorepoRoot } from "@rig/runtime/layout";
|
|
89
|
-
function resolveControlPlaneMonorepoRoot(projectRoot) {
|
|
90
|
-
return resolveMonorepoRoot(projectRoot);
|
|
91
|
-
}
|
|
92
|
-
function resolveControlPlaneHostStateRoot(projectRoot) {
|
|
93
|
-
return resolve(projectRoot, ".rig");
|
|
94
|
-
}
|
|
95
|
-
function resolveControlPlaneHostStateDir(projectRoot) {
|
|
96
|
-
return resolve(resolveControlPlaneHostStateRoot(projectRoot), "state");
|
|
97
|
-
}
|
|
98
|
-
function resolveControlPlaneHostLogsDir(projectRoot) {
|
|
99
|
-
return resolve(resolveControlPlaneHostStateRoot(projectRoot), "logs");
|
|
100
|
-
}
|
|
101
|
-
function resolveControlPlaneArtifactsDir(projectRoot) {
|
|
102
|
-
return resolve(resolveControlPlaneMonorepoRoot(projectRoot), "artifacts");
|
|
103
|
-
}
|
|
104
|
-
function resolveControlPlaneDefinitionRoot(projectRoot) {
|
|
105
|
-
return resolve(projectRoot, "rig");
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// packages/cli/src/commands/_pi-install.ts
|
|
109
|
-
import { existsSync } from "fs";
|
|
110
|
-
import { homedir } from "os";
|
|
111
|
-
import { resolve as resolve2 } from "path";
|
|
112
|
-
var PI_RIG_PACKAGE_NAME = "@h-rig/pi-rig";
|
|
113
|
-
async function defaultCommandRunner(command, options = {}) {
|
|
114
|
-
const proc = Bun.spawn(command, { cwd: options.cwd, stdout: "pipe", stderr: "pipe" });
|
|
115
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
116
|
-
new Response(proc.stdout).text(),
|
|
117
|
-
new Response(proc.stderr).text(),
|
|
118
|
-
proc.exited
|
|
119
|
-
]);
|
|
120
|
-
return { exitCode, stdout, stderr };
|
|
121
|
-
}
|
|
122
|
-
function resolvePiRigExtensionPath(homeDir) {
|
|
123
|
-
return resolve2(homeDir, ".pi", "agent", "extensions", "pi-rig");
|
|
124
|
-
}
|
|
125
|
-
function resolvePiHomeDir(inputHomeDir) {
|
|
126
|
-
return inputHomeDir ?? process.env.RIG_PI_HOME_DIR?.trim() ?? homedir();
|
|
127
|
-
}
|
|
128
|
-
function piListContainsPiRig(output) {
|
|
129
|
-
return output.split(/\r?\n/).some((line) => {
|
|
130
|
-
const normalized = line.trim();
|
|
131
|
-
return normalized.includes(PI_RIG_PACKAGE_NAME) || /(?:^|[\\/])packages[\\/]pi-rig(?:$|\s)/.test(normalized);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
async function safeRun(runner, command, options) {
|
|
135
|
-
try {
|
|
136
|
-
return await runner(command, options);
|
|
137
|
-
} catch (error) {
|
|
138
|
-
return { exitCode: 1, stdout: "", stderr: error instanceof Error ? error.message : String(error) };
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
async function checkPiRigInstall(input = {}) {
|
|
142
|
-
const home = resolvePiHomeDir(input.homeDir);
|
|
143
|
-
const extensionPath = resolvePiRigExtensionPath(home);
|
|
144
|
-
if (process.env.RIG_TEST_FAKE_PI_INSTALL === "1") {
|
|
145
|
-
return {
|
|
146
|
-
extensionPath,
|
|
147
|
-
pi: { ok: true, label: "pi", detail: "fake-pi" },
|
|
148
|
-
piRig: { ok: true, label: "pi-rig global extension", detail: extensionPath }
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
const runner = input.commandRunner ?? defaultCommandRunner;
|
|
152
|
-
const piResult = await safeRun(runner, ["pi", "--version"]);
|
|
153
|
-
const piListResult = piResult.exitCode === 0 ? await safeRun(runner, ["pi", "list"]) : { exitCode: 1, stdout: "", stderr: "" };
|
|
154
|
-
const hasPiRig = piListResult.exitCode === 0 && piListContainsPiRig(`${piListResult.stdout}
|
|
155
|
-
${piListResult.stderr}`);
|
|
156
|
-
const hasLegacyBridgeScaffold = !hasPiRig && (input.exists ?? existsSync)(extensionPath);
|
|
157
|
-
return {
|
|
158
|
-
extensionPath,
|
|
159
|
-
pi: {
|
|
160
|
-
ok: piResult.exitCode === 0,
|
|
161
|
-
label: "pi",
|
|
162
|
-
detail: (piResult.stdout || piResult.stderr).trim() || undefined,
|
|
163
|
-
hint: piResult.exitCode === 0 ? undefined : "Install Pi/OMP manually or set RIG_PI_INSTALL_COMMAND before verifying with bare `rig` / Cockpit \u2192 Doctor."
|
|
164
|
-
},
|
|
165
|
-
piRig: {
|
|
166
|
-
ok: hasPiRig,
|
|
167
|
-
label: "pi-rig global extension",
|
|
168
|
-
detail: hasPiRig ? piListResult.stdout.trim() || PI_RIG_PACKAGE_NAME : hasLegacyBridgeScaffold ? `legacy bridge scaffold at ${extensionPath}` : undefined,
|
|
169
|
-
hint: hasPiRig ? undefined : `Install the Rig OMP extension with \`pi install ${PI_RIG_PACKAGE_NAME}\`, then verify with bare \`rig\` / Cockpit \u2192 Doctor.`
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
async function buildPiSetupChecks(input = {}) {
|
|
174
|
-
const status = await checkPiRigInstall(input);
|
|
175
|
-
return [status.pi, status.piRig];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// packages/cli/src/commands/_doctor-checks.ts
|
|
179
|
-
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
180
|
-
import { resolve as resolve4 } from "path";
|
|
181
|
-
import { isSupportedBunVersion, MIN_SUPPORTED_BUN_VERSION } from "@rig/runtime/control-plane/setup-version";
|
|
182
|
-
|
|
183
|
-
// packages/cli/src/commands/_connection-state.ts
|
|
184
|
-
import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
185
|
-
import { dirname, resolve as resolve3 } from "path";
|
|
186
|
-
function resolveRepoConnectionPath(projectRoot) {
|
|
187
|
-
return resolve3(projectRoot, ".rig", "state", "connection.json");
|
|
188
|
-
}
|
|
189
|
-
function readJsonFile(path) {
|
|
190
|
-
if (!existsSync2(path))
|
|
191
|
-
return null;
|
|
192
|
-
try {
|
|
193
|
-
return JSON.parse(readFileSync(path, "utf8"));
|
|
194
|
-
} catch (error) {
|
|
195
|
-
throw new CliError(`Invalid Rig connection state at ${path}: ${error instanceof Error ? error.message : String(error)}`, 1, { hint: "Fix or delete that file, then re-select a server with `rig server use <alias|local>`." });
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function readRepoConnection(projectRoot) {
|
|
199
|
-
const payload = readJsonFile(resolveRepoConnectionPath(projectRoot));
|
|
200
|
-
if (!payload || typeof payload !== "object" || Array.isArray(payload))
|
|
201
|
-
return null;
|
|
202
|
-
const record = payload;
|
|
203
|
-
const selected = typeof record.selected === "string" ? record.selected.trim() : "";
|
|
204
|
-
if (!selected)
|
|
205
|
-
return null;
|
|
206
|
-
return {
|
|
207
|
-
selected,
|
|
208
|
-
project: typeof record.project === "string" ? record.project : undefined,
|
|
209
|
-
linkedAt: typeof record.linkedAt === "string" ? record.linkedAt : undefined,
|
|
210
|
-
serverProjectRoot: typeof record.serverProjectRoot === "string" && record.serverProjectRoot.trim() ? record.serverProjectRoot.trim() : undefined,
|
|
211
|
-
serverProjectRootAlias: typeof record.serverProjectRootAlias === "string" && record.serverProjectRootAlias.trim() ? record.serverProjectRootAlias.trim() : undefined,
|
|
212
|
-
serverProjectRootBaseUrl: typeof record.serverProjectRootBaseUrl === "string" && record.serverProjectRootBaseUrl.trim() ? record.serverProjectRootBaseUrl.trim().replace(/\/+$/, "") : undefined
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// packages/cli/src/commands/_inprocess-services.ts
|
|
217
|
-
import {
|
|
218
|
-
beginGitHubDeviceFlow,
|
|
219
|
-
checkGitHubRepoPermissions,
|
|
220
|
-
createGitHubAuthStore,
|
|
221
|
-
listGitHubProjects,
|
|
222
|
-
pollGitHubDeviceFlow,
|
|
223
|
-
resolveGitHubAuthStatus,
|
|
224
|
-
resolveProjectStatusField,
|
|
225
|
-
saveGitHubTokenForProject
|
|
226
|
-
} from "@rig/runtime/control-plane/github/index";
|
|
227
|
-
var scopedGitHubBearerTokens = new Map;
|
|
228
|
-
function cleanToken(value) {
|
|
229
|
-
const trimmed = value?.trim();
|
|
230
|
-
return trimmed ? trimmed : null;
|
|
231
|
-
}
|
|
232
|
-
function cleanString(value) {
|
|
233
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
234
|
-
}
|
|
235
|
-
function oauthClientId() {
|
|
236
|
-
return cleanToken(process.env.RIG_GITHUB_OAUTH_CLIENT_ID);
|
|
237
|
-
}
|
|
238
|
-
async function getGitHubAuthStatusInProcess(context) {
|
|
239
|
-
return { ok: true, ...resolveGitHubAuthStatus({ projectRoot: context.projectRoot, oauthConfigured: Boolean(oauthClientId()) }) };
|
|
240
|
-
}
|
|
241
|
-
async function requestGitHubAuthJsonInProcess(context, pathname, init = {}) {
|
|
242
|
-
const method = (init.method ?? "GET").toUpperCase();
|
|
243
|
-
if (pathname === "/api/github/auth/status")
|
|
244
|
-
return getGitHubAuthStatusInProcess(context);
|
|
245
|
-
if (pathname === "/api/github/repo/permissions") {
|
|
246
|
-
return checkGitHubRepoPermissions({ projectRoot: context.projectRoot, oauthConfigured: Boolean(oauthClientId()) });
|
|
247
|
-
}
|
|
248
|
-
if (pathname === "/api/github/auth/device/start" && method === "POST") {
|
|
249
|
-
const clientId = oauthClientId();
|
|
250
|
-
if (!clientId)
|
|
251
|
-
return { ok: false, oauthConfigured: false, error: "RIG_GITHUB_OAUTH_CLIENT_ID is not configured." };
|
|
252
|
-
const body = init.body ? JSON.parse(String(init.body)) : {};
|
|
253
|
-
return beginGitHubDeviceFlow({
|
|
254
|
-
projectRoot: context.projectRoot,
|
|
255
|
-
clientId,
|
|
256
|
-
scope: cleanString(body.scope) ?? undefined,
|
|
257
|
-
selectedRepo: cleanString(body.repoSlug)
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
if (pathname === "/api/github/auth/device/poll" && method === "POST") {
|
|
261
|
-
const clientId = oauthClientId();
|
|
262
|
-
if (!clientId)
|
|
263
|
-
return { ok: false, oauthConfigured: false, error: "RIG_GITHUB_OAUTH_CLIENT_ID is not configured." };
|
|
264
|
-
const body = init.body ? JSON.parse(String(init.body)) : {};
|
|
265
|
-
const pollId = cleanString(body.pollId);
|
|
266
|
-
if (!pollId)
|
|
267
|
-
return { ok: false, status: "error", error: "pollId is required" };
|
|
268
|
-
return pollGitHubDeviceFlow({ projectRoot: context.projectRoot, clientId, pollId, selectedRepo: cleanString(body.repoSlug) });
|
|
269
|
-
}
|
|
270
|
-
throw new Error(`No in-process GitHub auth API for ${method} ${pathname}`);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// packages/cli/src/commands/_doctor-checks.ts
|
|
274
|
-
function check(id, label, status, detail, remediation) {
|
|
275
|
-
return {
|
|
276
|
-
id,
|
|
277
|
-
label,
|
|
278
|
-
status,
|
|
279
|
-
...detail ? { detail } : {},
|
|
280
|
-
...remediation ? { remediation } : {}
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
function errorMessage(error) {
|
|
284
|
-
return error instanceof Error ? error.message : String(error);
|
|
285
|
-
}
|
|
286
|
-
function isAuthenticated(payload) {
|
|
287
|
-
if (!payload || typeof payload !== "object" || Array.isArray(payload))
|
|
288
|
-
return false;
|
|
289
|
-
const record = payload;
|
|
290
|
-
return record.signedIn === true || record.authenticated === true || record.status === "authenticated" || record.ok === true && typeof record.login === "string" && record.login.trim().length > 0;
|
|
291
|
-
}
|
|
292
|
-
function loadFallbackConfig(projectRoot) {
|
|
293
|
-
const candidates = ["rig.config.ts", "rig.config.mts", "rig.config.json"];
|
|
294
|
-
for (const name of candidates) {
|
|
295
|
-
const path = resolve4(projectRoot, name);
|
|
296
|
-
if (!existsSync3(path))
|
|
297
|
-
continue;
|
|
298
|
-
try {
|
|
299
|
-
const source = readFileSync2(path, "utf8");
|
|
300
|
-
if (name.endsWith(".json"))
|
|
301
|
-
return JSON.parse(source);
|
|
302
|
-
const owner = source.match(/owner\s*:\s*["']([^"']+)["']/)?.[1];
|
|
303
|
-
const repo = source.match(/repo\s*:\s*["']([^"']+)["']/)?.[1];
|
|
304
|
-
const projectRepo = source.match(/project\s*:\s*\{[^}]*repo\s*:\s*["']([^"']+)["']/s)?.[1] ?? (owner && repo ? `${owner}/${repo}` : undefined);
|
|
305
|
-
const taskKind = source.match(/taskSource\s*:\s*\{[^}]*kind\s*:\s*["']([^"']+)["']/s)?.[1];
|
|
306
|
-
if (projectRepo || taskKind) {
|
|
307
|
-
return {
|
|
308
|
-
...projectRepo ? { project: { name: projectRepo, repo: projectRepo } } : {},
|
|
309
|
-
...taskKind ? { taskSource: { kind: taskKind, ...owner ? { owner } : {}, ...repo ? { repo } : {} } } : {}
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
} catch {
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
function githubProjectsCheck(config) {
|
|
319
|
-
const github = config?.github;
|
|
320
|
-
const projects = github?.projects;
|
|
321
|
-
if (!projects?.enabled) {
|
|
322
|
-
return check("github-projects", "GitHub Projects status sync", "warn", "disabled or not configured", "Current OMP flow does not require GitHub Projects status sync; configure github.projects manually when Project status sync should be authoritative.");
|
|
323
|
-
}
|
|
324
|
-
if (projects.projectId && projects.statusFieldId) {
|
|
325
|
-
return check("github-projects", "GitHub Projects status sync", "pass", `project ${projects.projectId}`);
|
|
326
|
-
}
|
|
327
|
-
return check("github-projects", "GitHub Projects status sync", "fail", "enabled but projectId/statusFieldId is incomplete", "Configure github.projects.projectId and github.projects.statusFieldId, or disable github.projects.enabled.");
|
|
328
|
-
}
|
|
329
|
-
function permissionAllowsPr(payload) {
|
|
330
|
-
if (!payload || typeof payload !== "object" || Array.isArray(payload))
|
|
331
|
-
return null;
|
|
332
|
-
const record = payload;
|
|
333
|
-
if (record.canOpenPullRequest === true || record.pullRequests === true || record.push === true || record.maintain === true || record.admin === true)
|
|
334
|
-
return true;
|
|
335
|
-
if (record.canOpenPullRequest === false || record.pullRequests === false || record.push === false)
|
|
336
|
-
return false;
|
|
337
|
-
const permissions = record.permissions;
|
|
338
|
-
if (permissions && typeof permissions === "object" && !Array.isArray(permissions)) {
|
|
339
|
-
const p = permissions;
|
|
340
|
-
if (p.push === true || p.maintain === true || p.admin === true)
|
|
341
|
-
return true;
|
|
342
|
-
if (p.push === false && p.maintain !== true && p.admin !== true)
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
return null;
|
|
346
|
-
}
|
|
347
|
-
function prMergeCheck(config) {
|
|
348
|
-
const pr = config?.pr;
|
|
349
|
-
const merge = config?.merge;
|
|
350
|
-
if (pr?.mode === "off" || merge?.mode === "off") {
|
|
351
|
-
return check("pr-merge", "PR/merge automation", "warn", "automatic PR or merge is disabled", "Set pr.mode and merge.mode to auto for autonomous YOLO runs.");
|
|
352
|
-
}
|
|
353
|
-
return check("pr-merge", "PR/merge automation", "pass", `pr=${pr?.mode ?? "auto"}, merge=${merge?.mode ?? "auto"}, method=${merge?.method ?? "repo-default"}`);
|
|
354
|
-
}
|
|
355
|
-
async function runRigDoctorChecks(options) {
|
|
356
|
-
const projectRoot = options.projectRoot;
|
|
357
|
-
const checks = [];
|
|
358
|
-
const which = options.which ?? ((binary) => Bun.which(binary));
|
|
359
|
-
const bunVersion = options.bunVersion ?? Bun.version;
|
|
360
|
-
const request = options.requestJson ?? ((pathname, init) => requestGitHubAuthJsonInProcess({ projectRoot }, pathname, init));
|
|
361
|
-
const loadConfig = options.loadConfig ?? loadRigConfigOrNull;
|
|
362
|
-
const progress = options.onProgress ?? (() => {});
|
|
363
|
-
progress("Checking local toolchain\u2026");
|
|
364
|
-
checks.push(check("bun", `bun >= ${MIN_SUPPORTED_BUN_VERSION}`, isSupportedBunVersion(bunVersion) ? "pass" : "fail", `found ${bunVersion}`, `Install Bun ${MIN_SUPPORTED_BUN_VERSION} or newer.`), check("git", "git", which("git") ? "pass" : "fail", which("git") ?? undefined, "Install git and ensure it is on PATH."), check("jq", "jq", which("jq") ? "pass" : "warn", which("jq") ?? undefined, "Install jq (for example `brew install jq`)."));
|
|
365
|
-
progress("Loading rig.config\u2026");
|
|
366
|
-
const loadedConfig = await loadConfig(projectRoot).catch(() => null);
|
|
367
|
-
const config = loadedConfig ?? loadFallbackConfig(projectRoot);
|
|
368
|
-
const hasConfigFile = ["rig.config.ts", "rig.config.mts", "rig.config.json"].some((name) => existsSync3(resolve4(projectRoot, name)));
|
|
369
|
-
checks.push(config ? check("config", "rig.config loadable", "pass") : check("config", "rig.config loadable", hasConfigFile ? "fail" : "fail", hasConfigFile ? "config file exists but failed to load" : "missing rig.config.ts/json", "Create/fix rig.config.ts or use the OMP cockpit Start tab to scaffold one."));
|
|
370
|
-
const taskSourceKind = config?.taskSource?.kind;
|
|
371
|
-
checks.push(taskSourceKind ? check("task-source", "task source configured", "pass", taskSourceKind) : check("task-source", "task source configured", "fail", "missing taskSource", "Configure taskSource in rig.config.ts."));
|
|
372
|
-
const repo = readRepoConnection(projectRoot);
|
|
373
|
-
checks.push(repo ? check("project-link", "repo selected for local setup", repo.project ? "pass" : "warn", `${repo.selected}${repo.project ? ` -> ${repo.project}` : ""}`, "Run `rig init --repo owner/repo` if this project should use GitHub Issues.") : check("project-link", "repo selected for local setup", "warn", "missing .rig/state/connection.json", "Current UX can run without this compatibility file; `rig init` recreates it for GitHub-backed projects."));
|
|
374
|
-
try {
|
|
375
|
-
progress("Checking GitHub auth\u2026");
|
|
376
|
-
const auth = await request("/api/github/auth/status");
|
|
377
|
-
checks.push(isAuthenticated(auth) ? check("github-auth", "GitHub auth", "pass") : check("github-auth", "GitHub auth", "fail", "not authenticated", "Run `rig github auth import-gh` or `rig github auth token --token <token>`."));
|
|
378
|
-
} catch (error) {
|
|
379
|
-
checks.push(check("github-auth", "GitHub auth", "fail", errorMessage(error), "Authenticate GitHub through Rig."));
|
|
380
|
-
}
|
|
381
|
-
try {
|
|
382
|
-
progress("Checking GitHub repo permissions\u2026");
|
|
383
|
-
const permissions = await request("/api/github/repo/permissions");
|
|
384
|
-
const allowed = permissionAllowsPr(permissions);
|
|
385
|
-
checks.push(allowed === true ? check("github-repo-permissions", "GitHub repo PR permissions", "pass", JSON.stringify(permissions).slice(0, 180)) : allowed === false ? check("github-repo-permissions", "GitHub repo PR permissions", "fail", JSON.stringify(permissions).slice(0, 180), "Grant the selected GitHub token permission to push branches, open PRs, and merge according to repo rules.") : check("github-repo-permissions", "GitHub repo PR permissions", "warn", JSON.stringify(permissions).slice(0, 180), "Confirm the selected token can push branches and open PRs."));
|
|
386
|
-
} catch (error) {
|
|
387
|
-
checks.push(check("github-repo-permissions", "GitHub repo PR permissions", "warn", errorMessage(error), "Ensure the token can open PRs."));
|
|
388
|
-
}
|
|
389
|
-
if (taskSourceKind === "github-issues") {
|
|
390
|
-
checks.push(check("gh", "gh CLI fallback", which("gh") ? "pass" : "warn", which("gh") ?? undefined, "Install gh for local/dev GitHub fallback operations."));
|
|
391
|
-
}
|
|
392
|
-
checks.push(githubProjectsCheck(config));
|
|
393
|
-
checks.push(prMergeCheck(config));
|
|
394
|
-
progress("Checking Pi installation\u2026");
|
|
395
|
-
const piChecks = await (options.piChecks ?? (() => buildPiSetupChecks()))().catch((error) => [{
|
|
396
|
-
ok: false,
|
|
397
|
-
label: "pi/pi-rig checks",
|
|
398
|
-
hint: errorMessage(error)
|
|
399
|
-
}]);
|
|
400
|
-
for (const pi of piChecks) {
|
|
401
|
-
checks.push(check(pi.label === "pi" ? "pi" : "pi-rig", pi.label, pi.ok ? "pass" : "warn", pi.detail, pi.hint ?? (pi.ok ? undefined : "Install Pi/OMP and the Rig extension, then use bare `rig` or Cockpit \u2192 Doctor to verify.")));
|
|
402
|
-
}
|
|
403
|
-
return checks;
|
|
404
|
-
}
|
|
405
|
-
function formatDoctorChecks(checks) {
|
|
406
|
-
return checks.map((entry) => {
|
|
407
|
-
const prefix = entry.status.toUpperCase();
|
|
408
|
-
const detail = entry.detail ? ` \u2014 ${entry.detail}` : "";
|
|
409
|
-
const remediation = entry.remediation && entry.status !== "pass" ? ` (${entry.remediation})` : "";
|
|
410
|
-
return `${prefix}: ${entry.label}${detail}${remediation}`;
|
|
411
|
-
}).join(`
|
|
412
|
-
`);
|
|
413
|
-
}
|
|
414
|
-
function countDoctorFailures(checks) {
|
|
415
|
-
return checks.filter((entry) => entry.status === "fail").length;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// packages/cli/src/commands/_async-ui.ts
|
|
419
|
-
import pc from "picocolors";
|
|
420
|
-
|
|
421
|
-
// packages/cli/src/commands/_spinner.ts
|
|
422
|
-
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
423
|
-
function createTtySpinner(input) {
|
|
424
|
-
const output = input.output ?? process.stdout;
|
|
425
|
-
const isTty = output.isTTY === true;
|
|
426
|
-
const frames = input.frames && input.frames.length > 0 ? input.frames : SPINNER_FRAMES;
|
|
427
|
-
let label = input.label;
|
|
428
|
-
let frame = 0;
|
|
429
|
-
let paused = false;
|
|
430
|
-
let stopped = false;
|
|
431
|
-
let lastPrintedLabel = "";
|
|
432
|
-
const render = () => {
|
|
433
|
-
if (stopped || paused)
|
|
434
|
-
return;
|
|
435
|
-
if (!isTty) {
|
|
436
|
-
if (label !== lastPrintedLabel) {
|
|
437
|
-
output.write(`${label}
|
|
438
|
-
`);
|
|
439
|
-
lastPrintedLabel = label;
|
|
440
|
-
}
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
frame = (frame + 1) % frames.length;
|
|
444
|
-
const glyph = frames[frame] ?? frames[0] ?? "";
|
|
445
|
-
output.write(`\r\x1B[2K${input.styleFrame ? input.styleFrame(glyph) : glyph} ${label}`);
|
|
446
|
-
};
|
|
447
|
-
const clearLine = () => {
|
|
448
|
-
if (isTty)
|
|
449
|
-
output.write("\r\x1B[2K");
|
|
450
|
-
};
|
|
451
|
-
render();
|
|
452
|
-
const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
|
|
453
|
-
return {
|
|
454
|
-
setLabel(next) {
|
|
455
|
-
label = next;
|
|
456
|
-
render();
|
|
457
|
-
},
|
|
458
|
-
pause() {
|
|
459
|
-
paused = true;
|
|
460
|
-
clearLine();
|
|
461
|
-
},
|
|
462
|
-
resume() {
|
|
463
|
-
if (stopped)
|
|
464
|
-
return;
|
|
465
|
-
paused = false;
|
|
466
|
-
render();
|
|
467
|
-
},
|
|
468
|
-
stop(finalLine) {
|
|
469
|
-
if (stopped)
|
|
470
|
-
return;
|
|
471
|
-
stopped = true;
|
|
472
|
-
if (timer)
|
|
473
|
-
clearInterval(timer);
|
|
474
|
-
clearLine();
|
|
475
|
-
if (finalLine)
|
|
476
|
-
output.write(`${finalLine}
|
|
477
|
-
`);
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// packages/cli/src/commands/_async-ui.ts
|
|
483
|
-
var FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
|
|
484
|
-
var DONE_SYMBOL = pc.green("\u25C7");
|
|
485
|
-
var FAIL_SYMBOL = pc.red("\u25A0");
|
|
486
|
-
var activeUpdate = null;
|
|
487
|
-
async function withSpinner(label, work, options = {}) {
|
|
488
|
-
if (options.outputMode === "json") {
|
|
489
|
-
return work(() => {
|
|
490
|
-
return;
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
if (activeUpdate) {
|
|
494
|
-
activeUpdate(label);
|
|
495
|
-
return work(activeUpdate);
|
|
496
|
-
}
|
|
497
|
-
const output = options.output ?? process.stderr;
|
|
498
|
-
const isTty = output.isTTY === true;
|
|
499
|
-
let lastLabel = label;
|
|
500
|
-
if (!isTty) {
|
|
501
|
-
output.write(`${label}
|
|
502
|
-
`);
|
|
503
|
-
const update2 = (next) => {
|
|
504
|
-
lastLabel = next;
|
|
505
|
-
};
|
|
506
|
-
activeUpdate = update2;
|
|
507
|
-
try {
|
|
508
|
-
return await work(update2);
|
|
509
|
-
} finally {
|
|
510
|
-
activeUpdate = null;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
const spinner = createTtySpinner({
|
|
514
|
-
label,
|
|
515
|
-
output,
|
|
516
|
-
frames: FRAMES,
|
|
517
|
-
styleFrame: (frame) => pc.cyan(frame)
|
|
518
|
-
});
|
|
519
|
-
const update = (next) => {
|
|
520
|
-
lastLabel = next;
|
|
521
|
-
spinner.setLabel(next);
|
|
522
|
-
};
|
|
523
|
-
activeUpdate = update;
|
|
524
|
-
try {
|
|
525
|
-
const result = await work(update);
|
|
526
|
-
spinner.stop(options.doneLabel ? `${DONE_SYMBOL} ${options.doneLabel}` : undefined);
|
|
527
|
-
return result;
|
|
528
|
-
} catch (error) {
|
|
529
|
-
spinner.stop(`${FAIL_SYMBOL} ${lastLabel}`);
|
|
530
|
-
throw error;
|
|
531
|
-
} finally {
|
|
532
|
-
activeUpdate = null;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// packages/cli/src/commands/setup.ts
|
|
537
|
-
async function executeSetup(context, args) {
|
|
538
|
-
const [command = "check", ...rest] = args;
|
|
539
|
-
switch (command) {
|
|
540
|
-
case "bootstrap":
|
|
541
|
-
requireNoExtraArgs(rest, "rig setup bootstrap");
|
|
542
|
-
{
|
|
543
|
-
const hostBash = Bun.which("bash") || "/bin/bash";
|
|
544
|
-
const env = { ...process.env };
|
|
545
|
-
delete env.BASH;
|
|
546
|
-
delete env.RIG_BASH_MODE;
|
|
547
|
-
delete env.RIG_TASK_ID;
|
|
548
|
-
delete env.RIG_TASK_RUNTIME_ID;
|
|
549
|
-
delete env.RIG_TASK_WORKSPACE;
|
|
550
|
-
const proc = Bun.spawn([hostBash, "./bootstrap.sh"], {
|
|
551
|
-
cwd: context.projectRoot,
|
|
552
|
-
env,
|
|
553
|
-
stdin: "inherit",
|
|
554
|
-
stdout: "inherit",
|
|
555
|
-
stderr: "inherit"
|
|
556
|
-
});
|
|
557
|
-
const exitCode = await proc.exited;
|
|
558
|
-
if (exitCode !== 0) {
|
|
559
|
-
throw new CliError(`Command failed (${exitCode}): ${hostBash} ./bootstrap.sh`, exitCode);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
return { ok: true, group: "setup", command };
|
|
563
|
-
case "check":
|
|
564
|
-
requireNoExtraArgs(rest, `rig setup ${command}`);
|
|
565
|
-
{
|
|
566
|
-
const checks = await withMutedConsole(context.outputMode === "json", () => runSetupCheck(context.projectRoot, context.outputMode));
|
|
567
|
-
return { ok: true, group: "setup", command, details: { checks, failures: countDoctorFailures(checks) } };
|
|
568
|
-
}
|
|
569
|
-
case "setup":
|
|
570
|
-
requireNoExtraArgs(rest, "rig setup setup");
|
|
571
|
-
withMutedConsole(context.outputMode === "json", () => runSetupInit(context.projectRoot));
|
|
572
|
-
return { ok: true, group: "setup", command };
|
|
573
|
-
case "preflight":
|
|
574
|
-
requireNoExtraArgs(rest, "rig setup preflight");
|
|
575
|
-
await withMutedConsole(context.outputMode === "json", () => runSetupPreflight(context.projectRoot, context.outputMode));
|
|
576
|
-
return { ok: true, group: "setup", command };
|
|
577
|
-
default:
|
|
578
|
-
throw new CliError(`Unknown setup command: ${command}`, 1, { hint: "Run `rig setup --help` \u2014 commands are bootstrap|check|preflight." });
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
function formatTaskSourceKinds(kinds) {
|
|
582
|
-
return kinds.length > 0 ? kinds.join(", ") : "none";
|
|
583
|
-
}
|
|
584
|
-
function buildTaskSourceKindSetupCheck(config) {
|
|
585
|
-
if (!config.taskSource)
|
|
586
|
-
return null;
|
|
587
|
-
const kind = config.taskSource.kind;
|
|
588
|
-
const pluginHost = createPluginHost(config.plugins ?? []);
|
|
589
|
-
const registeredKinds = pluginHost.listExecutableTaskSources().map((source) => source.kind);
|
|
590
|
-
const isRegistered = Boolean(pluginHost.resolveTaskSourceFactoryByKind(kind));
|
|
591
|
-
return {
|
|
592
|
-
ok: isRegistered,
|
|
593
|
-
label: `task source kind "${kind}" registered`,
|
|
594
|
-
hint: isRegistered ? undefined : `registered kinds: ${formatTaskSourceKinds(registeredKinds)}; load a plugin that contributes an executable task source factory for "${kind}"`
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
function runSetupInit(projectRoot) {
|
|
598
|
-
const stateDir = resolveControlPlaneHostStateDir(projectRoot);
|
|
599
|
-
const logsDir = resolveControlPlaneHostLogsDir(projectRoot);
|
|
600
|
-
const artifactsDir = resolveControlPlaneArtifactsDir(projectRoot);
|
|
601
|
-
mkdirSync2(stateDir, { recursive: true });
|
|
602
|
-
mkdirSync2(logsDir, { recursive: true });
|
|
603
|
-
mkdirSync2(artifactsDir, { recursive: true });
|
|
604
|
-
const failuresPath = resolve5(stateDir, "failed_approaches.md");
|
|
605
|
-
if (!existsSync4(failuresPath)) {
|
|
606
|
-
writeFileSync2(failuresPath, `# Failed Approaches
|
|
607
|
-
|
|
608
|
-
`, "utf-8");
|
|
609
|
-
}
|
|
610
|
-
console.log("Harness directories ready.");
|
|
611
|
-
}
|
|
612
|
-
async function runSetupCheck(projectRoot, outputMode = "text") {
|
|
613
|
-
const doctorChecks = await withSpinner("Running setup checks\u2026", (update) => runRigDoctorChecks({ projectRoot, onProgress: update }), { outputMode });
|
|
614
|
-
console.log(formatDoctorChecks(doctorChecks));
|
|
615
|
-
const failures = countDoctorFailures(doctorChecks);
|
|
616
|
-
if (failures > 0) {
|
|
617
|
-
throw new CliError(`Setup check failed (${failures} failing doctor check${failures === 1 ? "" : "s"}).`, 1, { hint: "Legacy setup diagnostics failed; for current UX run bare `rig` and open Cockpit \u2192 Doctor for remediation details." });
|
|
618
|
-
}
|
|
619
|
-
return doctorChecks;
|
|
620
|
-
}
|
|
621
|
-
async function runSetupPreflight(projectRoot, outputMode = "text") {
|
|
622
|
-
await runSetupCheck(projectRoot, outputMode);
|
|
623
|
-
const validationRoot = resolve5(resolveControlPlaneDefinitionRoot(projectRoot), "validation");
|
|
624
|
-
if (existsSync4(validationRoot)) {
|
|
625
|
-
const validators = readdirSync(validationRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory());
|
|
626
|
-
for (const validator of validators) {
|
|
627
|
-
const script = resolve5(validationRoot, validator.name, "validate.sh");
|
|
628
|
-
if (existsSync4(script)) {
|
|
629
|
-
console.log(`OK: validator script ${script}`);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
const hooksRoot = resolve5(resolveControlPlaneDefinitionRoot(projectRoot), "hooks");
|
|
634
|
-
if (existsSync4(hooksRoot)) {
|
|
635
|
-
const hooks = readdirSync(hooksRoot).filter((name) => name.endsWith(".sh"));
|
|
636
|
-
for (const hook of hooks) {
|
|
637
|
-
console.log(`OK: hook ${hook}`);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
export {
|
|
642
|
-
executeSetup,
|
|
643
|
-
buildTaskSourceKindSetupCheck
|
|
644
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { RigStatsData } from "@rig/contracts";
|
|
2
|
-
import type { CommandOutcome } from "@rig/runtime";
|
|
3
|
-
import { type RunnerContext } from "../runner";
|
|
4
|
-
import { listRunProjections } from "./_run-projection";
|
|
5
|
-
type StatsCommandDeps = {
|
|
6
|
-
listRuns?: typeof listRunProjections;
|
|
7
|
-
};
|
|
8
|
-
export declare function parseSinceOption(value: string | undefined, now?: Date): Date | null;
|
|
9
|
-
export declare function computeRigStats(projectRoot: string, options?: {
|
|
10
|
-
since?: Date | null;
|
|
11
|
-
listRuns?: typeof listRunProjections;
|
|
12
|
-
}): Promise<RigStatsData>;
|
|
13
|
-
export declare function formatStatsRows(stats: RigStatsData): Array<[string, unknown]>;
|
|
14
|
-
export declare function executeStats(context: RunnerContext, args: string[], deps?: StatsCommandDeps): Promise<CommandOutcome>;
|
|
15
|
-
export {};
|