From cff06c9a546c6f942415739aba3c6295428ae1d0 Mon Sep 17 00:00:00 2001 From: dotta Date: Fri, 20 Mar 2026 15:44:22 -0500 Subject: [PATCH] Add issue titles to worktree merge preview Co-Authored-By: Paperclip --- cli/src/commands/worktree.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cli/src/commands/worktree.ts b/cli/src/commands/worktree.ts index 46e6e307..1f9bfbdf 100644 --- a/cli/src/commands/worktree.ts +++ b/cli/src/commands/worktree.ts @@ -1246,6 +1246,13 @@ function renderMergePlan(plan: Awaited>["pla unsupportedRunCount: number; unsupportedDocumentCount: number; }): string { + const terminalWidth = Math.max(60, process.stdout.columns ?? 100); + const oneLine = (value: string) => value.replace(/\s+/g, " ").trim(); + const truncateToWidth = (value: string, maxWidth: number) => { + if (maxWidth <= 1) return ""; + if (value.length <= maxWidth) return value; + return `${value.slice(0, Math.max(0, maxWidth - 1)).trimEnd()}…`; + }; const lines = [ `Mode: preview`, `Source: ${extras.sourcePath}`, @@ -1268,8 +1275,11 @@ function renderMergePlan(plan: Awaited>["pla ? ` project->${issue.mappedProjectName}` : ""; const adjustments = issue.adjustments.length > 0 ? ` [${issue.adjustments.join(", ")}]` : ""; + const prefix = `- ${issue.source.identifier ?? issue.source.id} -> ${issue.previewIdentifier} (${issue.targetStatus}${projectNote})`; + const title = oneLine(issue.source.title); + const suffix = `${adjustments}${title ? ` ${title}` : ""}`; lines.push( - `- ${issue.source.identifier ?? issue.source.id} -> ${issue.previewIdentifier} (${issue.targetStatus}${projectNote})${adjustments}`, + `${prefix}${truncateToWidth(suffix, Math.max(8, terminalWidth - prefix.length))}`, ); } }