diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..66ebc77291 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: + - repo: local + hooks: + - id: go-tests + name: Go tests (backend) + entry: make test-backend + language: system + pass_filenames: false + + - id: web-tests + name: Web tests + entry: make test-web + language: system + pass_filenames: false + + - id: web-lint + name: Web lint + entry: make lint-web + language: system + pass_filenames: false diff --git a/README.md b/README.md index a065cd4eb9..09b6687ad6 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,35 @@ go fmt ./... go vet ./... ``` +## Pre-commit Hooks + +We use `pre-commit` to run the backend tests, web tests, and web lint before commits. + +### Install + +```bash +# Install pre-commit (https://pre-commit.com/#install) +pipx install pre-commit + +# Install git hooks +pre-commit install +``` + +### Run Manually + +```bash +# Run all hooks once +pre-commit run --all-files +``` + +### Hooks Config + +The hooks are defined in `.pre-commit-config.yaml` and run these Makefile targets: + +- `make test-backend` +- `make test-web` +- `make lint-web` + ## Project Status ✅ **Core Features Working** @@ -233,4 +262,3 @@ See [apps/backend/NEXT_STEPS.md](apps/backend/NEXT_STEPS.md) for the complete ro ## Acknowledgments Built with Go and inspired by modern DevOps practices and AI-assisted development workflows. -