Class: Agentic::CLI
- Inherits:
-
Thor
show all
- Defined in:
- lib/agentic/cli.rb,
lib/agentic/cli/agent.rb,
lib/agentic/cli/config.rb,
lib/agentic/cli/capabilities.rb,
lib/agentic/cli/execution_observer.rb
Overview
Command Line Interface for Agentic
Defined Under Namespace
Classes: Agent, AgentCommands, Capabilities, Config, ConfigCommands, ExecutionObserver
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args) ⇒ CLI
Global logging configuration based on options
20
21
22
23
|
# File 'lib/agentic/cli.rb', line 20
def initialize(*args)
super
configure_logging
end
|
Class Method Details
.exit_on_failure? ⇒ Boolean
15
16
17
|
# File 'lib/agentic/cli.rb', line 15
def self.exit_on_failure?
true
end
|
Instance Method Details
#execute ⇒ Object
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/agentic/cli.rb', line 120
def execute
check_api_token!
plan_data = load_plan_data
unless plan_data
raise Thor::Error, "No plan provided. Use --plan FILE or --from-stdin"
end
tasks = initialize_tasks(plan_data)
execute_tasks(tasks)
end
|
#plan(goal) ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/agentic/cli.rb', line 61
def plan(goal)
check_api_token!
say UI.colorize("Creating plan for goal: #{goal}", :green) unless options[:quiet]
config = LlmConfig.new
config.model = options[:model] if options[:model]
execution_plan = UI.with_spinner("Planning tasks for goal", quiet: options[:quiet]) do
planner = TaskPlanner.new(goal, config)
planner.plan
end
unless options[:quiet]
puts format_plan(execution_plan)
puts
end
if !options[:quiet] && !options[:no_interactive] && ask_user_for_plan_adjustment
execution_plan = adjust_plan_with_user_input(execution_plan, config)
end
if options[:save] || options[:output] != "text"
output_plan(execution_plan, options)
end
if options[:execute] || (should_ask_for_execution? && ask_user_for_execution)
execute_plan_immediately(execution_plan)
end
end
|
#version ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/agentic/cli.rb', line 26
def version
version_box = UI.box(
"Agentic",
[
"Version: #{UI.colorize(Agentic::VERSION, :green)}",
"Ruby: #{UI.colorize(RUBY_VERSION, :blue)}",
"Platform: #{UI.colorize(RUBY_PLATFORM, :yellow)}"
].join("\n"),
padding: [1, 2, 1, 2],
style: {border: {fg: :blue}}
)
puts version_box
end
|