From 1be6fce1a6864ae63e8160b0666db2c647f2dbba Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Wed, 2 Jul 2025 13:52:13 -0400 Subject: [PATCH] Check for protected files in single apply diff (#5348) --- src/core/tools/applyDiffTool.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/tools/applyDiffTool.ts b/src/core/tools/applyDiffTool.ts index d4f7fd883f..c89fe8b735 100644 --- a/src/core/tools/applyDiffTool.ts +++ b/src/core/tools/applyDiffTool.ts @@ -147,9 +147,13 @@ export async function applyDiffToolLegacy( await cline.diffViewProvider.update(diffResult.content, true) await cline.diffViewProvider.scrollToFirstDiff() + // Check if file is write-protected + const isWriteProtected = cline.rooProtectedController?.isWriteProtected(relPath) || false + const completeMessage = JSON.stringify({ ...sharedMessageProps, diff: diffContent, + isProtected: isWriteProtected, } satisfies ClineSayTool) let toolProgressStatus @@ -158,7 +162,7 @@ export async function applyDiffToolLegacy( toolProgressStatus = cline.diffStrategy.getProgressStatus(block, diffResult) } - const didApprove = await askApproval("tool", completeMessage, toolProgressStatus) + const didApprove = await askApproval("tool", completeMessage, toolProgressStatus, isWriteProtected) if (!didApprove) { await cline.diffViewProvider.revertChanges() // Cline likely handles closing the diff view