feat: add stop hook continuation on blocking and example hooks (#657)

This commit is contained in:
jnjpng
2026-01-23 15:28:18 -08:00
committed by GitHub
parent 76f0e114ee
commit cc2b33bb6b
9 changed files with 572 additions and 200 deletions

21
hooks/fix-on-changes.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Hook script: Run bun run fix if there are uncommitted changes
# Triggered on: Stop event
# Check if there are any uncommitted changes (staged or unstaged)
if git diff --quiet HEAD 2>/dev/null; then
echo "No changes, skipping."
exit 0
fi
# Run fix - capture output and send to stderr on failure
output=$(bun run fix 2>&1)
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "$output"
exit 0
else
echo "$output" >&2
exit 2
fi

21
hooks/typecheck-on-changes.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Hook script: Run typecheck if there are uncommitted changes
# Triggered on: Stop event
# Check if there are any uncommitted changes (staged or unstaged)
if git diff --quiet HEAD 2>/dev/null; then
echo "No changes, skipping."
exit 0
fi
# Run typecheck - capture output and send to stderr on failure
output=$(tsc --noEmit --pretty 2>&1)
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "$output"
exit 0
else
echo "$output" >&2
exit 2
fi