Summary
Implement a hooks system that allows intercepting tool execution before and after it happens.
Why It's Needed
- Safety: Block dangerous commands before execution
- Backup: Create file backups before modifications
- Security: Prevent credential exposure
- Extensibility: Enable plugins and custom workflows
Hook Types to Implement
PreToolUse
- Fires before any tool executes
- Can block, allow, or modify tool input
- Returns:
{ decision: "allow" | "deny" | "ask", modifiedInput?, message? }
PostToolUse
- Fires after tool completes
- Can log results, provide feedback, trigger follow-up
- Returns:
{ feedback?, metadata? }
Configuration Format
{
"hooks": {
"PreToolUse": [
{
"name": "security-check",
"matcher": "bash|write|edit",
"script": ".codetyper/hooks/security.ts"
}
]
}
}
Acceptance Criteria
Effort Estimate
3 days
References
- Claude Code: 10 hook types
- OpenCode: 12+ hook types
Summary
Implement a hooks system that allows intercepting tool execution before and after it happens.
Why It's Needed
Hook Types to Implement
PreToolUse
{ decision: "allow" | "deny" | "ask", modifiedInput?, message? }PostToolUse
{ feedback?, metadata? }Configuration Format
{ "hooks": { "PreToolUse": [ { "name": "security-check", "matcher": "bash|write|edit", "script": ".codetyper/hooks/security.ts" } ] } }Acceptance Criteria
Effort Estimate
3 days
References