import path from "node:path";
import { fileURLToPath } from "node:url";
import { verifyRustPack } from "./rust-engine-pack.mjs";

const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const arguments_ = process.argv.slice(2);
if (arguments_.length > 1) {
  throw new Error(
    "Usage: node scripts/verify-rust-engine.mjs [public/engines/rust]",
  );
}
const pack = path.resolve(root, arguments_[0] ?? "public/engines/rust");
const metadata = await verifyRustPack(pack, root);
console.log(`Verified ${metadata.semanticIdentity}.`);
