/**
 * Skill Generation Utilities
 *
 * Shared utilities for generating skill and command files.
 */
import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getBulkArchiveChangeSkillTemplate, getVerifyChangeSkillTemplate, getOnboardSkillTemplate, getProxProposeSkillTemplate, getProxExploreCommandTemplate, getProxNewCommandTemplate, getProxContinueCommandTemplate, getProxApplyCommandTemplate, getProxFfCommandTemplate, getProxSyncCommandTemplate, getProxArchiveCommandTemplate, getProxBulkArchiveCommandTemplate, getProxVerifyCommandTemplate, getProxOnboardCommandTemplate, getProxProposeCommandTemplate, } from '../templates/skill-templates.js';
/**
 * Gets skill templates with their directory names, optionally filtered by workflow IDs.
 *
 * @param workflowFilter - If provided, only return templates whose workflowId is in this array
 */
export function getSkillTemplates(workflowFilter) {
    const all = [
        { template: getExploreSkillTemplate(), dirName: 'projectx-explore', workflowId: 'explore' },
        { template: getNewChangeSkillTemplate(), dirName: 'projectx-new-change', workflowId: 'new' },
        { template: getContinueChangeSkillTemplate(), dirName: 'projectx-continue-change', workflowId: 'continue' },
        { template: getApplyChangeSkillTemplate(), dirName: 'projectx-apply-change', workflowId: 'apply' },
        { template: getFfChangeSkillTemplate(), dirName: 'projectx-ff-change', workflowId: 'ff' },
        { template: getSyncSpecsSkillTemplate(), dirName: 'projectx-sync-specs', workflowId: 'sync' },
        { template: getArchiveChangeSkillTemplate(), dirName: 'projectx-archive-change', workflowId: 'archive' },
        { template: getBulkArchiveChangeSkillTemplate(), dirName: 'projectx-bulk-archive-change', workflowId: 'bulk-archive' },
        { template: getVerifyChangeSkillTemplate(), dirName: 'projectx-verify-change', workflowId: 'verify' },
        { template: getOnboardSkillTemplate(), dirName: 'projectx-onboard', workflowId: 'onboard' },
        { template: getProxProposeSkillTemplate(), dirName: 'projectx-propose', workflowId: 'propose' },
    ];
    if (!workflowFilter)
        return all;
    const filterSet = new Set(workflowFilter);
    return all.filter(entry => filterSet.has(entry.workflowId));
}
/**
 * Gets command templates with their IDs, optionally filtered by workflow IDs.
 *
 * @param workflowFilter - If provided, only return templates whose id is in this array
 */
export function getCommandTemplates(workflowFilter) {
    const all = [
        { template: getProxExploreCommandTemplate(), id: 'explore' },
        { template: getProxNewCommandTemplate(), id: 'new' },
        { template: getProxContinueCommandTemplate(), id: 'continue' },
        { template: getProxApplyCommandTemplate(), id: 'apply' },
        { template: getProxFfCommandTemplate(), id: 'ff' },
        { template: getProxSyncCommandTemplate(), id: 'sync' },
        { template: getProxArchiveCommandTemplate(), id: 'archive' },
        { template: getProxBulkArchiveCommandTemplate(), id: 'bulk-archive' },
        { template: getProxVerifyCommandTemplate(), id: 'verify' },
        { template: getProxOnboardCommandTemplate(), id: 'onboard' },
        { template: getProxProposeCommandTemplate(), id: 'propose' },
    ];
    if (!workflowFilter)
        return all;
    const filterSet = new Set(workflowFilter);
    return all.filter(entry => filterSet.has(entry.id));
}
/**
 * Converts command templates to CommandContent array, optionally filtered by workflow IDs.
 *
 * @param workflowFilter - If provided, only return contents whose id is in this array
 */
export function getCommandContents(workflowFilter) {
    const commandTemplates = getCommandTemplates(workflowFilter);
    return commandTemplates.map(({ template, id }) => ({
        id,
        name: template.name,
        description: template.description,
        category: template.category,
        tags: template.tags,
        body: template.content,
    }));
}
/**
 * Generates skill file content with YAML frontmatter.
 *
 * @param template - The skill template
 * @param generatedByVersion - The ProjectX version to embed in the file
 * @param transformInstructions - Optional callback to transform the instructions content
 */
export function generateSkillContent(template, generatedByVersion, transformInstructions) {
    const instructions = transformInstructions
        ? transformInstructions(template.instructions)
        : template.instructions;
    return `---
name: ${template.name}
description: ${template.description}
license: ${template.license || 'MIT'}
compatibility: ${template.compatibility || 'Requires projectx CLI.'}
metadata:
  author: ${template.metadata?.author || 'projectx'}
  version: "${template.metadata?.version || '1.0'}"
  generatedBy: "${generatedByVersion}"
---

${instructions}
`;
}
//# sourceMappingURL=skill-generation.js.map