Expand description
Agent Hooks System
This module provides an event-driven automation system for triggering agent actions based on various events like file changes, git operations, build events, and more.
§Features
- File change triggers with glob pattern matching
- Git operation triggers (commit, push, pull, merge, checkout, stash)
- Build and test event triggers
- Manual and scheduled triggers
- Conditional hook execution with expression evaluation
- Hook chaining for sequential execution
§Usage
ⓘ
use driven::hooks::{AgentHook, HookTrigger, HookAction, HookEngine};
let hook = AgentHook::new("on-save-lint")
.with_trigger(HookTrigger::FileChange {
patterns: vec!["**/*.rs".to_string()],
})
.with_action(HookAction {
agent: "reviewer".to_string(),
workflow: Some("quick-review".to_string()),
message: "Review the changed file".to_string(),
context: Default::default(),
});
let mut engine = HookEngine::new();
engine.register_hook(hook)?;
engine.start()?;Structs§
- Agent
Hook - Agent hook definition
- Hook
Action - Action to perform when a hook is triggered
- Hook
Condition - Hook condition for filtering
- Hook
Context - Context for hook condition evaluation
- Hook
Engine - Hook engine for managing and executing hooks
- Hook
Execution Result - Result of hook execution
- Test
Filter - Filter for test results
- Test
Result - Test result information
Enums§
- Build
Event - Build events that can trigger hooks
- GitOp
- Git operations that can trigger hooks
- Hook
Trigger - Hook trigger types
- Test
Status - Test status