Skip to main content

Module hook_handlers

Module hook_handlers 

Source

Functionsยง

arm_watchdog
Arms a watchdog that force-exits the process after the given duration. Prevents hook processes from becoming zombies when stdin pipes break or the IDE cancels the call. Since hooks MUST NOT spawn child processes (to avoid orphan zombies), a simple exit(1) suffices.
handle_codex_pretooluse
handle_codex_session_start
handle_copilot
Dedicated Copilot PreToolUse handler (dispatched via hook copilot).
handle_deny
Handle the lean-ctx hook deny subcommand.
handle_observe
Unified observe handler for all IDE hook events. Reads JSON from stdin, normalizes to ObserveEvent, counts tokens, appends to context_radar.jsonl, and exits immediately.
handle_read_dedup
handle_redirect
handle_rewrite
handle_rewrite_inline
Inline rewrite: takes a command as CLI args, prints the rewritten command to stdout. The command is passed as positional arguments, not via stdin JSON.
handle_vibe_pre_tool
load_active_transcript
load_detected_model
mark_hook_environment
Mark this process as a hook child so the daemon-client never auto-starts the daemon from inside a hook (which would create zombie processes).
model_context_window
radar_event_count
Count the IDE-hook observe events recorded in context_radar.jsonl.
shell_quote
Quote a path/arg for shell if it contains spaces or special chars.
shell_tokenize
Tokenize a shell command respecting single/double quotes and backslash escapes.