@nodii/dev 0.6.95 → 0.6.96
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/core.js +1 -1
- package/dist/hooks.js +2 -2
- package/dist/lane-supervisor.js +7 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.96";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/hooks.js
CHANGED
|
@@ -258,7 +258,7 @@ export async function heartbeatCurrentLane(request = devRequest, { cwd = process
|
|
|
258
258
|
if (laneKey) {
|
|
259
259
|
const lane = (await request("GET", `/api/v1/lanes/${encodeURIComponent(laneKey)}`)).data;
|
|
260
260
|
if (lane.repositories?.some((repository) => repository.branch === branch)) {
|
|
261
|
-
await request("POST", `/api/v1/lanes/${encodeURIComponent(lane.id)}/heartbeat`, { via: "nodii-dev" });
|
|
261
|
+
await request("POST", `/api/v1/lanes/${encodeURIComponent(lane.id)}/heartbeat`, { via: "nodii-dev", source: "hook" });
|
|
262
262
|
return { heartbeated: true, key: lane.key };
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -266,7 +266,7 @@ export async function heartbeatCurrentLane(request = devRequest, { cwd = process
|
|
|
266
266
|
const lanes = (await request("GET", "/api/v1/lanes?limit=200")).data ?? [];
|
|
267
267
|
const lane = lanes.find((x) => x.branch === branch && !["on_dev", "stopped"].includes(x.status));
|
|
268
268
|
if (!lane) return { heartbeated: false, reason: "no lane for current branch" };
|
|
269
|
-
await request("POST", `/api/v1/lanes/${encodeURIComponent(lane.id)}/heartbeat`, { via: "nodii-dev" });
|
|
269
|
+
await request("POST", `/api/v1/lanes/${encodeURIComponent(lane.id)}/heartbeat`, { via: "nodii-dev", source: "hook" });
|
|
270
270
|
return { heartbeated: true, key: lane.key };
|
|
271
271
|
}
|
|
272
272
|
|
package/dist/lane-supervisor.js
CHANGED
|
@@ -100,7 +100,13 @@ export const laneBlocked = (lane) => Boolean(laneBlockedReason(lane));
|
|
|
100
100
|
export function laneBlockedReason(lane) {
|
|
101
101
|
const step = (lane?.steps ?? []).find((candidate) => candidate.state === "blocked");
|
|
102
102
|
if (step) return `Lane step ${step.side}/${step.stepKey} is blocked.`;
|
|
103
|
-
|
|
103
|
+
// hub-283: the open waits first, then the latest heartbeat that says something.
|
|
104
|
+
// A noteless or hook heartbeat never clears a WAITING or BLOCKED.
|
|
105
|
+
const waits = (lane?.waits ?? []).map((wait) => wait.targetRef).filter(Boolean);
|
|
106
|
+
if (waits.length) return `Lane waits on ${waits.join(", ")}.`;
|
|
107
|
+
const heartbeat = (lane?.events ?? [])
|
|
108
|
+
.filter((event) => event.type === "heartbeat" && event.metadata?.source !== "hook" && String(event.metadata?.note ?? "").trim())
|
|
109
|
+
.at(-1);
|
|
104
110
|
const note = String(heartbeat?.metadata?.note ?? "");
|
|
105
111
|
return /^\s*blocked\b/i.test(note) || /^\s*WAITING\s*:/.test(note) ? `Lane heartbeat: ${note.slice(0, 500)}` : null;
|
|
106
112
|
}
|