@r5n/sisyphus 0.3.42 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +122 -20
  2. package/dist/cli.js +996 -445
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,469 +1,1020 @@
1
1
  #!/usr/bin/env bun
2
- var hr=Object.create;var{getPrototypeOf:pr,defineProperty:Tn,getOwnPropertyNames:br}=Object;var dr=Object.prototype.hasOwnProperty;var yn=(n,t,r)=>{r=n!=null?hr(pr(n)):{};let s=t||!n||!n.__esModule?Tn(r,"default",{value:n,enumerable:!0}):r;for(let i of br(n))if(!dr.call(s,i))Tn(s,i,{get:()=>n[i],enumerable:!0});return s};var qo=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var yr=(n,t)=>{for(var r in t)Tn(n,r,{get:t[r],enumerable:!0,configurable:!0,set:(s)=>t[r]=()=>s})};var C=(n,t)=>()=>(n&&(t=n(n=0)),t);var wr=import.meta.require;function Vn(n){return(t)=>$r?`${n}${t}${Jo.reset}`:t}function Po({bright:n=!1,color:t}){let r=Bun.color(t,"ansi");if(!r)return"";return n?xr[r]||r:r}var $r,gr,ur,Jo,xr,Sr,vr,m;var kn=C(()=>{$r=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout.isTTY),gr=["blue","cyan","gray","green","magenta","red","white","yellow"],ur=["bold","dim","italic","underline","reset"],Jo={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",underline:"\x1B[4m"},xr={"\x1B[30m":"\x1B[90m","\x1B[31m":"\x1B[91m","\x1B[32m":"\x1B[92m","\x1B[33m":"\x1B[93m","\x1B[34m":"\x1B[94m","\x1B[35m":"\x1B[95m","\x1B[36m":"\x1B[96m","\x1B[37m":"\x1B[97m"};Sr=gr.reduce((n,t)=>{return n[t]=Vn(Po({color:t})),n[`${t}Bright`]=Vn(Po({bright:!0,color:t})),n},{}),vr=ur.reduce((n,t)=>{return n[t]=Vn(Jo[t]),n},{}),m={...Sr,...vr}});function Rn({prefix:n,level:t,message:r}){let s=new Date().toISOString().split("T")[1]?.split(".")[0]||"",i=n?`[${n}] `:"";return`${m.dim(s||"")} ${t} ${i}${r}`}var v=({prefix:n="",level:t=process.env.DEBUG?0:1}={})=>{function r(...c){if(t<=0){let a=c.join(" ");console.log(Rn({level:m.dim("DEBUG"),message:a,prefix:n}))}}function s(...c){if(t<=1){let a=c.join(" ");console.info(Rn({level:m.cyan("INFO "),message:a,prefix:n}))}}function i(...c){if(t<=2){let a=c.join(" ");console.warn(Rn({level:m.yellow("WARN "),message:a,prefix:n}))}}function e(...c){if(t<=3){let a=c.join(" ");console.error(Rn({level:m.red("ERROR"),message:a,prefix:n}))}}function o(c){return v({level:t,prefix:`${n}:${c}`})}return{child:o,debug:r,error:e,info:s,warn:i}},Fn;var Bo=C(()=>{kn();Fn=v()});var _=C(()=>{kn();Bo()});var h;var Xo=C(()=>{_();h={arrow:m.yellow,bold:m.bold,boolean:m.cyan,bullet:m.yellow,busy:m.yellow,command:m.green,dim:m.dim,error:m.red,flag:m.yellow,info:m.cyan,number:m.magenta,offline:m.red,online:m.green,separator:m.dim,string:m.green,success:m.green,value:m.cyan,warning:m.yellow}});var oo=qo((Ti,Wo)=>{var no={to(n,t){if(!t)return`\x1B[${n+1}G`;return`\x1B[${t+1};${n+1}H`},move(n,t){let r="";if(n<0)r+=`\x1B[${-n}D`;else if(n>0)r+=`\x1B[${n}C`;if(t<0)r+=`\x1B[${-t}A`;else if(t>0)r+=`\x1B[${t}B`;return r},up:(n=1)=>`\x1B[${n}A`,down:(n=1)=>`\x1B[${n}B`,forward:(n=1)=>`\x1B[${n}C`,backward:(n=1)=>`\x1B[${n}D`,nextLine:(n=1)=>"\x1B[E".repeat(n),prevLine:(n=1)=>"\x1B[F".repeat(n),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Er={up:(n=1)=>"\x1B[S".repeat(n),down:(n=1)=>"\x1B[T".repeat(n)},Or={screen:"\x1B[2J",up:(n=1)=>"\x1B[1J".repeat(n),down:(n=1)=>"\x1B[J".repeat(n),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(n){let t="";for(let r=0;r<n;r++)t+=this.line+(r<n-1?no.up():"");if(n)t+=no.left;return t}};Wo.exports={cursor:no,scroll:Er,erase:Or,beep:"\x07"}});var ro=qo((Vi,to)=>{var _n=process||{},zo=_n.argv||[],An=_n.env||{},jr=!(!!An.NO_COLOR||zo.includes("--no-color"))&&(!!An.FORCE_COLOR||zo.includes("--color")||_n.platform==="win32"||(_n.stdout||{}).isTTY&&An.TERM!=="dumb"||!!An.CI),Rr=(n,t,r=n)=>(s)=>{let i=""+s,e=i.indexOf(t,n.length);return~e?n+Ar(i,t,r,e)+t:n+i+t},Ar=(n,t,r,s)=>{let i="",e=0;do i+=n.substring(e,s)+r,e=s+t.length,s=n.indexOf(t,e);while(~s);return i+n.substring(e)},Ko=(n=jr)=>{let t=n?Rr:()=>String;return{isColorSupported:n,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};to.exports=Ko();to.exports.createColors=Ko});import{stdin as ot,stdout as tt}from"process";import*as k from"readline";import Yo from"readline";import{Writable as _r}from"stream";function Mr({onlyFirst:n=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,n?void 0:"g")}function st(n){if(typeof n!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof n}\``);return n.replace(Ir,"")}function it(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function wn(n,t={}){if(typeof n!="string"||n.length===0||(t={ambiguousIsNarrow:!0,...t},n=st(n),n.length===0))return 0;n=n.replace(Hr()," ");let r=t.ambiguousIsNarrow?1:2,s=0;for(let i of n){let e=i.codePointAt(0);if(e<=31||e>=127&&e<=159||e>=768&&e<=879)continue;switch(Ur.eastAsianWidth(i)){case"F":case"W":s+=2;break;case"A":s+=r;break;default:s+=1}}return s}function qr(){let n=new Map;for(let[t,r]of Object.entries(M)){for(let[s,i]of Object.entries(r))M[s]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[s]=M[s],n.set(i[0],i[1]);Object.defineProperty(M,t,{value:r,enumerable:!1})}return Object.defineProperty(M,"codes",{value:n,enumerable:!1}),M.color.close="\x1B[39m",M.bgColor.close="\x1B[49m",M.color.ansi=Zo(),M.color.ansi256=Qo(),M.color.ansi16m=To(),M.bgColor.ansi=Zo(so),M.bgColor.ansi256=Qo(so),M.bgColor.ansi16m=To(so),Object.defineProperties(M,{rgbToAnsi256:{value:(t,r,s)=>t===r&&r===s?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:(t)=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[s]=r;s.length===3&&(s=[...s].map((e)=>e+e).join(""));let i=Number.parseInt(s,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:(t)=>M.rgbToAnsi256(...M.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:(t)=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,s,i;if(t>=232)r=((t-232)*10+8)/255,s=r,i=r;else{t-=16;let c=t%36;r=Math.floor(t/36)/5,s=Math.floor(c/6)/5,i=c%6/5}let e=Math.max(r,s,i)*2;if(e===0)return 30;let o=30+(Math.round(i)<<2|Math.round(s)<<1|Math.round(r));return e===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,r,s)=>M.ansi256ToAnsi(M.rgbToAnsi256(t,r,s)),enumerable:!1},hexToAnsi:{value:(t)=>M.ansi256ToAnsi(M.hexToAnsi256(t)),enumerable:!1}}),M}function Fo(n,t,r){return String(n).normalize().replace(/\r\n/g,`
2
+ var qo=Object.create;var{getPrototypeOf:Lo,defineProperty:$t,getOwnPropertyNames:No}=Object;var Uo=Object.prototype.hasOwnProperty;var pe=(e,t,n)=>{n=e!=null?qo(Lo(e)):{};let o=t||!e||!e.__esModule?$t(n,"default",{value:e,enumerable:!0}):n;for(let i of No(e))if(!Uo.call(o,i))$t(o,i,{get:()=>e[i],enumerable:!0});return o};var dn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wo=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0,configurable:!0,set:(o)=>t[n]=()=>o})};var O=(e,t)=>()=>(e&&(t=e(e=0)),t);var Je=import.meta.require;function vt(e){return(t)=>zo?`${e}${t}${yn.reset}`:t}function gn({bright:e=!1,color:t}){let n=Bun.color(t,"ansi");if(!n||typeof n!=="string")return"";return e&&n in hn?hn[n]??n:n}var zo,Jo,Ko,yn,hn,Zo,Vo,f;var xt=O(()=>{zo=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||(process.stdout?.isTTY??!1)),Jo=["blue","cyan","gray","green","magenta","red","white","yellow"],Ko=["bold","dim","italic","underline","reset"],yn={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",underline:"\x1B[4m"},hn={"\x1B[30m":"\x1B[90m","\x1B[31m":"\x1B[91m","\x1B[32m":"\x1B[92m","\x1B[33m":"\x1B[93m","\x1B[34m":"\x1B[94m","\x1B[35m":"\x1B[95m","\x1B[36m":"\x1B[96m","\x1B[37m":"\x1B[97m"};Zo=Jo.reduce((e,t)=>{return e[t]=vt(gn({color:t})),e[`${t}Bright`]=vt(gn({bright:!0,color:t})),e},{}),Vo=Ko.reduce((e,t)=>{return e[t]=vt(yn[t]),e},{}),f={...Zo,...Vo}});function Xo({prefix:e,level:t,message:n}){let o="";try{let s=new Date().toISOString().split("T")[1];if(s)o=s.split(".")[0]||""}catch{o="00:00:00"}let i=e?`[${e}] `:"";return`${f.dim(o)} ${t} ${i}${n}`}var Yo,v=({prefix:e="",level:t=process.env.DEBUG?0:1}={})=>{let n={};for(let o of Yo)n[o.method]=t<=o.level?(...i)=>{let r=i.map((s)=>String(s??"")).join(" ");o.console(Xo({level:o.color(o.label),message:r,prefix:e}))}:()=>{};return n.child=(o)=>v({level:t,prefix:`${e}:${o}`}),n},Ct;var bn=O(()=>{xt();Yo=[{color:f.dim,console:console.log,label:"DEBUG",level:0,method:"debug"},{color:f.cyan,console:console.info,label:"INFO ",level:1,method:"info"},{color:f.yellow,console:console.warn,label:"WARN ",level:2,method:"warn"},{color:f.red,console:console.error,label:"ERROR",level:3,method:"error"}],Ct=v()});var I=O(()=>{xt();bn()});var p;var St=O(()=>{I();p={arrow:f.yellow,bold:f.bold,boolean:f.cyan,bullet:f.yellow,busy:f.yellow,command:f.green,dim:f.dim,error:f.red,flag:f.yellow,info:f.cyan,number:f.magenta,offline:f.red,online:f.green,separator:f.dim,string:f.green,success:f.green,value:f.cyan,warning:f.yellow}});var Rt=dn((Tc,wn)=>{var kt={to(e,t){if(!t)return`\x1B[${e+1}G`;return`\x1B[${t+1};${e+1}H`},move(e,t){let n="";if(e<0)n+=`\x1B[${-e}D`;else if(e>0)n+=`\x1B[${e}C`;if(t<0)n+=`\x1B[${-t}A`;else if(t>0)n+=`\x1B[${t}B`;return n},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Qo={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Fo={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?kt.up():"");if(e)t+=kt.left;return t}};wn.exports={cursor:kt,scroll:Qo,erase:Fo,beep:"\x07"}});var It=dn((qc,jt)=>{var Ze=process||{},$n=Ze.argv||[],Ke=Ze.env||{},Do=!(!!Ke.NO_COLOR||$n.includes("--no-color"))&&(!!Ke.FORCE_COLOR||$n.includes("--color")||Ze.platform==="win32"||(Ze.stdout||{}).isTTY&&Ke.TERM!=="dumb"||!!Ke.CI),ei=(e,t,n=e)=>(o)=>{let i=""+o,r=i.indexOf(t,e.length);return~r?e+ti(i,t,n,r)+t:e+i+t},ti=(e,t,n,o)=>{let i="",r=0;do i+=e.substring(r,o)+n,r=o+t.length,o=e.indexOf(t,r);while(~o);return i+e.substring(r)},vn=(e=Do)=>{let t=e?ei:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};jt.exports=vn();jt.exports.createColors=vn});import{stdin as Pn,stdout as An}from"process";import*as ae from"readline";import xn from"readline";import{Writable as ni}from"stream";function si({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function Mn(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(oi,"")}function On(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pe(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Mn(e),e.length===0))return 0;e=e.replace(ci()," ");let n=t.ambiguousIsNarrow?1:2,o=0;for(let i of e){let r=i.codePointAt(0);if(r<=31||r>=127&&r<=159||r>=768&&r<=879)continue;switch(ri.eastAsianWidth(i)){case"F":case"W":o+=2;break;case"A":o+=n;break;default:o+=1}}return o}function mi(){let e=new Map;for(let[t,n]of Object.entries(H)){for(let[o,i]of Object.entries(n))H[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=H[o],e.set(i[0],i[1]);Object.defineProperty(H,t,{value:n,enumerable:!1})}return Object.defineProperty(H,"codes",{value:e,enumerable:!1}),H.color.close="\x1B[39m",H.bgColor.close="\x1B[49m",H.color.ansi=Cn(),H.color.ansi256=Sn(),H.color.ansi16m=kn(),H.bgColor.ansi=Cn(_t),H.bgColor.ansi256=Sn(_t),H.bgColor.ansi16m=kn(_t),Object.defineProperties(H,{rgbToAnsi256:{value:(t,n,o)=>t===n&&n===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:(t)=>{let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[o]=n;o.length===3&&(o=[...o].map((r)=>r+r).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:(t)=>H.rgbToAnsi256(...H.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:(t)=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,o,i;if(t>=232)n=((t-232)*10+8)/255,o=n,i=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,o=Math.floor(a/6)/5,i=a%6/5}let r=Math.max(n,o,i)*2;if(r===0)return 30;let s=30+(Math.round(i)<<2|Math.round(o)<<1|Math.round(n));return r===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,n,o)=>H.ansi256ToAnsi(H.rgbToAnsi256(t,n,o)),enumerable:!1},hexToAnsi:{value:(t)=>H.ansi256ToAnsi(H.hexToAnsi256(t)),enumerable:!1}}),H}function In(e,t,n){return String(e).normalize().replace(/\r\n/g,`
3
3
  `).split(`
4
- `).map((s)=>zr(s,t,r)).join(`
5
- `)}function lo(n,t){if(typeof n=="string")return In.aliases.get(n)===t;for(let r of n)if(r!==void 0&&lo(r,t))return!0;return!1}function Yr(n,t){if(n===t)return;let r=n.split(`
6
- `),s=t.split(`
7
- `),i=[];for(let e=0;e<Math.max(r.length,s.length);e++)r[e]!==s[e]&&i.push(e);return i}function Q(n){return n===eo}function Mn(n,t){let r=n;r.isTTY&&r.setRawMode(t)}function lt({input:n=ot,output:t=tt,overwrite:r=!0,hideCursor:s=!0}={}){let i=k.createInterface({input:n,output:t,prompt:"",tabSize:1});k.emitKeypressEvents(n,i),n.isTTY&&n.setRawMode(!0);let e=(o,{name:c,sequence:a})=>{let l=String(o);if(lo([l,c,a],"cancel")){s&&t.write(P.cursor.show),process.exit(0);return}if(!r)return;k.moveCursor(t,c==="return"?0:-1,c==="return"?-1:0,()=>{k.clearLine(t,1,()=>{n.once("keypress",e)})})};return s&&t.write(P.cursor.hide),n.once("keypress",e),()=>{n.off("keypress",e),s&&t.write(P.cursor.show),n.isTTY&&!Zr&&n.setRawMode(!1),i.terminal=!1,i.close()}}class $n{constructor(n,t=!0){X(this,"input"),X(this,"output"),X(this,"_abortSignal"),X(this,"rl"),X(this,"opts"),X(this,"_render"),X(this,"_track",!1),X(this,"_prevFrame",""),X(this,"_subscribers",new Map),X(this,"_cursor",0),X(this,"state","initial"),X(this,"error",""),X(this,"value");let{input:r=ot,output:s=tt,render:i,signal:e,...o}=n;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=e,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(n,t){let r=this._subscribers.get(n)??[];r.push(t),this._subscribers.set(n,r)}on(n,t){this.setSubscriber(n,{cb:t})}once(n,t){this.setSubscriber(n,{cb:t,once:!0})}emit(n,...t){let r=this._subscribers.get(n)??[],s=[];for(let i of r)i.cb(...t),i.once&&s.push(()=>r.splice(r.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise((n,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),n(eo);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new _r;r._write=(s,i,e)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),e()},this.input.pipe(r),this.rl=Yo.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Yo.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Mn(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(P.cursor.show),this.output.off("resize",this.render),Mn(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(P.cursor.show),this.output.off("resize",this.render),Mn(this.input,!1),n(eo)})})}onKeypress(n,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&In.aliases.has(t.name)&&this.emit("cursor",In.aliases.get(t.name)),In.actions.has(t.name)&&this.emit("cursor",t.name)),n&&(n.toLowerCase()==="y"||n.toLowerCase()==="n")&&this.emit("confirm",n.toLowerCase()==="y"),n==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),n&&this.emit("key",n.toLowerCase()),t?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}lo([n,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
8
- `),Mn(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let n=Fo(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
9
- `).length-1;this.output.write(P.cursor.move(-999,n*-1))}render(){let n=Fo(this._render(this)??"",process.stdout.columns,{hard:!0});if(n!==this._prevFrame){if(this.state==="initial")this.output.write(P.cursor.hide);else{let t=Yr(this._prevFrame,n);if(this.restoreCursor(),t&&t?.length===1){let r=t[0];this.output.write(P.cursor.move(0,r)),this.output.write(P.erase.lines(1));let s=n.split(`
10
- `);this.output.write(s[r]),this._prevFrame=n,this.output.write(P.cursor.move(0,s.length-r-1));return}if(t&&t?.length>1){let r=t[0];this.output.write(P.cursor.move(0,r)),this.output.write(P.erase.down());let s=n.split(`
11
- `).slice(r);this.output.write(s.join(`
12
- `)),this._prevFrame=n;return}this.output.write(P.erase.down())}this.output.write(n),this.state==="initial"&&(this.state="active"),this._prevFrame=n}}}var P,rt,Ir,et,Gr,Ur,Nr=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Hr,so=10,Zo=(n=0)=>(t)=>`\x1B[${t+n}m`,Qo=(n=0)=>(t)=>`\x1B[${38+n};5;${t}m`,To=(n=0)=>(t,r,s)=>`\x1B[${38+n};2;${t};${r};${s}m`,M,Cr,Lr,Pr,Gn,Jr=39,co="\x07",ct="[",Br="]",at="m",ao,Vo=(n)=>`${Gn.values().next().value}${ct}${n}${at}`,ko=(n)=>`${Gn.values().next().value}${ao}${n}${co}`,Xr=(n)=>n.split(" ").map((t)=>wn(t)),io=(n,t,r)=>{let s=[...t],i=!1,e=!1,o=wn(st(n[n.length-1]));for(let[c,a]of s.entries()){let l=wn(a);if(o+l<=r?n[n.length-1]+=a:(n.push(a),o=0),Gn.has(a)&&(i=!0,e=s.slice(c+1).join("").startsWith(ao)),i){e?a===co&&(i=!1,e=!1):a===at&&(i=!1);continue}o+=l,o===r&&c<s.length-1&&(n.push(""),o=0)}!o&&n[n.length-1].length>0&&n.length>1&&(n[n.length-2]+=n.pop())},Wr=(n)=>{let t=n.split(" "),r=t.length;for(;r>0&&!(wn(t[r-1])>0);)r--;return r===t.length?n:t.slice(0,r).join(" ")+t.slice(r).join("")},zr=(n,t,r={})=>{if(r.trim!==!1&&n.trim()==="")return"";let s="",i,e,o=Xr(n),c=[""];for(let[l,f]of n.split(" ").entries()){r.trim!==!1&&(c[c.length-1]=c[c.length-1].trimStart());let p=wn(c[c.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(c.push(""),p=0),(p>0||r.trim===!1)&&(c[c.length-1]+=" ",p++)),r.hard&&o[l]>t){let d=t-p,w=1+Math.floor((o[l]-d-1)/t);Math.floor((o[l]-1)/t)<w&&c.push(""),io(c,f,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(r.wordWrap===!1&&p<t){io(c,f,t);continue}c.push("")}if(p+o[l]>t&&r.wordWrap===!1){io(c,f,t);continue}c[c.length-1]+=f}r.trim!==!1&&(c=c.map((l)=>Wr(l)));let a=[...c.join(`
13
- `)];for(let[l,f]of a.entries()){if(s+=f,Gn.has(f)){let{groups:d}=new RegExp(`(?:\\${ct}(?<code>\\d+)m|\\${ao}(?<uri>.*)${co})`).exec(a.slice(l).join(""))||{groups:{}};if(d.code!==void 0){let w=Number.parseFloat(d.code);i=w===Jr?void 0:w}else d.uri!==void 0&&(e=d.uri.length===0?void 0:d.uri)}let p=Pr.codes.get(Number(i));a[l+1]===`
14
- `?(e&&(s+=ko("")),i&&p&&(s+=Vo(p))):f===`
15
- `&&(i&&p&&(s+=Vo(i)),e&&(s+=ko(e)))}return s},Kr,In,Zr,eo,Qr,Tr=(n,t,r)=>(t in n)?Qr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,X=(n,t,r)=>(Tr(n,typeof t!="symbol"?t+"":t,r),r),fo,Vr,kr,Fr=(n,t,r)=>(t in n)?kr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,Do=(n,t,r)=>(Fr(n,typeof t!="symbol"?t+"":t,r),r),ft,Dr,ns=(n,t,r)=>(t in n)?Dr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,nt=(n,t,r)=>(ns(n,typeof t!="symbol"?t+"":t,r),r),mo,ho;var po=C(()=>{P=yn(oo(),1),rt=yn(ro(),1);Ir=Mr();et={exports:{}};(function(n){var t={};n.exports=t,t.eastAsianWidth=function(s){var i=s.charCodeAt(0),e=s.length==2?s.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=e&&e<=57343&&(i&=1023,e&=1023,o=i<<10|e,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},t.characterLength=function(s){var i=this.eastAsianWidth(s);return i=="F"||i=="W"||i=="A"?2:1};function r(s){return s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(s){for(var i=r(s),e=0,o=0;o<i.length;o++)e=e+this.characterLength(i[o]);return e},t.slice=function(s,i,e){textLen=t.length(s),i=i||0,e=e||1,i<0&&(i=textLen+i),e<0&&(e=textLen+e);for(var o="",c=0,a=r(s),l=0;l<a.length;l++){var f=a[l],p=t.length(f);if(c>=i-(p==2?1:0))if(c+p<=e)o+=f;else break;c+=p}return o}})(et);Gr=et.exports,Ur=it(Gr),Hr=it(Nr);M={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]}};Object.keys(M.modifier);Cr=Object.keys(M.color),Lr=Object.keys(M.bgColor);[...Cr];Pr=qr(),Gn=new Set(["\x1B","\x9B"]),ao=`${Br}8;;`;Kr=["up","down","left","right","space","enter","cancel"],In={actions:new Set(Kr),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};Zr=globalThis.process.platform.startsWith("win"),eo=Symbol("clack:cancel");Qr=Object.defineProperty;fo=class fo extends $n{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(n){super(n,!1),this.value=!!n.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(P.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Vr=new WeakMap;kr=Object.defineProperty,ft=class extends $n{constructor(n){super(n,!1),Do(this,"options"),Do(this,"cursor",0),this.options=n.options,this.value=[...n.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===n.cursorAt),0),this.on("key",(t)=>{t==="a"&&this.toggleAll()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":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;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let n=this.value.length===this.options.length;this.value=n?[]:this.options.map((t)=>t.value)}toggleValue(){let n=this.value.includes(this._value);this.value=n?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}},Dr=Object.defineProperty;mo=class mo extends $n{constructor(n){super(n,!1),nt(this,"options"),nt(this,"cursor",0),this.options=n.options,this.cursor=this.options.findIndex(({value:t})=>t===n.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":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;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};ho=class ho extends $n{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let n=this.value.slice(0,this.cursor),[t,...r]=this.value.slice(this.cursor);return`${n}${rt.default.inverse(t)}${r.join("")}`}get cursor(){return this._cursor}constructor(n){super(n),this.on("finalize",()=>{this.value||(this.value=n.defaultValue)})}}});import{stripVTControlCharacters as bo}from"util";import K from"process";function os(){return K.platform!=="win32"?K.env.TERM!=="linux":!!K.env.CI||!!K.env.WT_SESSION||!!K.env.TERMINUS_SUBLIME||K.env.ConEmuTask==="{cmd::Cmder}"||K.env.TERM_PROGRAM==="Terminus-Sublime"||K.env.TERM_PROGRAM==="vscode"||K.env.TERM==="xterm-256color"||K.env.TERM==="alacritty"||K.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var b,Un,yo,G=(n,t)=>yo?n:t,ts,pt,bt,Nn,le,O,nn,wo,$o,rs,mt,ss,fe,ht,is,es,cs,as,ls,fs,ms,Hn=(n)=>{switch(n){case"initial":case"active":return b.default.cyan(ts);case"cancel":return b.default.red(pt);case"error":return b.default.yellow(bt);case"submit":return b.default.green(Nn)}},go=(n)=>{let{cursor:t,options:r,style:s}=n,i=n.maxItems??Number.POSITIVE_INFINITY,e=Math.max(process.stdout.rows-4,0),o=Math.min(e,Math.max(i,5)),c=0;t>=c+o-3?c=Math.max(Math.min(t-o+3,r.length-o),0):t<c+2&&(c=Math.max(t-2,0));let a=o<r.length&&c>0,l=o<r.length&&c+o<r.length;return r.slice(c,c+o).map((f,p,d)=>{let w=p===0&&a,y=p===d.length-1&&l;return w||y?b.default.dim("..."):s(f,p+c===t)})},W=(n)=>new ho({validate:n.validate,placeholder:n.placeholder,defaultValue:n.defaultValue,initialValue:n.initialValue,render(){let t=`${b.default.gray(O)}
16
- ${Hn(this.state)} ${n.message}
17
- `,r=n.placeholder?b.default.inverse(n.placeholder[0])+b.default.dim(n.placeholder.slice(1)):b.default.inverse(b.default.hidden("_")),s=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${t.trim()}
18
- ${b.default.yellow(O)} ${s}
19
- ${b.default.yellow(nn)} ${b.default.yellow(this.error)}
20
- `;case"submit":return`${t}${b.default.gray(O)} ${b.default.dim(this.value||n.placeholder)}`;case"cancel":return`${t}${b.default.gray(O)} ${b.default.strikethrough(b.default.dim(this.value??""))}${this.value?.trim()?`
21
- ${b.default.gray(O)}`:""}`;default:return`${t}${b.default.cyan(O)} ${s}
22
- ${b.default.cyan(nn)}
23
- `}}}).prompt(),N=(n)=>{let t=n.active??"Yes",r=n.inactive??"No";return new fo({active:t,inactive:r,initialValue:n.initialValue??!0,render(){let s=`${b.default.gray(O)}
24
- ${Hn(this.state)} ${n.message}
25
- `,i=this.value?t:r;switch(this.state){case"submit":return`${s}${b.default.gray(O)} ${b.default.dim(i)}`;case"cancel":return`${s}${b.default.gray(O)} ${b.default.strikethrough(b.default.dim(i))}
26
- ${b.default.gray(O)}`;default:return`${s}${b.default.cyan(O)} ${this.value?`${b.default.green(wo)} ${t}`:`${b.default.dim($o)} ${b.default.dim(t)}`} ${b.default.dim("/")} ${this.value?`${b.default.dim($o)} ${b.default.dim(r)}`:`${b.default.green(wo)} ${r}`}
27
- ${b.default.cyan(nn)}
28
- `}}}).prompt()},an=(n)=>{let t=(r,s)=>{let i=r.label??String(r.value);switch(s){case"selected":return`${b.default.dim(i)}`;case"active":return`${b.default.green(wo)} ${i} ${r.hint?b.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${b.default.strikethrough(b.default.dim(i))}`;default:return`${b.default.dim($o)} ${b.default.dim(i)}`}};return new mo({options:n.options,initialValue:n.initialValue,render(){let r=`${b.default.gray(O)}
29
- ${Hn(this.state)} ${n.message}
30
- `;switch(this.state){case"submit":return`${r}${b.default.gray(O)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${b.default.gray(O)} ${t(this.options[this.cursor],"cancelled")}
31
- ${b.default.gray(O)}`;default:return`${r}${b.default.cyan(O)} ${go({cursor:this.cursor,options:this.options,maxItems:n.maxItems,style:(s,i)=>t(s,i?"active":"inactive")}).join(`
32
- ${b.default.cyan(O)} `)}
33
- ${b.default.cyan(nn)}
34
- `}}}).prompt()},Cn=(n)=>{let t=(r,s)=>{let i=r.label??String(r.value);return s==="active"?`${b.default.cyan(rs)} ${i} ${r.hint?b.default.dim(`(${r.hint})`):""}`:s==="selected"?`${b.default.green(mt)} ${b.default.dim(i)} ${r.hint?b.default.dim(`(${r.hint})`):""}`:s==="cancelled"?`${b.default.strikethrough(b.default.dim(i))}`:s==="active-selected"?`${b.default.green(mt)} ${i} ${r.hint?b.default.dim(`(${r.hint})`):""}`:s==="submitted"?`${b.default.dim(i)}`:`${b.default.dim(ss)} ${b.default.dim(i)}`};return new ft({options:n.options,initialValues:n.initialValues,required:n.required??!0,cursorAt:n.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
35
- ${b.default.reset(b.default.dim(`Press ${b.default.gray(b.default.bgWhite(b.default.inverse(" space ")))} to select, ${b.default.gray(b.default.bgWhite(b.default.inverse(" enter ")))} to submit`))}`},render(){let r=`${b.default.gray(O)}
36
- ${Hn(this.state)} ${n.message}
37
- `,s=(i,e)=>{let o=this.value.includes(i.value);return e&&o?t(i,"active-selected"):o?t(i,"selected"):t(i,e?"active":"inactive")};switch(this.state){case"submit":return`${r}${b.default.gray(O)} ${this.options.filter(({value:i})=>this.value.includes(i)).map((i)=>t(i,"submitted")).join(b.default.dim(", "))||b.default.dim("none")}`;case"cancel":{let i=this.options.filter(({value:e})=>this.value.includes(e)).map((e)=>t(e,"cancelled")).join(b.default.dim(", "));return`${r}${b.default.gray(O)} ${i.trim()?`${i}
38
- ${b.default.gray(O)}`:""}`}case"error":{let i=this.error.split(`
39
- `).map((e,o)=>o===0?`${b.default.yellow(nn)} ${b.default.yellow(e)}`:` ${e}`).join(`
40
- `);return`${r+b.default.yellow(O)} ${go({options:this.options,cursor:this.cursor,maxItems:n.maxItems,style:s}).join(`
41
- ${b.default.yellow(O)} `)}
4
+ `).map((o)=>yi(o,t,n)).join(`
5
+ `)}function Mt(e,t){if(typeof e=="string")return Ye.aliases.get(e)===t;for(let n of e)if(n!==void 0&&Mt(n,t))return!0;return!1}function wi(e,t){if(e===t)return;let n=e.split(`
6
+ `),o=t.split(`
7
+ `),i=[];for(let r=0;r<Math.max(n.length,o.length);r++)n[r]!==o[r]&&i.push(r);return i}function se(e){return e===Pt}function Ve(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function qn({input:e=Pn,output:t=An,overwrite:n=!0,hideCursor:o=!0}={}){let i=ae.createInterface({input:e,output:t,prompt:"",tabSize:1});ae.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let r=(s,{name:a,sequence:c})=>{let l=String(s);if(Mt([l,a,c],"cancel")){o&&t.write(W.cursor.show),process.exit(0);return}if(!n)return;ae.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{ae.clearLine(t,1,()=>{e.once("keypress",r)})})};return o&&t.write(W.cursor.hide),e.once("keypress",r),()=>{e.off("keypress",r),o&&t.write(W.cursor.show),e.isTTY&&!$i&&e.setRawMode(!1),i.terminal=!1,i.close()}}class Ae{constructor(e,t=!0){K(this,"input"),K(this,"output"),K(this,"_abortSignal"),K(this,"rl"),K(this,"opts"),K(this,"_render"),K(this,"_track",!1),K(this,"_prevFrame",""),K(this,"_subscribers",new Map),K(this,"_cursor",0),K(this,"state","initial"),K(this,"error",""),K(this,"value");let{input:n=Pn,output:o=An,render:i,signal:r,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=r,this.input=n,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],o=[];for(let i of n)i.cb(...t),i.once&&o.push(()=>n.splice(n.indexOf(i),1));for(let i of o)i()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Pt);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new ni;n._write=(o,i,r)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),r()},this.input.pipe(n),this.rl=xn.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),xn.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Ve(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(W.cursor.show),this.output.off("resize",this.render),Ve(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(W.cursor.show),this.output.off("resize",this.render),Ve(this.input,!1),e(Pt)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&Ye.aliases.has(t.name)&&this.emit("cursor",Ye.aliases.get(t.name)),Ye.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),t?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Mt([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
8
+ `),Ve(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=In(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
9
+ `).length-1;this.output.write(W.cursor.move(-999,e*-1))}render(){let e=In(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(W.cursor.hide);else{let t=wi(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(W.cursor.move(0,n)),this.output.write(W.erase.lines(1));let o=e.split(`
10
+ `);this.output.write(o[n]),this._prevFrame=e,this.output.write(W.cursor.move(0,o.length-n-1));return}if(t&&t?.length>1){let n=t[0];this.output.write(W.cursor.move(0,n)),this.output.write(W.erase.down());let o=e.split(`
11
+ `).slice(n);this.output.write(o.join(`
12
+ `)),this._prevFrame=e;return}this.output.write(W.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}}var W,Bn,oi,Gn,ii,ri,ai=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},ci,_t=10,Cn=(e=0)=>(t)=>`\x1B[${t+e}m`,Sn=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,kn=(e=0)=>(t,n,o)=>`\x1B[${38+e};2;${t};${n};${o}m`,H,li,pi,ui,Xe,fi=39,At="\x07",Hn="[",di="]",Tn="m",Bt,Rn=(e)=>`${Xe.values().next().value}${Hn}${e}${Tn}`,jn=(e)=>`${Xe.values().next().value}${Bt}${e}${At}`,hi=(e)=>e.split(" ").map((t)=>Pe(t)),Et=(e,t,n)=>{let o=[...t],i=!1,r=!1,s=Pe(Mn(e[e.length-1]));for(let[a,c]of o.entries()){let l=Pe(c);if(s+l<=n?e[e.length-1]+=c:(e.push(c),s=0),Xe.has(c)&&(i=!0,r=o.slice(a+1).join("").startsWith(Bt)),i){r?c===At&&(i=!1,r=!1):c===Tn&&(i=!1);continue}s+=l,s===n&&a<o.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},gi=(e)=>{let t=e.split(" "),n=t.length;for(;n>0&&!(Pe(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},yi=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let o="",i,r,s=hi(e),a=[""];for(let[l,m]of e.split(" ").entries()){n.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let u=Pe(a[a.length-1]);if(l!==0&&(u>=t&&(n.wordWrap===!1||n.trim===!1)&&(a.push(""),u=0),(u>0||n.trim===!1)&&(a[a.length-1]+=" ",u++)),n.hard&&s[l]>t){let g=t-u,w=1+Math.floor((s[l]-g-1)/t);Math.floor((s[l]-1)/t)<w&&a.push(""),Et(a,m,t);continue}if(u+s[l]>t&&u>0&&s[l]>0){if(n.wordWrap===!1&&u<t){Et(a,m,t);continue}a.push("")}if(u+s[l]>t&&n.wordWrap===!1){Et(a,m,t);continue}a[a.length-1]+=m}n.trim!==!1&&(a=a.map((l)=>gi(l)));let c=[...a.join(`
13
+ `)];for(let[l,m]of c.entries()){if(o+=m,Xe.has(m)){let{groups:g}=new RegExp(`(?:\\${Hn}(?<code>\\d+)m|\\${Bt}(?<uri>.*)${At})`).exec(c.slice(l).join(""))||{groups:{}};if(g.code!==void 0){let w=Number.parseFloat(g.code);i=w===fi?void 0:w}else g.uri!==void 0&&(r=g.uri.length===0?void 0:g.uri)}let u=ui.codes.get(Number(i));c[l+1]===`
14
+ `?(r&&(o+=jn("")),i&&u&&(o+=Rn(u))):m===`
15
+ `&&(i&&u&&(o+=Rn(i)),r&&(o+=jn(r)))}return o},bi,Ye,$i,Pt,vi,xi=(e,t,n)=>(t in e)?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t,n)=>(xi(e,typeof t!="symbol"?t+"":t,n),n),Ot,Ci,Si,ki=(e,t,n)=>(t in e)?Si(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_n=(e,t,n)=>(ki(e,typeof t!="symbol"?t+"":t,n),n),Ln,Ri,ji=(e,t,n)=>(t in e)?Ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,En=(e,t,n)=>(ji(e,typeof t!="symbol"?t+"":t,n),n),Gt,Ht;var Tt=O(()=>{W=pe(Rt(),1),Bn=pe(It(),1);oi=si();Gn={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(o){var i=o.charCodeAt(0),r=o.length==2?o.charCodeAt(1):0,s=i;return 55296<=i&&i<=56319&&56320<=r&&r<=57343&&(i&=1023,r&=1023,s=i<<10|r,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},t.characterLength=function(o){var i=this.eastAsianWidth(o);return i=="F"||i=="W"||i=="A"?2:1};function n(o){return o.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(o){for(var i=n(o),r=0,s=0;s<i.length;s++)r=r+this.characterLength(i[s]);return r},t.slice=function(o,i,r){textLen=t.length(o),i=i||0,r=r||1,i<0&&(i=textLen+i),r<0&&(r=textLen+r);for(var s="",a=0,c=n(o),l=0;l<c.length;l++){var m=c[l],u=t.length(m);if(a>=i-(u==2?1:0))if(a+u<=r)s+=m;else break;a+=u}return s}})(Gn);ii=Gn.exports,ri=On(ii),ci=On(ai);H={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]}};Object.keys(H.modifier);li=Object.keys(H.color),pi=Object.keys(H.bgColor);[...li];ui=mi(),Xe=new Set(["\x1B","\x9B"]),Bt=`${di}8;;`;bi=["up","down","left","right","space","enter","cancel"],Ye={actions:new Set(bi),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};$i=globalThis.process.platform.startsWith("win"),Pt=Symbol("clack:cancel");vi=Object.defineProperty;Ot=class Ot extends Ae{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(W.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Ci=new WeakMap;Si=Object.defineProperty,Ln=class extends Ae{constructor(e){super(e,!1),_n(this,"options"),_n(this,"cursor",0),this.options=e.options,this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0),this.on("key",(t)=>{t==="a"&&this.toggleAll()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":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;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let e=this.value.length===this.options.length;this.value=e?[]:this.options.map((t)=>t.value)}toggleValue(){let e=this.value.includes(this._value);this.value=e?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}},Ri=Object.defineProperty;Gt=class Gt extends Ae{constructor(e){super(e,!1),En(this,"options"),En(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":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;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};Ht=class Ht extends Ae{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...n]=this.value.slice(this.cursor);return`${e}${Bn.default.inverse(t)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}}});import{stripVTControlCharacters as qt}from"util";import Y from"process";function Ii(){return Y.platform!=="win32"?Y.env.TERM!=="linux":!!Y.env.CI||!!Y.env.WT_SESSION||!!Y.env.TERMINUS_SUBLIME||Y.env.ConEmuTask==="{cmd::Cmder}"||Y.env.TERM_PROGRAM==="Terminus-Sublime"||Y.env.TERM_PROGRAM==="vscode"||Y.env.TERM==="xterm-256color"||Y.env.TERM==="alacritty"||Y.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var h,Qe,Lt,N=(e,t)=>Lt?e:t,_i,Wn,zn,Fe,Ei,_,ce,Nt,Ut,Pi,Nn,Ai,Fc,Un,Bi,Mi,Oi,Gi,Hi,Ti,qi,De=(e)=>{switch(e){case"initial":case"active":return h.default.cyan(_i);case"cancel":return h.default.red(Wn);case"error":return h.default.yellow(zn);case"submit":return h.default.green(Fe)}},Wt=(e)=>{let{cursor:t,options:n,style:o}=e,i=e.maxItems??Number.POSITIVE_INFINITY,r=Math.max(process.stdout.rows-4,0),s=Math.min(r,Math.max(i,5)),a=0;t>=a+s-3?a=Math.max(Math.min(t-s+3,n.length-s),0):t<a+2&&(a=Math.max(t-2,0));let c=s<n.length&&a>0,l=s<n.length&&a+s<n.length;return n.slice(a,a+s).map((m,u,g)=>{let w=u===0&&c,d=u===g.length-1&&l;return w||d?h.default.dim("..."):o(m,u+a===t)})},L=(e)=>new Ht({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${h.default.gray(_)}
16
+ ${De(this.state)} ${e.message}
17
+ `,n=e.placeholder?h.default.inverse(e.placeholder[0])+h.default.dim(e.placeholder.slice(1)):h.default.inverse(h.default.hidden("_")),o=this.value?this.valueWithCursor:n;switch(this.state){case"error":return`${t.trim()}
18
+ ${h.default.yellow(_)} ${o}
19
+ ${h.default.yellow(ce)} ${h.default.yellow(this.error)}
20
+ `;case"submit":return`${t}${h.default.gray(_)} ${h.default.dim(this.value||e.placeholder)}`;case"cancel":return`${t}${h.default.gray(_)} ${h.default.strikethrough(h.default.dim(this.value??""))}${this.value?.trim()?`
21
+ ${h.default.gray(_)}`:""}`;default:return`${t}${h.default.cyan(_)} ${o}
22
+ ${h.default.cyan(ce)}
23
+ `}}}).prompt(),A=(e)=>{let t=e.active??"Yes",n=e.inactive??"No";return new Ot({active:t,inactive:n,initialValue:e.initialValue??!0,render(){let o=`${h.default.gray(_)}
24
+ ${De(this.state)} ${e.message}
25
+ `,i=this.value?t:n;switch(this.state){case"submit":return`${o}${h.default.gray(_)} ${h.default.dim(i)}`;case"cancel":return`${o}${h.default.gray(_)} ${h.default.strikethrough(h.default.dim(i))}
26
+ ${h.default.gray(_)}`;default:return`${o}${h.default.cyan(_)} ${this.value?`${h.default.green(Nt)} ${t}`:`${h.default.dim(Ut)} ${h.default.dim(t)}`} ${h.default.dim("/")} ${this.value?`${h.default.dim(Ut)} ${h.default.dim(n)}`:`${h.default.green(Nt)} ${n}`}
27
+ ${h.default.cyan(ce)}
28
+ `}}}).prompt()},Z=(e)=>{let t=(n,o)=>{let i=n.label??String(n.value);switch(o){case"selected":return`${h.default.dim(i)}`;case"active":return`${h.default.green(Nt)} ${i} ${n.hint?h.default.dim(`(${n.hint})`):""}`;case"cancelled":return`${h.default.strikethrough(h.default.dim(i))}`;default:return`${h.default.dim(Ut)} ${h.default.dim(i)}`}};return new Gt({options:e.options,initialValue:e.initialValue,render(){let n=`${h.default.gray(_)}
29
+ ${De(this.state)} ${e.message}
30
+ `;switch(this.state){case"submit":return`${n}${h.default.gray(_)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${n}${h.default.gray(_)} ${t(this.options[this.cursor],"cancelled")}
31
+ ${h.default.gray(_)}`;default:return`${n}${h.default.cyan(_)} ${Wt({cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(o,i)=>t(o,i?"active":"inactive")}).join(`
32
+ ${h.default.cyan(_)} `)}
33
+ ${h.default.cyan(ce)}
34
+ `}}}).prompt()},X=(e)=>{let t=(n,o)=>{let i=n.label??String(n.value);return o==="active"?`${h.default.cyan(Pi)} ${i} ${n.hint?h.default.dim(`(${n.hint})`):""}`:o==="selected"?`${h.default.green(Nn)} ${h.default.dim(i)} ${n.hint?h.default.dim(`(${n.hint})`):""}`:o==="cancelled"?`${h.default.strikethrough(h.default.dim(i))}`:o==="active-selected"?`${h.default.green(Nn)} ${i} ${n.hint?h.default.dim(`(${n.hint})`):""}`:o==="submitted"?`${h.default.dim(i)}`:`${h.default.dim(Ai)} ${h.default.dim(i)}`};return new Ln({options:e.options,initialValues:e.initialValues,required:e.required??!0,cursorAt:e.cursorAt,validate(n){if(this.required&&n.length===0)return`Please select at least one option.
35
+ ${h.default.reset(h.default.dim(`Press ${h.default.gray(h.default.bgWhite(h.default.inverse(" space ")))} to select, ${h.default.gray(h.default.bgWhite(h.default.inverse(" enter ")))} to submit`))}`},render(){let n=`${h.default.gray(_)}
36
+ ${De(this.state)} ${e.message}
37
+ `,o=(i,r)=>{let s=this.value.includes(i.value);return r&&s?t(i,"active-selected"):s?t(i,"selected"):t(i,r?"active":"inactive")};switch(this.state){case"submit":return`${n}${h.default.gray(_)} ${this.options.filter(({value:i})=>this.value.includes(i)).map((i)=>t(i,"submitted")).join(h.default.dim(", "))||h.default.dim("none")}`;case"cancel":{let i=this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>t(r,"cancelled")).join(h.default.dim(", "));return`${n}${h.default.gray(_)} ${i.trim()?`${i}
38
+ ${h.default.gray(_)}`:""}`}case"error":{let i=this.error.split(`
39
+ `).map((r,s)=>s===0?`${h.default.yellow(ce)} ${h.default.yellow(r)}`:` ${r}`).join(`
40
+ `);return`${n+h.default.yellow(_)} ${Wt({options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:o}).join(`
41
+ ${h.default.yellow(_)} `)}
42
42
  ${i}
43
- `}default:return`${r}${b.default.cyan(O)} ${go({options:this.options,cursor:this.cursor,maxItems:n.maxItems,style:s}).join(`
44
- ${b.default.cyan(O)} `)}
45
- ${b.default.cyan(nn)}
46
- `}}}).prompt()},L=(n="",t="")=>{let r=`
47
- ${n}
48
- `.split(`
49
- `),s=bo(t).length,i=Math.max(r.reduce((o,c)=>{let a=bo(c);return a.length>o?a.length:o},0),s)+2,e=r.map((o)=>`${b.default.gray(O)} ${b.default.dim(o)}${" ".repeat(i-bo(o).length)}${b.default.gray(O)}`).join(`
50
- `);process.stdout.write(`${b.default.gray(O)}
51
- ${b.default.green(Nn)} ${b.default.reset(t)} ${b.default.gray(ht.repeat(Math.max(i-s-1,1))+is)}
43
+ `}default:return`${n}${h.default.cyan(_)} ${Wt({options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:o}).join(`
44
+ ${h.default.cyan(_)} `)}
45
+ ${h.default.cyan(ce)}
46
+ `}}}).prompt()},P=(e="",t="")=>{let n=`
52
47
  ${e}
53
- ${b.default.gray(es+ht.repeat(i+2)+cs)}
54
- `)},dt=(n="")=>{process.stdout.write(`${b.default.gray(nn)} ${b.default.red(n)}
55
-
56
- `)},$,me,yt=({indicator:n="dots"}={})=>{let t=yo?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=yo?80:120,s=process.env.CI==="true",i,e,o=!1,c="",a,l=performance.now(),f=(E)=>{let A=E>1?"Something went wrong":"Canceled";o&&I(A,E)},p=()=>f(2),d=()=>f(1),w=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",f)},y=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",f)},g=()=>{if(a===void 0)return;s&&process.stdout.write(`
57
- `);let E=a.split(`
58
- `);process.stdout.write(Un.cursor.move(-999,E.length-1)),process.stdout.write(Un.erase.down(E.length))},x=(E)=>E.replace(/\.+$/,""),u=(E)=>{let A=(performance.now()-E)/1000,R=Math.floor(A/60),z=Math.floor(A%60);return R>0?`[${R}m ${z}s]`:`[${z}s]`},S=(E="")=>{o=!0,i=lt(),c=x(E),l=performance.now(),process.stdout.write(`${b.default.gray(O)}
59
- `);let A=0,R=0;w(),e=setInterval(()=>{if(s&&c===a)return;g(),a=c;let z=b.default.magenta(t[A]);if(s)process.stdout.write(`${z} ${c}...`);else if(n==="timer")process.stdout.write(`${z} ${c} ${u(l)}`);else{let Z=".".repeat(Math.floor(R)).slice(0,3);process.stdout.write(`${z} ${c}${Z}`)}A=A+1<t.length?A+1:0,R=R<t.length?R+0.125:0},r)},I=(E="",A=0)=>{o=!1,clearInterval(e),g();let R=A===0?b.default.green(Nn):A===1?b.default.red(pt):b.default.red(bt);c=x(E??c),n==="timer"?process.stdout.write(`${R} ${c} ${u(l)}
60
- `):process.stdout.write(`${R} ${c}
61
- `),y(),i()};return{start:S,stop:I,message:(E="")=>{c=x(E??c)}}},uo=async(n,t)=>{let r={},s=Object.keys(n);for(let i of s){let e=n[i],o=await e({results:r})?.catch((c)=>{throw c});if(typeof t?.onCancel=="function"&&Q(o)){r[i]="canceled",t.onCancel({results:r});continue}r[i]=o}return r};var q=C(()=>{po();po();b=yn(ro(),1),Un=yn(oo(),1);yo=os(),ts=G("\u25C6","*"),pt=G("\u25A0","x"),bt=G("\u25B2","x"),Nn=G("\u25C7","o"),le=G("\u250C","T"),O=G("\u2502","|"),nn=G("\u2514","\u2014"),wo=G("\u25CF",">"),$o=G("\u25CB"," "),rs=G("\u25FB","[\u2022]"),mt=G("\u25FC","[+]"),ss=G("\u25FB","[ ]"),fe=G("\u25AA","\u2022"),ht=G("\u2500","-"),is=G("\u256E","+"),es=G("\u251C","+"),cs=G("\u256F","+"),as=G("\u25CF","\u2022"),ls=G("\u25C6","*"),fs=G("\u25B2","!"),ms=G("\u25A0","x"),$={message:(n="",{symbol:t=b.default.gray(O)}={})=>{let r=[`${b.default.gray(O)}`];if(n){let[s,...i]=n.split(`
62
- `);r.push(`${t} ${s}`,...i.map((e)=>`${b.default.gray(O)} ${e}`))}process.stdout.write(`${r.join(`
48
+ `.split(`
49
+ `),o=qt(t).length,i=Math.max(n.reduce((s,a)=>{let c=qt(a);return c.length>s?c.length:s},0),o)+2,r=n.map((s)=>`${h.default.gray(_)} ${h.default.dim(s)}${" ".repeat(i-qt(s).length)}${h.default.gray(_)}`).join(`
50
+ `);process.stdout.write(`${h.default.gray(_)}
51
+ ${h.default.green(Fe)} ${h.default.reset(t)} ${h.default.gray(Un.repeat(Math.max(i-o-1,1))+Bi)}
52
+ ${r}
53
+ ${h.default.gray(Mi+Un.repeat(i+2)+Oi)}
54
+ `)},Jn=(e="")=>{process.stdout.write(`${h.default.gray(ce)} ${h.default.red(e)}
55
+
56
+ `)},D=(e="")=>{process.stdout.write(`${h.default.gray(Ei)} ${e}
57
+ `)},T=(e="")=>{process.stdout.write(`${h.default.gray(_)}
58
+ ${h.default.gray(ce)} ${e}
59
+
60
+ `)},$,Dc,xe=({indicator:e="dots"}={})=>{let t=Lt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],n=Lt?80:120,o=process.env.CI==="true",i,r,s=!1,a="",c,l=performance.now(),m=(C)=>{let S=C>1?"Something went wrong":"Canceled";s&&U(S,C)},u=()=>m(2),g=()=>m(1),w=()=>{process.on("uncaughtExceptionMonitor",u),process.on("unhandledRejection",u),process.on("SIGINT",g),process.on("SIGTERM",g),process.on("exit",m)},d=()=>{process.removeListener("uncaughtExceptionMonitor",u),process.removeListener("unhandledRejection",u),process.removeListener("SIGINT",g),process.removeListener("SIGTERM",g),process.removeListener("exit",m)},y=()=>{if(c===void 0)return;o&&process.stdout.write(`
61
+ `);let C=c.split(`
62
+ `);process.stdout.write(Qe.cursor.move(-999,C.length-1)),process.stdout.write(Qe.erase.down(C.length))},b=(C)=>C.replace(/\.+$/,""),x=(C)=>{let S=(performance.now()-C)/1000,R=Math.floor(S/60),q=Math.floor(S%60);return R>0?`[${R}m ${q}s]`:`[${q}s]`},k=(C="")=>{s=!0,i=qn(),a=b(C),l=performance.now(),process.stdout.write(`${h.default.gray(_)}
63
+ `);let S=0,R=0;w(),r=setInterval(()=>{if(o&&a===c)return;y(),c=a;let q=h.default.magenta(t[S]);if(o)process.stdout.write(`${q} ${a}...`);else if(e==="timer")process.stdout.write(`${q} ${a} ${x(l)}`);else{let V=".".repeat(Math.floor(R)).slice(0,3);process.stdout.write(`${q} ${a}${V}`)}S=S+1<t.length?S+1:0,R=R<t.length?R+0.125:0},n)},U=(C="",S=0)=>{s=!1,clearInterval(r),y();let R=S===0?h.default.green(Fe):S===1?h.default.red(Wn):h.default.red(zn);a=b(C??a),e==="timer"?process.stdout.write(`${R} ${a} ${x(l)}
64
+ `):process.stdout.write(`${R} ${a}
65
+ `),d(),i()};return{start:k,stop:U,message:(C="")=>{a=b(C??a)}}},zt=async(e,t)=>{let n={},o=Object.keys(e);for(let i of o){let r=e[i],s=await r({results:n})?.catch((a)=>{throw a});if(typeof t?.onCancel=="function"&&se(s)){n[i]="canceled",t.onCancel({results:n});continue}n[i]=s}return n};var M=O(()=>{Tt();Tt();h=pe(It(),1),Qe=pe(Rt(),1);Lt=Ii(),_i=N("\u25C6","*"),Wn=N("\u25A0","x"),zn=N("\u25B2","x"),Fe=N("\u25C7","o"),Ei=N("\u250C","T"),_=N("\u2502","|"),ce=N("\u2514","\u2014"),Nt=N("\u25CF",">"),Ut=N("\u25CB"," "),Pi=N("\u25FB","[\u2022]"),Nn=N("\u25FC","[+]"),Ai=N("\u25FB","[ ]"),Fc=N("\u25AA","\u2022"),Un=N("\u2500","-"),Bi=N("\u256E","+"),Mi=N("\u251C","+"),Oi=N("\u256F","+"),Gi=N("\u25CF","\u2022"),Hi=N("\u25C6","*"),Ti=N("\u25B2","!"),qi=N("\u25A0","x"),$={message:(e="",{symbol:t=h.default.gray(_)}={})=>{let n=[`${h.default.gray(_)}`];if(e){let[o,...i]=e.split(`
66
+ `);n.push(`${t} ${o}`,...i.map((r)=>`${h.default.gray(_)} ${r}`))}process.stdout.write(`${n.join(`
63
67
  `)}
64
- `)},info:(n)=>{$.message(n,{symbol:b.default.blue(as)})},success:(n)=>{$.message(n,{symbol:b.default.green(ls)})},step:(n)=>{$.message(n,{symbol:b.default.green(Nn)})},warn:(n)=>{$.message(n,{symbol:b.default.yellow(fs)})},warning:(n)=>{$.warn(n)},error:(n)=>{$.message(n,{symbol:b.default.red(ms)})}},me=`${b.default.gray(O)} `});function wt(n,t){let r=hs[n]||"Unknown error";return t?`${r}: ${t}`:r}var hs;var xo=C(()=>{hs={"core.auth.failed":"Authentication failed","core.auth.invalid_token":"Token is invalid or expired","core.fs.cannot_read":"Cannot read file","core.fs.cannot_write":"Cannot write to file","core.fs.directory_not_found":"Directory not found","core.fs.file_not_found":"File not found","core.git.dirty_working_dir":"Working directory has uncommitted changes","core.git.no_commits":"No commits found","core.git.not_repository":"Not a git repository","core.git.operation_failed":"Git operation failed","core.invalid_argument":"Invalid argument","core.invalid_config":"Invalid configuration","core.network.request_failed":"Network request failed","core.operation_cancelled":"Operation cancelled","core.operation_failed":"Operation failed","core.permission_denied":"Permission denied","hydra.config.invalid_format":"Invalid configuration format","hydra.config.missing_required":"Missing required configuration","hydra.config.not_found":"Configuration file not found","hydra.runner.creation_failed":"Runner creation failed","hydra.runner.not_found":"Runner not found","hydra.runner.removal_failed":"Runner removal failed","hydra.token.decryption_failed":"Token decryption failed","hydra.token.encryption_failed":"Token encryption failed","sisyphus.publish.failed":"Publishing failed","sisyphus.release.no_changes":"No changes to release","sisyphus.stone.invalid":"Invalid stone format","sisyphus.stone.not_found":"No stones found","sisyphus.version.conflict":"Version conflict detected","sisyphus.version.invalid_format":"Invalid version format"}});function $t(n={}){let{errorPrefix:t="\u2717"}=n;return function r(s){if(Q(s))ln.info("Operation cancelled"),process.exit(0);if(s instanceof So){if(ln.error(`${t} ${s.message}`),s.code)ln.error(` Error code: ${s.code}`)}else if(s instanceof Error)ln.error(`${t} ${s.message}`);else ln.error(`${t} An unexpected error occurred`),ln.error(String(s));process.exit(1)}}var ln,So;var gt=C(()=>{q();_();xo();ln=v({prefix:"cli-core"}).child("error");So=class So extends Error{code;context;constructor(n,t,r){let s=n.includes(".")&&!n.includes(" ")?wt(n,r):n;super(s);this.code=t;this.context=r;this.name="CLIError"}}});var T,ps=(n,t)=>{let r=n.length,s=t.length,i=1<<r-1,e=-1,o=0,c=r,a=r;while(a--)T[n.charCodeAt(a)]|=1<<a;for(a=0;a<s;a++){let l=T[t.charCodeAt(a)],f=l|o;if(l|=(l&e)+e^e,o|=~(l|e),e&=l,o&i)c++;if(e&i)c--;o=o<<1|1,e=e<<1|~(f|o),o&=f}a=r;while(a--)T[n.charCodeAt(a)]=0;return c},bs=(n,t)=>{let r=t.length,s=n.length,i=[],e=[],o=Math.ceil(r/32),c=Math.ceil(s/32);for(let y=0;y<o;y++)e[y]=-1,i[y]=0;let a=0;for(;a<c-1;a++){let y=0,g=-1,x=a*32,u=Math.min(32,s)+x;for(let S=x;S<u;S++)T[n.charCodeAt(S)]|=1<<S;for(let S=0;S<r;S++){let I=T[t.charCodeAt(S)],E=e[S/32|0]>>>S&1,A=i[S/32|0]>>>S&1,R=I|y,z=((I|A)&g)+g^g|I|A,Z=y|~(z|g),cn=g&z;if(Z>>>31^E)e[S/32|0]^=1<<S;if(cn>>>31^A)i[S/32|0]^=1<<S;Z=Z<<1|E,cn=cn<<1|A,g=cn|~(R|Z),y=Z&R}for(let S=x;S<u;S++)T[n.charCodeAt(S)]=0}let l=0,f=-1,p=a*32,d=Math.min(32,s-p)+p;for(let y=p;y<d;y++)T[n.charCodeAt(y)]|=1<<y;let w=s;for(let y=0;y<r;y++){let g=T[t.charCodeAt(y)],x=e[y/32|0]>>>y&1,u=i[y/32|0]>>>y&1,S=g|l,I=((g|u)&f)+f^f|g|u,E=l|~(I|f),A=f&I;if(w+=E>>>s-1&1,w-=A>>>s-1&1,E>>>31^x)e[y/32|0]^=1<<y;if(A>>>31^u)i[y/32|0]^=1<<y;E=E<<1|x,A=A<<1|u,f=A|~(S|E),l=E&S}for(let y=p;y<d;y++)T[n.charCodeAt(y)]=0;return w},ut=(n,t)=>{if(n.length<t.length){let r=t;t=n,n=r}if(t.length===0)return n.length;if(n.length<=32)return ps(n,t);return bs(n,t)};var xt=C(()=>{T=new Uint32Array(65536)});function Ln(n,t,r=3){return t.map((e)=>({distance:ut(n.toLowerCase(),e.toLowerCase()),option:e})).filter(({distance:e})=>e<=Math.max(3,n.length/2)).sort((e,o)=>e.distance-o.distance).slice(0,r).map(({option:e})=>e)}function qn(n,t){return t[n.toLowerCase()]||null}var St=C(()=>{xt()});async function vo(n,t={}){let{fallback:r,logLevel:s="warn",message:i="Operation failed gracefully"}=t;try{return await n()}catch(e){let o=e instanceof Error?e.message:String(e);if(vt[s](`${i}: ${o}`),r)try{await r()}catch(c){vt.error(`Fallback also failed: ${c instanceof Error?c.message:String(c)}`)}return}}var vt;var Et=C(()=>{_();vt=v({prefix:"cli-core"}).child("graceful")});var Ot=C(()=>{_()});async function jt(n,t={}){let r={...ds,...t},s=new Error("Operation failed");for(let i=1;i<=r.maxAttempts;i++)try{return await n()}catch(e){if(s=e instanceof Error?e:new Error(String(e)),!r.retryableErrors.some((a)=>s.message.toLowerCase().includes(a.toLowerCase()))||i===r.maxAttempts)throw s;r.onRetry(i,s);let c=Math.min(r.initialDelay*r.backoffMultiplier**(i-1),r.maxDelay);await new Promise((a)=>setTimeout(a,c))}throw s}var ds;var Rt=C(()=>{_();ds={backoffMultiplier:2,initialDelay:1000,maxAttempts:3,maxDelay:30000,onRetry:(n,t)=>{Fn.warn(`Retry attempt ${n}: ${t.message}`)},retryableErrors:["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENOTFOUND","rate limit","429","503","502","504","npm ERR!","EPUBLISHCONFLICT"]}});var fn=(n)=>{return n.map=(t)=>fn((r)=>t(n(r))),n.or=(t)=>fn((r)=>{try{return n(r)}catch(s){return t(r)}}),n},Eo=()=>"bad banditype"(),Oo=(n)=>fn((t)=>typeof t===typeof n?t:Eo()),F=()=>Oo(""),At=()=>Oo(!0),Pn=()=>Oo(),_t=(n)=>fn((t)=>t instanceof n?t:Eo()),on=(n)=>_t(Object).map((t)=>{let r={};for(let s in n){let i=n[s](t[s]);i!==void 0&&(r[s]=i)}return r}),Jn=(n)=>_t(Array).map((t)=>t.map(n));function jo(n,t){return fn((r)=>{try{return n(r)}catch{try{return t(r)}catch{throw new Error("No matching schema in union")}}})}function mn(n,t){return(r)=>{if(r===void 0)return t;return n(r)}}function Mt(n){return{parse(t){try{return n(t)}catch(r){throw new Error(r instanceof Error?r.message:"Validation failed")}},safeParse(t){try{return{data:n(t),success:!0}}catch(r){return{error:r instanceof Error?r:new Error("Validation failed"),success:!1}}},validator:n}}function Ro(){return jo(Pn(),F())}function ys(){return jo(Pn(),At())}function Ao(n){return mn(F(),n)}function Bn(n){return mn(Ro(),n)}function D(n){return mn(ys(),n)}function Xn(n){return jo(Pn(),n)}var It=()=>{};var U=C(()=>{Xo();gt();xo();St();Et();Ot();Rt();It()});var ws,$s,gs,us,_o;var Ut=C(()=>{U();ws=on({commit:F(),date:F()}),$s=on({author:Bn("r5n-bot"),email:Ro(),message:Bn("release(\uD83C\uDF89): <packageName@version>")}),gs=on({commitAndPush:D(!1),github:D(!1),npm:D(!1),tags:D(!1)}),us=on({generate:D(!0),root:D(!1)}),_o=Mt(on({$schema:Ao("https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json"),changelog:Xn(us),commit:Xn($s),configPath:Bn(".sisyphus"),ignore:mn(Jn(F()),[]),lastStone:ws,release:Xn(gs),single:D(!1),stones:mn(Jn(F()),[]),tag:Ao("latest")}))});var gn=()=>{};var Nt={};yr(Nt,{versionBumper:()=>B,updateSisyphusConfig:()=>Ho,lineSplitter:()=>Go,isInteractive:()=>Uo,handleCancel:()=>hn,getStones:()=>V,getSisyphusConfig:()=>j,getPackages:()=>J,getPackageUpdateLabel:()=>un,ensureDryRunInTest:()=>No,bumpTypeOrder:()=>tn,bumpTypeAnnotation:()=>rn});var{$:Wn}=globalThis.Bun;function Uo({stream:n=process.stdout}={}){return Boolean(n?.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function hn(n){if(typeof n==="function")n();else dt(n||"Operation cancelled by user");process.exit(0)}function No(n){return n}async function j({overwrite:n,tag:t,dryRun:r,silent:s,configPath:i=".sisyphus",...e}={}){let o=`./${i}/config.json`,a=await Bun.file(o).exists(),l=a&&n,f=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim();if(f.length===0)throw new Error("Couldn't find git repository. Have you initialized git repository?");let p;if(a)try{let y=await Bun.file(".sisyphus/config.json").json(),g=_o.safeParse(y);if(!g.success)throw Mo.error("Configuration validation failed:",y,g),g.error instanceof Error?new Error(`Invalid configuration file: ${g.error.message}`):g.error;p=g.data}catch(y){if(y instanceof Error)throw new Error(`Invalid configuration file: ${y.message}`);throw new Error("Failed to parse configuration file")}else p=_o.parse({$schema:"https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json",ignore:[],lastStone:{commit:f,date:new Date().toISOString().split(".")[0]||""},stones:[],tag:t||"latest"});let d={...p,...e},w=`${JSON.stringify(d,null,2)}
65
- `;if(r){if(!s)Mo.info(`${m.bold(m.yellow("[dry-run]"))}
66
- ${m.italic(".sisyphus/config.json")}:
67
- ${w}`);return{...p,...e}}if(l)try{await Wn`rm -rf ${i}`.quiet()}catch{}if(a&&!n)return d;return await Wn`mkdir -p ${i}`.quiet(),await Bun.write(o,w),d}async function Ho({dryRun:n,silent:t,configPath:r,...s}){let i=await j({configPath:r}),e=`./${r||i.configPath||".sisyphus"}/config.json`,o=`${JSON.stringify({...i,...s},null,2)}
68
- `;if(n){if(!t)Mo.info(`${m.bold(m.yellow("[dry-run]"))}
69
- ${m.italic(e)} would be updated to
70
- ${o}`);return}await Bun.write(e,o),L(`${m.green("Sisyphus config updated!")}`)}function un({name:n,version:t,bump:r,tag:s}){return`${n}@${t} => ${m.green(B({bump:r,tag:s,version:t}))} ${rn[r]}`}function xs({baseVersion:n,bump:t}){let[r="0",s="0",i="0"]=n.split(".");switch(t){case"major":return`${Number.parseInt(r,10)+1}.0.0`;case"minor":return`${r}.${Number.parseInt(s,10)+1}.0`;case"dependency":case"patch":return`${r}.${s}.${Number.parseInt(i,10)+1}`;default:return`${r}.${s}.${i}`}}function B({version:n="",bump:t,tag:r}){let[s="0.0.0",i=""]=n.split("-"),[e="",o="0"]=i.split(".");if(t==="snapshot"){let c=new Date().toISOString().replace(/[.ZT:-]/g,"").slice(0,14);return`0.0.0-${r||"nightly"}-${c}`}if(r&&!t){let c=r===e?Number.parseInt(o,10)+1:1;return`${s}-${r}.${c}`}if(r||t==="dependency"&&e){let c=r===e?Number.parseInt(o,10)+1:1;return`${s}-${r||e}.${c}`}return xs({baseVersion:s,bump:t})}async function V({dryRun:n,silent:t,configPath:r,testModeEnabled:s}={}){let i=s,e=await j({configPath:r,dryRun:n,silent:t}),o=i&&r?`${r}/stones`:`./${r||e.configPath||".sisyphus"}/stones`;try{let a=(await Wn`ls ${o} 2>/dev/null || true`.quiet()).stdout.toString().trim();if(!a)return[];return a.split(`
71
- `).filter(Boolean).map((f)=>f.replace(".md",""))}catch(c){if(!n)await Wn`mkdir -p ${o}`.quiet();return[]}}async function J({filter:n,single:t}={}){let r=process.cwd(),s=await Bun.file("package.json").json();if(t)return vs(s);let i=s?.workspaces||[];if(i.length===0)throw new Error(`Seems like package.json doesn't have \`workspaces\` field or it's empty. Are you sure you are in the root of the workspace? (cwd: ${r})
72
-
73
- If you want to run Sisyphus in single-mode/root package, use --single flag or set \`"single": true\` in .sisyphus/config.json.`);let e=await Ss({cwd:r,workspaces:i}),o=Object.keys(e);return{packageNames:n?o.filter((c)=>c.includes(n)):o,packages:e}}async function Ss({workspaces:n,cwd:t}){let r={},s={};for(let i of n){let e=new Bun.Glob(`${i}/package.json`).scanSync({cwd:t});for(let o of e){let{name:c,version:a,dependencies:l={},devDependencies:f={}}=await Bun.file(o).json(),d=Object.entries({...l,...f}).map(([w,y])=>y.startsWith("workspace")?w:"").filter(Boolean);for(let w of d)if(s[w]||=[],!s[w].includes(c))s[w].push(c);r[c]={bump:"dependency",dependencyOf:[],file:o,name:c,version:a}}}for(let[i,e]of Object.entries(s))if(r[i])r[i].dependencyOf=e;return r}function vs({name:n,version:t}){return{packageNames:[n],packages:{[n]:{bump:"dependency",dependencyOf:[],file:"package.json",name:n,version:t||"0.0.0"}}}}var Mo,Go="***",tn,rn;var H=C(()=>{q();_();Ut();gn();Mo=v({prefix:"sisyphus"}).child("helpers"),tn=["dependency","patch","minor","major","snapshot"],rn={dependency:"\uD83D\uDCE6",patch:"\uD83D\uDC1B",minor:"\u2728",major:"\uD83D\uDEA8",snapshot:"\uD83D\uDCF8"}});U();_();U();U();var Gt=$t({errorPrefix:"\u2717"});q();U();_();H();q();_();H();import{parseArgs as Ls}from"util";var{$:Y}=globalThis.Bun;U();_();H();var xn=v({prefix:"sisyphus"}).child("changelog");async function Ct({changelogRoot:n,commit:t,dryRun:r=!1,stones:s}){let i=[""],{lastStone:{commit:e=""}}=await j(),o=Es({stones:s});for(let[c,{bump:a,path:l,changelog:f}]of o.entries()){let p=[...f,Ht({commit:t,lastCommit:e})],d=await Bun.file(l).exists(),[w,...y]=d?(await Bun.file(l).text()).split(`
74
- `):[`# ${c}`],g=[w,...p,...y];if(r)xn.info(`${m.bold(m.yellow("[dry-run]"))}
75
- ${g.join(`
76
- `)}`);else if(!await vo(async()=>{return xn.info(`Writing changelog to ${l}`),await Bun.write(l,`${g.join(`
68
+ `)},info:(e)=>{$.message(e,{symbol:h.default.blue(Gi)})},success:(e)=>{$.message(e,{symbol:h.default.green(Hi)})},step:(e)=>{$.message(e,{symbol:h.default.green(Fe)})},warn:(e)=>{$.message(e,{symbol:h.default.yellow(Ti)})},warning:(e)=>{$.warn(e)},error:(e)=>{$.message(e,{symbol:h.default.red(qi)})}},Dc=`${h.default.gray(_)} `});function Kn(e,t){let n=Li[e]||"Unknown error";return t?`${n}: ${t}`:n}var Li;var Jt=O(()=>{Li={"core.auth.failed":"Authentication failed","core.auth.invalid_token":"Token is invalid or expired","core.fs.cannot_read":"Cannot read file","core.fs.cannot_write":"Cannot write to file","core.fs.directory_not_found":"Directory not found","core.fs.file_not_found":"File not found","core.git.dirty_working_dir":"Working directory has uncommitted changes","core.git.no_commits":"No commits found","core.git.not_repository":"Not a git repository","core.git.operation_failed":"Git operation failed","core.invalid_argument":"Invalid argument","core.invalid_config":"Invalid configuration","core.network.request_failed":"Network request failed","core.operation_cancelled":"Operation cancelled","core.operation_failed":"Operation failed","core.permission_denied":"Permission denied","hydra.config.invalid_format":"Invalid configuration format","hydra.config.missing_required":"Missing required configuration","hydra.config.not_found":"Configuration file not found","hydra.runner.creation_failed":"Runner creation failed","hydra.runner.not_found":"Runner not found","hydra.runner.removal_failed":"Runner removal failed","hydra.token.decryption_failed":"Token decryption failed","hydra.token.encryption_failed":"Token encryption failed","sisyphus.publish.failed":"Publishing failed","sisyphus.release.no_changes":"No changes to release","sisyphus.stone.invalid":"Invalid stone format","sisyphus.stone.not_found":"No stones found","sisyphus.version.conflict":"Version conflict detected","sisyphus.version.invalid_format":"Invalid version format"}});function Zn(e={}){let{errorPrefix:t="\u2717"}=e;return function n(o){if(se(o))Ce.info("Operation cancelled"),process.exit(0);if(o instanceof ee){if(Ce.error(`${t} ${o.message}`),o.code)Ce.error(` Error code: ${o.code}`)}else if(o instanceof Error)Ce.error(`${t} ${o.message}`);else Ce.error(`${t} An unexpected error occurred`),Ce.error(String(o));process.exit(1)}}var Ce,ee;var Vn=O(()=>{M();I();Jt();Ce=v({prefix:"cli-core"}).child("error");ee=class ee extends Error{code;context;constructor(e,t,n){let o=e.includes(".")&&!e.includes(" ")?Kn(e,n):e;super(o);this.code=t;this.context=n;this.name="CLIError"}}});var oe,Ni=(e,t)=>{let n=e.length,o=t.length,i=1<<n-1,r=-1,s=0,a=n,c=n;while(c--)oe[e.charCodeAt(c)]|=1<<c;for(c=0;c<o;c++){let l=oe[t.charCodeAt(c)],m=l|s;if(l|=(l&r)+r^r,s|=~(l|r),r&=l,s&i)a++;if(r&i)a--;s=s<<1|1,r=r<<1|~(m|s),s&=m}c=n;while(c--)oe[e.charCodeAt(c)]=0;return a},Ui=(e,t)=>{let n=t.length,o=e.length,i=[],r=[],s=Math.ceil(n/32),a=Math.ceil(o/32);for(let d=0;d<s;d++)r[d]=-1,i[d]=0;let c=0;for(;c<a-1;c++){let d=0,y=-1,b=c*32,x=Math.min(32,o)+b;for(let k=b;k<x;k++)oe[e.charCodeAt(k)]|=1<<k;for(let k=0;k<n;k++){let U=oe[t.charCodeAt(k)],C=r[k/32|0]>>>k&1,S=i[k/32|0]>>>k&1,R=U|d,q=((U|S)&y)+y^y|U|S,V=d|~(q|y),ne=y&q;if(V>>>31^C)r[k/32|0]^=1<<k;if(ne>>>31^S)i[k/32|0]^=1<<k;V=V<<1|C,ne=ne<<1|S,y=ne|~(R|V),d=V&R}for(let k=b;k<x;k++)oe[e.charCodeAt(k)]=0}let l=0,m=-1,u=c*32,g=Math.min(32,o-u)+u;for(let d=u;d<g;d++)oe[e.charCodeAt(d)]|=1<<d;let w=o;for(let d=0;d<n;d++){let y=oe[t.charCodeAt(d)],b=r[d/32|0]>>>d&1,x=i[d/32|0]>>>d&1,k=y|l,U=((y|x)&m)+m^m|y|x,C=l|~(U|m),S=m&U;if(w+=C>>>o-1&1,w-=S>>>o-1&1,C>>>31^b)r[d/32|0]^=1<<d;if(S>>>31^x)i[d/32|0]^=1<<d;C=C<<1|b,S=S<<1|x,m=S|~(k|C),l=C&k}for(let d=u;d<g;d++)oe[e.charCodeAt(d)]=0;return w},Yn=(e,t)=>{if(e.length<t.length){let n=t;t=e,e=n}if(t.length===0)return e.length;if(e.length<=32)return Ni(e,t);return Ui(e,t)};var Xn=O(()=>{oe=new Uint32Array(65536)});function et(e,t,n=3){return t.map((r)=>({distance:Yn(e.toLowerCase(),r.toLowerCase()),option:r})).filter(({distance:r})=>r<=Math.max(3,e.length/2)).sort((r,s)=>r.distance-s.distance).slice(0,n).map(({option:r})=>r)}function tt(e,t){return t[e.toLowerCase()]||null}var Qn=O(()=>{Xn()});async function Kt(e,t={}){let{fallback:n,logLevel:o="warn",message:i="Operation failed gracefully"}=t;try{return await e()}catch(r){let s=r instanceof Error?r.message:String(r);if(Fn[o](`${i}: ${s}`),n)try{await n()}catch(a){Fn.error(`Fallback also failed: ${a instanceof Error?a.message:String(a)}`)}return}}var Fn;var Dn=O(()=>{I();Fn=v({prefix:"cli-core"}).child("graceful")});function nt(e){let t=[];if(t.push(p.bold(`${e.name} - ${e.description}`)),t.push(""),t.push(p.bold("USAGE")),t.push(` ${e.usage}`),t.push(""),e.options&&e.options.length>0){t.push(p.bold("OPTIONS"));for(let n of e.options){let o=n.type?n.type==="boolean"?p.boolean("[boolean]"):n.type==="string"?p.string("[string]"):n.type==="number"?p.number("[number]"):`[${n.type}]`:"",i=n.default!==void 0?p.dim(`(default: ${n.default})`):"",r=n.required?p.error("(required)"):"",s=[n.description,o,i,r].filter(Boolean);t.push(` ${p.flag(n.flags.padEnd(26))} ${s.join(" ")}`)}t.push("")}if(e.examples&&e.examples.length>0){t.push(p.bold("EXAMPLES"));for(let n of e.examples)t.push(p.dim(` # ${n.description}`)),t.push(` ${p.value(n.command)}`),t.push("")}if(e.sections&&e.sections.length>0)for(let n of e.sections){if(t.push(p.bold(n.title)),typeof n.content==="string")t.push(n.content);else t.push(...n.content);t.push("")}if(e.notes&&e.notes.length>0){t.push(p.bold("NOTES"));for(let n of e.notes)t.push(` - ${n}`);t.push("")}if(t[t.length-1]==="")t.pop();return t.join(`
69
+ `)}function st(e,t,n,o){let i=[];i.push(p.bold(e)),i.push(""),i.push(p.bold("USAGE")),i.push(` ${t}`),i.push(""),i.push(p.bold("COMMANDS"));let r=Math.max(...n.map((s)=>s.name.length));for(let s of n)i.push(` ${p.command(s.name.padEnd(r+2))} ${s.description}`);if(o)i.push(""),i.push(o);return i.join(`
70
+ `)}var es=O(()=>{St()});var ts=O(()=>{I()});async function ns(e,t={}){let n={...Wi,...t},o=new Error("Operation failed");for(let i=1;i<=n.maxAttempts;i++)try{return await e()}catch(r){if(o=r instanceof Error?r:new Error(String(r)),!n.retryableErrors.some((c)=>o.message.toLowerCase().includes(c.toLowerCase()))||i===n.maxAttempts)throw o;n.onRetry(i,o);let a=Math.min(n.initialDelay*n.backoffMultiplier**(i-1),n.maxDelay);await new Promise((c)=>setTimeout(c,a))}throw o}var Wi;var ss=O(()=>{I();Wi={backoffMultiplier:2,initialDelay:1000,maxAttempts:3,maxDelay:30000,onRetry:(e,t)=>{Ct.warn(`Retry attempt ${e}: ${t.message}`)},retryableErrors:["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENOTFOUND","rate limit","429","503","502","504","npm ERR!","EPUBLISHCONFLICT"]}});import{existsSync as zi}from"fs";import{readFile as Ji}from"fs/promises";import{homedir as Ki}from"os";import{join as is}from"path";async function Yi(){try{if(zi(Zt)){let e=await Ji(Zt,"utf-8");return JSON.parse(e)}}catch{}return{}}async function Xi(e){try{await Bun.write(Zt,JSON.stringify(e,null,2))}catch{}}async function Qi(e){try{let t=await fetch(`https://registry.npmjs.org/${e}/latest`,{signal:AbortSignal.timeout(5000)});if(!t.ok)return null;return(await t.json()).version}catch{return null}}async function Fi(e){let{packageName:t,currentVersion:n,checkInterval:o=Zi,silent:i=!1}=e;if(process.env.CI||process.env.CONTINUOUS_INTEGRATION)return null;if(process.env.R5N_NO_UPDATE_CHECK==="1")return null;try{let r=await Yi(),s=r[t],a=Date.now();if(s&&a-s.lastChecked<o)return{currentVersion:n,lastChecked:s.lastChecked,latestVersion:s.latestVersion,name:t,updateAvailable:os(s.latestVersion,n)>0};let c=await Qi(t);if(!c)return null;if(r[t]={lastChecked:a,latestVersion:c},!i)Xi(r).catch(()=>{});return{currentVersion:n,lastChecked:a,latestVersion:c,name:t,updateAvailable:os(c,n)>0}}catch{return null}}function Di(e){let{name:t,currentVersion:n,latestVersion:o}=e;return["","\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502 \u2502",`\u2502 Update available for ${(t.split("/").pop()||t).padEnd(29)} \u2502`,`\u2502 ${n.padEnd(15)} \u2192 ${o.padEnd(32)} \u2502`,"\u2502 \u2502",`\u2502 Run: bun update -g ${t.padEnd(30)} \u2502`,"\u2502 \u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518",""].join(`
71
+ `)}async function rs(e,t){let n=await Fi({currentVersion:t,packageName:e,silent:!1});if(n?.updateAvailable&&process.stdout.isTTY)setTimeout(()=>{console.log(Di(n))},100)}function os(e,t){let n=e.split(".").map(Number),o=t.split(".").map(Number);for(let i=0;i<Math.max(n.length,o.length);i++){let r=n[i]||0,s=o[i]||0;if(r>s)return 1;if(r<s)return-1}return 0}var Zi=86400000,Vi,Zt;var as=O(()=>{Vi=is(Ki(),".r5n","cache"),Zt=is(Vi,"update-check.json")});var Se=(e)=>{return e.map=(t)=>Se((n)=>t(e(n))),e.or=(t)=>Se((n)=>{try{return e(n)}catch(o){return t(n)}}),e},Vt=()=>"bad banditype"(),Yt=(e)=>Se((t)=>typeof t===typeof e?t:Vt()),ie=()=>Yt(""),cs=()=>Yt(!0),ot=()=>Yt(),ls=(e)=>Se((t)=>t instanceof e?t:Vt()),te=(e)=>ls(Object).map((t)=>{let n={};for(let o in e){let i=e[o](t[o]);i!==void 0&&(n[o]=i)}return n}),Be=(e)=>ls(Array).map((t)=>t.map(e));function Xt(e,t){return Se((n)=>{try{return e(n)}catch{try{return t(n)}catch{throw new Error("No matching schema in union")}}})}function me(e,t){return(n)=>{if(n===void 0)return t;return e(n)}}function ps(e){return{parse(t){try{return e(t)}catch(n){throw new Error(n instanceof Error?n.message:"Validation failed")}},safeParse(t){try{return{data:e(t),success:!0}}catch(n){return{error:n instanceof Error?n:new Error("Validation failed"),success:!1}}},validator:e}}function it(){return Xt(ot(),ie())}function er(){return Xt(ot(),cs())}function Qt(e){return me(ie(),e)}function Me(e){return me(it(),e)}function re(e){return me(er(),e)}function ue(e){return Xt(ot(),e)}var ms=()=>{};var us=()=>{};var E=O(()=>{St();Vn();Jt();Qn();Dn();es();ts();ss();as();ms();us()});import{join as nr}from"path";async function sr(e){let t=ds.get(e);if(t)return t;try{let n=e;if(e.startsWith("@sisyphus/"))n=e;else if(e.startsWith("./")||e.startsWith("../"))n=nr(process.cwd(),e);else if(!e.includes("/"))n=`sisyphus-plugin-${e}`;rt.info(`Loading plugin: ${e}`);let o=await import(n),i=o.default||o;if(!i.name)throw new Error(`Plugin ${e} must export a 'name' property`);return ds.set(e,i),rt.info(`Loaded plugin: ${i.name} ${i.version?`v${i.version}`:""}`),i}catch(n){throw rt.error(`Failed to load plugin ${e}:`,n),new Error(`Failed to load plugin ${e}: ${n}`)}}async function hs(e){let t=[];for(let n of e)try{let o=await sr(n);t.push(o)}catch(o){rt.warn(`Skipping plugin ${n} due to error:`,o)}return t}var rt,ds;var gs=O(()=>{E();rt=v({prefix:"sisyphus:plugins"}),ds=new Map});async function ys(e,t,...n){for(let o of e)if(o.hooks?.[t])try{ke.info(`Running ${t} hook for plugin: ${o.name}`),await o.hooks[t](...n)}catch(i){throw ke.error(`Error in ${t} hook for plugin ${o.name}:`,i),new Error(`Plugin ${o.name} failed in ${t}: ${i}`)}}async function bs(e,t,n){let o=t;for(let i of e)if(i.hooks?.modifyChangelog)try{ke.info(`Running modifyChangelog hook for plugin: ${i.name}`),o=await i.hooks.modifyChangelog(o,n)}catch(r){ke.error(`Error in modifyChangelog hook for plugin ${i.name}:`,r)}return o}async function ws(e,t){let n=t;for(let o of e)if(o.hooks?.modifyConfig)try{ke.info(`Running modifyConfig hook for plugin: ${o.name}`),n=await o.hooks.modifyConfig(n)}catch(i){ke.error(`Error in modifyConfig hook for plugin ${o.name}:`,i)}return n}var ke;var $s=O(()=>{E();ke=v({prefix:"sisyphus:plugins"})});var or,ir,rr,ar,cr,Ft;var vs=O(()=>{E();or=te({commit:ie(),date:ie()}),ir=te({author:Me("r5n-bot"),email:it(),message:Me("release(\uD83C\uDF89): <packageName@version>")}),rr=te({commitAndPush:re(!1),github:re(!1),npm:re(!1),tags:re(!1)}),ar=te({append:re(!0),filename:Me("CHANGELOG.md"),generate:re(!0),root:re(!1),template:it()}),cr=te({post:ue(te({})),pre:ue(te({}))}),Ft=ps(te({$schema:Qt("https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json"),changelog:ue(ar),commit:ue(ir),configPath:Me(".sisyphus"),ignore:me(Be(ie()),[]),lastStone:or,plugins:me(Be(ie()),[]),release:ue(rr),scripts:ue(cr),single:re(!1),stones:me(Be(ie()),[]),tag:Qt("latest")}))});var{$:Cs}=globalThis.Bun;async function lr(e,t){let n=t.scripts?.pre?.[e];if(!n)return;de.info(`Running pre-${e} script: ${n}`);try{await Cs`${n}`.quiet(),de.info(`Pre-${e} script completed`)}catch(o){throw de.error(`Pre-${e} script failed:`,o),new Error(`Pre-${e} script failed: ${o}`)}}async function xs(e,t){let n=t.scripts?.post?.[e];if(!n)return;de.info(`Running post-${e} script: ${n}`);try{await Cs`${n}`.quiet(),de.info(`Post-${e} script completed`)}catch(o){de.error(`Post-${e} script failed:`,o),de.warn(`Continuing despite post-${e} script failure`)}}async function Ss(e,t,n){await lr(e,t);try{let o=await n();return await xs(e,t),o}catch(o){throw await xs(e,t),o}}var de;var ks=O(()=>{E();de=v({prefix:"sisyphus:scripts"})});var Re=()=>{};function he(e){let t=e.match(/^([~^]?)(\d+)\.(\d+)\.(\d+)(.*)$/);if(!t)return null;let[,n="",o="0",i="0",r="0"]=t;return{major:Number.parseInt(o,10),minor:Number.parseInt(i,10),patch:Number.parseInt(r,10),prefix:n||"",version:`${o}.${i}.${r}`}}function Dt(e,t){let n=he(e),o=he(t);if(!n||!o)return!1;if(!o.prefix)return n.version===o.version;if(o.prefix==="^"){if(o.major>0)return n.major===o.major&&(n.minor>o.minor||n.minor===o.minor&&n.patch>=o.patch);if(o.minor>0)return n.major===0&&n.minor===o.minor&&n.patch>=o.patch;return n.major===0&&n.minor===0&&n.patch===o.patch}if(o.prefix==="~")return n.major===o.major&&n.minor===o.minor&&n.patch>=o.patch;return!1}function en(e,t,n){let o=he(e),i=he(t);if(!o||!i)return pr.warn(`Could not parse version constraint: ${e} -> ${t}`),t;if(n?.preserveConstraintType&&o.prefix)return`${o.prefix}${t}`;if(i.major>o.major)return i.major===0?t:`^${t}`;if(i.minor>o.minor)return o.prefix==="^"?`^${t}`:t;return o.prefix?`${o.prefix}${t}`:t}function Rs(e){let t=he(e);return t?t.version:e}function js(e,t){return!Dt(t,e)}function Is(e,t,n){let o={...e};for(let[i,r]of Object.entries(t))if(i in o&&o[i])o[i]=en(o[i],r,n);return o}var pr;var _s=O(()=>{I();pr=v({prefix:"sisyphus"}).child("version-constraints")});var rn={};Wo(rn,{versionBumper:()=>z,updateVersionConstraint:()=>en,updateSisyphusConfig:()=>on,updateDependencyVersions:()=>Is,satisfiesConstraint:()=>Dt,runWithScripts:()=>Ss,runPluginHook:()=>ys,parseVersionConstraint:()=>he,modifyConfigWithPlugins:()=>ws,modifyChangelogWithPlugins:()=>bs,lineSplitter:()=>tn,isInteractive:()=>nn,isBreakingChange:()=>js,handleCancel:()=>je,getStones:()=>Q,getSisyphusConfig:()=>j,getPlugins:()=>mr,getPackages:()=>G,getPackageUpdateLabel:()=>Oe,getMinimumVersion:()=>Rs,ensureDryRunInTest:()=>sn,bumpTypeOrder:()=>ge,bumpTypeAnnotation:()=>ye,SNAPSHOT_DATE_REGEX:()=>Ps,SNAPSHOT_DATE_LENGTH:()=>As,ISO_DATE_SEPARATOR:()=>Es,DEFAULT_SNAPSHOT_TAG:()=>Bs});var{$:ct}=globalThis.Bun;function nn({stream:e=process.stdout}={}){return Boolean(e?.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function je(e){if(typeof e==="function")e();else Jn(e||"Operation cancelled by user");process.exit(0)}function sn(e){return e}async function j({overwrite:e,tag:t,dryRun:n,silent:o,configPath:i=".sisyphus",...r}={}){let s=i.startsWith("/")?`${i}/config.json`:`./${i}/config.json`,c=await Bun.file(s).exists(),l=c&&e,m=i.includes("/.sisyphus-test-"),u="";if(!m){if(u=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),u.length===0)throw new Error("Couldn't find git repository. Have you initialized git repository?")}else u="test-commit-hash";let g;if(c)try{let y=await Bun.file(s).json(),b=Ft.safeParse(y);if(!b.success)throw lt.error("Configuration validation failed:",y,b),b.error instanceof Error?new Error(`Invalid configuration file: ${b.error.message}`):b.error;g=b.data}catch(y){if(y instanceof Error)throw new Error(`Invalid configuration file: ${y.message}`);throw new Error("Failed to parse configuration file")}else g=Ft.parse({$schema:"https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json",ignore:[],lastStone:{commit:u,date:new Date().toISOString().split(Es)[0]||""},stones:[],tag:t||"latest"});let w={...g,...r},d=`${JSON.stringify(w,null,2)}
72
+ `;if(n){if(!o)lt.info(`${f.bold(f.yellow("[dry-run]"))}
73
+ ${f.italic(".sisyphus/config.json")}:
74
+ ${d}`);return{...g,...r}}if(l)try{await ct`rm -rf ${i}`.quiet()}catch{}if(c&&!e)return w;return await ct`mkdir -p ${i}`.quiet(),await Bun.write(s,d),w}async function mr(e){if(at)return at;let t=e||await j();return at=await hs(t.plugins||[]),at}async function on({dryRun:e,silent:t,configPath:n,...o}){let i=await j({configPath:n}),r=`./${n||i.configPath||".sisyphus"}/config.json`,s=`${JSON.stringify({...i,...o},null,2)}
75
+ `;if(e){if(!t)lt.info(`${f.bold(f.yellow("[dry-run]"))}
76
+ ${f.italic(r)} would be updated to
77
+ ${s}`);return}await Bun.write(r,s),P(`${f.green("Sisyphus config updated!")}`)}function Oe({name:e,version:t,bump:n,tag:o}){return`${e}@${t} => ${f.green(z({bump:n,tag:o,version:t}))} ${ye[n]}`}function ur({baseVersion:e,bump:t}){let[n="0",o="0",i="0"]=e.split(".");switch(t){case"major":return`${Number.parseInt(n,10)+1}.0.0`;case"minor":return`${n}.${Number.parseInt(o,10)+1}.0`;case"dependency":case"patch":return`${n}.${o}.${Number.parseInt(i,10)+1}`;default:return`${n}.${o}.${i}`}}function z({version:e="",bump:t,tag:n}){let[o="0.0.0",i=""]=e.split("-"),[r="",s="0"]=i.split(".");if(t==="snapshot"){let a=new Date().toISOString().replace(Ps,"").slice(0,As);return`0.0.0-${n||Bs}-${a}`}if(n&&!t){let a=n===r?Number.parseInt(s,10)+1:1;return`${o}-${n}.${a}`}if(n||t==="dependency"&&r){let a=n===r?Number.parseInt(s,10)+1:1;return`${o}-${n||r}.${a}`}return ur({baseVersion:o,bump:t})}async function Q({dryRun:e,silent:t,configPath:n,testModeEnabled:o}={}){let i=o,r=await j({configPath:n,dryRun:e,silent:t}),s=i&&n?`${n}/stones`:`./${n||r.configPath||".sisyphus"}/stones`;try{let c=(await ct`ls ${s} 2>/dev/null || true`.quiet()).stdout.toString().trim();if(!c)return[];return c.split(`
78
+ `).filter(Boolean).map((m)=>m.replace(".md",""))}catch(a){if(!e)await ct`mkdir -p ${s}`.quiet();return[]}}async function G({filter:e,single:t,includePrivate:n}={}){let o=process.cwd(),i=await Bun.file("package.json").json();if(t)return dr(i);let r=i?.workspaces||[];if(r.length===0)throw new Error(`Seems like package.json doesn't have \`workspaces\` field or it's empty. Are you sure you are in the root of the workspace? (cwd: ${o})
79
+
80
+ If you want to run Sisyphus in single-mode/root package, use --single flag or set \`"single": true\` in .sisyphus/config.json.`);let{packages:s,privatePackageCount:a}=await fr({cwd:o,includePrivate:n,workspaces:r}),c=Object.keys(s);return{packageNames:e?c.filter((l)=>l.includes(e)):c,packages:s,privatePackageCount:a}}async function fr({workspaces:e,cwd:t,includePrivate:n}){let o={},i={},r=0;for(let s of e){let a=new Bun.Glob(`${s}/package.json`).scanSync({cwd:t});for(let c of a){let{name:l,version:m,private:u,dependencies:g={},devDependencies:w={}}=await Bun.file(c).json();if(u&&!n){lt.debug(`Skipping private package: ${l}`),r++;continue}let y=Object.entries({...g,...w}).map(([b,x])=>x.startsWith("workspace")?b:"").filter(Boolean);for(let b of y)if(i[b]||=[],!i[b].includes(l))i[b].push(l);o[l]={bump:"dependency",dependencyOf:[],file:c,name:l,version:m||"0.0.0"}}}for(let[s,a]of Object.entries(i))if(o[s])o[s].dependencyOf=a;return{packages:o,privatePackageCount:r}}function dr({name:e,version:t}){return{packageNames:[e],packages:{[e]:{bump:"dependency",dependencyOf:[],file:"package.json",name:e,version:t||"0.0.0"}},privatePackageCount:0}}var lt,tn="***",Es=".",Ps,As=14,Bs="nightly",ge,ye,at=null;var B=O(()=>{M();I();gs();$s();vs();ks();Re();_s();lt=v({prefix:"sisyphus"}).child("helpers"),Ps=/[.ZT:-]/g,ge=["dependency","patch","minor","major","snapshot"],ye={dependency:"\uD83D\uDCE6",patch:"\uD83D\uDC1B",minor:"\u2728",major:"\uD83D\uDEA8",snapshot:"\uD83D\uDCF8"}});E();I();var fe="0.4.1";E();E();var fs=Zn({errorPrefix:"\u2717"});M();E();I();B();import{parseArgs as hr}from"util";var Os=v({prefix:"changeset"}),Ms=".changesets";async function Gs(){let e=await Cr();D("\uD83D\uDE80 Create a new changeset");try{let{packages:t,packageNames:n}=await G({includePrivate:!1});if(n.length===0)throw new ee("No public packages found","NO_PUBLIC_PACKAGES");let o=n.map((r)=>({name:r,version:t[r]?.version||"0.0.0"})),i=await gr(o,e.all);if(i.changes.length===0){T("\u274C No packages selected");return}if(e.dryRun){wr(i),T("\u2728 Dry run complete - no files created");return}await $r(i),T("\u2728 Changeset created successfully!")}catch(t){throw Os.error("Failed to create changeset:",t),t}}async function gr(e,t){let n=await yr(e,t);if(n.length===0)return{changes:[],summary:""};let o=[];for(let a of n){let c=await br(a);if(c)o.push({packageName:a.name,versionType:c})}let i=await L({message:"Write a summary for this change",placeholder:"Fixed critical bug in authentication flow",validate:(a)=>{if(!a||a.trim().length===0)return"Summary is required";if(a.length>100)return"Summary should be less than 100 characters";return}});if(typeof i==="symbol")throw new ee("Changeset creation cancelled","CANCELLED");let r=await A({initialValue:!1,message:"Do you want to add a longer description?"}),s;if(r){let a=await L({message:"Write a detailed description (optional)",placeholder:"This change fixes the issue where users could not..."});if(typeof a!=="symbol"&&a.trim().length>0)s=a}return{changes:o,description:s,summary:i}}async function yr(e,t){if(t)return e;let n=e.map((i)=>({hint:i.version,label:i.name,value:i})),o=await X({message:"Which packages have changed?",options:n,required:!1});if(typeof o==="symbol")throw new ee("Package selection cancelled","CANCELLED");return o}async function br(e){let t=await Z({message:`How should ${e.name} be updated?`,options:[{hint:"Bug fixes and small changes",label:"Patch",value:"patch"},{hint:"New features, backwards compatible",label:"Minor",value:"minor"},{hint:"Breaking changes",label:"Major",value:"major"},{hint:"Don't update this package",label:"Skip",value:"skip"}]});if(typeof t==="symbol")throw new ee("Version selection cancelled","CANCELLED");return t==="skip"?null:t}function wr(e){if(console.log(`
81
+ \uD83D\uDCC4 Changeset Preview:`),console.log("\u2500".repeat(50)),console.log(`Summary: ${e.summary}`),e.description)console.log(`
82
+ Description:
83
+ ${e.description}`);console.log(`
84
+ Changes:`);for(let t of e.changes)console.log(` ${t.packageName}: ${t.versionType}`);console.log("\u2500".repeat(50))}async function $r(e){let t=await import("fs/promises"),n=await import("path");await t.mkdir(Ms,{recursive:!0});let i=`${vr()}.md`,r=n.join(Ms,i),s=xr(e);await t.writeFile(r,s,"utf-8"),Os.info(`Created changeset: ${i}`)}function vr(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}function xr(e){let t=[];t.push("---");for(let n of e.changes)t.push(`"${n.packageName}": ${n.versionType}`);if(t.push("---"),t.push(""),t.push(e.summary),e.description)t.push(""),t.push(e.description);return t.push(""),t.join(`
85
+ `)}async function Cr(){let{values:e}=hr({allowPositionals:!0,args:Bun.argv,options:{all:{default:!1,short:"a",type:"boolean"},dryRun:{default:!1,short:"d",type:"boolean"}},strict:!0});return{all:e.all,dryRun:e.dryRun}}M();E();I();B();M();I();B();import{parseArgs as Hr}from"util";var{$:F}=globalThis.Bun;E();I();B();var Ge=v({prefix:"sisyphus"}).child("changelog");async function Ts({changelogRoot:e,commit:t,dryRun:n=!1,stones:o}){let i=[""],{lastStone:{commit:r=""}}=await j(),s=Sr({stones:o});for(let[a,{bump:c,path:l,changelog:m}]of s.entries()){let u=[...m,Hs({commit:t,lastCommit:r})],g=await Bun.file(l).exists(),[w,...d]=g?(await Bun.file(l).text()).split(`
86
+ `):[`# ${a}`],y=[w,...u,...d];if(n)Ge.info(`${f.bold(f.yellow("[dry-run]"))}
87
+ ${y.join(`
88
+ `)}`);else if(!await Kt(async()=>{return Ge.info(`Writing changelog to ${l}`),await Bun.write(l,`${y.join(`
77
89
  `).trimEnd()}
78
- `),!0},{logLevel:"error",message:`Failed to write changelog to ${l}`}))continue;let[x="",,,u=""]=f;if(!i.includes(u))i.unshift(u);i.push(`### ${rn[a]} ${c}@${x.slice(7)}`)}if(n){let c=Bun.file("CHANGELOG.md"),a=await c.exists(),[l,...f]=a?(await c.text()).split(`
79
- `):["# Changelog"],p=[l,"",...i,...f,Ht({commit:t,lastCommit:e,root:!0})];if(r)xn.info(`${m.bold(m.yellow("[dry-run]"))}
90
+ `),!0},{logLevel:"error",message:`Failed to write changelog to ${l}`}))continue;let[b="",,,x=""]=m;if(!i.includes(x))i.unshift(x);i.push(`### ${ye[c]} ${a}@${b.slice(7)}`)}if(e){let a=Bun.file("CHANGELOG.md"),c=await a.exists(),[l,...m]=c?(await a.text()).split(`
91
+ `):["# Changelog"],u=[l,"",...i,...m,Hs({commit:t,lastCommit:r,root:!0})];if(n)Ge.info(`${f.bold(f.yellow("[dry-run]"))}
80
92
  Root changelog:
81
- ${p.join(`
82
- `)}`);else await vo(async()=>{xn.info(`Writing root changelog to ${c.name}`),await Bun.write(c,p.join(`
83
- `))},{logLevel:"error",message:"Failed to write root changelog"})}}function Es({stones:n}){let t=new Map;for(let{tag:r,packages:s,message:i}of n)for(let{file:e,name:o,version:c,bump:a}of s){let l=B({bump:a,tag:r,version:c}),{bump:f,path:p,changelog:d}=t.get(o)??{bump:a,changelog:[],path:e.replace("package.json","CHANGELOG.md")},[w="",,,y=""]=d,g=[w.replace("### ","")||"0.0.0",l].sort(Bun.semver.order)[1];t.set(o,{bump:f,changelog:[`### ${rn[a]} ${g}`,"",d.length>0?"__Stones:__":"__Stone:__",`_${i}${y?`, ${y.replace(/_/g,"")}_`:"_"}`],path:p})}return t}var Co="#@!";function Ht({root:n,lastCommit:t,commit:r}){let s=(()=>{try{return Bun.spawnSync(["git","remote","get-url","origin"]).stdout.toString().trim().split(":")[1]?.replaceAll(".git","")||""}catch{return""}})(),e=(()=>{try{return Bun.spawnSync(["git","log",`--pretty=format:%H${Co}%s${Co}%cn`,`${t}..${r}`]).stdout.toString()}catch{return xn.warn("Could not get git commit history"),""}})().split(`
84
- `).map((o)=>{if(o.length===0)return;let[c="",a="",l=""]=o.split(Co);return`- ${s?`[${c.slice(0,7)} ${a}](https://github.com/${s}/commit/${c})`:a} (by [@${l}](https://github.com/${l}))`}).filter(Boolean);return e.length>0?`
85
- <details><summary>${e.length} ${n?"Commits in this release":"Commits since last stone"}:</summary>
86
- ${e.join(`
93
+ ${u.join(`
94
+ `)}`);else await Kt(async()=>{Ge.info(`Writing root changelog to ${a.name}`),await Bun.write(a,u.join(`
95
+ `))},{logLevel:"error",message:"Failed to write root changelog"})}}function Sr({stones:e}){let t=new Map;for(let{tag:n,packages:o,message:i}of e)for(let{file:r,name:s,version:a,bump:c}of o){let l=z({bump:c,tag:n,version:a}),{bump:m,path:u,changelog:g}=t.get(s)??{bump:c,changelog:[],path:r.replace("package.json","CHANGELOG.md")},[w="",,,d=""]=g,y=[w.replace("### ","")||"0.0.0",l].sort(Bun.semver.order)[1];t.set(s,{bump:m,changelog:[`### ${ye[c]} ${y}`,"",g.length>0?"__Stones:__":"__Stone:__",`_${i}${d?`, ${d.replace(/_/g,"")}_`:"_"}`],path:u})}return t}var an="#@!";function Hs({root:e,lastCommit:t,commit:n}){let o=(()=>{try{return Bun.spawnSync(["git","remote","get-url","origin"]).stdout.toString().trim().split(":")[1]?.replaceAll(".git","")||""}catch{return""}})(),r=(()=>{try{return Bun.spawnSync(["git","log",`--pretty=format:%H${an}%s${an}%cn`,`${t}..${n}`]).stdout.toString()}catch{return Ge.warn("Could not get git commit history"),""}})().split(`
96
+ `).map((s)=>{if(s.length===0)return;let[a="",c="",l=""]=s.split(an);return`- ${o?`[${a.slice(0,7)} ${c}](https://github.com/${o}/commit/${a})`:c} (by [@${l}](https://github.com/${l}))`}).filter(Boolean);return r.length>0?`
97
+ <details><summary>${r.length} ${e?"Commits in this release":"Commits since last stone"}:</summary>
98
+ ${r.join(`
87
99
  `)}
88
- </details>`:""}q();_();var Os=/github\.com[:/]([^/]+)\/([^/]+)/;async function js(){if(process.env.GITHUB_REPOSITORY){let[n,t]=process.env.GITHUB_REPOSITORY.split("/");return{owner:n,repo:t}}try{let n=await Bun.file("package.json").json(),t=n.repository?.url||n.repository;if(typeof t==="string"){let r=t.replace("git+","").replace(".git","").replace("git@github.com:","https://github.com/"),[,s,i]=r.match(Os)||[];return{owner:s,repo:i}}}catch{}throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.")}async function Lt({token:n,tag:t,name:r,body:s}){let{owner:i,repo:e}=await js();if(!(i&&e))throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.");let o=`https://api.github.com/repos/${i}/${e}/releases`;try{let c=await fetch(o,{body:JSON.stringify({body:`${r}
89
-
90
- ${s||""}`,draft:!1,name:r,prerelease:t.includes("-"),tag_name:t}),headers:{Accept:"application/vnd.github.v3+json",Authorization:`Bearer ${n}`,"Content-Type":"application/json"},method:"POST"});if(!c.ok){let a=await c.text();throw new Error(`GitHub API returned ${c.status}: ${a}`)}return c.json()}catch(c){if(c instanceof Error)throw new Error(`Failed to create GitHub release: ${c.message}`);throw c}}async function qt({dryRun:n,github:t,githubToken:r,packages:s,rootTag:i,withTags:e}){if(n){$.info("Skipping git operations in dry run mode");return}if(Rs(e,s),As(i),t)await _s({githubToken:r,packages:s,rootTag:i,withTags:e})}function Rs(n,t){if(!n)return;for(let{name:r,version:s}of Object.values(t)){let i=`${r}@${s}`,{exitCode:e,stderr:o}=Bun.spawnSync(["git","tag",i,"-m",`Release ${i}`,"-f"]);if(e!==0)$.error(`Failed to create git tag ${i}: ${o?o.toString():"Unknown error"}`)}}function As(n){if(!n)return;let t=Bun.spawnSync(["git","tag",n,"-m","Release","-f"]);if(t.exitCode!==0)$.error(`Failed to create root tag ${n}: ${t.stderr?Buffer.from(t.stderr).toString():"Unknown error"}`)}async function _s({githubToken:n,packages:t,rootTag:r,withTags:s}){let i=n||process.env.GITHUB_TOKEN;if(!i)return L(m.reset(m.bold(`${m.redBright("No Github token found.")}
91
- Please provide one by using ${m.cyanBright("--githubToken")} flag or by setting ${m.green("GITHUB_TOKEN")} environment variable.`)));try{await Ms(i,s,t),await Is(i,r,t)}catch(e){return $.error(`Failed to create GitHub release:
92
- ${e instanceof Error?e.message:e}`),L(m.reset(m.bold(m.redBright("Failed to create GitHub release. Check your token and permissions."))))}}async function Ms(n,t,r){if(!t)return;for(let s of Object.values(r)){let i=`${s.name}@${s.version}`;await Lt({body:`Release of ${s.name} version ${s.version}`,name:`Release ${i}`,tag:i,token:n}),L(m.green(`\u2713 Created GitHub release for ${i}`))}}async function Is(n,t,r){if(!t)return;let s=Object.values(r).map((i)=>`- ${i.name}@${i.version}`).join(`
93
- `);await Lt({body:`Packages included:
94
- ${s}`,name:`Release ${t}`,tag:t,token:n}),L(m.green(`\u2713 Created GitHub root release ${t}`))}q();U();_();H();var{$:Gs}=globalThis.Bun;async function Pt({packages:n,dryRun:t,npmToken:r}){let s=r||process.env.NPM_CONFIG_TOKEN||process.env.NPM_TOKEN;if(!(s||t))return L(m.reset(m.bold(`${m.redBright("No NPM token found.")}
95
- Please provide one by using ${m.cyanBright("--npmToken")} flag or by setting one of ${m.green("NPM_CONFIG_TOKEN")} or ${m.green("NPM_TOKEN")} environment variables.`)));await Us({dryRun:t,packages:n,token:s})}async function Us({packages:n,dryRun:t,token:r}){let s=await Ns();for(let{name:i,version:e,tag:o,file:c}of Object.values(n)){let a=yt();a.start(`${t?m.yellow("[dry-run]: Test "):""}Publishing ${m.magenta(i)}@${m.cyanBright(e)}...`),await Hs({cwd:c.replace("package.json","")});let l=await(async()=>{try{let f=Cs({dryRun:t,otp:s,tag:o});return await jt(async()=>{let{stdout:p,exitCode:d}=Bun.spawnSync(f,{cwd:c.replace("package.json",""),env:{...process.env,NPM_CONFIG_TOKEN:r,NPM_TOKEN:r},stderr:"inherit"});if(d!==0)throw new Error(`npm publish failed with exit code ${d}`);return p},{onRetry:(p,d)=>{a.stop(),a.start(`${t?m.yellow("[dry-run]: Test "):""}Retrying publish ${m.magenta(i)}@${m.cyanBright(e)} (attempt ${p})...`)}}),`${m.green("Successfully published")} ${m.magenta(i)}@${m.cyanBright(e)}`}catch(f){return $.error(f instanceof Error?f.message:String(f)),`${m.bold(`${m.redBright("Failed")} ${m.magenta(i)}@${m.cyanBright(e)}`)}`}})();a.stop(`${t?m.yellow("[dry-run]: Test "):""}${l}`)}}async function Ns(){if(!Uo())return"";let n=await W({message:"Provide your NPM one-time password"});return Q(n)?"":n}async function Hs({cwd:n}){try{let t=await Gs`cd ${n} && bun run build`.quiet();if(t.exitCode!==0)throw new Error(`Build failed with exit code ${t.exitCode}`)}catch(t){try{if(!(await Bun.file(`${n}/package.json`).json()).scripts?.build)return}catch{}$.warn(`${t instanceof Error?t.message:String(t)}:
96
- Error during build step. If you don't have a build step, you can ignore this message.`)}}function Cs({dryRun:n,tag:t,otp:r}){return["npm","publish","--access","public"].concat(t?["--tag",t]:[]).concat(n?["--dry-run"]:[]).concat(r?["--otp",r]:[])}var sn=v({prefix:"sisyphus"}).child("roll");function qs(){let{values:n}=Ls({allowPositionals:!0,args:Bun.argv,options:{changelog:{short:"c",type:"boolean"},changelogRoot:{short:"r",type:"boolean"},dryRun:{default:!1,short:"d",type:"boolean"},github:{short:"g",type:"boolean"},githubToken:{type:"string"},npm:{short:"n",type:"boolean"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{short:"t",type:"boolean"}},strict:!0});return n}async function Jt(){let n=qs(),{dryRun:t,changelog:r,changelogRoot:s,github:i,githubToken:e,npm:o,npmToken:c,rootTag:a,withTags:l}=n,f=await j(),p=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),d=await(async()=>{try{return await Sn()}catch{return[]}})();if(d.length===0)return L(m.reset(m.bold(`${m.redBright("No stones found.")}
97
- ${m.reset(`Run ${m.green("bunx @r5n/sisyphus")}${m.yellow(" version")} and create some first.`)}`)));if(typeof r==="boolean"?r:f.changelog?.generate)await Ct({changelogRoot:typeof s==="boolean"?s:f.changelog?.root,commit:p,dryRun:t,stones:d});let w=await Ps({dryRun:t,stones:d});if(typeof o==="boolean"?o:f.release?.npm)await Pt({dryRun:t,npmToken:c,packages:w});let y=new Date().toISOString().split(".")[0]||"";if(await qt({dryRun:t,github:typeof i==="boolean"?i:f.release?.github,githubToken:e,packages:w,rootTag:a,withTags:typeof l==="boolean"?l:f.release?.tags}),await Ho({dryRun:t,lastStone:{commit:p,date:y},stones:[]}),!t)await Y`rm -rf .sisyphus/stones`.quiet();if(f.release?.commitAndPush){let g=Object.values(w).map((I)=>`${I.name}@${I.version}`).join(", "),x=f.commit?.message?f.commit.message.replace("{message}",g):`release(\uD83C\uDF89): ${g}`,{stdout:u}=await Y`git config user.name`.quiet(),{stdout:S}=await Y`git config user.email`.quiet();console.log(`git config user.name "${u.toString().trim()}"`,`git config user.email "${S.toString().trim()}"`),await Y`bun lint`.quiet(),await Y`git config user.name "Sisyphus"`,await Y`git config user.email "contact@r5n.dev"`,await Y`git commit --all -m "${x}"`,await Y`git push`,await Y`git config user.name "${u.toString().trim()}"`,await Y`git config user.email "${S.toString().trim()}"`}}async function Sn({dryRun:n,silent:t,configPath:r,testModeEnabled:s}={}){let i=s,e=await V({configPath:r,dryRun:n,silent:t}),{packages:o}=await J({single:i}),c=r||".sisyphus";if(i&&e.length===0&&r)try{let l=`${r}/stones`,p=(await Y`ls ${l} 2>/dev/null || true`.quiet()).stdout.toString().trim(),d=p?p.split(`
98
- `).filter(Boolean).map((w)=>w.replace(".md","")):[];if(d.length>0)return sn.info(`Found ${d.length} stones in test environment`),[{message:"Test stone config",name:d[0],packages:[{bump:"major",file:`${r}/workspace/packages/test-pkg/package.json`,name:"@test/pkg",version:"1.0.0"}],tag:"latest"}]}catch(l){sn.error(`Test directory read error: ${l}`)}let a=[];for(let l of e)try{let p=(await Bun.file(`${c}/stones/${l}.md`).text()).split(`
99
- `),[d]=p,w=d?.replace(/^#+\s*/,"")||"",y=p.findIndex((R)=>R.includes("|")&&R.includes(":---:"));if(y===-1){sn.error(`Failed to parse stone ${l} - could not find table format`);continue}let g=p[y-1],x=p[y+1];if(!g||!x){sn.error(`Failed to parse stone ${l} - invalid table structure`);continue}let u=g.split("|").map((R)=>R.trim()).filter(Boolean),S=x.split("|").map((R)=>R.trim()).filter(Boolean),I=[];for(let R=0;R<u.length;R++){let z=u[R],Z=S[R];if(Z){let cn=Z.split(",").map((jn)=>jn.trim());for(let jn of cn)if(o[jn])I.push({...o[jn],bump:z})}}let E=p.find((R)=>R.trim().startsWith("_")&&R.trim().endsWith("_")),A=E?E.replace(/_/g,"").trim():"";a.push({message:w.trim(),name:l,packages:I,tag:A})}catch(f){sn.error(`Error processing stone ${l}
100
- ${f instanceof Error?f.message:String(f)}`)}return a}async function Ps({stones:n,dryRun:t=!1}){let r=[],s={};for(let{tag:e,packages:o,message:c}of n){r.push(c);for(let a of o){s[a.name]||=a;let l=s[a.name]||a;if(e)l.tag=e;l.bump=tn.indexOf(a.bump)>tn.indexOf(l.bump)?a.bump:l.bump,s[a.name]=l}}let i=Object.values(s).reduce((e,o)=>{return e[o.name]={...o,version:o.tag?B({tag:o.tag,version:B({bump:o.bump,version:o.version})}):B({bump:o.bump,version:o.version})},e},{});if(t)sn.info(`${m.bold(m.yellow("[dry-run]"))}
100
+ </details>`:""}M();I();var kr=/github\.com[:/]([^/]+)\/([^/]+)/;async function Rr(){if(process.env.GITHUB_REPOSITORY){let[e,t]=process.env.GITHUB_REPOSITORY.split("/");return{owner:e,repo:t}}try{let e=await Bun.file("package.json").json(),t=e.repository?.url||e.repository;if(typeof t==="string"){let n=t.replace("git+","").replace(".git","").replace("git@github.com:","https://github.com/"),[,o,i]=n.match(kr)||[];return{owner:o,repo:i}}}catch{}throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.")}async function qs({token:e,tag:t,name:n,body:o}){let{owner:i,repo:r}=await Rr();if(!(i&&r))throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.");let s=`https://api.github.com/repos/${i}/${r}/releases`;try{let a=await fetch(s,{body:JSON.stringify({body:`${n}
101
+
102
+ ${o||""}`,draft:!1,name:n,prerelease:t.includes("-"),tag_name:t}),headers:{Accept:"application/vnd.github.v3+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json"},method:"POST"});if(!a.ok){let c=await a.text();throw new Error(`GitHub API returned ${a.status}: ${c}`)}return a.json()}catch(a){if(a instanceof Error)throw new Error(`Failed to create GitHub release: ${a.message}`);throw a}}async function Ls({dryRun:e,github:t,githubToken:n,packages:o,rootTag:i,withTags:r}){if(e){$.info("Skipping git operations in dry run mode");return}if(jr(r,o),Ir(i),t)await _r({githubToken:n,packages:o,rootTag:i,withTags:r})}function jr(e,t){if(!e)return;for(let{name:n,version:o}of Object.values(t)){let i=`${n}@${o}`;if(Bun.spawnSync(["git","tag",i,"-m",`Release ${i}`,"-f"]).exitCode!==0)$.error(`Failed to create git tag ${i}`)}}function Ir(e){if(!e)return;let t=Bun.spawnSync(["git","tag",e,"-m","Release","-f"]);if(t.exitCode!==0)$.error(`Failed to create root tag ${e}: ${t.stderr?Buffer.from(t.stderr).toString():"Unknown error"}`)}async function _r({githubToken:e,packages:t,rootTag:n,withTags:o}){let i=e||process.env.GITHUB_TOKEN;if(!i)return P(f.reset(f.bold(`${f.redBright("No Github token found.")}
103
+ Please provide one by using ${f.cyanBright("--githubToken")} flag or by setting ${f.green("GITHUB_TOKEN")} environment variable.`)));try{await Er(i,o,t),await Pr(i,n,t)}catch(r){return $.error(`Failed to create GitHub release:
104
+ ${r instanceof Error?r.message:r}`),P(f.reset(f.bold(f.redBright("Failed to create GitHub release. Check your token and permissions."))))}}async function Er(e,t,n){if(!t)return;for(let o of Object.values(n)){let i=`${o.name}@${o.version}`;await qs({body:`Release of ${o.name} version ${o.version}`,name:`Release ${i}`,tag:i,token:e}),P(f.green(`\u2713 Created GitHub release for ${i}`))}}async function Pr(e,t,n){if(!t)return;let o=Object.values(n).map((i)=>`- ${i.name}@${i.version}`).join(`
105
+ `);await qs({body:`Packages included:
106
+ ${o}`,name:`Release ${t}`,tag:t,token:e}),P(f.green(`\u2713 Created GitHub root release ${t}`))}M();E();I();B();var{$:Ar}=globalThis.Bun;async function Ns({packages:e,dryRun:t,npmToken:n}){let o=n||process.env.NPM_CONFIG_TOKEN||process.env.NPM_TOKEN;if(!(o||t))return P(f.reset(f.bold(`${f.redBright("No NPM token found.")}
107
+ Please provide one by using ${f.cyanBright("--npmToken")} flag or by setting one of ${f.green("NPM_CONFIG_TOKEN")} or ${f.green("NPM_TOKEN")} environment variables.`)));await Br({dryRun:t,packages:e,token:o})}async function Br({packages:e,dryRun:t,token:n}){let o=await Mr();for(let{name:i,version:r,tag:s,file:a}of Object.values(e)){let c=xe();c.start(`${t?f.yellow("[dry-run]: Test "):""}Publishing ${f.magenta(i)}@${f.cyanBright(r)}...`),await Or({cwd:a.replace("package.json","")});let l=await(async()=>{try{let m=Gr({dryRun:t,otp:o,tag:s});return await ns(async()=>{let{stdout:u,exitCode:g}=Bun.spawnSync(m,{cwd:a.replace("package.json",""),env:{...process.env,NPM_CONFIG_TOKEN:n,NPM_TOKEN:n},stderr:"inherit"});if(g!==0)throw new Error(`npm publish failed with exit code ${g}`);return u},{onRetry:(u,g)=>{c.stop(),c.start(`${t?f.yellow("[dry-run]: Test "):""}Retrying publish ${f.magenta(i)}@${f.cyanBright(r)} (attempt ${u})...`)}}),`${f.green("Successfully published")} ${f.magenta(i)}@${f.cyanBright(r)}`}catch(m){return $.error(m instanceof Error?m.message:String(m)),`${f.bold(`${f.redBright("Failed")} ${f.magenta(i)}@${f.cyanBright(r)}`)}`}})();c.stop(`${t?f.yellow("[dry-run]: Test "):""}${l}`)}}async function Mr(){if(!nn())return"";let e=await L({message:"Provide your NPM one-time password"});return se(e)?"":e}async function Or({cwd:e}){try{let t=await Ar`cd ${e} && bun run build`.quiet();if(t.exitCode!==0)throw new Error(`Build failed with exit code ${t.exitCode}`)}catch(t){try{if(!(await Bun.file(`${e}/package.json`).json()).scripts?.build)return}catch{}$.warn(`${t instanceof Error?t.message:String(t)}:
108
+ Error during build step. If you don't have a build step, you can ignore this message.`)}}function Gr({dryRun:e,tag:t,otp:n}){return["npm","publish","--access","public"].concat(t?["--tag",t]:[]).concat(e?["--dry-run"]:[]).concat(n?["--otp",n]:[])}var be=v({prefix:"sisyphus"}).child("roll");function Tr(){let{values:e}=Hr({allowPositionals:!0,args:Bun.argv,options:{changelog:{short:"c",type:"boolean"},changelogRoot:{short:"r",type:"boolean"},dryRun:{default:!1,short:"d",type:"boolean"},github:{short:"g",type:"boolean"},githubToken:{type:"string"},npm:{short:"n",type:"boolean"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{short:"t",type:"boolean"}},strict:!0});return e}async function Us(){let e=Tr(),{dryRun:t,changelog:n,changelogRoot:o,github:i,githubToken:r,npm:s,npmToken:a,rootTag:c,withTags:l}=e,m=await j(),u=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),g=await(async()=>{try{return await He()}catch{return[]}})();if(g.length===0)return P(f.reset(f.bold(`${f.redBright("No stones found.")}
109
+ ${f.reset(`Run ${f.green("bunx @r5n/sisyphus")}${f.yellow(" version")} and create some first.`)}`)));if(typeof n==="boolean"?n:m.changelog?.generate)await Ts({changelogRoot:typeof o==="boolean"?o:m.changelog?.root,commit:u,dryRun:t,stones:g});let w=await qr({dryRun:t,stones:g});if(typeof s==="boolean"?s:m.release?.npm)await Ns({dryRun:t,npmToken:a,packages:w});let d=new Date().toISOString().split(".")[0]||"";if(await Ls({dryRun:t,github:typeof i==="boolean"?i:m.release?.github,githubToken:r,packages:w,rootTag:c,withTags:typeof l==="boolean"?l:m.release?.tags}),await on({dryRun:t,lastStone:{commit:u,date:d},stones:[]}),!t)await F`rm -rf .sisyphus/stones`.quiet();if(m.release?.commitAndPush){let y=Object.values(w).map((U)=>`${U.name}@${U.version}`).join(", "),b=m.commit?.message?m.commit.message.replace("{message}",y):`release(\uD83C\uDF89): ${y}`,{stdout:x}=await F`git config --local user.name`.quiet(),{stdout:k}=await F`git config --local user.email`.quiet();console.log(`git config --local user.name "${x.toString().trim()}"`,`git config --local user.email "${k.toString().trim()}"`),await F`bun lint`.quiet(),await F`git config --local user.name "Sisyphus"`,await F`git config --local user.email "1390689+r5n-sisyphus@users.noreply.github.com"`,await F`git commit --all -m "${b}"`,await F`git push`,await F`git config user.name "${x.toString().trim()}"`,await F`git config user.email "${k.toString().trim()}"`}}async function He({dryRun:e,silent:t,configPath:n,testModeEnabled:o}={}){let i=o,r=await Q({configPath:n,dryRun:e,silent:t}),{packages:s}=await G({single:i}),a=n||".sisyphus";if(i&&r.length===0&&n)try{let l=`${n}/stones`,u=(await F`ls ${l} 2>/dev/null || true`.quiet()).stdout.toString().trim(),g=u?u.split(`
110
+ `).filter(Boolean).map((w)=>w.replace(".md","")):[];if(g.length>0)return be.info(`Found ${g.length} stones in test environment`),[{message:"Test stone config",name:g[0],packages:[{bump:"major",file:`${n}/workspace/packages/test-pkg/package.json`,name:"@test/pkg",version:"1.0.0"}],tag:"latest"}]}catch(l){be.error(`Test directory read error: ${l}`)}let c=[];for(let l of r)try{let u=(await Bun.file(`${a}/stones/${l}.md`).text()).split(`
111
+ `),[g]=u,w=g?.replace(/^#+\s*/,"")||"",d=u.findIndex((R)=>R.includes("|")&&R.includes(":---:"));if(d===-1){be.error(`Failed to parse stone ${l} - could not find table format`);continue}let y=u[d-1],b=u[d+1];if(!y||!b){be.error(`Failed to parse stone ${l} - invalid table structure`);continue}let x=y.split("|").map((R)=>R.trim()).filter(Boolean),k=b.split("|").map((R)=>R.trim()).filter(Boolean),U=[];for(let R=0;R<x.length;R++){let q=x[R],V=k[R];if(V){let ne=V.split(",").map((ze)=>ze.trim());for(let ze of ne)if(s[ze])U.push({...s[ze],bump:q})}}let C=u.find((R)=>R.trim().startsWith("_")&&R.trim().endsWith("_")),S=C?C.replace(/_/g,"").trim():"";c.push({message:w.trim(),name:l,packages:U,tag:S})}catch(m){be.error(`Error processing stone ${l}
112
+ ${m instanceof Error?m.message:String(m)}`)}return c}async function qr({stones:e,dryRun:t=!1}){let n=[],o={};for(let{tag:r,packages:s,message:a}of e){n.push(a);for(let c of s){o[c.name]||=c;let l=o[c.name]||c;if(r)l.tag=r;l.bump=ge.indexOf(c.bump)>ge.indexOf(l.bump)?c.bump:l.bump,o[c.name]=l}}let i=Object.values(o).reduce((r,s)=>{return r[s.name]={...s,version:s.tag?z({tag:s.tag,version:z({bump:s.bump,version:s.version})}):z({bump:s.bump,version:s.version})},r},{});if(t)be.info(`${f.bold(f.yellow("[dry-run]"))}
101
113
  Config for next release:
102
- Stones: ${r.join(", ")}
103
- ${JSON.stringify(i,null,2)}`);else{let e={};for(let[o,c]of Object.entries(i))try{let a=await Bun.file(c.file).json();e[o]={...c,version:a.version}}catch(a){sn.error(`Could not read current version for ${o}: ${a}`)}for(let{version:o,file:c}of Object.values(i)){let a=await Bun.file(c).json();a.version=o,await Bun.write(c,`${JSON.stringify(a,null,2)}
104
- `)}}return i}var Bt=v({prefix:"sisyphus"}).child("check");async function Xt(){let n=await import("util").then((d)=>d.parseArgs),{values:t}=n({allowPositionals:!0,args:Bun.argv,options:{debug:{type:"boolean"},json:{type:"boolean"}},strict:!1}),{json:r=!1,debug:s=!1}=t,i=Boolean(r);await j({dryRun:!0,silent:i});let{packages:e,packageNames:o}=await J(),{packages:c,packageNames:[a=""]}=await J({single:!0}),l=await Sn({dryRun:!0,silent:i});if(s)Bt.info("DEBUG: Stone configs:",JSON.stringify(l,null,2)),Bt.info("DEBUG: Packages:",JSON.stringify(e,null,2));if(i){let d={packages:o.map((w)=>({name:w,version:e[w]?.version})),root:{name:a,version:c[a]?.version},stones:l.map((w)=>({message:w.message,name:w.name,packages:w.packages.map((y)=>({bump:y.bump,name:y.name,newVersion:B({bump:y.bump,tag:w.tag,version:y.version}),version:y.version})),tag:w.tag}))};console.log(JSON.stringify(d,null,2));return}let f=l.length>0?`${h.bold(h.success("Stones:"))}
105
- ${l.map((d)=>`${h.arrow("\u2192")} ${h.bold("Stone:")} ${h.number(d.name)}
106
- ${h.bold("Packages:")}
107
- ${d.packages.map((w)=>` ${rn[w.bump]} ${h.value(w.name)}@${h.success(B({bump:w.bump,tag:d.tag,version:w.version}))} ${h.dim(`(${w.bump})`)}`).join(`
114
+ Stones: ${n.join(", ")}
115
+ ${JSON.stringify(i,null,2)}`);else{let r={};for(let[a,c]of Object.entries(i))try{let l=await Bun.file(c.file).json();r[a]={...c,version:l.version}}catch(l){be.error(`Could not read current version for ${a}: ${l}`)}let{updateDependencyVersions:s}=await Promise.resolve().then(() => (B(),rn));for(let{version:a,file:c,name:l}of Object.values(i)){let m=await Bun.file(c).json();m.version=a;for(let[u,g]of Object.entries(i)){if(u===l)continue;let w=await Bun.file(g.file).json(),d=!1;if(w.dependencies?.[l])w.dependencies=s(w.dependencies,{[l]:a},{preserveConstraintType:!0}),d=!0;if(w.devDependencies?.[l])w.devDependencies=s(w.devDependencies,{[l]:a},{preserveConstraintType:!0}),d=!0;if(w.peerDependencies?.[l])w.peerDependencies=s(w.peerDependencies,{[l]:a},{preserveConstraintType:!0}),d=!0;if(d)await Bun.write(g.file,`${JSON.stringify(w,null,2)}
116
+ `)}await Bun.write(c,`${JSON.stringify(m,null,2)}
117
+ `)}}return i}var Ws=v({prefix:"sisyphus"}).child("check");async function zs(){let e=await import("util").then((d)=>d.parseArgs),{values:t}=e({allowPositionals:!0,args:Bun.argv,options:{debug:{type:"boolean"},"include-private":{type:"boolean"},json:{type:"boolean"}},strict:!1}),{json:n=!1,debug:o=!1,"include-private":i=!1}=t,r=Boolean(n);await j({dryRun:!0,silent:r});let{packages:s,packageNames:a,privatePackageCount:c}=await G({includePrivate:Boolean(i)}),{packages:l,packageNames:[m=""]}=await G({single:!0}),u=await He({dryRun:!0,silent:r});if(o)Ws.info("DEBUG: Stone configs:",JSON.stringify(u,null,2)),Ws.info("DEBUG: Packages:",JSON.stringify(s,null,2));if(r){let d={packages:a.map((y)=>({name:y,version:s[y]?.version})),privatePackageCount:c,root:{name:m,version:l[m]?.version},stones:u.map((y)=>({message:y.message,name:y.name,packages:y.packages.map((b)=>({bump:b.bump,name:b.name,newVersion:z({bump:b.bump,tag:y.tag,version:b.version}),version:b.version})),tag:y.tag}))};console.log(JSON.stringify(d,null,2));return}let g=u.length>0?`${p.bold(p.success("Stones:"))}
118
+ ${u.map((d)=>`${p.arrow("\u2192")} ${p.bold("Stone:")} ${p.number(d.name)}
119
+ ${p.bold("Packages:")}
120
+ ${d.packages.map((y)=>` ${ye[y.bump]} ${p.value(y.name)}@${p.success(z({bump:y.bump,tag:d.tag,version:y.version}))} ${p.dim(`(${y.bump})`)}`).join(`
108
121
  `)}`).join(`
109
122
 
110
- `)}`:"",p=c[a]?.version?`@${c[a]?.version}`:"";if(!i)$.step(`${h.bold(h.success("Root package:"))} ${h.value(a)}${h.dim(p)}
111
- ${h.bold(h.success("Packages:"))}
112
- ${o.map((d)=>{let w=e[d]?.version?`@${e[d]?.version}`:"";return` ${h.bullet("\u2022")} ${h.value(d)}${h.dim(w)}`}).join(`
123
+ `)}`:"",w=l[m]?.version?`@${l[m]?.version}`:"";if(!r){let d=c>0&&!i?`
124
+ ${p.dim(`(${c} private package${c>1?"s":""} excluded)`)}`:"";$.step(`${p.bold(p.success("Root package:"))} ${p.value(m)}${p.dim(w)}
125
+ ${p.bold(p.success("Packages:"))}${d}
126
+ ${a.map((y)=>{let b=s[y]?.version?`@${s[y]?.version}`:"";return` ${p.bullet("\u2022")} ${p.value(y)}${p.dim(b)}`}).join(`
113
127
  `)}
114
128
 
115
- ${f}`),L(h.success("Sisyphus check complete."))}q();U();_();H();import{parseArgs as Js}from"util";var Wt=v({prefix:"sisyphus"}).child("graph");function Bs(){let{values:n}=Js({args:process.argv.slice(3),options:{depth:{short:"d",type:"string"},filter:{short:"f",type:"string"},json:{short:"j",type:"boolean"},"show-versions":{short:"v",type:"boolean"}}});return{depth:n.depth?parseInt(n.depth,10):void 0,filter:n.filter,json:n.json,showVersions:n["show-versions"]}}async function zt(){try{let n=Bs(),{packages:t}=await J(),r=Xs(t);if(n.json){let i=Array.from(r.values());console.log(JSON.stringify(i,null,2));return}let s=r;if(n.filter)s=zs(r,n.filter,n.depth);Ks(s,n.showVersions)}catch(n){Wt.error("Failed to generate dependency graph:",n),process.exit(1)}}function Xs(n){let t=new Map;for(let[r,s]of Object.entries(n))t.set(r,{dependencies:[],dependents:s.dependencyOf||[],level:0,name:r,version:s.version});for(let r of t.values())for(let s of r.dependents){let i=t.get(s);if(i)i.dependencies.push(r.name)}return Ws(t),t}function Ws(n){let t=Array.from(n.values()).filter((i)=>i.dependencies.length===0),r=new Set,s=t.map((i)=>({level:0,node:i}));while(s.length>0){let i=s.shift();if(!i)continue;let{node:e,level:o}=i;if(r.has(e.name))continue;r.add(e.name),e.level=o;for(let c of e.dependents){let a=n.get(c);if(a&&!r.has(c))s.push({level:o+1,node:a})}}}function zs(n,t,r){let s=new Map,i=Array.from(n.values()).find((c)=>c.name.includes(t));if(!i)return Wt.warn(`No packages found matching filter: ${t}`),s;let e=[{currentDepth:0,node:i}],o=new Set;while(e.length>0){let c=e.shift();if(!c)continue;let{node:a,currentDepth:l}=c;if(o.has(a.name))continue;if(r!==void 0&&l>r)continue;if(o.add(a.name),s.set(a.name,a),!r||l<r)for(let f of[...a.dependencies,...a.dependents]){let p=n.get(f);if(p&&!o.has(f))e.push({currentDepth:l+1,node:p})}}return s}function Ks(n,t){let r=Array.from(n.values()),s=Math.max(...r.map((e)=>e.level));$.info(`Package Dependency Graph (${n.size} packages)`),console.log();for(let e=0;e<=s;e++){let o=r.filter((c)=>c.level===e);if(o.length===0)continue;console.log(h.dim(`Level ${e}:`));for(let c of o){let l=t?` ${h.dim(`(${c.version})`)}`:"";if(console.log(` ${h.value(c.name)}${l}`),c.dependents.length>0){let f=c.dependents.map((p)=>{return n.get(p)?h.success(p):h.dim(p)}).join(", ");console.log(` ${h.dim("\u2192")} ${f}`)}}console.log()}let i=Ys(n);if(i.length>0){console.log(h.warning("\u26A0\uFE0F Circular dependencies detected:"));for(let e of i)console.log(` ${e.join(" \u2192 ")} \u2192 ${e[0]}`);console.log()}}function Ys(n){let t=[],r=new Set,s=new Set;function i(e,o){if(s.has(e)){let a=o.indexOf(e);if(a!==-1){let l=o.slice(a),f=[...l].sort().join(",");if(!t.some((p)=>[...p].sort().join(",")===f))t.push(l)}return}if(r.has(e))return;r.add(e),s.add(e);let c=n.get(e);if(c)for(let a of c.dependencies)i(a,[...o,a]);s.delete(e)}for(let e of n.keys())if(!r.has(e))i(e,[e]);return t}U();var zn="0.3.42";var Kt={check:`
116
- sisyphus check - Check current state and pending changes
117
-
118
- USAGE
119
- sisyphus check [options]
120
-
121
- OPTIONS
122
- -v, --verbose Show detailed information [boolean]
123
- -j, --json Output in JSON format [boolean]
124
- -d, --debug Show debug information [boolean]
125
-
126
- EXAMPLES
127
- # Show pending stones and current state
128
- sisyphus check
129
-
130
- # Show detailed change information
131
- sisyphus check --verbose
132
-
133
- # Output in JSON format
134
- sisyphus check --json
135
- `,graph:`
136
- sisyphus graph - Visualize monorepo package dependencies
137
-
138
- USAGE
139
- sisyphus graph [options]
140
-
141
- OPTIONS
142
- -j, --json Output in JSON format [boolean]
143
- -f, --filter <string> Filter to specific package [string]
144
- -d, --depth <number> Limit depth of dependency tree [number]
145
- -v, --show-versions Display package versions [boolean]
146
-
147
- EXAMPLES
148
- # Show full dependency graph
149
- sisyphus graph
150
-
151
- # Focus on specific package and its connections
152
- sisyphus graph --filter @org/core
153
-
154
- # Limit depth to direct dependencies only
155
- sisyphus graph --depth 1
156
-
157
- # Show with version numbers
158
- sisyphus graph --show-versions
159
-
160
- # Export as JSON for further processing
161
- sisyphus graph --json > dependencies.json
162
- `,init:`
163
- sisyphus init - Initialize Sisyphus in your project
129
+ ${g}`),P(p.success("Sisyphus check complete."))}}M();E();I();B();import{parseArgs as Lr}from"util";var Js=v({prefix:"sisyphus"}).child("graph");function Nr(){let{values:e}=Lr({args:process.argv.slice(3),options:{depth:{short:"d",type:"string"},filter:{short:"f",type:"string"},json:{short:"j",type:"boolean"},"show-versions":{short:"v",type:"boolean"}}});return{depth:e.depth?Number.parseInt(e.depth,10):void 0,filter:e.filter,json:e.json,showVersions:e["show-versions"]}}async function Ks(){try{let e=Nr(),{packages:t}=await G(),n=Ur(t);if(e.json){let i=Array.from(n.values());console.log(JSON.stringify(i,null,2));return}let o=n;if(e.filter)o=zr(n,e.filter,e.depth);Jr(o,e.showVersions)}catch(e){Js.error("Failed to generate dependency graph:",e),process.exit(1)}}function Ur(e){let t=new Map;for(let[n,o]of Object.entries(e))t.set(n,{dependencies:[],dependents:o.dependencyOf||[],level:0,name:n,version:o.version});for(let n of t.values())for(let o of n.dependents){let i=t.get(o);if(i)i.dependencies.push(n.name)}return Wr(t),t}function Wr(e){let t=Array.from(e.values()).filter((i)=>i.dependencies.length===0),n=new Set,o=t.map((i)=>({level:0,node:i}));while(o.length>0){let i=o.shift();if(!i)continue;let{node:r,level:s}=i;if(n.has(r.name))continue;n.add(r.name),r.level=s;for(let a of r.dependents){let c=e.get(a);if(c&&!n.has(a))o.push({level:s+1,node:c})}}}function zr(e,t,n){let o=new Map,i=Array.from(e.values()).find((a)=>a.name.includes(t));if(!i)return Js.warn(`No packages found matching filter: ${t}`),o;let r=[{currentDepth:0,node:i}],s=new Set;while(r.length>0){let a=r.shift();if(!a)continue;let{node:c,currentDepth:l}=a;if(s.has(c.name))continue;if(n!==void 0&&l>n)continue;if(s.add(c.name),o.set(c.name,c),!n||l<n)for(let m of[...c.dependencies,...c.dependents]){let u=e.get(m);if(u&&!s.has(m))r.push({currentDepth:l+1,node:u})}}return o}function Jr(e,t){let n=Array.from(e.values()),o=Math.max(...n.map((r)=>r.level));$.info(`Package Dependency Graph (${e.size} packages)`),console.log();for(let r=0;r<=o;r++){let s=n.filter((a)=>a.level===r);if(s.length===0)continue;console.log(p.dim(`Level ${r}:`));for(let a of s){let l=t?` ${p.dim(`(${a.version})`)}`:"";if(console.log(` ${p.value(a.name)}${l}`),a.dependents.length>0){let m=a.dependents.map((u)=>{return e.get(u)?p.success(u):p.dim(u)}).join(", ");console.log(` ${p.dim("\u2192")} ${m}`)}}console.log()}let i=Kr(e);if(i.length>0){console.log(p.warning("\u26A0\uFE0F Circular dependencies detected:"));for(let r of i)console.log(` ${r.join(" \u2192 ")} \u2192 ${r[0]}`);console.log()}}function Kr(e){let t=[],n=new Set,o=new Set;function i(r,s){if(o.has(r)){let c=s.indexOf(r);if(c!==-1){let l=s.slice(c),m=[...l].sort().join(",");if(!t.some((u)=>[...u].sort().join(",")===m))t.push(l)}return}if(n.has(r))return;n.add(r),o.add(r);let a=e.get(r);if(a)for(let c of a.dependencies)i(c,[...s,c]);o.delete(r)}for(let r of e.keys())if(!n.has(r))i(r,[r]);return t}E();var Zs={changeset:{description:"Create a new changeset interactively",examples:[{command:"sisyphus changeset",description:"Create changeset interactively"},{command:"sisyphus changeset --all",description:"Pre-select all packages"},{command:"sisyphus changeset --dry-run",description:"Preview without creating file"}],name:"sisyphus changeset",notes:["Changesets are stored in .changesets directory","Each changeset describes version bumps for one or more packages","Use semantic versioning: patch for fixes, minor for features, major for breaking changes"],options:[{description:"Select all packages",flags:"-a, --all",type:"boolean"},{description:"Preview without creating file",flags:"-d, --dry-run",type:"boolean"}],usage:"sisyphus changeset [options]"},check:{description:"Check current state and pending changes",examples:[{command:"sisyphus check",description:"Show pending stones and current state"},{command:"sisyphus check --verbose",description:"Show detailed change information"},{command:"sisyphus check --json",description:"Output in JSON format"},{command:"sisyphus check --include-private",description:"Include private packages"}],name:"sisyphus check",options:[{description:"Show detailed information",flags:"-v, --verbose",type:"boolean"},{description:"Output in JSON format",flags:"-j, --json",type:"boolean"},{description:"Show debug information",flags:"-d, --debug",type:"boolean"},{description:"Include private packages in the output",flags:"--include-private",type:"boolean"}],usage:"sisyphus check [options]"},graph:{description:"Visualize monorepo package dependencies",examples:[{command:"sisyphus graph",description:"Show full dependency graph"},{command:"sisyphus graph --filter @org/core",description:"Focus on specific package and its connections"},{command:"sisyphus graph --depth 1",description:"Limit depth to direct dependencies only"},{command:"sisyphus graph --show-versions",description:"Show with version numbers"},{command:"sisyphus graph --json > dependencies.json",description:"Export as JSON for further processing"}],name:"sisyphus graph",options:[{description:"Output in JSON format",flags:"-j, --json",type:"boolean"},{description:"Filter to specific package",flags:"-f, --filter",type:"string"},{description:"Limit depth of dependency tree",flags:"-d, --depth",type:"number"},{description:"Display package versions",flags:"-v, --show-versions",type:"boolean"}],usage:"sisyphus graph [options]"},init:{description:"Initialize Sisyphus in your project",examples:[{command:"sisyphus init",description:"Initialize Sisyphus interactively"},{command:"sisyphus init --force",description:"Reinitialize configuration"}],name:"sisyphus init",options:[{description:"Overwrite existing configuration",flags:"-f, --force",type:"boolean"}],usage:"sisyphus init [options]"},insights:{description:"Monorepo health analysis and insights",examples:[{command:"sisyphus insights",description:"Show overall monorepo health"},{command:"sisyphus insights --package @myorg/core",description:"Analyze specific package"},{command:"sisyphus insights --json",description:"Export insights as JSON"},{command:"sisyphus insights --include-private",description:"Include private packages in analysis"}],name:"sisyphus insights",options:[{description:"Analyze specific package",flags:"-p, --package",type:"string"},{description:"Output in JSON format",flags:"-j, --json",type:"boolean"},{description:"Include private packages in analysis",flags:"--include-private",type:"boolean"}],sections:[{content:[" - Package change frequency and staleness"," - Dependency health and circular dependencies"," - Release velocity and patterns"," - High-impact packages (many dependents)"," - Version mismatch detection"],title:"METRICS"}],usage:"sisyphus insights [options]"},metrics:{description:"View release metrics and statistics",examples:[{command:"sisyphus metrics",description:"Show metrics for last 30 days"},{command:"sisyphus metrics --days 90",description:"Show metrics for last 90 days"},{command:"sisyphus metrics --detailed",description:"Show detailed metrics"},{command:"sisyphus metrics --package @org/core",description:"Filter to specific package"},{command:"sisyphus metrics --json > metrics.json",description:"Export as JSON"}],name:"sisyphus metrics",options:[{description:"Output in JSON format",flags:"-j, --json",type:"boolean"},{description:"Number of days to analyze",flags:"-d, --days",type:"number"},{description:"Filter to specific package",flags:"-p, --package",type:"string"},{description:"Show detailed package metrics",flags:"-v, --detailed",type:"boolean"}],usage:"sisyphus metrics [options]"},migrate:{description:"Migrate from changesets, lerna, or standard-version",examples:[{command:"sisyphus migrate",description:"Auto-detect and migrate from changesets"},{command:"sisyphus migrate --clean",description:"Migrate and clean up changesets"},{command:"sisyphus migrate --dry-run",description:"Preview migration without making changes"}],name:"sisyphus migrate",notes:["Automatically detects changesets in .changeset directory","Converts YAML frontmatter to stone format","Preserves commit messages and summaries","Creates sequentially numbered stones"],options:[{description:"Source format (auto-detect if not specified)",flags:"-s, --source",type:"string"},{description:"Remove source files after migration",flags:"-c, --clean",type:"boolean"},{description:"Preview migration without changes",flags:"-d, --dry-run",type:"boolean"}],usage:"sisyphus migrate [options]"},pr:{description:"Create a stone from a pull/merge request",examples:[{command:"sisyphus pr",description:"Create stone from current branch's PR (requires gh CLI)"},{command:"sisyphus pr --url https://github.com/owner/repo/pull/123",description:"Create stone from specific GitHub PR"},{command:"sisyphus pr --url https://gitlab.com/owner/repo/-/merge_requests/123",description:"Create stone from GitLab MR"},{command:"sisyphus pr --dryRun",description:"Preview without creating stone"}],name:"sisyphus pr",notes:["Automatically detects bump type from PR labels and title","Labels: breaking-change \u2192 major, feature \u2192 minor, bug/fix \u2192 patch","Determines affected packages from changed files","Requires GitHub CLI (gh) for GitHub integration"],options:[{description:"PR/MR URL to process",flags:"-u, --url",type:"string"},{description:"Force GitHub mode",flags:"--github",type:"boolean"},{description:"Force GitLab mode",flags:"--gitlab",type:"boolean"},{description:"Preview changes without creating stone",flags:"-d, --dryRun",type:"boolean"},{description:"Skip confirmation prompt",flags:"-y, --yes",type:"boolean"}],usage:"sisyphus pr [options]"},prerelease:{description:"Manage prerelease versions (alpha, beta, rc)",examples:[{command:"sisyphus prerelease --type beta",description:"Create a new beta prerelease"},{command:"sisyphus prerelease --promote",description:"Promote prereleases (interactive UI)"},{command:'sisyphus prerelease --type alpha --filter "@org/core"',description:"Create alpha for specific packages"},{command:"sisyphus prerelease --type beta --bump minor --yes",description:"Non-interactive prerelease creation"}],name:"sisyphus prerelease",notes:["Use --promote to advance versions (alpha \u2192 beta \u2192 rc \u2192 stable)","RC and Next are treated as equivalent, both graduate to stable","You can skip tiers (e.g., alpha \u2192 rc or alpha \u2192 stable)"],options:[{description:"Prerelease type (alpha/beta/rc/etc)",flags:"-t, --type",type:"string"},{description:"Bump type (major/minor/patch)",flags:"-b, --bump",type:"string"},{description:"Promote existing prereleases",flags:"-p, --promote",type:"boolean"},{description:"Filter packages",flags:"-f, --filter",type:"string"},{description:"Preview changes",flags:"-d, --dryRun",type:"boolean"},{description:"Skip confirmation",flags:"-y, --yes",type:"boolean"}],usage:"sisyphus prerelease [options]"},preview:{description:"Preview what versions will be after rolling stones",examples:[{command:"sisyphus preview",description:"Preview release changes"},{command:"sisyphus preview --verbose",description:"Show detailed preview"},{command:"sisyphus preview --json",description:"Get preview as JSON"},{command:"sisyphus preview --include-private",description:"Include private packages in preview"}],name:"sisyphus preview",options:[{description:"Output in JSON format",flags:"-j, --json",type:"boolean"},{description:"Show additional information",flags:"-v, --verbose",type:"boolean"},{description:"Include private packages in preview",flags:"--include-private",type:"boolean"}],usage:"sisyphus preview [options]"},roll:{description:"Roll the stones and release packages",examples:[{command:"sisyphus roll",description:"Release packages with accumulated changes"},{command:"sisyphus roll --dry-run",description:"Preview release without publishing"},{command:"sisyphus roll --tag next",description:"Release with 'next' tag"}],name:"sisyphus roll",options:[{description:"Preview changes without releasing",flags:"-d, --dry-run",type:"boolean"},{description:"NPM dist-tag to use",flags:"-t, --tag",type:"string"}],usage:"sisyphus roll [options]"},solo:{description:"Single maintainer workflow (version + roll)",examples:[{command:"sisyphus solo",description:"Analyze commits and release immediately"},{command:"sisyphus solo --dry-run",description:"Preview what would be released"},{command:"sisyphus solo --tag next",description:"Release with 'next' tag"}],name:"sisyphus solo",notes:["Combines 'version --from-commits' and 'roll' in one command","Perfect for single maintainer projects","Skips stone accumulation phase","Uses conventional commits for version determination"],options:[{description:"NPM dist-tag to use",flags:"-t, --tag",type:"string"},{description:"Preview without releasing",flags:"-d, --dry-run",type:"boolean"}],usage:"sisyphus solo [options]"},stone:{description:"Manage pending stones",examples:[{command:"sisyphus stone list",description:"List all pending stones"},{command:"sisyphus stone delete stone-123",description:"Delete a specific stone"},{command:"sisyphus stone show stone-123",description:"Show stone details"},{command:"sisyphus stone merge",description:"Merge stones interactively"}],name:"sisyphus stone",notes:["Use 'sisyphus stone <command> --help' for more information about a command."],sections:[{content:[" list View all pending stones with details"," delete <id> Remove a specific stone by ID"," show <id> Display full content of a stone"," edit <id> Modify stone content or versions"," merge Combine stones with conflict resolution"],title:"COMMANDS"}],usage:"sisyphus stone <command> [options]"},version:{description:"Create a new version stone for next release",examples:[{command:"sisyphus version",description:"Create version stone interactively"},{command:"sisyphus version --from-commits",description:"Generate stones from conventional commits"},{command:"sisyphus version --dryRun",description:"Preview version changes"},{command:"sisyphus version --bump minor --filter @org/core",description:"Create with specific bump"},{command:"sisyphus version --include-private",description:"Include private packages in versioning"}],name:"sisyphus version",options:[{description:"Bump type (major/minor/patch)",flags:"-b, --bump",type:"string"},{description:"Preview changes without creating stone",flags:"-d, --dryRun",type:"boolean"},{description:"Filter packages",flags:"-f, --filter",type:"string"},{description:"Generate from conventional commits",flags:"--from-commits",type:"boolean"},{description:"Include private packages in versioning",flags:"--include-private",type:"boolean"},{description:"Create snapshot versions",flags:"-s, --snapshot",type:"boolean"},{description:"Release tag",flags:"-t, --tag",type:"string"},{description:"Skip confirmation prompt",flags:"-y, --yes",type:"boolean"}],usage:"sisyphus version [options]"}};function mt(e){if(e&&Zs[e]){console.log(nt(Zs[e]));return}let t=[{description:"Initialize Sisyphus in your project",name:"init"},{description:"Check current state and pending changes",name:"check"},{description:"Create a new changeset interactively",name:"changeset"},{description:"Visualize monorepo package dependencies",name:"graph"},{description:"Analyze monorepo health and dependencies",name:"insights"},{description:"View release metrics and statistics",name:"metrics"},{description:"Migrate from changesets/lerna/standard-version",name:"migrate"},{description:"Create stones from pull requests",name:"pr"},{description:"Manage prerelease versions (alpha, beta, rc)",name:"prerelease"},{description:"Preview what versions will be after rolling",name:"preview"},{description:"Roll the stones and release packages",name:"roll"},{description:"Single-step release (version + roll)",name:"solo"},{description:"Manage pending stones (list, delete, edit, merge)",name:"stone"},{description:"Create a new version stone for next release",name:"version"},{description:"Show this help message",name:"help"}];console.log(st(`Sisyphus@${fe} - The rock-solid versioning system`,"sisyphus <command> [options]",t,"Use sisyphus <command> --help for more information about a command."))}M();I();import{parseArgs as Vr}from"util";M();I();B();Re();async function Vs({single:e,tag:t,ignore:n}){let o=await zt({commitAndPush:()=>A({active:"Yes, commit and push the release",inactive:"Skip commit",initialValue:!1,message:"Should `roll` command commit and push the release?"}),commitConfig:()=>A({active:"Yes, configure commit",inactive:"Skip commit config",initialValue:!1,message:"Configure commit for release? Default commit message is `release(\uD83C\uDF89): <packageName@version>`"}),commitAuthor:({results:{commitConfig:i}})=>i?L({message:"Commit author",placeholder:"r5n-bot"}):void 0,commitEmail:({results:{commitConfig:i}})=>i?L({message:"Commit author email",placeholder:"r5n-bot@users.noreply.github.com"}):void 0,commitMessage:({results:{commitConfig:i}})=>i?L({message:"Commit message",placeholder:"release(\uD83C\uDF89): <packageName@version>"}):void 0,generateChangelog:()=>A({active:"Yes, Generate changelog",inactive:"Skip changelog",initialValue:!0,message:"Generate changelog for release?"}),releaseOnGitHub:()=>A({active:"Yes, create a GitHub release",inactive:"Skip GitHub release",initialValue:!1,message:"Create a release on GitHub when releasing packages?"}),releaseOnNPM:()=>A({active:"Yes, publish packages to NPM",inactive:"Skip NPM release",initialValue:!1,message:"Publish packages to NPM when releasing packages?"}),releaseTags:()=>A({active:"Yes, create tags for the release",inactive:"Skip tags",initialValue:!1,message:"Create tags for the release?"}),rootChangelog:({results:{generateChangelog:i}})=>i?A({active:"Yes, generate combined changelog",inactive:"Skip root changelog",initialValue:!0,message:"Generate combined changelog for monorepo?"}):void 0,single:()=>A({active:"Yes, setup for root package",inactive:"No, setup for monorepo workspace packages",initialValue:e,message:"Setup Sisyphus for only root package?"}),tag:()=>L({initialValue:t,message:"Tag used when versioning packages. Leave `latest` if you are not sure or want to release packages with latest tag.",placeholder:"latest"})},{onCancel:()=>je()});return{commitAndPush:!!o.commitAndPush,commitAuthor:o.commitAuthor||"",commitConfig:!!o.commitConfig,commitEmail:o.commitEmail||"",commitMessage:o.commitMessage||"",generateChangelog:o.generateChangelog,releaseOnGitHub:!!o.releaseOnGitHub,releaseOnNPM:!!o.releaseOnNPM,releaseTags:!!o.releaseTags,rootChangelog:!!o.rootChangelog,single:o.single,tag:o.tag}}async function Ys({bump:e,packages:t,packageNames:n,tag:o}){let i=Zr({packageNames:n,packages:t,tag:o}),r=`
130
+ - ${f.dim(f.italic(`Press ${f.underline(f.bold(f.whiteBright("a")))} to select/unselect all, ${f.underline(f.bold(f.whiteBright("SPACE")))} to select/unselect, ${f.underline(f.bold(f.whiteBright("ARROWS")))} to move, ${f.underline(f.bold(f.whiteBright("ENTER")))} to confirm`))}
131
+ `,s=e?[e]:["major","minor","patch"];$.info(r);let{message:a,majorPackages:c,minorPackages:l,patchPackages:m}=await zt({majorPackages:()=>s.includes("major")?i({bump:"major"}):void 0,minorPackages:({results:{majorPackages:u}})=>s.includes("minor")?i({bump:"minor",filterPackages:u||[]}):void 0,patchPackages:({results:{majorPackages:u,minorPackages:g}})=>s.includes("patch")?i({bump:"patch",filterPackages:(u||[]).concat(g||[])}):void 0,message:()=>L({message:`Name of the stone. ${f.dim(f.italic("Default prefix or message can be configured in config."))}`,placeholder:"New feature"})},{onCancel:()=>je()});return{majorPackages:c||[],message:a,minorPackages:l||[],patchPackages:m||[]}}function Zr({packageNames:e,tag:t,packages:n}){return({bump:o,filterPackages:i=[]})=>{let r=e.filter((a)=>!i?.includes(a)).map((a)=>({label:Oe({bump:o,name:a,tag:t,version:n[a]?.version||"0.0.0"}),value:a})),s={major:f.red,minor:f.yellow,patch:f.green};return r.length>0?X({initialValues:void 0,message:`Select packages for ${f.bold(s[o](o))} bump.`,options:r,required:!1}):void 0}}B();async function Xs(){let{values:{nonInteractive:e,overwrite:t,tag:n,single:o,ignore:i}}=Vr({allowPositionals:!0,args:Bun.argv,options:{ignore:{default:[],multiple:!0,short:"i",type:"string"},nonInteractive:{default:!1,short:"n",type:"boolean"},overwrite:{default:!1,short:"o",type:"boolean"},single:{default:!1,short:"s",type:"boolean"},tag:{default:"latest",short:"t",type:"string"}},strict:!0});if(e)await j({ignore:i,overwrite:t,single:o,tag:n});else{let{commitAndPush:r,commitAuthor:s,commitConfig:a,commitEmail:c,commitMessage:l,generateChangelog:m,releaseOnGitHub:u,releaseOnNPM:g,releaseTags:w,rootChangelog:d,single:y,tag:b}=await Vs({ignore:i,single:o,tag:n}),x={ignore:i,single:y,tag:b};if(a)x.commit={author:s,email:c,message:l};if(u||g||r)x.release={commitAndPush:r,github:u,npm:g,tags:w};if(m)x.changelog={generate:m,root:d};await j({overwrite:t,...x})}P(`${f.magenta(`${f.bold("Sisyphus ")}${f.underline(f.italic(`v${fe}`))}`)}${f.green(" is setup to roll stones.")}
164
132
 
165
- USAGE
166
- sisyphus init [options]
167
-
168
- OPTIONS
169
- -f, --force Overwrite existing configuration [boolean]
170
-
171
- EXAMPLES
172
- # Initialize Sisyphus interactively
173
- sisyphus init
174
-
175
- # Reinitialize configuration
176
- sisyphus init --force
177
- `,prerelease:`
178
- sisyphus prerelease - Manage prerelease versions (alpha, beta, rc)
179
-
180
- USAGE
181
- sisyphus prerelease [options]
182
-
183
- OPTIONS
184
- -t, --type <type> Prerelease type (alpha/beta/rc/etc) [string]
185
- -b, --bump <type> Bump type (major/minor/patch) [string]
186
- -p, --promote Promote existing prereleases [boolean]
187
- -f, --filter <string> Filter packages [string]
188
- -d, --dryRun Preview changes [boolean]
189
- -y, --yes Skip confirmation [boolean]
190
-
191
- EXAMPLES
192
- # Create a new beta prerelease
193
- sisyphus prerelease --type beta
194
-
195
- # Promote prereleases (interactive UI)
196
- sisyphus prerelease --promote
197
-
198
- # Create alpha for specific packages
199
- sisyphus prerelease --type alpha --filter "@org/core"
200
-
201
- # Non-interactive prerelease creation
202
- sisyphus prerelease --type beta --bump minor --yes
203
-
204
- NOTES
205
- - Use --promote to advance versions (alpha \u2192 beta \u2192 rc \u2192 stable)
206
- - RC and Next are treated as equivalent, both graduate to stable
207
- - You can skip tiers (e.g., alpha \u2192 rc or alpha \u2192 stable)
208
- `,preview:`
209
- sisyphus preview - Preview what versions will be after rolling stones
210
-
211
- USAGE
212
- sisyphus preview [options]
213
-
214
- OPTIONS
215
- -j, --json Output in JSON format [boolean]
216
- -v, --verbose Show additional information [boolean]
217
-
218
- EXAMPLES
219
- # Preview release changes
220
- sisyphus preview
221
-
222
- # Show detailed preview
223
- sisyphus preview --verbose
224
-
225
- # Get preview as JSON
226
- sisyphus preview --json
227
- `,roll:`
228
- sisyphus roll - Roll the stones and release packages
229
-
230
- USAGE
231
- sisyphus roll [options]
232
-
233
- OPTIONS
234
- -d, --dry-run Preview changes without releasing [boolean]
235
- -t, --tag NPM dist-tag to use [string]
236
-
237
- EXAMPLES
238
- # Release packages with accumulated changes
239
- sisyphus roll
240
-
241
- # Preview release without publishing
242
- sisyphus roll --dry-run
243
-
244
- # Release with 'next' tag
245
- sisyphus roll --tag next
246
- `,stone:`
247
- sisyphus stone - Manage pending stones
248
-
249
- USAGE
250
- sisyphus stone <command> [options]
251
-
252
- COMMANDS
253
- list View all pending stones with details
254
- delete <id> Remove a specific stone by ID
255
- show <id> Display full content of a stone
256
- edit <id> Modify stone content or versions
257
- merge Combine multiple stones into one
258
-
259
- EXAMPLES
260
- # List all pending stones
261
- sisyphus stone list
262
-
263
- # Delete a specific stone
264
- sisyphus stone delete stone-123
265
-
266
- # Show stone details
267
- sisyphus stone show stone-123
268
-
269
- # Merge stones interactively
270
- sisyphus stone merge
271
-
272
- Use 'sisyphus stone <command> --help' for more information about a command.
273
- `,version:`
274
- sisyphus version - Create a new version stone for next release
275
-
276
- USAGE
277
- sisyphus version [options]
278
-
279
- OPTIONS
280
- -b, --bump <type> Bump type (major/minor/patch) [string]
281
- -d, --dryRun Preview changes without creating stone[boolean]
282
- -f, --filter <string> Filter packages [string]
283
- --from-commits Generate from conventional commits [boolean]
284
- -s, --snapshot Create snapshot versions [boolean]
285
- -t, --tag <tag> Release tag [string]
286
- -y, --yes Skip confirmation prompt [boolean]
287
-
288
- EXAMPLES
289
- # Create version stone interactively
290
- sisyphus version
291
-
292
- # Generate stones from conventional commits
293
- sisyphus version --from-commits
294
-
295
- # Preview version changes
296
- sisyphus version --dryRun
297
-
298
- # Create with specific bump
299
- sisyphus version --bump minor --filter @org/core
300
- `};function Kn(n){if(n&&Kt[n]){let r=Kt[n].split(`
301
- `).map((s)=>{if(s.startsWith("sisyphus"))return h.bold(s);if(s==="USAGE"||s==="OPTIONS"||s==="EXAMPLES")return h.bold(s);if(s.startsWith(" -")){let i=s.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(i){let[,e="",o=""]=i,c=o.replace("(required)",h.error("(required)")).replace(/\(default: ([^)]+)\)/g,(a,l)=>h.dim(`(default: ${l})`)).replace(/\[boolean\]/g,h.boolean("[boolean]")).replace(/\[string\]/g,h.string("[string]")).replace(/\[number\]/g,h.number("[number]"));return` ${h.flag(e.padEnd(26))} ${c}`}}if(s.startsWith(" # "))return h.dim(s);if(s.startsWith(" sisyphus"))return` ${h.value(s.trim())}`;return s}).join(`
302
- `);console.log(r);return}console.log(`
303
- ${h.bold(`Sisyphus@${zn} - The rock-solid versioning system`)}
304
-
305
- ${h.bold("USAGE")}
306
- sisyphus <command> [options]
307
-
308
- ${h.bold("COMMANDS")}
309
- ${h.command("init")} Initialize Sisyphus in your project
310
- ${h.command("check")} Check current state and pending changes
311
- ${h.command("version")} Create a new version stone for next release
312
- ${h.command("roll")} Roll the stones and release packages
313
- ${h.command("stone")} Manage pending stones (list, delete, edit, merge)
314
- ${h.command("preview")} Preview what versions will be after rolling
315
- ${h.command("prerelease")} Manage prerelease versions (alpha, beta, rc)
316
- ${h.command("graph")} Visualize monorepo package dependencies
317
- ${h.command("help")} Show this help message
318
-
319
- Use ${h.value("sisyphus <command> --help")} for more information about a command.
320
- `)}q();_();import{parseArgs as Ts}from"util";q();_();H();gn();async function Yt({single:n,tag:t,ignore:r}){let s=await uo({commitAndPush:()=>N({active:"Yes, commit and push the release",inactive:"Skip commit",initialValue:!1,message:"Should `roll` command commit and push the release?"}),commitConfig:()=>N({active:"Yes, configure commit",inactive:"Skip commit config",initialValue:!1,message:"Configure commit for release? Default commit message is `release(\uD83C\uDF89): <packageName@version>`"}),commitAuthor:({results:{commitConfig:i}})=>i?W({message:"Commit author",placeholder:"r5n-bot"}):void 0,commitEmail:({results:{commitConfig:i}})=>i?W({message:"Commit author email",placeholder:"r5n-bot@users.noreply.github.com"}):void 0,commitMessage:({results:{commitConfig:i}})=>i?W({message:"Commit message",placeholder:"release(\uD83C\uDF89): <packageName@version>"}):void 0,generateChangelog:()=>N({active:"Yes, Generate changelog",inactive:"Skip changelog",initialValue:!0,message:"Generate changelog for release?"}),releaseOnGitHub:()=>N({active:"Yes, create a GitHub release",inactive:"Skip GitHub release",initialValue:!1,message:"Create a release on GitHub when releasing packages?"}),releaseOnNPM:()=>N({active:"Yes, publish packages to NPM",inactive:"Skip NPM release",initialValue:!1,message:"Publish packages to NPM when releasing packages?"}),releaseTags:()=>N({active:"Yes, create tags for the release",inactive:"Skip tags",initialValue:!1,message:"Create tags for the release?"}),rootChangelog:({results:{generateChangelog:i}})=>i?N({active:"Yes, generate combined changelog",inactive:"Skip root changelog",initialValue:!0,message:"Generate combined changelog for monorepo?"}):void 0,single:()=>N({active:"Yes, setup for root package",inactive:"No, setup for monorepo workspace packages",initialValue:n,message:"Setup Sisyphus for only root package?"}),tag:()=>W({initialValue:t,message:"Tag used when versioning packages. Leave `latest` if you are not sure or want to release packages with latest tag.",placeholder:"latest"})},{onCancel:()=>hn()});return{commitAndPush:!!s.commitAndPush,commitAuthor:s.commitAuthor||"",commitConfig:!!s.commitConfig,commitEmail:s.commitEmail||"",commitMessage:s.commitMessage||"",generateChangelog:s.generateChangelog,releaseOnGitHub:!!s.releaseOnGitHub,releaseOnNPM:!!s.releaseOnNPM,releaseTags:!!s.releaseTags,rootChangelog:!!s.rootChangelog,single:s.single,tag:s.tag}}async function Zt({bump:n,packages:t,packageNames:r,tag:s}){let i=Qs({packageNames:r,packages:t,tag:s}),e=`
321
- - ${m.dim(m.italic(`Press ${m.underline(m.bold(m.whiteBright("a")))} to select/unselect all, ${m.underline(m.bold(m.whiteBright("SPACE")))} to select/unselect, ${m.underline(m.bold(m.whiteBright("ARROWS")))} to move, ${m.underline(m.bold(m.whiteBright("ENTER")))} to confirm`))}
322
- `,o=n?[n]:["major","minor","patch"];$.info(e);let{message:c,majorPackages:a,minorPackages:l,patchPackages:f}=await uo({majorPackages:()=>o.includes("major")?i({bump:"major"}):void 0,minorPackages:({results:{majorPackages:p}})=>o.includes("minor")?i({bump:"minor",filterPackages:p||[]}):void 0,patchPackages:({results:{majorPackages:p,minorPackages:d}})=>o.includes("patch")?i({bump:"patch",filterPackages:(p||[]).concat(d||[])}):void 0,message:()=>W({message:`Name of the stone. ${m.dim(m.italic("Default prefix or message can be configured in config."))}`,placeholder:"New feature"})},{onCancel:()=>hn()});return{majorPackages:a||[],message:c,minorPackages:l||[],patchPackages:f||[]}}function Qs({packageNames:n,tag:t,packages:r}){return({bump:s,filterPackages:i=[]})=>{let e=n.filter((c)=>!i?.includes(c)).map((c)=>({label:un({bump:s,name:c,tag:t,version:r[c]?.version||"0.0.0"}),value:c})),o={major:m.red,minor:m.yellow,patch:m.green};return e.length>0?Cn({initialValues:void 0,message:`Select packages for ${m.bold(o[s](s))} bump.`,options:e,required:!1}):void 0}}H();async function Qt(){let{values:{nonInteractive:n,overwrite:t,tag:r,single:s,ignore:i}}=Ts({allowPositionals:!0,args:Bun.argv,options:{ignore:{default:[],multiple:!0,short:"i",type:"string"},nonInteractive:{default:!1,short:"n",type:"boolean"},overwrite:{default:!1,short:"o",type:"boolean"},single:{default:!1,short:"s",type:"boolean"},tag:{default:"latest",short:"t",type:"string"}},strict:!0});if(n)await j({ignore:i,overwrite:t,single:s,tag:r});else{let{commitAndPush:e,commitAuthor:o,commitConfig:c,commitEmail:a,commitMessage:l,generateChangelog:f,releaseOnGitHub:p,releaseOnNPM:d,releaseTags:w,rootChangelog:y,single:g,tag:x}=await Yt({ignore:i,single:s,tag:r}),u={ignore:i,single:g,tag:x};if(c)u.commit={author:o,email:a,message:l};if(p||d||e)u.release={commitAndPush:e,github:p,npm:d,tags:w};if(f)u.changelog={generate:f,root:y};await j({overwrite:t,...u})}L(`${m.magenta(`${m.bold("Sisyphus ")}${m.underline(m.italic(`v${zn}`))}`)}${m.green(" is setup to roll stones.")}
323
-
324
- You can now start by creating a new stone by running ${m.reset(m.green("bunx @r5n/sisyphus"))}${m.blue(" version")}
133
+ You can now start by creating a new stone by running ${f.reset(f.green("bunx @r5n/sisyphus"))}${f.blue(" version")}
325
134
  and following the prompts.
326
135
 
327
- After you finished, you can release it by running ${m.reset(m.green("bunx @r5n/sisyphus"))}${m.blue(" roll")}
328
- `)}q();U();_();H();gn();import{parseArgs as Ds}from"util";H();gn();import{randomUUID as Vs}from"crypto";var ks=["major","minor","patch","dependency","snapshot"];function Fs({message:n,tag:t,packages:r}){let s=r.reduce((e,o)=>{return e[o.bump]=e[o.bump]||[],e[o.bump].push(o.name),e},{}),i=ks.filter((e)=>s[e]?.length>0);return[`### ${n}`,t?`_${t}_`:"",Go,"",`| ${i.join(" | ")} |`,`| ${i.map(()=>":---:").join(" | ")} |`,`| ${i.map((e)=>s[e]?.join(", ")||"").join(" | ")} |`,""]}function en(n){let t=n.split(`
329
- `).filter((e)=>e.trim()),r={commitMessage:"",dependency:[],description:"",major:[],minor:[],patch:[],snapshot:[],tag:""},s=t.findIndex((e)=>e.includes("---"));if(t[0]?.startsWith("###"))r.commitMessage=t[0].replace(/^#+\s*/,"");if(s>1){let e=[];for(let o=1;o<s;o++){let c=t[o];if(c?.startsWith("_")&&c.endsWith("_"))r.tag=c.slice(1,-1);else if(c)e.push(c)}r.description=e.join(`
330
- `).trim()}let i=t.findIndex((e)=>e.includes("|")&&!e.includes("---"));if(i!==-1&&t[i]){let o=t[i].split("|").map((a)=>a.trim()).filter((a)=>a),c=t[i+2];if(c){let a=c.split("|").map((l)=>l.trim()).filter((l)=>l);o.forEach((l,f)=>{let p=a[f]?.split(",").map((w)=>w.trim()).filter((w)=>w)||[],d=l.toLowerCase();if(d==="major")r.major=p;else if(d==="minor")r.minor=p;else if(d==="patch")r.patch=p;else if(d==="dependency")r.dependency=p;else if(d==="snapshot")r.snapshot=p})}}return r}async function pn({majorPackages:n,message:t,minorPackages:r,packages:s,patchPackages:i,tag:e,configPath:o}){let a=`${`${(await V({configPath:o})).length+1}`.padStart(4,"0")}-${Vs().slice(0,8)}`,l=[...n,...r,...i],f=l.flatMap((y)=>s[y]?.dependencyOf||[]),d=[{packages:n,type:"major"},{packages:r,type:"minor"},{packages:i,type:"patch"},{packages:f.filter((y)=>!l.includes(y)),type:"dependency"}].flatMap(({packages:y,type:g})=>y.map((x)=>{let u=s[x];if(!u)throw new Error(`Package ${x} not found`);return{...u,bump:g,tag:e}})).filter(Boolean),w=Fs({message:t,packages:d,tag:e});return{packages:d,stoneContent:w,stoneName:a}}var ni=v({prefix:"sisyphus"}).child("prerelease"),oi=["alpha","beta","rc","canary","dev","next"];function ti(){let{values:n}=Ds({args:process.argv.slice(3),options:{bump:{short:"b",type:"string"},dryRun:{short:"d",type:"boolean"},filter:{short:"f",type:"string"},promote:{short:"p",type:"boolean"},type:{short:"t",type:"string"},yes:{short:"y",type:"boolean"}}});return n}async function Tt(){try{let n=ti(),{packages:t,packageNames:r}=await J({filter:n.filter});if(n.promote)await si(n,t,r);else await ri(n,t,r)}catch(n){ni.error("Prerelease operation failed:",n),process.exit(1)}}async function ri(n,t,r){let s=n.type||await an({message:"Select prerelease type",options:oi.map((x)=>({hint:ii(x),label:x,value:x}))});if(!s||typeof s!=="string"){$.info("Cancelled");return}let i=n.filter,e=i?r.filter((x)=>x.includes(i)):r;if(e.length===0){$.error(`No packages found matching filter: ${n.filter}`);return}let o=n.filter?e:await ei(e,t);if(o.length===0){$.info("No packages selected");return}let c;if(n.bump){let u={major:"major",minor:"minor",patch:"patch"}[n.bump.toLowerCase()];if(!u){$.error(`Invalid bump type: ${n.bump}. Must be major, minor, or patch.`);return}c=u}else{let x=await an({message:"What type of change is this prerelease for?",options:[{label:"Major - Breaking changes",value:"major"},{label:"Minor - New features",value:"minor"},{label:"Patch - Bug fixes",value:"patch"}]});if(!x){$.info("Cancelled");return}c=x}let a=`chore: prepare ${s} release`,l;if(n.yes)l=a;else{let x=await W({message:"Commit message for this prerelease",placeholder:a});if(!x||typeof x!=="string"){$.info("Cancelled");return}l=x}let f=[],p=[],d=[];for(let x of o)switch(c){case"major":f.push(x);break;case"minor":p.push(x);break;case"patch":d.push(x);break}let{stoneContent:w,stoneName:y}=await pn({majorPackages:f,message:l,minorPackages:p,packages:t,patchPackages:d,tag:s});$.step("Preview of prerelease changes:"),console.log();for(let x of o){let u=t[x],S=B({bump:c,tag:s,version:u.version});console.log(` ${h.value(x)}: ${u.version} \u2192 ${h.bold(S)}`)}if(console.log(),n.dryRun){$.info("Dry run - no changes made"),console.log(h.dim("Stone content:")),console.log(w.join(`
331
- `));return}if(!n.yes){if(!await N({initialValue:!0,message:"Create this prerelease stone?"})){$.info("Cancelled");return}}let g=await j();g.stones.push(y),await Bun.write(`.sisyphus/stones/${y}.md`,w.join(`
332
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(g,null,2)}
333
- `),$.success(`Created ${s} prerelease stone: ${h.bold(y)}`),$.info(`Run ${h.value("sisyphus roll")} to publish the prerelease`)}async function si(n,t,r){let s=r.filter((y)=>{return t[y].version.includes("-")});if(s.length===0){$.info("No packages with prerelease versions found");return}$.info(`Found ${h.bold(String(s.length))} packages with prerelease versions`),console.log();let i=new Map;for(let y of s){let x=t[y].version.match(/-(\w+)\./);if(x){let u=x[1];if(!i.has(u))i.set(u,[]);i.get(u)?.push(y)}}for(let[y,g]of i){console.log(`${h.bold(y)} packages:`);for(let x of g)console.log(` ${h.value(x)}: ${t[x].version}`);console.log()}let e=Array.from(i.keys()),o=[];if(e.includes("alpha"))o.push({label:"Promote alpha \u2192 beta",value:"alpha-to-beta"},{label:"Promote alpha \u2192 rc",value:"alpha-to-rc"},{label:"Promote alpha \u2192 stable",value:"alpha-to-stable"});if(e.includes("beta"))o.push({label:"Promote beta \u2192 rc",value:"beta-to-rc"},{label:"Promote beta \u2192 stable",value:"beta-to-stable"});if(e.includes("rc")||e.includes("next"))o.push({label:"Graduate to stable release",value:"to-stable"});o.push({label:"Increment current prerelease version",value:"increment"});let c=await an({message:"How would you like to promote these prereleases?",options:o});if(!c){$.info("Cancelled");return}let a,l=s,f;switch(c){case"alpha-to-beta":a="beta",l=i.get("alpha")||[],f="chore: promote alpha to beta";break;case"alpha-to-rc":a="rc",l=i.get("alpha")||[],f="chore: promote alpha to rc";break;case"alpha-to-stable":a=void 0,l=i.get("alpha")||[],f="chore: promote alpha to stable release";break;case"beta-to-rc":a="rc",l=i.get("beta")||[],f="chore: promote beta to rc";break;case"beta-to-stable":a=void 0,l=i.get("beta")||[],f="chore: promote beta to stable release";break;case"to-stable":a=void 0,l=[...i.get("rc")||[],...i.get("next")||[]],f="chore: graduate to stable release";break;case"increment":if(e.length>1){let y=await an({message:"Which prerelease type would you like to increment?",options:e.map((g)=>({label:g,value:g}))});if(!y){$.info("Cancelled");return}a=y,l=i.get(a)||[]}else a=e[0],l=a?i.get(a)||[]:[];f=`chore: increment ${a} version`;break;default:$.error("Unknown promotion strategy");return}if(l.length===0){$.info("No packages to promote");return}$.step("Preview of promotion:"),console.log();for(let y of l){let g=t[y].version,x;if(a===void 0)x=g.split("-")[0];else if(c==="increment")x=B({version:g,bump:"patch",tag:a});else x=`${g.split("-")[0]}-${a}.0`;console.log(` ${h.value(y)}: ${g} \u2192 ${h.bold(x)}`)}if(console.log(),!n.yes){if(!await N({message:"Continue with this promotion?",initialValue:!0})){$.info("Cancelled");return}}let{stoneContent:p,stoneName:d}=await pn({majorPackages:[],message:f,minorPackages:[],packages:t,patchPackages:l,tag:a});if(n.dryRun){$.info("Dry run - no changes made"),console.log(p.join(`
334
- `));return}let w=await j();w.stones.push(d),await Bun.write(`.sisyphus/stones/${d}.md`,p.join(`
136
+ After you finished, you can release it by running ${f.reset(f.green("bunx @r5n/sisyphus"))}${f.blue(" roll")}
137
+ `)}M();E();B();import{parseArgs as Yr}from"util";var{$:we}=globalThis.Bun;var cn=v({prefix:"sisyphus:insights"});async function Qs(){let{values:e}=Yr({args:process.argv.slice(3),options:{"include-private":{type:"boolean"},json:{short:"j",type:"boolean"},package:{short:"p",type:"string"}}}),{package:t,"include-private":n=!1}=e;D(`${p.command("sisyphus insights")} - Monorepo health report`);try{let o=await G({includePrivate:Boolean(n)}),i=Object.values(o.packages);if(t){let r=o.packages[t];if(!r)T(p.error(`Package ${t} not found`)),process.exit(1);let s=await Bun.file(r.file).json(),a={...r,packageJson:s};await Qr(a,o)}else await Xr(i,o.packages)}catch(o){cn.error("Failed to generate insights",o),T(p.error(`Failed to generate insights: ${o}`)),process.exit(1)}}async function Xr(e,t){let n=await Promise.all(e.map(async(i)=>{try{let r=await Bun.file(i.file).json();return{...i,packageJson:r}}catch(r){return cn.warn(`Failed to load package.json for ${i.name}:`,r),{...i,packageJson:{dependencies:{},devDependencies:{}}}}})),o=await Fr(n,t);if(P(`\uD83D\uDCE6 Total Packages: ${p.value(String(o.totalPackages))}
138
+ `+`\uD83D\uDD04 Circular Dependencies: ${o.circularDeps>0?p.error(String(o.circularDeps)):p.success("0")}
139
+ `+`\uD83D\uDCC8 Most Changed: ${p.value(o.mostChanged.name)} (${o.mostChanged.commits} commits)
140
+ `+`\uD83D\uDC0C Stale Packages: ${o.stalePackages.length>0?p.warning(String(o.stalePackages.length)):p.success("0")}
141
+ `+`\uD83C\uDFAF High Impact Changes: ${p.value(String(o.highImpactPackages))}
142
+ `+`\uD83D\uDE80 Release Velocity: ${p.value(o.releaseVelocity)}`,p.bold("\uD83D\uDCCA Monorepo Health Report")),o.dependencyIssues.length>0)P(o.dependencyIssues.map((i)=>`${p.dim("\u2022")} ${i}`).join(`
143
+ `),p.warning("\u26A0\uFE0F Dependency Issues"));if(o.stalePackages.length>0)P(o.stalePackages.map((i)=>`${p.dim("\u2022")} ${i.name} - ${i.daysSinceUpdate} days since last update`).join(`
144
+ `),p.warning("\uD83D\uDC0C Stale Packages"));T(p.success("Analysis complete"))}async function Qr(e,t){let n={};for(let[i,r]of Object.entries(t.packages))try{let s=await Bun.file(r.file).json();n[i]={...r,packageJson:s}}catch(s){cn.warn(`Failed to load package.json for ${i}:`,s),n[i]={...r,packageJson:{dependencies:{},devDependencies:{}}}}let o=await Dr(e,n);if(P(`Current: ${p.value(o.version)}
145
+ Path: ${p.dim(o.path)}
146
+ Dependencies: ${p.value(String(o.dependencies))}
147
+ Dependents: ${p.value(String(o.dependents))} internal${o.externalDependents?`, ${p.info(o.externalDependents)} external`:""}
148
+ Last Modified: ${p.dim(o.lastModified||"Unknown")}
149
+ Change Frequency: ${p.value(o.changeFrequency||"Low")}
150
+ Breaking Changes: ${p.value(String(o.breakingChanges))} in last year`,p.bold(`\uD83D\uDCE6 ${e.name}`)),o.dependencyTree.length>0)P(Ds(o.dependencyTree),p.info("\uD83C\uDF33 Dependency Tree"));if(o.internalDependents.length>0)P(o.internalDependents.map((i)=>`${p.dim("\u2022")} ${i}`).join(`
151
+ `),p.info("\uD83D\uDC65 Used By"));T(p.success("Analysis complete"))}async function Fr(e,t){let n=await ea(e),o=await ta(e),i=await na(),r=sa(e),s=oa(e,t);return{circularDeps:r.length,dependencyIssues:s,highImpactPackages:e.filter((a)=>a.dependencyOf?.length>5).length,mostChanged:n,releaseVelocity:i,stalePackages:o,totalPackages:e.length}}async function Dr(e,t){let n=await ia(e.file),o=await ra(e.file),i=await aa(e.name),r=Object.keys(e.packageJson?.dependencies||{}).length,s=Object.values(t).filter((c)=>c.dependencyOf?.includes(e.name)).map((c)=>c.name),a=Fs(e,t,3);return{breakingChanges:i,changeFrequency:o,dependencies:r,dependencyTree:a,dependents:s.length,externalDependents:await ca(e.name),internalDependents:s,lastModified:n,name:e.name,path:e.file,version:e.version||e.packageJson?.version||"0.0.0"}}async function ea(e){let t={commits:0,name:"None"};for(let n of e)try{let o=n.file.substring(0,n.file.lastIndexOf("/")),i=await we`cd ${o} && git rev-list --count HEAD -- .`.text(),r=Number.parseInt(i.trim(),10);if(r>t.commits)t={commits:r,name:n.name}}catch{}return t}async function ta(e,t=180){let n=[];for(let o of e)try{let i=o.file.substring(0,o.file.lastIndexOf("/")),r=await we`cd ${i} && git log -1 --format=%ct -- .`.text(),s=Number.parseInt(r.trim(),10),a=Math.floor((Date.now()/1000-s)/86400);if(a>t)n.push({daysSinceUpdate:a,name:o.name})}catch{}return n}async function na(){try{let t=(await we`git tag -l "v*" --sort=-creatordate | head -10`.text()).trim().split(`
152
+ `).filter(Boolean);if(t.length<2)return"N/A";let n=[];for(let r of t.slice(0,5)){let s=await we`git log -1 --format=%ct ${r}`.text();n.push(Number.parseInt(s.trim(),10))}let o=0;for(let r=1;r<n.length;r++){let s=n[r-1],a=n[r];if(s&&a)o+=(s-a)/86400}let i=Math.round(o/(n.length-1));if(i<7)return`${i} days (rapid)`;if(i<14)return`${i} days (fast)`;if(i<30)return`${i} days (regular)`;return`${i} days (slow)`}catch{return"N/A"}}function sa(e){return[]}function oa(e,t){let n=[],o=new Map;for(let i of e){let r={...i.packageJson?.dependencies||{},...i.packageJson?.devDependencies||{}};for(let[s,a]of Object.entries(r)){if(!o.has(s))o.set(s,new Set);o.get(s)?.add(a)}}for(let[i,r]of o)if(r.size>1)n.push(`${i} has ${r.size} different versions across packages`);return n}async function ia(e){try{let t=e.substring(0,e.lastIndexOf("/")),n=await we`cd ${t} && git log -1 --format=%ct -- .`.text();return new Date(Number.parseInt(n.trim(),10)*1000).toLocaleDateString()}catch{return"Unknown"}}async function ra(e){try{let t=e.substring(0,e.lastIndexOf("/")),n=await we`cd ${t} && git rev-list --count HEAD --since="6 months ago" -- .`.text(),o=Number.parseInt(n.trim(),10);if(o>50)return"High";if(o>20)return"Medium";if(o>5)return"Low";return"Very Low"}catch{return"Unknown"}}async function aa(e){try{let t=await we`git log --grep="BREAKING" --grep="breaking change" -i --oneline -- "*${e}*" | wc -l`.text();return Number.parseInt(t.trim(),10)}catch{return 0}}async function ca(e){return""}function Fs(e,t,n,o=0){if(o>=n)return[];let i=[],r=Object.keys(e.packageJson?.dependencies||{});for(let s of r)if(t[s])i.push({children:Fs(t[s],t,n,o+1),name:s,version:t[s].version});return i}function Ds(e,t=""){let n="";for(let o=0;o<e.length;o++){let i=o===e.length-1,r=i?"\u2514\u2500":"\u251C\u2500",s=t+(i?" ":"\u2502 ");if(n+=`${t}${r} ${e[o].name}@${e[o].version}
153
+ `,e[o].children?.length>0)n+=Ds(e[o].children,s)}return n.trimEnd()}M();E();I();B();import{parseArgs as la}from"util";var{$:pa}=globalThis.Bun;var eo=v({prefix:"sisyphus"}).child("metrics");function ma(){let{values:e}=la({args:process.argv.slice(3),options:{days:{short:"d",type:"string"},detailed:{short:"v",type:"boolean"},json:{short:"j",type:"boolean"},package:{short:"p",type:"string"}}});return{days:e.days?Number.parseInt(e.days,10):30,detailed:e.detailed,json:e.json,package:e.package}}async function to(){try{let e=ma(),{packages:t}=await G(),n=await ua(e.days||30),o=await fa(t,n,e.package);if(e.json){console.log(JSON.stringify({packageMetrics:o,releases:n},null,2));return}if(da(n,o,e),e.detailed)ha(o,e)}catch(e){eo.error("Failed to generate metrics:",e),process.exit(1)}}async function ua(e){let t=new Date;t.setDate(t.getDate()-e);try{let n=await pa`git log --tags --simplify-by-decoration --pretty="format:%ci %h %d" --since="${t.toISOString()}"`.text(),o=[],i=n.trim().split(`
154
+ `).filter(Boolean);for(let r of i){let s=r.match(/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([a-f0-9]+) \(tag: ([^)]+)\)/);if(s){let[,a="",c="",l=""]=s,m=new Date(a),u=l.match(/@[^@]+@[\d.]+(-\w+\.\d+)?/g);if(u){let g={},w=[];for(let d of u){let[y,b]=d.split("@").filter(Boolean);if(y&&b)w.push(`@${y}`),g[`@${y}`]={from:"unknown",to:b}}o.push({commitHash:c,date:m,packages:w,tag:l,versions:g})}}}return o}catch{return eo.warn("Could not fetch git history, using empty release history"),[]}}async function fa(e,t,n){let o=new Map;for(let[i]of Object.entries(e)){if(n&&!i.includes(n))continue;o.set(i,{majorReleases:0,minorReleases:0,name:i,patchReleases:0,releaseFrequency:"Never",totalReleases:0,versionHistory:[]})}for(let i of t)for(let r of i.packages){let s=o.get(r);if(!s)continue;s.totalReleases++,s.lastRelease=i.date;let a=i.versions[r];if(a?.to){s.versionHistory.push({date:i.date,version:a.to});let c=a.to.match(/(\d+)\.(\d+)\.(\d+)/);if(c){let[,,l,m]=c;if(m!=="0")s.patchReleases++;else if(l!=="0")s.minorReleases++;else s.majorReleases++}}}for(let i of o.values())if(i.totalReleases>1&&i.versionHistory.length>1){let r=i.versionHistory[i.versionHistory.length-1]?.date?.getTime()||0,s=i.versionHistory[0]?.date?.getTime()||0,a=Math.floor((s-r)/86400000),c=Math.floor(a/(i.totalReleases-1));if(c===0)i.releaseFrequency="Daily";else if(c<=7)i.releaseFrequency=`Every ${c} days`;else if(c<=30)i.releaseFrequency=`Every ${Math.floor(c/7)} weeks`;else i.releaseFrequency=`Every ${Math.floor(c/30)} months`}else if(i.totalReleases===1)i.releaseFrequency="Single release";return Array.from(o.values()).sort((i,r)=>r.totalReleases-i.totalReleases)}function da(e,t,n){let o=e.length,i=t.filter((a)=>a.totalReleases>0).length,r=t.length;if($.info(`Release Metrics - Last ${n.days} days`),console.log(),console.log(p.bold("\uD83D\uDCCA Overview")),console.log(` Total releases: ${p.value(String(o))}`),console.log(` Active packages: ${p.value(`${i}/${r}`)}`),e.length>0){let[a]=e;console.log(` Last release: ${p.dim(ln(a?.date))}`)}console.log();let s=t.filter((a)=>a.totalReleases>0).slice(0,5);if(s.length>0){console.log(p.bold("\uD83C\uDFC6 Most Active Packages"));for(let a of s){let c="\u2588".repeat(Math.min(20,a.totalReleases)),l=a.lastRelease?` (${no(a.lastRelease)})`:"";console.log(` ${p.value(a.name.padEnd(25))} ${p.dim(c)} ${a.totalReleases} releases${p.dim(l)}`)}console.log()}if(e.length>0){console.log(p.bold("\uD83D\uDCC5 Recent Releases"));let a=e.slice(0,5);for(let c of a){let l=c.packages.slice(0,3).join(", "),m=c.packages.length>3?` +${c.packages.length-3} more`:"";console.log(` ${p.dim(ln(c.date))} - ${l}${p.dim(m)}`)}console.log()}}function ha(e,t){console.log(p.bold("\uD83D\uDCE6 Package Details")),console.log();for(let n of e){if(n.totalReleases===0)continue;if(console.log(`${p.bold(n.name)}`),console.log(` Releases: ${n.totalReleases} (${n.majorReleases} major, ${n.minorReleases} minor, ${n.patchReleases} patch)`),console.log(` Frequency: ${n.releaseFrequency}`),console.log(` Last release: ${n.lastRelease?ln(n.lastRelease):"Never"}`),n.versionHistory.length>0){console.log(" Recent versions:");let o=n.versionHistory.slice(0,3);for(let{version:i,date:r}of o)console.log(` ${p.value(i)} - ${p.dim(no(r))}`)}console.log()}}function ln(e){if(!e)return"Never";return e.toLocaleDateString("en-US",{day:"numeric",hour:"2-digit",minute:"2-digit",month:"short",year:"numeric"})}function no(e){let n=new Date().getTime()-e.getTime(),o=Math.floor(n/86400000);if(o===0)return"today";if(o===1)return"yesterday";if(o<7)return`${o} days ago`;if(o<30)return`${Math.floor(o/7)} weeks ago`;if(o<365)return`${Math.floor(o/30)} months ago`;return`${Math.floor(o/365)} years ago`}M();E();B();import{randomUUID as ga}from"crypto";import{join as $e,relative as ya}from"path";var{$:pn}=globalThis.Bun;var mn=v({prefix:"sisyphus:migrate"});async function so(){let e=mn.child("run");D(`${p.command("sisyphus migrate")} - Migrate from changesets to stones`);let t=process.cwd(),n=$e(t,".changeset");if(!await Bun.file(n).exists())e.warn("No .changeset directory found"),T(p.error("No changesets found to migrate")),process.exit(1);let o=xe();o.start("Analyzing changesets...");try{let i=await ba(n);if(i.length===0){o.stop("No changesets found"),T(p.warning("No changesets to migrate"));return}o.stop(`Found ${p.value(String(i.length))} changeset(s)`);let r=[];for(let w of i){let d=await wa(w);if(d){r.push(d);let y=ya(t,w);P(`${p.dim("File:")} ${y}
155
+ ${p.dim("Packages:")} ${Object.entries(d.packages).map(([b,x])=>`${b} (${x})`).join(", ")}
156
+ ${p.dim("Summary:")} ${d.summary.slice(0,80)}${d.summary.length>80?"...":""}`,p.info("Changeset found"))}}if(r.length===0){T(p.warning("No valid changesets found to migrate"));return}if(!await A({initialValue:!0,message:`Migrate ${r.length} changeset(s) to stones?`})){T(p.dim("Migration cancelled"));return}o.start("Migrating changesets to stones...");let a=$e(t,".sisyphus"),c=$e(a,"stones");if(!await Bun.file(a).exists())await pn`mkdir -p ${c}`,await Bun.write($e(a,"config.json"),JSON.stringify({stones:[]},null,2));else if(!await Bun.file(c).exists())await pn`mkdir -p ${c}`;let m=(await Q()).length,u=[];for(let w of r){m++;let d=`${String(m).padStart(4,"0")}-${ga().slice(0,8)}`,y=$a(w),b=$e(c,`${d}.md`);await Bun.write(b,y.content),u.push(d),e.info(`Created stone: ${d}`)}if(o.stop(`Created ${p.value(String(u.length))} stone(s)`),u.length>0){let w=$e(a,"config.json"),d=await Bun.file(w).json();d.stones=[...d.stones||[],...u],await Bun.write(w,JSON.stringify(d,null,2))}if(await A({initialValue:!0,message:"Remove .changeset directory?"}))o.start("Cleaning up changesets..."),await pn`rm -rf ${n}`,o.stop("Changesets cleaned up"),e.info("Removed .changeset directory");T(p.success("Migration completed successfully!"))}catch(i){o.stop("Migration failed"),e.error("Migration failed",i),T(p.error(`Migration failed: ${i}`)),process.exit(1)}}async function ba(e){let t=[];try{let n=await Array.fromAsync(new Bun.Glob("*.md").scan(e));for(let o of n)if(o!=="README.md")t.push($e(e,o))}catch(n){mn.error("Failed to scan changeset directory",n)}return t}async function wa(e){try{let n=(await Bun.file(e).text()).split(`
157
+ `),o=!1,i=[],r=[];for(let c of n)if(c.trim()==="---")if(!o)o=!0;else o=!1;else if(o)i.push(c);else if(!o&&i.length>0)r.push(c);let s={};for(let c of i){let l=c.match(/^"(.+)":\s*(major|minor|patch)$/);if(l){if(l[1]&&l[2])s[l[1]]=l[2]}}let a=r.join(`
158
+ `).trim();if(Object.keys(s).length===0)return null;return{packages:s,summary:a}}catch(t){return mn.error(`Failed to parse changeset: ${e}`,t),null}}function $a(e){let t=[],n=[],o=[];for(let[m,u]of Object.entries(e.packages)){let g=m.startsWith("@")?m:`@${m}`;switch(u){case"major":t.push(g);break;case"minor":n.push(g);break;case"patch":o.push(g);break}}let i=e.summary.split(`
159
+ `)[0],s=`### ${i||"Migrated from changesets"}
160
+
161
+ `;if(e.summary&&e.summary!==i){let m=e.summary.split(`
162
+ `).slice(1).join(`
163
+ `).trim();if(m)s+=`${m}
164
+
165
+ `}s+=`***
166
+
167
+ `;let a=[],c=[],l=[];if(t.length>0)a.push("major"),c.push(t.join(", ")),l.push(":---:");if(n.length>0)a.push("minor"),c.push(n.join(", ")),l.push(":---:");if(o.length>0)a.push("patch"),c.push(o.join(", ")),l.push(":---:");return s+=`| ${a.join(" | ")} |
168
+ `,s+=`| ${l.join(" | ")} |
169
+ `,s+=`| ${c.join(" | ")} |
170
+ `,{content:s}}M();E();I();B();import{parseArgs as Sa}from"util";B();Re();import{randomUUID as va}from"crypto";var xa=["major","minor","patch","dependency","snapshot"];function Ca({message:e,tag:t,packages:n}){let o=n.reduce((r,s)=>{return r[s.bump]=r[s.bump]||[],r[s.bump].push(s.name),r},{}),i=xa.filter((r)=>o[r]?.length>0);return[`### ${e}`,t?`_${t}_`:"",tn,"",`| ${i.join(" | ")} |`,`| ${i.map(()=>":---:").join(" | ")} |`,`| ${i.map((r)=>o[r]?.join(", ")||"").join(" | ")} |`,""]}function ve(e){let t=e.split(`
171
+ `).filter((r)=>r.trim()),n={commitMessage:"",dependency:[],description:"",major:[],minor:[],patch:[],snapshot:[],tag:""},o=t.findIndex((r)=>r.includes("---"));if(t[0]?.startsWith("###"))n.commitMessage=t[0].replace(/^#+\s*/,"");if(o>1){let r=[];for(let s=1;s<o;s++){let a=t[s];if(a?.startsWith("_")&&a.endsWith("_"))n.tag=a.slice(1,-1);else if(a)r.push(a)}n.description=r.join(`
172
+ `).trim()}let i=t.findIndex((r)=>r.includes("|")&&!r.includes("---"));if(i!==-1&&t[i]){let s=t[i].split("|").map((c)=>c.trim()).filter((c)=>c),a=t[i+2];if(a){let c=a.split("|").map((l)=>l.trim()).filter((l)=>l);s.forEach((l,m)=>{let u=c[m]?.split(",").map((w)=>w.trim()).filter((w)=>w)||[],g=l.toLowerCase();if(g==="major")n.major=u;else if(g==="minor")n.minor=u;else if(g==="patch")n.patch=u;else if(g==="dependency")n.dependency=u;else if(g==="snapshot")n.snapshot=u})}}return n}async function le({majorPackages:e,message:t,minorPackages:n,packages:o,patchPackages:i,tag:r,configPath:s}){let c=`${`${(await Q({configPath:s})).length+1}`.padStart(4,"0")}-${va().slice(0,8)}`,l=[...e,...n,...i],m=l.flatMap((d)=>o[d]?.dependencyOf||[]),g=[{packages:e,type:"major"},{packages:n,type:"minor"},{packages:i,type:"patch"},{packages:m.filter((d)=>!l.includes(d)),type:"dependency"}].flatMap(({packages:d,type:y})=>d.map((b)=>{let x=o[b];if(!x)throw new Error(`Package ${b} not found`);return{...x,bump:y,tag:r}})).filter(Boolean),w=Ca({message:t,packages:g,tag:r});return{packages:g,stoneContent:w,stoneName:c}}var Te=v({prefix:"sisyphus"}).child("pr"),ka=/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/,Ra=/gitlab\.com\/(.+)\/-\/merge_requests\/(\d+)/,ja={"breaking-change":"major",bug:"patch",chore:"patch",documentation:"patch",enhancement:"minor",feature:"minor",fix:"patch"};function Ia(){let{values:e}=Sa({args:process.argv.slice(3),options:{dryRun:{short:"d",type:"boolean"},github:{type:"boolean"},gitlab:{type:"boolean"},url:{short:"u",type:"string"},yes:{short:"y",type:"boolean"}}});return e}async function oo(){try{let e=Ia(),{packages:t,packageNames:n}=await G(),o;if(e.url)o=await _a(e.url);else o=await Ea(e);if(!o){$.error("Could not determine PR information. Please provide a PR URL with --url");return}if($.info(`Processing PR #${o.number}: ${o.title}`),console.log(),console.log(` Author: ${p.value(o.author)}`),console.log(` Branch: ${p.value(o.branch)}`),o.labels.length>0)console.log(` Labels: ${o.labels.map((y)=>p.dim(y)).join(", ")}`);console.log();let i;for(let y of o.labels){let b=y.toLowerCase();for(let[x,k]of Object.entries(ja))if(b.includes(x)){if(i=k,k==="major")break}if(i==="major")break}if(!i){let y=o.title.toLowerCase();if(y.includes("breaking")||y.includes("!:"))i="major";else if(y.includes("feat")||y.includes("feature"))i="minor";else if(y.includes("fix")||y.includes("bug"))i="patch"}if(!i&&!e.yes){let y=await L({message:"Could not determine bump type from PR. What type of change is this? (major/minor/patch)",placeholder:"patch"});if(!y||!["major","minor","patch"].includes(y)){$.info("Invalid bump type. Cancelled.");return}i=y}else if(!i)i="patch";$.info(`Detected bump type: ${p.bold(i)}`);let r=await Ba(o.branch),s=await Ma(r,t,n);if(s.length===0){$.warn("No packages affected by this PR");return}console.log(),console.log(p.bold("Affected packages:"));for(let y of s){let b=t[y];if(!b)continue;let x=b.version,k=Oa(x,i);console.log(` ${p.value(y)}: ${x} \u2192 ${p.success(k)}`)}console.log();let a=`${o.title} (#${o.number})`,c;if(!e.yes){let y=await L({initialValue:a,message:"Commit message for this stone",placeholder:a});if(!y){$.info("Cancelled");return}c=y}else c=a;let l=i==="major"?s:[],m=i==="minor"?s:[],u=i==="patch"?s:[],{stoneContent:g,stoneName:w}=await le({majorPackages:l,message:c,minorPackages:m,packages:t,patchPackages:u,tag:void 0});if(e.dryRun){$.info("Dry run - no changes made"),console.log(p.dim("Stone content:")),console.log(g.join(`
173
+ `));return}if(!e.yes){if(!await A({initialValue:!0,message:"Create stone from this PR?"})){$.info("Cancelled");return}}let d=await j();d.stones.push(w),await Bun.write(`.sisyphus/stones/${w}.md`,g.join(`
174
+ `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(d,null,2)}
175
+ `),$.success(`Created stone from PR: ${p.bold(w)}`),$.info(`Review the stone with ${p.value(`sisyphus stone show ${w}`)}`)}catch(e){Te.error("Failed to process PR:",e),process.exit(1)}}async function _a(e){let t=e.match(ka);if(t){let[,o="",i="",r=""]=t;return await Pa(o,i,r)}let n=e.match(Ra);if(n){let[,o="",i=""]=n;return await Aa(o,i)}throw new Error("Unsupported PR URL format")}async function Ea(e){try{if((await Bun.$`git remote get-url origin`.text()).includes("github.com")||e.github)try{let n=await Bun.$`gh pr view --json number,title,body,labels,author,headRefName`.json();return{author:n.author?.login||"unknown",branch:n.headRefName,description:n.body||"",labels:n.labels?.map((o)=>o.name)||[],number:String(n.number),title:n.title}}catch{Te.debug("GitHub CLI not available or no PR found")}return null}catch(t){return Te.debug("Could not detect current PR:",t),null}}async function Pa(e,t,n){try{let o=await Bun.$`gh api repos/${e}/${t}/pulls/${n}`.json();return{author:o.user?.login||"unknown",branch:o.head.ref,description:o.body||"",labels:o.labels?.map((i)=>i.name)||[],number:String(o.number),title:o.title}}catch(o){throw new Error(`Failed to fetch GitHub PR: ${o}`)}}async function Aa(e,t){throw new Error("GitLab integration requires API token configuration")}async function Ba(e){try{let n=(await Bun.$`git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'`.text()).trim()||"main";return(e?await Bun.$`git diff --name-only ${n}...${e}`.text():await Bun.$`git diff --name-only ${n}...HEAD`.text()).trim().split(`
176
+ `).filter(Boolean)}catch(t){return Te.warn("Could not get changed files, using current uncommitted changes"),(await Bun.$`git status --porcelain`.text()).trim().split(`
177
+ `).map((o)=>o.substring(3)).filter(Boolean)}}async function Ma(e,t,n){let o=new Set,i=new Map;for(let[r,s]of Object.entries(t))if(s.relativePath)i.set(s.relativePath,r);for(let r of e)for(let[s,a]of i)if(r.startsWith(`${s}/`))o.add(a);if(o.size===0&&e.length>0){if(e.filter((s)=>!s.includes("/")||s.startsWith(".")).length>0)return Te.info("Root files changed, considering all packages affected"),n}return Array.from(o)}function Oa(e,t){let n=e.split("."),o=Number.parseInt(n[0]||"0",10),i=Number.parseInt(n[1]||"0",10),r=Number.parseInt(n[2]||"0",10);switch(t){case"major":return`${o+1}.0.0`;case"minor":return`${o}.${i+1}.0`;case"patch":return`${o}.${i}.${r+1}`;default:return e}}M();E();I();B();Re();import{parseArgs as Ga}from"util";var Ha=v({prefix:"sisyphus"}).child("prerelease"),Ta=["alpha","beta","rc","canary","dev","next"];function qa(){let{values:e}=Ga({args:process.argv.slice(3),options:{bump:{short:"b",type:"string"},dryRun:{short:"d",type:"boolean"},filter:{short:"f",type:"string"},promote:{short:"p",type:"boolean"},type:{short:"t",type:"string"},yes:{short:"y",type:"boolean"}}});return e}async function io(){try{let e=qa(),{packages:t,packageNames:n}=await G({filter:e.filter});if(e.promote)await Na(e,t,n);else await La(e,t,n)}catch(e){Ha.error("Prerelease operation failed:",e),process.exit(1)}}async function La(e,t,n){let o=e.type||await Z({message:"Select prerelease type",options:Ta.map((b)=>({hint:Ua(b),label:b,value:b}))});if(!o||typeof o!=="string"){$.info("Cancelled");return}let i=e.filter,r=i?n.filter((b)=>b.includes(i)):n;if(r.length===0){$.error(`No packages found matching filter: ${e.filter}`);return}let s=e.filter?r:await Wa(r,t);if(s.length===0){$.info("No packages selected");return}let a;if(e.bump){let x={major:"major",minor:"minor",patch:"patch"}[e.bump.toLowerCase()];if(!x){$.error(`Invalid bump type: ${e.bump}. Must be major, minor, or patch.`);return}a=x}else{let b=await Z({message:"What type of change is this prerelease for?",options:[{label:"Major - Breaking changes",value:"major"},{label:"Minor - New features",value:"minor"},{label:"Patch - Bug fixes",value:"patch"}]});if(!b){$.info("Cancelled");return}a=b}let c=`chore: prepare ${o} release`,l;if(e.yes)l=c;else{let b=await L({message:"Commit message for this prerelease",placeholder:c});if(!b||typeof b!=="string"){$.info("Cancelled");return}l=b}let m=[],u=[],g=[];for(let b of s)switch(a){case"major":m.push(b);break;case"minor":u.push(b);break;case"patch":g.push(b);break}let{stoneContent:w,stoneName:d}=await le({majorPackages:m,message:l,minorPackages:u,packages:t,patchPackages:g,tag:o});$.step("Preview of prerelease changes:"),console.log();for(let b of s){let x=t[b],k=z({bump:a,tag:o,version:x.version});console.log(` ${p.value(b)}: ${x.version} \u2192 ${p.bold(k)}`)}if(console.log(),e.dryRun){$.info("Dry run - no changes made"),console.log(p.dim("Stone content:")),console.log(w.join(`
178
+ `));return}if(!e.yes){if(!await A({initialValue:!0,message:"Create this prerelease stone?"})){$.info("Cancelled");return}}let y=await j();y.stones.push(d),await Bun.write(`.sisyphus/stones/${d}.md`,w.join(`
179
+ `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(y,null,2)}
180
+ `),$.success(`Created ${o} prerelease stone: ${p.bold(d)}`),$.info(`Run ${p.value("sisyphus roll")} to publish the prerelease`)}async function Na(e,t,n){let o=n.filter((d)=>{return t[d].version.includes("-")});if(o.length===0){$.info("No packages with prerelease versions found");return}$.info(`Found ${p.bold(String(o.length))} packages with prerelease versions`),console.log();let i=new Map;for(let d of o){let b=t[d].version.match(/-(\w+)\./);if(b){let x=b[1];if(!i.has(x))i.set(x,[]);i.get(x)?.push(d)}}for(let[d,y]of i){console.log(`${p.bold(d)} packages:`);for(let b of y)console.log(` ${p.value(b)}: ${t[b].version}`);console.log()}let r=Array.from(i.keys()),s=[];if(r.includes("alpha"))s.push({label:"Promote alpha \u2192 beta",value:"alpha-to-beta"},{label:"Promote alpha \u2192 rc",value:"alpha-to-rc"},{label:"Promote alpha \u2192 stable",value:"alpha-to-stable"});if(r.includes("beta"))s.push({label:"Promote beta \u2192 rc",value:"beta-to-rc"},{label:"Promote beta \u2192 stable",value:"beta-to-stable"});if(r.includes("rc")||r.includes("next"))s.push({label:"Graduate to stable release",value:"to-stable"});s.push({label:"Increment current prerelease version",value:"increment"});let a=await Z({message:"How would you like to promote these prereleases?",options:s});if(!a){$.info("Cancelled");return}let c,l=o,m;switch(a){case"alpha-to-beta":c="beta",l=i.get("alpha")||[],m="chore: promote alpha to beta";break;case"alpha-to-rc":c="rc",l=i.get("alpha")||[],m="chore: promote alpha to rc";break;case"alpha-to-stable":c=void 0,l=i.get("alpha")||[],m="chore: promote alpha to stable release";break;case"beta-to-rc":c="rc",l=i.get("beta")||[],m="chore: promote beta to rc";break;case"beta-to-stable":c=void 0,l=i.get("beta")||[],m="chore: promote beta to stable release";break;case"to-stable":c=void 0,l=[...i.get("rc")||[],...i.get("next")||[]],m="chore: graduate to stable release";break;case"increment":if(r.length>1){let d=await Z({message:"Which prerelease type would you like to increment?",options:r.map((y)=>({label:y,value:y}))});if(!d){$.info("Cancelled");return}c=d,l=i.get(c)||[]}else c=r[0],l=c?i.get(c)||[]:[];m=`chore: increment ${c} version`;break;default:$.error("Unknown promotion strategy");return}if(l.length===0){$.info("No packages to promote");return}$.step("Preview of promotion:"),console.log();for(let d of l){let y=t[d].version,b;if(c===void 0)b=y.split("-")[0];else if(a==="increment")b=z({bump:"patch",tag:c,version:y});else b=`${y.split("-")[0]}-${c}.0`;console.log(` ${p.value(d)}: ${y} \u2192 ${p.bold(b)}`)}if(console.log(),!e.yes){if(!await A({initialValue:!0,message:"Continue with this promotion?"})){$.info("Cancelled");return}}let{stoneContent:u,stoneName:g}=await le({majorPackages:[],message:m,minorPackages:[],packages:t,patchPackages:l,tag:c});if(e.dryRun){$.info("Dry run - no changes made"),console.log(u.join(`
181
+ `));return}let w=await j();w.stones.push(g),await Bun.write(`.sisyphus/stones/${g}.md`,u.join(`
335
182
  `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(w,null,2)}
336
- `),$.success(`Created promotion stone: ${h.bold(d)}`),$.info(`Run ${h.value("sisyphus roll")} to publish the promotion`)}function ii(n){switch(n){case"alpha":return"Early development, unstable";case"beta":return"Feature complete, testing";case"rc":return"Release candidate, final testing";case"canary":return"Latest commit builds";case"dev":return"Development builds";case"next":return"Next version preview";default:return""}}async function ei(n,t){if(await an({message:"Select packages for prerelease",options:[{label:"All packages",value:"all"},{label:"Select specific packages",value:"select"}]})==="all")return n;$.info("Select packages (space to select, enter to confirm)");let s=[];for(let i of n)if(await N({initialValue:!1,message:`Include ${i} (${t[i].version})?`}))s.push(i);return s}q();U();_();H();import{parseArgs as ci}from"util";var ai=v({prefix:"sisyphus"}).child("preview");async function Vt(){let{values:n}=ci({args:process.argv.slice(3),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:t,verbose:r}=n;try{let s=await j(),i=await Sn();if(i.length===0){if(t)console.log(JSON.stringify({message:"No pending stones found"}));else $.info("No pending stones found. Nothing to preview.");return}let{packages:e}=await J(),o={},c=[];for(let{tag:l,packages:f,message:p}of i){c.push(p);for(let d of f){if(!o[d.name])o[d.name]={...d};let w=o[d.name];if(!w)continue;if(l)w.tag=l;w.bump=tn.indexOf(d.bump)>tn.indexOf(w.bump)?d.bump:w.bump,o[d.name]=w}}let a=Object.entries(o).map(([l,f])=>{let p=e[l]?.version||"0.0.0",[d="0",w="0",y="0"]=p.split("."),g=p;switch(f.bump){case"major":g=`${Number.parseInt(d,10)+1}.0.0`;break;case"minor":g=`${d}.${Number.parseInt(w,10)+1}.0`;break;case"patch":case"dependency":g=`${d}.${w}.${Number.parseInt(y,10)+1}`;break;case"snapshot":{let x=new Date().toISOString().replace(/[.ZT:-]/g,"").slice(0,14);g=`0.0.0-${f.tag||"nightly"}-${x}`;break}}if(f.tag&&f.bump!=="snapshot")g=`${g}-${f.tag}.0`;return{bump:f.bump,currentVersion:p,name:l,newVersion:g,tag:f.tag}});if(t){console.log(JSON.stringify({messages:c,stones:i.length,updates:a},null,2));return}$.info(`Preview of release with ${h.bold(String(i.length))} stone${i.length>1?"s":""}`),console.log(),console.log(h.bold("Commit Messages:")),c.forEach((l)=>{console.log(` ${h.bullet("\u2022")} ${l}`)}),console.log(),console.log(h.bold("Version Updates:"));for(let l of a){let f=l.bump==="major"?h.error:l.bump==="minor"?h.warning:h.success;console.log(` ${h.value(l.name)}`),console.log(` ${h.dim("Current:")} ${l.currentVersion}`),console.log(` ${h.dim("New:")} ${h.bold(l.newVersion)}`),console.log(` ${h.dim("Bump:")} ${f(l.bump)}${l.tag?` (${h.value(l.tag)})`:""}`),console.log()}if(r)console.log(h.bold("Additional Information:")),console.log(` ${h.dim("Config path:")} ${s.configPath||".sisyphus"}`),console.log(` ${h.dim("Total packages:")} ${Object.keys(e).length}`),console.log(` ${h.dim("Packages to update:")} ${a.length}`)}catch(s){ai.error("Failed to preview release:",s),process.exit(1)}}U();_();q();U();_();H();import{existsSync as li}from"fs";import{unlink as fi}from"fs/promises";import{join as mi}from"path";import{parseArgs as hi}from"util";var vn=v({prefix:"sisyphus"}).child("stone:delete");async function kt(n){if(!n)vn.error("Stone ID is required"),vn.error("Usage: sisyphus stone delete <id>"),process.exit(1);let{values:t}=hi({args:process.argv.slice(5),options:{force:{short:"f",type:"boolean"}}}),{force:r}=t;try{let i=(await j()).stonesPath||".sisyphus/stones",e=mi(i,`${n}.md`);if(!li(e))vn.error(`Stone '${n}' not found`),vn.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);if(!r){if(!await N({initialValue:!1,message:`Delete stone '${n}'?`})){$.info("Deletion cancelled");return}}await fi(e),$.success(`Stone '${h.bold(n)}' deleted`)}catch(s){vn.error(`Failed to delete stone '${n}':`,s),process.exit(1)}}q();U();_();H();import{existsSync as pi}from"fs";import{readFile as bi,writeFile as di}from"fs/promises";import{join as yi}from"path";import{parseArgs as wi}from"util";var bn=v({prefix:"sisyphus"}).child("stone:edit");async function Ft(n){if(!n)bn.error("Stone ID is required"),bn.error("Usage: sisyphus stone edit <id>"),process.exit(1);let{values:t}=wi({args:process.argv.slice(5),options:{interactive:{short:"i",type:"boolean"},message:{short:"m",type:"string"}}}),{message:r,interactive:s}=t;try{let e=(await j()).stonesPath||".sisyphus/stones",o=yi(e,`${n}.md`);if(!pi(o))bn.error(`Stone '${n}' not found`),bn.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let c=await bi(o,"utf-8");if(r){let a=c.split(`
337
- `);a[0]=`### ${r}`,await di(o,a.join(`
338
- `)),$.success(`Updated commit message for stone '${h.bold(n)}'`);return}if(s){$.info("Interactive stone editing coming soon"),$.info("For now, you can manually edit:"),$.info(h.dim(o));return}bn.error("Please specify --message or --interactive"),process.exit(1)}catch(i){bn.error(`Failed to edit stone '${n}':`,i),process.exit(1)}}U();var Dt={delete:`
339
- sisyphus stone delete - Remove a specific stone before rolling
340
-
341
- USAGE
342
- sisyphus stone delete <id> [options]
343
-
344
- OPTIONS
345
- -f, --force Skip confirmation prompt [boolean]
346
-
347
- EXAMPLES
348
- # Delete a stone by ID
349
- sisyphus stone delete stone-123
350
-
351
- # Delete without confirmation
352
- sisyphus stone delete stone-123 --force
353
- `,edit:`
354
- sisyphus stone edit - Modify stone content or version bumps
355
-
356
- USAGE
357
- sisyphus stone edit <id> [options]
358
-
359
- OPTIONS
360
- -m, --message New commit message [string]
361
- -i, --interactive Edit in interactive mode [boolean]
362
-
363
- EXAMPLES
364
- # Edit stone interactively
365
- sisyphus stone edit stone-123 --interactive
366
-
367
- # Update commit message
368
- sisyphus stone edit stone-123 --message "feat: better description"
369
- `,list:`
370
- sisyphus stone list - View all pending stones with details
371
-
372
- USAGE
373
- sisyphus stone list [options]
374
-
375
- OPTIONS
376
- -j, --json Output in JSON format [boolean]
377
- -v, --verbose Show full stone content [boolean]
378
-
379
- EXAMPLES
380
- # List all pending stones
381
- sisyphus stone list
382
-
383
- # Show full stone content
384
- sisyphus stone list --verbose
385
-
386
- # Output as JSON for scripting
387
- sisyphus stone list --json
388
- `,merge:`
389
- sisyphus stone merge - Combine multiple stones into one
390
-
391
- USAGE
392
- sisyphus stone merge [options]
393
-
394
- OPTIONS
395
- -i, --ids Stone IDs to merge (multiple) [string]
396
- -m, --message Commit message for merged stone [string]
397
- -f, --force Skip confirmation [boolean]
398
-
399
- EXAMPLES
400
- # Merge stones interactively
401
- sisyphus stone merge
402
-
403
- # Merge specific stones
404
- sisyphus stone merge --ids stone-123 stone-456
405
-
406
- # Merge with custom message
407
- sisyphus stone merge --ids stone-123 stone-456 --message "feat: combined changes"
408
- `,show:`
409
- sisyphus stone show - Display full content of a specific stone
410
-
411
- USAGE
412
- sisyphus stone show <id> [options]
413
-
414
- OPTIONS
415
- -j, --json Output in JSON format [boolean]
416
-
417
- EXAMPLES
418
- # Show stone content
419
- sisyphus stone show stone-123
420
-
421
- # Output as JSON
422
- sisyphus stone show stone-123 --json
423
- `};function Yn(n){if(n&&Dt[n]){let r=Dt[n].split(`
424
- `).map((s)=>{if(s.startsWith("sisyphus"))return h.bold(s);if(s==="USAGE"||s==="OPTIONS"||s==="EXAMPLES")return h.bold(s);if(s.startsWith(" -")){let i=s.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(i){let[,e="",o=""]=i,c=o.replace("(required)",h.error("(required)")).replace(/\(default: ([^)]+)\)/g,(a,l)=>h.dim(`(default: ${l})`)).replace(/\[boolean\]/g,h.boolean("[boolean]")).replace(/\[string\]/g,h.string("[string]")).replace(/\[number\]/g,h.number("[number]"));return` ${h.flag(e.padEnd(26))} ${c}`}}if(s.startsWith(" # "))return h.dim(s);if(s.startsWith(" sisyphus"))return` ${h.value(s.trim())}`;return s}).join(`
425
- `);console.log(r);return}console.log(`
426
- ${h.bold("Sisyphus Stone Management")}
427
-
428
- ${h.bold("USAGE")}
429
- sisyphus stone <command> [options]
430
-
431
- ${h.bold("COMMANDS")}
432
- ${h.command("list")} View all pending stones with details
433
- ${h.command("delete")} Remove a specific stone by ID
434
- ${h.command("show")} Display full content of a stone
435
- ${h.command("edit")} Modify stone content or versions
436
- ${h.command("merge")} Combine multiple stones into one
437
- ${h.command("help")} Show this help message
183
+ `),$.success(`Created promotion stone: ${p.bold(g)}`),$.info(`Run ${p.value("sisyphus roll")} to publish the promotion`)}function Ua(e){switch(e){case"alpha":return"Early development, unstable";case"beta":return"Feature complete, testing";case"rc":return"Release candidate, final testing";case"canary":return"Latest commit builds";case"dev":return"Development builds";case"next":return"Next version preview";default:return""}}async function Wa(e,t){if(await Z({message:"Select packages for prerelease",options:[{label:"All packages",value:"all"},{label:"Select specific packages",value:"select"}]})==="all")return e;$.info("Select packages (space to select, enter to confirm)");let o=[];for(let i of e)if(await A({initialValue:!1,message:`Include ${i} (${t[i].version})?`}))o.push(i);return o}M();E();I();B();import{parseArgs as za}from"util";var Ja=v({prefix:"sisyphus"}).child("preview");async function ro(){let{values:e}=za({args:process.argv.slice(3),options:{"include-private":{type:"boolean"},json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:t,verbose:n,"include-private":o=!1}=e;try{let i=await j(),r=await He();if(r.length===0){if(t)console.log(JSON.stringify({message:"No pending stones found"}));else $.info("No pending stones found. Nothing to preview.");return}let{packages:s}=await G({includePrivate:Boolean(o)}),a={},c=[];for(let{tag:m,packages:u,message:g}of r){c.push(g);for(let w of u){if(!a[w.name])a[w.name]={...w};let d=a[w.name];if(!d)continue;if(m)d.tag=m;d.bump=ge.indexOf(w.bump)>ge.indexOf(d.bump)?w.bump:d.bump,a[w.name]=d}}let l=Object.entries(a).map(([m,u])=>{let g=s[m]?.version||"0.0.0",[w="0",d="0",y="0"]=g.split("."),b=g;switch(u.bump){case"major":b=`${Number.parseInt(w,10)+1}.0.0`;break;case"minor":b=`${w}.${Number.parseInt(d,10)+1}.0`;break;case"patch":case"dependency":b=`${w}.${d}.${Number.parseInt(y,10)+1}`;break;case"snapshot":{let x=new Date().toISOString().replace(/[.ZT:-]/g,"").slice(0,14);b=`0.0.0-${u.tag||"nightly"}-${x}`;break}}if(u.tag&&u.bump!=="snapshot")b=`${b}-${u.tag}.0`;return{bump:u.bump,currentVersion:g,name:m,newVersion:b,tag:u.tag}});if(t){console.log(JSON.stringify({messages:c,stones:r.length,updates:l},null,2));return}$.info(`Preview of release with ${p.bold(String(r.length))} stone${r.length>1?"s":""}`),console.log(),console.log(p.bold("Commit Messages:")),c.forEach((m)=>{console.log(` ${p.bullet("\u2022")} ${m}`)}),console.log(),console.log(p.bold("Version Updates:"));for(let m of l){let u=m.bump==="major"?p.error:m.bump==="minor"?p.warning:p.success;console.log(` ${p.value(m.name)}`),console.log(` ${p.dim("Current:")} ${m.currentVersion}`),console.log(` ${p.dim("New:")} ${p.bold(m.newVersion)}`),console.log(` ${p.dim("Bump:")} ${u(m.bump)}${m.tag?` (${p.value(m.tag)})`:""}`),console.log()}if(n)console.log(p.bold("Additional Information:")),console.log(` ${p.dim("Config path:")} ${i.configPath||".sisyphus"}`),console.log(` ${p.dim("Total packages:")} ${Object.keys(s).length}`),console.log(` ${p.dim("Packages to update:")} ${l.length}`)}catch(i){Ja.error("Failed to preview release:",i),process.exit(1)}}M();E();I();I();var{$:un}=globalThis.Bun;var qe=v({prefix:"git-hooks"});class ao{hooksDir=".git/hooks";async installHooks(e){try{if(await un`mkdir -p ${this.hooksDir}`.quiet(),e.enableCommitMsg)await this.createCommitMsgHook(e);if(e.enablePreCommit)await this.createPreCommitHook(e);if(e.enablePrePush)await this.createPrePushHook(e);if(e.enablePostCommit)await this.createPostCommitHook(e);qe.info("Git hooks installed successfully")}catch(t){throw qe.error("Failed to install git hooks:",t),t}}async createCommitMsgHook(e){let t=`#!/usr/bin/env bun
184
+
185
+ import { readFileSync } from "fs";
186
+ import { exit } from "process";
187
+
188
+ const COMMIT_MSG_FILE = process.argv[2];
189
+ const commitMessage = readFileSync(COMMIT_MSG_FILE, "utf8").trim();
190
+
191
+ const config = ${JSON.stringify(e,null,2)};
192
+
193
+ function parseCommitMessage(message) {
194
+ const pattern = /^(\\w+)(\\(.+\\))?!?: (.+)$/;
195
+ const match = message.match(pattern);
196
+
197
+ if (!match) {
198
+ return null;
199
+ }
200
+
201
+ const [, type, scopeMatch, subject] = match;
202
+ const scope = scopeMatch ? scopeMatch.slice(1, -1) : undefined;
203
+ const isBreaking = message.includes("!:") || message.includes("BREAKING CHANGE:");
204
+
205
+ const lines = message.split("\\n");
206
+ const body = lines.slice(1).join("\\n").trim() || undefined;
207
+
208
+ return {
209
+ type,
210
+ scope,
211
+ subject,
212
+ body,
213
+ isBreaking
214
+ };
215
+ }
216
+
217
+ function validateCommitMessage(message, config) {
218
+ const errors = [];
219
+
220
+ // Skip merge commits and revert commits
221
+ if (message.startsWith("Merge ") || message.startsWith("Revert ")) {
222
+ return { valid: true, errors: [] };
223
+ }
224
+
225
+ const parsed = parseCommitMessage(message);
226
+
227
+ if (!parsed) {
228
+ errors.push(\`Commit message does not match pattern: \${config.commitMsgPattern}\`);
229
+ return { valid: false, errors };
230
+ }
231
+
232
+ // Validate type
233
+ if (!config.commitTypes.includes(parsed.type)) {
234
+ errors.push(\`Invalid commit type "\${parsed.type}". Allowed: \${config.commitTypes.join(", ")}\`);
235
+ }
236
+
237
+ // Validate scope
238
+ if (config.requireScope && !parsed.scope) {
239
+ errors.push("Commit scope is required");
240
+ }
241
+
242
+ if (config.allowedScopes && parsed.scope && !config.allowedScopes.includes(parsed.scope)) {
243
+ errors.push(\`Invalid scope "\${parsed.scope}". Allowed: \${config.allowedScopes.join(", ")}\`);
244
+ }
245
+
246
+ // Validate subject length
247
+ if (parsed.subject.length > config.maxSubjectLength) {
248
+ errors.push(\`Subject line too long (\${parsed.subject.length} > \${config.maxSubjectLength})\`);
249
+ }
250
+
251
+ // Validate body
252
+ if (config.requireBody && !parsed.body) {
253
+ errors.push("Commit body is required");
254
+ }
255
+
256
+ // Validate breaking changes
257
+ if (config.requireBreakingChange && parsed.type === "feat" && !parsed.isBreaking) {
258
+ errors.push("Breaking change notation required for new features");
259
+ }
260
+
261
+ return { valid: errors.length === 0, errors };
262
+ }
263
+
264
+ const validation = validateCommitMessage(commitMessage, config);
265
+
266
+ if (!validation.valid) {
267
+ console.error("\u274C Commit message validation failed:");
268
+ for (const error of validation.errors) {
269
+ console.error(\` - \${error}\`);
270
+ }
271
+ console.error("");
272
+ console.error("Example valid commit:");
273
+ console.error(" feat(scope): add new feature");
274
+ console.error(" feat(scope)!: add breaking change");
275
+ console.error("");
276
+ exit(1);
277
+ }
278
+
279
+ console.log("\u2705 Commit message is valid");
280
+ exit(0);
281
+ `;await this.writeHook("commit-msg",t)}async createPreCommitHook(e){await this.writeHook("pre-commit",`#!/usr/bin/env bun
282
+
283
+ import { spawn } from "bun";
284
+ import { exit } from "process";
285
+
286
+ console.log("\uD83D\uDD0D Running pre-commit checks...");
287
+
288
+ async function runCommand(cmd, args = []) {
289
+ const proc = spawn(cmd, args);
290
+ const result = await proc.exited;
291
+
292
+ if (result !== 0) {
293
+ console.error(\`\u274C Command failed: \${cmd} \${args.join(" ")}\`);
294
+ return false;
295
+ }
296
+
297
+ return true;
298
+ }
299
+
300
+ async function runPreCommitChecks() {
301
+ const checks = [
302
+ { name: "Linting", cmd: "bun", args: ["lint"] },
303
+ { name: "Type checking", cmd: "bun", args: ["type-check"] },
304
+ { name: "Testing", cmd: "bun", args: ["test"] }
305
+ ];
306
+
307
+ for (const check of checks) {
308
+ console.log(\`Running \${check.name}...\`);
309
+
310
+ const success = await runCommand(check.cmd, check.args);
311
+
312
+ if (!success) {
313
+ console.error(\`\u274C \${check.name} failed\`);
314
+ exit(1);
315
+ }
316
+
317
+ console.log(\`\u2705 \${check.name} passed\`);
318
+ }
319
+ }
320
+
321
+ await runPreCommitChecks();
322
+ console.log("\u2705 All pre-commit checks passed");
323
+ exit(0);
324
+ `)}async createPrePushHook(e){await this.writeHook("pre-push",`#!/usr/bin/env bun
325
+
326
+ import { spawn } from "bun";
327
+ import { exit } from "process";
328
+
329
+ console.log("\uD83D\uDE80 Running pre-push checks...");
330
+
331
+ async function runCommand(cmd, args = []) {
332
+ const proc = spawn(cmd, args);
333
+ const result = await proc.exited;
334
+
335
+ if (result !== 0) {
336
+ console.error(\`\u274C Command failed: \${cmd} \${args.join(" ")}\`);
337
+ return false;
338
+ }
339
+
340
+ return true;
341
+ }
342
+
343
+ async function runPrePushChecks() {
344
+ console.log("Checking workspace health...");
345
+
346
+ const success = await runCommand("sisyphus", ["insights", "workspace-health"]);
347
+
348
+ if (!success) {
349
+ console.error("\u274C Workspace health check failed");
350
+ exit(1);
351
+ }
352
+
353
+ console.log("\u2705 Workspace health check passed");
354
+ }
355
+
356
+ await runPrePushChecks();
357
+ console.log("\u2705 All pre-push checks passed");
358
+ exit(0);
359
+ `)}async createPostCommitHook(e){await this.writeHook("post-commit",`#!/usr/bin/env bun
360
+
361
+ import { readFileSync } from "fs";
362
+ import { spawn } from "bun";
363
+
364
+ console.log("\uD83D\uDCDD Running post-commit actions...");
365
+
366
+ async function runCommand(cmd, args = []) {
367
+ const proc = spawn(cmd, args);
368
+ await proc.exited;
369
+ }
370
+
371
+ async function runPostCommitActions() {
372
+ // Check if this commit might affect version dependencies
373
+ try {
374
+ await runCommand("sisyphus", ["insights", "dependency-impact", "--since=HEAD~1"]);
375
+ } catch (error) {
376
+ console.log("Could not analyze dependency impact");
377
+ }
378
+
379
+ // Update any workspace caches
380
+ try {
381
+ await runCommand("bun", ["install", "--frozen-lockfile"]);
382
+ } catch (error) {
383
+ console.log("Could not update lockfile");
384
+ }
385
+ }
386
+
387
+ await runPostCommitActions();
388
+ console.log("\u2705 Post-commit actions completed");
389
+ `)}async writeHook(e,t){let n=`${this.hooksDir}/${e}`;await Bun.write(n,t),await un`chmod +x ${n}`.quiet(),qe.info(`Created ${e} hook`)}async uninstallHooks(){let e=["commit-msg","pre-commit","pre-push","post-commit"];for(let t of e){let n=`${this.hooksDir}/${t}`;try{await un`rm -f ${n}`.quiet(),qe.info(`Removed ${t} hook`)}catch(o){qe.warn(`Could not remove ${t} hook: ${o}`)}}}parseCommitMessage(e){let t=/^(\w+)(\(.+\))?!?: (.+)$/,n=e.match(t);if(!n)return null;let[,o,i,r]=n,s=i?i.slice(1,-1):void 0,a=e.includes("!:")||e.includes("BREAKING CHANGE:"),l=e.split(`
390
+ `).slice(1).join(`
391
+ `).trim()||void 0,m=l?.match(/BREAKING CHANGE: (.+)/),u=m?m[1]:void 0;return{body:l,footer:u,isBreaking:a,scope:s||"",subject:r||"",type:o||""}}validateCommitMessage(e,t){let n=[];if(e.startsWith("Merge ")||e.startsWith("Revert "))return{errors:[],valid:!0};let o=this.parseCommitMessage(e);if(!o)return n.push(`Commit message does not match pattern: ${t.commitMsgPattern}`),{errors:n,valid:!1};if(!t.commitTypes.includes(o.type))n.push(`Invalid commit type "${o.type}". Allowed: ${t.commitTypes.join(", ")}`);if(t.requireScope&&!o.scope)n.push("Commit scope is required");if(t.allowedScopes&&o.scope&&!t.allowedScopes.includes(o.scope))n.push(`Invalid scope "${o.scope}". Allowed: ${t.allowedScopes.join(", ")}`);if(o.subject.length>t.maxSubjectLength)n.push(`Subject line too long (${o.subject.length} > ${t.maxSubjectLength})`);if(t.requireBody&&!o.body)n.push("Commit body is required");if(t.requireBreakingChange&&o.type==="feat"&&!o.isBreaking)n.push("Breaking change notation required for new features");return{errors:n,valid:n.length===0}}getDefaultConfig(){return{allowedScopes:["core","hydra","sisyphus","tools","docs","deps"],commitMsgPattern:"type(scope): subject",commitTypes:["feat","fix","docs","style","refactor","test","chore","perf","ci","build","revert"],enableCommitMsg:!0,enablePostCommit:!1,enablePreCommit:!0,enablePrePush:!0,maxSubjectLength:72,requireBody:!1,requireBreakingChange:!1,requireScope:!1}}}var co=new ao;I();var ut=v({prefix:"gitlab-ci"});class lo{async generateBasicCI(e){return`# GitLab CI/CD Configuration for ${e.name}
392
+
393
+ image: ${e.image}
394
+
395
+ variables:
396
+ NODE_VERSION: "${e.nodeVersion}"
397
+ NPM_CONFIG_CACHE: ".npm"
398
+ BILD_CACHE: ".bun"
399
+
400
+ stages:
401
+ ${e.stages.map((t)=>` - ${t}`).join(`
402
+ `)}
403
+
404
+ cache:
405
+ key: \${CI_COMMIT_REF_SLUG}
406
+ paths:
407
+ - .npm/
408
+ - .bun/
409
+ - node_modules/
410
+
411
+ before_script:
412
+ - curl -fsSL https://bun.sh/install | bash
413
+ - export PATH="$HOME/.bun/bin:$PATH"
414
+ - bun --version
415
+ - ${e.installCommand}
416
+
417
+ # Install dependencies
418
+ install:
419
+ stage: install
420
+ script:
421
+ - ${e.installCommand}
422
+ artifacts:
423
+ paths:
424
+ - node_modules/
425
+ expire_in: 1 hour
426
+ only:
427
+ - branches
428
+ - tags
429
+
430
+ # Lint and type check
431
+ lint:
432
+ stage: lint
433
+ script:
434
+ - bun lint
435
+ - bun type-check
436
+ dependencies:
437
+ - install
438
+ only:
439
+ - branches
440
+ - tags
441
+
442
+ ${e.buildCommand?`# Build packages
443
+ build:
444
+ stage: build
445
+ script:
446
+ - ${e.buildCommand}
447
+ artifacts:
448
+ paths:
449
+ - dist/
450
+ - build/
451
+ expire_in: 1 hour
452
+ dependencies:
453
+ - install
454
+ only:
455
+ - branches
456
+ - tags`:""}
457
+
458
+ ${e.testCommand?`# Run tests
459
+ test:
460
+ stage: test
461
+ script:
462
+ - ${e.testCommand}
463
+ dependencies:
464
+ - install
465
+ ${e.buildCommand?"- build":""}
466
+ coverage: '/Lines\\s*:\\s*(\\d+\\.?\\d*)%/'
467
+ artifacts:
468
+ reports:
469
+ coverage_report:
470
+ coverage_format: cobertura
471
+ path: coverage/cobertura-coverage.xml
472
+ only:
473
+ - branches
474
+ - tags`:""}
475
+
476
+ # Version analysis
477
+ version-check:
478
+ stage: version
479
+ script:
480
+ - sisyphus graph --since=last-stone --format=json > version-changes.json
481
+ - sisyphus insights dependency-impact > dependency-impact.md
482
+ artifacts:
483
+ paths:
484
+ - version-changes.json
485
+ - dependency-impact.md
486
+ expire_in: 1 week
487
+ dependencies:
488
+ - install
489
+ only:
490
+ - main
491
+ - master
492
+
493
+ # Release packages
494
+ release:
495
+ stage: release
496
+ script:
497
+ - |
498
+ if sisyphus graph --since=last-stone --dry-run | grep -q "No changes"; then
499
+ echo "No changes detected, skipping release"
500
+ exit 0
501
+ fi
502
+ - sisyphus stone create --message="Automated release from GitLab CI" --auto-bump
503
+ ${e.publishCommand?`- ${e.publishCommand}`:""}
504
+ dependencies:
505
+ - install
506
+ ${e.buildCommand?"- build":""}
507
+ ${e.testCommand?"- test":""}
508
+ only:
509
+ - main
510
+ - master
511
+ when: ${e.publishCondition||"on_success"}
512
+ environment:
513
+ name: production
514
+ url: \${CI_PROJECT_URL}`}async generateMonorepoCI(e){return`# GitLab CI/CD Configuration for Monorepo
515
+
516
+ image: ${e.image}
517
+
518
+ variables:
519
+ NODE_VERSION: "${e.nodeVersion}"
520
+ NPM_CONFIG_CACHE: ".npm"
521
+ BUN_CACHE: ".bun"
522
+
523
+ stages:
524
+ - install
525
+ - lint
526
+ - test
527
+ - build
528
+ - version
529
+ - release
530
+
531
+ cache:
532
+ key: \${CI_COMMIT_REF_SLUG}-\${CI_PROJECT_PATH}
533
+ paths:
534
+ - .npm/
535
+ - .bun/
536
+ - node_modules/
537
+ - packages/*/node_modules/
538
+
539
+ before_script:
540
+ - curl -fsSL https://bun.sh/install | bash
541
+ - export PATH="$HOME/.bun/bin:$PATH"
542
+ - bun --version
543
+
544
+ # Install all dependencies
545
+ install:
546
+ stage: install
547
+ script:
548
+ - ${e.installCommand}
549
+ artifacts:
550
+ paths:
551
+ - node_modules/
552
+ - packages/*/node_modules/
553
+ expire_in: 2 hours
554
+ only:
555
+ - branches
556
+ - tags
557
+
558
+ # Lint all packages
559
+ lint:
560
+ stage: lint
561
+ script:
562
+ - bun lint
563
+ - bun type-check
564
+ dependencies:
565
+ - install
566
+ only:
567
+ - branches
568
+ - tags
569
+
570
+ # Test all packages
571
+ test:
572
+ stage: test
573
+ parallel:
574
+ matrix:
575
+ - PACKAGE: ["core", "hydra", "sisyphus"]
576
+ script:
577
+ - cd packages/\${PACKAGE}
578
+ - ${e.testCommand||"bun test"}
579
+ dependencies:
580
+ - install
581
+ coverage: '/Lines\\s*:\\s*(\\d+\\.?\\d*)%/'
582
+ artifacts:
583
+ reports:
584
+ coverage_report:
585
+ coverage_format: cobertura
586
+ path: packages/\${PACKAGE}/coverage/cobertura-coverage.xml
587
+ only:
588
+ - branches
589
+ - tags
590
+
591
+ # Build all packages
592
+ build:
593
+ stage: build
594
+ script:
595
+ - ${e.buildCommand||"bun build"}
596
+ artifacts:
597
+ paths:
598
+ - packages/*/dist/
599
+ - packages/*/build/
600
+ expire_in: 1 hour
601
+ dependencies:
602
+ - install
603
+ only:
604
+ - branches
605
+ - tags
606
+
607
+ # Analyze changes and dependencies
608
+ version-analysis:
609
+ stage: version
610
+ script:
611
+ - sisyphus graph --since=last-stone --format=json > version-changes.json
612
+ - sisyphus insights dependency-impact > dependency-impact.md
613
+ - sisyphus insights workspace-health > workspace-health.md
614
+ artifacts:
615
+ paths:
616
+ - version-changes.json
617
+ - dependency-impact.md
618
+ - workspace-health.md
619
+ expire_in: 1 week
620
+ dependencies:
621
+ - install
622
+ only:
623
+ - main
624
+ - master
625
+
626
+ # Release changed packages
627
+ release:
628
+ stage: release
629
+ script:
630
+ - |
631
+ if sisyphus graph --since=last-stone --dry-run | grep -q "No changes"; then
632
+ echo "No changes detected, skipping release"
633
+ exit 0
634
+ fi
635
+ - |
636
+ echo "Creating automated release stone..."
637
+ sisyphus stone create \\
638
+ --message="Automated release from GitLab CI (\${CI_COMMIT_SHORT_SHA})" \\
639
+ --auto-bump
640
+ ${e.publishCommand?`- ${e.publishCommand}`:""}
641
+ dependencies:
642
+ - install
643
+ - build
644
+ - test
645
+ only:
646
+ - main
647
+ - master
648
+ when: ${e.publishCondition||"on_success"}
649
+ environment:
650
+ name: production
651
+ url: \${CI_PROJECT_URL}`}async generateManualReleaseCI(){return`# Manual Release Pipeline
652
+
653
+ manual-release:
654
+ stage: release
655
+ script:
656
+ - echo "Starting manual release process..."
657
+ - |
658
+ if [ -n "\${VERSION_TYPE}" ]; then
659
+ sisyphus stone create \\
660
+ --message="\${RELEASE_MESSAGE:-Manual release}" \\
661
+ --bump="\${VERSION_TYPE}" \\
662
+ --auto-bump
663
+ else
664
+ sisyphus stone create \\
665
+ --message="\${RELEASE_MESSAGE:-Manual release}" \\
666
+ --interactive
667
+ fi
668
+ - sisyphus stone publish
669
+ dependencies:
670
+ - install
671
+ - build
672
+ - test
673
+ when: manual
674
+ allow_failure: false
675
+ environment:
676
+ name: production
677
+ url: \${CI_PROJECT_URL}
678
+ variables:
679
+ VERSION_TYPE: ""
680
+ RELEASE_MESSAGE: ""
681
+ only:
682
+ - main
683
+ - master`}async generateScheduledCI(){return`# Scheduled maintenance pipeline
684
+
685
+ dependency-update:
686
+ stage: maintenance
687
+ script:
688
+ - echo "Checking for dependency updates..."
689
+ - bun update
690
+ - |
691
+ if git diff --quiet package.json bun.lock; then
692
+ echo "No dependency updates available"
693
+ exit 0
694
+ fi
695
+ - git config --global user.name "GitLab CI"
696
+ - git config --global user.email "ci@gitlab.com"
697
+ - git add package.json bun.lock
698
+ - git commit -m "chore: update dependencies"
699
+ - sisyphus insights dependency-impact > dependency-impact.md
700
+ - |
701
+ echo "Dependency changes detected. Creating MR..."
702
+ # Would typically create MR via GitLab API
703
+ dependencies:
704
+ - install
705
+ only:
706
+ schedules:
707
+ - weekly
708
+ when: always
709
+ allow_failure: true
710
+
711
+ health-check:
712
+ stage: maintenance
713
+ script:
714
+ - sisyphus insights workspace-health
715
+ - sisyphus graph --validate
716
+ dependencies:
717
+ - install
718
+ only:
719
+ schedules:
720
+ - daily
721
+ when: always
722
+ allow_failure: true`}async createGitLabCI(e,t){let n=`${e}/.gitlab-ci.yml`;try{let o=await this.generateMonorepoCI(t);await Bun.write(n,o),ut.info("Created GitLab CI configuration: .gitlab-ci.yml");let i=await this.generateManualReleaseCI();await Bun.write(`${e}/.gitlab/ci/manual-release.yml`,i),ut.info("Created manual release CI: .gitlab/ci/manual-release.yml");let r=await this.generateScheduledCI();await Bun.write(`${e}/.gitlab/ci/scheduled.yml`,r),ut.info("Created scheduled CI: .gitlab/ci/scheduled.yml")}catch(o){throw ut.error("Failed to create GitLab CI files:",o),o}}getDefaultConfig(){return{buildCommand:"bun build",image:"oven/bun:latest",installCommand:"bun install",name:"Monorepo CI/CD",nodeVersion:"20",publishCommand:"sisyphus stone publish",publishCondition:"on_success",stages:["install","lint","test","build","version","release"],testCommand:"bun test"}}}var po=new lo;I();var{$:Ka}=globalThis.Bun;var Le=v({prefix:"workflow-templates"});class mo{async generateCIWorkflow(e){let t=e.nodeVersions.map((n)=>`'${n}'`).join(", ");return`name: ${e.name}
723
+
724
+ on:
725
+ ${e.triggers.map((n)=>` ${n}:`).join(`
726
+ `)}
438
727
 
439
- Use ${h.value("sisyphus stone <command> --help")} for more information about a command.
440
- `)}q();U();_();H();import{readFile as $i}from"fs/promises";import{join as gi}from"path";import{parseArgs as ui}from"util";var nr=v({prefix:"sisyphus"}).child("stone:list");async function or(){let{values:n}=ui({args:process.argv.slice(4),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:t,verbose:r}=n;try{let i=(await j()).stonesPath||".sisyphus/stones",e=await V();if(e.length===0){if(t)console.log(JSON.stringify([]));else $.info("No pending stones found");return}let o=[];for(let c of e){let a=gi(i,`${c}.md`);try{let l=await $i(a,"utf-8"),f=en(l);o.push({id:c,path:a,...f})}catch(l){nr.warn(`Failed to read stone ${c}:`,l)}}if(t){console.log(JSON.stringify(o,null,2));return}$.info(`Found ${h.bold(String(o.length))} pending stone${o.length>1?"s":""}`),console.log();for(let[c,a]of o.entries()){if(console.log(`${h.bullet("\u2022")} ${h.bold(a.id)}`),console.log(` ${h.dim("Message:")} ${a.commitMessage}`),a.tag)console.log(` ${h.dim("Tag:")} ${h.value(a.tag)}`);if(a.major.length>0)console.log(` ${h.error("Major:")} ${a.major.join(", ")}`);if(a.minor.length>0)console.log(` ${h.warning("Minor:")} ${a.minor.join(", ")}`);if(a.patch.length>0)console.log(` ${h.success("Patch:")} ${a.patch.join(", ")}`);if(r&&a.description)console.log(` ${h.dim("Description:")}`),a.description.split(`
441
- `).forEach((l)=>{console.log(` ${h.dim(l)}`)});if(c<o.length-1)console.log()}}catch(s){nr.error("Failed to list stones:",s),process.exit(1)}}q();U();_();H();import{readFile as tr,unlink as rr,writeFile as xi}from"fs/promises";import{join as Lo}from"path";import{parseArgs as Si}from"util";var sr=v({prefix:"sisyphus"}).child("stone:merge");async function ir(n){let{values:t}=Si({allowPositionals:!0,args:process.argv.slice(4),options:{force:{short:"f",type:"boolean"},ids:{multiple:!0,short:"i",type:"string"},message:{short:"m",type:"string"}}}),{ids:r,message:s,force:i}=t;try{let o=(await j()).stonesPath||".sisyphus/stones",c=await V();if(c.length<2){$.info("Need at least 2 stones to merge");return}let a=[];if(r&&r.length>=2){for(let u of r)if(c.includes(u)){let S=Lo(o,`${u}.md`),I=await tr(S,"utf-8"),E=en(I);a.push({id:u,path:S,...E})}if(a.length<2)sr.error("Could not find all specified stones"),process.exit(1)}else{let u=[];for(let I of c){let E=Lo(o,`${I}.md`),A=await tr(E,"utf-8"),R=en(A);u.push({label:`${I} - ${R.commitMessage}`,value:{id:I,path:E,...R}})}let S=await Cn({message:"Select stones to merge",options:u,required:!0});if(!S||Array.isArray(S)&&S.length<2){$.info("Need to select at least 2 stones");return}a=S}let l=s||await W({message:"Commit message for merged stone",placeholder:"feat: combined changes"});if(!l||typeof l!=="string"){$.info("Merge cancelled");return}let f={major:[],minor:[],patch:[]},p=[];for(let u of a)if(f.major.push(...u.major),f.minor.push(...u.minor),f.patch.push(...u.patch),u.description)p.push(u.description);f.major=[...new Set(f.major)],f.minor=[...new Set(f.minor)],f.patch=[...new Set(f.patch)];let w=`merged-${Date.now()}`,y=Lo(o,`${w}.md`),g=`### ${l}
442
- `;if(p.length>0)g+=`
443
- ${p.join(`
728
+ jobs:
729
+ test:
730
+ runs-on: ubuntu-latest
731
+ strategy:
732
+ matrix:
733
+ node-version: [${t}]
734
+
735
+ steps:
736
+ - name: Checkout code
737
+ uses: actions/checkout@v4
738
+ with:
739
+ fetch-depth: 0
740
+
741
+ - name: Setup Node.js \${{ matrix.node-version }}
742
+ uses: actions/setup-node@v4
743
+ with:
744
+ node-version: \${{ matrix.node-version }}
745
+ cache: 'bun'
746
+
747
+ - name: Install Bun
748
+ uses: oven-sh/setup-bun@v1
749
+ with:
750
+ bun-version: latest
751
+
752
+ - name: Install dependencies
753
+ run: ${e.installCommand}
754
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
755
+
756
+ ${e.buildCommand?`- name: Build packages
757
+ run: ${e.buildCommand}
758
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}`:""}
759
+
760
+ ${e.testCommand?`- name: Run tests
761
+ run: ${e.testCommand}
762
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}`:""}
763
+
764
+ - name: Type check
765
+ run: bun type-check
766
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
767
+
768
+ - name: Lint code
769
+ run: bun lint
770
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}`}async generateReleaseWorkflow(e){return`name: Release
771
+
772
+ on:
773
+ push:
774
+ branches: [main, master]
775
+ workflow_dispatch:
776
+
777
+ concurrency:
778
+ group: release-\${{ github.ref }}
779
+ cancel-in-progress: false
780
+
781
+ jobs:
782
+ release:
783
+ runs-on: ubuntu-latest
784
+ permissions:
785
+ contents: write
786
+ id-token: write
787
+ packages: write
788
+
789
+ steps:
790
+ - name: Checkout code
791
+ uses: actions/checkout@v4
792
+ with:
793
+ fetch-depth: 0
794
+ token: \${{ secrets.GITHUB_TOKEN }}
795
+
796
+ - name: Setup Node.js
797
+ uses: actions/setup-node@v4
798
+ with:
799
+ node-version: '${e.nodeVersions[0]||"20"}'
800
+ cache: 'bun'
801
+ registry-url: 'https://registry.npmjs.org'
802
+
803
+ - name: Install Bun
804
+ uses: oven-sh/setup-bun@v1
805
+ with:
806
+ bun-version: latest
807
+
808
+ - name: Install dependencies
809
+ run: ${e.installCommand}
810
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
811
+
812
+ ${e.buildCommand?`- name: Build packages
813
+ run: ${e.buildCommand}
814
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}`:""}
815
+
816
+ ${e.testCommand?`- name: Run tests
817
+ run: ${e.testCommand}
818
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}`:""}
819
+
820
+ - name: Check for changes
821
+ id: changes
822
+ run: |
823
+ if sisyphus graph --since=last-stone --dry-run | grep -q "No changes"; then
824
+ echo "has-changes=false" >> $GITHUB_OUTPUT
825
+ else
826
+ echo "has-changes=true" >> $GITHUB_OUTPUT
827
+ fi
828
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
829
+
830
+ - name: Create stone
831
+ if: steps.changes.outputs.has-changes == 'true'
832
+ run: |
833
+ sisyphus stone create --message="Automated release from CI" --auto-bump
834
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
835
+ env:
836
+ NODE_AUTH_TOKEN: \${{ secrets.NPM_TOKEN }}
837
+
838
+ ${e.publishCommand&&e.publishCondition?`- name: Publish packages
839
+ if: ${e.publishCondition}
840
+ run: ${e.publishCommand}
841
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
842
+ env:
843
+ NODE_AUTH_TOKEN: \${{ secrets.NPM_TOKEN }}`:""}`}async generateVersioningWorkflow(e){return`name: Version Management
844
+
845
+ on:
846
+ workflow_dispatch:
847
+ inputs:
848
+ version-type:
849
+ description: 'Version bump type'
850
+ required: true
851
+ default: 'patch'
852
+ type: choice
853
+ options:
854
+ - patch
855
+ - minor
856
+ - major
857
+ - snapshot
858
+ message:
859
+ description: 'Release message'
860
+ required: true
861
+ default: 'Manual release'
862
+ packages:
863
+ description: 'Specific packages (comma-separated, optional)'
864
+ required: false
865
+
866
+ jobs:
867
+ version:
868
+ runs-on: ubuntu-latest
869
+ permissions:
870
+ contents: write
871
+ packages: write
872
+
873
+ steps:
874
+ - name: Checkout code
875
+ uses: actions/checkout@v4
876
+ with:
877
+ fetch-depth: 0
878
+ token: \${{ secrets.GITHUB_TOKEN }}
879
+
880
+ - name: Setup Node.js
881
+ uses: actions/setup-node@v4
882
+ with:
883
+ node-version: '${e.nodeVersions[0]||"20"}'
884
+ cache: 'bun'
885
+
886
+ - name: Install Bun
887
+ uses: oven-sh/setup-bun@v1
888
+ with:
889
+ bun-version: latest
890
+
891
+ - name: Install dependencies
892
+ run: ${e.installCommand}
893
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}
894
+
895
+ - name: Configure Git
896
+ run: |
897
+ git config --global user.name "github-actions[bot]"
898
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
899
+
900
+ - name: Create versioned stone
901
+ run: |
902
+ if [ -n "\${{ github.event.inputs.packages }}" ]; then
903
+ sisyphus stone create \\
904
+ --message="\${{ github.event.inputs.message }}" \\
905
+ --bump="\${{ github.event.inputs.version-type }}" \\
906
+ --packages="\${{ github.event.inputs.packages }}"
907
+ else
908
+ sisyphus stone create \\
909
+ --message="\${{ github.event.inputs.message }}" \\
910
+ --bump="\${{ github.event.inputs.version-type }}" \\
911
+ --auto-bump
912
+ fi
913
+ ${e.workingDirectory?`working-directory: ${e.workingDirectory}`:""}`}async generateDependencyUpdateWorkflow(){return`name: Dependency Updates
914
+
915
+ on:
916
+ schedule:
917
+ - cron: '0 2 * * 1' # Weekly on Monday at 2 AM
918
+ workflow_dispatch:
919
+
920
+ jobs:
921
+ update-dependencies:
922
+ runs-on: ubuntu-latest
923
+ permissions:
924
+ contents: write
925
+ pull-requests: write
926
+
927
+ steps:
928
+ - name: Checkout code
929
+ uses: actions/checkout@v4
930
+ with:
931
+ fetch-depth: 0
932
+ token: \${{ secrets.GITHUB_TOKEN }}
933
+
934
+ - name: Setup Node.js
935
+ uses: actions/setup-node@v4
936
+ with:
937
+ node-version: '20'
938
+ cache: 'bun'
939
+
940
+ - name: Install Bun
941
+ uses: oven-sh/setup-bun@v1
942
+ with:
943
+ bun-version: latest
944
+
945
+ - name: Update dependencies
946
+ run: |
947
+ bun update
948
+
949
+ - name: Check for dependency changes
950
+ id: changes
951
+ run: |
952
+ if git diff --quiet package.json bun.lock; then
953
+ echo "has-changes=false" >> $GITHUB_OUTPUT
954
+ else
955
+ echo "has-changes=true" >> $GITHUB_OUTPUT
956
+ fi
957
+
958
+ - name: Analyze dependency impact
959
+ if: steps.changes.outputs.has-changes == 'true'
960
+ run: |
961
+ sisyphus insights dependency-impact > dependency-impact.md
962
+ echo "IMPACT<<EOF" >> $GITHUB_ENV
963
+ cat dependency-impact.md >> $GITHUB_ENV
964
+ echo "EOF" >> $GITHUB_ENV
965
+
966
+ - name: Create Pull Request
967
+ if: steps.changes.outputs.has-changes == 'true'
968
+ uses: peter-evans/create-pull-request@v5
969
+ with:
970
+ token: \${{ secrets.GITHUB_TOKEN }}
971
+ commit-message: "chore: update dependencies"
972
+ title: "\uD83D\uDD27 Automated dependency updates"
973
+ body: |
974
+ ## Dependency Impact Analysis
975
+
976
+ \${{ env.IMPACT }}
977
+
978
+ This PR contains automated dependency updates.
979
+
980
+ - Review the dependency impact analysis above
981
+ - Ensure all tests pass
982
+ - Merge when ready to publish updated packages
983
+ branch: dependency-updates
984
+ delete-branch: true`}async createWorkflowFiles(e,t){let n=`${e}/.github/workflows`;try{await Ka`mkdir -p ${n}`.quiet();let o=await this.generateCIWorkflow(t);await Bun.write(`${n}/ci.yml`,o),Le.info("Created CI workflow: .github/workflows/ci.yml");let i=await this.generateReleaseWorkflow(t);await Bun.write(`${n}/release.yml`,i),Le.info("Created release workflow: .github/workflows/release.yml");let r=await this.generateVersioningWorkflow(t);await Bun.write(`${n}/version.yml`,r),Le.info("Created versioning workflow: .github/workflows/version.yml");let s=await this.generateDependencyUpdateWorkflow();await Bun.write(`${n}/dependencies.yml`,s),Le.info("Created dependency update workflow: .github/workflows/dependencies.yml")}catch(o){throw Le.error("Failed to create workflow files:",o),o}}getDefaultConfig(){return{buildCommand:"bun build",installCommand:"bun install",name:"CI/CD",nodeVersions:["18","20","22"],publishCommand:"sisyphus stone publish",publishCondition:"success()",testCommand:"bun test",triggers:["push","pull_request"]}}}var uo=new mo;I();B();var{$:Za}=globalThis.Bun;var ft=v({prefix:"workspace-resolver"});class fo{packages={};packageJsonCache=new Map;async initialize(){let{packages:e}=await G({includePrivate:!0});this.packages=e;for(let[t,n]of Object.entries(e))try{let o=await Bun.file(n.file).json();this.packageJsonCache.set(t,o)}catch(o){ft.warn(`Failed to load package.json for ${t}: ${o}`)}ft.info(`Initialized workspace resolver with ${Object.keys(e).length} packages`)}async resolveWorkspaceDependencies(){let e=[];for(let[t,n]of Object.entries(this.packages)){let o=this.packageJsonCache.get(t);if(!o)continue;let i=await this.resolvePackageDependencies(t,o);e.push(i)}return e}async resolvePackageDependencies(e,t){let n=await this.resolveDependencyGroup(e,t.dependencies||{},"dependencies"),o=await this.resolveDependencyGroup(e,t.devDependencies||{},"devDependencies"),i=await this.resolveDependencyGroup(e,t.peerDependencies||{},"peerDependencies"),r=this.detectConflicts(e,[...n,...o]),s=this.generateSuggestions(e,n,o,r);return{conflicts:r,dependencies:n,devDependencies:o,package:e,peerDependencies:i,suggestions:s}}async resolveDependencyGroup(e,t,n){let o=[];for(let[i,r]of Object.entries(t)){let s=await this.resolveDependency(e,i,r);o.push(s)}return o}async resolveDependency(e,t,n){if(n.startsWith("workspace:"))return this.resolveWorkspaceDependency(e,t,n);if(n.startsWith("file:")||n.startsWith("link:"))return this.resolveLocalDependency(e,t,n);return this.resolveRegistryDependency(e,t,n)}resolveWorkspaceDependency(e,t,n){let o=this.packages[t];if(!o)return{name:t,resolvedVersion:"not-found",satisfies:!1,source:"workspace",version:n};let i=n.replace("workspace:",""),r=o.version,s=this.satisfiesVersion(r,i);return{location:o.file,name:t,resolvedVersion:r,satisfies:s,source:"workspace",version:n}}resolveLocalDependency(e,t,n){return{location:n.replace(/^(file:|link:)/,""),name:t,resolvedVersion:"local",satisfies:!0,source:"local",version:n}}async resolveRegistryDependency(e,t,n){try{let i=(await Za`npm view ${t} version`.quiet()).stdout.toString().trim(),r=this.satisfiesVersion(i,n);return{name:t,resolvedVersion:i,satisfies:r,source:"registry",version:n}}catch(o){return ft.debug(`Failed to resolve registry dependency ${t}: ${o}`),{name:t,resolvedVersion:"unknown",satisfies:!1,source:"registry",version:n}}}satisfiesVersion(e,t){if(t==="*"||t==="latest")return!0;if(t.startsWith("workspace:"))return!0;try{return (()=>{throw new Error("Cannot require module "+"semver");})().satisfies(e,t)}catch{return e===t}}detectConflicts(e,t){let n=[],o=new Map;for(let i of t){if(!o.has(i.name))o.set(i.name,[]);o.get(i.name)?.push(i)}for(let[i,r]of o)if(r.length>1){let s=r.map((c)=>c.version),a=[...new Set(s)];if(a.length>1)n.push({dependency:i,description:`Multiple versions of ${i} specified: ${a.join(", ")}`,packages:[e],resolution:`Align to single version: ${a[0]}`,severity:"warning",versions:a})}return n}generateSuggestions(e,t,n,o){let i=[];for(let r of[...t,...n]){if(!r.satisfies)i.push({dependency:r.name,from:r.version,impact:"unknown",package:e,reason:`Version mismatch: ${r.version} vs ${r.resolvedVersion}`,to:r.resolvedVersion,type:"upgrade"});if(r.source==="workspace"&&r.resolvedVersion==="not-found")i.push({dependency:r.name,from:r.version,impact:"breaking",package:e,reason:`Workspace dependency ${r.name} not found`,to:"",type:"remove"})}for(let r of o)i.push({dependency:r.dependency,from:r.versions.join(", "),impact:"non-breaking",package:e,reason:r.description,to:r.resolution||r.versions[0]||"",type:"align"});return i}async validateWorkspace(){let e=await this.resolveWorkspaceDependencies(),t=[],n=[],o=[];for(let i of e){for(let r of i.conflicts)if(r.severity==="error")t.push(`${i.package}: ${r.description}`);else n.push(`${i.package}: ${r.description}`);o.push(...i.suggestions)}return{errors:t,suggestions:o,valid:t.length===0,warnings:n}}async fixWorkspaceIssues(e){let t=new Map;for(let n of e){if(!t.has(n.package))t.set(n.package,[]);t.get(n.package)?.push(n)}for(let[n,o]of t)await this.applyPackageFixes(n,o)}async applyPackageFixes(e,t){let n=this.packages[e];if(!n)return;let o=this.packageJsonCache.get(e);if(!o)return;let i=!1;for(let r of t)switch(r.type){case"upgrade":case"align":if(o.dependencies?.[r.dependency])o.dependencies[r.dependency]=r.to,i=!0;if(o.devDependencies?.[r.dependency])o.devDependencies[r.dependency]=r.to,i=!0;break;case"remove":if(o.dependencies?.[r.dependency])delete o.dependencies[r.dependency],i=!0;if(o.devDependencies?.[r.dependency])delete o.devDependencies[r.dependency],i=!0;break}if(i)await Bun.write(n.file,JSON.stringify(o,null,2)),ft.info(`Applied ${t.length} fixes to ${e}`)}}var dt=new fo;var J=v({prefix:"setup"});async function ho(){D("\uD83D\uDD27 Sisyphus Workspace Setup");let e=await Z({message:"What would you like to set up?",options:[{label:"GitHub Actions workflows",value:"github"},{label:"GitLab CI configuration",value:"gitlab"},{label:"Git hooks for commit conventions",value:"hooks"},{label:"Workspace dependency resolution",value:"workspace"},{label:"Complete setup (all of the above)",value:"complete"}]});if(typeof e==="symbol")throw new ee("Setup cancelled","CANCELLED");switch(e){case"github":await go();break;case"gitlab":await yo();break;case"hooks":await bo();break;case"workspace":await wo();break;case"complete":await Va();break}T("\u2705 Setup completed successfully!")}async function go(){J.info("Setting up GitHub Actions workflows...");let e=await L({defaultValue:"CI/CD",message:"Workflow name",placeholder:"CI/CD"});if(typeof e==="symbol")return;let t=await X({message:"Select workflow triggers",options:[{label:"Push to main branches",value:"push"},{label:"Pull requests",value:"pull_request"},{label:"Manual trigger",value:"workflow_dispatch"},{label:"Scheduled (daily)",value:"schedule"}],required:!0});if(typeof t==="symbol")return;let n=await X({message:"Select Node.js versions to test",options:[{label:"Node.js 18",value:"18"},{label:"Node.js 20",value:"20"},{label:"Node.js 22",value:"22"}],required:!0});if(typeof n==="symbol")return;let o={buildCommand:"bun build",installCommand:"bun install",name:e,nodeVersions:n,publishCommand:"sisyphus stone publish",testCommand:"bun test",triggers:t};await uo.createWorkflowFiles(process.cwd(),o),J.info("GitHub Actions workflows created successfully")}async function yo(){J.info("Setting up GitLab CI configuration...");let e=await L({defaultValue:"Monorepo CI/CD",message:"CI/CD pipeline name",placeholder:"Monorepo CI/CD"});if(typeof e==="symbol")return;let t=await Z({message:"Select Docker image",options:[{label:"oven/bun:latest (recommended)",value:"oven/bun:latest"},{label:"node:20",value:"node:20"},{label:"node:18",value:"node:18"},{label:"Custom",value:"custom"}]});if(typeof t==="symbol")return;let n=t;if(t==="custom"){let i=await L({message:"Enter custom Docker image",placeholder:"my-registry/my-image:tag"});if(typeof i==="symbol")return;n=i}let o={buildCommand:"bun build",image:n,installCommand:"bun install",name:e,nodeVersion:"20",publishCommand:"sisyphus stone publish",stages:["install","lint","test","build","version","release"],testCommand:"bun test"};await po.createGitLabCI(process.cwd(),o),J.info("GitLab CI configuration created successfully")}async function bo(){J.info("Setting up Git hooks...");let e=await X({message:"Select hooks to install",options:[{label:"commit-msg (validate commit messages)",value:"commit-msg"},{label:"pre-commit (run linting and tests)",value:"pre-commit"},{label:"pre-push (workspace health check)",value:"pre-push"},{label:"post-commit (dependency analysis)",value:"post-commit"}],required:!0});if(typeof e==="symbol")return;let t=await X({message:"Select allowed commit types",options:[{label:"feat (new features)",value:"feat"},{label:"fix (bug fixes)",value:"fix"},{label:"docs (documentation)",value:"docs"},{label:"style (formatting)",value:"style"},{label:"refactor (code refactoring)",value:"refactor"},{label:"test (testing)",value:"test"},{label:"chore (maintenance)",value:"chore"},{label:"perf (performance)",value:"perf"},{label:"ci (CI/CD)",value:"ci"},{label:"build (build system)",value:"build"}],required:!0});if(typeof t==="symbol")return;let n=await A({initialValue:!1,message:"Require commit scope (e.g., feat(core): add feature)?"});if(typeof n==="symbol")return;let o={allowedScopes:["core","hydra","sisyphus","tools","docs","deps"],commitMsgPattern:"type(scope): subject",commitTypes:t,enableCommitMsg:e.includes("commit-msg"),enablePostCommit:e.includes("post-commit"),enablePreCommit:e.includes("pre-commit"),enablePrePush:e.includes("pre-push"),maxSubjectLength:72,requireBody:!1,requireBreakingChange:!1,requireScope:n};await co.installHooks(o),J.info("Git hooks installed successfully")}async function wo(){J.info("Setting up workspace dependency resolution..."),await dt.initialize();let e=await dt.validateWorkspace();if(e.valid)J.info("\u2705 Workspace is already properly configured");else{J.warn(`Found ${e.errors.length} errors and ${e.warnings.length} warnings`);for(let t of e.errors)J.error(t);for(let t of e.warnings)J.warn(t);if(e.suggestions.length>0){if(await A({initialValue:!0,message:`Found ${e.suggestions.length} suggested fixes. Apply them?`}))await dt.fixWorkspaceIssues(e.suggestions),J.info("\u2705 Workspace issues have been fixed")}}}async function Va(){J.info("Running complete workspace setup..."),await go(),await yo(),await bo(),await wo(),J.info("\uD83C\uDF89 Complete setup finished!")}M();E();B();import{parseArgs as Ya}from"util";var{$:ht}=globalThis.Bun;var Xa=v({prefix:"sisyphus:solo"});async function $o(){let{values:e}=Ya({args:process.argv.slice(3),options:{"dry-run":{short:"d",type:"boolean"},tag:{short:"t",type:"string"}}}),{"dry-run":t,tag:n}=e;D(`${p.command("sisyphus solo")} - Single maintainer workflow`);let o=xe();o.start("Creating version from commits and rolling immediately...");try{let i=await ht`git describe --tags --abbrev=0 2>/dev/null || echo ""`.text(),r=await ht`git rev-list ${i?`${i.trim()}..HEAD`:"HEAD"} --count`.text();if(Number.parseInt(r.trim(),10)===0){o.stop("No commits to release"),T(p.dim("Already up to date"));return}o.message("Analyzing commits...");let s=["bunx","@r5n/sisyphus","version","--from-commits","--yes"];if(t)s.push("--dry-run");if(await ht`${s}`,((await j()).stones||[]).length===0&&!t){o.stop("No releasable changes found"),T(p.dim("No version bumps needed"));return}o.message(t?"Previewing release...":"Rolling stones...");let l=["bunx","@r5n/sisyphus","roll"];if(t)l.push("--dry-run");if(n)l.push("--tag",n);await ht`${l}`,o.stop("Release complete!"),T(p.success("Published successfully"))}catch(i){o.stop("Solo release failed"),Xa.error("Failed to complete solo workflow",i),T(p.error(`Solo release failed: ${i}`)),process.exit(1)}}E();I();M();E();I();B();import{existsSync as Qa}from"fs";import{unlink as Fa}from"fs/promises";import{join as Da}from"path";import{parseArgs as ec}from"util";var Ne=v({prefix:"sisyphus"}).child("stone:delete");async function vo(e){if(!e)Ne.error("Stone ID is required"),Ne.error("Usage: sisyphus stone delete <id>"),process.exit(1);let{values:t}=ec({args:process.argv.slice(5),options:{force:{short:"f",type:"boolean"}}}),{force:n}=t;try{let i=(await j()).stonesPath||".sisyphus/stones",r=Da(i,`${e}.md`);if(!Qa(r))Ne.error(`Stone '${e}' not found`),Ne.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);if(!n){if(!await A({initialValue:!1,message:`Delete stone '${e}'?`})){$.info("Deletion cancelled");return}}await Fa(r),$.success(`Stone '${p.bold(e)}' deleted`)}catch(o){Ne.error(`Failed to delete stone '${e}':`,o),process.exit(1)}}M();E();I();B();import{existsSync as tc}from"fs";import{readFile as nc,writeFile as sc}from"fs/promises";import{join as oc}from"path";import{parseArgs as ic}from"util";var Ie=v({prefix:"sisyphus"}).child("stone:edit");async function xo(e){if(!e)Ie.error("Stone ID is required"),Ie.error("Usage: sisyphus stone edit <id>"),process.exit(1);let{values:t}=ic({args:process.argv.slice(5),options:{interactive:{short:"i",type:"boolean"},message:{short:"m",type:"string"}}}),{message:n,interactive:o}=t;try{let r=(await j()).stonesPath||".sisyphus/stones",s=oc(r,`${e}.md`);if(!tc(s))Ie.error(`Stone '${e}' not found`),Ie.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let a=await nc(s,"utf-8");if(n){let c=a.split(`
985
+ `);c[0]=`### ${n}`,await sc(s,c.join(`
986
+ `)),$.success(`Updated commit message for stone '${p.bold(e)}'`);return}if(o){$.info("Interactive stone editing coming soon"),$.info("For now, you can manually edit:"),$.info(p.dim(s));return}Ie.error("Please specify --message or --interactive"),process.exit(1)}catch(i){Ie.error(`Failed to edit stone '${e}':`,i),process.exit(1)}}E();var Co={delete:{description:"Remove a specific stone before rolling",examples:[{command:"sisyphus stone delete stone-123",description:"Delete a stone by ID"},{command:"sisyphus stone delete stone-123 --force",description:"Delete without confirmation"}],name:"sisyphus stone delete",options:[{description:"Skip confirmation prompt",flags:"-f, --force",type:"boolean"}],usage:"sisyphus stone delete <id> [options]"},edit:{description:"Modify stone content or version bumps",examples:[{command:"sisyphus stone edit stone-123 --interactive",description:"Edit stone interactively"},{command:'sisyphus stone edit stone-123 --message "feat: better description"',description:"Update commit message"}],name:"sisyphus stone edit",options:[{description:"New commit message",flags:"-m, --message",type:"string"},{description:"Edit in interactive mode",flags:"-i, --interactive",type:"boolean"}],usage:"sisyphus stone edit <id> [options]"},list:{description:"View all pending stones with details",examples:[{command:"sisyphus stone list",description:"List all pending stones"},{command:"sisyphus stone list --verbose",description:"Show full stone content"},{command:"sisyphus stone list --json",description:"Output as JSON for scripting"}],name:"sisyphus stone list",options:[{description:"Output in JSON format",flags:"-j, --json",type:"boolean"},{description:"Show full stone content",flags:"-v, --verbose",type:"boolean"}],usage:"sisyphus stone list [options]"},merge:{description:"Combine multiple stones with smart conflict resolution",examples:[{command:"sisyphus stone merge",description:"Merge stones interactively"},{command:"sisyphus stone merge --ids stone-123 stone-456",description:"Merge specific stones"},{command:"sisyphus stone merge --strategy highest",description:"Merge with automatic conflict resolution"},{command:'sisyphus stone merge --strategy interactive --message "feat: combined changes"',description:"Merge with interactive conflict resolution"}],name:"sisyphus stone merge",notes:["Detects when same package has different bump types across stones","Default strategy uses highest bump type (major > minor > patch)","Interactive strategy lets you choose resolution for each conflict"],options:[{description:"Stone IDs to merge (multiple)",flags:"-i, --ids",type:"string"},{description:"Commit message for merged stone",flags:"-m, --message",type:"string"},{description:"Skip confirmation",flags:"-f, --force",type:"boolean"},{description:"Conflict resolution (highest/interactive)",flags:"-s, --strategy",type:"string"}],usage:"sisyphus stone merge [options]"},show:{description:"Display full content of a specific stone",examples:[{command:"sisyphus stone show stone-123",description:"Show stone content"},{command:"sisyphus stone show stone-123 --json",description:"Output as JSON"}],name:"sisyphus stone show",options:[{description:"Output in JSON format",flags:"-j, --json",type:"boolean"}],usage:"sisyphus stone show <id> [options]"}};function gt(e){if(e&&Co[e]){console.log(nt(Co[e]));return}console.log(st("Sisyphus Stone Management","sisyphus stone <command> [options]",[{description:"View all pending stones with details",name:"list"},{description:"Remove a specific stone by ID",name:"delete"},{description:"Display full content of a stone",name:"show"},{description:"Modify stone content or versions",name:"edit"},{description:"Combine multiple stones into one",name:"merge"},{description:"Show this help message",name:"help"}],"Use sisyphus stone <command> --help for more information about a command."))}M();E();I();B();import{readFile as rc}from"fs/promises";import{join as ac}from"path";import{parseArgs as cc}from"util";var So=v({prefix:"sisyphus"}).child("stone:list");async function ko(){let{values:e}=cc({args:process.argv.slice(4),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:t,verbose:n}=e;try{let i=(await j()).stonesPath||".sisyphus/stones",r=await Q();if(r.length===0){if(t)console.log(JSON.stringify([]));else $.info("No pending stones found");return}let s=[];for(let a of r){let c=ac(i,`${a}.md`);try{let l=await rc(c,"utf-8"),m=ve(l);s.push({id:a,path:c,...m})}catch(l){So.warn(`Failed to read stone ${a}:`,l)}}if(t){console.log(JSON.stringify(s,null,2));return}$.info(`Found ${p.bold(String(s.length))} pending stone${s.length>1?"s":""}`),console.log();for(let[a,c]of s.entries()){if(console.log(`${p.bullet("\u2022")} ${p.bold(c.id)}`),console.log(` ${p.dim("Message:")} ${c.commitMessage}`),c.tag)console.log(` ${p.dim("Tag:")} ${p.value(c.tag)}`);if(c.major.length>0)console.log(` ${p.error("Major:")} ${c.major.join(", ")}`);if(c.minor.length>0)console.log(` ${p.warning("Minor:")} ${c.minor.join(", ")}`);if(c.patch.length>0)console.log(` ${p.success("Patch:")} ${c.patch.join(", ")}`);if(n&&c.description)console.log(` ${p.dim("Description:")}`),c.description.split(`
987
+ `).forEach((l)=>{console.log(` ${p.dim(l)}`)});if(a<s.length-1)console.log()}}catch(o){So.error("Failed to list stones:",o),process.exit(1)}}M();E();I();B();import{readFile as _o,unlink as Eo,writeFile as lc}from"fs/promises";import{join as fn}from"path";import{parseArgs as pc}from"util";M();E();Re();var yt={major:4,minor:3,patch:2,dependency:1,snapshot:5};function Ro(e){let t=new Map;for(let o of e){for(let i of o.major){let r={bumpType:"major",name:i,stoneId:o.id,tag:o.tag};t.set(i,[...t.get(i)||[],r])}for(let i of o.minor){let r={bumpType:"minor",name:i,stoneId:o.id,tag:o.tag};t.set(i,[...t.get(i)||[],r])}for(let i of o.patch){let r={bumpType:"patch",name:i,stoneId:o.id,tag:o.tag};t.set(i,[...t.get(i)||[],r])}}let n=[];for(let[o,i]of t)if(i.length>1){let r=new Set(i.map((a)=>a.bumpType)),s=new Set(i.map((a)=>a.tag).filter(Boolean));if(r.size>1||s.size>1)n.push({conflicts:i,packageName:o})}return n}async function jo(e,t="highest"){let n=[];for(let o of e){if(t==="highest"){let i=o.conflicts.reduce((r,s)=>yt[s.bumpType]>yt[r.bumpType]?s:r);o.resolution={chosenBumpType:i.bumpType,chosenStoneId:i.stoneId,reason:"Highest bump type selected"}}else{let i=o.conflicts.map((s)=>({label:`${s.bumpType} from ${s.stoneId}${s.tag?` (${s.tag})`:""}`,value:s}));console.log(`
988
+ ${p.warning("Conflict detected")} for ${p.value(o.packageName)}:`);for(let s of o.conflicts)console.log(` ${p.dim("\u2022")} ${s.bumpType} from ${s.stoneId}${s.tag?` (${s.tag})`:""}`);let r=await Z({message:"How should this conflict be resolved?",options:[{label:"Use highest bump type",value:"highest"},...i]});if(r&&r==="highest"){let s=o.conflicts.reduce((a,c)=>yt[c.bumpType]>yt[a.bumpType]?c:a);o.resolution={chosenBumpType:s.bumpType,chosenStoneId:s.stoneId,reason:"Highest bump type selected"}}else if(r&&typeof r==="object"){let s=r;o.resolution={chosenBumpType:s.bumpType,chosenStoneId:s.stoneId,reason:"Manually selected"}}}n.push(o)}return n}function Io(e,t){let n={major:new Set,minor:new Set,patch:new Set,tags:{}},o=new Map;for(let i of t)if(i.resolution){let{chosenBumpType:r}=i.resolution,s=i.conflicts.find((a)=>a.stoneId===i.resolution?.chosenStoneId);o.set(i.packageName,{bumpType:r,tag:s?.tag})}for(let i of e){for(let r of i.major){let s=o.get(r);if(s){switch(s.bumpType){case"major":n.major.add(r);break;case"minor":n.minor.add(r);break;case"patch":n.patch.add(r);break}if(s.tag)n.tags[r]=s.tag}else n.major.add(r)}for(let r of i.minor)if(!o.has(r))n.minor.add(r);for(let r of i.patch)if(!o.has(r))n.patch.add(r)}return{major:Array.from(n.major),minor:Array.from(n.minor),patch:Array.from(n.patch),tags:n.tags}}var Po=v({prefix:"sisyphus"}).child("stone:merge");async function Ao(e){let{values:t}=pc({allowPositionals:!0,args:process.argv.slice(4),options:{force:{short:"f",type:"boolean"},ids:{multiple:!0,short:"i",type:"string"},message:{short:"m",type:"string"},strategy:{short:"s",type:"string"}}}),{ids:n,message:o,force:i,strategy:r}=t;try{let a=(await j()).stonesPath||".sisyphus/stones",c=await Q();if(c.length<2){$.info("Need at least 2 stones to merge");return}let l=[];if(n&&n.length>=2){for(let C of n)if(c.includes(C)){let S=fn(a,`${C}.md`),R=await _o(S,"utf-8"),q=ve(R);l.push({id:C,path:S,...q})}if(l.length<2)Po.error("Could not find all specified stones"),process.exit(1)}else{let C=[];for(let R of c){let q=fn(a,`${R}.md`),V=await _o(q,"utf-8"),ne=ve(V);C.push({label:`${R} - ${ne.commitMessage}`,value:{id:R,path:q,...ne}})}let S=await X({message:"Select stones to merge",options:C,required:!0});if(!S||Array.isArray(S)&&S.length<2){$.info("Need to select at least 2 stones");return}l=S}let m=o||await L({message:"Commit message for merged stone",placeholder:"feat: combined changes"});if(!m||typeof m!=="string"){$.info("Merge cancelled");return}let u=Ro(l),g;if(u.length>0){P(`Found ${p.value(String(u.length))} package conflict(s):
989
+ `+u.map((R)=>` ${p.dim("\u2022")} ${R.packageName}`).join(`
990
+ `),p.warning("Conflicts detected"));let S=await jo(u,r==="highest"||r==="interactive"?r:"highest");if(g=Io(l,S),S.length>0){let R=S.filter((q)=>q.resolution).map((q)=>` ${p.dim("\u2022")} ${q.packageName}: ${q.resolution?.chosenBumpType} (${q.resolution?.reason})`).join(`
991
+ `);P(R,p.success("Conflicts resolved"))}}else{let C={major:[],minor:[],patch:[]};for(let S of l)C.major.push(...S.major),C.minor.push(...S.minor),C.patch.push(...S.patch);g={major:[...new Set(C.major)],minor:[...new Set(C.minor)],patch:[...new Set(C.patch)],tags:{}}}let w=[];for(let C of l)if(C.description)w.push(C.description);let y=`merged-${Date.now()}`,b=fn(a,`${y}.md`),x=`### ${m}
992
+ `,k=[...new Set(Object.values(g.tags))];if(k.length===1)x+=`_${k[0]}_
993
+ `;if(w.length>0)x+=`
994
+ ${w.join(`
444
995
 
445
996
  `)}
446
- `;if(g+=`
997
+ `;if(x+=`
447
998
  ---
448
999
 
449
- `,f.major.length>0||f.minor.length>0||f.patch.length>0){let u=[],S=[];if(f.major.length>0)u.push("major"),S.push(f.major.join(", "));if(f.minor.length>0)u.push("minor"),S.push(f.minor.join(", "));if(f.patch.length>0)u.push("patch"),S.push(f.patch.join(", "));g+=`| ${u.join(" | ")} |
450
- `,g+=`| ${u.map(()=>":---:").join(" | ")} |
451
- `,g+=`| ${S.join(" | ")} |
452
- `}if(await xi(y,g),!i){if(await N({initialValue:!0,message:"Delete original stones?"}))for(let S of a)await rr(S.path)}else for(let u of a)await rr(u.path);$.success(`Created merged stone: ${h.bold(w)}`)}catch(e){sr.error("Failed to merge stones:",e),process.exit(1)}}U();_();H();import{existsSync as vi}from"fs";import{readFile as Ei}from"fs/promises";import{join as Oi}from"path";import{parseArgs as ji}from"util";var En=v({prefix:"sisyphus"}).child("stone:show");async function er(n){if(!n)En.error("Stone ID is required"),En.error("Usage: sisyphus stone show <id>"),process.exit(1);let{values:t}=ji({args:process.argv.slice(5),options:{json:{short:"j",type:"boolean"}}}),{json:r}=t;try{let i=(await j()).stonesPath||".sisyphus/stones",e=Oi(i,`${n}.md`);if(!vi(e))En.error(`Stone '${n}' not found`),En.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let o=await Ei(e,"utf-8");if(r){let c=en(o);console.log(JSON.stringify({id:n,path:e,...c,raw:o},null,2));return}console.log(h.bold(`Stone: ${n}`)),console.log(h.dim(`Path: ${e}`)),console.log(h.dim("\u2500".repeat(50))),console.log(),console.log(o)}catch(s){En.error(`Failed to show stone '${n}':`,s),process.exit(1)}}var Zn=["list","delete","show","edit","merge","help"],dn=v({prefix:"sisyphus"}).child("stone"),Ri={combine:"merge",del:"delete",display:"show",join:"merge",ls:"list",modify:"edit",remove:"delete",rm:"delete",update:"edit",view:"show"};async function cr(){let[,,,n,...t]=process.argv;if(!n||n==="--help"||n==="-h"){Yn();return}let r=n;if(!Zn.includes(n)){let s=qn(n,Ri);if(s&&Zn.includes(s))r=s,dn.warn(`Assuming you meant '${s}'`)}if(!Zn.includes(r)){dn.error(`Unknown stone command: ${n}`);let s=Ln(n,Zn);if(s.length>0){dn.error("Did you mean one of these?");for(let i of s)dn.error(` ${i}`)}dn.error("Run 'sisyphus stone --help' for usage information"),process.exit(1)}if(t.includes("--help")||t.includes("-h")){Yn(r);return}try{switch(r){case"list":await or();break;case"delete":await kt(t[0]);break;case"show":await er(t[0]);break;case"edit":await Ft(t[0]);break;case"merge":await ir(t);break;case"help":{let s=t[0];Yn(s);break}default:throw new Error(`Unknown stone command: ${r}`)}}catch(s){dn.error(`Failed to execute stone ${r}:`,s),process.exit(1)}}q();_();import{parseArgs as Ii}from"util";H();q();U();_();H();var{$:ar}=globalThis.Bun;var Ai=v({prefix:"sisyphus"}).child("from-commits"),lr={build:"patch",chore:"patch",ci:"patch",docs:"patch",feat:"minor",fix:"patch",perf:"patch",refactor:"patch",style:"patch",test:"patch"};async function fr(n){try{let r=(await j()).lastStone?.commit||"",s=r?`${r}..HEAD`:"HEAD",{stdout:i}=await ar`git log ${s} --pretty=format:"%H|%s" --no-merges`.quiet();if(!i.toString().trim())return $.info("No commits found since last release"),[];let e=i.toString().trim().split(`
453
- `),o=[];for(let a of e){let[l,f]=a.split("|");if(!l||!f)continue;let p=_i(l,f);if(p){let{stdout:d}=await ar`git diff-tree --no-commit-id --name-only -r ${l}`.quiet();p.files=d.toString().trim().split(`
454
- `).filter(Boolean),o.push(p)}}if(o.length===0)return $.info("No conventional commits found"),[];let c=await Mi(o,n);return $.info(`Found ${h.bold(String(o.length))} conventional commits`),$.info(`Creating ${h.bold(String(c.length))} stone${c.length>1?"s":""}`),c}catch(t){throw Ai.error("Failed to analyze commits:",t),t}}function _i(n,t){let r=t.match(/^(\w+)(?:\(([^)]+)\))?(!)?:\s*(.+)$/);if(!r)return null;let[,s="",i,e,o=""]=r;if(!s||!lr[s])return null;return{breaking:!!e,files:[],hash:n,message:o,scope:i,type:s}}async function Mi(n,t){let{packages:r}=await Promise.resolve().then(() => (H(),Nt)).then((e)=>e.getPackages({filter:t})),s=new Map;for(let[e,o]of Object.entries(r)){let c=o.file.substring(0,o.file.lastIndexOf("/"));s.set(c,e)}let i=new Map;for(let e of n){let o=new Set;for(let f of e.files)for(let[p,d]of s.entries())if(f.startsWith(p))o.add(d);if(o.size===0)continue;let c;if(e.breaking)c="major";else c=lr[e.type]||"patch";let a=`${e.type}${e.breaking?"!":""}`;if(!i.has(a)){let f=e.breaking?"feat!: breaking changes":`${e.type}: ${e.type} updates`;i.set(a,{bump:c,message:f,packages:new Set})}let l=i.get(a);if(l)for(let f of o)l.packages.add(f)}return Array.from(i.values()).filter((e)=>e.packages.size>0)}function Gi(){let{values:n}=Ii({allowPositionals:!0,args:process.argv.slice(3),options:{bump:{default:"",short:"b",type:"string"},dryRun:{default:!1,short:"d",type:"boolean"},filter:{default:"",short:"f",type:"string"},"from-commits":{default:!1,type:"boolean"},snapshot:{default:!1,short:"s",type:"boolean"},tag:{default:"",short:"t",type:"string"},yes:{default:!1,short:"y",type:"boolean"}},strict:!1});return n}function Ui(n){let{snapshot:t,bump:r}=n;if(t&&r)throw new Error(`Cannot use both ${m.cyanBright("--snapshot")} and ${m.cyanBright("--bump")} options, pick one.`)}async function Ni(){let n=await N({active:"Yes, continue",inactive:"No, cancel",message:"Are you sure you want to create a new stone?"});if(!n||Q(n))throw new Error("Operation cancelled by user")}async function Hi(n,t,r){await Bun.write(`.sisyphus/stones/${n}.md`,t.join(`
455
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(r,null,2)}
456
- `)}async function mr(){try{let n=Gi();Ui(n);let{dryRun:t}=No(n);if(n["from-commits"]){await Ci(n);return}let{packages:r,packageNames:s}=await J({filter:n.filter}),{message:i,majorPackages:e,minorPackages:o,patchPackages:c}=await Zt({bump:n.bump,packageNames:s,packages:r,tag:n.tag}),{packages:a,stoneContent:l,stoneName:f}=await pn({majorPackages:e,message:i,minorPackages:o,packages:r,patchPackages:c,tag:n.tag});if($.step([`${n.dryRun?m.bold(m.yellow(`[dry-run]
457
- `)):""}${m.italic("Changes preview:")}
458
- `,`${m.italic("Stone: ")}${m.bold(i)}`,...a.map(un)].join(`
459
- `)),t){$.info(`${m.bold(m.yellow("[dry-run]"))}
1000
+ `,g.major.length>0||g.minor.length>0||g.patch.length>0){let C=[],S=[];if(g.major.length>0)C.push("major"),S.push(g.major.join(", "));if(g.minor.length>0)C.push("minor"),S.push(g.minor.join(", "));if(g.patch.length>0)C.push("patch"),S.push(g.patch.join(", "));x+=`| ${C.join(" | ")} |
1001
+ `,x+=`| ${C.map(()=>":---:").join(" | ")} |
1002
+ `,x+=`| ${S.join(" | ")} |
1003
+ `}if(await lc(b,x),!i){if(await A({initialValue:!0,message:"Delete original stones?"}))for(let S of l)await Eo(S.path)}else for(let C of l)await Eo(C.path);$.success(`Created merged stone: ${p.bold(y)}`)}catch(s){Po.error("Failed to merge stones:",s),process.exit(1)}}E();I();B();import{existsSync as mc}from"fs";import{readFile as uc}from"fs/promises";import{join as fc}from"path";import{parseArgs as dc}from"util";var Ue=v({prefix:"sisyphus"}).child("stone:show");async function Bo(e){if(!e)Ue.error("Stone ID is required"),Ue.error("Usage: sisyphus stone show <id>"),process.exit(1);let{values:t}=dc({args:process.argv.slice(5),options:{json:{short:"j",type:"boolean"}}}),{json:n}=t;try{let i=(await j()).stonesPath||".sisyphus/stones",r=fc(i,`${e}.md`);if(!mc(r))Ue.error(`Stone '${e}' not found`),Ue.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let s=await uc(r,"utf-8");if(n){let a=ve(s);console.log(JSON.stringify({id:e,path:r,...a,raw:s},null,2));return}console.log(p.bold(`Stone: ${e}`)),console.log(p.dim(`Path: ${r}`)),console.log(p.dim("\u2500".repeat(50))),console.log(),console.log(s)}catch(o){Ue.error(`Failed to show stone '${e}':`,o),process.exit(1)}}var bt=["list","delete","show","edit","merge","help"],_e=v({prefix:"sisyphus"}).child("stone"),hc={combine:"merge",del:"delete",display:"show",join:"merge",ls:"list",modify:"edit",remove:"delete",rm:"delete",update:"edit",view:"show"};async function Mo(){let[,,,e,...t]=process.argv;if(!e||e==="--help"||e==="-h"){gt();return}let n=e;if(!bt.includes(e)){let o=tt(e,hc);if(o&&bt.includes(o))n=o,_e.warn(`Assuming you meant '${o}'`)}if(!bt.includes(n)){_e.error(`Unknown stone command: ${e}`);let o=et(e,bt);if(o.length>0){_e.error("Did you mean one of these?");for(let i of o)_e.error(` ${i}`)}_e.error("Run 'sisyphus stone --help' for usage information"),process.exit(1)}if(t.includes("--help")||t.includes("-h")){gt(n);return}try{switch(n){case"list":await ko();break;case"delete":await vo(t[0]);break;case"show":await Bo(t[0]);break;case"edit":await xo(t[0]);break;case"merge":await Ao(t);break;case"help":{let o=t[0];gt(o);break}default:throw new Error(`Unknown stone command: ${n}`)}}catch(o){_e.error(`Failed to execute stone ${n}:`,o),process.exit(1)}}M();I();import{parseArgs as $c}from"util";B();M();E();I();B();var{$:Oo}=globalThis.Bun;var gc=v({prefix:"sisyphus"}).child("from-commits"),yc=/^(\w+)(?:\(([^)]+)\))?(!)?: (.+)$/,Go={build:"patch",chore:"patch",ci:"patch",docs:"patch",feat:"minor",fix:"patch",perf:"patch",refactor:"patch",style:"patch",test:"patch"};async function Ho(e){try{let n=(await j()).lastStone?.commit||"",o=n?`${n}..HEAD`:"HEAD",{stdout:i}=await Oo`git log ${o} --pretty=format:"%H|%s" --no-merges`.quiet();if(!i.toString().trim())return $.info("No commits found since last release"),[];let r=i.toString().trim().split(`
1004
+ `),s=[];for(let c of r){let[l,m]=c.split("|");if(!l||!m)continue;let u=bc(l,m);if(u){let{stdout:g}=await Oo`git diff-tree --no-commit-id --name-only -r ${l}`.quiet();u.files=g.toString().trim().split(`
1005
+ `).filter(Boolean),s.push(u)}}if(s.length===0)return $.info("No conventional commits found"),[];let a=await wc(s,e);return $.info(`Found ${p.bold(String(s.length))} conventional commits`),$.info(`Creating ${p.bold(String(a.length))} stone${a.length>1?"s":""}`),a}catch(t){throw gc.error("Failed to analyze commits:",t),t}}function bc(e,t){let n=t.match(yc);if(!n)return null;let[,o="",i,r,s=""]=n;if(!o||!Go[o])return null;return{breaking:!!r,files:[],hash:e,message:s,scope:i,type:o}}async function wc(e,t){let{packages:n}=await Promise.resolve().then(() => (B(),rn)).then((r)=>r.getPackages({filter:t})),o=new Map;for(let[r,s]of Object.entries(n)){let a=s.file.substring(0,s.file.lastIndexOf("/"));o.set(a,r)}let i=new Map;for(let r of e){let s=new Set;for(let m of r.files)for(let[u,g]of o.entries())if(m.startsWith(u))s.add(g);if(s.size===0)continue;let a;if(r.breaking)a="major";else a=Go[r.type]||"patch";let c=`${r.type}${r.breaking?"!":""}`;if(!i.has(c)){let m=r.breaking?"feat!: breaking changes":`${r.type}: ${r.type} updates`;i.set(c,{bump:a,message:m,packages:new Set})}let l=i.get(c);if(l)for(let m of s)l.packages.add(m)}return Array.from(i.values()).filter((r)=>r.packages.size>0)}function vc(){let{values:e}=$c({allowPositionals:!0,args:process.argv.slice(3),options:{bump:{default:"",short:"b",type:"string"},dryRun:{default:!1,short:"d",type:"boolean"},filter:{default:"",short:"f",type:"string"},"from-commits":{default:!1,type:"boolean"},"include-private":{default:!1,type:"boolean"},snapshot:{default:!1,short:"s",type:"boolean"},tag:{default:"",short:"t",type:"string"},yes:{default:!1,short:"y",type:"boolean"}},strict:!1});return e}function xc(e){let{snapshot:t,bump:n}=e;if(t&&n)throw new Error(`Cannot use both ${f.cyanBright("--snapshot")} and ${f.cyanBright("--bump")} options, pick one.`)}async function Cc(){let e=await A({active:"Yes, continue",inactive:"No, cancel",message:"Are you sure you want to create a new stone?"});if(!e||se(e))throw new Error("Operation cancelled by user")}async function Sc(e,t,n){await Bun.write(`.sisyphus/stones/${e}.md`,t.join(`
1006
+ `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(n,null,2)}
1007
+ `)}async function To(){try{let e=vc();xc(e);let{dryRun:t}=sn(e);if(e["from-commits"]){await kc(e);return}let{packages:n,packageNames:o,privatePackageCount:i}=await G({filter:e.filter,includePrivate:e["include-private"]});if(i>0&&!e["include-private"])$.info(f.dim(`Note: ${i} private package${i>1?"s":""} excluded from versioning`));let{message:r,majorPackages:s,minorPackages:a,patchPackages:c}=await Ys({bump:e.bump,packageNames:o,packages:n,tag:e.tag}),{packages:l,stoneContent:m,stoneName:u}=await le({majorPackages:s,message:r,minorPackages:a,packages:n,patchPackages:c,tag:e.tag});if($.step([`${e.dryRun?f.bold(f.yellow(`[dry-run]
1008
+ `)):""}${f.italic("Changes preview:")}
1009
+ `,`${f.italic("Stone: ")}${f.bold(r)}`,...l.map(Oe)].join(`
1010
+ `)),t){$.info(`${f.bold(f.yellow("[dry-run]"))}
460
1011
  Stone file preview:
461
- ${l.join(`
462
- `)}`);return}if(!n.yes)await Ni();let p=await j();p.stones.push(f),await Hi(f,l,p),L(`Now you can run ${m.green("bunx @r5n/sisyphus roll")} to release packages
463
- or create another stone with ${m.green("bunx @r5n/sisyphus version")}`,`${m.bold("Stone ")}${m.italic(`${f}.md`)} ${m.green("created!")}`)}catch(n){hn(n instanceof Error?n.message:String(n))}}async function Ci(n){let t=await fr(n.filter);if(t.length===0)return;let{packages:r}=await J({filter:n.filter}),s=await j(),i=0;for(let e of t){let o=[],c=[],a=[];for(let p of e.packages)switch(e.bump){case"major":o.push(p);break;case"minor":c.push(p);break;case"patch":case"dependency":a.push(p);break}let{stoneContent:l,stoneName:f}=await pn({majorPackages:o,message:e.message,minorPackages:c,packages:r,patchPackages:a,tag:n.tag});if(n.dryRun)$.info(`${m.bold(m.yellow("[dry-run]"))}
1012
+ ${m.join(`
1013
+ `)}`);return}if(!e.yes)await Cc();let g=await j();g.stones.push(u),await Sc(u,m,g),P(`Now you can run ${f.green("bunx @r5n/sisyphus roll")} to release packages
1014
+ or create another stone with ${f.green("bunx @r5n/sisyphus version")}`,`${f.bold("Stone ")}${f.italic(`${u}.md`)} ${f.green("created!")}`)}catch(e){je(e instanceof Error?e.message:String(e))}}async function kc(e){let t=await Ho(e.filter);if(t.length===0)return;let{packages:n,privatePackageCount:o}=await G({filter:e.filter});if(o>0)$.info(f.dim(`Note: ${o} private package${o>1?"s":""} excluded from versioning`));let i=await j(),r=0;for(let s of t){let a=[],c=[],l=[];for(let g of s.packages)switch(s.bump){case"major":a.push(g);break;case"minor":c.push(g);break;case"patch":case"dependency":l.push(g);break}let{stoneContent:m,stoneName:u}=await le({majorPackages:a,message:s.message,minorPackages:c,packages:n,patchPackages:l,tag:e.tag});if(e.dryRun)$.info(`${f.bold(f.yellow("[dry-run]"))}
464
1015
  Stone file preview:
465
- ${l.join(`
466
- `)}`);else s.stones.push(f),await Bun.write(`.sisyphus/stones/${f}.md`,l.join(`
467
- `)),i++}if(!n.dryRun&&i>0)await Bun.write(".sisyphus/config.json",`${JSON.stringify(s,null,2)}
468
- `),L(`Created ${m.bold(String(i))} stone${i>1?"s":""} from commits.
469
- Run ${m.green("bunx @r5n/sisyphus preview")} to see what will be released`,m.green("Success!"))}var Qn=["init","check","version","roll","stone","preview","prerelease","graph","help"],On=v({prefix:"sisyphus"}),Li={c:"check",cheack:"check",chekc:"check",g:"graph",graf:"graph",grah:"graph",h:"help",i:"init",initialise:"init",inti:"init",intialize:"init",p:"preview",pr:"prerelease",pre:"preview",preivew:"preview",prerelease:"prerelease",publish:"roll",r:"roll",relase:"release",release:"roll",rool:"roll",s:"stone",st:"stone",state:"check",status:"check",stones:"stone",v:"version",ver:"version",verison:"version"};async function qi(){try{let[,,n,...t]=process.argv;if(!n||n==="--help"||n==="-h"){Kn();return}let r=n;if(!Qn.includes(n)){let s=qn(n,Li);if(s&&Qn.includes(s))r=s,On.warn(`Assuming you meant '${s}'`)}if(!Qn.includes(r)){On.error(`Unknown command: ${n}`);let s=Ln(n,Qn);if(s.length>0){On.error("Did you mean one of these?");for(let i of s)On.error(` ${i}`)}On.error("Run 'sisyphus --help' for usage information"),process.exit(1)}if(t.includes("--help")||t.includes("-h")){Kn(r);return}switch(r){case"init":await Qt();break;case"check":await Xt();break;case"version":await mr();break;case"roll":await Jt();break;case"stone":await cr();break;case"preview":await Vt();break;case"prerelease":await Tt();break;case"graph":await zt();break;case"help":{let s=t[0];Kn(s);break}default:throw new Error(`Unknown command: ${r}`)}}catch(n){Gt(n)}}await qi();
1016
+ ${m.join(`
1017
+ `)}`);else i.stones.push(u),await Bun.write(`.sisyphus/stones/${u}.md`,m.join(`
1018
+ `)),r++}if(!e.dryRun&&r>0)await Bun.write(".sisyphus/config.json",`${JSON.stringify(i,null,2)}
1019
+ `),P(`Created ${f.bold(String(r))} stone${r>1?"s":""} from commits.
1020
+ Run ${f.green("bunx @r5n/sisyphus preview")} to see what will be released`,f.green("Success!"))}var wt=["init","check","changeset","version","roll","solo","stone","preview","prerelease","graph","metrics","insights","migrate","pr","setup","help"],We=v({prefix:"sisyphus"}),Rc={c:"check",change:"changeset",changes:"changeset",cheack:"check",chekc:"check",cs:"changeset",g:"graph",graf:"graph",grah:"graph",h:"help",i:"init",initialise:"init",inti:"init",intialize:"init",m:"metrics",metric:"metrics",mig:"migrate",migration:"migrate",p:"preview",pr:"prerelease",pre:"preview",preivew:"preview",prerelease:"prerelease",publish:"roll",r:"roll",relase:"release",release:"roll",rool:"roll",s:"stone",single:"solo",solo:"solo",st:"stone",state:"check",stats:"metrics",status:"check",stones:"stone",v:"version",ver:"version",verison:"version"};async function jc(){try{let[,,e,...t]=process.argv;if(e==="--version"||e==="-v"){console.log(fe);return}if(rs("@r5n/sisyphus",fe),!e||e==="--help"||e==="-h"){mt();return}let n=e;if(!wt.includes(e)){let o=tt(e,Rc);if(o&&wt.includes(o))n=o,We.warn(`Assuming you meant '${o}'`)}if(!wt.includes(n)){We.error(`Unknown command: ${e}`);let o=et(e,wt);if(o.length>0){We.error("Did you mean one of these?");for(let i of o)We.error(` ${i}`)}We.error("Run 'sisyphus --help' for usage information"),process.exit(1)}if(t.includes("--help")||t.includes("-h")){mt(n);return}switch(n){case"init":await Xs();break;case"check":await zs();break;case"changeset":await Gs();break;case"version":await To();break;case"roll":await Us();break;case"solo":await $o();break;case"stone":await Mo();break;case"preview":await ro();break;case"prerelease":await io();break;case"graph":await Ks();break;case"metrics":await to();break;case"insights":await Qs();break;case"migrate":await so();break;case"pr":await oo();break;case"setup":await ho();break;case"help":{let o=t[0];mt(o);break}default:throw new Error(`Unknown command: ${n}`)}}catch(e){fs(e)}}await jc();