Pre-commit hook: auto-recover broken venv before running checks #61
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When
.venvis broken (symlink to /root, stale uv version, missing editable install), the pre-commit hook fails at the firstuv runcall with a cryptic permission error. The developer has to manuallyrm -rf .venv && uv sync— a friction point.Fix
Add a venv health check at the top of
.git/hooks/pre-commit:This auto-recovers the venv if it's broken, before any lint/test/notebook checks run.
Files
.git/hooks/pre-commit