Skip to content

Commit 5ed2ee0

Browse files
committed
feat: add shell-level filtering wrapper for pre-commit checks
1 parent 10b1a59 commit 5ed2ee0

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

scripts/precommit-filtered.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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

0 commit comments

Comments
 (0)