Pre/post-CMD hooks (shell scripts around command execution) #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Inspired by Claude Code's hooks (run before/after Claude actions — auto-format on edit, lint before commit).
What: Optional shell scripts triggered around every CMD: line. Config in
config.lua:The hook receives the command line on stdin and
AISH_CMD,AISH_TURN,AISH_CWDas env vars. Non-zero exit onpre_cmdaborts execution;post_cmdexit code is ignored but stdout is logged.Why: Audit trail, format-after-edit, custom safety gates beyond
confirm_cmd.Where it lands: Phase 1 or 2. Touches
executor.lua, ~30 LOC.Source: https://code.claude.com/docs/en/overview (hooks)