Class: RubynCode::CLI::DaemonRunner

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

Overview

Boots all dependencies and starts the GOLEM daemon from the CLI. Handles authentication, database setup, and lifecycle output.

Usage:

rubyn-code daemon --name golem-1 --max-runs 50 --max-cost 5.0

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ DaemonRunner

Returns a new instance of DaemonRunner.



13
14
15
16
17
18
# File 'lib/rubyn_code/cli/daemon_runner.rb', line 13

def initialize(options)
  @options = options
  @daemon_opts = options.fetch(:daemon, {})
  @renderer = Renderer.new
  @project_root = Dir.pwd
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rubyn_code/cli/daemon_runner.rb', line 20

def run
  bootstrap!
  daemon = build_daemon
  daemon.start!
  display_shutdown_summary(daemon)
rescue Interrupt
  @renderer.info("\nShutting down daemon...")
  display_shutdown_summary(daemon) if daemon
rescue StandardError => e
  @renderer.error("Daemon failed: #{e.message}")
  RubynCode::Debug.warn(e.backtrace&.first(5)&.join("\n")) if @options[:debug]
  exit(1)
ensure
  disconnect_mcp_clients!
end