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§
- AiPrompt
Action - AI prompt action configuration
- Chain
Action - Chain action configuration
- Command
Action - Command action configuration
- Condition
- Condition for hook execution
- Event
- Event that triggers hooks
- Event
Context - Context passed to hooks
- Hook
- A hook that triggers on specific events
- Hook
Result - Result of hook execution
- Parameter
Bindings - Parameter bindings for tool calls
- Tool
Call Action - Tool call action configuration
Enums§
- Action
- Action to execute when a hook is triggered
- Hook
Status - Status of hook execution
- Parameter
Value - Parameter value (literal or variable reference)