mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
fix: ensure POSIX-compliant newlines in generated files (#856)
- Add final newline check to YAML config generation - Add final newline check to YAML manifest generation - Add final newline check to agent .md file generation - Ensures all text files end with \n per POSIX standard - Fixes 'No newline at end of file' git warnings
This commit is contained in:
@@ -33,7 +33,9 @@ class Config {
|
||||
});
|
||||
|
||||
await fs.ensureDir(path.dirname(configPath));
|
||||
await fs.writeFile(configPath, yamlContent, 'utf8');
|
||||
// Ensure POSIX-compliant final newline
|
||||
const content = yamlContent.endsWith('\n') ? yamlContent : yamlContent + '\n';
|
||||
await fs.writeFile(configPath, content, 'utf8');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,8 @@ async function formatYamlContent(content, filename) {
|
||||
noRefs: true,
|
||||
sortKeys: false, // Preserve key order
|
||||
});
|
||||
return formatted;
|
||||
// Ensure POSIX-compliant final newline
|
||||
return formatted.endsWith('\n') ? formatted : formatted + '\n';
|
||||
} catch (error) {
|
||||
console.error(chalk.red(`❌ YAML syntax error in ${filename}:`), error.message);
|
||||
console.error(chalk.yellow(`💡 Try manually fixing the YAML structure first`));
|
||||
|
||||
Reference in New Issue
Block a user