16 lines
1021 B
Plaintext
16 lines
1021 B
Plaintext
---
|
|
description: Require make test before git commit; never bypass pre-commit without explicit user request
|
|
alwaysApply: true
|
|
---
|
|
|
|
# Git commit gate
|
|
|
|
Before **`git commit`** (including when the user asks the agent to commit):
|
|
|
|
1. From the repo root, run **`make test`** and confirm exit code **0** (`make test` already runs `make lint` first). **`make test` fails if `go` or `golangci-lint` is not in PATH** — install Go 1.26+ and lint, then re-run; do not commit without a real green run.
|
|
2. Only then stage and commit. Do **not** commit while tests are failing or were not run for this change set.
|
|
3. Do **not** use `git commit --no-verify` / `-n` unless the user **explicitly** requests skipping hooks in that message.
|
|
4. If the local repo has no pre-commit hook yet, run **`make install-git-hooks`** once (or **`make setup`**) — installs `scripts/git-hooks/pre-commit`, which always runs `make test`.
|
|
|
|
With the hook installed, **every commit** must pass `make test`; there is no “no Go on machine” exception.
|