mytools-tasks 0.18.0 → 0.19.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/index.js +4 -5
  2. package/package.json +5 -12
package/dist/index.js CHANGED
@@ -114,11 +114,9 @@ Content-Type: ${u.type||"application/octet-stream"}\r
114
114
  `){return t.split(r).reduce((n,o)=>{let u=e?o.trim():o;return u&&n.push(u),n},[])}function Qa(t,e){return ks(t,!0).map(r=>e(r))}function Ja(t){return(0,Xn.exists)(t,Xn.FOLDER)}function $e(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function _m(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ei(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function it(t){return Array.isArray(t)?t:[t]}function wm(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function Wr(t){return it(t).map(e=>e instanceof String?e:String(e))}function Y(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Rs(t,e){let r=[];for(let n=0,o=t.length;n<o;n++)r.push(e,t[n]);return r}function Cs(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function vm(t,e){let r={};return e.forEach(n=>{t[n]!==void 0&&(r[n]=t[n])}),r}function Ia(t=0){return new Promise(e=>setTimeout(e,t))}function qa(t){if(t!==!1)return t}var Lr,ir,Ps,ti=T({"src/lib/utils/util.ts"(){"use strict";Ka(),Lr="\0",ir=()=>{},Ps=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ce(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Da(t,e){let r=Me(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function ri(t){return!!t&&Ps(t)==="[object Object]"}function Sm(t){return typeof t=="function"}var Es,Tm,ee,Qn,si,Ka=T({"src/lib/utils/argument-filters.ts"(){"use strict";ti(),Es=t=>Array.isArray(t),Tm=t=>typeof t=="number",ee=t=>typeof t=="string"||Me(t),Qn=t=>ee(t)||Array.isArray(t)&&t.every(ee),si=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Ma,ET=T({"src/lib/utils/exit-codes.ts"(){"use strict";Ma=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Ma||{})}}),Jn,AT=T({"src/lib/utils/git-output-streams.ts"(){"use strict";Jn=class Rm{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new Rm(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function OT(){throw new Error("LineParser:useMatches not implemented")}var M,Lt,IT=T({"src/lib/utils/line-parser.ts"(){"use strict";M=class{constructor(t,e){this.matches=[],this.useMatches=OT,this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((o,u)=>this.addMatch(o,u,r(u)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},Lt=class extends M{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Cm(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...xm},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var xm,qT=T({"src/lib/utils/simple-git-options.ts"(){"use strict";xm={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Za(t,e=[]){return ri(t)?Object.keys(t).reduce((r,n)=>{let o=t[n];if(Me(o))r.push(o);else if(Da(o,["boolean"]))r.push(n+"="+o);else if(Array.isArray(o))for(let u of o)Da(u,["string","number"])||r.push(n+"="+u);else r.push(n);return r},e):e}function de(t,e=0,r=!1){let n=[];for(let o=0,u=e<0?t.length:e;o<u;o++)"string|number".includes(typeof t[o])&&n.push(String(t[o]));return Za(Xa(t),n),r||n.push(...DT(t)),n}function DT(t){let e=typeof nr(t)=="function";return Wr(ce(nr(t,e?1:0),Es,[]))}function Xa(t){let e=Sm(nr(t));return ce(nr(t,e?1:0),ri)}function K(t,e=!0){let r=mm(nr(t));return e||pm(r)?r:void 0}var MT=T({"src/lib/utils/task-options.ts"(){"use strict";Ka(),ti()}});function Ba(t,e){return t(e.stdOut,e.stdErr)}function Se(t,e,r,n=!0){return it(r).forEach(o=>{for(let u=ks(o,n),l=0,h=u.length;l<h;l++){let d=(m=0)=>{if(!(l+m>=h))return u[l+m]};e.some(({parse:m})=>m(d,t))}}),t}var BT=T({"src/lib/utils/task-parser.ts"(){"use strict";ti()}}),km={};ne(km,{ExitCodes:()=>Ma,GitOutputStreams:()=>Jn,LineParser:()=>M,NOOP:()=>ir,NULL:()=>Lr,RemoteLineParser:()=>Lt,append:()=>$e,appendTaskOptions:()=>Za,asArray:()=>it,asCamelCase:()=>wm,asFunction:()=>mm,asNumber:()=>Y,asStringArray:()=>Wr,bufferToString:()=>Cs,callTaskParser:()=>Ba,createInstanceConfig:()=>Cm,delay:()=>Ia,filterArray:()=>Es,filterFunction:()=>Sm,filterHasLength:()=>si,filterNumber:()=>Tm,filterPlainObject:()=>ri,filterPrimitives:()=>Da,filterString:()=>ee,filterStringOrStringArray:()=>Qn,filterType:()=>ce,first:()=>bm,folderExists:()=>Ja,forEachLineWithContent:()=>Qa,getTrailingOptions:()=>de,including:()=>_m,isUserFunction:()=>pm,last:()=>nr,objectToString:()=>Ps,orVoid:()=>qa,parseStringResponse:()=>Se,pick:()=>vm,prefixedArray:()=>Rs,remove:()=>ei,splitOn:()=>gm,toLinesWithContent:()=>ks,trailingFunctionArgument:()=>K,trailingOptionsArgument:()=>Xa});var q=T({"src/lib/utils/index.ts"(){"use strict";Ka(),ET(),AT(),IT(),qT(),MT(),BT(),ti()}}),Pm={};ne(Pm,{CheckRepoActions:()=>Fa,checkIsBareRepoTask:()=>Am,checkIsRepoRootTask:()=>Em,checkIsRepoTask:()=>FT});function FT(t){switch(t){case"bare":return Am();case"root":return Em()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:ni,parser:eu}}function Em(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:ni,parser(e){return/^\.(git)?$/.test(e.trim())}}}function Am(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:ni,parser:eu}}function $T(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var Fa,ni,eu,Om=T({"src/lib/tasks/check-is-repo.ts"(){"use strict";q(),Fa=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Fa||{}),ni=({exitCode:t},e,r,n)=>{if(t===128&&$T(e))return r(Buffer.from("false"));n(e)},eu=t=>t.trim()==="true"}});function jT(t,e){let r=new Im(t),n=t?Dm:qm;return ks(e).forEach(o=>{let u=o.replace(n,"");r.paths.push(u),(Mm.test(u)?r.folders:r.files).push(u)}),r}var Im,qm,Dm,Mm,LT=T({"src/lib/responses/CleanSummary.ts"(){"use strict";q(),Im=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},qm=/^[a-z]+\s*/i,Dm=/^[a-z]+\s+[a-z]+\s*/i,Mm=/\/$/}}),$a={};ne($a,{EMPTY_COMMANDS:()=>ii,adhocExecTask:()=>Bm,configurationErrorTask:()=>ve,isBufferTask:()=>$m,isEmptyTask:()=>jm,straightThroughBufferTask:()=>Fm,straightThroughStringTask:()=>fe});function Bm(t){return{commands:ii,format:"empty",parser:t}}function ve(t){return{commands:ii,format:"empty",parser(){throw typeof t=="string"?new dm(t):t}}}function fe(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function Fm(t){return{commands:t,format:"buffer",parser(e){return e}}}function $m(t){return t.format==="buffer"}function jm(t){return t.format==="empty"||!t.commands.length}var ii,re=T({"src/lib/tasks/task.ts"(){"use strict";fm(),ii=[]}}),Lm={};ne(Lm,{CONFIG_ERROR_INTERACTIVE_MODE:()=>tu,CONFIG_ERROR_MODE_REQUIRED:()=>ru,CONFIG_ERROR_UNKNOWN_OPTION:()=>su,CleanOptions:()=>Hn,cleanTask:()=>Nm,cleanWithOptionsTask:()=>NT,isCleanOptionsArray:()=>UT});function NT(t,e){let{cleanMode:r,options:n,valid:o}=WT(t);return r?o.options?(n.push(...e),n.some(GT)?ve(tu):Nm(r,n)):ve(su+JSON.stringify(t)):ve(ru)}function Nm(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return jT(t==="n",n)}}}function UT(t){return Array.isArray(t)&&t.every(e=>nu.has(e))}function WT(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(o=>{zT(o)?(e=o,n.cleanMode=!0):n.options=n.options&&HT(r[r.length]=`-${o}`)}),{cleanMode:e,options:r,valid:n}}function zT(t){return t==="f"||t==="n"}function HT(t){return/^-[a-z]$/i.test(t)&&nu.has(t.charAt(1))}function GT(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var tu,ru,su,Hn,nu,Um=T({"src/lib/tasks/clean.ts"(){"use strict";LT(),q(),re(),tu="Git clean interactive mode is not supported",ru='Git clean mode parameter ("n" or "f") is required',su="Git clean unknown option found in: ",Hn=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(Hn||{}),nu=new Set(["i",...Wr(Object.values(Hn))])}});function VT(t){let e=new zm;for(let r of Wm(t))e.addValue(r.file,String(r.key),r.value);return e}function YT(t,e){let r=null,n=[],o=new Map;for(let u of Wm(t,e))u.key===e&&(n.push(r=u.value),o.has(u.file)||o.set(u.file,[]),o.get(u.file).push(r));return{key:e,paths:Array.from(o.keys()),scopes:o,value:r,values:n}}function QT(t){return t.replace(/^(file):/,"")}function*Wm(t,e=null){let r=t.split("\0");for(let n=0,o=r.length-1;n<o;){let u=QT(r[n++]),l=r[n++],h=e;if(l.includes(`
115
115
  `)){let d=gm(l,`
