hasTomBuildConfig function
Check if a directory has buildkit.yaml with a specific tool section.
Returns true if the tool key is present in the YAML, even if the value
is null (bare key like cleanup: with no sub-keys). This allows tools
to be activated with just the key present, using workspace or default config.
Implementation
bool hasTomBuildConfig(String dirPath, String toolKey) {
final yamlPath = p.join(dirPath, TomBuildConfig.projectFilename);
if (!exists(yamlPath)) return false;
try {
final content = read(yamlPath).toParagraph();
final yaml = loadYaml(content) as YamlMap?;
// Check containsKey instead of != null to support bare keys (cleanup:)
return yaml != null && yaml.containsKey(toolKey);
} catch (_) {
return false;
}
}