magi-code 0.105.1

Repository-aware CLI coding agent for terminal work
Documentation
use super::*;

// Separate schema/load paths form the baseline in profile_issue_379_repeated_setup_paths.
pub(crate) fn ensure_settings_schema_files(paths: &McPaths) -> anyhow::Result<()> {
    ensure_settings_schema_files_and_load(paths).map(|_| ())
}

pub(crate) fn load_config_with_settings(
    paths: McPaths,
    cli: CliConfigOverrides,
) -> anyhow::Result<(EffectiveConfig, Settings, AppearanceSettings)> {
    let document = read_settings_document(&paths)?;
    let config = EffectiveConfig::from_loaded_settings(paths, cli, document.settings.clone())?;
    Ok((config, document.settings, document.appearance))
}

pub(crate) fn write_settings(paths: &McPaths, settings: &Settings) -> anyhow::Result<()> {
    validate_settings(settings)?;
    update_settings_json(paths, SettingsScope::Global, |raw| {
        let before: Settings = serde_json::from_value(raw.clone())?;
        update_raw_from_settings(raw, &before, settings, SettingsScope::Global)
    })?;
    Ok(())
}