basant307/AI_Governance_Project
045
1#!/usr/bin/env node2import f, { writeFileSync as w } from 'fs'3import i from './index.js'4 5let p, a, n, s, o, d6 7p = process8a = p.argv[2]9 10if (a == 'init') {11 n = 'package.json'12 s = f.readFileSync(n)13 o = JSON.parse(s)14 ;(o.scripts ||= {}).prepare = 'husky'15 w(n, JSON.stringify(o, 0, /\t/.test(s) ? '\t' : 2) + '\n')16 p.stdout.write(i())17 try { f.mkdirSync('.husky') } catch {}18 w('.husky/pre-commit', (p.env.npm_config_user_agent?.split('/')[0] ?? 'npm') + ' test\n')19 p.exit()20}21 22d = c => console.error(`husky - ${c} command is DEPRECATED`)23if (['add', 'set', 'uninstall'].includes(a)) { d(a); p.exit(1) }24if (a == 'install') d(a)25 26p.stdout.write(i(a == 'install' ? undefined : a))27 