@gadgetinc/ggt 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/add-FTY6SEGW.js +78 -0
- package/dist/{add-R6TZAGXK.js.map → add-FTY6SEGW.js.map} +2 -2
- package/dist/chunk-6BALPDKR.js +2 -0
- package/dist/{chunk-3V7YWBUK.js.map → chunk-6BALPDKR.js.map} +2 -2
- package/dist/chunk-B2QVXD4S.js +2 -0
- package/dist/{chunk-B6XQEEUK.js.map → chunk-B2QVXD4S.js.map} +2 -2
- package/dist/chunk-DKP76YB2.js +11 -0
- package/dist/{chunk-HCQR6OPH.js.map → chunk-DKP76YB2.js.map} +2 -2
- package/dist/{chunk-NGYGSK7A.js → chunk-FLX4WQHD.js} +7 -5
- package/dist/chunk-FLX4WQHD.js.map +7 -0
- package/dist/chunk-IOJ2LNUK.js +2 -0
- package/dist/{chunk-SGMPMYEU.js.map → chunk-IOJ2LNUK.js.map} +2 -2
- package/dist/chunk-KXSKHE3X.js +65 -0
- package/dist/chunk-KXSKHE3X.js.map +7 -0
- package/dist/chunk-LMY5YGE5.js +121 -0
- package/dist/chunk-LMY5YGE5.js.map +7 -0
- package/dist/chunk-O3D5GVFK.js +8 -0
- package/dist/{chunk-TMPKLC3N.js.map → chunk-O3D5GVFK.js.map} +2 -2
- package/dist/chunk-P5UB5UJ6.js +6 -0
- package/dist/chunk-P5UB5UJ6.js.map +7 -0
- package/dist/chunk-RLMEA3WE.js +2 -0
- package/dist/{chunk-P5OUQ5XQ.js.map → chunk-RLMEA3WE.js.map} +2 -2
- package/dist/chunk-SWVUOPJX.js +12 -0
- package/dist/{chunk-AGRDDZFS.js.map → chunk-SWVUOPJX.js.map} +2 -2
- package/dist/chunk-VF4CDM7R.js +18 -0
- package/dist/{chunk-AGPFNOXG.js.map → chunk-VF4CDM7R.js.map} +2 -2
- package/dist/chunk-WCP5LTNQ.js +50 -0
- package/dist/{chunk-RIIVR43B.js.map → chunk-WCP5LTNQ.js.map} +4 -4
- package/dist/chunk-YB7NQA2X.js +2 -0
- package/dist/{chunk-NO72UU5F.js.map → chunk-YB7NQA2X.js.map} +2 -2
- package/dist/chunk-ZZIIWV6T.js +187 -0
- package/dist/chunk-ZZIIWV6T.js.map +7 -0
- package/dist/deploy-PQZW3X7G.js +25 -0
- package/dist/{deploy-2SXBPB5C.js.map → deploy-PQZW3X7G.js.map} +2 -2
- package/dist/dev-27YLA4GG.js +58 -0
- package/dist/{dev-I23ZQELT.js.map → dev-27YLA4GG.js.map} +2 -2
- package/dist/esm-RPCDY7LG.js +36 -0
- package/dist/esm-RPCDY7LG.js.map +7 -0
- package/dist/list-OTGSESA6.js +11 -0
- package/dist/{list-ML7QUWEU.js.map → list-OTGSESA6.js.map} +2 -2
- package/dist/login-YOXXXAJN.js +2 -0
- package/dist/logout-5YOHPXGR.js +7 -0
- package/dist/{logout-PPA6JCDY.js.map → logout-5YOHPXGR.js.map} +2 -2
- package/dist/main.js +12 -12
- package/dist/main.js.map +3 -3
- package/dist/{open-5DTFJE26.js → open-QPMDV7ZL.js} +7 -7
- package/dist/{open-5DTFJE26.js.map → open-QPMDV7ZL.js.map} +2 -2
- package/dist/{pull-TC2GVZRD.js → pull-3DUIUAIP.js} +7 -7
- package/dist/pull-3DUIUAIP.js.map +7 -0
- package/dist/push-RS6QHKDD.js +2 -0
- package/dist/status-N3VF5MBE.js +14 -0
- package/dist/{status-2CZXUGSZ.js.map → status-N3VF5MBE.js.map} +2 -2
- package/dist/version-EGM7PLFX.js +11 -0
- package/dist/{version-CXGPMLMK.js.map → version-EGM7PLFX.js.map} +2 -2
- package/dist/whoami-ES6XN3RI.js +7 -0
- package/dist/{whoami-NI52A6U4.js.map → whoami-ES6XN3RI.js.map} +2 -2
- package/package.json +33 -33
- package/dist/add-R6TZAGXK.js +0 -78
- package/dist/chunk-3V7YWBUK.js +0 -2
- package/dist/chunk-AGPFNOXG.js +0 -18
- package/dist/chunk-AGRDDZFS.js +0 -12
- package/dist/chunk-B6XQEEUK.js +0 -2
- package/dist/chunk-E3I3MPQD.js +0 -117
- package/dist/chunk-E3I3MPQD.js.map +0 -7
- package/dist/chunk-FQ2LR3BI.js +0 -6
- package/dist/chunk-FQ2LR3BI.js.map +0 -7
- package/dist/chunk-GIAIN3IJ.js +0 -65
- package/dist/chunk-GIAIN3IJ.js.map +0 -7
- package/dist/chunk-HCQR6OPH.js +0 -11
- package/dist/chunk-IPKFNVOS.js +0 -187
- package/dist/chunk-IPKFNVOS.js.map +0 -7
- package/dist/chunk-NGYGSK7A.js.map +0 -7
- package/dist/chunk-NO72UU5F.js +0 -2
- package/dist/chunk-P5OUQ5XQ.js +0 -2
- package/dist/chunk-RIIVR43B.js +0 -50
- package/dist/chunk-SGMPMYEU.js +0 -2
- package/dist/chunk-TMPKLC3N.js +0 -8
- package/dist/deploy-2SXBPB5C.js +0 -25
- package/dist/dev-I23ZQELT.js +0 -58
- package/dist/esm-46TFUFSK.js +0 -36
- package/dist/esm-46TFUFSK.js.map +0 -7
- package/dist/list-ML7QUWEU.js +0 -11
- package/dist/login-CEGC4DIJ.js +0 -2
- package/dist/logout-PPA6JCDY.js +0 -7
- package/dist/pull-TC2GVZRD.js.map +0 -7
- package/dist/push-DUSAXZ3K.js +0 -2
- package/dist/status-2CZXUGSZ.js +0 -14
- package/dist/version-CXGPMLMK.js +0 -11
- package/dist/whoami-NI52A6U4.js +0 -7
- /package/dist/{login-CEGC4DIJ.js.map → login-YOXXXAJN.js.map} +0 -0
- /package/dist/{push-DUSAXZ3K.js.map → push-RS6QHKDD.js.map} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import{c as Z}from"./chunk-YB7NQA2X.js";import{a as uo,b as co}from"./chunk-P5UB5UJ6.js";import{a as Br,b as Nr,i as Gr}from"./chunk-VF4CDM7R.js";import{a as mt,c as jr,f as _t,g as kt,j as Bt,l as lo,m as Dr,o as be,p as tt,t as Mr,u as we,v as _e,w as Ir,z as Tt}from"./chunk-WCP5LTNQ.js";import{a as Lr}from"./chunk-SWVUOPJX.js";import{$ as X,D as bt,K as wt,P as ve,R as Fr,U as It,X as $r,Z as S,_ as A,b as W,e as J,g as Cr,h as Sr,l as xr,m as Er,t as Or,u as Pr,v as Rr,y as Ar,z as ao}from"./chunk-KXSKHE3X.js";import{a as oo}from"./chunk-B2QVXD4S.js";import{a as n,b as ye,d as it,f as ft,h as T}from"./chunk-IOJ2LNUK.js";var Wr=it(N=>{"use strict";T();var mo=N&&N.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(N,"__esModule",{value:!0});var ho=ye("fs"),go=mo(co()),ht=go.default("@kwsites/file-exists");function yo(t,e,r){ht("checking %s",t);try{let s=ho.statSync(t);return s.isFile()&&e?(ht("[OK] path represents a file"),!0):s.isDirectory()&&r?(ht("[OK] path represents a directory"),!0):(ht("[FAIL] path represents something other than a file or directory"),!1)}catch(s){if(s.code==="ENOENT")return ht("[FAIL] path is not accessible: %o",s),!1;throw ht("[FATAL] %o",s),s}}n(yo,"check");function vo(t,e=N.READABLE){return yo(t,(e&N.FILE)>0,(e&N.FOLDER)>0)}n(vo,"exists");N.exists=vo;N.FILE=1;N.FOLDER=2;N.READABLE=N.FILE+N.FOLDER});var Qr=it(Gt=>{"use strict";T();function bo(t){for(var e in t)Gt.hasOwnProperty(e)||(Gt[e]=t[e])}n(bo,"__export");Object.defineProperty(Gt,"__esModule",{value:!0});bo(Wr())});var xe=it((Nl,Hr)=>{T();function wo(t){r.debug=r,r.default=r,r.coerce=c,r.disable=o,r.enable=i,r.enabled=a,r.humanize=oo(),r.destroy=h,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let m=0;for(let d=0;d<p.length;d++)m=(m<<5)-m+p.charCodeAt(d),m|=0;return r.colors[Math.abs(m)%r.colors.length]}n(e,"selectColor"),r.selectColor=e;function r(p){let m,d=null,g,B;function q(...D){if(!q.enabled)return;let K=q,lt=Number(new Date),me=lt-(m||lt);K.diff=me,K.prev=m,K.curr=lt,m=lt,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let pt=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(vt,he)=>{if(vt==="%%")return"%";pt++;let Mt=r.formatters[he];if(typeof Mt=="function"){let de=D[pt];vt=Mt.call(K,de),D.splice(pt,1),pt--}return vt}),r.formatArgs.call(K,D),(K.log||r.log).apply(K,D)}return n(q,"debug"),q.namespace=p,q.useColors=r.useColors(),q.color=r.selectColor(p),q.extend=s,q.destroy=r.destroy,Object.defineProperty(q,"enabled",{enumerable:!0,configurable:!1,get:n(()=>d!==null?d:(g!==r.namespaces&&(g=r.namespaces,B=r.enabled(p)),B),"get"),set:n(D=>{d=D},"set")}),typeof r.init=="function"&&r.init(q),q}n(r,"createDebug");function s(p,m){let d=r(this.namespace+(typeof m>"u"?":":m)+p);return d.log=this.log,d}n(s,"extend");function i(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let m,d=(typeof p=="string"?p:"").split(/[\s,]+/),g=d.length;for(m=0;m<g;m++)d[m]&&(p=d[m].replace(/\*/g,".*?"),p[0]==="-"?r.skips.push(new RegExp("^"+p.slice(1)+"$")):r.names.push(new RegExp("^"+p+"$")))}n(i,"enable");function o(){let p=[...r.names.map(u),...r.skips.map(u).map(m=>"-"+m)].join(",");return r.enable(""),p}n(o,"disable");function a(p){if(p[p.length-1]==="*")return!0;let m,d;for(m=0,d=r.skips.length;m<d;m++)if(r.skips[m].test(p))return!1;for(m=0,d=r.names.length;m<d;m++)if(r.names[m].test(p))return!0;return!1}n(a,"enabled");function u(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}n(u,"toNamespace");function c(p){return p instanceof Error?p.stack||p.message:p}n(c,"coerce");function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n(h,"destroy"),r.enable(r.load()),r}n(wo,"setup");Hr.exports=wo});var Yr=it((G,Ut)=>{T();G.formatArgs=ko;G.save=To;G.load=Co;G.useColors=_o;G.storage=So();G.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();G.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function _o(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}n(_o,"useColors");function ko(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ut.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(s=r))}),t.splice(s,0,e)}n(ko,"formatArgs");G.log=console.debug||console.log||(()=>{});function To(t){try{t?G.storage.setItem("debug",t):G.storage.removeItem("debug")}catch{}}n(To,"save");function Co(){let t;try{t=G.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}n(Co,"load");function So(){try{return localStorage}catch{}}n(So,"localstorage");Ut.exports=xe()(G);var{formatters:xo}=Ut.exports;xo.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Xr=it((R,Jt)=>{T();var Eo=ye("tty"),qt=ye("util");R.init=jo;R.log=Ao;R.formatArgs=Po;R.save=Fo;R.load=$o;R.useColors=Oo;R.destroy=qt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");R.colors=[6,2,3,4,5,1];try{let t=uo();t&&(t.stderr||t).level>=2&&(R.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}R.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),s=process.env[e];return/^(yes|on|true|enabled)$/i.test(s)?s=!0:/^(no|off|false|disabled)$/i.test(s)?s=!1:s==="null"?s=null:s=Number(s),t[r]=s,t},{});function Oo(){return"colors"in R.inspectOpts?!!R.inspectOpts.colors:Eo.isatty(process.stderr.fd)}n(Oo,"useColors");function Po(t){let{namespace:e,useColors:r}=this;if(r){let s=this.color,i="\x1B[3"+(s<8?s:"8;5;"+s),o=` ${i};1m${e} \x1B[0m`;t[0]=o+t[0].split(`
|
|
2
|
+
`).join(`
|
|
3
|
+
`+o),t.push(i+"m+"+Jt.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Ro()+e+" "+t[0]}n(Po,"formatArgs");function Ro(){return R.inspectOpts.hideDate?"":new Date().toISOString()+" "}n(Ro,"getDate");function Ao(...t){return process.stderr.write(qt.formatWithOptions(R.inspectOpts,...t)+`
|
|
4
|
+
`)}n(Ao,"log");function Fo(t){t?process.env.DEBUG=t:delete process.env.DEBUG}n(Fo,"save");function $o(){return process.env.DEBUG}n($o,"load");function jo(t){t.inspectOpts={};let e=Object.keys(R.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=R.inspectOpts[e[r]]}n(jo,"init");Jt.exports=xe()(R);var{formatters:Kr}=Jt.exports;Kr.o=function(t){return this.inspectOpts.colors=this.useColors,qt.inspect(t,this.inspectOpts).split(`
|
|
5
|
+
`).map(e=>e.trim()).join(" ")};Kr.O=function(t){return this.inspectOpts.colors=this.useColors,qt.inspect(t,this.inspectOpts)}});var Zr=it((Wl,Ee)=>{T();typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ee.exports=Yr():Ee.exports=Xr()});var Pe=it(ot=>{"use strict";T();Object.defineProperty(ot,"__esModule",{value:!0});ot.createDeferred=ot.deferred=void 0;function Oe(){let t,e,r="pending";return{promise:new Promise((i,o)=>{t=i,e=o}),done(i){r==="pending"&&(r="resolved",t(i))},fail(i){r==="pending"&&(r="rejected",e(i))},get fulfilled(){return r!=="pending"},get status(){return r}}}n(Oe,"deferred");ot.deferred=Oe;ot.createDeferred=Oe;ot.default=Oe});T();var Ur=ft(lo(),1);var nl=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ke=n(({problems:t,showFileTypes:e,...r})=>{let s="";for(let[i,o]of Object.entries(t)){s+=A(""),s+=A`• {cyan ${i}} {redBright ${(0,Ur.default)("problem",o.length,!0)}}`;for(let a of o){let[u,...c]=a.message.split(`
|
|
6
|
+
`);s+=S` {red ✖} `,(e??a.type==="SourceFile")&&(s+=S`${po(i)} `),s+=S(u);for(let h of c)s+=A(""),s+=S` ${h}`;for(let h of a.labels)s+=S` {dim ${h}}`;s+=A("")}}return A({...r,content:s})},"sprintProblems"),sl=n(t=>{X(ke(t))},"printProblems"),po=n(t=>{switch(!0){case Or(t):return W.yellowBright("JavaScript");case Pr(t):return W.blue("TypeScript");case Rr(t):return W.magenta("Gelly");default:return W.gray("File")}},"filetype"),il=n(t=>{let e={};for(let r of t){let s=r.node?.apiIdentifier??r.node?.name??"Other";e[s]??=[],e[s].push({type:r.node?.type??"Unknown",severity:r.severity,message:r.message,labels:Dr(r.nodeLabels?.map(i=>i?.identifier)??[])})}return e},"publishIssuesToProblems"),ol=n(t=>{let e={};for(let r of t)e[r.path]??=[],e[r.path].push({type:r.type,severity:r.level,message:r.message,labels:[]});return e},"filesyncProblemsToProblems");T();var qr=class extends kt{static{n(this,"YarnNotFoundError")}isBug=_t.NO;constructor(){super("Yarn not found")}render(){return S`
|
|
7
|
+
Yarn must be installed to sync your application. You can install it by running:
|
|
8
|
+
|
|
9
|
+
$ npm install --global yarn
|
|
10
|
+
|
|
11
|
+
For more information, see: https://classic.yarnpkg.com/en/docs/install
|
|
12
|
+
`}},Nt=class extends kt{constructor(r){super('The ".gadget/sync.json" file was invalid or not found');this.details=r}static{n(this,"UnknownDirectoryError")}isBug=_t.NO;render(){let r=this.details.directory.path;switch(this.details.command){case"add":case"open":case"status":return S`
|
|
13
|
+
A ".gadget/sync.json" file is missing in this directory:
|
|
14
|
+
|
|
15
|
+
${r}
|
|
16
|
+
|
|
17
|
+
In order to use "ggt ${this.details.command}", you must run it within a directory
|
|
18
|
+
that has already been initialized with "ggt dev".
|
|
19
|
+
`;case"dev":return S`
|
|
20
|
+
A ".gadget/sync.json" file is missing in this directory:
|
|
21
|
+
|
|
22
|
+
${r}
|
|
23
|
+
|
|
24
|
+
If you're running "ggt dev" for the first time, we recommend
|
|
25
|
+
using a gadget specific directory like this:
|
|
26
|
+
|
|
27
|
+
ggt dev ~/gadget/${this.details.args["--app"]??"<name>"}
|
|
28
|
+
|
|
29
|
+
To use a non-empty directory without a ".gadget/sync.json" file,
|
|
30
|
+
run "ggt dev" again with the "--allow-unknown-directory" flag:
|
|
31
|
+
|
|
32
|
+
ggt dev ${r} --allow-unknown-directory
|
|
33
|
+
`;default:return S`
|
|
34
|
+
A ".gadget/sync.json" file is missing in this directory:
|
|
35
|
+
|
|
36
|
+
${r}
|
|
37
|
+
|
|
38
|
+
If you're certain you want to use this directory, you can run
|
|
39
|
+
"ggt ${this.details.command}" again with the "--allow-unknown-directory" flag:
|
|
40
|
+
|
|
41
|
+
ggt ${this.details.command} --allow-unknown-directory
|
|
42
|
+
`}}},Jr=class extends kt{constructor(r){super(`Failed to synchronize files after ${r} attempts.`);this.attempts=r}static{n(this,"TooManyMergeAttemptsError")}isBug=_t.MAYBE;render(){return S`
|
|
43
|
+
We merged your local files with your environment's files ${this.attempts} times,
|
|
44
|
+
but your local and environment's files still don't match.
|
|
45
|
+
|
|
46
|
+
Make sure no one else is editing files on your environment, and try again.
|
|
47
|
+
`}},zr=class extends kt{constructor(r){super("This application is not allowed to be deployed due to fatal errors.");this.fatalErrors=r}static{n(this,"DeployDisallowedError")}isBug=_t.MAYBE;render(){let r=A`{red Gadget has detected the following fatal errors with your files:}`;return r+=ke({ensureEmptyLineAbove:!0,problems:this.fatalErrors,showFileTypes:!1}),r+=A({ensureEmptyLineAbove:!0,content:W.red("Please fix these errors and try again.")}),r}},fo=n(t=>(t instanceof tt&&(t=t.cause),xr(t)&&(t=t.errors),Er(t)&&(t=t[0]),Sr(t)&&"message"in t&&Cr(t.message)&&t.message.includes("Files version mismatch")),"isFilesVersionMismatchError"),yl=n((t,e)=>{if(fo(e)){t.log.debug("swallowing files version mismatch",{error:e});return}throw e},"swallowFilesVersionMismatch");T();import Vr from"node:assert";import Te from"node:process";var Se=n(t=>(t=bt(t,{ensureEmptyLineAbove:!0}),It.isInteractive||(X(t.content),X(JSON.stringify(t.choices??t.groupedChoices,void 0,2)),X({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),Te.exit(1)),new Promise(e=>{let r=new Ce({formatChoice:n(s=>s,"formatChoice"),formatSelection:n(s=>s,"formatSelection"),...t});r.on("submit",e),r.on("exit",()=>Te.exit(0)),r.on("abort",()=>Te.exit(0))})),"select"),Ce=class extends Br{static{n(this,"Select")}cursor=0;optionsPerPage=10;options;currentChoices;groupedChoicesTitleIndexMap=new Map;constructor(e){if(super(),this.options=bt(e,{formatChoice:n(r=>r,"formatChoice"),formatSelection:n(r=>r,"formatSelection"),...e}),this.options.choices)this.currentChoices=this.options.choices;else{this.currentChoices=this.options.groupedChoices.flatMap(([s,i])=>i);let r=0;this.options.groupedChoices.forEach(s=>{let[i,o]=s;o.forEach((a,u)=>{u===0&&this.groupedChoicesTitleIndexMap.set(r,i),r++})})}this.render()}get selection(){let e=this.currentChoices[this.cursor];return Vr(e,`choices[${this.cursor}] is not defined`),e}moveCursor(e){this.cursor=e,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render("Cancel (Ctrl+C)"),this.close()}submit(){this.done=!0,this.aborted=!1,this.value=this.selection,this.fire(),this.render(),this.close()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.currentChoices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.currentChoices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.currentChoices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.currentChoices.length),this.render()}_(e,r){if(e===" "){this.submit();return}}render(e){if(this.closed)return;super.render();let r=this.options.content;if(this.done){It.persistPrompt(A({...this.options,content:`${r.trimEnd()} ${this.options.formatChoice(e??this.selection)}`}));return}r+=` ${W.gray("Use arrow keys to move")}
|
|
48
|
+
|
|
49
|
+
`;let s="",{startIndex:i,endIndex:o}=Nr(this.cursor,this.currentChoices.length,this.optionsPerPage);for(let a=i;a<o;a++){let u;this.cursor===a?u=`${Bt.arrowRight} `:a===i&&i>0?u=`${Bt.arrowUp} `:a===o-1&&o<this.currentChoices.length?u=`${Bt.arrowDown} `:u=" ";let c=this.currentChoices[a];Vr(c,`choices[${a}] is not defined`);let h=this.options.formatChoice(c);this.cursor===a&&(h=W.blue.underline(h)),this.groupedChoicesTitleIndexMap.has(a)&&(a!==i&&(s+=`
|
|
50
|
+
`),s+=`${W.grey(this.groupedChoicesTitleIndexMap.get(a))}
|
|
51
|
+
`),s+=`${u}${h}
|
|
52
|
+
`}this.options.indent&&(s=$r(s,this.options.indent)),It.updatePrompt(r+s)}};T();var fe=ft(ao(),1);import wr from"node:assert";import Li from"node:path";T();var ne=ft(Qr(),1),Zt=ft(Zr(),1),ui=ft(Pe(),1),dt=ft(Pe(),1);import{spawn as ka}from"child_process";import{EventEmitter as Ic}from"node:events";var ee=Object.defineProperty,Do=Object.defineProperties,Lo=Object.getOwnPropertyDescriptor,Mo=Object.getOwnPropertyDescriptors,He=Object.getOwnPropertyNames,tn=Object.getOwnPropertySymbols,jn=Object.prototype.hasOwnProperty,Io=Object.prototype.propertyIsEnumerable,en=n((t,e,r)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"__defNormalProp"),z=n((t,e)=>{for(var r in e||(e={}))jn.call(e,r)&&en(t,r,e[r]);if(tn)for(var r of tn(e))Io.call(e,r)&&en(t,r,e[r]);return t},"__spreadValues"),xt=n((t,e)=>Do(t,Mo(e)),"__spreadProps"),f=n((t,e)=>n(function(){return t&&(e=(0,t[He(t)[0]])(t=0)),e},"__init"),"__esm"),Bo=n((t,e)=>n(function(){return e||(0,t[He(t)[0]])((e={exports:{}}).exports,e),e.exports},"__require"),"__commonJS"),P=n((t,e)=>{for(var r in e)ee(t,r,{get:e[r],enumerable:!0})},"__export"),No=n((t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of He(e))!jn.call(t,i)&&i!==r&&ee(t,i,{get:n(()=>e[i],"get"),enumerable:!(s=Lo(e,i))||s.enumerable});return t},"__copyProps"),x=n(t=>No(ee({},"__esModule",{value:!0}),t),"__toCommonJS"),St=n((t,e,r)=>new Promise((s,i)=>{var o=n(c=>{try{u(r.next(c))}catch(h){i(h)}},"fulfilled"),a=n(c=>{try{u(r.throw(c))}catch(h){i(h)}},"rejected"),u=n(c=>c.done?s(c.value):Promise.resolve(c.value).then(o,a),"step");u((r=r.apply(t,e)).next())}),"__async");function Go(...t){let e=new String(t);return re.set(e,t),e}n(Go,"pathspec");function Kt(t){return t instanceof String&&re.has(t)}n(Kt,"isPathSpec");function rn(t){return re.get(t)||[]}n(rn,"toPaths");var re,Rt=f({"src/lib/args/pathspec.ts"(){"use strict";re=new WeakMap}}),rt,st=f({"src/lib/errors/git-error.ts"(){"use strict";rt=class extends Error{static{n(this,"GitError")}constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),At,yt=f({"src/lib/errors/git-response-error.ts"(){"use strict";st(),At=class extends rt{static{n(this,"GitResponseError")}constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),Dn,Ln=f({"src/lib/errors/task-configuration-error.ts"(){"use strict";st(),Dn=class extends rt{static{n(this,"TaskConfigurationError")}constructor(t){super(void 0,t)}}}});function Mn(t){return typeof t=="function"?t:ct}n(Mn,"asFunction");function In(t){return typeof t=="function"&&t!==ct}n(In,"isUserFunction");function Bn(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}n(Bn,"splitOn");function Nn(t,e=0){return Gn(t)&&t.length>e?t[e]:void 0}n(Nn,"first");function ut(t,e=0){if(Gn(t)&&t.length>e)return t[t.length-1-e]}n(ut,"last");function Gn(t){return!!(t&&typeof t.length=="number")}n(Gn,"isArrayLike");function Ft(t="",e=!0,r=`
|
|
53
|
+
`){return t.split(r).reduce((s,i)=>{let o=e?i.trim():i;return o&&s.push(o),s},[])}n(Ft,"toLinesWithContent");function Ye(t,e){return Ft(t,!0).map(r=>e(r))}n(Ye,"forEachLineWithContent");function Ke(t){return(0,ne.exists)(t,ne.FOLDER)}n(Ke,"folderExists");function _(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}n(_,"append");function Un(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}n(Un,"including");function se(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}n(se,"remove");function H(t){return Array.isArray(t)?t:[t]}n(H,"asArray");function qn(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}n(qn,"asCamelCase");function Jn(t){return H(t).map(String)}n(Jn,"asStringArray");function C(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}n(C,"asNumber");function Et(t,e){let r=[];for(let s=0,i=t.length;s<i;s++)r.push(e,t[s]);return r}n(Et,"prefixedArray");function Ot(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}n(Ot,"bufferToString");function zn(t,e){return Object.assign({},...e.map(r=>r in t?{[r]:t[r]}:{}))}n(zn,"pick");function Le(t=0){return new Promise(e=>setTimeout(e,t))}n(Le,"delay");function Me(t){if(t!==!1)return t}n(Me,"orVoid");var gt,ct,$t,ie=f({"src/lib/utils/util.ts"(){"use strict";gt="\0",ct=n(()=>{},"NOOP"),$t=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Y(t,e,r){return e(t)?t:arguments.length>2?r:void 0}n(Y,"filterType");function Xe(t,e){let r=Kt(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}n(Xe,"filterPrimitives");function Ze(t){return!!t&&$t(t)==="[object Object]"}n(Ze,"filterPlainObject");function Vn(t){return typeof t=="function"}n(Vn,"filterFunction");var jt,F,Wn,Xt,tr,Qn=f({"src/lib/utils/argument-filters.ts"(){"use strict";ie(),Rt(),jt=n(t=>Array.isArray(t),"filterArray"),F=n(t=>typeof t=="string","filterString"),Wn=n(t=>Array.isArray(t)&&t.every(F),"filterStringArray"),Xt=n(t=>F(t)||Array.isArray(t)&&t.every(F),"filterStringOrStringArray"),tr=n(t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number","filterHasLength")}}),Ie,Uo=f({"src/lib/utils/exit-codes.ts"(){"use strict";Ie=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Ie||{})}}),Pt,qo=f({"src/lib/utils/git-output-streams.ts"(){"use strict";Pt=class{static{n(this,"GitOutputStreams")}constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new Pt(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),w,nt,Jo=f({"src/lib/utils/line-parser.ts"(){"use strict";w=class{static{n(this,"LineParser")}constructor(t,e){this.matches=[],this.parse=(r,s)=>(this.resetMatches(),this._regExp.every((i,o)=>this.addMatch(i,o,r(o)))?this.useMatches(s,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let s=r&&t.exec(r);return s&&this.pushMatch(e,s),!!s}pushMatch(t,e){this.matches.push(...e.slice(1))}},nt=class extends w{static{n(this,"RemoteLineParser")}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 Hn(...t){let e=process.cwd(),r=Object.assign(z({baseDir:e},Yn),...t.filter(s=>typeof s=="object"&&s));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}n(Hn,"createInstanceConfig");var Yn,zo=f({"src/lib/utils/simple-git-options.ts"(){"use strict";Yn={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function er(t,e=[]){return Ze(t)?Object.keys(t).reduce((r,s)=>{let i=t[s];return Kt(i)?r.push(i):Xe(i,["boolean"])?r.push(s+"="+i):r.push(s),r},e):e}n(er,"appendTaskOptions");function L(t,e=0,r=!1){let s=[];for(let i=0,o=e<0?t.length:e;i<o;i++)"string|number".includes(typeof t[i])&&s.push(String(t[i]));return er(rr(t),s),r||s.push(...Vo(t)),s}n(L,"getTrailingOptions");function Vo(t){let e=typeof ut(t)=="function";return Y(ut(t,e?1:0),jt,[])}n(Vo,"trailingArrayArgument");function rr(t){let e=Vn(ut(t));return Y(ut(t,e?1:0),Ze)}n(rr,"trailingOptionsArgument");function E(t,e=!0){let r=Mn(ut(t));return e||In(r)?r:void 0}n(E,"trailingFunctionArgument");var Wo=f({"src/lib/utils/task-options.ts"(){"use strict";Qn(),ie(),Rt()}});function Be(t,e){return t(e.stdOut,e.stdErr)}n(Be,"callTaskParser");function I(t,e,r,s=!0){return H(r).forEach(i=>{for(let o=Ft(i,s),a=0,u=o.length;a<u;a++){let c=n((h=0)=>{if(!(a+h>=u))return o[a+h]},"line");e.some(({parse:h})=>h(c,t))}}),t}n(I,"parseStringResponse");var Qo=f({"src/lib/utils/task-parser.ts"(){"use strict";ie()}}),Kn={};P(Kn,{ExitCodes:n(()=>Ie,"ExitCodes"),GitOutputStreams:n(()=>Pt,"GitOutputStreams"),LineParser:n(()=>w,"LineParser"),NOOP:n(()=>ct,"NOOP"),NULL:n(()=>gt,"NULL"),RemoteLineParser:n(()=>nt,"RemoteLineParser"),append:n(()=>_,"append"),appendTaskOptions:n(()=>er,"appendTaskOptions"),asArray:n(()=>H,"asArray"),asCamelCase:n(()=>qn,"asCamelCase"),asFunction:n(()=>Mn,"asFunction"),asNumber:n(()=>C,"asNumber"),asStringArray:n(()=>Jn,"asStringArray"),bufferToString:n(()=>Ot,"bufferToString"),callTaskParser:n(()=>Be,"callTaskParser"),createInstanceConfig:n(()=>Hn,"createInstanceConfig"),delay:n(()=>Le,"delay"),filterArray:n(()=>jt,"filterArray"),filterFunction:n(()=>Vn,"filterFunction"),filterHasLength:n(()=>tr,"filterHasLength"),filterPlainObject:n(()=>Ze,"filterPlainObject"),filterPrimitives:n(()=>Xe,"filterPrimitives"),filterString:n(()=>F,"filterString"),filterStringArray:n(()=>Wn,"filterStringArray"),filterStringOrStringArray:n(()=>Xt,"filterStringOrStringArray"),filterType:n(()=>Y,"filterType"),first:n(()=>Nn,"first"),folderExists:n(()=>Ke,"folderExists"),forEachLineWithContent:n(()=>Ye,"forEachLineWithContent"),getTrailingOptions:n(()=>L,"getTrailingOptions"),including:n(()=>Un,"including"),isUserFunction:n(()=>In,"isUserFunction"),last:n(()=>ut,"last"),objectToString:n(()=>$t,"objectToString"),orVoid:n(()=>Me,"orVoid"),parseStringResponse:n(()=>I,"parseStringResponse"),pick:n(()=>zn,"pick"),prefixedArray:n(()=>Et,"prefixedArray"),remove:n(()=>se,"remove"),splitOn:n(()=>Bn,"splitOn"),toLinesWithContent:n(()=>Ft,"toLinesWithContent"),trailingFunctionArgument:n(()=>E,"trailingFunctionArgument"),trailingOptionsArgument:n(()=>rr,"trailingOptionsArgument")});var b=f({"src/lib/utils/index.ts"(){"use strict";Qn(),Uo(),qo(),Jo(),zo(),Wo(),Qo(),ie()}}),Xn={};P(Xn,{CheckRepoActions:n(()=>Ne,"CheckRepoActions"),checkIsBareRepoTask:n(()=>ts,"checkIsBareRepoTask"),checkIsRepoRootTask:n(()=>Zn,"checkIsRepoRootTask"),checkIsRepoTask:n(()=>Ho,"checkIsRepoTask")});function Ho(t){switch(t){case"bare":return ts();case"root":return Zn()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:oe,parser:nr}}n(Ho,"checkIsRepoTask");function Zn(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:oe,parser(e){return/^\.(git)?$/.test(e.trim())}}}n(Zn,"checkIsRepoRootTask");function ts(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:oe,parser:nr}}n(ts,"checkIsBareRepoTask");function Yo(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}n(Yo,"isNotRepoMessage");var Ne,oe,nr,es=f({"src/lib/tasks/check-is-repo.ts"(){"use strict";b(),Ne=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Ne||{}),oe=n(({exitCode:t},e,r,s)=>{if(t===128&&Yo(e))return r(Buffer.from("false"));s(e)},"onError"),nr=n(t=>t.trim()==="true","parser")}});function Ko(t,e){let r=new rs(t),s=t?ss:ns;return Ft(e).forEach(i=>{let o=i.replace(s,"");r.paths.push(o),(is.test(o)?r.folders:r.files).push(o)}),r}n(Ko,"cleanSummaryParser");var rs,ns,ss,is,Xo=f({"src/lib/responses/CleanSummary.ts"(){"use strict";b(),rs=class{static{n(this,"CleanResponse")}constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},ns=/^[a-z]+\s*/i,ss=/^[a-z]+\s+[a-z]+\s*/i,is=/\/$/}}),Ge={};P(Ge,{EMPTY_COMMANDS:n(()=>ae,"EMPTY_COMMANDS"),adhocExecTask:n(()=>os,"adhocExecTask"),configurationErrorTask:n(()=>M,"configurationErrorTask"),isBufferTask:n(()=>us,"isBufferTask"),isEmptyTask:n(()=>cs,"isEmptyTask"),straightThroughBufferTask:n(()=>as,"straightThroughBufferTask"),straightThroughStringTask:n(()=>j,"straightThroughStringTask")});function os(t){return{commands:ae,format:"empty",parser:t}}n(os,"adhocExecTask");function M(t){return{commands:ae,format:"empty",parser(){throw typeof t=="string"?new Dn(t):t}}}n(M,"configurationErrorTask");function j(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}n(j,"straightThroughStringTask");function as(t){return{commands:t,format:"buffer",parser(e){return e}}}n(as,"straightThroughBufferTask");function us(t){return t.format==="buffer"}n(us,"isBufferTask");function cs(t){return t.format==="empty"||!t.commands.length}n(cs,"isEmptyTask");var ae,O=f({"src/lib/tasks/task.ts"(){"use strict";Ln(),ae=[]}}),ls={};P(ls,{CONFIG_ERROR_INTERACTIVE_MODE:n(()=>sr,"CONFIG_ERROR_INTERACTIVE_MODE"),CONFIG_ERROR_MODE_REQUIRED:n(()=>ir,"CONFIG_ERROR_MODE_REQUIRED"),CONFIG_ERROR_UNKNOWN_OPTION:n(()=>or,"CONFIG_ERROR_UNKNOWN_OPTION"),CleanOptions:n(()=>Wt,"CleanOptions"),cleanTask:n(()=>ps,"cleanTask"),cleanWithOptionsTask:n(()=>Zo,"cleanWithOptionsTask"),isCleanOptionsArray:n(()=>ta,"isCleanOptionsArray")});function Zo(t,e){let{cleanMode:r,options:s,valid:i}=ea(t);return r?i.options?(s.push(...e),s.some(sa)?M(sr):ps(r,s)):M(or+JSON.stringify(t)):M(ir)}n(Zo,"cleanWithOptionsTask");function ps(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(s){return Ko(t==="n",s)}}}n(ps,"cleanTask");function ta(t){return Array.isArray(t)&&t.every(e=>ar.has(e))}n(ta,"isCleanOptionsArray");function ea(t){let e,r=[],s={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{ra(i)?(e=i,s.cleanMode=!0):s.options=s.options&&na(r[r.length]=`-${i}`)}),{cleanMode:e,options:r,valid:s}}n(ea,"getCleanOptions");function ra(t){return t==="f"||t==="n"}n(ra,"isCleanMode");function na(t){return/^-[a-z]$/i.test(t)&&ar.has(t.charAt(1))}n(na,"isKnownOption");function sa(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}n(sa,"isInteractiveMode");var sr,ir,or,Wt,ar,fs=f({"src/lib/tasks/clean.ts"(){"use strict";Xo(),b(),O(),sr="Git clean interactive mode is not supported",ir='Git clean mode parameter ("n" or "f") is required',or="Git clean unknown option found in: ",Wt=(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))(Wt||{}),ar=new Set(["i",...Jn(Object.values(Wt))])}});function ia(t){let e=new hs;for(let r of ms(t))e.addValue(r.file,String(r.key),r.value);return e}n(ia,"configListParser");function oa(t,e){let r=null,s=[],i=new Map;for(let o of ms(t,e))o.key===e&&(s.push(r=o.value),i.has(o.file)||i.set(o.file,[]),i.get(o.file).push(r));return{key:e,paths:Array.from(i.keys()),scopes:i,value:r,values:s}}n(oa,"configGetParser");function aa(t){return t.replace(/^(file):/,"")}n(aa,"configFilePath");function*ms(t,e=null){let r=t.split("\0");for(let s=0,i=r.length-1;s<i;){let o=aa(r[s++]),a=r[s++],u=e;if(a.includes(`
|
|
54
|
+
`)){let c=Bn(a,`
|
|
55
|
+
`);u=c[0],a=c[1]}yield{file:o,key:u,value:a}}}n(ms,"configParser");var hs,ua=f({"src/lib/responses/ConfigList.ts"(){"use strict";b(),hs=class{static{n(this,"ConfigList")}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=ut(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let s=this.addFile(t);s.hasOwnProperty(e)?Array.isArray(s[e])?s[e].push(r):s[e]=[s[e],r]:s[e]=r,this._all=void 0}}}});function Re(t,e){return typeof t=="string"&&Ue.hasOwnProperty(t)?t:e}n(Re,"asConfigScope");function ca(t,e,r,s){let i=["config",`--${s}`];return r&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(o){return o}}}n(ca,"addConfigTask");function la(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(s){return oa(s,t)}}}n(la,"getConfigTask");function pa(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return ia(r)}}}n(pa,"listConfigTask");function fa(){return{addConfig(t,e,...r){return this._runTask(ca(t,e,r[0]===!0,Re(r[1],"local")),E(arguments))},getConfig(t,e){return this._runTask(la(t,Re(e,void 0)),E(arguments))},listConfig(...t){return this._runTask(pa(Re(t[0],void 0)),E(arguments))}}}n(fa,"config_default");var Ue,ds=f({"src/lib/tasks/config.ts"(){"use strict";ua(),b(),Ue=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Ue||{})}});function ma(t){return gs.has(t)}n(ma,"isDiffNameStatus");var Ae,gs,ys=f({"src/lib/tasks/diff-name-status.ts"(){"use strict";Ae=(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))(Ae||{}),gs=new Set(Object.values(Ae))}});function ha(...t){return new bs().param(...t)}n(ha,"grepQueryBuilder");function da(t){let e=new Set,r={};return Ye(t,s=>{let[i,o,a]=s.split(gt);e.add(i),(r[i]=r[i]||[]).push({line:C(o),path:i,preview:a})}),{paths:e,results:r}}n(da,"parseGrep");function ga(){return{grep(t){let e=E(arguments),r=L(arguments);for(let i of vs)if(r.includes(i))return this._runTask(M(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=ha().param(t));let s=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:s,format:"utf-8",parser(i){return da(i)}},e)}}}n(ga,"grep_default");var vs,Ct,nn,bs,ws=f({"src/lib/tasks/grep.ts"(){"use strict";b(),O(),vs=["-h"],Ct=Symbol("grepQuery"),bs=class{static{n(this,"GrepQuery")}constructor(){this[nn]=[]}*[(nn=Ct,Symbol.iterator)](){for(let t of this[Ct])yield t}and(...t){return t.length&&this[Ct].push("--and","(",...Et(t,"-e"),")"),this}param(...t){return this[Ct].push(...Et(t,"-e")),this}}}}),_s={};P(_s,{ResetMode:n(()=>Qt,"ResetMode"),getResetMode:n(()=>va,"getResetMode"),resetTask:n(()=>ya,"resetTask")});function ya(t,e){let r=["reset"];return ks(t)&&r.push(`--${t}`),r.push(...e),j(r)}n(ya,"resetTask");function va(t){if(ks(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}n(va,"getResetMode");function ks(t){return Ts.includes(t)}n(ks,"isValidResetMode");var Qt,Ts,Cs=f({"src/lib/tasks/reset.ts"(){"use strict";O(),Qt=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Qt||{}),Ts=Array.from(Object.values(Qt))}});function ba(){return(0,Zt.default)("simple-git")}n(ba,"createLog");function sn(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(s,...i)=>{t(s,...i),r(s,...i)}:t:(s,...i)=>{t(`%s ${s}`,e,...i),r&&r(s,...i)}}n(sn,"prefixedLogger");function wa(t,e,{namespace:r}){if(typeof t=="string")return t;let s=e&&e.namespace||"";return s.startsWith(r)?s.substr(r.length+1):s||r}n(wa,"childLoggerName");function ur(t,e,r,s=ba()){let i=t&&`[${t}]`||"",o=[],a=typeof e=="string"?s.extend(e):e,u=wa(Y(e,F),a,s);return h(r);function c(p,m){return _(o,ur(t,u.replace(/^[^:]+/,p),m,s))}function h(p){let m=p&&`[${p}]`||"",d=a&&sn(a,m)||ct,g=sn(s,`${i} ${m}`,d);return Object.assign(a?d:g,{label:t,sibling:c,info:g,step:h})}}n(ur,"createLogger");var Ss=f({"src/lib/git-logger.ts"(){"use strict";b(),Zt.default.formatters.L=t=>String(tr(t)?t.length:"-"),Zt.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):$t(t)}}),zt,qe,_a=f({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";st(),Ss(),zt=class{static{n(this,"_TasksPendingQueue")}constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let e=zt.getName(t.commands[0]),r=ur(this.logLabel,e);return{task:t,logger:r,name:e}}push(t){let e=this.createProgress(t);return e.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,e),e}fatal(t){for(let[e,{logger:r}]of Array.from(this._queue.entries()))e===t.task?(r.info("Failed %o",t),r("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):r.info("A fatal exception occurred in a previous task, the queue has been purged: %o",t.message),this.complete(e);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let e=this.withProgress(t);if(!e)throw new rt(void 0,"TasksPendingQueue: attempt called for an unknown task");return e.logger("Starting task"),e}static getName(t="empty"){return`task:${t}:${++zt.counter}`}},qe=zt,qe.counter=0}});function at(t,e){return{method:Nn(t.commands)||"",commands:e}}n(at,"pluginContext");function Ta(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}n(Ta,"onErrorReceived");function on(t,e,r,s){return i=>{r("%s received %L bytes",e,i),s("%B",i),t.push(i)}}n(on,"onDataReceived");var Je,Ca=f({"src/lib/runners/git-executor-chain.ts"(){"use strict";st(),O(),b(),_a(),Je=class{static{n(this,"GitExecutorChain")}constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new qe}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))}attemptTask(t){return St(this,null,function*(){let e=yield this._scheduler.next(),r=n(()=>this._queue.complete(t),"onQueueComplete");try{let{logger:s}=this._queue.attempt(t);return yield cs(t)?this.attemptEmptyTask(t,s):this.attemptRemoteTask(t,s)}catch(s){throw this.onFatalException(t,s)}finally{r(),e()}})}onFatalException(t,e){let r=e instanceof rt?Object.assign(e,{task:t}):new rt(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}attemptRemoteTask(t,e){return St(this,null,function*(){let r=this._plugins.exec("spawn.binary","",at(t,t.commands)),s=this._plugins.exec("spawn.args",[...t.commands],at(t,t.commands)),i=yield this.gitResponse(t,r,s,this.outputHandler,e.step("SPAWN")),o=yield this.handleTaskData(t,s,i,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),us(t)?Be(t.parser,o):Be(t.parser,o.asStrings())})}attemptEmptyTask(t,e){return St(this,null,function*(){return e("empty task bypassing child process to call to task's parser"),t.parser(this)})}handleTaskData(t,e,r,s){let{exitCode:i,rejection:o,stdOut:a,stdErr:u}=r;return new Promise((c,h)=>{s("Preparing to handle process response exitCode=%d stdOut=",i);let{error:p}=this._plugins.exec("task.error",{error:o},z(z({},at(t,e)),r));if(p&&t.onError)return s.info("exitCode=%s handling with custom error handler"),t.onError(r,p,m=>{s.info("custom error handler treated as success"),s("custom error returned a %s",$t(m)),c(new Pt(Array.isArray(m)?Buffer.concat(m):m,Buffer.concat(u)))},h);if(p)return s.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,u.length,o),h(p);s.info("retrieving task output complete"),c(new Pt(Buffer.concat(a),Buffer.concat(u)))})}gitResponse(t,e,r,s,i){return St(this,null,function*(){let o=i.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},at(t,t.commands));return new Promise(u=>{let c=[],h=[];i.info("%s %o",e,r),i("%O",a);let p=this._beforeSpawn(t,r);if(p)return u({stdOut:c,stdErr:h,exitCode:9901,rejection:p});this._plugins.exec("spawn.before",void 0,xt(z({},at(t,r)),{kill(d){p=d||p}}));let m=ka(e,r,a);m.stdout.on("data",on(c,"stdOut",i,o.step("stdOut"))),m.stderr.on("data",on(h,"stdErr",i,o.step("stdErr"))),m.on("error",Ta(h,i)),s&&(i("Passing child process stdOut/stdErr to custom outputHandler"),s(e,m.stdout,m.stderr,[...r])),this._plugins.exec("spawn.after",void 0,xt(z({},at(t,r)),{spawned:m,close(d,g){u({stdOut:c,stdErr:h,exitCode:d,rejection:p||g})},kill(d){m.killed||(p=d,m.kill("SIGINT"))}}))})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,xt(z({},at(t,e)),{kill(s){r=s||r}})),r}}}}),xs={};P(xs,{GitExecutor:n(()=>Es,"GitExecutor")});var Es,Sa=f({"src/lib/runners/git-executor.ts"(){"use strict";Ca(),Es=class{static{n(this,"GitExecutor")}constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new Je(this,this._scheduler,this._plugins)}chain(){return new Je(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function xa(t,e,r=ct){let s=n(o=>{r(null,o)},"onSuccess"),i=n(o=>{o?.task===t&&r(o instanceof At?Ea(o):o,void 0)},"onError2");e.then(s,i)}n(xa,"taskCallback");function Ea(t){let e=n(s=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${s} should be GitResponseError.git.${s}, this will no longer be available in version 3`),e=ct},"log");return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(s,i){return i in t||(s[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),s}}n(Ea,"addDeprecationNoticeToError");var Oa=f({"src/lib/task-callback.ts"(){"use strict";yt(),b()}});function an(t,e){return os(r=>{if(!Ke(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}n(an,"changeWorkingDirectoryTask");var Pa=f({"src/lib/tasks/change-working-directory.ts"(){"use strict";b(),O()}});function Fe(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=se(e,"-B")),j(e)}n(Fe,"checkoutTask");function Ra(){return{checkout(){return this._runTask(Fe(L(arguments,1)),E(arguments))},checkoutBranch(t,e){return this._runTask(Fe(["-b",t,e,...L(arguments)]),E(arguments))},checkoutLocalBranch(t){return this._runTask(Fe(["-b",t,...L(arguments)]),E(arguments))}}}n(Ra,"checkout_default");var Aa=f({"src/lib/tasks/checkout.ts"(){"use strict";b(),O()}});function Fa(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}n(Fa,"countObjectsResponse");function $a(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return I(Fa(),[Os],t)}})}}}n($a,"count_objects_default");var Os,ja=f({"src/lib/tasks/count-objects.ts"(){"use strict";b(),Os=new w(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let s=qn(e);t.hasOwnProperty(s)&&(t[s]=C(r))})}});function Da(t){return I({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},Ps,t)}n(Da,"parseCommitResult");var Ps,La=f({"src/lib/parsers/parse-commit.ts"(){"use strict";b(),Ps=[new w(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,s])=>{t.branch=e,t.commit=s,t.root=!!r}),new w(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),s=r.pop();!s||!s.includes("@")||(t.author={email:s.substr(0,s.length-1),name:r.join("<").trim()})}),new w(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,s])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(s,10)||0}),new w(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,s])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(r,10)||0;s==="-"?t.summary.deletions=i:s==="+"&&(t.summary.insertions=i)})]}});function Ma(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Et(t,"-m"),...e,...r],format:"utf-8",parser:Da}}n(Ma,"commitTask");function Ia(){return{commit(e,...r){let s=E(arguments),i=t(e)||Ma(H(e),H(Y(r[0],Xt,[])),[...Y(r[1],jt,[]),...L(arguments,0,!0)]);return this._runTask(i,s)}};function t(e){return!Xt(e)&&M("git.commit: requires the commit message to be supplied as a string/string[]")}}n(Ia,"commit_default");var Ba=f({"src/lib/tasks/commit.ts"(){"use strict";La(),b(),O()}});function Na(){return{firstCommit(){return this._runTask(j(["rev-list","--max-parents=0","HEAD"],!0),E(arguments))}}}n(Na,"first_commit_default");var Ga=f({"src/lib/tasks/first-commit.ts"(){"use strict";b(),O()}});function Ua(t,e){let r=["hash-object",t];return e&&r.push("-w"),j(r,!0)}n(Ua,"hashObjectTask");var qa=f({"src/lib/tasks/hash-object.ts"(){"use strict";O()}});function Ja(t,e,r){let s=String(r).trim(),i;if(i=Rs.exec(s))return new Ht(t,e,!1,i[1]);if(i=As.exec(s))return new Ht(t,e,!0,i[1]);let o="",a=s.split(" ");for(;a.length;)if(a.shift()==="in"){o=a.join(" ");break}return new Ht(t,e,/^re/i.test(s),o)}n(Ja,"parseInit");var Ht,Rs,As,za=f({"src/lib/responses/InitSummary.ts"(){"use strict";Ht=class{static{n(this,"InitSummary")}constructor(t,e,r,s){this.bare=t,this.path=e,this.existing=r,this.gitDir=s}},Rs=/^Init.+ repository in (.+)$/,As=/^Rein.+ in (.+)$/}});function Va(t){return t.includes(cr)}n(Va,"hasBareCommand");function Wa(t=!1,e,r){let s=["init",...r];return t&&!Va(s)&&s.splice(1,0,cr),{commands:s,format:"utf-8",parser(i){return Ja(s.includes("--bare"),e,i)}}}n(Wa,"initTask");var cr,Qa=f({"src/lib/tasks/init.ts"(){"use strict";za(),cr="--bare"}});function lr(t){for(let e=0;e<t.length;e++){let r=pr.exec(t[e]);if(r)return`--${r[1]}`}return""}n(lr,"logFormatFromCommand");function Ha(t){return pr.test(t)}n(Ha,"isLogFormat");var pr,Dt=f({"src/lib/args/log-format.ts"(){"use strict";pr=/^--(stat|numstat|name-only|name-status)(=|$)/}}),Fs,Ya=f({"src/lib/responses/DiffSummary.ts"(){"use strict";Fs=class{static{n(this,"DiffSummary")}constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function $s(t=""){let e=js[t];return r=>I(new Fs,e,r,!1)}n($s,"getDiffParser");var $e,un,cn,ln,js,Ds=f({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Dt(),Ya(),ys(),b(),$e=[new w(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,s=""])=>{t.files.push({file:e.trim(),changes:C(r),insertions:s.replace(/[^+]/g,"").length,deletions:s.replace(/[^-]/g,"").length,binary:!1})}),new w(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,s])=>{t.files.push({file:e.trim(),before:C(r),after:C(s),binary:!0})}),new w(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let s=/(\d+) i/.exec(r),i=/(\d+) d/.exec(r);t.changed=C(e),t.insertions=C(s?.[1]),t.deletions=C(i?.[1])})],un=[new w(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,s])=>{let i=C(e),o=C(r);t.changed++,t.insertions+=i,t.deletions+=o,t.files.push({file:s,changes:i+o,insertions:i,deletions:o,binary:!1})}),new w(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],cn=[new w(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],ln=[new w(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,s,i,o])=>{t.changed++,t.files.push({file:o??s,changes:0,insertions:0,deletions:0,binary:!1,status:Me(ma(e)&&e),from:Me(!!o&&s!==o&&s),similarity:C(r)})})],js={"":$e,"--stat":$e,"--numstat":un,"--name-status":ln,"--name-only":cn}}});function Ka(t,e){return e.reduce((r,s,i)=>(r[s]=t[i]||"",r),Object.create({diff:null}))}n(Ka,"lineBuilder");function Ls(t=hr,e=Ms,r=""){let s=$s(r);return function(i){let o=Ft(i.trim(),!1,fr).map(function(a){let u=a.split(mr),c=Ka(u[0].split(t),e);return u.length>1&&u[1].trim()&&(c.diff=s(u[1])),c});return{all:o,latest:o.length&&o[0]||null,total:o.length}}}n(Ls,"createListLogSummaryParser");var fr,mr,hr,Ms,Is=f({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";b(),Ds(),Dt(),fr="\xF2\xF2\xF2\xF2\xF2\xF2 ",mr=" \xF2\xF2",hr=" \xF2 ",Ms=["hash","date","message","refs","author_name","author_email"]}}),Bs={};P(Bs,{diffSummaryTask:n(()=>Xa,"diffSummaryTask"),validateLogFormatConfig:n(()=>ue,"validateLogFormatConfig")});function Xa(t){let e=lr(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),ue(r)||{commands:r,format:"utf-8",parser:$s(e)}}n(Xa,"diffSummaryTask");function ue(t){let e=t.filter(Ha);if(e.length>1)return M(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return M(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}n(ue,"validateLogFormatConfig");var dr=f({"src/lib/tasks/diff.ts"(){"use strict";Dt(),Ds(),O()}});function Za(t,e){let r=[],s=[];return Object.keys(t).forEach(i=>{r.push(i),s.push(String(t[i]))}),[r,s.join(e)]}n(Za,"prettyFormat");function tu(t){return Object.keys(t).reduce((e,r)=>(r in ze||(e[r]=t[r]),e),{})}n(tu,"userOptions");function Ns(t={},e=[]){let r=Y(t.splitter,F,hr),s=!Xe(t.format)&&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"},[i,o]=Za(s,r),a=[],u=[`--pretty=format:${fr}${o}${mr}`,...e],c=t.n||t["max-count"]||t.maxCount;if(c&&u.push(`--max-count=${c}`),t.from||t.to){let h=t.symmetric!==!1?"...":"..";a.push(`${t.from||""}${h}${t.to||""}`)}return F(t.file)&&u.push("--follow",Go(t.file)),er(tu(t),u),{fields:i,splitter:r,commands:[...u,...a]}}n(Ns,"parseLogOptions");function eu(t,e,r){let s=Ls(t,e,lr(r));return{commands:["log",...r],format:"utf-8",parser:s}}n(eu,"logTask");function ru(){return{log(...r){let s=E(arguments),i=Ns(rr(arguments),Y(arguments[0],jt)),o=e(...r)||ue(i.commands)||t(i);return this._runTask(o,s)}};function t(r){return eu(r.splitter,r.fields,r.commands)}function e(r,s){return F(r)&&F(s)&&M("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}n(ru,"log_default");var ze,Gs=f({"src/lib/tasks/log.ts"(){"use strict";Dt(),Rt(),Is(),b(),O(),dr(),ze=(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))(ze||{})}}),Yt,Us,nu=f({"src/lib/responses/MergeSummary.ts"(){"use strict";Yt=class{static{n(this,"MergeSummaryConflict")}constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},Us=class{static{n(this,"MergeSummaryDetail")}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"}}}}),Ve,qs,su=f({"src/lib/responses/PullSummary.ts"(){"use strict";Ve=class{static{n(this,"PullSummary")}constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},qs=class{static{n(this,"PullFailedSummary")}constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function je(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}n(je,"objectEnumerationResult");function pn(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:C(e&&e[1]||"0"),delta:C(r&&r[1]||"0")}}n(pn,"asObjectCount");var Js,iu=f({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";b(),Js=[new nt(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let s=e.toLowerCase(),i=je(t.remoteMessages);Object.assign(i,{[s]:C(r)})}),new nt(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let s=e.toLowerCase(),i=je(t.remoteMessages);Object.assign(i,{[s]:C(r)})}),new nt(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,s])=>{let i=je(t.remoteMessages);i.total=pn(e),i.reused=pn(r),i.packReused=C(s)})]}});function zs(t,e){return I({remoteMessages:new Ws},Vs,e)}n(zs,"parseRemoteMessages");var Vs,Ws,Qs=f({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";b(),iu(),Vs=[new nt(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Js,new nt([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new nt([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,s])=>{t.remoteMessages.vulnerabilities={count:C(e),summary:r,url:s}})],Ws=class{static{n(this,"RemoteMessageSummary")}constructor(){this.all=[]}}}});function ou(t,e){let r=I(new qs,Hs,[t,e]);return r.message&&r}n(ou,"parsePullErrorResult");var fn,mn,hn,dn,Hs,gn,gr,Ys=f({"src/lib/parsers/parse-pull.ts"(){"use strict";su(),b(),Qs(),fn=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,mn=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,hn=/^(create|delete) mode \d+ (.+)/,dn=[new w(fn,(t,[e,r,s])=>{t.files.push(e),r&&(t.insertions[e]=r.length),s&&(t.deletions[e]=s.length)}),new w(mn,(t,[e,,r,,s])=>r!==void 0||s!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+s||0,!0):!1),new w(hn,(t,[e,r])=>{_(t.files,r),_(e==="create"?t.created:t.deleted,r)})],Hs=[new w(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new w(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new w(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,s,i])=>{t.branch.local=s,t.hash.local=e,t.branch.remote=i,t.hash.remote=r})],gn=n((t,e)=>I(new Ve,dn,[t,e]),"parsePullDetail"),gr=n((t,e)=>Object.assign(new Ve,gn(t,e),zs(t,e)),"parsePullResult")}}),yn,Ks,vn,au=f({"src/lib/parsers/parse-merge.ts"(){"use strict";nu(),b(),Ys(),yn=[new w(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new w(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new Yt(e,r))}),new w(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,s])=>{t.conflicts.push(new Yt(e,r,{deleteRef:s}))}),new w(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new Yt(e,null))}),new w(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Ks=n((t,e)=>Object.assign(vn(t,e),gr(t,e)),"parseMergeResult"),vn=n(t=>I(new Us,yn,t),"parseMergeDetail")}});function bn(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let s=Ks(e,r);if(s.failed)throw new At(s);return s}}:M("Git.merge requires at least one option")}n(bn,"mergeTask");var uu=f({"src/lib/tasks/merge.ts"(){"use strict";yt(),au(),O()}});function cu(t,e,r){let s=r.includes("deleted"),i=r.includes("tag")||/^refs\/tags/.test(t),o=!r.includes("new");return{deleted:s,tag:i,branch:!i,new:!o,alreadyUpdated:o,local:t,remote:e}}n(cu,"pushResultPushedItem");var wn,Xs,_n,lu=f({"src/lib/parsers/parse-push.ts"(){"use strict";b(),Qs(),wn=[new w(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new w(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref=xt(z({},t.ref||{}),{local:e})}),new w(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,s])=>{t.pushed.push(cu(e,r,s))}),new w(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,s])=>{t.branch=xt(z({},t.branch||{}),{local:e,remote:r,remoteName:s})}),new w(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,s,i])=>{t.update={head:{local:e,remote:r},hash:{from:s,to:i}}})],Xs=n((t,e)=>{let r=_n(t,e),s=zs(t,e);return z(z({},r),s)},"parsePushResult"),_n=n((t,e)=>I({pushed:[]},wn,[t,e]),"parsePushDetail")}}),Zs={};P(Zs,{pushTagsTask:n(()=>pu,"pushTagsTask"),pushTask:n(()=>yr,"pushTask")});function pu(t={},e){return _(e,"--tags"),yr(t,e)}n(pu,"pushTagsTask");function yr(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),se(r,"-v"),_(r,"--verbose"),_(r,"--porcelain"),{commands:r,format:"utf-8",parser:Xs}}n(yr,"pushTask");var ti=f({"src/lib/tasks/push.ts"(){"use strict";lu(),b()}});function fu(){return{showBuffer(){let t=["show",...L(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(as(t),E(arguments))},show(){let t=["show",...L(arguments,1)];return this._runTask(j(t),E(arguments))}}}n(fu,"show_default");var mu=f({"src/lib/tasks/show.ts"(){"use strict";b(),O()}}),kn,ei,hu=f({"src/lib/responses/FileStatusSummary.ts"(){"use strict";kn=/^(.+)\0(.+)$/,ei=class{static{n(this,"FileStatusSummary")}constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let s=kn.exec(t)||[null,t,t];this.from=s[2]||"",this.path=s[1]||""}}}}});function Tn(t){let[e,r]=t.split(gt);return{from:r||e,to:e}}n(Tn,"renamedFile");function U(t,e,r){return[`${t}${e}`,r]}n(U,"parser3");function De(t,...e){return e.map(r=>U(t,r,(s,i)=>_(s.conflicted,i)))}n(De,"conflicts");function du(t,e){let r=e.trim();switch(" "){case r.charAt(2):return s(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return s(" ",r.charAt(0),r.substr(2));default:return}function s(i,o,a){let u=`${i}${o}`,c=ri.get(u);c&&c(t,a),u!=="##"&&u!=="!!"&&t.files.push(new ei(a,i,o))}n(s,"data")}n(du,"splitLine");var Cn,ri,ni,gu=f({"src/lib/responses/StatusSummary.ts"(){"use strict";b(),hu(),Cn=class{static{n(this,"StatusSummary")}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}},ri=new Map([U(" ","A",(t,e)=>_(t.created,e)),U(" ","D",(t,e)=>_(t.deleted,e)),U(" ","M",(t,e)=>_(t.modified,e)),U("A"," ",(t,e)=>_(t.created,e)&&_(t.staged,e)),U("A","M",(t,e)=>_(t.created,e)&&_(t.staged,e)&&_(t.modified,e)),U("D"," ",(t,e)=>_(t.deleted,e)&&_(t.staged,e)),U("M"," ",(t,e)=>_(t.modified,e)&&_(t.staged,e)),U("M","M",(t,e)=>_(t.modified,e)&&_(t.staged,e)),U("R"," ",(t,e)=>{_(t.renamed,Tn(e))}),U("R","M",(t,e)=>{let r=Tn(e);_(t.renamed,r),_(t.modified,r.to)}),U("!","!",(t,e)=>{_(t.ignored=t.ignored||[],e)}),U("?","?",(t,e)=>_(t.not_added,e)),...De("A","A","U"),...De("D","D","U"),...De("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,s=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,o=/\.{3}(\S*)/,a=/\son\s([\S]+)$/,u;u=r.exec(e),t.ahead=u&&+u[1]||0,u=s.exec(e),t.behind=u&&+u[1]||0,u=i.exec(e),t.current=u&&u[1],u=o.exec(e),t.tracking=u&&u[1],u=a.exec(e),t.current=u&&u[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),ni=n(function(t){let e=t.split(gt),r=new Cn;for(let s=0,i=e.length;s<i;){let o=e[s++].trim();o&&(o.charAt(0)==="R"&&(o+=gt+(e[s++]||"")),du(r,o))}return r},"parseStatusSummary")}});function yu(t){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...t.filter(r=>!si.includes(r))],parser(r){return ni(r)}}}n(yu,"statusTask");var si,vu=f({"src/lib/tasks/status.ts"(){"use strict";gu(),si=["--null","-z"]}});function te(t=0,e=0,r=0,s="",i=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:s,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}n(te,"versionResponse");function bu(){return te(0,0,0,"",!1)}n(bu,"notInstalledResponse");function wu(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:_u,onError(t,e,r,s){if(t.exitCode===-2)return r(Buffer.from(vr));s(e)}})}}}n(wu,"version_default");function _u(t){return t===vr?bu():I(te(0,0,0,t),ii,t)}n(_u,"versionParser");var vr,ii,ku=f({"src/lib/tasks/version.ts"(){"use strict";b(),vr="installed=false",ii=[new w(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,s,i=""])=>{Object.assign(t,te(C(e),C(r),C(s),i))}),new w(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,s,i=""])=>{Object.assign(t,te(C(e),C(r),s,i))})]}}),oi={};P(oi,{SimpleGitApi:n(()=>We,"SimpleGitApi")});var We,Tu=f({"src/lib/simple-git-api.ts"(){"use strict";Oa(),Pa(),Aa(),ja(),Ba(),ds(),Ga(),ws(),qa(),Qa(),Gs(),uu(),ti(),mu(),vu(),O(),ku(),b(),We=class{static{n(this,"SimpleGitApi")}constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),s=r.push(t);return e&&xa(t,s,e),Object.create(this,{then:{value:s.then.bind(s)},catch:{value:s.catch.bind(s)},_executor:{value:r}})}add(t){return this._runTask(j(["add",...H(t)]),E(arguments))}cwd(t){let e=E(arguments);return typeof t=="string"?this._runTask(an(t,this._executor),e):typeof t?.path=="string"?this._runTask(an(t.path,t.root&&this._executor||void 0),e):this._runTask(M("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Ua(t,e===!0),E(arguments))}init(t){return this._runTask(Wa(t===!0,this._executor.cwd,L(arguments)),E(arguments))}merge(){return this._runTask(bn(L(arguments)),E(arguments))}mergeFromTo(t,e){return F(t)&&F(e)?this._runTask(bn([t,e,...L(arguments)]),E(arguments,!1)):this._runTask(M("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=yr({remote:Y(arguments[0],F),branch:Y(arguments[1],F)},L(arguments));return this._runTask(t,E(arguments))}stash(){return this._runTask(j(["stash",...L(arguments)]),E(arguments))}status(){return this._runTask(yu(L(arguments)),E(arguments))}},Object.assign(We.prototype,Ra(),Ia(),fa(),$a(),Na(),ga(),ru(),fu(),wu())}}),ai={};P(ai,{Scheduler:n(()=>ci,"Scheduler")});var Sn,ci,Cu=f({"src/lib/runners/scheduler.ts"(){"use strict";b(),Ss(),Sn=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,ui.createDeferred)();return{promise:e,done:r,id:t}}})(),ci=class{static{n(this,"Scheduler")}constructor(t=2){this.concurrency=t,this.logger=ur("","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=_(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),se(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=_(this.pending,Sn());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),li={};P(li,{applyPatchTask:n(()=>Su,"applyPatchTask")});function Su(t,e){return j(["apply",...e,...t])}n(Su,"applyPatchTask");var xu=f({"src/lib/tasks/apply-patch.ts"(){"use strict";O()}});function Eu(t,e){return{branch:t,hash:e,success:!0}}n(Eu,"branchDeletionSuccess");function Ou(t){return{branch:t,hash:null,success:!1}}n(Ou,"branchDeletionFailure");var pi,Pu=f({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";pi=class{static{n(this,"BranchDeletionBatch")}constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function fi(t,e){return e===1&&Qe.test(t)}n(fi,"hasBranchDeletionError");var xn,Qe,En,ce,Ru=f({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";Pu(),b(),xn=/(\S+)\s+\(\S+\s([^)]+)\)/,Qe=/^error[^']+'([^']+)'/m,En=[new w(xn,(t,[e,r])=>{let s=Eu(e,r);t.all.push(s),t.branches[e]=s}),new w(Qe,(t,[e])=>{let r=Ou(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ce=n((t,e)=>I(new pi,En,[t,e]),"parseBranchDeletions")}}),mi,Au=f({"src/lib/responses/BranchSummary.ts"(){"use strict";mi=class{static{n(this,"BranchSummaryResult")}constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,s,i){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:s,label:i}}}}});function On(t){return t?t.charAt(0):""}n(On,"branchStatus");function hi(t){return I(new mi,di,t)}n(hi,"parseBranchSummary");var di,Fu=f({"src/lib/parsers/parse-branch.ts"(){"use strict";Au(),b(),di=[new w(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,s,i])=>{t.push(On(e),!0,r,s,i)}),new w(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),(t,[e,r,s,i])=>{t.push(On(e),!1,r,s,i)})]}}),gi={};P(gi,{branchLocalTask:n(()=>ju,"branchLocalTask"),branchTask:n(()=>$u,"branchTask"),containsDeleteBranchCommand:n(()=>yi,"containsDeleteBranchCommand"),deleteBranchTask:n(()=>Lu,"deleteBranchTask"),deleteBranchesTask:n(()=>Du,"deleteBranchesTask")});function yi(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}n(yi,"containsDeleteBranchCommand");function $u(t){let e=yi(t),r=["branch",...t];return r.length===1&&r.push("-a"),r.includes("-v")||r.splice(1,0,"-v"),{format:"utf-8",commands:r,parser(s,i){return e?ce(s,i).all[0]:hi(s)}}}n($u,"branchTask");function ju(){return{format:"utf-8",commands:["branch","-v"],parser:hi}}n(ju,"branchLocalTask");function Du(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,s){return ce(r,s)},onError({exitCode:r,stdOut:s},i,o,a){if(!fi(String(i),r))return a(i);o(s)}}}n(Du,"deleteBranchesTask");function Lu(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(s,i){return ce(s,i).branches[t]},onError({exitCode:s,stdErr:i,stdOut:o},a,u,c){if(!fi(String(a),s))return c(a);throw new At(r.parser(Ot(o),Ot(i)),String(a))}};return r}n(Lu,"deleteBranchTask");var Mu=f({"src/lib/tasks/branch.ts"(){"use strict";yt(),Ru(),Fu(),b()}}),vi,Iu=f({"src/lib/responses/CheckIgnore.ts"(){"use strict";vi=n(t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e),"parseCheckIgnore")}}),bi={};P(bi,{checkIgnoreTask:n(()=>Bu,"checkIgnoreTask")});function Bu(t){return{commands:["check-ignore",...t],format:"utf-8",parser:vi}}n(Bu,"checkIgnoreTask");var Nu=f({"src/lib/tasks/check-ignore.ts"(){"use strict";Iu()}}),wi={};P(wi,{cloneMirrorTask:n(()=>Uu,"cloneMirrorTask"),cloneTask:n(()=>_i,"cloneTask")});function Gu(t){return/^--upload-pack(=|$)/.test(t)}n(Gu,"disallowedCommand");function _i(t,e,r){let s=["clone",...r];return F(t)&&s.push(t),F(e)&&s.push(e),s.find(Gu)?M("git.fetch: potential exploit argument blocked."):j(s)}n(_i,"cloneTask");function Uu(t,e,r){return _(r,"--mirror"),_i(t,e,r)}n(Uu,"cloneMirrorTask");var qu=f({"src/lib/tasks/clone.ts"(){"use strict";O(),b()}});function Ju(t,e){return I({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},ki,[t,e])}n(Ju,"parseFetchResult");var ki,zu=f({"src/lib/parsers/parse-fetch.ts"(){"use strict";b(),ki=[new w(/From (.+)$/,(t,[e])=>{t.remote=e}),new w(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new w(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new w(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new w(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,s,i])=>{t.updated.push({name:s,tracking:i,to:r,from:e})})]}}),Ti={};P(Ti,{fetchTask:n(()=>Wu,"fetchTask")});function Vu(t){return/^--upload-pack(=|$)/.test(t)}n(Vu,"disallowedCommand2");function Wu(t,e,r){let s=["fetch",...r];return t&&e&&s.push(t,e),s.find(Vu)?M("git.fetch: potential exploit argument blocked."):{commands:s,format:"utf-8",parser:Ju}}n(Wu,"fetchTask");var Qu=f({"src/lib/tasks/fetch.ts"(){"use strict";zu(),O()}});function Hu(t){return I({moves:[]},Ci,t)}n(Hu,"parseMoveResult");var Ci,Yu=f({"src/lib/parsers/parse-move.ts"(){"use strict";b(),Ci=[new w(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),Si={};P(Si,{moveTask:n(()=>Ku,"moveTask")});function Ku(t,e){return{commands:["mv","-v",...H(t),e],format:"utf-8",parser:Hu}}n(Ku,"moveTask");var Xu=f({"src/lib/tasks/move.ts"(){"use strict";Yu(),b()}}),xi={};P(xi,{pullTask:n(()=>Zu,"pullTask")});function Zu(t,e,r){let s=["pull",...r];return t&&e&&s.splice(1,0,t,e),{commands:s,format:"utf-8",parser(i,o){return gr(i,o)},onError(i,o,a,u){let c=ou(Ot(i.stdOut),Ot(i.stdErr));if(c)return u(new At(c));u(o)}}}n(Zu,"pullTask");var tc=f({"src/lib/tasks/pull.ts"(){"use strict";yt(),Ys(),b()}});function ec(t){let e={};return Ei(t,([r])=>e[r]={name:r}),Object.values(e)}n(ec,"parseGetRemotes");function rc(t){let e={};return Ei(t,([r,s,i])=>{e.hasOwnProperty(r)||(e[r]={name:r,refs:{fetch:"",push:""}}),i&&s&&(e[r].refs[i.replace(/[^a-z]/g,"")]=s)}),Object.values(e)}n(rc,"parseGetRemotesVerbose");function Ei(t,e){Ye(t,r=>e(r.split(/\s+/)))}n(Ei,"forEach");var nc=f({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";b()}}),Oi={};P(Oi,{addRemoteTask:n(()=>sc,"addRemoteTask"),getRemotesTask:n(()=>ic,"getRemotesTask"),listRemotesTask:n(()=>oc,"listRemotesTask"),remoteTask:n(()=>ac,"remoteTask"),removeRemoteTask:n(()=>uc,"removeRemoteTask")});function sc(t,e,r){return j(["remote","add",...r,t,e])}n(sc,"addRemoteTask");function ic(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?rc:ec}}n(ic,"getRemotesTask");function oc(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),j(e)}n(oc,"listRemotesTask");function ac(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),j(e)}n(ac,"remoteTask");function uc(t){return j(["remote","remove",t])}n(uc,"removeRemoteTask");var cc=f({"src/lib/tasks/remote.ts"(){"use strict";nc(),O()}}),Pi={};P(Pi,{stashListTask:n(()=>lc,"stashListTask")});function lc(t={},e){let r=Ns(t),s=["stash","list",...r.commands,...e],i=Ls(r.splitter,r.fields,lr(s));return ue(s)||{commands:s,format:"utf-8",parser:i}}n(lc,"stashListTask");var pc=f({"src/lib/tasks/stash-list.ts"(){"use strict";Dt(),Is(),dr(),Gs()}}),Ri={};P(Ri,{addSubModuleTask:n(()=>fc,"addSubModuleTask"),initSubModuleTask:n(()=>mc,"initSubModuleTask"),subModuleTask:n(()=>le,"subModuleTask"),updateSubModuleTask:n(()=>hc,"updateSubModuleTask")});function fc(t,e){return le(["add",t,e])}n(fc,"addSubModuleTask");function mc(t){return le(["init",...t])}n(mc,"initSubModuleTask");function le(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),j(e)}n(le,"subModuleTask");function hc(t){return le(["update",...t])}n(hc,"updateSubModuleTask");var dc=f({"src/lib/tasks/sub-module.ts"(){"use strict";O()}});function gc(t,e){let r=isNaN(t),s=isNaN(e);return r!==s?r?1:-1:r?Ai(t,e):0}n(gc,"singleSorted");function Ai(t,e){return t===e?0:t>e?1:-1}n(Ai,"sorted");function yc(t){return t.trim()}n(yc,"trimmed");function Vt(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}n(Vt,"toNumber");var Pn,Fi,vc=f({"src/lib/responses/TagList.ts"(){"use strict";Pn=class{static{n(this,"TagList")}constructor(t,e){this.all=t,this.latest=e}},Fi=n(function(t,e=!1){let r=t.split(`
|
|
56
|
+
`).map(yc).filter(Boolean);e||r.sort(function(i,o){let a=i.split("."),u=o.split(".");if(a.length===1||u.length===1)return gc(Vt(a[0]),Vt(u[0]));for(let c=0,h=Math.max(a.length,u.length);c<h;c++){let p=Ai(Vt(a[c]),Vt(u[c]));if(p)return p}return 0});let s=e?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new Pn(r,s)},"parseTagList")}}),$i={};P($i,{addAnnotatedTagTask:n(()=>_c,"addAnnotatedTagTask"),addTagTask:n(()=>wc,"addTagTask"),tagListTask:n(()=>bc,"tagListTask")});function bc(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return Fi(r,e)}}}n(bc,"tagListTask");function wc(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}n(wc,"addTagTask");function _c(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}n(_c,"addAnnotatedTagTask");var kc=f({"src/lib/tasks/tag.ts"(){"use strict";vc()}}),Tc=Bo({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(Sa(),x(xs)),{SimpleGitApi:s}=(Tu(),x(oi)),{Scheduler:i}=(Cu(),x(ai)),{configurationErrorTask:o}=(O(),x(Ge)),{asArray:a,filterArray:u,filterPrimitives:c,filterString:h,filterStringOrStringArray:p,filterType:m,getTrailingOptions:d,trailingFunctionArgument:g,trailingOptionsArgument:B}=(b(),x(Kn)),{applyPatchTask:q}=(xu(),x(li)),{branchTask:D,branchLocalTask:K,deleteBranchesTask:lt,deleteBranchTask:me}=(Mu(),x(gi)),{checkIgnoreTask:pt}=(Nu(),x(bi)),{checkIsRepoTask:kr}=(es(),x(Xn)),{cloneTask:vt,cloneMirrorTask:he}=(qu(),x(wi)),{cleanWithOptionsTask:Mt,isCleanOptionsArray:de}=(fs(),x(ls)),{diffSummaryTask:Bi}=(dr(),x(Bs)),{fetchTask:Ni}=(Qu(),x(Ti)),{moveTask:Gi}=(Xu(),x(Si)),{pullTask:Ui}=(tc(),x(xi)),{pushTagsTask:qi}=(ti(),x(Zs)),{addRemoteTask:Ji,getRemotesTask:zi,listRemotesTask:Vi,remoteTask:Wi,removeRemoteTask:Qi}=(cc(),x(Oi)),{getResetMode:Hi,resetTask:Yi}=(Cs(),x(_s)),{stashListTask:Ki}=(pc(),x(Pi)),{addSubModuleTask:Xi,initSubModuleTask:Zi,subModuleTask:to,updateSubModuleTask:eo}=(dc(),x(Ri)),{addAnnotatedTagTask:ro,addTagTask:no,tagListTask:so}=(kc(),x($i)),{straightThroughBufferTask:io,straightThroughStringTask:Q}=(O(),x(Ge));function v(l,y){this._plugins=y,this._executor=new r(l.baseDir,new i(l.maxConcurrentProcesses),y),this._trimmed=l.trimmed}n(v,"Git2"),(v.prototype=Object.create(s.prototype)).constructor=v,v.prototype.customBinary=function(l){return this._plugins.reconfigure("binary",l),this},v.prototype.env=function(l,y){return arguments.length===1&&typeof l=="object"?this._executor.env=l:(this._executor.env=this._executor.env||{})[l]=y,this},v.prototype.stashList=function(l){return this._runTask(Ki(B(arguments)||{},u(l)&&l||[]),g(arguments))};function Tr(l,y,k,$){return typeof k!="string"?o(`git.${l}() requires a string 'repoPath'`):y(k,m($,h),d(arguments))}n(Tr,"createCloneTask"),v.prototype.clone=function(){return this._runTask(Tr("clone",vt,...arguments),g(arguments))},v.prototype.mirror=function(){return this._runTask(Tr("mirror",he,...arguments),g(arguments))},v.prototype.mv=function(l,y){return this._runTask(Gi(l,y),g(arguments))},v.prototype.checkoutLatestTag=function(l){var y=this;return this.pull(function(){y.tags(function(k,$){y.checkout($.latest,l)})})},v.prototype.pull=function(l,y,k,$){return this._runTask(Ui(m(l,h),m(y,h),d(arguments)),g(arguments))},v.prototype.fetch=function(l,y){return this._runTask(Ni(m(l,h),m(y,h),d(arguments)),g(arguments))},v.prototype.silent=function(l){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},v.prototype.tags=function(l,y){return this._runTask(so(d(arguments)),g(arguments))},v.prototype.rebase=function(){return this._runTask(Q(["rebase",...d(arguments)]),g(arguments))},v.prototype.reset=function(l){return this._runTask(Yi(Hi(l),d(arguments)),g(arguments))},v.prototype.revert=function(l){let y=g(arguments);return typeof l!="string"?this._runTask(o("Commit must be a string"),y):this._runTask(Q(["revert",...d(arguments,0,!0),l]),y)},v.prototype.addTag=function(l){let y=typeof l=="string"?no(l):o("Git.addTag requires a tag name");return this._runTask(y,g(arguments))},v.prototype.addAnnotatedTag=function(l,y){return this._runTask(ro(l,y),g(arguments))},v.prototype.deleteLocalBranch=function(l,y,k){return this._runTask(me(l,typeof y=="boolean"?y:!1),g(arguments))},v.prototype.deleteLocalBranches=function(l,y,k){return this._runTask(lt(l,typeof y=="boolean"?y:!1),g(arguments))},v.prototype.branch=function(l,y){return this._runTask(D(d(arguments)),g(arguments))},v.prototype.branchLocal=function(l){return this._runTask(K(),g(arguments))},v.prototype.raw=function(l){let y=!Array.isArray(l),k=[].slice.call(y?arguments:l,0);for(let V=0;V<k.length&&y;V++)if(!c(k[V])){k.splice(V,k.length-V);break}k.push(...d(arguments,0,!0));var $=g(arguments);return k.length?this._runTask(Q(k,this._trimmed),$):this._runTask(o("Raw: must supply one or more command to execute"),$)},v.prototype.submoduleAdd=function(l,y,k){return this._runTask(Xi(l,y),g(arguments))},v.prototype.submoduleUpdate=function(l,y){return this._runTask(eo(d(arguments,!0)),g(arguments))},v.prototype.submoduleInit=function(l,y){return this._runTask(Zi(d(arguments,!0)),g(arguments))},v.prototype.subModule=function(l,y){return this._runTask(to(d(arguments)),g(arguments))},v.prototype.listRemote=function(){return this._runTask(Vi(d(arguments)),g(arguments))},v.prototype.addRemote=function(l,y,k){return this._runTask(Ji(l,y,d(arguments)),g(arguments))},v.prototype.removeRemote=function(l,y){return this._runTask(Qi(l),g(arguments))},v.prototype.getRemotes=function(l,y){return this._runTask(zi(l===!0),g(arguments))},v.prototype.remote=function(l,y){return this._runTask(Wi(d(arguments)),g(arguments))},v.prototype.tag=function(l,y){let k=d(arguments);return k[0]!=="tag"&&k.unshift("tag"),this._runTask(Q(k),g(arguments))},v.prototype.updateServerInfo=function(l){return this._runTask(Q(["update-server-info"]),g(arguments))},v.prototype.pushTags=function(l,y){let k=qi({remote:m(l,h)},d(arguments));return this._runTask(k,g(arguments))},v.prototype.rm=function(l){return this._runTask(Q(["rm","-f",...a(l)]),g(arguments))},v.prototype.rmKeepLocal=function(l){return this._runTask(Q(["rm","--cached",...a(l)]),g(arguments))},v.prototype.catFile=function(l,y){return this._catFile("utf-8",arguments)},v.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},v.prototype._catFile=function(l,y){var k=g(y),$=["cat-file"],V=y[0];if(typeof V=="string")return this._runTask(o("Git.catFile: options must be supplied as an array of strings"),k);Array.isArray(V)&&$.push.apply($,V);let ge=l==="buffer"?io($):Q($);return this._runTask(ge,k)},v.prototype.diff=function(l,y){let k=h(l)?o("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):Q(["diff",...d(arguments)]);return this._runTask(k,g(arguments))},v.prototype.diffSummary=function(){return this._runTask(Bi(d(arguments,1)),g(arguments))},v.prototype.applyPatch=function(l){let y=p(l)?q(a(l),d([].slice.call(arguments,1))):o("git.applyPatch requires one or more string patches as the first argument");return this._runTask(y,g(arguments))},v.prototype.revparse=function(){let l=["rev-parse",...d(arguments,!0)];return this._runTask(Q(l,!0),g(arguments))},v.prototype.clean=function(l,y,k){let $=de(l),V=$&&l.join("")||m(l,h)||"",ge=d([].slice.call(arguments,$?1:0));return this._runTask(Mt(V,ge),g(arguments))},v.prototype.exec=function(l){let y={commands:[],format:"utf-8",parser(){typeof l=="function"&&l()}};return this._runTask(y)},v.prototype.clearQueue=function(){return this},v.prototype.checkIgnore=function(l,y){return this._runTask(pt(a(m(l,p,[]))),g(arguments))},v.prototype.checkIsRepo=function(l,y){return this._runTask(kr(m(l,h)),g(arguments))},e.exports=v}});Rt();st();var Cc=class extends rt{static{n(this,"GitConstructError")}constructor(t,e){super(void 0,e),this.config=t}};st();st();var et=class extends rt{static{n(this,"GitPluginError")}constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};yt();Ln();es();fs();ds();ys();ws();Cs();function Sc(t){return t?[{type:"spawn.before",action(s,i){t.aborted&&i.kill(new et(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(s,i){function o(){i.kill(new et(void 0,"abort","Abort signal received"))}n(o,"kill"),t.addEventListener("abort",o),i.spawned.on("close",()=>t.removeEventListener("abort",o))}}]:void 0}n(Sc,"abortPlugin");function xc(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}n(xc,"isConfigSwitch");function Ec(t,e){if(xc(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new et(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}n(Ec,"preventProtocolOverride");function Oc(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new et(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new et(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new et(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}n(Oc,"preventUploadPack");function Pc({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,s){return r.forEach((i,o)=>{let a=o<r.length?r[o+1]:"";t||Ec(i,a),e||Oc(i,s.method)}),r}}}n(Pc,"blockUnsafeOperationsPlugin");b();function Rc(t){let e=Et(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}n(Rc,"commandConfigPrefixingPlugin");b();var Rn=(0,dt.deferred)().promise;function Ac({onClose:t=!0,onExit:e=50}={}){function r(){let i=-1,o={close:(0,dt.deferred)(),closeTimeout:(0,dt.deferred)(),exit:(0,dt.deferred)(),exitTimeout:(0,dt.deferred)()},a=Promise.race([t===!1?Rn:o.closeTimeout.promise,e===!1?Rn:o.exitTimeout.promise]);return s(t,o.close,o.closeTimeout),s(e,o.exit,o.exitTimeout),{close(u){i=u,o.close.done()},exit(u){i=u,o.exit.done()},get exitCode(){return i},result:a}}n(r,"createEvents");function s(i,o,a){i!==!1&&(i===!0?o.promise:o.promise.then(()=>Le(i))).then(a.done)}return n(s,"configureTimeout"),{type:"spawn.after",action(i,o){return St(this,arguments,function*(a,{spawned:u,close:c}){var h,p;let m=r(),d=!0,g=n(()=>void(d=!1),"quickClose");(h=u.stdout)==null||h.on("data",g),(p=u.stderr)==null||p.on("data",g),u.on("error",g),u.on("close",B=>m.close(B)),u.on("exit",B=>m.exit(B));try{yield m.result,d&&(yield Le(50)),c(m.exitCode)}catch(B){c(m.exitCode,B)}})}}}n(Ac,"completionDetectionPlugin");b();var Fc="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",An="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function $c(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}n($c,"isBadArgument");function Fn(t,e){if(t.length<1||t.length>2)throw new et(void 0,"binary",Fc);if(t.some($c))if(e)console.warn(An);else throw new et(void 0,"binary",An);let[s,i]=t;return{binary:s,prefix:i}}n(Fn,"toBinaryConfig");function jc(t,e=["git"],r=!1){let s=Fn(H(e),r);t.on("binary",i=>{s=Fn(H(i),r)}),t.append("spawn.binary",()=>s.binary),t.append("spawn.args",i=>s.prefix?[s.prefix,...i]:i)}n(jc,"customBinaryPlugin");st();function Dc(t){return!!(t.exitCode&&t.stdErr.length)}n(Dc,"isTaskError");function Lc(t){return Buffer.concat([...t.stdOut,...t.stdErr])}n(Lc,"getErrorMessage");function Mc(t=!1,e=Dc,r=Lc){return(s,i)=>!t&&s||!e(i)?s:r(i)}n(Mc,"errorDetectionHandler");function $n(t){return{type:"task.error",action(e,r){let s=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(s)?{error:new rt(void 0,s.toString("utf-8"))}:{error:s}}}}n($n,"errorDetectionPlugin");b();var Bc=class{static{n(this,"PluginStore")}constructor(){this.plugins=new Set,this.events=new Ic}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=_(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return H(t).forEach(r=>r&&this.plugins.add(_(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let s=e,i=Object.freeze(Object.create(r));for(let o of this.plugins)o.type===t&&(s=o.action(s,i));return s}};b();function Nc(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(o,a){return r.includes(a.method)?Un(o,e):o}},{type:"spawn.after",action(o,a){var u;a.commands.includes(e)&&((u=a.spawned.stderr)==null||u.on("data",c=>{let h=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(c.toString("utf8"));h&&t({method:a.method,stage:Gc(h[1]),progress:C(h[2]),processed:C(h[3]),total:C(h[4])})}))}}]}n(Nc,"progressMonitorPlugin");function Gc(t){return String(t.toLowerCase().split(" ",1))||"unknown"}n(Gc,"progressEventStage");b();function Uc(t){let e=zn(t,["uid","gid"]);return{type:"spawn.options",action(r){return z(z({},e),r)}}}n(Uc,"spawnOptionsPlugin");function qc({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(s,i){var o,a;let u;function c(){u&&clearTimeout(u),u=setTimeout(p,t)}n(c,"wait");function h(){var m,d;(m=i.spawned.stdout)==null||m.off("data",c),(d=i.spawned.stderr)==null||d.off("data",c),i.spawned.off("exit",h),i.spawned.off("close",h),u&&clearTimeout(u)}n(h,"stop");function p(){h(),i.kill(new et(void 0,"timeout","block timeout reached"))}n(p,"kill"),r&&((o=i.spawned.stdout)==null||o.on("data",c)),e&&((a=i.spawned.stderr)==null||a.on("data",c)),i.spawned.on("exit",h),i.spawned.on("close",h),c()}}}n(qc,"timeoutPlugin");Rt();function Jc(){return{type:"spawn.args",action(t){let e=[],r;function s(i){(r=r||[]).push(...i)}n(s,"append2");for(let i=0;i<t.length;i++){let o=t[i];if(Kt(o)){s(rn(o));continue}if(o==="--"){s(t.slice(i+1).flatMap(a=>Kt(a)&&rn(a)||a));break}e.push(o)}return r?[...e,"--",...r.map(String)]:e}}}n(Jc,"suffixPathsPlugin");b();var zc=Tc();function Vc(t,e){var r;let s=new Bc,i=Hn(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Ke(i.baseDir))throw new Cc(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&s.add(Rc(i.config)),s.add(Pc(i.unsafe)),s.add(Jc()),s.add(Ac(i.completion)),i.abort&&s.add(Sc(i.abort)),i.progress&&s.add(Nc(i.progress)),i.timeout&&s.add(qc(i.timeout)),i.spawnOptions&&s.add(Uc(i.spawnOptions)),s.add($n(Mc(!0))),i.errors&&s.add($n(i.errors)),jc(s,i.binary,(r=i.unsafe)==null?void 0:r.allowUnsafeCustomBinary),new zc(i,s)}n(Vc,"gitInstanceFactory");yt();var ji=Vc;T();var Di=n((t,e)=>{let r=/^(https:\/\/)?(?<slug>[\w-]+?)(--development)?(\..*)?$/.exec(t)?.groups?.slug;if(r)return r;throw new Z(S`
|
|
57
|
+
${e} must be the application's {bold slug} or {bold URL}
|
|
58
|
+
|
|
59
|
+
{bold EXAMPLES:}
|
|
60
|
+
${e} my-app
|
|
61
|
+
${e} my-app.gadget.app
|
|
62
|
+
${e} https://my-app.gadget.app
|
|
63
|
+
${e} https://my-app.gadget.app/edit
|
|
64
|
+
${e} https://my-app--development.gadget.app/edit
|
|
65
|
+
`)},"AppArg");T();import br from"node:assert";var pe=class{static{n(this,"Edit")}ctx;#t;constructor(e,r){this.ctx=e.child({name:"edit"}),this.#t=new Mr(this.ctx,r,"/edit/api/graphql")}async query({query:e,variables:r,...s}){let i=/query (\w+)/.exec(e)?.[1];br(i,"query name not found");let o=this.ctx.child({name:"edit",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:wt(r)}}});o.log.info("executing graphql query");let a=await this.#t.execute(o,{operation:e,variables:r,...s,http:{retry:{methods:["POST"]},...s.http}});if(a.errors)throw new tt(e,a.errors);if(!a.data)throw new tt(e,"Query response did not contain data");return a.data}async mutate({mutation:e,variables:r,...s}){let i=/mutation (\w+)/.exec(e)?.[1];br(i,"mutation name not found");let o=this.ctx.child({name:"edit",fields:{edit:{mutation:i}},devFields:{edit:{mutation:i,variables:wt(r)}}});o.log.info("executing graphql mutation");let a=await this.#t.execute(o,{operation:e,variables:r,...s});if(a.errors)throw new tt(e,a.errors);if(!a.data)throw new tt(e,"Mutation response did not contain data");return a.data}subscribe({onData:e,...r}){let s=/subscription (\w+)/.exec(r.subscription)?.[1];br(s,"subscription name not found");let i=this.ctx.child({name:"edit",fields:{edit:{subscription:s}},devFields:{edit:{subscription:s,variables:wt(r.variables)}}}),o=n(async u=>{if(u.errors){a(),await r.onError(new tt(r.subscription,u.errors));return}if(!u.data){a(),await r.onError(new tt(r.subscription,"Subscription response did not contain data"));return}await e(u.data)},"onResponse");i.log.info("subscribing to graphql subscription");let a=this.#t.subscribe(i,{...r,onResponse:o});return{unsubscribe:n(()=>{a()},"unsubscribe"),resubscribe:n(u=>{a(),u!==void 0&&(r.variables=u),i=this.ctx.child({name:"edit",fields:{edit:{subscription:s}},devFields:{edit:{subscription:s,variables:wt(r.variables)}}}),i.log.info("re-subscribing to graphql subscription"),a=this.#t.subscribe(i,{...r,onResponse:o})},"resubscribe")}}async dispose(){await this.#t.dispose()}};var mf={"--app":{type:Di,alias:["-a","--application"]},"--env":{type:String,alias:["-e","--environment"]},"--allow-unknown-directory":Boolean,"--allow-different-app":Boolean},_r=class t{constructor(e,r,s,i,o,a){this.ctx=e;this.args=r;this.directory=s;this.environment=i;this.previousEnvironment=o;this.state=a;this.ctx=e.child({name:"sync-json",fields:n(()=>({syncJson:{directory:this.directory.path,branch:this.gitBranch,...this.state}}),"fields")}),this.edit=new pe(this.ctx,this.environment)}static{n(this,"SyncJson")}gitBranch;edit;get filesVersion(){let e=this.state.environments[this.state.environment];return wr(e,"environment must exist in environments"),BigInt(e.filesVersion)}static async load(e,{command:r,args:s,directory:i}){e=e.child({name:"sync-json"});let o=await Gr(e,r),a=await _e(e);if(a.length===0)throw new Z(S`
|
|
66
|
+
You (${o.email}) don't have have any Gadget applications.
|
|
67
|
+
|
|
68
|
+
Visit https://gadget.new to create one!
|
|
69
|
+
`);let u=await fe.default.readFile(i.absolute(".gadget/sync.json"),"utf8").catch(g=>e.log.warn("failed to read .gadget/sync.json",{error:g}));if(!u)return;let c;try{c=Kc.parse(JSON.parse(u))}catch(g){e.log.warn("failed to parse .gadget/sync.json",{error:g,syncJsonFile:u});return}let h=await Mi({args:s,availableApps:a,state:c}),p=await Ii({command:r,args:s,application:h,state:c});if(jr({application_id:h.id,environment_id:p.id}),c.application!==h.slug){if(s["--allow-different-app"]){let g={application:h.slug,environment:p.name,environments:{[p.name]:{filesVersion:"0"}}},B=p.type==="production"?new Lt(e,s,i,p,void 0,g):new t(e,s,i,p,void 0,g);return await B.loadGitBranch(),B}throw new Z(S`
|
|
70
|
+
You were about to sync the following app to the following directory:
|
|
71
|
+
|
|
72
|
+
${h.slug} (${p.name}) → ${i.path}
|
|
73
|
+
|
|
74
|
+
However, that directory has already been synced with this app:
|
|
75
|
+
|
|
76
|
+
${c.application} (${c.environment})
|
|
77
|
+
|
|
78
|
+
If you're sure that you want to sync:
|
|
79
|
+
|
|
80
|
+
${h.slug} (${p.name}) → ${i.path}
|
|
81
|
+
|
|
82
|
+
Run "ggt dev" with the {bold --allow-different-app} flag.
|
|
83
|
+
`)}let m;c.environment!==p.name&&(p.type!=="production"&&X({ensureEmptyLineAbove:!0,content:S`
|
|
84
|
+
Changing environment.
|
|
85
|
+
|
|
86
|
+
${c.environment} → ${p.name}
|
|
87
|
+
`}),m=c.environment,c.environment=p.name,c.environments[p.name]||(c.environments[p.name]={filesVersion:"0"}));let d=p.type==="production"?new Lt(e,s,i,p,m,c):new t(e,s,i,p,m,c);return await d.save(d.filesVersion),await d.loadGitBranch(),d}static async loadOrInit(e,{command:r,args:s,directory:i}){e=e.child({name:"sync-json"});let o=await t.load(e,{command:r,args:s,directory:i});if(o)return o;if(await i.hasFiles()&&!s["--allow-unknown-directory"])throw new Nt({command:r,args:s,directory:i});let a=await Mi({args:s,availableApps:await _e(e)}),u=await Ii({command:r,args:s,application:a});await fe.default.ensureDir(i.path);let c={application:a.slug,environment:u.name,environments:{[u.name]:{filesVersion:"0"}}};return o=u.type==="production"?new Lt(e,s,i,u,void 0,c):new t(e,s,i,u,void 0,c),await o.save(o.filesVersion),await o.loadGitBranch(),o}async save(e){let r=this.state.environments[this.state.environment];wr(r,"environment must exist in environments"),r.filesVersion=String(e),this.ctx.log.debug("saving .gadget/sync.json"),await fe.default.outputJSON(this.directory.absolute(".gadget/sync.json"),this.state,{spaces:2})}async loadGitBranch(){this.gitBranch=await Wc(this.ctx,{directory:this.directory})}sprint(e={}){let r=A`
|
|
88
|
+
Application ${this.environment.application.slug}
|
|
89
|
+
Environment ${this.environment.name}
|
|
90
|
+
`;this.gitBranch&&(r+=A({indent:5,content:`Branch ${this.gitBranch}`}));let s=ve.domains.app;return mt.isSupported?r+=A({ensureEmptyLineAbove:!0,content:`${mt(Tt.link("Preview"),`https://${this.environment.application.slug}--${this.environment.name}.${s}`)} ${mt(Tt.link("Editor"),`https://${this.environment.application.primaryDomain}/edit/${this.environment.name}`)} ${mt(Tt.link("Playground"),`https://${this.environment.application.primaryDomain}/api/playground/javascript?environment=${this.environment.name}`)} ${mt(Tt.link("Docs"),`https://docs.gadget.dev/api/${this.environment.application.slug}`)}`}):r+=A`
|
|
91
|
+
------------------------
|
|
92
|
+
Preview https://${this.environment.application.slug}--${this.environment.name}.${s}
|
|
93
|
+
Editor https://${this.environment.application.primaryDomain}/edit/${this.environment.name}
|
|
94
|
+
Playground https://${this.environment.application.primaryDomain}/api/playground/javascript?environment=${this.environment.name}
|
|
95
|
+
Docs https://docs.gadget.dev/api/${this.environment.application.slug}
|
|
96
|
+
`,A({...e,content:r})}print(e){e=bt(e,{ensureEmptyLineAbove:!0}),X(this.sprint(e))}},Lt=class extends _r{static{n(this,"EphemeralSyncJson")}async save(e){let r=this.state.environments[this.state.environment];return wr(r,"environment must exist in environments"),r.filesVersion=String(e),Promise.resolve()}},hf=n(async t=>{ve.windows&&t.startsWith("~/")&&(t=Fr(t.slice(2)));let e=await Ar(".gadget/sync.json",{cwd:t});return e&&(t=Li.join(e,"../..")),t=Li.resolve(t),await Lr.init(t)},"loadSyncJsonDirectory"),Mi=n(async({args:t,availableApps:e,state:r})=>{let s=t["--app"]||r?.application;if(!s){let a=Array.from(Ir(e)).map(([u,c])=>[u,c.map(h=>h.slug)]);s=await Se({groupedChoices:a,content:"Which application do you want to develop?"})}let i=e.find(a=>a.slug===s);if(i)return i;let o=be(s,e.map(a=>a.slug)).slice(0,5);throw new Z(S`
|
|
97
|
+
Unknown application:
|
|
98
|
+
|
|
99
|
+
${s}
|
|
100
|
+
|
|
101
|
+
Did you mean one of these?
|
|
102
|
+
|
|
103
|
+
• ${o.join(`
|
|
104
|
+
\u2022 `)}
|
|
105
|
+
`)},"loadApplication"),Ii=n(async({command:t,args:e,application:r,state:s})=>{if(e["--env"]&&!r.multiEnvironmentEnabled)throw new Z(S`
|
|
106
|
+
You specified an environment but your app doesn't have multiple environments.
|
|
107
|
+
|
|
108
|
+
Remove the "--env" flag to sync to the {bold ${r.primaryDomain}} environment.
|
|
109
|
+
`);let i=r.environments.filter(c=>c.type===we.Development);t==="pull"&&i.push(...r.environments.filter(c=>c.type===we.Production));let o=e["--env"]||s?.environment;if(o||(o=await Se({choices:i.map(c=>c.name),content:"Which environment do you want to develop on?"})),o.toLowerCase()==="production"&&t!=="pull")throw new Z(S`
|
|
110
|
+
You cannot "ggt ${t}" your {bold production} environment.
|
|
111
|
+
`);let a=i.find(c=>c.name===o.toLowerCase());if(a)return{...a,application:r};let u=be(o,i.map(c=>c.name)).slice(0,5);throw new Z(S`
|
|
112
|
+
Unknown environment:
|
|
113
|
+
|
|
114
|
+
${o}
|
|
115
|
+
|
|
116
|
+
Did you mean one of these?
|
|
117
|
+
|
|
118
|
+
• ${u.join(`
|
|
119
|
+
\u2022 `)}
|
|
120
|
+
`)},"loadEnvironment"),Wc=n(async(t,{directory:e})=>{try{return await ji(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},"loadBranch"),Qc=J.object({application:J.string(),environment:J.string(),environments:J.record(J.object({filesVersion:J.string()}))}),Hc=J.object({app:J.string(),filesVersion:J.string(),mtime:J.number()}),Yc=J.union([Qc,Hc]),Kc=Yc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{nl as a,ke as b,sl as c,il as d,ol as e,qr as f,Nt as g,Jr as h,zr as i,fo as j,yl as k,Se as l,mf as m,_r as n,hf as o};
|
|
121
|
+
//# sourceMappingURL=chunk-LMY5YGE5.js.map
|