Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions typescript/apps/beps/src/lib/export-all-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
* Status is prominently featured to give more weight to mature proposals.
*/

import { readFileSync } from "fs";
import { join } from "path";

// ─────────────────────────────────────────────────────────────────────────────
// Static Files (read from disk at runtime)
// ─────────────────────────────────────────────────────────────────────────────

const STATIC_DIR = join(__dirname, "../../static");

function readStaticFile(relativePath: string): string {
return readFileSync(join(STATIC_DIR, relativePath), "utf-8");
}

// ─────────────────────────────────────────────────────────────────────────────
// Types
// ─────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -599,6 +612,25 @@ Downloads all BEPs as a ZIP archive. No authentication required.
return md;
}

// ─────────────────────────────────────────────────────────────────────────────
// Static File Loaders
// ─────────────────────────────────────────────────────────────────────────────

/**
* Load the BEP skill file for Claude Code.
*/
export function loadBepSkill(): string {
return readStaticFile("skills/bep.md");
}

/**
* Load the BEP CLI script, replacing the API base URL placeholder.
*/
export function loadBepScript(apiBaseUrl: string): string {
const script = readStaticFile("bep");
return script.replace(/__BEP_API_BASE__/g, apiBaseUrl);
}

// ─────────────────────────────────────────────────────────────────────────────
// Generate All Files
// ─────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -627,6 +659,18 @@ export function generateAllBepsExportFiles(data: ExportAllData, apiBaseUrl: stri
content: generateNewBepInstructions(nextNumber, apiBaseUrl, goodReferenceBeps),
});

// BEP skill for Claude Code
files.push({
path: "skills/bep.md",
content: loadBepSkill(),
});

// BEP CLI script
files.push({
path: "bep",
content: loadBepScript(apiBaseUrl),
});

// Individual BEP folders: BEP-<NUMBER>-<slug>/
for (const bep of data.beps) {
const bepFolder = formatBepFolderName(bep.number, bep.title);
Expand Down Expand Up @@ -654,3 +698,4 @@ export function generateAllBepsExportFiles(data: ExportAllData, apiBaseUrl: stri

return files;
}

Loading
Loading