fix: use merge-base for diffStat in merger and show files changed on done task cards
The merger was using `git diff HEAD..branch --stat` which includes artifacts from other tasks when branches fork from older main commits. Switch to `git diff $(merge-base)..branch --stat` so commit messages only describe the branch's own changes. Also surface the "files changed" button on done task cards using mergeDetails, opening the same ChangedFilesModal with commit-backed diffs (matching the Changes tab in the task modal). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import type { TaskStore, MergeResult } from "@fusion/core";
|
||||
import { getTaskMergeBlocker, type TaskStore, type MergeResult } from "@fusion/core";
|
||||
import { createKbAgent, promptWithFallback } from "./pi.js";
|
||||
import type { WorktreePool } from "./worktree-pool.js";
|
||||
import { AgentLogger } from "./agent-logger.js";
|
||||
@@ -585,10 +585,9 @@ export async function aiMergeTask(
|
||||
): Promise<MergeResult> {
|
||||
// 1. Validate task state
|
||||
const task = await store.getTask(taskId);
|
||||
if (task.column !== "in-review") {
|
||||
throw new Error(
|
||||
`Cannot merge ${taskId}: task is in '${task.column}', must be in 'in-review'`,
|
||||
);
|
||||
const mergeBlocker = getTaskMergeBlocker(task);
|
||||
if (mergeBlocker) {
|
||||
throw new Error(`Cannot merge ${taskId}: ${mergeBlocker}`);
|
||||
}
|
||||
|
||||
const branch = task.branch || `kb/${taskId.toLowerCase()}`;
|
||||
@@ -635,7 +634,11 @@ export async function aiMergeTask(
|
||||
commitLog = "(unable to read commit log)";
|
||||
}
|
||||
try {
|
||||
diffStat = execSync(`git diff HEAD..${branch} --stat`, {
|
||||
const mergeBase = execSync(`git merge-base HEAD ${branch}`, {
|
||||
cwd: rootDir,
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
diffStat = execSync(`git diff ${mergeBase}..${branch} --stat`, {
|
||||
cwd: rootDir,
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
|
||||
Reference in New Issue
Block a user