diffprism 0.31.1 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  startGlobalServer,
7
7
  startReview,
8
8
  startWatch
9
- } from "./chunk-OJ723D6Z.js";
9
+ } from "./chunk-G4W5QBT4.js";
10
10
 
11
11
  // cli/src/index.ts
12
12
  import { Command } from "commander";
@@ -887,7 +887,7 @@ async function serverStop() {
887
887
 
888
888
  // cli/src/index.ts
889
889
  var program = new Command();
890
- program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.31.1" : "0.0.0-dev");
890
+ program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.32.0" : "0.0.0-dev");
891
891
  program.command("review [ref]").description("Open a browser-based diff review").option("--staged", "Review staged changes").option("--unstaged", "Review unstaged changes").option("-t, --title <title>", "Review title").option("--dev", "Use Vite dev server with HMR instead of static files").action(review);
892
892
  program.command("start [ref]").description("Set up DiffPrism and start watching for changes").option("--staged", "Watch staged changes").option("--unstaged", "Watch unstaged changes").option("-t, --title <title>", "Review title").option("--interval <ms>", "Poll interval in milliseconds (default: 1000)").option("--dev", "Use Vite dev server with HMR instead of static files").option("--global", "Install skill globally (~/.claude/skills/)").option("--force", "Overwrite existing configuration files").action(start);
893
893
  program.command("watch [ref]").description("Start a persistent diff watcher with live-updating browser UI").option("--staged", "Watch staged changes").option("--unstaged", "Watch unstaged changes").option("-t, --title <title>", "Review title").option("--interval <ms>", "Poll interval in milliseconds (default: 1000)").option("--dev", "Use Vite dev server with HMR instead of static files").action(watch);
@@ -2384,6 +2384,12 @@ async function startGlobalServer(options = {}) {
2384
2384
  payload: session.payload
2385
2385
  };
2386
2386
  ws.send(JSON.stringify(msg));
2387
+ for (const annotation of session.annotations) {
2388
+ ws.send(JSON.stringify({
2389
+ type: "annotation:added",
2390
+ payload: annotation
2391
+ }));
2392
+ }
2387
2393
  }
2388
2394
  } else {
2389
2395
  const summaries = Array.from(sessions2.values()).map(toSummary);
@@ -2403,6 +2409,12 @@ async function startGlobalServer(options = {}) {
2403
2409
  type: "review:init",
2404
2410
  payload: session.payload
2405
2411
  }));
2412
+ for (const annotation of session.annotations) {
2413
+ ws.send(JSON.stringify({
2414
+ type: "annotation:added",
2415
+ payload: annotation
2416
+ }));
2417
+ }
2406
2418
  }
2407
2419
  }
2408
2420
  }
@@ -2435,6 +2447,12 @@ async function startGlobalServer(options = {}) {
2435
2447
  type: "review:init",
2436
2448
  payload: session.payload
2437
2449
  }));
2450
+ for (const annotation of session.annotations) {
2451
+ ws.send(JSON.stringify({
2452
+ type: "annotation:added",
2453
+ payload: annotation
2454
+ }));
2455
+ }
2438
2456
  }
2439
2457
  } else if (msg.type === "session:close") {
2440
2458
  const closedId = msg.payload.sessionId;
@@ -8,7 +8,7 @@ import {
8
8
  readReviewResult,
9
9
  readWatchFile,
10
10
  startReview
11
- } from "./chunk-OJ723D6Z.js";
11
+ } from "./chunk-G4W5QBT4.js";
12
12
 
13
13
  // packages/mcp-server/src/index.ts
14
14
  import fs from "fs";
@@ -63,6 +63,29 @@ async function reviewViaGlobalServer(serverInfo, diffRef, options) {
63
63
  const { sessionId } = await createResponse.json();
64
64
  lastGlobalSessionId = sessionId;
65
65
  lastGlobalServerInfo = serverInfo;
66
+ if (options.annotations?.length) {
67
+ for (const ann of options.annotations) {
68
+ await fetch(
69
+ `http://localhost:${serverInfo.httpPort}/api/reviews/${sessionId}/annotations`,
70
+ {
71
+ method: "POST",
72
+ headers: { "Content-Type": "application/json" },
73
+ body: JSON.stringify({
74
+ file: ann.file,
75
+ line: ann.line,
76
+ body: ann.body,
77
+ type: ann.type,
78
+ confidence: ann.confidence ?? 1,
79
+ category: ann.category ?? "other",
80
+ source: {
81
+ agent: ann.source_agent ?? "unknown",
82
+ tool: "open_review"
83
+ }
84
+ })
85
+ }
86
+ );
87
+ }
88
+ }
66
89
  const pollIntervalMs = 2e3;
67
90
  const maxWaitMs = 600 * 1e3;
68
91
  const start = Date.now();
@@ -83,7 +106,7 @@ async function reviewViaGlobalServer(serverInfo, diffRef, options) {
83
106
  async function startMcpServer() {
84
107
  const server = new McpServer({
85
108
  name: "diffprism",
86
- version: true ? "0.31.1" : "0.0.0-dev"
109
+ version: true ? "0.32.0" : "0.0.0-dev"
87
110
  });
88
111
  server.tool(
89
112
  "open_review",
@@ -94,9 +117,29 @@ async function startMcpServer() {
94
117
  ),
95
118
  title: z.string().optional().describe("Title for the review"),
96
119
  description: z.string().optional().describe("Description of the changes"),
97
- reasoning: z.string().optional().describe("Agent reasoning about why these changes were made")
120
+ reasoning: z.string().optional().describe("Agent reasoning about why these changes were made"),
121
+ annotations: z.array(
122
+ z.object({
123
+ file: z.string().describe("File path within the diff to annotate"),
124
+ line: z.number().describe("Line number to annotate"),
125
+ body: z.string().describe("The annotation text"),
126
+ type: z.enum(["finding", "suggestion", "question", "warning"]).describe("Type of annotation"),
127
+ confidence: z.number().min(0).max(1).optional().describe("Confidence in the finding (0-1, defaults to 1)"),
128
+ category: z.enum([
129
+ "security",
130
+ "performance",
131
+ "convention",
132
+ "correctness",
133
+ "complexity",
134
+ "test-coverage",
135
+ "documentation",
136
+ "other"
137
+ ]).optional().describe("Category of the finding (defaults to 'other')"),
138
+ source_agent: z.string().optional().describe("Agent identifier (e.g., 'security-reviewer')")
139
+ })
140
+ ).optional().describe("Initial annotations to attach to the review")
98
141
  },
99
- async ({ diff_ref, title, description, reasoning }) => {
142
+ async ({ diff_ref, title, description, reasoning, annotations }) => {
100
143
  try {
101
144
  const serverInfo = await isServerAlive();
102
145
  if (serverInfo) {
@@ -104,7 +147,8 @@ async function startMcpServer() {
104
147
  title,
105
148
  description,
106
149
  reasoning,
107
- cwd: process.cwd()
150
+ cwd: process.cwd(),
151
+ annotations
108
152
  });
109
153
  return {
110
154
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffprism",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "type": "module",
5
5
  "description": "Local-first code review tool for agent-generated code changes",
6
6
  "bin": {