docs: add missing hook events from official CHANGELOG (v2.1.9-v2.1.10)
- Add 3 missing events to Section 7.1: Setup, PermissionRequest, SubagentStop - Document PreToolUse additionalContext feature (v2.1.9+) - Create 3 production-ready hook templates (setup, permission, subagent) - Add resource evaluation documenting rejection of secondary source Source: Official Claude Code CHANGELOG, not external blog posts Closes gap identified during resource evaluation process Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bd193cf73a
commit
edf74b38c5
5 changed files with 356 additions and 0 deletions
|
|
@ -5992,6 +5992,9 @@ Hooks are scripts that run automatically when specific events occur.
|
|||
| `SessionStart` | Session begins | Initialization |
|
||||
| `SessionEnd` | Session ends | Cleanup |
|
||||
| `Stop` | User interrupts | Graceful shutdown |
|
||||
| `Setup` | Claude Code starts | Initialization (v2.1.10+) |
|
||||
| `PermissionRequest` | Permission dialog appears | Custom approval logic |
|
||||
| `SubagentStop` | Sub-agent completes | Subagent cleanup |
|
||||
|
||||
### Event Flow
|
||||
|
||||
|
|
@ -6114,6 +6117,16 @@ Hooks can return JSON on stdout:
|
|||
}
|
||||
```
|
||||
|
||||
**PreToolUse additionalContext** (v2.1.9+): PreToolUse hooks can inject context into Claude's prompt via `additionalContext`. This allows enriching Claude's understanding before tool execution:
|
||||
|
||||
```json
|
||||
{
|
||||
"hookSpecificOutput": {
|
||||
"additionalContext": "Current git branch: feature/auth. 3 uncommitted files."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Exit Codes
|
||||
|
||||
| Code | Meaning | Result |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue