/** Run every repository gate and report failures without hiding later checks. */ import { fileURLToPath } from 'node:url'; export const checks = [ 'audit:secrets', 'build', 'typecheck', 'test:contracts', 'test:tooling', 'test:integration', 'test:native', 'lint:check', ] as const; async function runTask(check: string): Promise { process.stdout.write(`\nRunning ${check}\n`); const child = Bun.spawn([process.execPath, 'run', check], { cwd: fileURLToPath(new URL('..', import.meta.url)), stdin: 'inherit', stdout: 'inherit', stderr: 'inherit', }); return child.exited; } export async function runChecks( tasks: readonly string[] = checks, run: (task: string) => Promise = runTask ): Promise { const failed: string[] = []; for (const task of tasks) { if ((await run(task)) !== 0) failed.push(task); } return failed; } if (import.meta.main) { const failed = await runChecks(); if (failed.length > 0) { process.stderr.write(`\nFailed checks: ${failed.join(', ')}\n`); process.exitCode = 1; } else { process.stdout.write('\nAll repository checks passed.\n'); } }