Skip to content

Commit 63fd274

Browse files
backnotpropclaude
andcommitted
revert: remove code review and annotate from shared templates
Scope-crept into code review/annotate feedback which introduced a double heading regression and dropped integration-specific strings. Reverts those paths to their original inline strings; shared module now only covers plan deny feedback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a828aa9 commit 63fd274

5 files changed

Lines changed: 17 additions & 79 deletions

File tree

apps/hook/server/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import { resolveMarkdownFile } from "@plannotator/server/resolve-file";
4949
import { registerSession, unregisterSession, listSessions } from "@plannotator/server/sessions";
5050
import { openBrowser } from "@plannotator/server/browser";
5151
import { detectProjectName } from "@plannotator/server/project";
52-
import { planDenyFeedback, codeReviewFeedback, codeReviewApproved, annotateFeedback } from "@plannotator/shared/feedback-templates";
52+
import { planDenyFeedback } from "@plannotator/shared/feedback-templates";
5353
import path from "path";
5454

5555
// Embed the built HTML at compile time
@@ -185,9 +185,10 @@ if (args[0] === "sessions") {
185185

186186
// Output feedback (captured by slash command)
187187
if (result.approved) {
188-
console.log(codeReviewApproved());
188+
console.log("Code review completed — no changes requested.");
189189
} else {
190-
console.log(codeReviewFeedback(result.feedback!));
190+
console.log(result.feedback);
191+
console.log("\nThe reviewer has identified issues above. You must address all of them.");
191192
}
192193
process.exit(0);
193194

@@ -273,7 +274,7 @@ if (args[0] === "sessions") {
273274
server.stop();
274275

275276
// Output feedback (captured by slash command)
276-
console.log(result.feedback ? annotateFeedback(result.feedback, absolutePath) : "No feedback provided.");
277+
console.log(result.feedback || "No feedback provided.");
277278
process.exit(0);
278279

279280
} else {

apps/opencode-plugin/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
import { getGitContext, runGitDiff } from "@plannotator/server/git";
3030
import { writeRemoteShareLink } from "@plannotator/server/share-url";
3131
import { resolveMarkdownFile } from "@plannotator/server/resolve-file";
32-
import { planDenyFeedback, codeReviewFeedback, codeReviewApproved, annotateFeedback } from "@plannotator/shared/feedback-templates";
32+
import { planDenyFeedback } from "@plannotator/shared/feedback-templates";
3333

3434
// @ts-ignore - Bun import attribute for text
3535
import indexHtml from "./plannotator.html" with { type: "text" };
@@ -223,8 +223,8 @@ Do NOT proceed with implementation until your plan is approved.
223223
const targetAgent = result.agentSwitch || 'build';
224224

225225
const message = result.approved
226-
? codeReviewApproved()
227-
: codeReviewFeedback(result.feedback!);
226+
? `# Code Review\n\nCode review completed — no changes requested.`
227+
: `# Code Review Feedback\n\n${result.feedback}\n\nPlease address this feedback.`;
228228

229229
// Send feedback to agent
230230
try {
@@ -321,7 +321,7 @@ Do NOT proceed with implementation until your plan is approved.
321321
parts: [
322322
{
323323
type: "text",
324-
text: annotateFeedback(result.feedback!, absolutePath),
324+
text: `# Markdown Annotations\n\nFile: ${absolutePath}\n\n${result.feedback}\n\nPlease address the annotation feedback above.`,
325325
},
326326
],
327327
},

apps/pi-extension/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
runGitDiff,
3636
openBrowser,
3737
} from "./server.js";
38-
import { planDenyFeedback, codeReviewFeedback, codeReviewApproved, annotateFeedback } from "./feedback-templates.js";
38+
import { planDenyFeedback } from "./feedback-templates.js";
3939

4040
// Load HTML at runtime (jiti doesn't support import attributes)
4141
const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -257,9 +257,9 @@ export default function plannotator(pi: ExtensionAPI): void {
257257

258258
if (result.feedback) {
259259
if (result.approved) {
260-
pi.sendUserMessage(codeReviewApproved());
260+
pi.sendUserMessage(`# Code Review\n\nCode review completed — no changes requested.`);
261261
} else {
262-
pi.sendUserMessage(codeReviewFeedback(result.feedback));
262+
pi.sendUserMessage(`# Code Review Feedback\n\n${result.feedback}\n\nPlease address this feedback.`);
263263
}
264264
} else {
265265
ctx.ui.notify("Code review closed (no feedback).", "info");
@@ -303,7 +303,9 @@ export default function plannotator(pi: ExtensionAPI): void {
303303
server.stop();
304304

305305
if (result.feedback) {
306-
pi.sendUserMessage(annotateFeedback(result.feedback, absolutePath));
306+
pi.sendUserMessage(
307+
`# Markdown Annotations\n\nFile: ${absolutePath}\n\n${result.feedback}\n\nPlease address the annotation feedback above.`,
308+
);
307309
} else {
308310
ctx.ui.notify("Annotation closed (no feedback).", "info");
309311
}
Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { describe, test, expect } from "bun:test";
2-
import {
3-
planDenyFeedback,
4-
codeReviewFeedback,
5-
codeReviewApproved,
6-
annotateFeedback,
7-
} from "./feedback-templates";
2+
import { planDenyFeedback } from "./feedback-templates";
83

94
describe("feedback-templates", () => {
105
/**
@@ -35,39 +30,14 @@ describe("feedback-templates", () => {
3530
expect(result).toContain(feedback);
3631
});
3732

38-
test("code review feedback preserves content verbatim", () => {
39-
const feedback = "### Line 42 (new)\n```suggestion\nconst x = 1;\n```";
40-
const result = codeReviewFeedback(feedback);
41-
expect(result).toContain(feedback);
42-
});
43-
44-
test("annotate feedback preserves content verbatim", () => {
45-
const feedback = "## 1. Comment on: \"setup()\"\n> This needs error handling";
46-
const result = annotateFeedback(feedback, "/src/main.ts");
47-
expect(result).toContain(feedback);
48-
});
49-
5033
/**
5134
* Empty feedback should not produce a broken message — the agent needs
5235
* something actionable even if the user didn't write annotations.
5336
*/
5437
test("plan deny handles empty feedback gracefully", () => {
5538
const result = planDenyFeedback("");
5639
expect(result.length).toBeGreaterThan(50);
57-
// Should not end with just whitespace or have a dangling separator
58-
expect(result.trimEnd()).toBe(result.trimEnd());
59-
});
60-
61-
/**
62-
* The annotate template optionally includes a file path so the agent knows
63-
* which file the annotations refer to.
64-
*/
65-
test("annotate feedback includes file path when given, omits when not", () => {
66-
const withPath = annotateFeedback("fix typo", "/src/readme.md");
67-
const withoutPath = annotateFeedback("fix typo");
68-
69-
expect(withPath).toContain("/src/readme.md");
70-
expect(withoutPath).not.toContain("File:");
40+
expect(result).toBe(result.trimEnd());
7141
});
7242

7343
/**
@@ -78,19 +48,7 @@ describe("feedback-templates", () => {
7848
*/
7949
test("plan deny instructs agent to preserve plan title", () => {
8050
const result = planDenyFeedback("feedback");
81-
// Must mention the heading / title and tell the agent not to change it
8251
expect(result.toLowerCase()).toContain("title");
8352
expect(result.toLowerCase()).toContain("heading");
8453
});
85-
86-
/**
87-
* Approved code review is a distinct message — it should NOT contain
88-
* directive language that would confuse the agent into thinking there's work to do.
89-
*/
90-
test("code review approved does not contain directive language", () => {
91-
const result = codeReviewApproved();
92-
expect(result).not.toContain("MUST");
93-
expect(result).not.toContain("address");
94-
expect(result).not.toContain("fix");
95-
});
9654
});
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
/**
22
* Shared feedback templates for all agent integrations.
33
*
4-
* These are the messages sent back to LLM agents when users deny plans,
5-
* submit code review feedback, or provide annotation feedback.
6-
*
74
* The plan deny template was tuned in #224 / commit 3dca977 to use strong
85
* directive framing — Claude was ignoring softer phrasing.
96
*/
107

11-
// ── Plan deny ────────────────────────────────────────────────────────
12-
138
export const planDenyFeedback = (
149
feedback: string,
1510
toolName: string = "ExitPlanMode",
1611
): string =>
1712
`YOUR PLAN WAS NOT APPROVED.\n\nYou MUST revise the plan to address ALL of the feedback below before calling ${toolName} again.\n\nRules:\n- Use the Edit tool to make targeted changes to the plan — do not resubmit the same plan unchanged.\n- Do NOT change the plan title (first # heading) unless the user explicitly asks you to.\n\n${feedback || "Plan changes requested"}`;
18-
19-
// ── Code review ──────────────────────────────────────────────────────
20-
21-
export const codeReviewFeedback = (feedback: string): string =>
22-
`# Code Review Feedback\n\n${feedback}\n\nThe reviewer has identified issues above. You MUST address all of them.`;
23-
24-
export const codeReviewApproved = (): string =>
25-
`Code review completed — no changes requested.`;
26-
27-
// ── Annotate ─────────────────────────────────────────────────────────
28-
29-
export const annotateFeedback = (
30-
feedback: string,
31-
filePath?: string,
32-
): string => {
33-
const fileRef = filePath ? `File: ${filePath}\n\n` : "";
34-
return `# Markdown Annotations\n\n${fileRef}${feedback}\n\nYou MUST address the annotation feedback above.`;
35-
};

0 commit comments

Comments
 (0)