Repository steps
Add a step only one repository needs as a local command in lefthook.yml below the remotes block, without repeating a step a preset already runs, which hookset check reports as a duplicate to delete.
The presets cover the stations every repository shares. A step only one repository needs (an
end-to-end smoke test, a schema check, a hook on post-merge) goes in that repository's own
lefthook.yml, under the hook it belongs to, below the remotes: block hookset init wrote:
remotes:
- git_url: https://github.com/ofri-peretz/burgee
ref: hookset@1.0.0
configs:
- packages/hookset/presets/lefthook/commit-msg.yml
- packages/hookset/presets/lefthook/pre-commit.yml
- packages/hookset/presets/lefthook/pre-push.yml
pre-push:
commands:
e2e:
priority: 10
run: npm run test:e2e
post-merge:
commands:
install:
run: npm installlefthook merges the local commands with the ones the remote brings. A priority above the
presets' (they use 1 to 5 on pre-push) runs the local step after them.
Never repeat a station
A local step that runs a station's script (hook:verify, hook:staged, and the rest), or
commitlint --edit on commit-msg, runs that station twice. hookset check fails on it with
duplicate and names the command to delete. The fix is always the same: change what the
station script runs in package.json, and delete the local step.
Name local steps for what they do
The preset steps are all named hookset-<station>. Keep that prefix for the presets, so a
reader of the lefthook output can tell a shared step from one this repository added.
Monorepo
Wire hookset once at the root of a monorepo: one lefthook.yml, one package.json whose hook:staged and hook:verify scripts hand off to the workspace tool, and check run from the root or with --cwd.
Repositories where agents work
Give a repository that Claude Code works in the git hooks and the hook pack in one command, list its deploys under ask and its generated files under generated, and replace the CLAUDE.md sentences the hooks now enforce.