MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / record_hook_invoked

Function record_hook_invoked

src/hooks/mod.rs:180–196  ·  view source on GitHub ↗
(root: Option<&Path>, agent: HintAgent, hook_name: &str, event_json: &str)

Source from the content-addressed store, hash-verified

178}
179
180fn record_hook_invoked(root: Option<&Path>, agent: HintAgent, hook_name: &str, event_json: &str) {
181 let parsed: Value = serde_json::from_str(event_json).unwrap_or(Value::Null);
182 record_hook_analytics(
183 root,
184 "hook_invoked",
185 serde_json::json!({
186 "agent": agent.as_key(),
187 "hook_name": hook_name,
188 "hook_event_name": text_field(&parsed, &["hook_event_name", "hookEventName"]),
189 "session_id": event_session_id(&parsed),
190 "tool_name": text_field(&parsed, &["tool_name", "toolName", "name"]),
191 "command": text_field(&parsed, &["command", "cmd", "shell_command"]),
192 "prompt_category": inferred_prompt_category(&parsed),
193 "event_cwd": event_cwd_from_parsed(&parsed).map(|cwd| cwd.display().to_string()),
194 }),
195 );
196}
197
198fn inferred_prompt_category(parsed: &Value) -> Option<&'static str> {
199 let text = prompt_like_text(parsed)

Callers 15

hook_codex_session_startFunction · 0.85
hook_codex_post_tool_useFunction · 0.85
hook_codex_post_compactFunction · 0.85
hook_kiro_pre_tool_useFunction · 0.85
hook_kiro_prompt_submitFunction · 0.85
hook_kiro_post_tool_useFunction · 0.85
hook_pre_tool_useFunction · 0.85

Calls 1

record_hook_analyticsFunction · 0.85

Tested by

no test coverage detected