// Planu — Prior Decisions YAML Formatter (SPEC-615)
// Converts PriorDecisionLink[] into a YAML block for spec frontmatter.
// Per AC4: empty input → empty string (field omitted, not rendered as empty list).
/**
 * Produce a YAML priorDecisions block suitable for embedding in spec frontmatter.
 *
 * Returns empty string when the array is empty so callers can omit the field
 * entirely (Acceptance Criterion 4).
 *
 * Example output (non-empty):
 * ```yaml
 * priorDecisions:
 *   - id: DEC-123
 *     title: "Use JWT over sessions"
 *     relevance: 0.85
 * ```
 */
export function formatPriorDecisions(links) {
    if (links.length === 0) {
        return '';
    }
    const lines = ['priorDecisions:'];
    for (const link of links) {
        const safeTitle = link.title.replace(/"/g, '\\"');
        lines.push(`  - id: ${link.decisionId}`);
        lines.push(`    title: "${safeTitle}"`);
        lines.push(`    relevance: ${link.relevanceScore}`);
    }
    return lines.join('\n');
}
//# sourceMappingURL=formatter.js.map