name: Reusable Validation Workflow

on:
  workflow_call:
    inputs:
      node-version:
        description: 'Node.js version'
        required: false
        type: string
        default: '20.x'

jobs:
  validate:
    name: Validate Components
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Setup Node.js
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
        with:
          node-version: ${{ inputs.node-version }}

      - name: Install validation dependencies
        run: npm ci --ignore-scripts

      - name: Validate agents
        run: node scripts/ci/validate-agents.js

      - name: Validate hooks
        run: node scripts/ci/validate-hooks.js

      - name: Validate commands
        run: node scripts/ci/validate-commands.js

      - name: Validate skills
        run: node scripts/ci/validate-skills.js

      - name: Validate install manifests
        run: node scripts/ci/validate-install-manifests.js

      - name: Validate workflow security
        run: node scripts/ci/validate-workflow-security.js

      - name: Validate rules
        run: node scripts/ci/validate-rules.js

      - name: Check unicode safety
        run: node scripts/ci/check-unicode-safety.js

      - name: Validate no personal paths
        run: node scripts/ci/validate-no-personal-paths.js
