@spardutti/claude-skills 2.60.4 → 2.60.5
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 +13 -4
- package/hooks/ship-prep.sh +2 -5
- package/package.json +1 -1
package/hooks/ship-log.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, join, resolve } from "node:path";
|
|
5
5
|
import { git, parseReport, prSize } from "./ship-log-parse.mjs";
|
|
6
6
|
import { printReport, tally } from "./ship-log-report.mjs";
|
|
7
7
|
|
|
8
8
|
const HERE = dirname(resolve(process.argv[1]));
|
|
9
9
|
const VERDICTS = ["confirmed", "refuted", "unconfirmed", "skipped"];
|
|
10
|
+
// A release ships only work its feature PRs already logged.
|
|
11
|
+
const RELEASE = /^(main|master|dev|develop|development|chore\/release-.*)$/;
|
|
10
12
|
const now = () => new Date().toISOString().replace(/\.\d+Z$/, "Z");
|
|
11
13
|
|
|
12
14
|
// gate-config.sh owns the config files and their order, so the gate and this agree on "on".
|
|
@@ -69,7 +71,7 @@ function finalize(dir, path, record, tag, status, reason, at) {
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
function prOf(branch) {
|
|
72
|
-
const r = spawnSync("gh", ["pr", "list", "--head", branch, "--state", "all", "--json", "number,createdAt,state", "--limit", "1"], { encoding: "utf8" });
|
|
74
|
+
const r = spawnSync("gh", ["pr", "list", "--head", branch, "--state", "all", "--json", "number,createdAt,closedAt,state", "--limit", "1"], { encoding: "utf8" });
|
|
73
75
|
try { return r.status === 0 ? JSON.parse(r.stdout)[0] : undefined; } catch { return undefined; }
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -80,8 +82,10 @@ function closeOpened(dir, app) {
|
|
|
80
82
|
const open = join(dir, "open");
|
|
81
83
|
for (const f of existsSync(open) ? readdirSync(open).filter((n) => n.startsWith(`${app}__`)) : []) {
|
|
82
84
|
const path = join(open, f), record = JSON.parse(readFileSync(path, "utf8"));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
const pr = prOf(record.branch), empty = !record.gate.length && !record.findings.length;
|
|
86
|
+
// A /ship that only merged fills nothing, so once its PR closes there is nothing to keep.
|
|
87
|
+
if (empty && pr?.closedAt >= record.started) { rmSync(path); continue; }
|
|
88
|
+
if (empty) continue;
|
|
85
89
|
const opened = pr && pr.createdAt >= record.started;
|
|
86
90
|
if (!pr || (!opened && pr.state !== "OPEN")) continue;
|
|
87
91
|
finalize(dir, path, Object.assign(record, { pr: pr.number }), `pr${pr.number}`,
|
|
@@ -156,6 +160,11 @@ function run(mode, args) {
|
|
|
156
160
|
if (mode === "on") return c.on ? 0 : 1;
|
|
157
161
|
if (!c.on) return 0;
|
|
158
162
|
const id = identity(c.root), path = openPath(c.dir, id), record = load(path, id);
|
|
163
|
+
if (mode === "start" && RELEASE.test(id.branch)) {
|
|
164
|
+
closeOpened(c.dir, id.app);
|
|
165
|
+
if (existsSync(path)) rmSync(path);
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
159
168
|
if (mode === "start") return restart(c.dir, path, record, id), 0;
|
|
160
169
|
if (mode === "ready") {
|
|
161
170
|
const todo = existsSync(path) ? missing(record, c) : [];
|
package/hooks/ship-prep.sh
CHANGED
|
@@ -69,11 +69,8 @@ scope() {
|
|
|
69
69
|
fi
|
|
70
70
|
echo "diff $diff"
|
|
71
71
|
echo "review /code-review medium origin/$(base_branch)...$branch"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
node "$HERE/ship-log.mjs" step audit start >/dev/null 2>&1
|
|
75
|
-
node "$HERE/ship-log.mjs" step review start >/dev/null 2>&1 ;;
|
|
76
|
-
esac
|
|
72
|
+
node "$HERE/ship-log.mjs" step audit start >/dev/null 2>&1
|
|
73
|
+
node "$HERE/ship-log.mjs" step review start >/dev/null 2>&1
|
|
77
74
|
return 0
|
|
78
75
|
}
|
|
79
76
|
|