import { readFile, writeFile } from "node:fs/promises" import path from "node:path" import { Marked } from "marked" const SECTIONS = [ { file: "guide/overview.md" }, { file: "guide/installation.md" }, { file: "guide/orchestration.md" }, { file: "guide/agent-model-matching.md" }, { file: "guide/team-mode.md" }, { file: "reference/cli.md" }, { file: "reference/configuration.md" }, { file: "reference/features.md" }, { file: "manifesto.md" }, ] const DOCS_ROOT = path.resolve(process.cwd(), "..", "docs") const OUTPUT = path.resolve(process.cwd(), "lib", "docs-content.generated.ts") const marked = new Marked({ gfm: true, breaks: false }) const sources = {} for (const s of SECTIONS) { const md = await readFile(path.join(DOCS_ROOT, s.file), "utf8") sources[s.file] = await marked.parse(md) } const out = "// Generated by scripts/generate-docs-content.mjs - DO NOT EDIT\n" + "export const DOC_SOURCES: Record = " + JSON.stringify(sources, null, 2) + "\n" await writeFile(OUTPUT, out) console.log("Generated " + OUTPUT + " with " + SECTIONS.length + " HTML-compiled docs")