pub enum Action {
Command(CommandAction),
ToolCall(ToolCallAction),
AiPrompt(AiPromptAction),
Chain(ChainAction),
}Expand description
Action to execute when a hook is triggered
Actions define what happens when a hook is triggered. There are four types of actions:
Command- Execute a shell commandToolCall- Call a ricecoder tool with parametersAiPrompt- Send a prompt to an AI assistantChain- Execute multiple hooks in sequence
§Examples
Command action:
ⓘ
Action::Command(CommandAction {
command: "echo".to_string(),
args: vec!["Hello, World!".to_string()],
timeout_ms: Some(5000),
capture_output: true,
})Tool call action:
ⓘ
Action::ToolCall(ToolCallAction {
tool_name: "formatter".to_string(),
tool_path: "/usr/local/bin/prettier".to_string(),
parameters: ParameterBindings {
bindings: vec![
("file_path".to_string(), ParameterValue::Variable("file_path".to_string())),
].into_iter().collect(),
},
timeout_ms: Some(5000),
})Variants§
Command(CommandAction)
Execute a shell command
ToolCall(ToolCallAction)
Call a tool with parameters
AiPrompt(AiPromptAction)
Send a prompt to an AI assistant
Chain(ChainAction)
Chain multiple hooks
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnwindSafe for Action
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more