fix(core): refine simple frontmatter parser key detection

- Restrict multi-line description continuation check to known keys (name, description)
- Avoid incorrectly identifying lines starting with "Note:" or similar as new keys
- Add test case to verify the fix

Fixes https://github.com/google-gemini/gemini-cli/issues/25693
This commit is contained in:
Taylor Mullen 2026-04-20 20:43:31 -07:00
parent 54b3642706
commit d2113ae23d
2 changed files with 29 additions and 2 deletions

View file

@ -343,4 +343,28 @@ description: A long description: with a colon
expect(skills[0].name).toBe('my-skill');
expect(skills[0].description).toBe('A long description: with a colon');
});
it('should not treat "Note:" as a new key in multi-line description in simple parser', async () => {
const skillDir = path.join(testRootDir, 'simple-parser-note');
await fs.mkdir(skillDir, { recursive: true });
const skillFile = path.join(skillDir, 'SKILL.md');
// Forces YAML failure, triggers simple parser
await fs.writeFile(
skillFile,
`---
name: note-skill
description: This is a description
Note: This should be part of the description
---
`,
);
const skills = await loadSkillsFromDir(testRootDir);
expect(skills).toHaveLength(1);
expect(skills[0].name).toBe('note-skill');
expect(skills[0].description).toBe(
'This is a description Note: This should be part of the description',
);
});
});

View file

@ -92,8 +92,11 @@ function parseSimpleFrontmatter(
while (i + 1 < lines.length) {
const nextLine = lines[i + 1];
// If next line is indented, it's a continuation of the description,
// UNLESS it looks like another key (e.g. "name:")
if (nextLine.match(/^[ \t]+\S/) && !nextLine.match(/^\s*\w+\s*:/)) {
// UNLESS it looks like another known key (e.g. "name:")
if (
nextLine.match(/^[ \t]+\S/) &&
!nextLine.match(/^\s*(name|description)\s*:/i)
) {
descLines.push(nextLine.trim());
i++;
} else {