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:
Serhii
2025-11-05 04:18:12 +02:00
committed by GitHub
parent ba5f76c37d
commit c283344a54
6 changed files with 37 additions and 15 deletions

View File

@@ -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');
}
/**

View File

@@ -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`));