#!/usr/bin/env bun

import { spawnSync } from "child_process";
import { resolve } from "path";

const hooksPath = resolve(".hooks");

console.log(`Setting git hooks path to ${hooksPath}...`);
const result = spawnSync("git", ["config", "core.hooksPath", hooksPath], {
  stdio: "inherit",
});

if (result.status === 0) {
  console.log("Git hooks successfully configured!");
} else {
  console.error("Failed to configure git hooks.");
  process.exit(1);
}
