File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Wrapper for 'just pre-commit' that only outputs failures to reduce context bloat
3+
4+ set -euo pipefail
5+
6+ REPO_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
7+ cd " $REPO_ROOT "
8+
9+ LOG_FILE=" /tmp/opencode-cloud-precommit-$$ .log"
10+
11+ echo " Running pre-commit checks (full output captured to $LOG_FILE )..."
12+ echo " "
13+
14+ # Run pre-commit, capture all output
15+ if just pre-commit > " $LOG_FILE " 2>&1 ; then
16+ echo " ✅ All tests passed."
17+ rm -f " $LOG_FILE "
18+ exit 0
19+ else
20+ EXIT_CODE=$?
21+ echo " ❌ Pre-commit failed (exit code $EXIT_CODE )"
22+ echo " "
23+ echo " === FAILURES ONLY ==="
24+
25+ # Extract only failure lines and surrounding context
26+ grep -B2 -A2 " FAILED\|❌\|error:\|Error:" " $LOG_FILE " || true
27+
28+ # Show summary line if present
29+ grep " Tests:" " $LOG_FILE " || true
30+
31+ echo " "
32+ echo " Full log saved: $LOG_FILE "
33+ exit $EXIT_CODE
34+ fi
You can’t perform that action at this time.
0 commit comments