// engine/skill-generator/sections-docs.ts — SPEC-384
// Builds an official documentation section for generated skills.
/**
 * Builds a "Official Documentation References" markdown section for a skill.
 * Includes best practices, anti-patterns, and tooling from official docs.
 * Returns empty string if no useful data (source is 'fallback').
 */
export function buildDocAwareSection(tech, docs) {
    if (docs.source === 'fallback') {
        return '';
    }
    const lines = [`## ${tech} — Official Documentation`];
    if (docs.docsUrl) {
        lines.push(``, `> Source: ${docs.docsUrl}`);
    }
    if (docs.bestPractices.length > 0) {
        lines.push('', '### Best Practices');
        for (const bp of docs.bestPractices.slice(0, 5)) {
            lines.push(`- ${bp}`);
        }
    }
    if (docs.antiPatterns.length > 0) {
        lines.push('', '### Anti-Patterns to Avoid');
        for (const ap of docs.antiPatterns.slice(0, 3)) {
            lines.push(`- ⚠️ ${ap}`);
        }
    }
    if (docs.toolingRecommendations.length > 0) {
        lines.push('', '### Recommended Tooling');
        for (const tool of docs.toolingRecommendations.slice(0, 3)) {
            lines.push(`- ${tool}`);
        }
    }
    if (docs.versionNotes.length > 0) {
        lines.push('', '### Version Notes');
        for (const note of docs.versionNotes.slice(0, 2)) {
            lines.push(`- ${note}`);
        }
    }
    return lines.join('\n');
}
/**
 * Builds doc-aware sections for multiple techs.
 * Returns concatenated sections, skipping empty ones (fallback sources).
 */
export function buildDocAwareSections(docsMap) {
    const sections = [];
    for (const [tech, docs] of docsMap) {
        const section = buildDocAwareSection(tech, docs);
        if (section) {
            sections.push(section);
        }
    }
    if (sections.length === 0) {
        return '';
    }
    return ['', '---', '', '## Official Documentation References', '', ...sections].join('\n');
}
//# sourceMappingURL=sections-docs.js.map