Class: Rubyagents::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyagents/cli.rb

Constant Summary collapse

TOOL_MAP =
{
  "web_search" => -> { require_relative "tools/web_search"; WebSearch },
  "visit_webpage" => -> { require_relative "tools/visit_webpage"; VisitWebpage },
  "user_input" => -> { require_relative "tools/user_input"; UserInput },
  "file_read" => -> { require_relative "tools/file_read"; FileRead },
  "file_write" => -> { require_relative "tools/file_write"; FileWrite }
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rubyagents/cli.rb', line 19

def initialize(argv)
  @argv = argv
  @options = {
    model: "openai/gpt-5.2",
    tools: [],
    mcp: [],
    interactive: false,
    max_steps: 10,
    planning_interval: nil,
    agent_type: "code"
  }
  parse_options!
end

Class Method Details

.run(argv = ARGV) ⇒ Object



15
16
17
# File 'lib/rubyagents/cli.rb', line 15

def self.run(argv = ARGV)
  new(argv).run
end

Instance Method Details

#run ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/rubyagents/cli.rb', line 33

def run
  if @options[:interactive]
    interactive_mode
  elsif @query
    single_query(@query)
  else
    puts @parser.help
  end
end