name: Check asset sync

on:
  pull_request:
    paths:
      - "src/ui-ux-pro-max/**"
      - "cli/assets/**"
      - ".claude/skills/ui-ux-pro-max/data/**"
      - ".claude/skills/ui-ux-pro-max/scripts/**"
      - "cli/scripts/sync-assets.mjs"
      - ".github/workflows/check-asset-sync.yml"
  push:
    branches: [main]
    paths:
      - "src/ui-ux-pro-max/**"
      - "cli/assets/**"
      - ".claude/skills/ui-ux-pro-max/data/**"
      - ".claude/skills/ui-ux-pro-max/scripts/**"

jobs:
  check-assets:
    name: cli/assets and .claude/skills/ui-ux-pro-max must match src/ui-ux-pro-max
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      # check:assets runs `node scripts/sync-assets.mjs --check`, which uses only
      # node builtins (no npm install needed) and normalizes CRLF/LF before
      # hashing, so it compares content rather than line endings. It checks
      # both cli/assets/ AND .claude/skills/ui-ux-pro-max/{data,scripts} --
      # the latter is what Claude Code actually loads when this repo is
      # installed as a plugin, and previously had no sync check at all.
      - name: Check assets are in sync with source of truth
        run: npm --prefix cli run check:assets
