diffprism 0.27.0 → 0.30.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/mcp-server.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
analyze,
|
|
3
3
|
consumeReviewResult,
|
|
4
|
+
detectWorktree,
|
|
4
5
|
getCurrentBranch,
|
|
5
6
|
getDiff,
|
|
6
7
|
isServerAlive,
|
|
7
8
|
readReviewResult,
|
|
8
9
|
readWatchFile,
|
|
9
10
|
startReview
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OJ723D6Z.js";
|
|
11
12
|
|
|
12
13
|
// packages/mcp-server/src/index.ts
|
|
13
14
|
import fs from "fs";
|
|
@@ -29,6 +30,7 @@ async function reviewViaGlobalServer(serverInfo, diffRef, options) {
|
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
const briefing = analyze(diffSet);
|
|
33
|
+
const worktreeInfo = detectWorktree({ cwd });
|
|
32
34
|
const payload = {
|
|
33
35
|
reviewId: "",
|
|
34
36
|
// Server assigns the real ID
|
|
@@ -39,7 +41,12 @@ async function reviewViaGlobalServer(serverInfo, diffRef, options) {
|
|
|
39
41
|
title: options.title,
|
|
40
42
|
description: options.description,
|
|
41
43
|
reasoning: options.reasoning,
|
|
42
|
-
currentBranch
|
|
44
|
+
currentBranch,
|
|
45
|
+
worktree: worktreeInfo.isWorktree ? {
|
|
46
|
+
isWorktree: true,
|
|
47
|
+
worktreePath: worktreeInfo.worktreePath,
|
|
48
|
+
mainWorktreePath: worktreeInfo.mainWorktreePath
|
|
49
|
+
} : void 0
|
|
43
50
|
}
|
|
44
51
|
};
|
|
45
52
|
const createResponse = await fetch(
|
|
@@ -76,7 +83,7 @@ async function reviewViaGlobalServer(serverInfo, diffRef, options) {
|
|
|
76
83
|
async function startMcpServer() {
|
|
77
84
|
const server = new McpServer({
|
|
78
85
|
name: "diffprism",
|
|
79
|
-
version: true ? "0.
|
|
86
|
+
version: true ? "0.30.0" : "0.0.0-dev"
|
|
80
87
|
});
|
|
81
88
|
server.tool(
|
|
82
89
|
"open_review",
|
|
@@ -353,6 +360,97 @@ async function startMcpServer() {
|
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
362
|
);
|
|
363
|
+
server.tool(
|
|
364
|
+
"get_diff",
|
|
365
|
+
"Get a structured diff (DiffSet) for local git changes. Returns file-level and hunk-level change data as JSON without opening a browser. Use this to inspect what changed before deciding whether to open a full review.",
|
|
366
|
+
{
|
|
367
|
+
diff_ref: z.string().describe(
|
|
368
|
+
'Git diff reference: "staged", "unstaged", "working-copy" (staged+unstaged grouped), or a ref range like "HEAD~3..HEAD"'
|
|
369
|
+
)
|
|
370
|
+
},
|
|
371
|
+
async ({ diff_ref }) => {
|
|
372
|
+
try {
|
|
373
|
+
const cwd = process.cwd();
|
|
374
|
+
const { diffSet } = getDiff(diff_ref, { cwd });
|
|
375
|
+
return {
|
|
376
|
+
content: [
|
|
377
|
+
{
|
|
378
|
+
type: "text",
|
|
379
|
+
text: JSON.stringify(diffSet, null, 2)
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
};
|
|
383
|
+
} catch (err) {
|
|
384
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
385
|
+
return {
|
|
386
|
+
content: [
|
|
387
|
+
{
|
|
388
|
+
type: "text",
|
|
389
|
+
text: `Error: ${message}`
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
isError: true
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
server.tool(
|
|
398
|
+
"analyze_diff",
|
|
399
|
+
"Analyze local git changes and return a ReviewBriefing with summary, file triage (critical/notable/mechanical), impact detection (affected modules, tests, dependencies, breaking changes), complexity scores, test coverage gaps, and pattern flags (security issues, TODOs, console.logs). Same analysis shown in the DiffPrism briefing bar, but returned as JSON without opening a browser.",
|
|
400
|
+
{
|
|
401
|
+
diff_ref: z.string().describe(
|
|
402
|
+
'Git diff reference: "staged", "unstaged", "working-copy" (staged+unstaged grouped), or a ref range like "HEAD~3..HEAD"'
|
|
403
|
+
)
|
|
404
|
+
},
|
|
405
|
+
async ({ diff_ref }) => {
|
|
406
|
+
try {
|
|
407
|
+
const cwd = process.cwd();
|
|
408
|
+
const { diffSet } = getDiff(diff_ref, { cwd });
|
|
409
|
+
if (diffSet.files.length === 0) {
|
|
410
|
+
return {
|
|
411
|
+
content: [
|
|
412
|
+
{
|
|
413
|
+
type: "text",
|
|
414
|
+
text: JSON.stringify({
|
|
415
|
+
summary: "No changes to analyze.",
|
|
416
|
+
triage: { critical: [], notable: [], mechanical: [] },
|
|
417
|
+
impact: {
|
|
418
|
+
affectedModules: [],
|
|
419
|
+
affectedTests: [],
|
|
420
|
+
publicApiChanges: false,
|
|
421
|
+
breakingChanges: [],
|
|
422
|
+
newDependencies: []
|
|
423
|
+
},
|
|
424
|
+
verification: { testsPass: null, typeCheck: null, lintClean: null },
|
|
425
|
+
fileStats: []
|
|
426
|
+
}, null, 2)
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
const briefing = analyze(diffSet);
|
|
432
|
+
return {
|
|
433
|
+
content: [
|
|
434
|
+
{
|
|
435
|
+
type: "text",
|
|
436
|
+
text: JSON.stringify(briefing, null, 2)
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
};
|
|
440
|
+
} catch (err) {
|
|
441
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
442
|
+
return {
|
|
443
|
+
content: [
|
|
444
|
+
{
|
|
445
|
+
type: "text",
|
|
446
|
+
text: `Error: ${message}`
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
isError: true
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
);
|
|
356
454
|
const transport = new StdioServerTransport();
|
|
357
455
|
await server.connect(transport);
|
|
358
456
|
}
|