@rightkit/release 0.6.46 → 0.6.47

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.
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ // Line-stamping relay for the gate's inherited-output children (GATE-CONTRACT GC-A21, rightkit#1463/#1514): `node stamp-relay.mjs <cmd> [args...]`
3
+ // runs <cmd> with piped output and writes every complete line to its own stdout/stderr prefixed with the UTC time, the same form the gate's
4
+ // own lines carry. The gate keeps launching synchronously (spawnSync, stdio inherit) and only puts this relay in front, so a child's live output
5
+ // still streams. A partial last line is stamped and ended at exit. The relay passes stdin through, forwards SIGINT, SIGTERM and SIGHUP to the
6
+ // child, and ends the way the child ended: the same exit code, or the same signal re-raised on itself.
7
+ import { spawn } from "node:child_process";
8
+ import { pathToFileURL } from "node:url";
9
+
10
+ export function lineStamper(write, now = () => new Date().toISOString()) {
11
+ let pending = "";
12
+ return {
13
+ push(chunk) {
14
+ pending += chunk;
15
+ let at;
16
+ while ((at = pending.indexOf("\n")) >= 0) { write(`${now()} ${pending.slice(0, at + 1)}`); pending = pending.slice(at + 1); }
17
+ },
18
+ end() { if (pending) { write(`${now()} ${pending}\n`); pending = ""; } },
19
+ };
20
+ }
21
+
22
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
23
+ const [cmd, ...args] = process.argv.slice(2);
24
+ if (!cmd) { process.stderr.write("usage: stamp-relay.mjs <cmd> [args...]\n"); process.exit(64); }
25
+ const child = spawn(cmd, args, { stdio: ["inherit", "pipe", "pipe"], windowsHide: true });
26
+ const out = lineStamper((s) => process.stdout.write(s));
27
+ const err = lineStamper((s) => process.stderr.write(s));
28
+ child.stdout.setEncoding("utf8").on("data", (c) => out.push(c));
29
+ child.stderr.setEncoding("utf8").on("data", (c) => err.push(c));
30
+ for (const sig of ["SIGINT", "SIGTERM", "SIGHUP"]) process.on(sig, () => { try { child.kill(sig); } catch { /* already gone */ } });
31
+ child.on("error", (e) => { process.stderr.write(`${new Date().toISOString()} stamp-relay: ${cmd} could not be started (${e.code ?? e.message})\n`); process.exit(127); });
32
+ child.on("close", (code, signal) => {
33
+ out.end(); err.end();
34
+ if (signal) { process.removeAllListeners(signal); process.kill(process.pid, signal); return; }
35
+ process.exitCode = code ?? 1;
36
+ });
37
+ }
@@ -269,7 +269,8 @@ export async function publisherRequirementsForUnits({ selected, snapshot, rustUn
269
269
  const manifest = npm ? readJson(`${dir}/package.json`) : null;
270
270
  if (npm && manifest?.name !== unit) throw new Error(`${row.selector}: npm manifest identity differs`);
271
271
  if (npm && manifest.private === true && !manifest.scripts?.build && !manifest.scripts?.test) throw new Error(`${row.selector}: private unit has no own build or test script; recursive workspace build cannot prove its coverage`);
272
- const planned = compileRequirements({ kind, unit, dir, config, manifest, platform, workspace: cargo ? discovered.cargoDir : ".", env, assetGated });
272
+ // Class A's full pass (rustfmt over every Rust file of this snapshot) precedes these requirements in the same run: no per-crate fmt (GC-A24).
273
+ const planned = compileRequirements({ kind, unit, dir, config, manifest, platform, workspace: cargo ? discovered.cargoDir : ".", env, assetGated, formatProven: true });
273
274
  out.push({ selector: row.selector, dir, ...planned });
274
275
  }
275
276
  return out;