1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Per-subagent git worktree lifecycle management for Zeph.
//!
//! This crate implements the `zeph-worktree` subsystem described in
//! `specs/063-worktree-subsystem/spec.md`. It provides:
//!
//! - [`WorktreeManager`] — creates, removes, lists, and reconciles git worktrees
//! - [`WorktreeHandle`] — a live record of one managed worktree
//! - [`StaleWorktree`] — a worktree discovered by `reconcile` outside session state,
//! annotated with git's own `prunable` verdict
//! - [`WorktreeError`] — all errors this crate can produce
//! - [`GitRunner`] / [`DefaultGitRunner`]
//! — the git invocation abstraction and its production implementation
//! - [`manager::probe_capabilities`] — bootstrap git availability probe
//!
//! ## Dependency direction
//!
//! ```text
//! zeph-subagent → zeph-worktree → (zeph-config, tokio, thiserror, tracing)
//! ```
//!
//! This crate MUST NOT depend on `zeph-core`, `zeph-subagent`, or
//! `zeph-channels`.
//!
//! ## Example
//!
//! ```no_run
//! use std::path::PathBuf;
//! use zeph_config::WorktreeConfig;
//! use zeph_worktree::{DefaultWorktreeManager, git_runner::DefaultGitRunner, manager::probe_capabilities};
//!
//! # async fn example() -> Result<(), zeph_worktree::WorktreeError> {
//! let repo = PathBuf::from("/path/to/repo");
//! let runner = DefaultGitRunner::new();
//! probe_capabilities(&runner, &repo).await?;
//!
//! let mgr = DefaultWorktreeManager::new(repo, WorktreeConfig::default(), DefaultGitRunner::new()).await?;
//! let handle = mgr.create("agent-42").await?;
//! println!("Worktree at {:?}", handle.path);
//! mgr.remove(&handle, false).await?;
//! # Ok(())
//! # }
//! ```
pub use WorktreeError;
pub use ;
pub use ;
pub use ;
pub use ;
/// A [`WorktreeManager`] using the production [`DefaultGitRunner`].
///
/// This is the type that `SubAgentManager` stores as
/// `Option<Arc<DefaultWorktreeManager>>`.
pub type DefaultWorktreeManager = ;