feat(config): implement TOML loading & defaults #22
Labels
No labels
area:config
area:contracts
area:engine
area:eventsourcing
area:frontend
area:git
area:ipc
area:persistence
area:provider
area:scaffold
area:terminal
type:user-story
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/peon!22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "peon/3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
AppConfigwithGeneralConfig,ProvidersConfig,TerminalConfig,GitConfig, and akeybindingsHashMapTerminalModeenum (Embedded/Kitty/Foot/Auto) withserde rename_all = lowercaseload_config()reads~/.config/forge-agent/config.toml, creating it from the embeddeddefault_config.tomlif absentNone(auto-detection signal for callers)GeneralConfig::resolved_data_dir()expands a leading~to the actual home directoryCloses #3
All acceptance criteria from #3 are implemented and the structure is clean. One real bug to fix before merging.
@ -2,0 +144,4 @@#[derive(Debug, Error)]pub enum ConfigError {#[error("cannot determine config directory")]NoConfigDir,Bug:
ConfigError::NoHomeDiris dead code — never returned.expand_tildesilently returns the unexpanded path whendirs::home_dir()isNone, so this variant is never constructed anywhere. That's misleading to callers inspecting the publicConfigErrortype, and it will cause theresolved_data_dir_is_absolutetest below to silently fail in environments without$HOME(the fallback produces a relativePathBuf::from("~/.local/share/forge-agent")), making theassert!(resolved.is_absolute())assertion blow up.Pick one of the two clean fixes:
Option A — keep silent-fallback, remove the dead variant:
And weaken the test:
Option B — wire up the variant properly:
Then
resolved_data_dirreturnsResult<PathBuf, ConfigError>andload_configpropagates it.