Repository navigation
fix(docsite): keep one full page per topic when the CLI splits its docs - #7199
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
View Storybook for this PR · View Sandbox for this PR Generated by PR Enrichment workflow | View current CI run |
1e9158f to
fa5f76c
Compare
The CLI now splits long topics into docs-tree namespaces of short guides. The docsite built pages only from flat topic files, so /docs/layout returned 404 after the layout split and its six guides became separate sidebar entries. The theme split did the same to /docs/theme. Every root namespace is now one page at its own slug, compiled through the CLI docs API (a depth-all, full-detail read), so a former flat topic keeps its URL, sidebar group, section titles and anchors. Each guide's own slug redirects to its section on that page and gets no sidebar, search or sitemap entry. The cli namespace keeps today's per-guide pages, so /docs/cli stays the package page. Theme, split before namespaces existed, shows use-a-theme and author-a-theme on its page again. A fixture test splits a flat topic into a namespace and checks the page is unchanged; another checks every page the site had before the splits still exists in its sidebar group.
fa5f76c to
2e1c238
Compare
There was a problem hiding this comment.
Approving. The split topics render as whole pages again at their old URLs, and nothing that had a page lost one.
- Generated the registry and served the site from this head (Next dev, webpack, workspace packages built):
/docs/layoutis 200 with the title "Layout", 14 sections and every old anchor (#scaffold,#structure,#headers-and-footers,#side-panels,#spacing,#breakpoints); on main's registry it has no page./docs/themeis 200 with the two merged topics (21 sections;#wrap-your-app-in-a-theme,#custom-themespresent)./docs/tokens,/docs/styling,/docs/getting-started,/docs/cliand/docs/cli-integrations-quick-startare 200 as before; an unknown slug is 404. - Redirects are real:
/docs/layout-scaffold→ 307/docs/layout#scaffold,/docs/layout-side-panels→#side-panels,/docs/use-a-theme→/docs/theme#wrap-your-app-in-a-theme,/docs/author-a-theme→#custom-themes./docs/token-tablesand/docs/unorganizedare 404 (no such topics today), so the rule is inert for the upcoming splits until they land, and generic enough to cover them. - Red arm: the new
route-resolutionsuite against a registry generated from main fails 4 tests (/docs/layoutlost its page, the layout anchors, the theme text, the guide-section link); at this head both new suites pass 35/35. The outline builder moved intodocOutline.tsbyte-for-byte. - No Changeset is right: the docsite is a private app outside the release group, as with the other docsite-only fixes.
[Automated review]
There was a problem hiding this comment.
Approval needs a maintainer spec decision first: please provide or identify the governing current spec for docsite namespace pages — whether a root namespace that replaces a flat topic should be one full page at the old slug with its guides inlined as sections and each guide slug redirecting to its section, or a page listing its children while guides keep their own pages. The current docsite contract requires truthful, registry-backed projections and one canonical URL, and this change follows those rules, but it does not settle that presentation, the theme merge onto /docs/theme, or the token-tables data-only exception; the docs-tree record leaves the listed-versus-inlined question open.
On implementation, the shape looks right: pages, sidebar, search and sitemap all keep projecting the one generated registry, guide slugs redirect to real section anchors, /docs/cli stays the package page, and the new tests pin every pre-split page and the layout anchors by name. One small compatibility note to settle alongside the decision: the current theme overview anchors #create-a-custom-theme and #integration-themes disappear in the merge because the folded-in sections carry different titles, so deep links using those fragments land without a target.
Thank you for keeping the established URLs working through the splits — once the presentation rule is recorded, this should be quick to re-review.
[Automated review]
Why
The CLI now splits long doc topics into docs-tree namespaces of short guides, so an agent can read one guide at a time. The docsite built its pages only from flat topic files, so the splits changed what readers see:
/docs/layoutreturns 404 since the layout split. Its six guides show up as separate sidebar entries (layout-scaffold,layout-structure, ...)./docs/themeshrank to a four-section overview after the theme split. "Use a theme" and "Author a theme" became new sidebar entries.The upcoming splits (tokens, typography, styling, styling-libraries, migration, internationalization) would do the same to six more pages. This PR lands first, so those splits change nothing for readers.
What
The rule is generic and runs through the CLI's doc compiler. No page needs to be listed:
docs(route, undefined, {depth: 'all', detail: 'full'}), the same read asastryx docs <name> --depth all --detail full). So a former flat topic keeps its URL, its title, its section titles and its anchors (/docs/layout#side-panelsstill lands).foundationswhen every guide under it is a foundations doc, andguidein every other case. So tokens and typography stay in Foundations./docs/layout-scaffold) is a temporary redirect to its section on the full page. A redirect has no sidebar, search palette or sitemap entry, andastryx docs layout/scaffoldin prose links to/docs/layout#scaffold.scripts/docs-pages.mjs):clikeeps one page per guide./docs/clistays the@astryxdesign/clipackage page, and the existing integration guide pages, sidebar entries and redirects are unchanged./docs/themeshowsuse-a-themeand thenauthor-a-theme, and their slugs redirect to their sections there. The overview's own four sections only point to those two topics, and their titles would duplicate the anchors, so they are not repeated.token-tables(added by the tokens split) is the data that token references read. It is not a page; the tokens page already shows every table.ReferenceDocViewintodocOutline.tsunchanged, so tests can check anchors without rendering.Tests
docs-pages.test.tssplits a fixture flat topic into a namespace of two guides. It checks that the site still has exactly one page at the old slug, in the same group, with the same sections, and that each guide slug redirects to its section.route-resolution.test.tschecks every page the site had before the splits: it must still exist in the same sidebar group. It also checks that/docs/clistays the package page, that every redirect lands on a real anchor, and that guide references link to their sections. On main this test fails at/docs/layout.