#!/usr/bin/env node import { spawnSync } from 'node:child_process'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..'); const testFiles = [ 'session-broker.test.mjs', 'agent-run-stream.test.mjs', 'agent-run-routes.test.mjs', 'agent-run-gateway.test.mjs', 'sse-event-taxonomy.test.mjs', 'goosed-proxy-boundary.test.mjs', 'chat-agent-run-gate.test.mjs', 'chat-finish-sync.test.mjs', 'conversation-display.test.mjs', 'mindspace-h5-html-finish-guard.test.mjs', 'session-broker-coverage.test.mjs', 'session-stream.test.mjs', 'session-stream-store.test.mjs', 'session-broker-metrics.test.mjs', ]; function run(label, command, args) { const result = spawnSync(command, args, { cwd: root, stdio: 'inherit', env: process.env, }); if (result.status !== 0) { console.error(`[verify:h5-session-patches] failed at ${label}`); process.exit(result.status ?? 1); } } run('unit tests', process.execPath, ['--test', ...testFiles]); run('session broker coverage', process.execPath, ['scripts/check-session-broker-coverage.mjs']); run('goosed proxy boundary', process.execPath, ['scripts/check-goosed-proxy-boundary.mjs']); run('mindspace publish guards', process.execPath, ['scripts/verify-mindspace-publish-guards.mjs']); console.log('h5 session patch verification ok');