// tools/create-spec-hu/local-first-hu-adapter.ts — SPEC-047
// Builds local-first architecture criteria sections for HU.md.
import { generateCrdtCriteria, formatCrdtCriteriaAsLines, generateSyncCriteria, formatSyncCriteriaAsLines, generateOfflineCriteria, generateSchemaEvolutionCriteria, formatSchemaEvolutionAsLines, generateUxSyncStateCriteria, detectTargetPlatform, } from '../../engine/local-first/index.js';
/**
 * Build local-first sections for HU.md.
 * Emits CRDT criteria, sync protocol, offline storage, schema evolution, and UX sync state
 * when the project has local-first signals detected.
 */
export function buildLocalFirstHuSection(knowledge) {
    if (!knowledge) {
        return [];
    }
    const detection = knowledge.localFirst;
    if (!detection?.isLocalFirst) {
        return [];
    }
    const crdtCriteria = generateCrdtCriteria(detection.crdtLibrary);
    const crdtLines = formatCrdtCriteriaAsLines(crdtCriteria);
    const syncCriteria = generateSyncCriteria(detection.syncBackend);
    const syncLines = formatSyncCriteriaAsLines(syncCriteria);
    const platform = detectTargetPlatform(knowledge.framework, knowledge.stack);
    const offlineLines = generateOfflineCriteria(detection.localStorageEngine, platform);
    const schemaEvolutionCriteria = generateSchemaEvolutionCriteria();
    const schemaLines = formatSchemaEvolutionAsLines(schemaEvolutionCriteria);
    const uxLines = generateUxSyncStateCriteria();
    return [...crdtLines, ...syncLines, ...offlineLines, ...schemaLines, ...uxLines];
}
//# sourceMappingURL=local-first-hu-adapter.js.map