Initial commit: Complete macOS dotfiles system
🖖 Features: - Master 'engage' script for one-command setup - 120+ CLI tools via Homebrew - 40+ Applications (casks + MAS apps) - Complete macOS system configuration - Security hardening and privacy settings - Obsidian knowledge vault setup - Comprehensive backup strategies - Automated symlink management Live long and prosper\! 🚀 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Git Hooks
|
||||
|
||||
This directory contains global git hooks that can be used across all repositories.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Configure git to use this directory for hooks:
|
||||
```bash
|
||||
git config --global core.hooksPath ~/dotfiles/git/hooks
|
||||
```
|
||||
|
||||
2. Make hooks executable:
|
||||
```bash
|
||||
chmod +x ~/dotfiles/git/hooks/*
|
||||
```
|
||||
|
||||
## Available Hooks
|
||||
|
||||
- `pre-commit`: Run before each commit
|
||||
- `commit-msg`: Validate commit messages
|
||||
- `pre-push`: Run before pushing
|
||||
|
||||
## Per-Repository Hooks
|
||||
|
||||
To use repository-specific hooks instead of global ones:
|
||||
```bash
|
||||
git config --local core.hooksPath .git/hooks
|
||||
```
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# Global pre-commit hook
|
||||
# Runs checks before allowing a commit
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo "Running pre-commit checks..."
|
||||
|
||||
# Check for debugging keywords
|
||||
if git diff --cached --name-only | xargs grep -E "(console\.log|debugger|binding\.pry|TODO:|FIXME:|XXX:)" 2>/dev/null; then
|
||||
echo -e "${YELLOW}Warning: Found debugging keywords or TODOs${NC}"
|
||||
echo "Continue anyway? (y/n)"
|
||||
read -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for large files (>5MB)
|
||||
for file in $(git diff --cached --name-only); do
|
||||
if [ -f "$file" ]; then
|
||||
size=$(wc -c < "$file")
|
||||
if [ $size -gt 5242880 ]; then
|
||||
echo -e "${RED}Error: $file is larger than 5MB${NC}"
|
||||
echo "Consider using Git LFS for large files"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for secrets (basic check)
|
||||
if git diff --cached --name-only | xargs grep -E "(password|secret|token|api_key)\s*=\s*[\"'][^\"']+[\"']" 2>/dev/null; then
|
||||
echo -e "${RED}Warning: Possible secrets detected!${NC}"
|
||||
echo "Please review your changes carefully."
|
||||
echo "Continue anyway? (y/n)"
|
||||
read -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Pre-commit checks passed!${NC}"
|
||||
Reference in New Issue
Block a user