#!/bin/bash # Cursor beforeShellExecution hook. # Remind about tmux for long-running servers and review before git push. input=$(cat) command=$(echo "$input" | node -e "let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);process.stdout.write(i.command||i.tool_input?.command||'')}catch{}})") if echo "$command" | grep -Eq 'npm run dev|pnpm( run)? dev|yarn dev|bun run dev'; then if [ -z "$TMUX" ]; then echo '{"permission":"ask","user_message":"Dev servers should run in tmux so logs stay available. Example: tmux new-session -d -s dev \"npm run dev\"","agent_message":"Dev server is not in tmux. Ask before continuing."}' exit 0 fi fi if echo "$command" | grep -Eq 'git push'; then echo '{"permission":"ask","user_message":"Review the diff before pushing. Continue only if the changes look correct.","agent_message":"git push requires a quick review before proceeding."}' exit 0 fi echo '{"permission":"allow"}' exit 0