Module types

Module types 

Source
Expand description

Core data types for the hooks system

This module defines the core data structures for the hooks system, including hooks, actions, events, and execution results.

§Examples

Creating a simple command hook:

use ricecoder_hooks::*;

let hook = Hook {
    id: "format-on-save".to_string(),
    name: "Format on Save".to_string(),
    description: Some("Format code when file is saved".to_string()),
    event: "file_saved".to_string(),
    action: Action::Command(CommandAction {
        command: "prettier".to_string(),
        args: vec!["--write".to_string(), "{{file_path}}".to_string()],
        timeout_ms: Some(5000),
        capture_output: true,
    }),
    enabled: true,
    tags: vec!["formatting".to_string()],
    metadata: serde_json::json!({}),
    condition: None,
};

Structs§

AiPromptAction
AI prompt action configuration
ChainAction
Chain action configuration
CommandAction
Command action configuration
Condition
Condition for hook execution
Event
Event that triggers hooks
EventContext
Context passed to hooks
Hook
A hook that triggers on specific events
HookResult
Result of hook execution
ParameterBindings
Parameter bindings for tool calls
ToolCallAction
Tool call action configuration

Enums§

Action
Action to execute when a hook is triggered
HookStatus
Status of hook execution
ParameterValue
Parameter value (literal or variable reference)