@spardutti/claude-skills 2.59.1 → 2.59.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/hooks/ship-log.mjs +4 -3
- package/package.json +1 -1
package/hooks/ship-log.mjs
CHANGED
|
@@ -57,20 +57,21 @@ function finalize(dir, path, record, tag, status, reason, at) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function prOf(branch) {
|
|
60
|
-
const r = spawnSync("gh", ["pr", "list", "--head", branch, "--state", "all", "--json", "number,createdAt", "--limit", "1"], { encoding: "utf8" });
|
|
60
|
+
const r = spawnSync("gh", ["pr", "list", "--head", branch, "--state", "all", "--json", "number,createdAt,state", "--limit", "1"], { encoding: "utf8" });
|
|
61
61
|
try { return r.status === 0 ? JSON.parse(r.stdout)[0] : undefined; } catch { return undefined; }
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// Agents skip the `pr` call, so a log whose branch has a PR by now is closed at that PR.
|
|
65
65
|
// A PR older than the log was only updated by it, so that log ends at its own last event.
|
|
66
|
+
// A long-lived branch like dev keeps its merged PRs, so an old one that is not open is not this log's.
|
|
66
67
|
function closeOpened(dir, app) {
|
|
67
68
|
const open = join(dir, "open");
|
|
68
69
|
for (const f of existsSync(open) ? readdirSync(open).filter((n) => n.startsWith(`${app}__`)) : []) {
|
|
69
70
|
const path = join(open, f), record = JSON.parse(readFileSync(path, "utf8"));
|
|
70
71
|
if (!record.gate.length && !record.findings.length) continue;
|
|
71
72
|
const pr = prOf(record.branch);
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
const opened = pr && pr.createdAt >= record.started;
|
|
74
|
+
if (!pr || (!opened && pr.state !== "OPEN")) continue;
|
|
74
75
|
finalize(dir, path, Object.assign(record, { pr: pr.number }), `pr${pr.number}`,
|
|
75
76
|
opened ? "pr-opened" : "pr-updated", null, opened ? pr.createdAt : lastEvent(record));
|
|
76
77
|
}
|