diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..2432eda --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Auto-recompile paraglide messages when ui/messages/*.json files are staged. +# Prevents svelte-check / CI failures caused by stale generated JS files. + +set -euo pipefail + +STAGED=$(git diff --cached --name-only) + +if echo "$STAGED" | grep -q '^ui/messages/'; then + echo "[pre-commit] ui/messages/*.json changed — recompiling paraglide..." + (cd ui && npm run paraglide --silent) + git add -f ui/src/lib/paraglide/messages/ + echo "[pre-commit] paraglide output re-staged." +fi diff --git a/justfile b/justfile index aa57f1f..4f0e62a 100644 --- a/justfile +++ b/justfile @@ -122,6 +122,13 @@ secrets-env: secrets-dashboard: doppler open dashboard +# ── Developer setup ─────────────────────────────────────────────────────────── + +# One-time dev setup: configure git to use committed hooks in .githooks/ +setup: + git config core.hooksPath .githooks + @echo "Git hooks configured (.githooks/pre-commit active)." + # ── Gitea CI ────────────────────────────────────────────────────────────────── # Validate workflow files