droboticflow-new/scripts/check-git-hooks.mjs

13 lines
587 B
JavaScript

#!/usr/bin/env node
import { ensureGitHooks } from "./lib/git-hooks.mjs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
try {
const state = ensureGitHooks(root, { install: process.argv.includes("--install") });
console.log(`Git hooks: ${state}${state === "active" ? ` in ${root}` : " (CI, HUSKY=0, or exported source)"}`);
} catch (error) {
console.error(`Git hooks unavailable: ${error.message}. Run npm run hooks:install in this checkout.`);
process.exitCode = 1;
}