@r5n/sisyphus 0.3.42 → 0.4.0

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 (2) hide show
  1. package/dist/cli.js +374 -176
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,118 +1,124 @@
1
1
  #!/usr/bin/env bun
2
- var hr=Object.create;var{getPrototypeOf:pr,defineProperty:Tn,getOwnPropertyNames:br}=Object;var dr=Object.prototype.hasOwnProperty;var yn=(n,t,r)=>{r=n!=null?hr(pr(n)):{};let s=t||!n||!n.__esModule?Tn(r,"default",{value:n,enumerable:!0}):r;for(let i of br(n))if(!dr.call(s,i))Tn(s,i,{get:()=>n[i],enumerable:!0});return s};var qo=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var yr=(n,t)=>{for(var r in t)Tn(n,r,{get:t[r],enumerable:!0,configurable:!0,set:(s)=>t[r]=()=>s})};var C=(n,t)=>()=>(n&&(t=n(n=0)),t);var wr=import.meta.require;function Vn(n){return(t)=>$r?`${n}${t}${Jo.reset}`:t}function Po({bright:n=!1,color:t}){let r=Bun.color(t,"ansi");if(!r)return"";return n?xr[r]||r:r}var $r,gr,ur,Jo,xr,Sr,vr,m;var kn=C(()=>{$r=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout.isTTY),gr=["blue","cyan","gray","green","magenta","red","white","yellow"],ur=["bold","dim","italic","underline","reset"],Jo={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",underline:"\x1B[4m"},xr={"\x1B[30m":"\x1B[90m","\x1B[31m":"\x1B[91m","\x1B[32m":"\x1B[92m","\x1B[33m":"\x1B[93m","\x1B[34m":"\x1B[94m","\x1B[35m":"\x1B[95m","\x1B[36m":"\x1B[96m","\x1B[37m":"\x1B[97m"};Sr=gr.reduce((n,t)=>{return n[t]=Vn(Po({color:t})),n[`${t}Bright`]=Vn(Po({bright:!0,color:t})),n},{}),vr=ur.reduce((n,t)=>{return n[t]=Vn(Jo[t]),n},{}),m={...Sr,...vr}});function Rn({prefix:n,level:t,message:r}){let s=new Date().toISOString().split("T")[1]?.split(".")[0]||"",i=n?`[${n}] `:"";return`${m.dim(s||"")} ${t} ${i}${r}`}var v=({prefix:n="",level:t=process.env.DEBUG?0:1}={})=>{function r(...c){if(t<=0){let a=c.join(" ");console.log(Rn({level:m.dim("DEBUG"),message:a,prefix:n}))}}function s(...c){if(t<=1){let a=c.join(" ");console.info(Rn({level:m.cyan("INFO "),message:a,prefix:n}))}}function i(...c){if(t<=2){let a=c.join(" ");console.warn(Rn({level:m.yellow("WARN "),message:a,prefix:n}))}}function e(...c){if(t<=3){let a=c.join(" ");console.error(Rn({level:m.red("ERROR"),message:a,prefix:n}))}}function o(c){return v({level:t,prefix:`${n}:${c}`})}return{child:o,debug:r,error:e,info:s,warn:i}},Fn;var Bo=C(()=>{kn();Fn=v()});var _=C(()=>{kn();Bo()});var h;var Xo=C(()=>{_();h={arrow:m.yellow,bold:m.bold,boolean:m.cyan,bullet:m.yellow,busy:m.yellow,command:m.green,dim:m.dim,error:m.red,flag:m.yellow,info:m.cyan,number:m.magenta,offline:m.red,online:m.green,separator:m.dim,string:m.green,success:m.green,value:m.cyan,warning:m.yellow}});var oo=qo((Ti,Wo)=>{var no={to(n,t){if(!t)return`\x1B[${n+1}G`;return`\x1B[${t+1};${n+1}H`},move(n,t){let r="";if(n<0)r+=`\x1B[${-n}D`;else if(n>0)r+=`\x1B[${n}C`;if(t<0)r+=`\x1B[${-t}A`;else if(t>0)r+=`\x1B[${t}B`;return r},up:(n=1)=>`\x1B[${n}A`,down:(n=1)=>`\x1B[${n}B`,forward:(n=1)=>`\x1B[${n}C`,backward:(n=1)=>`\x1B[${n}D`,nextLine:(n=1)=>"\x1B[E".repeat(n),prevLine:(n=1)=>"\x1B[F".repeat(n),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Er={up:(n=1)=>"\x1B[S".repeat(n),down:(n=1)=>"\x1B[T".repeat(n)},Or={screen:"\x1B[2J",up:(n=1)=>"\x1B[1J".repeat(n),down:(n=1)=>"\x1B[J".repeat(n),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(n){let t="";for(let r=0;r<n;r++)t+=this.line+(r<n-1?no.up():"");if(n)t+=no.left;return t}};Wo.exports={cursor:no,scroll:Er,erase:Or,beep:"\x07"}});var ro=qo((Vi,to)=>{var _n=process||{},zo=_n.argv||[],An=_n.env||{},jr=!(!!An.NO_COLOR||zo.includes("--no-color"))&&(!!An.FORCE_COLOR||zo.includes("--color")||_n.platform==="win32"||(_n.stdout||{}).isTTY&&An.TERM!=="dumb"||!!An.CI),Rr=(n,t,r=n)=>(s)=>{let i=""+s,e=i.indexOf(t,n.length);return~e?n+Ar(i,t,r,e)+t:n+i+t},Ar=(n,t,r,s)=>{let i="",e=0;do i+=n.substring(e,s)+r,e=s+t.length,s=n.indexOf(t,e);while(~s);return i+n.substring(e)},Ko=(n=jr)=>{let t=n?Rr:()=>String;return{isColorSupported:n,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};to.exports=Ko();to.exports.createColors=Ko});import{stdin as ot,stdout as tt}from"process";import*as k from"readline";import Yo from"readline";import{Writable as _r}from"stream";function Mr({onlyFirst:n=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,n?void 0:"g")}function st(n){if(typeof n!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof n}\``);return n.replace(Ir,"")}function it(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function wn(n,t={}){if(typeof n!="string"||n.length===0||(t={ambiguousIsNarrow:!0,...t},n=st(n),n.length===0))return 0;n=n.replace(Hr()," ");let r=t.ambiguousIsNarrow?1:2,s=0;for(let i of n){let e=i.codePointAt(0);if(e<=31||e>=127&&e<=159||e>=768&&e<=879)continue;switch(Ur.eastAsianWidth(i)){case"F":case"W":s+=2;break;case"A":s+=r;break;default:s+=1}}return s}function qr(){let n=new Map;for(let[t,r]of Object.entries(M)){for(let[s,i]of Object.entries(r))M[s]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[s]=M[s],n.set(i[0],i[1]);Object.defineProperty(M,t,{value:r,enumerable:!1})}return Object.defineProperty(M,"codes",{value:n,enumerable:!1}),M.color.close="\x1B[39m",M.bgColor.close="\x1B[49m",M.color.ansi=Zo(),M.color.ansi256=Qo(),M.color.ansi16m=To(),M.bgColor.ansi=Zo(so),M.bgColor.ansi256=Qo(so),M.bgColor.ansi16m=To(so),Object.defineProperties(M,{rgbToAnsi256:{value:(t,r,s)=>t===r&&r===s?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:(t)=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[s]=r;s.length===3&&(s=[...s].map((e)=>e+e).join(""));let i=Number.parseInt(s,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:(t)=>M.rgbToAnsi256(...M.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:(t)=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,s,i;if(t>=232)r=((t-232)*10+8)/255,s=r,i=r;else{t-=16;let c=t%36;r=Math.floor(t/36)/5,s=Math.floor(c/6)/5,i=c%6/5}let e=Math.max(r,s,i)*2;if(e===0)return 30;let o=30+(Math.round(i)<<2|Math.round(s)<<1|Math.round(r));return e===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,r,s)=>M.ansi256ToAnsi(M.rgbToAnsi256(t,r,s)),enumerable:!1},hexToAnsi:{value:(t)=>M.ansi256ToAnsi(M.hexToAnsi256(t)),enumerable:!1}}),M}function Fo(n,t,r){return String(n).normalize().replace(/\r\n/g,`
2
+ var 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,`
3
3
  `).split(`
4
- `).map((s)=>zr(s,t,r)).join(`
5
- `)}function lo(n,t){if(typeof n=="string")return In.aliases.get(n)===t;for(let r of n)if(r!==void 0&&lo(r,t))return!0;return!1}function Yr(n,t){if(n===t)return;let r=n.split(`
6
- `),s=t.split(`
7
- `),i=[];for(let e=0;e<Math.max(r.length,s.length);e++)r[e]!==s[e]&&i.push(e);return i}function Q(n){return n===eo}function Mn(n,t){let r=n;r.isTTY&&r.setRawMode(t)}function lt({input:n=ot,output:t=tt,overwrite:r=!0,hideCursor:s=!0}={}){let i=k.createInterface({input:n,output:t,prompt:"",tabSize:1});k.emitKeypressEvents(n,i),n.isTTY&&n.setRawMode(!0);let e=(o,{name:c,sequence:a})=>{let l=String(o);if(lo([l,c,a],"cancel")){s&&t.write(P.cursor.show),process.exit(0);return}if(!r)return;k.moveCursor(t,c==="return"?0:-1,c==="return"?-1:0,()=>{k.clearLine(t,1,()=>{n.once("keypress",e)})})};return s&&t.write(P.cursor.hide),n.once("keypress",e),()=>{n.off("keypress",e),s&&t.write(P.cursor.show),n.isTTY&&!Zr&&n.setRawMode(!1),i.terminal=!1,i.close()}}class $n{constructor(n,t=!0){X(this,"input"),X(this,"output"),X(this,"_abortSignal"),X(this,"rl"),X(this,"opts"),X(this,"_render"),X(this,"_track",!1),X(this,"_prevFrame",""),X(this,"_subscribers",new Map),X(this,"_cursor",0),X(this,"state","initial"),X(this,"error",""),X(this,"value");let{input:r=ot,output:s=tt,render:i,signal:e,...o}=n;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=e,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(n,t){let r=this._subscribers.get(n)??[];r.push(t),this._subscribers.set(n,r)}on(n,t){this.setSubscriber(n,{cb:t})}once(n,t){this.setSubscriber(n,{cb:t,once:!0})}emit(n,...t){let r=this._subscribers.get(n)??[],s=[];for(let i of r)i.cb(...t),i.once&&s.push(()=>r.splice(r.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise((n,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),n(eo);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new _r;r._write=(s,i,e)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),e()},this.input.pipe(r),this.rl=Yo.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Yo.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Mn(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(P.cursor.show),this.output.off("resize",this.render),Mn(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(P.cursor.show),this.output.off("resize",this.render),Mn(this.input,!1),n(eo)})})}onKeypress(n,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&In.aliases.has(t.name)&&this.emit("cursor",In.aliases.get(t.name)),In.actions.has(t.name)&&this.emit("cursor",t.name)),n&&(n.toLowerCase()==="y"||n.toLowerCase()==="n")&&this.emit("confirm",n.toLowerCase()==="y"),n==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),n&&this.emit("key",n.toLowerCase()),t?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}lo([n,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
8
- `),Mn(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let n=Fo(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
9
- `).length-1;this.output.write(P.cursor.move(-999,n*-1))}render(){let n=Fo(this._render(this)??"",process.stdout.columns,{hard:!0});if(n!==this._prevFrame){if(this.state==="initial")this.output.write(P.cursor.hide);else{let t=Yr(this._prevFrame,n);if(this.restoreCursor(),t&&t?.length===1){let r=t[0];this.output.write(P.cursor.move(0,r)),this.output.write(P.erase.lines(1));let s=n.split(`
10
- `);this.output.write(s[r]),this._prevFrame=n,this.output.write(P.cursor.move(0,s.length-r-1));return}if(t&&t?.length>1){let r=t[0];this.output.write(P.cursor.move(0,r)),this.output.write(P.erase.down());let s=n.split(`
11
- `).slice(r);this.output.write(s.join(`
12
- `)),this._prevFrame=n;return}this.output.write(P.erase.down())}this.output.write(n),this.state==="initial"&&(this.state="active"),this._prevFrame=n}}}var P,rt,Ir,et,Gr,Ur,Nr=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Hr,so=10,Zo=(n=0)=>(t)=>`\x1B[${t+n}m`,Qo=(n=0)=>(t)=>`\x1B[${38+n};5;${t}m`,To=(n=0)=>(t,r,s)=>`\x1B[${38+n};2;${t};${r};${s}m`,M,Cr,Lr,Pr,Gn,Jr=39,co="\x07",ct="[",Br="]",at="m",ao,Vo=(n)=>`${Gn.values().next().value}${ct}${n}${at}`,ko=(n)=>`${Gn.values().next().value}${ao}${n}${co}`,Xr=(n)=>n.split(" ").map((t)=>wn(t)),io=(n,t,r)=>{let s=[...t],i=!1,e=!1,o=wn(st(n[n.length-1]));for(let[c,a]of s.entries()){let l=wn(a);if(o+l<=r?n[n.length-1]+=a:(n.push(a),o=0),Gn.has(a)&&(i=!0,e=s.slice(c+1).join("").startsWith(ao)),i){e?a===co&&(i=!1,e=!1):a===at&&(i=!1);continue}o+=l,o===r&&c<s.length-1&&(n.push(""),o=0)}!o&&n[n.length-1].length>0&&n.length>1&&(n[n.length-2]+=n.pop())},Wr=(n)=>{let t=n.split(" "),r=t.length;for(;r>0&&!(wn(t[r-1])>0);)r--;return r===t.length?n:t.slice(0,r).join(" ")+t.slice(r).join("")},zr=(n,t,r={})=>{if(r.trim!==!1&&n.trim()==="")return"";let s="",i,e,o=Xr(n),c=[""];for(let[l,f]of n.split(" ").entries()){r.trim!==!1&&(c[c.length-1]=c[c.length-1].trimStart());let p=wn(c[c.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(c.push(""),p=0),(p>0||r.trim===!1)&&(c[c.length-1]+=" ",p++)),r.hard&&o[l]>t){let d=t-p,w=1+Math.floor((o[l]-d-1)/t);Math.floor((o[l]-1)/t)<w&&c.push(""),io(c,f,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(r.wordWrap===!1&&p<t){io(c,f,t);continue}c.push("")}if(p+o[l]>t&&r.wordWrap===!1){io(c,f,t);continue}c[c.length-1]+=f}r.trim!==!1&&(c=c.map((l)=>Wr(l)));let a=[...c.join(`
13
- `)];for(let[l,f]of a.entries()){if(s+=f,Gn.has(f)){let{groups:d}=new RegExp(`(?:\\${ct}(?<code>\\d+)m|\\${ao}(?<uri>.*)${co})`).exec(a.slice(l).join(""))||{groups:{}};if(d.code!==void 0){let w=Number.parseFloat(d.code);i=w===Jr?void 0:w}else d.uri!==void 0&&(e=d.uri.length===0?void 0:d.uri)}let p=Pr.codes.get(Number(i));a[l+1]===`
14
- `?(e&&(s+=ko("")),i&&p&&(s+=Vo(p))):f===`
15
- `&&(i&&p&&(s+=Vo(i)),e&&(s+=ko(e)))}return s},Kr,In,Zr,eo,Qr,Tr=(n,t,r)=>(t in n)?Qr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,X=(n,t,r)=>(Tr(n,typeof t!="symbol"?t+"":t,r),r),fo,Vr,kr,Fr=(n,t,r)=>(t in n)?kr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,Do=(n,t,r)=>(Fr(n,typeof t!="symbol"?t+"":t,r),r),ft,Dr,ns=(n,t,r)=>(t in n)?Dr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,nt=(n,t,r)=>(ns(n,typeof t!="symbol"?t+"":t,r),r),mo,ho;var po=C(()=>{P=yn(oo(),1),rt=yn(ro(),1);Ir=Mr();et={exports:{}};(function(n){var t={};n.exports=t,t.eastAsianWidth=function(s){var i=s.charCodeAt(0),e=s.length==2?s.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=e&&e<=57343&&(i&=1023,e&=1023,o=i<<10|e,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},t.characterLength=function(s){var i=this.eastAsianWidth(s);return i=="F"||i=="W"||i=="A"?2:1};function r(s){return s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(s){for(var i=r(s),e=0,o=0;o<i.length;o++)e=e+this.characterLength(i[o]);return e},t.slice=function(s,i,e){textLen=t.length(s),i=i||0,e=e||1,i<0&&(i=textLen+i),e<0&&(e=textLen+e);for(var o="",c=0,a=r(s),l=0;l<a.length;l++){var f=a[l],p=t.length(f);if(c>=i-(p==2?1:0))if(c+p<=e)o+=f;else break;c+=p}return o}})(et);Gr=et.exports,Ur=it(Gr),Hr=it(Nr);M={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(M.modifier);Cr=Object.keys(M.color),Lr=Object.keys(M.bgColor);[...Cr];Pr=qr(),Gn=new Set(["\x1B","\x9B"]),ao=`${Br}8;;`;Kr=["up","down","left","right","space","enter","cancel"],In={actions:new Set(Kr),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};Zr=globalThis.process.platform.startsWith("win"),eo=Symbol("clack:cancel");Qr=Object.defineProperty;fo=class fo extends $n{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(n){super(n,!1),this.value=!!n.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(P.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Vr=new WeakMap;kr=Object.defineProperty,ft=class extends $n{constructor(n){super(n,!1),Do(this,"options"),Do(this,"cursor",0),this.options=n.options,this.value=[...n.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===n.cursorAt),0),this.on("key",(t)=>{t==="a"&&this.toggleAll()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let n=this.value.length===this.options.length;this.value=n?[]:this.options.map((t)=>t.value)}toggleValue(){let n=this.value.includes(this._value);this.value=n?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}},Dr=Object.defineProperty;mo=class mo extends $n{constructor(n){super(n,!1),nt(this,"options"),nt(this,"cursor",0),this.options=n.options,this.cursor=this.options.findIndex(({value:t})=>t===n.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};ho=class ho extends $n{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let n=this.value.slice(0,this.cursor),[t,...r]=this.value.slice(this.cursor);return`${n}${rt.default.inverse(t)}${r.join("")}`}get cursor(){return this._cursor}constructor(n){super(n),this.on("finalize",()=>{this.value||(this.value=n.defaultValue)})}}});import{stripVTControlCharacters as bo}from"util";import K from"process";function os(){return K.platform!=="win32"?K.env.TERM!=="linux":!!K.env.CI||!!K.env.WT_SESSION||!!K.env.TERMINUS_SUBLIME||K.env.ConEmuTask==="{cmd::Cmder}"||K.env.TERM_PROGRAM==="Terminus-Sublime"||K.env.TERM_PROGRAM==="vscode"||K.env.TERM==="xterm-256color"||K.env.TERM==="alacritty"||K.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var b,Un,yo,G=(n,t)=>yo?n:t,ts,pt,bt,Nn,le,O,nn,wo,$o,rs,mt,ss,fe,ht,is,es,cs,as,ls,fs,ms,Hn=(n)=>{switch(n){case"initial":case"active":return b.default.cyan(ts);case"cancel":return b.default.red(pt);case"error":return b.default.yellow(bt);case"submit":return b.default.green(Nn)}},go=(n)=>{let{cursor:t,options:r,style:s}=n,i=n.maxItems??Number.POSITIVE_INFINITY,e=Math.max(process.stdout.rows-4,0),o=Math.min(e,Math.max(i,5)),c=0;t>=c+o-3?c=Math.max(Math.min(t-o+3,r.length-o),0):t<c+2&&(c=Math.max(t-2,0));let a=o<r.length&&c>0,l=o<r.length&&c+o<r.length;return r.slice(c,c+o).map((f,p,d)=>{let w=p===0&&a,y=p===d.length-1&&l;return w||y?b.default.dim("..."):s(f,p+c===t)})},W=(n)=>new ho({validate:n.validate,placeholder:n.placeholder,defaultValue:n.defaultValue,initialValue:n.initialValue,render(){let t=`${b.default.gray(O)}
16
- ${Hn(this.state)} ${n.message}
17
- `,r=n.placeholder?b.default.inverse(n.placeholder[0])+b.default.dim(n.placeholder.slice(1)):b.default.inverse(b.default.hidden("_")),s=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${t.trim()}
18
- ${b.default.yellow(O)} ${s}
19
- ${b.default.yellow(nn)} ${b.default.yellow(this.error)}
20
- `;case"submit":return`${t}${b.default.gray(O)} ${b.default.dim(this.value||n.placeholder)}`;case"cancel":return`${t}${b.default.gray(O)} ${b.default.strikethrough(b.default.dim(this.value??""))}${this.value?.trim()?`
21
- ${b.default.gray(O)}`:""}`;default:return`${t}${b.default.cyan(O)} ${s}
22
- ${b.default.cyan(nn)}
23
- `}}}).prompt(),N=(n)=>{let t=n.active??"Yes",r=n.inactive??"No";return new fo({active:t,inactive:r,initialValue:n.initialValue??!0,render(){let s=`${b.default.gray(O)}
24
- ${Hn(this.state)} ${n.message}
25
- `,i=this.value?t:r;switch(this.state){case"submit":return`${s}${b.default.gray(O)} ${b.default.dim(i)}`;case"cancel":return`${s}${b.default.gray(O)} ${b.default.strikethrough(b.default.dim(i))}
26
- ${b.default.gray(O)}`;default:return`${s}${b.default.cyan(O)} ${this.value?`${b.default.green(wo)} ${t}`:`${b.default.dim($o)} ${b.default.dim(t)}`} ${b.default.dim("/")} ${this.value?`${b.default.dim($o)} ${b.default.dim(r)}`:`${b.default.green(wo)} ${r}`}
27
- ${b.default.cyan(nn)}
28
- `}}}).prompt()},an=(n)=>{let t=(r,s)=>{let i=r.label??String(r.value);switch(s){case"selected":return`${b.default.dim(i)}`;case"active":return`${b.default.green(wo)} ${i} ${r.hint?b.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${b.default.strikethrough(b.default.dim(i))}`;default:return`${b.default.dim($o)} ${b.default.dim(i)}`}};return new mo({options:n.options,initialValue:n.initialValue,render(){let r=`${b.default.gray(O)}
29
- ${Hn(this.state)} ${n.message}
30
- `;switch(this.state){case"submit":return`${r}${b.default.gray(O)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${b.default.gray(O)} ${t(this.options[this.cursor],"cancelled")}
31
- ${b.default.gray(O)}`;default:return`${r}${b.default.cyan(O)} ${go({cursor:this.cursor,options:this.options,maxItems:n.maxItems,style:(s,i)=>t(s,i?"active":"inactive")}).join(`
32
- ${b.default.cyan(O)} `)}
33
- ${b.default.cyan(nn)}
34
- `}}}).prompt()},Cn=(n)=>{let t=(r,s)=>{let i=r.label??String(r.value);return s==="active"?`${b.default.cyan(rs)} ${i} ${r.hint?b.default.dim(`(${r.hint})`):""}`:s==="selected"?`${b.default.green(mt)} ${b.default.dim(i)} ${r.hint?b.default.dim(`(${r.hint})`):""}`:s==="cancelled"?`${b.default.strikethrough(b.default.dim(i))}`:s==="active-selected"?`${b.default.green(mt)} ${i} ${r.hint?b.default.dim(`(${r.hint})`):""}`:s==="submitted"?`${b.default.dim(i)}`:`${b.default.dim(ss)} ${b.default.dim(i)}`};return new ft({options:n.options,initialValues:n.initialValues,required:n.required??!0,cursorAt:n.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
35
- ${b.default.reset(b.default.dim(`Press ${b.default.gray(b.default.bgWhite(b.default.inverse(" space ")))} to select, ${b.default.gray(b.default.bgWhite(b.default.inverse(" enter ")))} to submit`))}`},render(){let r=`${b.default.gray(O)}
36
- ${Hn(this.state)} ${n.message}
37
- `,s=(i,e)=>{let o=this.value.includes(i.value);return e&&o?t(i,"active-selected"):o?t(i,"selected"):t(i,e?"active":"inactive")};switch(this.state){case"submit":return`${r}${b.default.gray(O)} ${this.options.filter(({value:i})=>this.value.includes(i)).map((i)=>t(i,"submitted")).join(b.default.dim(", "))||b.default.dim("none")}`;case"cancel":{let i=this.options.filter(({value:e})=>this.value.includes(e)).map((e)=>t(e,"cancelled")).join(b.default.dim(", "));return`${r}${b.default.gray(O)} ${i.trim()?`${i}
38
- ${b.default.gray(O)}`:""}`}case"error":{let i=this.error.split(`
39
- `).map((e,o)=>o===0?`${b.default.yellow(nn)} ${b.default.yellow(e)}`:` ${e}`).join(`
40
- `);return`${r+b.default.yellow(O)} ${go({options:this.options,cursor:this.cursor,maxItems:n.maxItems,style:s}).join(`
41
- ${b.default.yellow(O)} `)}
42
- ${i}
43
- `}default:return`${r}${b.default.cyan(O)} ${go({options:this.options,cursor:this.cursor,maxItems:n.maxItems,style:s}).join(`
44
- ${b.default.cyan(O)} `)}
45
- ${b.default.cyan(nn)}
46
- `}}}).prompt()},L=(n="",t="")=>{let r=`
47
- ${n}
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
48
  `.split(`
49
- `),s=bo(t).length,i=Math.max(r.reduce((o,c)=>{let a=bo(c);return a.length>o?a.length:o},0),s)+2,e=r.map((o)=>`${b.default.gray(O)} ${b.default.dim(o)}${" ".repeat(i-bo(o).length)}${b.default.gray(O)}`).join(`
50
- `);process.stdout.write(`${b.default.gray(O)}
51
- ${b.default.green(Nn)} ${b.default.reset(t)} ${b.default.gray(ht.repeat(Math.max(i-s-1,1))+is)}
52
- ${e}
53
- ${b.default.gray(es+ht.repeat(i+2)+cs)}
54
- `)},dt=(n="")=>{process.stdout.write(`${b.default.gray(nn)} ${b.default.red(n)}
55
-
56
- `)},$,me,yt=({indicator:n="dots"}={})=>{let t=yo?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=yo?80:120,s=process.env.CI==="true",i,e,o=!1,c="",a,l=performance.now(),f=(E)=>{let A=E>1?"Something went wrong":"Canceled";o&&I(A,E)},p=()=>f(2),d=()=>f(1),w=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",f)},y=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",f)},g=()=>{if(a===void 0)return;s&&process.stdout.write(`
57
- `);let E=a.split(`
58
- `);process.stdout.write(Un.cursor.move(-999,E.length-1)),process.stdout.write(Un.erase.down(E.length))},x=(E)=>E.replace(/\.+$/,""),u=(E)=>{let A=(performance.now()-E)/1000,R=Math.floor(A/60),z=Math.floor(A%60);return R>0?`[${R}m ${z}s]`:`[${z}s]`},S=(E="")=>{o=!0,i=lt(),c=x(E),l=performance.now(),process.stdout.write(`${b.default.gray(O)}
59
- `);let A=0,R=0;w(),e=setInterval(()=>{if(s&&c===a)return;g(),a=c;let z=b.default.magenta(t[A]);if(s)process.stdout.write(`${z} ${c}...`);else if(n==="timer")process.stdout.write(`${z} ${c} ${u(l)}`);else{let Z=".".repeat(Math.floor(R)).slice(0,3);process.stdout.write(`${z} ${c}${Z}`)}A=A+1<t.length?A+1:0,R=R<t.length?R+0.125:0},r)},I=(E="",A=0)=>{o=!1,clearInterval(e),g();let R=A===0?b.default.green(Nn):A===1?b.default.red(pt):b.default.red(bt);c=x(E??c),n==="timer"?process.stdout.write(`${R} ${c} ${u(l)}
60
- `):process.stdout.write(`${R} ${c}
61
- `),y(),i()};return{start:S,stop:I,message:(E="")=>{c=x(E??c)}}},uo=async(n,t)=>{let r={},s=Object.keys(n);for(let i of s){let e=n[i],o=await e({results:r})?.catch((c)=>{throw c});if(typeof t?.onCancel=="function"&&Q(o)){r[i]="canceled",t.onCancel({results:r});continue}r[i]=o}return r};var q=C(()=>{po();po();b=yn(ro(),1),Un=yn(oo(),1);yo=os(),ts=G("\u25C6","*"),pt=G("\u25A0","x"),bt=G("\u25B2","x"),Nn=G("\u25C7","o"),le=G("\u250C","T"),O=G("\u2502","|"),nn=G("\u2514","\u2014"),wo=G("\u25CF",">"),$o=G("\u25CB"," "),rs=G("\u25FB","[\u2022]"),mt=G("\u25FC","[+]"),ss=G("\u25FB","[ ]"),fe=G("\u25AA","\u2022"),ht=G("\u2500","-"),is=G("\u256E","+"),es=G("\u251C","+"),cs=G("\u256F","+"),as=G("\u25CF","\u2022"),ls=G("\u25C6","*"),fs=G("\u25B2","!"),ms=G("\u25A0","x"),$={message:(n="",{symbol:t=b.default.gray(O)}={})=>{let r=[`${b.default.gray(O)}`];if(n){let[s,...i]=n.split(`
62
- `);r.push(`${t} ${s}`,...i.map((e)=>`${b.default.gray(O)} ${e}`))}process.stdout.write(`${r.join(`
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)}
52
+ ${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)}
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}
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)}
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(`
63
67
  `)}
64
- `)},info:(n)=>{$.message(n,{symbol:b.default.blue(as)})},success:(n)=>{$.message(n,{symbol:b.default.green(ls)})},step:(n)=>{$.message(n,{symbol:b.default.green(Nn)})},warn:(n)=>{$.message(n,{symbol:b.default.yellow(fs)})},warning:(n)=>{$.warn(n)},error:(n)=>{$.message(n,{symbol:b.default.red(ms)})}},me=`${b.default.gray(O)} `});function wt(n,t){let r=hs[n]||"Unknown error";return t?`${r}: ${t}`:r}var hs;var xo=C(()=>{hs={"core.auth.failed":"Authentication failed","core.auth.invalid_token":"Token is invalid or expired","core.fs.cannot_read":"Cannot read file","core.fs.cannot_write":"Cannot write to file","core.fs.directory_not_found":"Directory not found","core.fs.file_not_found":"File not found","core.git.dirty_working_dir":"Working directory has uncommitted changes","core.git.no_commits":"No commits found","core.git.not_repository":"Not a git repository","core.git.operation_failed":"Git operation failed","core.invalid_argument":"Invalid argument","core.invalid_config":"Invalid configuration","core.network.request_failed":"Network request failed","core.operation_cancelled":"Operation cancelled","core.operation_failed":"Operation failed","core.permission_denied":"Permission denied","hydra.config.invalid_format":"Invalid configuration format","hydra.config.missing_required":"Missing required configuration","hydra.config.not_found":"Configuration file not found","hydra.runner.creation_failed":"Runner creation failed","hydra.runner.not_found":"Runner not found","hydra.runner.removal_failed":"Runner removal failed","hydra.token.decryption_failed":"Token decryption failed","hydra.token.encryption_failed":"Token encryption failed","sisyphus.publish.failed":"Publishing failed","sisyphus.release.no_changes":"No changes to release","sisyphus.stone.invalid":"Invalid stone format","sisyphus.stone.not_found":"No stones found","sisyphus.version.conflict":"Version conflict detected","sisyphus.version.invalid_format":"Invalid version format"}});function $t(n={}){let{errorPrefix:t="\u2717"}=n;return function r(s){if(Q(s))ln.info("Operation cancelled"),process.exit(0);if(s instanceof So){if(ln.error(`${t} ${s.message}`),s.code)ln.error(` Error code: ${s.code}`)}else if(s instanceof Error)ln.error(`${t} ${s.message}`);else ln.error(`${t} An unexpected error occurred`),ln.error(String(s));process.exit(1)}}var ln,So;var gt=C(()=>{q();_();xo();ln=v({prefix:"cli-core"}).child("error");So=class So extends Error{code;context;constructor(n,t,r){let s=n.includes(".")&&!n.includes(" ")?wt(n,r):n;super(s);this.code=t;this.context=r;this.name="CLIError"}}});var T,ps=(n,t)=>{let r=n.length,s=t.length,i=1<<r-1,e=-1,o=0,c=r,a=r;while(a--)T[n.charCodeAt(a)]|=1<<a;for(a=0;a<s;a++){let l=T[t.charCodeAt(a)],f=l|o;if(l|=(l&e)+e^e,o|=~(l|e),e&=l,o&i)c++;if(e&i)c--;o=o<<1|1,e=e<<1|~(f|o),o&=f}a=r;while(a--)T[n.charCodeAt(a)]=0;return c},bs=(n,t)=>{let r=t.length,s=n.length,i=[],e=[],o=Math.ceil(r/32),c=Math.ceil(s/32);for(let y=0;y<o;y++)e[y]=-1,i[y]=0;let a=0;for(;a<c-1;a++){let y=0,g=-1,x=a*32,u=Math.min(32,s)+x;for(let S=x;S<u;S++)T[n.charCodeAt(S)]|=1<<S;for(let S=0;S<r;S++){let I=T[t.charCodeAt(S)],E=e[S/32|0]>>>S&1,A=i[S/32|0]>>>S&1,R=I|y,z=((I|A)&g)+g^g|I|A,Z=y|~(z|g),cn=g&z;if(Z>>>31^E)e[S/32|0]^=1<<S;if(cn>>>31^A)i[S/32|0]^=1<<S;Z=Z<<1|E,cn=cn<<1|A,g=cn|~(R|Z),y=Z&R}for(let S=x;S<u;S++)T[n.charCodeAt(S)]=0}let l=0,f=-1,p=a*32,d=Math.min(32,s-p)+p;for(let y=p;y<d;y++)T[n.charCodeAt(y)]|=1<<y;let w=s;for(let y=0;y<r;y++){let g=T[t.charCodeAt(y)],x=e[y/32|0]>>>y&1,u=i[y/32|0]>>>y&1,S=g|l,I=((g|u)&f)+f^f|g|u,E=l|~(I|f),A=f&I;if(w+=E>>>s-1&1,w-=A>>>s-1&1,E>>>31^x)e[y/32|0]^=1<<y;if(A>>>31^u)i[y/32|0]^=1<<y;E=E<<1|x,A=A<<1|u,f=A|~(S|E),l=E&S}for(let y=p;y<d;y++)T[n.charCodeAt(y)]=0;return w},ut=(n,t)=>{if(n.length<t.length){let r=t;t=n,n=r}if(t.length===0)return n.length;if(n.length<=32)return ps(n,t);return bs(n,t)};var xt=C(()=>{T=new Uint32Array(65536)});function Ln(n,t,r=3){return t.map((e)=>({distance:ut(n.toLowerCase(),e.toLowerCase()),option:e})).filter(({distance:e})=>e<=Math.max(3,n.length/2)).sort((e,o)=>e.distance-o.distance).slice(0,r).map(({option:e})=>e)}function qn(n,t){return t[n.toLowerCase()]||null}var St=C(()=>{xt()});async function vo(n,t={}){let{fallback:r,logLevel:s="warn",message:i="Operation failed gracefully"}=t;try{return await n()}catch(e){let o=e instanceof Error?e.message:String(e);if(vt[s](`${i}: ${o}`),r)try{await r()}catch(c){vt.error(`Fallback also failed: ${c instanceof Error?c.message:String(c)}`)}return}}var vt;var Et=C(()=>{_();vt=v({prefix:"cli-core"}).child("graceful")});var Ot=C(()=>{_()});async function jt(n,t={}){let r={...ds,...t},s=new Error("Operation failed");for(let i=1;i<=r.maxAttempts;i++)try{return await n()}catch(e){if(s=e instanceof Error?e:new Error(String(e)),!r.retryableErrors.some((a)=>s.message.toLowerCase().includes(a.toLowerCase()))||i===r.maxAttempts)throw s;r.onRetry(i,s);let c=Math.min(r.initialDelay*r.backoffMultiplier**(i-1),r.maxDelay);await new Promise((a)=>setTimeout(a,c))}throw s}var ds;var Rt=C(()=>{_();ds={backoffMultiplier:2,initialDelay:1000,maxAttempts:3,maxDelay:30000,onRetry:(n,t)=>{Fn.warn(`Retry attempt ${n}: ${t.message}`)},retryableErrors:["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENOTFOUND","rate limit","429","503","502","504","npm ERR!","EPUBLISHCONFLICT"]}});var fn=(n)=>{return n.map=(t)=>fn((r)=>t(n(r))),n.or=(t)=>fn((r)=>{try{return n(r)}catch(s){return t(r)}}),n},Eo=()=>"bad banditype"(),Oo=(n)=>fn((t)=>typeof t===typeof n?t:Eo()),F=()=>Oo(""),At=()=>Oo(!0),Pn=()=>Oo(),_t=(n)=>fn((t)=>t instanceof n?t:Eo()),on=(n)=>_t(Object).map((t)=>{let r={};for(let s in n){let i=n[s](t[s]);i!==void 0&&(r[s]=i)}return r}),Jn=(n)=>_t(Array).map((t)=>t.map(n));function jo(n,t){return fn((r)=>{try{return n(r)}catch{try{return t(r)}catch{throw new Error("No matching schema in union")}}})}function mn(n,t){return(r)=>{if(r===void 0)return t;return n(r)}}function Mt(n){return{parse(t){try{return n(t)}catch(r){throw new Error(r instanceof Error?r.message:"Validation failed")}},safeParse(t){try{return{data:n(t),success:!0}}catch(r){return{error:r instanceof Error?r:new Error("Validation failed"),success:!1}}},validator:n}}function Ro(){return jo(Pn(),F())}function ys(){return jo(Pn(),At())}function Ao(n){return mn(F(),n)}function Bn(n){return mn(Ro(),n)}function D(n){return mn(ys(),n)}function Xn(n){return jo(Pn(),n)}var It=()=>{};var U=C(()=>{Xo();gt();xo();St();Et();Ot();Rt();It()});var ws,$s,gs,us,_o;var Ut=C(()=>{U();ws=on({commit:F(),date:F()}),$s=on({author:Bn("r5n-bot"),email:Ro(),message:Bn("release(\uD83C\uDF89): <packageName@version>")}),gs=on({commitAndPush:D(!1),github:D(!1),npm:D(!1),tags:D(!1)}),us=on({generate:D(!0),root:D(!1)}),_o=Mt(on({$schema:Ao("https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json"),changelog:Xn(us),commit:Xn($s),configPath:Bn(".sisyphus"),ignore:mn(Jn(F()),[]),lastStone:ws,release:Xn(gs),single:D(!1),stones:mn(Jn(F()),[]),tag:Ao("latest")}))});var gn=()=>{};var Nt={};yr(Nt,{versionBumper:()=>B,updateSisyphusConfig:()=>Ho,lineSplitter:()=>Go,isInteractive:()=>Uo,handleCancel:()=>hn,getStones:()=>V,getSisyphusConfig:()=>j,getPackages:()=>J,getPackageUpdateLabel:()=>un,ensureDryRunInTest:()=>No,bumpTypeOrder:()=>tn,bumpTypeAnnotation:()=>rn});var{$:Wn}=globalThis.Bun;function Uo({stream:n=process.stdout}={}){return Boolean(n?.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function hn(n){if(typeof n==="function")n();else dt(n||"Operation cancelled by user");process.exit(0)}function No(n){return n}async function j({overwrite:n,tag:t,dryRun:r,silent:s,configPath:i=".sisyphus",...e}={}){let o=`./${i}/config.json`,a=await Bun.file(o).exists(),l=a&&n,f=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim();if(f.length===0)throw new Error("Couldn't find git repository. Have you initialized git repository?");let p;if(a)try{let y=await Bun.file(".sisyphus/config.json").json(),g=_o.safeParse(y);if(!g.success)throw Mo.error("Configuration validation failed:",y,g),g.error instanceof Error?new Error(`Invalid configuration file: ${g.error.message}`):g.error;p=g.data}catch(y){if(y instanceof Error)throw new Error(`Invalid configuration file: ${y.message}`);throw new Error("Failed to parse configuration file")}else p=_o.parse({$schema:"https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/cli/sisyphus/schema.json",ignore:[],lastStone:{commit:f,date:new Date().toISOString().split(".")[0]||""},stones:[],tag:t||"latest"});let d={...p,...e},w=`${JSON.stringify(d,null,2)}
65
- `;if(r){if(!s)Mo.info(`${m.bold(m.yellow("[dry-run]"))}
66
- ${m.italic(".sisyphus/config.json")}:
67
- ${w}`);return{...p,...e}}if(l)try{await Wn`rm -rf ${i}`.quiet()}catch{}if(a&&!n)return d;return await Wn`mkdir -p ${i}`.quiet(),await Bun.write(o,w),d}async function Ho({dryRun:n,silent:t,configPath:r,...s}){let i=await j({configPath:r}),e=`./${r||i.configPath||".sisyphus"}/config.json`,o=`${JSON.stringify({...i,...s},null,2)}
68
- `;if(n){if(!t)Mo.info(`${m.bold(m.yellow("[dry-run]"))}
69
- ${m.italic(e)} would be updated to
70
- ${o}`);return}await Bun.write(e,o),L(`${m.green("Sisyphus config updated!")}`)}function un({name:n,version:t,bump:r,tag:s}){return`${n}@${t} => ${m.green(B({bump:r,tag:s,version:t}))} ${rn[r]}`}function xs({baseVersion:n,bump:t}){let[r="0",s="0",i="0"]=n.split(".");switch(t){case"major":return`${Number.parseInt(r,10)+1}.0.0`;case"minor":return`${r}.${Number.parseInt(s,10)+1}.0`;case"dependency":case"patch":return`${r}.${s}.${Number.parseInt(i,10)+1}`;default:return`${r}.${s}.${i}`}}function B({version:n="",bump:t,tag:r}){let[s="0.0.0",i=""]=n.split("-"),[e="",o="0"]=i.split(".");if(t==="snapshot"){let c=new Date().toISOString().replace(/[.ZT:-]/g,"").slice(0,14);return`0.0.0-${r||"nightly"}-${c}`}if(r&&!t){let c=r===e?Number.parseInt(o,10)+1:1;return`${s}-${r}.${c}`}if(r||t==="dependency"&&e){let c=r===e?Number.parseInt(o,10)+1:1;return`${s}-${r||e}.${c}`}return xs({baseVersion:s,bump:t})}async function V({dryRun:n,silent:t,configPath:r,testModeEnabled:s}={}){let i=s,e=await j({configPath:r,dryRun:n,silent:t}),o=i&&r?`${r}/stones`:`./${r||e.configPath||".sisyphus"}/stones`;try{let a=(await Wn`ls ${o} 2>/dev/null || true`.quiet()).stdout.toString().trim();if(!a)return[];return a.split(`
71
- `).filter(Boolean).map((f)=>f.replace(".md",""))}catch(c){if(!n)await Wn`mkdir -p ${o}`.quiet();return[]}}async function J({filter:n,single:t}={}){let r=process.cwd(),s=await Bun.file("package.json").json();if(t)return vs(s);let i=s?.workspaces||[];if(i.length===0)throw new Error(`Seems like package.json doesn't have \`workspaces\` field or it's empty. Are you sure you are in the root of the workspace? (cwd: ${r})
72
-
73
- If you want to run Sisyphus in single-mode/root package, use --single flag or set \`"single": true\` in .sisyphus/config.json.`);let e=await Ss({cwd:r,workspaces:i}),o=Object.keys(e);return{packageNames:n?o.filter((c)=>c.includes(n)):o,packages:e}}async function Ss({workspaces:n,cwd:t}){let r={},s={};for(let i of n){let e=new Bun.Glob(`${i}/package.json`).scanSync({cwd:t});for(let o of e){let{name:c,version:a,dependencies:l={},devDependencies:f={}}=await Bun.file(o).json(),d=Object.entries({...l,...f}).map(([w,y])=>y.startsWith("workspace")?w:"").filter(Boolean);for(let w of d)if(s[w]||=[],!s[w].includes(c))s[w].push(c);r[c]={bump:"dependency",dependencyOf:[],file:o,name:c,version:a}}}for(let[i,e]of Object.entries(s))if(r[i])r[i].dependencyOf=e;return r}function vs({name:n,version:t}){return{packageNames:[n],packages:{[n]:{bump:"dependency",dependencyOf:[],file:"package.json",name:n,version:t||"0.0.0"}}}}var Mo,Go="***",tn,rn;var H=C(()=>{q();_();Ut();gn();Mo=v({prefix:"sisyphus"}).child("helpers"),tn=["dependency","patch","minor","major","snapshot"],rn={dependency:"\uD83D\uDCE6",patch:"\uD83D\uDC1B",minor:"\u2728",major:"\uD83D\uDEA8",snapshot:"\uD83D\uDCF8"}});U();_();U();U();var Gt=$t({errorPrefix:"\u2717"});q();U();_();H();q();_();H();import{parseArgs as Ls}from"util";var{$:Y}=globalThis.Bun;U();_();H();var xn=v({prefix:"sisyphus"}).child("changelog");async function Ct({changelogRoot:n,commit:t,dryRun:r=!1,stones:s}){let i=[""],{lastStone:{commit:e=""}}=await j(),o=Es({stones:s});for(let[c,{bump:a,path:l,changelog:f}]of o.entries()){let p=[...f,Ht({commit:t,lastCommit:e})],d=await Bun.file(l).exists(),[w,...y]=d?(await Bun.file(l).text()).split(`
74
- `):[`# ${c}`],g=[w,...p,...y];if(r)xn.info(`${m.bold(m.yellow("[dry-run]"))}
75
- ${g.join(`
76
- `)}`);else if(!await vo(async()=>{return xn.info(`Writing changelog to ${l}`),await Bun.write(l,`${g.join(`
68
+ `)},info:(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]"))}
79
+ ${y.join(`
80
+ `)}`);else if(!await Cn(async()=>{return Bt.info(`Writing changelog to ${m}`),await Bun.write(m,`${y.join(`
77
81
  `).trimEnd()}
78
- `),!0},{logLevel:"error",message:`Failed to write changelog to ${l}`}))continue;let[x="",,,u=""]=f;if(!i.includes(u))i.unshift(u);i.push(`### ${rn[a]} ${c}@${x.slice(7)}`)}if(n){let c=Bun.file("CHANGELOG.md"),a=await c.exists(),[l,...f]=a?(await c.text()).split(`
79
- `):["# Changelog"],p=[l,"",...i,...f,Ht({commit:t,lastCommit:e,root:!0})];if(r)xn.info(`${m.bold(m.yellow("[dry-run]"))}
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]"))}
80
84
  Root changelog:
81
85
  ${p.join(`
82
- `)}`);else await vo(async()=>{xn.info(`Writing root changelog to ${c.name}`),await Bun.write(c,p.join(`
83
- `))},{logLevel:"error",message:"Failed to write root changelog"})}}function Es({stones:n}){let t=new Map;for(let{tag:r,packages:s,message:i}of n)for(let{file:e,name:o,version:c,bump:a}of s){let l=B({bump:a,tag:r,version:c}),{bump:f,path:p,changelog:d}=t.get(o)??{bump:a,changelog:[],path:e.replace("package.json","CHANGELOG.md")},[w="",,,y=""]=d,g=[w.replace("### ","")||"0.0.0",l].sort(Bun.semver.order)[1];t.set(o,{bump:f,changelog:[`### ${rn[a]} ${g}`,"",d.length>0?"__Stones:__":"__Stone:__",`_${i}${y?`, ${y.replace(/_/g,"")}_`:"_"}`],path:p})}return t}var Co="#@!";function Ht({root:n,lastCommit:t,commit:r}){let s=(()=>{try{return Bun.spawnSync(["git","remote","get-url","origin"]).stdout.toString().trim().split(":")[1]?.replaceAll(".git","")||""}catch{return""}})(),e=(()=>{try{return Bun.spawnSync(["git","log",`--pretty=format:%H${Co}%s${Co}%cn`,`${t}..${r}`]).stdout.toString()}catch{return xn.warn("Could not get git commit history"),""}})().split(`
84
- `).map((o)=>{if(o.length===0)return;let[c="",a="",l=""]=o.split(Co);return`- ${s?`[${c.slice(0,7)} ${a}](https://github.com/${s}/commit/${c})`:a} (by [@${l}](https://github.com/${l}))`}).filter(Boolean);return e.length>0?`
85
- <details><summary>${e.length} ${n?"Commits in this release":"Commits since last stone"}:</summary>
86
- ${e.join(`
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(`
87
91
  `)}
88
- </details>`:""}q();_();var Os=/github\.com[:/]([^/]+)\/([^/]+)/;async function js(){if(process.env.GITHUB_REPOSITORY){let[n,t]=process.env.GITHUB_REPOSITORY.split("/");return{owner:n,repo:t}}try{let n=await Bun.file("package.json").json(),t=n.repository?.url||n.repository;if(typeof t==="string"){let r=t.replace("git+","").replace(".git","").replace("git@github.com:","https://github.com/"),[,s,i]=r.match(Os)||[];return{owner:s,repo:i}}}catch{}throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.")}async function Lt({token:n,tag:t,name:r,body:s}){let{owner:i,repo:e}=await js();if(!(i&&e))throw new Error("Could not determine GitHub repository. Please set GITHUB_REPOSITORY environment variable or ensure package.json has a valid repository URL.");let o=`https://api.github.com/repos/${i}/${e}/releases`;try{let c=await fetch(o,{body:JSON.stringify({body:`${r}
89
-
90
- ${s||""}`,draft:!1,name:r,prerelease:t.includes("-"),tag_name:t}),headers:{Accept:"application/vnd.github.v3+json",Authorization:`Bearer ${n}`,"Content-Type":"application/json"},method:"POST"});if(!c.ok){let a=await c.text();throw new Error(`GitHub API returned ${c.status}: ${a}`)}return c.json()}catch(c){if(c instanceof Error)throw new Error(`Failed to create GitHub release: ${c.message}`);throw c}}async function qt({dryRun:n,github:t,githubToken:r,packages:s,rootTag:i,withTags:e}){if(n){$.info("Skipping git operations in dry run mode");return}if(Rs(e,s),As(i),t)await _s({githubToken:r,packages:s,rootTag:i,withTags:e})}function Rs(n,t){if(!n)return;for(let{name:r,version:s}of Object.values(t)){let i=`${r}@${s}`,{exitCode:e,stderr:o}=Bun.spawnSync(["git","tag",i,"-m",`Release ${i}`,"-f"]);if(e!==0)$.error(`Failed to create git tag ${i}: ${o?o.toString():"Unknown error"}`)}}function As(n){if(!n)return;let t=Bun.spawnSync(["git","tag",n,"-m","Release","-f"]);if(t.exitCode!==0)$.error(`Failed to create root tag ${n}: ${t.stderr?Buffer.from(t.stderr).toString():"Unknown error"}`)}async function _s({githubToken:n,packages:t,rootTag:r,withTags:s}){let i=n||process.env.GITHUB_TOKEN;if(!i)return L(m.reset(m.bold(`${m.redBright("No Github token found.")}
91
- Please provide one by using ${m.cyanBright("--githubToken")} flag or by setting ${m.green("GITHUB_TOKEN")} environment variable.`)));try{await Ms(i,s,t),await Is(i,r,t)}catch(e){return $.error(`Failed to create GitHub release:
92
- ${e instanceof Error?e.message:e}`),L(m.reset(m.bold(m.redBright("Failed to create GitHub release. Check your token and permissions."))))}}async function Ms(n,t,r){if(!t)return;for(let s of Object.values(r)){let i=`${s.name}@${s.version}`;await Lt({body:`Release of ${s.name} version ${s.version}`,name:`Release ${i}`,tag:i,token:n}),L(m.green(`\u2713 Created GitHub release for ${i}`))}}async function Is(n,t,r){if(!t)return;let s=Object.values(r).map((i)=>`- ${i.name}@${i.version}`).join(`
93
- `);await Lt({body:`Packages included:
94
- ${s}`,name:`Release ${t}`,tag:t,token:n}),L(m.green(`\u2713 Created GitHub root release ${t}`))}q();U();_();H();var{$:Gs}=globalThis.Bun;async function Pt({packages:n,dryRun:t,npmToken:r}){let s=r||process.env.NPM_CONFIG_TOKEN||process.env.NPM_TOKEN;if(!(s||t))return L(m.reset(m.bold(`${m.redBright("No NPM token found.")}
95
- Please provide one by using ${m.cyanBright("--npmToken")} flag or by setting one of ${m.green("NPM_CONFIG_TOKEN")} or ${m.green("NPM_TOKEN")} environment variables.`)));await Us({dryRun:t,packages:n,token:s})}async function Us({packages:n,dryRun:t,token:r}){let s=await Ns();for(let{name:i,version:e,tag:o,file:c}of Object.values(n)){let a=yt();a.start(`${t?m.yellow("[dry-run]: Test "):""}Publishing ${m.magenta(i)}@${m.cyanBright(e)}...`),await Hs({cwd:c.replace("package.json","")});let l=await(async()=>{try{let f=Cs({dryRun:t,otp:s,tag:o});return await jt(async()=>{let{stdout:p,exitCode:d}=Bun.spawnSync(f,{cwd:c.replace("package.json",""),env:{...process.env,NPM_CONFIG_TOKEN:r,NPM_TOKEN:r},stderr:"inherit"});if(d!==0)throw new Error(`npm publish failed with exit code ${d}`);return p},{onRetry:(p,d)=>{a.stop(),a.start(`${t?m.yellow("[dry-run]: Test "):""}Retrying publish ${m.magenta(i)}@${m.cyanBright(e)} (attempt ${p})...`)}}),`${m.green("Successfully published")} ${m.magenta(i)}@${m.cyanBright(e)}`}catch(f){return $.error(f instanceof Error?f.message:String(f)),`${m.bold(`${m.redBright("Failed")} ${m.magenta(i)}@${m.cyanBright(e)}`)}`}})();a.stop(`${t?m.yellow("[dry-run]: Test "):""}${l}`)}}async function Ns(){if(!Uo())return"";let n=await W({message:"Provide your NPM one-time password"});return Q(n)?"":n}async function Hs({cwd:n}){try{let t=await Gs`cd ${n} && bun run build`.quiet();if(t.exitCode!==0)throw new Error(`Build failed with exit code ${t.exitCode}`)}catch(t){try{if(!(await Bun.file(`${n}/package.json`).json()).scripts?.build)return}catch{}$.warn(`${t instanceof Error?t.message:String(t)}:
96
- Error during build step. If you don't have a build step, you can ignore this message.`)}}function Cs({dryRun:n,tag:t,otp:r}){return["npm","publish","--access","public"].concat(t?["--tag",t]:[]).concat(n?["--dry-run"]:[]).concat(r?["--otp",r]:[])}var sn=v({prefix:"sisyphus"}).child("roll");function qs(){let{values:n}=Ls({allowPositionals:!0,args:Bun.argv,options:{changelog:{short:"c",type:"boolean"},changelogRoot:{short:"r",type:"boolean"},dryRun:{default:!1,short:"d",type:"boolean"},github:{short:"g",type:"boolean"},githubToken:{type:"string"},npm:{short:"n",type:"boolean"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{short:"t",type:"boolean"}},strict:!0});return n}async function Jt(){let n=qs(),{dryRun:t,changelog:r,changelogRoot:s,github:i,githubToken:e,npm:o,npmToken:c,rootTag:a,withTags:l}=n,f=await j(),p=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),d=await(async()=>{try{return await Sn()}catch{return[]}})();if(d.length===0)return L(m.reset(m.bold(`${m.redBright("No stones found.")}
97
- ${m.reset(`Run ${m.green("bunx @r5n/sisyphus")}${m.yellow(" version")} and create some first.`)}`)));if(typeof r==="boolean"?r:f.changelog?.generate)await Ct({changelogRoot:typeof s==="boolean"?s:f.changelog?.root,commit:p,dryRun:t,stones:d});let w=await Ps({dryRun:t,stones:d});if(typeof o==="boolean"?o:f.release?.npm)await Pt({dryRun:t,npmToken:c,packages:w});let y=new Date().toISOString().split(".")[0]||"";if(await qt({dryRun:t,github:typeof i==="boolean"?i:f.release?.github,githubToken:e,packages:w,rootTag:a,withTags:typeof l==="boolean"?l:f.release?.tags}),await Ho({dryRun:t,lastStone:{commit:p,date:y},stones:[]}),!t)await Y`rm -rf .sisyphus/stones`.quiet();if(f.release?.commitAndPush){let g=Object.values(w).map((I)=>`${I.name}@${I.version}`).join(", "),x=f.commit?.message?f.commit.message.replace("{message}",g):`release(\uD83C\uDF89): ${g}`,{stdout:u}=await Y`git config user.name`.quiet(),{stdout:S}=await Y`git config user.email`.quiet();console.log(`git config user.name "${u.toString().trim()}"`,`git config user.email "${S.toString().trim()}"`),await Y`bun lint`.quiet(),await Y`git config user.name "Sisyphus"`,await Y`git config user.email "contact@r5n.dev"`,await Y`git commit --all -m "${x}"`,await Y`git push`,await Y`git config user.name "${u.toString().trim()}"`,await Y`git config user.email "${S.toString().trim()}"`}}async function Sn({dryRun:n,silent:t,configPath:r,testModeEnabled:s}={}){let i=s,e=await V({configPath:r,dryRun:n,silent:t}),{packages:o}=await J({single:i}),c=r||".sisyphus";if(i&&e.length===0&&r)try{let l=`${r}/stones`,p=(await Y`ls ${l} 2>/dev/null || true`.quiet()).stdout.toString().trim(),d=p?p.split(`
98
- `).filter(Boolean).map((w)=>w.replace(".md","")):[];if(d.length>0)return sn.info(`Found ${d.length} stones in test environment`),[{message:"Test stone config",name:d[0],packages:[{bump:"major",file:`${r}/workspace/packages/test-pkg/package.json`,name:"@test/pkg",version:"1.0.0"}],tag:"latest"}]}catch(l){sn.error(`Test directory read error: ${l}`)}let a=[];for(let l of e)try{let p=(await Bun.file(`${c}/stones/${l}.md`).text()).split(`
99
- `),[d]=p,w=d?.replace(/^#+\s*/,"")||"",y=p.findIndex((R)=>R.includes("|")&&R.includes(":---:"));if(y===-1){sn.error(`Failed to parse stone ${l} - could not find table format`);continue}let g=p[y-1],x=p[y+1];if(!g||!x){sn.error(`Failed to parse stone ${l} - invalid table structure`);continue}let u=g.split("|").map((R)=>R.trim()).filter(Boolean),S=x.split("|").map((R)=>R.trim()).filter(Boolean),I=[];for(let R=0;R<u.length;R++){let z=u[R],Z=S[R];if(Z){let cn=Z.split(",").map((jn)=>jn.trim());for(let jn of cn)if(o[jn])I.push({...o[jn],bump:z})}}let E=p.find((R)=>R.trim().startsWith("_")&&R.trim().endsWith("_")),A=E?E.replace(/_/g,"").trim():"";a.push({message:w.trim(),name:l,packages:I,tag:A})}catch(f){sn.error(`Error processing stone ${l}
100
- ${f instanceof Error?f.message:String(f)}`)}return a}async function Ps({stones:n,dryRun:t=!1}){let r=[],s={};for(let{tag:e,packages:o,message:c}of n){r.push(c);for(let a of o){s[a.name]||=a;let l=s[a.name]||a;if(e)l.tag=e;l.bump=tn.indexOf(a.bump)>tn.indexOf(l.bump)?a.bump:l.bump,s[a.name]=l}}let i=Object.values(s).reduce((e,o)=>{return e[o.name]={...o,version:o.tag?B({tag:o.tag,version:B({bump:o.bump,version:o.version})}):B({bump:o.bump,version:o.version})},e},{});if(t)sn.info(`${m.bold(m.yellow("[dry-run]"))}
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]"))}
101
105
  Config for next release:
102
- Stones: ${r.join(", ")}
103
- ${JSON.stringify(i,null,2)}`);else{let e={};for(let[o,c]of Object.entries(i))try{let a=await Bun.file(c.file).json();e[o]={...c,version:a.version}}catch(a){sn.error(`Could not read current version for ${o}: ${a}`)}for(let{version:o,file:c}of Object.values(i)){let a=await Bun.file(c).json();a.version=o,await Bun.write(c,`${JSON.stringify(a,null,2)}
104
- `)}}return i}var Bt=v({prefix:"sisyphus"}).child("check");async function Xt(){let n=await import("util").then((d)=>d.parseArgs),{values:t}=n({allowPositionals:!0,args:Bun.argv,options:{debug:{type:"boolean"},json:{type:"boolean"}},strict:!1}),{json:r=!1,debug:s=!1}=t,i=Boolean(r);await j({dryRun:!0,silent:i});let{packages:e,packageNames:o}=await J(),{packages:c,packageNames:[a=""]}=await J({single:!0}),l=await Sn({dryRun:!0,silent:i});if(s)Bt.info("DEBUG: Stone configs:",JSON.stringify(l,null,2)),Bt.info("DEBUG: Packages:",JSON.stringify(e,null,2));if(i){let d={packages:o.map((w)=>({name:w,version:e[w]?.version})),root:{name:a,version:c[a]?.version},stones:l.map((w)=>({message:w.message,name:w.name,packages:w.packages.map((y)=>({bump:y.bump,name:y.name,newVersion:B({bump:y.bump,tag:w.tag,version:y.version}),version:y.version})),tag:w.tag}))};console.log(JSON.stringify(d,null,2));return}let f=l.length>0?`${h.bold(h.success("Stones:"))}
105
- ${l.map((d)=>`${h.arrow("\u2192")} ${h.bold("Stone:")} ${h.number(d.name)}
106
- ${h.bold("Packages:")}
107
- ${d.packages.map((w)=>` ${rn[w.bump]} ${h.value(w.name)}@${h.success(B({bump:w.bump,tag:d.tag,version:w.version}))} ${h.dim(`(${w.bump})`)}`).join(`
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(`
108
113
  `)}`).join(`
109
114
 
110
- `)}`:"",p=c[a]?.version?`@${c[a]?.version}`:"";if(!i)$.step(`${h.bold(h.success("Root package:"))} ${h.value(a)}${h.dim(p)}
111
- ${h.bold(h.success("Packages:"))}
112
- ${o.map((d)=>{let w=e[d]?.version?`@${e[d]?.version}`:"";return` ${h.bullet("\u2022")} ${h.value(d)}${h.dim(w)}`}).join(`
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(`
113
119
  `)}
114
120
 
115
- ${f}`),L(h.success("Sisyphus check complete."))}q();U();_();H();import{parseArgs as Js}from"util";var Wt=v({prefix:"sisyphus"}).child("graph");function Bs(){let{values:n}=Js({args:process.argv.slice(3),options:{depth:{short:"d",type:"string"},filter:{short:"f",type:"string"},json:{short:"j",type:"boolean"},"show-versions":{short:"v",type:"boolean"}}});return{depth:n.depth?parseInt(n.depth,10):void 0,filter:n.filter,json:n.json,showVersions:n["show-versions"]}}async function zt(){try{let n=Bs(),{packages:t}=await J(),r=Xs(t);if(n.json){let i=Array.from(r.values());console.log(JSON.stringify(i,null,2));return}let s=r;if(n.filter)s=zs(r,n.filter,n.depth);Ks(s,n.showVersions)}catch(n){Wt.error("Failed to generate dependency graph:",n),process.exit(1)}}function Xs(n){let t=new Map;for(let[r,s]of Object.entries(n))t.set(r,{dependencies:[],dependents:s.dependencyOf||[],level:0,name:r,version:s.version});for(let r of t.values())for(let s of r.dependents){let i=t.get(s);if(i)i.dependencies.push(r.name)}return Ws(t),t}function Ws(n){let t=Array.from(n.values()).filter((i)=>i.dependencies.length===0),r=new Set,s=t.map((i)=>({level:0,node:i}));while(s.length>0){let i=s.shift();if(!i)continue;let{node:e,level:o}=i;if(r.has(e.name))continue;r.add(e.name),e.level=o;for(let c of e.dependents){let a=n.get(c);if(a&&!r.has(c))s.push({level:o+1,node:a})}}}function zs(n,t,r){let s=new Map,i=Array.from(n.values()).find((c)=>c.name.includes(t));if(!i)return Wt.warn(`No packages found matching filter: ${t}`),s;let e=[{currentDepth:0,node:i}],o=new Set;while(e.length>0){let c=e.shift();if(!c)continue;let{node:a,currentDepth:l}=c;if(o.has(a.name))continue;if(r!==void 0&&l>r)continue;if(o.add(a.name),s.set(a.name,a),!r||l<r)for(let f of[...a.dependencies,...a.dependents]){let p=n.get(f);if(p&&!o.has(f))e.push({currentDepth:l+1,node:p})}}return s}function Ks(n,t){let r=Array.from(n.values()),s=Math.max(...r.map((e)=>e.level));$.info(`Package Dependency Graph (${n.size} packages)`),console.log();for(let e=0;e<=s;e++){let o=r.filter((c)=>c.level===e);if(o.length===0)continue;console.log(h.dim(`Level ${e}:`));for(let c of o){let l=t?` ${h.dim(`(${c.version})`)}`:"";if(console.log(` ${h.value(c.name)}${l}`),c.dependents.length>0){let f=c.dependents.map((p)=>{return n.get(p)?h.success(p):h.dim(p)}).join(", ");console.log(` ${h.dim("\u2192")} ${f}`)}}console.log()}let i=Ys(n);if(i.length>0){console.log(h.warning("\u26A0\uFE0F Circular dependencies detected:"));for(let e of i)console.log(` ${e.join(" \u2192 ")} \u2192 ${e[0]}`);console.log()}}function Ys(n){let t=[],r=new Set,s=new Set;function i(e,o){if(s.has(e)){let a=o.indexOf(e);if(a!==-1){let l=o.slice(a),f=[...l].sort().join(",");if(!t.some((p)=>[...p].sort().join(",")===f))t.push(l)}return}if(r.has(e))return;r.add(e),s.add(e);let c=n.get(e);if(c)for(let a of c.dependencies)i(a,[...o,a]);s.delete(e)}for(let e of n.keys())if(!r.has(e))i(e,[e]);return t}U();var zn="0.3.42";var Kt={check:`
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:`
116
122
  sisyphus check - Check current state and pending changes
117
123
 
118
124
  USAGE
@@ -174,6 +180,116 @@ EXAMPLES
174
180
 
175
181
  # Reinitialize configuration
176
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
199
+
200
+ # Export insights as JSON
201
+ sisyphus insights --json
202
+
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]
214
+
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]
220
+
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
256
+
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
177
293
  `,prerelease:`
178
294
  sisyphus prerelease - Manage prerelease versions (alpha, beta, rc)
179
295
 
@@ -243,6 +359,31 @@ EXAMPLES
243
359
 
244
360
  # Release with 'next' tag
245
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
246
387
  `,stone:`
247
388
  sisyphus stone - Manage pending stones
248
389
 
@@ -254,7 +395,7 @@ COMMANDS
254
395
  delete <id> Remove a specific stone by ID
255
396
  show <id> Display full content of a stone
256
397
  edit <id> Modify stone content or versions
257
- merge Combine multiple stones into one
398
+ merge Combine stones with conflict resolution
258
399
 
259
400
  EXAMPLES
260
401
  # List all pending stones
@@ -297,45 +438,88 @@ EXAMPLES
297
438
 
298
439
  # Create with specific bump
299
440
  sisyphus version --bump minor --filter @org/core
300
- `};function Kn(n){if(n&&Kt[n]){let r=Kt[n].split(`
301
- `).map((s)=>{if(s.startsWith("sisyphus"))return h.bold(s);if(s==="USAGE"||s==="OPTIONS"||s==="EXAMPLES")return h.bold(s);if(s.startsWith(" -")){let i=s.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(i){let[,e="",o=""]=i,c=o.replace("(required)",h.error("(required)")).replace(/\(default: ([^)]+)\)/g,(a,l)=>h.dim(`(default: ${l})`)).replace(/\[boolean\]/g,h.boolean("[boolean]")).replace(/\[string\]/g,h.string("[string]")).replace(/\[number\]/g,h.number("[number]"));return` ${h.flag(e.padEnd(26))} ${c}`}}if(s.startsWith(" # "))return h.dim(s);if(s.startsWith(" sisyphus"))return` ${h.value(s.trim())}`;return s}).join(`
302
- `);console.log(r);return}console.log(`
303
- ${h.bold(`Sisyphus@${zn} - The rock-solid versioning system`)}
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`)}
304
445
 
305
- ${h.bold("USAGE")}
446
+ ${f.bold("USAGE")}
306
447
  sisyphus <command> [options]
307
448
 
308
- ${h.bold("COMMANDS")}
309
- ${h.command("init")} Initialize Sisyphus in your project
310
- ${h.command("check")} Check current state and pending changes
311
- ${h.command("version")} Create a new version stone for next release
312
- ${h.command("roll")} Roll the stones and release packages
313
- ${h.command("stone")} Manage pending stones (list, delete, edit, merge)
314
- ${h.command("preview")} Preview what versions will be after rolling
315
- ${h.command("prerelease")} Manage prerelease versions (alpha, beta, rc)
316
- ${h.command("graph")} Visualize monorepo package dependencies
317
- ${h.command("help")} Show this help message
318
-
319
- Use ${h.value("sisyphus <command> --help")} for more information about a command.
320
- `)}q();_();import{parseArgs as Ts}from"util";q();_();H();gn();async function Yt({single:n,tag:t,ignore:r}){let s=await uo({commitAndPush:()=>N({active:"Yes, commit and push the release",inactive:"Skip commit",initialValue:!1,message:"Should `roll` command commit and push the release?"}),commitConfig:()=>N({active:"Yes, configure commit",inactive:"Skip commit config",initialValue:!1,message:"Configure commit for release? Default commit message is `release(\uD83C\uDF89): <packageName@version>`"}),commitAuthor:({results:{commitConfig:i}})=>i?W({message:"Commit author",placeholder:"r5n-bot"}):void 0,commitEmail:({results:{commitConfig:i}})=>i?W({message:"Commit author email",placeholder:"r5n-bot@users.noreply.github.com"}):void 0,commitMessage:({results:{commitConfig:i}})=>i?W({message:"Commit message",placeholder:"release(\uD83C\uDF89): <packageName@version>"}):void 0,generateChangelog:()=>N({active:"Yes, Generate changelog",inactive:"Skip changelog",initialValue:!0,message:"Generate changelog for release?"}),releaseOnGitHub:()=>N({active:"Yes, create a GitHub release",inactive:"Skip GitHub release",initialValue:!1,message:"Create a release on GitHub when releasing packages?"}),releaseOnNPM:()=>N({active:"Yes, publish packages to NPM",inactive:"Skip NPM release",initialValue:!1,message:"Publish packages to NPM when releasing packages?"}),releaseTags:()=>N({active:"Yes, create tags for the release",inactive:"Skip tags",initialValue:!1,message:"Create tags for the release?"}),rootChangelog:({results:{generateChangelog:i}})=>i?N({active:"Yes, generate combined changelog",inactive:"Skip root changelog",initialValue:!0,message:"Generate combined changelog for monorepo?"}):void 0,single:()=>N({active:"Yes, setup for root package",inactive:"No, setup for monorepo workspace packages",initialValue:n,message:"Setup Sisyphus for only root package?"}),tag:()=>W({initialValue:t,message:"Tag used when versioning packages. Leave `latest` if you are not sure or want to release packages with latest tag.",placeholder:"latest"})},{onCancel:()=>hn()});return{commitAndPush:!!s.commitAndPush,commitAuthor:s.commitAuthor||"",commitConfig:!!s.commitConfig,commitEmail:s.commitEmail||"",commitMessage:s.commitMessage||"",generateChangelog:s.generateChangelog,releaseOnGitHub:!!s.releaseOnGitHub,releaseOnNPM:!!s.releaseOnNPM,releaseTags:!!s.releaseTags,rootChangelog:!!s.rootChangelog,single:s.single,tag:s.tag}}async function Zt({bump:n,packages:t,packageNames:r,tag:s}){let i=Qs({packageNames:r,packages:t,tag:s}),e=`
321
- - ${m.dim(m.italic(`Press ${m.underline(m.bold(m.whiteBright("a")))} to select/unselect all, ${m.underline(m.bold(m.whiteBright("SPACE")))} to select/unselect, ${m.underline(m.bold(m.whiteBright("ARROWS")))} to move, ${m.underline(m.bold(m.whiteBright("ENTER")))} to confirm`))}
322
- `,o=n?[n]:["major","minor","patch"];$.info(e);let{message:c,majorPackages:a,minorPackages:l,patchPackages:f}=await uo({majorPackages:()=>o.includes("major")?i({bump:"major"}):void 0,minorPackages:({results:{majorPackages:p}})=>o.includes("minor")?i({bump:"minor",filterPackages:p||[]}):void 0,patchPackages:({results:{majorPackages:p,minorPackages:d}})=>o.includes("patch")?i({bump:"patch",filterPackages:(p||[]).concat(d||[])}):void 0,message:()=>W({message:`Name of the stone. ${m.dim(m.italic("Default prefix or message can be configured in config."))}`,placeholder:"New feature"})},{onCancel:()=>hn()});return{majorPackages:a||[],message:c,minorPackages:l||[],patchPackages:f||[]}}function Qs({packageNames:n,tag:t,packages:r}){return({bump:s,filterPackages:i=[]})=>{let e=n.filter((c)=>!i?.includes(c)).map((c)=>({label:un({bump:s,name:c,tag:t,version:r[c]?.version||"0.0.0"}),value:c})),o={major:m.red,minor:m.yellow,patch:m.green};return e.length>0?Cn({initialValues:void 0,message:`Select packages for ${m.bold(o[s](s))} bump.`,options:e,required:!1}):void 0}}H();async function Qt(){let{values:{nonInteractive:n,overwrite:t,tag:r,single:s,ignore:i}}=Ts({allowPositionals:!0,args:Bun.argv,options:{ignore:{default:[],multiple:!0,short:"i",type:"string"},nonInteractive:{default:!1,short:"n",type:"boolean"},overwrite:{default:!1,short:"o",type:"boolean"},single:{default:!1,short:"s",type:"boolean"},tag:{default:"latest",short:"t",type:"string"}},strict:!0});if(n)await j({ignore:i,overwrite:t,single:s,tag:r});else{let{commitAndPush:e,commitAuthor:o,commitConfig:c,commitEmail:a,commitMessage:l,generateChangelog:f,releaseOnGitHub:p,releaseOnNPM:d,releaseTags:w,rootChangelog:y,single:g,tag:x}=await Yt({ignore:i,single:s,tag:r}),u={ignore:i,single:g,tag:x};if(c)u.commit={author:o,email:a,message:l};if(p||d||e)u.release={commitAndPush:e,github:p,npm:d,tags:w};if(f)u.changelog={generate:f,root:y};await j({overwrite:t,...u})}L(`${m.magenta(`${m.bold("Sisyphus ")}${m.underline(m.italic(`v${zn}`))}`)}${m.green(" is setup to roll stones.")}
323
-
324
- You can now start by creating a new stone by running ${m.reset(m.green("bunx @r5n/sisyphus"))}${m.blue(" version")}
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")}
325
471
  and following the prompts.
326
472
 
327
- After you finished, you can release it by running ${m.reset(m.green("bunx @r5n/sisyphus"))}${m.blue(" roll")}
328
- `)}q();U();_();H();gn();import{parseArgs as Ds}from"util";H();gn();import{randomUUID as Vs}from"crypto";var ks=["major","minor","patch","dependency","snapshot"];function Fs({message:n,tag:t,packages:r}){let s=r.reduce((e,o)=>{return e[o.bump]=e[o.bump]||[],e[o.bump].push(o.name),e},{}),i=ks.filter((e)=>s[e]?.length>0);return[`### ${n}`,t?`_${t}_`:"",Go,"",`| ${i.join(" | ")} |`,`| ${i.map(()=>":---:").join(" | ")} |`,`| ${i.map((e)=>s[e]?.join(", ")||"").join(" | ")} |`,""]}function en(n){let t=n.split(`
329
- `).filter((e)=>e.trim()),r={commitMessage:"",dependency:[],description:"",major:[],minor:[],patch:[],snapshot:[],tag:""},s=t.findIndex((e)=>e.includes("---"));if(t[0]?.startsWith("###"))r.commitMessage=t[0].replace(/^#+\s*/,"");if(s>1){let e=[];for(let o=1;o<s;o++){let c=t[o];if(c?.startsWith("_")&&c.endsWith("_"))r.tag=c.slice(1,-1);else if(c)e.push(c)}r.description=e.join(`
330
- `).trim()}let i=t.findIndex((e)=>e.includes("|")&&!e.includes("---"));if(i!==-1&&t[i]){let o=t[i].split("|").map((a)=>a.trim()).filter((a)=>a),c=t[i+2];if(c){let a=c.split("|").map((l)=>l.trim()).filter((l)=>l);o.forEach((l,f)=>{let p=a[f]?.split(",").map((w)=>w.trim()).filter((w)=>w)||[],d=l.toLowerCase();if(d==="major")r.major=p;else if(d==="minor")r.minor=p;else if(d==="patch")r.patch=p;else if(d==="dependency")r.dependency=p;else if(d==="snapshot")r.snapshot=p})}}return r}async function pn({majorPackages:n,message:t,minorPackages:r,packages:s,patchPackages:i,tag:e,configPath:o}){let a=`${`${(await V({configPath:o})).length+1}`.padStart(4,"0")}-${Vs().slice(0,8)}`,l=[...n,...r,...i],f=l.flatMap((y)=>s[y]?.dependencyOf||[]),d=[{packages:n,type:"major"},{packages:r,type:"minor"},{packages:i,type:"patch"},{packages:f.filter((y)=>!l.includes(y)),type:"dependency"}].flatMap(({packages:y,type:g})=>y.map((x)=>{let u=s[x];if(!u)throw new Error(`Package ${x} not found`);return{...u,bump:g,tag:e}})).filter(Boolean),w=Fs({message:t,packages:d,tag:e});return{packages:d,stoneContent:w,stoneName:a}}var ni=v({prefix:"sisyphus"}).child("prerelease"),oi=["alpha","beta","rc","canary","dev","next"];function ti(){let{values:n}=Ds({args:process.argv.slice(3),options:{bump:{short:"b",type:"string"},dryRun:{short:"d",type:"boolean"},filter:{short:"f",type:"string"},promote:{short:"p",type:"boolean"},type:{short:"t",type:"string"},yes:{short:"y",type:"boolean"}}});return n}async function Tt(){try{let n=ti(),{packages:t,packageNames:r}=await J({filter:n.filter});if(n.promote)await si(n,t,r);else await ri(n,t,r)}catch(n){ni.error("Prerelease operation failed:",n),process.exit(1)}}async function ri(n,t,r){let s=n.type||await an({message:"Select prerelease type",options:oi.map((x)=>({hint:ii(x),label:x,value:x}))});if(!s||typeof s!=="string"){$.info("Cancelled");return}let i=n.filter,e=i?r.filter((x)=>x.includes(i)):r;if(e.length===0){$.error(`No packages found matching filter: ${n.filter}`);return}let o=n.filter?e:await ei(e,t);if(o.length===0){$.info("No packages selected");return}let c;if(n.bump){let u={major:"major",minor:"minor",patch:"patch"}[n.bump.toLowerCase()];if(!u){$.error(`Invalid bump type: ${n.bump}. Must be major, minor, or patch.`);return}c=u}else{let x=await an({message:"What type of change is this prerelease for?",options:[{label:"Major - Breaking changes",value:"major"},{label:"Minor - New features",value:"minor"},{label:"Patch - Bug fixes",value:"patch"}]});if(!x){$.info("Cancelled");return}c=x}let a=`chore: prepare ${s} release`,l;if(n.yes)l=a;else{let x=await W({message:"Commit message for this prerelease",placeholder:a});if(!x||typeof x!=="string"){$.info("Cancelled");return}l=x}let f=[],p=[],d=[];for(let x of o)switch(c){case"major":f.push(x);break;case"minor":p.push(x);break;case"patch":d.push(x);break}let{stoneContent:w,stoneName:y}=await pn({majorPackages:f,message:l,minorPackages:p,packages:t,patchPackages:d,tag:s});$.step("Preview of prerelease changes:"),console.log();for(let x of o){let u=t[x],S=B({bump:c,tag:s,version:u.version});console.log(` ${h.value(x)}: ${u.version} \u2192 ${h.bold(S)}`)}if(console.log(),n.dryRun){$.info("Dry run - no changes made"),console.log(h.dim("Stone content:")),console.log(w.join(`
331
- `));return}if(!n.yes){if(!await N({initialValue:!0,message:"Create this prerelease stone?"})){$.info("Cancelled");return}}let g=await j();g.stones.push(y),await Bun.write(`.sisyphus/stones/${y}.md`,w.join(`
332
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(g,null,2)}
333
- `),$.success(`Created ${s} prerelease stone: ${h.bold(y)}`),$.info(`Run ${h.value("sisyphus roll")} to publish the prerelease`)}async function si(n,t,r){let s=r.filter((y)=>{return t[y].version.includes("-")});if(s.length===0){$.info("No packages with prerelease versions found");return}$.info(`Found ${h.bold(String(s.length))} packages with prerelease versions`),console.log();let i=new Map;for(let y of s){let x=t[y].version.match(/-(\w+)\./);if(x){let u=x[1];if(!i.has(u))i.set(u,[]);i.get(u)?.push(y)}}for(let[y,g]of i){console.log(`${h.bold(y)} packages:`);for(let x of g)console.log(` ${h.value(x)}: ${t[x].version}`);console.log()}let e=Array.from(i.keys()),o=[];if(e.includes("alpha"))o.push({label:"Promote alpha \u2192 beta",value:"alpha-to-beta"},{label:"Promote alpha \u2192 rc",value:"alpha-to-rc"},{label:"Promote alpha \u2192 stable",value:"alpha-to-stable"});if(e.includes("beta"))o.push({label:"Promote beta \u2192 rc",value:"beta-to-rc"},{label:"Promote beta \u2192 stable",value:"beta-to-stable"});if(e.includes("rc")||e.includes("next"))o.push({label:"Graduate to stable release",value:"to-stable"});o.push({label:"Increment current prerelease version",value:"increment"});let c=await an({message:"How would you like to promote these prereleases?",options:o});if(!c){$.info("Cancelled");return}let a,l=s,f;switch(c){case"alpha-to-beta":a="beta",l=i.get("alpha")||[],f="chore: promote alpha to beta";break;case"alpha-to-rc":a="rc",l=i.get("alpha")||[],f="chore: promote alpha to rc";break;case"alpha-to-stable":a=void 0,l=i.get("alpha")||[],f="chore: promote alpha to stable release";break;case"beta-to-rc":a="rc",l=i.get("beta")||[],f="chore: promote beta to rc";break;case"beta-to-stable":a=void 0,l=i.get("beta")||[],f="chore: promote beta to stable release";break;case"to-stable":a=void 0,l=[...i.get("rc")||[],...i.get("next")||[]],f="chore: graduate to stable release";break;case"increment":if(e.length>1){let y=await an({message:"Which prerelease type would you like to increment?",options:e.map((g)=>({label:g,value:g}))});if(!y){$.info("Cancelled");return}a=y,l=i.get(a)||[]}else a=e[0],l=a?i.get(a)||[]:[];f=`chore: increment ${a} version`;break;default:$.error("Unknown promotion strategy");return}if(l.length===0){$.info("No packages to promote");return}$.step("Preview of promotion:"),console.log();for(let y of l){let g=t[y].version,x;if(a===void 0)x=g.split("-")[0];else if(c==="increment")x=B({version:g,bump:"patch",tag:a});else x=`${g.split("-")[0]}-${a}.0`;console.log(` ${h.value(y)}: ${g} \u2192 ${h.bold(x)}`)}if(console.log(),!n.yes){if(!await N({message:"Continue with this promotion?",initialValue:!0})){$.info("Cancelled");return}}let{stoneContent:p,stoneName:d}=await pn({majorPackages:[],message:f,minorPackages:[],packages:t,patchPackages:l,tag:a});if(n.dryRun){$.info("Dry run - no changes made"),console.log(p.join(`
334
- `));return}let w=await j();w.stones.push(d),await Bun.write(`.sisyphus/stones/${d}.md`,p.join(`
335
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(w,null,2)}
336
- `),$.success(`Created promotion stone: ${h.bold(d)}`),$.info(`Run ${h.value("sisyphus roll")} to publish the promotion`)}function ii(n){switch(n){case"alpha":return"Early development, unstable";case"beta":return"Feature complete, testing";case"rc":return"Release candidate, final testing";case"canary":return"Latest commit builds";case"dev":return"Development builds";case"next":return"Next version preview";default:return""}}async function ei(n,t){if(await an({message:"Select packages for prerelease",options:[{label:"All packages",value:"all"},{label:"Select specific packages",value:"select"}]})==="all")return n;$.info("Select packages (space to select, enter to confirm)");let s=[];for(let i of n)if(await N({initialValue:!1,message:`Include ${i} (${t[i].version})?`}))s.push(i);return s}q();U();_();H();import{parseArgs as ci}from"util";var ai=v({prefix:"sisyphus"}).child("preview");async function Vt(){let{values:n}=ci({args:process.argv.slice(3),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:t,verbose:r}=n;try{let s=await j(),i=await Sn();if(i.length===0){if(t)console.log(JSON.stringify({message:"No pending stones found"}));else $.info("No pending stones found. Nothing to preview.");return}let{packages:e}=await J(),o={},c=[];for(let{tag:l,packages:f,message:p}of i){c.push(p);for(let d of f){if(!o[d.name])o[d.name]={...d};let w=o[d.name];if(!w)continue;if(l)w.tag=l;w.bump=tn.indexOf(d.bump)>tn.indexOf(w.bump)?d.bump:w.bump,o[d.name]=w}}let a=Object.entries(o).map(([l,f])=>{let p=e[l]?.version||"0.0.0",[d="0",w="0",y="0"]=p.split("."),g=p;switch(f.bump){case"major":g=`${Number.parseInt(d,10)+1}.0.0`;break;case"minor":g=`${d}.${Number.parseInt(w,10)+1}.0`;break;case"patch":case"dependency":g=`${d}.${w}.${Number.parseInt(y,10)+1}`;break;case"snapshot":{let x=new Date().toISOString().replace(/[.ZT:-]/g,"").slice(0,14);g=`0.0.0-${f.tag||"nightly"}-${x}`;break}}if(f.tag&&f.bump!=="snapshot")g=`${g}-${f.tag}.0`;return{bump:f.bump,currentVersion:p,name:l,newVersion:g,tag:f.tag}});if(t){console.log(JSON.stringify({messages:c,stones:i.length,updates:a},null,2));return}$.info(`Preview of release with ${h.bold(String(i.length))} stone${i.length>1?"s":""}`),console.log(),console.log(h.bold("Commit Messages:")),c.forEach((l)=>{console.log(` ${h.bullet("\u2022")} ${l}`)}),console.log(),console.log(h.bold("Version Updates:"));for(let l of a){let f=l.bump==="major"?h.error:l.bump==="minor"?h.warning:h.success;console.log(` ${h.value(l.name)}`),console.log(` ${h.dim("Current:")} ${l.currentVersion}`),console.log(` ${h.dim("New:")} ${h.bold(l.newVersion)}`),console.log(` ${h.dim("Bump:")} ${f(l.bump)}${l.tag?` (${h.value(l.tag)})`:""}`),console.log()}if(r)console.log(h.bold("Additional Information:")),console.log(` ${h.dim("Config path:")} ${s.configPath||".sisyphus"}`),console.log(` ${h.dim("Total packages:")} ${Object.keys(e).length}`),console.log(` ${h.dim("Packages to update:")} ${a.length}`)}catch(s){ai.error("Failed to preview release:",s),process.exit(1)}}U();_();q();U();_();H();import{existsSync as li}from"fs";import{unlink as fi}from"fs/promises";import{join as mi}from"path";import{parseArgs as hi}from"util";var vn=v({prefix:"sisyphus"}).child("stone:delete");async function kt(n){if(!n)vn.error("Stone ID is required"),vn.error("Usage: sisyphus stone delete <id>"),process.exit(1);let{values:t}=hi({args:process.argv.slice(5),options:{force:{short:"f",type:"boolean"}}}),{force:r}=t;try{let i=(await j()).stonesPath||".sisyphus/stones",e=mi(i,`${n}.md`);if(!li(e))vn.error(`Stone '${n}' not found`),vn.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);if(!r){if(!await N({initialValue:!1,message:`Delete stone '${n}'?`})){$.info("Deletion cancelled");return}}await fi(e),$.success(`Stone '${h.bold(n)}' deleted`)}catch(s){vn.error(`Failed to delete stone '${n}':`,s),process.exit(1)}}q();U();_();H();import{existsSync as pi}from"fs";import{readFile as bi,writeFile as di}from"fs/promises";import{join as yi}from"path";import{parseArgs as wi}from"util";var bn=v({prefix:"sisyphus"}).child("stone:edit");async function Ft(n){if(!n)bn.error("Stone ID is required"),bn.error("Usage: sisyphus stone edit <id>"),process.exit(1);let{values:t}=wi({args:process.argv.slice(5),options:{interactive:{short:"i",type:"boolean"},message:{short:"m",type:"string"}}}),{message:r,interactive:s}=t;try{let e=(await j()).stonesPath||".sisyphus/stones",o=yi(e,`${n}.md`);if(!pi(o))bn.error(`Stone '${n}' not found`),bn.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let c=await bi(o,"utf-8");if(r){let a=c.split(`
337
- `);a[0]=`### ${r}`,await di(o,a.join(`
338
- `)),$.success(`Updated commit message for stone '${h.bold(n)}'`);return}if(s){$.info("Interactive stone editing coming soon"),$.info("For now, you can manually edit:"),$.info(h.dim(o));return}bn.error("Please specify --message or --interactive"),process.exit(1)}catch(i){bn.error(`Failed to edit stone '${n}':`,i),process.exit(1)}}U();var Dt={delete:`
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:`
339
523
  sisyphus stone delete - Remove a specific stone before rolling
340
524
 
341
525
  USAGE
@@ -386,7 +570,7 @@ EXAMPLES
386
570
  # Output as JSON for scripting
387
571
  sisyphus stone list --json
388
572
  `,merge:`
389
- sisyphus stone merge - Combine multiple stones into one
573
+ sisyphus stone merge - Combine multiple stones with smart conflict resolution
390
574
 
391
575
  USAGE
392
576
  sisyphus stone merge [options]
@@ -395,6 +579,7 @@ OPTIONS
395
579
  -i, --ids Stone IDs to merge (multiple) [string]
396
580
  -m, --message Commit message for merged stone [string]
397
581
  -f, --force Skip confirmation [boolean]
582
+ -s, --strategy Conflict resolution (highest/interactive) [string]
398
583
 
399
584
  EXAMPLES
400
585
  # Merge stones interactively
@@ -403,8 +588,16 @@ EXAMPLES
403
588
  # Merge specific stones
404
589
  sisyphus stone merge --ids stone-123 stone-456
405
590
 
406
- # Merge with custom message
407
- sisyphus stone merge --ids stone-123 stone-456 --message "feat: combined changes"
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
408
601
  `,show:`
409
602
  sisyphus stone show - Display full content of a specific stone
410
603
 
@@ -420,50 +613,55 @@ EXAMPLES
420
613
 
421
614
  # Output as JSON
422
615
  sisyphus stone show stone-123 --json
423
- `};function Yn(n){if(n&&Dt[n]){let r=Dt[n].split(`
424
- `).map((s)=>{if(s.startsWith("sisyphus"))return h.bold(s);if(s==="USAGE"||s==="OPTIONS"||s==="EXAMPLES")return h.bold(s);if(s.startsWith(" -")){let i=s.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(i){let[,e="",o=""]=i,c=o.replace("(required)",h.error("(required)")).replace(/\(default: ([^)]+)\)/g,(a,l)=>h.dim(`(default: ${l})`)).replace(/\[boolean\]/g,h.boolean("[boolean]")).replace(/\[string\]/g,h.string("[string]")).replace(/\[number\]/g,h.number("[number]"));return` ${h.flag(e.padEnd(26))} ${c}`}}if(s.startsWith(" # "))return h.dim(s);if(s.startsWith(" sisyphus"))return` ${h.value(s.trim())}`;return s}).join(`
425
- `);console.log(r);return}console.log(`
426
- ${h.bold("Sisyphus Stone Management")}
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")}
427
620
 
428
- ${h.bold("USAGE")}
621
+ ${f.bold("USAGE")}
429
622
  sisyphus stone <command> [options]
430
623
 
431
- ${h.bold("COMMANDS")}
432
- ${h.command("list")} View all pending stones with details
433
- ${h.command("delete")} Remove a specific stone by ID
434
- ${h.command("show")} Display full content of a stone
435
- ${h.command("edit")} Modify stone content or versions
436
- ${h.command("merge")} Combine multiple stones into one
437
- ${h.command("help")} Show this help message
438
-
439
- Use ${h.value("sisyphus stone <command> --help")} for more information about a command.
440
- `)}q();U();_();H();import{readFile as $i}from"fs/promises";import{join as gi}from"path";import{parseArgs as ui}from"util";var nr=v({prefix:"sisyphus"}).child("stone:list");async function or(){let{values:n}=ui({args:process.argv.slice(4),options:{json:{short:"j",type:"boolean"},verbose:{short:"v",type:"boolean"}}}),{json:t,verbose:r}=n;try{let i=(await j()).stonesPath||".sisyphus/stones",e=await V();if(e.length===0){if(t)console.log(JSON.stringify([]));else $.info("No pending stones found");return}let o=[];for(let c of e){let a=gi(i,`${c}.md`);try{let l=await $i(a,"utf-8"),f=en(l);o.push({id:c,path:a,...f})}catch(l){nr.warn(`Failed to read stone ${c}:`,l)}}if(t){console.log(JSON.stringify(o,null,2));return}$.info(`Found ${h.bold(String(o.length))} pending stone${o.length>1?"s":""}`),console.log();for(let[c,a]of o.entries()){if(console.log(`${h.bullet("\u2022")} ${h.bold(a.id)}`),console.log(` ${h.dim("Message:")} ${a.commitMessage}`),a.tag)console.log(` ${h.dim("Tag:")} ${h.value(a.tag)}`);if(a.major.length>0)console.log(` ${h.error("Major:")} ${a.major.join(", ")}`);if(a.minor.length>0)console.log(` ${h.warning("Minor:")} ${a.minor.join(", ")}`);if(a.patch.length>0)console.log(` ${h.success("Patch:")} ${a.patch.join(", ")}`);if(r&&a.description)console.log(` ${h.dim("Description:")}`),a.description.split(`
441
- `).forEach((l)=>{console.log(` ${h.dim(l)}`)});if(c<o.length-1)console.log()}}catch(s){nr.error("Failed to list stones:",s),process.exit(1)}}q();U();_();H();import{readFile as tr,unlink as rr,writeFile as xi}from"fs/promises";import{join as Lo}from"path";import{parseArgs as Si}from"util";var sr=v({prefix:"sisyphus"}).child("stone:merge");async function ir(n){let{values:t}=Si({allowPositionals:!0,args:process.argv.slice(4),options:{force:{short:"f",type:"boolean"},ids:{multiple:!0,short:"i",type:"string"},message:{short:"m",type:"string"}}}),{ids:r,message:s,force:i}=t;try{let o=(await j()).stonesPath||".sisyphus/stones",c=await V();if(c.length<2){$.info("Need at least 2 stones to merge");return}let a=[];if(r&&r.length>=2){for(let u of r)if(c.includes(u)){let S=Lo(o,`${u}.md`),I=await tr(S,"utf-8"),E=en(I);a.push({id:u,path:S,...E})}if(a.length<2)sr.error("Could not find all specified stones"),process.exit(1)}else{let u=[];for(let I of c){let E=Lo(o,`${I}.md`),A=await tr(E,"utf-8"),R=en(A);u.push({label:`${I} - ${R.commitMessage}`,value:{id:I,path:E,...R}})}let S=await Cn({message:"Select stones to merge",options:u,required:!0});if(!S||Array.isArray(S)&&S.length<2){$.info("Need to select at least 2 stones");return}a=S}let l=s||await W({message:"Commit message for merged stone",placeholder:"feat: combined changes"});if(!l||typeof l!=="string"){$.info("Merge cancelled");return}let f={major:[],minor:[],patch:[]},p=[];for(let u of a)if(f.major.push(...u.major),f.minor.push(...u.minor),f.patch.push(...u.patch),u.description)p.push(u.description);f.major=[...new Set(f.major)],f.minor=[...new Set(f.minor)],f.patch=[...new Set(f.patch)];let w=`merged-${Date.now()}`,y=Lo(o,`${w}.md`),g=`### ${l}
442
- `;if(p.length>0)g+=`
443
- ${p.join(`
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(`
444
642
 
445
643
  `)}
446
- `;if(g+=`
644
+ `;if(v+=`
447
645
  ---
448
646
 
449
- `,f.major.length>0||f.minor.length>0||f.patch.length>0){let u=[],S=[];if(f.major.length>0)u.push("major"),S.push(f.major.join(", "));if(f.minor.length>0)u.push("minor"),S.push(f.minor.join(", "));if(f.patch.length>0)u.push("patch"),S.push(f.patch.join(", "));g+=`| ${u.join(" | ")} |
450
- `,g+=`| ${u.map(()=>":---:").join(" | ")} |
451
- `,g+=`| ${S.join(" | ")} |
452
- `}if(await xi(y,g),!i){if(await N({initialValue:!0,message:"Delete original stones?"}))for(let S of a)await rr(S.path)}else for(let u of a)await rr(u.path);$.success(`Created merged stone: ${h.bold(w)}`)}catch(e){sr.error("Failed to merge stones:",e),process.exit(1)}}U();_();H();import{existsSync as vi}from"fs";import{readFile as Ei}from"fs/promises";import{join as Oi}from"path";import{parseArgs as ji}from"util";var En=v({prefix:"sisyphus"}).child("stone:show");async function er(n){if(!n)En.error("Stone ID is required"),En.error("Usage: sisyphus stone show <id>"),process.exit(1);let{values:t}=ji({args:process.argv.slice(5),options:{json:{short:"j",type:"boolean"}}}),{json:r}=t;try{let i=(await j()).stonesPath||".sisyphus/stones",e=Oi(i,`${n}.md`);if(!vi(e))En.error(`Stone '${n}' not found`),En.info("Run 'sisyphus stone list' to see available stones"),process.exit(1);let o=await Ei(e,"utf-8");if(r){let c=en(o);console.log(JSON.stringify({id:n,path:e,...c,raw:o},null,2));return}console.log(h.bold(`Stone: ${n}`)),console.log(h.dim(`Path: ${e}`)),console.log(h.dim("\u2500".repeat(50))),console.log(),console.log(o)}catch(s){En.error(`Failed to show stone '${n}':`,s),process.exit(1)}}var Zn=["list","delete","show","edit","merge","help"],dn=v({prefix:"sisyphus"}).child("stone"),Ri={combine:"merge",del:"delete",display:"show",join:"merge",ls:"list",modify:"edit",remove:"delete",rm:"delete",update:"edit",view:"show"};async function cr(){let[,,,n,...t]=process.argv;if(!n||n==="--help"||n==="-h"){Yn();return}let r=n;if(!Zn.includes(n)){let s=qn(n,Ri);if(s&&Zn.includes(s))r=s,dn.warn(`Assuming you meant '${s}'`)}if(!Zn.includes(r)){dn.error(`Unknown stone command: ${n}`);let s=Ln(n,Zn);if(s.length>0){dn.error("Did you mean one of these?");for(let i of s)dn.error(` ${i}`)}dn.error("Run 'sisyphus stone --help' for usage information"),process.exit(1)}if(t.includes("--help")||t.includes("-h")){Yn(r);return}try{switch(r){case"list":await or();break;case"delete":await kt(t[0]);break;case"show":await er(t[0]);break;case"edit":await Ft(t[0]);break;case"merge":await ir(t);break;case"help":{let s=t[0];Yn(s);break}default:throw new Error(`Unknown stone command: ${r}`)}}catch(s){dn.error(`Failed to execute stone ${r}:`,s),process.exit(1)}}q();_();import{parseArgs as Ii}from"util";H();q();U();_();H();var{$:ar}=globalThis.Bun;var Ai=v({prefix:"sisyphus"}).child("from-commits"),lr={build:"patch",chore:"patch",ci:"patch",docs:"patch",feat:"minor",fix:"patch",perf:"patch",refactor:"patch",style:"patch",test:"patch"};async function fr(n){try{let r=(await j()).lastStone?.commit||"",s=r?`${r}..HEAD`:"HEAD",{stdout:i}=await ar`git log ${s} --pretty=format:"%H|%s" --no-merges`.quiet();if(!i.toString().trim())return $.info("No commits found since last release"),[];let e=i.toString().trim().split(`
453
- `),o=[];for(let a of e){let[l,f]=a.split("|");if(!l||!f)continue;let p=_i(l,f);if(p){let{stdout:d}=await ar`git diff-tree --no-commit-id --name-only -r ${l}`.quiet();p.files=d.toString().trim().split(`
454
- `).filter(Boolean),o.push(p)}}if(o.length===0)return $.info("No conventional commits found"),[];let c=await Mi(o,n);return $.info(`Found ${h.bold(String(o.length))} conventional commits`),$.info(`Creating ${h.bold(String(c.length))} stone${c.length>1?"s":""}`),c}catch(t){throw Ai.error("Failed to analyze commits:",t),t}}function _i(n,t){let r=t.match(/^(\w+)(?:\(([^)]+)\))?(!)?:\s*(.+)$/);if(!r)return null;let[,s="",i,e,o=""]=r;if(!s||!lr[s])return null;return{breaking:!!e,files:[],hash:n,message:o,scope:i,type:s}}async function Mi(n,t){let{packages:r}=await Promise.resolve().then(() => (H(),Nt)).then((e)=>e.getPackages({filter:t})),s=new Map;for(let[e,o]of Object.entries(r)){let c=o.file.substring(0,o.file.lastIndexOf("/"));s.set(c,e)}let i=new Map;for(let e of n){let o=new Set;for(let f of e.files)for(let[p,d]of s.entries())if(f.startsWith(p))o.add(d);if(o.size===0)continue;let c;if(e.breaking)c="major";else c=lr[e.type]||"patch";let a=`${e.type}${e.breaking?"!":""}`;if(!i.has(a)){let f=e.breaking?"feat!: breaking changes":`${e.type}: ${e.type} updates`;i.set(a,{bump:c,message:f,packages:new Set})}let l=i.get(a);if(l)for(let f of o)l.packages.add(f)}return Array.from(i.values()).filter((e)=>e.packages.size>0)}function Gi(){let{values:n}=Ii({allowPositionals:!0,args:process.argv.slice(3),options:{bump:{default:"",short:"b",type:"string"},dryRun:{default:!1,short:"d",type:"boolean"},filter:{default:"",short:"f",type:"string"},"from-commits":{default:!1,type:"boolean"},snapshot:{default:!1,short:"s",type:"boolean"},tag:{default:"",short:"t",type:"string"},yes:{default:!1,short:"y",type:"boolean"}},strict:!1});return n}function Ui(n){let{snapshot:t,bump:r}=n;if(t&&r)throw new Error(`Cannot use both ${m.cyanBright("--snapshot")} and ${m.cyanBright("--bump")} options, pick one.`)}async function Ni(){let n=await N({active:"Yes, continue",inactive:"No, cancel",message:"Are you sure you want to create a new stone?"});if(!n||Q(n))throw new Error("Operation cancelled by user")}async function Hi(n,t,r){await Bun.write(`.sisyphus/stones/${n}.md`,t.join(`
455
- `)),await Bun.write(".sisyphus/config.json",`${JSON.stringify(r,null,2)}
456
- `)}async function mr(){try{let n=Gi();Ui(n);let{dryRun:t}=No(n);if(n["from-commits"]){await Ci(n);return}let{packages:r,packageNames:s}=await J({filter:n.filter}),{message:i,majorPackages:e,minorPackages:o,patchPackages:c}=await Zt({bump:n.bump,packageNames:s,packages:r,tag:n.tag}),{packages:a,stoneContent:l,stoneName:f}=await pn({majorPackages:e,message:i,minorPackages:o,packages:r,patchPackages:c,tag:n.tag});if($.step([`${n.dryRun?m.bold(m.yellow(`[dry-run]
457
- `)):""}${m.italic("Changes preview:")}
458
- `,`${m.italic("Stone: ")}${m.bold(i)}`,...a.map(un)].join(`
459
- `)),t){$.info(`${m.bold(m.yellow("[dry-run]"))}
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]"))}
460
658
  Stone file preview:
461
659
  ${l.join(`
462
- `)}`);return}if(!n.yes)await Ni();let p=await j();p.stones.push(f),await Hi(f,l,p),L(`Now you can run ${m.green("bunx @r5n/sisyphus roll")} to release packages
463
- or create another stone with ${m.green("bunx @r5n/sisyphus version")}`,`${m.bold("Stone ")}${m.italic(`${f}.md`)} ${m.green("created!")}`)}catch(n){hn(n instanceof Error?n.message:String(n))}}async function Ci(n){let t=await fr(n.filter);if(t.length===0)return;let{packages:r}=await J({filter:n.filter}),s=await j(),i=0;for(let e of t){let o=[],c=[],a=[];for(let p of e.packages)switch(e.bump){case"major":o.push(p);break;case"minor":c.push(p);break;case"patch":case"dependency":a.push(p);break}let{stoneContent:l,stoneName:f}=await pn({majorPackages:o,message:e.message,minorPackages:c,packages:r,patchPackages:a,tag:n.tag});if(n.dryRun)$.info(`${m.bold(m.yellow("[dry-run]"))}
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]"))}
464
662
  Stone file preview:
465
663
  ${l.join(`
466
- `)}`);else s.stones.push(f),await Bun.write(`.sisyphus/stones/${f}.md`,l.join(`
467
- `)),i++}if(!n.dryRun&&i>0)await Bun.write(".sisyphus/config.json",`${JSON.stringify(s,null,2)}
468
- `),L(`Created ${m.bold(String(i))} stone${i>1?"s":""} from commits.
469
- Run ${m.green("bunx @r5n/sisyphus preview")} to see what will be released`,m.green("Success!"))}var Qn=["init","check","version","roll","stone","preview","prerelease","graph","help"],On=v({prefix:"sisyphus"}),Li={c:"check",cheack:"check",chekc:"check",g:"graph",graf:"graph",grah:"graph",h:"help",i:"init",initialise:"init",inti:"init",intialize:"init",p:"preview",pr:"prerelease",pre:"preview",preivew:"preview",prerelease:"prerelease",publish:"roll",r:"roll",relase:"release",release:"roll",rool:"roll",s:"stone",st:"stone",state:"check",status:"check",stones:"stone",v:"version",ver:"version",verison:"version"};async function qi(){try{let[,,n,...t]=process.argv;if(!n||n==="--help"||n==="-h"){Kn();return}let r=n;if(!Qn.includes(n)){let s=qn(n,Li);if(s&&Qn.includes(s))r=s,On.warn(`Assuming you meant '${s}'`)}if(!Qn.includes(r)){On.error(`Unknown command: ${n}`);let s=Ln(n,Qn);if(s.length>0){On.error("Did you mean one of these?");for(let i of s)On.error(` ${i}`)}On.error("Run 'sisyphus --help' for usage information"),process.exit(1)}if(t.includes("--help")||t.includes("-h")){Kn(r);return}switch(r){case"init":await Qt();break;case"check":await Xt();break;case"version":await mr();break;case"roll":await Jt();break;case"stone":await cr();break;case"preview":await Vt();break;case"prerelease":await Tt();break;case"graph":await zt();break;case"help":{let s=t[0];Kn(s);break}default:throw new Error(`Unknown command: ${r}`)}}catch(n){Gt(n)}}await qi();
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();