From 15b6e5fba161a194fe5427d7d29b0c4286423260 Mon Sep 17 00:00:00 2001 From: soryu Date: Tue, 10 Feb 2026 14:50:07 +0000 Subject: Add auto-PR creation for remote repos in directives --- makima/src/daemon/task/manager.rs | 45 +++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'makima/src/daemon/task/manager.rs') diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs index a24f527..22b41d9 100644 --- a/makima/src/daemon/task/manager.rs +++ b/makima/src/daemon/task/manager.rs @@ -5587,8 +5587,8 @@ impl TaskManagerInner { let target_repo = match target_repo_path { Some(path) => Some(crate::daemon::worktree::expand_tilde(path)), None => { - if action == "pr" { - // For PR action, check if worktree has an origin remote we can use directly + if action == "pr" || action == "branch" { + // For PR/branch action without target_repo, use origin directly None } else { tracing::warn!(task_id = %task_id, "No target_repo_path configured, skipping completion action"); @@ -5633,19 +5633,36 @@ impl TaskManagerInner { match action { "branch" => { - let target_repo = target_repo.ok_or_else(|| "No target_repo_path configured for branch action".to_string())?; - // Just push the branch to target repo - self.worktree_manager - .push_to_target_repo(worktree_path, &target_repo, &branch_name, task_name) - .await - .map_err(|e| e.to_string())?; + match target_repo { + Some(target_repo) => { + // Push branch to local target repo + self.worktree_manager + .push_to_target_repo(worktree_path, &target_repo, &branch_name, task_name) + .await + .map_err(|e| e.to_string())?; - let msg = DaemonMessage::task_output( - task_id, - format!("Branch '{}' pushed to {}\n", branch_name, target_repo.display()), - false, - ); - let _ = self.ws_tx.send(msg).await; + let msg = DaemonMessage::task_output( + task_id, + format!("Branch '{}' pushed to {}\n", branch_name, target_repo.display()), + false, + ); + let _ = self.ws_tx.send(msg).await; + } + None => { + // Push branch to origin (GitHub) + self.worktree_manager + .push_branch_to_origin(worktree_path, &branch_name, task_name) + .await + .map_err(|e| e.to_string())?; + + let msg = DaemonMessage::task_output( + task_id, + format!("Branch '{}' pushed to origin\n", branch_name), + false, + ); + let _ = self.ws_tx.send(msg).await; + } + } Ok(None) } "merge" => { -- cgit v1.2.3