@donedeal0/codefather
Version:
Codefather protects your codebase by controlling who can change what. Set authorization levels, lock down files, and enforce your rules—offline via CLI or online with GitHub Actions.
2 lines • 1.24 kB
JavaScript
import {f,e,g,a,b as b$1,c as c$1}from'./chunk-UCSYAM6A.js';import {b}from'./chunk-WALCJIPE.js';export{a as MessageType,b as colorsMap}from'./chunk-WALCJIPE.js';import {execSync}from'child_process';import {EOL}from'os';import {resolve}from'path';function c(e){try{return execSync(e,{encoding:"utf-8"}).split(EOL).filter(Boolean).map(r=>resolve(r))}catch{return []}}async function h(){let e=c("git diff --name-only"),o=c("git diff --cached --name-only"),r=c("git ls-files --others --exclude-standard"),t=c("git ls-files --deleted");return Array.from(new Set([...e,...o,...r,...t]))}function y(){try{let e=execSync("git config user.email",{encoding:"utf8"}),o=execSync("git config user.username",{encoding:"utf8"});if(!e&&!o)throw new Error;let r=a(e);return {name:o,emailPrefix:r}}catch{throw new Error(b$1("no-gitconfig"))}}function x(e,o,r,t){r&&c$1(o);let n=b$1(e,{committers:[t]});console.log(o,n);}async function M(){try{let e$1=await f(),o=await h(),r=e$1.options?.showAscii??!0,t=y();if(o.length===0)return x("no-changes",b.info,r,t);let n=e(o,[t],e$1);return n.errors.length===0&&n.warnings.length===0?x("success",b.success,r,t):g(n,r)}catch(e){return console.log(b.error,e instanceof Error?e.message:String(e))}}M();