@beastmode-develeap/beastmode 0.1.271 → 0.1.272

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
@@ -6471,6 +6471,36 @@ Path: ${projectPath}
6471
6471
  return { status: "idle" };
6472
6472
  }
6473
6473
  },
6474
+ // ── GET /api/projects/:name/codebase-guide ──
6475
+ // Return the project's codebase guide content at a requested pyramid level.
6476
+ // Levels: l0 (one-line .txt), l1 (paragraph .md, DEFAULT), l2 (full .md).
6477
+ // Responds 200 with { level, content, meta } when the guide is available;
6478
+ // 404 when analysis has not completed or the requested level file is missing.
6479
+ {
6480
+ method: "GET",
6481
+ pattern: "/api/projects/:name/codebase-guide",
6482
+ handler: (_body, params, query) => {
6483
+ const { name } = params;
6484
+ assertSafeName(name);
6485
+ const projectsDir = join14(factoryDir, ".beastmode", "projects");
6486
+ const meta = _readAnalyzeMeta(projectsDir, name);
6487
+ if (!meta || meta.status !== "complete") {
6488
+ throw new HttpError(404, {
6489
+ error: "No codebase guide available",
6490
+ status: meta?.status || "none"
6491
+ });
6492
+ }
6493
+ const levelRaw = query?.level || "l1";
6494
+ const level = levelRaw === "l0" || levelRaw === "l2" ? levelRaw : "l1";
6495
+ const filename = level === "l0" ? "codebase-guide.l0.txt" : level === "l2" ? "codebase-guide.md" : "codebase-guide.l1.md";
6496
+ const filePath = join14(projectsDir, name, filename);
6497
+ if (!existsSync16(filePath)) {
6498
+ throw new HttpError(404, { error: "Guide file not found" });
6499
+ }
6500
+ const content = readFileSync13(filePath, "utf-8");
6501
+ return { level, content, meta };
6502
+ }
6503
+ },
6474
6504
  // ── Runs ──
6475
6505
  {
6476
6506
  method: "GET",