@r5n/sisyphus 0.2.0-rc.1 → 0.2.0-rc.3

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 +65 -17
  2. package/package.json +2 -3
package/dist/cli.js CHANGED
@@ -1,23 +1,71 @@
1
1
  // @bun
2
- import{blue as St,bold as d,cyanBright as j,dim as P,green as jt,italic as w,magenta as Mt,underline as G,whiteBright as Ct,yellow as z}from"picocolors";var q="0.2.0-rc.1";function D(e){let t=[];switch(e){case"init":t=[Ct(`Initialises Sisyphus with config, by creating ${w(".sisyphus/config.json")} file in the root of the workspace.`),"",d("Flags:"),p("--single",`Initialises config in a single package mode. Sisyphus will work for root ${P(w("package.json"))} file only`),p("--overwrite",["Overrides existing config.","It will remove existing one and creates new one with default values or given options"]),p("--tag","Initialises config with a specific tag"),p("--ignore",`Array of packages to ignore. Can be used as array: ${G(w("bunx @r5n/sisyphus init -i pkg1 -i pkg2"))}`),"",d("Examples:"),$("Usual monorepo setup with multiple packages","init",""),$("Single package setup","init","--single"),$("Setup with a specific tag","init","--tag v1.0.0"),$("Setup with ignored packages","init","-i pkg1 -i pkg2")];break;case"version":{t=["Generates a stone from interactive mode. It will ask you about version bump, release message, changelog generation etc.","",d("Flags:"),p("--bump",["Predefined semantic version of bump for selected packages.",`Available types: ${G(w("major, minor, patch"))}. ${d(w(`Can't be used with ${j("--snapshot")} option`))}`]),p("--tag","Version tag for release. Given string will be used as a tagged version for selected packages"),p("--filter","Sisyphus will only update packages that match the given filter"),p("--snapshot",[`Create a snapshot release with version of given tag and timestamp. ${d(w(`Can't be used with ${j("--bump")} option`))}`,"Useful for creating a release from a specific point in time for analysis, debugging or nightly builds"]),p("--yes","Sisyphus will not ask for confirmation before creating a stone"),"",d("Examples:"),$("Base usage","version",""),$("Generate stone with predefined version bump","version","--bump major"),$("Generate stone with snapshot release","version","--snapshot"),$("Confirm stone creation automatically","version","--yes")];break}case"roll":{t=["Creates a release from a specific point in time. It's based on stones created by Sisyphus.","With proper flags it will publish to NPM, create a release on GitHub, generate a changelog and more.","",d("Flags:"),p("--changelog","Creates a changelog from a specific point in time"),p(["-r","--changelogRoot"],"Creates a combined changelog for the monorepo. Useful for release notes."),p("--npm","Publishes packages to NPM"),p("--github","Creates a release on GitHub. Can be configured via `github` in config."),p(["-t","--withTags"],"Creates git tags for release"),p(["","--rootTag"],"Creates a tag of given string. Useful for creating a release from a specific point in time."),p(["","--npmToken"],["NPM token to use for publishing.",`By default it's read from ${d(w("NPM_TOKEN"))} environment variable`]),p(["","--githubToken"],["GitHub token to use for creating a release & tags.",`By default it's read from ${d(w("GITHUB_TOKEN"))} environment variable`]),p("--dryRun","Roll will not make any changes, it will only show what it would do"),"",d("Examples:"),$("Base usage of roll command to generate tags, changelog and npm release","roll","-n -c -t"),$("Generate changelog on release","roll","--changelog"),$("Creates release and publish packages to NPM","roll","--npm"),$("Enables GitHub release creation","roll","--github"),$("Creates release with git tags per package","roll","--withTags"),$("Creates release with a specific tag","roll","--rootTag v1.0.0"),$("Roll with dry run to check for changes","roll","--dryRun")];break}default:t=["",w(P(`Run ${G(w("bunx @r5n/sisyphus <command> --help"))} for more info on command usage`)),"",d("Commands:"),N("help","Show this help information"),N("init","Initialise Sisyphus config"),N("roll","Release packages, tags, changelogs etc. based on generated stones"),N("version","Create stone from interactive mode"),""]}console.info(`
3
- ${Mt(`${d("Sisyphus ")}${G(w(`v${q}`))}`)}
2
+ var St=Object.create;var{getPrototypeOf:kt,defineProperty:Se,getOwnPropertyNames:Pt}=Object;var Mt=Object.prototype.hasOwnProperty;var M=(r,t,i)=>{i=r!=null?St(kt(r)):{};const n=t||!r||!r.__esModule?Se(i,"default",{value:r,enumerable:!0}):i;for(let o of Pt(r))if(!Mt.call(n,o))Se(n,o,{get:()=>r[o],enumerable:!0});return n};var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var _=Y((Nr,le)=>{var ke=process.argv||[],Z=process.env,Rt=!(("NO_COLOR"in Z)||ke.includes("--no-color"))&&(("FORCE_COLOR"in Z)||ke.includes("--color")||process.platform==="win32"||import.meta.require!=null&&import.meta.require("tty").isatty(1)&&Z.TERM!=="dumb"||("CI"in Z)),jt=(r,t,i=r)=>(n)=>{let o=""+n,s=o.indexOf(t,r.length);return~s?r+Ot(o,t,i,s)+t:r+o+t},Ot=(r,t,i,n)=>{let o="",s=0;do o+=r.substring(s,n)+i,s=n+t.length,n=r.indexOf(t,s);while(~n);return o+r.substring(s)},Pe=(r=Rt)=>{let t=r?jt:()=>String;return{isColorSupported:r,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")}};le.exports=Pe();le.exports.createColors=Pe});var ge=Y((Lr,Re)=>{var f=`${"\x1B"}[`,me={to(r,t){if(!t)return`${f}${r+1}G`;return`${f}${t+1};${r+1}H`},move(r,t){let i="";if(r<0)i+=`${f}${-r}D`;else if(r>0)i+=`${f}${r}C`;if(t<0)i+=`${f}${-t}A`;else if(t>0)i+=`${f}${t}B`;return i},up:(r=1)=>`${f}${r}A`,down:(r=1)=>`${f}${r}B`,forward:(r=1)=>`${f}${r}C`,backward:(r=1)=>`${f}${r}D`,nextLine:(r=1)=>`${f}E`.repeat(r),prevLine:(r=1)=>`${f}F`.repeat(r),left:`${f}G`,hide:`${f}?25l`,show:`${f}?25h`,save:`${"\x1B"}7`,restore:`${"\x1B"}8`},_t={up:(r=1)=>`${f}S`.repeat(r),down:(r=1)=>`${f}T`.repeat(r)},At={screen:`${f}2J`,up:(r=1)=>`${f}1J`.repeat(r),down:(r=1)=>`${f}J`.repeat(r),line:`${f}2K`,lineEnd:`${f}K`,lineStart:`${f}1K`,lines(r){let t="";for(let i=0;i<r;i++)t+=this.line+(i<r-1?me.up():"");if(r)t+=me.left;return t}};Re.exports={cursor:me,scroll:_t,erase:At,beep:"\x07"}});var Be=Y((Ur,$e)=>{var je=process.argv||[],Q=process.env,Gt=!(("NO_COLOR"in Q)||je.includes("--no-color"))&&(("FORCE_COLOR"in Q)||je.includes("--color")||process.platform==="win32"||import.meta.require!=null&&import.meta.require("tty").isatty(1)&&Q.TERM!=="dumb"||("CI"in Q)),Et=(r,t,i=r)=>(n)=>{let o=""+n,s=o.indexOf(t,r.length);return~s?r+Nt(o,t,i,s)+t:r+o+t},Nt=(r,t,i,n)=>{let o="",s=0;do o+=r.substring(s,n)+i,s=n+t.length,n=r.indexOf(t,s);while(~n);return o+r.substring(s)},Oe=(r=Gt)=>{let t=r?Et:()=>String;return{isColorSupported:r,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")}};$e.exports=Oe();$e.exports.createColors=Oe});var ze=Y((Yr,xe)=>{var Ye=process.argv||[],te=process.env,lr=!(("NO_COLOR"in te)||Ye.includes("--no-color"))&&(("FORCE_COLOR"in te)||Ye.includes("--color")||process.platform==="win32"||import.meta.require!=null&&import.meta.require("tty").isatty(1)&&te.TERM!=="dumb"||("CI"in te)),cr=(r,t,i=r)=>(n)=>{let o=""+n,s=o.indexOf(t,r.length);return~s?r+mr(o,t,i,s)+t:r+o+t},mr=(r,t,i,n)=>{let o="",s=0;do o+=r.substring(s,n)+i,s=n+t.length,n=r.indexOf(t,s);while(~n);return o+r.substring(s)},Ze=(r=lr)=>{let t=r?cr:()=>String;return{isColorSupported:r,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")}};xe.exports=Ze();xe.exports.createColors=Ze});var c=M(_(),1);var Me="0.2.0-rc.3";function ce(r){let t=[];switch(r){case"init":t=[c.whiteBright(`Initialises Sisyphus with config, by creating ${c.italic(".sisyphus/config.json")} file in the root of the workspace.`),"",c.bold("Flags:"),S("--single",`Initialises config in a single package mode. Sisyphus will work for root ${c.dim(c.italic("package.json"))} file only`),S("--overwrite",["Overrides existing config.","It will remove existing one and creates new one with default values or given options"]),S("--tag","Initialises config with a specific tag"),S("--ignore",`Array of packages to ignore. Can be used as array: ${c.underline(c.italic("bunx @r5n/sisyphus init -i pkg1 -i pkg2"))}`),"",c.bold("Examples:"),P("Usual monorepo setup with multiple packages","init",""),P("Single package setup","init","--single"),P("Setup with a specific tag","init","--tag v1.0.0"),P("Setup with ignored packages","init","-i pkg1 -i pkg2")];break;case"version":{t=["Generates a stone from interactive mode. It will ask you about version bump, release message, changelog generation etc.","",c.bold("Flags:"),S("--bump",["Predefined semantic version of bump for selected packages.",`Available types: ${c.underline(c.italic("major, minor, patch"))}. ${c.bold(c.italic(`Can't be used with ${c.cyanBright("--snapshot")} option`))}`]),S("--tag","Version tag for release. Given string will be used as a tagged version for selected packages"),S("--filter","Sisyphus will only update packages that match the given filter"),S("--snapshot",[`Create a snapshot release with version of given tag and timestamp. ${c.bold(c.italic(`Can't be used with ${c.cyanBright("--bump")} option`))}`,"Useful for creating a release from a specific point in time for analysis, debugging or nightly builds"]),S("--yes","Sisyphus will not ask for confirmation before creating a stone"),"",c.bold("Examples:"),P("Base usage","version",""),P("Generate stone with predefined version bump","version","--bump major"),P("Generate stone with snapshot release","version","--snapshot"),P("Confirm stone creation automatically","version","--yes")];break}case"roll":{t=["Creates a release from a specific point in time. It's based on stones created by Sisyphus.","With proper flags it will publish to NPM, create a release on GitHub, generate a changelog and more.","",c.bold("Flags:"),S("--changelog","Creates a changelog from a specific point in time"),S(["-r","--changelogRoot"],"Creates a combined changelog for the monorepo. Useful for release notes."),S("--npm","Publishes packages to NPM"),S("--github","Creates a release on GitHub. Can be configured via `github` in config."),S(["-t","--withTags"],"Creates git tags for release"),S(["","--rootTag"],"Creates a tag of given string. Useful for creating a release from a specific point in time."),S(["","--npmToken"],["NPM token to use for publishing.",`By default it's read from ${c.bold(c.italic("NPM_TOKEN"))} environment variable`]),S(["","--githubToken"],["GitHub token to use for creating a release & tags.",`By default it's read from ${c.bold(c.italic("GITHUB_TOKEN"))} environment variable`]),S("--dryRun","Roll will not make any changes, it will only show what it would do"),"",c.bold("Examples:"),P("Base usage of roll command to generate tags, changelog and npm release","roll","-n -c -t"),P("Generate changelog on release","roll","--changelog"),P("Creates release and publish packages to NPM","roll","--npm"),P("Enables GitHub release creation","roll","--github"),P("Creates release with git tags per package","roll","--withTags"),P("Creates release with a specific tag","roll","--rootTag v1.0.0"),P("Roll with dry run to check for changes","roll","--dryRun")];break}default:t=["",c.italic(c.dim(`Run ${c.underline(c.italic("bunx @r5n/sisyphus <command> --help"))} for more info on command usage`)),"",c.bold("Commands:"),z("help","Show this help information"),z("init","Initialise Sisyphus config"),z("roll","Release packages, tags, changelogs etc. based on generated stones"),z("version","Create stone from interactive mode"),""]}console.info(`
3
+ ${c.magenta(`${c.bold("Sisyphus ")}${c.underline(c.italic(`v${Me}`))}`)}
4
4
 
5
- Usage: bunx @r5n/sisyphus ${z(w(e&&!e.includes("help")?`${e} ${j("[...flags]")}`:"<command>"))}
5
+ Usage: bunx @r5n/sisyphus ${c.yellow(c.italic(r&&!r.includes("help")?`${r} ${c.cyanBright("[...flags]")}`:"<command>"))}
6
6
  ${t.join("\n ")}
7
- ${P("Any issues & ideas can be reported at https://github.com/r5n-labs/Typescript-Monorepo/issues/new/choose")}
8
- `)}function $(e,t,i){return` ${P(e)}
9
- ${jt("bunx @r5n/sisyphus")}${z(` ${t} `)}${j(i)}
10
- `}function p(e,t,i=40){const[o,n]=Array.isArray(e)?e:[e.slice(1,3),e],s=j(d(`${o?`${o}, `:""}${n}`)),a=Array.isArray(t)?t.map((r,l)=>`${j(d("")).padEnd(l===0?0:i+4," ")}${P(r)}`).join("\n"):P(t);return` ${s.padEnd(i," ")}${a}`}function N(e,t,i=32){return` ${St(d(e)).padEnd(i," ")}${P(t)}`}import{parseArgs as Ft}from"util";import{note as Ht}from"@clack/prompts";import{green as Ot,reset as Dt}from"picocolors";import{mkdirSync as Y,readdirSync as _t,rmdirSync as Gt}from"fs";import{cancel as Nt,note as Rt}from"@clack/prompts";var{Glob:At}=globalThis.Bun;import{bold as Et,green as V,italic as xt,yellow as Ut}from"picocolors";function C(e){if(typeof e==="function")e();else Nt(e||"Operation cancelled by user");process.exit(0)}async function k({overwrite:e,tag:t,...i}={}){const n=await Bun.file("./.sisyphus/config.json").exists(),s=n&&e;if(!n||s){const a=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim();if(a.length===0)throw new Error("Couldn't find git repository. Have you initialized git repository?");if(s)Gt(".sisyphus",{recursive:!0});const r={...i,tag:t||"latest",lastStone:{commit:a,date:new Date().toISOString().split(".")[0]||""},ignore:[],stones:[]};Y(".sisyphus"),await Bun.write(".sisyphus/config.json",`${JSON.stringify(r,null,2)}\n`)}return Bun.file(".sisyphus/config.json").json()}async function X({dryRun:e,...t}){const i=await k();if(e)console.info(`${Et(Ut("[dry-run]"))}
11
- ${xt(".sisyphus/config.json")} would be updated to
12
- ${JSON.stringify({...i,...t},null,2)}`);else await Bun.write(".sisyphus/config.json",`${JSON.stringify({...i,...t},null,2)}\n`),Rt(`${V("Sisyphus config updated!")}`)}function E({name:e,version:t,bump:i,tag:o}){return`${e}@${t} => ${V(_({version:t,bump:i,tag:o}))} ${A[i]}`}function Z(e){const t=e.map((o)=>J.indexOf(o)),i=Math.max(...t);return J[i]||"patch"}function _({version:e="",bump:t,tag:i}){const[o="0.0.0",n=""]=e.split("-"),[s="0",a="0",r="0"]=o.split("."),[l="",u="0"]=n.split(".");if(t==="snapshot"){const f=new Date().toISOString().replaceAll(/[.ZT:-]/g,"").slice(0,14);return`0.0.0-${i||"nightly"}-${f}`}if(i||t==="dependency"&&l)return`${o}-${i||l}.${Number.parseInt(u)+1}`;const c=t==="major"?`${s}.0.0`:t==="minor"?`${s}.${a}.0`:`${s}.${a}.${r}`;if(l&&o===c)return c;switch(t){case"major":return`${Number.parseInt(s)+1}.0.0`;case"minor":return`${s}.${Number.parseInt(a)+1}.0`;case"patch":return`${s}.${a}.${Number.parseInt(r)+1}`;default:return e}}function x(){try{return _t(".sisyphus/stones").map((e)=>e.replace(".md",""))}catch{return Y(".sisyphus/stones"),[]}}async function U({filter:e,single:t}){const i=process.cwd(),o={};let n=[];try{n=(await Bun.file("package.json").json())?.workspaces||[]}catch(r){throw new Error("Couldn't find package.json for this project.",{cause:r})}if(!t&&n.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: ${i})\n
13
- If you want to run Sisyphus in single package, use --single flag or set \`"single": true\` in .sisyphus/config.json.`);const s={};for(let r of n){const l=new At(`${r}/package.json`).scanSync({cwd:i});for(let u of l){const{name:c,version:f,dependencies:h,devDependencies:m}=await Bun.file(u).json(),v=Object.entries({...h??{},...m??{}}).map(([g,y])=>y.startsWith("workspace")?g:"").filter(Boolean);for(let g of v)if(s[g]||=[],!s[g].includes(c))s[g].push(c);o[c]={name:c,version:f,file:u,dependencyOf:[]}}}for(let[r,l]of Object.entries(s))if(o[r])o[r].dependencyOf=l;const a=Object.keys(o);return{packages:o,packageNames:e?a.filter((r)=>r.includes(e)):a}}var R="#@!",M="***",J=["dependency","patch","minor","major","snapshot"],A={dependency:"\uD83D\uDCE6",patch:"\uD83D\uDC1B",minor:"\u2728",major:"\uD83D\uDEA8",snapshot:"\uD83D\uDCF8"};async function T(){const{values:{overwrite:e,tag:t,single:i,ignore:o}}=Ft({allowPositionals:!0,args:Bun.argv,strict:!0,options:{single:{default:!1,type:"boolean",short:"s"},ignore:{default:[],type:"string",short:"i",multiple:!0},overwrite:{default:!1,type:"boolean",short:"o"},tag:{default:"latest",type:"string",short:"t"}}}),n=await k({single:i,ignore:o,overwrite:e,tag:t});console.info(n),Ht(Dt(Ot("Sisyphus is setup to roll stones.")))}import{rmSync as Vt}from"fs";import{parseArgs as Xt}from"util";import{note as Zt}from"@clack/prompts";import{bold as ct,green as Tt,redBright as te,reset as lt,yellow as gt}from"picocolors";import{bold as tt,yellow as et}from"picocolors";async function nt({changelogRoot:e,commit:t,dryRun:i=!1,stones:o}){const n=[""],{lastStone:{commit:s=""}}=await k(),a=Kt({stones:o});for(let[r,{bump:l,path:u,changelog:c}]of a.entries()){const f=[`# ${r}`,"",...c,ot({lastCommit:s,commit:t})];if(i)console.info(`${tt(et("[dry-run]"))}\n${f.join("\n")}`);else await Bun.write(u,f.join("\n"));const[h="",,,m=""]=c;if(!n.includes(m))n.unshift(m);n.push(`### ${A[l]} ${r}@${h.slice(7)}`)}if(e){const r=Bun.file("CHANGELOG.md"),l=await r.exists(),[u,...c]=l?(await r.text()).split("\n"):["# Changelog"],f=[u,"",...n,...c,ot({root:!0,lastCommit:s,commit:t}),M,""];if(i)console.info(`${tt(et("[dry-run]"))}\nRoot changelog:\n${f.join("\n")}`);else await Bun.write(r,f.join("\n"))}}function Kt({stones:e}){const t=new Map;for(let{tag:i,packages:o,message:n}of e)for(let{file:s,name:a,version:r,bump:l}of o){const u=_({version:r,tag:i,bump:l}),{bump:c,path:f,changelog:h}=t.get(a)??{path:s.replace("package.json","CHANGELOG.md"),changelog:[],bump:l},[m="",,,b=""]=h,v=[m.replace("### ","")||"0.0.0",u].sort(Bun.semver.order)[1],g=[`### ${A[l]} ${v}`,"",h.length>0?"__Stones:__":"__Stone:__",`_${n}${b?`, ${b.replaceAll("_","")}_`:"_"}`];t.set(a,{bump:c,path:f,changelog:g})}return t}function ot({root:e,lastCommit:t,commit:i}){const o=Bun.spawnSync(["git","log",`--pretty=format:%H${R}%s${R}%cn`,`${t}..${i}`]).stdout.toString().split("\n").map((n)=>{if(n.length===0)return;const[s,a,r]=n.split(R);return{hash:s,message:a,author:r}}).filter(Boolean);return`
14
- <details><summary>${o.length} ${e?"Commits in this release":"Commits since last stone"}:</summary>
7
+ ${c.dim("Any issues & ideas can be reported at https://github.com/r5n-labs/Typescript-Monorepo/issues/new/choose")}
8
+ `)}function P(r,t,i){return` ${c.dim(r)}
9
+ ${c.green("bunx @r5n/sisyphus")}${c.yellow(` ${t} `)}${c.cyanBright(i)}
10
+ `}function S(r,t,i=40){const[n,o]=Array.isArray(r)?r:[r.slice(1,3),r],s=c.cyanBright(c.bold(`${n?`${n}, `:""}${o}`)),e=Array.isArray(t)?t.map((a,m)=>`${c.cyanBright(c.bold("")).padEnd(m===0?0:i+4," ")}${c.dim(a)}`).join("\n"):c.dim(t);return` ${s.padEnd(i," ")}${e}`}function z(r,t,i=32){return` ${c.blue(c.bold(r)).padEnd(i," ")}${c.dim(t)}`}import{parseArgs as Pr}from"util";var R=M(ge(),1);import{stdin as Ct,stdout as It}from"process";var F=M(Be(),1);import _e from"readline";import{WriteStream as qt}from"tty";function Lt({onlyFirst:r=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,r?void 0:"g")}function Ue(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(Lt(),"")}function Ve(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function K(r,t={}){if(typeof r!="string"||r.length===0||(t={ambiguousIsNarrow:!0,...t},r=Ue(r),r.length===0))return 0;r=r.replace(Kt()," ");const i=t.ambiguousIsNarrow?1:2;let n=0;for(let o of r){const s=o.codePointAt(0);if(s<=31||s>=127&&s<=159||s>=768&&s<=879)continue;switch(Vt.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=i;break;default:n+=1}}return n}function Jt(){const r=new Map;for(let[t,i]of Object.entries(p)){for(let[n,o]of Object.entries(i))p[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},i[n]=p[n],r.set(o[0],o[1]);Object.defineProperty(p,t,{value:i,enumerable:!1})}return Object.defineProperty(p,"codes",{value:r,enumerable:!1}),p.color.close="\x1B[39m",p.bgColor.close="\x1B[49m",p.color.ansi=Ae(),p.color.ansi256=Ge(),p.color.ansi16m=Ee(),p.bgColor.ansi=Ae(be),p.bgColor.ansi256=Ge(be),p.bgColor.ansi16m=Ee(be),Object.defineProperties(p,{rgbToAnsi256:{value:(t,i,n)=>t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:(t)=>{const i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!i)return[0,0,0];let[n]=i;n.length===3&&(n=[...n].map((s)=>s+s).join(""));const o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:(t)=>p.rgbToAnsi256(...p.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:(t)=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let i,n,o;if(t>=232)i=((t-232)*10+8)/255,n=i,o=i;else{t-=16;const a=t%36;i=Math.floor(t/36)/5,n=Math.floor(a/6)/5,o=a%6/5}const s=Math.max(i,n,o)*2;if(s===0)return 30;let e=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(i));return s===2&&(e+=60),e},enumerable:!1},rgbToAnsi:{value:(t,i,n)=>p.ansi256ToAnsi(p.rgbToAnsi256(t,i,n)),enumerable:!1},hexToAnsi:{value:(t)=>p.ansi256ToAnsi(p.hexToAnsi256(t)),enumerable:!1}}),p}function Ie(r,t,i){return String(r).normalize().replace(/\r\n/g,`
11
+ `).split(`
12
+ `).map((n)=>Ft(n,t,i)).join(`
13
+ `)}function tr(r,t){if(r===t)return;const i=r.split(`
14
+ `),n=t.split(`
15
+ `),o=[];for(let s=0;s<Math.max(i.length,n.length);s++)i[s]!==n[s]&&o.push(s);return o}function T(r){return r===He}function X(r,t){r.isTTY&&r.setRawMode(t)}var We={exports:{}};(function(r){var t={};r.exports=t,t.eastAsianWidth=function(n){var o=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,e=o;return 55296<=o&&o<=56319&&56320<=s&&s<=57343&&(o&=1023,s&=1023,e=o<<10|s,e+=65536),e==12288||65281<=e&&e<=65376||65504<=e&&e<=65510?"F":e==8361||65377<=e&&e<=65470||65474<=e&&e<=65479||65482<=e&&e<=65487||65490<=e&&e<=65495||65498<=e&&e<=65500||65512<=e&&e<=65518?"H":4352<=e&&e<=4447||4515<=e&&e<=4519||4602<=e&&e<=4607||9001<=e&&e<=9002||11904<=e&&e<=11929||11931<=e&&e<=12019||12032<=e&&e<=12245||12272<=e&&e<=12283||12289<=e&&e<=12350||12353<=e&&e<=12438||12441<=e&&e<=12543||12549<=e&&e<=12589||12593<=e&&e<=12686||12688<=e&&e<=12730||12736<=e&&e<=12771||12784<=e&&e<=12830||12832<=e&&e<=12871||12880<=e&&e<=13054||13056<=e&&e<=19903||19968<=e&&e<=42124||42128<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||55216<=e&&e<=55238||55243<=e&&e<=55291||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65106||65108<=e&&e<=65126||65128<=e&&e<=65131||110592<=e&&e<=110593||127488<=e&&e<=127490||127504<=e&&e<=127546||127552<=e&&e<=127560||127568<=e&&e<=127569||131072<=e&&e<=194367||177984<=e&&e<=196605||196608<=e&&e<=262141?"W":32<=e&&e<=126||162<=e&&e<=163||165<=e&&e<=166||e==172||e==175||10214<=e&&e<=10221||10629<=e&&e<=10630?"Na":e==161||e==164||167<=e&&e<=168||e==170||173<=e&&e<=174||176<=e&&e<=180||182<=e&&e<=186||188<=e&&e<=191||e==198||e==208||215<=e&&e<=216||222<=e&&e<=225||e==230||232<=e&&e<=234||236<=e&&e<=237||e==240||242<=e&&e<=243||247<=e&&e<=250||e==252||e==254||e==257||e==273||e==275||e==283||294<=e&&e<=295||e==299||305<=e&&e<=307||e==312||319<=e&&e<=322||e==324||328<=e&&e<=331||e==333||338<=e&&e<=339||358<=e&&e<=359||e==363||e==462||e==464||e==466||e==468||e==470||e==472||e==474||e==476||e==593||e==609||e==708||e==711||713<=e&&e<=715||e==717||e==720||728<=e&&e<=731||e==733||e==735||768<=e&&e<=879||913<=e&&e<=929||931<=e&&e<=937||945<=e&&e<=961||963<=e&&e<=969||e==1025||1040<=e&&e<=1103||e==1105||e==8208||8211<=e&&e<=8214||8216<=e&&e<=8217||8220<=e&&e<=8221||8224<=e&&e<=8226||8228<=e&&e<=8231||e==8240||8242<=e&&e<=8243||e==8245||e==8251||e==8254||e==8308||e==8319||8321<=e&&e<=8324||e==8364||e==8451||e==8453||e==8457||e==8467||e==8470||8481<=e&&e<=8482||e==8486||e==8491||8531<=e&&e<=8532||8539<=e&&e<=8542||8544<=e&&e<=8555||8560<=e&&e<=8569||e==8585||8592<=e&&e<=8601||8632<=e&&e<=8633||e==8658||e==8660||e==8679||e==8704||8706<=e&&e<=8707||8711<=e&&e<=8712||e==8715||e==8719||e==8721||e==8725||e==8730||8733<=e&&e<=8736||e==8739||e==8741||8743<=e&&e<=8748||e==8750||8756<=e&&e<=8759||8764<=e&&e<=8765||e==8776||e==8780||e==8786||8800<=e&&e<=8801||8804<=e&&e<=8807||8810<=e&&e<=8811||8814<=e&&e<=8815||8834<=e&&e<=8835||8838<=e&&e<=8839||e==8853||e==8857||e==8869||e==8895||e==8978||9312<=e&&e<=9449||9451<=e&&e<=9547||9552<=e&&e<=9587||9600<=e&&e<=9615||9618<=e&&e<=9621||9632<=e&&e<=9633||9635<=e&&e<=9641||9650<=e&&e<=9651||9654<=e&&e<=9655||9660<=e&&e<=9661||9664<=e&&e<=9665||9670<=e&&e<=9672||e==9675||9678<=e&&e<=9681||9698<=e&&e<=9701||e==9711||9733<=e&&e<=9734||e==9737||9742<=e&&e<=9743||9748<=e&&e<=9749||e==9756||e==9758||e==9792||e==9794||9824<=e&&e<=9825||9827<=e&&e<=9829||9831<=e&&e<=9834||9836<=e&&e<=9837||e==9839||9886<=e&&e<=9887||9918<=e&&e<=9919||9924<=e&&e<=9933||9935<=e&&e<=9953||e==9955||9960<=e&&e<=9983||e==10045||e==10071||10102<=e&&e<=10111||11093<=e&&e<=11097||12872<=e&&e<=12879||57344<=e&&e<=63743||65024<=e&&e<=65039||e==65533||127232<=e&&e<=127242||127248<=e&&e<=127277||127280<=e&&e<=127337||127344<=e&&e<=127386||917760<=e&&e<=917999||983040<=e&&e<=1048573||1048576<=e&&e<=1114109?"A":"N"},t.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function i(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var o=i(n),s=0,e=0;e<o.length;e++)s=s+this.characterLength(o[e]);return s},t.slice=function(n,o,s){textLen=t.length(n),o=o||0,s=s||1,o<0&&(o=textLen+o),s<0&&(s=textLen+s);for(var e="",a=0,m=i(n),g=0;g<m.length;g++){var b=m[g],$=t.length(b);if(a>=o-($==2?1:0))if(a+$<=s)e+=b;else break;a+=$}return e}})(We);var Ut=We.exports,Vt=Ve(Ut),Wt=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},Kt=Ve(Wt),be=10,Ae=(r=0)=>(t)=>`\x1B[${t+r}m`,Ge=(r=0)=>(t)=>`\x1B[${38+r};5;${t}m`,Ee=(r=0)=>(t,i,n)=>`\x1B[${38+r};2;${t};${i};${n}m`,p={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(p.modifier);var Tt=Object.keys(p.color),Ht=Object.keys(p.bgColor);[...Tt];var Yt=Jt(),D=new Set(["\x1B","\x9B"]),Zt=39,pe="\x07",Ke="[",zt="]",Te="m",de=`${zt}8;;`,Ne=(r)=>`${D.values().next().value}${Ke}${r}${Te}`,Ce=(r)=>`${D.values().next().value}${de}${r}${pe}`,Qt=(r)=>r.split(" ").map((t)=>K(t)),he=(r,t,i)=>{const n=[...t];let o=!1,s=!1,e=K(Ue(r[r.length-1]));for(let[a,m]of n.entries()){const g=K(m);if(e+g<=i?r[r.length-1]+=m:(r.push(m),e=0),D.has(m)&&(o=!0,s=n.slice(a+1).join("").startsWith(de)),o){s?m===pe&&(o=!1,s=!1):m===Te&&(o=!1);continue}e+=g,e===i&&a<n.length-1&&(r.push(""),e=0)}!e&&r[r.length-1].length>0&&r.length>1&&(r[r.length-2]+=r.pop())},Xt=(r)=>{const t=r.split(" ");let i=t.length;for(;i>0&&!(K(t[i-1])>0);)i--;return i===t.length?r:t.slice(0,i).join(" ")+t.slice(i).join("")},Ft=(r,t,i={})=>{if(i.trim!==!1&&r.trim()==="")return"";let n="",o,s;const e=Qt(r);let a=[""];for(let[g,b]of r.split(" ").entries()){i.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let $=K(a[a.length-1]);if(g!==0&&($>=t&&(i.wordWrap===!1||i.trim===!1)&&(a.push(""),$=0),($>0||i.trim===!1)&&(a[a.length-1]+=" ",$++)),i.hard&&e[g]>t){const d=t-$,u=1+Math.floor((e[g]-d-1)/t);Math.floor((e[g]-1)/t)<u&&a.push(""),he(a,b,t);continue}if($+e[g]>t&&$>0&&e[g]>0){if(i.wordWrap===!1&&$<t){he(a,b,t);continue}a.push("")}if($+e[g]>t&&i.wordWrap===!1){he(a,b,t);continue}a[a.length-1]+=b}i.trim!==!1&&(a=a.map((g)=>Xt(g)));const m=[...a.join(`
16
+ `)];for(let[g,b]of m.entries()){if(n+=b,D.has(b)){const{groups:d}=new RegExp(`(?:\\${Ke}(?<code>\\d+)m|\\${de}(?<uri>.*)${pe})`).exec(m.slice(g).join(""))||{groups:{}};if(d.code!==void 0){const u=Number.parseFloat(d.code);o=u===Zt?void 0:u}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}const $=Yt.codes.get(Number(o));m[g+1]===`
17
+ `?(s&&(n+=Ce("")),o&&$&&(n+=Ne($))):b===`
18
+ `&&(o&&$&&(n+=Ne(o)),s&&(n+=Ce(s)))}return n},Dt=Object.defineProperty,er=(r,t,i)=>(t in r)?Dt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,O=(r,t,i)=>(er(r,typeof t!="symbol"?t+"":t,i),i),He=Symbol("clack:cancel"),qe=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),rr=new Set(["up","down","left","right","space","enter"]);class ee{constructor({render:r,input:t=Ct,output:i=It,...n},o=!0){O(this,"input"),O(this,"output"),O(this,"rl"),O(this,"opts"),O(this,"_track",!1),O(this,"_render"),O(this,"_cursor",0),O(this,"state","initial"),O(this,"value"),O(this,"error",""),O(this,"subscribers",new Map),O(this,"_prevFrame",""),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.input=t,this.output=i}prompt(){const r=new qt(0);return r._write=(t,i,n)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),n()},this.input.pipe(r),this.rl=_e.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),_e.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),X(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((t,i)=>{this.once("submit",()=>{this.output.write(R.cursor.show),this.output.off("resize",this.render),X(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(R.cursor.show),this.output.off("resize",this.render),X(this.input,!1),t(He)})})}on(r,t){const i=this.subscribers.get(r)??[];i.push({cb:t}),this.subscribers.set(r,i)}once(r,t){const i=this.subscribers.get(r)??[];i.push({cb:t,once:!0}),this.subscribers.set(r,i)}emit(r,...t){const i=this.subscribers.get(r)??[],n=[];for(let o of i)o.cb(...t),o.once&&n.push(()=>i.splice(i.indexOf(o),1));for(let o of n)o()}unsubscribe(){this.subscribers.clear()}onKeypress(r,t){if(this.state==="error"&&(this.state="active"),t?.name&&!this._track&&qe.has(t.name)&&this.emit("cursor",qe.get(t.name)),t?.name&&rr.has(t.name)&&this.emit("cursor",t.name),r&&(r.toLowerCase()==="y"||r.toLowerCase()==="n")&&this.emit("confirm",r.toLowerCase()==="y"),r===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),r&&this.emit("key",r.toLowerCase()),t?.name==="return"){if(this.opts.validate){const i=this.opts.validate(this.value);i&&(this.error=i,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}r===""&&(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(`
19
+ `),X(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const r=Ie(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
20
+ `).length-1;this.output.write(R.cursor.move(-999,r*-1))}render(){const r=Ie(this._render(this)??"",process.stdout.columns,{hard:!0});if(r!==this._prevFrame){if(this.state==="initial")this.output.write(R.cursor.hide);else{const t=tr(this._prevFrame,r);if(this.restoreCursor(),t&&t?.length===1){const i=t[0];this.output.write(R.cursor.move(0,i)),this.output.write(R.erase.lines(1));const n=r.split(`
21
+ `);this.output.write(n[i]),this._prevFrame=r,this.output.write(R.cursor.move(0,n.length-i-1));return}else if(t&&t?.length>1){const i=t[0];this.output.write(R.cursor.move(0,i)),this.output.write(R.erase.down());const n=r.split(`
22
+ `).slice(i);this.output.write(n.join(`
23
+ `)),this._prevFrame=r;return}this.output.write(R.erase.down())}this.output.write(r),this.state==="initial"&&(this.state="active"),this._prevFrame=r}}}class fe extends ee{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(r){super(r,!1),this.value=!!r.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(R.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var ir=Object.defineProperty,nr=(r,t,i)=>(t in r)?ir(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,Le=(r,t,i)=>(nr(r,typeof t!="symbol"?t+"":t,i),i),Je=class extends ee{constructor(r){super(r,!1),Le(this,"options"),Le(this,"cursor",0),this.options=r.options,this.value=[...r.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===r.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(){const r=this.value.length===this.options.length;this.value=r?[]:this.options.map((t)=>t.value)}toggleValue(){const r=this.value.includes(this._value);this.value=r?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}};var or=Object.defineProperty,sr=(r,t,i)=>(t in r)?or(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,ar=(r,t,i)=>(sr(r,typeof t!="symbol"?t+"":t,i),i);class ue extends ee{constructor(r){super(r),ar(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=r.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${F.default.inverse(F.default.hidden("_"))}`;else{const t=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${t}${F.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}}var Tr=globalThis.process.platform.startsWith("win");var l=M(ze(),1),et=M(ge(),1);import A from"process";function gr(){return A.platform!=="win32"?A.env.TERM!=="linux":Boolean(A.env.CI)||Boolean(A.env.WT_SESSION)||Boolean(A.env.TERMINUS_SUBLIME)||A.env.ConEmuTask==="{cmd::Cmder}"||A.env.TERM_PROGRAM==="Terminus-Sublime"||A.env.TERM_PROGRAM==="vscode"||A.env.TERM==="xterm-256color"||A.env.TERM==="alacritty"||A.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function vr(){const r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,"g")}var $r=gr(),y=(r,t)=>$r?r:t,br=y("\u25C6","*"),hr=y("\u25A0","x"),pr=y("\u25B2","x"),tt=y("\u25C7","o"),ti=y("\u250C","T"),x=y("\u2502","|"),L=y("\u2514","\u2014"),Qe=y("\u25CF",">"),Xe=y("\u25CB"," "),dr=y("\u25FB","[\u2022]"),Fe=y("\u25FC","[+]"),fr=y("\u25FB","[ ]"),ri=y("\u25AA","\u2022"),De=y("\u2500","-"),ur=y("\u256E","+"),xr=y("\u251C","+"),yr=y("\u256F","+"),ii=y("\u25CF","\u2022"),ni=y("\u25C6","*"),oi=y("\u25B2","!"),si=y("\u25A0","x"),ve=(r)=>{switch(r){case"initial":case"active":return l.default.cyan(br);case"cancel":return l.default.red(hr);case"error":return l.default.yellow(pr);case"submit":return l.default.green(tt)}},rt=(r)=>new ue({validate:r.validate,placeholder:r.placeholder,defaultValue:r.defaultValue,initialValue:r.initialValue,render(){const t=`${l.default.gray(x)}
24
+ ${ve(this.state)} ${r.message}
25
+ `,i=r.placeholder?l.default.inverse(r.placeholder[0])+l.default.dim(r.placeholder.slice(1)):l.default.inverse(l.default.hidden("_")),n=this.value?this.valueWithCursor:i;switch(this.state){case"error":return`${t.trim()}
26
+ ${l.default.yellow(x)} ${n}
27
+ ${l.default.yellow(L)} ${l.default.yellow(this.error)}
28
+ `;case"submit":return`${t}${l.default.gray(x)} ${l.default.dim(this.value||r.placeholder)}`;case"cancel":return`${t}${l.default.gray(x)} ${l.default.strikethrough(l.default.dim(this.value??""))}${this.value?.trim()?`
29
+ `+l.default.gray(x):""}`;default:return`${t}${l.default.cyan(x)} ${n}
30
+ ${l.default.cyan(L)}
31
+ `}}}).prompt();var it=(r)=>{const t=r.active??"Yes",i=r.inactive??"No";return new fe({active:t,inactive:i,initialValue:r.initialValue??!0,render(){const n=`${l.default.gray(x)}
32
+ ${ve(this.state)} ${r.message}
33
+ `,o=this.value?t:i;switch(this.state){case"submit":return`${n}${l.default.gray(x)} ${l.default.dim(o)}`;case"cancel":return`${n}${l.default.gray(x)} ${l.default.strikethrough(l.default.dim(o))}
34
+ ${l.default.gray(x)}`;default:return`${n}${l.default.cyan(x)} ${this.value?`${l.default.green(Qe)} ${t}`:`${l.default.dim(Xe)} ${l.default.dim(t)}`} ${l.default.dim("/")} ${this.value?`${l.default.dim(Xe)} ${l.default.dim(i)}`:`${l.default.green(Qe)} ${i}`}
35
+ ${l.default.cyan(L)}
36
+ `}}}).prompt()};var nt=(r)=>{const t=(i,n)=>{const o=i.label??String(i.value);return n==="active"?`${l.default.cyan(dr)} ${o} ${i.hint?l.default.dim(`(${i.hint})`):""}`:n==="selected"?`${l.default.green(Fe)} ${l.default.dim(o)}`:n==="cancelled"?`${l.default.strikethrough(l.default.dim(o))}`:n==="active-selected"?`${l.default.green(Fe)} ${o} ${i.hint?l.default.dim(`(${i.hint})`):""}`:n==="submitted"?`${l.default.dim(o)}`:`${l.default.dim(fr)} ${l.default.dim(o)}`};return new Je({options:r.options,initialValues:r.initialValues,required:r.required??!0,cursorAt:r.cursorAt,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
37
+ ${l.default.reset(l.default.dim(`Press ${l.default.gray(l.default.bgWhite(l.default.inverse(" space ")))} to select, ${l.default.gray(l.default.bgWhite(l.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${l.default.gray(x)}
38
+ ${ve(this.state)} ${r.message}
39
+ `;switch(this.state){case"submit":return`${i}${l.default.gray(x)} ${this.options.filter(({value:n})=>this.value.includes(n)).map((n)=>t(n,"submitted")).join(l.default.dim(", "))||l.default.dim("none")}`;case"cancel":{const n=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>t(o,"cancelled")).join(l.default.dim(", "));return`${i}${l.default.gray(x)} ${n.trim()?`${n}
40
+ ${l.default.gray(x)}`:""}`}case"error":{const n=this.error.split(`
41
+ `).map((o,s)=>s===0?`${l.default.yellow(L)} ${l.default.yellow(o)}`:` ${o}`).join(`
42
+ `);return i+l.default.yellow(x)+" "+this.options.map((o,s)=>{const e=this.value.includes(o.value),a=s===this.cursor;return a&&e?t(o,"active-selected"):e?t(o,"selected"):t(o,a?"active":"inactive")}).join(`
43
+ ${l.default.yellow(x)} `)+`
44
+ `+n+`
45
+ `}default:return`${i}${l.default.cyan(x)} ${this.options.map((n,o)=>{const s=this.value.includes(n.value),e=o===this.cursor;return e&&s?t(n,"active-selected"):s?t(n,"selected"):t(n,e?"active":"inactive")}).join(`
46
+ ${l.default.cyan(x)} `)}
47
+ ${l.default.cyan(L)}
48
+ `}}}).prompt()};var ye=(r)=>r.replace(vr(),""),B=(r="",t="")=>{const i=`
49
+ ${r}
50
+ `.split(`
51
+ `),n=ye(t).length,o=Math.max(i.reduce((e,a)=>(a=ye(a),a.length>e?a.length:e),0),n)+2,s=i.map((e)=>`${l.default.gray(x)} ${l.default.dim(e)}${" ".repeat(o-ye(e).length)}${l.default.gray(x)}`).join(`
52
+ `);process.stdout.write(`${l.default.gray(x)}
53
+ ${l.default.green(tt)} ${l.default.reset(t)} ${l.default.gray(De.repeat(Math.max(o-n-1,1))+ur)}
54
+ ${s}
55
+ ${l.default.gray(xr+De.repeat(o+2)+yr)}
56
+ `)},ot=(r="")=>{process.stdout.write(`${l.default.gray(L)} ${l.default.red(r)}
15
57
 
16
- ${o.map(({hash:n,message:s,author:a})=>`- ${n} ${s} (by @${a})`).join("\n")}
58
+ `)};var st=async(r,t)=>{const i={},n=Object.keys(r);for(let o of n){const s=r[o],e=await s({results:i})?.catch((a)=>{throw a});if(typeof t?.onCancel=="function"&&T(e)){i[o]="canceled",t.onCancel({results:i});continue}i[o]=e}return i};var ae=M(_(),1);import{mkdirSync as ct,readdirSync as wr,rmdirSync as Sr}from"fs";var C=M(_(),1);var{Glob:kr}=globalThis.Bun;function H(r){if(typeof r==="function")r();else ot(r||"Operation cancelled by user");process.exit(0)}async function q({overwrite:r,tag:t,...i}={}){const o=await Bun.file("./.sisyphus/config.json").exists(),s=o&&r;if(!o||s){const e=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim();if(e.length===0)throw new Error("Couldn't find git repository. Have you initialized git repository?");if(s)Sr(".sisyphus",{recursive:!0});const a={...i,tag:t||"latest",lastStone:{commit:e,date:new Date().toISOString().split(".")[0]||""},ignore:[],stones:[]};ct(".sisyphus"),await Bun.write(".sisyphus/config.json",`${JSON.stringify(a,null,2)}\n`)}return Bun.file(".sisyphus/config.json").json()}async function mt({dryRun:r,...t}){const i=await q();if(r)console.info(`${C.bold(C.yellow("[dry-run]"))}
59
+ ${C.italic(".sisyphus/config.json")} would be updated to
60
+ ${JSON.stringify({...i,...t},null,2)}`);else await Bun.write(".sisyphus/config.json",`${JSON.stringify({...i,...t},null,2)}\n`),B(`${C.green("Sisyphus config updated!")}`)}function ne({name:r,version:t,bump:i,tag:n}){return`${r}@${t} => ${C.green(J({version:t,bump:i,tag:n}))} ${ie[i]}`}function gt(r){const t=r.map((n)=>at.indexOf(n)),i=Math.max(...t);return at[i]||"patch"}function J({version:r="",bump:t,tag:i}){const[n="0.0.0",o=""]=r.split("-"),[s="0",e="0",a="0"]=n.split("."),[m="",g="0"]=o.split(".");if(t==="snapshot"){const $=new Date().toISOString().replaceAll(/[.ZT:-]/g,"").slice(0,14);return`0.0.0-${i||"nightly"}-${$}`}if(i||t==="dependency"&&m)return`${n}-${i||m}.${Number.parseInt(g)+1}`;const b=t==="major"?`${s}.0.0`:t==="minor"?`${s}.${e}.0`:`${s}.${e}.${a}`;if(m&&n===b)return b;switch(t){case"major":return`${Number.parseInt(s)+1}.0.0`;case"minor":return`${s}.${Number.parseInt(e)+1}.0`;case"patch":return`${s}.${e}.${Number.parseInt(a)+1}`;default:return r}}function oe(){try{return wr(".sisyphus/stones").map((r)=>r.replace(".md",""))}catch{return ct(".sisyphus/stones"),[]}}async function se({filter:r,single:t}){const i=process.cwd(),n={};let o=[];try{o=(await Bun.file("package.json").json())?.workspaces||[]}catch(a){throw new Error("Couldn't find package.json for this project.",{cause:a})}if(!t&&o.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: ${i})\n
61
+ If you want to run Sisyphus in single package, use --single flag or set \`"single": true\` in .sisyphus/config.json.`);const s={};for(let a of o){const m=new kr(`${a}/package.json`).scanSync({cwd:i});for(let g of m){const{name:b,version:$,dependencies:d,devDependencies:u}=await Bun.file(g).json(),I=Object.entries({...d??{},...u??{}}).map(([v,W])=>W.startsWith("workspace")?v:"").filter(Boolean);for(let v of I)if(s[v]||=[],!s[v].includes(b))s[v].push(b);n[b]={name:b,version:$,file:g,dependencyOf:[]}}}for(let[a,m]of Object.entries(s))if(n[a])n[a].dependencyOf=m;const e=Object.keys(n);return{packages:n,packageNames:r?e.filter((a)=>a.includes(r)):e}}var re="#@!",U="***",at=["dependency","patch","minor","major","snapshot"],ie={dependency:"\uD83D\uDCE6",patch:"\uD83D\uDC1B",minor:"\u2728",major:"\uD83D\uDEA8",snapshot:"\uD83D\uDCF8"};async function $t(){const{values:{overwrite:r,tag:t,single:i,ignore:n}}=Pr({allowPositionals:!0,args:Bun.argv,strict:!0,options:{single:{default:!1,type:"boolean",short:"s"},ignore:{default:[],type:"string",short:"i",multiple:!0},overwrite:{default:!1,type:"boolean",short:"o"},tag:{default:"latest",type:"string",short:"t"}}}),o=await q({single:i,ignore:n,overwrite:r,tag:t});console.info(o),B(ae.reset(ae.green("Sisyphus is setup to roll stones.")))}import{rmSync as Rr}from"fs";import{parseArgs as jr}from"util";var j=M(_(),1);var V=M(_(),1);async function ht({changelogRoot:r,commit:t,dryRun:i=!1,stones:n}){const o=[""],{lastStone:{commit:s=""}}=await q(),e=Mr({stones:n});for(let[a,{bump:m,path:g,changelog:b}]of e.entries()){const $=[`# ${a}`,"",...b,bt({lastCommit:s,commit:t})];if(i)console.info(`${V.bold(V.yellow("[dry-run]"))}\n${$.join("\n")}`);else await Bun.write(g,$.join("\n"));const[d="",,,u=""]=b;if(!o.includes(u))o.unshift(u);o.push(`### ${ie[m]} ${a}@${d.slice(7)}`)}if(r){const a=Bun.file("CHANGELOG.md"),m=await a.exists(),[g,...b]=m?(await a.text()).split("\n"):["# Changelog"],$=[g,"",...o,...b,bt({root:!0,lastCommit:s,commit:t}),U,""];if(i)console.info(`${V.bold(V.yellow("[dry-run]"))}\nRoot changelog:\n${$.join("\n")}`);else await Bun.write(a,$.join("\n"))}}function Mr({stones:r}){const t=new Map;for(let{tag:i,packages:n,message:o}of r)for(let{file:s,name:e,version:a,bump:m}of n){const g=J({version:a,tag:i,bump:m}),{bump:b,path:$,changelog:d}=t.get(e)??{path:s.replace("package.json","CHANGELOG.md"),changelog:[],bump:m},[u="",,,w=""]=d,I=[u.replace("### ","")||"0.0.0",g].sort(Bun.semver.order)[1],v=[`### ${ie[m]} ${I}`,"",d.length>0?"__Stones:__":"__Stone:__",`_${o}${w?`, ${w.replaceAll("_","")}_`:"_"}`];t.set(e,{bump:b,path:$,changelog:v})}return t}function bt({root:r,lastCommit:t,commit:i}){const n=Bun.spawnSync(["git","log",`--pretty=format:%H${re}%s${re}%cn`,`${t}..${i}`]).stdout.toString().split("\n").map((o)=>{if(o.length===0)return;const[s,e,a]=o.split(re);return{hash:s,message:e,author:a}}).filter(Boolean);return`
62
+ <details><summary>${n.length} ${r?"Commits in this release":"Commits since last stone"}:</summary>
63
+
64
+ ${n.map(({hash:o,message:s,author:e})=>`- ${o} ${s} (by @${e})`).join("\n")}
17
65
 
18
66
  </details>
19
- `}import{note as Bt}from"@clack/prompts";import{bold as Lt,cyanBright as It,green as Wt,redBright as qt,reset as zt}from"picocolors";function it({packages:e,withTags:t,githubToken:i,github:o,rootTag:n}){if(t)for(let{name:s,version:a}of Object.values(e)){const r=`${s}@${a}`;Bun.spawnSync(["git","tag",r,"-m",`Release ${r}`,"-f"])}if(n)Bun.spawnSync(["git","tag",n,"-m","Release","-f"]);if(o){if(!(i||process.env.GITHUB_TOKEN))return Bt(zt(Lt(`${qt("No Github token found.")}
20
- Please provide one by using ${It("--githubToken")} flag or by setting ${Wt("GITHUB_TOKEN")} environment variable.`)));console.info("TODO: Creating Github release",{withTags:t,githubToken:i})}}import{note as Jt}from"@clack/prompts";import{bold as K,cyanBright as Qt,green as st,magenta as B,redBright as rt,reset as Yt}from"picocolors";function at({packages:e,dryRun:t,npmToken:i}){if(!(i||process.env.NPM_TOKEN))return Jt(Yt(K(`${rt("No NPM token found.")}
21
- Please provide one by using ${Qt("--npmToken")} flag or by setting ${st("NPM_TOKEN")} environment variable.`)));const n=["npm","publish","--registry","https://registry.npmjs.org"].concat(t?["--dry-run"]:[]);for(let{name:s,file:a}of Object.values(e)){console.info(`Publishing ${B(s)}...`);try{Bun.spawnSync(n,{cwd:a.replace("package.json","")}),console.info(K(`${st("Published")} ${B(s)}`))}catch(r){console.error(K(`${rt("Failed to publish")} ${B(s)}`)),console.error(r)}}}async function ut(){const{values:e}=Xt({allowPositionals:!0,args:Bun.argv,strict:!0,options:{changelog:{default:!0,type:"boolean",short:"c"},changelogRoot:{default:!1,type:"boolean",short:"r"},dryRun:{default:!1,type:"boolean",short:"d"},github:{default:!1,type:"boolean",short:"g"},githubToken:{type:"string"},npm:{default:!1,type:"boolean",short:"n"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{default:!1,type:"boolean",short:"t"}}}),t=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),i=new Date().toISOString().split(".")[0]||"",{dryRun:o,npmToken:n,changelogRoot:s}=e;let a=[];try{a=await ee()}catch{}if(a.length===0)return Zt(lt(ct(`${te("No stones found.")}
22
- ${lt(`Run ${Tt("bunx @r5n/sisyphus")}${gt(" version")} and create some first.`)}`)));const r=await oe({dryRun:o,configs:a});if(e.changelog)await nt({dryRun:o,changelogRoot:s,commit:t,stones:a});if(e.npm)at({dryRun:o,packages:r,npmToken:n});if(e.github)it({...e,packages:r});if(await X({dryRun:o,stones:[],lastStone:{commit:t,date:i}}),!e.dryRun)Vt(".sisyphus/stones",{recursive:!0,force:!0})}async function ee(){const e=x(),{packages:t}=await U({}),i=[];for(let o of e)try{const n=await Bun.file(`.sisyphus/stones/${o}.md`).text(),[s="",a=""]=n.split(M),[r="",,l=""]=a.trim().split("|\n|"),[u="",c=""]=s.split("\n");console.info({bumpTypesInfo:r,packagesInfo:l,releaseInfo:a,stoneContent:n,tag:c,title:u,titleAndTag:s});const f=r.slice(2).split("|").map((b)=>b.trim()),m=l.trim().slice(0,-2).split("|").map((b)=>b.split(",").map((v)=>v.trim())).flatMap((b,v)=>b.map((g)=>t[g]?{...t[g],bump:f[v]}:void 0)).filter(Boolean);i.push({message:u.replace("###","").trim(),name:o,packages:m,tag:c})}catch(n){console.error(`Error processing stone ${o}`),console.error(n)}return i}async function oe({configs:e,dryRun:t=!1}){const i=[],o=e.reduce((n,{message:s,packages:a})=>{i.push(s);for(let{bump:r,name:l,...u}of a)n[l]||={...u,name:l,bump:r},n[l].bump=Z([r,n[l].bump]),n[l].version=_({version:n[l].version,bump:r});return n},{});if(t)console.info(`${ct(gt("[dry-run]"))}\nConfig for next release:\n${i.join("\n")}\n${JSON.stringify(o,null,2)}`);else for(let{version:n,file:s}of Object.values(o)){const a=await Bun.file(s).json();await Bun.write(s,`${JSON.stringify({...a,version:n},null,2)}\n`)}return o}import{parseArgs as ue}from"util";import{confirm as fe,isCancel as he}from"@clack/prompts";import{bold as dt,cyanBright as bt,italic as wt,yellow as me}from"picocolors";import{group as ne,multiselect as ie,text as se}from"@clack/prompts";import{bold as S,dim as ft,italic as ht,magenta as L,underline as F,whiteBright as H}from"picocolors";import{object as re,string as O}from"zod";async function mt({packages:e,packageNames:t,tag:i}){function o({message:h,bump:m,packageNames:b,filterPackages:v}){const g=b.filter((y)=>!v?.includes(y)).map((y)=>({value:y,label:E({tag:i,name:y,version:e[y]?.version||"",bump:m})}));return g.length>0?ie({required:!1,initialValues:void 0,message:h,options:g}):void 0}const n=`\n - ${ft(ht(`Press ${F(S(H("a")))} to select/unselect all, ${F(S(H("SPACE")))} to select/unselect, ${F(S(H("ARROWS")))} to move, ${F(S(H("ENTER")))} to confirm`))}\n`,s=await ne({message:()=>se({placeholder:"New feature",message:`Name of the stone. ${ft(ht("Default prefix or message can be configured in config."))}`}),majorPackages:()=>o({message:`Select packages for ${S(L("major"))} bump.${n}`,bump:"major",packageNames:t,filterPackages:[]}),minorPackages:({results:{majorPackages:h}})=>o({message:`Select packages for ${S(L("minor"))} bump.`,bump:"minor",packageNames:t,filterPackages:h||[]}),patchPackages:({results:{majorPackages:h,minorPackages:m}})=>o({message:`Select packages for ${S(L("patch"))} bump.`,bump:"patch",packageNames:t,filterPackages:(h||[]).concat(m||[])})},{onCancel:()=>C()}),{success:a,error:r,data:{message:l="stone",majorPackages:u=[],minorPackages:c=[],patchPackages:f=[]}={}}=re({message:O().optional(),majorPackages:O().array().optional(),minorPackages:O().array().optional(),patchPackages:O().array().optional()}).safeParse(s);if(!a)return C(r.message);return{message:l,majorPackages:u,minorPackages:c,patchPackages:f}}import{randomUUID as ae}from"crypto";import{note as le}from"@clack/prompts";import{bold as pt,green as I,italic as ce,yellow as ge}from"picocolors";async function $t({dryRun:e=!1,majorPackages:t,message:i,minorPackages:o,packages:n,patchPackages:s,tag:a}){const l=`${`${x().length+1}`.padStart(4,"0")}-${ae().slice(0,8)}`,u=[...t,...o,...s],c=u.flatMap((g)=>n[g]?.dependencyOf||[]),f=[t,o,s,c.filter((g)=>!u.includes(g))],h=f.flatMap((g,y)=>g.length>0&&W[y]).filter(Boolean),m=[`### ${i}`,a?`_${a}_`:"",M,"",`| ${h.join(" | ")} |`,`| ${h.map(()=>":---:").join(" | ")} |`,`| ${h.map((g)=>f[W.indexOf(g)]?.join(", ")).join(" | ")} |`,""],b=await k();if(b.stones.push(l),e)console.info(`${pt(ge("[dry-run]"))}\nStone file preview:\n${m.join("\n")}`);else await Bun.write(`.sisyphus/stones/${l}.md`,m.join("\n")),await Bun.write(".sisyphus/config.json",`${JSON.stringify(b,null,2)}\n`),le(`Now you can run ${I("bunx @r5n/sisyphus roll")} to release packages
23
- or create another stone with ${I("bunx @r5n/sisyphus version")}`,`${pt("Stone ")}${ce(`${l}.md`)} ${I("created!")}`);return f.flatMap((g,y)=>g.map((Pt)=>({...n[Pt],bump:W[y]}))).filter(Boolean)}var W=["major","minor","patch","dependency"];async function yt(){const{values:{bump:e,dryRun:t,filter:i,tag:o,snapshot:n,yes:s}}=ue({allowPositionals:!0,args:Bun.argv,strict:!0,options:{bump:{default:"",type:"string",short:"b"},dryRun:{default:!1,type:"boolean",short:"d"},filter:{default:"",type:"string",short:"f"},snapshot:{default:!1,type:"boolean",short:"s"},tag:{default:"",type:"string",short:"t"},yes:{default:!1,type:"boolean",short:"y"}}});if(n&&e)return C(`Cannot use both ${bt("--snapshot")} and ${bt("--bump")} options, pick one.`);const{packages:a,packageNames:r}=await U({filter:i}),{message:l,majorPackages:u,minorPackages:c,patchPackages:f}=await mt({packages:a,packageNames:r,tag:o}),h=await $t({dryRun:t,message:l,packages:a,tag:o,majorPackages:u,minorPackages:c,patchPackages:f});if(console.info([`${t?dt(me("[dry-run]\n")):""}${wt("Changes preview:")}\n`,`${wt("Stone: ")}${dt(l)}`,...h.map(E)].join("\n")),!(s||t)){const m=await fe({message:"Are you sure you want to create a new stone?",active:"Yes, continue",inactive:"No, cancel"});if(!m||he(m))return C("Operation cancelled by user")}}function vt({method:e}){if(Bun.argv.includes("--help"))return D(e);switch(e){case"init":return T();case"version":return yt();case"roll":return ut();default:return D()}}var[pe]=process.argv.slice(2);vt({method:pe});
67
+ `}var N=M(_(),1);function pt({packages:r,withTags:t,githubToken:i,github:n,rootTag:o}){if(t)for(let{name:s,version:e}of Object.values(r)){const a=`${s}@${e}`;Bun.spawnSync(["git","tag",a,"-m",`Release ${a}`,"-f"])}if(o)Bun.spawnSync(["git","tag",o,"-m","Release","-f"]);if(n){if(!(i||process.env.GITHUB_TOKEN))return B(N.reset(N.bold(`${N.redBright("No Github token found.")}
68
+ Please provide one by using ${N.cyanBright("--githubToken")} flag or by setting ${N.green("GITHUB_TOKEN")} environment variable.`)));console.info("TODO: Creating Github release",{withTags:t,githubToken:i})}}var k=M(_(),1);function dt({packages:r,dryRun:t,npmToken:i}){if(!(i||process.env.NPM_TOKEN))return B(k.reset(k.bold(`${k.redBright("No NPM token found.")}
69
+ Please provide one by using ${k.cyanBright("--npmToken")} flag or by setting ${k.green("NPM_TOKEN")} environment variable.`)));const o=["npm","publish","--registry","https://registry.npmjs.org"].concat(t?["--dry-run"]:[]);for(let{name:s,file:e}of Object.values(r)){console.info(`Publishing ${k.magenta(s)}...`);try{Bun.spawnSync(o,{cwd:e.replace("package.json","")}),console.info(k.bold(`${k.green("Published")} ${k.magenta(s)}`))}catch(a){console.error(k.bold(`${k.redBright("Failed to publish")} ${k.magenta(s)}`)),console.error(a)}}}async function ft(){const{values:r}=jr({allowPositionals:!0,args:Bun.argv,strict:!0,options:{changelog:{default:!0,type:"boolean",short:"c"},changelogRoot:{default:!1,type:"boolean",short:"r"},dryRun:{default:!1,type:"boolean",short:"d"},github:{default:!1,type:"boolean",short:"g"},githubToken:{type:"string"},npm:{default:!1,type:"boolean",short:"n"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{default:!1,type:"boolean",short:"t"}}}),t=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),i=new Date().toISOString().split(".")[0]||"",{dryRun:n,npmToken:o,changelogRoot:s}=r;let e=[];try{e=await Or()}catch{}if(e.length===0)return B(j.reset(j.bold(`${j.redBright("No stones found.")}
70
+ ${j.reset(`Run ${j.green("bunx @r5n/sisyphus")}${j.yellow(" version")} and create some first.`)}`)));const a=await Br({dryRun:n,configs:e});if(r.changelog)await ht({dryRun:n,changelogRoot:s,commit:t,stones:e});if(r.npm)dt({dryRun:n,packages:a,npmToken:o});if(r.github)pt({...r,packages:a});if(await mt({dryRun:n,stones:[],lastStone:{commit:t,date:i}}),!r.dryRun)Rr(".sisyphus/stones",{recursive:!0,force:!0})}async function Or(){const r=oe(),{packages:t}=await se({}),i=[];for(let n of r)try{const o=await Bun.file(`.sisyphus/stones/${n}.md`).text(),[s="",e=""]=o.split(U),[a="",,m=""]=e.trim().split("|\n|"),[g="",b=""]=s.split("\n");console.info({bumpTypesInfo:a,packagesInfo:m,releaseInfo:e,stoneContent:o,tag:b,title:g,titleAndTag:s});const $=a.slice(2).split("|").map((w)=>w.trim()),u=m.trim().slice(0,-2).split("|").map((w)=>w.split(",").map((I)=>I.trim())).flatMap((w,I)=>w.map((v)=>t[v]?{...t[v],bump:$[I]}:void 0)).filter(Boolean);i.push({message:g.replace("###","").trim(),name:n,packages:u,tag:b})}catch(o){console.error(`Error processing stone ${n}`),console.error(o)}return i}async function Br({configs:r,dryRun:t=!1}){const i=[],n=r.reduce((o,{message:s,packages:e})=>{i.push(s);for(let{bump:a,name:m,...g}of e)o[m]||={...g,name:m,bump:a},o[m].bump=gt([a,o[m].bump]),o[m].version=J({version:o[m].version,bump:a});return o},{});if(t)console.info(`${j.bold(j.yellow("[dry-run]"))}\nConfig for next release:\n${i.join("\n")}\n${JSON.stringify(n,null,2)}`);else for(let{version:o,file:s}of Object.values(n)){const e=await Bun.file(s).json();await Bun.write(s,`${JSON.stringify({...e,version:o},null,2)}\n`)}return n}import{parseArgs as Ar}from"util";var E=M(_(),1);var h=M(_(),1);async function ut({packages:r,packageNames:t,tag:i}){function n({message:g,bump:b,packageNames:$,filterPackages:d}){const u=$.filter((w)=>!d?.includes(w)).map((w)=>({value:w,label:ne({tag:i,name:w,version:r[w]?.version||"",bump:b})}));return u.length>0?nt({required:!1,initialValues:void 0,message:g,options:u}):void 0}const o=`\n - ${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`))}\n`,{message:s,majorPackages:e,minorPackages:a,patchPackages:m}=await st({message:()=>rt({placeholder:"New feature",message:`Name of the stone. ${h.dim(h.italic("Default prefix or message can be configured in config."))}`}),majorPackages:()=>n({message:`Select packages for ${h.bold(h.magenta("major"))} bump.${o}`,bump:"major",packageNames:t,filterPackages:[]}),minorPackages:({results:{majorPackages:g}})=>n({message:`Select packages for ${h.bold(h.magenta("minor"))} bump.`,bump:"minor",packageNames:t,filterPackages:g||[]}),patchPackages:({results:{majorPackages:g,minorPackages:b}})=>n({message:`Select packages for ${h.bold(h.magenta("patch"))} bump.`,bump:"patch",packageNames:t,filterPackages:(g||[]).concat(b||[])})},{onCancel:()=>H()});return{message:s,majorPackages:e||[],minorPackages:a||[],patchPackages:m||[]}}import{randomUUID as _r}from"crypto";var G=M(_(),1);async function xt({dryRun:r=!1,majorPackages:t,message:i,minorPackages:n,packages:o,patchPackages:s,tag:e}){const m=`${`${oe().length+1}`.padStart(4,"0")}-${_r().slice(0,8)}`,g=[...t,...n,...s],b=g.flatMap((v)=>o[v]?.dependencyOf||[]),$=[t,n,s,b.filter((v)=>!g.includes(v))],d=$.flatMap((v,W)=>v.length>0&&we[W]).filter(Boolean),u=[`### ${i}`,e?`_${e}_`:"",U,"",`| ${d.join(" | ")} |`,`| ${d.map(()=>":---:").join(" | ")} |`,`| ${d.map((v)=>$[we.indexOf(v)]?.join(", ")).join(" | ")} |`,""],w=await q();if(w.stones.push(m),r)console.info(`${G.bold(G.yellow("[dry-run]"))}\nStone file preview:\n${u.join("\n")}`);else await Bun.write(`.sisyphus/stones/${m}.md`,u.join("\n")),await Bun.write(".sisyphus/config.json",`${JSON.stringify(w,null,2)}\n`),B(`Now you can run ${G.green("bunx @r5n/sisyphus roll")} to release packages
71
+ or create another stone with ${G.green("bunx @r5n/sisyphus version")}`,`${G.bold("Stone ")}${G.italic(`${m}.md`)} ${G.green("created!")}`);return $.flatMap((v,W)=>v.map((wt)=>({...o[wt],bump:we[W]}))).filter(Boolean)}var we=["major","minor","patch","dependency"];async function yt(){const{values:{bump:r,dryRun:t,filter:i,tag:n,snapshot:o,yes:s}}=Ar({allowPositionals:!0,args:Bun.argv,strict:!0,options:{bump:{default:"",type:"string",short:"b"},dryRun:{default:!1,type:"boolean",short:"d"},filter:{default:"",type:"string",short:"f"},snapshot:{default:!1,type:"boolean",short:"s"},tag:{default:"",type:"string",short:"t"},yes:{default:!1,type:"boolean",short:"y"}}});if(o&&r)return H(`Cannot use both ${E.cyanBright("--snapshot")} and ${E.cyanBright("--bump")} options, pick one.`);const{packages:e,packageNames:a}=await se({filter:i}),{message:m,majorPackages:g,minorPackages:b,patchPackages:$}=await ut({packages:e,packageNames:a,tag:n}),d=await xt({dryRun:t,message:m,packages:e,tag:n,majorPackages:g,minorPackages:b,patchPackages:$});if(console.info([`${t?E.bold(E.yellow("[dry-run]\n")):""}${E.italic("Changes preview:")}\n`,`${E.italic("Stone: ")}${E.bold(m)}`,...d.map(ne)].join("\n")),!(s||t)){const u=await it({message:"Are you sure you want to create a new stone?",active:"Yes, continue",inactive:"No, cancel"});if(!u||T(u))return H("Operation cancelled by user")}}function vt({method:r}){if(Bun.argv.includes("--help"))return ce(r);switch(r){case"init":return $t();case"version":return yt();case"roll":return ft();default:return ce()}}var[Gr]=process.argv.slice(2);vt({method:Gr});
package/package.json CHANGED
@@ -5,8 +5,7 @@
5
5
  },
6
6
  "dependencies": {
7
7
  "@clack/prompts": "0.7.0",
8
- "picocolors": "1.1.0",
9
- "zod": "3.23.8"
8
+ "picocolors": "1.1.0"
10
9
  },
11
10
  "devDependencies": {
12
11
  "@r5n/tools-bun": "workspace:*"
@@ -30,5 +29,5 @@
30
29
  "type-check": "bun tsc --noEmit"
31
30
  },
32
31
  "types": "./cli.ts",
33
- "version": "0.2.0-rc.1"
32
+ "version": "0.2.0-rc.3"
34
33
  }