import { parseFrontmatter, stringifyFrontmatter } from '../utils/markers.js'; /** * Transform a buildcrew agent markdown file into a platform-specific agent file. * Preserves name, description, and mode (if present) from the original frontmatter * so that OpenCode primary/subagent semantics carry through to the target platform. * Other buildcrew-specific frontmatter fields such as temperature are intentionally * stripped because they are platform-agnostic and not part of the target schema. */ export function transformAgent(content, recipe) { const { frontmatter, body } = parseFrontmatter(content); const targetFrontmatter = { name: recipe.name, description: frontmatter?.description || `${recipe.name} agent` }; if (frontmatter?.mode) { targetFrontmatter.mode = frontmatter.mode; } return stringifyFrontmatter(targetFrontmatter) + '\n\n' + body; }