fix: parseFrontmatter handles CRLF line endings

On Windows checkouts, SKILL.md may have CRLF line endings, which caused
parseFrontmatter to fall back to {} and the build to prepend a fresh
frontmatter block while leaving the original one in the body. The result
was the dist Qoder SKILL.md shipping with two frontmatter blocks and
losing user-invocable / argument-hint / license / allowed-tools metadata.

Make the regex and YAML line split CRLF-tolerant. Regenerated tracked
.qoder/skills/impeccable/SKILL.md is now a single, well-formed
frontmatter block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vinaywho
2026-04-28 16:00:19 +05:30
co-authored by Claude Opus 4.7
parent 9a76c7bc17
commit 7cfa7759f5
2 changed files with 6 additions and 11 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ export function restorePerProjectArtifacts(rootDir, stashed) {
* Returns { frontmatter: object, body: string }
*/
export function parseFrontmatter(content) {
const frontmatterRegex = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/;
const match = content.match(frontmatterRegex);
if (!match) {
@@ -56,7 +56,7 @@ export function parseFrontmatter(content) {
const frontmatter = {};
// Simple YAML parser (handles basic key-value and arrays)
const lines = frontmatterText.split('\n');
const lines = frontmatterText.split(/\r?\n/);
let currentKey = null;
let currentArray = null;