Alpha: Ships on npm at 7.0.0-alpha.07.0.0-alpha.0
For agents
An agent writes the record, never the markup, and shortens each field the schema refuses.
The prompt
The landing prints the same five lines.
Read https://next.mdxui.dev/llms.txt, then fetch https://next.mdxui.dev/pages/home.json, a page record that parses.
Run pnpm add @mdxui/site@7.0.0-alpha.0. It pins @mdxui/themes 7.0.0-alpha.0.
Rewrite its strings for my business. Keep the Section types that fit.
Parse it with PageSchema.safeParse. When it refuses, shorten the content, never the bound.
Render it with renderPage under two of the 5 Themes and save both HTML files.The four fetches
| Address | Answers |
|---|---|
https://next.mdxui.dev/llms.txt | The install, the calls, the Theme names and the record to start from |
https://next.mdxui.dev/pages/home.json | A whole record that already parses |
https://next.mdxui.dev/docs/reference/refusals.md | Every bound and rule by path, with its fix |
https://next.mdxui.dev/schema.json, or one Section type as .md | Every bound at once, or the type the agent adds |
Every docs page is also served as Markdown at its address plus .md.
Reading a refusal
refusal-url.ts prints each refusal beside the address of its fix:
import { PageSchema } from '@mdxui/site';
// Each refusal, then the address of its fix: the block's type, then the path after `block`, list indexes dropped.
export function refusalUrls(page: any): string[] {
const result = PageSchema.safeParse(page);
if (result.success) return [];
return result.error.issues.flatMap(({ path, message }) => {
const keys = (p: PropertyKey[]) => p.filter((s) => typeof s === 'string').join('.');
const anchor = path[0] !== 'sections' ? `page.${keys(path)}` : path[2] === 'shell' ? `shell.${keys(path.slice(3))}` : [page.sections[path[1] as number]?.block?.type, keys(path.slice(3))].filter(Boolean).join('.');
return [`${path.join('.')}: ${message}`, `https://next.mdxui.dev/docs/reference/refusals#${anchor}`];
});
}On the landing's record with a 71-character hero title, it prints:
sections.1.block.title: Too big: expected string to have <=64 characters
https://next.mdxui.dev/docs/reference/refusals#hero.title