scripts/generate-catalog-pages.ts's own docs.json rebuild -- the one
CONTRIBUTING.md tells a contributor to run alone -- wrapped any section with
exactly one child shelf of the same name (3D motion, Carousels, Cursors,
Blocks) in a redundant identical-name parent: {group:"3D motion",
pages:[{group:"3D motion", pages:[...]}]}. Reproduced on a clean origin/main
worktree: running the generator with nothing else changed still rewrote 959
lines of docs.json. sync-docs-catalog.mjs, run afterward, silently repaired
it, so the bug only ever surfaced when the documented single-command recipe
ran on its own.
Extracted the collapsing decision into sectionEntry(), a pure function:
flatten to the child's own pages when a section wraps exactly one
identically-named shelf, otherwise keep the nested shelf (a differently-named
single child, like "Data & charts" wrapping "Data", still nests on purpose).
Shown red without the fix (packages/core's node --test file):
31 passed, 1 failed -- "flattens a section that wraps exactly one shelf of
its own name". Green with it: 32 passed. Ran the full generator against this
branch's own registry afterward and confirmed programmatically: no group in
docs.json's Catalog tab nests a child whose own "group" equals its parent's.