28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/legion/cli/chat/tools/knowledge_maintenance.rb', line 28
def execute(action:)
action = action.to_s.strip
return "Invalid action: #{action}. Must be one of: #{VALID_ACTIONS.join(', ')}" unless VALID_ACTIONS.include?(action)
data = run_maintenance(action)
return "Apollo error: #{data[:error]}" if data[:error]
format_result(action, data)
rescue Errno::ECONNREFUSED
'Apollo unavailable (daemon not running).'
rescue StandardError => e
Legion::Logging.warn("KnowledgeMaintenance#execute failed: #{e.message}") if defined?(Legion::Logging)
"Error running maintenance: #{e.message}"
end
|