import { formatCommandGateFailure } from './commandGateMessage.js';
import { runCommandQualityGate } from './commandGateRunner.js';
function createFailureResponse(content, persona) {
    return {
        persona,
        status: 'done',
        content,
        timestamp: new Date(),
    };
}
export async function runQualityGates({ qualityGates, projectRoot, step, }) {
    if (!qualityGates || qualityGates.length === 0) {
        return { ok: true };
    }
    for (const gate of qualityGates) {
        if (typeof gate === 'string') {
            continue;
        }
        const result = await runCommandQualityGate({ gate, projectRoot });
        if (!result.ok) {
            return {
                ok: false,
                response: createFailureResponse(formatCommandGateFailure(result.failure), step.name),
            };
        }
    }
    return { ok: true };
}
//# sourceMappingURL=qualityGateRunner.js.map