Changes: - Pre-commit hook: fixed stale black+isort reference to ruff, clarified no-bypass policy - Loop prompt: Phase 1 is now FIX BROKEN PRS FIRST before any new work - Loop prompt: --no-verify banned in NEVER list and git hooks section - Loop prompt: commit step explicitly relies on hooks for format+test, no manual tox - All --no-verify references removed from workflow examples 1516 tests passing, 76.7% coverage. Co-authored-by: Kimi Agent <kimi@timmy.local> Reviewed-on: http://localhost:3000/rockachopa/Timmy-time-dashboard/pulls/139 Co-authored-by: hermes <hermes@timmy.local> Co-committed-by: hermes <hermes@timmy.local>
38 lines
957 B
Bash
Executable File
38 lines
957 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-commit hook: auto-format + test. No bypass. No exceptions.
|
|
#
|
|
# Auto-activated by `make install` via git core.hooksPath.
|
|
|
|
set -e
|
|
|
|
MAX_SECONDS=60
|
|
|
|
# Auto-format staged files
|
|
echo "Auto-formatting with ruff..."
|
|
tox -e format -- 2>/dev/null || tox -e format
|
|
git add -u
|
|
|
|
echo "Running pre-commit gate via tox (${MAX_SECONDS}s limit)..."
|
|
|
|
# macOS lacks GNU timeout; use perl as a portable fallback.
|
|
if command -v timeout &>/dev/null; then
|
|
timeout "${MAX_SECONDS}" tox -e unit
|
|
else
|
|
perl -e "alarm ${MAX_SECONDS}; exec @ARGV" -- tox -e unit
|
|
fi
|
|
exit_code=$?
|
|
|
|
# Re-stage any files that were reformatted
|
|
git add -u
|
|
|
|
if [ "$exit_code" -eq 142 ] || [ "$exit_code" -eq 124 ]; then
|
|
echo ""
|
|
echo "BLOCKED: pre-commit gate exceeded ${MAX_SECONDS}s wall-clock limit."
|
|
echo "Speed up slow tests before committing."
|
|
exit 1
|
|
elif [ "$exit_code" -ne 0 ]; then
|
|
echo ""
|
|
echo "BLOCKED: pre-commit gate failed."
|
|
exit 1
|
|
fi
|