pub struct WorktreeManager { /* private fields */ }Expand description
Manages Git worktrees for agent isolation
Implementations§
Source§impl WorktreeManager
impl WorktreeManager
Sourcepub fn with_config(
repo_path: impl Into<PathBuf>,
config: WorktreeConfig,
) -> Self
pub fn with_config( repo_path: impl Into<PathBuf>, config: WorktreeConfig, ) -> Self
Create with custom configuration
Sourcepub fn with_worktree_base(self, base: impl Into<PathBuf>) -> Self
pub fn with_worktree_base(self, base: impl Into<PathBuf>) -> Self
Set a custom base directory for worktrees
Sourcepub async fn get_or_create_worktree(
&self,
agent_id: &str,
branch: &str,
purpose: &str,
) -> WorktreeResult
pub async fn get_or_create_worktree( &self, agent_id: &str, branch: &str, purpose: &str, ) -> WorktreeResult
Create or get a worktree for an agent
Sourcepub async fn get_worktree(&self, agent_id: &str) -> Option<AgentWorktree>
pub async fn get_worktree(&self, agent_id: &str) -> Option<AgentWorktree>
Get an agent’s worktree
Sourcepub async fn remove_worktree(
&self,
agent_id: &str,
force: bool,
) -> WorktreeResult
pub async fn remove_worktree( &self, agent_id: &str, force: bool, ) -> WorktreeResult
Remove an agent’s worktree
Sourcepub async fn cleanup_stale_worktrees(&self) -> Vec<String>
pub async fn cleanup_stale_worktrees(&self) -> Vec<String>
Cleanup stale worktrees
Sourcepub async fn list_all_worktrees(&self) -> Result<Vec<GitWorktreeInfo>, String>
pub async fn list_all_worktrees(&self) -> Result<Vec<GitWorktreeInfo>, String>
List all worktrees (both tracked and untracked)
Sourcepub async fn list_tracked_worktrees(&self) -> Vec<AgentWorktree>
pub async fn list_tracked_worktrees(&self) -> Vec<AgentWorktree>
Get tracked worktrees
Sourcepub async fn sync_with_git(&self) -> Result<SyncResult, String>
pub async fn sync_with_git(&self) -> Result<SyncResult, String>
Sync tracking with actual git worktrees
Sourcepub async fn update_changes_status(&self, agent_id: &str) -> bool
pub async fn update_changes_status(&self, agent_id: &str) -> bool
Update the has_changes flag for a worktree
Sourcepub async fn get_working_directory(&self, agent_id: &str) -> PathBuf
pub async fn get_working_directory(&self, agent_id: &str) -> PathBuf
Get the working directory for an agent
Sourcepub async fn get_stats(&self) -> WorktreeStats
pub async fn get_stats(&self) -> WorktreeStats
Get statistics about worktrees
Auto Trait Implementations§
impl !Freeze for WorktreeManager
impl !RefUnwindSafe for WorktreeManager
impl Send for WorktreeManager
impl Sync for WorktreeManager
impl Unpin for WorktreeManager
impl UnsafeUnpin for WorktreeManager
impl !UnwindSafe for WorktreeManager
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