From 16aadbf0bf2a5e3d262407eb1e5e0cab6e4fc998 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 3 Jul 2026 06:01:22 -0700 Subject: [PATCH] Allow sync-agent-skills.mjs to match Windows line ends (#5477) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description of Changes The readFrontmatter regex in `docs/scripts/sync-agent-skills.mjs` uses `\n` to match line endings, which fails on Windows where files have CRLF (`\r\n`) endings. This causes `pnpm run build` to fail with: ``` Error: skills\cli\SKILL.md is missing YAML frontmatter ``` Fix: change `\n` → `\r?\n` in the frontmatter regex and use /\r?\n/ for line splitting so the script works on both Unix and Windows. # API and ABI breaking changes No API or ABI changes # Expected complexity level and risk 1 - Trivial # Testing - [X] When used along side `bump-versions`, this prevents Windows from having the outlined issue. --- docs/scripts/sync-agent-skills.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/scripts/sync-agent-skills.mjs b/docs/scripts/sync-agent-skills.mjs index 8de4f839815..b1593f8281d 100644 --- a/docs/scripts/sync-agent-skills.mjs +++ b/docs/scripts/sync-agent-skills.mjs @@ -11,13 +11,13 @@ const outputDir = path.join( 'docs/static/.well-known/agent-skills' ); function readFrontmatter(markdown, sourcePath) { - const match = markdown.match(/^---\n([\s\S]*?)\n---\n/); + const match = markdown.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/); if (!match) { throw new Error(`${sourcePath} is missing YAML frontmatter`); } const frontmatter = {}; - for (const line of match[1].split('\n')) { + for (const line of match[1].split(/\r?\n/)) { const field = line.match(/^([a-zA-Z0-9_-]+):\s*(.*)$/); if (field) { frontmatter[field[1]] = field[2].replace(/^"(.*)"$/, '$1');