diff options
| author | soryu <soryu@soryu.co> | 2026-02-10 14:50:07 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-10 14:50:07 +0000 |
| commit | 15b6e5fba161a194fe5427d7d29b0c4286423260 (patch) | |
| tree | fdd7bde229150cbb56d37714c23c2dc9db902f28 /makima/src/daemon/task | |
| parent | 526edf672aae73c3670ab6141253bf92f1fbfe8c (diff) | |
| download | soryu-15b6e5fba161a194fe5427d7d29b0c4286423260.tar.gz soryu-15b6e5fba161a194fe5427d7d29b0c4286423260.zip | |
Add auto-PR creation for remote repos in directives
Diffstat (limited to 'makima/src/daemon/task')
| -rw-r--r-- | makima/src/daemon/task/manager.rs | 45 |
1 files changed, 31 insertions, 14 deletions
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" => { |
