@@ -2,6 +2,7 @@ import * as fs from "fs/promises"
22import * as path from "path"
33import * as vscode from "vscode"
44import matter from "gray-matter"
5+ import { parseFrontmatter } from "../../utils/frontmatter"
56
67import type { ClineProvider } from "../../core/webview/ClineProvider"
78import { getGlobalRooDirectory , getGlobalAgentsDirectory , getProjectAgentsDirectoryForCwd } from "../roo-config"
@@ -316,7 +317,7 @@ export class SkillsManager {
316317
317318 try {
318319 // Use gray-matter to parse frontmatter
319- const { data : frontmatter } = matter ( fileContent )
320+ const { data : frontmatter } = parseFrontmatter ( fileContent )
320321
321322 // Validate required fields (only name and description for now)
322323 if ( ! frontmatter . name || typeof frontmatter . name !== "string" ) {
@@ -490,7 +491,7 @@ export class SkillsManager {
490491
491492 // Read skill content from disk
492493 const fileContent = await fs . readFile ( skill . path , "utf-8" )
493- const { content : body } = matter ( fileContent )
494+ const { content : body } = parseFrontmatter ( fileContent )
494495
495496 return {
496497 ...skill ,
@@ -945,7 +946,7 @@ Add your skill instructions here.
945946
946947 // Read the current SKILL.md file
947948 const fileContent = await fs . readFile ( skill . path , "utf-8" )
948- const { data : frontmatter , content : body } = matter ( fileContent )
949+ const { data : frontmatter , content : body } = parseFrontmatter ( fileContent )
949950
950951 // Update the frontmatter with new modeSlugs
951952 if ( newModeSlugs && newModeSlugs . length > 0 ) {
@@ -959,7 +960,7 @@ Add your skill instructions here.
959960 }
960961
961962 // Serialize back to SKILL.md format
962- const newContent = matter . stringify ( body , frontmatter )
963+ const newContent = matter . stringify ( { content : body } , frontmatter )
963964 await fs . writeFile ( skill . path , newContent , "utf-8" )
964965
965966 // Refresh skills list
0 commit comments