feat: implement Build Architecture Guard with Husky hooks

- Add pre-commit and pre-push hooks for build file protection
- Create comprehensive guard script for BUILDING.md validation
- Add npm scripts for guard setup and testing
- Integrate with existing build system
This commit is contained in:
Matthew Raymer
2025-08-20 12:59:48 +00:00
parent 8db07465ed
commit d663c52f2d
6 changed files with 296 additions and 0 deletions

27
.husky/pre-push Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# Husky Pre-push Hook
# Runs Build Architecture Guard to check commits being pushed
#
. "$(dirname -- "$0")/_/husky.sh"
echo "🔍 Running Build Architecture Guard (pre-push)..."
# Get the remote branch we're pushing to
REMOTE_BRANCH="origin/$(git rev-parse --abbrev-ref HEAD)"
# Check if remote branch exists
if git show-ref --verify --quiet "refs/remotes/$REMOTE_BRANCH"; then
RANGE="$REMOTE_BRANCH...HEAD"
else
# If remote branch doesn't exist, check last commit
RANGE="HEAD~1..HEAD"
fi
bash ./scripts/build-arch-guard.sh --range "$RANGE" || {
echo
echo "💡 To bypass this check for emergency pushes, use:"
echo " git push --no-verify"
echo
exit 1
}