import { readPackageJson, readPythonDeps } from './file-readers.js';
import { detectProviderFromNpm, detectProviderFromPython, detectProviderFromEnv, detectFrameworkFromNpm, detectFrameworkFromPython, detectVectorStoreFromNpm, detectVectorStoreFromPython, detectRAGFromSource, detectToolUseFromSource, hasMcpSdk, detectFineTuning, detectEmbeddingsOwn, } from './detectors.js';
import { detectEuAiActRisk } from './eu-ai-detector.js';
export { detectProviderFromNpm, detectProviderFromPython, detectProviderFromEnv, } from './detectors.js';
export { detectFrameworkFromNpm, detectFrameworkFromPython } from './detectors.js';
export { detectVectorStoreFromNpm, detectVectorStoreFromPython } from './detectors.js';
export { detectRAGFromSource, detectToolUseFromSource, hasMcpSdk } from './detectors.js';
export { detectFineTuning, detectEmbeddingsOwn } from './detectors.js';
export { detectEuAiActRisk } from './eu-ai-detector.js';
/**
 * Detect LLM project characteristics including provider, framework, RAG, tool use, fine-tuning.
 * Returns a complete LlmDetectionResult.
 */
export async function detectLlm(projectPath) {
    const [pkg, pythonDeps] = await Promise.all([
        readPackageJson(projectPath),
        readPythonDeps(projectPath),
    ]);
    const allNpmDeps = pkg ? { ...pkg.deps, ...pkg.devDeps } : {};
    // Detect provider
    let provider = detectProviderFromNpm(allNpmDeps) ?? (pythonDeps ? detectProviderFromPython(pythonDeps) : null);
    provider ??= await detectProviderFromEnv(projectPath);
    // If no provider detected, this is not an LLM project
    if (!provider) {
        return {
            isLlmProject: false,
            provider: null,
            framework: 'none',
            hasRAG: false,
            vectorStore: null,
            hasToolUse: false,
            hasFineTuning: false,
            hasEmbeddingsOwn: false,
            euAiActRisk: 'minimal-risk',
            detectedHighRiskDomains: [],
        };
    }
    // Detect framework (check npm first, fall back to Python if none found)
    const npmFramework = detectFrameworkFromNpm(allNpmDeps);
    const framework = npmFramework !== 'none'
        ? npmFramework
        : pythonDeps
            ? detectFrameworkFromPython(pythonDeps)
            : 'none';
    // Detect vectorstore (implies RAG)
    const vectorStore = detectVectorStoreFromNpm(allNpmDeps) ??
        (pythonDeps ? detectVectorStoreFromPython(pythonDeps) : null);
    // Detect RAG from source if no vectorstore found by deps
    const hasRAGFromSource = vectorStore === null ? await detectRAGFromSource(projectPath) : false;
    const hasRAG = vectorStore !== null || hasRAGFromSource;
    // Detect tool use — MCP SDK is a definite signal
    const hasMcp = hasMcpSdk(allNpmDeps);
    const hasToolUse = hasMcp || (await detectToolUseFromSource(projectPath));
    // Detect fine-tuning and own embeddings
    const [hasFineTuning, hasEmbeddingsOwn] = await Promise.all([
        detectFineTuning(projectPath, pythonDeps),
        detectEmbeddingsOwn(projectPath, pythonDeps),
    ]);
    // Detect EU AI Act risk
    const { risk: euAiActRisk, domains: detectedHighRiskDomains } = await detectEuAiActRisk(projectPath);
    return {
        isLlmProject: true,
        provider,
        framework,
        hasRAG,
        vectorStore,
        hasToolUse,
        hasFineTuning,
        hasEmbeddingsOwn,
        euAiActRisk,
        detectedHighRiskDomains,
    };
}
//# sourceMappingURL=index.js.map