@@ -25,13 +25,7 @@ def view_file(codebase: Codebase, filepath: str) -> dict[str, Any]:
25
25
pass
26
26
27
27
if not file :
28
- for f in codebase .files :
29
- if f .file_path .endswith (filepath ):
30
- file = f
31
- break
32
-
33
- if not file :
34
- return {"error" : f"File not found: { filepath } " }
28
+ return {"error" : f"File not found: { filepath } . Please use full filepath relative to workspace root." }
35
29
36
30
return {
37
31
"filepath" : file .filepath ,
@@ -106,6 +100,8 @@ def edit_file(codebase: Codebase, filepath: str, content: str) -> dict[str, Any]
106
100
file = codebase .get_file (filepath )
107
101
except ValueError :
108
102
return {"error" : f"File not found: { filepath } " }
103
+ if file is None :
104
+ return {"error" : f"File not found: { filepath } " }
109
105
110
106
file .edit (content )
111
107
codebase .commit ()
@@ -144,6 +140,8 @@ def delete_file(codebase: Codebase, filepath: str) -> dict[str, Any]:
144
140
file = codebase .get_file (filepath )
145
141
except ValueError :
146
142
return {"error" : f"File not found: { filepath } " }
143
+ if file is None :
144
+ return {"error" : f"File not found: { filepath } " }
147
145
148
146
file .remove ()
149
147
codebase .commit ()
@@ -165,6 +163,8 @@ def rename_file(codebase: Codebase, filepath: str, new_filepath: str) -> dict[st
165
163
file = codebase .get_file (filepath )
166
164
except ValueError :
167
165
return {"error" : f"File not found: { filepath } " }
166
+ if file is None :
167
+ return {"error" : f"File not found: { filepath } " }
168
168
169
169
if codebase .has_file (new_filepath ):
170
170
return {"error" : f"Destination file already exists: { new_filepath } " }
@@ -204,6 +204,8 @@ def move_symbol(
204
204
source = codebase .get_file (source_file )
205
205
except ValueError :
206
206
return {"error" : f"Source file not found: { source_file } " }
207
+ if source is None :
208
+ return {"error" : f"Source file not found: { source_file } " }
207
209
208
210
try :
209
211
target = codebase .get_file (target_file )
0 commit comments