Repository navigation
fix(hooks): keep a hook's matcher and kind when installing to another agent - #204
Merged
Merged
Conversation
… agent Installing a hook to another agent now translates the tool names in its matcher for Cursor and Gemini CLI, writes the matcher for Cursor and Copilot (it was dropped), and reports a matcher it had to copy as written. Prompt and agent hooks go only to agents that run them instead of being written as shell commands. Install failures show the reason. Disable and delete now find a hook in its file by id, so a matcher that holds `:` or `*`, an entry with extra fields, and a prompt hook can all be disabled and restored. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Deploying harnesskit with
|
| Latest commit: |
f472fa3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://96bc625a.harnesskit.pages.dev |
| Branch Preview URL: | https://fix-hook-cross-agent-install.harnesskit.pages.dev |
Disabling one handler of a Claude-shaped group saved the whole group, so enabling it again pushed the group's other handlers back a second time. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A Copilot hook whose command sits under `bash` or a platform key was listed but could not be disabled or deleted, because only `command` was matched. The reader and the matcher now share one lookup. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Match a Cursor or Copilot entry the way that agent's reader lists it, so an entry the reader skips is never saved or removed in its place. - Entries that differ only in other keys are one row; save all of them, since disabling removes all of them. - Trim a whole-group snapshot saved by an earlier version to the row's own handler before restoring it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems
Installing a hook from one agent to another could leave a hook that fires for the wrong tools, never fires, or runs the wrong thing.
Bashhook → CursorShellBashcopied; never firesrun_shell_commandBash"type": "agent") → any agent but Claude CodeFound on the way, all on main today:
timeoutcould not be disabled or deleted.*or contains:(Cursor'sMCP:create_issue) could not be disabled.bashor a platform key (osx,linux,windows) was listed but could not be disabled or deleted.Changes
adapter/hook_tools.rs(new): tool names per agent andtranslate_matcher. Plain names and|lists are rewritten. Anything else (a regex, an MCP tool pattern, a tool the target has no name for) is copied as written and reported back; the UI shows it as a warning.HookEntrycarries a kind: command, prompt or agent. Adapters say which kinds they run.:.Behaviour changes to know about
Not covered
Testing
cargo fmt,cargo clippy -D warnings,cargo test --workspace(hk-core 818),tsc,biome, frontend tests (374), website tests (677).🤖 Generated with Claude Code