From 8463eb103388fd351a8f3877ea7165147ff3bcb2 Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Thu, 29 Jan 2026 02:11:07 +0900 Subject: [PATCH] =?UTF-8?q?Instruct=20=E3=81=ABworktree=E3=81=AE=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E6=96=87=E8=84=88=E3=82=92=E8=87=AA=E5=8B=95=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mainからの差分とコミット履歴を指示に含めることで、 エージェントがworktreeの現在の状態を把握できるようにする。 --- src/commands/reviewTasks.ts | 55 +++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/src/commands/reviewTasks.ts b/src/commands/reviewTasks.ts index 48f4864..1dd244d 100644 --- a/src/commands/reviewTasks.ts +++ b/src/commands/reviewTasks.ts @@ -232,6 +232,49 @@ async function selectWorkflowForInstruction(projectDir: string): Promise 0 ? lines.join('\n') + '\n\n' : ''; +} + /** * Instruct worktree: give additional instructions to modify the worktree. * Executes a task on the worktree and auto-commits if successful. @@ -260,10 +303,16 @@ export async function instructWorktree( log.info('Instructing worktree', { branch, worktreePath, workflow: selectedWorkflow }); info(`Running instruction on ${branch}...`); - // 3. Execute task on worktree - const taskSuccess = await executeTask(instruction, worktreePath, selectedWorkflow, projectDir); + // 3. Build instruction with worktree context + const worktreeContext = getWorktreeContext(projectDir, branch); + const fullInstruction = worktreeContext + ? `${worktreeContext}## 追加指示\n${instruction}` + : instruction; - // 4. Auto-commit if successful + // 4. Execute task on worktree + const taskSuccess = await executeTask(fullInstruction, worktreePath, selectedWorkflow, projectDir); + + // 5. Auto-commit if successful if (taskSuccess) { const commitResult = autoCommitWorktree(worktreePath, item.taskSlug); if (commitResult.success && commitResult.commitHash) {