loadProjectToolsConfig function

ToolsConfig? loadProjectToolsConfig(
  1. String projectDir
)

Loads the PROJECT-level tools: section from <projectDir>/.fah/config.yaml — the git-backed availability policy travels with the repo. The PROJECT scope is consumed live (separate from the saved global CliConfig.tools) so the deepest-wins resolution can stack both. Null when the file or the section is absent/unreadable; a present-but-invalid section throws ConfigException (strict, like the user config).

Implementation

ToolsConfig? loadProjectToolsConfig(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['tools'];
    return node == null ? null : ToolsConfig.fromYaml(node);
  } on ConfigException {
    rethrow;
  } on Object {
    return null;
  }
}