Skip to content

fix(docsite): keep one full page per topic when the CLI splits its docs - #7199

Merged
josephfarina merged 1 commit into
mainfrom
docs/docsite-namespace-pages
Oct 9, 2026
Merged

josephfarina merged 1 commit into
mainfrom
docs/docsite-namespace-pages

Conversation

@josephfarina

@josephfarina josephfarina commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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/layout returns 404 since the layout split. Its six guides show up as separate sidebar entries (layout-scaffold, layout-structure, ...).
  • /docs/theme shrank 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:

  • Every root namespace is one page at its slug. The page shows every guide under the namespace, compiled through the CLI docs API (docs(route, undefined, {depth: 'all', detail: 'full'}), the same read as astryx 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-panels still lands).
  • Sidebar group: the namespace's own category when it has one. Otherwise foundations when every guide under it is a foundations doc, and guide in every other case. So tokens and typography stay in Foundations.
  • Guide slugs redirect. Each guide's old slug (for example /docs/layout-scaffold) is a temporary redirect to its section on the full page. A redirect has no sidebar, search palette or sitemap entry, and astryx docs layout/scaffold in prose links to /docs/layout#scaffold.
  • Documented exceptions (in scripts/docs-pages.mjs):
    • cli keeps one page per guide. /docs/cli stays the @astryxdesign/cli package page, and the existing integration guide pages, sidebar entries and redirects are unchanged.
    • The theme split came before namespaces existed, so /docs/theme shows use-a-theme and then author-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.
  • The page components are unchanged. The outline builder moved from ReferenceDocView into docOutline.ts unchanged, so tests can check anchors without rendering.

Tests

  • docs-pages.test.ts splits 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.ts checks every page the site had before the splits: it must still exist in the same sidebar group. It also checks that /docs/cli stays 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.

@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 8, 2026 11:23pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 8, 2026
@astracat-bot

astracat-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 8, 2026, 11:58 PM UTC

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run completed, but its trusted analysis is unavailable.

View Storybook for this PR · View Sandbox for this PR


Generated by PR Enrichment workflow | View current CI run

@josephfarina
josephfarina force-pushed the docs/docsite-namespace-pages branch from 1e9158f to fa5f76c Compare October 8, 2026 22:52
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Oct 8, 2026
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.
@josephfarina
josephfarina force-pushed the docs/docsite-namespace-pages branch from fa5f76c to 2e1c238 Compare October 8, 2026 23:12
@josephfarina josephfarina changed the title feat(docsite): render namespace pages alongside flat topics fix(docsite): keep one full page per topic when the CLI splits its docs Oct 8, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 8, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/layout is 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/theme is 200 with the two merged topics (21 sections; #wrap-your-app-in-a-theme, #custom-themes present). /docs/tokens, /docs/styling, /docs/getting-started, /docs/cli and /docs/cli-integrations-quick-start are 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-tables and /docs/unorganized are 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-resolution suite against a registry generated from main fails 4 tests (/docs/layout lost 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 into docOutline.ts byte-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]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

@josephfarina
josephfarina merged commit c4df65c into main Oct 9, 2026
43 checks passed
@github-actions
github-actions Bot deleted the docs/docsite-namespace-pages branch October 9, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 2e1c2383 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant