chore: add pre-commit hook recipes #138

Merged
David merged 1 commit from chore/pre-commit-hooks into main 2026-06-13 12:46:46 +02:00
Owner

Summary

  • Adds install-hooks recipe (governance [group: 'hooks'] pattern from governance/PRE_COMMIT.md): writes a #!/usr/bin/env sh stub at .git/hooks/pre-commit that execs just pre-commit, marks it executable, and is idempotent (removes any leftover symlink from a prior install before writing).
  • Adds pre-commit recipe that mirrors .forgejo/workflows/check.yml step-for-step - cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo build --workspace --all-targets --locked, cargo test --workspace --lib - all run inside the dev compose api container via docker compose -f compose.dev.yml run --rm --no-deps api so the toolchain matches CI exactly.
  • No -e SQLX_OFFLINE=true flags added because the api service in compose.dev.yml already declares SQLX_OFFLINE: "true" in its environment block, so the env var is present in the container for all four steps without extra flags.

Opt-in, no behavior change

This PR adds no automated behavior. Contributors opt in once per fresh clone with just install-hooks. Any single commit can bypass the hook with git commit --no-verify. Nothing in the existing dev/CI workflow is altered.

Test plan

  • Run just --list and confirm [hooks] group shows install-hooks and pre-commit.
  • Run just install-hooks and confirm .git/hooks/pre-commit is created and executable.
  • Run just install-hooks a second time (idempotency check) - should overwrite cleanly.
  • With the dev compose stack available, run just pre-commit and confirm all four cargo steps execute in order inside the api container.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

## Summary - Adds `install-hooks` recipe (governance `[group: 'hooks']` pattern from `governance/PRE_COMMIT.md`): writes a `#!/usr/bin/env sh` stub at `.git/hooks/pre-commit` that execs `just pre-commit`, marks it executable, and is idempotent (removes any leftover symlink from a prior install before writing). - Adds `pre-commit` recipe that mirrors `.forgejo/workflows/check.yml` step-for-step - `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo build --workspace --all-targets --locked`, `cargo test --workspace --lib` - all run inside the dev compose `api` container via `docker compose -f compose.dev.yml run --rm --no-deps api` so the toolchain matches CI exactly. - No `-e SQLX_OFFLINE=true` flags added because the `api` service in `compose.dev.yml` already declares `SQLX_OFFLINE: "true"` in its `environment` block, so the env var is present in the container for all four steps without extra flags. ## Opt-in, no behavior change This PR adds no automated behavior. Contributors opt in once per fresh clone with `just install-hooks`. Any single commit can bypass the hook with `git commit --no-verify`. Nothing in the existing dev/CI workflow is altered. ## Test plan - [ ] Run `just --list` and confirm `[hooks]` group shows `install-hooks` and `pre-commit`. - [ ] Run `just install-hooks` and confirm `.git/hooks/pre-commit` is created and executable. - [ ] Run `just install-hooks` a second time (idempotency check) - should overwrite cleanly. - [ ] With the dev compose stack available, run `just pre-commit` and confirm all four cargo steps execute in order inside the `api` container. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chore: add install-hooks and pre-commit just recipes
All checks were successful
Check / fmt / clippy / build / test (pull_request) Successful in 1m13s
Create release / Create release from merged PR (pull_request) Has been skipped
41f4170134
Add the governance `[group: 'hooks']` recipes from governance/PRE_COMMIT.md: `install-hooks` writes a `.git/hooks/pre-commit` stub that execs `just pre-commit`, and `pre-commit` mirrors `.forgejo/workflows/check.yml` step-for-step (fmt, clippy, build, unit tests) inside the dev compose `api` container so CI failures surface locally before push.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
David merged commit 415eea1a34 into main 2026-06-13 12:46:46 +02:00
David deleted branch chore/pre-commit-hooks 2026-06-13 12:46:46 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/bunyip!138
No description provided.