Class: SkillBench::Config

Inherits:
Object
  • Object
show all
Extended by:
Config::FacadeReaders, Config::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'

Class Method Summary collapse

Class Method Details

.allow_host_executionBoolean

Returns whether commands may run directly on the host when no sandbox isolation (container) is active. Defaults to false (fail closed).

Returns:

  • (Boolean)

    true when un-isolated host execution is explicitly enabled



102
103
104
# File 'lib/skill_bench/config.rb', line 102

def allow_host_execution
  store.allow_host_execution || false
end

.allowed_commandsArray<String>?

Returns allowed commands from configuration.

Returns:

  • (Array<String>, nil)

    List of allowed commands



94
95
96
# File 'lib/skill_bench/config.rb', line 94

def allowed_commands
  store.allowed_commands
end

.api_keyString?

Returns API key from configuration.

Returns:

  • (String, nil)

    API key



155
156
157
# File 'lib/skill_bench/config.rb', line 155

def api_key
  store.api_key
end

.applyHash

Applies configuration from the store.

Returns:

  • (Hash)

    applied configuration



41
42
43
# File 'lib/skill_bench/config.rb', line 41

def apply
  Config::Applier.call(store.to_h)
end

.command_argument_constraintsHash

Returns the optional per-command argument constraints.

When unconfigured, returns an empty Hash meaning no argument constraints apply (the allowlist remains the only command-authorization control).

Returns:

  • (Hash)

    base command => disallowed argument substrings/flags



112
113
114
# File 'lib/skill_bench/config.rb', line 112

def command_argument_constraints
  store.command_argument_constraints || {}
end

.current_llm_providerSymbol

Returns the current LLM provider name.

Returns:

  • (Symbol)

    Current provider name



126
127
128
# File 'lib/skill_bench/config.rb', line 126

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.

Parameters:

  • provider (Symbol)

    Provider name



134
135
136
# File 'lib/skill_bench/config.rb', line 134

def current_llm_provider=(provider)
  store.assign_current_llm_provider(provider)
end

.defaultsHash

Returns the default configuration.

Returns:

  • (Hash)

    default configuration hash



34
35
36
# File 'lib/skill_bench/config.rb', line 34

def defaults
  Config::Defaults.call
end

.env_overridesHash

Returns configuration overrides from environment variables.

Returns:

  • (Hash)

    environment-based overrides



65
66
67
# File 'lib/skill_bench/config.rb', line 65

def env_overrides
  Config::EnvOverrides.call
end

.llm_providers_configHash

Returns LLM providers configuration.

Returns:

  • (Hash)

    Providers configuration



141
142
143
# File 'lib/skill_bench/config.rb', line 141

def llm_providers_config
  store.llm_providers_config || {}
end

.load_from_file(path) ⇒ Hash

Loads configuration from a JSON file.

Parameters:

  • path (String)

    Path to JSON file

Returns:

  • (Hash)

    loaded configuration



49
50
51
# File 'lib/skill_bench/config.rb', line 49

def load_from_file(path)
  Config::JsonLoader.call(path)
end

.max_execution_timeInteger

Returns max execution time from configuration.

Returns:

  • (Integer)

    Maximum execution time in seconds



119
120
121
# File 'lib/skill_bench/config.rb', line 119

def max_execution_time
  store.max_execution_time || 30
end

.modelString?

Returns model from configuration.

Returns:

  • (String, nil)

    Model name



162
163
164
# File 'lib/skill_bench/config.rb', line 162

def model
  store.model
end

.resetvoid

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
80
81
# File 'lib/skill_bench/config.rb', line 73

def reset
  @store = Config::Store.new
  apply_defaults
  apply_json_config(home_config_path)
  local_path = Pathname.new(Dir.pwd).join(CONFIG_FILENAME)
  is_workspace_file = File.exist?(File.join(Dir.pwd, 'ruby-skill-bench.gemspec'))
  apply_json_config(local_path) unless defined?(Minitest) && is_workspace_file
  apply_env_overrides
end

.save_to_file(path, config) ⇒ void

This method returns an undefined value.

Saves configuration to a JSON file.

Parameters:

  • path (String)

    Path to JSON file

  • config (Hash)

    Configuration to save



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.

Yield Parameters:

  • config (Config::Store)

    Configuration store for modification



87
88
89
# File 'lib/skill_bench/config.rb', line 87

def setup
  yield store
end

.skill_sourcesHash?

Returns skill sources mapping.

Returns:

  • (Hash, nil)

    skill source name → directory path



148
149
150
# File 'lib/skill_bench/config.rb', line 148

def skill_sources
  store.skill_sources || {}
end

.storeConfig::Store

Returns the mutable configuration store behind the facade. Lazily initializes configuration on first access.

Returns:



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

def store
  @store ||= Config::Store.new
end