Git drift hook
Keep committed harness files honest by installing a git pre-commit hook that runs the drift gate on every commit.
Install
Section titled “Install”adept hook install # fail mode (default)adept hook install --mode fix # auto-fix modeThis writes .git/hooks/pre-commit. The installed hook is a thin stub that execs
adept hook run — all the logic stays in the CLI.
You can also install it at init time:
adept init --git-hook # bare flag == fail modeadept init --git-hook=fix| Mode | Behavior on drift |
|---|---|
fail (default) |
The commit is blocked; you fix drift and re-commit. |
fix |
adept auto-adopts / re-renders the drift and re-stages the files, then the commit proceeds. |
Under the hood, fix mode runs adept hook run --fix.
Safety
Section titled “Safety”adeptonly overwrites a pre-commit hook it wrote itself (marked with an internaladept-managedmarker). It refuses to clobber a hand-written hook — remove it or install manually if you already have one.- The hook assumes a standard
.git/directory. In a worktree or submodule (where.gitis a file pointing elsewhere), install the hook manually. - The installed hook calls
adeptfrom$PATH— that’s the install-time contract, so make sureadeptis on thePATHof whoever commits.
Running the gate manually / in CI
Section titled “Running the gate manually / in CI”The same gate the hook invokes:
adept hook run # fail on driftadept hook run --fix # auto-adopt/re-render and re-stageFor CI, prefer adept status, which exits 2 when anything is out of sync:
adept status || echo "drift detected"