Class: SkillBench::Commands::Init
- Inherits:
-
Object
- Object
- SkillBench::Commands::Init
- Defined in:
- lib/skill_bench/commands/init.rb
Overview
Handles the ‘skill-bench init` command. Generates a skill-bench.json config file with single-provider settings.
Class Method Summary collapse
-
.config_for_provider(provider) ⇒ Hash
Generates configuration hash for a specific provider.
-
.run(provider:, force: false) ⇒ void
Run the init command to generate config.
Class Method Details
.config_for_provider(provider) ⇒ Hash
Generates configuration hash for a specific provider.
30 31 32 33 34 35 36 |
# File 'lib/skill_bench/commands/init.rb', line 30 def self.config_for_provider(provider) { provider: provider, max_execution_time: 30, config: SkillBench::Clients::ProviderSchemas.for(provider) } end |
.run(provider:, force: false) ⇒ void
This method returns an undefined value.
Run the init command to generate config.
18 19 20 21 22 23 |
# File 'lib/skill_bench/commands/init.rb', line 18 def self.run(provider:, force: false) raise "Config file '#{SkillBench::Config::CONFIG_FILENAME}' already exists. Use --force to overwrite." if File.exist?(SkillBench::Config::CONFIG_FILENAME) && !force config = config_for_provider(provider) File.write(SkillBench::Config::CONFIG_FILENAME, JSON.pretty_generate(config)) end |