Class: AgentSettings::Adapters::Codex
- Inherits:
-
Object
- Object
- AgentSettings::Adapters::Codex
- Defined in:
- lib/agent_settings/adapters/codex.rb
Overview
Adapter for Codex agent configuration.
Codex stores configuration in TOML files:
- Global: ~/.codex/config.toml (user-level config)
- Project: .codex/config.toml (project-level config, trusted only)
- System: /etc/codex/config.toml (system-level config)
Codex has a unique "trust" model - project config is only used for trusted projects. Untrusted projects will have a warning and no project layer.
Environment variable CODEX_HOME can override the home directory where the global config is located.
Instance Method Summary collapse
-
#env_overrides(dir:, env:, trusted:) ⇒ Array<EnvOverride>
Get environment variable overrides for Codex.
-
#layers(dir:, env:, trusted:) ⇒ Array<Location>
Get all config layers for Codex.
-
#warnings(dir:, env:, trusted:) ⇒ Array<String>
Get warnings for Codex configuration.
Instance Method Details
#env_overrides(dir:, env:, trusted:) ⇒ Array<EnvOverride>
Get environment variable overrides for Codex.
Checks for CODEX_HOME environment variable. When set, it changes the base directory for the global config (from ~ to the specified path).
52 53 54 |
# File 'lib/agent_settings/adapters/codex.rb', line 52 def env_overrides(dir:, env:, trusted:) # rubocop:disable Lint/UnusedMethodArgument build_env_overrides(env) end |
#layers(dir:, env:, trusted:) ⇒ Array<Location>
Get all config layers for Codex.
Returns an array of Location objects for global, system (if exists), and project (if trusted) configs. Project config is excluded for untrusted projects.
39 40 41 |
# File 'lib/agent_settings/adapters/codex.rb', line 39 def layers(dir:, env:, trusted:) build_layers(dir, env, trusted) end |
#warnings(dir:, env:, trusted:) ⇒ Array<String>
Get warnings for Codex configuration.
Returns a warning if the project is untrusted but has a config file. This helps users understand why their project config is being ignored.
65 66 67 68 69 70 71 |
# File 'lib/agent_settings/adapters/codex.rb', line 65 def warnings(dir:, env:, trusted:) # rubocop:disable Lint/UnusedMethodArgument warnings = [] if !trusted && File.exist?(File.join(dir, ".codex", "config.toml")) warnings << "Project config ignored for untrusted project" end warnings end |