import { simplematter } from "simplematter";
import { stringify } from "yaml";

//#region src/utils/skill-files.ts
const SKILL_ENTRY_FILE_PATH = "SKILL.md";
function parseSkillFromMarkdown(markdown) {
	const [frontmatter, content] = simplematter(markdown);
	return {
		frontmatter,
		content
	};
}
function serializeSkillToMarkdown({ name, description, metadata, content }) {
	metadata ??= void 0;
	return [
		"---",
		stringify({
			name,
			description,
			metadata
		}).trimEnd(),
		"---",
		"",
		content
	].join("\n");
}

//#endregion
export { SKILL_ENTRY_FILE_PATH, parseSkillFromMarkdown, serializeSkillToMarkdown };