重點導讀
想讓 Claude Code 在檢查失敗後再試一次,Stop hook 必須以退出碼 2 結束,Claude 才會收到錯誤訊息並重試。
若使用退出碼 1,檢查雖然失敗,Claude 仍會直接結束。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
Lydia Hallie ✨@lydiahallie
·9 天前
You can use a Stop hook to have Claude try again when a check fails, but make sure it exits with code 2!
Exit 2 sends Claude back to retry with the hook's stderr, exit 1 is non-blocking so Claude just finishes even when the check failed https://t.co/s8Yzl8uykg
推文來源 · X (Twitter)在 X 參與討論
來源: Lydia Hallie ✨ (x.com)
在 X 查看推文