feat(docs-site): add agent-readable docs routes

This commit is contained in:
Luca Martial 2026-05-11 16:40:34 -07:00
parent b440c75092
commit dfa4651ebc
6 changed files with 211 additions and 1 deletions

View file

@ -0,0 +1,11 @@
import { buildLlmsFullTxt } from "@/lib/llm-docs";
export const dynamic = "force-static";
export async function GET() {
return new Response(await buildLlmsFullTxt(), {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
}

View file

@ -0,0 +1,27 @@
import {
getLlmDocsPage,
getLlmDocsPages,
getPageMarkdown,
} from "@/lib/llm-docs";
import { notFound } from "next/navigation";
export const dynamic = "force-static";
export async function GET(
_request: Request,
props: { params: Promise<{ slug?: string[] }> },
) {
const params = await props.params;
const page = getLlmDocsPage(params.slug);
if (!page) notFound();
return new Response(await getPageMarkdown(page), {
headers: {
"Content-Type": "text/markdown; charset=utf-8",
},
});
}
export function generateStaticParams() {
return getLlmDocsPages().map((page) => ({ slug: page.slug }));
}

View file

@ -0,0 +1,11 @@
import { buildLlmsTxt } from "@/lib/llm-docs";
export const dynamic = "force-static";
export function GET() {
return new Response(buildLlmsTxt(), {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
}