Getting started
Install hookset beside lefthook, declare the three station scripts a repository owns, run `hookset init` to write a lefthook.yml pinned to a release tag, and read what `hookset check` reports.
hookset does one thing: it makes the git hooks of every repository the same, and checks that
they stay the same. The hooks themselves are lefthook presets that live in the burgee
repository. A repository pulls them at a pinned hookset@<version> tag, and each preset step
calls one of the repository's own scripts by a fixed name, so the wiring is shared and the work
is local.
Install
npm install -D hookset lefthookhookset needs Node 22.13 or later and git. lefthook runs the hooks; hookset writes and checks its configuration.
Declare the stations
A preset step runs npm run hook:<name>. Three of those names are enforced, so the repository
declares them in package.json, and prepare installs the hooks after every npm install:
{
"name": "my-app",
"private": true,
"scripts": {
"prepare": "lefthook install || true",
"hook:provedone": "provedone gate --mode enforce",
"hook:staged": "prettier --check",
"hook:verify": "npm run typecheck && npm test && npm run build"
}
}What each script runs is the repository's choice. hook:staged gets the staged paths as
arguments; hook:verify runs before a push. Presets lists every
station and what calls it.
Check before anything is wired
hookset check is the gate. In a repository with no lefthook.yml it says so, with the fix:
hookset: 1 error, 4 warnings
✗ there is no lefthook.yml
fix: run `hookset init`
! the mutation station is not declared yet (optional)
fix: add "hook:mutation" to package.json scripts when the repo has it: changed-lines mutation testing
! the test-integrity station is not declared yet (observe)
fix: add "hook:test-integrity" to package.json scripts when the repo has it: no .only, .skip or weakened assertion in the diff
! the proofline station is not declared yet (observe)
fix: add "hook:proofline" to package.json scripts when the repo has it: the change carries its Checked line
! the triggerlist station is not declared yet (observe)
fix: add "hook:triggerlist" to package.json scripts when the repo has it: protected paths changed only with their triggerWrite the config
wrote lefthook.ymlThe file it wrote pulls the three presets from the burgee repository at the tag of the hookset you installed, and nothing else (shown here without its comments):
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.ymlRun it again and nothing changes:
already up to dateCheck again
hookset: ok (hookset@1.0.0)
! the mutation station is not declared yet (optional)
fix: add "hook:mutation" to package.json scripts when the repo has it: changed-lines mutation testing
! the test-integrity station is not declared yet (observe)
fix: add "hook:test-integrity" to package.json scripts when the repo has it: no .only, .skip or weakened assertion in the diff
! the proofline station is not declared yet (observe)
fix: add "hook:proofline" to package.json scripts when the repo has it: the change carries its Checked line
! the triggerlist station is not declared yet (observe)
fix: add "hook:triggerlist" to package.json scripts when the repo has it: protected paths changed only with their triggerThe repository passes: every enforced station has its script, and the presets are pinned to a
tag. The lines that start with ! are warnings. Those four stations are wired with
npm run --if-present, so a repository that has not declared them passes, and check lists
them so you know they exist. ✗ lines are errors, and any error makes check exit 1.
Every output block on this site is checked: tests/examples.test.ts writes each titled file,
runs the command in the block's title in order, and compares.
Where next
- Presets: what each hook runs, station by station.
- The two commands: every flag, every problem
checkreports, and--json. - Claude Code hooks:
hookset init --claudeand what the pack denies. - Coming from husky: move
.husky/scripts into the station scripts. - Run it in CI: the reusable workflow.
hookset
Git hooks presets for AI coding agents: lefthook presets pulled by a pinned tag, a Claude Code hook pack that denies skipped hooks, and `hookset init` and `check`. No dependency outside the burgee family. A husky migration path.
Presets
The three lefthook presets hookset ships, one per git hook, and every station in them: the command each step runs, the repository script it calls, whether it is enforced, optional or observed, and why each one sits on the hook it does.