mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-10 19:33:37 +08:00
feat: surface ecc2 worktree pressure
This commit is contained in:
@@ -18,6 +18,13 @@ pub struct MergeReadiness {
|
||||
pub conflicts: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum WorktreeHealth {
|
||||
Clear,
|
||||
InProgress,
|
||||
Conflicted,
|
||||
}
|
||||
|
||||
/// Create a new git worktree for an agent session.
|
||||
pub fn create_for_session(session_id: &str, cfg: &Config) -> Result<WorktreeInfo> {
|
||||
let repo_root = std::env::current_dir().context("Failed to resolve repository root")?;
|
||||
@@ -228,6 +235,19 @@ pub fn merge_readiness(worktree: &WorktreeInfo) -> Result<MergeReadiness> {
|
||||
anyhow::bail!("git merge-tree failed: {stderr}");
|
||||
}
|
||||
|
||||
pub fn health(worktree: &WorktreeInfo) -> Result<WorktreeHealth> {
|
||||
let merge_readiness = merge_readiness(worktree)?;
|
||||
if merge_readiness.status == MergeReadinessStatus::Conflicted {
|
||||
return Ok(WorktreeHealth::Conflicted);
|
||||
}
|
||||
|
||||
if diff_file_preview(worktree, 1)?.is_empty() {
|
||||
Ok(WorktreeHealth::Clear)
|
||||
} else {
|
||||
Ok(WorktreeHealth::InProgress)
|
||||
}
|
||||
}
|
||||
|
||||
fn git_diff_shortstat(worktree_path: &Path, extra_args: &[&str]) -> Result<Option<String>> {
|
||||
let mut command = Command::new("git");
|
||||
command
|
||||
|
||||
Reference in New Issue
Block a user