From 1eeea70977ab8e31c4b40a337ac52232d990fa0a Mon Sep 17 00:00:00 2001 From: Wendy Smoak Date: Sat, 21 Feb 2026 07:39:56 -0500 Subject: [PATCH] fix: normalize line endings and use platform-native EOL in SKILL.md output Normalize all content to LF in transformToSkillFormat, then convert to os.EOL (CRLF on Windows, LF on Linux/macOS) before writing SKILL.md files in both writeSkillArtifacts and installCustomAgentLauncher. Co-Authored-By: Claude Opus 4.6 --- tools/cli/installers/lib/ide/codex.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/cli/installers/lib/ide/codex.js b/tools/cli/installers/lib/ide/codex.js index db0230c17..9339ecfbf 100644 --- a/tools/cli/installers/lib/ide/codex.js +++ b/tools/cli/installers/lib/ide/codex.js @@ -227,8 +227,9 @@ class CodexSetup extends BaseIdeSetup { // Transform content: rewrite frontmatter for skills format const skillContent = this.transformToSkillFormat(artifact.content, skillName); - // Write SKILL.md - await fs.writeFile(path.join(skillDir, 'SKILL.md'), skillContent, 'utf8'); + // Write SKILL.md with platform-native line endings + const platformContent = skillContent.replaceAll('\n', os.EOL); + await fs.writeFile(path.join(skillDir, 'SKILL.md'), platformContent, 'utf8'); writtenCount++; } @@ -243,6 +244,9 @@ class CodexSetup extends BaseIdeSetup { * @returns {string} Transformed content */ transformToSkillFormat(content, skillName) { + // Normalize line endings so body matches rebuilt frontmatter (both LF) + content = content.replaceAll('\r\n', '\n').replaceAll('\r', '\n'); + // Parse frontmatter const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/); if (!fmMatch) { @@ -420,8 +424,10 @@ class CodexSetup extends BaseIdeSetup { '6. WAIT for user input before proceeding\n' + '\n'; + // Write with platform-native line endings + const platformContent = skillContent.replaceAll('\n', os.EOL); const skillPath = path.join(skillDir, 'SKILL.md'); - await fs.writeFile(skillPath, skillContent, 'utf8'); + await fs.writeFile(skillPath, platformContent, 'utf8'); return { path: path.relative(projectDir, skillPath),