stack/.cursor/hooks/stop-check.sh
2026-01-16 13:09:10 -08:00

22 lines
457 B
Bash
Executable File

#!/bin/bash
# Cursor hook: stop
# Runs typecheck and lint when the agent loop ends
# Read JSON input from stdin (contains status and loop_count)
input=$(cat)
# Check if this is a repeated stop hook call (loop_count > 0)
# to prevent infinite loops
loop_count=$(echo "$input" | jq -r '.loop_count // 0')
if [[ "$loop_count" -gt 0 ]]; then
exit 0
fi
# Run typecheck and lint
pnpm run typecheck 1>&2 || exit 2
pnpm run lint --fix 1>&2 || exit 2
exit 0