Repository navigation
feat(docs): ship the docs as plain Markdown for coding agents - #121
Merged
Merged
Conversation
The package shipped the site's sources as its docs: 9 of 19 pages were MDX that imported components from docs-site/, which doesn't ship, and their examples lived only in JSX props (#116). - scripts/build-docs.mjs runs at prepack and writes harness/docs/: one .md per page and llms.txt, indexed in the order of the site's navigation. harness/plugin.json points docs at it; docs/ no longer ships. - Each component becomes its form in docs-site/components/markdown.ts: an example prints the code the site prints, then a table of what its theme resolves to in all four schemes (tone, or opacity and step, and each floor's contrast, measured as glaze:inspect does); a figure keeps its caption; Callout becomes a GitHub alert. - The build fails on a component with no form, MDX in prose, a link that leads nowhere or a page missing from the navigation. pnpm check:harness builds and checks it in CI. - Code both forms print moves out of .astro/.tsx into .ts modules (exampleSource, cssOutput, token-pair.ts, palette-output.ts); the site renders byte-identical pages. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7EW65e4ssEmkDivbZ5
Two independent reviews of the docs build; every finding fixed. - Values the captions describe now ship: ContrastExample prints both metrics, the floor's first, and the roles-swapped Lc; the contrast level example gets a table per level; the measurement figures (StepCompare, Unreachable, TintedPigment, MixRamp, FloorCompare, SchemeRamp, WindowMap, ToneRamp, ToneDrift, StatusThemes) get tables. Their themes come from shared figures.ts builders, so the site and the Markdown can't drift; the site renders the same pages. - A page prints a theme once: an example always prints its code, a figure only a theme the page hasn't printed. A note under each title says how to read the tables and where the live examples are. - Metrics: ratio is WCAG as on the site, a row without its floor is measured in the floor's metric, the asked step uses the theme's tuning, Callout severities map to the right alerts. - The build: components and comments are replaced at any depth; an expression inside a component, or a link to a file that isn't a page, is an error; fences inside blockquotes, footnotes, the / route, double-backtick spans and CRLF frontmatter are handled; errors name their page; the Node guard can run on older Node. - The reference quotes the new snapshot error; shipped type comments and README links point at the site instead of docs/. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7EW65e4ssEmkDivbZ5
- Getting started printed its whole theme twice: UiPreview, a whole UI in the reader's scheme, keeps only its caption, as PalettePreview does. - Preview links "the site" to its page; forms get the page's site URL. - The reading note explains table cells only on pages that have them, and now covers `h`/`s` and which side APCA takes as text. - PaletteStep prints Lc only where the site does: the site's KIND table moves to methodology/palette.ts so both read it. - An overlay's WCAG ratio is no longer checked against an APCA target. - Level tables honor the `schemes` and `hc` props, as LevelStrip does. - Build errors give the line in the file, past its frontmatter, and an MDX syntax error gives its line and column. - A component with children inside a blockquote drops the quote markers of its children; inline comments go; an inline component says so. - Reference definitions in blockquotes are rewritten; a frontmatter value continued on the next line fails; CodeGroup takes an item with no language; a Card or Steps item of more than one paragraph fails. - Comments in okhst.ts, warnings.ts and resolver.ts link to the site. - prepack keeps its logs off stdout, so `pack --json` stays JSON, and tsconfig sets erasableSyntaxOnly: the docs build runs src with Node's type stripping. - AGENTS.md: test file locations, a run-on sentence. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7EW65e4ssEmkDivbZ5
- A line that starts with `[label]:` is a reference definition only when a URL and an optional title follow; any other such line is prose, and its inline links are rewritten (it used to swallow them, in blockquotes too). - The build parses an MDX page with blank lines where its frontmatter was, so every position is a line of the file, including the spans inside an MDX syntax error. The firstLine offset goes. - A frontmatter value continued past a blank line fails too; an indented comment line is not a continuation. - The reading note detects the tables by the headers the forms print, and mentions tables only on pages that have them; hue is 0–360. - An inline component is an error inside a component too, and a component with children on its tag's line is an error instead of leaking the tag. - A CodeGroup item with no language gets a `text` fence, so its title stays a title. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7EW65e4ssEmkDivbZ5
Contributor
📦 Snapshot releasePublished |
Merged
tenphi
pushed a commit
to cube-js/cube-ui-kit
that referenced
this pull request
Nov 23, 2026
Glaze 3.2.0 ships its docs as plain Markdown in harness/docs/, indexed by its own llms.txt (tenphi/glaze#121, which fixes tenphi/glaze#116, the follow-up this PR filed). Its code is unchanged apart from one error message, so no color moves. - `pnpm update-glaze` with 3.2.0: package.json, pnpm-lock.yaml, and `harnesspm sync` for the lock and AGENTS.md's harnesspm block. - The three hand-written links to Glaze's old `docs/*.mdx` pages (AGENTS.md, docs/rules/probe.md, docs/rules/review.md) lead to `harness/docs/*.md`. - The changeset says UI Kit now pins Glaze 3.2.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #116.
harness/docs/, indexed byharness/docs/llms.txt. harnesspm gives it to agents asglaze:docs, soplugin.jsonnow pointsdocsat./docs(relative toharness/).> **Figure:** …. A figure of measurements gets a table of them. A whole UI in the reader's scheme (UiPreview,PalettePreview) and an interactivePreviewkeep only the caption, and aPreviewlinks to its page on the site.<Callout>→ GitHub alert (> [!NOTE]),<CodeGroup>→ titled fences,<Card>→ linked list item,<Steps>→ ordered list..mdlinks, site routes become page links, and anything else must be a full URL. The build fails otherwise.docs/(the.mdxsources) stays for the site and no longer ships.Why
The shipped
docs/held site MDX. 9 of 19 pages imported components from../docs-site/, which doesn't ship, and their examples existed only as JSX props. An agent readingglaze:docssaw imports it couldn't follow and examples it couldn't copy.How it works
scripts/build-docs.mjsruns atprepack(and in CI throughpnpm check:harness):docs/and parses MDX with@mdx-js/mdx(a new dev dependency)..tshelpers andsrc/through its type stripping and a small resolve hook.docs-site/components/markdown.ts, and removes imports, exports and comments.llms.txtin the order ofdocs.config.ts.The build fails on:
Errors give the line in the source file. The parser sees blank lines where the frontmatter was, so every position, including the spans inside an MDX syntax error, is a line of the file.
Figures and the site share one source of values. Each figure's theme now comes from a
.tsbuilder (figures.tsin each folder,token-pair.ts,palette-output.ts, plusexampleSource/cssOutputinglaze-docs.ts). The site's components and the Markdown forms both read these, so they print the same numbers. The site renders the same pages as before.A sample (
contrast.md, "Floors at a glance")Changes
scripts/build-docs.mjs+scripts/build-docs.test.mjs(Vitest now also runsscripts/**/*.test.mjs).docs-site/components/markdown.ts: the Markdown form of every component the pages use.docs-site/components/**/figures.tsand the other shared.tsbuilders; the site components that now use them.package.json:filesshipsharnessand dropsdocs.prepackbuilds the docs and runsharnesspm check, with its logs kept off stdout sopack --jsonstays JSON.check:harnessscript.harness/plugin.json(docs: ./docs),.gitignore(harness/docs/), and the CI step "Build the agent docs and check the harness".tsconfig.json:erasableSyntaxOnly, because the docs build runssrc/with Node's type stripping.docs/now point at the site:src/okhst.ts,src/warnings.ts,src/resolver.tsandsrc/types.tssrc/serialize.ts, and the reference quote of itREADME.mdAGENTS.md,README.md,docs-site/components/README.md: how the Markdown is built and what a new component needs.minor. Consumers who readnode_modules/@tenphi/glaze/docs/*directly need the new paths inharness/docs/*.md.Checks
pnpm typecheck,pnpm lint,pnpm format:check,pnpm build,pnpm check:harnesspnpm test: 901 pass, 21 of them for the docs buildastro buildHTML is byte-identical tomain, with asset hashes and per-build UUIDs normalized. The one exception is the intended new wording of the Glaze 2 snapshot error, on the reference page and in the Glaze bundle inlined on two pages.npm packandpnpm packinclude all 20harness/docsfiles and nodocs/.npm pack --dry-run --jsonprints clean JSON.Docs: node_modules/.harnesspm/pkgs/@tenphi/glaze/harness/docs/llms.txt (glaze:docs)inAGENTS.md, andharnesspm doctorreports Ready.#anchorin the built pages resolves.harnesspm checkcatches a planted dead link.@tenphi/glazeruns againstdist. The only blocks that don't are hand-written fragments that continue an earlier block.Review rounds
Each round used fresh reviewers who read the code itself, not a summary of it. Every finding was fixed, or kept as a deliberate decision listed below.
pack --jsonCodeGroupitems with no languageDeliberate decisions
harness/docs/(git-ignored), next to the rest of the harness. There is nopostpackcleanup, because pnpm 11 reads the packed files afterpostpack.ContrastMixdoes. The site'sContrastRowsremoves them all at once. The two differ only for a chain of floored colors, which no page has.Follow-ups (not in this PR)
cube-js/cube-ui-kit'sAGENTS.mdlinks Glaze's docs index by hand asnode_modules/.harnesspm/docs/glaze/llms.txt. After this ships, the path harnesspm writes becomesnode_modules/.harnesspm/pkgs/@tenphi/glaze/harness/docs/llms.txt.Generated by Claude Code