Class: LLMExperiment::CLI::DoctorCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/llm_experiment/cli/doctor_command.rb

Constant Summary collapse

NAME =
"doctor"
SUMMARY =
"preflight checks: CLI, services, disk, auth, images, prompts"
MARKS =
{ ok: "ok", warn: "warn", fail: "FAIL" }.freeze

Instance Method Summary collapse

Methods inherited from Command

#call, #initialize, summary

Constructor Details

This class inherits a constructor from LLMExperiment::CLI::Command

Instance Method Details

#run(_argv) ⇒ Object

Raises:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/llm_experiment/cli/doctor_command.rb', line 11

def run(_argv)
  exp = begin
    experiment
  rescue ConfigError
    nil
  end
  checks = Doctor.new(container: container).checks(exp)
  checks.each do |check|
    line = format("  %-5s %-22s %s", MARKS[check.status], check.name, check.detail)
    line += "  -> #{check.hint}" if check.hint && check.status != :ok
    puts line
  end
  puts exp ? "\nexperiment: #{exp.name} (#{exp.root})" : "\n(no experiment.yml found here; machine checks only)"
  raise Error, "doctor found failures" if checks.any? { |c| c.status == :fail }
end