"use strict";
/**
 * 🩵 FAF Mirror - Convenience Wrapper
 * Simple FAF-specific interface for C-Mirror
 *
 * This wrapper:
 * - Uses FAF defaults (.faf and CLAUDE.md)
 * - Includes FAF-specific validators
 * - Integrates with FAF DNA chain
 * - Provides championship communication
 *
 * Usage:
 *   const mirror = new FAFMirror();
 *   await mirror.sync();
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.FAFMirror = void 0;
const path = __importStar(require("path"));
const mirror_engine_1 = require("../core/mirror-engine");
const terminal_display_1 = require("../broadcast/terminal-display");
class FAFMirror {
    engine;
    projectPath;
    displayStarted = false;
    constructor(projectPath = process.cwd(), options = {}) {
        this.projectPath = projectPath;
        // FAF defaults
        const config = {
            structuredFile: path.join(projectPath, '.faf'),
            readableFile: path.join(projectPath, 'CLAUDE.md'),
            projectPath,
            atomicWrites: true, // Always use safe writes
            selfHealing: true, // Always auto-recover
            dnaChain: {
                enabled: true, // DNA logging
                path: path.join(projectPath, '.faf-dna.json'),
                logLevel: 'standard'
            },
            ...options
        };
        this.engine = new mirror_engine_1.MirrorEngine(config);
    }
    /**
     * Sync .faf ↔ CLAUDE.md
     * With championship terminal display
     */
    async sync() {
        // Start terminal display (listens to events)
        if (!this.displayStarted) {
            (0, terminal_display_1.startTerminalDisplay)();
            this.displayStarted = true;
        }
        // Run the sync
        const result = await this.engine.sync();
        return result;
    }
    /**
     * Stop display (cleanup)
     */
    stop() {
        if (this.displayStarted) {
            (0, terminal_display_1.stopTerminalDisplay)();
            this.displayStarted = false;
        }
    }
}
exports.FAFMirror = FAFMirror;
//# sourceMappingURL=faf-mirror.js.map