fix: Handle colons in skill description frontmatter (#16345)

Co-authored-by: gemini-code-assist[bot] <gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
maruto
2026-01-15 11:10:21 +09:00
committed by GitHub
parent 467e869326
commit 4848f42486
2 changed files with 166 additions and 9 deletions
@@ -100,4 +100,98 @@ describe('skillLoader', () => {
expect(skills).toEqual([]);
expect(coreEvents.emitFeedback).not.toHaveBeenCalled();
});
it('should parse skill with colon in description (issue #16323)', async () => {
const skillDir = path.join(testRootDir, 'colon-skill');
await fs.mkdir(skillDir, { recursive: true });
const skillFile = path.join(skillDir, 'SKILL.md');
await fs.writeFile(
skillFile,
`---
name: foo
description: Simple story generation assistant for fiction writing. Use for creating characters, scenes, storylines, and prose. Trigger words: character, scene, storyline, story, prose, fiction, writing.
---
# Instructions
Do something.
`,
);
const skills = await loadSkillsFromDir(testRootDir);
expect(skills).toHaveLength(1);
expect(skills[0].name).toBe('foo');
expect(skills[0].description).toContain('Trigger words:');
});
it('should parse skill with multiple colons in description', async () => {
const skillDir = path.join(testRootDir, 'multi-colon-skill');
await fs.mkdir(skillDir, { recursive: true });
const skillFile = path.join(skillDir, 'SKILL.md');
await fs.writeFile(
skillFile,
`---
name: multi-colon
description: Use this for tasks like: coding, reviewing, testing. Keywords: async, await, promise.
---
# Instructions
Do something.
`,
);
const skills = await loadSkillsFromDir(testRootDir);
expect(skills).toHaveLength(1);
expect(skills[0].name).toBe('multi-colon');
expect(skills[0].description).toContain('tasks like:');
expect(skills[0].description).toContain('Keywords:');
});
it('should parse skill with quoted YAML description (backward compatibility)', async () => {
const skillDir = path.join(testRootDir, 'quoted-skill');
await fs.mkdir(skillDir, { recursive: true });
const skillFile = path.join(skillDir, 'SKILL.md');
await fs.writeFile(
skillFile,
`---
name: quoted-skill
description: "A skill with colons: like this one: and another."
---
# Instructions
Do something.
`,
);
const skills = await loadSkillsFromDir(testRootDir);
expect(skills).toHaveLength(1);
expect(skills[0].name).toBe('quoted-skill');
expect(skills[0].description).toBe(
'A skill with colons: like this one: and another.',
);
});
it('should parse skill with multi-line YAML description', async () => {
const skillDir = path.join(testRootDir, 'multiline-skill');
await fs.mkdir(skillDir, { recursive: true });
const skillFile = path.join(skillDir, 'SKILL.md');
await fs.writeFile(
skillFile,
`---
name: multiline-skill
description:
Expertise in reviewing code for style, security, and performance. Use when the
user asks for "feedback," a "review," or to "check" their changes.
---
# Instructions
Do something.
`,
);
const skills = await loadSkillsFromDir(testRootDir);
expect(skills).toHaveLength(1);
expect(skills[0].name).toBe('multiline-skill');
expect(skills[0].description).toContain('Expertise in reviewing code');
expect(skills[0].description).toContain('check');
});
});