# Pre-commit configuration
# See https://pre-commit.com for more information
repos:
  # Frontend checks
  - repo: local
    hooks:
      - id: frontend-format
        name: Frontend Format (Prettier)
        entry: bash -c "cd frontend && npm run format"
        language: system
        files: ^frontend/.*\.(ts|tsx|js|jsx|json|css|md)$
        pass_filenames: false

      - id: frontend-lint
        name: Frontend Lint (ESLint)
        entry: bash -c "cd frontend && npm run lint"
        language: system
        files: ^frontend/.*\.(ts|tsx|js|jsx)$
        pass_filenames: false

      - id: frontend-build
        name: Frontend Build
        entry: bash -c "cd frontend && npm run build"
        language: system
        files: ^frontend/.*\.(ts|tsx|js|jsx|json|css)$
        pass_filenames: false

  # Backend checks
  - repo: local
    hooks:
      - id: backend-format-and-lint
        name: Backend Format & Lint (golangci-lint)
        entry: bash -c "cd backend && golangci-lint fmt ./internal/... ./cmd/... && golangci-lint run ./internal/... ./cmd/..."
        language: system
        files: ^backend/.*\.go$
        pass_filenames: false

      - id: backend-go-mod-tidy
        name: Backend Go Mod Tidy
        entry: bash -c "cd backend && go mod tidy"
        language: system
        files: ^backend/.*\.go$
        pass_filenames: false

  # Agent checks
  - repo: local
    hooks:
      - id: agent-format-and-lint
        name: Agent Format & Lint (golangci-lint)
        entry: bash -c "cd agent && golangci-lint fmt ./internal/... ./cmd/... && golangci-lint run ./internal/... ./cmd/..."
        language: system
        files: ^agent/.*\.go$
        pass_filenames: false

      - id: agent-go-mod-tidy
        name: Agent Go Mod Tidy
        entry: bash -c "cd agent && go mod tidy"
        language: system
        files: ^agent/.*\.go$
        pass_filenames: false
