tamperward 2.23.17 → 2.23.18

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/README.md CHANGED
@@ -257,6 +257,7 @@ platforms.
257
257
  | Capability | Linux | macOS | Windows |
258
258
  | --- | --- | --- | --- |
259
259
  | `check` / policy evaluation | Supported | Supported | Supported |
260
+ | parsed output (`--json`, `--format github`, hook/sweep JSON) on a pipe | Complete before exit | Complete before exit (asynchronous pipe drained first) | Complete before exit (asynchronous pipe drained first) |
260
261
  | Claude hook / Stop adapter | Supported where Claude Code command hooks are available | Same | Same |
261
262
  | `watch` / observer telemetry | Supported; backend health is reported | Supported/degraded according to `fs.watch` health | Supported/degraded according to `fs.watch` health |
262
263
  | opt-in `hook-service` | Supported (per-user `0600` unix socket) | Supported (per-user `0600` unix socket) | **Unsupported; `start` refuses, hooks run in-process** |
package/dist/cli/index.js CHANGED
@@ -302,6 +302,29 @@ var init_hook_client = __esm({
302
302
  }
303
303
  });
304
304
 
305
+ // src/cli/exit.ts
306
+ function exitAfterFlush(code2) {
307
+ process.exitCode = code2;
308
+ let pending = 0;
309
+ const done = () => {
310
+ pending -= 1;
311
+ if (pending === 0) process.exit(code2);
312
+ };
313
+ for (const stream of [process.stdout, process.stderr]) {
314
+ pending += 1;
315
+ stream.on("error", noop);
316
+ stream.write("", done);
317
+ }
318
+ }
319
+ var noop;
320
+ var init_exit = __esm({
321
+ "src/cli/exit.ts"() {
322
+ "use strict";
323
+ noop = () => {
324
+ };
325
+ }
326
+ });
327
+
305
328
  // src/lazy-deps.ts
306
329
  import { createRequire } from "node:module";
307
330
  function loadPicomatch() {
@@ -10749,7 +10772,7 @@ function runHookService(args) {
10749
10772
  }).catch((e) => {
10750
10773
  process.stderr.write(`tamperward hook-service: ${e instanceof Error ? e.message : String(e)}
10751
10774
  `);
10752
- process.exit(2);
10775
+ exitAfterFlush(2);
10753
10776
  });
10754
10777
  return -1;
10755
10778
  }
@@ -10773,14 +10796,15 @@ function runHookService(args) {
10773
10796
  if (!isRecord(res) || typeof res.served !== "number") {
10774
10797
  process.stdout.write(`tamperward hook-service: not running (pid ${state.pid} did not answer, or is another version); ${optIn}
10775
10798
  `);
10776
- process.exit(0);
10799
+ exitAfterFlush(0);
10800
+ return;
10777
10801
  }
10778
10802
  const cache3 = isRecord(res.cache) ? res.cache : {};
10779
10803
  process.stdout.write(
10780
10804
  `tamperward hook-service: running (pid ${state.pid}, tamperward@${state.version}, root ${state.root}, since ${state.started_at}); served: ${res.served}; snapshot cache hits/misses/entries: ${String(cache3.hits ?? 0)}/${String(cache3.misses ?? 0)}/${String(cache3.size ?? 0)}; ${optIn}
10781
10805
  `
10782
10806
  );
10783
- process.exit(0);
10807
+ exitAfterFlush(0);
10784
10808
  });
10785
10809
  return -1;
10786
10810
  }
@@ -10793,6 +10817,7 @@ var init_hook_service = __esm({
10793
10817
  init_ptree_cache();
10794
10818
  init_repo_context();
10795
10819
  init_hook();
10820
+ init_exit();
10796
10821
  init_hook_client();
10797
10822
  MAX_REQUEST_BYTES = 64 * 1024 * 1024;
10798
10823
  STOP_WAIT_MS = 1e4;
@@ -17816,6 +17841,7 @@ var init_main = __esm({
17816
17841
 
17817
17842
  // src/cli/index.ts
17818
17843
  init_hook_client();
17844
+ init_exit();
17819
17845
  import { readFileSync as readFileSync24 } from "node:fs";
17820
17846
  function loadMain() {
17821
17847
  return Promise.resolve().then(() => (init_main(), main_exports));
@@ -17847,4 +17873,4 @@ async function launch(argv) {
17847
17873
  return main2.guardedMain(argv);
17848
17874
  }
17849
17875
  var code = await launch(process.argv.slice(2));
17850
- if (code >= 0) process.exit(code);
17876
+ if (code >= 0) exitAfterFlush(code);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.23.17",
3
+ "version": "2.23.18",
4
4
  "description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "hexrift",