Loading...
#!/bin/bash
npx prettier --write .
npx tsc --noEmit#!/bin/bash
file=$(jq -r '.tool_input.file_path // empty')
case "$file" in
*.ts|*.tsx) npx prettier --write "$file" ;;
esac
exit 0Formatting only the edited TypeScript file keeps the hook fast, instead of reformatting and type-checking the whole project after every call.
No, the call has already run. The hook can report errors back to the agent so it fixes them in the next step.
Usually not, because it runs after every matching call. Run fast checks per file and save full tests for a stop hook or CI.
The hook prints them and exits with the code the tool expects for feedback, and the harness passes the output back to the agent.