Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: accept crlf command frontmatter

Affaan Mustafa70cc2bb247b2
diff --git a/tests/commands/command-frontmatter.test.js b/tests/commands/command-frontmatter.test.js
index 06666c717..36d4714f3 100644
--- a/tests/commands/command-frontmatter.test.js
+++ b/tests/commands/command-frontmatter.test.js
@@ -29,20 +29,17 @@ function getCommandFiles() {
}
function parseFrontmatter(content) {
- if (!content.startsWith('---\n')) {
- return null;
- }
-
- const endIndex = content.indexOf('\n---', 4);
- if (endIndex === -1) {
- return null;
- }
-
- return content.slice(4, endIndex);
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
+ return match ? match[1] : null;
}
console.log('\n=== Testing command frontmatter metadata ===\n');
+test('frontmatter parser accepts LF and CRLF line endings', () => {
+ assert.strictEqual(parseFrontmatter('---\ndescription: ok\n---\n# Title'), 'description: ok');
+ assert.strictEqual(parseFrontmatter('---\r\ndescription: ok\r\n---\r\n# Title'), 'description: ok');
+});
+
for (const fileName of getCommandFiles()) {
test(`${fileName} declares command metadata frontmatter`, () => {
const content = fs.readFileSync(path.join(commandsDir, fileName), 'utf8');