Pinning by tag and upgrading
Why each repository pins the presets to a hookset@<version> git tag rather than a branch, what check says about a branch or an older tag, how `hookset init` moves the pin, and how a new preset version is released.
A repository's lefthook.yml pulls the presets through lefthook's remotes, and the ref of
that remote is a git tag of the burgee repository: hookset@<version>, the version of the
hookset package that wrote it.
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.ymlWhy a tag
- A tag does not move. A repository's hooks change only when that repository changes its
ref, in a pull request of its own that its own CI runs. A branch would change every repository's hooks the moment burgee merged, with nobody looking. - lefthook takes a tag or a branch, never a commit. So a release is a tag.
- A shared file copied into each repository drifts. The
spec rejected
a copy synced from elsewhere for that reason;
remotesat a pinned tag is one file, read in place.
What check says
A branch is an error. The repository below pins main:
remotes:
- git_url: https://github.com/ofri-peretz/burgee
ref: main
configs:
- packages/hookset/presets/lefthook/commit-msg.yml
- packages/hookset/presets/lefthook/pre-commit.yml
- packages/hookset/presets/lefthook/pre-push.yml{
"private": true,
"scripts": {
"prepare": "lefthook install || true",
"hook:provedone": "provedone gate --mode enforce",
"hook:staged": "prettier --check",
"hook:verify": "npm test",
"hook:mutation": "npm run mutation:changed",
"hook:test-integrity": "truepass diff",
"hook:proofline": "node scripts/proofline.mjs",
"hook:triggerlist": "triggerlist protect origin/main"
}
}hookset: 1 error
✗ the presets remote is pinned to main, not a hookset@<version> tag
fix: set `ref: hookset@1.0.0`An older tag is a warning, not an error: the repository still runs a fixed set of hooks, just
not the newest. Here a repository is pinned to hookset@0.2.1:
remotes:
- git_url: https://github.com/ofri-peretz/burgee
ref: hookset@0.2.1
configs:
- packages/hookset/presets/lefthook/commit-msg.yml
- packages/hookset/presets/lefthook/pre-commit.yml
- packages/hookset/presets/lefthook/pre-push.ymlhookset: ok (hookset@0.2.1)
! the presets are pinned to hookset@0.2.1; this hookset is hookset@1.0.0
fix: set `ref: hookset@1.0.0` (`hookset init` does it)
! 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 triggerUpgrading
Update the package, then let init move the pin:
npm install -D hookset@latestwrote lefthook.ymlhookset: 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 triggerinit rewrites only the ref: line and leaves the rest of the file as it was. It moves the
first ref: inside remotes:, so keep the hookset remote first in that block when a
repository pulls from more than one.
A new preset version can add an enforced station, as hookset@1.0.0 added the
provedone station on commit-msg. Run hookset check after the bump: it names the
script to declare before the hook can pass. Read the changelog for what each
version changed.
Releasing a preset version
For maintainers of the burgee repository: bump version in packages/hookset/package.json
through a changeset, merge, then tag the merge commit hookset@<version>. Every repository
moves by changing its ref, which hookset init does, and hookset check warns on every
repository still pinned behind.
The two commands
`hookset init` writes or re-pins the lefthook.yml that pulls the presets and refuses a hand-written one without --force; `hookset check` reports every missing station, unpinned remote, repeated step and drifted Claude hook, as text or as a --json envelope, and exits 1 on any error.
Claude Code hooks
`hookset init --claude` vendors two Claude Code hooks into .claude/hooks/ and wires them in .claude/settings.json: guard-bash denies skipped git hooks, a moved core.hooksPath, CI polling loops and a short-timeout commit or push, and asks before a publish; stop-after-3 ends the turn after the third failed test run in a row.