local-diff-reviewer 2.0.0 → 2.0.1
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/cli/start.js +10 -0
- package/package.json +1 -1
package/dist/cli/start.js
CHANGED
|
@@ -622,6 +622,9 @@ import { existsSync } from "node:fs";
|
|
|
622
622
|
import { createServer } from "node:http";
|
|
623
623
|
import { join as join4, normalize as normalize2, resolve, sep } from "node:path";
|
|
624
624
|
|
|
625
|
+
// src/shared/types.ts
|
|
626
|
+
var REVIEW_REFRESH_PROTOCOL = 1;
|
|
627
|
+
|
|
625
628
|
// src/core/markdown-source-map.ts
|
|
626
629
|
import GithubSlugger from "github-slugger";
|
|
627
630
|
function buildMarkdownBlocks(content) {
|
|
@@ -737,6 +740,9 @@ async function startServer(state, port = 4966) {
|
|
|
737
740
|
app.get("/api/diff", (_req, res) => {
|
|
738
741
|
res.json({ files: state.diffFiles });
|
|
739
742
|
});
|
|
743
|
+
app.get("/api/capabilities", (_req, res) => {
|
|
744
|
+
res.json({ reviewRefreshProtocol: REVIEW_REFRESH_PROTOCOL });
|
|
745
|
+
});
|
|
740
746
|
app.get("/api/review-state", async (_req, res, next) => {
|
|
741
747
|
try {
|
|
742
748
|
const comments = await readComments(state.session.repoRoot);
|
|
@@ -1149,6 +1155,10 @@ async function refreshRunningReview(session, diffFiles) {
|
|
|
1149
1155
|
for (const runtime of runtimes) {
|
|
1150
1156
|
const apiUrl = `http://127.0.0.1:${runtime.apiPort}`;
|
|
1151
1157
|
try {
|
|
1158
|
+
const capabilityResponse = await fetch(`${apiUrl}/api/capabilities`);
|
|
1159
|
+
if (!capabilityResponse.ok) continue;
|
|
1160
|
+
const capabilities = await capabilityResponse.json();
|
|
1161
|
+
if (capabilities.reviewRefreshProtocol !== REVIEW_REFRESH_PROTOCOL) continue;
|
|
1152
1162
|
const response = await fetch(`${apiUrl}/api/review-state`, {
|
|
1153
1163
|
method: "POST",
|
|
1154
1164
|
headers: { "Content-Type": "application/json" },
|