huskies: merge 824

This commit is contained in:
dave
2026-04-29 13:38:34 +00:00
parent b4854cf693
commit 59b626d3ba
13 changed files with 658 additions and 4 deletions
+2 -1
View File
@@ -11,7 +11,8 @@ pub(crate) use lifecycle::{
tool_list_agents, tool_start_agent, tool_stop_agent, tool_wait_for_agent,
};
pub(crate) use worktree::{
tool_create_worktree, tool_get_editor_command, tool_list_worktrees, tool_remove_worktree,
tool_cleanup_worktrees, tool_create_worktree, tool_get_editor_command, tool_list_worktrees,
tool_remove_worktree,
};
#[cfg(test)]
@@ -58,6 +58,22 @@ pub(crate) async fn tool_remove_worktree(args: &Value, ctx: &AppContext) -> Resu
Ok(format!("Worktree for story '{story_id}' removed."))
}
/// MCP tool handler for `cleanup_worktrees` — removes stale worktrees whose stories are done or archived.
pub(crate) async fn tool_cleanup_worktrees(
args: &Value,
ctx: &AppContext,
) -> Result<String, String> {
let confirm = args
.get("confirm")
.and_then(|v| v.as_bool())
.unwrap_or(false);
let project_root = ctx.services.agents.get_project_root(&ctx.state)?;
let config = crate::config::ProjectConfig::load(&project_root)?;
let report = worktree::run_cleanup(&project_root, &config, confirm).await;
Ok(worktree::format_report(&report, confirm))
}
pub(crate) fn tool_get_editor_command(args: &Value, ctx: &AppContext) -> Result<String, String> {
let worktree_path = args
.get("worktree_path")