Skip to main content

Module config

Module config 

Source
Expand description

Hook configuration schema and loader.

Hooks can be configured via a hooks.json file in ~/.recursive/ or <workspace>/.recursive/. The file maps event names to lists of hook matchers, each of which may filter by tool name / argument prefix.

§Example hooks.json

{
  "PreToolCall": [
    {
      "matcher": "run_shell(git *)",
      "hooks": [
        { "type": "command", "command": "~/.recursive/hooks/git-check.sh", "timeout": 10 }
      ]
    }
  ],
  "UserPromptSubmit": [
    {
      "hooks": [
        { "type": "command", "command": "~/.recursive/hooks/log-prompt.sh", "async": true }
      ]
    }
  ]
}

Structs§

HookCommand
A single hook command entry.
HookMatcher
A hook matcher: an optional filter condition plus the hooks to run.
HooksConfig
Top-level hook configuration, loaded from hooks.json.

Enums§

HookCommandType
Supported hook execution types.

Functions§

load_hooks_config
Load HooksConfig from the first hooks.json found in dirs.
matches_hook
Returns true if input_tool / args satisfy the given matcher pattern.