Skip to content

Commit 2b1eb2b

Browse files
fix(code): excluding cc plans from the cloud diff (#1842)
1 parent 77756d5 commit 2b1eb2b

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

apps/code/src/renderer/features/task-detail/utils/cloudToolChanges.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
22

33
import {
44
extractCloudFileContent,
5+
extractCloudToolChangedFiles,
56
type ParsedToolCall,
67
} from "./cloudToolChanges";
78

@@ -34,6 +35,35 @@ function makeToolCalls(
3435
return new Map(calls.map((tc, i) => [tc.toolCallId || `tc-${i}`, tc]));
3536
}
3637

38+
describe("extractCloudToolChangedFiles", () => {
39+
it("excludes plan files from changed files", () => {
40+
const calls = makeToolCalls(
41+
toolCall({
42+
toolCallId: "tc-plan",
43+
kind: "write",
44+
locations: [
45+
{
46+
path: "/home/user/.claude/plans/breezy-squishing-twilight.md",
47+
},
48+
],
49+
content: diffContent(
50+
"/home/user/.claude/plans/breezy-squishing-twilight.md",
51+
"# Plan\n\nDo stuff",
52+
),
53+
}),
54+
toolCall({
55+
toolCallId: "tc-real",
56+
kind: "edit",
57+
locations: [{ path: "src/app.ts" }],
58+
content: diffContent("src/app.ts", "new code", "old code"),
59+
}),
60+
);
61+
const result = extractCloudToolChangedFiles(calls);
62+
expect(result).toHaveLength(1);
63+
expect(result[0].path).toBe("src/app.ts");
64+
});
65+
});
66+
3767
describe("extractCloudFileContent", () => {
3868
it("returns untouched for an empty tool calls map", () => {
3969
const result = extractCloudFileContent(new Map(), "src/app.ts");

apps/code/src/renderer/features/task-detail/utils/cloudToolChanges.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export function extractCloudToolChangedFiles(
252252
const path =
253253
diff?.path ?? (kind === "move" ? destinationPath : locationPath);
254254
if (!path) continue;
255+
if (path.includes(".claude/plans/")) continue;
255256

256257
let file: ChangedFile;
257258
if (kind === "move") {

0 commit comments

Comments
 (0)