@beastmode-develeap/beastmode 0.1.335 → 0.1.337
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 +42 -33
- package/dist/index.js.map +1 -1
- package/dist/web/board.html +1 -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
|
@@ -5281,7 +5281,7 @@ var init_chat_handler = __esm({
|
|
|
5281
5281
|
});
|
|
5282
5282
|
|
|
5283
5283
|
// src/cli/ui/board-api-routes.ts
|
|
5284
|
-
import { readFileSync as readFileSync14, writeFileSync as writeFileSync13, existsSync as existsSync16, readdirSync as readdirSync8, unlinkSync as unlinkSync4, mkdirSync as mkdirSync12, statSync as statSync6 } from "fs";
|
|
5284
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync13, existsSync as existsSync16, readdirSync as readdirSync8, unlinkSync as unlinkSync4, mkdirSync as mkdirSync12, statSync as statSync6, rmSync as rmSync3 } from "fs";
|
|
5285
5285
|
import { join as join15, basename as basename5, resolve as resolve4, dirname as dirname6, sep } from "path";
|
|
5286
5286
|
import { homedir } from "os";
|
|
5287
5287
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -6405,6 +6405,7 @@ function getBoardRoutes(factoryDir) {
|
|
|
6405
6405
|
const { path: projectPath, github_url, clone_target } = body;
|
|
6406
6406
|
const boardUrl = getBoardUrl2(factoryDir);
|
|
6407
6407
|
let resolvedPath;
|
|
6408
|
+
let createdCloneDir = false;
|
|
6408
6409
|
if (github_url) {
|
|
6409
6410
|
const url = github_url.trim();
|
|
6410
6411
|
if (!/^(https?:\/\/|git@)/.test(url)) {
|
|
@@ -6456,6 +6457,7 @@ function getBoardRoutes(factoryDir) {
|
|
|
6456
6457
|
const errMsg = stderr.trim() || stdout.trim() || (result.error ? result.error.message : `exit ${result.status}`);
|
|
6457
6458
|
throw new Error(`git clone failed: ${errMsg}`);
|
|
6458
6459
|
}
|
|
6460
|
+
createdCloneDir = true;
|
|
6459
6461
|
} else if (projectPath) {
|
|
6460
6462
|
resolvedPath = resolve4(projectPath);
|
|
6461
6463
|
if (!existsSync16(resolvedPath)) throw new Error(`Directory not found: ${resolvedPath}`);
|
|
@@ -6463,39 +6465,46 @@ function getBoardRoutes(factoryDir) {
|
|
|
6463
6465
|
throw new Error("Missing required field: provide either `path` (local) or `github_url` (clone)");
|
|
6464
6466
|
}
|
|
6465
6467
|
const projectName = basename5(resolvedPath);
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
const stack = detectStack(resolvedPath);
|
|
6472
|
-
let verifyPort = 3001;
|
|
6473
|
-
for (const existing of existingProjects) {
|
|
6474
|
-
const port = existing.deploy?.verify_port;
|
|
6475
|
-
if (typeof port === "number" && port >= verifyPort) verifyPort = port + 1;
|
|
6476
|
-
}
|
|
6477
|
-
const record = createProjectRecord({
|
|
6478
|
-
name: projectName,
|
|
6479
|
-
resolvedPath,
|
|
6480
|
-
gitRemote: stack.git_remote || void 0,
|
|
6481
|
-
verifyPort,
|
|
6482
|
-
plugins: stack.suggested_plugins || [],
|
|
6483
|
-
deployTarget: stack.suggested_deploy || "pr-only",
|
|
6484
|
-
stack: {
|
|
6485
|
-
detected: stack.framework,
|
|
6486
|
-
build_command: stack.suggested_commands.build,
|
|
6487
|
-
dev_command: stack.suggested_commands.dev,
|
|
6488
|
-
test_command: stack.suggested_commands.test,
|
|
6489
|
-
install_command: stack.suggested_commands.install,
|
|
6490
|
-
dev_port: stack.dev_port,
|
|
6491
|
-
is_monorepo: stack.is_monorepo,
|
|
6492
|
-
total_packages: stack.total_packages,
|
|
6493
|
-
primary_languages: stack.primary_languages,
|
|
6494
|
-
...stack.packages ? { packages: stack.packages } : {}
|
|
6468
|
+
try {
|
|
6469
|
+
const existingResp = await proxyToBoard(boardUrl, "GET", "/api/projects");
|
|
6470
|
+
const existingProjects = existingResp.projects || [];
|
|
6471
|
+
if (existingProjects.some((p) => p.name === projectName)) {
|
|
6472
|
+
throw new HttpError(409, { error: `Project already exists: ${projectName}` });
|
|
6495
6473
|
}
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6474
|
+
const stack = detectStack(resolvedPath);
|
|
6475
|
+
let verifyPort = 3001;
|
|
6476
|
+
for (const existing of existingProjects) {
|
|
6477
|
+
const port = existing.deploy?.verify_port;
|
|
6478
|
+
if (typeof port === "number" && port >= verifyPort) verifyPort = port + 1;
|
|
6479
|
+
}
|
|
6480
|
+
const record = createProjectRecord({
|
|
6481
|
+
name: projectName,
|
|
6482
|
+
resolvedPath,
|
|
6483
|
+
gitRemote: stack.git_remote || void 0,
|
|
6484
|
+
verifyPort,
|
|
6485
|
+
plugins: stack.suggested_plugins || [],
|
|
6486
|
+
deployTarget: stack.suggested_deploy || "pr-only",
|
|
6487
|
+
stack: {
|
|
6488
|
+
detected: stack.framework,
|
|
6489
|
+
build_command: stack.suggested_commands.build,
|
|
6490
|
+
dev_command: stack.suggested_commands.dev,
|
|
6491
|
+
test_command: stack.suggested_commands.test,
|
|
6492
|
+
install_command: stack.suggested_commands.install,
|
|
6493
|
+
dev_port: stack.dev_port,
|
|
6494
|
+
is_monorepo: stack.is_monorepo,
|
|
6495
|
+
total_packages: stack.total_packages,
|
|
6496
|
+
primary_languages: stack.primary_languages,
|
|
6497
|
+
...stack.packages ? { packages: stack.packages } : {}
|
|
6498
|
+
}
|
|
6499
|
+
});
|
|
6500
|
+
const stored = await proxyToBoard(boardUrl, "POST", "/api/projects", record);
|
|
6501
|
+
return stored;
|
|
6502
|
+
} catch (err) {
|
|
6503
|
+
if (createdCloneDir && existsSync16(resolvedPath)) {
|
|
6504
|
+
rmSync3(resolvedPath, { recursive: true, force: true });
|
|
6505
|
+
}
|
|
6506
|
+
throw err;
|
|
6507
|
+
}
|
|
6499
6508
|
}
|
|
6500
6509
|
},
|
|
6501
6510
|
{
|