pub struct Config {
pub settings: Settings,
pub commands: Commands,
pub wrappers: WrapperConfig,
pub git: GitConfig,
pub cargo: CargoConfig,
pub kubectl: KubectlConfig,
pub gh: GhConfig,
pub project_overlay_path: Option<PathBuf>,
}Expand description
Top-level configuration, produced by merging embedded defaults with
an optional user overlay from ~/.config/cc-toolgate/config.toml.
Fields§
§settings: SettingsGlobal settings (e.g. escalate_deny).
commands: CommandsFlat command-to-decision mappings (allow, ask, deny lists).
wrappers: WrapperConfigWrapper commands that execute their arguments as subcommands.
git: GitConfigGit subcommand-aware evaluation rules.
cargo: CargoConfigCargo subcommand-aware evaluation rules.
kubectl: KubectlConfigkubectl subcommand-aware evaluation rules.
gh: GhConfigGitHub CLI (gh) subcommand-aware evaluation rules.
project_overlay_path: Option<PathBuf>Path to the project overlay file, if one was loaded.
Set by Config::load() when a project-level .claude/cc-toolgate.toml
is found. Used to annotate ASK decisions with provenance.
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Load the default embedded configuration.
Sourcepub fn load() -> Self
pub fn load() -> Self
Load configuration with resolution order:
- Start with embedded defaults
- Merge user overlay from ~/.config/cc-toolgate/config.toml (if exists)
- Merge project overlay from
/.claude/cc-toolgate.toml (if CWD is inside a git repo and the file exists)
Each overlay merges with what’s below it: lists extend, scalars override.
Set replace = true in any section to replace its defaults entirely.
Use remove_<field> lists to subtract specific items.
When a project overlay is loaded, project_overlay_path is set to the
file that was applied. Callers can inspect this to annotate decisions
with provenance information.