A hook for shell command execution
Kiro Product
IDE and CLI
Feature Description
Currently, I have a PreToolUse hook, which denies specific commands with a reason. However, this script has to manually split the full shell commands into subcommands (i.e. echo a; echo b => echo a and echo b) - something kiro-cli already does internally. I'd prefer if I, through the version 3 permission system, could add a "call this hook with the subcommand, and follow what the output says" - similar to PermissionRequest. However, PermissionRequest gets the full command, not the split, individual subcommands.
This could also be solved by combining #11498 and #11698
Use Case
I could tell the agent "No, do not use echo, because <reasons>. Use <thing> instead" without having to roll my own flaky shell command parsing.
Additional Context
No response
Thanks for opening this issue! 🎉 The idea of having Kiro pass pre-split subcommands to hooks rather than requiring users to roll their own shell parsing is a really thoughtful improvement — it would definitely make the hook experience cleaner and more reliable. A maintainer will take a look at this soon. We appreciate you taking the time to detail the use case and link the related issues — that kind of context is super helpful!
Thanks for raising this. Letting a hook receive each split subcommand of a shell command (the same way the permission system already evaluates them), and act on its output, would remove the need to parse commands yourself in a PreToolUse hook. Logging this as a feature request.