/**
 * Codebase Map — structured codebase analysis for autonomous agent understanding.
 * Runs all analyzers and returns a unified CodebaseMapResult.
 * @epic cognitive-cleo
 */
import { detectProjectType } from '../store/project-detect.js';
export async function mapCodebase(projectRoot, options) {
    const projectContext = detectProjectType(projectRoot);
    const [{ analyzeStack }, { analyzeArchitecture }, { analyzeStructure }, { analyzeConventions }, { analyzeTesting }, { analyzeIntegrations }, { analyzeConcerns },] = await Promise.all([
        import('./analyzers/stack.js'),
        import('./analyzers/architecture.js'),
        import('./analyzers/structure.js'),
        import('./analyzers/conventions.js'),
        import('./analyzers/testing.js'),
        import('./analyzers/integrations.js'),
        import('./analyzers/concerns.js'),
    ]);
    const focus = options?.focus;
    const result = {
        projectContext,
        stack: !focus || focus === 'stack'
            ? analyzeStack(projectRoot, projectContext)
            : { languages: [], frameworks: [], dependencies: [] },
        architecture: !focus || focus === 'architecture'
            ? analyzeArchitecture(projectRoot, projectContext)
            : { layers: [], entryPoints: [], patterns: [] },
        structure: !focus || focus === 'structure'
            ? analyzeStructure(projectRoot)
            : { directories: [], totalFiles: 0 },
        conventions: !focus || focus === 'conventions'
            ? analyzeConventions(projectRoot, projectContext)
            : { fileNaming: 'unknown', importStyle: 'unknown' },
        testing: !focus || focus === 'testing'
            ? analyzeTesting(projectRoot, projectContext)
            : {
                framework: 'unknown',
                patterns: [],
                directories: [],
                hasFixtures: false,
                hasMocks: false,
                coverageConfigured: false,
            },
        integrations: !focus || focus === 'integrations'
            ? analyzeIntegrations(projectRoot, projectContext)
            : { apis: [], databases: [], auth: [], cicd: [], containerized: false },
        concerns: !focus || focus === 'concerns'
            ? analyzeConcerns(projectRoot)
            : { todos: [], largeFiles: [], complexity: { high: 0, medium: 0, low: 0 } },
        analyzedAt: new Date().toISOString(),
    };
    if (options?.storeToBrain) {
        const { storeMapToBrain } = await import('./store.js');
        await storeMapToBrain(projectRoot, result);
    }
    return result;
}
//# sourceMappingURL=index.js.map