Skip to main content

max / balanced_breakfast

963 B · 34 lines History Blame Raw
1 #!/bin/bash
2 # Balanced Breakfast pre-commit gate: rustfmt + frontend design-system lint
3 # + JS tests.
4 # Blocks the commit if either fails (per the no-PR workflow; run locally).
5 #
6 # Activate in a fresh clone (one-time):
7 # git config core.hooksPath scripts/githooks
8 #
9 # Bypass for a work-in-progress commit: git commit --no-verify
10 set -euo pipefail
11
12 ROOT="$(git rev-parse --show-toplevel)"
13 cd "$ROOT"
14
15 echo "pre-commit: rustfmt..."
16 if ! bash scripts/githooks/rustfmt-gate.sh; then
17 echo "pre-commit: rustfmt gate failed, commit aborted (use --no-verify to bypass)."
18 exit 1
19 fi
20
21 echo "pre-commit: frontend lint..."
22 if ! bash scripts/lint-frontend.sh; then
23 echo "pre-commit: lint failed, commit aborted (use --no-verify to bypass)."
24 exit 1
25 fi
26
27 echo "pre-commit: JS tests..."
28 if ! node src-tauri/frontend/js/tests/run.js; then
29 echo "pre-commit: JS tests failed, commit aborted (use --no-verify to bypass)."
30 exit 1
31 fi
32
33 echo "pre-commit: clean."
34