Expand description
Configuration resolution for Ralph, including global and project layers.
Responsibilities:
- Resolve configuration from multiple layers: global config, project config, and defaults.
- Load and parse config files (JSON with JSONC comment support via
load_layer). - Merge configuration layers via
ConfigLayerandapply_layer. - Validate configuration values (version, paths, numeric ranges, runner binaries).
- Resolve queue/done file paths and ID generation settings (prefix, width).
- Discover repository root via
.ralph/directory or.git/.
Not handled here:
- CLI argument parsing (see
crate::cli). - Queue operations like task CRUD (see
crate::queue). - Runner execution or agent invocation (see
crate::runner). - Prompt rendering or template processing (see
crate::prompts_internal). - Lock management (see
crate::lock).
Invariants/assumptions:
- Config version must be 2; unsupported versions are rejected.
- Paths are resolved relative to repo root unless absolute.
- Global config resolves from
~/.config/ralph/config.jsonc. - Project config resolves from
.ralph/config.jsonc. - Config layers are applied in this order: defaults, then global, then project (later layers override earlier ones).
save_layercreates parent directories automatically if needed.
Structs§
- Config
Layer - Repo
Trust - Local trust file for execution-sensitive project configuration.
- Resolved
- Resolved configuration including computed paths.
Enums§
- Trust
File Init Status - Outcome of
initialize_repo_trust_file.
Functions§
- apply_
layer - Apply a config layer on top of a base config. Later layers override earlier ones using leaf-wise merge semantics.
- find_
repo_ root - Find the repository root starting from a given path.
- git_
ref_ invalid_ reason - global_
config_ path - Get the path to the global config file.
- initialize_
repo_ trust_ file - Create or update
.ralph/trust.jsoncsoRepoTrust::is_trustedbecomes true. - load_
layer - Load a config layer from a JSON/JSONC file.
- load_
repo_ trust - Load repo trust if present, otherwise return the default untrusted state.
- project_
config_ path - Get the path to the project config file for a given repo root.
- project_
trust_ path - Preferred local trust path for a repository root.
- resolve_
done_ path - Resolve the done file path from config.
- resolve_
from_ cwd - Resolve configuration from the current working directory.
- resolve_
from_ cwd_ for_ doctor - Resolve config for the doctor command, skipping instruction_files validation. This allows doctor to diagnose and warn about missing files without failing early.
- resolve_
from_ cwd_ skipping_ project_ execution_ trust - Resolve like
resolve_from_cwd, but skip project-layer execution trust validation. - resolve_
from_ cwd_ with_ profile - Resolve config with an optional profile selection.
- resolve_
id_ prefix - Resolve the queue ID prefix from config.
- resolve_
id_ width - Resolve the queue ID width from config.
- resolve_
queue_ path - Resolve the queue file path from config.
- save_
layer - Save a config layer to a JSON file. Automatically sets version to 2 if not specified and creates parent directories.
- validate_
agent_ binary_ paths - validate_
agent_ patch - validate_
config - validate_
project_ execution_ trust - validate_
queue_ done_ file_ override - validate_
queue_ file_ override - validate_
queue_ id_ prefix_ override - validate_
queue_ id_ width_ override - validate_
queue_ overrides