diffprism 0.24.1 → 0.24.2
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-
|
|
9
|
+
} from "./chunk-PG4ERDT3.js";
|
|
10
10
|
|
|
11
11
|
// cli/src/index.ts
|
|
12
12
|
import { Command } from "commander";
|
|
@@ -836,7 +836,7 @@ async function serverStop() {
|
|
|
836
836
|
|
|
837
837
|
// cli/src/index.ts
|
|
838
838
|
var program = new Command();
|
|
839
|
-
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.24.
|
|
839
|
+
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.24.2" : "0.0.0-dev");
|
|
840
840
|
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);
|
|
841
841
|
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);
|
|
842
842
|
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);
|
|
@@ -1657,33 +1657,69 @@ async function handleApiRequest(req, res) {
|
|
|
1657
1657
|
try {
|
|
1658
1658
|
const body = await readBody(req);
|
|
1659
1659
|
const { payload, projectPath, diffRef } = JSON.parse(body);
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1660
|
+
let existingSession;
|
|
1661
|
+
for (const session of sessions2.values()) {
|
|
1662
|
+
if (session.projectPath === projectPath) {
|
|
1663
|
+
existingSession = session;
|
|
1664
|
+
break;
|
|
1665
|
+
}
|
|
1664
1666
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
payload
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1667
|
+
if (existingSession) {
|
|
1668
|
+
const sessionId = existingSession.id;
|
|
1669
|
+
payload.reviewId = sessionId;
|
|
1670
|
+
if (diffRef) {
|
|
1671
|
+
payload.watchMode = true;
|
|
1672
|
+
}
|
|
1673
|
+
stopSessionWatcher(sessionId);
|
|
1674
|
+
existingSession.payload = payload;
|
|
1675
|
+
existingSession.status = "pending";
|
|
1676
|
+
existingSession.result = null;
|
|
1677
|
+
existingSession.createdAt = Date.now();
|
|
1678
|
+
existingSession.diffRef = diffRef;
|
|
1679
|
+
existingSession.lastDiffHash = diffRef ? hashDiff(payload.rawDiff) : void 0;
|
|
1680
|
+
existingSession.lastDiffSet = diffRef ? payload.diffSet : void 0;
|
|
1681
|
+
existingSession.hasNewChanges = false;
|
|
1682
|
+
if (diffRef && hasConnectedClients()) {
|
|
1683
|
+
startSessionWatcher(sessionId);
|
|
1684
|
+
}
|
|
1685
|
+
if (hasViewersForSession(sessionId)) {
|
|
1686
|
+
sendToSessionClients(sessionId, {
|
|
1687
|
+
type: "review:init",
|
|
1688
|
+
payload
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
broadcastSessionUpdate(existingSession);
|
|
1692
|
+
reopenBrowserIfNeeded?.();
|
|
1693
|
+
jsonResponse(res, 200, { sessionId });
|
|
1694
|
+
} else {
|
|
1695
|
+
const sessionId = `session-${randomUUID().slice(0, 8)}`;
|
|
1696
|
+
payload.reviewId = sessionId;
|
|
1697
|
+
if (diffRef) {
|
|
1698
|
+
payload.watchMode = true;
|
|
1699
|
+
}
|
|
1700
|
+
const session = {
|
|
1701
|
+
id: sessionId,
|
|
1702
|
+
payload,
|
|
1703
|
+
projectPath,
|
|
1704
|
+
status: "pending",
|
|
1705
|
+
createdAt: Date.now(),
|
|
1706
|
+
result: null,
|
|
1707
|
+
diffRef,
|
|
1708
|
+
lastDiffHash: diffRef ? hashDiff(payload.rawDiff) : void 0,
|
|
1709
|
+
lastDiffSet: diffRef ? payload.diffSet : void 0,
|
|
1710
|
+
hasNewChanges: false
|
|
1711
|
+
};
|
|
1712
|
+
sessions2.set(sessionId, session);
|
|
1713
|
+
if (diffRef && hasConnectedClients()) {
|
|
1714
|
+
startSessionWatcher(sessionId);
|
|
1715
|
+
}
|
|
1716
|
+
broadcastToAll({
|
|
1717
|
+
type: "session:added",
|
|
1718
|
+
payload: toSummary(session)
|
|
1719
|
+
});
|
|
1720
|
+
reopenBrowserIfNeeded?.();
|
|
1721
|
+
jsonResponse(res, 201, { sessionId });
|
|
1680
1722
|
}
|
|
1681
|
-
broadcastToAll({
|
|
1682
|
-
type: "session:added",
|
|
1683
|
-
payload: toSummary(session)
|
|
1684
|
-
});
|
|
1685
|
-
reopenBrowserIfNeeded?.();
|
|
1686
|
-
jsonResponse(res, 201, { sessionId });
|
|
1687
1723
|
} catch {
|
|
1688
1724
|
jsonResponse(res, 400, { error: "Invalid request body" });
|
|
1689
1725
|
}
|
package/dist/mcp-server.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
readReviewResult,
|
|
8
8
|
readWatchFile,
|
|
9
9
|
startReview
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PG4ERDT3.js";
|
|
11
11
|
|
|
12
12
|
// packages/mcp-server/src/index.ts
|
|
13
13
|
import fs from "fs";
|
|
@@ -76,7 +76,7 @@ async function reviewViaGlobalServer(serverInfo, diffRef, options) {
|
|
|
76
76
|
async function startMcpServer() {
|
|
77
77
|
const server = new McpServer({
|
|
78
78
|
name: "diffprism",
|
|
79
|
-
version: true ? "0.24.
|
|
79
|
+
version: true ? "0.24.2" : "0.0.0-dev"
|
|
80
80
|
});
|
|
81
81
|
server.tool(
|
|
82
82
|
"open_review",
|