mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-10 19:33:37 +08:00
feat: add ecc2 coordinate backlog health checks
This commit is contained in:
@@ -105,6 +105,9 @@ enum Commands {
|
|||||||
/// Emit machine-readable JSON instead of the human summary
|
/// Emit machine-readable JSON instead of the human summary
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
json: bool,
|
json: bool,
|
||||||
|
/// Return a non-zero exit code from the final coordination health
|
||||||
|
#[arg(long)]
|
||||||
|
check: bool,
|
||||||
/// Keep coordinating until the backlog is healthy, saturated, or max passes is reached
|
/// Keep coordinating until the backlog is healthy, saturated, or max passes is reached
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
until_healthy: bool,
|
until_healthy: bool,
|
||||||
@@ -425,6 +428,7 @@ async fn main() -> Result<()> {
|
|||||||
worktree: use_worktree,
|
worktree: use_worktree,
|
||||||
lead_limit,
|
lead_limit,
|
||||||
json,
|
json,
|
||||||
|
check,
|
||||||
until_healthy,
|
until_healthy,
|
||||||
max_passes,
|
max_passes,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -475,11 +479,11 @@ async fn main() -> Result<()> {
|
|||||||
let payload = CoordinateBacklogRun {
|
let payload = CoordinateBacklogRun {
|
||||||
pass_budget,
|
pass_budget,
|
||||||
passes: pass_summaries,
|
passes: pass_summaries,
|
||||||
final_status,
|
final_status: final_status.clone(),
|
||||||
};
|
};
|
||||||
println!("{}", serde_json::to_string_pretty(&payload)?);
|
println!("{}", serde_json::to_string_pretty(&payload)?);
|
||||||
} else if pass_budget > 1 {
|
} else if pass_budget > 1 {
|
||||||
if let Some(status) = final_status {
|
if let Some(status) = final_status.as_ref() {
|
||||||
println!(
|
println!(
|
||||||
"Final coordination health: {:?} | mode {:?} | backlog {} handoff(s) across {} lead(s)",
|
"Final coordination health: {:?} | mode {:?} | backlog {} handoff(s) across {} lead(s)",
|
||||||
status.health,
|
status.health,
|
||||||
@@ -489,6 +493,14 @@ async fn main() -> Result<()> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if check {
|
||||||
|
let exit_code = final_status
|
||||||
|
.as_ref()
|
||||||
|
.map(coordination_status_exit_code)
|
||||||
|
.unwrap_or(0);
|
||||||
|
std::process::exit(exit_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Some(Commands::CoordinationStatus { json, check }) => {
|
Some(Commands::CoordinationStatus { json, check }) => {
|
||||||
let status = session::manager::get_coordination_status(&db, &cfg)?;
|
let status = session::manager::get_coordination_status(&db, &cfg)?;
|
||||||
@@ -1061,12 +1073,14 @@ mod tests {
|
|||||||
Some(Commands::CoordinateBacklog {
|
Some(Commands::CoordinateBacklog {
|
||||||
agent,
|
agent,
|
||||||
lead_limit,
|
lead_limit,
|
||||||
|
check,
|
||||||
until_healthy,
|
until_healthy,
|
||||||
max_passes,
|
max_passes,
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
assert_eq!(agent, "claude");
|
assert_eq!(agent, "claude");
|
||||||
assert_eq!(lead_limit, 7);
|
assert_eq!(lead_limit, 7);
|
||||||
|
assert!(!check);
|
||||||
assert!(!until_healthy);
|
assert!(!until_healthy);
|
||||||
assert_eq!(max_passes, 5);
|
assert_eq!(max_passes, 5);
|
||||||
}
|
}
|
||||||
@@ -1108,11 +1122,35 @@ mod tests {
|
|||||||
match cli.command {
|
match cli.command {
|
||||||
Some(Commands::CoordinateBacklog {
|
Some(Commands::CoordinateBacklog {
|
||||||
json,
|
json,
|
||||||
|
check,
|
||||||
until_healthy,
|
until_healthy,
|
||||||
max_passes,
|
max_passes,
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
assert!(json);
|
assert!(json);
|
||||||
|
assert!(!check);
|
||||||
|
assert!(!until_healthy);
|
||||||
|
assert_eq!(max_passes, 5);
|
||||||
|
}
|
||||||
|
_ => panic!("expected coordinate-backlog subcommand"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cli_parses_coordinate_backlog_check_flag() {
|
||||||
|
let cli = Cli::try_parse_from(["ecc", "coordinate-backlog", "--check"])
|
||||||
|
.expect("coordinate-backlog --check should parse");
|
||||||
|
|
||||||
|
match cli.command {
|
||||||
|
Some(Commands::CoordinateBacklog {
|
||||||
|
json,
|
||||||
|
check,
|
||||||
|
until_healthy,
|
||||||
|
max_passes,
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
assert!(!json);
|
||||||
|
assert!(check);
|
||||||
assert!(!until_healthy);
|
assert!(!until_healthy);
|
||||||
assert_eq!(max_passes, 5);
|
assert_eq!(max_passes, 5);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user