Class: SkillBench::Cli::ValidateCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/cli/validate_command.rb

Overview

Handles the skill-bench validate / doctor subcommand.

Runs read-only pre-flight checks and prints a PASS/FAIL report:

1. Criteria JSON structure (via {Models::CriteriaValidator}).
2. skill-bench.json shape (hand-rolled, lightweight schema check).
3. Provider credentials for the configured non-mock provider.

It never runs an eval and never makes a network call.

Constant Summary collapse

DEFAULT_CRITERIA =

Default criteria file validated when --criteria is not given.

'criteria.json'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ ValidateCommand

Returns a new instance of ValidateCommand.

Parameters:

  • argv (Array<String>)

    Raw CLI arguments



27
28
29
# File 'lib/skill_bench/cli/validate_command.rb', line 27

def initialize(argv)
  @argv = argv
end

Class Method Details

.call(argv) ⇒ Integer

Returns Exit code.

Parameters:

  • argv (Array<String>)

    Raw CLI arguments

Returns:

  • (Integer)

    Exit code



22
23
24
# File 'lib/skill_bench/cli/validate_command.rb', line 22

def self.call(argv)
  new(argv).call
end

Instance Method Details

#callInteger

Parses options, runs the pre-flight checks, and prints the report.

Returns:

  • (Integer)

    Exit code (0 when all checks pass, 1 otherwise)



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/skill_bench/cli/validate_command.rb', line 34

def call
  options = parse_options
  config_path = options[:config] || SkillBench::Config::CONFIG_FILENAME
  config_data = load_config_data(config_path)
  results = [
    check_criteria(options),
    check_config(config_path, config_data),
    check_provider_key(config_data)
  ]
  print_report(results)
  results.any? { |result| result[:status] == :fail } ? 1 : 0
rescue HelpRequested
  0
rescue StandardError => e
  warn "Error: #{e.message}"
  1
end