code-puppy 0.0.58__py3-none-any.whl → 0.0.59__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -282,27 +282,27 @@ def register_file_modifications_tools(agent):
282
282
  "changed": False,
283
283
  "diff": "",
284
284
  }
285
- if isinstance(parsed_payload, dict):
286
- if "delete_snippet" in parsed_payload:
287
- snippet = parsed_payload["delete_snippet"]
288
- return delete_snippet_from_file(context, file_path, snippet)
289
- if "replacements" in parsed_payload:
290
- replacements = parsed_payload["replacements"]
291
- return replace_in_file(context, file_path, replacements)
292
- if "content" in parsed_payload:
293
- content = parsed_payload["content"]
294
- overwrite = bool(parsed_payload.get("overwrite", False))
295
- file_exists = os.path.exists(file_path)
296
- if file_exists and not overwrite:
297
- return {
298
- "success": False,
299
- "path": file_path,
300
- "message": f"File '{file_path}' exists. Set 'overwrite': true to replace.",
301
- "changed": False,
302
- }
303
- return write_to_file(context, file_path, content, overwrite)
304
285
  try:
305
- write_to_file(context, file_path, diff, overwrite=False)
286
+ if isinstance(parsed_payload, dict):
287
+ if "delete_snippet" in parsed_payload:
288
+ snippet = parsed_payload["delete_snippet"]
289
+ return delete_snippet_from_file(context, file_path, snippet)
290
+ if "replacements" in parsed_payload:
291
+ replacements = parsed_payload["replacements"]
292
+ return replace_in_file(context, file_path, replacements)
293
+ if "content" in parsed_payload:
294
+ content = parsed_payload["content"]
295
+ overwrite = bool(parsed_payload.get("overwrite", False))
296
+ file_exists = os.path.exists(file_path)
297
+ if file_exists and not overwrite:
298
+ return {
299
+ "success": False,
300
+ "path": file_path,
301
+ "message": f"File '{file_path}' exists. Set 'overwrite': true to replace.",
302
+ "changed": False,
303
+ }
304
+ return write_to_file(context, file_path, content, overwrite)
305
+ return write_to_file(context, file_path, diff, overwrite=False)
306
306
  except Exception as e:
307
307
  console.print(
308
308
  "[bold red] Unable to route file modification tool call to sub-tool [/bold red]"
@@ -311,7 +311,7 @@ def register_file_modifications_tools(agent):
311
311
  return {
312
312
  "success": False,
313
313
  "path": file_path,
314
- "message": "Wasn't able to route file modification to the right sub-tool!",
314
+ "message": f"Something went wrong in file editing: {str(e)}",
315
315
  "changed": False,
316
316
  }
317
317
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.58
3
+ Version: 0.0.59
4
4
  Summary: Code generation agent
5
5
  Author: Michael Pfaffenberger
6
6
  License: MIT
@@ -17,12 +17,12 @@ code_puppy/tools/__init__.py,sha256=J_HCbkivdr1rP5vfucxttXhGmTBx0S2LNoDMrbaE-Fc,
17
17
  code_puppy/tools/code_map.py,sha256=5vzKBUddY0z9kMfHZmLiewUMJofDOONJIaXCWVhbE5E,3201
18
18
  code_puppy/tools/command_runner.py,sha256=6Ej2axH-b4ZGPLxOWg9kfW75qbftAecCFqWEtw3wEB8,6540
19
19
  code_puppy/tools/common.py,sha256=WAwij4KZ3JVFr9PssLsmIAPE9rlDKg8XSEtdKjNMQF4,1307
20
- code_puppy/tools/file_modifications.py,sha256=0oH0MvmzpivzyCllAZ9M_Khfick6XRx-bdLouMKYPXU,13298
20
+ code_puppy/tools/file_modifications.py,sha256=o7meMYjsQ70P1Lgc0XM0pFsh6Nn3XfJb7R5y-bwZp_M,13367
21
21
  code_puppy/tools/file_operations.py,sha256=-mo07EB6Rp_eDEFWqdJblj1Unz6flAsSY2ZNIxYzBiM,11595
22
22
  code_puppy/tools/web_search.py,sha256=sA2ierjuuYA517-uhb5s53SgeVsyOe1nExoZsrU1Fps,1284
23
- code_puppy-0.0.58.data/data/code_puppy/models.json,sha256=7H-y97YK9BXhag5wJU19rtg24JtZWYx60RsBLBW3WiI,2162
24
- code_puppy-0.0.58.dist-info/METADATA,sha256=PnPuFqL053yK6leEJxiu72nsmm9WYlpOI9ARQFGH36o,4784
25
- code_puppy-0.0.58.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
- code_puppy-0.0.58.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
27
- code_puppy-0.0.58.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
28
- code_puppy-0.0.58.dist-info/RECORD,,
23
+ code_puppy-0.0.59.data/data/code_puppy/models.json,sha256=7H-y97YK9BXhag5wJU19rtg24JtZWYx60RsBLBW3WiI,2162
24
+ code_puppy-0.0.59.dist-info/METADATA,sha256=s85j3wx1XwgNQJrliE5LzbUezX_T7NJcWWAKUA6ZJgg,4784
25
+ code_puppy-0.0.59.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
+ code_puppy-0.0.59.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
27
+ code_puppy-0.0.59.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
28
+ code_puppy-0.0.59.dist-info/RECORD,,