LLM Docs Generation Route (llms-components.txt/route.ts)

chakra-ui · ai, AI / Agents, llm, docs, api, nextjs, content

Generates plain‑text documentation of all Chakra UI components for LLM consumption, cached for one hour.

// Source: https://github.com/mperkins0155/chakra-ui | License: MIT | Copyright 2019 Chakra Systems Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { docs } from "@/.velite"
import { cleanupContent } from "@/lib/llms-utils"

export const dynamic = "force-static"

export async function GET() {
  let content =
    "<SYSTEM>Documentation for all components in Chakra UI v3.</SYSTEM>\n\n"

  const componentDocs = docs.filter((doc) =>
    doc.slug.startsWith("docs/components"),
  )

  for (const doc of componentDocs) {
    if (!doc.llm || doc.llm?.length === 0) continue
    const llm = cleanupContent(doc.llm)
    content += `# ${doc.title}\n\n${llm}\n\n`
  }

  return new Response(content, {
    headers: {
      "Content-Type": "text/plain; charset=utf-8",
      "Cach

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key