2026-02-08 16:21:19 +09:00
|
|
|
import { readFileSync } from "node:fs"
|
|
|
|
|
import { parseFrontmatter } from "../../shared/frontmatter"
|
|
|
|
|
import type { LoadedSkill } from "./types"
|
|
|
|
|
|
|
|
|
|
export function extractSkillTemplate(skill: LoadedSkill): string {
|
2026-03-28 15:24:18 +09:00
|
|
|
if (skill.scope === "config" && skill.definition.template) {
|
|
|
|
|
return skill.definition.template
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (skill.path) {
|
|
|
|
|
const content = readFileSync(skill.path, "utf-8")
|
|
|
|
|
const { body } = parseFrontmatter(content)
|
2026-02-08 16:21:19 +09:00
|
|
|
return body.trim()
|
|
|
|
|
}
|
|
|
|
|
return skill.definition.template || ""
|
|
|
|
|
}
|