116
116
  `);h=d[0],l=d[1]}yield{file:u,key:h,value:l}}}var zm,JT=T({"src/lib/responses/ConfigList.ts"(){"use strict";q(),zm=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=nr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);Object.hasOwn(n,e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function xa(t,e){return typeof t=="string"&&Object.hasOwn(ja,t)?t:e}function KT(t,e,r,n){let o=["config",`--${n}`];return r&&o.push("--add"),o.push(t,e),{commands:o,format:"utf-8",parser(u){return u}}}function ZT(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return YT(n,t)}}}function XT(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return VT(r)}}}function eR(){return{addConfig(t,e,...r){return this._runTask(KT(t,e,r[0]===!0,xa(r[1],"local")),K(arguments))},getConfig(t,e){return this._runTask(ZT(t,xa(e,void 0)),K(arguments))},listConfig(...t){return this._runTask(XT(xa(t[0],void 0)),K(arguments))}}}var ja,Hm=T({"src/lib/tasks/config.ts"(){"use strict";JT(),q(),ja=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ja||{})}});function tR(t){return Gm.has(t)}var ka,Gm,Vm=T({"src/lib/tasks/diff-name-status.ts"(){"use strict";ka=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(ka||{}),Gm=new Set(Object.values(ka))}});function rR(...t){return new Qm().param(...t)}function sR(t){let e=new Set,r={};return Qa(t,n=>{let[o,u,l]=n.split(Lr);e.add(o),(r[o]=r[o]||[]).push({line:Y(u),path:o,preview:l})}),{paths:e,results:r}}function nR(){return{grep(t){let e=K(arguments),r=de(arguments);for(let o of Ym)if(r.includes(o))return this._runTask(ve(`git.grep: use of "${o}" is not supported.`),e);typeof t=="string"&&(t=rR().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(o){return sR(o)}},e)}}}var Ym,Ts,Mf,Qm,Jm=T({"src/lib/tasks/grep.ts"(){"use strict";q(),re(),Ym=["-h"],Ts=Symbol("grepQuery"),Qm=class{constructor(){this[Mf]=[]}*[(Mf=Ts,Symbol.iterator)](){for(let t of this[Ts])yield t}and(...t){return t.length&&this[Ts].push("--and","(",...Rs(t,"-e"),")"),this}param(...t){return this[Ts].push(...Rs(t,"-e")),this}}}}),Km={};ne(Km,{ResetMode:()=>Gn,getResetMode:()=>oR,resetTask:()=>iR});function iR(t,e){let r=["reset"];return Zm(t)&&r.push(`--${t}`),r.push(...e),fe(r)}function oR(t){if(Zm(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function Zm(t){return typeof t=="string"&&Xm.includes(t)}var Gn,Xm,ep=T({"src/lib/tasks/reset.ts"(){"use strict";q(),re(),Gn=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Gn||{}),Xm=Wr(Object.values(Gn))}});function aR(){return(0,Kn.default)("simple-git")}function Bf(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...o)=>{t(n,...o),r(n,...o)}:t:(n,...o)=>{t(`%s ${n}`,e,...o),r&&r(n,...o)}}function uR(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function iu(t,e,r,n=aR()){let o=t&&`[${t}]`||"",u=[],l=typeof e=="string"?n.extend(e):e,h=uR(ce(e,ee),l,n);return m(r);function d(p,w){return $e(u,iu(t,h.replace(/^[^:]+/,p),w,n))}function m(p){let w=p&&`[${p}]`||"",_=l&&Bf(l,w)||ir,R=Bf(n,`${o} ${w}`,_);return Object.assign(l?_:R,{label:t,sibling:d,info:R,step:m})}}var tp=T({"src/lib/git-logger.ts"(){"use strict";q(),Kn.default.formatters.L=t=>String(si(t)?t.length:"-"),Kn.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Ps(t)}}),rp,lR=T({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";Nt(),tp(),rp=class La{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let r=La.getName(e.commands[0]),n=iu(this.logLabel,r);return{task:e,logger:n,name:r}}push(e){let r=this.createProgress(e);return r.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,r),r}fatal(e){for(let[r,{logger:n}]of Array.from(this._queue.entries()))r===e.task?(n.info("Failed %o",e),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(r);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let r=this.withProgress(e);if(!r)throw new vt(void 0,"TasksPendingQueue: attempt called for an unknown task");return r.logger("Starting task"),r}static getName(e="empty"){return`task:${e}:${++La.counter}`}static{this.counter=0}}}});function sr(t,e){return{method:bm(t.commands)||"",commands:e}}function cR(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function Ff(t,e,r,n){return o=>{r("%s received %L bytes",e,o),n("%B",o),t.push(o)}}var Na,hR=T({"src/lib/runners/git-executor-chain.ts"(){"use strict";Nt(),re(),q(),lR(),Na=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new rp}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:n}=this._queue.attempt(t);return await(jm(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n))}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof vt?Object.assign(e,{task:t}):new vt(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",sr(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],{...sr(t,t.commands),env:{...this.env}}),o=await this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),u=await this.handleTaskData(t,n,o,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),$m(t)?Ba(t.parser,u):Ba(t.parser,u.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,n){let{exitCode:o,rejection:u,stdOut:l,stdErr:h}=r;return new Promise((d,m)=>{n("Preparing to handle process response exitCode=%d stdOut=",o);let{error:p}=this._plugins.exec("task.error",{error:u},{...sr(t,e),...r});if(p&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,p,w=>{n.info("custom error handler treated as success"),n("custom error returned a %s",Ps(w)),d(new Jn(Array.isArray(w)?Buffer.concat(w):w,Buffer.concat(h)))},m);if(p)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",o,h.length,u),m(p);n.info("retrieving task output complete"),d(new Jn(Buffer.concat(l),Buffer.concat(h)))})}async gitResponse(t,e,r,n,o){let u=o.sibling("output"),l=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},sr(t,t.commands));return new Promise(h=>{let d=[],m=[];o.info("%s %o",e,r),o("%O",l);let p=this._beforeSpawn(t,r);if(p)return h({stdOut:d,stdErr:m,exitCode:9901,rejection:p});this._plugins.exec("spawn.before",void 0,{...sr(t,r),kill(_){p=_||p}});let w=(0,sp.spawn)(e,r,l);w.stdout.on("data",Ff(d,"stdOut",o,u.step("stdOut"))),w.stderr.on("data",Ff(m,"stdErr",o,u.step("stdErr"))),w.on("error",cR(m,o)),n&&(o("Passing child process stdOut/stdErr to custom outputHandler"),n(e,w.stdout,w.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...sr(t,r),spawned:w,close(_,R){h({stdOut:d,stdErr:m,exitCode:_,rejection:p||R})},kill(_){w.killed||(p=_,w.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...sr(t,e),kill(n){r=n||r}}),r}}}}),np={};ne(np,{GitExecutor:()=>ip});var ip,dR=T({"src/lib/runners/git-executor.ts"(){"use strict";hR(),ip=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new Na(this,this._scheduler,this._plugins)}chain(){return new Na(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function fR(t,e,r=ir){let n=u=>{r(null,u)},o=u=>{u?.task===t&&r(u instanceof xs?mR(u):u,void 0)};e.then(n,o)}function mR(t){let e=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=ir};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,o){return o in t||(n[o]={enumerable:!1,configurable:!1,get(){return e(o),t.git[o]}}),n}}var pR=T({"src/lib/task-callback.ts"(){"use strict";Ur(),q()}});function $f(t,e){return Bm(r=>{if(!Ja(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var gR=T({"src/lib/tasks/change-working-directory.ts"(){"use strict";q(),re()}});function Pa(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ei(e,"-B")),fe(e)}function bR(){return{checkout(){return this._runTask(Pa(de(arguments,1)),K(arguments))},checkoutBranch(t,e){return this._runTask(Pa(["-b",t,e,...de(arguments)]),K(arguments))},checkoutLocalBranch(t){return this._runTask(Pa(["-b",t,...de(arguments)]),K(arguments))}}}var yR=T({"src/lib/tasks/checkout.ts"(){"use strict";q(),re()}});function _R(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function wR(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Se(_R(),[op],t)}})}}}var op,vR=T({"src/lib/tasks/count-objects.ts"(){"use strict";q(),op=new M(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=wm(e);Object.hasOwn(t,n)&&(t[n]=Y(r))})}});function SR(t){return Se({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},ap,t)}var ap,TR=T({"src/lib/parsers/parse-commit.ts"(){"use strict";q(),ap=[new M(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new M(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new M(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new M(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let o=parseInt(r,10)||0;n==="-"?t.summary.deletions=o:n==="+"&&(t.summary.insertions=o)})]}});function RR(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Rs(t,"-m"),...e,...r],format:"utf-8",parser:SR}}function CR(){return{commit(e,...r){let n=K(arguments),o=t(e)||RR(it(e),it(ce(r[0],Qn,[])),[...Wr(ce(r[1],Es,[])),...de(arguments,0,!0)]);return this._runTask(o,n)}};function t(e){return!Qn(e)&&ve("git.commit: requires the commit message to be supplied as a string/string[]")}}var xR=T({"src/lib/tasks/commit.ts"(){"use strict";TR(),q(),re()}});function kR(){return{firstCommit(){return this._runTask(fe(["rev-list","--max-parents=0","HEAD"],!0),K(arguments))}}}var PR=T({"src/lib/tasks/first-commit.ts"(){"use strict";q(),re()}});function ER(t,e){let r=["hash-object",t];return e&&r.push("-w"),fe(r,!0)}var AR=T({"src/lib/tasks/hash-object.ts"(){"use strict";re()}});function OR(t,e,r){let n=String(r).trim(),o;if(o=up.exec(n))return new Vn(t,e,!1,o[1]);if(o=lp.exec(n))return new Vn(t,e,!0,o[1]);let u="",l=n.split(" ");for(;l.length;)if(l.shift()==="in"){u=l.join(" ");break}return new Vn(t,e,/^re/i.test(n),u)}var Vn,up,lp,IR=T({"src/lib/responses/InitSummary.ts"(){"use strict";Vn=class{constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},up=/^Init.+ repository in (.+)$/,lp=/^Rein.+ in (.+)$/}});function qR(t){return t.includes(ou)}function DR(t=!1,e,r){let n=["init",...r];return t&&!qR(n)&&n.splice(1,0,ou),{commands:n,format:"utf-8",parser(o){return OR(n.includes("--bare"),e,o)}}}var ou,MR=T({"src/lib/tasks/init.ts"(){"use strict";IR(),ou="--bare"}});function au(t){for(let e=0;e<t.length;e++){let r=uu.exec(t[e]);if(r)return`--${r[1]}`}return""}function BR(t){return uu.test(t)}var uu,As=T({"src/lib/args/log-format.ts"(){"use strict";uu=/^--(stat|numstat|name-only|name-status)(=|$)/}}),cp,FR=T({"src/lib/responses/DiffSummary.ts"(){"use strict";cp=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function hp(t=""){let e=dp[t];return r=>Se(new cp,e,r,!1)}var Ea,jf,Lf,Nf,dp,fp=T({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";As(),FR(),Vm(),q(),Ea=[new M(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:Y(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new M(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:Y(r),after:Y(n),binary:!0})}),new M(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),o=/(\d+) d/.exec(r);t.changed=Y(e),t.insertions=Y(n?.[1]),t.deletions=Y(o?.[1])})],jf=[new M(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let o=Y(e),u=Y(r);t.changed++,t.insertions+=o,t.deletions+=u,t.files.push({file:n,changes:o+u,insertions:o,deletions:u,binary:!1})}),new M(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],Lf=[new M(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Nf=[new M(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,o,u])=>{t.changed++,t.files.push({file:u??n,changes:0,insertions:0,deletions:0,binary:!1,status:qa(tR(e)&&e),from:qa(!!u&&n!==u&&n),similarity:Y(r)})})],dp={"":Ea,"--stat":Ea,"--numstat":jf,"--name-status":Nf,"--name-only":Lf}}});function $R(t,e){return e.reduce((r,n,o)=>(r[n]=t[o]||"",r),Object.create({diff:null}))}function mp(t=hu,e=pp,r=""){let n=hp(r);return function(o){let u=ks(o.trim(),!1,lu).map(function(l){let h=l.split(cu),d=$R(h[0].split(t),e);return h.length>1&&h[1].trim()&&(d.diff=n(h[1])),d});return{all:u,latest:u.length&&u[0]||null,total:u.length}}}var lu,cu,hu,pp,gp=T({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";q(),fp(),As(),lu="\xF2\xF2\xF2\xF2\xF2\xF2 ",cu=" \xF2\xF2",hu=" \xF2 ",pp=["hash","date","message","refs","author_name","author_email"]}}),bp={};ne(bp,{diffSummaryTask:()=>jR,validateLogFormatConfig:()=>oi});function jR(t){let e=au(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),oi(r)||{commands:r,format:"utf-8",parser:hp(e)}}function oi(t){let e=t.filter(BR);if(e.length>1)return ve(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return ve(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var du=T({"src/lib/tasks/diff.ts"(){"use strict";As(),fp(),re()}});function LR(t,e){let r=[],n=[];return Object.keys(t).forEach(o=>{r.push(o),n.push(String(t[o]))}),[r,n.join(e)]}function NR(t){return Object.keys(t).reduce((e,r)=>(r in Ua||(e[r]=t[r]),e),{})}function yp(t={},e=[]){let r=ce(t.splitter,ee,hu),n=ri(t.format)?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[o,u]=LR(n,r),l=[],h=[`--pretty=format:${lu}${u}${cu}`,...e],d=t.n||t["max-count"]||t.maxCount;if(d&&h.push(`--max-count=${d}`),t.from||t.to){let m=t.symmetric!==!1?"...":"..";l.push(`${t.from||""}${m}${t.to||""}`)}return ee(t.file)&&h.push("--follow",Br(t.file)),Za(NR(t),h),{fields:o,splitter:r,commands:[...h,...l]}}function UR(t,e,r){let n=mp(t,e,au(r));return{commands:["log",...r],format:"utf-8",parser:n}}function WR(){return{log(...r){let n=K(arguments),o=yp(Xa(arguments),Wr(ce(arguments[0],Es,[]))),u=e(...r)||oi(o.commands)||t(o);return this._runTask(u,n)}};function t(r){return UR(r.splitter,r.fields,r.commands)}function e(r,n){return ee(r)&&ee(n)&&ve("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Ua,_p=T({"src/lib/tasks/log.ts"(){"use strict";As(),gp(),q(),re(),du(),Ua=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(Ua||{})}}),Yn,wp,zR=T({"src/lib/responses/MergeSummary.ts"(){"use strict";Yn=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},wp=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),Wa,vp,HR=T({"src/lib/responses/PullSummary.ts"(){"use strict";Wa=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},vp=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Aa(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Uf(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Y(e&&e[1]||"0"),delta:Y(r&&r[1]||"0")}}var Sp,GR=T({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";q(),Sp=[new Lt(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),o=Aa(t.remoteMessages);Object.assign(o,{[n]:Y(r)})}),new Lt(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),o=Aa(t.remoteMessages);Object.assign(o,{[n]:Y(r)})}),new Lt(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let o=Aa(t.remoteMessages);o.total=Uf(e),o.reused=Uf(r),o.packReused=Y(n)})]}});function Tp(t,e){return Se({remoteMessages:new Cp},Rp,e)}var Rp,Cp,xp=T({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";q(),GR(),Rp=[new Lt(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Sp,new Lt([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new Lt([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:Y(e),summary:r,url:n}})],Cp=class{constructor(){this.all=[]}}}});function VR(t,e){let r=Se(new vp,kp,[t,e]);return r.message&&r}var Wf,zf,Hf,Gf,kp,Vf,fu,Pp=T({"src/lib/parsers/parse-pull.ts"(){"use strict";HR(),q(),xp(),Wf=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,zf=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,Hf=/^(create|delete) mode \d+ (.+)/,Gf=[new M(Wf,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new M(zf,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new M(Hf,(t,[e,r])=>{$e(t.files,r),$e(e==="create"?t.created:t.deleted,r)})],kp=[new M(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new M(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new M(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,o])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=o,t.hash.remote=r})],Vf=(t,e)=>Se(new Wa,Gf,[t,e]),fu=(t,e)=>Object.assign(new Wa,Vf(t,e),Tp(t,e))}}),Yf,Ep,Qf,YR=T({"src/lib/parsers/parse-merge.ts"(){"use strict";zR(),q(),Pp(),Yf=[new M(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new M(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new Yn(e,r))}),new M(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new Yn(e,r,{deleteRef:n}))}),new M(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new Yn(e,null))}),new M(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Ep=(t,e)=>Object.assign(Qf(t,e),fu(t,e)),Qf=t=>Se(new wp,Yf,t)}});function Jf(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=Ep(e,r);if(n.failed)throw new xs(n);return n}}:ve("Git.merge requires at least one option")}var QR=T({"src/lib/tasks/merge.ts"(){"use strict";Ur(),YR(),re()}});function JR(t,e,r){let n=r.includes("deleted"),o=r.includes("tag")||/^refs\/tags/.test(t),u=!r.includes("new");return{deleted:n,tag:o,branch:!o,new:!u,alreadyUpdated:u,local:t,remote:e}}var Kf,Ap,Zf,KR=T({"src/lib/parsers/parse-push.ts"(){"use strict";q(),xp(),Kf=[new M(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new M(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new M(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push(JR(e,r,n))}),new M(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:n}}),new M(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,o])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:o}}})],Ap=(t,e)=>{let r=Zf(t,e),n=Tp(t,e);return{...r,...n}},Zf=(t,e)=>Se({pushed:[]},Kf,[t,e])}}),Op={};ne(Op,{pushTagsTask:()=>ZR,pushTask:()=>mu});function ZR(t={},e){return $e(e,"--tags"),mu(t,e)}function mu(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),ei(r,"-v"),$e(r,"--verbose"),$e(r,"--porcelain"),{commands:r,format:"utf-8",parser:Ap}}var Ip=T({"src/lib/tasks/push.ts"(){"use strict";KR(),q()}});function XR(){return{showBuffer(){let t=["show",...de(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(Fm(t),K(arguments))},show(){let t=["show",...de(arguments,1)];return this._runTask(fe(t),K(arguments))}}}var e0=T({"src/lib/tasks/show.ts"(){"use strict";q(),re()}}),Xf,qp,t0=T({"src/lib/responses/FileStatusSummary.ts"(){"use strict";Xf=/^(.+)\0(.+)$/,qp=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=Xf.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function em(t){let[e,r]=t.split(Lr);return{from:r||e,to:e}}function ke(t,e,r){return[`${t}${e}`,r]}function Oa(t,...e){return e.map(r=>ke(t,r,(n,o)=>n.conflicted.push(o)))}function r0(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return n(" ",r.charAt(0),r.slice(2));default:return}function n(o,u,l){let h=`${o}${u}`,d=Dp.get(h);d&&d(t,l),h!=="##"&&h!=="!!"&&t.files.push(new qp(l,o,u))}}var tm,Dp,Mp,s0=T({"src/lib/responses/StatusSummary.ts"(){"use strict";q(),t0(),tm=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},Dp=new Map([ke(" ","A",(t,e)=>t.created.push(e)),ke(" ","D",(t,e)=>t.deleted.push(e)),ke(" ","M",(t,e)=>t.modified.push(e)),ke("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),ke("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),ke("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),ke("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),ke("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),ke("R"," ",(t,e)=>{t.renamed.push(em(e))}),ke("R","M",(t,e)=>{let r=em(e);t.renamed.push(r),t.modified.push(r.to)}),ke("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),ke("?","?",(t,e)=>t.not_added.push(e)),...Oa("A","A","U"),...Oa("D","D","U"),...Oa("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,o=/^(.+?(?=(?:\.{3}|\s|$)))/,u=/\.{3}(\S*)/,l=/\son\s(\S+?)(?=\.{3}|$)/,h=r.exec(e);t.ahead=h&&+h[1]||0,h=n.exec(e),t.behind=h&&+h[1]||0,h=o.exec(e),t.current=ce(h?.[1],ee,null),h=u.exec(e),t.tracking=ce(h?.[1],ee,null),h=l.exec(e),h&&(t.current=ce(h?.[1],ee,t.current)),t.detached=/\(no branch\)/.test(e)}]]),Mp=function(t){let e=t.split(Lr),r=new tm;for(let n=0,o=e.length;n<o;){let u=e[n++].trim();u&&(u.charAt(0)==="R"&&(u+=Lr+(e[n++]||"")),r0(r,u))}return r}}});function n0(t){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...t.filter(r=>!Bp.includes(r))],parser(r){return Mp(r)}}}var Bp,i0=T({"src/lib/tasks/status.ts"(){"use strict";s0(),Bp=["--null","-z"]}});function Zn(t=0,e=0,r=0,n="",o=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:o},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function o0(){return Zn(0,0,0,"",!1)}function a0(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:u0,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(pu));n(e)}})}}}function u0(t){return t===pu?o0():Se(Zn(0,0,0,t),Fp,t)}var pu,Fp,l0=T({"src/lib/tasks/version.ts"(){"use strict";q(),pu="installed=false",Fp=[new M(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,o=""])=>{Object.assign(t,Zn(Y(e),Y(r),Y(n),o))}),new M(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,o=""])=>{Object.assign(t,Zn(Y(e),Y(r),n,o))})]}});function rm(t,e,r,...n){return ee(r)?e(r,ce(n[0],ee),de(arguments)):ve(`git.${t}() requires a string 'repoPath'`)}function c0(){return{clone(t,...e){return this._runTask(rm("clone",za,ce(t,ee),...e),K(arguments))},mirror(t,...e){return this._runTask(rm("mirror",$p,ce(t,ee),...e),K(arguments))}}}var za,$p,h0=T({"src/lib/tasks/clone.ts"(){"use strict";re(),q(),za=(t,e,r)=>{let n=["clone",...r];return ee(t)&&n.push(Br(t)),ee(e)&&n.push(Br(e)),fe(n)},$p=(t,e,r)=>($e(r,"--mirror"),za(t,e,r))}}),jp={};ne(jp,{SimpleGitApi:()=>Ha});var Ha,d0=T({"src/lib/simple-git-api.ts"(){"use strict";pR(),gR(),yR(),vR(),xR(),Hm(),PR(),Jm(),AR(),MR(),_p(),QR(),Ip(),e0(),i0(),re(),l0(),q(),h0(),Ha=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&fR(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask(fe(["add",...it(t)]),K(arguments))}cwd(t){let e=K(arguments);return typeof t=="string"?this._runTask($f(t,this._executor),e):typeof t?.path=="string"?this._runTask($f(t.path,t.root&&this._executor||void 0),e):this._runTask(ve("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(ER(t,e===!0),K(arguments))}init(t){return this._runTask(DR(t===!0,this._executor.cwd,de(arguments)),K(arguments))}merge(){return this._runTask(Jf(de(arguments)),K(arguments))}mergeFromTo(t,e){return ee(t)&&ee(e)?this._runTask(Jf([t,e,...de(arguments)]),K(arguments,!1)):this._runTask(ve("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=mu({remote:ce(arguments[0],ee),branch:ce(arguments[1],ee)},de(arguments));return this._runTask(t,K(arguments))}stash(){return this._runTask(fe(["stash",...de(arguments)]),K(arguments))}status(){return this._runTask(n0(de(arguments)),K(arguments))}},Object.assign(Ha.prototype,bR(),c0(),CR(),eR(),wR(),kR(),nR(),WR(),XR(),a0())}}),Lp={};ne(Lp,{Scheduler:()=>Up});var sm,Up,f0=T({"src/lib/runners/scheduler.ts"(){"use strict";q(),tp(),sm=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,Np.createDeferred)();return{promise:e,done:r,id:t}}})(),Up=class{constructor(t=2){this.concurrency=t,this.logger=iu("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=$e(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ei(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=$e(this.pending,sm());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),Wp={};ne(Wp,{applyPatchTask:()=>m0});function m0(t,e){return fe(["apply",...e,...t])}var p0=T({"src/lib/tasks/apply-patch.ts"(){"use strict";re()}});function g0(t,e){return{branch:t,hash:e,success:!0}}function b0(t){return{branch:t,hash:null,success:!1}}var zp,y0=T({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";zp=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Hp(t,e){return e===1&&Ga.test(t)}var nm,Ga,im,ai,_0=T({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";y0(),q(),nm=/(\S+)\s+\(\S+\s([^)]+)\)/,Ga=/^error[^']+'([^']+)'/m,im=[new M(nm,(t,[e,r])=>{let n=g0(e,r);t.all.push(n),t.branches[e]=n}),new M(Ga,(t,[e])=>{let r=b0(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ai=(t,e)=>Se(new zp,im,[t,e])}}),Gp,w0=T({"src/lib/responses/BranchSummary.ts"(){"use strict";Gp=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,o){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:o}}}}});function om(t){return t?t.charAt(0):""}function Vp(t,e=!1){return Se(new Gp,e?[Qp]:Yp,t)}var Yp,Qp,v0=T({"src/lib/parsers/parse-branch.ts"(){"use strict";w0(),q(),Yp=[new M(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,o])=>{t.push(om(e),!0,r,n,o)}),new M(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,n,o])=>{t.push(om(e),!1,r,n,o)})],Qp=new M(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),Jp={};ne(Jp,{branchLocalTask:()=>T0,branchTask:()=>S0,containsDeleteBranchCommand:()=>Kp,deleteBranchTask:()=>C0,deleteBranchesTask:()=>R0});function Kp(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function S0(t){let e=Kp(t),r=t.includes("--show-current"),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(o,u){return e?ai(o,u).all[0]:Vp(o,r)}}}function T0(){return{format:"utf-8",commands:["branch","-v"],parser(t){return Vp(t)}}}function R0(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return ai(r,n)},onError({exitCode:r,stdOut:n},o,u,l){if(!Hp(String(o),r))return l(o);u(n)}}}function C0(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,o){return ai(n,o).branches[t]},onError({exitCode:n,stdErr:o,stdOut:u},l,h,d){if(!Hp(String(l),n))return d(l);throw new xs(r.parser(Cs(u),Cs(o)),String(l))}};return r}var x0=T({"src/lib/tasks/branch.ts"(){"use strict";Ur(),_0(),v0(),q()}});function k0(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&(0,Zp.normalize)(e)}var Xp,P0=T({"src/lib/responses/CheckIgnore.ts"(){"use strict";Xp=t=>t.split(/\n/g).map(k0).filter(Boolean)}}),eg={};ne(eg,{checkIgnoreTask:()=>E0});function E0(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Xp}}var A0=T({"src/lib/tasks/check-ignore.ts"(){"use strict";P0()}});function O0(t,e){return Se({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},tg,[t,e])}var tg,I0=T({"src/lib/parsers/parse-fetch.ts"(){"use strict";q(),tg=[new M(/From (.+)$/,(t,[e])=>{t.remote=e}),new M(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new M(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new M(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new M(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,o])=>{t.updated.push({name:n,tracking:o,to:r,from:e})})]}}),rg={};ne(rg,{fetchTask:()=>D0});function q0(t){return/^--upload-pack(=|$)/.test(t)}function D0(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(q0)?ve("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:O0}}var M0=T({"src/lib/tasks/fetch.ts"(){"use strict";I0(),re()}});function B0(t){return Se({moves:[]},sg,t)}var sg,F0=T({"src/lib/parsers/parse-move.ts"(){"use strict";q(),sg=[new M(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),ng={};ne(ng,{moveTask:()=>$0});function $0(t,e){return{commands:["mv","-v",...it(t),e],format:"utf-8",parser:B0}}var j0=T({"src/lib/tasks/move.ts"(){"use strict";F0(),q()}}),ig={};ne(ig,{pullTask:()=>L0});function L0(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(o,u){return fu(o,u)},onError(o,u,l,h){let d=VR(Cs(o.stdOut),Cs(o.stdErr));if(d)return h(new xs(d));h(u)}}}var N0=T({"src/lib/tasks/pull.ts"(){"use strict";Ur(),Pp(),q()}});function U0(t){let e={};return og(t,([r])=>e[r]={name:r}),Object.values(e)}function W0(t){let e={};return og(t,([r,n,o])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),o&&n&&(e[r].refs[o.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function og(t,e){Qa(t,r=>e(r.split(/\s+/)))}var z0=T({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";q()}}),ag={};ne(ag,{addRemoteTask:()=>H0,getRemotesTask:()=>G0,listRemotesTask:()=>V0,remoteTask:()=>Y0,removeRemoteTask:()=>Q0});function H0(t,e,r){return fe(["remote","add",...r,t,e])}function G0(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?W0:U0}}function V0(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),fe(e)}function Y0(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),fe(e)}function Q0(t){return fe(["remote","remove",t])}var J0=T({"src/lib/tasks/remote.ts"(){"use strict";z0(),re()}}),ug={};ne(ug,{stashListTask:()=>K0});function K0(t={},e){let r=yp(t),n=["stash","list",...r.commands,...e],o=mp(r.splitter,r.fields,au(n));return oi(n)||{commands:n,format:"utf-8",parser:o}}var Z0=T({"src/lib/tasks/stash-list.ts"(){"use strict";As(),gp(),du(),_p()}}),lg={};ne(lg,{addSubModuleTask:()=>X0,initSubModuleTask:()=>eC,subModuleTask:()=>ui,updateSubModuleTask:()=>tC});function X0(t,e){return ui(["add",t,e])}function eC(t){return ui(["init",...t])}function ui(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),fe(e)}function tC(t){return ui(["update",...t])}var rC=T({"src/lib/tasks/sub-module.ts"(){"use strict";re()}});function sC(t,e){let r=Number.isNaN(t),n=Number.isNaN(e);return r!==n?r?1:-1:r?cg(t,e):0}function cg(t,e){return t===e?0:t>e?1:-1}function nC(t){return t.trim()}function zn(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var am,hg,iC=T({"src/lib/responses/TagList.ts"(){"use strict";am=class{constructor(t,e){this.all=t,this.latest=e}},hg=function(t,e=!1){let r=t.split(`
