fix: hooks スクリプト未存在時の graceful fallback - #607
Conversation
hooks スクリプトがないリポジトリで Claude を使用すると "No such file or directory" エラーでブロックされていた問題を修正。 スクリプト未存在時は /repo-maintenance の実行を推奨するメッセージを表示する。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughConfiguration file Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 AI Code Review (Local Hook)Models: Codex (default) / Gemini (default) 🤖 Codex Review指摘事項(重大度順)
結論: patch is incorrect
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e97b4d4ce7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| "type": "command", | ||
| "command": "bash -c 'cd \"$(git rev-parse --show-toplevel 2>/dev/null || echo .)\" && python3 .claude/hooks/block_git_no_verify.py'" | ||
| "command": "bash -c 'cd \"$(git rev-parse --show-toplevel 2>/dev/null || echo .)\" && { [ -f .claude/hooks/block_git_no_verify.py ] && python3 .claude/hooks/block_git_no_verify.py || echo \"[hooks] .claude/hooks/block_git_no_verify.py not found. Run /repo-maintenance to set up quality hooks.\"; }'" |
There was a problem hiding this comment.
Preserve hook failure exit codes when adding fallback
The new A && B || echo ... pattern turns real hook failures into success: when python3 .claude/hooks/block_git_no_verify.py exists but exits non-zero (e.g., it intentionally returns 2 to block forbidden commands), the || echo ... branch runs and the overall shell command exits 0, so Claude no longer blocks the action. This regresses the enforcement behavior documented for these hooks and applies to each similarly updated command in this file.
Useful? React with 👍 / 👎.
|
🎉 This PR is included in version 1.101.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
No such file or directoryエラーでブロックされる問題を修正/repo-maintenanceの実行を推奨するメッセージを表示するように変更~/.claude/settings.json)とプロジェクト設定の両方に適用Test plan
git checkout等がブロックされないことを確認/repo-maintenance推奨メッセージが表示されることを確認🤖 Generated with Claude Code
Summary by CodeRabbit
/repo-maintenancefor complete quality hook installation.