/** * Quote-back formatter (DRAFT-001 v0.3.0 B2). * * Produces the markdown block that the cockpit pushes into the chat * editor when the user commits a line-selection. The first line is a * machine-readable reference; the rest is the quoted content. A * trailing blank line + cursor lands the user ready to type their * question. * * Format (line-granular; column precision is a v0.x non-goal): * * > sdd:#L-L * > * > * … * * */ export function formatQuote( relPath: string, startLine1Based: number, endLine1Based: number, selectedLines: string[], ): string { const ref = `> sdd:${relPath}#L${startLine1Based}-L${endLine1Based}`; const body = selectedLines.map((l) => (l.length === 0 ? ">" : `> ${l}`)).join("\n"); // Trailing blank line so the editor cursor sits one line below the quote. return `${ref}\n${body}\n\n`; }