From 579238f3f394720311118211d73676ba275db886 Mon Sep 17 00:00:00 2001 From: Matthias Neumayer Date: Thu, 19 Mar 2026 14:27:04 +0100 Subject: [PATCH 1/3] fix: waiting UI cleanup, dead code removal, and review prompt improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove redundant .padEnd() after truncateToWidth(..., true) which already pads to the target visual width - Move waitingUI above try block so the catch path can properly dismiss and await the TUI overlay before showing the error notification - Guard empty feedback: skip editor insertion when there are no comments or overall notes, show 'No feedback to insert' instead - Change review prompt from 'Please address the following feedback' to 'Address the following code review feedback:' — primes the model better by signaling this is code review context, and saves tokens by dropping the unnecessary 'please' --- src/index.ts | 17 +++++++++++------ src/prompt.ts | 9 ++++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index e441bd6..6144c06 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,7 @@ export default function (pi: ExtensionAPI) { ]; return [ borderTop, - ...lines.map((line) => `${theme.fg("border", "│")}${truncateToWidth(line, innerWidth, "...", true).padEnd(innerWidth, " ")}${theme.fg("border", "│")}`), + ...lines.map((line) => `${theme.fg("border", "│")}${truncateToWidth(line, innerWidth, "...", true)}${theme.fg("border", "│")}`), borderBottom, ]; }, @@ -111,10 +111,10 @@ export default function (pi: ExtensionAPI) { }); activeWindow = window; - const waitingUI = showWaitingUI(ctx); - ctx.ui.notify("Opened native diff review window.", "info"); + const waitingUI = showWaitingUI(ctx); + try { const windowMessagePromise = new Promise((resolve, reject) => { let settled = false; @@ -184,10 +184,15 @@ export default function (pi: ExtensionAPI) { } const prompt = composeReviewPrompt(files, message); - ctx.ui.setEditorText(prompt); - ctx.ui.notify("Inserted diff review feedback into the editor.", "info"); + if (prompt.length > 0) { + ctx.ui.setEditorText(prompt); + ctx.ui.notify("Inserted diff review feedback into the editor.", "info"); + } else { + ctx.ui.notify("No feedback to insert.", "info"); + } } catch (error) { - activeWaitingUIDismiss?.(); + waitingUI.dismiss(); + await waitingUI.promise; closeActiveWindow(); const message = error instanceof Error ? error.message : String(error); ctx.ui.notify(`Diff review failed: ${message}`, "error"); diff --git a/src/prompt.ts b/src/prompt.ts index ec1ee99..69d7e8d 100644 --- a/src/prompt.ts +++ b/src/prompt.ts @@ -15,10 +15,13 @@ export function composeReviewPrompt(files: DiffReviewFile[], payload: ReviewSubm const fileMap = new Map(files.map((file) => [file.id, file])); const lines: string[] = []; - lines.push("Please address the following feedback"); - lines.push(""); - const overallComment = payload.overallComment.trim(); + const hasFeedback = overallComment.length > 0 || payload.comments.length > 0; + if (hasFeedback) { + lines.push("Address the following code review feedback:"); + lines.push(""); + } + if (overallComment.length > 0) { lines.push(overallComment); lines.push(""); From 81b0cb15fcee708b8e20eaa6f81fe84befd0dde1 Mon Sep 17 00:00:00 2001 From: Matthias Neumayer Date: Thu, 19 Mar 2026 14:35:05 +0100 Subject: [PATCH 2/3] fix: remove notification for empty feedback insertion in diff review --- src/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 6144c06..c017f3a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -187,8 +187,6 @@ export default function (pi: ExtensionAPI) { if (prompt.length > 0) { ctx.ui.setEditorText(prompt); ctx.ui.notify("Inserted diff review feedback into the editor.", "info"); - } else { - ctx.ui.notify("No feedback to insert.", "info"); } } catch (error) { waitingUI.dismiss(); From aeac19682dd0bc727a2e4ae1f874e2de3982bb78 Mon Sep 17 00:00:00 2001 From: newme616 Date: Mon, 18 May 2026 08:47:06 +0200 Subject: [PATCH 3/3] Make husky prepare script tolerate missing dev deps When pi installs this extension with `npm install --omit=dev`, husky is not present and the `prepare` script fails with exit code 127, breaking installation. Appending `|| true` keeps the hook setup as a no-op in production installs while preserving the dev workflow. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f68fb3..97f64e5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "check": "tsgo --noEmit", - "prepare": "husky" + "prepare": "husky || true" }, "pi": { "extensions": [