Story 33: Copy-paste diff commands for agent worktrees

- Add base_branch detection to WorktreeInfo (from project root HEAD)
- Expose base_branch in AgentInfo API response
- Add {{base_branch}} template variable to agent config rendering
- Show git difftool command with copy-to-clipboard in AgentPanel UI
- Add diff command instruction to coder agent prompts
- Add AgentPanel tests for diff command rendering and clipboard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-20 12:48:50 +00:00
parent 1cd1d318d3
commit 39b67ff754
7 changed files with 297 additions and 7 deletions

View File

@@ -76,6 +76,7 @@ pub struct AgentInfo {
pub status: AgentStatus,
pub session_id: Option<String>,
pub worktree_path: Option<String>,
pub base_branch: Option<String>,
}
struct StoryAgent {
@@ -182,7 +183,7 @@ impl AgentPool {
// Spawn the agent process
let wt_path_str = wt_info.path.to_string_lossy().to_string();
let (command, args, prompt) =
config.render_agent_args(&wt_path_str, story_id, Some(&resolved_name))?;
config.render_agent_args(&wt_path_str, story_id, Some(&resolved_name), Some(&wt_info.base_branch))?;
let sid = story_id.to_string();
let aname = resolved_name.clone();
@@ -247,6 +248,7 @@ impl AgentPool {
status: AgentStatus::Running,
session_id: None,
worktree_path: Some(wt_path_str),
base_branch: Some(wt_info.base_branch.clone()),
})
}
@@ -321,6 +323,10 @@ impl AgentPool {
.worktree_info
.as_ref()
.map(|wt| wt.path.to_string_lossy().to_string()),
base_branch: agent
.worktree_info
.as_ref()
.map(|wt| wt.base_branch.clone()),
}
})
.collect())