@beastmode-develeap/beastmode 0.1.319 → 0.1.321

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 CHANGED
@@ -5256,7 +5256,7 @@ var init_chat_handler = __esm({
5256
5256
  });
5257
5257
 
5258
5258
  // src/cli/ui/board-api-routes.ts
5259
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as existsSync16, readdirSync as readdirSync8, unlinkSync as unlinkSync4, mkdirSync as mkdirSync12, statSync as statSync6, rmSync as rmSync3 } from "fs";
5259
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as existsSync16, readdirSync as readdirSync8, unlinkSync as unlinkSync4, mkdirSync as mkdirSync12, statSync as statSync6, renameSync as renameSync3 } from "fs";
5260
5260
  import { join as join14, basename as basename5, resolve as resolve4, dirname as dirname5, sep } from "path";
5261
5261
  import { homedir } from "os";
5262
5262
  import { randomUUID as randomUUID2 } from "crypto";
@@ -6426,6 +6426,9 @@ function getBoardRoutes(factoryDir) {
6426
6426
  throw new Error("Missing required field: provide either `path` (local) or `github_url` (clone)");
6427
6427
  }
6428
6428
  const projectName = basename5(resolvedPath);
6429
+ if (existsSync16(join14(projectsDir, projectName, "project.json"))) {
6430
+ throw new HttpError(409, { error: `Project already exists: ${projectName}` });
6431
+ }
6429
6432
  const stack = detectStack(resolvedPath);
6430
6433
  let verifyPort = 3001;
6431
6434
  for (const existing of listProjectRecords(projectsDir)) {
@@ -6471,9 +6474,15 @@ function getBoardRoutes(factoryDir) {
6471
6474
  const hasSubDir = existsSync16(join14(subDir, "project.json"));
6472
6475
  const hasFlat = existsSync16(flatPath);
6473
6476
  if (!hasSubDir && !hasFlat) throw new Error(`Project not found: ${name}`);
6474
- if (hasSubDir) rmSync3(subDir, { recursive: true, force: true });
6475
- else if (existsSync16(subDir)) rmSync3(subDir, { recursive: true, force: true });
6476
- if (hasFlat) unlinkSync4(flatPath);
6477
+ const archivedBase = join14(projectsDir, ".archived");
6478
+ mkdirSync12(archivedBase, { recursive: true });
6479
+ const uniq = (dest) => existsSync16(dest) ? `${dest}-${Date.now()}` : dest;
6480
+ if (hasSubDir || existsSync16(subDir)) {
6481
+ renameSync3(subDir, uniq(join14(archivedBase, name)));
6482
+ }
6483
+ if (hasFlat) {
6484
+ renameSync3(flatPath, uniq(join14(archivedBase, `${name}.json`)));
6485
+ }
6477
6486
  return { success: true };
6478
6487
  }
6479
6488
  },
@@ -14858,7 +14867,7 @@ runnerCommand.command("build-image").description(
14858
14867
  // src/cli/commands/project-cmd.ts
14859
14868
  init_engine();
14860
14869
  import { Command as Command24 } from "commander";
14861
- import { existsSync as existsSync39, mkdirSync as mkdirSync24, readFileSync as readFileSync35, renameSync as renameSync3 } from "fs";
14870
+ import { existsSync as existsSync39, mkdirSync as mkdirSync24, readFileSync as readFileSync35, renameSync as renameSync4 } from "fs";
14862
14871
  import { join as join38, resolve as resolve21, basename as basename9 } from "path";
14863
14872
  import { execSync as execSync13 } from "child_process";
14864
14873
  var DEFAULT_MAX_PROJECTS = 5;
@@ -14978,7 +14987,7 @@ function projectRemoveAction(factoryDir, name) {
14978
14987
  if (!existsSync39(projectDir)) throw new Error(`Project not found: ${name}`);
14979
14988
  const archivedBase = join38(factoryDir, ".beastmode", "projects", ".archived");
14980
14989
  mkdirSync24(archivedBase, { recursive: true });
14981
- renameSync3(projectDir, join38(archivedBase, name));
14990
+ renameSync4(projectDir, join38(archivedBase, name));
14982
14991
  }
14983
14992
  var projectCommand = new Command24("project").description("Manage projects in this factory");
14984
14993
  projectCommand.command("add <path>").description("Register a project").option("--name <name>", "Override project name").option("--board-id <id>", "Link to existing board ID").action((path, opts) => {