Class: SkillBench::Config
- Inherits:
-
Object
- Object
- SkillBench::Config
- Extended by:
- FacadeReaders, FacadeWriters
- Defined in:
- lib/skill_bench/config.rb,
lib/skill_bench/config/store.rb,
lib/skill_bench/config/applier.rb,
lib/skill_bench/config/defaults.rb,
lib/skill_bench/config/json_loader.rb,
lib/skill_bench/config/env_overrides.rb,
lib/skill_bench/config/facade_readers.rb,
lib/skill_bench/config/facade_writers.rb
Overview
Centralized configuration for the SkillBench system. Supports hierarchical loading: Defaults < Home JSON < Local JSON < ENV Variables.
Defined Under Namespace
Modules: FacadeReaders, FacadeWriters Classes: Applier, Defaults, EnvOverrides, JsonLoader, Store
Constant Summary collapse
- CONFIG_FILENAME =
File name used for local and home evaluator configuration.
'skill-bench.json'
Constants included from FacadeWriters
FacadeWriters::PROVIDER_SETTINGS
Class Method Summary collapse
-
.allowed_commands ⇒ Array<String>?
Returns allowed commands from configuration.
-
.api_key ⇒ String?
Returns API key from configuration.
-
.apply ⇒ Hash
Applies configuration from the store.
-
.current_llm_provider ⇒ Symbol
Returns the current LLM provider name.
-
.current_llm_provider=(provider) ⇒ void
Sets the current LLM provider.
-
.defaults ⇒ Hash
Returns the default configuration.
-
.env_overrides ⇒ Hash
Returns configuration overrides from environment variables.
-
.llm_providers_config ⇒ Hash
Returns LLM providers configuration.
-
.load_from_file(path) ⇒ Hash
Loads configuration from a JSON file.
-
.max_execution_time ⇒ Integer
Returns max execution time from configuration.
-
.model ⇒ String?
Returns model from configuration.
-
.reset ⇒ void
Resets and reloads configuration from all sources.
-
.save_to_file(path, config) ⇒ void
Saves configuration to a JSON file.
-
.setup {|config| ... } ⇒ void
Sets up configuration with a block.
-
.store ⇒ Config::Store
Returns the mutable configuration store behind the facade.
Methods included from FacadeWriters
allowed_commands=, current_llm_provider=, llm_providers_config=, max_execution_time=, set_provider_api_key, set_provider_api_version, set_provider_base_url, set_provider_endpoint, set_provider_location, set_provider_model, set_provider_project_id
Methods included from FacadeReaders
allowed_commands, api_key, base_url, current_llm_provider, for_provider, llm_providers_config, max_execution_time, model
Class Method Details
.allowed_commands ⇒ Array<String>?
Returns allowed commands from configuration.
92 93 94 |
# File 'lib/skill_bench/config.rb', line 92 def allowed_commands store.allowed_commands end |
.api_key ⇒ String?
Returns API key from configuration.
128 129 130 |
# File 'lib/skill_bench/config.rb', line 128 def api_key store.api_key end |
.apply ⇒ Hash
Applies configuration from the store.
41 42 43 |
# File 'lib/skill_bench/config.rb', line 41 def apply Config::Applier.call(store.to_h) end |
.current_llm_provider ⇒ Symbol
Returns the current LLM provider name.
106 107 108 |
# File 'lib/skill_bench/config.rb', line 106 def current_llm_provider store.current_llm_provider || :openai end |
.current_llm_provider=(provider) ⇒ void
This method returns an undefined value.
Sets the current LLM provider.
114 115 116 |
# File 'lib/skill_bench/config.rb', line 114 def current_llm_provider=(provider) store.assign_current_llm_provider(provider) end |
.defaults ⇒ Hash
Returns the default configuration.
34 35 36 |
# File 'lib/skill_bench/config.rb', line 34 def defaults Config::Defaults.call end |
.env_overrides ⇒ Hash
Returns configuration overrides from environment variables.
65 66 67 |
# File 'lib/skill_bench/config.rb', line 65 def env_overrides Config::EnvOverrides.call end |
.llm_providers_config ⇒ Hash
Returns LLM providers configuration.
121 122 123 |
# File 'lib/skill_bench/config.rb', line 121 def llm_providers_config store.llm_providers_config || {} end |
.load_from_file(path) ⇒ Hash
Loads configuration from a JSON file.
49 50 51 |
# File 'lib/skill_bench/config.rb', line 49 def load_from_file(path) Config::JsonLoader.call(path) end |
.max_execution_time ⇒ Integer
Returns max execution time from configuration.
99 100 101 |
# File 'lib/skill_bench/config.rb', line 99 def max_execution_time store.max_execution_time || 30 end |
.model ⇒ String?
Returns model from configuration.
135 136 137 |
# File 'lib/skill_bench/config.rb', line 135 def model store.model end |
.reset ⇒ void
This method returns an undefined value.
Resets and reloads configuration from all sources. Pipeline: Defaults → Home JSON → Local JSON → ENV overrides.
73 74 75 76 77 78 79 |
# File 'lib/skill_bench/config.rb', line 73 def reset @store = Config::Store.new apply_defaults apply_json_config(home_config_path) apply_json_config(Pathname.new(Dir.pwd).join(CONFIG_FILENAME)) apply_env_overrides end |
.save_to_file(path, config) ⇒ void
This method returns an undefined value.
Saves configuration to a JSON file.
58 59 60 |
# File 'lib/skill_bench/config.rb', line 58 def save_to_file(path, config) Config::FacadeWriters.save_to_file(path, config) end |
.setup {|config| ... } ⇒ void
This method returns an undefined value.
Sets up configuration with a block.
85 86 87 |
# File 'lib/skill_bench/config.rb', line 85 def setup yield store end |
.store ⇒ Config::Store
Returns the mutable configuration store behind the facade. Lazily initializes configuration on first access.
27 28 29 |
# File 'lib/skill_bench/config.rb', line 27 def store @store ||= Config::Store.new end |