Skip to content

Add hooks as plugins#147

Merged
nikomatsakis merged 4 commits intomainfrom
plugins
Mar 30, 2026
Merged

Add hooks as plugins#147
nikomatsakis merged 4 commits intomainfrom
plugins

Conversation

@jackh726
Copy link
Copy Markdown
Contributor

(still draft, just opening to share)

Before merging, I need to actually process/"forward" the hook output. This currently just passes the same payload to each hook, but I think each successive hook should an "updated" payload. And so, that means we likely should be doing early-returns on e.g. Block.

Comment thread src/hook.rs
ClaudePreToolUse,
#[value(name = "pre-tool-use")]
#[serde(rename = "PreToolUse")]
PreToolUse,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why'd you change the name back? My intention with including Claude is that there may be other kinds of hooks in the future that have distinct json formats, and I imagined we'd want to do some normalization on our side.

Comment thread src/plugins.rs
#[derive(Debug, Deserialize, Clone)]
pub struct Hook {
pub name: String,
pub event: HookEvent,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess you removed it because of this -- seems fine, I imagined we'd have a different set of events here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The "canonical" events we support.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah - I don't expect that there will be other types of hooks.

Comment thread src/plugins.rs

[installation]
summary = "Download and install helper"
commands = ["wget https://example.org/bin/tool"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I imagine we're going to iterate on this quite a bit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah...not exactly sure the shape here yet.

@nikomatsakis nikomatsakis marked this pull request as ready for review March 30, 2026 14:55
@nikomatsakis
Copy link
Copy Markdown
Member

After some discussion with Jack, we decided to merge this and iterate in tree

@nikomatsakis nikomatsakis merged commit af7dc09 into main Mar 30, 2026
4 checks passed
@jackh726 jackh726 deleted the plugins branch March 30, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants