Feature Request: Allow hook to approve commands, otherwise ask user
Right now I use a simple script to apply some conservative heuristics to gh commands and approve read only ones. I wanted to be asked for less safe commands. This does not currently seem to be possible.
How I do it:
- Add
Bash(gh:*)as allowed tool (otherwise I would be asked to allow it before myPreToolUsehook is called) - Have a
PreToolUsehook withBashmatcher that checks if we're running someghcall. - Log
{"decision": "approve"}for things likegh issue list/ Log{"decision": undefined}for things likegh issue create
What I want it to do is that I interactively asked to confirm if I want to allow the tool call if decision is undefined. Currently this does not work. It just gets approved as well :/
I don't know if this is a change to PreToolUse or PreToolAproval should be added. Would love to discuss this. It would be really great and make claude way more usable for me. I don't want to take care of a giant list of Bash(gh repo view) entries in my allow list. Or maybe add a their "decision": "interactive" state?
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