loadProjectSpillsConfig function
Loads the PROJECT-level spills: section from
<projectDir>/.fah/config.yaml (issue #678) — the spilling thresholds
travel with the repo. Project wins wholesale over the user-level
spills: section, like the other project sections. Null when the
file or the section is absent; the parse itself is tolerant, so this
never throws.
Implementation
SpillsConfig? loadProjectSpillsConfig(String projectDir) {
final file = File('$projectDir/.fah/config.yaml');
if (!file.existsSync()) return null;
try {
final doc = loadYaml(file.readAsStringSync());
if (doc is! YamlMap) return null;
final node = doc['spills'];
return node == null ? null : SpillsConfig.fromYaml(node);
} on Object {
return null;
}
}