1
0
Fork 0
mirror of https://github.com/imjasonh/cnotes synced 2026-07-11 02:14:52 +00:00

Scaffold all 7 hook events and eliminate type casting

- Add missing hook handlers: Stop, SubagentStop, PreCompact
- Replace all string type casting with proper JSON unmarshaling
- Change ToolUseRequest.Parameters from map[string]interface{} to json.RawMessage
- Update helper methods to use json.Unmarshal directly to typed structs
- Replace speech notifications with simple logging notifications
- Update documentation to reflect all hook events and remove speech references
- Add comprehensive CLAUDE.md with architecture overview and development guidance

All hooks now use type-safe JSON handling without .(string) assertions.
Complete coverage of Claude Code events: PreToolUse, PostToolUse,
UserPromptSubmit, Notification, Stop, SubagentStop, PreCompact.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jason Hall 2025-07-21 12:01:55 -04:00
parent c61b579243
commit 45ef980233
Failed to extract signature
10 changed files with 351 additions and 108 deletions

View file

@ -87,7 +87,10 @@ func runInstall(cmd *cobra.Command, args []string) error {
fmt.Println(" • pre_tool_use: Validates bash commands and prevents sensitive file edits")
fmt.Println(" • post_tool_use: Logs tool usage and runs goimports on modified Go files")
fmt.Println(" • user_prompt_submit: Adds project context to prompts")
fmt.Println(" • notification: Speaks notifications aloud (macOS)")
fmt.Println(" • notification: Logs notification events")
fmt.Println(" • stop: Logs session completion")
fmt.Println(" • subagent_stop: Logs subagent completion")
fmt.Println(" • pre_compact: Handles context compaction events")
fmt.Println("\nTo test: echo '{\"event\":\"pre_tool_use\",\"tool\":\"Bash\",\"tool_use_request\":{\"tool\":\"Bash\",\"parameters\":{\"command\":\"ls\"}}}' | hooks run")
return nil