@@ -26,12 +26,28 @@ export async function writeToFileTool(
2626 let newContent : string | undefined = block . params . content
2727 let predictedLineCount : number | undefined = parseInt ( block . params . line_count ?? "0" )
2828
29- if ( ! relPath || newContent === undefined ) {
29+ if ( block . partial && ( ! relPath || newContent === undefined ) ) {
3030 // checking for newContent ensure relPath is complete
3131 // wait so we can determine if it's a new file or editing an existing file
3232 return
3333 }
3434
35+ if ( ! relPath ) {
36+ cline . consecutiveMistakeCount ++
37+ cline . recordToolError ( "write_to_file" )
38+ pushToolResult ( await cline . sayAndCreateMissingParamError ( "write_to_file" , "path" ) )
39+ await cline . diffViewProvider . reset ( )
40+ return
41+ }
42+
43+ if ( newContent === undefined ) {
44+ cline . consecutiveMistakeCount ++
45+ cline . recordToolError ( "write_to_file" )
46+ pushToolResult ( await cline . sayAndCreateMissingParamError ( "write_to_file" , "content" ) )
47+ await cline . diffViewProvider . reset ( )
48+ return
49+ }
50+
3551 const accessAllowed = cline . rooIgnoreController ?. validateAccess ( relPath )
3652
3753 if ( ! accessAllowed ) {
@@ -96,22 +112,6 @@ export async function writeToFileTool(
96112
97113 return
98114 } else {
99- if ( ! relPath ) {
100- cline . consecutiveMistakeCount ++
101- cline . recordToolError ( "write_to_file" )
102- pushToolResult ( await cline . sayAndCreateMissingParamError ( "write_to_file" , "path" ) )
103- await cline . diffViewProvider . reset ( )
104- return
105- }
106-
107- if ( newContent === undefined ) {
108- cline . consecutiveMistakeCount ++
109- cline . recordToolError ( "write_to_file" )
110- pushToolResult ( await cline . sayAndCreateMissingParamError ( "write_to_file" , "content" ) )
111- await cline . diffViewProvider . reset ( )
112- return
113- }
114-
115115 if ( predictedLineCount === undefined ) {
116116 cline . consecutiveMistakeCount ++
117117 cline . recordToolError ( "write_to_file" )
0 commit comments