Loading...
#!/bin/bash
npm test || exit 2#!/bin/bash
input=$(cat)
if [ "$(echo "$input" | jq -r '.stop_hook_active')" = "true" ]; then exit 0; fi
if ! npm test --silent; then
echo "Tests fail. Fix them before finishing." >&2
exit 2
fiSkipping the check when the hook already forced a retry prevents an endless loop while still making the agent fix failing tests.
Yes. If the hook blocks the stop and returns a reason, the agent continues and tries to fix the problem.
Check the flag the tool passes when the hook already triggered a retry, or count attempts, and let the agent stop after a limit.
Yes. A common use is a desktop or chat notification that the task is done, so you do not have to watch the session.