Move HookNames and ParseHookEvent to HookSupport interface#429
Move HookNames and ParseHookEvent to HookSupport interface#429squishykid wants to merge 5 commits intomainfrom
Conversation
HookNames is only relevant for agents that support hooks. Moving it to HookSupport makes the Agent interface narrower and the type assertion in hooks_cmd.go explicit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 1cebb5656cd7
ParseHookEvent is only relevant for agents that support hooks. Moving it to HookSupport alongside HookNames keeps hook-related methods together and narrows the core Agent interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 475108d11c45
PR SummaryMedium Risk Overview Updates hook command registration and dispatch to only create Written by Cursor Bugbot for commit 0c50af5. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR narrows the core agent.Agent interface by moving hook-specific APIs (HookNames() and ParseHookEvent()) onto the optional agent.HookSupport interface, and updates hook command registration/execution to use HookSupport assertions.
Changes:
- Removed
HookNames()/ParseHookEvent()fromagent.Agentand added them toagent.HookSupport. - Updated hook command wiring (
hooks_cmd.go,hook_registry.go) to only register/execute agent hook commands for agents implementingHookSupport. - Updated mocks/tests to reflect the slimmer
Agentinterface and the expandedHookSupportinterface.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/agent/agent.go | Moves hook-related methods from Agent to HookSupport to keep Agent focused. |
| cmd/entire/cli/hooks_cmd.go | Only adds hook subcommands for agents that implement HookSupport. |
| cmd/entire/cli/hook_registry.go | Changes newAgentHooksCmd to accept HookSupport and asserts HookSupport before parsing hook input. |
| cmd/entire/cli/agent/agent_test.go | Adjusts mock implementations to match new interface boundaries. |
| cmd/entire/cli/lifecycle_test.go | Removes now-unneeded hook-related mock methods/imports from lifecycle tests. |
Summary
HookNames()fromAgenttoHookSupportinterface — only relevant for agents with hooksParseHookEvent()fromAgenttoHookSupportinterface — keeps hook-related methods togetherhooks_cmd.goandhook_registry.goto useHookSupporttype assertionsAgentinterface to exclude hook-specific concernsStacked on #428
🤖 Generated with Claude Code