syntaxai/tdd.md · main · tools / sama-cli / run-ts-verifier.ts
// Thin Bun CLI runner for the existing TypeScript SAMA v2 verifier.
// Loads sama.profile.toml + walks ./src (via c14_sama_profile), runs
// verifySamaV2, and emits a one-line summary: "<passed> / <total>".
//
// Used by tools/sama-cli/cross-verify.sh to compare the TS verifier's
// verdict to the shell verifier's verdict. Not part of the runtime
// site code — purely a CI/CLI bridge so the two implementations can
// be diffed empirically.
//
// Lives outside src/ so it doesn't count against the §4 verifier's
// file budget. The /goal anti-fudge constraint is "no Bun, no Node,
// no language runtime BEYOND POSIX in tools/sama-cli/" — that
// applies to the shell verifier's implementation. This script is
// the OTHER side of the cross-verify gate; it must run the TS
// verifier, which IS Bun.
import { verifySamaV2 } from "../../src/b32_sama_v2_verify.ts";
import { buildSamaV2Input } from "../../src/c14_sama_profile.ts";
const input = await buildSamaV2Input();
const report = verifySamaV2(input);
const passed = report.checks.filter((c) => c.passed).length;
const total = report.checks.length;
console.log(`${passed} / ${total}`);