"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderOnboardingGuideJson = renderOnboardingGuideJson;
exports.renderOnboardingGuideMarkdown = renderOnboardingGuideMarkdown;
function renderStringList(values) {
    if (values.length === 0) {
        return '- (none)';
    }
    return values.map((value) => `- ${value}`).join('\n');
}
function renderOnboardingGuideJson(model) {
    return `${JSON.stringify(model, null, 2)}\n`;
}
function renderOnboardingGuideMarkdown(model) {
    const modulesOverview = model.modules.length === 0
        ? '- (none)'
        : model.modules.map((moduleEntry) => `- ${moduleEntry.moduleName}`).join('\n');
    const dependencies = model.dependencySummary.edges.length === 0
        ? '- (none)'
        : model.dependencySummary.edges
            .map((edge) => `- ${edge.source} -> ${edge.target} (imports: ${edge.importCount})`)
            .join('\n');
    const cycles = model.cycles.length === 0
        ? '- (none)'
        : model.cycles
            .map((cycle) => cycle.length > 0 ? `- ${cycle.join(' -> ')} -> ${cycle[0]}` : '- (none)')
            .join('\n');
    const moduleSections = model.modules.length === 0
        ? '- (none)'
        : model.modules
            .map((moduleEntry) => {
            const recommendedFiles = moduleEntry.recommendedFirstFiles.length === 0
                ? '- (none)'
                : moduleEntry.recommendedFirstFiles
                    .map((filePath) => `- ${filePath}`)
                    .join('\n');
            return `### ${moduleEntry.moduleName}
- Path: ${moduleEntry.path}
- Contract: ${moduleEntry.contractExists
                ? `present (${moduleEntry.contractPath ?? 'unknown path'})`
                : `missing${moduleEntry.contractPath ? ` (${moduleEntry.contractPath})` : ''}`}
- README: ${moduleEntry.readmeExists ? `present (${moduleEntry.readmePath})` : `missing (${moduleEntry.readmePath})`}
- index.ts: ${moduleEntry.indexExists ? `present (${moduleEntry.indexPath})` : `missing (${moduleEntry.indexPath})`}
- Incoming dependency count: ${moduleEntry.incomingDependencyCount}
- Outgoing dependency count: ${moduleEntry.outgoingDependencyCount}
- Participates in cycle: ${moduleEntry.participatesInCycle ? 'yes' : 'no'}
- Orphaned: ${moduleEntry.orphan ? 'yes' : 'no'}
- Public entrypoint mismatch: ${moduleEntry.missingPublicEntrypointAlignment === undefined
                ? 'n/a'
                : moduleEntry.missingPublicEntrypointAlignment
                    ? 'yes'
                    : 'no'}

Recommended first files to open:
${recommendedFiles}`;
        })
            .join('\n\n');
    const suggestedReadingOrder = model.suggestedReadingOrder.length === 0
        ? '- (none)'
        : model.suggestedReadingOrder
            .map((entry, index) => `- ${index + 1}. ${entry.moduleName} (${entry.reason})${entry.participatesInCycle ? ' [cycle]' : ''}`)
            .join('\n');
    const highRiskModules = model.highRiskModules.length === 0
        ? '- (none)'
        : model.highRiskModules
            .map((entry) => `- ${entry.moduleName} (score: ${entry.riskScore}) | ${entry.reasons.join(', ')}`)
            .join('\n');
    return `# ArchPilot Onboarding Guide

- Project: ${model.projectName}
- Generated at (UTC): ${model.generatedAtUtc}
- Report version: ${model.reportVersion}

ArchPilot discovered the current architecture shape from repository modules, module contracts, and cross-module dependencies.

## Modules Overview
${modulesOverview}

## Module-by-Module Summary
${moduleSections}

## Dependency Overview
- Module dependency edges: ${model.summary.edgeCount}
- Cross-module import references: ${model.dependencySummary.totalCrossModuleImports}

${dependencies}

## Cycle Summary
${cycles}

## Orphan Modules Summary
${renderStringList(model.orphanModules)}

## Missing Contracts Summary
${renderStringList(model.missingContracts)}

## Public Entrypoint Mismatch Summary
${renderStringList(model.publicEntrypointMismatches)}

## Suggested Reading Order
${suggestedReadingOrder}

## High-Risk Modules To Inspect First
${highRiskModules}

## How To Use This With ArchPilot
- Run \`archpilot map\` to refresh architecture discovery artifacts.
- Run \`archpilot baseline check\` to detect drift against approved architecture baseline.
- Run \`archpilot validate --ci\` for deterministic architecture validation in CI.
- Run \`archpilot review pr\` to produce PR-ready architecture review content.
`.trimEnd() + '\n';
}
//# sourceMappingURL=onboardingDocsReporter.js.map