fix: whitelist .claude/plans/ in doc file creation hook#230
Conversation
The PreToolUse Write hook blocks creation of .md files to prevent unnecessary documentation sprawl. However, it also blocks Claude Code's built-in plan mode from writing plan files to .claude/plans/*.md, causing "BLOCKED: Unnecessary documentation file creation" errors every time a plan is created or updated. Add .claude/plans/ path to the whitelist so plan files are not blocked.
📝 WalkthroughWalkthroughUpdated the Write hook's documentation file blocking logic to allow markdown and text files under the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
|
[openclaw-bot:pr-review] Automated Review - CI checks are passing! ✅ Hi @neal-zhu, thanks for this contribution! All CI checks have passed successfully. A maintainer will review this PR shortly. In the meantime, please ensure:
This is an automated review from OpenClaw. |
Summary
PreToolUse:Writehook that blocks unnecessary.mdfile creation also incorrectly blocks Claude Code's plan mode from writing plan files to.claude/plans/*.md[Hook] BLOCKED: Unnecessary documentation file creationerrors every time a plan is created or updated via plan mode.claude/plans/path to the whitelist regex so plan files are no longer blockedReproduction
/planorEnterPlanMode).claude/plans/<name>.md[Hook] BLOCKED: Unnecessary documentation file creationFix
Added
&&!/\\.claude\\/plans\\//.test(p)to the condition in the doc file creation hook, alongside the existing whitelist forREADME.md,CLAUDE.md,AGENTS.md, andCONTRIBUTING.md.Test plan
.claude/plans/*.mdfiles without being blocked.mdfile creation is still blocked as expectedSummary by CodeRabbit