Add mandatory pre-commit full check for agents and devs.
Some checks failed
CI / Lint, type check, unit tests, coverage (pull_request) Successful in 2m6s
CI / E2E browser tests (pull_request) Failing after 1m8s

Document that ./gradlew check must pass before every commit. Add scripts
to run the same verification as CI and optionally install a git hook.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Joakim Mörling 2026-05-27 13:43:35 +02:00
parent afa552e18b
commit c578463b10
3 changed files with 50 additions and 0 deletions

View file

@ -160,6 +160,21 @@ Full details in `@CODING_GUIDELINES.md`. Key rules:
list concrete changes as bullet points. Never write single-line list concrete changes as bullet points. Never write single-line
"feat: add X" messages. "feat: add X" messages.
**Before every commit (mandatory — agents must not skip):**
```bash
# from repo root; needs Docker running
export POSTGRES_DB=bilhej POSTGRES_USER=bilhej POSTGRES_PASSWORD=test_pw_ci_123
export JWT_SECRET=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
export STRIPE_SECRET_KEY=sk_test_fake STRIPE_WEBHOOK_SECRET=whsec_fake STRIPE_PRICE_ID=price_fake
./gradlew check
```
This runs frontend lint, frontend unit tests (242), backend tests (163), coverage
thresholds, Flyway checks, and **all 90 E2E tests in Docker**. **Do not commit or
push if this fails.** Optional local guard: `./scripts/install-pre-commit-hook.sh`
(runs the same `check` on every `git commit`).
### Frontend (Vue.js 3) ### Frontend (Vue.js 3)
- `<script setup>` with Composition API only. Never Options API. - `<script setup>` with Composition API only. Never Options API.
- File naming: PascalCase for pages/components, camelCase (`useXxx`) for composables. - File naming: PascalCase for pages/components, camelCase (`useXxx`) for composables.

View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Symlinks scripts/pre-commit-check.sh into .git/hooks/pre-commit
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HOOK="$ROOT/.git/hooks/pre-commit"
CHECK="$ROOT/scripts/pre-commit-check.sh"
chmod +x "$CHECK"
ln -sf "../../scripts/pre-commit-check.sh" "$HOOK"
chmod +x "$HOOK"
echo "Installed pre-commit hook -> scripts/pre-commit-check.sh"
echo "Every commit will run: ./gradlew check"

20
scripts/pre-commit-check.sh Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Runs the same verification as CI before allowing a commit.
# Install: ./scripts/install-pre-commit-hook.sh
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"
export POSTGRES_DB="${POSTGRES_DB:-bilhej}"
export POSTGRES_USER="${POSTGRES_USER:-bilhej}"
export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-test_pw_ci_123}"
export JWT_SECRET="${JWT_SECRET:-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}"
export STRIPE_SECRET_KEY="${STRIPE_SECRET_KEY:-sk_test_fake}"
export STRIPE_WEBHOOK_SECRET="${STRIPE_WEBHOOK_SECRET:-whsec_fake}"
export STRIPE_PRICE_ID="${STRIPE_PRICE_ID:-price_fake}"
echo "pre-commit: running ./gradlew check (lint + unit + E2E in Docker)..."
./gradlew check --no-daemon
echo "pre-commit: all checks passed."