// Skill content generators — markdown-based skill files
export function generateProjectRulesSkill(config, name, description, knowledge) {
    const content = [
        `# ${name}`,
        '',
        description,
        '',
        '## Stack',
        `- Language: ${knowledge.language}`,
        `- Framework: ${knowledge.framework ?? 'none'}`,
        `- Database: ${knowledge.database}`,
        `- Architecture: ${knowledge.architecture.primary}`,
        '',
        '## Rules',
        '',
        ...knowledge.qualityProfile.principles.map((p) => `- Follow ${p}`),
        '',
        '## Layers',
        '',
        ...knowledge.architecture.layers.map((l) => `- **${l.name}** (${l.directories.join(', ')}): ${l.responsibility}`),
    ].join('\n');
    const path = config.skillsDir
        ? `${config.skillsDir}${name.toLowerCase().replace(/\s+/g, '-')}.md`
        : config.rulesFile;
    return { path, content, format: config.format };
}
export function generateDomainSkill(config, name, description, knowledge, specContent) {
    const slug = name.toLowerCase().replace(/\s+/g, '-');
    const agentSlug = `${slug}-agent`;
    const content = [
        `# ${name}`,
        '',
        description,
        '',
        '## Context',
        `This skill is for the ${knowledge.language}/${knowledge.framework ?? 'native'} project.`,
        '',
        specContent ? '## Spec Content' : '',
        specContent ?? '',
        '',
        '## Phases',
        '',
        '1. **Understand** — Read spec criteria, review existing code, identify affected modules',
        '2. **Implement** — Write code following architecture patterns and project conventions',
        '3. **Validate** — Run tests, typecheck, lint; verify all spec criteria pass',
        '4. **Track** — Update PROGRESS.md or spec status with session results',
        '5. **Commit** — Commit with conventional commit message (feat/fix/refactor)',
        '',
        '## Guidelines',
        '',
        '- Follow the project architecture patterns.',
        '- Write tests for all new functionality.',
        '- Handle errors explicitly.',
        '- Keep functions small and focused.',
        '',
        '## 3-Layer Automation',
        '',
        `- **Sub-agent**: Generate with \`generate_sub_agent\` → saves to \`agents/${agentSlug}.ts\``,
        `- **Orchestration**: See \`scripts/orchestrate-${slug}.sh\` (generated alongside this skill)`,
        '- The sub-agent handles subtask delegation; this skill manages commit, tracking, pipeline',
    ].join('\n');
    const path = config.skillsDir ? `${config.skillsDir}${slug}.md` : `skills/${slug}.md`;
    return { path, content, format: 'markdown' };
}
export function generateWorkflowSkill(config, name, description, knowledge) {
    const content = [
        `# ${name}`,
        '',
        description,
        '',
        '## Workflow Steps',
        '',
        '1. Check for an existing spec in the specs directory.',
        '2. If no spec exists, create one using the SDD MCP tools.',
        '3. Review the spec and get it approved.',
        '4. Implement following the spec criteria.',
        '5. Validate implementation against the spec.',
        '6. Record actuals (hours, tokens, cost).',
        '',
        '## Commands',
        '',
        knowledge.buildCommand ? `- Build: \`${knowledge.buildCommand}\`` : '',
        knowledge.testCommand ? `- Test: \`${knowledge.testCommand}\`` : '',
        '',
        '## Spec Location',
        '',
        `Specs are in: \`${knowledge.specLocation}\``,
    ]
        .filter(Boolean)
        .join('\n');
    const path = config.skillsDir
        ? `${config.skillsDir}${name.toLowerCase().replace(/\s+/g, '-')}.md`
        : `skills/${name.toLowerCase().replace(/\s+/g, '-')}.md`;
    return { path, content, format: 'markdown' };
}
export function generateConventionSkill(config, name, description, knowledge) {
    const content = [
        `# ${name}`,
        '',
        description,
        '',
        '## Conventions',
        '',
        ...Object.entries(knowledge.conventions).map(([k, v]) => `- **${k}**: ${v}`),
        '',
        '## Quality Standards',
        '',
        `Strictness: ${knowledge.qualityProfile.strictness}`,
        '',
        ...knowledge.qualityProfile.principles.map((p) => `- ${p}`),
        '',
        '## Enabled Categories',
        '',
        ...knowledge.qualityProfile.enabledCategories.map((c) => `- ${c}`),
    ].join('\n');
    const path = config.skillsDir
        ? `${config.skillsDir}${name.toLowerCase().replace(/\s+/g, '-')}.md`
        : `skills/${name.toLowerCase().replace(/\s+/g, '-')}.md`;
    return { path, content, format: 'markdown' };
}
export function generateSddWorkflowSkillContent(knowledge) {
    return [
        '# SDD Workflow Skill',
        '',
        'This skill guides the SDD (Spec Driven Development) workflow.',
        '',
        '## When to Use',
        '',
        'Use this workflow whenever implementing a new feature, refactor, or bugfix.',
        '',
        '## Steps',
        '',
        '1. **Analyze** — Use `sdd_init_project` to analyze the codebase.',
        '2. **Spec** — Use `sdd_create_spec` to create a specification.',
        '3. **Review** — Use `sdd_generate_checklist` to verify spec quality.',
        '4. **Filter** — Apply relevant filters (ADR, schema, UI, resilience, execution plan).',
        '5. **Implement** — Follow the execution plan step by step.',
        '6. **Validate** — Use `sdd_validate_spec` to check compliance.',
        '7. **Complete** — Use `sdd_update_status` to mark as done.',
        '',
        '## Project Info',
        '',
        `- Language: ${knowledge.language}`,
        `- Framework: ${knowledge.framework ?? 'none'}`,
        `- Architecture: ${knowledge.architecture.primary}`,
        `- Specs: ${knowledge.specLocation}`,
    ].join('\n');
}
export function buildInstallInstructions(platform, config, files, skillType) {
    const instructions = [];
    instructions.push(`To install for ${config.name}:`);
    instructions.push('');
    for (const file of files) {
        instructions.push(`1. Save the generated content to \`${file.path}\``);
    }
    if (platform === 'claude-code') {
        instructions.push('');
        instructions.push('Claude Code will automatically detect CLAUDE.md and skills/ directory.');
    }
    else if (platform === 'cursor') {
        instructions.push('');
        instructions.push('Cursor will automatically detect .cursorrules in the project root.');
    }
    else if (platform === 'windsurf') {
        instructions.push('');
        instructions.push('Windsurf will automatically detect .windsurfrules in the project root.');
    }
    if (skillType === 'domain-skill') {
        instructions.push('');
        instructions.push('3-Layer Automation System:');
        instructions.push('   - Run `sdd_generate_sub_agent` to create the complementary sub-agent');
        instructions.push('   - Make the orchestration script executable: chmod +x scripts/orchestrate-*.sh');
        instructions.push('   - The skill, sub-agent, and script are designed to work as a cohesive system');
    }
    return instructions.join('\n');
}
//# sourceMappingURL=skills-content.js.map