Git hooks are used as a local convenience guard to enforce the managed Composer repositories policy.
Scope: Local convenience guards for the current monorepo development baseline.
The managed repositories block in root composer.json MUST be managed only by:
composer sync:repos
Manual edits of managed entries MUST NOT be part of the workflow.
The pre-commit hook enforces this by running:
composer sync:checkIf drift is detected, the commit is blocked.
Hooks MUST be enabled by setting the Git hooks path:
git config core.hooksPath .githooksCanonical one-time setup on a clean clone:
composer setup(That script MUST configure core.hooksPath as part of setup.)
To verify hooks path:
git config --get core.hooksPathExpected output:
.githooksIf pre-commit fails due to managed repositories drift:
- Restore the canonical managed block:
composer sync:repos- Re-stage and commit again:
git add composer.json
git commitCI repeats the same rule and MUST run the drift check before any composer install:
composer sync:checkLocal hooks are convenience; CI is the source of truth.