loadCliConfig function
Loads CliConfig from ~/.fah/config.yaml.
Returns defaults when the file is missing or unreadable. A syntactically valid file whose model-roles section is invalid throws ConfigException (bad roles must surface, never silently vanish).
Implementation
CliConfig loadCliConfig(String homeDir) {
final file = File('$homeDir/.fah/config.yaml');
if (!file.existsSync()) return CliConfig();
try {
final content = file.readAsStringSync();
final doc = loadYaml(content);
if (doc is YamlMap) return CliConfig.fromYaml(doc);
} on ConfigException {
rethrow;
} on Object {
// Ignore corrupt config and fall back to defaults.
}
return CliConfig();
}