Skip to main content
Glama
plan-registry.js1.17 kB
import fs from "fs"; import path from "path"; const PLANS_DIR = path.resolve("docs/plans"); export function loadPlan(planId) { const planPath = path.join(PLANS_DIR, `${planId}.md`); if (!fs.existsSync(planPath)) { throw new Error(`PLAN_NOT_FOUND: ${planId}`); } const content = fs.readFileSync(planPath, "utf8"); return parsePlan(content, planId); } function parsePlan(content, planId) { const lines = content.split("\n"); let status = null; let scope = []; let inScope = false; for (const line of lines) { if (line.startsWith("STATUS:")) { status = line.replace("STATUS:", "").trim(); } if (line.startsWith("SCOPE:")) { inScope = true; continue; } if (inScope) { if (line.trim().startsWith("- ")) { scope.push(line.trim().replace("- ", "")); } else if (line.trim() === "") { continue; } else { inScope = false; } } } if (status !== "APPROVED") { throw new Error(`PLAN_NOT_APPROVED: ${planId}`); } if (scope.length === 0) { throw new Error(`PLAN_INVALID: ${planId} has empty SCOPE`); } return { id: planId, status, scope }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dylanmarriner/MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server