@h-rig/cli 0.0.6-alpha.2 → 0.0.6-alpha.21
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 +1288 -315
- package/dist/src/commands/_authority-runs.js +1 -0
- package/dist/src/commands/_cli-format.js +106 -0
- package/dist/src/commands/_doctor-checks.js +10 -22
- package/dist/src/commands/_operator-surface.js +204 -0
- package/dist/src/commands/_operator-view.js +207 -51
- package/dist/src/commands/_pi-install.js +4 -3
- package/dist/src/commands/_pi-session.js +253 -0
- package/dist/src/commands/_preflight.js +33 -28
- package/dist/src/commands/_server-client.js +80 -27
- package/dist/src/commands/_snapshot-upload.js +7 -20
- package/dist/src/commands/_task-picker.js +44 -16
- package/dist/src/commands/agent.js +2 -0
- package/dist/src/commands/doctor.js +10 -22
- package/dist/src/commands/github.js +9 -22
- package/dist/src/commands/init.js +295 -66
- package/dist/src/commands/queue.js +1 -0
- package/dist/src/commands/run.js +456 -95
- package/dist/src/commands/server.js +9 -22
- package/dist/src/commands/setup.js +10 -22
- package/dist/src/commands/task-run-driver.js +539 -64
- package/dist/src/commands/task.js +502 -130
- package/dist/src/commands.js +1276 -306
- package/dist/src/index.js +1288 -315
- package/dist/src/launcher.js +5 -3
- package/dist/src/runner.js +3 -2
- package/package.json +5 -4
|
@@ -61,7 +61,6 @@ function normalizeRuntimeAdapter(value) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// packages/cli/src/commands/_server-client.ts
|
|
64
|
-
import { spawnSync } from "child_process";
|
|
65
64
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
66
65
|
import { resolve as resolve2 } from "path";
|
|
67
66
|
import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
|
|
@@ -149,7 +148,7 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
// packages/cli/src/commands/_server-client.ts
|
|
152
|
-
var
|
|
151
|
+
var scopedGitHubBearerTokens = new Map;
|
|
153
152
|
function cleanToken(value) {
|
|
154
153
|
const trimmed = value?.trim();
|
|
155
154
|
return trimmed ? trimmed : null;
|
|
@@ -166,25 +165,13 @@ function readPrivateRemoteSessionToken(projectRoot) {
|
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
function readGitHubBearerTokenForRemote(projectRoot) {
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
const scopedKey = resolve2(projectRoot);
|
|
169
|
+
if (scopedGitHubBearerTokens.has(scopedKey))
|
|
170
|
+
return scopedGitHubBearerTokens.get(scopedKey) ?? null;
|
|
171
171
|
const privateSession = readPrivateRemoteSessionToken(projectRoot);
|
|
172
|
-
if (privateSession)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
const envToken = cleanToken(process.env.RIG_GITHUB_TOKEN) ?? cleanToken(process.env.GITHUB_TOKEN) ?? cleanToken(process.env.GH_TOKEN);
|
|
177
|
-
if (envToken) {
|
|
178
|
-
cachedGitHubBearerToken = envToken;
|
|
179
|
-
return cachedGitHubBearerToken;
|
|
180
|
-
}
|
|
181
|
-
const result = spawnSync("gh", ["auth", "token"], {
|
|
182
|
-
encoding: "utf8",
|
|
183
|
-
timeout: 5000,
|
|
184
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
185
|
-
});
|
|
186
|
-
cachedGitHubBearerToken = result.status === 0 ? cleanToken(result.stdout) : null;
|
|
187
|
-
return cachedGitHubBearerToken;
|
|
172
|
+
if (privateSession)
|
|
173
|
+
return privateSession;
|
|
174
|
+
return cleanToken(process.env.RIG_SERVER_AUTH_TOKEN) ?? cleanToken(process.env.RIG_REMOTE_AUTH_TOKEN);
|
|
188
175
|
}
|
|
189
176
|
async function ensureServerForCli(projectRoot) {
|
|
190
177
|
try {
|
|
@@ -299,7 +286,7 @@ async function executeServer(context, args, options) {
|
|
|
299
286
|
const authTokenResult = takeOption(pending, "--auth-token");
|
|
300
287
|
pending = authTokenResult.rest;
|
|
301
288
|
requireNoExtraArgs(pending, "bun run rig server start [--host <host>] [--port <n>] [--poll-ms <n>] [--auth-token <token>]");
|
|
302
|
-
const commandParts = ["
|
|
289
|
+
const commandParts = ["rig-server", "start"];
|
|
303
290
|
if (hostResult.value) {
|
|
304
291
|
commandParts.push("--host", hostResult.value);
|
|
305
292
|
}
|
|
@@ -322,7 +309,7 @@ async function executeServer(context, args, options) {
|
|
|
322
309
|
const eventResult = takeOption(pending, "--event");
|
|
323
310
|
pending = eventResult.rest;
|
|
324
311
|
requireNoExtraArgs(pending, "bun run rig server notify-test [--event <type>]");
|
|
325
|
-
const commandParts = ["
|
|
312
|
+
const commandParts = ["rig-server", "notify-test"];
|
|
326
313
|
if (eventResult.value) {
|
|
327
314
|
commandParts.push("--event", eventResult.value);
|
|
328
315
|
}
|
|
@@ -102,7 +102,8 @@ function resolveControlPlaneDefinitionRoot(projectRoot) {
|
|
|
102
102
|
import { existsSync, readFileSync, rmSync } from "fs";
|
|
103
103
|
import { homedir } from "os";
|
|
104
104
|
import { resolve as resolve2 } from "path";
|
|
105
|
-
var PI_RIG_PACKAGE_NAME = "@rig/pi-rig";
|
|
105
|
+
var PI_RIG_PACKAGE_NAME = "@h-rig/pi-rig";
|
|
106
|
+
var LEGACY_PI_RIG_PACKAGE_NAME = "@rig/pi-rig";
|
|
106
107
|
async function defaultCommandRunner(command, options = {}) {
|
|
107
108
|
const proc = Bun.spawn(command, { cwd: options.cwd, stdout: "pipe", stderr: "pipe" });
|
|
108
109
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
@@ -121,7 +122,7 @@ function resolvePiHomeDir(inputHomeDir) {
|
|
|
121
122
|
function piListContainsPiRig(output) {
|
|
122
123
|
return output.split(/\r?\n/).some((line) => {
|
|
123
124
|
const normalized = line.trim();
|
|
124
|
-
return normalized.includes(PI_RIG_PACKAGE_NAME) || /(?:^|[\\/])packages[\\/]pi-rig(?:$|\s)/.test(normalized);
|
|
125
|
+
return normalized.includes(PI_RIG_PACKAGE_NAME) || normalized.includes(LEGACY_PI_RIG_PACKAGE_NAME) || /(?:^|[\\/])packages[\\/]pi-rig(?:$|\s)/.test(normalized);
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
async function safeRun(runner, command, options) {
|
|
@@ -258,11 +259,10 @@ function resolveSelectedConnection(projectRoot, options = {}) {
|
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
// packages/cli/src/commands/_server-client.ts
|
|
261
|
-
import { spawnSync } from "child_process";
|
|
262
262
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
263
263
|
import { resolve as resolve4 } from "path";
|
|
264
264
|
import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
|
|
265
|
-
var
|
|
265
|
+
var scopedGitHubBearerTokens = new Map;
|
|
266
266
|
function cleanToken(value) {
|
|
267
267
|
const trimmed = value?.trim();
|
|
268
268
|
return trimmed ? trimmed : null;
|
|
@@ -279,25 +279,13 @@ function readPrivateRemoteSessionToken(projectRoot) {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
function readGitHubBearerTokenForRemote(projectRoot) {
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
const scopedKey = resolve4(projectRoot);
|
|
283
|
+
if (scopedGitHubBearerTokens.has(scopedKey))
|
|
284
|
+
return scopedGitHubBearerTokens.get(scopedKey) ?? null;
|
|
284
285
|
const privateSession = readPrivateRemoteSessionToken(projectRoot);
|
|
285
|
-
if (privateSession)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
const envToken = cleanToken(process.env.RIG_GITHUB_TOKEN) ?? cleanToken(process.env.GITHUB_TOKEN) ?? cleanToken(process.env.GH_TOKEN);
|
|
290
|
-
if (envToken) {
|
|
291
|
-
cachedGitHubBearerToken = envToken;
|
|
292
|
-
return cachedGitHubBearerToken;
|
|
293
|
-
}
|
|
294
|
-
const result = spawnSync("gh", ["auth", "token"], {
|
|
295
|
-
encoding: "utf8",
|
|
296
|
-
timeout: 5000,
|
|
297
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
298
|
-
});
|
|
299
|
-
cachedGitHubBearerToken = result.status === 0 ? cleanToken(result.stdout) : null;
|
|
300
|
-
return cachedGitHubBearerToken;
|
|
286
|
+
if (privateSession)
|
|
287
|
+
return privateSession;
|
|
288
|
+
return cleanToken(process.env.RIG_SERVER_AUTH_TOKEN) ?? cleanToken(process.env.RIG_REMOTE_AUTH_TOKEN);
|
|
301
289
|
}
|
|
302
290
|
async function ensureServerForCli(projectRoot) {
|
|
303
291
|
try {
|