Git Hooks & Automation Squad
CCCP operates as an automated commissar for your Git workflow, preventing non-compliant commits before they enter version control and automating changelog updates upon push.
1. The Four Standard Hooks
| Hook Name | Trigger Lifecycle | Enforcement & Automated Action |
|---|---|---|
commit-msg |
During git commit |
Validates commit syntax against Conventional Commits; provides instant error guidance. |
post-commit |
After successful commit | Synchronizes CHANGELOG.md and writes updated predictive development version to VERSION. |
pre-push |
During git push |
Verifies that release tags match committed VERSION files and blocks pushing dev versions as tags. |
reference-transaction |
During git tag |
Intercepts tag creation to prevent tagging commits with dirty or uncommitted development states. |
2. Inspecting Hooks (`cccp hooks`)
CCCP includes a built-in inspectorate to audit and diff installed hooks:
# Audit installed hooks for version synchronization:
cccp hooks audit
# Inspect differences against canonical templates (detects third-party tools like Husky):
cccp hooks diff
3. Post-Push Automation & Custom Scripts
Executing cccp push triggers the post-push lifecycle, allowing custom scripts or automated synchronization actions:
# Push to remote and run post-push hooks:
cccp push origin main
Discovery Precedence for Custom Post-Push Scripts
- Path defined in
POST_PUSH_HOOKenvironment variable or.cccprc - Shared team script in
.cccp/hooks/post-push - Local developer script in
.git/hooks/post-push.local