pre-commit:
  parallel: false
  commands:
    slopgate:
      run: /home/user/Projects/slopgate/bin/slopgate --staged --config .slopgate/config.toml --tier fast

# Local pre-push guard — FAST smoke ahead of the authoritative remote PR Gate
# (.github/workflows/pr-gate.yml runs the full `pnpm gate`). Local stays fast so pushing
# is practical: typecheck of packages affected since origin/main + the CI-script tests
# only. The heavy unit + e2e suites (`test`, `verify`) run remotely on the PR Gate — the
# real merge net (safe-merge.mjs refuses a PR whose PR Gate isn't green).
pre-push:
  parallel: false
  commands:
    guard:
      use_stdin: true
      run: |
        zero=0000000000000000000000000000000000000000
        deleting=1
        while read -r local_ref local_sha remote_ref remote_sha; do
          [ -z "$remote_ref" ] && continue
          if [ "$remote_ref" = "refs/heads/main" ]; then
            echo "Direct push to main is blocked — push a feature branch and open a PR."
            exit 1
          fi
          [ "$local_sha" != "$zero" ] && deleting=0
        done
        if [ "$deleting" = "1" ]; then
          echo "branch-delete push — nothing new to gate, skipping."
          exit 0
        fi
        if git fetch --quiet origin main; then
          TURBO_SCM_BASE=origin/main ./scripts/cpu-limit.sh turbo run typecheck --affected || exit 1
        else
          echo "fetch of origin/main failed — falling back to full typecheck (affected base would be stale)"
          ./scripts/cpu-limit.sh turbo run typecheck || exit 1
        fi
        exec pnpm run test:scripts
