kaizen/collect/hooks/
mod.rs1pub mod claude;
5pub mod cursor;
6pub mod normalize;
7
8#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct HookEvent {
11 pub kind: EventKind,
12 pub session_id: String,
13 pub ts_ms: u64,
14 pub payload: serde_json::Value,
15}
16
17#[derive(Debug, Clone, PartialEq, Eq)]
19pub enum EventKind {
20 PreToolUse,
21 PostToolUse,
22 Stop,
23 SessionStart,
24 Unknown(String),
25}
26
27impl EventKind {
28 pub fn parse(s: &str) -> Self {
29 match s {
30 "PreToolUse" | "pre_tool_use" => Self::PreToolUse,
31 "PostToolUse" | "post_tool_use" => Self::PostToolUse,
32 "Stop" | "stop" => Self::Stop,
33 "SessionStart" | "session_start" => Self::SessionStart,
34 other => Self::Unknown(other.to_string()),
35 }
36 }
37}