im_wower
·
2026-03-26
verify-workspace.mjs
1#!/usr/bin/env node
2
3import { spawnSync } from "node:child_process";
4import { dirname, resolve } from "node:path";
5import { fileURLToPath } from "node:url";
6
7const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
8
9const testPackages = [
10 "@baa-conductor/db",
11 "@baa-conductor/host-ops",
12 "@baa-conductor/codex-app-server",
13 "@baa-conductor/codex-exec",
14 "@baa-conductor/worker-runner",
15 "@baa-conductor/status-api",
16 "@baa-conductor/conductor-daemon",
17 "@baa-conductor/codexd"
18];
19
20const entrypoints = {
21 lint: [
22 {
23 label: "workspace typecheck",
24 command: ["pnpm", "typecheck"]
25 },
26 {
27 label: "git diff hygiene",
28 command: ["git", "diff", "--check"]
29 }
30 ],
31 test: testPackages.map((pkg) => ({
32 label: `${pkg} test`,
33 command: ["pnpm", "--filter", pkg, "test"]
34 })),
35 smoke: [
36 {
37 label: "workspace build",
38 command: ["pnpm", "build"]
39 },
40 {
41 label: "runtime public API compatibility smoke",
42 command: ["node", "--test", "scripts/runtime/public-api-base.test.mjs"]
43 },
44 {
45 label: "legacy control-api absence smoke",
46 command: ["node", "--test", "tests/control-api/control-api-smoke.test.mjs"]
47 },
48 {
49 label: "codexd e2e smoke",
50 command: ["node", "--test", "tests/codexd/codexd-e2e-smoke.test.mjs"]
51 },
52 {
53 label: "browser-control e2e smoke",
54 command: ["node", "--test", "tests/browser/browser-control-e2e-smoke.test.mjs"]
55 }
56 ]
57};
58
59const mode = process.argv[2];
60const steps = entrypoints[mode];
61
62if (!steps) {
63 console.error("Usage: node scripts/verify-workspace.mjs <lint|test|smoke>");
64 process.exit(1);
65}
66
67for (const step of steps) {
68 console.log(`\n==> ${step.label}`);
69 console.log(`$ ${step.command.join(" ")}`);
70
71 const result = spawnSync(step.command[0], step.command.slice(1), {
72 cwd: repoRoot,
73 env: process.env,
74 stdio: "inherit"
75 });
76
77 if (result.error) {
78 throw result.error;
79 }
80
81 if (typeof result.status === "number" && result.status !== 0) {
82 process.exit(result.status);
83 }
84
85 if (result.signal) {
86 console.error(`Command terminated by signal: ${result.signal}`);
87 process.exit(1);
88 }
89}