mirror of
https://github.com/google-gemini/gemini-cli
synced 2026-04-21 13:37:17 +00:00
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:
parent
54b3642706
commit
d2113ae23d
2 changed files with 29 additions and 2 deletions
|
|
@ -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',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue