|
|
@@ -26,12 +26,28 @@ export async function writeToFileTool(
|
|
|
let newContent: string | undefined = block.params.content
|
|
|
let predictedLineCount: number | undefined = parseInt(block.params.line_count ?? "0")
|
|
|
|
|
|
- if (!relPath || newContent === undefined) {
|
|
|
+ if (block.partial && (!relPath || newContent === undefined)) {
|
|
|
// checking for newContent ensure relPath is complete
|
|
|
// wait so we can determine if it's a new file or editing an existing file
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if (!relPath) {
|
|
|
+ cline.consecutiveMistakeCount++
|
|
|
+ cline.recordToolError("write_to_file")
|
|
|
+ pushToolResult(await cline.sayAndCreateMissingParamError("write_to_file", "path"))
|
|
|
+ await cline.diffViewProvider.reset()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (newContent === undefined) {
|
|
|
+ cline.consecutiveMistakeCount++
|
|
|
+ cline.recordToolError("write_to_file")
|
|
|
+ pushToolResult(await cline.sayAndCreateMissingParamError("write_to_file", "content"))
|
|
|
+ await cline.diffViewProvider.reset()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
const accessAllowed = cline.rooIgnoreController?.validateAccess(relPath)
|
|
|
|
|
|
if (!accessAllowed) {
|
|
|
@@ -96,22 +112,6 @@ export async function writeToFileTool(
|
|
|
|
|
|
return
|
|
|
} else {
|
|
|
- if (!relPath) {
|
|
|
- cline.consecutiveMistakeCount++
|
|
|
- cline.recordToolError("write_to_file")
|
|
|
- pushToolResult(await cline.sayAndCreateMissingParamError("write_to_file", "path"))
|
|
|
- await cline.diffViewProvider.reset()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if (newContent === undefined) {
|
|
|
- cline.consecutiveMistakeCount++
|
|
|
- cline.recordToolError("write_to_file")
|
|
|
- pushToolResult(await cline.sayAndCreateMissingParamError("write_to_file", "content"))
|
|
|
- await cline.diffViewProvider.reset()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
if (predictedLineCount === undefined) {
|
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("write_to_file")
|