Class: Legion::CLI::Chat::Tools::RunCommand

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/legion/cli/chat/tools/run_command.rb

Instance Method Summary collapse

Instance Method Details

#execute(command:, timeout: 120, working_directory: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/legion/cli/chat/tools/run_command.rb', line 18

def execute(command:, timeout: 120, working_directory: nil)
  dir = working_directory ? File.expand_path(working_directory) : Dir.pwd

  if sandbox_enabled? && sandbox_available?
    execute_sandboxed(command: command, timeout: timeout, dir: dir)
  else
    execute_direct(command: command, timeout: timeout, dir: dir)
  end
end