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\n${error}\n`, + clineIgnoreError: (path: string) => + `Access to ${path} is blocked by the .clineignore file settings. You must try to continue in the task without using this file, or ask the user to update the .clineignore file.`, + noToolsUsed: () => `[ERROR] You did not use a tool in your previous response! Please retry with a tool use. diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 5a93caf07b..7f03c8e230 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -121,6 +121,7 @@ export type ClineSay = | "use_mcp_server" | "diff_error" | "deleted_api_reqs" + | "clineignore_error" export interface ClineSayTool { tool: diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 59d40936f1..a4904eb89e 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -989,6 +989,47 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi ) + case "clineignore_error": + return ( + <> +
+
+ + + Access Denied + +
+
+ Cline tried to access {message.text} which is blocked by the{" "} + .clineignore + file settings. +
+
+ + ) case "completion_result": const hasChanges = message.text?.endsWith(COMPLETION_RESULT_CHANGES_FLAG) ?? false const text = hasChanges ? message.text?.slice(0, -COMPLETION_RESULT_CHANGES_FLAG.length) : message.text