Configuration
Configure defineSite, createSource, withDocs, package registries, and AI agents.
@wrksz/docs is configured through three small modules: defineSite for project metadata, createSource for your MDX directory, and withDocs in next.config.ts.
Site (defineSite)
defineSite describes your project once and shares it with layouts, metadata builders, registry fetches, and agent links.
namestringrequiredShort product or library name shown in the header, sidebar brand, and page titles.
package{ name: string; registry: Registry }requiredPackage name and registry used for <Install>, the hero install bar, download stats, and automatic latest-version lookups.
descriptionstringrequiredDefault site description used in metadata, llms.txt, and JSON-LD.
urlstringrequiredCanonical origin of the deployed docs site, e.g. https://docs.wrksz.dev.
repo{ owner: string; name: string; branch?: string; docsDir?: string }requiredGitHub repository used for header/sidebar links and EditPageAction. branch defaults to "main" and docsDir defaults to "apps/docs/content/docs".
versionstring | falseVersion badge shown next to the site name. When omitted, DocsRoot fetches the latest version from package.registry.latest on the server (cached for 1 hour). Pass a string to pin it, or false to hide it.
navSiteLink[]Extra links shown in the home page header.
footer{ label: string; links: SiteLink[] }[]Columns of links rendered in the home page Footer.
agents(string | Agent)[]Default ["claude-code", "codex", "cursor"]Default agents offered by <AgentPrompt>, by built-in id or defineAgent object.
openIn(string | Agent)[]Default ["chatgpt", "claude", "grok", "cursor"]Targets listed in OpenPageMenu after "View as Markdown".
Content source (createSource)
createSource scans a folder of .mdx and .md files and exposes pages(), page(), tree(), breadcrumbs(), neighbours(), params(), render(), markdown(), and updated().
dirstringrequiredPath to the content directory, resolved relative to the current working directory.
baseUrlstringDefault "/docs"URL prefix for generated page routes. Keep this aligned with withDocs({ baseUrl }).
draftsbooleanDefault process.env.NODE_ENV !== "production"Whether pages with draft: true in frontmatter are included. Shown in development and excluded from production builds by default.
Next.js config (withDocs)
withDocs adds @wrksz/docs to transpilePackages and registers URL rewrites so /llms.txt, /llms-full.txt, /docs.md, and /docs/<page>.md resolve to your createLlmsRoute handler.
baseUrlstringDefault "/docs"Docs URL prefix rewritten to the Markdown route. Must match createSource({ baseUrl }).
routestringDefault "/llms.mdx"App Router path where createLlmsRoute is mounted, e.g. src/app/llms.mdx/[[...path]]/route.ts.
Package registries
Two registries ship out of the box from @wrksz/docs:
npm:bun,npm,pnpm(default),yarn, with npmjs downloads and latest-version lookups.pypi:uv(default),pip,poetry,pdm, with pypistats downloads and PyPI latest-version lookups.
Use defineRegistry to support another ecosystem. Command and URL templates replace {name} with the package name, and downloads.path / latest.path read dotted keys from JSON responses.
AI agents
Built-in agent ids are claude-code, codex, cursor, claude, chatgpt, and grok. Pass any subset to defineSite({ agents, openIn }), or register a custom target with defineAgent using {prompt} where the URL-encoded prompt should go.
Inside <AgentPrompt>, the placeholders {origin}, {page}, {llms}, and {llms-full} are replaced automatically using site.url and the current page's Markdown URL.