Class: SharedTools::Tools::Disk::DirectoryMoveTool

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/shared_tools/tools/disk/directory_move_tool.rb

Overview

Examples:

tool = SharedTools::Tools::Disk::DirectoryMoveTool.new(root: "./project")
tool.execute(path: "./foo", destination: "./bar")

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver: nil, logger: nil) ⇒ DirectoryMoveTool

Returns a new instance of DirectoryMoveTool.



21
22
23
24
# File 'lib/shared_tools/tools/disk/directory_move_tool.rb', line 21

def initialize(driver: nil, logger: nil)
  @driver = driver || SharedTools::Tools::Disk::LocalDriver.new(root: Dir.pwd)
  @logger = logger || RubyLLM.logger
end

Class Method Details

.nameObject



12
# File 'lib/shared_tools/tools/disk/directory_move_tool.rb', line 12

def self.name = 'disk_directory_move'

Instance Method Details

#execute(path:, destination:) ⇒ String

Parameters:

  • path (String)
  • destination (String)

Returns:

  • (String)


30
31
32
33
34
35
36
# File 'lib/shared_tools/tools/disk/directory_move_tool.rb', line 30

def execute(path:, destination:)
  @logger.info("#{self.class.name}#execute path=#{path.inspect} destination=#{destination.inspect}")
  @driver.directory_move(path:, destination:)
rescue SecurityError => e
  @logger.error(e.message)
  raise e
end