Class: WritersRoom::WriteFileTool
- Inherits:
-
ProjectTool
- Object
- RobotLab::Tool
- ProjectTool
- WritersRoom::WriteFileTool
- Defined in:
- lib/writers_room/tools/write_file_tool.rb
Overview
LLM tool that writes or updates files within the project directory.
Instance Attribute Summary
Attributes inherited from ProjectTool
Instance Method Summary collapse
Methods inherited from ProjectTool
Constructor Details
This class inherits a constructor from WritersRoom::ProjectTool
Instance Method Details
#execute(path:, content:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/writers_room/tools/write_file_tool.rb', line 19 def execute(path:, content:) full_path = resolve_path(path) FileUtils.mkdir_p(File.dirname(full_path)) File.write(full_path, content) "Wrote #{content.length} bytes to #{path}" rescue RuntimeError => e e. rescue StandardError => e "Error writing file: #{e.message}" end |