Expand description
Loop completion handler for worktree-based loops.
Handles post-completion actions for loops running in git worktrees, including auto-merge queue integration.
§Design
When a loop completes successfully (CompletionPromise):
- Primary loop: No special handling (runs in main workspace)
- Worktree loop with auto-merge: Enqueue to merge queue for merge-ralph
- Worktree loop without auto-merge: Log completion, leave worktree for manual merge
§Example
use ralph_core::loop_completion::{LoopCompletionHandler, CompletionAction};
use ralph_core::loop_context::LoopContext;
use std::path::PathBuf;
// Primary loop - no special action
let primary = LoopContext::primary(PathBuf::from("/project"));
let handler = LoopCompletionHandler::new(true); // auto_merge enabled
let action = handler.handle_completion(&primary, "implement auth").unwrap();
assert!(matches!(action, CompletionAction::None));
// Worktree loop with auto-merge - enqueues to merge queue
let worktree = LoopContext::worktree(
"ralph-20250124-a3f2",
PathBuf::from("/project/.worktrees/ralph-20250124-a3f2"),
PathBuf::from("/project"),
);
let action = handler.handle_completion(&worktree, "implement auth").unwrap();
assert!(matches!(action, CompletionAction::Enqueued { .. }));Structs§
- Completion
Landing - Landing details included in completion actions.
- Loop
Completion Handler - Handler for loop completion events.
Enums§
- Completion
Action - Action taken upon loop completion.
- Completion
Error - Errors that can occur during completion handling.