/**
 * Build search queries based on project context and category.
 * Returns an array of search terms optimized for web search.
 */
export function buildSearchQueries(category, context) {
    const year = new Date().getFullYear();
    const stackStr = context.stack.join(' ');
    const queryBuilders = {
        frameworks: () => [
            `best ${context.target} frameworks ${stackStr} ${year}`,
            `${stackStr} recommended libraries tools ${year}`,
            ...(context.appType ? [`best frameworks for ${context.appType} ${year}`] : []),
        ],
        security: () => [
            `OWASP top 10 ${year} ${context.target} security`,
            `${stackStr} security best practices ${year}`,
            `${stackStr} common vulnerabilities prevention ${year}`,
            ...(context.target === 'frontend' ? [`XSS CSRF prevention ${stackStr} ${year}`] : []),
            ...(context.target === 'backend' ? [`SQL injection API security ${stackStr} ${year}`] : []),
        ],
        pricing: () => [
            `LLM API pricing comparison ${year}`,
            `Claude OpenAI Gemini pricing per token ${year}`,
            `AI model costs ${year} latest`,
        ],
        tooling: () => [
            `${stackStr} recommended dev tools ${year}`,
            `${context.target} tooling ecosystem ${stackStr} ${year}`,
            ...(context.appType ? [`${context.appType} tooling stack ${year}`] : []),
        ],
        patterns: () => [
            `${context.target} architecture patterns ${year}`,
            `${stackStr} anti-patterns common bugs ${year}`,
            `resilience patterns ${context.target} ${year}`,
            `${stackStr} scalability best practices ${year}`,
            ...(context.scope === 'architectural' ? [`distributed systems patterns ${year}`] : []),
        ],
        compliance: () => [
            `data privacy regulations ${year}`,
            `GDPR CCPA compliance requirements ${year}`,
            `${context.target} data protection checklist ${year}`,
        ],
        platforms: () => [
            `${context.target} deployment platforms comparison ${year}`,
            `best hosting ${stackStr} ${year}`,
            `serverless edge deployment ${stackStr} ${year}`,
        ],
    };
    return queryBuilders[category]();
}
/**
 * Determine which categories are relevant for a given project context.
 */
export function resolveRelevantCategories(context) {
    const categories = ['patterns', 'security']; // always relevant
    if (context.target === 'frontend' || context.target === 'fullstack') {
        categories.push('frameworks');
    }
    if (context.target === 'backend' || context.target === 'fullstack') {
        categories.push('tooling', 'platforms');
    }
    if (context.scope === 'architectural' || context.scope === 'cross-module') {
        categories.push('compliance');
    }
    // Deduplicate
    return [...new Set(categories)];
}
/**
 * Build a normalized context key for caching.
 */
export function normalizeContext(context) {
    return {
        stack: [...context.stack].sort(),
        target: context.target,
        scope: context.scope,
        ...(context.appType ? { appType: context.appType } : {}),
        ...(context.language ? { language: context.language } : {}),
    };
}
//# sourceMappingURL=context-resolver.js.map