import type { MarkdownDocument } from './output-generator' /** * Generate agent instructions prompt for AI assistants */ export function generateAgentPrompt( documents: MarkdownDocument[], sourceUrl: string, siteName: string ): string { const topics = documents.map((d) => d.title).slice(0, 20) const extractionDate = new Date().toISOString().split('T')[0] return `# Agent Instructions for ${siteName} ## Context You have access to the complete documentation for ${siteName}, extracted from ${sourceUrl}. ## Documentation Overview This documentation contains ${documents.length} sections covering: ${topics.map((t) => `- ${t}`).join('\n')}${documents.length > 20 ? '\n- ...and more' : ''} ## How to Use This Documentation ### Finding Information 1. Use the Table of Contents in FULL-DOCUMENTATION.md to locate topics 2. Individual section files are in the /sections folder 3. Search for specific keywords within files ### When Asked Questions About ${siteName} 1. Reference the specific section that answers the question 2. Quote relevant code examples directly 3. Provide links to the original documentation when helpful ### Code Examples When providing code examples from this documentation: - Always show the complete, working code - Include necessary imports - Add comments explaining key parts ## Quick Reference **Installation:** \`\`\`bash # Check the Getting Started or Installation section \`\`\` **Basic Usage:** \`\`\` # Check the Quick Start or Basic Usage section \`\`\` ## Documentation Statistics - **Total Sections:** ${documents.length} - **Total Words:** ${documents.reduce((s, d) => s + d.wordCount, 0).toLocaleString()} - **Source URL:** ${sourceUrl} ## Important Notes - This documentation was extracted on ${extractionDate} - For the most up-to-date information, visit ${sourceUrl} - Report any issues with this extraction to the user --- *Generated by llm.energy* ` } /** * Generate a condensed system prompt for chat interfaces */ export function generateSystemPrompt( documents: MarkdownDocument[], sourceUrl: string, siteName: string ): string { const topics = documents .slice(0, 10) .map((d) => d.title) .join(', ') return `You are an expert on ${siteName}. You have been provided with the complete official documentation from ${sourceUrl}. Key topics covered: ${topics}${documents.length > 10 ? ', and more' : ''}. When answering questions: 1. Reference specific sections from the documentation 2. Provide accurate code examples as shown in the docs 3. Link to relevant sections when helpful 4. Be precise and cite the documentation Total documentation: ${documents.length} sections, ${documents.reduce((s, d) => s + d.wordCount, 0).toLocaleString()} words.` } /** * Generate a quick reference card */ export function generateQuickReference( documents: MarkdownDocument[], siteName: string ): string { const sections = documents.slice(0, 15) return `# ${siteName} Quick Reference ## Available Sections ${sections.map((doc, i) => `${i + 1}. **${doc.title}** (${doc.wordCount} words)`).join('\n')} ${documents.length > 15 ? `\n...and ${documents.length - 15} more sections` : ''} ## Tips for AI Assistants - Start with the Table of Contents in FULL-DOCUMENTATION.md - Use section files for focused queries - Quote code examples directly from the docs - Always verify information against the source --- *Quick Reference Card - Generated by llm.energy* ` }