import fs from 'node:fs';
import path from 'node:path';
const ENGINE_FILE = '.engine';
export function getEngine() {
    const cwd = process.cwd();
    const engineFile = path.join(cwd, ENGINE_FILE);
    if (fs.existsSync(engineFile)) {
        const content = fs.readFileSync(engineFile, 'utf-8').trim();
        if (content === 'claude-code' || content === 'opencode' || content === 'auto') {
            return content;
        }
    }
    const envEngine = process.env.AGENT_ENGINE;
    if (envEngine === 'claude-code' || envEngine === 'opencode' || envEngine === 'auto') {
        return envEngine;
    }
    return 'auto';
}
export function setEngine(engine) {
    const cwd = process.cwd();
    const engineFile = path.join(cwd, ENGINE_FILE);
    fs.writeFileSync(engineFile, engine, 'utf-8');
}
//# sourceMappingURL=engine-config.js.map