Skip to content

feat(docusaurus): derive collection artifact counts from YAML instead of hardcoded values #1249

@katriendg

Description

@katriendg

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.ts no longer contains hardcoded artifact count integers
  • Artifact counts stay accurate without any manual update step after collection YAML changes
  • npm run docs:test passes after any collection YAML change without a separate PR edit
  • npm run docs:build produces a correctly-rendered site with accurate counts

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions