Guardy
🪝 Hooks

🔧 Management

Install, uninstall, and manage hooks

Installing Hooks

# Install all configured hooks
guardy hooks install

# Force reinstall (overwrites existing hooks)
guardy hooks install --force

This creates Git hooks in .git/hooks/ directory.

Uninstalling Hooks

# Remove all Guardy hooks
guardy hooks uninstall

Running Hooks Manually

Test hooks without committing:

# Run pre-commit hook
guardy hooks run pre-commit

# Run on specific files
guardy hooks run pre-commit --files src/main.rs,src/lib.rs

# Test commit message validation
guardy hooks run commit-msg --message "feat: add new feature"

Listing Hooks

# Show installed hooks
guardy hooks list

# Output:
# ✓ pre-commit (installed)
# ✓ commit-msg (installed)
# ✗ pre-push (not installed)

Bypassing Hooks

Use sparingly! Bypassing hooks can introduce security risks.

Skip All Hooks

GUARDY_SKIP=1 git commit -m "emergency: fix production"

Skip Specific Hook

GUARDY_SKIP_PRE_COMMIT=1 git commit -m "wip: debugging"
GUARDY_SKIP_COMMIT_MSG=1 git commit -m "quick fix"

Git Native Bypass

git commit --no-verify -m "bypass all hooks"

Troubleshooting

Hook Not Running

# Check if hooks are installed
guardy hooks list

# Reinstall if needed
guardy hooks install --force

Debug Output

# Enable verbose output
GUARDY_DEBUG=1 git commit -m "test"

# Or use verbose flag
guardy hooks run pre-commit --verbose

Permission Issues

# Ensure hooks are executable
chmod +x .git/hooks/pre-commit
chmod +x .git/hooks/commit-msg

Performance Issues

  1. Enable parallel execution
  2. Use glob patterns to limit file processing
  3. Consider moving heavy checks to pre-push
  4. Use caching when available