2026-05-08 16:38:14 +09:00
|
|
|
import { readFile, writeFile } from "node:fs/promises"
|
|
|
|
|
import path from "node:path"
|
2026-05-08 16:57:28 +09:00
|
|
|
import { Marked } from "marked"
|
2026-05-08 16:38:14 +09:00
|
|
|
|
|
|
|
|
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")
|
|
|
|
|
|
2026-05-08 16:57:28 +09:00
|
|
|
const marked = new Marked({ gfm: true, breaks: false })
|
|
|
|
|
|
2026-05-08 16:38:14 +09:00
|
|
|
const sources = {}
|
|
|
|
|
for (const s of SECTIONS) {
|
2026-05-08 16:57:28 +09:00
|
|
|
const md = await readFile(path.join(DOCS_ROOT, s.file), "utf8")
|
|
|
|
|
sources[s.file] = await marked.parse(md)
|
2026-05-08 16:38:14 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const out =
|
|
|
|
|
"// Generated by scripts/generate-docs-content.mjs - DO NOT EDIT\n" +
|
|
|
|
|
"export const DOC_SOURCES: Record<string, string> = " +
|
|
|
|
|
JSON.stringify(sources, null, 2) +
|
|
|
|
|
"\n"
|
|
|
|
|
|
|
|
|
|
await writeFile(OUTPUT, out)
|
2026-05-08 16:57:28 +09:00
|
|
|
console.log("Generated " + OUTPUT + " with " + SECTIONS.length + " HTML-compiled docs")
|