feat: add stop hook continuation on blocking and example hooks (#657)
This commit is contained in:
21
hooks/fix-on-changes.sh
Executable file
21
hooks/fix-on-changes.sh
Executable 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
21
hooks/typecheck-on-changes.sh
Executable 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
|
||||
Reference in New Issue
Block a user