Skip to content

Latest commit

 

History

History
98 lines (61 loc) · 1.74 KB

File metadata and controls

98 lines (61 loc) · 1.74 KB

Git hooks

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.


1) What is enforced

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:check

If drift is detected, the commit is blocked.


2) Enable hooks (single-choice)

Hooks MUST be enabled by setting the Git hooks path:

git config core.hooksPath .githooks

Canonical 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.hooksPath

Expected output:

.githooks

3) Fixing a hook failure (managed repositories drift)

If pre-commit fails due to managed repositories drift:

  1. Restore the canonical managed block:
composer sync:repos
  1. Re-stage and commit again:
git add composer.json
git commit

4) CI remains authoritative

CI repeats the same rule and MUST run the drift check before any composer install:

composer sync:check

Local hooks are convenience; CI is the source of truth.