Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

blume.config.ts

49 lines1.7 KB

1import * as NodeFS from "node:fs";
2import * as NodePath from "node:path";
3​
4import { defineConfig } from "blume";
5​
6const DOCS_ROOT = NodePath.resolve(import.meta.dirname, "../../docs/user");
7​
8// The sidebar follows the "Documentation index" section of README.md.
9function sidebarFromReadme() {
10 const readme = NodeFS.readFileSync(NodePath.join(DOCS_ROOT, "README.md"), "utf8");
11 const groups: { label: string; items: string[] }[] = [];
12 let inIndex = false;
13 for (const rawLine of readme.split(/\r?\n/)) {
14 const line = rawLine.trim();
15 if (/^##\s+Documentation index$/i.test(line)) {
16 inIndex = true;
17 continue;
18 }
19 if (!inIndex) continue;
20 if (/^##\s/.test(line)) break;
21 const heading = /^###\s+(.+)$/.exec(line);
22 if (heading?.[1]) {
23 groups.push({ label: heading[1], items: [] });
24 continue;
25 }
26 const slug = /^-\s+\[[^\]]+\]\(\.\/([^)#]+)\.md/.exec(line)?.[1];
27 if (slug) groups.at(-1)?.items.push(`/${slug}`);
28 }
29 return ["/", ...groups];
31​
32export default defineConfig({
33 title: "T3 Code Docs",
34 description:
35 "How to install, use, and run T3 Code, the open-source control plane for coding agents.",
36 logo: { image: "/logo.svg", text: "Code", href: "https://t3.codes" },
37 github: { owner: "pingdotgg", repo: "t3code", dir: "apps/docs" },
38 theme: { mode: "dark", toggle: false },
39 content: { root: DOCS_ROOT },
40 navigation: {
41 sidebar: sidebarFromReadme(),
42 actions: [{ href: "https://t3.codes/download", label: "Download" }],
43 },
44 feedback: false,
45 // apps/marketing serves the site-wide robots.txt.
46 seo: { robots: false },
47 // Served from apps/marketing's output at t3.codes/docs.
48 deployment: { site: "https://t3.codes", base: "/docs" },
49});