# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-added-large-files
      - id: check-toml
      - id: check-yaml
        args:
          - --unsafe
      - id: end-of-file-fixer
        exclude: |
            (?x)^(
                frontend/src/client/.*|
                backend/app/email-templates/build/.*
            )$
      - id: trailing-whitespace
        exclude: ^frontend/src/client/.*
  - repo: local
    hooks:
      - id: local-biome-check
        name: biome check
        entry: npm run lint
        language: system
        types: [text]
        files: ^frontend/

      - id: local-ruff-check
        name: ruff check
        entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
        require_serial: true
        language: unsupported
        types: [python]

      - id: local-ruff-format
        name: ruff format
        entry: uv run ruff format --force-exclude --exit-non-zero-on-format
        require_serial: true
        language: unsupported
        types: [python]

      - id: local-mypy
        name: mypy check
        entry: uv run mypy backend/app
        require_serial: true
        language: unsupported
        pass_filenames: false

      - id: generate-frontend-sdk
        name: Generate Frontend SDK
        entry: bash ./scripts/generate-client.sh
        pass_filenames: false
        language: unsupported
        files: ^backend/.*$|^scripts/generate-client\.sh$
