@oss-autopilot/core 1.13.1 → 1.14.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/cli.bundle.cjs +66 -66
- package/dist/commands/dashboard-server.js +24 -1
- package/package.json +1 -1
|
@@ -51,6 +51,21 @@ function readVettedIssues() {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the mtime of the vetted issue list file in ms, or null if unknown.
|
|
56
|
+
* Used to detect external edits and invalidate the cached dashboard payload.
|
|
57
|
+
*/
|
|
58
|
+
function getIssueListMtimeMs() {
|
|
59
|
+
try {
|
|
60
|
+
const info = detectIssueList();
|
|
61
|
+
if (!info)
|
|
62
|
+
return null;
|
|
63
|
+
return fs.statSync(info.path).mtimeMs;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
54
69
|
/**
|
|
55
70
|
* Build the JSON payload that the SPA expects from GET /api/data.
|
|
56
71
|
*/
|
|
@@ -186,6 +201,7 @@ export async function startDashboardServer(options) {
|
|
|
186
201
|
}
|
|
187
202
|
// ── Build cached JSON response ───────────────────────────────────────────
|
|
188
203
|
let cachedJsonData;
|
|
204
|
+
let cachedIssueListMtimeMs = getIssueListMtimeMs();
|
|
189
205
|
try {
|
|
190
206
|
cachedJsonData = buildDashboardJson(cachedDigest, stateManager.getState(), cachedCommentedIssues);
|
|
191
207
|
}
|
|
@@ -217,9 +233,13 @@ export async function startDashboardServer(options) {
|
|
|
217
233
|
else {
|
|
218
234
|
stateChanged = stateManager.reloadIfChanged();
|
|
219
235
|
}
|
|
220
|
-
|
|
236
|
+
// Also rebuild when the vetted issue list file was edited outside this server (#924)
|
|
237
|
+
const currentIssueListMtimeMs = getIssueListMtimeMs();
|
|
238
|
+
const issueListChanged = currentIssueListMtimeMs !== cachedIssueListMtimeMs;
|
|
239
|
+
if (stateChanged || issueListChanged) {
|
|
221
240
|
try {
|
|
222
241
|
cachedJsonData = buildDashboardJson(cachedDigest, stateManager.getState(), cachedCommentedIssues);
|
|
242
|
+
cachedIssueListMtimeMs = currentIssueListMtimeMs;
|
|
223
243
|
}
|
|
224
244
|
catch (error) {
|
|
225
245
|
warn(MODULE, `Failed to rebuild dashboard data after state reload: ${errorMessage(error)}`);
|
|
@@ -336,6 +356,7 @@ export async function startDashboardServer(options) {
|
|
|
336
356
|
}
|
|
337
357
|
// Rebuild dashboard data from cached digest + updated state
|
|
338
358
|
cachedJsonData = buildDashboardJson(cachedDigest, stateManager.getState(), cachedCommentedIssues);
|
|
359
|
+
cachedIssueListMtimeMs = getIssueListMtimeMs();
|
|
339
360
|
sendJson(res, 200, cachedJsonData);
|
|
340
361
|
}
|
|
341
362
|
// ── POST /api/refresh handler ────────────────────────────────────────────
|
|
@@ -357,6 +378,7 @@ export async function startDashboardServer(options) {
|
|
|
357
378
|
cachedDigest = result.digest;
|
|
358
379
|
cachedCommentedIssues = result.commentedIssues;
|
|
359
380
|
cachedJsonData = buildDashboardJson(cachedDigest, stateManager.getState(), cachedCommentedIssues, result.allMergedPRs, result.allClosedPRs);
|
|
381
|
+
cachedIssueListMtimeMs = getIssueListMtimeMs();
|
|
360
382
|
sendJson(res, 200, cachedJsonData);
|
|
361
383
|
}
|
|
362
384
|
catch (error) {
|
|
@@ -476,6 +498,7 @@ export async function startDashboardServer(options) {
|
|
|
476
498
|
cachedDigest = result.digest;
|
|
477
499
|
cachedCommentedIssues = result.commentedIssues;
|
|
478
500
|
cachedJsonData = buildDashboardJson(cachedDigest, stateManager.getState(), cachedCommentedIssues, result.allMergedPRs, result.allClosedPRs);
|
|
501
|
+
cachedIssueListMtimeMs = getIssueListMtimeMs();
|
|
479
502
|
warn(MODULE, 'Background data refresh complete');
|
|
480
503
|
})
|
|
481
504
|
.catch((error) => {
|