chore(#2185): add scripts/pre-push hook to catch lint failures before CI
Wraps check-issue-refs.sh and check-comment-blocks.sh so a push that would fail the tracker-tag or comment-block CI jobs is caught locally before it reaches the remote — eliminating the fix-and-repush round-trip. Install once per clone: ln -sf ../../scripts/pre-push .git/hooks/pre-push Also adds a one-liner hint to CLAUDE.md so it surfaces in every agent's context at session start.
This commit is contained in:
parent
99347a24d9
commit
e60986cb76
2 changed files with 35 additions and 0 deletions
|
|
@ -129,3 +129,6 @@ The docs below own the details — this section just points at them.
|
|||
window:** → [`docs/turn-loop.md`](docs/turn-loop.md).
|
||||
- **Two-step spawn, approval flow, flake.lock validation:** →
|
||||
[`docs/approvals.md`](docs/approvals.md).
|
||||
- **Pre-push lint hook** (catches tracker-tag and comment-block failures
|
||||
before CI does — install once per clone):
|
||||
`ln -sf ../../scripts/pre-push .git/hooks/pre-push`
|
||||
|
|
|
|||
32
scripts/pre-push
Executable file
32
scripts/pre-push
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
# Git pre-push hook: runs the tracker-tag lint and the comment-block
|
||||
# lint against the working tree before any push lands on the remote.
|
||||
# Catches issues that would fail CI and require a follow-up commit
|
||||
# (common failure mode: a nix comment containing a hash-issue-number
|
||||
# tag added mid-session).
|
||||
#
|
||||
# Install (once per clone):
|
||||
# ln -sf ../../scripts/pre-push .git/hooks/pre-push
|
||||
#
|
||||
# The hook runs against the full working tree (not just staged or
|
||||
# pushed files) to match what CI sees: `nix flake check` builds from
|
||||
# the committed tree, so an untracked hit on a staged file would still
|
||||
# trip CI.
|
||||
set -eu
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
|
||||
echo "pre-push: running tracker-tag lint..." >&2
|
||||
if ! sh "$repo_root/scripts/check-issue-refs.sh"; then
|
||||
echo "pre-push: tracker-tag lint FAILED — fix before pushing" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "pre-push: running comment-block lint..." >&2
|
||||
if ! sh "$repo_root/scripts/check-comment-blocks.sh"; then
|
||||
echo "pre-push: comment-block lint FAILED — fix before pushing" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "pre-push: lints passed ✓" >&2
|
||||
exit 0
|
||||
Loading…
Reference in a new issue