From 88a07de5fb3ab563f9677117d54c627c669e4c7e Mon Sep 17 00:00:00 2001
From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
Date: Thu, 6 Feb 2025 23:56:02 -0800
Subject: [PATCH] Use special error type for when cline tries to access
clineignore'd file
---
src/core/Cline.ts | 9 +++--
src/core/prompts/responses.ts | 3 ++
src/shared/ExtensionMessage.ts | 1 +
webview-ui/src/components/chat/ChatRow.tsx | 41 ++++++++++++++++++++++
4 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/src/core/Cline.ts b/src/core/Cline.ts
index a7e999f6af..2d0c785c2e 100644
--- a/src/core/Cline.ts
+++ b/src/core/Cline.ts
@@ -1594,7 +1594,8 @@ export class Cline {
const accessAllowed = this.llmFileAccessController.validateAccess(relPath)
if (!accessAllowed) {
- await handleError("writing file", new Error(`Access denied: ${relPath} (blocked by .clineignore)`))
+ await this.say("clineignore_error", relPath)
+ pushToolResult(formatResponse.clineIgnoreError(relPath))
break
}
@@ -1870,10 +1871,8 @@ export class Cline {
const accessAllowed = this.llmFileAccessController.validateAccess(relPath)
if (!accessAllowed) {
- await handleError(
- "reading file",
- new Error(`Access denied: ${relPath} (blocked by .clineignore)`),
- )
+ await this.say("clineignore_error", relPath)
+ pushToolResult(formatResponse.clineIgnoreError(relPath))
break
}
diff --git a/src/core/prompts/responses.ts b/src/core/prompts/responses.ts
index 34341dba1d..7452106d5f 100644
--- a/src/core/prompts/responses.ts
+++ b/src/core/prompts/responses.ts
@@ -11,6 +11,9 @@ export const formatResponse = {
toolError: (error?: string) => `The tool execution failed with the following error:\n
{message.text} which is blocked by the{" "}
+ .clineignore
+ file settings.
+