Skip to content

docs: components/<Name>/README.md is the catalog source#261

Merged
adamziel merged 1 commit intotrunkfrom
docs-readme-as-catalog
May 3, 2026
Merged

docs: components/<Name>/README.md is the catalog source#261
adamziel merged 1 commit intotrunkfrom
docs-readme-as-catalog

Conversation

@adamziel
Copy link
Copy Markdown
Collaborator

@adamziel adamziel commented May 3, 2026

Summary

Consolidates the catalog's per-component markdown into each component's README.md and retires bin/_docs_components/ entirely.

Before After
components/<Name>/README.md (Composer/Packagist surface) components/<Name>/README.mdboth Composer/Packagist surface and docs-site catalog.
bin/_docs_components/<slug>.md (docs-site catalog) deleted
bin/_extract_catalog.py (one-shot migration tool) deleted

YAML-style frontmatter at the top of each README (slug, title, install, credit_title + credit_body, repeated see_also: …) drives the docs site. GitHub's README renderer hides frontmatter from the github.com view, so it's invisible to a reader landing on a component's directory page or on Packagist — but the build pipeline parses it.

Why

The two files had overlapping content (lede, intro prose) and nothing structural prevented drift. Co-locating the catalog with its component eliminates duplication, removes the bin/_docs_components/ indirection, and keeps everything one Composer package needs in one file. No generation step.

Pipeline change is small

  • bin/_load_catalog.py: COMPONENT_DIRCOMPONENT_ORDER (slug → directory tuples, ordered) reading from components/<Name>/README.md.
  • bin/run-snippets.py: --update writes captured stdout back into the same README via the same slug → directory map.
  • bin/build-reference.py: docstring only.
  • .github/workflows/{docs,snippet-tests}.yml: dropped bin/_docs_components/** from path filters.
  • bin/_docs_components/ directory and bin/_extract_catalog.py deleted.
  • bin/_docs_components.py keeps its small structural metadata (STARTER_PATHS, COMPONENT_GUIDES) plus COMPONENTS = load_components().

Test plan

  • Verify docs snippets workflow passes (87/87).
  • Deploy docs to GitHub Pages runs cleanly on push to trunk; live reference pages render with snippets.
  • Spot-check on github.com that frontmatter is hidden in the README view (e.g. https://github.com/WordPress/php-toolkit/tree/trunk/components/HTML).
  • Spot-check on packagist.org/packages/wp-php-toolkit/zip after the next release.

Note: lost API tables

Replacing the old per-component READMEs with the catalog content drops some API Reference tables that lived only in the old READMEs (Polyfill's function list, ByteStream's interfaces, Merge's strategies, HttpServer's class list, etc.). Most were redundant with the new "When to use which" comparison tables already in the catalog. If any are worth keeping, they can be added back as new sections in the README in a follow-up — they'll then appear on the docs site too, since the README is the docs source.

🤖 Generated with Claude Code

Consolidates the catalog's per-component markdown into each component's
README.md and retires bin/_docs_components/ entirely.

Before:
  components/<Name>/README.md       — Composer/Packagist surface
  bin/_docs_components/<slug>.md    — docs-site catalog
  bin/_extract_catalog.py           — one-shot migration tool

After:
  components/<Name>/README.md       — both Composer/Packagist surface AND
                                      docs-site catalog. Frontmatter at the
                                      top (slug/title/install/credit_*/
                                      see_also) drives the docs site;
                                      GitHub's renderer hides it from the
                                      README view on github.com.

Why: the two files had overlapping content (lede, intro prose) and
nothing structural prevented drift. Co-locating the catalog with the
component eliminates the duplication, removes the bin/_docs_components/
indirection, and keeps everything one Composer package needs in one
file.

Pipeline change is small:
  - bin/_load_catalog.py: COMPONENT_DIR replaced by COMPONENT_ORDER
    (slug → directory tuples, kept ordered) reading from
    components/<Name>/README.md.
  - bin/run-snippets.py: --update writes captured stdout back into the
    same README via the same slug → directory map.
  - bin/build-reference.py: docstring only.
  - .github/workflows/{docs,snippet-tests}.yml: dropped
    `bin/_docs_components/**` from path filters.
  - bin/_docs_components/ and bin/_extract_catalog.py deleted.
  - bin/_docs_components.py keeps its small structural metadata
    (STARTER_PATHS, COMPONENT_GUIDES) plus `COMPONENTS = load_components()`.

Verified: bin/run-snippets.py --check → 87/87 still pass; build-reference.py
regenerates docs/reference/ cleanly.

Note: replacing the old per-package READMEs with the catalog content drops
some "API Reference" tables that lived only in the old READMEs (Polyfill's
function list, ByteStream's interfaces, Merge's strategies, HttpServer's
class list, etc.). Most of those were redundant with the new "When to use
which" tables already in the catalog; if any are worth keeping, they can
be added back as new sections in the README in a follow-up — they'll then
appear on the docs site too.
@adamziel adamziel merged commit 34428e3 into trunk May 3, 2026
27 of 29 checks passed
@adamziel adamziel deleted the docs-readme-as-catalog branch May 3, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant