repos:
  - repo: local
    hooks:
      - id: sync-banner-version
        name: Sync banner version from package.json
        entry: pwsh -NoProfile -File scripts/sync-banner-version.ps1
        language: system
        always_run: true
        pass_filenames: false
        require_serial: true
        description: Updates the version in the SVG banner when package.json version changes.
      - id: sync-issue-template-versions
        name: Sync issue template package versions
        entry: pwsh -NoProfile -File scripts/sync-issue-template-versions.ps1
        language: system
        always_run: true
        pass_filenames: false
        require_serial: true
        description: >
          Updates the package version dropdown in issue templates from
          package.json, CHANGELOG.md, and git tags. Runs on every commit.
      - id: dotnet-tool-restore
        name: Install .NET tools
        entry: dotnet tool restore
        language: system
        always_run: true
        pass_filenames: false
        stages:
          - pre-commit
          - pre-push
          - post-checkout
          - post-rewrite
        description: Install the .NET tools listed at .config/dotnet-tools.json.
      - id: csharpier
        name: Run CSharpier on C# files
        entry: pwsh -NoProfile -File scripts/format-staged-csharp.ps1
        language: system
        types:
          - c#
        pass_filenames: false
        require_serial: true
        description: CSharpier is an opinionated C# formatter inspired by Prettier.
      - id: csharp-naming
        name: Lint C# method naming (no underscores)
        entry: pwsh -NoProfile -File scripts/lint-csharp-naming.ps1 -StagedOnly -Fix
        language: system
        types:
          - c#
        pass_filenames: false
        require_serial: true
        description: Enforce PascalCase method names without underscores. Auto-renames when run locally.
      - id: csharp-no-regions
        name: "Lint C# files for #region directives"
        entry: pwsh -NoProfile -File scripts/lint-no-regions.ps1 -StagedOnly -Fix
        language: system
        types:
          - c#
        pass_filenames: false
        require_serial: true
        description: "Prevent #region directives from being checked in. Auto-removes when run locally."
      - id: unity-file-naming
        name: Lint Unity Object file naming
        entry: pwsh -NoProfile -File scripts/lint-unity-file-naming.ps1 -StagedOnly
        language: system
        types:
          - c#
        pass_filenames: false
        require_serial: true
        description: Ensure MonoBehaviour/ScriptableObject classes are in correctly named files.
      - id: prettier
        name: Prettier (Markdown, JSON, asmdef, asmref, YAML)
        entry: pwsh -NoProfile -File scripts/format-staged-prettier.ps1
        language: system
        files: '(?i)\.(md|markdown|jsonc?|asmdef|asmref|ya?ml|js)$'
        description: Use the repo's Prettier version from package.json.
        require_serial: true
      - id: markdownlint
        name: markdownlint (respect repo config)
        entry: pwsh -NoProfile -File scripts/lint-staged-markdown.ps1
        language: system
        files: '(?i)\.(md|markdown)$'
        require_serial: true
      - id: yamllint
        name: yamllint
        entry: pwsh -NoProfile -File scripts/lint-yaml.ps1 -StagedOnly
        language: system
        files: '(?i)\.(ya?ml)$'
        pass_filenames: false
        require_serial: true
        description: >
          Lint YAML files for syntax and style issues.
          Requires yamllint (pip install yamllint).
          If yamllint is not installed, this hook will SKIP with a warning
          (exit 0) to allow commits from machines without yamllint.
          CI enforces yamllint, so issues will be caught before merge.
      - id: lychee
        name: Check markdown links (lychee)
        entry: pwsh -NoProfile -File scripts/lint-staged-links.ps1
        language: system
        files: '(?i)\.(md|markdown)$'
        pass_filenames: false
        require_serial: true
        description: Check for broken links in staged markdown files using lychee.
