loadProjectConfig method

Future<GenConfig?> loadProjectConfig([
  1. String? workingDir
])

Load project-local config from .claudio.yaml in working directory

Implementation

Future<GenConfig?> loadProjectConfig([String? workingDir]) async {
  final dir = workingDir ?? Directory.current.path;
  final file = File(p.join(dir, '.claudio.yaml'));

  if (!await file.exists()) {
    return null;
  }

  try {
    final content = await file.readAsString();
    final yaml = loadYaml(content);

    if (yaml is! Map) {
      return null;
    }

    return GenConfig.fromYaml(yaml);
  } catch (e) {
    warn('Could not load project config: $e');
    return null;
  }
}