@r5n/sisyphus 0.4.0 → 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 +989 -636
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,667 +1,1020 @@
1
1
  #!/usr/bin/env bun
2
- var ie=Object.create;var{getPrototypeOf:ae,defineProperty:ln,getOwnPropertyNames:ce}=Object;var fe=Object.prototype.hasOwnProperty;var jt=(t,o,s)=>{s=t!=null?ie(ae(t)):{};let e=o||!t||!t.__esModule?ln(s,"default",{value:t,enumerable:!0}):s;for(let r of ce(t))if(!fe.call(e,r))ln(e,r,{get:()=>t[r],enumerable:!0});return e};var oo=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports);var me=(t,o)=>{for(var s in o)ln(t,s,{get:o[s],enumerable:!0,configurable:!0,set:(e)=>o[s]=()=>e})};var U=(t,o)=>()=>(t&&(o=t(t=0)),o);var le=import.meta.require;function hn(t){return(o)=>he?`${t}${o}${eo.reset}`:o}function so({bright:t=!1,color:o}){let s=Bun.color(o,"ansi");if(!s)return"";return t?ge[s]||s:s}var he,pe,ue,eo,ge,be,ye,h;var pn=U(()=>{he=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout.isTTY),pe=["blue","cyan","gray","green","magenta","red","white","yellow"],ue=["bold","dim","italic","underline","reset"],eo={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",underline:"\x1B[4m"},ge={"\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"};be=pe.reduce((t,o)=>{return t[o]=hn(so({color:o})),t[`${o}Bright`]=hn(so({bright:!0,color:o})),t},{}),ye=ue.reduce((t,o)=>{return t[o]=hn(eo[o]),t},{}),h={...be,...ye}});function Ct({prefix:t,level:o,message:s}){let e=new Date().toISOString().split("T")[1]?.split(".")[0]||"",r=t?`[${t}] `:"";return`${h.dim(e||"")} ${o} ${r}${s}`}var x=({prefix:t="",level:o=process.env.DEBUG?0:1}={})=>{function s(...a){if(o<=0){let c=a.join(" ");console.log(Ct({level:h.dim("DEBUG"),message:c,prefix:t}))}}function e(...a){if(o<=1){let c=a.join(" ");console.info(Ct({level:h.cyan("INFO "),message:c,prefix:t}))}}function r(...a){if(o<=2){let c=a.join(" ");console.warn(Ct({level:h.yellow("WARN "),message:c,prefix:t}))}}function i(...a){if(o<=3){let c=a.join(" ");console.error(Ct({level:h.red("ERROR"),message:c,prefix:t}))}}function n(a){return x({level:o,prefix:`${t}:${a}`})}return{child:n,debug:s,error:i,info:e,warn:r}},un;var ro=U(()=>{pn();un=x()});var P=U(()=>{pn();ro()});var f;var io=U(()=>{P();f={arrow:h.yellow,bold:h.bold,boolean:h.cyan,bullet:h.yellow,busy:h.yellow,command:h.green,dim:h.dim,error:h.red,flag:h.yellow,info:h.cyan,number:h.magenta,offline:h.red,online:h.green,separator:h.dim,string:h.green,success:h.green,value:h.cyan,warning:h.yellow}});var yn=oo((Ca,ao)=>{var bn={to(t,o){if(!o)return`\x1B[${t+1}G`;return`\x1B[${o+1};${t+1}H`},move(t,o){let s="";if(t<0)s+=`\x1B[${-t}D`;else if(t>0)s+=`\x1B[${t}C`;if(o<0)s+=`\x1B[${-o}A`;else if(o>0)s+=`\x1B[${o}B`;return s},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},de={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},we={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let o="";for(let s=0;s<t;s++)o+=this.line+(s<t-1?bn.up():"");if(t)o+=bn.left;return o}};ao.exports={cursor:bn,scroll:de,erase:we,beep:"\x07"}});var wn=oo((La,dn)=>{var Ht=process||{},co=Ht.argv||[],Lt=Ht.env||{},$e=!(!!Lt.NO_COLOR||co.includes("--no-color"))&&(!!Lt.FORCE_COLOR||co.includes("--color")||Ht.platform==="win32"||(Ht.stdout||{}).isTTY&&Lt.TERM!=="dumb"||!!Lt.CI),Se=(t,o,s=t)=>(e)=>{let r=""+e,i=r.indexOf(o,t.length);return~i?t+xe(r,o,s,i)+o:t+r+o},xe=(t,o,s,e)=>{let r="",i=0;do r+=t.substring(i,e)+s,i=e+o.length,e=t.indexOf(o,i);while(~e);return r+t.substring(i)},fo=(t=$e)=>{let o=t?Se:()=>String;return{isColorSupported:t,reset:o("\x1B[0m","\x1B[0m"),bold:o("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:o("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:o("\x1B[3m","\x1B[23m"),underline:o("\x1B[4m","\x1B[24m"),inverse:o("\x1B[7m","\x1B[27m"),hidden:o("\x1B[8m","\x1B[28m"),strikethrough:o("\x1B[9m","\x1B[29m"),black:o("\x1B[30m","\x1B[39m"),red:o("\x1B[31m","\x1B[39m"),green:o("\x1B[32m","\x1B[39m"),yellow:o("\x1B[33m","\x1B[39m"),blue:o("\x1B[34m","\x1B[39m"),magenta:o("\x1B[35m","\x1B[39m"),cyan:o("\x1B[36m","\x1B[39m"),white:o("\x1B[37m","\x1B[39m"),gray:o("\x1B[90m","\x1B[39m"),bgBlack:o("\x1B[40m","\x1B[49m"),bgRed:o("\x1B[41m","\x1B[49m"),bgGreen:o("\x1B[42m","\x1B[49m"),bgYellow:o("\x1B[43m","\x1B[49m"),bgBlue:o("\x1B[44m","\x1B[49m"),bgMagenta:o("\x1B[45m","\x1B[49m"),bgCyan:o("\x1B[46m","\x1B[49m"),bgWhite:o("\x1B[47m","\x1B[49m"),blackBright:o("\x1B[90m","\x1B[39m"),redBright:o("\x1B[91m","\x1B[39m"),greenBright:o("\x1B[92m","\x1B[39m"),yellowBright:o("\x1B[93m","\x1B[39m"),blueBright:o("\x1B[94m","\x1B[39m"),magentaBright:o("\x1B[95m","\x1B[39m"),cyanBright:o("\x1B[96m","\x1B[39m"),whiteBright:o("\x1B[97m","\x1B[39m"),bgBlackBright:o("\x1B[100m","\x1B[49m"),bgRedBright:o("\x1B[101m","\x1B[49m"),bgGreenBright:o("\x1B[102m","\x1B[49m"),bgYellowBright:o("\x1B[103m","\x1B[49m"),bgBlueBright:o("\x1B[104m","\x1B[49m"),bgMagentaBright:o("\x1B[105m","\x1B[49m"),bgCyanBright:o("\x1B[106m","\x1B[49m"),bgWhiteBright:o("\x1B[107m","\x1B[49m")}};dn.exports=fo();dn.exports.createColors=fo});import{stdin as $o,stdout as So}from"process";import*as ot from"readline";import mo from"readline";import{Writable as ve}from"stream";function Ee({onlyFirst:t=!1}={}){let o=["[\\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(o,t?void 0:"g")}function vo(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(je,"")}function Eo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rt(t,o={}){if(typeof t!="string"||t.length===0||(o={ambiguousIsNarrow:!0,...o},t=vo(t),t.length===0))return 0;t=t.replace(Ie()," ");let s=o.ambiguousIsNarrow?1:2,e=0;for(let r of t){let i=r.codePointAt(0);if(i<=31||i>=127&&i<=159||i>=768&&i<=879)continue;switch(Oe.eastAsianWidth(r)){case"F":case"W":e+=2;break;case"A":e+=s;break;default:e+=1}}return e}function _e(){let t=new Map;for(let[o,s]of Object.entries(M)){for(let[e,r]of Object.entries(s))M[e]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[e]=M[e],t.set(r[0],r[1]);Object.defineProperty(M,o,{value:s,enumerable:!1})}return Object.defineProperty(M,"codes",{value:t,enumerable:!1}),M.color.close="\x1B[39m",M.bgColor.close="\x1B[49m",M.color.ansi=lo(),M.color.ansi256=ho(),M.color.ansi16m=po(),M.bgColor.ansi=lo($n),M.bgColor.ansi256=ho($n),M.bgColor.ansi16m=po($n),Object.defineProperties(M,{rgbToAnsi256:{value:(o,s,e)=>o===s&&s===e?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(s/255*5)+Math.round(e/255*5),enumerable:!1},hexToRgb:{value:(o)=>{let s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(o.toString(16));if(!s)return[0,0,0];let[e]=s;e.length===3&&(e=[...e].map((i)=>i+i).join(""));let r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:(o)=>M.rgbToAnsi256(...M.hexToRgb(o)),enumerable:!1},ansi256ToAnsi:{value:(o)=>{if(o<8)return 30+o;if(o<16)return 90+(o-8);let s,e,r;if(o>=232)s=((o-232)*10+8)/255,e=s,r=s;else{o-=16;let a=o%36;s=Math.floor(o/36)/5,e=Math.floor(a/6)/5,r=a%6/5}let i=Math.max(s,e,r)*2;if(i===0)return 30;let n=30+(Math.round(r)<<2|Math.round(e)<<1|Math.round(s));return i===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(o,s,e)=>M.ansi256ToAnsi(M.rgbToAnsi256(o,s,e)),enumerable:!1},hexToAnsi:{value:(o)=>M.ansi256ToAnsi(M.hexToAnsi256(o)),enumerable:!1}}),M}function bo(t,o,s){return String(t).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((e)=>Ce(e,o,s)).join(`
5
- `)}function jn(t,o){if(typeof t=="string")return Jt.aliases.get(t)===o;for(let s of t)if(s!==void 0&&jn(s,o))return!0;return!1}function He(t,o){if(t===o)return;let s=t.split(`
6
- `),e=o.split(`
7
- `),r=[];for(let i=0;i<Math.max(s.length,e.length);i++)s[i]!==e[i]&&r.push(i);return r}function F(t){return t===xn}function qt(t,o){let s=t;s.isTTY&&s.setRawMode(o)}function Ao({input:t=$o,output:o=So,overwrite:s=!0,hideCursor:e=!0}={}){let r=ot.createInterface({input:t,output:o,prompt:"",tabSize:1});ot.emitKeypressEvents(t,r),t.isTTY&&t.setRawMode(!0);let i=(n,{name:a,sequence:c})=>{let m=String(n);if(jn([m,a,c],"cancel")){e&&o.write(J.cursor.show),process.exit(0);return}if(!s)return;ot.moveCursor(o,a==="return"?0:-1,a==="return"?-1:0,()=>{ot.clearLine(o,1,()=>{t.once("keypress",i)})})};return e&&o.write(J.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),e&&o.write(J.cursor.show),t.isTTY&&!qe&&t.setRawMode(!1),r.terminal=!1,r.close()}}class Ot{constructor(t,o=!0){z(this,"input"),z(this,"output"),z(this,"_abortSignal"),z(this,"rl"),z(this,"opts"),z(this,"_render"),z(this,"_track",!1),z(this,"_prevFrame",""),z(this,"_subscribers",new Map),z(this,"_cursor",0),z(this,"state","initial"),z(this,"error",""),z(this,"value");let{input:s=$o,output:e=So,render:r,signal:i,...n}=t;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=o,this._abortSignal=i,this.input=s,this.output=e}unsubscribe(){this._subscribers.clear()}setSubscriber(t,o){let s=this._subscribers.get(t)??[];s.push(o),this._subscribers.set(t,s)}on(t,o){this.setSubscriber(t,{cb:o})}once(t,o){this.setSubscriber(t,{cb:o,once:!0})}emit(t,...o){let s=this._subscribers.get(t)??[],e=[];for(let r of s)r.cb(...o),r.once&&e.push(()=>s.splice(s.indexOf(r),1));for(let r of e)r()}prompt(){return new Promise((t,o)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(xn);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let s=new ve;s._write=(e,r,i)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),i()},this.input.pipe(s),this.rl=mo.createInterface({input:this.input,output:s,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),mo.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),qt(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(J.cursor.show),this.output.off("resize",this.render),qt(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(J.cursor.show),this.output.off("resize",this.render),qt(this.input,!1),t(xn)})})}onKeypress(t,o){if(this.state==="error"&&(this.state="active"),o?.name&&(!this._track&&Jt.aliases.has(o.name)&&this.emit("cursor",Jt.aliases.get(o.name)),Jt.actions.has(o.name)&&this.emit("cursor",o.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),o?.name==="return"){if(this.opts.validate){let s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}jn([t,o?.name,o?.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
- `),qt(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=bo(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
9
- `).length-1;this.output.write(J.cursor.move(-999,t*-1))}render(){let t=bo(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(J.cursor.hide);else{let o=He(this._prevFrame,t);if(this.restoreCursor(),o&&o?.length===1){let s=o[0];this.output.write(J.cursor.move(0,s)),this.output.write(J.erase.lines(1));let e=t.split(`
10
- `);this.output.write(e[s]),this._prevFrame=t,this.output.write(J.cursor.move(0,e.length-s-1));return}if(o&&o?.length>1){let s=o[0];this.output.write(J.cursor.move(0,s)),this.output.write(J.erase.down());let e=t.split(`
11
- `).slice(s);this.output.write(e.join(`
12
- `)),this._prevFrame=t;return}this.output.write(J.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}var J,xo,je,jo,Re,Oe,Ae=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},Ie,$n=10,lo=(t=0)=>(o)=>`\x1B[${o+t}m`,ho=(t=0)=>(o)=>`\x1B[${38+t};5;${o}m`,po=(t=0)=>(o,s,e)=>`\x1B[${38+t};2;${o};${s};${e}m`,M,Pe,Be,Me,Wt,Ge=39,vn="\x07",Ro="[",Ne="]",Oo="m",En,uo=(t)=>`${Wt.values().next().value}${Ro}${t}${Oo}`,go=(t)=>`${Wt.values().next().value}${En}${t}${vn}`,Te=(t)=>t.split(" ").map((o)=>Rt(o)),Sn=(t,o,s)=>{let e=[...o],r=!1,i=!1,n=Rt(vo(t[t.length-1]));for(let[a,c]of e.entries()){let m=Rt(c);if(n+m<=s?t[t.length-1]+=c:(t.push(c),n=0),Wt.has(c)&&(r=!0,i=e.slice(a+1).join("").startsWith(En)),r){i?c===vn&&(r=!1,i=!1):c===Oo&&(r=!1);continue}n+=m,n===s&&a<e.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Ue=(t)=>{let o=t.split(" "),s=o.length;for(;s>0&&!(Rt(o[s-1])>0);)s--;return s===o.length?t:o.slice(0,s).join(" ")+o.slice(s).join("")},Ce=(t,o,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let e="",r,i,n=Te(t),a=[""];for(let[m,l]of t.split(" ").entries()){s.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=Rt(a[a.length-1]);if(m!==0&&(p>=o&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),p=0),(p>0||s.trim===!1)&&(a[a.length-1]+=" ",p++)),s.hard&&n[m]>o){let g=o-p,d=1+Math.floor((n[m]-g-1)/o);Math.floor((n[m]-1)/o)<d&&a.push(""),Sn(a,l,o);continue}if(p+n[m]>o&&p>0&&n[m]>0){if(s.wordWrap===!1&&p<o){Sn(a,l,o);continue}a.push("")}if(p+n[m]>o&&s.wordWrap===!1){Sn(a,l,o);continue}a[a.length-1]+=l}s.trim!==!1&&(a=a.map((m)=>Ue(m)));let c=[...a.join(`
13
- `)];for(let[m,l]of c.entries()){if(e+=l,Wt.has(l)){let{groups:g}=new RegExp(`(?:\\${Ro}(?<code>\\d+)m|\\${En}(?<uri>.*)${vn})`).exec(c.slice(m).join(""))||{groups:{}};if(g.code!==void 0){let d=Number.parseFloat(g.code);r=d===Ge?void 0:d}else g.uri!==void 0&&(i=g.uri.length===0?void 0:g.uri)}let p=Me.codes.get(Number(r));c[m+1]===`
14
- `?(i&&(e+=go("")),r&&p&&(e+=uo(p))):l===`
15
- `&&(r&&p&&(e+=uo(r)),i&&(e+=go(i)))}return e},Le,Jt,qe,xn,Je,We=(t,o,s)=>(o in t)?Je(t,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[o]=s,z=(t,o,s)=>(We(t,typeof o!="symbol"?o+"":o,s),s),Rn,Xe,ze,Ye=(t,o,s)=>(o in t)?ze(t,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[o]=s,yo=(t,o,s)=>(Ye(t,typeof o!="symbol"?o+"":o,s),s),Io,Ke,Ze=(t,o,s)=>(o in t)?Ke(t,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[o]=s,wo=(t,o,s)=>(Ze(t,typeof o!="symbol"?o+"":o,s),s),On,An;var In=U(()=>{J=jt(yn(),1),xo=jt(wn(),1);je=Ee();jo={exports:{}};(function(t){var o={};t.exports=o,o.eastAsianWidth=function(e){var r=e.charCodeAt(0),i=e.length==2?e.charCodeAt(1):0,n=r;return 55296<=r&&r<=56319&&56320<=i&&i<=57343&&(r&=1023,i&=1023,n=r<<10|i,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},o.characterLength=function(e){var r=this.eastAsianWidth(e);return r=="F"||r=="W"||r=="A"?2:1};function s(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}o.length=function(e){for(var r=s(e),i=0,n=0;n<r.length;n++)i=i+this.characterLength(r[n]);return i},o.slice=function(e,r,i){textLen=o.length(e),r=r||0,i=i||1,r<0&&(r=textLen+r),i<0&&(i=textLen+i);for(var n="",a=0,c=s(e),m=0;m<c.length;m++){var l=c[m],p=o.length(l);if(a>=r-(p==2?1:0))if(a+p<=i)n+=l;else break;a+=p}return n}})(jo);Re=jo.exports,Oe=Eo(Re),Ie=Eo(Ae);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);Pe=Object.keys(M.color),Be=Object.keys(M.bgColor);[...Pe];Me=_e(),Wt=new Set(["\x1B","\x9B"]),En=`${Ne}8;;`;Le=["up","down","left","right","space","enter","cancel"],Jt={actions:new Set(Le),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};qe=globalThis.process.platform.startsWith("win"),xn=Symbol("clack:cancel");Je=Object.defineProperty;Rn=class Rn extends Ot{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(o)=>{this.output.write(J.cursor.move(0,-1)),this.value=o,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Xe=new WeakMap;ze=Object.defineProperty,Io=class extends Ot{constructor(t){super(t,!1),yo(this,"options"),yo(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:o})=>o===t.cursorAt),0),this.on("key",(o)=>{o==="a"&&this.toggleAll()}),this.on("cursor",(o)=>{switch(o){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 t=this.value.length===this.options.length;this.value=t?[]:this.options.map((o)=>o.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter((o)=>o!==this._value):[...this.value,this._value]}},Ke=Object.defineProperty;On=class On extends Ot{constructor(t){super(t,!1),wo(this,"options"),wo(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:o})=>o===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(o)=>{switch(o){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}};An=class An extends Ot{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let t=this.value.slice(0,this.cursor),[o,...s]=this.value.slice(this.cursor);return`${t}${xo.default.inverse(o)}${s.join("")}`}get cursor(){return this._cursor}constructor(t){super(t),this.on("finalize",()=>{this.value||(this.value=t.defaultValue)})}}});import{stripVTControlCharacters as Pn}from"util";import K from"process";function Qe(){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,Xt,Bn,C=(t,o)=>Bn?t:o,Ve,_o,Mo,zt,ke,A,st,_n,Mn,Fe,Po,De,Fa,Bo,tr,nr,or,sr,er,rr,ir,Yt=(t)=>{switch(t){case"initial":case"active":return b.default.cyan(Ve);case"cancel":return b.default.red(_o);case"error":return b.default.yellow(Mo);case"submit":return b.default.green(zt)}},Gn=(t)=>{let{cursor:o,options:s,style:e}=t,r=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),n=Math.min(i,Math.max(r,5)),a=0;o>=a+n-3?a=Math.max(Math.min(o-n+3,s.length-n),0):o<a+2&&(a=Math.max(o-2,0));let c=n<s.length&&a>0,m=n<s.length&&a+n<s.length;return s.slice(a,a+n).map((l,p,g)=>{let d=p===0&&c,u=p===g.length-1&&m;return d||u?b.default.dim("..."):e(l,p+a===o)})},W=(t)=>new An({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let o=`${b.default.gray(A)}
16
- ${Yt(this.state)} ${t.message}
17
- `,s=t.placeholder?b.default.inverse(t.placeholder[0])+b.default.dim(t.placeholder.slice(1)):b.default.inverse(b.default.hidden("_")),e=this.value?this.valueWithCursor:s;switch(this.state){case"error":return`${o.trim()}
18
- ${b.default.yellow(A)} ${e}
19
- ${b.default.yellow(st)} ${b.default.yellow(this.error)}
20
- `;case"submit":return`${o}${b.default.gray(A)} ${b.default.dim(this.value||t.placeholder)}`;case"cancel":return`${o}${b.default.gray(A)} ${b.default.strikethrough(b.default.dim(this.value??""))}${this.value?.trim()?`
21
- ${b.default.gray(A)}`:""}`;default:return`${o}${b.default.cyan(A)} ${e}
22
- ${b.default.cyan(st)}
23
- `}}}).prompt(),G=(t)=>{let o=t.active??"Yes",s=t.inactive??"No";return new Rn({active:o,inactive:s,initialValue:t.initialValue??!0,render(){let e=`${b.default.gray(A)}
24
- ${Yt(this.state)} ${t.message}
25
- `,r=this.value?o:s;switch(this.state){case"submit":return`${e}${b.default.gray(A)} ${b.default.dim(r)}`;case"cancel":return`${e}${b.default.gray(A)} ${b.default.strikethrough(b.default.dim(r))}
26
- ${b.default.gray(A)}`;default:return`${e}${b.default.cyan(A)} ${this.value?`${b.default.green(_n)} ${o}`:`${b.default.dim(Mn)} ${b.default.dim(o)}`} ${b.default.dim("/")} ${this.value?`${b.default.dim(Mn)} ${b.default.dim(s)}`:`${b.default.green(_n)} ${s}`}
27
- ${b.default.cyan(st)}
28
- `}}}).prompt()},et=(t)=>{let o=(s,e)=>{let r=s.label??String(s.value);switch(e){case"selected":return`${b.default.dim(r)}`;case"active":return`${b.default.green(_n)} ${r} ${s.hint?b.default.dim(`(${s.hint})`):""}`;case"cancelled":return`${b.default.strikethrough(b.default.dim(r))}`;default:return`${b.default.dim(Mn)} ${b.default.dim(r)}`}};return new On({options:t.options,initialValue:t.initialValue,render(){let s=`${b.default.gray(A)}
29
- ${Yt(this.state)} ${t.message}
30
- `;switch(this.state){case"submit":return`${s}${b.default.gray(A)} ${o(this.options[this.cursor],"selected")}`;case"cancel":return`${s}${b.default.gray(A)} ${o(this.options[this.cursor],"cancelled")}
31
- ${b.default.gray(A)}`;default:return`${s}${b.default.cyan(A)} ${Gn({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(e,r)=>o(e,r?"active":"inactive")}).join(`
32
- ${b.default.cyan(A)} `)}
33
- ${b.default.cyan(st)}
34
- `}}}).prompt()},Kt=(t)=>{let o=(s,e)=>{let r=s.label??String(s.value);return e==="active"?`${b.default.cyan(Fe)} ${r} ${s.hint?b.default.dim(`(${s.hint})`):""}`:e==="selected"?`${b.default.green(Po)} ${b.default.dim(r)} ${s.hint?b.default.dim(`(${s.hint})`):""}`:e==="cancelled"?`${b.default.strikethrough(b.default.dim(r))}`:e==="active-selected"?`${b.default.green(Po)} ${r} ${s.hint?b.default.dim(`(${s.hint})`):""}`:e==="submitted"?`${b.default.dim(r)}`:`${b.default.dim(De)} ${b.default.dim(r)}`};return new Io({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(s){if(this.required&&s.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 s=`${b.default.gray(A)}
36
- ${Yt(this.state)} ${t.message}
37
- `,e=(r,i)=>{let n=this.value.includes(r.value);return i&&n?o(r,"active-selected"):n?o(r,"selected"):o(r,i?"active":"inactive")};switch(this.state){case"submit":return`${s}${b.default.gray(A)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>o(r,"submitted")).join(b.default.dim(", "))||b.default.dim("none")}`;case"cancel":{let r=this.options.filter(({value:i})=>this.value.includes(i)).map((i)=>o(i,"cancelled")).join(b.default.dim(", "));return`${s}${b.default.gray(A)} ${r.trim()?`${r}
38
- ${b.default.gray(A)}`:""}`}case"error":{let r=this.error.split(`
39
- `).map((i,n)=>n===0?`${b.default.yellow(st)} ${b.default.yellow(i)}`:` ${i}`).join(`
40
- `);return`${s+b.default.yellow(A)} ${Gn({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:e}).join(`
41
- ${b.default.yellow(A)} `)}
42
- ${r}
43
- `}default:return`${s}${b.default.cyan(A)} ${Gn({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:e}).join(`
44
- ${b.default.cyan(A)} `)}
45
- ${b.default.cyan(st)}
46
- `}}}).prompt()},I=(t="",o="")=>{let s=`
47
- ${t}
48
- `.split(`
49
- `),e=Pn(o).length,r=Math.max(s.reduce((n,a)=>{let c=Pn(a);return c.length>n?c.length:n},0),e)+2,i=s.map((n)=>`${b.default.gray(A)} ${b.default.dim(n)}${" ".repeat(r-Pn(n).length)}${b.default.gray(A)}`).join(`
50
- `);process.stdout.write(`${b.default.gray(A)}
51
- ${b.default.green(zt)} ${b.default.reset(o)} ${b.default.gray(Bo.repeat(Math.max(r-e-1,1))+tr)}
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(_)} `)}
52
42
  ${i}
53
- ${b.default.gray(nr+Bo.repeat(r+2)+or)}
54
- `)},Go=(t="")=>{process.stdout.write(`${b.default.gray(st)} ${b.default.red(t)}
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=`
47
+ ${e}
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
55
 
56
- `)},bt=(t="")=>{process.stdout.write(`${b.default.gray(ke)} ${t}
57
- `)},H=(t="")=>{process.stdout.write(`${b.default.gray(A)}
58
- ${b.default.gray(st)} ${t}
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
59
 
60
- `)},w,Da,yt=({indicator:t="dots"}={})=>{let o=Bn?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],s=Bn?80:120,e=process.env.CI==="true",r,i,n=!1,a="",c,m=performance.now(),l=(S)=>{let E=S>1?"Something went wrong":"Canceled";n&&q(E,S)},p=()=>l(2),g=()=>l(1),d=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",g),process.on("SIGTERM",g),process.on("exit",l)},u=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",g),process.removeListener("SIGTERM",g),process.removeListener("exit",l)},y=()=>{if(c===void 0)return;e&&process.stdout.write(`
61
- `);let S=c.split(`
62
- `);process.stdout.write(Xt.cursor.move(-999,S.length-1)),process.stdout.write(Xt.erase.down(S.length))},$=(S)=>S.replace(/\.+$/,""),v=(S)=>{let E=(performance.now()-S)/1000,R=Math.floor(E/60),T=Math.floor(E%60);return R>0?`[${R}m ${T}s]`:`[${T}s]`},j=(S="")=>{n=!0,r=Ao(),a=$(S),m=performance.now(),process.stdout.write(`${b.default.gray(A)}
63
- `);let E=0,R=0;d(),i=setInterval(()=>{if(e&&a===c)return;y(),c=a;let T=b.default.magenta(o[E]);if(e)process.stdout.write(`${T} ${a}...`);else if(t==="timer")process.stdout.write(`${T} ${a} ${v(m)}`);else{let Y=".".repeat(Math.floor(R)).slice(0,3);process.stdout.write(`${T} ${a}${Y}`)}E=E+1<o.length?E+1:0,R=R<o.length?R+0.125:0},s)},q=(S="",E=0)=>{n=!1,clearInterval(i),y();let R=E===0?b.default.green(zt):E===1?b.default.red(_o):b.default.red(Mo);a=$(S??a),t==="timer"?process.stdout.write(`${R} ${a} ${v(m)}
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
64
  `):process.stdout.write(`${R} ${a}
65
- `),u(),r()};return{start:j,stop:q,message:(S="")=>{a=$(S??a)}}},Nn=async(t,o)=>{let s={},e=Object.keys(t);for(let r of e){let i=t[r],n=await i({results:s})?.catch((a)=>{throw a});if(typeof o?.onCancel=="function"&&F(n)){s[r]="canceled",o.onCancel({results:s});continue}s[r]=n}return s};var N=U(()=>{In();In();b=jt(wn(),1),Xt=jt(yn(),1);Bn=Qe(),Ve=C("\u25C6","*"),_o=C("\u25A0","x"),Mo=C("\u25B2","x"),zt=C("\u25C7","o"),ke=C("\u250C","T"),A=C("\u2502","|"),st=C("\u2514","\u2014"),_n=C("\u25CF",">"),Mn=C("\u25CB"," "),Fe=C("\u25FB","[\u2022]"),Po=C("\u25FC","[+]"),De=C("\u25FB","[ ]"),Fa=C("\u25AA","\u2022"),Bo=C("\u2500","-"),tr=C("\u256E","+"),nr=C("\u251C","+"),or=C("\u256F","+"),sr=C("\u25CF","\u2022"),er=C("\u25C6","*"),rr=C("\u25B2","!"),ir=C("\u25A0","x"),w={message:(t="",{symbol:o=b.default.gray(A)}={})=>{let s=[`${b.default.gray(A)}`];if(t){let[e,...r]=t.split(`
66
- `);s.push(`${o} ${e}`,...r.map((i)=>`${b.default.gray(A)} ${i}`))}process.stdout.write(`${s.join(`
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(`
67
67
  `)}
68
- `)},info:(t)=>{w.message(t,{symbol:b.default.blue(sr)})},success:(t)=>{w.message(t,{symbol:b.default.green(er)})},step:(t)=>{w.message(t,{symbol:b.default.green(zt)})},warn:(t)=>{w.message(t,{symbol:b.default.yellow(rr)})},warning:(t)=>{w.warn(t)},error:(t)=>{w.message(t,{symbol:b.default.red(ir)})}},Da=`${b.default.gray(A)} `});function No(t,o){let s=ar[t]||"Unknown error";return o?`${s}: ${o}`:s}var ar;var Tn=U(()=>{ar={"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 To(t={}){let{errorPrefix:o="\u2717"}=t;return function s(e){if(F(e))dt.info("Operation cancelled"),process.exit(0);if(e instanceof Un){if(dt.error(`${o} ${e.message}`),e.code)dt.error(` Error code: ${e.code}`)}else if(e instanceof Error)dt.error(`${o} ${e.message}`);else dt.error(`${o} An unexpected error occurred`),dt.error(String(e));process.exit(1)}}var dt,Un;var Uo=U(()=>{N();P();Tn();dt=x({prefix:"cli-core"}).child("error");Un=class Un extends Error{code;context;constructor(t,o,s){let e=t.includes(".")&&!t.includes(" ")?No(t,s):t;super(e);this.code=o;this.context=s;this.name="CLIError"}}});var D,cr=(t,o)=>{let s=t.length,e=o.length,r=1<<s-1,i=-1,n=0,a=s,c=s;while(c--)D[t.charCodeAt(c)]|=1<<c;for(c=0;c<e;c++){let m=D[o.charCodeAt(c)],l=m|n;if(m|=(m&i)+i^i,n|=~(m|i),i&=m,n&r)a++;if(i&r)a--;n=n<<1|1,i=i<<1|~(l|n),n&=l}c=s;while(c--)D[t.charCodeAt(c)]=0;return a},fr=(t,o)=>{let s=o.length,e=t.length,r=[],i=[],n=Math.ceil(s/32),a=Math.ceil(e/32);for(let u=0;u<n;u++)i[u]=-1,r[u]=0;let c=0;for(;c<a-1;c++){let u=0,y=-1,$=c*32,v=Math.min(32,e)+$;for(let j=$;j<v;j++)D[t.charCodeAt(j)]|=1<<j;for(let j=0;j<s;j++){let q=D[o.charCodeAt(j)],S=i[j/32|0]>>>j&1,E=r[j/32|0]>>>j&1,R=q|u,T=((q|E)&y)+y^y|q|E,Y=u|~(T|y),k=y&T;if(Y>>>31^S)i[j/32|0]^=1<<j;if(k>>>31^E)r[j/32|0]^=1<<j;Y=Y<<1|S,k=k<<1|E,y=k|~(R|Y),u=Y&R}for(let j=$;j<v;j++)D[t.charCodeAt(j)]=0}let m=0,l=-1,p=c*32,g=Math.min(32,e-p)+p;for(let u=p;u<g;u++)D[t.charCodeAt(u)]|=1<<u;let d=e;for(let u=0;u<s;u++){let y=D[o.charCodeAt(u)],$=i[u/32|0]>>>u&1,v=r[u/32|0]>>>u&1,j=y|m,q=((y|v)&l)+l^l|y|v,S=m|~(q|l),E=l&q;if(d+=S>>>e-1&1,d-=E>>>e-1&1,S>>>31^$)i[u/32|0]^=1<<u;if(E>>>31^v)r[u/32|0]^=1<<u;S=S<<1|$,E=E<<1|v,l=E|~(j|S),m=S&j}for(let u=p;u<g;u++)D[t.charCodeAt(u)]=0;return d},Co=(t,o)=>{if(t.length<o.length){let s=o;o=t,t=s}if(o.length===0)return t.length;if(t.length<=32)return cr(t,o);return fr(t,o)};var Lo=U(()=>{D=new Uint32Array(65536)});function Zt(t,o,s=3){return o.map((i)=>({distance:Co(t.toLowerCase(),i.toLowerCase()),option:i})).filter(({distance:i})=>i<=Math.max(3,t.length/2)).sort((i,n)=>i.distance-n.distance).slice(0,s).map(({option:i})=>i)}function Qt(t,o){return o[t.toLowerCase()]||null}var Ho=U(()=>{Lo()});async function Cn(t,o={}){let{fallback:s,logLevel:e="warn",message:r="Operation failed gracefully"}=o;try{return await t()}catch(i){let n=i instanceof Error?i.message:String(i);if(qo[e](`${r}: ${n}`),s)try{await s()}catch(a){qo.error(`Fallback also failed: ${a instanceof Error?a.message:String(a)}`)}return}}var qo;var Jo=U(()=>{P();qo=x({prefix:"cli-core"}).child("graceful")});var Wo=U(()=>{P()});async function Xo(t,o={}){let s={...mr,...o},e=new Error("Operation failed");for(let r=1;r<=s.maxAttempts;r++)try{return await t()}catch(i){if(e=i instanceof Error?i:new Error(String(i)),!s.retryableErrors.some((c)=>e.message.toLowerCase().includes(c.toLowerCase()))||r===s.maxAttempts)throw e;s.onRetry(r,e);let a=Math.min(s.initialDelay*s.backoffMultiplier**(r-1),s.maxDelay);await new Promise((c)=>setTimeout(c,a))}throw e}var mr;var zo=U(()=>{P();mr={backoffMultiplier:2,initialDelay:1000,maxAttempts:3,maxDelay:30000,onRetry:(t,o)=>{un.warn(`Retry attempt ${t}: ${o.message}`)},retryableErrors:["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENOTFOUND","rate limit","429","503","502","504","npm ERR!","EPUBLISHCONFLICT"]}});var wt=(t)=>{return t.map=(o)=>wt((s)=>o(t(s))),t.or=(o)=>wt((s)=>{try{return t(s)}catch(e){return o(s)}}),t},Ln=()=>"bad banditype"(),Hn=(t)=>wt((o)=>typeof o===typeof t?o:Ln()),tt=()=>Hn(""),Yo=()=>Hn(!0),Vt=()=>Hn(),Ko=(t)=>wt((o)=>o instanceof t?o:Ln()),V=(t)=>Ko(Object).map((o)=>{let s={};for(let e in t){let r=t[e](o[e]);r!==void 0&&(s[e]=r)}return s}),At=(t)=>Ko(Array).map((o)=>o.map(t));function qn(t,o){return wt((s)=>{try{return t(s)}catch{try{return o(s)}catch{throw new Error("No matching schema in union")}}})}function it(t,o){return(s)=>{if(s===void 0)return o;return t(s)}}function Zo(t){return{parse(o){try{return t(o)}catch(s){throw new Error(s instanceof Error?s.message:"Validation failed")}},safeParse(o){try{return{data:t(o),success:!0}}catch(s){return{error:s instanceof Error?s:new Error("Validation failed"),success:!1}}},validator:t}}function kt(){return qn(Vt(),tt())}function lr(){return qn(Vt(),Yo())}function Jn(t){return it(tt(),t)}function It(t){return it(kt(),t)}function nt(t){return it(lr(),t)}function at(t){return qn(Vt(),t)}var Qo=()=>{};var B=U(()=>{io();Uo();Tn();Ho();Jo();Wo();zo();Qo()});import{join as hr}from"path";async function pr(t){let o=ko.get(t);if(o)return o;try{let s=t;if(t.startsWith("@sisyphus/"))s=t;else if(t.startsWith("./")||t.startsWith("../"))s=hr(process.cwd(),t);else if(!t.includes("/"))s=`sisyphus-plugin-${t}`;Ft.info(`Loading plugin: ${t}`);let e=await import(s),r=e.default||e;if(!r.name)throw new Error(`Plugin ${t} must export a 'name' property`);return ko.set(t,r),Ft.info(`Loaded plugin: ${r.name} ${r.version?`v${r.version}`:""}`),r}catch(s){throw Ft.error(`Failed to load plugin ${t}:`,s),new Error(`Failed to load plugin ${t}: ${s}`)}}async function Fo(t){let o=[];for(let s of t)try{let e=await pr(s);o.push(e)}catch(e){Ft.warn(`Skipping plugin ${s} due to error:`,e)}return o}var Ft,ko;var Do=U(()=>{B();Ft=x({prefix:"sisyphus:plugins"}),ko=new Map});async function ts(t,o,...s){for(let e of t)if(e.hooks?.[o])try{$t.info(`Running ${o} hook for plugin: ${e.name}`),await e.hooks[o](...s)}catch(r){throw $t.error(`Error in ${o} hook for plugin ${e.name}:`,r),new Error(`Plugin ${e.name} failed in ${o}: ${r}`)}}async function ns(t,o,s){let e=o;for(let r of t)if(r.hooks?.modifyChangelog)try{$t.info(`Running modifyChangelog hook for plugin: ${r.name}`),e=await r.hooks.modifyChangelog(e,s)}catch(i){$t.error(`Error in modifyChangelog hook for plugin ${r.name}:`,i)}return e}async function os(t,o){let s=o;for(let e of t)if(e.hooks?.modifyConfig)try{$t.info(`Running modifyConfig hook for plugin: ${e.name}`),s=await e.hooks.modifyConfig(s)}catch(r){$t.error(`Error in modifyConfig hook for plugin ${e.name}:`,r)}return s}var $t;var ss=U(()=>{B();$t=x({prefix:"sisyphus:plugins"})});var ur,gr,br,yr,dr,Wn;var es=U(()=>{B();ur=V({commit:tt(),date:tt()}),gr=V({author:It("r5n-bot"),email:kt(),message:It("release(\uD83C\uDF89): <packageName@version>")}),br=V({commitAndPush:nt(!1),github:nt(!1),npm:nt(!1),tags:nt(!1)}),yr=V({append:nt(!0),filename:It("CHANGELOG.md"),generate:nt(!0),root:nt(!1),template:kt()}),dr=V({post:at(V({})),pre:at(V({}))}),Wn=Zo(V({$schema:Jn("https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json"),changelog:at(yr),commit:at(gr),configPath:It(".sisyphus"),ignore:it(At(tt()),[]),lastStone:ur,plugins:it(At(tt()),[]),release:at(br),scripts:at(dr),single:nt(!1),stones:it(At(tt()),[]),tag:Jn("latest")}))});var{$:is}=globalThis.Bun;async function wr(t,o){let s=o.scripts?.pre?.[t];if(!s)return;ct.info(`Running pre-${t} script: ${s}`);try{await is`${s}`.quiet(),ct.info(`Pre-${t} script completed`)}catch(e){throw ct.error(`Pre-${t} script failed:`,e),new Error(`Pre-${t} script failed: ${e}`)}}async function rs(t,o){let s=o.scripts?.post?.[t];if(!s)return;ct.info(`Running post-${t} script: ${s}`);try{await is`${s}`.quiet(),ct.info(`Post-${t} script completed`)}catch(e){ct.error(`Post-${t} script failed:`,e),ct.warn(`Continuing despite post-${t} script failure`)}}async function as(t,o,s){await wr(t,o);try{let e=await s();return await rs(t,o),e}catch(e){throw await rs(t,o),e}}var ct;var cs=U(()=>{B();ct=x({prefix:"sisyphus:scripts"})});var St=()=>{};function ft(t){let o=t.match(/^([~^]?)(\d+)\.(\d+)\.(\d+)(.*)$/);if(!o)return null;let[,s="",e="0",r="0",i="0"]=o;return{major:parseInt(e,10),minor:parseInt(r,10),patch:parseInt(i,10),prefix:s||"",version:`${e}.${r}.${i}`}}function Xn(t,o){let s=ft(t),e=ft(o);if(!s||!e)return!1;if(!e.prefix)return s.version===e.version;if(e.prefix==="^")if(e.major>0)return s.major===e.major&&(s.minor>e.minor||s.minor===e.minor&&s.patch>=e.patch);else if(e.minor>0)return s.major===0&&s.minor===e.minor&&s.patch>=e.patch;else return s.major===0&&s.minor===0&&s.patch===e.patch;if(e.prefix==="~")return s.major===e.major&&s.minor===e.minor&&s.patch>=e.patch;return!1}function zn(t,o,s){let e=ft(t),r=ft(o);if(!e||!r)return $r.warn(`Could not parse version constraint: ${t} -> ${o}`),o;if(s?.preserveConstraintType&&e.prefix)return`${e.prefix}${o}`;if(r.major>e.major)return r.major===0?o:`^${o}`;else if(r.minor>e.minor)return e.prefix==="^"?`^${o}`:o;else return e.prefix?`${e.prefix}${o}`:o}function fs(t){let o=ft(t);return o?o.version:t}function ms(t,o){return!Xn(o,t)}function ls(t,o,s){let e={...t};for(let[r,i]of Object.entries(o))if(r in e&&e[r])e[r]=zn(e[r],i,s);return e}var $r;var hs=U(()=>{P();$r=x({prefix:"sisyphus"}).child("version-constraints")});var Vn={};me(Vn,{versionBumper:()=>X,updateVersionConstraint:()=>zn,updateSisyphusConfig:()=>Qn,updateDependencyVersions:()=>ls,satisfiesConstraint:()=>Xn,runWithScripts:()=>as,runPluginHook:()=>ts,parseVersionConstraint:()=>ft,modifyConfigWithPlugins:()=>os,modifyChangelogWithPlugins:()=>ns,lineSplitter:()=>Yn,isInteractive:()=>Kn,isBreakingChange:()=>ms,handleCancel:()=>xt,getStones:()=>Z,getSisyphusConfig:()=>O,getPlugins:()=>Sr,getPackages:()=>L,getPackageUpdateLabel:()=>Pt,getMinimumVersion:()=>fs,ensureDryRunInTest:()=>Zn,bumpTypeOrder:()=>mt,bumpTypeAnnotation:()=>lt,SNAPSHOT_DATE_REGEX:()=>us,SNAPSHOT_DATE_LENGTH:()=>gs,ISO_DATE_SEPARATOR:()=>ps,DEFAULT_SNAPSHOT_TAG:()=>bs});var{$:tn}=globalThis.Bun;function Kn({stream:t=process.stdout}={}){return Boolean(t?.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function xt(t){if(typeof t==="function")t();else Go(t||"Operation cancelled by user");process.exit(0)}function Zn(t){return t}async function O({overwrite:t,tag:o,dryRun:s,silent:e,configPath:r=".sisyphus",...i}={}){let n=`./${r}/config.json`,c=await Bun.file(n).exists(),m=c&&t,l=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim();if(l.length===0)throw new Error("Couldn't find git repository. Have you initialized git repository?");let p;if(c)try{let u=await Bun.file(".sisyphus/config.json").json(),y=Wn.safeParse(u);if(!y.success)throw nn.error("Configuration validation failed:",u,y),y.error instanceof Error?new Error(`Invalid configuration file: ${y.error.message}`):y.error;p=y.data}catch(u){if(u instanceof Error)throw new Error(`Invalid configuration file: ${u.message}`);throw new Error("Failed to parse configuration file")}else p=Wn.parse({$schema:"https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json",ignore:[],lastStone:{commit:l,date:new Date().toISOString().split(ps)[0]||""},stones:[],tag:o||"latest"});let g={...p,...i},d=`${JSON.stringify(g,null,2)}
69
- `;if(s){if(!e)nn.info(`${h.bold(h.yellow("[dry-run]"))}
70
- ${h.italic(".sisyphus/config.json")}:
71
- ${d}`);return{...p,...i}}if(m)try{await tn`rm -rf ${r}`.quiet()}catch{}if(c&&!t)return g;return await tn`mkdir -p ${r}`.quiet(),await Bun.write(n,d),g}async function Sr(t){if(Dt)return Dt;let o=t||await O();return Dt=await Fo(o.plugins||[]),Dt}async function Qn({dryRun:t,silent:o,configPath:s,...e}){let r=await O({configPath:s}),i=`./${s||r.configPath||".sisyphus"}/config.json`,n=`${JSON.stringify({...r,...e},null,2)}
72
- `;if(t){if(!o)nn.info(`${h.bold(h.yellow("[dry-run]"))}
73
- ${h.italic(i)} would be updated to
74
- ${n}`);return}await Bun.write(i,n),I(`${h.green("Sisyphus config updated!")}`)}function Pt({name:t,version:o,bump:s,tag:e}){return`${t}@${o} => ${h.green(X({bump:s,tag:e,version:o}))} ${lt[s]}`}function xr({baseVersion:t,bump:o}){let[s="0",e="0",r="0"]=t.split(".");switch(o){case"major":return`${Number.parseInt(s,10)+1}.0.0`;case"minor":return`${s}.${Number.parseInt(e,10)+1}.0`;case"dependency":case"patch":return`${s}.${e}.${Number.parseInt(r,10)+1}`;default:return`${s}.${e}.${r}`}}function X({version:t="",bump:o,tag:s}){let[e="0.0.0",r=""]=t.split("-"),[i="",n="0"]=r.split(".");if(o==="snapshot"){let a=new Date().toISOString().replace(us,"").slice(0,gs);return`0.0.0-${s||bs}-${a}`}if(s&&!o){let a=s===i?Number.parseInt(n,10)+1:1;return`${e}-${s}.${a}`}if(s||o==="dependency"&&i){let a=s===i?Number.parseInt(n,10)+1:1;return`${e}-${s||i}.${a}`}return xr({baseVersion:e,bump:o})}async function Z({dryRun:t,silent:o,configPath:s,testModeEnabled:e}={}){let r=e,i=await O({configPath:s,dryRun:t,silent:o}),n=r&&s?`${s}/stones`:`./${s||i.configPath||".sisyphus"}/stones`;try{let c=(await tn`ls ${n} 2>/dev/null || true`.quiet()).stdout.toString().trim();if(!c)return[];return c.split(`
75
- `).filter(Boolean).map((l)=>l.replace(".md",""))}catch(a){if(!t)await tn`mkdir -p ${n}`.quiet();return[]}}async function L({filter:t,single:o}={}){let s=process.cwd(),e=await Bun.file("package.json").json();if(o)return Er(e);let r=e?.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: ${s})
76
-
77
- If you want to run Sisyphus in single-mode/root package, use --single flag or set \`"single": true\` in .sisyphus/config.json.`);let{packages:i,privatePackageCount:n}=await vr({cwd:s,workspaces:r}),a=Object.keys(i);return{packageNames:t?a.filter((c)=>c.includes(t)):a,packages:i,privatePackageCount:n}}async function vr({workspaces:t,cwd:o}){let s={},e={},r=0;for(let i of t){let n=new Bun.Glob(`${i}/package.json`).scanSync({cwd:o});for(let a of n){let{name:c,version:m,private:l,dependencies:p={},devDependencies:g={}}=await Bun.file(a).json();if(l){nn.debug(`Skipping private package: ${c}`),r++;continue}let u=Object.entries({...p,...g}).map(([y,$])=>$.startsWith("workspace")?y:"").filter(Boolean);for(let y of u)if(e[y]||=[],!e[y].includes(c))e[y].push(c);s[c]={bump:"dependency",dependencyOf:[],file:a,name:c,version:m}}}for(let[i,n]of Object.entries(e))if(s[i])s[i].dependencyOf=n;return{packages:s,privatePackageCount:r}}function Er({name:t,version:o}){return{packageNames:[t],packages:{[t]:{bump:"dependency",dependencyOf:[],file:"package.json",name:t,version:o||"0.0.0"}},privatePackageCount:0}}var nn,Yn="***",ps=".",us,gs=14,bs="nightly",mt,lt,Dt=null;var _=U(()=>{N();P();Do();ss();es();cs();St();hs();nn=x({prefix:"sisyphus"}).child("helpers"),us=/[.ZT:-]/g,mt=["dependency","patch","minor","major","snapshot"],lt={dependency:"\uD83D\uDCE6",patch:"\uD83D\uDC1B",minor:"\u2728",major:"\uD83D\uDEA8",snapshot:"\uD83D\uDCF8"}});B();P();B();B();var Vo=To({errorPrefix:"\u2717"});N();B();P();_();N();P();_();import{parseArgs as Cr}from"util";var{$:Q}=globalThis.Bun;B();P();_();var Bt=x({prefix:"sisyphus"}).child("changelog");async function ds({changelogRoot:t,commit:o,dryRun:s=!1,stones:e}){let r=[""],{lastStone:{commit:i=""}}=await O(),n=jr({stones:e});for(let[a,{bump:c,path:m,changelog:l}]of n.entries()){let p=[...l,ys({commit:o,lastCommit:i})],g=await Bun.file(m).exists(),[d,...u]=g?(await Bun.file(m).text()).split(`
78
- `):[`# ${a}`],y=[d,...p,...u];if(s)Bt.info(`${h.bold(h.yellow("[dry-run]"))}
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]"))}
79
87
  ${y.join(`
80
- `)}`);else if(!await Cn(async()=>{return Bt.info(`Writing changelog to ${m}`),await Bun.write(m,`${y.join(`
88
+ `)}`);else if(!await Kt(async()=>{return Ge.info(`Writing changelog to ${l}`),await Bun.write(l,`${y.join(`
81
89
  `).trimEnd()}
82
- `),!0},{logLevel:"error",message:`Failed to write changelog to ${m}`}))continue;let[$="",,,v=""]=l;if(!r.includes(v))r.unshift(v);r.push(`### ${lt[c]} ${a}@${$.slice(7)}`)}if(t){let a=Bun.file("CHANGELOG.md"),c=await a.exists(),[m,...l]=c?(await a.text()).split(`
83
- `):["# Changelog"],p=[m,"",...r,...l,ys({commit:o,lastCommit:i,root:!0})];if(s)Bt.info(`${h.bold(h.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]"))}
84
92
  Root changelog:
85
- ${p.join(`
86
- `)}`);else await Cn(async()=>{Bt.info(`Writing root changelog to ${a.name}`),await Bun.write(a,p.join(`
87
- `))},{logLevel:"error",message:"Failed to write root changelog"})}}function jr({stones:t}){let o=new Map;for(let{tag:s,packages:e,message:r}of t)for(let{file:i,name:n,version:a,bump:c}of e){let m=X({bump:c,tag:s,version:a}),{bump:l,path:p,changelog:g}=o.get(n)??{bump:c,changelog:[],path:i.replace("package.json","CHANGELOG.md")},[d="",,,u=""]=g,y=[d.replace("### ","")||"0.0.0",m].sort(Bun.semver.order)[1];o.set(n,{bump:l,changelog:[`### ${lt[c]} ${y}`,"",g.length>0?"__Stones:__":"__Stone:__",`_${r}${u?`, ${u.replace(/_/g,"")}_`:"_"}`],path:p})}return o}var kn="#@!";function ys({root:t,lastCommit:o,commit:s}){let e=(()=>{try{return Bun.spawnSync(["git","remote","get-url","origin"]).stdout.toString().trim().split(":")[1]?.replaceAll(".git","")||""}catch{return""}})(),i=(()=>{try{return Bun.spawnSync(["git","log",`--pretty=format:%H${kn}%s${kn}%cn`,`${o}..${s}`]).stdout.toString()}catch{return Bt.warn("Could not get git commit history"),""}})().split(`
88
- `).map((n)=>{if(n.length===0)return;let[a="",c="",m=""]=n.split(kn);return`- ${e?`[${a.slice(0,7)} ${c}](https://github.com/${e}/commit/${a})`:c} (by [@${m}](https://github.com/${m}))`}).filter(Boolean);return i.length>0?`
89
- <details><summary>${i.length} ${t?"Commits in this release":"Commits since last stone"}:</summary>
90
- ${i.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(`
91
99
  `)}
92
- </details>`:""}N();P();var Rr=/github\.com[:/]([^/]+)\/([^/]+)/;async function Or(){if(process.env.GITHUB_REPOSITORY){let[t,o]=process.env.GITHUB_REPOSITORY.split("/");return{owner:t,repo:o}}try{let t=await Bun.file("package.json").json(),o=t.repository?.url||t.repository;if(typeof o==="string"){let s=o.replace("git+","").replace(".git","").replace("git@github.com:","https://github.com/"),[,e,r]=s.match(Rr)||[];return{owner:e,repo:r}}}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 ws({token:t,tag:o,name:s,body:e}){let{owner:r,repo:i}=await Or();if(!(r&&i))throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.");let n=`https://api.github.com/repos/${r}/${i}/releases`;try{let a=await fetch(n,{body:JSON.stringify({body:`${s}
93
-
94
- ${e||""}`,draft:!1,name:s,prerelease:o.includes("-"),tag_name:o}),headers:{Accept:"application/vnd.github.v3+json",Authorization:`Bearer ${t}`,"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 $s({dryRun:t,github:o,githubToken:s,packages:e,rootTag:r,withTags:i}){if(t){w.info("Skipping git operations in dry run mode");return}if(Ar(i,e),Ir(r),o)await Pr({githubToken:s,packages:e,rootTag:r,withTags:i})}function Ar(t,o){if(!t)return;for(let{name:s,version:e}of Object.values(o)){let r=`${s}@${e}`;if(Bun.spawnSync(["git","tag",r,"-m",`Release ${r}`,"-f"]).exitCode!==0)w.error(`Failed to create git tag ${r}`)}}function Ir(t){if(!t)return;let o=Bun.spawnSync(["git","tag",t,"-m","Release","-f"]);if(o.exitCode!==0)w.error(`Failed to create root tag ${t}: ${o.stderr?Buffer.from(o.stderr).toString():"Unknown error"}`)}async function Pr({githubToken:t,packages:o,rootTag:s,withTags:e}){let r=t||process.env.GITHUB_TOKEN;if(!r)return I(h.reset(h.bold(`${h.redBright("No Github token found.")}
95
- Please provide one by using ${h.cyanBright("--githubToken")} flag or by setting ${h.green("GITHUB_TOKEN")} environment variable.`)));try{await Br(r,e,o),await _r(r,s,o)}catch(i){return w.error(`Failed to create GitHub release:
96
- ${i instanceof Error?i.message:i}`),I(h.reset(h.bold(h.redBright("Failed to create GitHub release. Check your token and permissions."))))}}async function Br(t,o,s){if(!o)return;for(let e of Object.values(s)){let r=`${e.name}@${e.version}`;await ws({body:`Release of ${e.name} version ${e.version}`,name:`Release ${r}`,tag:r,token:t}),I(h.green(`\u2713 Created GitHub release for ${r}`))}}async function _r(t,o,s){if(!o)return;let e=Object.values(s).map((r)=>`- ${r.name}@${r.version}`).join(`
97
- `);await ws({body:`Packages included:
98
- ${e}`,name:`Release ${o}`,tag:o,token:t}),I(h.green(`\u2713 Created GitHub root release ${o}`))}N();B();P();_();var{$:Mr}=globalThis.Bun;async function Ss({packages:t,dryRun:o,npmToken:s}){let e=s||process.env.NPM_CONFIG_TOKEN||process.env.NPM_TOKEN;if(!(e||o))return I(h.reset(h.bold(`${h.redBright("No NPM token found.")}
99
- Please provide one by using ${h.cyanBright("--npmToken")} flag or by setting one of ${h.green("NPM_CONFIG_TOKEN")} or ${h.green("NPM_TOKEN")} environment variables.`)));await Gr({dryRun:o,packages:t,token:e})}async function Gr({packages:t,dryRun:o,token:s}){let e=await Nr();for(let{name:r,version:i,tag:n,file:a}of Object.values(t)){let c=yt();c.start(`${o?h.yellow("[dry-run]: Test "):""}Publishing ${h.magenta(r)}@${h.cyanBright(i)}...`),await Tr({cwd:a.replace("package.json","")});let m=await(async()=>{try{let l=Ur({dryRun:o,otp:e,tag:n});return await Xo(async()=>{let{stdout:p,exitCode:g}=Bun.spawnSync(l,{cwd:a.replace("package.json",""),env:{...process.env,NPM_CONFIG_TOKEN:s,NPM_TOKEN:s},stderr:"inherit"});if(g!==0)throw new Error(`npm publish failed with exit code ${g}`);return p},{onRetry:(p,g)=>{c.stop(),c.start(`${o?h.yellow("[dry-run]: Test "):""}Retrying publish ${h.magenta(r)}@${h.cyanBright(i)} (attempt ${p})...`)}}),`${h.green("Successfully published")} ${h.magenta(r)}@${h.cyanBright(i)}`}catch(l){return w.error(l instanceof Error?l.message:String(l)),`${h.bold(`${h.redBright("Failed")} ${h.magenta(r)}@${h.cyanBright(i)}`)}`}})();c.stop(`${o?h.yellow("[dry-run]: Test "):""}${m}`)}}async function Nr(){if(!Kn())return"";let t=await W({message:"Provide your NPM one-time password"});return F(t)?"":t}async function Tr({cwd:t}){try{let o=await Mr`cd ${t} && bun run build`.quiet();if(o.exitCode!==0)throw new Error(`Build failed with exit code ${o.exitCode}`)}catch(o){try{if(!(await Bun.file(`${t}/package.json`).json()).scripts?.build)return}catch{}w.warn(`${o instanceof Error?o.message:String(o)}:
100
- Error during build step. If you don't have a build step, you can ignore this message.`)}}function Ur({dryRun:t,tag:o,otp:s}){return["npm","publish","--access","public"].concat(o?["--tag",o]:[]).concat(t?["--dry-run"]:[]).concat(s?["--otp",s]:[])}var ht=x({prefix:"sisyphus"}).child("roll");function Lr(){let{values:t}=Cr({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 t}async function xs(){let t=Lr(),{dryRun:o,changelog:s,changelogRoot:e,github:r,githubToken:i,npm:n,npmToken:a,rootTag:c,withTags:m}=t,l=await O(),p=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),g=await(async()=>{try{return await _t()}catch{return[]}})();if(g.length===0)return I(h.reset(h.bold(`${h.redBright("No stones found.")}
101
- ${h.reset(`Run ${h.green("bunx @r5n/sisyphus")}${h.yellow(" version")} and create some first.`)}`)));if(typeof s==="boolean"?s:l.changelog?.generate)await ds({changelogRoot:typeof e==="boolean"?e:l.changelog?.root,commit:p,dryRun:o,stones:g});let d=await Hr({dryRun:o,stones:g});if(typeof n==="boolean"?n:l.release?.npm)await Ss({dryRun:o,npmToken:a,packages:d});let u=new Date().toISOString().split(".")[0]||"";if(await $s({dryRun:o,github:typeof r==="boolean"?r:l.release?.github,githubToken:i,packages:d,rootTag:c,withTags:typeof m==="boolean"?m:l.release?.tags}),await Qn({dryRun:o,lastStone:{commit:p,date:u},stones:[]}),!o)await Q`rm -rf .sisyphus/stones`.quiet();if(l.release?.commitAndPush){let y=Object.values(d).map((q)=>`${q.name}@${q.version}`).join(", "),$=l.commit?.message?l.commit.message.replace("{message}",y):`release(\uD83C\uDF89): ${y}`,{stdout:v}=await Q`git config user.name`.quiet(),{stdout:j}=await Q`git config user.email`.quiet();console.log(`git config user.name "${v.toString().trim()}"`,`git config user.email "${j.toString().trim()}"`),await Q`bun lint`.quiet(),await Q`git config user.name "Sisyphus"`,await Q`git config user.email "contact@r5n.dev"`,await Q`git commit --all -m "${$}"`,await Q`git push`,await Q`git config user.name "${v.toString().trim()}"`,await Q`git config user.email "${j.toString().trim()}"`}}async function _t({dryRun:t,silent:o,configPath:s,testModeEnabled:e}={}){let r=e,i=await Z({configPath:s,dryRun:t,silent:o}),{packages:n}=await L({single:r}),a=s||".sisyphus";if(r&&i.length===0&&s)try{let m=`${s}/stones`,p=(await Q`ls ${m} 2>/dev/null || true`.quiet()).stdout.toString().trim(),g=p?p.split(`
102
- `).filter(Boolean).map((d)=>d.replace(".md","")):[];if(g.length>0)return ht.info(`Found ${g.length} stones in test environment`),[{message:"Test stone config",name:g[0],packages:[{bump:"major",file:`${s}/workspace/packages/test-pkg/package.json`,name:"@test/pkg",version:"1.0.0"}],tag:"latest"}]}catch(m){ht.error(`Test directory read error: ${m}`)}let c=[];for(let m of i)try{let p=(await Bun.file(`${a}/stones/${m}.md`).text()).split(`
103
- `),[g]=p,d=g?.replace(/^#+\s*/,"")||"",u=p.findIndex((R)=>R.includes("|")&&R.includes(":---:"));if(u===-1){ht.error(`Failed to parse stone ${m} - could not find table format`);continue}let y=p[u-1],$=p[u+1];if(!y||!$){ht.error(`Failed to parse stone ${m} - invalid table structure`);continue}let v=y.split("|").map((R)=>R.trim()).filter(Boolean),j=$.split("|").map((R)=>R.trim()).filter(Boolean),q=[];for(let R=0;R<v.length;R++){let T=v[R],Y=j[R];if(Y){let k=Y.split(",").map((Ut)=>Ut.trim());for(let Ut of k)if(n[Ut])q.push({...n[Ut],bump:T})}}let S=p.find((R)=>R.trim().startsWith("_")&&R.trim().endsWith("_")),E=S?S.replace(/_/g,"").trim():"";c.push({message:d.trim(),name:m,packages:q,tag:E})}catch(l){ht.error(`Error processing stone ${m}
104
- ${l instanceof Error?l.message:String(l)}`)}return c}async function Hr({stones:t,dryRun:o=!1}){let s=[],e={};for(let{tag:i,packages:n,message:a}of t){s.push(a);for(let c of n){e[c.name]||=c;let m=e[c.name]||c;if(i)m.tag=i;m.bump=mt.indexOf(c.bump)>mt.indexOf(m.bump)?c.bump:m.bump,e[c.name]=m}}let r=Object.values(e).reduce((i,n)=>{return i[n.name]={...n,version:n.tag?X({tag:n.tag,version:X({bump:n.bump,version:n.version})}):X({bump:n.bump,version:n.version})},i},{});if(o)ht.info(`${h.bold(h.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]"))}
105
113
  Config for next release:
106
- Stones: ${s.join(", ")}
107
- ${JSON.stringify(r,null,2)}`);else{let i={};for(let[a,c]of Object.entries(r))try{let m=await Bun.file(c.file).json();i[a]={...c,version:m.version}}catch(m){ht.error(`Could not read current version for ${a}: ${m}`)}let{updateDependencyVersions:n}=await Promise.resolve().then(() => (_(),Vn));for(let{version:a,file:c,name:m}of Object.values(r)){let l=await Bun.file(c).json();l.version=a;for(let[p,g]of Object.entries(r)){if(p===m)continue;let d=await Bun.file(g.file).json(),u=!1;if(d.dependencies?.[m])d.dependencies=n(d.dependencies,{[m]:a},{preserveConstraintType:!0}),u=!0;if(d.devDependencies?.[m])d.devDependencies=n(d.devDependencies,{[m]:a},{preserveConstraintType:!0}),u=!0;if(d.peerDependencies?.[m])d.peerDependencies=n(d.peerDependencies,{[m]:a},{preserveConstraintType:!0}),u=!0;if(u)await Bun.write(g.file,`${JSON.stringify(d,null,2)}
108
- `)}await Bun.write(c,`${JSON.stringify(l,null,2)}
109
- `)}}return r}var vs=x({prefix:"sisyphus"}).child("check");async function Es(){let t=await import("util").then((d)=>d.parseArgs),{values:o}=t({allowPositionals:!0,args:Bun.argv,options:{debug:{type:"boolean"},json:{type:"boolean"}},strict:!1}),{json:s=!1,debug:e=!1}=o,r=Boolean(s);await O({dryRun:!0,silent:r});let{packages:i,packageNames:n,privatePackageCount:a}=await L(),{packages:c,packageNames:[m=""]}=await L({single:!0}),l=await _t({dryRun:!0,silent:r});if(e)vs.info("DEBUG: Stone configs:",JSON.stringify(l,null,2)),vs.info("DEBUG: Packages:",JSON.stringify(i,null,2));if(r){let d={packages:n.map((u)=>({name:u,version:i[u]?.version})),privatePackageCount:a,root:{name:m,version:c[m]?.version},stones:l.map((u)=>({message:u.message,name:u.name,packages:u.packages.map((y)=>({bump:y.bump,name:y.name,newVersion:X({bump:y.bump,tag:u.tag,version:y.version}),version:y.version})),tag:u.tag}))};console.log(JSON.stringify(d,null,2));return}let p=l.length>0?`${f.bold(f.success("Stones:"))}
110
- ${l.map((d)=>`${f.arrow("\u2192")} ${f.bold("Stone:")} ${f.number(d.name)}
111
- ${f.bold("Packages:")}
112
- ${d.packages.map((u)=>` ${lt[u.bump]} ${f.value(u.name)}@${f.success(X({bump:u.bump,tag:d.tag,version:u.version}))} ${f.dim(`(${u.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(`
113
121
  `)}`).join(`
114
122
 
115
- `)}`:"",g=c[m]?.version?`@${c[m]?.version}`:"";if(!r){let d=a>0?`
116
- ${f.dim(`(${a} private package${a>1?"s":""} excluded)`)}`:"";w.step(`${f.bold(f.success("Root package:"))} ${f.value(m)}${f.dim(g)}
117
- ${f.bold(f.success("Packages:"))}${d}
118
- ${n.map((u)=>{let y=i[u]?.version?`@${i[u]?.version}`:"";return` ${f.bullet("\u2022")} ${f.value(u)}${f.dim(y)}`}).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(`
119
127
  `)}
120
128
 
121
- ${p}`),I(f.success("Sisyphus check complete."))}}N();B();P();_();import{parseArgs as qr}from"util";var js=x({prefix:"sisyphus"}).child("graph");function Jr(){let{values:t}=qr({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:t.depth?parseInt(t.depth,10):void 0,filter:t.filter,json:t.json,showVersions:t["show-versions"]}}async function Rs(){try{let t=Jr(),{packages:o}=await L(),s=Wr(o);if(t.json){let r=Array.from(s.values());console.log(JSON.stringify(r,null,2));return}let e=s;if(t.filter)e=zr(s,t.filter,t.depth);Yr(e,t.showVersions)}catch(t){js.error("Failed to generate dependency graph:",t),process.exit(1)}}function Wr(t){let o=new Map;for(let[s,e]of Object.entries(t))o.set(s,{dependencies:[],dependents:e.dependencyOf||[],level:0,name:s,version:e.version});for(let s of o.values())for(let e of s.dependents){let r=o.get(e);if(r)r.dependencies.push(s.name)}return Xr(o),o}function Xr(t){let o=Array.from(t.values()).filter((r)=>r.dependencies.length===0),s=new Set,e=o.map((r)=>({level:0,node:r}));while(e.length>0){let r=e.shift();if(!r)continue;let{node:i,level:n}=r;if(s.has(i.name))continue;s.add(i.name),i.level=n;for(let a of i.dependents){let c=t.get(a);if(c&&!s.has(a))e.push({level:n+1,node:c})}}}function zr(t,o,s){let e=new Map,r=Array.from(t.values()).find((a)=>a.name.includes(o));if(!r)return js.warn(`No packages found matching filter: ${o}`),e;let i=[{currentDepth:0,node:r}],n=new Set;while(i.length>0){let a=i.shift();if(!a)continue;let{node:c,currentDepth:m}=a;if(n.has(c.name))continue;if(s!==void 0&&m>s)continue;if(n.add(c.name),e.set(c.name,c),!s||m<s)for(let l of[...c.dependencies,...c.dependents]){let p=t.get(l);if(p&&!n.has(l))i.push({currentDepth:m+1,node:p})}}return e}function Yr(t,o){let s=Array.from(t.values()),e=Math.max(...s.map((i)=>i.level));w.info(`Package Dependency Graph (${t.size} packages)`),console.log();for(let i=0;i<=e;i++){let n=s.filter((a)=>a.level===i);if(n.length===0)continue;console.log(f.dim(`Level ${i}:`));for(let a of n){let m=o?` ${f.dim(`(${a.version})`)}`:"";if(console.log(` ${f.value(a.name)}${m}`),a.dependents.length>0){let l=a.dependents.map((p)=>{return t.get(p)?f.success(p):f.dim(p)}).join(", ");console.log(` ${f.dim("\u2192")} ${l}`)}}console.log()}let r=Kr(t);if(r.length>0){console.log(f.warning("\u26A0\uFE0F Circular dependencies detected:"));for(let i of r)console.log(` ${i.join(" \u2192 ")} \u2192 ${i[0]}`);console.log()}}function Kr(t){let o=[],s=new Set,e=new Set;function r(i,n){if(e.has(i)){let c=n.indexOf(i);if(c!==-1){let m=n.slice(c),l=[...m].sort().join(",");if(!o.some((p)=>[...p].sort().join(",")===l))o.push(m)}return}if(s.has(i))return;s.add(i),e.add(i);let a=t.get(i);if(a)for(let c of a.dependencies)r(c,[...n,c]);e.delete(i)}for(let i of t.keys())if(!s.has(i))r(i,[i]);return o}B();var sn="0.4.0";var Os={check:`
122
- sisyphus check - Check current state and pending changes
123
-
124
- USAGE
125
- sisyphus check [options]
126
-
127
- OPTIONS
128
- -v, --verbose Show detailed information [boolean]
129
- -j, --json Output in JSON format [boolean]
130
- -d, --debug Show debug information [boolean]
131
-
132
- EXAMPLES
133
- # Show pending stones and current state
134
- sisyphus check
135
-
136
- # Show detailed change information
137
- sisyphus check --verbose
138
-
139
- # Output in JSON format
140
- sisyphus check --json
141
- `,graph:`
142
- sisyphus graph - Visualize monorepo package dependencies
143
-
144
- USAGE
145
- sisyphus graph [options]
146
-
147
- OPTIONS
148
- -j, --json Output in JSON format [boolean]
149
- -f, --filter <string> Filter to specific package [string]
150
- -d, --depth <number> Limit depth of dependency tree [number]
151
- -v, --show-versions Display package versions [boolean]
152
-
153
- EXAMPLES
154
- # Show full dependency graph
155
- sisyphus graph
156
-
157
- # Focus on specific package and its connections
158
- sisyphus graph --filter @org/core
159
-
160
- # Limit depth to direct dependencies only
161
- sisyphus graph --depth 1
162
-
163
- # Show with version numbers
164
- sisyphus graph --show-versions
165
-
166
- # Export as JSON for further processing
167
- sisyphus graph --json > dependencies.json
168
- `,init:`
169
- sisyphus init - Initialize Sisyphus in your project
170
-
171
- USAGE
172
- sisyphus init [options]
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.")}
173
132
 
174
- OPTIONS
175
- -f, --force Overwrite existing configuration [boolean]
176
-
177
- EXAMPLES
178
- # Initialize Sisyphus interactively
179
- sisyphus init
180
-
181
- # Reinitialize configuration
182
- sisyphus init --force
183
- `,insights:`
184
- sisyphus insights - Monorepo health analysis and insights
185
-
186
- USAGE
187
- sisyphus insights [options]
188
-
189
- OPTIONS
190
- -p, --package <name> Analyze specific package [string]
191
- -j, --json Output in JSON format [boolean]
192
-
193
- EXAMPLES
194
- # Show overall monorepo health
195
- sisyphus insights
196
-
197
- # Analyze specific package
198
- sisyphus insights --package @myorg/core
133
+ You can now start by creating a new stone by running ${f.reset(f.green("bunx @r5n/sisyphus"))}${f.blue(" version")}
134
+ and following the prompts.
199
135
 
200
- # Export insights as JSON
201
- sisyphus insights --json
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}
202
164
 
203
- METRICS
204
- - Package change frequency and staleness
205
- - Dependency health and circular dependencies
206
- - Release velocity and patterns
207
- - High-impact packages (many dependents)
208
- - Version mismatch detection
209
- `,metrics:`
210
- sisyphus metrics - View release metrics and statistics
211
-
212
- USAGE
213
- sisyphus metrics [options]
165
+ `}s+=`***
214
166
 
215
- OPTIONS
216
- -j, --json Output in JSON format [boolean]
217
- -d, --days <number> Number of days to analyze [number]
218
- -p, --package <string> Filter to specific package [string]
219
- -v, --detailed Show detailed package metrics [boolean]
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(`
182
+ `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(w,null,2)}
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}
220
392
 
221
- EXAMPLES
222
- # Show metrics for last 30 days
223
- sisyphus metrics
224
-
225
- # Show metrics for last 90 days
226
- sisyphus metrics --days 90
227
-
228
- # Show detailed metrics
229
- sisyphus metrics --detailed
230
-
231
- # Filter to specific package
232
- sisyphus metrics --package @org/core
233
-
234
- # Export as JSON
235
- sisyphus metrics --json > metrics.json
236
- `,migrate:`
237
- sisyphus migrate - Migrate from changesets, lerna, or standard-version
238
-
239
- USAGE
240
- sisyphus migrate [options]
241
-
242
- OPTIONS
243
- -s, --source <type> Source format (auto-detect if not specified) [string]
244
- -c, --clean Remove source files after migration [boolean]
245
- -d, --dry-run Preview migration without changes [boolean]
246
-
247
- EXAMPLES
248
- # Auto-detect and migrate from changesets
249
- sisyphus migrate
250
-
251
- # Migrate and clean up changesets
252
- sisyphus migrate --clean
253
-
254
- # Preview migration without making changes
255
- sisyphus migrate --dry-run
393
+ image: ${e.image}
256
394
 
257
- NOTES
258
- - Automatically detects changesets in .changeset directory
259
- - Converts YAML frontmatter to stone format
260
- - Preserves commit messages and summaries
261
- - Creates sequentially numbered stones
262
- `,pr:`
263
- sisyphus pr - Create a stone from a pull/merge request
264
-
265
- USAGE
266
- sisyphus pr [options]
267
-
268
- OPTIONS
269
- -u, --url <url> PR/MR URL to process [string]
270
- --github Force GitHub mode [boolean]
271
- --gitlab Force GitLab mode [boolean]
272
- -d, --dryRun Preview changes without creating stone[boolean]
273
- -y, --yes Skip confirmation prompt [boolean]
274
-
275
- EXAMPLES
276
- # Create stone from current branch's PR (requires gh CLI)
277
- sisyphus pr
278
-
279
- # Create stone from specific GitHub PR
280
- sisyphus pr --url https://github.com/owner/repo/pull/123
281
-
282
- # Create stone from GitLab MR
283
- sisyphus pr --url https://gitlab.com/owner/repo/-/merge_requests/123
284
-
285
- # Preview without creating stone
286
- sisyphus pr --dryRun
287
-
288
- NOTES
289
- - Automatically detects bump type from PR labels and title
290
- - Labels: breaking-change \u2192 major, feature \u2192 minor, bug/fix \u2192 patch
291
- - Determines affected packages from changed files
292
- - Requires GitHub CLI (gh) for GitHub integration
293
- `,prerelease:`
294
- sisyphus prerelease - Manage prerelease versions (alpha, beta, rc)
295
-
296
- USAGE
297
- sisyphus prerelease [options]
298
-
299
- OPTIONS
300
- -t, --type <type> Prerelease type (alpha/beta/rc/etc) [string]
301
- -b, --bump <type> Bump type (major/minor/patch) [string]
302
- -p, --promote Promote existing prereleases [boolean]
303
- -f, --filter <string> Filter packages [string]
304
- -d, --dryRun Preview changes [boolean]
305
- -y, --yes Skip confirmation [boolean]
306
-
307
- EXAMPLES
308
- # Create a new beta prerelease
309
- sisyphus prerelease --type beta
310
-
311
- # Promote prereleases (interactive UI)
312
- sisyphus prerelease --promote
313
-
314
- # Create alpha for specific packages
315
- sisyphus prerelease --type alpha --filter "@org/core"
316
-
317
- # Non-interactive prerelease creation
318
- sisyphus prerelease --type beta --bump minor --yes
395
+ variables:
396
+ NODE_VERSION: "${e.nodeVersion}"
397
+ NPM_CONFIG_CACHE: ".npm"
398
+ BILD_CACHE: ".bun"
319
399
 
320
- NOTES
321
- - Use --promote to advance versions (alpha \u2192 beta \u2192 rc \u2192 stable)
322
- - RC and Next are treated as equivalent, both graduate to stable
323
- - You can skip tiers (e.g., alpha \u2192 rc or alpha \u2192 stable)
324
- `,preview:`
325
- sisyphus preview - Preview what versions will be after rolling stones
326
-
327
- USAGE
328
- sisyphus preview [options]
329
-
330
- OPTIONS
331
- -j, --json Output in JSON format [boolean]
332
- -v, --verbose Show additional information [boolean]
333
-
334
- EXAMPLES
335
- # Preview release changes
336
- sisyphus preview
337
-
338
- # Show detailed preview
339
- sisyphus preview --verbose
340
-
341
- # Get preview as JSON
342
- sisyphus preview --json
343
- `,roll:`
344
- sisyphus roll - Roll the stones and release packages
345
-
346
- USAGE
347
- sisyphus roll [options]
348
-
349
- OPTIONS
350
- -d, --dry-run Preview changes without releasing [boolean]
351
- -t, --tag NPM dist-tag to use [string]
352
-
353
- EXAMPLES
354
- # Release packages with accumulated changes
355
- sisyphus roll
356
-
357
- # Preview release without publishing
358
- sisyphus roll --dry-run
359
-
360
- # Release with 'next' tag
361
- sisyphus roll --tag next
362
- `,solo:`
363
- sisyphus solo - Single maintainer workflow (version + roll)
364
-
365
- USAGE
366
- sisyphus solo [options]
367
-
368
- OPTIONS
369
- -t, --tag NPM dist-tag to use [string]
370
- -d, --dry-run Preview without releasing [boolean]
371
-
372
- EXAMPLES
373
- # Analyze commits and release immediately
374
- sisyphus solo
375
-
376
- # Preview what would be released
377
- sisyphus solo --dry-run
378
-
379
- # Release with 'next' tag
380
- sisyphus solo --tag next
381
-
382
- NOTES
383
- - Combines 'version --from-commits' and 'roll' in one command
384
- - Perfect for single maintainer projects
385
- - Skips stone accumulation phase
386
- - Uses conventional commits for version determination
387
- `,stone:`
388
- sisyphus stone - Manage pending stones
389
-
390
- USAGE
391
- sisyphus stone <command> [options]
392
-
393
- COMMANDS
394
- list View all pending stones with details
395
- delete <id> Remove a specific stone by ID
396
- show <id> Display full content of a stone
397
- edit <id> Modify stone content or versions
398
- merge Combine stones with conflict resolution
399
-
400
- EXAMPLES
401
- # List all pending stones
402
- sisyphus stone list
403
-
404
- # Delete a specific stone
405
- sisyphus stone delete stone-123
406
-
407
- # Show stone details
408
- sisyphus stone show stone-123
409
-
410
- # Merge stones interactively
411
- sisyphus stone merge
412
-
413
- Use 'sisyphus stone <command> --help' for more information about a command.
414
- `,version:`
415
- sisyphus version - Create a new version stone for next release
416
-
417
- USAGE
418
- sisyphus version [options]
419
-
420
- OPTIONS
421
- -b, --bump <type> Bump type (major/minor/patch) [string]
422
- -d, --dryRun Preview changes without creating stone[boolean]
423
- -f, --filter <string> Filter packages [string]
424
- --from-commits Generate from conventional commits [boolean]
425
- -s, --snapshot Create snapshot versions [boolean]
426
- -t, --tag <tag> Release tag [string]
427
- -y, --yes Skip confirmation prompt [boolean]
428
-
429
- EXAMPLES
430
- # Create version stone interactively
431
- sisyphus version
432
-
433
- # Generate stones from conventional commits
434
- sisyphus version --from-commits
435
-
436
- # Preview version changes
437
- sisyphus version --dryRun
438
-
439
- # Create with specific bump
440
- sisyphus version --bump minor --filter @org/core
441
- `};function en(t){if(t&&Os[t]){let s=Os[t].split(`
442
- `).map((e)=>{if(e.startsWith("sisyphus"))return f.bold(e);if(e==="USAGE"||e==="OPTIONS"||e==="EXAMPLES")return f.bold(e);if(e.startsWith(" -")){let r=e.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(r){let[,i="",n=""]=r,a=n.replace("(required)",f.error("(required)")).replace(/\(default: ([^)]+)\)/g,(c,m)=>f.dim(`(default: ${m})`)).replace(/\[boolean\]/g,f.boolean("[boolean]")).replace(/\[string\]/g,f.string("[string]")).replace(/\[number\]/g,f.number("[number]"));return` ${f.flag(i.padEnd(26))} ${a}`}}if(e.startsWith(" # "))return f.dim(e);if(e.startsWith(" sisyphus"))return` ${f.value(e.trim())}`;return e}).join(`
443
- `);console.log(s);return}console.log(`
444
- ${f.bold(`Sisyphus@${sn} - The rock-solid versioning system`)}
445
-
446
- ${f.bold("USAGE")}
447
- sisyphus <command> [options]
448
-
449
- ${f.bold("COMMANDS")}
450
- ${f.command("init")} Initialize Sisyphus in your project
451
- ${f.command("check")} Check current state and pending changes
452
- ${f.command("version")} Create a new version stone for next release
453
- ${f.command("roll")} Roll the stones and release packages
454
- ${f.command("solo")} Single-step release (version + roll)
455
- ${f.command("stone")} Manage pending stones (list, delete, edit, merge)
456
- ${f.command("preview")} Preview what versions will be after rolling
457
- ${f.command("prerelease")} Manage prerelease versions (alpha, beta, rc)
458
- ${f.command("graph")} Visualize monorepo package dependencies
459
- ${f.command("metrics")} View release metrics and statistics
460
- ${f.command("insights")} Analyze monorepo health and dependencies
461
- ${f.command("migrate")} Migrate from changesets/lerna/standard-version
462
- ${f.command("pr")} Create stones from pull requests
463
- ${f.command("help")} Show this help message
464
-
465
- Use ${f.value("sisyphus <command> --help")} for more information about a command.
466
- `)}N();P();import{parseArgs as Vr}from"util";N();P();_();St();async function As({single:t,tag:o,ignore:s}){let e=await Nn({commitAndPush:()=>G({active:"Yes, commit and push the release",inactive:"Skip commit",initialValue:!1,message:"Should `roll` command commit and push the release?"}),commitConfig:()=>G({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:r}})=>r?W({message:"Commit author",placeholder:"r5n-bot"}):void 0,commitEmail:({results:{commitConfig:r}})=>r?W({message:"Commit author email",placeholder:"r5n-bot@users.noreply.github.com"}):void 0,commitMessage:({results:{commitConfig:r}})=>r?W({message:"Commit message",placeholder:"release(\uD83C\uDF89): <packageName@version>"}):void 0,generateChangelog:()=>G({active:"Yes, Generate changelog",inactive:"Skip changelog",initialValue:!0,message:"Generate changelog for release?"}),releaseOnGitHub:()=>G({active:"Yes, create a GitHub release",inactive:"Skip GitHub release",initialValue:!1,message:"Create a release on GitHub when releasing packages?"}),releaseOnNPM:()=>G({active:"Yes, publish packages to NPM",inactive:"Skip NPM release",initialValue:!1,message:"Publish packages to NPM when releasing packages?"}),releaseTags:()=>G({active:"Yes, create tags for the release",inactive:"Skip tags",initialValue:!1,message:"Create tags for the release?"}),rootChangelog:({results:{generateChangelog:r}})=>r?G({active:"Yes, generate combined changelog",inactive:"Skip root changelog",initialValue:!0,message:"Generate combined changelog for monorepo?"}):void 0,single:()=>G({active:"Yes, setup for root package",inactive:"No, setup for monorepo workspace packages",initialValue:t,message:"Setup Sisyphus for only root package?"}),tag:()=>W({initialValue:o,message:"Tag used when versioning packages. Leave `latest` if you are not sure or want to release packages with latest tag.",placeholder:"latest"})},{onCancel:()=>xt()});return{commitAndPush:!!e.commitAndPush,commitAuthor:e.commitAuthor||"",commitConfig:!!e.commitConfig,commitEmail:e.commitEmail||"",commitMessage:e.commitMessage||"",generateChangelog:e.generateChangelog,releaseOnGitHub:!!e.releaseOnGitHub,releaseOnNPM:!!e.releaseOnNPM,releaseTags:!!e.releaseTags,rootChangelog:!!e.rootChangelog,single:e.single,tag:e.tag}}async function Is({bump:t,packages:o,packageNames:s,tag:e}){let r=Qr({packageNames:s,packages:o,tag:e}),i=`
467
- - ${h.dim(h.italic(`Press ${h.underline(h.bold(h.whiteBright("a")))} to select/unselect all, ${h.underline(h.bold(h.whiteBright("SPACE")))} to select/unselect, ${h.underline(h.bold(h.whiteBright("ARROWS")))} to move, ${h.underline(h.bold(h.whiteBright("ENTER")))} to confirm`))}
468
- `,n=t?[t]:["major","minor","patch"];w.info(i);let{message:a,majorPackages:c,minorPackages:m,patchPackages:l}=await Nn({majorPackages:()=>n.includes("major")?r({bump:"major"}):void 0,minorPackages:({results:{majorPackages:p}})=>n.includes("minor")?r({bump:"minor",filterPackages:p||[]}):void 0,patchPackages:({results:{majorPackages:p,minorPackages:g}})=>n.includes("patch")?r({bump:"patch",filterPackages:(p||[]).concat(g||[])}):void 0,message:()=>W({message:`Name of the stone. ${h.dim(h.italic("Default prefix or message can be configured in config."))}`,placeholder:"New feature"})},{onCancel:()=>xt()});return{majorPackages:c||[],message:a,minorPackages:m||[],patchPackages:l||[]}}function Qr({packageNames:t,tag:o,packages:s}){return({bump:e,filterPackages:r=[]})=>{let i=t.filter((a)=>!r?.includes(a)).map((a)=>({label:Pt({bump:e,name:a,tag:o,version:s[a]?.version||"0.0.0"}),value:a})),n={major:h.red,minor:h.yellow,patch:h.green};return i.length>0?Kt({initialValues:void 0,message:`Select packages for ${h.bold(n[e](e))} bump.`,options:i,required:!1}):void 0}}_();async function Ps(){let{values:{nonInteractive:t,overwrite:o,tag:s,single:e,ignore:r}}=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(t)await O({ignore:r,overwrite:o,single:e,tag:s});else{let{commitAndPush:i,commitAuthor:n,commitConfig:a,commitEmail:c,commitMessage:m,generateChangelog:l,releaseOnGitHub:p,releaseOnNPM:g,releaseTags:d,rootChangelog:u,single:y,tag:$}=await As({ignore:r,single:e,tag:s}),v={ignore:r,single:y,tag:$};if(a)v.commit={author:n,email:c,message:m};if(p||g||i)v.release={commitAndPush:i,github:p,npm:g,tags:d};if(l)v.changelog={generate:l,root:u};await O({overwrite:o,...v})}I(`${h.magenta(`${h.bold("Sisyphus ")}${h.underline(h.italic(`v${sn}`))}`)}${h.green(" is setup to roll stones.")}
469
-
470
- You can now start by creating a new stone by running ${h.reset(h.green("bunx @r5n/sisyphus"))}${h.blue(" version")}
471
- and following the prompts.
400
+ stages:
401
+ ${e.stages.map((t)=>` - ${t}`).join(`
402
+ `)}
472
403
 
473
- After you finished, you can release it by running ${h.reset(h.green("bunx @r5n/sisyphus"))}${h.blue(" roll")}
474
- `)}N();B();_();import{parseArgs as kr}from"util";var{$:pt}=globalThis.Bun;var Fr=x({prefix:"sisyphus:insights"});async function Bs(){let{values:t}=kr({args:process.argv.slice(3),options:{json:{short:"j",type:"boolean"},package:{short:"p",type:"string"}}}),{package:o}=t;bt(`${f.command("sisyphus insights")} - Monorepo health report`);try{let s=await L(),e=Object.values(s);if(o){let r=s.packages[o];if(!r)H(f.error(`Package ${o} not found`)),process.exit(1);await ti(r,s)}else await Dr(e,s.packages)}catch(s){Fr.error("Failed to generate insights",s),H(f.error(`Failed to generate insights: ${s}`)),process.exit(1)}}async function Dr(t,o){let s=await ni(t,o);if(I(`\uD83D\uDCE6 Total Packages: ${f.value(String(s.totalPackages))}
475
- `+`\uD83D\uDD04 Circular Dependencies: ${s.circularDeps>0?f.error(String(s.circularDeps)):f.success("0")}
476
- `+`\uD83D\uDCC8 Most Changed: ${f.value(s.mostChanged.name)} (${s.mostChanged.commits} commits)
477
- `+`\uD83D\uDC0C Stale Packages: ${s.stalePackages.length>0?f.warning(String(s.stalePackages.length)):f.success("0")}
478
- `+`\uD83C\uDFAF High Impact Changes: ${f.value(String(s.highImpactPackages))}
479
- `+`\uD83D\uDE80 Release Velocity: ${f.value(s.releaseVelocity)}`,f.bold("\uD83D\uDCCA Monorepo Health Report")),s.dependencyIssues.length>0)I(s.dependencyIssues.map((e)=>`${f.dim("\u2022")} ${e}`).join(`
480
- `),f.warning("\u26A0\uFE0F Dependency Issues"));if(s.stalePackages.length>0)I(s.stalePackages.map((e)=>`${f.dim("\u2022")} ${e.name} - ${e.daysSinceUpdate} days since last update`).join(`
481
- `),f.warning("\uD83D\uDC0C Stale Packages"));H(f.success("Analysis complete"))}async function ti(t,o){let s=await oi(t,o);if(I(`Current: ${f.value(s.version)}
482
- Path: ${f.dim(s.path)}
483
- Dependencies: ${f.value(String(s.dependencies))}
484
- Dependents: ${f.value(String(s.dependents))} internal${s.externalDependents?`, ${f.info(s.externalDependents)} external`:""}
485
- Last Modified: ${f.dim(s.lastModified||"Unknown")}
486
- Change Frequency: ${f.value(s.changeFrequency||"Low")}
487
- Breaking Changes: ${f.value(String(s.breakingChanges))} in last year`,f.bold(`\uD83D\uDCE6 ${t.name}`)),s.dependencyTree.length>0)I(Ms(s.dependencyTree),f.info("\uD83C\uDF33 Dependency Tree"));if(s.internalDependents.length>0)I(s.internalDependents.map((e)=>`${f.dim("\u2022")} ${e}`).join(`
488
- `),f.info("\uD83D\uDC65 Used By"));H(f.success("Analysis complete"))}async function ni(t,o){let s=await si(t),e=await ei(t),r=await ri(),i=ii(t),n=ai(t,o);return{circularDeps:i.length,dependencyIssues:n,highImpactPackages:t.filter((a)=>a.dependencyOf?.length>5).length,mostChanged:s,releaseVelocity:r,stalePackages:e,totalPackages:t.length}}async function oi(t,o){let s=await ci(t.path),e=await fi(t.path),r=await mi(t.name),i=Object.keys(t.packageJson.dependencies||{}).length,n=Object.values(o).filter((c)=>c.dependencyOf?.includes(t.name)).map((c)=>c.name),a=_s(t,o,3);return{breakingChanges:r,changeFrequency:e,dependencies:i,dependencyTree:a,dependents:n.length,externalDependents:await li(t.name),internalDependents:n,lastModified:s,name:t.name,path:t.path,version:t.version}}async function si(t){let o={commits:0,name:"None"};for(let s of t)try{let e=await pt`cd ${s.path} && git rev-list --count HEAD -- .`.text(),r=parseInt(e.trim(),10);if(r>o.commits)o={commits:r,name:s.name}}catch{}return o}async function ei(t,o=180){let s=[];for(let e of t)try{let r=await pt`cd ${e.path} && git log -1 --format=%ct -- .`.text(),i=parseInt(r.trim(),10),n=Math.floor((Date.now()/1000-i)/86400);if(n>o)s.push({daysSinceUpdate:n,name:e.name})}catch{}return s}async function ri(){try{let o=(await pt`git tag -l "v*" --sort=-creatordate | head -10`.text()).trim().split(`
489
- `).filter(Boolean);if(o.length<2)return"N/A";let s=[];for(let i of o.slice(0,5)){let n=await pt`git log -1 --format=%ct ${i}`.text();s.push(parseInt(n.trim(),10))}let e=0;for(let i=1;i<s.length;i++){let n=s[i-1],a=s[i];if(n&&a)e+=(n-a)/86400}let r=Math.round(e/(s.length-1));if(r<7)return`${r} days (rapid)`;if(r<14)return`${r} days (fast)`;if(r<30)return`${r} days (regular)`;return`${r} days (slow)`}catch{return"N/A"}}function ii(t){return[]}function ai(t,o){let s=[],e=new Map;for(let r of t){let i={...r.packageJson.dependencies,...r.packageJson.devDependencies};for(let[n,a]of Object.entries(i)){if(!e.has(n))e.set(n,new Set);e.get(n)?.add(a)}}for(let[r,i]of e)if(i.size>1)s.push(`${r} has ${i.size} different versions across packages`);return s}async function ci(t){try{let o=await pt`cd ${t} && git log -1 --format=%ct -- .`.text();return new Date(parseInt(o.trim(),10)*1000).toLocaleDateString()}catch{return"Unknown"}}async function fi(t){try{let o=await pt`cd ${t} && git rev-list --count HEAD --since="6 months ago" -- .`.text(),s=parseInt(o.trim(),10);if(s>50)return"High";if(s>20)return"Medium";if(s>5)return"Low";return"Very Low"}catch{return"Unknown"}}async function mi(t){try{let o=await pt`git log --grep="BREAKING" --grep="breaking change" -i --oneline -- "*${t}*" | wc -l`.text();return parseInt(o.trim(),10)}catch{return 0}}async function li(t){return""}function _s(t,o,s,e=0){if(e>=s)return[];let r=[],i=Object.keys(t.packageJson.dependencies||{});for(let n of i)if(o[n])r.push({children:_s(o[n],o,s,e+1),name:n,version:o[n].version});return r}function Ms(t,o=""){let s="";for(let e=0;e<t.length;e++){let r=e===t.length-1,i=r?"\u2514\u2500":"\u251C\u2500",n=o+(r?" ":"\u2502 ");if(s+=`${o}${i} ${t[e].name}@${t[e].version}
490
- `,t[e].children?.length>0)s+=Ms(t[e].children,n)}return s.trimEnd()}N();B();P();_();import{parseArgs as hi}from"util";var{$:pi}=globalThis.Bun;var Gs=x({prefix:"sisyphus"}).child("metrics");function ui(){let{values:t}=hi({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:t.days?parseInt(t.days,10):30,detailed:t.detailed,json:t.json,package:t.package}}async function Ns(){try{let t=ui(),{packages:o}=await L(),s=await gi(t.days||30),e=await bi(o,s,t.package);if(t.json){console.log(JSON.stringify({packageMetrics:e,releases:s},null,2));return}if(yi(s,e,t),t.detailed)di(e,t)}catch(t){Gs.error("Failed to generate metrics:",t),process.exit(1)}}async function gi(t){let o=new Date;o.setDate(o.getDate()-t);try{let s=await pi`git log --tags --simplify-by-decoration --pretty="format:%ci %h %d" --since="${o.toISOString()}"`.text(),e=[],r=s.trim().split(`
491
- `).filter(Boolean);for(let i of r){let n=i.match(/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([a-f0-9]+) \(tag: ([^)]+)\)/);if(n){let[,a="",c="",m=""]=n,l=new Date(a),p=m.match(/@[^@]+@[\d.]+(-\w+\.\d+)?/g);if(p){let g={},d=[];for(let u of p){let[y,$]=u.split("@").filter(Boolean);if(y&&$)d.push(`@${y}`),g[`@${y}`]={from:"unknown",to:$}}e.push({commitHash:c,date:l,packages:d,tag:m,versions:g})}}}return e}catch{return Gs.warn("Could not fetch git history, using empty release history"),[]}}async function bi(t,o,s){let e=new Map;for(let[r]of Object.entries(t)){if(s&&!r.includes(s))continue;e.set(r,{majorReleases:0,minorReleases:0,name:r,patchReleases:0,releaseFrequency:"Never",totalReleases:0,versionHistory:[]})}for(let r of o)for(let i of r.packages){let n=e.get(i);if(!n)continue;n.totalReleases++,n.lastRelease=r.date;let a=r.versions[i];if(a?.to){n.versionHistory.push({date:r.date,version:a.to});let c=a.to.match(/(\d+)\.(\d+)\.(\d+)/);if(c){let[,,m,l]=c;if(l!=="0")n.patchReleases++;else if(m!=="0")n.minorReleases++;else n.majorReleases++}}}for(let r of e.values())if(r.totalReleases>1&&r.versionHistory.length>1){let i=r.versionHistory[r.versionHistory.length-1]?.date?.getTime()||0,n=r.versionHistory[0]?.date?.getTime()||0,a=Math.floor((n-i)/86400000),c=Math.floor(a/(r.totalReleases-1));if(c===0)r.releaseFrequency="Daily";else if(c<=7)r.releaseFrequency=`Every ${c} days`;else if(c<=30)r.releaseFrequency=`Every ${Math.floor(c/7)} weeks`;else r.releaseFrequency=`Every ${Math.floor(c/30)} months`}else if(r.totalReleases===1)r.releaseFrequency="Single release";return Array.from(e.values()).sort((r,i)=>i.totalReleases-r.totalReleases)}function yi(t,o,s){let e=t.length,r=o.filter((a)=>a.totalReleases>0).length,i=o.length;if(w.info(`Release Metrics - Last ${s.days} days`),console.log(),console.log(f.bold("\uD83D\uDCCA Overview")),console.log(` Total releases: ${f.value(String(e))}`),console.log(` Active packages: ${f.value(`${r}/${i}`)}`),t.length>0){let[a]=t;console.log(` Last release: ${f.dim(Fn(a?.date))}`)}console.log();let n=o.filter((a)=>a.totalReleases>0).slice(0,5);if(n.length>0){console.log(f.bold("\uD83C\uDFC6 Most Active Packages"));for(let a of n){let c="\u2588".repeat(Math.min(20,a.totalReleases)),m=a.lastRelease?` (${Ts(a.lastRelease)})`:"";console.log(` ${f.value(a.name.padEnd(25))} ${f.dim(c)} ${a.totalReleases} releases${f.dim(m)}`)}console.log()}if(t.length>0){console.log(f.bold("\uD83D\uDCC5 Recent Releases"));let a=t.slice(0,5);for(let c of a){let m=c.packages.slice(0,3).join(", "),l=c.packages.length>3?` +${c.packages.length-3} more`:"";console.log(` ${f.dim(Fn(c.date))} - ${m}${f.dim(l)}`)}console.log()}}function di(t,o){console.log(f.bold("\uD83D\uDCE6 Package Details")),console.log();for(let s of t){if(s.totalReleases===0)continue;if(console.log(`${f.bold(s.name)}`),console.log(` Releases: ${s.totalReleases} (${s.majorReleases} major, ${s.minorReleases} minor, ${s.patchReleases} patch)`),console.log(` Frequency: ${s.releaseFrequency}`),console.log(` Last release: ${s.lastRelease?Fn(s.lastRelease):"Never"}`),s.versionHistory.length>0){console.log(" Recent versions:");let e=s.versionHistory.slice(0,3);for(let{version:r,date:i}of e)console.log(` ${f.value(r)} - ${f.dim(Ts(i))}`)}console.log()}}function Fn(t){if(!t)return"Never";return t.toLocaleDateString("en-US",{day:"numeric",hour:"2-digit",minute:"2-digit",month:"short",year:"numeric"})}function Ts(t){let s=new Date().getTime()-t.getTime(),e=Math.floor(s/86400000);if(e===0)return"today";if(e===1)return"yesterday";if(e<7)return`${e} days ago`;if(e<30)return`${Math.floor(e/7)} weeks ago`;if(e<365)return`${Math.floor(e/30)} months ago`;return`${Math.floor(e/365)} years ago`}N();B();_();import{randomUUID as wi}from"crypto";import{join as ut,relative as $i}from"path";var{$:Dn}=globalThis.Bun;var to=x({prefix:"sisyphus:migrate"});async function Us(){let t=to.child("run");bt(`${f.command("sisyphus migrate")} - Migrate from changesets to stones`);let o=process.cwd(),s=ut(o,".changeset");if(!await Bun.file(s).exists())t.warn("No .changeset directory found"),H(f.error("No changesets found to migrate")),process.exit(1);let e=yt();e.start("Analyzing changesets...");try{let r=await Si(s);if(r.length===0){e.stop("No changesets found"),H(f.warning("No changesets to migrate"));return}e.stop(`Found ${f.value(String(r.length))} changeset(s)`);let i=[];for(let d of r){let u=await xi(d);if(u){i.push(u);let y=$i(o,d);I(`${f.dim("File:")} ${y}
492
- ${f.dim("Packages:")} ${Object.entries(u.packages).map(([$,v])=>`${$} (${v})`).join(", ")}
493
- ${f.dim("Summary:")} ${u.summary.slice(0,80)}${u.summary.length>80?"...":""}`,f.info("Changeset found"))}}if(i.length===0){H(f.warning("No valid changesets found to migrate"));return}if(!await G({initialValue:!0,message:`Migrate ${i.length} changeset(s) to stones?`})){H(f.dim("Migration cancelled"));return}e.start("Migrating changesets to stones...");let a=ut(o,".sisyphus"),c=ut(a,"stones");if(!await Bun.file(a).exists())await Dn`mkdir -p ${c}`,await Bun.write(ut(a,"config.json"),JSON.stringify({stones:[]},null,2));else if(!await Bun.file(c).exists())await Dn`mkdir -p ${c}`;let l=(await Z()).length,p=[];for(let d of i){l++;let u=`${String(l).padStart(4,"0")}-${wi().slice(0,8)}`,y=vi(d),$=ut(c,`${u}.md`);await Bun.write($,y.content),p.push(u),t.info(`Created stone: ${u}`)}if(e.stop(`Created ${f.value(String(p.length))} stone(s)`),p.length>0){let d=ut(a,"config.json"),u=await Bun.file(d).json();u.stones=[...u.stones||[],...p],await Bun.write(d,JSON.stringify(u,null,2))}if(await G({initialValue:!0,message:"Remove .changeset directory?"}))e.start("Cleaning up changesets..."),await Dn`rm -rf ${s}`,e.stop("Changesets cleaned up"),t.info("Removed .changeset directory");H(f.success("Migration completed successfully!"))}catch(r){e.stop("Migration failed"),t.error("Migration failed",r),H(f.error(`Migration failed: ${r}`)),process.exit(1)}}async function Si(t){let o=[];try{let s=await Array.fromAsync(new Bun.Glob("*.md").scan(t));for(let e of s)if(e!=="README.md")o.push(ut(t,e))}catch(s){to.error("Failed to scan changeset directory",s)}return o}async function xi(t){try{let s=(await Bun.file(t).text()).split(`
494
- `),e=!1,r=[],i=[];for(let c of s)if(c.trim()==="---")if(!e)e=!0;else e=!1;else if(e)r.push(c);else if(!e&&r.length>0)i.push(c);let n={};for(let c of r){let m=c.match(/^"(.+)":\s*(major|minor|patch)$/);if(m){if(m[1]&&m[2])n[m[1]]=m[2]}}let a=i.join(`
495
- `).trim();if(Object.keys(n).length===0)return null;return{packages:n,summary:a}}catch(o){return to.error(`Failed to parse changeset: ${t}`,o),null}}function vi(t){let o=[],s=[],e=[];for(let[l,p]of Object.entries(t.packages)){let g=l.startsWith("@")?l:`@${l}`;switch(p){case"major":o.push(g);break;case"minor":s.push(g);break;case"patch":e.push(g);break}}let r=t.summary.split(`
496
- `)[0],n=`### ${r||"Migrated from changesets"}
497
-
498
- `;if(t.summary&&t.summary!==r){let l=t.summary.split(`
499
- `).slice(1).join(`
500
- `).trim();if(l)n+=`${l}
501
-
502
- `}n+=`***
503
-
504
- `;let a=[],c=[],m=[];if(o.length>0)a.push("major"),c.push(o.join(", ")),m.push(":---:");if(s.length>0)a.push("minor"),c.push(s.join(", ")),m.push(":---:");if(e.length>0)a.push("patch"),c.push(e.join(", ")),m.push(":---:");return n+=`| ${a.join(" | ")} |
505
- `,n+=`| ${m.join(" | ")} |
506
- `,n+=`| ${c.join(" | ")} |
507
- `,{content:n}}N();B();P();_();import{parseArgs as Oi}from"util";_();St();import{randomUUID as Ei}from"crypto";var ji=["major","minor","patch","dependency","snapshot"];function Ri({message:t,tag:o,packages:s}){let e=s.reduce((i,n)=>{return i[n.bump]=i[n.bump]||[],i[n.bump].push(n.name),i},{}),r=ji.filter((i)=>e[i]?.length>0);return[`### ${t}`,o?`_${o}_`:"",Yn,"",`| ${r.join(" | ")} |`,`| ${r.map(()=>":---:").join(" | ")} |`,`| ${r.map((i)=>e[i]?.join(", ")||"").join(" | ")} |`,""]}function gt(t){let o=t.split(`
508
- `).filter((i)=>i.trim()),s={commitMessage:"",dependency:[],description:"",major:[],minor:[],patch:[],snapshot:[],tag:""},e=o.findIndex((i)=>i.includes("---"));if(o[0]?.startsWith("###"))s.commitMessage=o[0].replace(/^#+\s*/,"");if(e>1){let i=[];for(let n=1;n<e;n++){let a=o[n];if(a?.startsWith("_")&&a.endsWith("_"))s.tag=a.slice(1,-1);else if(a)i.push(a)}s.description=i.join(`
509
- `).trim()}let r=o.findIndex((i)=>i.includes("|")&&!i.includes("---"));if(r!==-1&&o[r]){let n=o[r].split("|").map((c)=>c.trim()).filter((c)=>c),a=o[r+2];if(a){let c=a.split("|").map((m)=>m.trim()).filter((m)=>m);n.forEach((m,l)=>{let p=c[l]?.split(",").map((d)=>d.trim()).filter((d)=>d)||[],g=m.toLowerCase();if(g==="major")s.major=p;else if(g==="minor")s.minor=p;else if(g==="patch")s.patch=p;else if(g==="dependency")s.dependency=p;else if(g==="snapshot")s.snapshot=p})}}return s}async function rt({majorPackages:t,message:o,minorPackages:s,packages:e,patchPackages:r,tag:i,configPath:n}){let c=`${`${(await Z({configPath:n})).length+1}`.padStart(4,"0")}-${Ei().slice(0,8)}`,m=[...t,...s,...r],l=m.flatMap((u)=>e[u]?.dependencyOf||[]),g=[{packages:t,type:"major"},{packages:s,type:"minor"},{packages:r,type:"patch"},{packages:l.filter((u)=>!m.includes(u)),type:"dependency"}].flatMap(({packages:u,type:y})=>u.map(($)=>{let v=e[$];if(!v)throw new Error(`Package ${$} not found`);return{...v,bump:y,tag:i}})).filter(Boolean),d=Ri({message:o,packages:g,tag:i});return{packages:g,stoneContent:d,stoneName:c}}var Mt=x({prefix:"sisyphus"}).child("pr"),Ai=/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/,Ii=/gitlab\.com\/(.+)\/-\/merge_requests\/(\d+)/,Pi={"breaking-change":"major",bug:"patch",chore:"patch",documentation:"patch",enhancement:"minor",feature:"minor",fix:"patch"};function Bi(){let{values:t}=Oi({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 t}async function Cs(){try{let t=Bi(),{packages:o,packageNames:s}=await L(),e;if(t.url)e=await _i(t.url);else e=await Mi(t);if(!e){w.error("Could not determine PR information. Please provide a PR URL with --url");return}if(w.info(`Processing PR #${e.number}: ${e.title}`),console.log(),console.log(` Author: ${f.value(e.author)}`),console.log(` Branch: ${f.value(e.branch)}`),e.labels.length>0)console.log(` Labels: ${e.labels.map((y)=>f.dim(y)).join(", ")}`);console.log();let r;for(let y of e.labels){let $=y.toLowerCase();for(let[v,j]of Object.entries(Pi))if($.includes(v)){if(r=j,j==="major")break}if(r==="major")break}if(!r){let y=e.title.toLowerCase();if(y.includes("breaking")||y.includes("!:"))r="major";else if(y.includes("feat")||y.includes("feature"))r="minor";else if(y.includes("fix")||y.includes("bug"))r="patch"}if(!r&&!t.yes){let y=await W({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)){w.info("Invalid bump type. Cancelled.");return}r=y}else if(!r)r="patch";w.info(`Detected bump type: ${f.bold(r)}`);let i=await Ti(e.branch),n=await Ui(i,o,s);if(n.length===0){w.warn("No packages affected by this PR");return}console.log(),console.log(f.bold("Affected packages:"));for(let y of n){let $=o[y];if(!$)continue;let v=$.version,j=Ci(v,r);console.log(` ${f.value(y)}: ${v} \u2192 ${f.success(j)}`)}console.log();let a=`${e.title} (#${e.number})`,c;if(!t.yes){let y=await W({initialValue:a,message:"Commit message for this stone",placeholder:a});if(!y){w.info("Cancelled");return}c=y}else c=a;let m=r==="major"?n:[],l=r==="minor"?n:[],p=r==="patch"?n:[],{stoneContent:g,stoneName:d}=await rt({majorPackages:m,message:c,minorPackages:l,packages:o,patchPackages:p,tag:void 0});if(t.dryRun){w.info("Dry run - no changes made"),console.log(f.dim("Stone content:")),console.log(g.join(`
510
- `));return}if(!t.yes){if(!await G({initialValue:!0,message:"Create stone from this PR?"})){w.info("Cancelled");return}}let u=await O();u.stones.push(d),await Bun.write(`.sisyphus/stones/${d}.md`,g.join(`
511
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(u,null,2)}
512
- `),w.success(`Created stone from PR: ${f.bold(d)}`),w.info(`Review the stone with ${f.value(`sisyphus stone show ${d}`)}`)}catch(t){Mt.error("Failed to process PR:",t),process.exit(1)}}async function _i(t){let o=t.match(Ai);if(o){let[,e="",r="",i=""]=o;return await Gi(e,r,i)}let s=t.match(Ii);if(s){let[,e="",r=""]=s;return await Ni(e,r)}throw new Error("Unsupported PR URL format")}async function Mi(t){try{if((await Bun.$`git remote get-url origin`.text()).includes("github.com")||t.github)try{let s=await Bun.$`gh pr view --json number,title,body,labels,author,headRefName`.json();return{author:s.author?.login||"unknown",branch:s.headRefName,description:s.body||"",labels:s.labels?.map((e)=>e.name)||[],number:String(s.number),title:s.title}}catch{Mt.debug("GitHub CLI not available or no PR found")}return null}catch(o){return Mt.debug("Could not detect current PR:",o),null}}async function Gi(t,o,s){try{let e=await Bun.$`gh api repos/${t}/${o}/pulls/${s}`.json();return{author:e.user?.login||"unknown",branch:e.head.ref,description:e.body||"",labels:e.labels?.map((r)=>r.name)||[],number:String(e.number),title:e.title}}catch(e){throw new Error(`Failed to fetch GitHub PR: ${e}`)}}async function Ni(t,o){throw new Error("GitLab integration requires API token configuration")}async function Ti(t){try{let s=(await Bun.$`git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'`.text()).trim()||"main";return(t?await Bun.$`git diff --name-only ${s}...${t}`.text():await Bun.$`git diff --name-only ${s}...HEAD`.text()).trim().split(`
513
- `).filter(Boolean)}catch(o){return Mt.warn("Could not get changed files, using current uncommitted changes"),(await Bun.$`git status --porcelain`.text()).trim().split(`
514
- `).map((e)=>e.substring(3)).filter(Boolean)}}async function Ui(t,o,s){let e=new Set,r=new Map;for(let[i,n]of Object.entries(o))if(n.relativePath)r.set(n.relativePath,i);for(let i of t)for(let[n,a]of r)if(i.startsWith(`${n}/`))e.add(a);if(e.size===0&&t.length>0){if(t.filter((n)=>!n.includes("/")||n.startsWith(".")).length>0)return Mt.info("Root files changed, considering all packages affected"),s}return Array.from(e)}function Ci(t,o){let s=t.split("."),e=parseInt(s[0]||"0",10),r=parseInt(s[1]||"0",10),i=parseInt(s[2]||"0",10);switch(o){case"major":return`${e+1}.0.0`;case"minor":return`${e}.${r+1}.0`;case"patch":return`${e}.${r}.${i+1}`;default:return t}}N();B();P();_();St();import{parseArgs as Li}from"util";var Hi=x({prefix:"sisyphus"}).child("prerelease"),qi=["alpha","beta","rc","canary","dev","next"];function Ji(){let{values:t}=Li({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 t}async function Ls(){try{let t=Ji(),{packages:o,packageNames:s}=await L({filter:t.filter});if(t.promote)await Xi(t,o,s);else await Wi(t,o,s)}catch(t){Hi.error("Prerelease operation failed:",t),process.exit(1)}}async function Wi(t,o,s){let e=t.type||await et({message:"Select prerelease type",options:qi.map(($)=>({hint:zi($),label:$,value:$}))});if(!e||typeof e!=="string"){w.info("Cancelled");return}let r=t.filter,i=r?s.filter(($)=>$.includes(r)):s;if(i.length===0){w.error(`No packages found matching filter: ${t.filter}`);return}let n=t.filter?i:await Yi(i,o);if(n.length===0){w.info("No packages selected");return}let a;if(t.bump){let v={major:"major",minor:"minor",patch:"patch"}[t.bump.toLowerCase()];if(!v){w.error(`Invalid bump type: ${t.bump}. Must be major, minor, or patch.`);return}a=v}else{let $=await et({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(!$){w.info("Cancelled");return}a=$}let c=`chore: prepare ${e} release`,m;if(t.yes)m=c;else{let $=await W({message:"Commit message for this prerelease",placeholder:c});if(!$||typeof $!=="string"){w.info("Cancelled");return}m=$}let l=[],p=[],g=[];for(let $ of n)switch(a){case"major":l.push($);break;case"minor":p.push($);break;case"patch":g.push($);break}let{stoneContent:d,stoneName:u}=await rt({majorPackages:l,message:m,minorPackages:p,packages:o,patchPackages:g,tag:e});w.step("Preview of prerelease changes:"),console.log();for(let $ of n){let v=o[$],j=X({bump:a,tag:e,version:v.version});console.log(` ${f.value($)}: ${v.version} \u2192 ${f.bold(j)}`)}if(console.log(),t.dryRun){w.info("Dry run - no changes made"),console.log(f.dim("Stone content:")),console.log(d.join(`
515
- `));return}if(!t.yes){if(!await G({initialValue:!0,message:"Create this prerelease stone?"})){w.info("Cancelled");return}}let y=await O();y.stones.push(u),await Bun.write(`.sisyphus/stones/${u}.md`,d.join(`
516
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(y,null,2)}
517
- `),w.success(`Created ${e} prerelease stone: ${f.bold(u)}`),w.info(`Run ${f.value("sisyphus roll")} to publish the prerelease`)}async function Xi(t,o,s){let e=s.filter((u)=>{return o[u].version.includes("-")});if(e.length===0){w.info("No packages with prerelease versions found");return}w.info(`Found ${f.bold(String(e.length))} packages with prerelease versions`),console.log();let r=new Map;for(let u of e){let $=o[u].version.match(/-(\w+)\./);if($){let v=$[1];if(!r.has(v))r.set(v,[]);r.get(v)?.push(u)}}for(let[u,y]of r){console.log(`${f.bold(u)} packages:`);for(let $ of y)console.log(` ${f.value($)}: ${o[$].version}`);console.log()}let i=Array.from(r.keys()),n=[];if(i.includes("alpha"))n.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(i.includes("beta"))n.push({label:"Promote beta \u2192 rc",value:"beta-to-rc"},{label:"Promote beta \u2192 stable",value:"beta-to-stable"});if(i.includes("rc")||i.includes("next"))n.push({label:"Graduate to stable release",value:"to-stable"});n.push({label:"Increment current prerelease version",value:"increment"});let a=await et({message:"How would you like to promote these prereleases?",options:n});if(!a){w.info("Cancelled");return}let c,m=e,l;switch(a){case"alpha-to-beta":c="beta",m=r.get("alpha")||[],l="chore: promote alpha to beta";break;case"alpha-to-rc":c="rc",m=r.get("alpha")||[],l="chore: promote alpha to rc";break;case"alpha-to-stable":c=void 0,m=r.get("alpha")||[],l="chore: promote alpha to stable release";break;case"beta-to-rc":c="rc",m=r.get("beta")||[],l="chore: promote beta to rc";break;case"beta-to-stable":c=void 0,m=r.get("beta")||[],l="chore: promote beta to stable release";break;case"to-stable":c=void 0,m=[...r.get("rc")||[],...r.get("next")||[]],l="chore: graduate to stable release";break;case"increment":if(i.length>1){let u=await et({message:"Which prerelease type would you like to increment?",options:i.map((y)=>({label:y,value:y}))});if(!u){w.info("Cancelled");return}c=u,m=r.get(c)||[]}else c=i[0],m=c?r.get(c)||[]:[];l=`chore: increment ${c} version`;break;default:w.error("Unknown promotion strategy");return}if(m.length===0){w.info("No packages to promote");return}w.step("Preview of promotion:"),console.log();for(let u of m){let y=o[u].version,$;if(c===void 0)$=y.split("-")[0];else if(a==="increment")$=X({bump:"patch",tag:c,version:y});else $=`${y.split("-")[0]}-${c}.0`;console.log(` ${f.value(u)}: ${y} \u2192 ${f.bold($)}`)}if(console.log(),!t.yes){if(!await G({initialValue:!0,message:"Continue with this promotion?"})){w.info("Cancelled");return}}let{stoneContent:p,stoneName:g}=await rt({majorPackages:[],message:l,minorPackages:[],packages:o,patchPackages:m,tag:c});if(t.dryRun){w.info("Dry run - no changes made"),console.log(p.join(`
518
- `));return}let d=await O();d.stones.push(g),await Bun.write(`.sisyphus/stones/${g}.md`,p.join(`
519
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(d,null,2)}
520
- `),w.success(`Created promotion stone: ${f.bold(g)}`),w.info(`Run ${f.value("sisyphus roll")} to publish the promotion`)}function zi(t){switch(t){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 Yi(t,o){if(await et({message:"Select packages for prerelease",options:[{label:"All packages",value:"all"},{label:"Select specific packages",value:"select"}]})==="all")return t;w.info("Select packages (space to select, enter to confirm)");let e=[];for(let r of t)if(await G({initialValue:!1,message:`Include ${r} (${o[r].version})?`}))e.push(r);return e}N();B();P();_();import{parseArgs as Ki}from"util";var Zi=x({prefix:"sisyphus"}).child("preview");async function Hs(){let{values:t}=Ki({args:process.argv.slice(3),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:o,verbose:s}=t;try{let e=await O(),r=await _t();if(r.length===0){if(o)console.log(JSON.stringify({message:"No pending stones found"}));else w.info("No pending stones found. Nothing to preview.");return}let{packages:i}=await L(),n={},a=[];for(let{tag:m,packages:l,message:p}of r){a.push(p);for(let g of l){if(!n[g.name])n[g.name]={...g};let d=n[g.name];if(!d)continue;if(m)d.tag=m;d.bump=mt.indexOf(g.bump)>mt.indexOf(d.bump)?g.bump:d.bump,n[g.name]=d}}let c=Object.entries(n).map(([m,l])=>{let p=i[m]?.version||"0.0.0",[g="0",d="0",u="0"]=p.split("."),y=p;switch(l.bump){case"major":y=`${Number.parseInt(g,10)+1}.0.0`;break;case"minor":y=`${g}.${Number.parseInt(d,10)+1}.0`;break;case"patch":case"dependency":y=`${g}.${d}.${Number.parseInt(u,10)+1}`;break;case"snapshot":{let $=new Date().toISOString().replace(/[.ZT:-]/g,"").slice(0,14);y=`0.0.0-${l.tag||"nightly"}-${$}`;break}}if(l.tag&&l.bump!=="snapshot")y=`${y}-${l.tag}.0`;return{bump:l.bump,currentVersion:p,name:m,newVersion:y,tag:l.tag}});if(o){console.log(JSON.stringify({messages:a,stones:r.length,updates:c},null,2));return}w.info(`Preview of release with ${f.bold(String(r.length))} stone${r.length>1?"s":""}`),console.log(),console.log(f.bold("Commit Messages:")),a.forEach((m)=>{console.log(` ${f.bullet("\u2022")} ${m}`)}),console.log(),console.log(f.bold("Version Updates:"));for(let m of c){let l=m.bump==="major"?f.error:m.bump==="minor"?f.warning:f.success;console.log(` ${f.value(m.name)}`),console.log(` ${f.dim("Current:")} ${m.currentVersion}`),console.log(` ${f.dim("New:")} ${f.bold(m.newVersion)}`),console.log(` ${f.dim("Bump:")} ${l(m.bump)}${m.tag?` (${f.value(m.tag)})`:""}`),console.log()}if(s)console.log(f.bold("Additional Information:")),console.log(` ${f.dim("Config path:")} ${e.configPath||".sisyphus"}`),console.log(` ${f.dim("Total packages:")} ${Object.keys(i).length}`),console.log(` ${f.dim("Packages to update:")} ${c.length}`)}catch(e){Zi.error("Failed to preview release:",e),process.exit(1)}}N();B();_();import{parseArgs as Qi}from"util";var{$:rn}=globalThis.Bun;var Vi=x({prefix:"sisyphus:solo"});async function qs(){let{values:t}=Qi({args:process.argv.slice(3),options:{"dry-run":{short:"d",type:"boolean"},tag:{short:"t",type:"string"}}}),{"dry-run":o,tag:s}=t;bt(`${f.command("sisyphus solo")} - Single maintainer workflow`);let e=yt();e.start("Creating version from commits and rolling immediately...");try{let r=await rn`git describe --tags --abbrev=0 2>/dev/null || echo ""`.text(),i=await rn`git rev-list ${r?`${r.trim()}..HEAD`:"HEAD"} --count`.text();if(parseInt(i.trim(),10)===0){e.stop("No commits to release"),H(f.dim("Already up to date"));return}e.message("Analyzing commits...");let n=["bunx","@r5n/sisyphus","version","--from-commits","--yes"];if(o)n.push("--dry-run");if(await rn`${n}`,((await O()).stones||[]).length===0&&!o){e.stop("No releasable changes found"),H(f.dim("No version bumps needed"));return}e.message(o?"Previewing release...":"Rolling stones...");let m=["bunx","@r5n/sisyphus","roll"];if(o)m.push("--dry-run");if(s)m.push("--tag",s);await rn`${m}`,e.stop("Release complete!"),H(f.success("Published successfully"))}catch(r){e.stop("Solo release failed"),Vi.error("Failed to complete solo workflow",r),H(f.error(`Solo release failed: ${r}`)),process.exit(1)}}B();P();N();B();P();_();import{existsSync as ki}from"fs";import{unlink as Fi}from"fs/promises";import{join as Di}from"path";import{parseArgs as ta}from"util";var Gt=x({prefix:"sisyphus"}).child("stone:delete");async function Js(t){if(!t)Gt.error("Stone ID is required"),Gt.error("Usage: sisyphus stone delete <id>"),process.exit(1);let{values:o}=ta({args:process.argv.slice(5),options:{force:{short:"f",type:"boolean"}}}),{force:s}=o;try{let r=(await O()).stonesPath||".sisyphus/stones",i=Di(r,`${t}.md`);if(!ki(i))Gt.error(`Stone '${t}' not found`),Gt.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);if(!s){if(!await G({initialValue:!1,message:`Delete stone '${t}'?`})){w.info("Deletion cancelled");return}}await Fi(i),w.success(`Stone '${f.bold(t)}' deleted`)}catch(e){Gt.error(`Failed to delete stone '${t}':`,e),process.exit(1)}}N();B();P();_();import{existsSync as na}from"fs";import{readFile as oa,writeFile as sa}from"fs/promises";import{join as ea}from"path";import{parseArgs as ra}from"util";var vt=x({prefix:"sisyphus"}).child("stone:edit");async function Ws(t){if(!t)vt.error("Stone ID is required"),vt.error("Usage: sisyphus stone edit <id>"),process.exit(1);let{values:o}=ra({args:process.argv.slice(5),options:{interactive:{short:"i",type:"boolean"},message:{short:"m",type:"string"}}}),{message:s,interactive:e}=o;try{let i=(await O()).stonesPath||".sisyphus/stones",n=ea(i,`${t}.md`);if(!na(n))vt.error(`Stone '${t}' not found`),vt.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let a=await oa(n,"utf-8");if(s){let c=a.split(`
521
- `);c[0]=`### ${s}`,await sa(n,c.join(`
522
- `)),w.success(`Updated commit message for stone '${f.bold(t)}'`);return}if(e){w.info("Interactive stone editing coming soon"),w.info("For now, you can manually edit:"),w.info(f.dim(n));return}vt.error("Please specify --message or --interactive"),process.exit(1)}catch(r){vt.error(`Failed to edit stone '${t}':`,r),process.exit(1)}}B();var Xs={delete:`
523
- sisyphus stone delete - Remove a specific stone before rolling
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
+ `)}
524
727
 
525
- USAGE
526
- sisyphus stone delete <id> [options]
527
-
528
- OPTIONS
529
- -f, --force Skip confirmation prompt [boolean]
530
-
531
- EXAMPLES
532
- # Delete a stone by ID
533
- sisyphus stone delete stone-123
534
-
535
- # Delete without confirmation
536
- sisyphus stone delete stone-123 --force
537
- `,edit:`
538
- sisyphus stone edit - Modify stone content or version bumps
539
-
540
- USAGE
541
- sisyphus stone edit <id> [options]
542
-
543
- OPTIONS
544
- -m, --message New commit message [string]
545
- -i, --interactive Edit in interactive mode [boolean]
546
-
547
- EXAMPLES
548
- # Edit stone interactively
549
- sisyphus stone edit stone-123 --interactive
550
-
551
- # Update commit message
552
- sisyphus stone edit stone-123 --message "feat: better description"
553
- `,list:`
554
- sisyphus stone list - View all pending stones with details
555
-
556
- USAGE
557
- sisyphus stone list [options]
558
-
559
- OPTIONS
560
- -j, --json Output in JSON format [boolean]
561
- -v, --verbose Show full stone content [boolean]
562
-
563
- EXAMPLES
564
- # List all pending stones
565
- sisyphus stone list
566
-
567
- # Show full stone content
568
- sisyphus stone list --verbose
569
-
570
- # Output as JSON for scripting
571
- sisyphus stone list --json
572
- `,merge:`
573
- sisyphus stone merge - Combine multiple stones with smart conflict resolution
574
-
575
- USAGE
576
- sisyphus stone merge [options]
577
-
578
- OPTIONS
579
- -i, --ids Stone IDs to merge (multiple) [string]
580
- -m, --message Commit message for merged stone [string]
581
- -f, --force Skip confirmation [boolean]
582
- -s, --strategy Conflict resolution (highest/interactive) [string]
583
-
584
- EXAMPLES
585
- # Merge stones interactively
586
- sisyphus stone merge
587
-
588
- # Merge specific stones
589
- sisyphus stone merge --ids stone-123 stone-456
590
-
591
- # Merge with automatic conflict resolution
592
- sisyphus stone merge --strategy highest
593
-
594
- # Merge with interactive conflict resolution
595
- sisyphus stone merge --strategy interactive --message "feat: combined changes"
596
-
597
- NOTES
598
- - Detects when same package has different bump types across stones
599
- - Default strategy uses highest bump type (major > minor > patch)
600
- - Interactive strategy lets you choose resolution for each conflict
601
- `,show:`
602
- sisyphus stone show - Display full content of a specific stone
603
-
604
- USAGE
605
- sisyphus stone show <id> [options]
606
-
607
- OPTIONS
608
- -j, --json Output in JSON format [boolean]
609
-
610
- EXAMPLES
611
- # Show stone content
612
- sisyphus stone show stone-123
613
-
614
- # Output as JSON
615
- sisyphus stone show stone-123 --json
616
- `};function an(t){if(t&&Xs[t]){let s=Xs[t].split(`
617
- `).map((e)=>{if(e.startsWith("sisyphus"))return f.bold(e);if(e==="USAGE"||e==="OPTIONS"||e==="EXAMPLES")return f.bold(e);if(e.startsWith(" -")){let r=e.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(r){let[,i="",n=""]=r,a=n.replace("(required)",f.error("(required)")).replace(/\(default: ([^)]+)\)/g,(c,m)=>f.dim(`(default: ${m})`)).replace(/\[boolean\]/g,f.boolean("[boolean]")).replace(/\[string\]/g,f.string("[string]")).replace(/\[number\]/g,f.number("[number]"));return` ${f.flag(i.padEnd(26))} ${a}`}}if(e.startsWith(" # "))return f.dim(e);if(e.startsWith(" sisyphus"))return` ${f.value(e.trim())}`;return e}).join(`
618
- `);console.log(s);return}console.log(`
619
- ${f.bold("Sisyphus Stone Management")}
620
-
621
- ${f.bold("USAGE")}
622
- sisyphus stone <command> [options]
623
-
624
- ${f.bold("COMMANDS")}
625
- ${f.command("list")} View all pending stones with details
626
- ${f.command("delete")} Remove a specific stone by ID
627
- ${f.command("show")} Display full content of a stone
628
- ${f.command("edit")} Modify stone content or versions
629
- ${f.command("merge")} Combine multiple stones into one
630
- ${f.command("help")} Show this help message
631
-
632
- Use ${f.value("sisyphus stone <command> --help")} for more information about a command.
633
- `)}N();B();P();_();import{readFile as ia}from"fs/promises";import{join as aa}from"path";import{parseArgs as ca}from"util";var zs=x({prefix:"sisyphus"}).child("stone:list");async function Ys(){let{values:t}=ca({args:process.argv.slice(4),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:o,verbose:s}=t;try{let r=(await O()).stonesPath||".sisyphus/stones",i=await Z();if(i.length===0){if(o)console.log(JSON.stringify([]));else w.info("No pending stones found");return}let n=[];for(let a of i){let c=aa(r,`${a}.md`);try{let m=await ia(c,"utf-8"),l=gt(m);n.push({id:a,path:c,...l})}catch(m){zs.warn(`Failed to read stone ${a}:`,m)}}if(o){console.log(JSON.stringify(n,null,2));return}w.info(`Found ${f.bold(String(n.length))} pending stone${n.length>1?"s":""}`),console.log();for(let[a,c]of n.entries()){if(console.log(`${f.bullet("\u2022")} ${f.bold(c.id)}`),console.log(` ${f.dim("Message:")} ${c.commitMessage}`),c.tag)console.log(` ${f.dim("Tag:")} ${f.value(c.tag)}`);if(c.major.length>0)console.log(` ${f.error("Major:")} ${c.major.join(", ")}`);if(c.minor.length>0)console.log(` ${f.warning("Minor:")} ${c.minor.join(", ")}`);if(c.patch.length>0)console.log(` ${f.success("Patch:")} ${c.patch.join(", ")}`);if(s&&c.description)console.log(` ${f.dim("Description:")}`),c.description.split(`
634
- `).forEach((m)=>{console.log(` ${f.dim(m)}`)});if(a<n.length-1)console.log()}}catch(e){zs.error("Failed to list stones:",e),process.exit(1)}}N();B();P();_();import{readFile as Vs,unlink as ks,writeFile as fa}from"fs/promises";import{join as no}from"path";import{parseArgs as ma}from"util";N();B();St();var cn={major:4,minor:3,patch:2,dependency:1,snapshot:5};function Ks(t){let o=new Map;for(let e of t){for(let r of e.major){let i={bumpType:"major",name:r,stoneId:e.id,tag:e.tag};o.set(r,[...o.get(r)||[],i])}for(let r of e.minor){let i={bumpType:"minor",name:r,stoneId:e.id,tag:e.tag};o.set(r,[...o.get(r)||[],i])}for(let r of e.patch){let i={bumpType:"patch",name:r,stoneId:e.id,tag:e.tag};o.set(r,[...o.get(r)||[],i])}}let s=[];for(let[e,r]of o)if(r.length>1){let i=new Set(r.map((a)=>a.bumpType)),n=new Set(r.map((a)=>a.tag).filter(Boolean));if(i.size>1||n.size>1)s.push({conflicts:r,packageName:e})}return s}async function Zs(t,o="highest"){let s=[];for(let e of t){if(o==="highest"){let r=e.conflicts.reduce((i,n)=>cn[n.bumpType]>cn[i.bumpType]?n:i);e.resolution={chosenBumpType:r.bumpType,chosenStoneId:r.stoneId,reason:"Highest bump type selected"}}else{let r=e.conflicts.map((n)=>({label:`${n.bumpType} from ${n.stoneId}${n.tag?` (${n.tag})`:""}`,value:n}));console.log(`
635
- ${f.warning("Conflict detected")} for ${f.value(e.packageName)}:`);for(let n of e.conflicts)console.log(` ${f.dim("\u2022")} ${n.bumpType} from ${n.stoneId}${n.tag?` (${n.tag})`:""}`);let i=await et({message:"How should this conflict be resolved?",options:[{label:"Use highest bump type",value:"highest"},...r]});if(i&&i==="highest"){let n=e.conflicts.reduce((a,c)=>cn[c.bumpType]>cn[a.bumpType]?c:a);e.resolution={chosenBumpType:n.bumpType,chosenStoneId:n.stoneId,reason:"Highest bump type selected"}}else if(i&&typeof i==="object"){let n=i;e.resolution={chosenBumpType:n.bumpType,chosenStoneId:n.stoneId,reason:"Manually selected"}}}s.push(e)}return s}function Qs(t,o){let s={major:new Set,minor:new Set,patch:new Set,tags:{}},e=new Map;for(let r of o)if(r.resolution){let{chosenBumpType:i}=r.resolution,n=r.conflicts.find((a)=>a.stoneId===r.resolution?.chosenStoneId);e.set(r.packageName,{bumpType:i,tag:n?.tag})}for(let r of t){for(let i of r.major){let n=e.get(i);if(n){switch(n.bumpType){case"major":s.major.add(i);break;case"minor":s.minor.add(i);break;case"patch":s.patch.add(i);break}if(n.tag)s.tags[i]=n.tag}else s.major.add(i)}for(let i of r.minor)if(!e.has(i))s.minor.add(i);for(let i of r.patch)if(!e.has(i))s.patch.add(i)}return{major:Array.from(s.major),minor:Array.from(s.minor),patch:Array.from(s.patch),tags:s.tags}}var Fs=x({prefix:"sisyphus"}).child("stone:merge");async function Ds(t){let{values:o}=ma({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:s,message:e,force:r,strategy:i}=o;try{let a=(await O()).stonesPath||".sisyphus/stones",c=await Z();if(c.length<2){w.info("Need at least 2 stones to merge");return}let m=[];if(s&&s.length>=2){for(let S of s)if(c.includes(S)){let E=no(a,`${S}.md`),R=await Vs(E,"utf-8"),T=gt(R);m.push({id:S,path:E,...T})}if(m.length<2)Fs.error("Could not find all specified stones"),process.exit(1)}else{let S=[];for(let R of c){let T=no(a,`${R}.md`),Y=await Vs(T,"utf-8"),k=gt(Y);S.push({label:`${R} - ${k.commitMessage}`,value:{id:R,path:T,...k}})}let E=await Kt({message:"Select stones to merge",options:S,required:!0});if(!E||Array.isArray(E)&&E.length<2){w.info("Need to select at least 2 stones");return}m=E}let l=e||await W({message:"Commit message for merged stone",placeholder:"feat: combined changes"});if(!l||typeof l!=="string"){w.info("Merge cancelled");return}let p=Ks(m),g;if(p.length>0){I(`Found ${f.value(String(p.length))} package conflict(s):
636
- `+p.map((R)=>` ${f.dim("\u2022")} ${R.packageName}`).join(`
637
- `),f.warning("Conflicts detected"));let E=await Zs(p,i==="highest"||i==="interactive"?i:"highest");if(g=Qs(m,E),E.length>0){let R=E.filter((T)=>T.resolution).map((T)=>` ${f.dim("\u2022")} ${T.packageName}: ${T.resolution?.chosenBumpType} (${T.resolution?.reason})`).join(`
638
- `);I(R,f.success("Conflicts resolved"))}}else{let S={major:[],minor:[],patch:[]};for(let E of m)S.major.push(...E.major),S.minor.push(...E.minor),S.patch.push(...E.patch);g={major:[...new Set(S.major)],minor:[...new Set(S.minor)],patch:[...new Set(S.patch)],tags:{}}}let d=[];for(let S of m)if(S.description)d.push(S.description);let y=`merged-${Date.now()}`,$=no(a,`${y}.md`),v=`### ${l}
639
- `,j=[...new Set(Object.values(g.tags))];if(j.length===1)v+=`_${j[0]}_
640
- `;if(d.length>0)v+=`
641
- ${d.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(`
642
995
 
643
996
  `)}
644
- `;if(v+=`
997
+ `;if(x+=`
645
998
  ---
646
999
 
647
- `,g.major.length>0||g.minor.length>0||g.patch.length>0){let S=[],E=[];if(g.major.length>0)S.push("major"),E.push(g.major.join(", "));if(g.minor.length>0)S.push("minor"),E.push(g.minor.join(", "));if(g.patch.length>0)S.push("patch"),E.push(g.patch.join(", "));v+=`| ${S.join(" | ")} |
648
- `,v+=`| ${S.map(()=>":---:").join(" | ")} |
649
- `,v+=`| ${E.join(" | ")} |
650
- `}if(await fa($,v),!r){if(await G({initialValue:!0,message:"Delete original stones?"}))for(let E of m)await ks(E.path)}else for(let S of m)await ks(S.path);w.success(`Created merged stone: ${f.bold(y)}`)}catch(n){Fs.error("Failed to merge stones:",n),process.exit(1)}}B();P();_();import{existsSync as la}from"fs";import{readFile as ha}from"fs/promises";import{join as pa}from"path";import{parseArgs as ua}from"util";var Nt=x({prefix:"sisyphus"}).child("stone:show");async function te(t){if(!t)Nt.error("Stone ID is required"),Nt.error("Usage: sisyphus stone show <id>"),process.exit(1);let{values:o}=ua({args:process.argv.slice(5),options:{json:{short:"j",type:"boolean"}}}),{json:s}=o;try{let r=(await O()).stonesPath||".sisyphus/stones",i=pa(r,`${t}.md`);if(!la(i))Nt.error(`Stone '${t}' not found`),Nt.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let n=await ha(i,"utf-8");if(s){let a=gt(n);console.log(JSON.stringify({id:t,path:i,...a,raw:n},null,2));return}console.log(f.bold(`Stone: ${t}`)),console.log(f.dim(`Path: ${i}`)),console.log(f.dim("\u2500".repeat(50))),console.log(),console.log(n)}catch(e){Nt.error(`Failed to show stone '${t}':`,e),process.exit(1)}}var fn=["list","delete","show","edit","merge","help"],Et=x({prefix:"sisyphus"}).child("stone"),ga={combine:"merge",del:"delete",display:"show",join:"merge",ls:"list",modify:"edit",remove:"delete",rm:"delete",update:"edit",view:"show"};async function ne(){let[,,,t,...o]=process.argv;if(!t||t==="--help"||t==="-h"){an();return}let s=t;if(!fn.includes(t)){let e=Qt(t,ga);if(e&&fn.includes(e))s=e,Et.warn(`Assuming you meant '${e}'`)}if(!fn.includes(s)){Et.error(`Unknown stone command: ${t}`);let e=Zt(t,fn);if(e.length>0){Et.error("Did you mean one of these?");for(let r of e)Et.error(` ${r}`)}Et.error("Run 'sisyphus stone --help' for usage information"),process.exit(1)}if(o.includes("--help")||o.includes("-h")){an(s);return}try{switch(s){case"list":await Ys();break;case"delete":await Js(o[0]);break;case"show":await te(o[0]);break;case"edit":await Ws(o[0]);break;case"merge":await Ds(o);break;case"help":{let e=o[0];an(e);break}default:throw new Error(`Unknown stone command: ${s}`)}}catch(e){Et.error(`Failed to execute stone ${s}:`,e),process.exit(1)}}N();P();import{parseArgs as $a}from"util";_();N();B();P();_();var{$:oe}=globalThis.Bun;var ba=x({prefix:"sisyphus"}).child("from-commits"),ya=/^(\w+)(?:\(([^)]+)\))?(!)?: (.+)$/,se={build:"patch",chore:"patch",ci:"patch",docs:"patch",feat:"minor",fix:"patch",perf:"patch",refactor:"patch",style:"patch",test:"patch"};async function ee(t){try{let s=(await O()).lastStone?.commit||"",e=s?`${s}..HEAD`:"HEAD",{stdout:r}=await oe`git log ${e} --pretty=format:"%H|%s" --no-merges`.quiet();if(!r.toString().trim())return w.info("No commits found since last release"),[];let i=r.toString().trim().split(`
651
- `),n=[];for(let c of i){let[m,l]=c.split("|");if(!m||!l)continue;let p=da(m,l);if(p){let{stdout:g}=await oe`git diff-tree --no-commit-id --name-only -r ${m}`.quiet();p.files=g.toString().trim().split(`
652
- `).filter(Boolean),n.push(p)}}if(n.length===0)return w.info("No conventional commits found"),[];let a=await wa(n,t);return w.info(`Found ${f.bold(String(n.length))} conventional commits`),w.info(`Creating ${f.bold(String(a.length))} stone${a.length>1?"s":""}`),a}catch(o){throw ba.error("Failed to analyze commits:",o),o}}function da(t,o){let s=o.match(ya);if(!s)return null;let[,e="",r,i,n=""]=s;if(!e||!se[e])return null;return{breaking:!!i,files:[],hash:t,message:n,scope:r,type:e}}async function wa(t,o){let{packages:s}=await Promise.resolve().then(() => (_(),Vn)).then((i)=>i.getPackages({filter:o})),e=new Map;for(let[i,n]of Object.entries(s)){let a=n.file.substring(0,n.file.lastIndexOf("/"));e.set(a,i)}let r=new Map;for(let i of t){let n=new Set;for(let l of i.files)for(let[p,g]of e.entries())if(l.startsWith(p))n.add(g);if(n.size===0)continue;let a;if(i.breaking)a="major";else a=se[i.type]||"patch";let c=`${i.type}${i.breaking?"!":""}`;if(!r.has(c)){let l=i.breaking?"feat!: breaking changes":`${i.type}: ${i.type} updates`;r.set(c,{bump:a,message:l,packages:new Set})}let m=r.get(c);if(m)for(let l of n)m.packages.add(l)}return Array.from(r.values()).filter((i)=>i.packages.size>0)}function Sa(){let{values:t}=$a({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 t}function xa(t){let{snapshot:o,bump:s}=t;if(o&&s)throw new Error(`Cannot use both ${h.cyanBright("--snapshot")} and ${h.cyanBright("--bump")} options, pick one.`)}async function va(){let t=await G({active:"Yes, continue",inactive:"No, cancel",message:"Are you sure you want to create a new stone?"});if(!t||F(t))throw new Error("Operation cancelled by user")}async function Ea(t,o,s){await Bun.write(`.sisyphus/stones/${t}.md`,o.join(`
653
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(s,null,2)}
654
- `)}async function re(){try{let t=Sa();xa(t);let{dryRun:o}=Zn(t);if(t["from-commits"]){await ja(t);return}let{packages:s,packageNames:e,privatePackageCount:r}=await L({filter:t.filter});if(r>0)w.info(h.dim(`Note: ${r} private package${r>1?"s":""} excluded from versioning`));let{message:i,majorPackages:n,minorPackages:a,patchPackages:c}=await Is({bump:t.bump,packageNames:e,packages:s,tag:t.tag}),{packages:m,stoneContent:l,stoneName:p}=await rt({majorPackages:n,message:i,minorPackages:a,packages:s,patchPackages:c,tag:t.tag});if(w.step([`${t.dryRun?h.bold(h.yellow(`[dry-run]
655
- `)):""}${h.italic("Changes preview:")}
656
- `,`${h.italic("Stone: ")}${h.bold(i)}`,...m.map(Pt)].join(`
657
- `)),o){w.info(`${h.bold(h.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]"))}
658
1011
  Stone file preview:
659
- ${l.join(`
660
- `)}`);return}if(!t.yes)await va();let g=await O();g.stones.push(p),await Ea(p,l,g),I(`Now you can run ${h.green("bunx @r5n/sisyphus roll")} to release packages
661
- or create another stone with ${h.green("bunx @r5n/sisyphus version")}`,`${h.bold("Stone ")}${h.italic(`${p}.md`)} ${h.green("created!")}`)}catch(t){xt(t instanceof Error?t.message:String(t))}}async function ja(t){let o=await ee(t.filter);if(o.length===0)return;let{packages:s,privatePackageCount:e}=await L({filter:t.filter});if(e>0)w.info(h.dim(`Note: ${e} private package${e>1?"s":""} excluded from versioning`));let r=await O(),i=0;for(let n of o){let a=[],c=[],m=[];for(let g of n.packages)switch(n.bump){case"major":a.push(g);break;case"minor":c.push(g);break;case"patch":case"dependency":m.push(g);break}let{stoneContent:l,stoneName:p}=await rt({majorPackages:a,message:n.message,minorPackages:c,packages:s,patchPackages:m,tag:t.tag});if(t.dryRun)w.info(`${h.bold(h.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]"))}
662
1015
  Stone file preview:
663
- ${l.join(`
664
- `)}`);else r.stones.push(p),await Bun.write(`.sisyphus/stones/${p}.md`,l.join(`
665
- `)),i++}if(!t.dryRun&&i>0)await Bun.write(".sisyphus/config.json",`${JSON.stringify(r,null,2)}
666
- `),I(`Created ${h.bold(String(i))} stone${i>1?"s":""} from commits.
667
- Run ${h.green("bunx @r5n/sisyphus preview")} to see what will be released`,h.green("Success!"))}var mn=["init","check","version","roll","solo","stone","preview","prerelease","graph","metrics","insights","migrate","pr","help"],Tt=x({prefix:"sisyphus"}),Ra={c:"check",cheack:"check",chekc:"check",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 Oa(){try{let[,,t,...o]=process.argv;if(!t||t==="--help"||t==="-h"){en();return}let s=t;if(!mn.includes(t)){let e=Qt(t,Ra);if(e&&mn.includes(e))s=e,Tt.warn(`Assuming you meant '${e}'`)}if(!mn.includes(s)){Tt.error(`Unknown command: ${t}`);let e=Zt(t,mn);if(e.length>0){Tt.error("Did you mean one of these?");for(let r of e)Tt.error(` ${r}`)}Tt.error("Run 'sisyphus --help' for usage information"),process.exit(1)}if(o.includes("--help")||o.includes("-h")){en(s);return}switch(s){case"init":await Ps();break;case"check":await Es();break;case"version":await re();break;case"roll":await xs();break;case"solo":await qs();break;case"stone":await ne();break;case"preview":await Hs();break;case"prerelease":await Ls();break;case"graph":await Rs();break;case"metrics":await Ns();break;case"insights":await Bs();break;case"migrate":await Us();break;case"pr":await Cs();break;case"help":{let e=o[0];en(e);break}default:throw new Error(`Unknown command: ${s}`)}}catch(t){Vo(t)}}await Oa();
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();