vibe-and-thrive 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ralph/verify.sh +30 -5
package/package.json
CHANGED
package/ralph/verify.sh
CHANGED
|
@@ -426,21 +426,37 @@ run_configured_checks() {
|
|
|
426
426
|
# Run pre-commit hooks if available (catches errors before commit attempt)
|
|
427
427
|
if command -v pre-commit &>/dev/null && [[ -f ".pre-commit-config.yaml" ]]; then
|
|
428
428
|
echo -n " pre-commit hooks... "
|
|
429
|
-
local precommit_log
|
|
430
|
-
precommit_log=$(create_temp_file ".log") || return 1
|
|
429
|
+
local precommit_log="$RALPH_DIR/last_precommit_failure.log"
|
|
431
430
|
|
|
431
|
+
# First run - let hooks auto-fix files
|
|
432
432
|
if pre-commit run --all-files > "$precommit_log" 2>&1; then
|
|
433
433
|
print_success "passed"
|
|
434
|
+
rm -f "$precommit_log"
|
|
435
|
+
elif grep -q "files were modified by this hook" "$precommit_log"; then
|
|
436
|
+
# Hooks auto-fixed files - stage them and run again
|
|
437
|
+
echo "auto-fixing..."
|
|
438
|
+
git add -A 2>/dev/null || true
|
|
439
|
+
|
|
440
|
+
# Second run - should pass now unless there are real errors
|
|
441
|
+
if pre-commit run --all-files > "$precommit_log" 2>&1; then
|
|
442
|
+
print_success "passed (after auto-fix)"
|
|
443
|
+
rm -f "$precommit_log"
|
|
444
|
+
else
|
|
445
|
+
# Still failing - these are real errors
|
|
446
|
+
print_error "failed"
|
|
447
|
+
echo ""
|
|
448
|
+
echo " Pre-commit hook errors (after auto-fix):"
|
|
449
|
+
grep -A 20 "Failed\|error\|Error" "$precommit_log" | head -40 | sed 's/^/ /'
|
|
450
|
+
return 1
|
|
451
|
+
fi
|
|
434
452
|
else
|
|
453
|
+
# First run failed with real errors (not just auto-fix)
|
|
435
454
|
print_error "failed"
|
|
436
455
|
echo ""
|
|
437
456
|
echo " Pre-commit hook errors:"
|
|
438
|
-
# Show the failing hooks and their output
|
|
439
457
|
grep -A 20 "Failed\|error\|Error" "$precommit_log" | head -40 | sed 's/^/ /'
|
|
440
|
-
rm -f "$precommit_log"
|
|
441
458
|
return 1
|
|
442
459
|
fi
|
|
443
|
-
rm -f "$precommit_log"
|
|
444
460
|
fi
|
|
445
461
|
|
|
446
462
|
# Config-based checks are optional
|
|
@@ -920,5 +936,14 @@ save_failure_context() {
|
|
|
920
936
|
jq -r '"Missing elements: " + (.elementsMissing | join(", "))' "$RALPH_DIR/last_browser_failure.json" 2>/dev/null
|
|
921
937
|
echo ""
|
|
922
938
|
fi
|
|
939
|
+
|
|
940
|
+
if [[ -f "$RALPH_DIR/last_precommit_failure.log" ]]; then
|
|
941
|
+
echo "--- Pre-commit / Lint Failure ---"
|
|
942
|
+
echo "Fix these lint errors before the story can be completed:"
|
|
943
|
+
echo ""
|
|
944
|
+
# Extract just the error lines (skip the hook names and status lines)
|
|
945
|
+
grep -E "^\s*(error|warning|Error|ARG|F841|B007|SIM|-->)" "$RALPH_DIR/last_precommit_failure.log" | head -50
|
|
946
|
+
echo ""
|
|
947
|
+
fi
|
|
923
948
|
} > "$context_file"
|
|
924
949
|
}
|