Skip to main content

Module hook_mode

Module hook_mode 

Source
Expand description

Claude Code Hook integration module.

This module provides real-time security checks for Claude Code via the Hooks API. It reads JSON from stdin, analyzes the tool input, and outputs a JSON response.

§Usage

cc-audit --hook-mode

§Configuration

Add to Claude Code settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{"type": "command", "command": "cc-audit --hook-mode"}]
      }
    ]
  }
}

Re-exports§

pub use analyzer::HookAnalyzer;
pub use types::BashInput;
pub use types::EditInput;
pub use types::HookEvent;
pub use types::HookEventName;
pub use types::HookResponse;
pub use types::WriteInput;

Modules§

analyzer
High-speed analyzer for Claude Code Hook mode.
types
Type definitions for Claude Code Hook integration.

Functions§

run_hook_mode
Run the hook mode, reading from stdin and writing to stdout. Returns 0 on success, 2 on blocking error.