fix: loose ends from retiring dev/scripts/git-hooks#7
Conversation
Two stragglers missed in #6: 1. scripts/install-hooks.ps1 still raw-fetched from resq-software/dev/$Ref/scripts/git-hooks — the retired path. Windows users following the curl-pipe flow would get 404s. Rewritten to mirror install-hooks.sh's two-path strategy: prefer `resq dev install-hooks` when on PATH, fall back to the crates raw URL. RESQ_CRATES_REF replaces RESQ_DEV_REF. Adds the scaffold prompt for the local-pre-push, matching the bash mirror. 2. .github/workflows/hooks-tests.yml had `paths: scripts/git-hooks/**` in its trigger filter — that directory no longer exists, so the workflow wouldn't fire on test changes alone. Trigger now fires on tests/hooks/**, scripts/install-hooks.sh, and the workflow file. Added a weekly cron so canonical-template drift on the crates side gets caught even without a dev-side change. Verified end-to-end: install-resq.sh → fresh repo + Cargo.toml → install-hooks.sh (resq-preferred path) → `git commit` triggers `resq pre-commit` which runs through Copyright/Large Files/Debug/ Secrets/Audit/Format. Doctor reports healthy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 53 minutes and 20 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the install-hooks.ps1 script to utilize the resq binary for hook installation and introduces a prompt for scaffolding local hooks. The review feedback identifies several areas where error handling should be strengthened, specifically by verifying exit codes for the resq and git commands and ensuring that Invoke-WebRequest terminates on failure.
| if ($resqBin) { | ||
| Write-Host "info Installing hooks via $resqBin dev install-hooks" -ForegroundColor Cyan | ||
| Push-Location $targetRoot | ||
| try { & $resqBin dev install-hooks } finally { Pop-Location } |
There was a problem hiding this comment.
The script should check the exit code of the resq command to ensure the installation was successful, mirroring the set -e behavior in the shell version. If the command fails, the script currently continues and incorrectly reports success.
try { & $resqBin dev install-hooks; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } finally { Pop-Location }
| $rawBase = "https://raw.githubusercontent.com/resq-software/crates/$Ref/crates/resq-cli/templates/git-hooks" | ||
| Write-Host "info Fetching hooks from $rawBase" -ForegroundColor Cyan | ||
| foreach ($h in $hooks) { | ||
| Invoke-WebRequest -Uri "$rawBase/$h" -OutFile (Join-Path $hooksDir $h) -UseBasicParsing |
There was a problem hiding this comment.
By default, Invoke-WebRequest does not throw a terminating error on HTTP failures (like 404). This can lead to a partial or corrupted installation where hook files contain error messages instead of script content. Adding -ErrorAction Stop ensures the script fails fast on network or server errors.
Invoke-WebRequest -Uri "$rawBase/$h" -OutFile (Join-Path $hooksDir $h) -UseBasicParsing -ErrorAction Stop
| if ($IsLinux -or $IsMacOS) { | ||
| foreach ($h in $hooks) { & chmod +x (Join-Path $hooksDir $h) } | ||
| } | ||
| & git -C $targetRoot config core.hooksPath .git-hooks |
Summary
Two stragglers missed in #6:
scripts/install-hooks.ps1still raw-fetched from the retiredresq-software/dev/$Ref/scripts/git-hookspath — Windows users would get 404s. Rewritten to mirror the sh version: preferresq dev install-hookswhen on PATH, fall back to the crates raw URL (RESQ_CRATES_REFreplacesRESQ_DEV_REF). Also gained the local-pre-push scaffold prompt for parity..github/workflows/hooks-tests.ymlhadpaths: scripts/git-hooks/**in its trigger filter — that directory no longer exists, so the workflow was effectively dark on most relevant changes. Trigger now fires ontests/hooks/**+scripts/install-hooks.sh+ the workflow file, plus a weekly cron to catch canonical-template drift on the crates side that would otherwise go unnoticed.End-to-end validation (local)
🤖 Generated with Claude Code