[Feature] shadcn-audit: headless audit-chrome MCP, component video, media via gh --attach

Merged
CI
6d ago
+310-65

The shadcn audit now drives its browser steps with a headless Chrome of its own, records a short video of the RubyUI component, and puts PR media on GitHub with gh --attach instead of the pr-assets branch.

Changes

Headless browser for the audit

A new .mcp.json declares audit-chrome: chrome-devtools-mcp 1.11.0 (the plugin's version) with --headless --isolated --viewport 1280x800 --no-usage-statistics --no-performance-crux. The chrome-devtools plugin starts its server headed, with a persistent profile and the screen's DPR, so the same audit gave different screenshots on different machines. With audit-chrome every page starts at 1280Ɨ800 and DPR 1, and nothing opens on screen. Claude Code asks each person once to approve the server.

Component video

After the behavior checks, the audit records the RubyUI side at the audited head following a short script per kind (references/interactions.md, "Video"). The recorder is built into Chrome, so it needs no ffmpeg. It does need a current Chrome: 157 records, 151 answers "does not support screen recording". In that case the skill asks the user to update Chrome and carries on without the video. When ffmpeg is installed, the skill converts the AV1 file to H.264 so Safari on older Macs can play it.

Report and comment

report.json takes an optional videos list per component (label, rubyui, optional shadcn). render --html shows a player. comment --post uploads the videos with gh pr comment --attach. That command can only create comments, so the CLI posts the new one first and then deletes the user's previous marked comment (action: replaced). If the upload fails, the old comment stays. A video listed in the report but missing on disk stops the post before anything is sent.

Fix PRs

Before/after images and the video of the fixed component go up with gh pr create --attach. A "before" video from main is recorded only when the fix touches a Behavior or Animation line. pr-assets is now legacy: nothing new goes there, and the branch stays because older PRs link their images to it.

The video below is the DropdownMenu walkthrough from the validation run.

Test steps

  1. cd audit && bundle exec rake (288 tests plus standardrb).
  2. Start a new Claude Code session at the repo root and approve audit-chrome.
  3. Run /shadcn-audit dropdown_menu. Check that no Chrome window opens, that the environment probe shows w: 1280, h: 800, dpr: 1 on both sides, and that <run>/videos/dropdown_menu-rubyui-light.mp4 exists and plays in report.html.
  4. With Chrome older than 157, screencast_start should fail with "does not support screen recording" and the audit should finish without a video.

šŸ¤– Generated with Claude Code

https://github.com/user-attachments/assets/047b0fbc-372c-4bb4-aabd-5ef51ba5eb28


Summary by cubic

The shadcn audit now drives its browser steps with a headless audit-chrome MCP server instead of the chrome-devtools plugin's headed one, records a short video of each RubyUI component, and publishes PR media via gh --attach rather than the pr-assets branch.

  • New .mcp.json declares audit-chrome: chrome-devtools-mcp 1.11.0, headless, isolated, 1280Ɨ800, DPR 1, no usage statistics. Screenshots are now comparable across machines since no window opens and no persistent profile is reused.
  • After behavior checks, the audit records the RubyUI side with Chrome's built-in screen recorder (needs Chrome 157+; older versions skip the video with a note to update). AV1 files are converted to H.264 when ffmpeg is on PATH.
  • report.json accepts an optional videos list per component; the HTML renderer plays them and comment --post uploads them with gh pr comment --attach. Since that command can only create comments, the CLI posts the new one first, then deletes the user's previous marked comment (action: replaced). A failed upload leaves the old comment in place, and a report video missing on disk stops the post.
  • Fix PRs attach before/after images and a video of the fixed component with gh pr create --attach. A "before" video from main is recorded only when the fix touches a Behavior or Animation line. pr-assets stays as legacy for older PRs; nothing new goes there.