// engine/agent-ready-exporter/formatters/kiro.ts — Kiro EARS format — SPEC-318
/**
 * Convert a success criterion to EARS (Easy Approach to Requirements Syntax) format.
 * Pattern: "WHEN <trigger> THE SYSTEM SHALL <response>"
 */
function toEarsFormat(criterion) {
    const lower = criterion.toLowerCase();
    if (lower.startsWith('when ') || lower.startsWith('the system')) {
        return criterion;
    }
    return `THE SYSTEM SHALL ${criterion}`;
}
/**
 * Augment an AgentReadySpec with Kiro-specific EARS requirements and steering context.
 */
export function formatKiro(spec) {
    const requirements = spec.agent_context.success_criteria.map((criterion, idx) => ({
        id: `REQ-${String(idx + 1).padStart(3, '0')}`,
        ears_format: toEarsFormat(criterion),
        original: criterion,
    }));
    const kiroSpec = {
        ...spec,
        _format: 'kiro',
        kiro_requirements: requirements,
        steering: {
            product: `Implement ${spec.title} following the success criteria`,
            tech: spec.agent_context.constraints.join('; ') || 'Follow existing project conventions',
            structure: 'Respect the files_to_create and files_to_modify boundaries',
        },
    };
    return JSON.stringify(kiroSpec, null, 2);
}
//# sourceMappingURL=kiro.js.map