Class: RubyLlmAgents::DoctorGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/ruby_llm_agents/doctor_generator.rb

Overview

Doctor generator — validates that setup is complete and working.

Usage:

rails generate ruby_llm_agents:doctor
rails ruby_llm_agents:doctor   (rake task alias)

Checks:

1. API keys  at least one provider key is configured
2. Migrations  required tables exist
3. Routes  engine is mounted
4. Background jobs  ActiveJob adapter is configured (not :async/:inline in prod)
5. Agents  at least one agent file exists

Instance Method Summary collapse

Instance Method Details

#run_checksObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/generators/ruby_llm_agents/doctor_generator.rb', line 22

def run_checks
  @pass = 0
  @fail = 0
  @warn = 0

  say ""
  say "RubyLLM::Agents Doctor", :bold
  say "=" * 40

  check_api_keys
  check_migrations
  check_routes
  check_background_jobs
  check_agents

  say ""
  say "=" * 40
  summary = "#{@pass} passed, #{@fail} failed, #{@warn} warnings"
  if @fail > 0
    say "Result: #{summary}", :red
  elsif @warn > 0
    say "Result: #{summary}", :yellow
  else
    say "Result: #{summary} — you're all set!", :green
  end
  say ""
end