#!/bin/bash # Pre-commit hook: run tests before allowing commit # Usage: cp pre-commit-hook.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit echo "๐Ÿงช Running tests before commit..." python -m pytest tests/ -q --tb=short if [ $? -ne 0 ]; then echo "โŒ Tests failed! Commit aborted." echo "Fix failures and try again: python -m pytest tests/ -v" exit 1 fi echo "โœ… All tests passed! Proceeding with commit..." exit 0