build: add pre-commit/push hooks mirroring CI checks (#22705)

This change adds git hooks and Makefile targets that mirror CI required
checks locally, catching issues before they reach CI.

This is for use by AI agents (documented in AGENTS.md).

- **pre-commit** (every commit): gen, fmt, lint, typos, slim binary
  build. Fast checks without Docker or Playwright.
- **pre-push** (before push): full CI suite including site build, tests,
  sqlc-vet, offlinedocs.
  
To use:

```sh
git config core.hooksPath scripts/githooks
```

Works in worktrees (where `.git` is a file). Bypass with `--no-verify`.
This commit is contained in:
Mathias Fredriksson
2026-03-06 16:56:11 +02:00
committed by GitHub
parent d06bf5c75f
commit 752e6ecc16
5 changed files with 189 additions and 16 deletions
+8
View File
@@ -70,6 +70,14 @@ Use the following `make` commands and scripts in development:
- `make build` compiles binaries and release packages
- `make install` installs binaries to `$GOPATH/bin`
- `make test`
- `make pre-commit` runs gen, fmt, lint, typos, and builds a slim binary
- `make pre-push` runs the full CI suite including tests
Install the git hooks to run these automatically:
```sh
git config core.hooksPath scripts/githooks
```
### Running Coder on development mode