git-hooks
Git hooks management and installation - Automates installation of pre-commit, pre-push, and git safety hooks.
๐ Complete Git Hooks Guide - Detailed documentation with troubleshooting and bypass methods.
Quick Overviewโ
Supernal Coding provides three main git hooks:
- Pre-commit: Type duplication checking + branch protection
- Pre-push: Full test suite validation + build checks
- Git Safety: Main/master branch protection
Usageโ
# Install all git hooks (recommended)
sc git-hooks install
# Install specific hooks
sc git-hooks install pre-commit
sc git-hooks install pre-push
sc git-hooks install all
# Check installation status
sc git-hooks status
# Remove hooks
sc git-hooks remove
Examplesโ
Basic Installationโ
# Install all hooks in current repository
sc git-hooks install
# Output:
# ๐ง Installing Supernal Coding git safety hooks...
# โ
Pre-commit hook installed (type checking, branch protection)
# โ
Pre-push hook installed (test validation, build checks)
# โ
Git safety hooks installed (main branch protection)
Status Checkโ
sc git-hooks status
# Output:
# ๐ Git Hooks Status:
# โ
Pre-commit hook: Installed and executable
# โ
Pre-push hook: Installed and executable
# โ
Git safety: Main branch protection active
# ๐ Type checking: Enabled (scripts/check-type-duplicates.cjs)
Emergency Bypassโ
# Bypass pre-commit hook (emergency only)
git commit --no-verify -m "Emergency hotfix"
# Bypass pre-push hook (use with caution)
git push --no-verify
# Alternative pre-push bypass
SC_SKIP_PRE_PUSH=true git push
Hook Detailsโ
Pre-commit Hookโ
- โ Type Duplication Checking: Scans for duplicate types/interfaces
- ๐ Branch Protection: Prevents direct commits to main/master
- ๐ CLI Sync: Updates agent rules with latest commands
- โ ๏ธ Branch Naming: Validates naming conventions
Pre-push Hookโ
- ๐งช Test Validation: Runs full test suite (285+ tests)
- ๐๏ธ Build Validation: Checks if build script succeeds
- ๐ Final Type Check: Last scan for duplications (warning only)
- ๐ Progress Display: Shows branch and validation status
Git Safety Hookโ
- ๐ซ Main Branch Protection: Absolute prevention of direct commits
- ๐ Educational Messaging: Guides users to proper workflow
- ๐ Emergency Instructions: Shows bypass methods when needed
Configurationโ
Git hooks behavior is configured via supernal-code.config.toml:
[type_duplication]
enabled = true
pre_commit_hook = true
block_commits_on_duplications = true
allow_force_commits = true
[git_workflow]
protect_main_branches = ["main", "master"]
require_branch_naming = false
auto_sync_cli_docs = true
Troubleshootingโ
Common Issuesโ
- Hook not executable:
chmod +x .git/hooks/* - Test failures: Debug with
npm test - Type checker errors: Check
node scripts/check-type-duplicates.cjs - Permission denied: Verify repository ownership
Emergency Proceduresโ
- Document the reason for any bypass
- Fix underlying issue immediately
- Re-run validations manually
- Inform team about bypass usage
Categoryโ
Git & Workflow
๐ Complete Documentation | ๐ Troubleshooting | ๐ Workflow Guide
This documentation reflects the actual implementation of Supernal Coding's git hooks.