[Feature] shadcn-audit: one component map file per component

Merged
CI
3d ago
+363-298

Why

Adding a component to the shadcn audit touched the same lines in four shared files, so the parallel PRs for Badge (#600), AspectRatio (#601) and Avatar (#602) conflicted with each other. This PR takes two of those files out of every component PR.

Changes

  • audit/component_map.yml is split into audit/component_map/<folder>.yml, one file per component. The content is identical (checked by loading both and comparing). The key reference moves to audit/component_map/README.md. A new component adds its own file.
  • ComponentMap.for_audit(audit_dir) reads the directory and falls back to the single component_map.yml, so preview checkouts of SHAs from before the split still load.
  • sandbox_test.rb and rubyui_preview_test.rb read the folder list from audit/fixtures/ and the shadcn add list from the map; neither is hardcoded anymore. A new test checks that every fixture has a map file and every entry with selectors has fixtures.
  • map <folder> for an unmapped folder also returns path, the file to create. Config errors name the file: component_map/dialog.yml: unknown kind ….
  • The skill, grading.md, audit/README.md and gem/AGENTS.md point at the new layout.

mcp/data/registry.json still conflicts between component PRs. It is generated, so the fix is to rebuild it after merging main instead of resolving the conflict by hand. That is out of scope here.

Test steps

cd audit
bundle exec rake                         # 216 runs, 0 failures; standardrb clean
bundle exec exe/shadcn-audit map badge   # entry from component_map/badge.yml
bundle exec exe/shadcn-audit map button  # {"missing": true, "path": "audit/component_map/button.yml", ...}

šŸ¤– Generated with Claude Code


Summary by cubic

Splits audit/component_map.yml into one file per component, audit/component_map/<folder>.yml, so adding a component no longer touches shared lines that conflict across parallel component PRs (Badge, AspectRatio, Avatar).

  • New components add their own <folder>.yml; the key reference moves to audit/component_map/README.md.
  • ComponentMap.for_audit reads the directory and falls back to the legacy single file, so preview checkouts of pre-split SHAs still load.
  • map <folder> for unmapped folders now returns the file path to create; config errors name the exact file.
  • Sandbox and preview tests read folders and component lists from audit/fixtures/ and the map instead of hardcoding them, with a new test ensuring every fixture has a map file and every compared entry has fixtures.
  • Skill, grading.md, audit/README.md, and gem/AGENTS.md reference the new layout.

Migration

mcp/data/registry.json remains a conflict point between component PRs; rebuild it after merging main instead of resolving manually.