117
- `).map(nC).filter(Boolean);e||r.sort(function(o,u){let l=o.split("."),h=u.split(".");if(l.length===1||h.length===1)return sC(zn(l[0]),zn(h[0]));for(let d=0,m=Math.max(l.length,h.length);d<m;d++){let p=cg(zn(l[d]),zn(h[d]));if(p)return p}return 0});let n=e?r[0]:[...r].reverse().find(o=>o.indexOf(".")>=0);return new am(r,n)}}}),dg={};ne(dg,{addAnnotatedTagTask:()=>uC,addTagTask:()=>aC,tagListTask:()=>oC});function oC(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return hg(r,e)}}}function aC(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function uC(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var lC=T({"src/lib/tasks/tag.ts"(){"use strict";iC()}}),cC=kT({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(dR(),te(np)),{SimpleGitApi:n}=(d0(),te(jp)),{Scheduler:o}=(f0(),te(Lp)),{adhocExecTask:u,configurationErrorTask:l}=(re(),te($a)),{asArray:h,filterArray:d,filterPrimitives:m,filterString:p,filterStringOrStringArray:w,filterType:_,getTrailingOptions:R,trailingFunctionArgument:y,trailingOptionsArgument:D}=(q(),te(km)),{applyPatchTask:k}=(p0(),te(Wp)),{branchTask:P,branchLocalTask:j,deleteBranchesTask:J,deleteBranchTask:$}=(x0(),te(Jp)),{checkIgnoreTask:N}=(A0(),te(eg)),{checkIsRepoTask:U}=(Om(),te(Pm)),{cleanWithOptionsTask:Oe,isCleanOptionsArray:Ke}=(Um(),te(Lm)),{diffSummaryTask:Wt}=(du(),te(bp)),{fetchTask:Qr}=(M0(),te(rg)),{moveTask:js}=(j0(),te(ng)),{pullTask:Jr}=(N0(),te(ig)),{pushTagsTask:Ue}=(Ip(),te(Op)),{addRemoteTask:pr,getRemotesTask:Kr,listRemotesTask:Ls,remoteTask:Ri,removeRemoteTask:Zr}=(J0(),te(ag)),{getResetMode:Ci,resetTask:Ns}=(ep(),te(Km)),{stashListTask:Us}=(Z0(),te(ug)),{addSubModuleTask:xi,initSubModuleTask:ki,subModuleTask:Ie,updateSubModuleTask:me}=(rC(),te(lg)),{addAnnotatedTagTask:Pi,addTagTask:Ws,tagListTask:We}=(lC(),te(dg)),{straightThroughBufferTask:Xr,straightThroughStringTask:pe}=(re(),te($a));function O(v,x){this._plugins=x,this._executor=new r(v.baseDir,new o(v.maxConcurrentProcesses),x),this._trimmed=v.trimmed}(O.prototype=Object.create(n.prototype)).constructor=O,O.prototype.customBinary=function(v){return this._plugins.reconfigure("binary",v),this},O.prototype.env=function(v,x){return arguments.length===1&&typeof v=="object"?this._executor.env=v:(this._executor.env=this._executor.env||{})[v]=x,this},O.prototype.stashList=function(v){return this._runTask(Us(D(arguments)||{},d(v)&&v||[]),y(arguments))},O.prototype.mv=function(v,x){return this._runTask(js(v,x),y(arguments))},O.prototype.checkoutLatestTag=function(v){var x=this;return this.pull(function(){x.tags(function(W,se){x.checkout(se.latest,v)})})},O.prototype.pull=function(v,x,W,se){return this._runTask(Jr(_(v,p),_(x,p),R(arguments)),y(arguments))},O.prototype.fetch=function(v,x){return this._runTask(Qr(_(v,p),_(x,p),R(arguments)),y(arguments))},O.prototype.silent=function(v){return this._runTask(u(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},O.prototype.tags=function(v,x){return this._runTask(We(R(arguments)),y(arguments))},O.prototype.rebase=function(){return this._runTask(pe(["rebase",...R(arguments)]),y(arguments))},O.prototype.reset=function(v){return this._runTask(Ns(Ci(v),R(arguments)),y(arguments))},O.prototype.revert=function(v){let x=y(arguments);return typeof v!="string"?this._runTask(l("Commit must be a string"),x):this._runTask(pe(["revert",...R(arguments,0,!0),v]),x)},O.prototype.addTag=function(v){let x=typeof v=="string"?Ws(v):l("Git.addTag requires a tag name");return this._runTask(x,y(arguments))},O.prototype.addAnnotatedTag=function(v,x){return this._runTask(Pi(v,x),y(arguments))},O.prototype.deleteLocalBranch=function(v,x,W){return this._runTask($(v,typeof x=="boolean"?x:!1),y(arguments))},O.prototype.deleteLocalBranches=function(v,x,W){return this._runTask(J(v,typeof x=="boolean"?x:!1),y(arguments))},O.prototype.branch=function(v,x){return this._runTask(P(R(arguments)),y(arguments))},O.prototype.branchLocal=function(v){return this._runTask(j(),y(arguments))},O.prototype.raw=function(v){let x=!Array.isArray(v),W=[].slice.call(x?arguments:v,0);for(let ge=0;ge<W.length&&x;ge++)if(!m(W[ge])){W.splice(ge,W.length-ge);break}W.push(...R(arguments,0,!0));var se=y(arguments);return W.length?this._runTask(pe(W,this._trimmed),se):this._runTask(l("Raw: must supply one or more command to execute"),se)},O.prototype.submoduleAdd=function(v,x,W){return this._runTask(xi(v,x),y(arguments))},O.prototype.submoduleUpdate=function(v,x){return this._runTask(me(R(arguments,!0)),y(arguments))},O.prototype.submoduleInit=function(v,x){return this._runTask(ki(R(arguments,!0)),y(arguments))},O.prototype.subModule=function(v,x){return this._runTask(Ie(R(arguments)),y(arguments))},O.prototype.listRemote=function(){return this._runTask(Ls(R(arguments)),y(arguments))},O.prototype.addRemote=function(v,x,W){return this._runTask(pr(v,x,R(arguments)),y(arguments))},O.prototype.removeRemote=function(v,x){return this._runTask(Zr(v),y(arguments))},O.prototype.getRemotes=function(v,x){return this._runTask(Kr(v===!0),y(arguments))},O.prototype.remote=function(v,x){return this._runTask(Ri(R(arguments)),y(arguments))},O.prototype.tag=function(v,x){let W=R(arguments);return W[0]!=="tag"&&W.unshift("tag"),this._runTask(pe(W),y(arguments))},O.prototype.updateServerInfo=function(v){return this._runTask(pe(["update-server-info"]),y(arguments))},O.prototype.pushTags=function(v,x){let W=Ue({remote:_(v,p)},R(arguments));return this._runTask(W,y(arguments))},O.prototype.rm=function(v){return this._runTask(pe(["rm","-f",...h(v)]),y(arguments))},O.prototype.rmKeepLocal=function(v){return this._runTask(pe(["rm","--cached",...h(v)]),y(arguments))},O.prototype.catFile=function(v,x){return this._catFile("utf-8",arguments)},O.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},O.prototype._catFile=function(v,x){var W=y(x),se=["cat-file"],ge=x[0];if(typeof ge=="string")return this._runTask(l("Git.catFile: options must be supplied as an array of strings"),W);Array.isArray(ge)&&se.push.apply(se,ge);let zt=v==="buffer"?Xr(se):pe(se);return this._runTask(zt,W)},O.prototype.diff=function(v,x){let W=p(v)?l("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):pe(["diff",...R(arguments)]);return this._runTask(W,y(arguments))},O.prototype.diffSummary=function(){return this._runTask(Wt(R(arguments,1)),y(arguments))},O.prototype.applyPatch=function(v){let x=w(v)?k(h(v),R([].slice.call(arguments,1))):l("git.applyPatch requires one or more string patches as the first argument");return this._runTask(x,y(arguments))},O.prototype.revparse=function(){let v=["rev-parse",...R(arguments,!0)];return this._runTask(pe(v,!0),y(arguments))},O.prototype.clean=function(v,x,W){let se=Ke(v),ge=se&&v.join("")||_(v,p)||"",zt=R([].slice.call(arguments,se?1:0));return this._runTask(Oe(ge,zt),y(arguments))},O.prototype.exec=function(v){let x={commands:[],format:"utf-8",parser(){typeof v=="function"&&v()}};return this._runTask(x)},O.prototype.clearQueue=function(){return this._runTask(u(()=>console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},O.prototype.checkIgnore=function(v,x){return this._runTask(N(h(_(v,w,[]))),y(arguments))},O.prototype.checkIsRepo=function(v,x){return this._runTask(U(_(v,p)),y(arguments))},e.exports=O}});Nt();var hC=class extends vt{constructor(t,e){super(void 0,e),this.config=t}};Nt();Nt();var Nr=class extends vt{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};Ur();fm();Om();Um();Hm();Vm();Jm();ep();function dC(t){return t?[{type:"spawn.before",action(n,o){t.aborted&&o.kill(new Nr(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,o){function u(){o.kill(new Nr(void 0,"abort","Abort signal received"))}t.addEventListener("abort",u),o.spawned.on("close",()=>t.removeEventListener("abort",u))}}]:void 0}function fC(t={}){return{type:"spawn.args",action(e,{env:r}){for(let n of Df(e,r))if(t[n.category]!==!0)throw new Nr(void 0,"unsafe",n.message);return e}}}q();function mC(t){let e=Rs(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}q();var um=(0,jr.deferred)().promise;function pC({onClose:t=!0,onExit:e=50}={}){function r(){let o=-1,u={close:(0,jr.deferred)(),closeTimeout:(0,jr.deferred)(),exit:(0,jr.deferred)(),exitTimeout:(0,jr.deferred)()},l=Promise.race([t===!1?um:u.closeTimeout.promise,e===!1?um:u.exitTimeout.promise]);return n(t,u.close,u.closeTimeout),n(e,u.exit,u.exitTimeout),{close(h){o=h,u.close.done()},exit(h){o=h,u.exit.done()},get exitCode(){return o},result:l}}function n(o,u,l){o!==!1&&(o===!0?u.promise:u.promise.then(()=>Ia(o))).then(l.done)}return{type:"spawn.after",async action(o,{spawned:u,close:l}){let h=r(),d=!0,m=()=>{d=!1};u.stdout?.on("data",m),u.stderr?.on("data",m),u.on("error",m),u.on("close",p=>h.close(p)),u.on("exit",p=>h.exit(p));try{await h.result,d&&await Ia(50),l(h.exitCode)}catch(p){l(h.exitCode,p)}}}}q();var gC="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",lm="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function bC(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function cm(t,e){if(t.length<1||t.length>2)throw new Nr(void 0,"binary",gC);if(t.some(bC))if(e)console.warn(lm);else throw new Nr(void 0,"binary",lm);let[n,o]=t;return{binary:n,prefix:o}}function yC(t,e=["git"],r=!1){let n=cm(it(e),r);t.on("binary",o=>{n=cm(it(o),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",o=>n.prefix?[n.prefix,...o]:o)}Nt();function _C(t){return!!(t.exitCode&&t.stdErr.length)}function wC(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function vC(t=!1,e=_C,r=wC){return(n,o)=>!t&&n||!e(o)?n:r(o)}function hm(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new vt(void 0,n.toString("utf-8"))}:{error:n}}}}q();var SC=class{constructor(){this.plugins=new Set,this.events=new fg.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=$e(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return it(t).forEach(r=>r&&this.plugins.add($e(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,o=Object.freeze(Object.create(r));for(let u of this.plugins)u.type===t&&(n=u.action(n,o));return n}};q();function TC(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(u,l){return r.includes(l.method)?_m(u,e):u}},{type:"spawn.after",action(u,l){l.commands.includes(e)&&l.spawned.stderr?.on("data",h=>{let d=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(h.toString("utf8"));d&&t({method:l.method,stage:RC(d[1]),progress:Y(d[2]),processed:Y(d[3]),total:Y(d[4])})})}}]}function RC(t){return String(t.toLowerCase().split(" ",1))||"unknown"}q();function CC(t){let e=vm(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function xC({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,o){let u;function l(){u&&clearTimeout(u),u=setTimeout(d,t)}function h(){o.spawned.stdout?.off("data",l),o.spawned.stderr?.off("data",l),o.spawned.off("exit",h),o.spawned.off("close",h),u&&clearTimeout(u)}function d(){h(),o.kill(new Nr(void 0,"timeout","block timeout reached"))}r&&o.spawned.stdout?.on("data",l),e&&o.spawned.stderr?.on("data",l),o.spawned.on("exit",h),o.spawned.on("close",h),l()}}}function kC(){return{type:"spawn.args",action(t){let e=[],r;function n(o){(r=r||[]).push(...o)}for(let o=0;o<t.length;o++){let u=t[o];if(Me(u)){n(Fr(u));continue}if(u==="--"){n(t.slice(o+1).flatMap(l=>Me(l)&&Fr(l)||l));break}e.push(u)}return r?[...e,"--",...r.map(String)]:e}}}q();var PC=cC();function EC(t,e){let r=new SC,n=Cm(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Ja(n.baseDir))throw new hC(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(mC(n.config)),r.add(fC(n.unsafe)),r.add(pC(n.completion)),n.abort&&r.add(dC(n.abort)),n.progress&&r.add(TC(n.progress)),n.timeout&&r.add(xC(n.timeout)),n.spawnOptions&&r.add(CC(n.spawnOptions)),r.add(kC()),r.add(hm(vC(!0))),n.errors&&r.add(hm(n.errors)),yC(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new PC(n,r)}Ur();var je=EC;var Si=ie(Bn());var AC=t=>t?.trim().normalize("NFD").replace(/\[.*]\s/,"").replace(/\+\s/,"").replace(/-\s/,"").replace(/\./,"").replace(/>/g,"").replace(/</g,"").replace(/:/g,"").replace(/"/g,"").replace(/&/g,"").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").replace(/\s/g,"-").toLowerCase(),OC=t=>t==="Epic"?"story":t==="Bug"?"fix":"feat",mg=t=>{let{id:e,name:r,type:n}=t,o=OC(n),u=AC(r);return[`${o}/${e}_${u}`,`${o}/${e}`,`${e}`]};var pg=ie(require("os")),zr=require("fs/promises"),gg=require("fs"),or=()=>pg.default.homedir(),bg=()=>process.cwd(),yg=async t=>{await(0,zr.mkdir)(t,{recursive:!0})},li=t=>(0,gg.existsSync)(t),_g=async(t,e)=>{await(0,zr.writeFile)(t,e)},gu=async t=>(await(0,zr.readFile)(t)).toString();var bu={tools:{jira:{domain:process.env.JIRA_DOMAIN??"",authorization:process.env.JIRA_AUTHORIZATION??""},github:{token:process.env.GITHUB_TOKEN??"",organization:process.env.GITHUB_ORGANIZATION??""},ai:{model:"gpt-4o-mini",token:"",url:"https://api.openai.com/v1"}},projects:{},advanced:!1,debug:!1,experimental:!1,version:"0.0.0"};var wg=t=>btoa(t);var vg=()=>li(`${or()}/.mytools/config`),Sg=async()=>{li(`${or()}/.mytools/config`)||(li(`${or()}/.mytools`)||await yg(`${or()}/.mytools`),await hi(bu))},Tg=async()=>{let t=await ar(),{tools:e,...r}=t,{ai:n}=e,{tools:o,...u}=bu,{ai:l}=o;await hi({...u,...r,tools:{...o,...e,ai:{...l,...n}}})},Rg=async()=>{let t=await ar();await hi({...t,projects:{}})},Cg=async()=>{let t=wg(bg()),e=await ar(),r=e.tools.jira,n=e.projects[t]?.tools.jira;return n?n.domain&&n.authorization:r.domain&&r.authorization},xg=async()=>{let{experimental:t}=await ar();return t},kg=async()=>{let{version:t}=await Eg(),[e,r,n]=t.split(".").map(d=>parseInt(d)),{version:o}=await ar();if(!o)return!0;let[u,l,h]=o.split(".").map(d=>parseInt(d));return e>u||r>l||n>h},Pg=async()=>{let{version:t}=await Eg(),e=await ar();await hi({...e,version:t})},ci=async()=>{let t=await ar(),{tools:e}=t,{ai:r}=e;return r},Eg=async()=>{let t=await gu(`${__dirname}/../package.json`);return JSON.parse(t)},ar=async()=>{let t=await gu(`${or()}/.mytools/config`);return JSON.parse(t)},hi=async t=>{let e=JSON.stringify(t,null,2);await _g(`${or()}/.mytools/config`,e)};var ab=ie(require("http"),1),ub=ie(require("https"),1),dr=ie(require("zlib"),1),Ae=ie(require("stream"),1),Fs=require("buffer");function IC(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),n="",o=!1,u=r[0]||"text/plain",l=u;for(let p=1;p<r.length;p++)r[p]==="base64"?o=!0:r[p]&&(l+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(n=r[p].substring(8)));!r[0]&&!n.length&&(l+=";charset=US-ASCII",n="US-ASCII");let h=o?"base64":"ascii",d=unescape(t.substring(e+1)),m=Buffer.from(d,h);return m.type=u,m.typeFull=l,m.charset=n,m}var Ag=IC;var Le=ie(require("stream"),1),Rt=require("util"),Pe=require("buffer");Os();fi();var Tt=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var Te=class extends Tt{constructor(e,r,n){super(e,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};var mi=Symbol.toStringTag,Su=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[mi]==="URLSearchParams",qs=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[mi]),jg=t=>typeof t=="object"&&(t[mi]==="AbortSignal"||t[mi]==="EventTarget"),Lg=(t,e)=>{let r=new URL(e).hostname,n=new URL(t).hostname;return r===n||r.endsWith(`.${n}`)},Ng=(t,e)=>{let r=new URL(e).protocol,n=new URL(t).protocol;return r===n};var YC=(0,Rt.promisify)(Le.default.pipeline),Re=Symbol("Body internals"),at=class{constructor(e,{size:r=0}={}){let n=null;e===null?e=null:Su(e)?e=Pe.Buffer.from(e.toString()):qs(e)||Pe.Buffer.isBuffer(e)||(Rt.types.isAnyArrayBuffer(e)?e=Pe.Buffer.from(e):ArrayBuffer.isView(e)?e=Pe.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof Le.default||(e instanceof lr?(e=$g(e),n=e.type.split("=")[1]):e=Pe.Buffer.from(String(e))));let o=e;Pe.Buffer.isBuffer(e)?o=Le.default.Readable.from(e):qs(e)&&(o=Le.default.Readable.from(e.stream())),this[Re]={body:e,stream:o,boundary:n,disturbed:!1,error:null},this.size=r,e instanceof Le.default&&e.on("error",u=>{let l=u instanceof Tt?u:new Te(`Invalid response body while trying to fetch ${this.url}: ${u.message}`,"system",u);this[Re].error=l})}get body(){return this[Re].stream}get bodyUsed(){return this[Re].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:n}=await Cu(this);return e.slice(r,r+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new lr,o=new URLSearchParams(await this.text());for(let[u,l]of o)n.append(u,l);return n}let{toFormData:r}=await Promise.resolve().then(()=>(Gg(),Hg));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Re].body&&this[Re].body.type||"",r=await this.arrayBuffer();return new St([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Cu(this);return new TextDecoder().decode(e)}buffer(){return Cu(this)}};at.prototype.buffer=(0,Rt.deprecate)(at.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(at.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Rt.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Cu(t){if(t[Re].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Re].disturbed=!0,t[Re].error)throw t[Re].error;let{body:e}=t;if(e===null)return Pe.Buffer.alloc(0);if(!(e instanceof Le.default))return Pe.Buffer.alloc(0);let r=[],n=0;try{for await(let o of e){if(t.size>0&&n+o.length>t.size){let u=new Te(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(u),u}n+=o.length,r.push(o)}}catch(o){throw o instanceof Tt?o:new Te(`Invalid response body while trying to fetch ${t.url}: ${o.message}`,"system",o)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(o=>typeof o=="string")?Pe.Buffer.from(r.join("")):Pe.Buffer.concat(r,n)}catch(o){throw new Te(`Could not create Buffer from response body for ${t.url}: ${o.message}`,"system",o)}else throw new Te(`Premature close of server response while trying to fetch ${t.url}`)}var Gr=(t,e)=>{let r,n,{body:o}=t[Re];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof Le.default&&typeof o.getBoundary!="function"&&(r=new Le.PassThrough({highWaterMark:e}),n=new Le.PassThrough({highWaterMark:e}),o.pipe(r),o.pipe(n),t[Re].stream=r,o=n),o},QC=(0,Rt.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),yi=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Su(t)?"application/x-www-form-urlencoded;charset=UTF-8":qs(t)?t.type||null:Pe.Buffer.isBuffer(t)||Rt.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof lr?`multipart/form-data; boundary=${e[Re].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${QC(t)}`:t instanceof Le.default?null:"text/plain;charset=UTF-8",Vg=t=>{let{body:e}=t[Re];return e===null?0:qs(e)?e.size:Pe.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},Yg=async(t,{body:e})=>{e===null?t.end():await YC(e,t)};var xu=require("util"),Ms=ie(require("http"),1),_i=typeof Ms.default.validateHeaderName=="function"?Ms.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},ku=typeof Ms.default.validateHeaderValue=="function"?Ms.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ee=class t extends URLSearchParams{constructor(e){let r=[];if(e instanceof t){let n=e.raw();for(let[o,u]of Object.entries(n))r.push(...u.map(l=>[o,l]))}else if(e!=null)if(typeof e=="object"&&!xu.types.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)r.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(o=>{if(typeof o!="object"||xu.types.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,o])=>(_i(n),ku(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(r),new Proxy(this,{get(n,o,u){switch(o){case"append":case"set":return(l,h)=>(_i(l),ku(l,String(h)),URLSearchParams.prototype[o].call(n,String(l).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return l=>(_i(l),URLSearchParams.prototype[o].call(n,String(l).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,u)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,r=void 0){for(let n of this.keys())Reflect.apply(e,r,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let n=this.getAll(r);return r==="host"?e[r]=n[0]:e[r]=n.length>1?n:n[0],e},{})}};Object.defineProperties(Ee.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function Qg(t=[]){return new Ee(t.reduce((e,r,n,o)=>(n%2===0&&e.push(o.slice(n,n+2)),e),[]).filter(([e,r])=>{try{return _i(e),ku(e,String(r)),!0}catch{return!1}}))}var JC=new Set([301,302,303,307,308]),wi=t=>JC.has(t);var Je=Symbol("Response internals"),Ne=class t extends at{constructor(e=null,r={}){super(e,r);let n=r.status!=null?r.status:200,o=new Ee(r.headers);if(e!==null&&!o.has("Content-Type")){let u=yi(e,this);u&&o.append("Content-Type",u)}this[Je]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Je].type}get url(){return this[Je].url||""}get status(){return this[Je].status}get ok(){return this[Je].status>=200&&this[Je].status<300}get redirected(){return this[Je].counter>0}get statusText(){return this[Je].statusText}get headers(){return this[Je].headers}get highWaterMark(){return this[Je].highWaterMark}clone(){return new t(Gr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!wi(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new t(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new t(null,{status:0,statusText:""});return e[Je].type="error",e}static json(e=void 0,r={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new Ee(r&&r.headers);return o.has("content-type")||o.set("content-type","application/json"),new t(n,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Ne.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var nb=require("url"),ib=require("util");var Jg=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var Zg=require("net");function Kg(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var Xg=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),eb="strict-origin-when-cross-origin";function tb(t){if(!Xg.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function KC(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Zg.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:t.host==="localhost"||t.host.endsWith(".localhost")?!1:t.protocol==="file:"}function Vr(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:KC(t)}function rb(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let n=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let o=t.referrer,u=Kg(o),l=Kg(o,!0);u.toString().length>4096&&(u=l),e&&(u=e(u)),r&&(l=r(l));let h=new URL(t.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return l;case"unsafe-url":return u;case"strict-origin":return Vr(u)&&!Vr(h)?"no-referrer":l.toString();case"strict-origin-when-cross-origin":return u.origin===h.origin?u:Vr(u)&&!Vr(h)?"no-referrer":l;case"same-origin":return u.origin===h.origin?u:"no-referrer";case"origin-when-cross-origin":return u.origin===h.origin?u:l;case"no-referrer-when-downgrade":return Vr(u)&&!Vr(h)?"no-referrer":u;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function sb(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&Xg.has(n)&&(r=n);return r}var ae=Symbol("Request internals"),Bs=t=>typeof t=="object"&&typeof t[ae]=="object",ZC=(0,ib.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),hr=class t extends at{constructor(e,r={}){let n;if(Bs(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=r.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!Bs(r)&&"data"in r&&ZC(),(r.body!=null||Bs(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let u=r.body?r.body:Bs(e)&&e.body!==null?Gr(e):null;super(u,{size:r.size||e.size||0});let l=new Ee(r.headers||e.headers||{});if(u!==null&&!l.has("Content-Type")){let m=yi(u,this);m&&l.set("Content-Type",m)}let h=Bs(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!jg(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let m=new URL(d);d=/^about:(\/\/)?client$/.test(m)?"client":m}else d=void 0;this[ae]={method:o,redirect:r.redirect||e.redirect||"follow",headers:l,parsedURL:n,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[ae].method}get url(){return(0,nb.format)(this[ae].parsedURL)}get headers(){return this[ae].headers}get redirect(){return this[ae].redirect}get signal(){return this[ae].signal}get referrer(){if(this[ae].referrer==="no-referrer")return"";if(this[ae].referrer==="client")return"about:client";if(this[ae].referrer)return this[ae].referrer.toString()}get referrerPolicy(){return this[ae].referrerPolicy}set referrerPolicy(e){this[ae].referrerPolicy=tb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(hr.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var ob=t=>{let{parsedURL:e}=t[ae],r=new Ee(t[ae].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(n="0"),t.body!==null){let h=Vg(t);typeof h=="number"&&!Number.isNaN(h)&&(n=String(h))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=eb),t.referrer&&t.referrer!=="no-referrer"?t[ae].referrer=rb(t):t[ae].referrer="no-referrer",t[ae].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=t;typeof o=="function"&&(o=o(e));let u=Jg(e),l={path:e.pathname+u,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:o};return{parsedURL:e,options:l}};var vi=class extends Tt{constructor(e,r="aborted"){super(e,r)}};fi();Tu();var XC=new Set(["data:","http:","https:"]);async function fr(t,e){return new Promise((r,n)=>{let o=new hr(t,e),{parsedURL:u,options:l}=ob(o);if(!XC.has(u.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`);if(u.protocol==="data:"){let y=Ag(o.url),D=new Ne(y,{headers:{"Content-Type":y.typeFull}});r(D);return}let h=(u.protocol==="https:"?ub.default:ab.default).request,{signal:d}=o,m=null,p=()=>{let y=new vi("The operation was aborted.");n(y),o.body&&o.body instanceof Ae.default.Readable&&o.body.destroy(y),!(!m||!m.body)&&m.body.emit("error",y)};if(d&&d.aborted){p();return}let w=()=>{p(),R()},_=h(u.toString(),l);d&&d.addEventListener("abort",w);let R=()=>{_.abort(),d&&d.removeEventListener("abort",w)};_.on("error",y=>{n(new Te(`request to ${o.url} failed, reason: ${y.message}`,"system",y)),R()}),ex(_,y=>{m&&m.body&&m.body.destroy(y)}),process.version<"v14"&&_.on("socket",y=>{let D;y.prependListener("end",()=>{D=y._eventsCount}),y.prependListener("close",k=>{if(m&&D<y._eventsCount&&!k){let P=new Error("Premature close");P.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",P)}})}),_.on("response",y=>{_.setTimeout(0);let D=Qg(y.rawHeaders);if(wi(y.statusCode)){let $=D.get("Location"),N=null;try{N=$===null?null:new URL($,o.url)}catch{if(o.redirect!=="manual"){n(new Te(`uri requested responds with an invalid redirect URL: ${$}`,"invalid-redirect")),R();return}}switch(o.redirect){case"error":n(new Te(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),R();return;case"manual":break;case"follow":{if(N===null)break;if(o.counter>=o.follow){n(new Te(`maximum redirect reached at: ${o.url}`,"max-redirect")),R();return}let U={headers:new Ee(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:Gr(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!Lg(o.url,N)||!Ng(o.url,N))for(let Ke of["authorization","www-authenticate","cookie","cookie2"])U.headers.delete(Ke);if(y.statusCode!==303&&o.body&&e.body instanceof Ae.default.Readable){n(new Te("Cannot follow redirect with body being a readable stream","unsupported-redirect")),R();return}(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&o.method==="POST")&&(U.method="GET",U.body=void 0,U.headers.delete("content-length"));let Oe=sb(D);Oe&&(U.referrerPolicy=Oe),r(fr(new hr(N,U))),R();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}d&&y.once("end",()=>{d.removeEventListener("abort",w)});let k=(0,Ae.pipeline)(y,new Ae.PassThrough,$=>{$&&n($)});process.version<"v12.10"&&y.on("aborted",w);let P={url:o.url,status:y.statusCode,statusText:y.statusMessage,headers:D,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},j=D.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||j===null||y.statusCode===204||y.statusCode===304){m=new Ne(k,P),r(m);return}let J={flush:dr.default.Z_SYNC_FLUSH,finishFlush:dr.default.Z_SYNC_FLUSH};if(j==="gzip"||j==="x-gzip"){k=(0,Ae.pipeline)(k,dr.default.createGunzip(J),$=>{$&&n($)}),m=new Ne(k,P),r(m);return}if(j==="deflate"||j==="x-deflate"){let $=(0,Ae.pipeline)(y,new Ae.PassThrough,N=>{N&&n(N)});$.once("data",N=>{(N[0]&15)===8?k=(0,Ae.pipeline)(k,dr.default.createInflate(),U=>{U&&n(U)}):k=(0,Ae.pipeline)(k,dr.default.createInflateRaw(),U=>{U&&n(U)}),m=new Ne(k,P),r(m)}),$.once("end",()=>{m||(m=new Ne(k,P),r(m))});return}if(j==="br"){k=(0,Ae.pipeline)(k,dr.default.createBrotliDecompress(),$=>{$&&n($)}),m=new Ne(k,P),r(m);return}m=new Ne(k,P),r(m)}),Yg(_,o).catch(n)})}function ex(t,e){let r=Fs.Buffer.from(`0\r
117
+ `).map(nC).filter(Boolean);e||r.sort(function(o,u){let l=o.split("."),h=u.split(".");if(l.length===1||h.length===1)return sC(zn(l[0]),zn(h[0]));for(let d=0,m=Math.max(l.length,h.length);d<m;d++){let p=cg(zn(l[d]),zn(h[d]));if(p)return p}return 0});let n=e?r[0]:[...r].reverse().find(o=>o.indexOf(".")>=0);return new am(r,n)}}}),dg={};ne(dg,{addAnnotatedTagTask:()=>uC,addTagTask:()=>aC,tagListTask:()=>oC});function oC(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return hg(r,e)}}}function aC(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function uC(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var lC=T({"src/lib/tasks/tag.ts"(){"use strict";iC()}}),cC=kT({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(dR(),te(np)),{SimpleGitApi:n}=(d0(),te(jp)),{Scheduler:o}=(f0(),te(Lp)),{adhocExecTask:u,configurationErrorTask:l}=(re(),te($a)),{asArray:h,filterArray:d,filterPrimitives:m,filterString:p,filterStringOrStringArray:w,filterType:_,getTrailingOptions:R,trailingFunctionArgument:y,trailingOptionsArgument:D}=(q(),te(km)),{applyPatchTask:k}=(p0(),te(Wp)),{branchTask:P,branchLocalTask:j,deleteBranchesTask:J,deleteBranchTask:$}=(x0(),te(Jp)),{checkIgnoreTask:N}=(A0(),te(eg)),{checkIsRepoTask:U}=(Om(),te(Pm)),{cleanWithOptionsTask:Oe,isCleanOptionsArray:Ke}=(Um(),te(Lm)),{diffSummaryTask:Wt}=(du(),te(bp)),{fetchTask:Qr}=(M0(),te(rg)),{moveTask:js}=(j0(),te(ng)),{pullTask:Jr}=(N0(),te(ig)),{pushTagsTask:Ue}=(Ip(),te(Op)),{addRemoteTask:pr,getRemotesTask:Kr,listRemotesTask:Ls,remoteTask:Ri,removeRemoteTask:Zr}=(J0(),te(ag)),{getResetMode:Ci,resetTask:Ns}=(ep(),te(Km)),{stashListTask:Us}=(Z0(),te(ug)),{addSubModuleTask:xi,initSubModuleTask:ki,subModuleTask:Ie,updateSubModuleTask:me}=(rC(),te(lg)),{addAnnotatedTagTask:Pi,addTagTask:Ws,tagListTask:We}=(lC(),te(dg)),{straightThroughBufferTask:Xr,straightThroughStringTask:pe}=(re(),te($a));function O(v,x){this._plugins=x,this._executor=new r(v.baseDir,new o(v.maxConcurrentProcesses),x),this._trimmed=v.trimmed}(O.prototype=Object.create(n.prototype)).constructor=O,O.prototype.customBinary=function(v){return this._plugins.reconfigure("binary",v),this},O.prototype.env=function(v,x){return arguments.length===1&&typeof v=="object"?this._executor.env=v:(this._executor.env=this._executor.env||{})[v]=x,this},O.prototype.stashList=function(v){return this._runTask(Us(D(arguments)||{},d(v)&&v||[]),y(arguments))},O.prototype.mv=function(v,x){return this._runTask(js(v,x),y(arguments))},O.prototype.checkoutLatestTag=function(v){var x=this;return this.pull(function(){x.tags(function(W,se){x.checkout(se.latest,v)})})},O.prototype.pull=function(v,x,W,se){return this._runTask(Jr(_(v,p),_(x,p),R(arguments)),y(arguments))},O.prototype.fetch=function(v,x){return this._runTask(Qr(_(v,p),_(x,p),R(arguments)),y(arguments))},O.prototype.silent=function(v){return this._runTask(u(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},O.prototype.tags=function(v,x){return this._runTask(We(R(arguments)),y(arguments))},O.prototype.rebase=function(){return this._runTask(pe(["rebase",...R(arguments)]),y(arguments))},O.prototype.reset=function(v){return this._runTask(Ns(Ci(v),R(arguments)),y(arguments))},O.prototype.revert=function(v){let x=y(arguments);return typeof v!="string"?this._runTask(l("Commit must be a string"),x):this._runTask(pe(["revert",...R(arguments,0,!0),v]),x)},O.prototype.addTag=function(v){let x=typeof v=="string"?Ws(v):l("Git.addTag requires a tag name");return this._runTask(x,y(arguments))},O.prototype.addAnnotatedTag=function(v,x){return this._runTask(Pi(v,x),y(arguments))},O.prototype.deleteLocalBranch=function(v,x,W){return this._runTask($(v,typeof x=="boolean"?x:!1),y(arguments))},O.prototype.deleteLocalBranches=function(v,x,W){return this._runTask(J(v,typeof x=="boolean"?x:!1),y(arguments))},O.prototype.branch=function(v,x){return this._runTask(P(R(arguments)),y(arguments))},O.prototype.branchLocal=function(v){return this._runTask(j(),y(arguments))},O.prototype.raw=function(v){let x=!Array.isArray(v),W=[].slice.call(x?arguments:v,0);for(let ge=0;ge<W.length&&x;ge++)if(!m(W[ge])){W.splice(ge,W.length-ge);break}W.push(...R(arguments,0,!0));var se=y(arguments);return W.length?this._runTask(pe(W,this._trimmed),se):this._runTask(l("Raw: must supply one or more command to execute"),se)},O.prototype.submoduleAdd=function(v,x,W){return this._runTask(xi(v,x),y(arguments))},O.prototype.submoduleUpdate=function(v,x){return this._runTask(me(R(arguments,!0)),y(arguments))},O.prototype.submoduleInit=function(v,x){return this._runTask(ki(R(arguments,!0)),y(arguments))},O.prototype.subModule=function(v,x){return this._runTask(Ie(R(arguments)),y(arguments))},O.prototype.listRemote=function(){return this._runTask(Ls(R(arguments)),y(arguments))},O.prototype.addRemote=function(v,x,W){return this._runTask(pr(v,x,R(arguments)),y(arguments))},O.prototype.removeRemote=function(v,x){return this._runTask(Zr(v),y(arguments))},O.prototype.getRemotes=function(v,x){return this._runTask(Kr(v===!0),y(arguments))},O.prototype.remote=function(v,x){return this._runTask(Ri(R(arguments)),y(arguments))},O.prototype.tag=function(v,x){let W=R(arguments);return W[0]!=="tag"&&W.unshift("tag"),this._runTask(pe(W),y(arguments))},O.prototype.updateServerInfo=function(v){return this._runTask(pe(["update-server-info"]),y(arguments))},O.prototype.pushTags=function(v,x){let W=Ue({remote:_(v,p)},R(arguments));return this._runTask(W,y(arguments))},O.prototype.rm=function(v){return this._runTask(pe(["rm","-f",...h(v)]),y(arguments))},O.prototype.rmKeepLocal=function(v){return this._runTask(pe(["rm","--cached",...h(v)]),y(arguments))},O.prototype.catFile=function(v,x){return this._catFile("utf-8",arguments)},O.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},O.prototype._catFile=function(v,x){var W=y(x),se=["cat-file"],ge=x[0];if(typeof ge=="string")return this._runTask(l("Git.catFile: options must be supplied as an array of strings"),W);Array.isArray(ge)&&se.push.apply(se,ge);let zt=v==="buffer"?Xr(se):pe(se);return this._runTask(zt,W)},O.prototype.diff=function(v,x){let W=p(v)?l("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):pe(["diff",...R(arguments)]);return this._runTask(W,y(arguments))},O.prototype.diffSummary=function(){return this._runTask(Wt(R(arguments,1)),y(arguments))},O.prototype.applyPatch=function(v){let x=w(v)?k(h(v),R([].slice.call(arguments,1))):l("git.applyPatch requires one or more string patches as the first argument");return this._runTask(x,y(arguments))},O.prototype.revparse=function(){let v=["rev-parse",...R(arguments,!0)];return this._runTask(pe(v,!0),y(arguments))},O.prototype.clean=function(v,x,W){let se=Ke(v),ge=se&&v.join("")||_(v,p)||"",zt=R([].slice.call(arguments,se?1:0));return this._runTask(Oe(ge,zt),y(arguments))},O.prototype.exec=function(v){let x={commands:[],format:"utf-8",parser(){typeof v=="function"&&v()}};return this._runTask(x)},O.prototype.clearQueue=function(){return this._runTask(u(()=>console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},O.prototype.checkIgnore=function(v,x){return this._runTask(N(h(_(v,w,[]))),y(arguments))},O.prototype.checkIsRepo=function(v,x){return this._runTask(U(_(v,p)),y(arguments))},e.exports=O}});Nt();var hC=class extends vt{constructor(t,e){super(void 0,e),this.config=t}};Nt();Nt();var Nr=class extends vt{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};Ur();fm();Om();Um();Hm();Vm();Jm();ep();function dC(t){return t?[{type:"spawn.before",action(n,o){t.aborted&&o.kill(new Nr(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,o){function u(){o.kill(new Nr(void 0,"abort","Abort signal received"))}t.addEventListener("abort",u),o.spawned.on("close",()=>t.removeEventListener("abort",u))}}]:void 0}function fC(t={}){return{type:"spawn.args",action(e,{env:r}){for(let n of Df(e,r))if(t[n.category]!==!0)throw new Nr(void 0,"unsafe",n.message);return e}}}q();function mC(t){let e=Rs(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}q();var um=(0,jr.deferred)().promise;function pC({onClose:t=!0,onExit:e=50}={}){function r(){let o=-1,u={close:(0,jr.deferred)(),closeTimeout:(0,jr.deferred)(),exit:(0,jr.deferred)(),exitTimeout:(0,jr.deferred)()},l=Promise.race([t===!1?um:u.closeTimeout.promise,e===!1?um:u.exitTimeout.promise]);return n(t,u.close,u.closeTimeout),n(e,u.exit,u.exitTimeout),{close(h){o=h,u.close.done()},exit(h){o=h,u.exit.done()},get exitCode(){return o},result:l}}function n(o,u,l){o!==!1&&(o===!0?u.promise:u.promise.then(()=>Ia(o))).then(l.done)}return{type:"spawn.after",async action(o,{spawned:u,close:l}){let h=r(),d=!0,m=()=>{d=!1};u.stdout?.on("data",m),u.stderr?.on("data",m),u.on("error",m),u.on("close",p=>h.close(p)),u.on("exit",p=>h.exit(p));try{await h.result,d&&await Ia(50),l(h.exitCode)}catch(p){l(h.exitCode,p)}}}}q();var gC="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",lm="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function bC(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function cm(t,e){if(t.length<1||t.length>2)throw new Nr(void 0,"binary",gC);if(t.some(bC))if(e)console.warn(lm);else throw new Nr(void 0,"binary",lm);let[n,o]=t;return{binary:n,prefix:o}}function yC(t,e=["git"],r=!1){let n=cm(it(e),r);t.on("binary",o=>{n=cm(it(o),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",o=>n.prefix?[n.prefix,...o]:o)}Nt();function _C(t){return!!(t.exitCode&&t.stdErr.length)}function wC(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function vC(t=!1,e=_C,r=wC){return(n,o)=>!t&&n||!e(o)?n:r(o)}function hm(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new vt(void 0,n.toString("utf-8"))}:{error:n}}}}q();var SC=class{constructor(){this.plugins=new Set,this.events=new fg.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=$e(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return it(t).forEach(r=>r&&this.plugins.add($e(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,o=Object.freeze(Object.create(r));for(let u of this.plugins)u.type===t&&(n=u.action(n,o));return n}};q();function TC(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(u,l){return r.includes(l.method)?_m(u,e):u}},{type:"spawn.after",action(u,l){l.commands.includes(e)&&l.spawned.stderr?.on("data",h=>{let d=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(h.toString("utf8"));d&&t({method:l.method,stage:RC(d[1]),progress:Y(d[2]),processed:Y(d[3]),total:Y(d[4])})})}}]}function RC(t){return String(t.toLowerCase().split(" ",1))||"unknown"}q();function CC(t){let e=vm(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function xC({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,o){let u;function l(){u&&clearTimeout(u),u=setTimeout(d,t)}function h(){o.spawned.stdout?.off("data",l),o.spawned.stderr?.off("data",l),o.spawned.off("exit",h),o.spawned.off("close",h),u&&clearTimeout(u)}function d(){h(),o.kill(new Nr(void 0,"timeout","block timeout reached"))}r&&o.spawned.stdout?.on("data",l),e&&o.spawned.stderr?.on("data",l),o.spawned.on("exit",h),o.spawned.on("close",h),l()}}}function kC(){return{type:"spawn.args",action(t){let e=[],r;function n(o){(r=r||[]).push(...o)}for(let o=0;o<t.length;o++){let u=t[o];if(Me(u)){n(Fr(u));continue}if(u==="--"){n(t.slice(o+1).flatMap(l=>Me(l)&&Fr(l)||l));break}e.push(u)}return r?[...e,"--",...r.map(String)]:e}}}q();var PC=cC();function EC(t,e){let r=new SC,n=Cm(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Ja(n.baseDir))throw new hC(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(mC(n.config)),r.add(fC(n.unsafe)),r.add(pC(n.completion)),n.abort&&r.add(dC(n.abort)),n.progress&&r.add(TC(n.progress)),n.timeout&&r.add(xC(n.timeout)),n.spawnOptions&&r.add(CC(n.spawnOptions)),r.add(kC()),r.add(hm(vC(!0))),n.errors&&r.add(hm(n.errors)),yC(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new PC(n,r)}Ur();var je=EC;var Si=ie(Bn());var AC=t=>t?.trim().normalize("NFD").replace(/\[.*]\s/,"").replace(/\+\s/,"").replace(/-\s/,"").replace(/\./,"").replace(/>/g,"").replace(/</g,"").replace(/:/g,"").replace(/"/g,"").replace(/&/g,"").replace(/['\u2019]/g,"-").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").replace(/\s/g,"-").toLowerCase(),OC=t=>t==="Epic"?"story":t==="Bug"?"fix":"feat",mg=t=>{let{id:e,name:r,type:n}=t,o=OC(n),u=AC(r);return[`${o}/${e}_${u}`,`${o}/${e}`,`${e}`]};var pg=ie(require("os")),zr=require("fs/promises"),gg=require("fs"),or=()=>pg.default.homedir(),bg=()=>process.cwd(),yg=async t=>{await(0,zr.mkdir)(t,{recursive:!0})},li=t=>(0,gg.existsSync)(t),_g=async(t,e)=>{await(0,zr.writeFile)(t,e)},gu=async t=>(await(0,zr.readFile)(t)).toString();var bu={tools:{jira:{domain:process.env.JIRA_DOMAIN??"",authorization:process.env.JIRA_AUTHORIZATION??""},github:{token:process.env.GITHUB_TOKEN??"",organization:process.env.GITHUB_ORGANIZATION??""},ai:{model:"gpt-4o-mini",token:"",url:"https://api.openai.com/v1"}},projects:{},advanced:!1,debug:!1,experimental:!1,version:"0.0.0"};var wg=t=>btoa(t);var vg=()=>li(`${or()}/.mytools/config`),Sg=async()=>{li(`${or()}/.mytools/config`)||(li(`${or()}/.mytools`)||await yg(`${or()}/.mytools`),await hi(bu))},Tg=async()=>{let t=await ar(),{tools:e,...r}=t,{ai:n}=e,{tools:o,...u}=bu,{ai:l}=o;await hi({...u,...r,tools:{...o,...e,ai:{...l,...n}}})},Rg=async()=>{let t=await ar();await hi({...t,projects:{}})},Cg=async()=>{let t=wg(bg()),e=await ar(),r=e.tools.jira,n=e.projects[t]?.tools.jira;return n?n.domain&&n.authorization:r.domain&&r.authorization},xg=async()=>{let{experimental:t}=await ar();return t},kg=async()=>{let{version:t}=await Eg(),[e,r,n]=t.split(".").map(d=>parseInt(d)),{version:o}=await ar();if(!o)return!0;let[u,l,h]=o.split(".").map(d=>parseInt(d));return e>u||r>l||n>h},Pg=async()=>{let{version:t}=await Eg(),e=await ar();await hi({...e,version:t})},ci=async()=>{let t=await ar(),{tools:e}=t,{ai:r}=e;return r},Eg=async()=>{let t=await gu(`${__dirname}/../package.json`);return JSON.parse(t)},ar=async()=>{let t=await gu(`${or()}/.mytools/config`);return JSON.parse(t)},hi=async t=>{let e=JSON.stringify(t,null,2);await _g(`${or()}/.mytools/config`,e)};var ab=ie(require("http"),1),ub=ie(require("https"),1),dr=ie(require("zlib"),1),Ae=ie(require("stream"),1),Fs=require("buffer");function IC(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),n="",o=!1,u=r[0]||"text/plain",l=u;for(let p=1;p<r.length;p++)r[p]==="base64"?o=!0:r[p]&&(l+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(n=r[p].substring(8)));!r[0]&&!n.length&&(l+=";charset=US-ASCII",n="US-ASCII");let h=o?"base64":"ascii",d=unescape(t.substring(e+1)),m=Buffer.from(d,h);return m.type=u,m.typeFull=l,m.charset=n,m}var Ag=IC;var Le=ie(require("stream"),1),Rt=require("util"),Pe=require("buffer");Os();fi();var Tt=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var Te=class extends Tt{constructor(e,r,n){super(e,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};var mi=Symbol.toStringTag,Su=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[mi]==="URLSearchParams",qs=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[mi]),jg=t=>typeof t=="object"&&(t[mi]==="AbortSignal"||t[mi]==="EventTarget"),Lg=(t,e)=>{let r=new URL(e).hostname,n=new URL(t).hostname;return r===n||r.endsWith(`.${n}`)},Ng=(t,e)=>{let r=new URL(e).protocol,n=new URL(t).protocol;return r===n};var YC=(0,Rt.promisify)(Le.default.pipeline),Re=Symbol("Body internals"),at=class{constructor(e,{size:r=0}={}){let n=null;e===null?e=null:Su(e)?e=Pe.Buffer.from(e.toString()):qs(e)||Pe.Buffer.isBuffer(e)||(Rt.types.isAnyArrayBuffer(e)?e=Pe.Buffer.from(e):ArrayBuffer.isView(e)?e=Pe.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof Le.default||(e instanceof lr?(e=$g(e),n=e.type.split("=")[1]):e=Pe.Buffer.from(String(e))));let o=e;Pe.Buffer.isBuffer(e)?o=Le.default.Readable.from(e):qs(e)&&(o=Le.default.Readable.from(e.stream())),this[Re]={body:e,stream:o,boundary:n,disturbed:!1,error:null},this.size=r,e instanceof Le.default&&e.on("error",u=>{let l=u instanceof Tt?u:new Te(`Invalid response body while trying to fetch ${this.url}: ${u.message}`,"system",u);this[Re].error=l})}get body(){return this[Re].stream}get bodyUsed(){return this[Re].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:n}=await Cu(this);return e.slice(r,r+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new lr,o=new URLSearchParams(await this.text());for(let[u,l]of o)n.append(u,l);return n}let{toFormData:r}=await Promise.resolve().then(()=>(Gg(),Hg));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Re].body&&this[Re].body.type||"",r=await this.arrayBuffer();return new St([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Cu(this);return new TextDecoder().decode(e)}buffer(){return Cu(this)}};at.prototype.buffer=(0,Rt.deprecate)(at.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(at.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Rt.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Cu(t){if(t[Re].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Re].disturbed=!0,t[Re].error)throw t[Re].error;let{body:e}=t;if(e===null)return Pe.Buffer.alloc(0);if(!(e instanceof Le.default))return Pe.Buffer.alloc(0);let r=[],n=0;try{for await(let o of e){if(t.size>0&&n+o.length>t.size){let u=new Te(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(u),u}n+=o.length,r.push(o)}}catch(o){throw o instanceof Tt?o:new Te(`Invalid response body while trying to fetch ${t.url}: ${o.message}`,"system",o)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(o=>typeof o=="string")?Pe.Buffer.from(r.join("")):Pe.Buffer.concat(r,n)}catch(o){throw new Te(`Could not create Buffer from response body for ${t.url}: ${o.message}`,"system",o)}else throw new Te(`Premature close of server response while trying to fetch ${t.url}`)}var Gr=(t,e)=>{let r,n,{body:o}=t[Re];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof Le.default&&typeof o.getBoundary!="function"&&(r=new Le.PassThrough({highWaterMark:e}),n=new Le.PassThrough({highWaterMark:e}),o.pipe(r),o.pipe(n),t[Re].stream=r,o=n),o},QC=(0,Rt.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),yi=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Su(t)?"application/x-www-form-urlencoded;charset=UTF-8":qs(t)?t.type||null:Pe.Buffer.isBuffer(t)||Rt.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof lr?`multipart/form-data; boundary=${e[Re].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${QC(t)}`:t instanceof Le.default?null:"text/plain;charset=UTF-8",Vg=t=>{let{body:e}=t[Re];return e===null?0:qs(e)?e.size:Pe.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},Yg=async(t,{body:e})=>{e===null?t.end():await YC(e,t)};var xu=require("util"),Ms=ie(require("http"),1),_i=typeof Ms.default.validateHeaderName=="function"?Ms.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},ku=typeof Ms.default.validateHeaderValue=="function"?Ms.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ee=class t extends URLSearchParams{constructor(e){let r=[];if(e instanceof t){let n=e.raw();for(let[o,u]of Object.entries(n))r.push(...u.map(l=>[o,l]))}else if(e!=null)if(typeof e=="object"&&!xu.types.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)r.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(o=>{if(typeof o!="object"||xu.types.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,o])=>(_i(n),ku(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(r),new Proxy(this,{get(n,o,u){switch(o){case"append":case"set":return(l,h)=>(_i(l),ku(l,String(h)),URLSearchParams.prototype[o].call(n,String(l).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return l=>(_i(l),URLSearchParams.prototype[o].call(n,String(l).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,u)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,r=void 0){for(let n of this.keys())Reflect.apply(e,r,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let n=this.getAll(r);return r==="host"?e[r]=n[0]:e[r]=n.length>1?n:n[0],e},{})}};Object.defineProperties(Ee.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function Qg(t=[]){return new Ee(t.reduce((e,r,n,o)=>(n%2===0&&e.push(o.slice(n,n+2)),e),[]).filter(([e,r])=>{try{return _i(e),ku(e,String(r)),!0}catch{return!1}}))}var JC=new Set([301,302,303,307,308]),wi=t=>JC.has(t);var Je=Symbol("Response internals"),Ne=class t extends at{constructor(e=null,r={}){super(e,r);let n=r.status!=null?r.status:200,o=new Ee(r.headers);if(e!==null&&!o.has("Content-Type")){let u=yi(e,this);u&&o.append("Content-Type",u)}this[Je]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Je].type}get url(){return this[Je].url||""}get status(){return this[Je].status}get ok(){return this[Je].status>=200&&this[Je].status<300}get redirected(){return this[Je].counter>0}get statusText(){return this[Je].statusText}get headers(){return this[Je].headers}get highWaterMark(){return this[Je].highWaterMark}clone(){return new t(Gr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!wi(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new t(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new t(null,{status:0,statusText:""});return e[Je].type="error",e}static json(e=void 0,r={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new Ee(r&&r.headers);return o.has("content-type")||o.set("content-type","application/json"),new t(n,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Ne.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var nb=require("url"),ib=require("util");var Jg=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var Zg=require("net");function Kg(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var Xg=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),eb="strict-origin-when-cross-origin";function tb(t){if(!Xg.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function KC(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Zg.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:t.host==="localhost"||t.host.endsWith(".localhost")?!1:t.protocol==="file:"}function Vr(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:KC(t)}function rb(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let n=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let o=t.referrer,u=Kg(o),l=Kg(o,!0);u.toString().length>4096&&(u=l),e&&(u=e(u)),r&&(l=r(l));let h=new URL(t.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return l;case"unsafe-url":return u;case"strict-origin":return Vr(u)&&!Vr(h)?"no-referrer":l.toString();case"strict-origin-when-cross-origin":return u.origin===h.origin?u:Vr(u)&&!Vr(h)?"no-referrer":l;case"same-origin":return u.origin===h.origin?u:"no-referrer";case"origin-when-cross-origin":return u.origin===h.origin?u:l;case"no-referrer-when-downgrade":return Vr(u)&&!Vr(h)?"no-referrer":u;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function sb(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of e)n&&Xg.has(n)&&(r=n);return r}var ae=Symbol("Request internals"),Bs=t=>typeof t=="object"&&typeof t[ae]=="object",ZC=(0,ib.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),hr=class t extends at{constructor(e,r={}){let n;if(Bs(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=r.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!Bs(r)&&"data"in r&&ZC(),(r.body!=null||Bs(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let u=r.body?r.body:Bs(e)&&e.body!==null?Gr(e):null;super(u,{size:r.size||e.size||0});let l=new Ee(r.headers||e.headers||{});if(u!==null&&!l.has("Content-Type")){let m=yi(u,this);m&&l.set("Content-Type",m)}let h=Bs(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!jg(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let m=new URL(d);d=/^about:(\/\/)?client$/.test(m)?"client":m}else d=void 0;this[ae]={method:o,redirect:r.redirect||e.redirect||"follow",headers:l,parsedURL:n,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[ae].method}get url(){return(0,nb.format)(this[ae].parsedURL)}get headers(){return this[ae].headers}get redirect(){return this[ae].redirect}get signal(){return this[ae].signal}get referrer(){if(this[ae].referrer==="no-referrer")return"";if(this[ae].referrer==="client")return"about:client";if(this[ae].referrer)return this[ae].referrer.toString()}get referrerPolicy(){return this[ae].referrerPolicy}set referrerPolicy(e){this[ae].referrerPolicy=tb(e)}clone(){return new t(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(hr.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var ob=t=>{let{parsedURL:e}=t[ae],r=new Ee(t[ae].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(n="0"),t.body!==null){let h=Vg(t);typeof h=="number"&&!Number.isNaN(h)&&(n=String(h))}n&&r.set("Content-Length",n),t.referrerPolicy===""&&(t.referrerPolicy=eb),t.referrer&&t.referrer!=="no-referrer"?t[ae].referrer=rb(t):t[ae].referrer="no-referrer",t[ae].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=t;typeof o=="function"&&(o=o(e));let u=Jg(e),l={path:e.pathname+u,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:o};return{parsedURL:e,options:l}};var vi=class extends Tt{constructor(e,r="aborted"){super(e,r)}};fi();Tu();var XC=new Set(["data:","http:","https:"]);async function fr(t,e){return new Promise((r,n)=>{let o=new hr(t,e),{parsedURL:u,options:l}=ob(o);if(!XC.has(u.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`);if(u.protocol==="data:"){let y=Ag(o.url),D=new Ne(y,{headers:{"Content-Type":y.typeFull}});r(D);return}let h=(u.protocol==="https:"?ub.default:ab.default).request,{signal:d}=o,m=null,p=()=>{let y=new vi("The operation was aborted.");n(y),o.body&&o.body instanceof Ae.default.Readable&&o.body.destroy(y),!(!m||!m.body)&&m.body.emit("error",y)};if(d&&d.aborted){p();return}let w=()=>{p(),R()},_=h(u.toString(),l);d&&d.addEventListener("abort",w);let R=()=>{_.abort(),d&&d.removeEventListener("abort",w)};_.on("error",y=>{n(new Te(`request to ${o.url} failed, reason: ${y.message}`,"system",y)),R()}),ex(_,y=>{m&&m.body&&m.body.destroy(y)}),process.version<"v14"&&_.on("socket",y=>{let D;y.prependListener("end",()=>{D=y._eventsCount}),y.prependListener("close",k=>{if(m&&D<y._eventsCount&&!k){let P=new Error("Premature close");P.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",P)}})}),_.on("response",y=>{_.setTimeout(0);let D=Qg(y.rawHeaders);if(wi(y.statusCode)){let $=D.get("Location"),N=null;try{N=$===null?null:new URL($,o.url)}catch{if(o.redirect!=="manual"){n(new Te(`uri requested responds with an invalid redirect URL: ${$}`,"invalid-redirect")),R();return}}switch(o.redirect){case"error":n(new Te(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),R();return;case"manual":break;case"follow":{if(N===null)break;if(o.counter>=o.follow){n(new Te(`maximum redirect reached at: ${o.url}`,"max-redirect")),R();return}let U={headers:new Ee(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:Gr(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!Lg(o.url,N)||!Ng(o.url,N))for(let Ke of["authorization","www-authenticate","cookie","cookie2"])U.headers.delete(Ke);if(y.statusCode!==303&&o.body&&e.body instanceof Ae.default.Readable){n(new Te("Cannot follow redirect with body being a readable stream","unsupported-redirect")),R();return}(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&o.method==="POST")&&(U.method="GET",U.body=void 0,U.headers.delete("content-length"));let Oe=sb(D);Oe&&(U.referrerPolicy=Oe),r(fr(new hr(N,U))),R();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}d&&y.once("end",()=>{d.removeEventListener("abort",w)});let k=(0,Ae.pipeline)(y,new Ae.PassThrough,$=>{$&&n($)});process.version<"v12.10"&&y.on("aborted",w);let P={url:o.url,status:y.statusCode,statusText:y.statusMessage,headers:D,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},j=D.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||j===null||y.statusCode===204||y.statusCode===304){m=new Ne(k,P),r(m);return}let J={flush:dr.default.Z_SYNC_FLUSH,finishFlush:dr.default.Z_SYNC_FLUSH};if(j==="gzip"||j==="x-gzip"){k=(0,Ae.pipeline)(k,dr.default.createGunzip(J),$=>{$&&n($)}),m=new Ne(k,P),r(m);return}if(j==="deflate"||j==="x-deflate"){let $=(0,Ae.pipeline)(y,new Ae.PassThrough,N=>{N&&n(N)});$.once("data",N=>{(N[0]&15)===8?k=(0,Ae.pipeline)(k,dr.default.createInflate(),U=>{U&&n(U)}):k=(0,Ae.pipeline)(k,dr.default.createInflateRaw(),U=>{U&&n(U)}),m=new Ne(k,P),r(m)}),$.once("end",()=>{m||(m=new Ne(k,P),r(m))});return}if(j==="br"){k=(0,Ae.pipeline)(k,dr.default.createBrotliDecompress(),$=>{$&&n($)}),m=new Ne(k,P),r(m);return}m=new Ne(k,P),r(m)}),Yg(_,o).catch(n)})}function ex(t,e){let r=Fs.Buffer.from(`0\r
118
118
  \r
119
- `),n=!1,o=!1,u;t.on("response",l=>{let{headers:h}=l;n=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",l=>{let h=()=>{if(n&&!o){let m=new Error("Premature close");m.code="ERR_STREAM_PREMATURE_CLOSE",e(m)}},d=m=>{o=Fs.Buffer.compare(m.slice(-5),r)===0,!o&&u&&(o=Fs.Buffer.compare(u.slice(-3),r.slice(0,3))===0&&Fs.Buffer.compare(m.slice(-2),r.slice(3))===0),u=m};l.prependListener("close",h),l.on("data",d),t.on("close",()=>{l.removeListener("close",h),l.removeListener("data",d)})})}var tx=t=>{let e='status = "In Progress"';return t===1?`${e} AND assignee = currentUser()`:e},lb=async t=>{let e=`${process.env.JIRA_DOMAIN}/rest/api/3/search/jql`,r={expand:"names",maxResults:50,fieldsByKeys:!1,fields:["summary","issuetype","status"],jql:tx(t)},n=await fr(e,{method:"post",body:JSON.stringify(r),headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!n.ok)return[];let o=await n.json(),{issues:u=[]}=o;return u.map(l=>{let{fields:{summary:h,issuetype:{name:d},status:{name:m}},key:p,self:w}=l;return{id:p.trim(),name:h.trim(),type:d.trim(),url:w.trim(),status:m}})};var Yr=ie(ya()),Ct=t=>console.log(`\u{1F437} ${(0,Yr.green)("[SUCCESS]")} ${t}`),mr=t=>console.log(`\u{1F437} ${(0,Yr.cyan)("[INFO]")} ${t}`),Pu=t=>console.log(`\u{1F437} ${(0,Yr.red)("[ERROR]")} ${t}`);async function rx(){mr("making a git fetch..."),await je().fetch(),Ct("git fetch completed")}async function sx(){mr("pulling branches..."),await je().pull(),Ct("pull branches completed")}async function nx(t){return mr("requesting task in progress..."),await lb(t)}async function ix(){let{ownership:t}=await(0,Si.default)({type:"select",name:"ownership",message:"What kind of task do you want to search?",choices:[{title:"My tasks",value:1},{title:"All tasks",value:2}],initial:0});return t}async function ox(t){let{task:e}=await(0,Si.default)({type:"select",name:"task",message:"What task do you want to start?",choices:t.map(r=>({title:`${(0,$s.cyan)(r.id)} => ${r.name} => ${(0,$s.yellow)(r.type)}`,value:r}))});return e}async function ax(t){let{branchName:e}=await(0,Si.default)({type:"select",name:"branchName",message:"What name of brunch do you like?",choices:t.map(r=>({title:r,value:r}))});return e}async function ux(t){mr(`creating new branch ${(0,$s.yellow)(t)}`),await je().checkoutLocalBranch(t)}var lx=async()=>{if(!await Cg())return Promise.reject("The envs JIRA_DOMAIN or JIRA_AUTHORIZATION not exist. More info in doc")},cx=async()=>{await lx(),await rx(),await sx();let t=await ix(),e=await nx(t);if(!e.length)return Promise.reject("There are not in progress tasks");let r=await ox(e),n=mg(r),o=await ax(n);await ux(o)},cb=cx;var Ti=ie(Bn());var hb=async()=>{let t=await fr(`https://api.github.com/orgs/${process.env.GITHUB_ORGANIZATION}/repos?sort=full_name&per_page=100`,{method:"get",headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!t.ok){let{message:r}=await t.json();return Promise.reject(`Fail to find projects in github -> ${t.statusText}: ${r}`)}return(await t.json()).map(({id:r,name:n})=>({id:r,name:n}))},db=async t=>{let e=await fr(`https://api.github.com/repos/${process.env.GITHUB_ORGANIZATION}/${t.repo}/pulls`,{method:"post",body:JSON.stringify({title:t.title,body:t.body,head:t.head,base:t.base,draft:!0}),headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!e.ok){let{message:n}=await e.json();return Promise.reject(`Fail to create PR in github -> ${e.statusText}: ${n}`)}let r=await e.json();return{id:r.id,number:r.number,url:r.html_url,state:r.state,title:r.title,body:r.body,headSha:r.head.sha,head:r.head.ref,baseSha:r.base.sha,base:r.base.ref,repo:r.base.repo.name}};async function hx(){mr("making a git fetch..."),await je().fetch(),Ct("git fetch completed")}var dx=async t=>{let{baseBranch:e}=await(0,Ti.default)({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map(r=>({title:r,value:r}))});return e},fx=async()=>{let{current:t,all:e}=await je().branch();return[t,e]},mx=async()=>{if(!process.env.GITHUB_TOKEN||!process.env.GITHUB_ORGANIZATION)return Promise.reject("The envs GITHUB_TOKEN or GITHUB_ORGANIZATION not exist. More info in doc")},px=async()=>{let{current:t,all:e}=await je().branch();if(!e.find(r=>r===`remotes/origin/${t}`))return Promise.reject("Current branch not found at origin")},gx=async(t,e,r)=>{let{url:n}=await db({title:`${t} pull request`,body:`Esta PR [cierra, soluciona, resuelve] [#000](https://zityhub.atlassian.net/browse/000)
120
-
121
- ![required gif]()
119
+ `),n=!1,o=!1,u;t.on("response",l=>{let{headers:h}=l;n=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",l=>{let h=()=>{if(n&&!o){let m=new Error("Premature close");m.code="ERR_STREAM_PREMATURE_CLOSE",e(m)}},d=m=>{o=Fs.Buffer.compare(m.slice(-5),r)===0,!o&&u&&(o=Fs.Buffer.compare(u.slice(-3),r.slice(0,3))===0&&Fs.Buffer.compare(m.slice(-2),r.slice(3))===0),u=m};l.prependListener("close",h),l.on("data",d),t.on("close",()=>{l.removeListener("close",h),l.removeListener("data",d)})})}var tx=t=>{let e='status = "In Progress"';return t===1?`${e} AND assignee = currentUser()`:e},lb=async t=>{let e=`${process.env.JIRA_DOMAIN}/rest/api/3/search/jql`,r={expand:"names",maxResults:50,fieldsByKeys:!1,fields:["summary","issuetype","status"],jql:tx(t)},n=await fr(e,{method:"post",body:JSON.stringify(r),headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Basic ${process.env.JIRA_AUTHORIZATION}`}});if(!n.ok)return[];let o=await n.json(),{issues:u=[]}=o;return u.map(l=>{let{fields:{summary:h,issuetype:{name:d},status:{name:m}},key:p,self:w}=l;return{id:p.trim(),name:h.trim(),type:d.trim(),url:w.trim(),status:m}})};var Yr=ie(ya()),Ct=t=>console.log(`\u{1F437} ${(0,Yr.green)("[SUCCESS]")} ${t}`),mr=t=>console.log(`\u{1F437} ${(0,Yr.cyan)("[INFO]")} ${t}`),Pu=t=>console.log(`\u{1F437} ${(0,Yr.red)("[ERROR]")} ${t}`);async function rx(){mr("making a git fetch..."),await je().fetch(),Ct("git fetch completed")}async function sx(){mr("pulling branches..."),await je().pull(),Ct("pull branches completed")}async function nx(t){return mr("requesting task in progress..."),await lb(t)}async function ix(){let{ownership:t}=await(0,Si.default)({type:"select",name:"ownership",message:"What kind of task do you want to search?",choices:[{title:"My tasks",value:1},{title:"All tasks",value:2}],initial:0});return t}async function ox(t){let{task:e}=await(0,Si.default)({type:"select",name:"task",message:"What task do you want to start?",choices:t.map(r=>({title:`${(0,$s.cyan)(r.id)} => ${r.name} => ${(0,$s.yellow)(r.type)}`,value:r}))});return e}async function ax(t){let{branchName:e}=await(0,Si.default)({type:"select",name:"branchName",message:"What name of brunch do you like?",choices:t.map(r=>({title:r,value:r}))});return e}async function ux(t){mr(`creating new branch ${(0,$s.yellow)(t)}`),await je().checkoutLocalBranch(t)}var lx=async()=>{if(!await Cg())return Promise.reject("The envs JIRA_DOMAIN or JIRA_AUTHORIZATION not exist. More info in doc")},cx=async()=>{await lx(),await rx(),await sx();let t=await ix(),e=await nx(t);if(!e.length)return Promise.reject("There are not in progress tasks");let r=await ox(e),n=mg(r),o=await ax(n);await ux(o)},cb=cx;var Ti=ie(Bn());var hb=async()=>{let t=await fr(`https://api.github.com/orgs/${process.env.GITHUB_ORGANIZATION}/repos?sort=full_name&per_page=100`,{method:"get",headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!t.ok){let{message:r}=await t.json();return Promise.reject(`Fail to find projects in github -> ${t.statusText}: ${r}`)}return(await t.json()).map(({id:r,name:n})=>({id:r,name:n}))},db=async t=>{let e=await fr(`https://api.github.com/repos/${process.env.GITHUB_ORGANIZATION}/${t.repo}/pulls`,{method:"post",body:JSON.stringify({title:t.title,body:t.body,head:t.head,base:t.base,draft:!0}),headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28",Authorization:`Bearer ${process.env.GITHUB_TOKEN}`}});if(!e.ok){let{message:n}=await e.json();return Promise.reject(`Fail to create PR in github -> ${e.statusText}: ${n}`)}let r=await e.json();return{id:r.id,number:r.number,url:r.html_url,state:r.state,title:r.title,body:r.body,headSha:r.head.sha,head:r.head.ref,baseSha:r.base.sha,base:r.base.ref,repo:r.base.repo.name}};async function hx(){mr("making a git fetch..."),await je().fetch(),Ct("git fetch completed")}var dx=async t=>{let{baseBranch:e}=await(0,Ti.default)({type:"select",name:"baseBranch",message:"What base branch?",choices:t.map(r=>({title:r,value:r}))});return e},fx=async()=>{let{current:t,all:e}=await je().branch();return[t,e]},mx=async()=>{if(!process.env.GITHUB_TOKEN||!process.env.GITHUB_ORGANIZATION)return Promise.reject("The envs GITHUB_TOKEN or GITHUB_ORGANIZATION not exist. More info in doc")},px=async()=>{let{current:t,all:e}=await je().branch();if(!e.find(r=>r===`remotes/origin/${t}`))return Promise.reject("Current branch not found at origin")},gx=async(t,e,r)=>{let{url:n}=await db({title:`${t} pull request`,body:`Esta PR viene de [#000](https://zityhub.atlassian.net/browse/000)
122
120
 
123
121
  ### Descripci\xF3n
124
122
 
@@ -126,12 +124,13 @@ Content-Type: ${u.type||"application/octet-stream"}\r
126
124
 
127
125
  ### Aceptaci\xF3n
128
126
 
127
+ - [ ] Levantar la api \`node --run clean-db:development && node --run dev:debug\`
129
128
  - [ ] Hay que probar....
129
+ - [ ] Revisar c\xF3digo
130
130
 
131
131
  ### Informaci\xF3n extra
132
132
 
133
133
  - M\xE1s info
134
-
135
134
  `,head:t,base:e,repo:r});Ct(n)};function bx(t){let e="remotes/origin/";return t.filter(r=>r.includes(e)).map(r=>r.replace(e,""))}var yx=(t,e)=>e.filter(r=>r!==t),_x=async t=>{let{project:e}=await(0,Ti.default)({type:"select",name:"project",message:"What project?",choices:t.map(({name:r})=>({title:r,value:r}))});return e},wx=async(t,e,r)=>{let{confirmed:n}=await(0,Ti.default)({type:"confirm",name:"confirmed",message:`Do you want to create PR in "${t}" from "${r}" to "${e}"?`});return n},vx=async()=>{await mx(),await hx(),await px();let t=await hb(),e=await _x(t),[r,n]=await fx(),o=bx(n),u=yx(r,o),l=await dx(u);await wx(e,l,r)&&await gx(r,l,e)},fb=vx;var mb=require("ai"),pb=require("@ai-sdk/openai");var Sx=async()=>(await je().diff()).split(`
136
135
  `).filter(e=>e.startsWith("+")&&e.includes("it(")).map(e=>{let r=e.match(/it\(\s*'([^']+)'\s*,/);return r?r[1]:null}).filter(Boolean),Tx=async t=>{let{url:e,token:r,model:n}=await ci(),o=(0,pb.createOpenAI)({baseURL:e,apiKey:r}),{text:u}=await(0,mb.generateText)({model:o(n),system:`Eres un experto en gram\xE1tica y redacci\xF3n en ingl\xE9s. Tu tarea es revisar los nombres de tests unitarios de un
137
136
  proyecto y corregirlos si tienen errores gramaticales o de estilo. Siempre debes responder con una lista numerada en
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mytools-tasks",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "license": "MIT",
5
5
  "repository": "diazdavid-info/my-tools",
6
6
  "author": {
@@ -14,38 +14,31 @@
14
14
  "dist"
15
15
  ],
16
16
  "devDependencies": {
17
- "@types/jest": "30.0.0",
18
17
  "@types/node": "25.6.0",
19
18
  "@types/prompts": "2.4.9",
20
- "@vercel/ncc": "0.38.4",
21
- "jest": "30.3.0",
22
19
  "node-fetch": "3.3.2",
23
20
  "picocolors": "1.1.1",
24
21
  "prettier": "^3.8.3",
25
22
  "prompts": "2.4.2",
26
23
  "rimraf": "6.1.3",
27
24
  "simple-git": "3.36.0",
28
- "ts-jest": "29.4.9",
29
25
  "tsup": "^8.5.1",
30
26
  "typescript": "6.0.3",
31
- "mytools-tsconfig": "0.1.0",
32
- "eslint-config-mytools": "1.0.2"
27
+ "eslint-config-mytools": "1.0.2",
28
+ "mytools-tsconfig": "0.1.0"
33
29
  },
34
30
  "engines": {
35
31
  "node": ">=18.16.0"
36
32
  },
37
33
  "dependencies": {
38
34
  "@ai-sdk/openai": "^3.0.54",
39
- "ai": "^6.0.170",
40
- "zod": "^4.4.1"
35
+ "ai": "^6.0.170"
41
36
  },
42
37
  "scripts": {
43
38
  "build": "rimraf dist && tsup",
44
39
  "clean": "rm -rf node_modules && rm -rf dist",
45
40
  "dev": "tsup --watch",
46
41
  "format": "prettier --write .",
47
- "lint": "eslint index.ts",
48
- "test": "jest",
49
- "test:watch": "jest --watch"
42
+ "lint": "eslint index.ts"
50
43
  }
51
44
  }