Centralize frontmatter parsing + parse frontmatter with yaml library (#728)
* Add frontmatter utility and tidy coding agent prompts * Add frontmatter parsing utilities and tests * Parse frontmatter with YAML parser * Simplify frontmatter parsing utilities * strip body in 1 place * Improve frontmatter parsing error handling * Normalize multiline skill and select-list descriptions
This commit is contained in:
@@ -95,6 +95,28 @@ describe("skills", () => {
|
||||
expect(warnings.some((w) => w.message.includes("description is required"))).toBe(true);
|
||||
});
|
||||
|
||||
it("should warn and skip skill when YAML frontmatter is invalid", () => {
|
||||
const { skills, warnings } = loadSkillsFromDir({
|
||||
dir: join(fixturesDir, "invalid-yaml"),
|
||||
source: "test",
|
||||
});
|
||||
|
||||
expect(skills).toHaveLength(0);
|
||||
expect(warnings.some((w) => w.message.includes("at line"))).toBe(true);
|
||||
});
|
||||
|
||||
it("should preserve multiline descriptions from YAML", () => {
|
||||
const { skills, warnings } = loadSkillsFromDir({
|
||||
dir: join(fixturesDir, "multiline-description"),
|
||||
source: "test",
|
||||
});
|
||||
|
||||
expect(skills).toHaveLength(1);
|
||||
expect(skills[0].description).toContain("\n");
|
||||
expect(skills[0].description).toContain("This is a multiline description.");
|
||||
expect(warnings).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("should warn when name contains consecutive hyphens", () => {
|
||||
const { skills, warnings } = loadSkillsFromDir({
|
||||
dir: join(fixturesDir, "consecutive-hyphens"),
|
||||
|
||||
Reference in New Issue
Block a user