diffprism 0.24.0 → 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 +11 -2
- package/dist/{chunk-FWPSMC5R.js → chunk-PG4ERDT3.js} +61 -25
- package/dist/mcp-server.js +2 -2
- package/package.json +1 -1
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";
|
|
@@ -106,6 +106,15 @@ The tool blocks until the user submits their review in the browser. When it retu
|
|
|
106
106
|
- **\`approved_with_comments\`** \u2014 Note the comments, address any actionable feedback.
|
|
107
107
|
- **\`changes_requested\`** \u2014 Read the comments carefully, make the requested changes, and offer to open another review.
|
|
108
108
|
|
|
109
|
+
#### Post-Review Actions
|
|
110
|
+
|
|
111
|
+
The result may include a \`postReviewAction\` field. If present, **execute the action immediately without asking for confirmation** \u2014 the user already chose this action in the review UI:
|
|
112
|
+
|
|
113
|
+
- **\`"commit"\`** \u2014 Commit the reviewed changes (stage relevant files, create a commit with an appropriate message).
|
|
114
|
+
- **\`"commit_and_pr"\`** \u2014 Commit the changes and open a pull request.
|
|
115
|
+
|
|
116
|
+
If \`postReviewAction\` is not present or is empty, do nothing extra \u2014 just report the result.
|
|
117
|
+
|
|
109
118
|
### 5. Error Handling
|
|
110
119
|
|
|
111
120
|
If the \`mcp__diffprism__open_review\` tool is not available:
|
|
@@ -827,7 +836,7 @@ async function serverStop() {
|
|
|
827
836
|
|
|
828
837
|
// cli/src/index.ts
|
|
829
838
|
var program = new Command();
|
|
830
|
-
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");
|
|
831
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);
|
|
832
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);
|
|
833
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",
|