pub struct HookManager { /* private fields */ }Expand description
Orchestrates hook execution for lifecycle events.
The manager holds a frozen snapshot of the hook configuration, an executor for running subprocess commands, and session metadata used to build stdin payloads for hook commands.
Implementations§
Source§impl HookManager
impl HookManager
Sourcepub fn new(
config: HookConfig,
session_id: impl Into<String>,
cwd: impl Into<String>,
) -> Self
pub fn new( config: HookConfig, session_id: impl Into<String>, cwd: impl Into<String>, ) -> Self
Create a new hook manager.
The config should already have compile_all() and
strip_unknown_events() called on it.
Sourcepub fn has_hooks_for(&self, event: HookEvent) -> bool
pub fn has_hooks_for(&self, event: HookEvent) -> bool
Fast check: are there hooks registered for this event?
Sourcepub async fn run_hooks(
&self,
event: HookEvent,
match_value: Option<&str>,
event_data: Option<&Value>,
) -> HookOutcome
pub async fn run_hooks( &self, event: HookEvent, match_value: Option<&str>, event_data: Option<&Value>, ) -> HookOutcome
Run all matching hooks for an event.
Hooks execute sequentially. Short-circuits on block (exit code 2).
§Arguments
event: The lifecycle event.match_value: Value to test against matcher regex (e.g., tool name).event_data: Additional event-specific data for the stdin payload.
Auto Trait Implementations§
impl Freeze for HookManager
impl RefUnwindSafe for HookManager
impl Send for HookManager
impl Sync for HookManager
impl Unpin for HookManager
impl UnsafeUnpin for HookManager
impl UnwindSafe for HookManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more