ci:
  skip: [eslint]  # Skip ESLint hooks in pre-commit.ci since not work
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
    -   id: check-yaml
    -   id: check-json
    -   id: check-merge-conflict
    -   id: check-symlinks
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
    -   id: pretty-format-json
        args: ['--autofix', '--indent=2', '--no-ensure-ascii', '--top-keys=__namespace__']
        files: ^src/i18n/.*\.json$
    -   id: requirements-txt-fixer
        exclude: ^src/api/requirements\.txt$
-   repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.15.13
    hooks:
    -   id: ruff-check
        args: [ --fix ]
    -   id: ruff-format
-   repo: https://github.com/commitizen-tools/commitizen
    rev: v4.16.2  # use latest stable version
    hooks:
    -   id: commitizen
        stages: [commit-msg]
        additional_dependencies: ['markupsafe==2.0.1']
-   repo: local
    hooks:
    -   id: prettier-cook-web
        name: Prettier cook-web files
        entry: prettier
        language: node
        files: ^src/cook-web/.*\.(js|jsx|ts|tsx|mjs|cjs|css|scss|md|mdx|json)$
        args: ['--write', '--config', 'src/cook-web/.prettierrc', '--ignore-path', 'src/cook-web/.prettierignore']
        additional_dependencies: ['prettier@3.7.4']
-   repo: local
    hooks:
    -   id: check-repo-harness
        name: Validate repository harness
        entry: python3 scripts/check_repo_harness.py
        language: system
        pass_filenames: false
        files: ^(AGENTS\.md|CLAUDE\.md|ARCHITECTURE\.md|PLANS\.md|docs/|scripts/(build_repo_knowledge_index|check_repo_harness|check_ai_collab_docs|generate_ai_collab_docs)\.py|\.claude/|\.cursor/|\.github/)
    -   id: check-architecture-boundaries
        name: Validate architecture boundaries
        entry: python3 scripts/check_architecture_boundaries.py
        language: system
        pass_filenames: false
        files: ^(docs/generated/architecture-boundary-baseline\.json|docs/references/architecture-boundaries\.md|scripts/check_architecture_boundaries\.py|scripts/testdata/architecture_boundaries/|src/api/|src/cook-web/src/)
    -   id: check-shared-translations
        name: Validate shared translation parity
        entry: python3 scripts/check_translations.py
        language: system
        pass_filenames: false
    -   id: check-translation-usage
        name: Validate translation key usage
        entry: python3 scripts/check_translation_usage.py --fail-on-unused
        language: system
        pass_filenames: false
    -   id: generate-languages-check
        name: Validate locales metadata up to date
        entry: bash -lc 'python3 scripts/generate_languages.py && git diff --exit-code -- src/i18n/locales.json'
        language: system
        pass_filenames: false
-   repo: local
    hooks:
    -   id: eslint
        name: ESLint cook-web files (errors only)
        entry: bash -c 'cd src/cook-web && npm run lint-file -- $(echo "$@" | sed "s|src/cook-web/||g")' --
        language: system
        files: ^src/cook-web/.*\.(js|jsx|ts|tsx)$
-   repo: local
    hooks:
    -   id: no-hardcoded-cjk-in-backend
        name: Forbid hardcoded CJK characters in backend Python
        entry: python3 scripts/check_backend_hardcoded_cn.py
        language: system
        pass_filenames: false
