@beastmode-develeap/beastmode 0.1.300 → 0.1.302
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/index.js +34 -6
- package/dist/index.js.map +1 -1
- package/dist/web/board.html +270 -1
- package/dist/web/build-commit.txt +1 -1
- package/dist/web/build-stamp.txt +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14310,11 +14310,14 @@ import {
|
|
|
14310
14310
|
writeFileSync as writeFileSync30
|
|
14311
14311
|
} from "fs";
|
|
14312
14312
|
import { dirname as dirname9, join as join36 } from "path";
|
|
14313
|
-
var TARGET_LABEL = "[self-hosted, beastmode]";
|
|
14313
|
+
var TARGET_LABEL = "[self-hosted, self-hosted-beastmode]";
|
|
14314
14314
|
var TARGET_WORKFLOWS = [
|
|
14315
14315
|
".github/workflows/test.yml",
|
|
14316
|
-
".github/workflows/dogfood-e2e.yml"
|
|
14316
|
+
".github/workflows/dogfood-e2e.yml",
|
|
14317
|
+
".github/workflows/docker-publish.yml",
|
|
14318
|
+
".github/workflows/audit-settings.yml"
|
|
14317
14319
|
];
|
|
14320
|
+
var RUNNER_REQUIRED_LABEL = "self-hosted-beastmode";
|
|
14318
14321
|
var STATE_FILE = ".beastmode/runner-workflow-state.json";
|
|
14319
14322
|
var RUNS_ON_REGEX = /^(\s+runs-on:\s*)(.+)$/;
|
|
14320
14323
|
function replaceRunsOn(content, targetLabel) {
|
|
@@ -14347,26 +14350,48 @@ function restoreRunsOn(content, originals) {
|
|
|
14347
14350
|
});
|
|
14348
14351
|
return newLines.join("\n");
|
|
14349
14352
|
}
|
|
14353
|
+
async function assertOnlineRunnerExists() {
|
|
14354
|
+
const config = resolveGitHubConfig();
|
|
14355
|
+
const list = await listRunners(config);
|
|
14356
|
+
const matching = list.runners.filter(
|
|
14357
|
+
(r) => r.status === "online" && r.labels.some((l) => l.name === RUNNER_REQUIRED_LABEL)
|
|
14358
|
+
);
|
|
14359
|
+
if (matching.length === 0) {
|
|
14360
|
+
throw new Error(
|
|
14361
|
+
"Target label `[self-hosted, self-hosted-beastmode]` has no online runners; check `beastmode runner status`."
|
|
14362
|
+
);
|
|
14363
|
+
}
|
|
14364
|
+
}
|
|
14350
14365
|
async function switchWorkflows(projectDir) {
|
|
14351
14366
|
const statePath = join36(projectDir, STATE_FILE);
|
|
14352
14367
|
if (existsSync37(statePath)) {
|
|
14353
|
-
return { alreadySwitched: true, files: [] };
|
|
14368
|
+
return { alreadySwitched: true, files: [], skipped: [] };
|
|
14354
14369
|
}
|
|
14370
|
+
await assertOnlineRunnerExists();
|
|
14355
14371
|
const state = {
|
|
14356
14372
|
switched_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14357
14373
|
target_label: TARGET_LABEL,
|
|
14358
14374
|
files: []
|
|
14359
14375
|
};
|
|
14360
14376
|
const resultFiles = [];
|
|
14377
|
+
const skipped = [];
|
|
14361
14378
|
for (const relPath of TARGET_WORKFLOWS) {
|
|
14362
14379
|
const absPath = join36(projectDir, relPath);
|
|
14363
14380
|
if (!existsSync37(absPath)) {
|
|
14364
|
-
|
|
14381
|
+
skipped.push({ relativePath: relPath, reason: "missing" });
|
|
14382
|
+
continue;
|
|
14365
14383
|
}
|
|
14366
14384
|
const content = readFileSync34(absPath, "utf-8");
|
|
14367
14385
|
const { newContent, originals } = replaceRunsOn(content, TARGET_LABEL);
|
|
14368
14386
|
if (originals.length === 0) {
|
|
14369
|
-
|
|
14387
|
+
skipped.push({ relativePath: relPath, reason: "no_runs_on" });
|
|
14388
|
+
continue;
|
|
14389
|
+
}
|
|
14390
|
+
const allAtTarget = originals.every(
|
|
14391
|
+
(o) => o.line.match(RUNS_ON_REGEX)?.[2] === TARGET_LABEL
|
|
14392
|
+
);
|
|
14393
|
+
if (allAtTarget) {
|
|
14394
|
+
skipped.push({ relativePath: relPath, reason: "already_at_target" });
|
|
14370
14395
|
}
|
|
14371
14396
|
writeFileSync30(absPath, newContent, "utf-8");
|
|
14372
14397
|
state.files.push({ relativePath: relPath, originals });
|
|
@@ -14374,7 +14399,7 @@ async function switchWorkflows(projectDir) {
|
|
|
14374
14399
|
}
|
|
14375
14400
|
mkdirSync23(dirname9(statePath), { recursive: true });
|
|
14376
14401
|
writeFileSync30(statePath, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
14377
|
-
return { alreadySwitched: false, files: resultFiles };
|
|
14402
|
+
return { alreadySwitched: false, files: resultFiles, skipped };
|
|
14378
14403
|
}
|
|
14379
14404
|
async function restoreWorkflows(projectDir) {
|
|
14380
14405
|
const statePath = join36(projectDir, STATE_FILE);
|
|
@@ -14716,6 +14741,9 @@ runnerCommand.command("switch-workflows").description("Switch workflow runs-on t
|
|
|
14716
14741
|
for (const file of result.files) {
|
|
14717
14742
|
success(`${file.relativePath}: ${file.jobCount} job(s) switched`);
|
|
14718
14743
|
}
|
|
14744
|
+
for (const skip of result.skipped) {
|
|
14745
|
+
info(`${skip.relativePath}: skipped (${skip.reason})`);
|
|
14746
|
+
}
|
|
14719
14747
|
info("State saved to .beastmode/runner-workflow-state.json");
|
|
14720
14748
|
} catch (err) {
|
|
14721
14749
|
error(err.message);
|