Skip to content

Move HookNames and ParseHookEvent to HookSupport interface#429

Open
squishykid wants to merge 5 commits intomainfrom
rwr/move-hooks-to-hook-interface
Open

Move HookNames and ParseHookEvent to HookSupport interface#429
squishykid wants to merge 5 commits intomainfrom
rwr/move-hooks-to-hook-interface

Conversation

@squishykid
Copy link
Member

Summary

  • Moves HookNames() from Agent to HookSupport interface — only relevant for agents with hooks
  • Moves ParseHookEvent() from Agent to HookSupport interface — keeps hook-related methods together
  • Updates call sites in hooks_cmd.go and hook_registry.go to use HookSupport type assertions
  • Narrows the core Agent interface to exclude hook-specific concerns

Stacked on #428

🤖 Generated with Claude Code

squishykid and others added 2 commits February 19, 2026 18:18
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
Copilot AI review requested due to automatic review settings February 19, 2026 17:26
@squishykid squishykid requested a review from a team as a code owner February 19, 2026 17:26
@cursor
Copy link

cursor bot commented Feb 19, 2026

PR Summary

Medium Risk
This is an interface refactor that can break compilation or hook execution for any agent implementations/callers not updated to satisfy HookSupport or to type-assert it correctly.

Overview
Narrows the core agent.Agent interface by removing hook-specific methods (HookNames, ParseHookEvent) and making them part of the optional agent.HookSupport interface instead.

Updates hook command registration and dispatch to only create entire hooks <agent> subcommands for agents that implement HookSupport, and to type-assert HookSupport before parsing hook stdin into lifecycle events. Test mocks are adjusted to reflect the new interface split.

Written by Cursor Bugbot for commit 0c50af5. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() from agent.Agent and added them to agent.HookSupport.
  • Updated hook command wiring (hooks_cmd.go, hook_registry.go) to only register/execute agent hook commands for agents implementing HookSupport.
  • Updated mocks/tests to reflect the slimmer Agent interface and the expanded HookSupport interface.

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.

@squishykid squishykid requested a review from Soph February 19, 2026 19:21
Base automatically changed from rwr/cleanup-ParseHookInput to main February 20, 2026 00:19
@squishykid squishykid enabled auto-merge February 20, 2026 07:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments