mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
Use special error type for when cline tries to access clineignore'd file
This commit is contained in:
parent
fc60f6e55e
commit
88a07de5fb
4 changed files with 49 additions and 5 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ export const formatResponse = {
|
|||
|
||||
toolError: (error?: string) => `The tool execution failed with the following error:\n<error>\n${error}\n</error>`,
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ export type ClineSay =
|
|||
| "use_mcp_server"
|
||||
| "diff_error"
|
||||
| "deleted_api_reqs"
|
||||
| "clineignore_error"
|
||||
|
||||
export interface ClineSayTool {
|
||||
tool:
|
||||
|
|
|
|||
|
|
@ -989,6 +989,47 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi
|
|||
</div>
|
||||
</>
|
||||
)
|
||||
case "clineignore_error":
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
backgroundColor: "rgba(255, 191, 0, 0.1)",
|
||||
padding: 8,
|
||||
borderRadius: 3,
|
||||
fontSize: 12,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
marginBottom: 4,
|
||||
}}>
|
||||
<i
|
||||
className="codicon codicon-error"
|
||||
style={{
|
||||
marginRight: 8,
|
||||
fontSize: 18,
|
||||
color: "#FFA500",
|
||||
}}></i>
|
||||
<span
|
||||
style={{
|
||||
fontWeight: 500,
|
||||
color: "#FFA500",
|
||||
}}>
|
||||
Access Denied
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
Cline tried to access <code>{message.text}</code> which is blocked by the{" "}
|
||||
<code>.clineignore</code>
|
||||
file settings.
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue