use serde_json::{json, Value};
const MATCHER: &str = "write_file|replace|edit";
pub const SETTINGS: &str = ".gemini/settings.json";
pub const EVENT: &str = "BeforeTool";
pub fn entry() -> Value {
json!({
"matcher": MATCHER,
"hooks": [{
"type": "command",
"command": "ralon hook check"
}]
})
}
pub fn is_ours(candidate: &Value) -> bool {
candidate
.get("hooks")
.and_then(Value::as_array)
.is_some_and(|hooks| {
hooks.iter().any(|hook| {
hook.get("command")
.and_then(Value::as_str)
.is_some_and(|command| command.contains("ralon hook check"))
})
})
}