@stacksjs/logsmith
Advanced tools
Sorry, the diff of this file is too big to display
+27
-803
| #!/usr/bin/env node | ||
| import { | ||
| analyzeCommits, | ||
| colors, | ||
| generateChangelog, | ||
| getAvailableThemes, | ||
| getLabel, | ||
| loadLogsmithConfig, | ||
| logError, | ||
| logInfo | ||
| } from "../chunk-9hzrnrhw.js"; | ||
| import{G as k,I as O,K as O6,P as B6,S as e,d as N6,j as w,p as R}from"../chunk-nkbrcqpe.js";import t from"node:process";import{EventEmitter as b6}from"node:events";import $6 from"node:process";import l from"node:process";import h from"node:process";import x6,{stdin as fz,stdout as Sz}from"node:process";import X6,{stdin as a6,stdout as c6}from"node:process";import p6 from"node:readline";var{create:T6,getPrototypeOf:P6,defineProperty:Z6,getOwnPropertyNames:I6}=Object,R6=Object.prototype.hasOwnProperty,M=(z,Z,$)=>{$=z!=null?T6(P6(z)):{};let Q=Z||!z||!z.__esModule?Z6($,"default",{value:z,enumerable:!0}):$;for(let J of I6(z))if(!R6.call(Q,J))Z6(Q,J,{get:()=>z[J],enumerable:!0});return Q},n=(z,Z)=>()=>(Z||z((Z={exports:{}}).exports,Z),Z.exports),E6=n((z,Z)=>{function $(J){return J==null?[]:Array.isArray(J)?J:[J]}function Q(J,Y,U,X){var q,G=J[Y],j=~X.string.indexOf(Y)?U==null||U===!0?"":String(U):typeof U==="boolean"?U:~X.boolean.indexOf(Y)?U==="false"?!1:U==="true"||(J._.push((q=+U,q*0===0)?q:U),!!U):(q=+U,q*0===0)?q:U;J[Y]=G==null?j:Array.isArray(G)?G.concat(j):[G,j]}Z.exports=function(J,Y){J=J||[],Y=Y||{};var U,X,q,G,j,K={_:[]},H=0,F=0,V=0,I=J.length;let g=Y.alias!==void 0,_=Y.unknown!==void 0,o=Y.default!==void 0;if(Y.alias=Y.alias||{},Y.string=$(Y.string),Y.boolean=$(Y.boolean),g)for(U in Y.alias){X=Y.alias[U]=$(Y.alias[U]);for(H=0;H<X.length;H++)(Y.alias[X[H]]=X.concat(U)).splice(H,1)}for(H=Y.boolean.length;H-- >0;){X=Y.alias[Y.boolean[H]]||[];for(F=X.length;F-- >0;)Y.boolean.push(X[F])}for(H=Y.string.length;H-- >0;){X=Y.alias[Y.string[H]]||[];for(F=X.length;F-- >0;)Y.string.push(X[F])}if(o){for(U in Y.default)if(G=typeof Y.default[U],X=Y.alias[U]=Y.alias[U]||[],Y[G]!==void 0){Y[G].push(U);for(H=0;H<X.length;H++)Y[G].push(X[H])}}let z6=_?Object.keys(Y.alias):[];for(H=0;H<I;H++){if(q=J[H],q==="--"){K._=K._.concat(J.slice(++H));break}for(F=0;F<q.length;F++)if(q.charCodeAt(F)!==45)break;if(F===0)K._.push(q);else if(q.substring(F,F+3)==="no-"){if(G=q.substring(F+3),_&&!~z6.indexOf(G))return Y.unknown(q);K[G]=!1}else{for(V=F+1;V<q.length;V++)if(q.charCodeAt(V)===61)break;G=q.substring(F,V),j=q.substring(++V)||(H+1===I||(""+J[H+1]).charCodeAt(0)===45||J[++H]),X=F===2?[G]:G;for(V=0;V<X.length;V++){if(G=X[V],_&&!~z6.indexOf(G))return Y.unknown("-".repeat(F)+G);Q(K,G,V+1<X.length||j,Y)}}}if(o){for(U in Y.default)if(K[U]===void 0)K[U]=Y.default[U]}if(g)for(U in K){X=Y.alias[U]||[];while(X.length>0)K[X.shift()]=K[U]}return K}}),N=n((z,Z)=>{var $=process||{},Q=$.argv||[],J=$.env||{},Y=!(!!J.NO_COLOR||Q.includes("--no-color"))&&(!!J.FORCE_COLOR||Q.includes("--color")||$.platform==="win32"||($.stdout||{}).isTTY&&J.TERM!=="dumb"||!!J.CI),U=(G,j,K=G)=>(H)=>{let F=""+H,V=F.indexOf(j,G.length);return~V?G+X(F,j,K,V)+j:G+F+j},X=(G,j,K,H)=>{let F="",V=0;do F+=G.substring(V,H)+K,V=H+j.length,H=G.indexOf(j,V);while(~H);return F+G.substring(V)},q=(G=Y)=>{let j=G?U:()=>String;return{isColorSupported:G,reset:j("\x1B[0m","\x1B[0m"),bold:j("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:j("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:j("\x1B[3m","\x1B[23m"),underline:j("\x1B[4m","\x1B[24m"),inverse:j("\x1B[7m","\x1B[27m"),hidden:j("\x1B[8m","\x1B[28m"),strikethrough:j("\x1B[9m","\x1B[29m"),black:j("\x1B[30m","\x1B[39m"),red:j("\x1B[31m","\x1B[39m"),green:j("\x1B[32m","\x1B[39m"),yellow:j("\x1B[33m","\x1B[39m"),blue:j("\x1B[34m","\x1B[39m"),magenta:j("\x1B[35m","\x1B[39m"),cyan:j("\x1B[36m","\x1B[39m"),white:j("\x1B[37m","\x1B[39m"),gray:j("\x1B[90m","\x1B[39m"),bgBlack:j("\x1B[40m","\x1B[49m"),bgRed:j("\x1B[41m","\x1B[49m"),bgGreen:j("\x1B[42m","\x1B[49m"),bgYellow:j("\x1B[43m","\x1B[49m"),bgBlue:j("\x1B[44m","\x1B[49m"),bgMagenta:j("\x1B[45m","\x1B[49m"),bgCyan:j("\x1B[46m","\x1B[49m"),bgWhite:j("\x1B[47m","\x1B[49m"),blackBright:j("\x1B[90m","\x1B[39m"),redBright:j("\x1B[91m","\x1B[39m"),greenBright:j("\x1B[92m","\x1B[39m"),yellowBright:j("\x1B[93m","\x1B[39m"),blueBright:j("\x1B[94m","\x1B[39m"),magentaBright:j("\x1B[95m","\x1B[39m"),cyanBright:j("\x1B[96m","\x1B[39m"),whiteBright:j("\x1B[97m","\x1B[39m"),bgBlackBright:j("\x1B[100m","\x1B[49m"),bgRedBright:j("\x1B[101m","\x1B[49m"),bgGreenBright:j("\x1B[102m","\x1B[49m"),bgYellowBright:j("\x1B[103m","\x1B[49m"),bgBlueBright:j("\x1B[104m","\x1B[49m"),bgMagentaBright:j("\x1B[105m","\x1B[49m"),bgCyanBright:j("\x1B[106m","\x1B[49m"),bgWhiteBright:j("\x1B[107m","\x1B[49m")}};Z.exports=q(),Z.exports.createColors=q}),A6=n((z,Z)=>{Z.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}}),k6=M(E6(),1);function F6(z){return z.replace(/[<[].+/,"").trim()}function C6(z){let Z=/<([^>]+)>/g,$=/\[([^\]]+)\]/g,Q=[],J=(X)=>{let q=!1,G=X[1];if(G.startsWith("..."))G=G.slice(3),q=!0;return{required:X[0].startsWith("<"),value:G,variadic:q}},Y;while(Y=Z.exec(z))Q.push(J(Y));let U;while(U=$.exec(z))Q.push(J(U));return Q}function h6(z){let Z={alias:{},boolean:[]};for(let[$,Q]of z.entries()){if(Q.names.length>1)Z.alias[Q.names[0]]=Q.names.slice(1);if(Q.isBoolean)if(Q.negated){if(!z.some((Y,U)=>{return U!==$&&Y.names.some((X)=>Q.names.includes(X))&&typeof Y.required==="boolean"}))Z.boolean.push(Q.names[0])}else Z.boolean.push(Q.names[0])}return Z}function Q6(z){return z.sort((Z,$)=>{return Z.length>$.length?-1:1})[0]}function J6(z,Z){return z.length>=Z?z:`${z}${" ".repeat(Z-z.length)}`}function v6(z){return z.replace(/([a-z])-([a-z])/g,(Z,$,Q)=>{return $+Q.toUpperCase()})}function y6(z,Z,$){let Q=0,J=Z.length,Y=z,U;for(;Q<J;++Q)U=Y[Z[Q]],Y=Y[Z[Q]]=Q===J-1?$:U!=null?U:!!~Z[Q+1].indexOf(".")||!(+Z[Q+1]>-1)?{}:[]}function f6(z,Z){for(let $ of Object.keys(Z)){let Q=Z[$];if(Q.shouldTransform){if(z[$]=Array.prototype.concat.call([],z[$]),typeof Q.transformFunction==="function")z[$]=z[$].map(Q.transformFunction)}}}function S6(z){let Z=/([^\\/]+)$/.exec(z);return Z?Z[1]:""}function V6(z){return z.split(".").map((Z,$)=>{return $===0?v6(Z):Z}).join(".")}class C extends Error{constructor(z){super(z);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=new Error(z).stack}}function g6(){let{env:z}=$6,{TERM:Z,TERM_PROGRAM:$}=z;if($6.platform!=="win32")return Z!=="linux";return Boolean(z.WT_SESSION)||Boolean(z.TERMINUS_SUBLIME)||z.ConEmuTask==="{cmd::Cmder}"||$==="Terminus-Sublime"||$==="vscode"||Z==="xterm-256color"||Z==="alacritty"||Z==="rxvt-unicode"||Z==="rxvt-unicode-256color"||z.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var y="\x1B",L=`${y}[`;var B={to(z,Z){if(!Z)return`${L}${z+1}G`;return`${L}${Z+1};${z+1}H`},move(z,Z){let $="";if(z<0)$+=`${L}${-z}D`;else if(z>0)$+=`${L}${z}C`;if(Z<0)$+=`${L}${-Z}A`;else if(Z>0)$+=`${L}${Z}B`;return $},up:(z=1)=>`${L}${z}A`,down:(z=1)=>`${L}${z}B`,forward:(z=1)=>`${L}${z}C`,backward:(z=1)=>`${L}${z}D`,nextLine:(z=1)=>`${L}E`.repeat(z),prevLine:(z=1)=>`${L}F`.repeat(z),left:`${L}G`,hide:`${L}?25l`,show:`${L}?25h`,save:`${y}7`,restore:`${y}8`};var d={screen:`${L}2J`,up:(z=1)=>`${L}1J`.repeat(z),down:(z=1)=>`${L}J`.repeat(z),line:`${L}2K`,lineEnd:`${L}K`,lineStart:`${L}1K`,lines(z){let Z="";for(let $=0;$<z;$++)Z+=this.line+($<z-1?B.up():"");if(z)Z+=B.left;return Z}},kz={screen:`${y}c`};class D6{rawName;description;name;names;isBoolean;required;config;negated;constructor(z,Z,$){if(this.rawName=z,this.description=Z,this.config=Object.assign({},$),z=z.replace(/\.\*/g,""),this.negated=!1,this.names=F6(z).split(",").map((Q)=>{let J=Q.trim().replace(/^-{1,2}/,"");if(J.startsWith("no-"))this.negated=!0,J=J.replace(/^no-/,"");return V6(J)}).sort((Q,J)=>Q.length>J.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(z.includes("<"))this.required=!0;else if(z.includes("["))this.required=!1;else this.isBoolean=!0}}var Cz=l.argv,_6=`${l.platform}-${l.arch} bun-v${typeof Bun!=="undefined"?Bun.version:"unknown"}`,d6=h.argv,u6=`${h.platform}-${h.arch} node-${h.version}`;class a{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(z,Z,$,Q){if(this.rawName=z,this.description=Z,this.config=$,this.cli=Q,this.options=[],this.aliasNames=[],this.name=F6(z),this.args=C6(z),this.examples=[],!$)this.config={}}usage(z){return this.usageText=z,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(z,Z="-v, --version"){return this.versionNumber=z,this.option(Z,"Display version number"),this}example(z){return this.examples.push(z),this}option(z,Z,$){let Q=new D6(z,Z,$);return this.options.push(Q),this}alias(z){return this.aliasNames.push(z),this}action(z){return this.commandAction=z,this}isMatched(z){return this.name===z||this.aliasNames.includes(z)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof c}hasOption(z){return z=z.split(".")[0],!!this.options.find((Z)=>{return Z.names.includes(z)})}outputHelp(){let{name:z,commands:Z}=this.cli,{versionNumber:$,options:Q,helpCallback:J}=this.cli.globalCommand,Y=[{body:`${z}${$?`/${$}`:""}`}];if(Y.push({title:"Usage",body:` $ ${z} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&Z.length>0){let q=Q6(Z.map((G)=>G.rawName));Y.push({title:"Commands",body:Z.map((G)=>{return` ${J6(G.rawName,q.length)} ${G.description}`}).join(` | ||
| `)}),Y.push({title:"For more info, run any command with the `--help` flag",body:Z.map((G)=>` $ ${z}${G.name===""?"":` ${G.name}`} --help`).join(` | ||
| `)})}let X=this.isGlobalCommand?Q:[...this.options,...Q||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)X=X.filter((q)=>q.name!=="version");if(X.length>0){let q=Q6(X.map((G)=>G.rawName));Y.push({title:"Options",body:X.map((G)=>{return` ${J6(G.rawName,q.length)} ${G.description} ${G.config.default===void 0?"":`(default: ${G.config.default})`}`}).join(` | ||
| `)})}if(this.examples.length>0)Y.push({title:"Examples",body:this.examples.map((q)=>{if(typeof q==="function")return q(z);return q}).join(` | ||
| `)});if(J)Y=J(Y)||Y;console.log(Y.map((q)=>{return q.title?`${q.title}: | ||
| ${q.body}`:q.body}).join(` | ||
| // bin/cli.ts | ||
| import process2 from "node:process"; | ||
| // ../../node_modules/cac/dist/index.mjs | ||
| import { EventEmitter } from "events"; | ||
| function toArr(any) { | ||
| return any == null ? [] : Array.isArray(any) ? any : [any]; | ||
| } | ||
| function toVal(out, key, val, opts) { | ||
| var x, old = out[key], nxt = ~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val; | ||
| out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt]; | ||
| } | ||
| function mri2(args, opts) { | ||
| args = args || []; | ||
| opts = opts || {}; | ||
| var k, arr, arg, name, val, out = { _: [] }; | ||
| var i = 0, j = 0, idx = 0, len = args.length; | ||
| const alibi = opts.alias !== undefined; | ||
| const strict = opts.unknown !== undefined; | ||
| const defaults = opts.default !== undefined; | ||
| opts.alias = opts.alias || {}; | ||
| opts.string = toArr(opts.string); | ||
| opts.boolean = toArr(opts.boolean); | ||
| if (alibi) { | ||
| for (k in opts.alias) { | ||
| arr = opts.alias[k] = toArr(opts.alias[k]); | ||
| for (i = 0;i < arr.length; i++) { | ||
| (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1); | ||
| } | ||
| } | ||
| } | ||
| for (i = opts.boolean.length;i-- > 0; ) { | ||
| arr = opts.alias[opts.boolean[i]] || []; | ||
| for (j = arr.length;j-- > 0; ) | ||
| opts.boolean.push(arr[j]); | ||
| } | ||
| for (i = opts.string.length;i-- > 0; ) { | ||
| arr = opts.alias[opts.string[i]] || []; | ||
| for (j = arr.length;j-- > 0; ) | ||
| opts.string.push(arr[j]); | ||
| } | ||
| if (defaults) { | ||
| for (k in opts.default) { | ||
| name = typeof opts.default[k]; | ||
| arr = opts.alias[k] = opts.alias[k] || []; | ||
| if (opts[name] !== undefined) { | ||
| opts[name].push(k); | ||
| for (i = 0;i < arr.length; i++) { | ||
| opts[name].push(arr[i]); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| const keys = strict ? Object.keys(opts.alias) : []; | ||
| for (i = 0;i < len; i++) { | ||
| arg = args[i]; | ||
| if (arg === "--") { | ||
| out._ = out._.concat(args.slice(++i)); | ||
| break; | ||
| } | ||
| for (j = 0;j < arg.length; j++) { | ||
| if (arg.charCodeAt(j) !== 45) | ||
| break; | ||
| } | ||
| if (j === 0) { | ||
| out._.push(arg); | ||
| } else if (arg.substring(j, j + 3) === "no-") { | ||
| name = arg.substring(j + 3); | ||
| if (strict && !~keys.indexOf(name)) { | ||
| return opts.unknown(arg); | ||
| } | ||
| out[name] = false; | ||
| } else { | ||
| for (idx = j + 1;idx < arg.length; idx++) { | ||
| if (arg.charCodeAt(idx) === 61) | ||
| break; | ||
| } | ||
| name = arg.substring(j, idx); | ||
| val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]); | ||
| arr = j === 2 ? [name] : name; | ||
| for (idx = 0;idx < arr.length; idx++) { | ||
| name = arr[idx]; | ||
| if (strict && !~keys.indexOf(name)) | ||
| return opts.unknown("-".repeat(j) + name); | ||
| toVal(out, name, idx + 1 < arr.length || val, opts); | ||
| } | ||
| } | ||
| } | ||
| if (defaults) { | ||
| for (k in opts.default) { | ||
| if (out[k] === undefined) { | ||
| out[k] = opts.default[k]; | ||
| } | ||
| } | ||
| } | ||
| if (alibi) { | ||
| for (k in out) { | ||
| arr = opts.alias[k] || []; | ||
| while (arr.length > 0) { | ||
| out[arr.shift()] = out[k]; | ||
| } | ||
| } | ||
| } | ||
| return out; | ||
| } | ||
| var removeBrackets = (v) => v.replace(/[<[].+/, "").trim(); | ||
| var findAllBrackets = (v) => { | ||
| const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g; | ||
| const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g; | ||
| const res = []; | ||
| const parse = (match) => { | ||
| let variadic = false; | ||
| let value = match[1]; | ||
| if (value.startsWith("...")) { | ||
| value = value.slice(3); | ||
| variadic = true; | ||
| } | ||
| return { | ||
| required: match[0].startsWith("<"), | ||
| value, | ||
| variadic | ||
| }; | ||
| }; | ||
| let angledMatch; | ||
| while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) { | ||
| res.push(parse(angledMatch)); | ||
| } | ||
| let squareMatch; | ||
| while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) { | ||
| res.push(parse(squareMatch)); | ||
| } | ||
| return res; | ||
| }; | ||
| var getMriOptions = (options) => { | ||
| const result = { alias: {}, boolean: [] }; | ||
| for (const [index, option] of options.entries()) { | ||
| if (option.names.length > 1) { | ||
| result.alias[option.names[0]] = option.names.slice(1); | ||
| } | ||
| if (option.isBoolean) { | ||
| if (option.negated) { | ||
| const hasStringTypeOption = options.some((o, i) => { | ||
| return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean"; | ||
| }); | ||
| if (!hasStringTypeOption) { | ||
| result.boolean.push(option.names[0]); | ||
| } | ||
| } else { | ||
| result.boolean.push(option.names[0]); | ||
| } | ||
| } | ||
| } | ||
| return result; | ||
| }; | ||
| var findLongest = (arr) => { | ||
| return arr.sort((a, b) => { | ||
| return a.length > b.length ? -1 : 1; | ||
| })[0]; | ||
| }; | ||
| var padRight = (str, length) => { | ||
| return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`; | ||
| }; | ||
| var camelcase = (input) => { | ||
| return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => { | ||
| return p1 + p2.toUpperCase(); | ||
| }); | ||
| }; | ||
| var setDotProp = (obj, keys, val) => { | ||
| let i = 0; | ||
| let length = keys.length; | ||
| let t = obj; | ||
| let x; | ||
| for (;i < length; ++i) { | ||
| x = t[keys[i]]; | ||
| t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : []; | ||
| } | ||
| }; | ||
| var setByType = (obj, transforms) => { | ||
| for (const key of Object.keys(transforms)) { | ||
| const transform = transforms[key]; | ||
| if (transform.shouldTransform) { | ||
| obj[key] = Array.prototype.concat.call([], obj[key]); | ||
| if (typeof transform.transformFunction === "function") { | ||
| obj[key] = obj[key].map(transform.transformFunction); | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| var getFileName = (input) => { | ||
| const m = /([^\\\/]+)$/.exec(input); | ||
| return m ? m[1] : ""; | ||
| }; | ||
| var camelcaseOptionName = (name) => { | ||
| return name.split(".").map((v, i) => { | ||
| return i === 0 ? camelcase(v) : v; | ||
| }).join("."); | ||
| }; | ||
| class CACError extends Error { | ||
| constructor(message) { | ||
| super(message); | ||
| this.name = this.constructor.name; | ||
| if (typeof Error.captureStackTrace === "function") { | ||
| Error.captureStackTrace(this, this.constructor); | ||
| } else { | ||
| this.stack = new Error(message).stack; | ||
| } | ||
| } | ||
| } | ||
| class Option { | ||
| constructor(rawName, description, config) { | ||
| this.rawName = rawName; | ||
| this.description = description; | ||
| this.config = Object.assign({}, config); | ||
| rawName = rawName.replace(/\.\*/g, ""); | ||
| this.negated = false; | ||
| this.names = removeBrackets(rawName).split(",").map((v) => { | ||
| let name = v.trim().replace(/^-{1,2}/, ""); | ||
| if (name.startsWith("no-")) { | ||
| this.negated = true; | ||
| name = name.replace(/^no-/, ""); | ||
| } | ||
| return camelcaseOptionName(name); | ||
| }).sort((a, b) => a.length > b.length ? 1 : -1); | ||
| this.name = this.names[this.names.length - 1]; | ||
| if (this.negated && this.config.default == null) { | ||
| this.config.default = true; | ||
| } | ||
| if (rawName.includes("<")) { | ||
| this.required = true; | ||
| } else if (rawName.includes("[")) { | ||
| this.required = false; | ||
| } else { | ||
| this.isBoolean = true; | ||
| } | ||
| } | ||
| } | ||
| var processArgs = process.argv; | ||
| var platformInfo = `${process.platform}-${process.arch} node-${process.version}`; | ||
| class Command { | ||
| constructor(rawName, description, config = {}, cli) { | ||
| this.rawName = rawName; | ||
| this.description = description; | ||
| this.config = config; | ||
| this.cli = cli; | ||
| this.options = []; | ||
| this.aliasNames = []; | ||
| this.name = removeBrackets(rawName); | ||
| this.args = findAllBrackets(rawName); | ||
| this.examples = []; | ||
| } | ||
| usage(text) { | ||
| this.usageText = text; | ||
| return this; | ||
| } | ||
| allowUnknownOptions() { | ||
| this.config.allowUnknownOptions = true; | ||
| return this; | ||
| } | ||
| ignoreOptionDefaultValue() { | ||
| this.config.ignoreOptionDefaultValue = true; | ||
| return this; | ||
| } | ||
| version(version, customFlags = "-v, --version") { | ||
| this.versionNumber = version; | ||
| this.option(customFlags, "Display version number"); | ||
| return this; | ||
| } | ||
| example(example) { | ||
| this.examples.push(example); | ||
| return this; | ||
| } | ||
| option(rawName, description, config) { | ||
| const option = new Option(rawName, description, config); | ||
| this.options.push(option); | ||
| return this; | ||
| } | ||
| alias(name) { | ||
| this.aliasNames.push(name); | ||
| return this; | ||
| } | ||
| action(callback) { | ||
| this.commandAction = callback; | ||
| return this; | ||
| } | ||
| isMatched(name) { | ||
| return this.name === name || this.aliasNames.includes(name); | ||
| } | ||
| get isDefaultCommand() { | ||
| return this.name === "" || this.aliasNames.includes("!"); | ||
| } | ||
| get isGlobalCommand() { | ||
| return this instanceof GlobalCommand; | ||
| } | ||
| hasOption(name) { | ||
| name = name.split(".")[0]; | ||
| return this.options.find((option) => { | ||
| return option.names.includes(name); | ||
| }); | ||
| } | ||
| outputHelp() { | ||
| const { name, commands } = this.cli; | ||
| const { | ||
| versionNumber, | ||
| options: globalOptions, | ||
| helpCallback | ||
| } = this.cli.globalCommand; | ||
| let sections = [ | ||
| { | ||
| body: `${name}${versionNumber ? `/${versionNumber}` : ""}` | ||
| } | ||
| ]; | ||
| sections.push({ | ||
| title: "Usage", | ||
| body: ` $ ${name} ${this.usageText || this.rawName}` | ||
| }); | ||
| const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0; | ||
| if (showCommands) { | ||
| const longestCommandName = findLongest(commands.map((command) => command.rawName)); | ||
| sections.push({ | ||
| title: "Commands", | ||
| body: commands.map((command) => { | ||
| return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`; | ||
| }).join(` | ||
| `) | ||
| }); | ||
| sections.push({ | ||
| title: `For more info, run any command with the \`--help\` flag`, | ||
| body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(` | ||
| `) | ||
| }); | ||
| } | ||
| let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []]; | ||
| if (!this.isGlobalCommand && !this.isDefaultCommand) { | ||
| options = options.filter((option) => option.name !== "version"); | ||
| } | ||
| if (options.length > 0) { | ||
| const longestOptionName = findLongest(options.map((option) => option.rawName)); | ||
| sections.push({ | ||
| title: "Options", | ||
| body: options.map((option) => { | ||
| return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === undefined ? "" : `(default: ${option.config.default})`}`; | ||
| }).join(` | ||
| `) | ||
| }); | ||
| } | ||
| if (this.examples.length > 0) { | ||
| sections.push({ | ||
| title: "Examples", | ||
| body: this.examples.map((example) => { | ||
| if (typeof example === "function") { | ||
| return example(name); | ||
| } | ||
| return example; | ||
| }).join(` | ||
| `) | ||
| }); | ||
| } | ||
| if (helpCallback) { | ||
| sections = helpCallback(sections) || sections; | ||
| } | ||
| console.log(sections.map((section) => { | ||
| return section.title ? `${section.title}: | ||
| ${section.body}` : section.body; | ||
| }).join(` | ||
| `)); | ||
| } | ||
| outputVersion() { | ||
| const { name } = this.cli; | ||
| const { versionNumber } = this.cli.globalCommand; | ||
| if (versionNumber) { | ||
| console.log(`${name}/${versionNumber} ${platformInfo}`); | ||
| } | ||
| } | ||
| checkRequiredArgs() { | ||
| const minimalArgsCount = this.args.filter((arg) => arg.required).length; | ||
| if (this.cli.args.length < minimalArgsCount) { | ||
| throw new CACError(`missing required args for command \`${this.rawName}\``); | ||
| } | ||
| } | ||
| checkUnknownOptions() { | ||
| const { options, globalCommand } = this.cli; | ||
| if (!this.config.allowUnknownOptions) { | ||
| for (const name of Object.keys(options)) { | ||
| if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) { | ||
| throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| checkOptionValue() { | ||
| const { options: parsedOptions, globalCommand } = this.cli; | ||
| const options = [...globalCommand.options, ...this.options]; | ||
| for (const option of options) { | ||
| const value = parsedOptions[option.name.split(".")[0]]; | ||
| if (option.required) { | ||
| const hasNegated = options.some((o) => o.negated && o.names.includes(option.name)); | ||
| if (value === true || value === false && !hasNegated) { | ||
| throw new CACError(`option \`${option.rawName}\` value is missing`); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| class GlobalCommand extends Command { | ||
| constructor(cli) { | ||
| super("@@global@@", "", {}, cli); | ||
| } | ||
| } | ||
| var __assign = Object.assign; | ||
| class CAC extends EventEmitter { | ||
| constructor(name = "") { | ||
| super(); | ||
| this.name = name; | ||
| this.commands = []; | ||
| this.rawArgs = []; | ||
| this.args = []; | ||
| this.options = {}; | ||
| this.globalCommand = new GlobalCommand(this); | ||
| this.globalCommand.usage("<command> [options]"); | ||
| } | ||
| usage(text) { | ||
| this.globalCommand.usage(text); | ||
| return this; | ||
| } | ||
| command(rawName, description, config) { | ||
| const command = new Command(rawName, description || "", config, this); | ||
| command.globalCommand = this.globalCommand; | ||
| this.commands.push(command); | ||
| return command; | ||
| } | ||
| option(rawName, description, config) { | ||
| this.globalCommand.option(rawName, description, config); | ||
| return this; | ||
| } | ||
| help(callback) { | ||
| this.globalCommand.option("-h, --help", "Display this message"); | ||
| this.globalCommand.helpCallback = callback; | ||
| this.showHelpOnExit = true; | ||
| return this; | ||
| } | ||
| version(version, customFlags = "-v, --version") { | ||
| this.globalCommand.version(version, customFlags); | ||
| this.showVersionOnExit = true; | ||
| return this; | ||
| } | ||
| example(example) { | ||
| this.globalCommand.example(example); | ||
| return this; | ||
| } | ||
| outputHelp() { | ||
| if (this.matchedCommand) { | ||
| this.matchedCommand.outputHelp(); | ||
| } else { | ||
| this.globalCommand.outputHelp(); | ||
| } | ||
| } | ||
| outputVersion() { | ||
| this.globalCommand.outputVersion(); | ||
| } | ||
| setParsedInfo({ args, options }, matchedCommand, matchedCommandName) { | ||
| this.args = args; | ||
| this.options = options; | ||
| if (matchedCommand) { | ||
| this.matchedCommand = matchedCommand; | ||
| } | ||
| if (matchedCommandName) { | ||
| this.matchedCommandName = matchedCommandName; | ||
| } | ||
| return this; | ||
| } | ||
| unsetMatchedCommand() { | ||
| this.matchedCommand = undefined; | ||
| this.matchedCommandName = undefined; | ||
| } | ||
| parse(argv = processArgs, { | ||
| run = true | ||
| } = {}) { | ||
| this.rawArgs = argv; | ||
| if (!this.name) { | ||
| this.name = argv[1] ? getFileName(argv[1]) : "cli"; | ||
| } | ||
| let shouldParse = true; | ||
| for (const command of this.commands) { | ||
| const parsed = this.mri(argv.slice(2), command); | ||
| const commandName = parsed.args[0]; | ||
| if (command.isMatched(commandName)) { | ||
| shouldParse = false; | ||
| const parsedInfo = __assign(__assign({}, parsed), { | ||
| args: parsed.args.slice(1) | ||
| }); | ||
| this.setParsedInfo(parsedInfo, command, commandName); | ||
| this.emit(`command:${commandName}`, command); | ||
| } | ||
| } | ||
| if (shouldParse) { | ||
| for (const command of this.commands) { | ||
| if (command.name === "") { | ||
| shouldParse = false; | ||
| const parsed = this.mri(argv.slice(2), command); | ||
| this.setParsedInfo(parsed, command); | ||
| this.emit(`command:!`, command); | ||
| } | ||
| } | ||
| } | ||
| if (shouldParse) { | ||
| const parsed = this.mri(argv.slice(2)); | ||
| this.setParsedInfo(parsed); | ||
| } | ||
| if (this.options.help && this.showHelpOnExit) { | ||
| this.outputHelp(); | ||
| run = false; | ||
| this.unsetMatchedCommand(); | ||
| } | ||
| if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) { | ||
| this.outputVersion(); | ||
| run = false; | ||
| this.unsetMatchedCommand(); | ||
| } | ||
| const parsedArgv = { args: this.args, options: this.options }; | ||
| if (run) { | ||
| this.runMatchedCommand(); | ||
| } | ||
| if (!this.matchedCommand && this.args[0]) { | ||
| this.emit("command:*"); | ||
| } | ||
| return parsedArgv; | ||
| } | ||
| mri(argv, command) { | ||
| const cliOptions = [ | ||
| ...this.globalCommand.options, | ||
| ...command ? command.options : [] | ||
| ]; | ||
| const mriOptions = getMriOptions(cliOptions); | ||
| let argsAfterDoubleDashes = []; | ||
| const doubleDashesIndex = argv.indexOf("--"); | ||
| if (doubleDashesIndex > -1) { | ||
| argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1); | ||
| argv = argv.slice(0, doubleDashesIndex); | ||
| } | ||
| let parsed = mri2(argv, mriOptions); | ||
| parsed = Object.keys(parsed).reduce((res, name) => { | ||
| return __assign(__assign({}, res), { | ||
| [camelcaseOptionName(name)]: parsed[name] | ||
| }); | ||
| }, { _: [] }); | ||
| const args = parsed._; | ||
| const options = { | ||
| "--": argsAfterDoubleDashes | ||
| }; | ||
| const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue; | ||
| let transforms = Object.create(null); | ||
| for (const cliOption of cliOptions) { | ||
| if (!ignoreDefault && cliOption.config.default !== undefined) { | ||
| for (const name of cliOption.names) { | ||
| options[name] = cliOption.config.default; | ||
| } | ||
| } | ||
| if (Array.isArray(cliOption.config.type)) { | ||
| if (transforms[cliOption.name] === undefined) { | ||
| transforms[cliOption.name] = Object.create(null); | ||
| transforms[cliOption.name]["shouldTransform"] = true; | ||
| transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0]; | ||
| } | ||
| } | ||
| } | ||
| for (const key of Object.keys(parsed)) { | ||
| if (key !== "_") { | ||
| const keys = key.split("."); | ||
| setDotProp(options, keys, parsed[key]); | ||
| setByType(options, transforms); | ||
| } | ||
| } | ||
| return { | ||
| args, | ||
| options | ||
| }; | ||
| } | ||
| runMatchedCommand() { | ||
| const { args, options, matchedCommand: command } = this; | ||
| if (!command || !command.commandAction) | ||
| return; | ||
| command.checkUnknownOptions(); | ||
| command.checkOptionValue(); | ||
| command.checkRequiredArgs(); | ||
| const actionArgs = []; | ||
| command.args.forEach((arg, index) => { | ||
| if (arg.variadic) { | ||
| actionArgs.push(args.slice(index)); | ||
| } else { | ||
| actionArgs.push(args[index]); | ||
| } | ||
| }); | ||
| actionArgs.push(options); | ||
| return command.commandAction.apply(this, actionArgs); | ||
| } | ||
| } | ||
| // package.json | ||
| var version = "0.1.18"; | ||
| // bin/cli.ts | ||
| var cli = new CAC("logsmith"); | ||
| cli.command("[...args]", "Generate changelog").option("--from <ref>", "Start commit reference (default: latest git tag)").option("--to <ref>", "End commit reference (default: HEAD)").option("--dir <dir>", "Path to git repository (default: current directory)").option("--output [file]", "Changelog file name (default: CHANGELOG.md). Use --no-output to write to console only").option("--format <format>", "Output format: markdown, json, html (default: markdown)").option("--language <lang>", "Language for changelog: en, es, fr, de, zh, ja, ko, ru, pt, it (default: en)").option("--theme <theme>", "Theme for styling: default, minimal, github, gitmoji, unicode, simple, colorful, corporate (default: default)").option("--no-output", "Write to console only").option("--clean", "Determine if the working directory is clean and exit if not").option("--exclude-authors <authors>", "Skip contributors (comma-separated)").option("--include-authors <authors>", "Include only specific contributors (comma-separated)").option("--hide-author-email", "Do not include author email in changelog").option("--exclude-types <types>", "Exclude commit types (comma-separated)").option("--include-types <types>", "Include only specific commit types (comma-separated)").option("--exclude-scopes <scopes>", "Exclude commit scopes (comma-separated)").option("--include-scopes <scopes>", "Include only specific commit scopes (comma-separated)").option("--min-commits <number>", "Minimum commits required to include a section", { type: [Number] }).option("--max-commits <number>", "Maximum commits per section (0 = unlimited)", { type: [Number] }).option("--no-dates", "Hide dates from changelog").option("--no-breaking-group", "Don't group breaking changes separately").option("--include-body", "Include commit body in changelog entries").option("--no-linkify", "Don't linkify issues and PRs").option("--max-length <number>", "Maximum description length (0 = unlimited)", { type: [Number] }).option("--no-markdown-lint", "Disable markdown linting and auto-fixing").option("--verbose", "Enable verbose logging").example("logsmith").example("logsmith --from v1.0.0 --to HEAD").example("logsmith --output CHANGELOG.md").example("logsmith --format json --output changelog.json").example("logsmith --format html --output changelog.html").example("logsmith --no-output").example('logsmith --exclude-authors "dependabot[bot],github-actions[bot]"').example('logsmith --exclude-types "chore,ci" --include-types "feat,fix"').example("logsmith --min-commits 2 --max-commits 10").example("logsmith --theme github --language en").example("logsmith --theme minimal --format html").example("logsmith --theme gitmoji --output CHANGELOG.md").action(async (args, options) => { | ||
| try { | ||
| let fromRef = options.from; | ||
| let toRef = options.to || "HEAD"; | ||
| if (args.length >= 4 && args[0] === "from" && args[2] === "to") { | ||
| fromRef = args[1]; | ||
| toRef = args[3]; | ||
| } | ||
| const validFormats = ["markdown", "json", "html"]; | ||
| const format = options.format || "markdown"; | ||
| if (!validFormats.includes(format)) { | ||
| logError(`Invalid format: ${format}. Valid formats are: ${validFormats.join(", ")}`); | ||
| } | ||
| const validThemes = ["default", "minimal", "github", "gitmoji", "unicode", "simple", "colorful", "corporate"]; | ||
| const theme = options.theme || "default"; | ||
| if (!validThemes.includes(theme)) { | ||
| logError(`Invalid theme: ${theme}. Valid themes are: ${validThemes.join(", ")}`); | ||
| } | ||
| let outputFile = options.output; | ||
| let actualFormat = format; | ||
| if (outputFile && typeof outputFile === "string" && !options.format) { | ||
| if (outputFile.endsWith(".json")) { | ||
| actualFormat = "json"; | ||
| } else if (outputFile.endsWith(".html") || outputFile.endsWith(".htm")) { | ||
| actualFormat = "html"; | ||
| } | ||
| } else if (!outputFile) { | ||
| const extensions = { json: "json", html: "html", markdown: "md" }; | ||
| outputFile = `CHANGELOG.${extensions[format]}`; | ||
| actualFormat = format; | ||
| } | ||
| const cliOptions = { | ||
| from: fromRef, | ||
| to: toRef, | ||
| dir: options.dir || process2.cwd(), | ||
| output: outputFile !== undefined ? outputFile : "CHANGELOG.md", | ||
| format: actualFormat, | ||
| language: options.language || "en", | ||
| theme, | ||
| clean: options.clean || false, | ||
| excludeAuthors: options.excludeAuthors ? options.excludeAuthors.split(",").map((s) => s.trim()) : undefined, | ||
| includeAuthors: options.includeAuthors ? options.includeAuthors.split(",").map((s) => s.trim()) : [], | ||
| hideAuthorEmail: options.hideAuthorEmail || false, | ||
| excludeCommitTypes: options.excludeTypes ? options.excludeTypes.split(",").map((s) => s.trim()) : [], | ||
| includeCommitTypes: options.includeTypes ? options.includeTypes.split(",").map((s) => s.trim()) : [], | ||
| excludeScopes: options.excludeScopes ? options.excludeScopes.split(",").map((s) => s.trim()) : [], | ||
| includeScopes: options.includeScopes ? options.includeScopes.split(",").map((s) => s.trim()) : [], | ||
| minCommitsForSection: options["min-commits"] || 1, | ||
| maxCommitsPerSection: options["max-commits"] || 0, | ||
| includeDates: options.dates !== false, | ||
| groupBreakingChanges: options.breakingGroup !== false, | ||
| includeCommitBody: options.includeBody || false, | ||
| linkifyIssues: options.linkify !== false, | ||
| linkifyPRs: options.linkify !== false, | ||
| maxDescriptionLength: options.maxLength || 0, | ||
| markdownLint: options.markdownLint !== false, | ||
| verbose: options.verbose || false | ||
| }; | ||
| if (options.noOutput) { | ||
| cliOptions.output = false; | ||
| } | ||
| const config = await loadLogsmithConfig(cliOptions); | ||
| if (config.verbose) { | ||
| logInfo("Loaded configuration"); | ||
| logInfo(`Working directory: ${config.dir}`); | ||
| logInfo(`Output format: ${config.format}`); | ||
| } | ||
| const result = await generateChangelog(config); | ||
| if (config.output === false && result.content) { | ||
| console.log(result.content); | ||
| } | ||
| if (config.verbose) { | ||
| if (result.outputPath) { | ||
| logInfo(`Changelog written to ${result.outputPath}`); | ||
| } | ||
| logInfo("✨ Done!"); | ||
| } | ||
| } catch (error) { | ||
| logError(`Failed to generate changelog: ${error}`); | ||
| } | ||
| }); | ||
| cli.command("stats", "Show repository statistics and trends").option("--from <ref>", "Start commit reference (default: latest git tag)").option("--to <ref>", "End commit reference (default: HEAD)").option("--dir <dir>", "Path to git repository (default: current directory)").option("--language <lang>", "Language for output: en, es, fr, de, zh, ja, ko, ru, pt, it (default: en)").option("--json", "Output in JSON format").option("--verbose", "Enable verbose logging").example("logsmith stats").example("logsmith stats --from v1.0.0 --to HEAD").example("logsmith stats --json").action(async (options) => { | ||
| try { | ||
| const cliOptions = { | ||
| from: options.from, | ||
| to: options.to || "HEAD", | ||
| dir: options.dir || process2.cwd(), | ||
| language: options.language || "en", | ||
| verbose: options.verbose || false | ||
| }; | ||
| const config = await loadLogsmithConfig(cliOptions); | ||
| if (config.verbose) { | ||
| logInfo("Analyzing repository statistics..."); | ||
| logInfo(`Working directory: ${config.dir}`); | ||
| logInfo(`Range: ${config.from || "first commit"} → ${config.to}`); | ||
| } | ||
| const stats = analyzeCommits(config); | ||
| if (options.json) { | ||
| console.log(JSON.stringify(stats, null, 2)); | ||
| } else { | ||
| displayStats(stats, config.language); | ||
| } | ||
| if (config.verbose) { | ||
| logInfo("✨ Analysis complete!"); | ||
| } | ||
| } catch (error) { | ||
| logError(`Failed to analyze repository: ${error}`); | ||
| } | ||
| }); | ||
| cli.command("themes", "List available themes").action(() => { | ||
| const themes = getAvailableThemes(); | ||
| console.log(` | ||
| `))}outputVersion(){let{name:z}=this.cli,{versionNumber:Z}=this.cli.globalCommand;if(Z){let $;if(Bun)$=_6;else $=u6;console.log(`${z}/${Z} ${$}`)}}checkRequiredArgs(){let z=this.args.filter((Z)=>Z.required).length;if(this.cli.args.length<z)throw new C(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:z,globalCommand:Z}=this.cli;if(!this.config.allowUnknownOptions){for(let $ of Object.keys(z))if($!=="--"&&!this.hasOption($)&&!Z.hasOption($))throw new C(`Unknown option \`${$.length>1?`--${$}`:`-${$}`}\``)}}checkOptionValue(){let{options:z,globalCommand:Z}=this.cli,$=[...Z.options,...this.options];for(let Q of $){let J=z[Q.name.split(".")[0]];if(Q.required){let Y=$.some((U)=>U.negated&&U.names.includes(Q.name));if(J===!0||J===!1&&!Y)throw new C(`option \`${Q.rawName}\` value is missing`)}}}}class c extends a{constructor(z){super("@@global@@","",{},z)}}var m6=a;class p extends b6{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(z=""){super();this.name=z,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new c(this),this.globalCommand.usage("<command> [options]")}usage(z){return this.globalCommand.usage(z),this}command(z,Z,$){if(!$)$={};let Q=new m6(z,Z||"",$,this);return Q.globalCommand=this.globalCommand,this.commands.push(Q),Q}option(z,Z,$){return this.globalCommand.option(z,Z,$),this}help(z){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=z,this.showHelpOnExit=!0,this}version(z,Z="-v, --version"){return this.globalCommand.version(z,Z),this.showVersionOnExit=!0,this}example(z){return this.globalCommand.example(z),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:z,options:Z},$,Q){if(this.args=z,this.options=Z,$)this.matchedCommand=$;if(Q)this.matchedCommandName=Q;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(z=d6,{run:Z=!0}={}){if(this.rawArgs=z,!this.name)this.name=z[1]?S6(z[1]):"cli";let $=!0;for(let J of this.commands){let Y=this.mri(z.slice(2),J),U=Y.args[0];if(J.isMatched(U)){$=!1;let X={...Y,args:Y.args.slice(1)};this.setParsedInfo(X,J,U),this.emit(`command:${U}`,J)}}if($){for(let J of this.commands)if(J.name===""){$=!1;let Y=this.mri(z.slice(2),J);this.setParsedInfo(Y,J),this.emit("command:!",J)}}if($){let J=this.mri(z.slice(2));this.setParsedInfo(J)}if(this.options.help&&this.showHelpOnExit)this.outputHelp(),Z=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),Z=!1,this.unsetMatchedCommand();let Q={args:this.args,options:this.options};if(Z)this.runMatchedCommand();if(!this.matchedCommand&&this.args[0])this.emit("command:*");return Q}mri(z,Z){let $=[...this.globalCommand.options,...Z?Z.options:[]],Q=h6($),J=[],Y=z.indexOf("--");if(Y>-1)J=z.slice(Y+1),z=z.slice(0,Y);let U=k6.default(z,Q);U=Object.keys(U).reduce((K,H)=>{return{...K,[V6(H)]:U[H]}},{_:[]});let X=U._,q={"--":J},G=Z&&Z.config.ignoreOptionDefaultValue?Z.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,j=Object.create(null);for(let K of $){if(!G&&K.config.default!==void 0)for(let H of K.names)q[H]=K.config.default;if(Array.isArray(K.config.type)){if(j[K.name]===void 0)j[K.name]=Object.create(null),j[K.name].shouldTransform=!0,j[K.name].transformFunction=K.config.type[0]}}for(let K of Object.keys(U))if(K!=="_"){let H=K.split(".");y6(q,H,U[K]),f6(q,j)}return{args:X,options:q}}runMatchedCommand(){let{args:z,options:Z,matchedCommand:$}=this;if(!$||!$.commandAction)return;$.checkUnknownOptions(),$.checkOptionValue(),$.checkRequiredArgs();let Q=[];return $.args.forEach((J,Y)=>{if(J.variadic)Q.push(z.slice(Y));else Q.push(z[Y])}),Q.push(Z),$.commandAction.apply(this,Q)}}var vz=M(N(),1),l6=["up","down","left","right","space","enter","cancel"],v={actions:new Set(l6),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function W6(z,Z){if(typeof z==="string")return v.aliases.get(z)===Z;for(let $ of z){if($===void 0)continue;if(W6($,Z))return!0}return!1}function n6(z,Z){if(z===Z)return[];let $=z.split(` | ||
| `),Q=Z.split(` | ||
| `),J=[];for(let Y=0;Y<Math.max($.length,Q.length);Y++)if($[Y]!==Q[Y])J.push(Y);return J}var gz=x6.platform.startsWith("win"),Y6=Symbol("clapp:cancel");function b(z,Z){let $=z;if($.isTTY)$.setRawMode(Z)}var u=M(N(),1);function i6({onlyFirst:z=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",z?void 0:"g")}var r6=i6();function M6(z){if(typeof z!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof z}\``);return z.replace(r6,"")}function s6(z){return z===161||z===164||z===167||z===168||z===170||z===173||z===174||z>=176&&z<=180||z>=182&&z<=186||z>=188&&z<=191||z===198||z===208||z===215||z===216||z>=222&&z<=225||z===230||z>=232&&z<=234||z===236||z===237||z===240||z===242||z===243||z>=247&&z<=250||z===252||z===254||z===257||z===273||z===275||z===283||z===294||z===295||z===299||z>=305&&z<=307||z===312||z>=319&&z<=322||z===324||z>=328&&z<=331||z===333||z===338||z===339||z===358||z===359||z===363||z===462||z===464||z===466||z===468||z===470||z===472||z===474||z===476||z===593||z===609||z===708||z===711||z>=713&&z<=715||z===717||z===720||z>=728&&z<=731||z===733||z===735||z>=768&&z<=879||z>=913&&z<=929||z>=931&&z<=937||z>=945&&z<=961||z>=963&&z<=969||z===1025||z>=1040&&z<=1103||z===1105||z===8208||z>=8211&&z<=8214||z===8216||z===8217||z===8220||z===8221||z>=8224&&z<=8226||z>=8228&&z<=8231||z===8240||z===8242||z===8243||z===8245||z===8251||z===8254||z===8308||z===8319||z>=8321&&z<=8324||z===8364||z===8451||z===8453||z===8457||z===8467||z===8470||z===8481||z===8482||z===8486||z===8491||z===8531||z===8532||z>=8539&&z<=8542||z>=8544&&z<=8555||z>=8560&&z<=8569||z===8585||z>=8592&&z<=8601||z===8632||z===8633||z===8658||z===8660||z===8679||z===8704||z===8706||z===8707||z===8711||z===8712||z===8715||z===8719||z===8721||z===8725||z===8730||z>=8733&&z<=8736||z===8739||z===8741||z>=8743&&z<=8748||z===8750||z>=8756&&z<=8759||z===8764||z===8765||z===8776||z===8780||z===8786||z===8800||z===8801||z>=8804&&z<=8807||z===8810||z===8811||z===8814||z===8815||z===8834||z===8835||z===8838||z===8839||z===8853||z===8857||z===8869||z===8895||z===8978||z>=9312&&z<=9449||z>=9451&&z<=9547||z>=9552&&z<=9587||z>=9600&&z<=9615||z>=9618&&z<=9621||z===9632||z===9633||z>=9635&&z<=9641||z===9650||z===9651||z===9654||z===9655||z===9660||z===9661||z===9664||z===9665||z>=9670&&z<=9672||z===9675||z>=9678&&z<=9681||z>=9698&&z<=9701||z===9711||z===9733||z===9734||z===9737||z===9742||z===9743||z===9756||z===9758||z===9792||z===9794||z===9824||z===9825||z>=9827&&z<=9829||z>=9831&&z<=9834||z===9836||z===9837||z===9839||z===9886||z===9887||z===9919||z>=9926&&z<=9933||z>=9935&&z<=9939||z>=9941&&z<=9953||z===9955||z===9960||z===9961||z>=9963&&z<=9969||z===9972||z>=9974&&z<=9977||z===9979||z===9980||z===9982||z===9983||z===10045||z>=10102&&z<=10111||z>=11094&&z<=11097||z>=12872&&z<=12879||z>=57344&&z<=63743||z>=65024&&z<=65039||z===65533||z>=127232&&z<=127242||z>=127248&&z<=127277||z>=127280&&z<=127337||z>=127344&&z<=127373||z===127375||z===127376||z>=127387&&z<=127404||z>=917760&&z<=917999||z>=983040&&z<=1048573||z>=1048576&&z<=1114109}function e6(z){return z===12288||z>=65281&&z<=65376||z>=65504&&z<=65510}function t6(z){return z>=4352&&z<=4447||z===8986||z===8987||z===9001||z===9002||z>=9193&&z<=9196||z===9200||z===9203||z===9725||z===9726||z===9748||z===9749||z>=9776&&z<=9783||z>=9800&&z<=9811||z===9855||z>=9866&&z<=9871||z===9875||z===9889||z===9898||z===9899||z===9917||z===9918||z===9924||z===9925||z===9934||z===9940||z===9962||z===9970||z===9971||z===9973||z===9978||z===9981||z===9989||z===9994||z===9995||z===10024||z===10060||z===10062||z>=10067&&z<=10069||z===10071||z>=10133&&z<=10135||z===10160||z===10175||z===11035||z===11036||z===11088||z===11093||z>=11904&&z<=11929||z>=11931&&z<=12019||z>=12032&&z<=12245||z>=12272&&z<=12287||z>=12289&&z<=12350||z>=12353&&z<=12438||z>=12441&&z<=12543||z>=12549&&z<=12591||z>=12593&&z<=12686||z>=12688&&z<=12773||z>=12783&&z<=12830||z>=12832&&z<=12871||z>=12880&&z<=42124||z>=42128&&z<=42182||z>=43360&&z<=43388||z>=44032&&z<=55203||z>=63744&&z<=64255||z>=65040&&z<=65049||z>=65072&&z<=65106||z>=65108&&z<=65126||z>=65128&&z<=65131||z>=94176&&z<=94180||z===94192||z===94193||z>=94208&&z<=100343||z>=100352&&z<=101589||z>=101631&&z<=101640||z>=110576&&z<=110579||z>=110581&&z<=110587||z===110589||z===110590||z>=110592&&z<=110882||z===110898||z>=110928&&z<=110930||z===110933||z>=110948&&z<=110951||z>=110960&&z<=111355||z>=119552&&z<=119638||z>=119648&&z<=119670||z===126980||z===127183||z===127374||z>=127377&&z<=127386||z>=127488&&z<=127490||z>=127504&&z<=127547||z>=127552&&z<=127560||z===127568||z===127569||z>=127584&&z<=127589||z>=127744&&z<=127776||z>=127789&&z<=127797||z>=127799&&z<=127868||z>=127870&&z<=127891||z>=127904&&z<=127946||z>=127951&&z<=127955||z>=127968&&z<=127984||z===127988||z>=127992&&z<=128062||z===128064||z>=128066&&z<=128252||z>=128255&&z<=128317||z>=128331&&z<=128334||z>=128336&&z<=128359||z===128378||z===128405||z===128406||z===128420||z>=128507&&z<=128591||z>=128640&&z<=128709||z===128716||z>=128720&&z<=128722||z>=128725&&z<=128727||z>=128732&&z<=128735||z===128747||z===128748||z>=128756&&z<=128764||z>=128992&&z<=129003||z===129008||z>=129292&&z<=129338||z>=129340&&z<=129349||z>=129351&&z<=129535||z>=129648&&z<=129660||z>=129664&&z<=129673||z>=129679&&z<=129734||z>=129742&&z<=129756||z>=129759&&z<=129769||z>=129776&&z<=129784||z>=131072&&z<=196605||z>=196608&&z<=262141}function o6(z){if(!Number.isSafeInteger(z))throw new TypeError(`Expected a code point, got \`${typeof z}\`.`)}function zz(z,{ambiguousAsWide:Z=!1}={}){if(o6(z),e6(z)||t6(z)||Z&&s6(z))return 2;return 1}var Zz=M(A6(),1),$z=new Intl.Segmenter,Qz=/^\p{Default_Ignorable_Code_Point}$/u;function A(z,Z={}){if(typeof z!=="string"||z.length===0)return 0;let{ambiguousIsNarrow:$=!0,countAnsiEscapeCodes:Q=!1}=Z;if(!Q)z=M6(z);if(z.length===0)return 0;let J=0,Y={ambiguousAsWide:!$};for(let{segment:U}of $z.segment(z)){let X=U.codePointAt(0);if(X<=31||X>=127&&X<=159)continue;if(X>=8203&&X<=8207||X===65279)continue;if(X>=768&&X<=879||X>=6832&&X<=6911||X>=7616&&X<=7679||X>=8400&&X<=8447||X>=65056&&X<=65071)continue;if(X>=55296&&X<=57343)continue;if(X>=65024&&X<=65039)continue;if(Qz.test(U))continue;if(Zz.default().test(U)){J+=2;continue}J+=zz(X,Y)}return J}var m=10,j6=(z=0)=>(Z)=>`\x1B[${Z+z}m`,U6=(z=0)=>(Z)=>`\x1B[${38+z};5;${Z}m`,G6=(z=0)=>(Z,$,Q)=>`\x1B[${38+z};2;${Z};${$};${Q}m`,D={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},uz=Object.keys(D.modifier),Jz=Object.keys(D.color),Yz=Object.keys(D.bgColor),mz=[...Jz,...Yz];function Xz(){let z=new Map;for(let[Z,$]of Object.entries(D)){for(let[Q,J]of Object.entries($))D[Q]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},$[Q]=D[Q],z.set(J[0],J[1]);Object.defineProperty(D,Z,{value:$,enumerable:!1})}return Object.defineProperty(D,"codes",{value:z,enumerable:!1}),D.color.close="\x1B[39m",D.bgColor.close="\x1B[49m",D.color.ansi=j6(),D.color.ansi256=U6(),D.color.ansi16m=G6(),D.bgColor.ansi=j6(m),D.bgColor.ansi256=U6(m),D.bgColor.ansi16m=G6(m),Object.defineProperties(D,{rgbToAnsi256:{value:(Z,$,Q)=>{if(Z===$&&$===Q){if(Z<8)return 16;if(Z>248)return 231;return Math.round((Z-8)/247*24)+232}return 16+36*Math.round(Z/255*5)+6*Math.round($/255*5)+Math.round(Q/255*5)},enumerable:!1},hexToRgb:{value:(Z)=>{let $=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Z.toString(16));if(!$)return[0,0,0];let[Q]=$;if(Q.length===3)Q=[...Q].map((Y)=>Y+Y).join("");let J=Number.parseInt(Q,16);return[J>>16&255,J>>8&255,J&255]},enumerable:!1},hexToAnsi256:{value:(Z)=>D.rgbToAnsi256(...D.hexToRgb(Z)),enumerable:!1},ansi256ToAnsi:{value:(Z)=>{if(Z<8)return 30+Z;if(Z<16)return 90+(Z-8);let $,Q,J;if(Z>=232)$=((Z-232)*10+8)/255,Q=$,J=$;else{Z-=16;let X=Z%36;$=Math.floor(Z/36)/5,Q=Math.floor(X/6)/5,J=X%6/5}let Y=Math.max($,Q,J)*2;if(Y===0)return 30;let U=30+(Math.round(J)<<2|Math.round(Q)<<1|Math.round($));if(Y===2)U+=60;return U},enumerable:!1},rgbToAnsi:{value:(Z,$,Q)=>D.ansi256ToAnsi(D.rgbToAnsi256(Z,$,Q)),enumerable:!1},hexToAnsi:{value:(Z)=>D.ansi256ToAnsi(D.hexToAnsi256(Z)),enumerable:!1}}),D}var jz=Xz(),Uz=jz,S=new Set(["\x1B",""]),Gz=39,i="\x07",L6="[",qz="]",w6="m",f=`${qz}8;;`,q6=(z)=>`${S.values().next().value}${L6}${z}${w6}`,K6=(z)=>`${S.values().next().value}${f}${z}${i}`,Kz=(z)=>z.split(" ").map((Z)=>A(Z)),x=(z,Z,$)=>{let Q=[...Z],J=!1,Y=!1,U=A(M6(z.at(-1)));for(let[X,q]of Q.entries()){let G=A(q);if(U+G<=$)z[z.length-1]+=q;else z.push(q),U=0;if(S.has(q))J=!0,Y=Q.slice(X+1,X+1+f.length).join("")===f;if(J){if(Y){if(q===i)J=!1,Y=!1}else if(q===w6)J=!1;continue}if(U+=G,U===$&&X<Q.length-1)z.push(""),U=0}if(!U&&z.at(-1).length>0&&z.length>1)z[z.length-2]+=z.pop()},Hz=(z)=>{let Z=z.split(" "),$=Z.length;while($>0){if(A(Z[$-1])>0)break;$--}if($===Z.length)return z;return Z.slice(0,$).join(" ")+Z.slice($).join("")},Fz=(z,Z,$={})=>{if($.trim!==!1&&z.trim()==="")return"";let Q="",J,Y,U=Kz(z),X=[""];for(let[K,H]of z.split(" ").entries()){if($.trim!==!1)X[X.length-1]=X.at(-1).trimStart();let F=A(X.at(-1));if(K!==0){if(F>=Z&&($.wordWrap===!1||$.trim===!1))X.push(""),F=0;if(F>0||$.trim===!1)X[X.length-1]+=" ",F++}if($.hard&&U[K]>Z){let V=Z-F,I=1+Math.floor((U[K]-V-1)/Z);if(Math.floor((U[K]-1)/Z)<I)X.push("");x(X,H,Z);continue}if(F+U[K]>Z&&F>0&&U[K]>0){if($.wordWrap===!1&&F<Z){x(X,H,Z);continue}X.push("")}if(F+U[K]>Z&&$.wordWrap===!1){x(X,H,Z);continue}X[X.length-1]+=H}if($.trim!==!1)X=X.map((K)=>Hz(K));let q=X.join(` | ||
| `),G=[...q],j=0;for(let[K,H]of G.entries()){if(Q+=H,S.has(H)){let{groups:V}=new RegExp(`(?:\\${L6}(?<code>\\d+)m|\\${f}(?<uri>.*)${i})`).exec(q.slice(j))||{groups:{}};if(V.code!==void 0){let I=Number.parseFloat(V.code);J=I===Gz?void 0:I}else if(V.uri!==void 0)Y=V.uri.length===0?void 0:V.uri}let F=Uz.codes.get(Number(J));if(G[K+1]===` | ||
| `){if(Y)Q+=K6("");if(J&&F)Q+=q6(F)}else if(H===` | ||
| `){if(J&&F)Q+=q6(J);if(Y)Q+=K6(Y)}j+=H.length}return Q};function H6(z,Z,$){return String(z).normalize().replaceAll(`\r | ||
| `,` | ||
| `).split(` | ||
| `).map((Q)=>Fz(Q,Z,$)).join(` | ||
| `)}class r{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(z,Z=!0){let{input:$=a6,output:Q=c6,render:J,signal:Y,...U}=z;this.opts=U,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=J.bind(this),this._track=Z,this._abortSignal=Y,this.input=$,this.output=Q}unsubscribe(){this._subscribers.clear()}setSubscriber(z,Z){let $=this._subscribers.get(z)??[];$.push(Z),this._subscribers.set(z,$)}on(z,Z){return this.setSubscriber(z,{cb:Z}),this}once(z,Z){return this.setSubscriber(z,{cb:Z,once:!0}),this}emit(z,...Z){let $=this._subscribers.get(z)??[],Q=[];for(let J of $)if(J.cb(...Z),J.once)Q.push(()=>$.splice($.indexOf(J),1));for(let J of Q)J();return this}prompt(){return new Promise((z)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),z(Y6);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=p6.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),b(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(B.show),this.output.off("resize",this.render),b(this.input,!1),z(this.value)}),this.once("cancel",()=>{this.output.write(B.show),this.output.off("resize",this.render),b(this.input,!1),z(Y6)})})}_isActionKey(z,Z){return z==="\t"}_setValue(z){this.value=z,this.emit("value",this.value)}_setUserInput(z,Z){if(this.userInput=z??"",this.emit("userInput",this.userInput),Z&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(z,Z){if(this._track&&Z.name!=="return"){if(Z.name&&this._isActionKey(z,Z))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let $=Z.name==="tab"||Z.name==="escape"||Z.name==="backspace"||Z.name==="delete"||Z.name==="enter"||Z.name==="return"||Z.name&&["up","down","left","right"].includes(Z.name);if(z&&!$&&z.length===1&&z>=" ")this._manualLine+=z;else if(Z.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let Q=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(Q)}if(this.state==="error")this.state="active",this.error="";if(Z?.name){if(!this._track&&v.aliases.has(Z.name))this.emit("cursor",v.aliases.get(Z.name));if(v.actions.has(Z.name))this.emit("cursor",Z.name)}if(z&&(z.toLowerCase()==="y"||z.toLowerCase()==="n"))this.emit("confirm",z.toLowerCase()==="y");if(this.emit("key",z?.toLowerCase(),Z),Z?.name==="return"){if(this.opts.validate){let $=this.opts.validate(this.value);if($)this.error=$ instanceof Error?$.message:$,this.state="error"}if(this.state!=="error")this.state="submit"}if(W6([z,Z?.name,Z?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(` | ||
| `),b(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let z=H6(this._prevFrame,X6.stdout.columns,{hard:!0,trim:!1}).split(` | ||
| `).length-1;this.output.write(B.move(-999,z*-1))}render(){let z=H6(this._render(this)??"",X6.stdout.columns,{hard:!0,trim:!1});if(z===this._prevFrame)return;if(this.state==="initial")this.output.write(B.hide);else{let Z=n6(this._prevFrame,z);if(this.restoreCursor(),Z&&Z?.length===1){let $=Z[0];this.output.write(B.move(0,$)),this.output.write(d.lines(1));let Q=z.split(` | ||
| `);this.output.write(Q[$]),this._prevFrame=z,this.output.write(B.move(0,Q.length-$-1));return}if(Z&&Z?.length>1){let $=Z[0];this.output.write(B.move(0,$)),this.output.write(d.down());let J=z.split(` | ||
| `).slice($);this.output.write(J.join(` | ||
| `)),this._prevFrame=z;return}this.output.write(d.down())}if(this.output.write(z),this.state==="initial")this.state="active";this._prevFrame=z}}function Vz(z,Z){if(z===void 0)return 0;if(Z.length===0)return 0;let Q=Z.findIndex((J)=>J.value===z);return Q!==-1?Q:0}function Dz(z,Z){return(Z.label??String(Z.value)).toLowerCase().includes(z.toLowerCase())}function Wz(z,Z){if(!Z)return;if(z)return Z;return Z[0]}class Mz extends r{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#z=0;#$="";#Q;#Z;get cursor(){return this.#z}get userInputWithCursor(){if(!this.userInput)return u.default.inverse(u.default.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let z=this.userInput.slice(0,this._cursor),[Z,...$]=this.userInput.slice(this._cursor);return`${z}${u.default.inverse(Z)}${$.join("")}`}get options(){if(typeof this.#Z==="function")return this.#Z();return this.#Z}constructor(z){super(z);this.#Z=z.options;let Z=this.options;this.filteredOptions=[...Z],this.multiple=z.multiple===!0,this.#Q=z.filter??Dz;let $;if(z.initialValue&&Array.isArray(z.initialValue))if(this.multiple)$=z.initialValue;else $=z.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)$=[this.options[0].value];if($)for(let Q of $){let J=Z.findIndex((Y)=>Y.value===Q);if(J!==-1)this.toggleSelected(Q),this.#z=J}this.focusedValue=this.options[this.#z]?.value,this.on("key",(Q,J)=>this.#J(Q,J)),this.on("userInput",(Q)=>this.#Y(Q))}_isActionKey(z,Z){return z==="\t"||this.multiple&&this.isNavigating&&Z.name==="space"&&z!==void 0&&z!==""}#J(z,Z){let $=Z.name==="up",Q=Z.name==="down",J=Z.name==="return";if($||Q){if(this.#z=Math.max(0,Math.min(this.#z+($?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#z]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(J)this.value=Wz(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(Z.name==="tab"||this.isNavigating&&Z.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(z){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(z))this.selectedValues=this.selectedValues.filter((Z)=>Z!==z);else this.selectedValues=[...this.selectedValues,z];else this.selectedValues=[z]}#Y(z){if(z!==this.#$){this.#$=z;let Z=this.options;if(z)this.filteredOptions=Z.filter(($)=>this.#Q(z,$));else this.filteredOptions=[...Z];if(this.#z=Vz(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#z]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class Lz extends r{options;cursor=0;#z;getGroupItems(z){return this.options.filter((Z)=>Z.group===z)}isGroupSelected(z){let Z=this.getGroupItems(z),$=this.value;if($===void 0)return!1;return Z.every((Q)=>$.includes(Q.value))}toggleValue(){let z=this.options[this.cursor];if(this.value===void 0)this.value=[];if(z.group===!0){let Z=z.value,$=this.getGroupItems(Z);if(this.isGroupSelected(Z))this.value=this.value.filter((Q)=>$.findIndex((J)=>J.value===Q)===-1);else this.value=[...this.value,...$.map((Q)=>Q.value)];this.value=Array.from(new Set(this.value))}else{let Z=this.value.includes(z.value);this.value=Z?this.value.filter(($)=>$!==z.value):[...this.value,z.value]}}constructor(z){super(z,!1);let{options:Z}=z;this.#z=z.selectableGroups!==!1,this.options=Object.entries(Z).flatMap(([$,Q])=>[{value:$,group:!0,label:$},...Q.map((J)=>({...J,group:$}))]),this.value=[...z.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:$})=>$===z.cursorAt),this.#z?0:1),this.on("cursor",($)=>{switch($){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Q=this.options[this.cursor]?.group===!0;if(!this.#z&&Q)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Q=this.options[this.cursor]?.group===!0;if(!this.#z&&Q)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var xz=M(N(),1);var lz=M(N(),1);var nz=M(N(),1),T={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},E={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function wz(){return!0}function Nz(){let z={};z.supportsColor=wz();function Z(Q,J=[]){let Y=Q===""?[]:[...J,Q],U=function(q){if(!z.supportsColor)return q;let G="",j="";for(let K of Y)if(K in E&&E[K]in T){let H=E[K];G+=T[H][0],j=T[H][1]+j}else if(K in T)G+=T[K][0],j=T[K][1]+j;return G+q+j},X=[...Object.keys(T),...Object.keys(E)];for(let q of X)if(!(q in U))Object.defineProperty(U,q,{get(){return Z(q,Y)}});return U}let $=[...Object.keys(T),...Object.keys(E)];for(let Q of $)if(!(Q in z))Object.defineProperty(z,Q,{get(){return Z(Q)}});return z}var az=Nz();var Oz=g6();var W=(z,Z)=>Oz?z:Z,cz=W("◆","*"),pz=W("■","x"),iz=W("▲","x"),rz=W("◇","o"),sz=W("┌","T"),Bz=W("│","|"),ez=W("└","—"),tz=W("●",">"),oz=W("○"," "),z0=W("◻","[•]"),Z0=W("◼","[+]"),$0=W("◻","[ ]"),Q0=W("▪","•"),J0=W("─","-"),Y0=W("╮","+"),X0=W("├","+"),j0=W("╯","+"),U0=W("●","•"),G0=W("◆","*"),q0=W("▲","!"),K0=W("■","x");var H0=M(N(),1);var F0=M(N(),1);var V0=M(N(),1);var D0=M(N(),1);var W0=M(N(),1);var M0=M(N(),1);var L0=M(N(),1);var w0=M(N(),1);var N0=M(N(),1),O0=M(N(),1);var B0={light:W("─","-"),heavy:W("━","="),block:W("█","#")};var T0=M(N(),1);var P0=M(N(),1);var Tz=M(N(),1);function Pz(){return`${Tz.default.gray(Bz)} `}var I0=Pz();var R0=M(N(),1);var E0=M(N(),1);var s="0.2.0";var P=new p("logsmith");P.command("[...args]","Generate changelog").option("--from <ref>","Start commit reference (default: latest git tag)").option("--to <ref>","End commit reference (default: HEAD)").option("--dir <dir>","Path to git repository (default: current directory)").option("--output [file]","Changelog file name (default: CHANGELOG.md). Use --no-output to write to console only").option("--format <format>","Output format: markdown, json, html (default: markdown)").option("--language <lang>","Language for changelog: en, es, fr, de, zh, ja, ko, ru, pt, it (default: en)").option("--theme <theme>","Theme for styling: default, minimal, github, gitmoji, unicode, simple, colorful, corporate (default: default)").option("--no-output","Write to console only").option("--clean","Determine if the working directory is clean and exit if not").option("--exclude-authors <authors>","Skip contributors (comma-separated)").option("--include-authors <authors>","Include only specific contributors (comma-separated)").option("--hide-author-email","Do not include author email in changelog").option("--exclude-types <types>","Exclude commit types (comma-separated)").option("--include-types <types>","Include only specific commit types (comma-separated)").option("--exclude-scopes <scopes>","Exclude commit scopes (comma-separated)").option("--include-scopes <scopes>","Include only specific commit scopes (comma-separated)").option("--min-commits <number>","Minimum commits required to include a section",{type:[Number]}).option("--max-commits <number>","Maximum commits per section (0 = unlimited)",{type:[Number]}).option("--no-dates","Hide dates from changelog").option("--no-breaking-group","Don't group breaking changes separately").option("--include-body","Include commit body in changelog entries").option("--no-linkify","Don't linkify issues and PRs").option("--max-length <number>","Maximum description length (0 = unlimited)",{type:[Number]}).option("--no-markdown-lint","Disable markdown linting and auto-fixing").option("--verbose","Enable verbose logging").example("logsmith").example("logsmith --from v1.0.0 --to HEAD").example("logsmith --output CHANGELOG.md").example("logsmith --format json --output changelog.json").example("logsmith --format html --output changelog.html").example("logsmith --no-output").example('logsmith --exclude-authors "dependabot[bot],github-actions[bot]"').example('logsmith --exclude-types "chore,ci" --include-types "feat,fix"').example("logsmith --min-commits 2 --max-commits 10").example("logsmith --theme github --language en").example("logsmith --theme minimal --format html").example("logsmith --theme gitmoji --output CHANGELOG.md").action(async(z,Z)=>{try{let $=Z.from,Q=Z.to||"HEAD";if(z.length>=4&&z[0]==="from"&&z[2]==="to")$=z[1],Q=z[3];let J=["markdown","json","html"],Y=Z.format||"markdown";if(!J.includes(Y))k(`Invalid format: ${Y}. Valid formats are: ${J.join(", ")}`);let U=["default","minimal","github","gitmoji","unicode","simple","colorful","corporate"],X=Z.theme||"default";if(!U.includes(X))k(`Invalid theme: ${X}. Valid themes are: ${U.join(", ")}`);let q=Z.output,G=Y;if(q&&typeof q==="string"&&!Z.format){if(q.endsWith(".json"))G="json";else if(q.endsWith(".html")||q.endsWith(".htm"))G="html"}else if(!q)q=`CHANGELOG.${{json:"json",html:"html",markdown:"md"}[Y]}`,G=Y;let j={from:$,to:Q,dir:Z.dir||t.cwd(),output:q!==void 0?q:"CHANGELOG.md",format:G,language:Z.language||"en",theme:X,clean:Z.clean||!1,excludeAuthors:Z.excludeAuthors?Z.excludeAuthors.split(",").map((F)=>F.trim()):void 0,includeAuthors:Z.includeAuthors?Z.includeAuthors.split(",").map((F)=>F.trim()):[],hideAuthorEmail:Z.hideAuthorEmail||!1,excludeCommitTypes:Z.excludeTypes?Z.excludeTypes.split(",").map((F)=>F.trim()):[],includeCommitTypes:Z.includeTypes?Z.includeTypes.split(",").map((F)=>F.trim()):[],excludeScopes:Z.excludeScopes?Z.excludeScopes.split(",").map((F)=>F.trim()):[],includeScopes:Z.includeScopes?Z.includeScopes.split(",").map((F)=>F.trim()):[],minCommitsForSection:Z["min-commits"]||1,maxCommitsPerSection:Z["max-commits"]||0,includeDates:Z.dates!==!1,groupBreakingChanges:Z.breakingGroup!==!1,includeCommitBody:Z.includeBody||!1,linkifyIssues:Z.linkify!==!1,linkifyPRs:Z.linkify!==!1,maxDescriptionLength:Z.maxLength||0,markdownLint:Z.markdownLint!==!1,verbose:Z.verbose||!1};if(Z.noOutput)j.output=!1;let K=await e(j);if(K.verbose)O("Loaded configuration"),O(`Working directory: ${K.dir}`),O(`Output format: ${K.format}`);let H=await B6(K);if(K.output===!1&&H.content)console.log(H.content);if(K.verbose){if(H.outputPath)O(`Changelog written to ${H.outputPath}`);O("✨ Done!")}}catch($){k(`Failed to generate changelog: ${$}`)}});P.command("stats","Show repository statistics and trends").option("--from <ref>","Start commit reference (default: latest git tag)").option("--to <ref>","End commit reference (default: HEAD)").option("--dir <dir>","Path to git repository (default: current directory)").option("--language <lang>","Language for output: en, es, fr, de, zh, ja, ko, ru, pt, it (default: en)").option("--json","Output in JSON format").option("--verbose","Enable verbose logging").example("logsmith stats").example("logsmith stats --from v1.0.0 --to HEAD").example("logsmith stats --json").action(async(z)=>{try{let Z={from:z.from,to:z.to||"HEAD",dir:z.dir||t.cwd(),language:z.language||"en",verbose:z.verbose||!1},$=await e(Z);if($.verbose)O("Analyzing repository statistics..."),O(`Working directory: ${$.dir}`),O(`Range: ${$.from||"first commit"} → ${$.to}`);let Q=O6($);if(z.json)console.log(JSON.stringify(Q,null,2));else Rz(Q,$.language);if($.verbose)O("✨ Analysis complete!")}catch(Z){k(`Failed to analyze repository: ${Z}`)}});P.command("themes","List available themes").action(()=>{let z=N6();console.log(` | ||
| \uD83C\uDFA8 Available Themes: | ||
| `); | ||
| for (const [key, theme] of Object.entries(themes)) { | ||
| console.log(` ${colors.cyan}${key.padEnd(12)}${colors.reset} - ${theme.name}: ${theme.description}`); | ||
| } | ||
| console.log(` | ||
| ${colors.gray}Use --theme <name> to apply a theme${colors.reset}`); | ||
| }); | ||
| cli.command("version", "Show the version of logsmith").action(() => { | ||
| console.log(version); | ||
| }); | ||
| cli.version(version); | ||
| cli.help(); | ||
| cli.parse(); | ||
| if (process2.argv.length === 2) { | ||
| cli.outputHelp(); | ||
| } | ||
| function displayStats(stats, language = "en") { | ||
| const { colors: c } = { colors }; | ||
| console.log(` | ||
| ${c.bold}\uD83D\uDCCA ${getLabel("repositoryStats", language)}${c.reset}`); | ||
| console.log(`${c.gray}─────────────────────────${c.reset}`); | ||
| console.log(`${c.cyan}${getLabel("range", language)}:${c.reset} ${stats.from || "first commit"} → ${stats.to}`); | ||
| console.log(`${c.cyan}${getLabel("totalCommits", language)}:${c.reset} ${stats.totalCommits}`); | ||
| console.log(`${c.cyan}${getLabel("contributors", language)}:${c.reset} ${stats.contributors}`); | ||
| console.log(`${c.cyan}${getLabel("breakingChangesCount", language)}:${c.reset} ${stats.breakingChanges}`); | ||
| const freq = stats.trends.commitFrequency; | ||
| console.log(` | ||
| ${c.bold}\uD83D\uDCC8 ${getLabel("commitFrequency", language)}${c.reset}`); | ||
| console.log(`${c.gray}───────────────────${c.reset}`); | ||
| console.log(`${c.cyan}${getLabel("totalDays", language)}:${c.reset} ${freq.totalDays}`); | ||
| console.log(`${c.cyan}${getLabel("averagePerDay", language)}:${c.reset} ${freq.averagePerDay}`); | ||
| if (freq.peakDay.commits > 0) { | ||
| console.log(`${c.cyan}${getLabel("peakDay", language)}:${c.reset} ${freq.peakDay.date} (${freq.peakDay.commits} ${getLabel("commits", language)})`); | ||
| } | ||
| const recentDays = Object.entries(freq.daily).sort(([a], [b]) => b.localeCompare(a)).slice(0, 7); | ||
| if (recentDays.length > 0) { | ||
| console.log(`${c.cyan}${getLabel("recentActivity", language)}:${c.reset}`); | ||
| for (const [date, commits] of recentDays) { | ||
| const bar = "█".repeat(Math.min(commits, 20)); | ||
| console.log(` ${date}: ${bar} ${commits}`); | ||
| } | ||
| } | ||
| const contrib = stats.trends.contributorGrowth; | ||
| console.log(` | ||
| ${c.bold}\uD83D\uDC65 ${getLabel("contributors", language)}${c.reset}`); | ||
| console.log(`${c.gray}──────────────${c.reset}`); | ||
| console.log(`${c.cyan}${getLabel("mostActive", language)}:${c.reset} ${contrib.mostActiveContributor.name} (${contrib.mostActiveContributor.commits} ${getLabel("commits", language)})`); | ||
| console.log(`${c.cyan}${getLabel("newContributors", language)}:${c.reset} ${contrib.newContributors.length}`); | ||
| const topContributors = Object.entries(contrib.contributorCommits).sort(([, a], [, b]) => b - a).slice(0, 5); | ||
| if (topContributors.length > 0) { | ||
| console.log(`${c.cyan}${getLabel("topContributors", language)}:${c.reset}`); | ||
| for (const [name, commits] of topContributors) { | ||
| const shortName = name.split(" <")[0]; | ||
| const percentage = (commits / stats.totalCommits * 100).toFixed(1); | ||
| console.log(` ${shortName}: ${commits} ${getLabel("commits", language)} (${percentage}%)`); | ||
| } | ||
| } | ||
| const types = stats.trends.typeDistribution; | ||
| console.log(` | ||
| ${c.bold}\uD83D\uDCCB Commit Types${c.reset}`); | ||
| console.log(`${c.gray}──────────────${c.reset}`); | ||
| console.log(`${c.cyan}${getLabel("mostCommon", language)}:${c.reset} ${types.mostCommonType.type} (${types.mostCommonType.percentage}%)`); | ||
| if (types.leastCommonType.type) { | ||
| console.log(`${c.cyan}${getLabel("leastCommon", language)}:${c.reset} ${types.leastCommonType.type} (${types.leastCommonType.percentage}%)`); | ||
| } | ||
| const sortedTypes = Object.entries(types.percentages).sort(([, a], [, b]) => b - a); | ||
| console.log(`${c.cyan}${getLabel("distribution", language)}:${c.reset}`); | ||
| for (const [type, percentage] of sortedTypes) { | ||
| const count = stats.commitTypes[type] || 0; | ||
| const bar = "▓".repeat(Math.min(Math.round(percentage / 2), 20)); | ||
| console.log(` ${type.padEnd(10)}: ${bar} ${percentage}% (${count})`); | ||
| } | ||
| console.log(); | ||
| } | ||
| `);for(let[Z,$]of Object.entries(z))console.log(` ${R.cyan}${Z.padEnd(12)}${R.reset} - ${$.name}: ${$.description}`);console.log(` | ||
| ${R.gray}Use --theme <name> to apply a theme${R.reset}`)});P.command("version","Show the version of logsmith").action(()=>{console.log(s)});P.version(s);P.help();P.parse();if(t.argv.length===2)P.outputHelp();function Rz(z,Z="en"){let{colors:$}={colors:R};console.log(` | ||
| ${$.bold}\uD83D\uDCCA ${w("repositoryStats",Z)}${$.reset}`),console.log(`${$.gray}─────────────────────────${$.reset}`),console.log(`${$.cyan}${w("range",Z)}:${$.reset} ${z.from||"first commit"} → ${z.to}`),console.log(`${$.cyan}${w("totalCommits",Z)}:${$.reset} ${z.totalCommits}`),console.log(`${$.cyan}${w("contributors",Z)}:${$.reset} ${z.contributors}`),console.log(`${$.cyan}${w("breakingChangesCount",Z)}:${$.reset} ${z.breakingChanges}`);let Q=z.trends.commitFrequency;if(console.log(` | ||
| ${$.bold}\uD83D\uDCC8 ${w("commitFrequency",Z)}${$.reset}`),console.log(`${$.gray}───────────────────${$.reset}`),console.log(`${$.cyan}${w("totalDays",Z)}:${$.reset} ${Q.totalDays}`),console.log(`${$.cyan}${w("averagePerDay",Z)}:${$.reset} ${Q.averagePerDay}`),Q.peakDay.commits>0)console.log(`${$.cyan}${w("peakDay",Z)}:${$.reset} ${Q.peakDay.date} (${Q.peakDay.commits} ${w("commits",Z)})`);let J=Object.entries(Q.daily).sort(([G],[j])=>j.localeCompare(G)).slice(0,7);if(J.length>0){console.log(`${$.cyan}${w("recentActivity",Z)}:${$.reset}`);for(let[G,j]of J){let K="█".repeat(Math.min(j,20));console.log(` ${G}: ${K} ${j}`)}}let Y=z.trends.contributorGrowth;console.log(` | ||
| ${$.bold}\uD83D\uDC65 ${w("contributors",Z)}${$.reset}`),console.log(`${$.gray}──────────────${$.reset}`),console.log(`${$.cyan}${w("mostActive",Z)}:${$.reset} ${Y.mostActiveContributor.name} (${Y.mostActiveContributor.commits} ${w("commits",Z)})`),console.log(`${$.cyan}${w("newContributors",Z)}:${$.reset} ${Y.newContributors.length}`);let U=Object.entries(Y.contributorCommits).sort(([,G],[,j])=>j-G).slice(0,5);if(U.length>0){console.log(`${$.cyan}${w("topContributors",Z)}:${$.reset}`);for(let[G,j]of U){let K=G.split(" <")[0],H=(j/z.totalCommits*100).toFixed(1);console.log(` ${K}: ${j} ${w("commits",Z)} (${H}%)`)}}let X=z.trends.typeDistribution;if(console.log(` | ||
| ${$.bold}\uD83D\uDCCB Commit Types${$.reset}`),console.log(`${$.gray}──────────────${$.reset}`),console.log(`${$.cyan}${w("mostCommon",Z)}:${$.reset} ${X.mostCommonType.type} (${X.mostCommonType.percentage}%)`),X.leastCommonType.type)console.log(`${$.cyan}${w("leastCommon",Z)}:${$.reset} ${X.leastCommonType.type} (${X.leastCommonType.percentage}%)`);let q=Object.entries(X.percentages).sort(([,G],[,j])=>j-G);console.log(`${$.cyan}${w("distribution",Z)}:${$.reset}`);for(let[G,j]of q){let K=z.commitTypes[G]||0,H="▓".repeat(Math.min(Math.round(j/2),20));console.log(` ${G.padEnd(10)}: ${H} ${j}% (${K})`)}console.log()} |
+1
-92
@@ -1,92 +0,1 @@ | ||
| import { | ||
| analyzeCommits, | ||
| colors, | ||
| config, | ||
| defaultConfig, | ||
| defineConfig, | ||
| execGit, | ||
| formatDate, | ||
| generateChangelog, | ||
| generateChangelogContent, | ||
| generateCompareUrl, | ||
| generateFormattedChangelog, | ||
| generateHtmlChangelog, | ||
| generateJsonChangelog, | ||
| getAllTags, | ||
| getAvailableThemes, | ||
| getCommitTypeFormat, | ||
| getCommitTypeFormatWithTheme, | ||
| getCommitTypeText, | ||
| getCommits, | ||
| getContributors, | ||
| getHtmlStyles, | ||
| getLabel, | ||
| getLatestTag, | ||
| getMarkdownStyles, | ||
| getRepositoryUrl, | ||
| getSupportedLanguages, | ||
| getTheme, | ||
| getThemeEmoji, | ||
| getThemedCommitType, | ||
| getTranslations, | ||
| groupCommits, | ||
| isGitRepository, | ||
| lintMarkdown, | ||
| loadLogsmithConfig, | ||
| log, | ||
| logError, | ||
| logInfo, | ||
| logSuccess, | ||
| logWarning, | ||
| parseCommit, | ||
| parseReferences, | ||
| symbols, | ||
| themeHasEmojis, | ||
| themes | ||
| } from "../chunk-9hzrnrhw.js"; | ||
| export { | ||
| themes, | ||
| themeHasEmojis, | ||
| symbols, | ||
| parseReferences, | ||
| parseCommit, | ||
| logWarning, | ||
| logSuccess, | ||
| logInfo, | ||
| logError, | ||
| log, | ||
| loadLogsmithConfig, | ||
| lintMarkdown, | ||
| isGitRepository, | ||
| groupCommits, | ||
| getTranslations, | ||
| getThemedCommitType, | ||
| getThemeEmoji, | ||
| getTheme, | ||
| getSupportedLanguages, | ||
| getRepositoryUrl, | ||
| getMarkdownStyles, | ||
| getLatestTag, | ||
| getLabel, | ||
| getHtmlStyles, | ||
| getContributors, | ||
| getCommits, | ||
| getCommitTypeText, | ||
| getCommitTypeFormatWithTheme, | ||
| getCommitTypeFormat, | ||
| getAvailableThemes, | ||
| getAllTags, | ||
| generateJsonChangelog, | ||
| generateHtmlChangelog, | ||
| generateFormattedChangelog, | ||
| generateCompareUrl, | ||
| generateChangelogContent, | ||
| generateChangelog, | ||
| formatDate, | ||
| execGit, | ||
| defineConfig, | ||
| defaultConfig, | ||
| config, | ||
| colors, | ||
| analyzeCommits | ||
| }; | ||
| import{A as h,B as m,C as p,D as f,E as u,F as y,G as c,H as l,I as r,J as a,K as s,L as g,M as i,N as n,O as o,P as j,Q as t,R as e,S as jj,T as k,a as G,b as H,c as I,d as J,e as K,f as N,g as O,h as P,i as Q,j as R,k as S,l as T,m as U,n as V,o as W,p as X,q as Y,r as Z,s as _,t as $,u as b,v as d,w as q,x,y as L,z as M}from"../chunk-nkbrcqpe.js";export{G as themes,O as themeHasEmojis,Y as symbols,x as parseReferences,q as parseCommit,a as logWarning,l as logSuccess,r as logInfo,c as logError,y as log,jj as loadLogsmithConfig,g as lintMarkdown,_ as isGitRepository,L as groupCommits,P as getTranslations,W as getThemedCommitType,I as getThemeEmoji,H as getTheme,T as getSupportedLanguages,f as getRepositoryUrl,K as getMarkdownStyles,$ as getLatestTag,R as getLabel,N as getHtmlStyles,p as getContributors,d as getCommits,V as getCommitTypeText,U as getCommitTypeFormatWithTheme,Q as getCommitTypeFormat,J as getAvailableThemes,b as getAllTags,n as generateJsonChangelog,o as generateHtmlChangelog,i as generateFormattedChangelog,u as generateCompareUrl,M as generateChangelogContent,j as generateChangelog,S as formatDate,m as formatAuthorWithGitHub,h as extractGitHubUsername,Z as execGit,k as defineConfig,t as defaultConfig,e as config,X as colors,s as analyzeCommits}; |
+12
-0
@@ -45,2 +45,14 @@ import type { ChangelogSection, CommitInfo, GeneratedChangelog, GitReference, LogsmithConfig, RepositoryStats } from './types'; | ||
| /** | ||
| * Extract GitHub username from git email | ||
| * Supports common patterns like: | ||
| * - username@users.noreply.github.com | ||
| * - 12345+username@users.noreply.github.com | ||
| * - username@github.com | ||
| */ | ||
| export declare function extractGitHubUsername(email: string): string | undefined; | ||
| /** | ||
| * Format author with optional GitHub link | ||
| */ | ||
| export declare function formatAuthorWithGitHub(name: string, email: string, hideEmail: boolean): string; | ||
| /** | ||
| * Get contributors from commits | ||
@@ -47,0 +59,0 @@ */ |
+3
-10
| { | ||
| "name": "@stacksjs/logsmith", | ||
| "type": "module", | ||
| "version": "0.1.18", | ||
| "version": "0.2.0", | ||
| "description": "Forge beautiful changelog automatically.", | ||
@@ -63,13 +63,6 @@ "author": "Chris Breuer <chris@stacksjs.org>", | ||
| "dependencies": { | ||
| "bunfig": "^0.14.1", | ||
| "@stacksjs/clapp": "^0.2.0", | ||
| "bunfig": "^0.15.0", | ||
| "markdownlint": "^0.38.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@stacksjs/bumpx": "^0.1.38", | ||
| "@stacksjs/gitlint": "^0.1.5", | ||
| "bun-git-hooks": "^0.2.19" | ||
| }, | ||
| "lint-staged": { | ||
| "*.{js,ts}": "bunx --bun eslint . --fix" | ||
| } | ||
| } |
+25
-18
@@ -29,4 +29,4 @@ # 🔨 Logsmith | ||
| ```bash | ||
| bunx logsmith | ||
| ``` | ||
| logsmith | ||
| ```text | ||
@@ -36,4 +36,4 @@ Generate a changelog and save to CHANGELOG.md: | ||
| ```bash | ||
| bunx logsmith --output CHANGELOG.md | ||
| ``` | ||
| logsmith --output CHANGELOG.md | ||
| ```text | ||
@@ -43,4 +43,4 @@ Generate changelog from specific commit range: | ||
| ```bash | ||
| bunx logsmith --from v1.0.0 --to HEAD | ||
| ``` | ||
| logsmith --from v1.0.0 --to HEAD | ||
| ```text | ||
@@ -51,11 +51,11 @@ Generate changelog in different formats: | ||
| # JSON format | ||
| bunx logsmith --format json --output changelog.json | ||
| logsmith --format json --output changelog.json | ||
| # HTML format | ||
| bunx logsmith --format html --output changelog.html | ||
| logsmith --format html --output changelog.html | ||
| # Auto-detect format from file extension | ||
| bunx logsmith --output changelog.json # Automatically uses JSON format | ||
| bunx logsmith --output changelog.html # Automatically uses HTML format | ||
| ``` | ||
| logsmith --output changelog.json # Automatically uses JSON format | ||
| logsmith --output changelog.html # Automatically uses HTML format | ||
| ```text | ||
@@ -79,3 +79,3 @@ ### Programmatic Usage | ||
| console.log(result.outputPath) // Path where changelog was written | ||
| ``` | ||
| ```text | ||
@@ -91,2 +91,3 @@ ## 📖 CLI Commands | ||
| **Core Options:** | ||
| - `--from <ref>` - Start commit reference (default: latest git tag) | ||
@@ -101,2 +102,3 @@ - `--to <ref>` - End commit reference (default: HEAD) | ||
| **Author Filtering:** | ||
| - `--exclude-authors <authors>` - Skip contributors (comma-separated) | ||
@@ -107,2 +109,3 @@ - `--include-authors <authors>` - Include only specific contributors (comma-separated) | ||
| **Advanced Filtering:** | ||
| - `--exclude-types <types>` - Exclude commit types (comma-separated) | ||
@@ -117,2 +120,3 @@ - `--include-types <types>` - Include only specific commit types (comma-separated) | ||
| **Formatting Options:** | ||
| - `--no-dates` - Hide dates from changelog | ||
@@ -132,2 +136,3 @@ - `--no-breaking-group` - Don't group breaking changes separately | ||
| **Options:** | ||
| - `--from <ref>` - Start commit reference (default: latest git tag) | ||
@@ -140,3 +145,4 @@ - `--to <ref>` - End commit reference (default: HEAD) | ||
| **Example Output:** | ||
| ``` | ||
| ```text | ||
| 📊 Repository Statistics | ||
@@ -249,3 +255,3 @@ ───────────────────────── | ||
| ``` | ||
| ```text | ||
| feat: add new authentication system | ||
@@ -267,3 +273,3 @@ fix: resolve memory leak in parser | ||
| ``` | ||
| ```text | ||
| feat!: remove deprecated API endpoints | ||
@@ -350,2 +356,3 @@ feat: add new feature | ||
| **Returns:** | ||
| ```typescript | ||
@@ -364,10 +371,10 @@ interface ChangelogResult { | ||
| Logsmith focuses solely on changelog generation. For version bumping functionality, use it together with [`@stacksjs/logsmith`](../logsmith): | ||
| Logsmith focuses solely on changelog generation. For version bumping functionality, use it together with [`@stacksjs/bumpx`](https://github.com/stacksjs/bumpx): | ||
| ```bash | ||
| # First bump the version | ||
| bunx logsmith patch | ||
| bunx bumpx patch | ||
| # Then generate changelog | ||
| bunx logsmith --output CHANGELOG.md | ||
| logsmith --output CHANGELOG.md | ||
| ``` | ||
@@ -374,0 +381,0 @@ |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
0
-100%388
1.84%9
-30.77%178404
-10.67%3
50%1862
-67.45%3
200%+ Added
+ Added
+ Added
+ Added
- Removed
Updated