@blamejs/exceptd-skills 0.19.15 → 0.19.17

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.
@@ -239,6 +239,48 @@ function _openCodeqlAlerts(prNum) {
239
239
 
240
240
  // ---- Subcommands ---------------------------------------------------------
241
241
 
242
+ // The derived-artifact regeneration, in the one order that is correct. Shared
243
+ // by `prepare` and `regen` so the two cannot drift: any source edit after a
244
+ // prepare — a review finding fixed on the release branch, most often a data
245
+ // correction — invalidates the signatures, indexes and SBOM hashes, and
246
+ // re-running the four commands from memory is where the ordering gets lost.
247
+ function _regenArtifacts() {
248
+ _section("regen artifacts");
249
+ // Order matters: sign first (re-signs the manifest), then the snapshot/
250
+ // index/SBOM derivations. refresh-sbom runs LAST because it hashes the
251
+ // shipped tree (incl. README) — regenerating it before a later source edit
252
+ // strands the hashes (the recurring "refresh-sbom last" lesson).
253
+ _run("node", ["lib/sign.js", "sign-all"]);
254
+ _run("npm", ["run", "build-indexes"]);
255
+ _run("npm", ["run", "refresh-snapshot"]);
256
+ _run("npm", ["run", "refresh-sbom"]);
257
+ _ok("signed + indexes + snapshot + sbom regenerated");
258
+ }
259
+
260
+ // Re-derive the artifacts after editing source on an already-prepared release
261
+ // branch. No version bump, no CHANGELOG requirement, no clean-tree demand —
262
+ // this phase exists precisely for a dirty tree. It refuses on main, where the
263
+ // bump belongs to `prepare`.
264
+ function cmdRegen() {
265
+ _section("regen");
266
+ // Positively require a release branch rather than merely rejecting main: this
267
+ // re-signs the manifest and rewrites checked-in derived artifacts, so an
268
+ // accidental run from a feature branch or a detached HEAD would produce
269
+ // release artifacts from a tree that is not the release.
270
+ if (!_gitOnRelease()) {
271
+ throw new Error("release: regen must run on a release-vX.Y.Z branch (on " + _gitBranch() + "). " +
272
+ "On main the regeneration belongs to `prepare`.");
273
+ }
274
+ var dirty = _capture("git", ["status", "--porcelain"]).stdout.split(/\r?\n/).filter(function (l) { return l.trim(); });
275
+ if (!dirty.length) console.log("working tree is clean — regenerating anyway (artifacts may be stale from an earlier commit)");
276
+ else {
277
+ console.log("regenerating against " + dirty.length + " uncommitted path(s):");
278
+ dirty.forEach(function (l) { console.log(" " + l.trim()); });
279
+ }
280
+ _regenArtifacts();
281
+ console.log("\nnext: node scripts/release.js gates");
282
+ }
283
+
242
284
  function cmdPrepare(opts) {
243
285
  _section("prepare");
244
286
  if (!_gitOnMain()) throw new Error("release: prepare must run on main (on " + _gitBranch() + ")");
@@ -299,16 +341,7 @@ function cmdPrepare(opts) {
299
341
  _writeJsonVersion("manifest.json", next);
300
342
  _ok("bumped package.json + manifest.json → " + next);
301
343
 
302
- _section("regen artifacts");
303
- // Order matters: sign first (re-signs the manifest), then the snapshot/
304
- // index/SBOM derivations. refresh-sbom runs LAST because it hashes the
305
- // shipped tree (incl. README) — regenerating it before a later source edit
306
- // strands the hashes (the recurring "refresh-sbom last" lesson).
307
- _run("node", ["lib/sign.js", "sign-all"]);
308
- _run("npm", ["run", "build-indexes"]);
309
- _run("npm", ["run", "refresh-snapshot"]);
310
- _run("npm", ["run", "refresh-sbom"]);
311
- _ok("signed + indexes + snapshot + sbom regenerated");
344
+ _regenArtifacts();
312
345
 
313
346
  _section("test-count baseline");
314
347
  // Check BEFORE refreshing. `--update-baseline` writes whatever it observes,
@@ -685,6 +718,7 @@ function cmdHelp() {
685
718
  console.log(" node scripts/release.js prepare [--minor] [--with-content]");
686
719
  console.log(" # bump + sign + indexes + snapshot + sbom + baseline");
687
720
  console.log(" # --with-content: release ships uncommitted work");
721
+ console.log(" node scripts/release.js regen # re-derive artifacts after editing a release branch");
688
722
  console.log(" node scripts/release.js gates # npm test + 20-gate predeploy");
689
723
  console.log(" node scripts/release.js commit # release branch + signed commit");
690
724
  console.log(" node scripts/release.js push # push branch + open PR");
@@ -710,6 +744,7 @@ var opts = {
710
744
  try {
711
745
  switch (sub) {
712
746
  case "prepare": cmdPrepare(opts); break;
747
+ case "regen": cmdRegen(); break;
713
748
  case "gates": cmdGates(); break;
714
749
  case "commit": cmdCommit(); break;
715
750
  case "push": cmdPush(); break;