chore: add pre-commit hook recipes #191

Merged
David merged 2 commits from chore/pre-commit-hooks into main 2026-06-13 12:49:35 +02:00
Owner

Adds the opt-in governance pre-commit hook recipes from governance/PRE_COMMIT.md (compose-run variant A) to the justfile. No behavior change to existing recipes; two new recipes land under a # ── Hooks ── divider in the [group: 'hooks'] group.

install-hooks (run once per fresh clone) writes a #!/usr/bin/env sh\nexec just pre-commit\n stub to .git/hooks/pre-commit and marks it executable; re-running overwrites any leftover symlink from an older install layout. Opt in with just install-hooks; bypass a single commit with git commit --no-verify.

pre-commit mirrors .forgejo/workflows/check.yml step-for-step with byte-identical cargo args (cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo check --all-targets, cargo test --lib, cargo test --doc, then the nine integration test binaries with --test-threads=4), each run through docker compose --file compose.dev.yml run --rm against the dev server container so the toolchain matches CI.

Steps 1-5 use --no-deps (no DB needed); the integration step drops --no-deps so the compose postgres service (a depends_on of server, condition service_healthy) starts. The server service already sets DATABASE_URL=postgres://...@postgres:5432/mokosh, so the integration step needs no -e DATABASE_URL override. The server service does not set SQLX_OFFLINE, so the five compile/test steps (clippy, check, unit, doc, integration) pass -e SQLX_OFFLINE=true to match CI's job-level SQLX_OFFLINE: "true"; fmt does not compile so it is left bare.

Validated with just --list (exit 0; both recipes appear under [hooks]). No CI/docker/cargo build was run locally.

🤖 Generated with Claude Code

Adds the opt-in governance pre-commit hook recipes from `governance/PRE_COMMIT.md` (compose-run variant A) to the `justfile`. No behavior change to existing recipes; two new recipes land under a `# ── Hooks ──` divider in the `[group: 'hooks']` group. `install-hooks` (run once per fresh clone) writes a `#!/usr/bin/env sh\nexec just pre-commit\n` stub to `.git/hooks/pre-commit` and marks it executable; re-running overwrites any leftover symlink from an older install layout. Opt in with `just install-hooks`; bypass a single commit with `git commit --no-verify`. `pre-commit` mirrors `.forgejo/workflows/check.yml` step-for-step with byte-identical cargo args (cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo check --all-targets, cargo test --lib, cargo test --doc, then the nine integration test binaries with --test-threads=4), each run through `docker compose --file compose.dev.yml run --rm` against the dev `server` container so the toolchain matches CI. Steps 1-5 use `--no-deps` (no DB needed); the integration step drops `--no-deps` so the compose `postgres` service (a `depends_on` of `server`, condition service_healthy) starts. The `server` service already sets `DATABASE_URL=postgres://...@postgres:5432/mokosh`, so the integration step needs no `-e DATABASE_URL` override. The `server` service does not set `SQLX_OFFLINE`, so the five compile/test steps (clippy, check, unit, doc, integration) pass `-e SQLX_OFFLINE=true` to match CI's job-level `SQLX_OFFLINE: "true"`; fmt does not compile so it is left bare. Validated with `just --list` (exit 0; both recipes appear under `[hooks]`). No CI/docker/cargo build was run locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chore: add install-hooks and pre-commit just recipes
All checks were successful
E2E (staging) / Playwright against staging (pull_request) Successful in 38s
Check / fmt + clippy + compile + tests (pull_request) Successful in 1m30s
2a34180678
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, compile check, unit, doc, and integration tests) inside the dev compose `server` container so CI failures surface locally before push. The integration step drops `--no-deps` so the dev Postgres starts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge branch 'main' into chore/pre-commit-hooks
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
E2E (staging) / Playwright against staging (pull_request) Successful in 49s
Check / fmt + clippy + compile + tests (pull_request) Successful in 2m35s
Build OCI container / Build and push mokosh-api image (push) Successful in 3m49s
22b4f592c9
David merged commit 732427aa30 into main 2026-06-13 12:49:35 +02:00
David deleted branch chore/pre-commit-hooks 2026-06-13 12:49:35 +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/mokosh-server!191
No description provided.