summaryrefslogtreecommitdiff
path: root/makima/src/daemon/task/manager.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-22 13:17:17 +0000
committerGitHub <noreply@github.com>2026-01-22 13:17:17 +0000
commit265f8cf14fec9d7116d09af49e4b48b357faceda (patch)
treec98ff8be7dd5f01692446e01c7b568279b0635ac /makima/src/daemon/task/manager.rs
parenta363bfdd7a3e81b75bf230e45d001b80f759ca57 (diff)
downloadsoryu-265f8cf14fec9d7116d09af49e4b48b357faceda.tar.gz
soryu-265f8cf14fec9d7116d09af49e4b48b357faceda.zip
Fix completion actions: default to PR and support remote repos (#21)
* Fix completion actions: default to PR and support remote repos - Change default completion action from 'branch' to 'pr' for tasks using daemon working directory - Allow PR completion action to work without target_repo_path if the worktree already has an origin remote configured (e.g., when cloned from a remote URL) - Update create_pull_request to accept optional target_repo parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add dismiss functionality for completed standalone tasks ## Changes ### Backend - Add 'hidden' field to Task model (models.rs) - Add database migration for hidden column (20250122000000_add_task_hidden.sql) - Update task listing queries to include hidden field and filter out hidden tasks - Update update_task_for_owner to handle hidden field ### Frontend - Add hidden field to TaskSummary interface (api.ts) - Add dismissTask API function (api.ts) - Add hideTask function to useTasks hook - Add Dismiss button to TaskList for completed standalone tasks - Wire up onDismiss handler in mesh.tsx route ## Behavior - Completed standalone tasks (tasks without a contract) show a "Dismiss" button - Dismissing a task sets hidden=true and removes it from the task list - Hidden tasks are filtered out by default in all task listing queries Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/daemon/task/manager.rs')
-rw-r--r--makima/src/daemon/task/manager.rs31
1 files changed, 22 insertions, 9 deletions
diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs
index 95554e9..0cba516 100644
--- a/makima/src/daemon/task/manager.rs
+++ b/makima/src/daemon/task/manager.rs
@@ -4277,16 +4277,25 @@ impl TaskManagerInner {
target_repo_path: Option<&str>,
target_branch: Option<&str>,
) -> Result<Option<String>, String> {
+ // For PR action, we can use the worktree's origin directly if target_repo_path is not set
let target_repo = match target_repo_path {
- Some(path) => crate::daemon::worktree::expand_tilde(path),
+ Some(path) => Some(crate::daemon::worktree::expand_tilde(path)),
None => {
- tracing::warn!(task_id = %task_id, "No target_repo_path configured, skipping completion action");
- return Ok(None);
+ if action == "pr" {
+ // For PR action, check if worktree has an origin remote we can use directly
+ None
+ } else {
+ tracing::warn!(task_id = %task_id, "No target_repo_path configured, skipping completion action");
+ return Ok(None);
+ }
}
};
- if !target_repo.exists() {
- return Err(format!("Target repo not found: {} (expanded from {:?})", target_repo.display(), target_repo_path));
+ // Validate target_repo exists if provided
+ if let Some(ref repo) = target_repo {
+ if !repo.exists() {
+ return Err(format!("Target repo not found: {} (expanded from {:?})", repo.display(), target_repo_path));
+ }
}
// Get the branch name: makima/{task-name-with-dashes}-{short-id}
@@ -4296,13 +4305,14 @@ impl TaskManagerInner {
crate::daemon::worktree::short_uuid(task_id)
);
- // Determine target branch - use provided value or detect default branch of target repo
+ // Determine target branch - use provided value or detect default branch
let target_branch = match target_branch {
Some(branch) => branch.to_string(),
None => {
- // Detect default branch (main, master, develop, etc.)
+ // Detect default branch from target_repo if available, otherwise from worktree
+ let detect_path = target_repo.as_ref().map(|p| p.as_path()).unwrap_or(worktree_path);
self.worktree_manager
- .detect_default_branch(&target_repo)
+ .detect_default_branch(detect_path)
.await
.unwrap_or_else(|_| "master".to_string())
}
@@ -4317,6 +4327,7 @@ 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)
@@ -4332,6 +4343,7 @@ impl TaskManagerInner {
Ok(None)
}
"merge" => {
+ let target_repo = target_repo.ok_or_else(|| "No target_repo_path configured for merge action".to_string())?;
// Push and merge into target branch
let commit_sha = self.worktree_manager
.merge_to_target(worktree_path, &target_repo, &branch_name, &target_branch, task_name)
@@ -4348,6 +4360,7 @@ impl TaskManagerInner {
}
"pr" => {
// Push and create PR
+ // For PR, we can use target_repo if provided, or create PR directly from worktree
let title = task_name.to_string();
let body = format!(
"Automated PR from makima task.\n\nTask ID: `{}`",
@@ -4356,7 +4369,7 @@ impl TaskManagerInner {
let pr_url = self.worktree_manager
.create_pull_request(
worktree_path,
- &target_repo,
+ target_repo.as_deref(),
&branch_name,
&target_branch,
&title,