import path from "node:path";
import { fileURLToPath } from "node:url";
import { installGoPack } from "./go-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/install-go-engine.mjs [.engine-build/go]",
  );
}
const source = path.resolve(root, arguments_[0] ?? ".engine-build/go");
const result = await installGoPack(source, root);
console.log(`Installed verified Go engine assets at ${result.output}.`);
