-
Notifications
You must be signed in to change notification settings - Fork 134
feat(docusaurus): derive collection artifact counts from YAML instead of hardcoded values #1249
Description
Problem
docs/docusaurus/src/data/collectionCards.ts hardcodes artifact counts for each collection and for hve-core-all. These values duplicate information already present in collections/*.collection.yml and must be manually updated every time an artifact is added or removed from any collection.
Every new skill, agent, or prompt added to a collection can silently break the Docusaurus test suite. Short-term mitigation is tracked in #1248. This issue covers the permanent fix.
Note: the test file collectionCards.test.ts already implements countYamlPaths() that reads the YAML files correctly — the production data file should do the same.
Proposed Solution
Change collectionCards.ts to derive counts by reading collections/*.collection.yml at build or test time rather than storing static integers.
Preferred option — build-time derivation (Option A):
Read the YAML files directly in collectionCards.ts using Node's fs module (already used in the test file) and compute counts dynamically. This eliminates the duplication entirely with minimal complexity and without adding a new build step.
Alternative — codegen script (Option B):
Add a docs:sync-counts npm script that regenerates the static counts from YAML and writes them back to collectionCards.ts. Wire into plugin:generate.
Option A is preferred.
Acceptance Criteria
-
collectionCards.tsno longer contains hardcoded artifact count integers - Artifact counts stay accurate without any manual update step after collection YAML changes
-
npm run docs:testpasses after any collection YAML change without a separate PR edit -
npm run docs:buildproduces a correctly-rendered site with accurate counts
Related
- docs: add npm run docs:test to PR template checklist and contributing guides #1248 (short-term checklist fix, should be resolved first)