@beastmode-develeap/beastmode 0.1.3 → 0.1.5
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 +96 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6901,6 +6901,75 @@ function isGhcrAuthenticated() {
|
|
|
6901
6901
|
return false;
|
|
6902
6902
|
}
|
|
6903
6903
|
}
|
|
6904
|
+
function loginToGhcr(token) {
|
|
6905
|
+
try {
|
|
6906
|
+
execSync(`echo "${token}" | docker login ghcr.io -u beastmode --password-stdin`, {
|
|
6907
|
+
encoding: "utf-8",
|
|
6908
|
+
timeout: 15e3,
|
|
6909
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6910
|
+
});
|
|
6911
|
+
try {
|
|
6912
|
+
execSync(`docker manifest inspect ${GHCR_IMAGE_PREFIX}/board:latest`, {
|
|
6913
|
+
encoding: "utf-8",
|
|
6914
|
+
timeout: 15e3,
|
|
6915
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6916
|
+
});
|
|
6917
|
+
return true;
|
|
6918
|
+
} catch {
|
|
6919
|
+
try {
|
|
6920
|
+
execSync("docker logout ghcr.io", {
|
|
6921
|
+
encoding: "utf-8",
|
|
6922
|
+
timeout: 5e3,
|
|
6923
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6924
|
+
});
|
|
6925
|
+
} catch {
|
|
6926
|
+
}
|
|
6927
|
+
return false;
|
|
6928
|
+
}
|
|
6929
|
+
} catch {
|
|
6930
|
+
return false;
|
|
6931
|
+
}
|
|
6932
|
+
}
|
|
6933
|
+
function seedConfigFromImage(targetDir, tag) {
|
|
6934
|
+
const configDir = join8(targetDir, "config");
|
|
6935
|
+
const containerName = "bm-config-seed";
|
|
6936
|
+
try {
|
|
6937
|
+
try {
|
|
6938
|
+
execSync(`docker rm -f ${containerName}`, {
|
|
6939
|
+
encoding: "utf-8",
|
|
6940
|
+
timeout: 1e4,
|
|
6941
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6942
|
+
});
|
|
6943
|
+
} catch {
|
|
6944
|
+
}
|
|
6945
|
+
execSync(`docker create --name ${containerName} ${GHCR_IMAGE_PREFIX}/daemon:${tag}`, {
|
|
6946
|
+
encoding: "utf-8",
|
|
6947
|
+
timeout: 3e4,
|
|
6948
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6949
|
+
});
|
|
6950
|
+
execSync(`docker cp ${containerName}:/app/config/. "${configDir}/"`, {
|
|
6951
|
+
encoding: "utf-8",
|
|
6952
|
+
timeout: 15e3,
|
|
6953
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6954
|
+
});
|
|
6955
|
+
execSync(`docker rm ${containerName}`, {
|
|
6956
|
+
encoding: "utf-8",
|
|
6957
|
+
timeout: 1e4,
|
|
6958
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6959
|
+
});
|
|
6960
|
+
return true;
|
|
6961
|
+
} catch {
|
|
6962
|
+
try {
|
|
6963
|
+
execSync(`docker rm -f ${containerName}`, {
|
|
6964
|
+
encoding: "utf-8",
|
|
6965
|
+
timeout: 1e4,
|
|
6966
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6967
|
+
});
|
|
6968
|
+
} catch {
|
|
6969
|
+
}
|
|
6970
|
+
return false;
|
|
6971
|
+
}
|
|
6972
|
+
}
|
|
6904
6973
|
function generateComposeYaml(tag) {
|
|
6905
6974
|
return `services:
|
|
6906
6975
|
# Python board API \u2014 data layer (SQLite + WebSocket). Internal only.
|
|
@@ -6999,7 +7068,7 @@ function step(n, total, text) {
|
|
|
6999
7068
|
}
|
|
7000
7069
|
|
|
7001
7070
|
// src/cli/commands/init.ts
|
|
7002
|
-
var initCommand = new Command("init").description("Create a new BeastMode factory").argument("[name]", "Factory name (default: current directory name)").option("--project <path>", "Path to target project").option("--preset <preset>", "Pipeline preset (full, lean, prototype, infra, docs)").option("--backend <backend>", "Task backend (beastmode-board, github-issues)").option("--deploy <target>", "Deploy target (pr-only, vercel, aws-ecs, ...)").option("--methodology <name>", "Development methodology plugin").option("--plugin <name>", "Install plugin (repeatable)", collect, []).option("--from <template>", "Import config from template file").option("--ui", "Open web wizard instead of CLI").option("--yes", "Accept all defaults (non-interactive)").action(async (name, opts) => {
|
|
7071
|
+
var initCommand = new Command("init").description("Create a new BeastMode factory").argument("[name]", "Factory name (default: current directory name)").option("--project <path>", "Path to target project").option("--preset <preset>", "Pipeline preset (full, lean, prototype, infra, docs)").option("--backend <backend>", "Task backend (beastmode-board, github-issues)").option("--deploy <target>", "Deploy target (pr-only, vercel, aws-ecs, ...)").option("--methodology <name>", "Development methodology plugin").option("--plugin <name>", "Install plugin (repeatable)", collect, []).option("--from <template>", "Import config from template file").option("--ui", "Open web wizard instead of CLI").option("--yes", "Accept all defaults (non-interactive)").option("--github-token <token>", "GitHub PAT (avoids interactive prompt)").option("--board-password <password>", "Board UI password (avoids interactive prompt)").action(async (name, opts) => {
|
|
7003
7072
|
try {
|
|
7004
7073
|
await runInit(name, opts);
|
|
7005
7074
|
} catch (err) {
|
|
@@ -7304,7 +7373,7 @@ async function runImageModeInit(name, opts) {
|
|
|
7304
7373
|
const factoryName = name || ".";
|
|
7305
7374
|
const targetDir = resolve5(factoryName === "." ? "." : factoryName);
|
|
7306
7375
|
step(1, totalSteps, "Credentials");
|
|
7307
|
-
let githubToken = process.env.GITHUB_TOKEN || "";
|
|
7376
|
+
let githubToken = opts.githubToken || process.env.GITHUB_TOKEN || "";
|
|
7308
7377
|
if (!githubToken && !opts.yes) {
|
|
7309
7378
|
const answer = await inquirer.prompt([
|
|
7310
7379
|
{
|
|
@@ -7321,8 +7390,8 @@ async function runImageModeInit(name, opts) {
|
|
|
7321
7390
|
} else {
|
|
7322
7391
|
warn("GITHUB_TOKEN not set \u2014 add to .env later");
|
|
7323
7392
|
}
|
|
7324
|
-
let uiPassword = "";
|
|
7325
|
-
if (!opts.yes) {
|
|
7393
|
+
let uiPassword = opts.boardPassword || "";
|
|
7394
|
+
if (!uiPassword && !opts.yes) {
|
|
7326
7395
|
const { password } = await inquirer.prompt([
|
|
7327
7396
|
{
|
|
7328
7397
|
type: "password",
|
|
@@ -7334,24 +7403,29 @@ async function runImageModeInit(name, opts) {
|
|
|
7334
7403
|
uiPassword = password || "";
|
|
7335
7404
|
if (uiPassword) success("Board UI password set");
|
|
7336
7405
|
else info("No board password \u2014 UI will be open");
|
|
7406
|
+
} else if (uiPassword) {
|
|
7407
|
+
success("Board UI password set");
|
|
7337
7408
|
}
|
|
7338
7409
|
step(2, totalSteps, "Docker Registry");
|
|
7339
7410
|
if (!isGhcrAuthenticated()) {
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7411
|
+
if (githubToken && loginToGhcr(githubToken)) {
|
|
7412
|
+
success("Authenticated to ghcr.io (via GitHub token)");
|
|
7413
|
+
} else {
|
|
7414
|
+
info("Not logged in to ghcr.io \u2014 images may still pull if public");
|
|
7415
|
+
info(" To log in manually: docker login ghcr.io -u <your-github-username>");
|
|
7416
|
+
if (!opts.yes && !opts.githubToken) {
|
|
7417
|
+
const { retry } = await inquirer.prompt([
|
|
7418
|
+
{
|
|
7419
|
+
type: "confirm",
|
|
7420
|
+
name: "retry",
|
|
7421
|
+
message: "Continue anyway?",
|
|
7422
|
+
default: true
|
|
7423
|
+
}
|
|
7424
|
+
]);
|
|
7425
|
+
if (!retry) {
|
|
7426
|
+
error("Aborted \u2014 log in to ghcr.io first");
|
|
7427
|
+
process.exit(1);
|
|
7350
7428
|
}
|
|
7351
|
-
]);
|
|
7352
|
-
if (!retry) {
|
|
7353
|
-
error("Aborted \u2014 log in to ghcr.io first");
|
|
7354
|
-
process.exit(1);
|
|
7355
7429
|
}
|
|
7356
7430
|
}
|
|
7357
7431
|
} else {
|
|
@@ -7374,7 +7448,7 @@ async function runImageModeInit(name, opts) {
|
|
|
7374
7448
|
];
|
|
7375
7449
|
writeFileSync13(join15(targetDir, ".env"), envLines.join("\n"), "utf-8");
|
|
7376
7450
|
success(".env");
|
|
7377
|
-
for (const dir of ["data", "runs", "daemon/logs", ".beastmode"]) {
|
|
7451
|
+
for (const dir of ["data", "runs", "daemon/logs", ".beastmode", "config"]) {
|
|
7378
7452
|
mkdirSync12(join15(targetDir, dir), { recursive: true });
|
|
7379
7453
|
}
|
|
7380
7454
|
step(4, totalSteps, "Pull Images");
|
|
@@ -7386,6 +7460,9 @@ async function runImageModeInit(name, opts) {
|
|
|
7386
7460
|
timeout: 3e5
|
|
7387
7461
|
});
|
|
7388
7462
|
success("Images pulled successfully");
|
|
7463
|
+
if (seedConfigFromImage(targetDir, "latest")) {
|
|
7464
|
+
success("Default config files seeded");
|
|
7465
|
+
}
|
|
7389
7466
|
} catch {
|
|
7390
7467
|
console.log();
|
|
7391
7468
|
error("Failed to pull BeastMode images from ghcr.io.");
|