@gadgetinc/ggt 2.2.0 → 3.0.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 +392 -307
- package/dist/action-CF6zatIh.js +64 -0
- package/dist/action-CF6zatIh.js.map +1 -0
- package/dist/action-CrDCeX3F.js +8 -0
- package/dist/action-CrDCeX3F.js.map +1 -0
- package/dist/add-Basu3Gyf.js +1 -0
- package/dist/agent-plugin-CqgwTOk-.js +15 -0
- package/dist/agent-plugin-CqgwTOk-.js.map +1 -0
- package/dist/agent-plugin-DU9G5B1d.js +9 -0
- package/dist/agent-plugin-DU9G5B1d.js.map +1 -0
- package/dist/assert-Bu1E126Z.js +2 -0
- package/dist/assert-Bu1E126Z.js.map +1 -0
- package/dist/chunk-BjEoQXZ0.js +1 -0
- package/dist/collection-C2TCeYqY.js +2 -0
- package/dist/collection-C2TCeYqY.js.map +1 -0
- package/dist/collection-aM0fpch0.js +1 -0
- package/dist/command-2iNTc5dV.js +118 -0
- package/dist/command-2iNTc5dV.js.map +1 -0
- package/dist/completion-D96nxD5n.js +37 -0
- package/dist/completion-D96nxD5n.js.map +1 -0
- package/dist/configure-C8ge-2cK.js +15 -0
- package/dist/configure-C8ge-2cK.js.map +1 -0
- package/dist/debugger-BkYgApKn.js +22 -0
- package/dist/debugger-BkYgApKn.js.map +1 -0
- package/dist/defaults-B_eD7Pia.js +2 -0
- package/dist/defaults-B_eD7Pia.js.map +1 -0
- package/dist/deploy-Da6P2HXS.js +15 -0
- package/dist/deploy-Da6P2HXS.js.map +1 -0
- package/dist/dev-DWMSNcLl.js +32 -0
- package/dist/dev-DWMSNcLl.js.map +1 -0
- package/dist/dev-lock-BFanZSu1.js +10 -0
- package/dist/dev-lock-BFanZSu1.js.map +1 -0
- package/dist/directory-CNL03L6c.js +9 -0
- package/dist/directory-CNL03L6c.js.map +1 -0
- package/dist/env-DoWNvHzW.js +62 -0
- package/dist/env-DoWNvHzW.js.map +1 -0
- package/dist/esm-B25i6Etq.js +12 -0
- package/dist/esm-B25i6Etq.js.map +1 -0
- package/dist/esm-CJocZrdd.js +2 -0
- package/dist/esm-CJocZrdd.js.map +1 -0
- package/dist/eval-BceZMSd5.js +27 -0
- package/dist/eval-BceZMSd5.js.map +1 -0
- package/dist/execAsync-DrhcEHLd.js +2 -0
- package/dist/execAsync-DrhcEHLd.js.map +1 -0
- package/dist/filesync-De6asZeR.js +61 -0
- package/dist/filesync-De6asZeR.js.map +1 -0
- package/dist/getMachineId-bsd-Cch8Z6pV.js +2 -0
- package/dist/getMachineId-bsd-Cch8Z6pV.js.map +1 -0
- package/dist/getMachineId-darwin-kbQWK54o.js +3 -0
- package/dist/getMachineId-darwin-kbQWK54o.js.map +1 -0
- package/dist/getMachineId-linux-DdIel6zr.js +2 -0
- package/dist/getMachineId-linux-DdIel6zr.js.map +1 -0
- package/dist/getMachineId-unsupported-Bvmsh30k.js +2 -0
- package/dist/getMachineId-unsupported-Bvmsh30k.js.map +1 -0
- package/dist/getMachineId-win-BteHZe8j.js +2 -0
- package/dist/getMachineId-win-BteHZe8j.js.map +1 -0
- package/dist/ggt-B3HQjQRM.js +3 -0
- package/dist/ggt-B3HQjQRM.js.map +1 -0
- package/dist/handler-DZyG8Sel.js +4 -0
- package/dist/handler-DZyG8Sel.js.map +1 -0
- package/dist/http-CY3lPMkt.js +320 -0
- package/dist/http-CY3lPMkt.js.map +1 -0
- package/dist/indent-string-BVm-4tyL.js +2 -0
- package/dist/indent-string-BVm-4tyL.js.map +1 -0
- package/dist/list-lQKWZ6ZI.js +10 -0
- package/dist/list-lQKWZ6ZI.js.map +1 -0
- package/dist/login-Ce0tByNd.js +1 -0
- package/dist/logout-_sTWeaiQ.js +5 -0
- package/dist/logout-_sTWeaiQ.js.map +1 -0
- package/dist/logs-DbhJzz4M.js +9 -0
- package/dist/logs-DbhJzz4M.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -7
- package/dist/model-CBiMKY0P.js +11 -0
- package/dist/model-CBiMKY0P.js.map +1 -0
- package/dist/ms-B7sMc0pR.js +2 -0
- package/dist/ms-B7sMc0pR.js.map +1 -0
- package/dist/open-CSsA4B-l.js +38 -0
- package/dist/open-CSsA4B-l.js.map +1 -0
- package/dist/p-map-DE0acmRv.js +2 -0
- package/dist/p-map-DE0acmRv.js.map +1 -0
- package/dist/problems-BMLsmxd4.js +11 -0
- package/dist/problems-BMLsmxd4.js.map +1 -0
- package/dist/prompt-C9nwJW0G.js +2 -0
- package/dist/prompt-C9nwJW0G.js.map +1 -0
- package/dist/pull-DpizmJGk.js +12 -0
- package/dist/pull-DpizmJGk.js.map +1 -0
- package/dist/push-67KBCw6c.js +12 -0
- package/dist/push-67KBCw6c.js.map +1 -0
- package/dist/root-D_UnUsp7.js +28 -0
- package/dist/root-D_UnUsp7.js.map +1 -0
- package/dist/select-Dey_sjjd.js +4 -0
- package/dist/select-Dey_sjjd.js.map +1 -0
- package/dist/session-BmzGF1t7.js +2 -0
- package/dist/session-BmzGF1t7.js.map +1 -0
- package/dist/spinner-BVmbgIil.js +8 -0
- package/dist/spinner-BVmbgIil.js.map +1 -0
- package/dist/src-DxCC1MV4.js +6 -0
- package/dist/src-DxCC1MV4.js.map +1 -0
- package/dist/status-P_RFQ7J0.js +13 -0
- package/dist/status-P_RFQ7J0.js.map +1 -0
- package/dist/subscribeToEnvironmentLogs-CUicaiw_.js +2 -0
- package/dist/subscribeToEnvironmentLogs-CUicaiw_.js.map +1 -0
- package/dist/sync-json-V52OzeCz.js +112 -0
- package/dist/sync-json-V52OzeCz.js.map +1 -0
- package/dist/table-MrBbxMay.js +11 -0
- package/dist/table-MrBbxMay.js.map +1 -0
- package/dist/update-CfxiL08e.js +12 -0
- package/dist/update-CfxiL08e.js.map +1 -0
- package/dist/update-iyhnL9-M.js +1 -0
- package/dist/var-ByWcufFt.js +59 -0
- package/dist/var-ByWcufFt.js.map +1 -0
- package/dist/version-B_9GB4u3.js +9 -0
- package/dist/version-B_9GB4u3.js.map +1 -0
- package/dist/whoami-BNcXIfz7.js +5 -0
- package/dist/whoami-BNcXIfz7.js.map +1 -0
- package/package.json +19 -23
- package/assets/favicon-128@4x.png +0 -0
- package/dist/add-TWLGKL2T.js +0 -82
- package/dist/add-TWLGKL2T.js.map +0 -7
- package/dist/agent-plugin-TN24O7FB.js +0 -10
- package/dist/agent-plugin-TN24O7FB.js.map +0 -7
- package/dist/chunk-2742UPMB.js +0 -10
- package/dist/chunk-2742UPMB.js.map +0 -7
- package/dist/chunk-3OM5WM7E.js +0 -2
- package/dist/chunk-3OM5WM7E.js.map +0 -7
- package/dist/chunk-442CSROP.js +0 -66
- package/dist/chunk-442CSROP.js.map +0 -7
- package/dist/chunk-7DYQUG5M.js +0 -2
- package/dist/chunk-7DYQUG5M.js.map +0 -7
- package/dist/chunk-DR4CXBD6.js +0 -11
- package/dist/chunk-DR4CXBD6.js.map +0 -7
- package/dist/chunk-F255O64V.js +0 -2
- package/dist/chunk-F255O64V.js.map +0 -7
- package/dist/chunk-GFQYFEEH.js +0 -2
- package/dist/chunk-GFQYFEEH.js.map +0 -7
- package/dist/chunk-GJGBTM5Y.js +0 -2
- package/dist/chunk-GJGBTM5Y.js.map +0 -7
- package/dist/chunk-HCULGPBH.js +0 -2
- package/dist/chunk-HCULGPBH.js.map +0 -7
- package/dist/chunk-J232VCIM.js +0 -2
- package/dist/chunk-J232VCIM.js.map +0 -7
- package/dist/chunk-JG2QCDK2.js +0 -118
- package/dist/chunk-JG2QCDK2.js.map +0 -7
- package/dist/chunk-JKZNSRLU.js +0 -8
- package/dist/chunk-JKZNSRLU.js.map +0 -7
- package/dist/chunk-JYE5LLIF.js +0 -9
- package/dist/chunk-JYE5LLIF.js.map +0 -7
- package/dist/chunk-KKIL22RY.js +0 -2
- package/dist/chunk-KKIL22RY.js.map +0 -7
- package/dist/chunk-L2XBSR7G.js +0 -2
- package/dist/chunk-L2XBSR7G.js.map +0 -7
- package/dist/chunk-MW6MXMSN.js +0 -2
- package/dist/chunk-MW6MXMSN.js.map +0 -7
- package/dist/chunk-OUIZQC4D.js +0 -12
- package/dist/chunk-OUIZQC4D.js.map +0 -7
- package/dist/chunk-R6KJLEKY.js +0 -28
- package/dist/chunk-R6KJLEKY.js.map +0 -7
- package/dist/chunk-SIR6HLN3.js +0 -69
- package/dist/chunk-SIR6HLN3.js.map +0 -7
- package/dist/chunk-SVWK2NXG.js +0 -2
- package/dist/chunk-SVWK2NXG.js.map +0 -7
- package/dist/chunk-T6UHSWMT.js +0 -2
- package/dist/chunk-T6UHSWMT.js.map +0 -7
- package/dist/chunk-WB6O2V5D.js +0 -11
- package/dist/chunk-WB6O2V5D.js.map +0 -7
- package/dist/chunk-XC4F2TLW.js +0 -113
- package/dist/chunk-XC4F2TLW.js.map +0 -7
- package/dist/chunk-YFUOXDPK.js +0 -10
- package/dist/chunk-YFUOXDPK.js.map +0 -7
- package/dist/chunk-ZSREFZXV.js +0 -211
- package/dist/chunk-ZSREFZXV.js.map +0 -7
- package/dist/chunk-ZYDMXS5R.js +0 -6
- package/dist/chunk-ZYDMXS5R.js.map +0 -7
- package/dist/configure-UJS7V2JX.js +0 -12
- package/dist/configure-UJS7V2JX.js.map +0 -7
- package/dist/debugger-QN2MCLBL.js +0 -41
- package/dist/debugger-QN2MCLBL.js.map +0 -7
- package/dist/deploy-J74PHPQA.js +0 -25
- package/dist/deploy-J74PHPQA.js.map +0 -7
- package/dist/dev-GGUSOOYP.js +0 -59
- package/dist/dev-GGUSOOYP.js.map +0 -7
- package/dist/esm-D77XRR65.js +0 -38
- package/dist/esm-D77XRR65.js.map +0 -7
- package/dist/eval-L6WHUFLU.js +0 -54
- package/dist/eval-L6WHUFLU.js.map +0 -7
- package/dist/getMachineId-bsd-QUXN4NKS.js +0 -2
- package/dist/getMachineId-bsd-QUXN4NKS.js.map +0 -7
- package/dist/getMachineId-darwin-TCXBAX22.js +0 -3
- package/dist/getMachineId-darwin-TCXBAX22.js.map +0 -7
- package/dist/getMachineId-linux-IJ3LYIOX.js +0 -2
- package/dist/getMachineId-linux-IJ3LYIOX.js.map +0 -7
- package/dist/getMachineId-unsupported-IKXBUCYY.js +0 -2
- package/dist/getMachineId-unsupported-IKXBUCYY.js.map +0 -7
- package/dist/getMachineId-win-6CX7VSFF.js +0 -2
- package/dist/getMachineId-win-6CX7VSFF.js.map +0 -7
- package/dist/ggt-5XNRJZSW.js +0 -44
- package/dist/ggt-5XNRJZSW.js.map +0 -7
- package/dist/list-756D46N5.js +0 -11
- package/dist/list-756D46N5.js.map +0 -7
- package/dist/login-GMWQRH7V.js +0 -2
- package/dist/login-GMWQRH7V.js.map +0 -7
- package/dist/logout-LQABTJFD.js +0 -7
- package/dist/logout-LQABTJFD.js.map +0 -7
- package/dist/logs-AQZB272X.js +0 -28
- package/dist/logs-AQZB272X.js.map +0 -7
- package/dist/open-OMZWPQ66.js +0 -74
- package/dist/open-OMZWPQ66.js.map +0 -7
- package/dist/problems-FZJKH52E.js +0 -14
- package/dist/problems-FZJKH52E.js.map +0 -7
- package/dist/pull-XYCYN7QN.js +0 -28
- package/dist/pull-XYCYN7QN.js.map +0 -7
- package/dist/push-3QM7ZFTC.js +0 -2
- package/dist/push-3QM7ZFTC.js.map +0 -7
- package/dist/status-PWAXNK5G.js +0 -14
- package/dist/status-PWAXNK5G.js.map +0 -7
- package/dist/update-QIQFJFRQ.js +0 -2
- package/dist/update-QIQFJFRQ.js.map +0 -7
- package/dist/var-N4WGGJXZ.js +0 -159
- package/dist/var-N4WGGJXZ.js.map +0 -7
- package/dist/version-AJKSJJDC.js +0 -11
- package/dist/version-AJKSJJDC.js.map +0 -7
- package/dist/whoami-KJYDSQSD.js +0 -7
- package/dist/whoami-KJYDSQSD.js.map +0 -7
package/dist/chunk-XC4F2TLW.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import{c as J}from"./chunk-T6UHSWMT.js";import{a as te}from"./chunk-DR4CXBD6.js";import{a as mr}from"./chunk-ZYDMXS5R.js";import{B as br,C as ot,D as kr,E as _r,H as ft,a as nt,b as fr,e as st,f as it,j as hr,k as dr,m as Zt,n as X,o as gr,z as vr}from"./chunk-442CSROP.js";import{a as yr}from"./chunk-OUIZQC4D.js";import{J as ur,K as cr,X as lr,b as K,ca as xt,e as W,g as tr,h as er,ha as Xt,j as rr,ja as pr,n as nr,o as sr,ra as T,sa as $,ta as mt,u as ir,v as or,w as ar}from"./chunk-JG2QCDK2.js";import{a as s,b as Vi,d as Kt,f as V,h as S}from"./chunk-7DYQUG5M.js";var $r=Kt(B=>{"use strict";S();var Xi=B&&B.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(B,"__esModule",{value:!0});var Zi=Vi("fs"),to=Xi(mr()),at=to.default("@kwsites/file-exists");function eo(t,e,r){at("checking %s",t);try{let n=Zi.statSync(t);return n.isFile()&&e?(at("[OK] path represents a file"),!0):n.isDirectory()&&r?(at("[OK] path represents a directory"),!0):(at("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return at("[FAIL] path is not accessible: %o",n),!1;throw at("[FATAL] %o",n),n}}s(eo,"check");function ro(t,e=B.READABLE){return eo(t,(e&B.FILE)>0,(e&B.FOLDER)>0)}s(ro,"exists");B.exists=ro;B.FILE=1;B.FOLDER=2;B.READABLE=B.FILE+B.FOLDER});var jr=Kt(Rt=>{"use strict";S();function no(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}s(no,"__export");Object.defineProperty(Rt,"__esModule",{value:!0});no($r())});var oe=Kt(Z=>{"use strict";S();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ie(){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}}}s(ie,"deferred");Z.deferred=ie;Z.createDeferred=ie;Z.default=ie});S();var wr=V(hr(),1);var Ac=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ee=s(({problems:t,showFileTypes:e,...r})=>{let n="";for(let[i,o]of Object.entries(t)){n+=$(""),n+=$`• {cyan ${i}} {redBright ${(0,wr.default)("problem",o.length,!0)}}`;for(let a of o){let[u,...p]=a.message.split(`
|
|
2
|
-
`);n+=T` {red ✖} `,(e??a.type==="SourceFile")&&(n+=T`${Wi(i)} `),n+=T(u);for(let v of p)n+=$(""),n+=T` ${v}`;for(let v of a.labels)n+=T` {dim ${v}}`;n+=$("")}}return $({...r,content:n})},"sprintProblems"),Ec=s(t=>{mt(ee(t))},"printProblems"),Wi=s(t=>{switch(!0){case ir(t):return K.yellowBright("JavaScript");case or(t):return K.blue("TypeScript");case ar(t):return K.magenta("Gelly");default:return K.gray("File")}},"filetype"),Rc=s(t=>{let e={};for(let r of t){let n=r.node?.apiIdentifier??r.node?.name??"Other";e[n]??=[],e[n].push({type:r.node?.type??"Unknown",severity:r.severity,message:r.message,labels:dr(r.nodeLabels?.map(i=>i?.identifier)??[])})}return e},"publishIssuesToProblems"),Pc=s(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");S();var re=V(hr(),1);var Tr=class extends it{static{s(this,"YarnNotFoundError")}isBug=st.NO;constructor(){super("Yarn not found")}render(){return T`
|
|
3
|
-
Yarn must be installed to sync your application. You can install it by running:
|
|
4
|
-
|
|
5
|
-
$ npm install --global yarn
|
|
6
|
-
|
|
7
|
-
For more information, see: https://classic.yarnpkg.com/en/docs/install
|
|
8
|
-
`}},At=class extends it{constructor(r){super('The ".gadget/sync.json" file was invalid or not found');this.details=r}static{s(this,"UnknownDirectoryError")}isBug=st.NO;render(){let r=this.details.directory.path;switch(this.details.command){case"add":case"open":case"debugger":case"problems":case"status":return T`
|
|
9
|
-
A ".gadget/sync.json" file is missing in this directory:
|
|
10
|
-
|
|
11
|
-
${r}
|
|
12
|
-
|
|
13
|
-
In order to use "ggt ${this.details.command}", you must run it within a directory
|
|
14
|
-
that has already been initialized with "ggt dev".
|
|
15
|
-
`;case"dev":return T`
|
|
16
|
-
A ".gadget/sync.json" file is missing in this directory:
|
|
17
|
-
|
|
18
|
-
${r}
|
|
19
|
-
|
|
20
|
-
If you're running "ggt dev" for the first time, we recommend
|
|
21
|
-
using a gadget specific directory like this:
|
|
22
|
-
|
|
23
|
-
ggt dev ~/gadget/${this.details.args["--app"]??"<name>"}
|
|
24
|
-
|
|
25
|
-
To use a non-empty directory without a ".gadget/sync.json" file,
|
|
26
|
-
run "ggt dev" again with the "--allow-unknown-directory" flag:
|
|
27
|
-
|
|
28
|
-
ggt dev ${r} --allow-unknown-directory
|
|
29
|
-
`;default:return T`
|
|
30
|
-
A ".gadget/sync.json" file is missing in this directory:
|
|
31
|
-
|
|
32
|
-
${r}
|
|
33
|
-
|
|
34
|
-
If you're certain you want to use this directory, you can run
|
|
35
|
-
"ggt ${this.details.command}" again with the "--allow-unknown-directory" flag:
|
|
36
|
-
|
|
37
|
-
ggt ${this.details.command} --allow-unknown-directory
|
|
38
|
-
`}}},Sr=class extends it{constructor(r){super(`Failed to synchronize files after ${r} attempts.`);this.attempts=r}static{s(this,"TooManyMergeAttemptsError")}isBug=st.MAYBE;render(){return T`
|
|
39
|
-
We merged your local files with your environment's files ${this.attempts} times,
|
|
40
|
-
but your local and environment's files still don't match.
|
|
41
|
-
|
|
42
|
-
Make sure no one else is editing files on your environment, and try again.
|
|
43
|
-
`}},xr=class extends it{constructor(r,n){super(`Failed to push local changes to environment after ${(0,re.default)("attempt",r,!0)}.`);this.attempts=r;this.command=n}static{s(this,"TooManyPushAttemptsError")}isBug=st.MAYBE;render(){return T`
|
|
44
|
-
We tried to push your local changes to your environment ${(0,re.default)("time",this.attempts,!0)},
|
|
45
|
-
but your environment's files kept changing since we last checked.
|
|
46
|
-
|
|
47
|
-
Please re-run "ggt ${this.command}" to see the changes and try again.
|
|
48
|
-
`}},Ar=class extends it{constructor(r){super("This application is not allowed to be deployed due to fatal errors.");this.fatalErrors=r}static{s(this,"DeployDisallowedError")}isBug=st.MAYBE;render(){let r=$`{red Gadget has detected the following fatal errors with your files:}`;return r+=ee({ensureEmptyLineAbove:!0,problems:this.fatalErrors,showFileTypes:!1}),r+=$({ensureEmptyLineAbove:!0,content:K.red("Please fix these errors and try again.")}),r}},Hi=s(t=>(t instanceof X&&(t=t.cause),nr(t)&&(t=t.errors),sr(t)&&(t=t[0]),er(t)&&"message"in t&&tr(t.message)&&t.message.includes("Files version mismatch")),"isFilesVersionMismatchError"),Nc=s((t,e)=>{if(Hi(e)){t.log.debug("swallowing files version mismatch",{error:e});return}throw e},"swallowFilesVersionMismatch");S();import ne from"node:assert";var Et=class{static{s(this,"Edit")}ctx;environment;#t;constructor(e,r){this.ctx=e.child({name:"edit"}),this.environment=r,this.#t=new br(this.ctx,r,"/edit/api/graphql")}async query({query:e,variables:r,...n}){let i=/query (\w+)/.exec(e)?.[1];ne(i,"query name not found");let o=this.ctx.child({name:"edit",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:xt(r)}}});o.log.info("executing graphql query");let a=await this.#t.execute(o,{operation:e,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(a.errors)throw new X(e,a.errors);if(!a.data)throw new X(e,"Query response did not contain data");return a.data}async mutate({mutation:e,variables:r,...n}){let i=/mutation (\w+)/.exec(e)?.[1];ne(i,"mutation name not found");let o=this.ctx.child({name:"edit",fields:{edit:{mutation:i}},devFields:{edit:{mutation:i,variables:xt(r)}}});o.log.info("executing graphql mutation");let a=await this.#t.execute(o,{operation:e,variables:r,...n});if(a.errors){let u=a.errors;throw rr(u)&&u[0]==="Unauthenticated. No authenticated client."?new gr(e):new X(e,a.errors)}if(!a.data)throw new X(e,"Mutation response did not contain data");return a.data}subscribe({subscription:e,variables:r,onData:n,onError:i,onComplete:o,retry:a}){let u=/subscription (\w+)/.exec(e)?.[1];ne(u,"subscription name not found");let p=this.ctx.child({name:"edit",fields:{edit:{subscription:u}},devFields:{edit:{subscription:u,variables:xt(r)}}});return p.log.info("subscribing to graphql subscription"),this.#t.subscribe(p,{subscription:e,variables:r,onData:n,onError:i,onComplete:o,retry:a})}async dispose(){await this.#t.dispose()}};S();var Or=V(cr(),1);S();var Er=s((t,e)=>{let r=/^(https:\/\/)?(?<slug>[\w-]+?)(--development)?(\..*)?$/.exec(t)?.groups?.slug;if(r)return r;throw new J(T`
|
|
49
|
-
${e} must be the application's {bold slug} or {bold URL}
|
|
50
|
-
|
|
51
|
-
{bold EXAMPLES:}
|
|
52
|
-
${e} my-app
|
|
53
|
-
${e} my-app.gadget.app
|
|
54
|
-
${e} https://my-app.gadget.app
|
|
55
|
-
${e} https://my-app.gadget.app/edit
|
|
56
|
-
${e} https://my-app--development.gadget.app/edit
|
|
57
|
-
`)},"AppArg");S();var Rr=W.object({application:W.string(),environment:W.string(),environments:W.record(W.string(),W.object({filesVersion:W.string()}))});var se=Rr;var Cr={"--app":{type:Er,alias:["-a","--application"]},"--env":{type:String,alias:["-e","--environment"]}},ht=class t{constructor(e,r,n,i){this.ctx=e;this.args=r;this.environment=n;this.syncJsonState=i;this.ctx=e.child({name:"app-identity"}),this.edit=new Et(this.ctx,this.environment)}static{s(this,"AppIdentity")}edit;static async load(e,{command:r,args:n,directory:i}){e=e.child({name:"app-identity"});let o=await vr(e,r),a=await kr(e);if(a.length===0)throw new J(T`
|
|
58
|
-
You (${o.email}) don't have have any Gadget applications.
|
|
59
|
-
|
|
60
|
-
Visit https://gadget.new to create one!
|
|
61
|
-
`);let u=await Or.default.readFile(i.absolute(".gadget/sync.json"),"utf8").catch(w=>e.log.warn("failed to read .gadget/sync.json",{error:w})),p;if(u)try{p=se.parse(JSON.parse(u))}catch(w){e.log.warn("failed to parse .gadget/sync.json",{error:w,syncJsonFile:u})}let v=await Yi({args:n,availableApps:a,state:p}),g=await Ki({command:r,args:n,application:v,state:p});return fr({application_id:v.id,environment_id:g.id}),new t(e,n,g,p)}get application(){return this.environment.application}},Pr=["pull","logs","eval","var"],Yi=s(async({args:t,availableApps:e,state:r})=>{let n=t["--app"]||r?.application;if(!n){let a=Array.from(_r(e)).map(([u,p])=>[u,p.map(v=>v.slug)]);n=await te({groupedChoices:a,searchable:!0,content:"Which application do you want to develop?"})}let i=e.find(a=>a.slug===n);if(i)return i;let o=Zt(n,e.map(a=>a.slug)).slice(0,5);throw new J(T`
|
|
62
|
-
Unknown application:
|
|
63
|
-
|
|
64
|
-
${n}
|
|
65
|
-
|
|
66
|
-
Did you mean one of these?
|
|
67
|
-
|
|
68
|
-
• ${o.join(`
|
|
69
|
-
\u2022 `)}
|
|
70
|
-
`)},"loadApplication"),Ki=s(async({command:t,args:e,application:r,state:n})=>{let i=r.environments.filter(p=>p.type===ot.Development);Pr.includes(t)&&i.push(...r.environments.filter(p=>p.type===ot.Production));let o=e["--env"]||n?.environment;if(o||(o=await te({choices:i.map(p=>p.name),content:"Which environment do you want to develop on?"})),o.toLowerCase()==="production"&&!Pr.includes(t))throw new J(T`
|
|
71
|
-
You cannot "ggt ${t}" your {bold production} environment.
|
|
72
|
-
`);let a=i.find(p=>p.name===o.toLowerCase());if(a)return{...a,application:r};let u=Zt(o,i.map(p=>p.name)).slice(0,5);throw new J(T`
|
|
73
|
-
Unknown environment:
|
|
74
|
-
|
|
75
|
-
${o}
|
|
76
|
-
|
|
77
|
-
Did you mean one of these?
|
|
78
|
-
|
|
79
|
-
• ${u.join(`
|
|
80
|
-
\u2022 `)}
|
|
81
|
-
`)},"loadEnvironment");S();var Ye=V(cr(),1);import Ke from"node:assert";import fi from"node:path";S();var Nt=V(jr(),1),Bt=V(mr(),1),Is=V(oe(),1),ut=V(oe(),1);import{Buffer as co}from"node:buffer";import{spawn as Qo}from"child_process";import{normalize as uu}from"node:path";import{EventEmitter as pc}from"node:events";var Ee=Object.defineProperty,so=Object.getOwnPropertyDescriptor,Re=Object.getOwnPropertyNames,io=Object.prototype.hasOwnProperty,l=s((t,e)=>s(function(){return t&&(e=(0,t[Re(t)[0]])(t=0)),e},"__init"),"__esm"),oo=s((t,e)=>s(function(){return e||(0,t[Re(t)[0]])((e={exports:{}}).exports,e),e.exports},"__require"),"__commonJS"),R=s((t,e)=>{for(var r in e)Ee(t,r,{get:e[r],enumerable:!0})},"__export"),ao=s((t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Re(e))!io.call(t,i)&&i!==r&&Ee(t,i,{get:s(()=>e[i],"get"),enumerable:!(n=so(e,i))||n.enumerable});return t},"__copyProps"),x=s(t=>ao(Ee({},"__esModule",{value:!0}),t),"__toCommonJS");function uo(...t){let e=new String(t);return It.set(e,t),e}s(uo,"pathspec");function Dt(t){return t instanceof String&&It.has(t)}s(Dt,"isPathSpec");function Dr(t){return It.get(t)||[]}s(Dr,"toPaths");var It,vt=l({"src/lib/args/pathspec.ts"(){"use strict";It=new WeakMap}}),Q,Y=l({"src/lib/errors/git-error.ts"(){"use strict";Q=class extends Error{static{s(this,"GitError")}constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),bt,lt=l({"src/lib/errors/git-response-error.ts"(){"use strict";Y(),bt=class extends Q{static{s(this,"GitResponseError")}constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),mn,fn=l({"src/lib/errors/task-configuration-error.ts"(){"use strict";Y(),mn=class extends Q{static{s(this,"TaskConfigurationError")}constructor(t){super(void 0,t)}}}});function hn(t){return typeof t!="function"?rt:t}s(hn,"asFunction");function dn(t){return typeof t=="function"&&t!==rt}s(dn,"isUserFunction");function gn(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}s(gn,"splitOn");function yn(t,e=0){return vn(t)&&t.length>e?t[e]:void 0}s(yn,"first");function et(t,e=0){if(vn(t)&&t.length>e)return t[t.length-1-e]}s(et,"last");function vn(t){return Jt(t)}s(vn,"isArrayLike");function kt(t="",e=!0,r=`
|
|
82
|
-
`){return t.split(r).reduce((n,i)=>{let o=e?i.trim():i;return o&&n.push(o),n},[])}s(kt,"toLinesWithContent");function Pe(t,e){return kt(t,!0).map(r=>e(r))}s(Pe,"forEachLineWithContent");function Oe(t){return(0,Nt.exists)(t,Nt.FOLDER)}s(Oe,"folderExists");function N(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}s(N,"append");function bn(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}s(bn,"including");function Gt(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}s(Gt,"remove");function q(t){return Array.isArray(t)?t:[t]}s(q,"asArray");function kn(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}s(kn,"asCamelCase");function pt(t){return q(t).map(e=>e instanceof String?e:String(e))}s(pt,"asStringArray");function _(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}s(_,"asNumber");function gt(t,e){let r=[];for(let n=0,i=t.length;n<i;n++)r.push(e,t[n]);return r}s(gt,"prefixedArray");function yt(t){return(Array.isArray(t)?co.concat(t):t).toString("utf-8")}s(yt,"bufferToString");function _n(t,e){let r={};return e.forEach(n=>{t[n]!==void 0&&(r[n]=t[n])}),r}s(_n,"pick");function fe(t=0){return new Promise(e=>setTimeout(e,t))}s(fe,"delay");function he(t){if(t!==!1)return t}s(he,"orVoid");var ct,rt,_t,Ut=l({"src/lib/utils/util.ts"(){"use strict";Ce(),ct="\0",rt=s(()=>{},"NOOP"),_t=Object.prototype.toString.call.bind(Object.prototype.toString)}});function I(t,e,r){return e(t)?t:arguments.length>2?r:void 0}s(I,"filterType");function de(t,e){let r=Dt(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}s(de,"filterPrimitives");function qt(t){return!!t&&_t(t)==="[object Object]"}s(qt,"filterPlainObject");function wn(t){return typeof t=="function"}s(wn,"filterFunction");var wt,Tn,O,Lt,Jt,Ce=l({"src/lib/utils/argument-filters.ts"(){"use strict";vt(),Ut(),wt=s(t=>Array.isArray(t),"filterArray"),Tn=s(t=>typeof t=="number","filterNumber"),O=s(t=>typeof t=="string","filterString"),Lt=s(t=>O(t)||Array.isArray(t)&&t.every(O),"filterStringOrStringArray"),Jt=s(t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number","filterHasLength")}}),ge,lo=l({"src/lib/utils/exit-codes.ts"(){"use strict";ge=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(ge||{})}}),Mt,po=l({"src/lib/utils/git-output-streams.ts"(){"use strict";Mt=class Sn{static{s(this,"_GitOutputStreams")}constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new Sn(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function mo(){throw new Error("LineParser:useMatches not implemented")}s(mo,"useMatchesDefault");var d,H,fo=l({"src/lib/utils/line-parser.ts"(){"use strict";d=class{static{s(this,"LineParser")}constructor(t,e){this.matches=[],this.useMatches=mo,this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((i,o)=>this.addMatch(i,o,r(o)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},H=class extends d{static{s(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 xn(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...An},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}s(xn,"createInstanceConfig");var An,ho=l({"src/lib/utils/simple-git-options.ts"(){"use strict";An={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function $e(t,e=[]){return qt(t)?Object.keys(t).reduce((r,n)=>{let i=t[n];if(Dt(i))r.push(i);else if(de(i,["boolean"]))r.push(n+"="+i);else if(Array.isArray(i))for(let o of i)de(o,["string","number"])||r.push(n+"="+o);else r.push(n);return r},e):e}s($e,"appendTaskOptions");function D(t,e=0,r=!1){let n=[];for(let i=0,o=e<0?t.length:e;i<o;i++)"string|number".includes(typeof t[i])&&n.push(String(t[i]));return $e(je(t),n),r||n.push(...go(t)),n}s(D,"getTrailingOptions");function go(t){let e=typeof et(t)=="function";return pt(I(et(t,e?1:0),wt,[]))}s(go,"trailingArrayArgument");function je(t){let e=wn(et(t));return I(et(t,e?1:0),qt)}s(je,"trailingOptionsArgument");function A(t,e=!0){let r=hn(et(t));return e||dn(r)?r:void 0}s(A,"trailingFunctionArgument");var yo=l({"src/lib/utils/task-options.ts"(){"use strict";Ce(),Ut(),vt()}});function ye(t,e){return t(e.stdOut,e.stdErr)}s(ye,"callTaskParser");function M(t,e,r,n=!0){return q(r).forEach(i=>{for(let o=kt(i,n),a=0,u=o.length;a<u;a++){let p=s((v=0)=>{if(!(a+v>=u))return o[a+v]},"line");e.some(({parse:v})=>v(p,t))}}),t}s(M,"parseStringResponse");var vo=l({"src/lib/utils/task-parser.ts"(){"use strict";Ut()}}),En={};R(En,{ExitCodes:s(()=>ge,"ExitCodes"),GitOutputStreams:s(()=>Mt,"GitOutputStreams"),LineParser:s(()=>d,"LineParser"),NOOP:s(()=>rt,"NOOP"),NULL:s(()=>ct,"NULL"),RemoteLineParser:s(()=>H,"RemoteLineParser"),append:s(()=>N,"append"),appendTaskOptions:s(()=>$e,"appendTaskOptions"),asArray:s(()=>q,"asArray"),asCamelCase:s(()=>kn,"asCamelCase"),asFunction:s(()=>hn,"asFunction"),asNumber:s(()=>_,"asNumber"),asStringArray:s(()=>pt,"asStringArray"),bufferToString:s(()=>yt,"bufferToString"),callTaskParser:s(()=>ye,"callTaskParser"),createInstanceConfig:s(()=>xn,"createInstanceConfig"),delay:s(()=>fe,"delay"),filterArray:s(()=>wt,"filterArray"),filterFunction:s(()=>wn,"filterFunction"),filterHasLength:s(()=>Jt,"filterHasLength"),filterNumber:s(()=>Tn,"filterNumber"),filterPlainObject:s(()=>qt,"filterPlainObject"),filterPrimitives:s(()=>de,"filterPrimitives"),filterString:s(()=>O,"filterString"),filterStringOrStringArray:s(()=>Lt,"filterStringOrStringArray"),filterType:s(()=>I,"filterType"),first:s(()=>yn,"first"),folderExists:s(()=>Oe,"folderExists"),forEachLineWithContent:s(()=>Pe,"forEachLineWithContent"),getTrailingOptions:s(()=>D,"getTrailingOptions"),including:s(()=>bn,"including"),isUserFunction:s(()=>dn,"isUserFunction"),last:s(()=>et,"last"),objectToString:s(()=>_t,"objectToString"),orVoid:s(()=>he,"orVoid"),parseStringResponse:s(()=>M,"parseStringResponse"),pick:s(()=>_n,"pick"),prefixedArray:s(()=>gt,"prefixedArray"),remove:s(()=>Gt,"remove"),splitOn:s(()=>gn,"splitOn"),toLinesWithContent:s(()=>kt,"toLinesWithContent"),trailingFunctionArgument:s(()=>A,"trailingFunctionArgument"),trailingOptionsArgument:s(()=>je,"trailingOptionsArgument")});var h=l({"src/lib/utils/index.ts"(){"use strict";Ce(),lo(),po(),fo(),ho(),yo(),vo(),Ut()}}),Rn={};R(Rn,{CheckRepoActions:s(()=>ve,"CheckRepoActions"),checkIsBareRepoTask:s(()=>On,"checkIsBareRepoTask"),checkIsRepoRootTask:s(()=>Pn,"checkIsRepoRootTask"),checkIsRepoTask:s(()=>bo,"checkIsRepoTask")});function bo(t){switch(t){case"bare":return On();case"root":return Pn()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:zt,parser:De}}s(bo,"checkIsRepoTask");function Pn(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:zt,parser(e){return/^\.(git)?$/.test(e.trim())}}}s(Pn,"checkIsRepoRootTask");function On(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:zt,parser:De}}s(On,"checkIsBareRepoTask");function ko(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}s(ko,"isNotRepoMessage");var ve,zt,De,Cn=l({"src/lib/tasks/check-is-repo.ts"(){"use strict";h(),ve=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(ve||{}),zt=s(({exitCode:t},e,r,n)=>{if(t===128&&ko(e))return r(Buffer.from("false"));n(e)},"onError"),De=s(t=>t.trim()==="true","parser")}});function _o(t,e){let r=new $n(t),n=t?Dn:jn;return kt(e).forEach(i=>{let o=i.replace(n,"");r.paths.push(o),(Ln.test(o)?r.folders:r.files).push(o)}),r}s(_o,"cleanSummaryParser");var $n,jn,Dn,Ln,wo=l({"src/lib/responses/CleanSummary.ts"(){"use strict";h(),$n=class{static{s(this,"CleanResponse")}constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},jn=/^[a-z]+\s*/i,Dn=/^[a-z]+\s+[a-z]+\s*/i,Ln=/\/$/}}),be={};R(be,{EMPTY_COMMANDS:s(()=>Qt,"EMPTY_COMMANDS"),adhocExecTask:s(()=>Mn,"adhocExecTask"),configurationErrorTask:s(()=>L,"configurationErrorTask"),isBufferTask:s(()=>Fn,"isBufferTask"),isEmptyTask:s(()=>In,"isEmptyTask"),straightThroughBufferTask:s(()=>Bn,"straightThroughBufferTask"),straightThroughStringTask:s(()=>j,"straightThroughStringTask")});function Mn(t){return{commands:Qt,format:"empty",parser:t}}s(Mn,"adhocExecTask");function L(t){return{commands:Qt,format:"empty",parser(){throw typeof t=="string"?new mn(t):t}}}s(L,"configurationErrorTask");function j(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}s(j,"straightThroughStringTask");function Bn(t){return{commands:t,format:"buffer",parser(e){return e}}}s(Bn,"straightThroughBufferTask");function Fn(t){return t.format==="buffer"}s(Fn,"isBufferTask");function In(t){return t.format==="empty"||!t.commands.length}s(In,"isEmptyTask");var Qt,E=l({"src/lib/tasks/task.ts"(){"use strict";fn(),Qt=[]}}),Nn={};R(Nn,{CONFIG_ERROR_INTERACTIVE_MODE:s(()=>Le,"CONFIG_ERROR_INTERACTIVE_MODE"),CONFIG_ERROR_MODE_REQUIRED:s(()=>Me,"CONFIG_ERROR_MODE_REQUIRED"),CONFIG_ERROR_UNKNOWN_OPTION:s(()=>Be,"CONFIG_ERROR_UNKNOWN_OPTION"),CleanOptions:s(()=>Ot,"CleanOptions"),cleanTask:s(()=>Gn,"cleanTask"),cleanWithOptionsTask:s(()=>To,"cleanWithOptionsTask"),isCleanOptionsArray:s(()=>So,"isCleanOptionsArray")});function To(t,e){let{cleanMode:r,options:n,valid:i}=xo(t);return r?i.options?(n.push(...e),n.some(Ro)?L(Le):Gn(r,n)):L(Be+JSON.stringify(t)):L(Me)}s(To,"cleanWithOptionsTask");function Gn(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return _o(t==="n",n)}}}s(Gn,"cleanTask");function So(t){return Array.isArray(t)&&t.every(e=>Fe.has(e))}s(So,"isCleanOptionsArray");function xo(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{Ao(i)?(e=i,n.cleanMode=!0):n.options=n.options&&Eo(r[r.length]=`-${i}`)}),{cleanMode:e,options:r,valid:n}}s(xo,"getCleanOptions");function Ao(t){return t==="f"||t==="n"}s(Ao,"isCleanMode");function Eo(t){return/^-[a-z]$/i.test(t)&&Fe.has(t.charAt(1))}s(Eo,"isKnownOption");function Ro(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}s(Ro,"isInteractiveMode");var Le,Me,Be,Ot,Fe,Un=l({"src/lib/tasks/clean.ts"(){"use strict";wo(),h(),E(),Le="Git clean interactive mode is not supported",Me='Git clean mode parameter ("n" or "f") is required',Be="Git clean unknown option found in: ",Ot=(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))(Ot||{}),Fe=new Set(["i",...pt(Object.values(Ot))])}});function Po(t){let e=new Jn;for(let r of qn(t))e.addValue(r.file,String(r.key),r.value);return e}s(Po,"configListParser");function Oo(t,e){let r=null,n=[],i=new Map;for(let o of qn(t,e))o.key===e&&(n.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:n}}s(Oo,"configGetParser");function Co(t){return t.replace(/^(file):/,"")}s(Co,"configFilePath");function*qn(t,e=null){let r=t.split("\0");for(let n=0,i=r.length-1;n<i;){let o=Co(r[n++]),a=r[n++],u=e;if(a.includes(`
|
|
83
|
-
`)){let p=gn(a,`
|
|
84
|
-
`);u=p[0],a=p[1]}yield{file:o,key:u,value:a}}}s(qn,"configParser");var Jn,$o=l({"src/lib/responses/ConfigList.ts"(){"use strict";h(),Jn=class{static{s(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=et(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);Object.hasOwn(n,e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function ae(t,e){return typeof t=="string"&&Object.hasOwn(ke,t)?t:e}s(ae,"asConfigScope");function jo(t,e,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(o){return o}}}s(jo,"addConfigTask");function Do(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return Oo(n,t)}}}s(Do,"getConfigTask");function Lo(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return Po(r)}}}s(Lo,"listConfigTask");function Mo(){return{addConfig(t,e,...r){return this._runTask(jo(t,e,r[0]===!0,ae(r[1],"local")),A(arguments))},getConfig(t,e){return this._runTask(Do(t,ae(e,void 0)),A(arguments))},listConfig(...t){return this._runTask(Lo(ae(t[0],void 0)),A(arguments))}}}s(Mo,"config_default");var ke,zn=l({"src/lib/tasks/config.ts"(){"use strict";$o(),h(),ke=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ke||{})}});function Bo(t){return Qn.has(t)}s(Bo,"isDiffNameStatus");var ue,Qn,Vn=l({"src/lib/tasks/diff-name-status.ts"(){"use strict";ue=(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))(ue||{}),Qn=new Set(Object.values(ue))}});function Fo(...t){return new Hn().param(...t)}s(Fo,"grepQueryBuilder");function Io(t){let e=new Set,r={};return Pe(t,n=>{let[i,o,a]=n.split(ct);e.add(i),(r[i]=r[i]||[]).push({line:_(o),path:i,preview:a})}),{paths:e,results:r}}s(Io,"parseGrep");function No(){return{grep(t){let e=A(arguments),r=D(arguments);for(let i of Wn)if(r.includes(i))return this._runTask(L(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=Fo().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(i){return Io(i)}},e)}}}s(No,"grep_default");var Wn,dt,Lr,Hn,Yn=l({"src/lib/tasks/grep.ts"(){"use strict";h(),E(),Wn=["-h"],dt=Symbol("grepQuery"),Hn=class{static{s(this,"GrepQuery")}constructor(){this[Lr]=[]}*[(Lr=dt,Symbol.iterator)](){for(let t of this[dt])yield t}and(...t){return t.length&&this[dt].push("--and","(",...gt(t,"-e"),")"),this}param(...t){return this[dt].push(...gt(t,"-e")),this}}}}),Kn={};R(Kn,{ResetMode:s(()=>Ct,"ResetMode"),getResetMode:s(()=>Uo,"getResetMode"),resetTask:s(()=>Go,"resetTask")});function Go(t,e){let r=["reset"];return Xn(t)&&r.push(`--${t}`),r.push(...e),j(r)}s(Go,"resetTask");function Uo(t){if(Xn(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}s(Uo,"getResetMode");function Xn(t){return typeof t=="string"&&Zn.includes(t)}s(Xn,"isValidResetMode");var Ct,Zn,ts=l({"src/lib/tasks/reset.ts"(){"use strict";h(),E(),Ct=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Ct||{}),Zn=pt(Object.values(Ct))}});function qo(){return(0,Bt.default)("simple-git")}s(qo,"createLog");function Mr(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...i)=>{t(n,...i),r(n,...i)}:t:(n,...i)=>{t(`%s ${n}`,e,...i),r&&r(n,...i)}}s(Mr,"prefixedLogger");function Jo(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}s(Jo,"childLoggerName");function Ie(t,e,r,n=qo()){let i=t&&`[${t}]`||"",o=[],a=typeof e=="string"?n.extend(e):e,u=Jo(I(e,O),a,n);return v(r);function p(g,w){return N(o,Ie(t,u.replace(/^[^:]+/,g),w,n))}function v(g){let w=g&&`[${g}]`||"",P=a&&Mr(a,w)||rt,k=Mr(n,`${i} ${w}`,P);return Object.assign(a?P:k,{label:t,sibling:p,info:k,step:v})}}s(Ie,"createLogger");var es=l({"src/lib/git-logger.ts"(){"use strict";h(),Bt.default.formatters.L=t=>String(Jt(t)?t.length:"-"),Bt.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):_t(t)}}),rs,zo=l({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";Y(),es(),rs=class _e{static{s(this,"_TasksPendingQueue")}constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let r=_e.getName(e.commands[0]),n=Ie(this.logLabel,r);return{task:e,logger:n,name:r}}push(e){let r=this.createProgress(e);return r.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,r),r}fatal(e){for(let[r,{logger:n}]of Array.from(this._queue.entries()))r===e.task?(n.info("Failed %o",e),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(r);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let r=this.withProgress(e);if(!r)throw new Q(void 0,"TasksPendingQueue: attempt called for an unknown task");return r.logger("Starting task"),r}static getName(e="empty"){return`task:${e}:${++_e.counter}`}static{this.counter=0}}}});function tt(t,e){return{method:yn(t.commands)||"",commands:e}}s(tt,"pluginContext");function Vo(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}s(Vo,"onErrorReceived");function Br(t,e,r,n){return i=>{r("%s received %L bytes",e,i),n("%B",i),t.push(i)}}s(Br,"onDataReceived");var we,Wo=l({"src/lib/runners/git-executor-chain.ts"(){"use strict";Y(),E(),h(),zo(),we=class{static{s(this,"GitExecutorChain")}constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new rs}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=s(()=>this._queue.complete(t),"onQueueComplete");try{let{logger:n}=this._queue.attempt(t);return await(In(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n))}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof Q?Object.assign(e,{task:t}):new Q(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",tt(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],tt(t,t.commands)),i=await this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),o=await this.handleTaskData(t,n,i,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),Fn(t)?ye(t.parser,o):ye(t.parser,o.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,n){let{exitCode:i,rejection:o,stdOut:a,stdErr:u}=r;return new Promise((p,v)=>{n("Preparing to handle process response exitCode=%d stdOut=",i);let{error:g}=this._plugins.exec("task.error",{error:o},{...tt(t,e),...r});if(g&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,g,w=>{n.info("custom error handler treated as success"),n("custom error returned a %s",_t(w)),p(new Mt(Array.isArray(w)?Buffer.concat(w):w,Buffer.concat(u)))},v);if(g)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,u.length,o),v(g);n.info("retrieving task output complete"),p(new Mt(Buffer.concat(a),Buffer.concat(u)))})}async gitResponse(t,e,r,n,i){let o=i.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},tt(t,t.commands));return new Promise(u=>{let p=[],v=[];i.info("%s %o",e,r),i("%O",a);let g=this._beforeSpawn(t,r);if(g)return u({stdOut:p,stdErr:v,exitCode:9901,rejection:g});this._plugins.exec("spawn.before",void 0,{...tt(t,r),kill(P){g=P||g}});let w=Qo(e,r,a);w.stdout.on("data",Br(p,"stdOut",i,o.step("stdOut"))),w.stderr.on("data",Br(v,"stdErr",i,o.step("stdErr"))),w.on("error",Vo(v,i)),n&&(i("Passing child process stdOut/stdErr to custom outputHandler"),n(e,w.stdout,w.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...tt(t,r),spawned:w,close(P,k){u({stdOut:p,stdErr:v,exitCode:P,rejection:g||k})},kill(P){w.killed||(g=P,w.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...tt(t,e),kill(n){r=n||r}}),r}}}}),ns={};R(ns,{GitExecutor:s(()=>ss,"GitExecutor")});var ss,Ho=l({"src/lib/runners/git-executor.ts"(){"use strict";Wo(),ss=class{static{s(this,"GitExecutor")}constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new we(this,this._scheduler,this._plugins)}chain(){return new we(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function Yo(t,e,r=rt){let n=s(o=>{r(null,o)},"onSuccess"),i=s(o=>{o?.task===t&&r(o instanceof bt?Ko(o):o,void 0)},"onError2");e.then(n,i)}s(Yo,"taskCallback");function Ko(t){let e=s(n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=rt},"log");return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,i){return i in t||(n[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),n}}s(Ko,"addDeprecationNoticeToError");var Xo=l({"src/lib/task-callback.ts"(){"use strict";lt(),h()}});function Fr(t,e){return Mn(r=>{if(!Oe(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}s(Fr,"changeWorkingDirectoryTask");var Zo=l({"src/lib/tasks/change-working-directory.ts"(){"use strict";h(),E()}});function ce(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=Gt(e,"-B")),j(e)}s(ce,"checkoutTask");function ta(){return{checkout(){return this._runTask(ce(D(arguments,1)),A(arguments))},checkoutBranch(t,e){return this._runTask(ce(["-b",t,e,...D(arguments)]),A(arguments))},checkoutLocalBranch(t){return this._runTask(ce(["-b",t,...D(arguments)]),A(arguments))}}}s(ta,"checkout_default");var ea=l({"src/lib/tasks/checkout.ts"(){"use strict";h(),E()}});function ra(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}s(ra,"countObjectsResponse");function na(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return M(ra(),[is],t)}})}}}s(na,"count_objects_default");var is,sa=l({"src/lib/tasks/count-objects.ts"(){"use strict";h(),is=new d(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=kn(e);Object.hasOwn(t,n)&&(t[n]=_(r))})}});function ia(t){return M({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},os,t)}s(ia,"parseCommitResult");var os,oa=l({"src/lib/parsers/parse-commit.ts"(){"use strict";h(),os=[new d(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new d(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new d(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new d(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(r,10)||0;n==="-"?t.summary.deletions=i:n==="+"&&(t.summary.insertions=i)})]}});function aa(t,e,r){return{commands:["-c","core.abbrev=40","commit",...gt(t,"-m"),...e,...r],format:"utf-8",parser:ia}}s(aa,"commitTask");function ua(){return{commit(e,...r){let n=A(arguments),i=t(e)||aa(q(e),q(I(r[0],Lt,[])),[...pt(I(r[1],wt,[])),...D(arguments,0,!0)]);return this._runTask(i,n)}};function t(e){return!Lt(e)&&L("git.commit: requires the commit message to be supplied as a string/string[]")}}s(ua,"commit_default");var ca=l({"src/lib/tasks/commit.ts"(){"use strict";oa(),h(),E()}});function la(){return{firstCommit(){return this._runTask(j(["rev-list","--max-parents=0","HEAD"],!0),A(arguments))}}}s(la,"first_commit_default");var pa=l({"src/lib/tasks/first-commit.ts"(){"use strict";h(),E()}});function ma(t,e){let r=["hash-object",t];return e&&r.push("-w"),j(r,!0)}s(ma,"hashObjectTask");var fa=l({"src/lib/tasks/hash-object.ts"(){"use strict";E()}});function ha(t,e,r){let n=String(r).trim(),i;if(i=as.exec(n))return new $t(t,e,!1,i[1]);if(i=us.exec(n))return new $t(t,e,!0,i[1]);let o="",a=n.split(" ");for(;a.length;)if(a.shift()==="in"){o=a.join(" ");break}return new $t(t,e,/^re/i.test(n),o)}s(ha,"parseInit");var $t,as,us,da=l({"src/lib/responses/InitSummary.ts"(){"use strict";$t=class{static{s(this,"InitSummary")}constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},as=/^Init.+ repository in (.+)$/,us=/^Rein.+ in (.+)$/}});function ga(t){return t.includes(Ne)}s(ga,"hasBareCommand");function ya(t=!1,e,r){let n=["init",...r];return t&&!ga(n)&&n.splice(1,0,Ne),{commands:n,format:"utf-8",parser(i){return ha(n.includes("--bare"),e,i)}}}s(ya,"initTask");var Ne,va=l({"src/lib/tasks/init.ts"(){"use strict";da(),Ne="--bare"}});function Ge(t){for(let e=0;e<t.length;e++){let r=Ue.exec(t[e]);if(r)return`--${r[1]}`}return""}s(Ge,"logFormatFromCommand");function ba(t){return Ue.test(t)}s(ba,"isLogFormat");var Ue,Tt=l({"src/lib/args/log-format.ts"(){"use strict";Ue=/^--(stat|numstat|name-only|name-status)(=|$)/}}),cs,ka=l({"src/lib/responses/DiffSummary.ts"(){"use strict";cs=class{static{s(this,"DiffSummary")}constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function ls(t=""){let e=ps[t];return r=>M(new cs,e,r,!1)}s(ls,"getDiffParser");var le,Ir,Nr,Gr,ps,ms=l({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Tt(),ka(),Vn(),h(),le=[new d(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:_(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new d(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:_(r),after:_(n),binary:!0})}),new d(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),i=/(\d+) d/.exec(r);t.changed=_(e),t.insertions=_(n?.[1]),t.deletions=_(i?.[1])})],Ir=[new d(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let i=_(e),o=_(r);t.changed++,t.insertions+=i,t.deletions+=o,t.files.push({file:n,changes:i+o,insertions:i,deletions:o,binary:!1})}),new d(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],Nr=[new d(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Gr=[new d(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,i,o])=>{t.changed++,t.files.push({file:o??n,changes:0,insertions:0,deletions:0,binary:!1,status:he(Bo(e)&&e),from:he(!!o&&n!==o&&n),similarity:_(r)})})],ps={"":le,"--stat":le,"--numstat":Ir,"--name-status":Gr,"--name-only":Nr}}});function _a(t,e){return e.reduce((r,n,i)=>(r[n]=t[i]||"",r),Object.create({diff:null}))}s(_a,"lineBuilder");function fs(t=ze,e=hs,r=""){let n=ls(r);return function(i){let o=kt(i.trim(),!1,qe).map(function(a){let u=a.split(Je),p=_a(u[0].split(t),e);return u.length>1&&u[1].trim()&&(p.diff=n(u[1])),p});return{all:o,latest:o.length&&o[0]||null,total:o.length}}}s(fs,"createListLogSummaryParser");var qe,Je,ze,hs,ds=l({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";h(),ms(),Tt(),qe="\xF2\xF2\xF2\xF2\xF2\xF2 ",Je=" \xF2\xF2",ze=" \xF2 ",hs=["hash","date","message","refs","author_name","author_email"]}}),gs={};R(gs,{diffSummaryTask:s(()=>wa,"diffSummaryTask"),validateLogFormatConfig:s(()=>Vt,"validateLogFormatConfig")});function wa(t){let e=Ge(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),Vt(r)||{commands:r,format:"utf-8",parser:ls(e)}}s(wa,"diffSummaryTask");function Vt(t){let e=t.filter(ba);if(e.length>1)return L(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return L(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}s(Vt,"validateLogFormatConfig");var Qe=l({"src/lib/tasks/diff.ts"(){"use strict";Tt(),ms(),E()}});function Ta(t,e){let r=[],n=[];return Object.keys(t).forEach(i=>{r.push(i),n.push(String(t[i]))}),[r,n.join(e)]}s(Ta,"prettyFormat");function Sa(t){return Object.keys(t).reduce((e,r)=>(r in Te||(e[r]=t[r]),e),{})}s(Sa,"userOptions");function ys(t={},e=[]){let r=I(t.splitter,O,ze),n=qt(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]=Ta(n,r),a=[],u=[`--pretty=format:${qe}${o}${Je}`,...e],p=t.n||t["max-count"]||t.maxCount;if(p&&u.push(`--max-count=${p}`),t.from||t.to){let v=t.symmetric!==!1?"...":"..";a.push(`${t.from||""}${v}${t.to||""}`)}return O(t.file)&&u.push("--follow",uo(t.file)),$e(Sa(t),u),{fields:i,splitter:r,commands:[...u,...a]}}s(ys,"parseLogOptions");function xa(t,e,r){let n=fs(t,e,Ge(r));return{commands:["log",...r],format:"utf-8",parser:n}}s(xa,"logTask");function Aa(){return{log(...r){let n=A(arguments),i=ys(je(arguments),pt(I(arguments[0],wt,[]))),o=e(...r)||Vt(i.commands)||t(i);return this._runTask(o,n)}};function t(r){return xa(r.splitter,r.fields,r.commands)}function e(r,n){return O(r)&&O(n)&&L("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}s(Aa,"log_default");var Te,vs=l({"src/lib/tasks/log.ts"(){"use strict";Tt(),vt(),ds(),h(),E(),Qe(),Te=(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))(Te||{})}}),jt,bs,Ea=l({"src/lib/responses/MergeSummary.ts"(){"use strict";jt=class{static{s(this,"MergeSummaryConflict")}constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},bs=class{static{s(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"}}}}),Se,ks,Ra=l({"src/lib/responses/PullSummary.ts"(){"use strict";Se=class{static{s(this,"PullSummary")}constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},ks=class{static{s(this,"PullFailedSummary")}constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function pe(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}s(pe,"objectEnumerationResult");function Ur(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:_(e&&e[1]||"0"),delta:_(r&&r[1]||"0")}}s(Ur,"asObjectCount");var _s,Pa=l({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";h(),_s=[new H(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),i=pe(t.remoteMessages);Object.assign(i,{[n]:_(r)})}),new H(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),i=pe(t.remoteMessages);Object.assign(i,{[n]:_(r)})}),new H(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let i=pe(t.remoteMessages);i.total=Ur(e),i.reused=Ur(r),i.packReused=_(n)})]}});function ws(t,e){return M({remoteMessages:new Ss},Ts,e)}s(ws,"parseRemoteMessages");var Ts,Ss,xs=l({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";h(),Pa(),Ts=[new H(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),..._s,new H([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new H([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:_(e),summary:r,url:n}})],Ss=class{static{s(this,"RemoteMessageSummary")}constructor(){this.all=[]}}}});function Oa(t,e){let r=M(new ks,As,[t,e]);return r.message&&r}s(Oa,"parsePullErrorResult");var qr,Jr,zr,Qr,As,Vr,Ve,Es=l({"src/lib/parsers/parse-pull.ts"(){"use strict";Ra(),h(),xs(),qr=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Jr=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,zr=/^(create|delete) mode \d+ (.+)/,Qr=[new d(qr,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new d(Jr,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new d(zr,(t,[e,r])=>{N(t.files,r),N(e==="create"?t.created:t.deleted,r)})],As=[new d(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new d(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new d(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,i])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=i,t.hash.remote=r})],Vr=s((t,e)=>M(new Se,Qr,[t,e]),"parsePullDetail"),Ve=s((t,e)=>Object.assign(new Se,Vr(t,e),ws(t,e)),"parsePullResult")}}),Wr,Rs,Hr,Ca=l({"src/lib/parsers/parse-merge.ts"(){"use strict";Ea(),h(),Es(),Wr=[new d(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new d(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new jt(e,r))}),new d(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new jt(e,r,{deleteRef:n}))}),new d(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new jt(e,null))}),new d(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Rs=s((t,e)=>Object.assign(Hr(t,e),Ve(t,e)),"parseMergeResult"),Hr=s(t=>M(new bs,Wr,t),"parseMergeDetail")}});function Yr(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=Rs(e,r);if(n.failed)throw new bt(n);return n}}:L("Git.merge requires at least one option")}s(Yr,"mergeTask");var $a=l({"src/lib/tasks/merge.ts"(){"use strict";lt(),Ca(),E()}});function ja(t,e,r){let n=r.includes("deleted"),i=r.includes("tag")||/^refs\/tags/.test(t),o=!r.includes("new");return{deleted:n,tag:i,branch:!i,new:!o,alreadyUpdated:o,local:t,remote:e}}s(ja,"pushResultPushedItem");var Kr,Ps,Xr,Da=l({"src/lib/parsers/parse-push.ts"(){"use strict";h(),xs(),Kr=[new d(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new d(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new d(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push(ja(e,r,n))}),new d(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:n}}),new d(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,i])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:i}}})],Ps=s((t,e)=>{let r=Xr(t,e),n=ws(t,e);return{...r,...n}},"parsePushResult"),Xr=s((t,e)=>M({pushed:[]},Kr,[t,e]),"parsePushDetail")}}),Os={};R(Os,{pushTagsTask:s(()=>La,"pushTagsTask"),pushTask:s(()=>We,"pushTask")});function La(t={},e){return N(e,"--tags"),We(t,e)}s(La,"pushTagsTask");function We(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),Gt(r,"-v"),N(r,"--verbose"),N(r,"--porcelain"),{commands:r,format:"utf-8",parser:Ps}}s(We,"pushTask");var Cs=l({"src/lib/tasks/push.ts"(){"use strict";Da(),h()}});function Ma(){return{showBuffer(){let t=["show",...D(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(Bn(t),A(arguments))},show(){let t=["show",...D(arguments,1)];return this._runTask(j(t),A(arguments))}}}s(Ma,"show_default");var Ba=l({"src/lib/tasks/show.ts"(){"use strict";h(),E()}}),Zr,$s,Fa=l({"src/lib/responses/FileStatusSummary.ts"(){"use strict";Zr=/^(.+)\0(.+)$/,$s=class{static{s(this,"FileStatusSummary")}constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=Zr.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function tn(t){let[e,r]=t.split(ct);return{from:r||e,to:e}}s(tn,"renamedFile");function F(t,e,r){return[`${t}${e}`,r]}s(F,"parser3");function me(t,...e){return e.map(r=>F(t,r,(n,i)=>n.conflicted.push(i)))}s(me,"conflicts");function Ia(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return n(" ",r.charAt(0),r.slice(2));default:return}function n(i,o,a){let u=`${i}${o}`,p=js.get(u);p&&p(t,a),u!=="##"&&u!=="!!"&&t.files.push(new $s(a,i,o))}s(n,"data")}s(Ia,"splitLine");var en,js,Ds,Na=l({"src/lib/responses/StatusSummary.ts"(){"use strict";h(),Fa(),en=class{static{s(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}},js=new Map([F(" ","A",(t,e)=>t.created.push(e)),F(" ","D",(t,e)=>t.deleted.push(e)),F(" ","M",(t,e)=>t.modified.push(e)),F("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),F("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),F("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),F("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),F("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),F("R"," ",(t,e)=>{t.renamed.push(tn(e))}),F("R","M",(t,e)=>{let r=tn(e);t.renamed.push(r),t.modified.push(r.to)}),F("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),F("?","?",(t,e)=>t.not_added.push(e)),...me("A","A","U"),...me("D","D","U"),...me("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,o=/\.{3}(\S*)/,a=/\son\s(\S+?)(?=\.{3}|$)/,u=r.exec(e);t.ahead=u&&+u[1]||0,u=n.exec(e),t.behind=u&&+u[1]||0,u=i.exec(e),t.current=I(u?.[1],O,null),u=o.exec(e),t.tracking=I(u?.[1],O,null),u=a.exec(e),u&&(t.current=I(u?.[1],O,t.current)),t.detached=/\(no branch\)/.test(e)}]]),Ds=s(function(t){let e=t.split(ct),r=new en;for(let n=0,i=e.length;n<i;){let o=e[n++].trim();o&&(o.charAt(0)==="R"&&(o+=ct+(e[n++]||"")),Ia(r,o))}return r},"parseStatusSummary")}});function Ga(t){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...t.filter(r=>!Ls.includes(r))],parser(r){return Ds(r)}}}s(Ga,"statusTask");var Ls,Ua=l({"src/lib/tasks/status.ts"(){"use strict";Na(),Ls=["--null","-z"]}});function Ft(t=0,e=0,r=0,n="",i=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}s(Ft,"versionResponse");function qa(){return Ft(0,0,0,"",!1)}s(qa,"notInstalledResponse");function Ja(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:za,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(He));n(e)}})}}}s(Ja,"version_default");function za(t){return t===He?qa():M(Ft(0,0,0,t),Ms,t)}s(za,"versionParser");var He,Ms,Qa=l({"src/lib/tasks/version.ts"(){"use strict";h(),He="installed=false",Ms=[new d(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,i=""])=>{Object.assign(t,Ft(_(e),_(r),_(n),i))}),new d(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,i=""])=>{Object.assign(t,Ft(_(e),_(r),n,i))})]}}),Bs={};R(Bs,{SimpleGitApi:s(()=>xe,"SimpleGitApi")});var xe,Va=l({"src/lib/simple-git-api.ts"(){"use strict";Xo(),Zo(),ea(),sa(),ca(),zn(),pa(),Yn(),fa(),va(),vs(),$a(),Cs(),Ba(),Ua(),E(),Qa(),h(),xe=class{static{s(this,"SimpleGitApi")}constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&Yo(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask(j(["add",...q(t)]),A(arguments))}cwd(t){let e=A(arguments);return typeof t=="string"?this._runTask(Fr(t,this._executor),e):typeof t?.path=="string"?this._runTask(Fr(t.path,t.root&&this._executor||void 0),e):this._runTask(L("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(ma(t,e===!0),A(arguments))}init(t){return this._runTask(ya(t===!0,this._executor.cwd,D(arguments)),A(arguments))}merge(){return this._runTask(Yr(D(arguments)),A(arguments))}mergeFromTo(t,e){return O(t)&&O(e)?this._runTask(Yr([t,e,...D(arguments)]),A(arguments,!1)):this._runTask(L("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=We({remote:I(arguments[0],O),branch:I(arguments[1],O)},D(arguments));return this._runTask(t,A(arguments))}stash(){return this._runTask(j(["stash",...D(arguments)]),A(arguments))}status(){return this._runTask(Ga(D(arguments)),A(arguments))}},Object.assign(xe.prototype,ta(),ua(),Mo(),na(),la(),No(),Aa(),Ma(),Ja())}}),Fs={};R(Fs,{Scheduler:s(()=>Ns,"Scheduler")});var rn,Ns,Wa=l({"src/lib/runners/scheduler.ts"(){"use strict";h(),es(),rn=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,Is.createDeferred)();return{promise:e,done:r,id:t}}})(),Ns=class{static{s(this,"Scheduler")}constructor(t=2){this.concurrency=t,this.logger=Ie("","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=N(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),Gt(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=N(this.pending,rn());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),Gs={};R(Gs,{applyPatchTask:s(()=>Ha,"applyPatchTask")});function Ha(t,e){return j(["apply",...e,...t])}s(Ha,"applyPatchTask");var Ya=l({"src/lib/tasks/apply-patch.ts"(){"use strict";E()}});function Ka(t,e){return{branch:t,hash:e,success:!0}}s(Ka,"branchDeletionSuccess");function Xa(t){return{branch:t,hash:null,success:!1}}s(Xa,"branchDeletionFailure");var Us,Za=l({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";Us=class{static{s(this,"BranchDeletionBatch")}constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function qs(t,e){return e===1&&Ae.test(t)}s(qs,"hasBranchDeletionError");var nn,Ae,sn,Wt,tu=l({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";Za(),h(),nn=/(\S+)\s+\(\S+\s([^)]+)\)/,Ae=/^error[^']+'([^']+)'/m,sn=[new d(nn,(t,[e,r])=>{let n=Ka(e,r);t.all.push(n),t.branches[e]=n}),new d(Ae,(t,[e])=>{let r=Xa(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],Wt=s((t,e)=>M(new Us,sn,[t,e]),"parseBranchDeletions")}}),Js,eu=l({"src/lib/responses/BranchSummary.ts"(){"use strict";Js=class{static{s(this,"BranchSummaryResult")}constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,i){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:i}}}}});function on(t){return t?t.charAt(0):""}s(on,"branchStatus");function zs(t,e=!1){return M(new Js,e?[Vs]:Qs,t)}s(zs,"parseBranchSummary");var Qs,Vs,ru=l({"src/lib/parsers/parse-branch.ts"(){"use strict";eu(),h(),Qs=[new d(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,i])=>{t.push(on(e),!0,r,n,i)}),new d(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,n,i])=>{t.push(on(e),!1,r,n,i)})],Vs=new d(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),Ws={};R(Ws,{branchLocalTask:s(()=>su,"branchLocalTask"),branchTask:s(()=>nu,"branchTask"),containsDeleteBranchCommand:s(()=>Hs,"containsDeleteBranchCommand"),deleteBranchTask:s(()=>ou,"deleteBranchTask"),deleteBranchesTask:s(()=>iu,"deleteBranchesTask")});function Hs(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}s(Hs,"containsDeleteBranchCommand");function nu(t){let e=Hs(t),r=t.includes("--show-current"),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(i,o){return e?Wt(i,o).all[0]:zs(i,r)}}}s(nu,"branchTask");function su(){return{format:"utf-8",commands:["branch","-v"],parser(t){return zs(t)}}}s(su,"branchLocalTask");function iu(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return Wt(r,n)},onError({exitCode:r,stdOut:n},i,o,a){if(!qs(String(i),r))return a(i);o(n)}}}s(iu,"deleteBranchesTask");function ou(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,i){return Wt(n,i).branches[t]},onError({exitCode:n,stdErr:i,stdOut:o},a,u,p){if(!qs(String(a),n))return p(a);throw new bt(r.parser(yt(o),yt(i)),String(a))}};return r}s(ou,"deleteBranchTask");var au=l({"src/lib/tasks/branch.ts"(){"use strict";lt(),tu(),ru(),h()}});function cu(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&uu(e)}s(cu,"toPath");var Ys,lu=l({"src/lib/responses/CheckIgnore.ts"(){"use strict";Ys=s(t=>t.split(/\n/g).map(cu).filter(Boolean),"parseCheckIgnore")}}),Ks={};R(Ks,{checkIgnoreTask:s(()=>pu,"checkIgnoreTask")});function pu(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Ys}}s(pu,"checkIgnoreTask");var mu=l({"src/lib/tasks/check-ignore.ts"(){"use strict";lu()}}),Xs={};R(Xs,{cloneMirrorTask:s(()=>hu,"cloneMirrorTask"),cloneTask:s(()=>Zs,"cloneTask")});function fu(t){return/^--upload-pack(=|$)/.test(t)}s(fu,"disallowedCommand");function Zs(t,e,r){let n=["clone",...r];return O(t)&&n.push(t),O(e)&&n.push(e),n.find(fu)?L("git.fetch: potential exploit argument blocked."):j(n)}s(Zs,"cloneTask");function hu(t,e,r){return N(r,"--mirror"),Zs(t,e,r)}s(hu,"cloneMirrorTask");var du=l({"src/lib/tasks/clone.ts"(){"use strict";E(),h()}});function gu(t,e){return M({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},ti,[t,e])}s(gu,"parseFetchResult");var ti,yu=l({"src/lib/parsers/parse-fetch.ts"(){"use strict";h(),ti=[new d(/From (.+)$/,(t,[e])=>{t.remote=e}),new d(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new d(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new d(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new d(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,i])=>{t.updated.push({name:n,tracking:i,to:r,from:e})})]}}),ei={};R(ei,{fetchTask:s(()=>bu,"fetchTask")});function vu(t){return/^--upload-pack(=|$)/.test(t)}s(vu,"disallowedCommand2");function bu(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(vu)?L("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:gu}}s(bu,"fetchTask");var ku=l({"src/lib/tasks/fetch.ts"(){"use strict";yu(),E()}});function _u(t){return M({moves:[]},ri,t)}s(_u,"parseMoveResult");var ri,wu=l({"src/lib/parsers/parse-move.ts"(){"use strict";h(),ri=[new d(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),ni={};R(ni,{moveTask:s(()=>Tu,"moveTask")});function Tu(t,e){return{commands:["mv","-v",...q(t),e],format:"utf-8",parser:_u}}s(Tu,"moveTask");var Su=l({"src/lib/tasks/move.ts"(){"use strict";wu(),h()}}),si={};R(si,{pullTask:s(()=>xu,"pullTask")});function xu(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(i,o){return Ve(i,o)},onError(i,o,a,u){let p=Oa(yt(i.stdOut),yt(i.stdErr));if(p)return u(new bt(p));u(o)}}}s(xu,"pullTask");var Au=l({"src/lib/tasks/pull.ts"(){"use strict";lt(),Es(),h()}});function Eu(t){let e={};return ii(t,([r])=>e[r]={name:r}),Object.values(e)}s(Eu,"parseGetRemotes");function Ru(t){let e={};return ii(t,([r,n,i])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),i&&n&&(e[r].refs[i.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}s(Ru,"parseGetRemotesVerbose");function ii(t,e){Pe(t,r=>e(r.split(/\s+/)))}s(ii,"forEach");var Pu=l({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";h()}}),oi={};R(oi,{addRemoteTask:s(()=>Ou,"addRemoteTask"),getRemotesTask:s(()=>Cu,"getRemotesTask"),listRemotesTask:s(()=>$u,"listRemotesTask"),remoteTask:s(()=>ju,"remoteTask"),removeRemoteTask:s(()=>Du,"removeRemoteTask")});function Ou(t,e,r){return j(["remote","add",...r,t,e])}s(Ou,"addRemoteTask");function Cu(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?Ru:Eu}}s(Cu,"getRemotesTask");function $u(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),j(e)}s($u,"listRemotesTask");function ju(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),j(e)}s(ju,"remoteTask");function Du(t){return j(["remote","remove",t])}s(Du,"removeRemoteTask");var Lu=l({"src/lib/tasks/remote.ts"(){"use strict";Pu(),E()}}),ai={};R(ai,{stashListTask:s(()=>Mu,"stashListTask")});function Mu(t={},e){let r=ys(t),n=["stash","list",...r.commands,...e],i=fs(r.splitter,r.fields,Ge(n));return Vt(n)||{commands:n,format:"utf-8",parser:i}}s(Mu,"stashListTask");var Bu=l({"src/lib/tasks/stash-list.ts"(){"use strict";Tt(),ds(),Qe(),vs()}}),ui={};R(ui,{addSubModuleTask:s(()=>Fu,"addSubModuleTask"),initSubModuleTask:s(()=>Iu,"initSubModuleTask"),subModuleTask:s(()=>Ht,"subModuleTask"),updateSubModuleTask:s(()=>Nu,"updateSubModuleTask")});function Fu(t,e){return Ht(["add",t,e])}s(Fu,"addSubModuleTask");function Iu(t){return Ht(["init",...t])}s(Iu,"initSubModuleTask");function Ht(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),j(e)}s(Ht,"subModuleTask");function Nu(t){return Ht(["update",...t])}s(Nu,"updateSubModuleTask");var Gu=l({"src/lib/tasks/sub-module.ts"(){"use strict";E()}});function Uu(t,e){let r=Number.isNaN(t),n=Number.isNaN(e);return r!==n?r?1:-1:r?ci(t,e):0}s(Uu,"singleSorted");function ci(t,e){return t===e?0:t>e?1:-1}s(ci,"sorted");function qu(t){return t.trim()}s(qu,"trimmed");function Pt(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}s(Pt,"toNumber");var an,li,Ju=l({"src/lib/responses/TagList.ts"(){"use strict";an=class{static{s(this,"TagList")}constructor(t,e){this.all=t,this.latest=e}},li=s(function(t,e=!1){let r=t.split(`
|
|
85
|
-
`).map(qu).filter(Boolean);e||r.sort(function(i,o){let a=i.split("."),u=o.split(".");if(a.length===1||u.length===1)return Uu(Pt(a[0]),Pt(u[0]));for(let p=0,v=Math.max(a.length,u.length);p<v;p++){let g=ci(Pt(a[p]),Pt(u[p]));if(g)return g}return 0});let n=e?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new an(r,n)},"parseTagList")}}),pi={};R(pi,{addAnnotatedTagTask:s(()=>Vu,"addAnnotatedTagTask"),addTagTask:s(()=>Qu,"addTagTask"),tagListTask:s(()=>zu,"tagListTask")});function zu(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return li(r,e)}}}s(zu,"tagListTask");function Qu(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}s(Qu,"addTagTask");function Vu(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}s(Vu,"addAnnotatedTagTask");var Wu=l({"src/lib/tasks/tag.ts"(){"use strict";Ju()}}),Hu=oo({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(Ho(),x(ns)),{SimpleGitApi:n}=(Va(),x(Bs)),{Scheduler:i}=(Wa(),x(Fs)),{adhocExecTask:o,configurationErrorTask:a}=(E(),x(be)),{asArray:u,filterArray:p,filterPrimitives:v,filterString:g,filterStringOrStringArray:w,filterType:P,getTrailingOptions:k,trailingFunctionArgument:y,trailingOptionsArgument:hi}=(h(),x(En)),{applyPatchTask:di}=(Ya(),x(Gs)),{branchTask:gi,branchLocalTask:yi,deleteBranchesTask:vi,deleteBranchTask:bi}=(au(),x(Ws)),{checkIgnoreTask:ki}=(mu(),x(Ks)),{checkIsRepoTask:_i}=(Cn(),x(Rn)),{cloneTask:wi,cloneMirrorTask:Ti}=(du(),x(Xs)),{cleanWithOptionsTask:Si,isCleanOptionsArray:xi}=(Un(),x(Nn)),{diffSummaryTask:Ai}=(Qe(),x(gs)),{fetchTask:Ei}=(ku(),x(ei)),{moveTask:Ri}=(Su(),x(ni)),{pullTask:Pi}=(Au(),x(si)),{pushTagsTask:Oi}=(Cs(),x(Os)),{addRemoteTask:Ci,getRemotesTask:$i,listRemotesTask:ji,remoteTask:Di,removeRemoteTask:Li}=(Lu(),x(oi)),{getResetMode:Mi,resetTask:Bi}=(ts(),x(Kn)),{stashListTask:Fi}=(Bu(),x(ai)),{addSubModuleTask:Ii,initSubModuleTask:Ni,subModuleTask:Gi,updateSubModuleTask:Ui}=(Gu(),x(ui)),{addAnnotatedTagTask:qi,addTagTask:Ji,tagListTask:zi}=(Wu(),x(pi)),{straightThroughBufferTask:Qi,straightThroughStringTask:U}=(E(),x(be));function f(c,m){this._plugins=m,this._executor=new r(c.baseDir,new i(c.maxConcurrentProcesses),m),this._trimmed=c.trimmed}s(f,"Git2"),(f.prototype=Object.create(n.prototype)).constructor=f,f.prototype.customBinary=function(c){return this._plugins.reconfigure("binary",c),this},f.prototype.env=function(c,m){return arguments.length===1&&typeof c=="object"?this._executor.env=c:(this._executor.env=this._executor.env||{})[c]=m,this},f.prototype.stashList=function(c){return this._runTask(Fi(hi(arguments)||{},p(c)&&c||[]),y(arguments))};function Ze(c,m,b,C){return typeof b!="string"?a(`git.${c}() requires a string 'repoPath'`):m(b,P(C,g),k(arguments))}s(Ze,"createCloneTask"),f.prototype.clone=function(){return this._runTask(Ze("clone",wi,...arguments),y(arguments))},f.prototype.mirror=function(){return this._runTask(Ze("mirror",Ti,...arguments),y(arguments))},f.prototype.mv=function(c,m){return this._runTask(Ri(c,m),y(arguments))},f.prototype.checkoutLatestTag=function(c){var m=this;return this.pull(function(){m.tags(function(b,C){m.checkout(C.latest,c)})})},f.prototype.pull=function(c,m,b,C){return this._runTask(Pi(P(c,g),P(m,g),k(arguments)),y(arguments))},f.prototype.fetch=function(c,m){return this._runTask(Ei(P(c,g),P(m,g),k(arguments)),y(arguments))},f.prototype.silent=function(c){return this._runTask(o(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},f.prototype.tags=function(c,m){return this._runTask(zi(k(arguments)),y(arguments))},f.prototype.rebase=function(){return this._runTask(U(["rebase",...k(arguments)]),y(arguments))},f.prototype.reset=function(c){return this._runTask(Bi(Mi(c),k(arguments)),y(arguments))},f.prototype.revert=function(c){let m=y(arguments);return typeof c!="string"?this._runTask(a("Commit must be a string"),m):this._runTask(U(["revert",...k(arguments,0,!0),c]),m)},f.prototype.addTag=function(c){let m=typeof c=="string"?Ji(c):a("Git.addTag requires a tag name");return this._runTask(m,y(arguments))},f.prototype.addAnnotatedTag=function(c,m){return this._runTask(qi(c,m),y(arguments))},f.prototype.deleteLocalBranch=function(c,m,b){return this._runTask(bi(c,typeof m=="boolean"?m:!1),y(arguments))},f.prototype.deleteLocalBranches=function(c,m,b){return this._runTask(vi(c,typeof m=="boolean"?m:!1),y(arguments))},f.prototype.branch=function(c,m){return this._runTask(gi(k(arguments)),y(arguments))},f.prototype.branchLocal=function(c){return this._runTask(yi(),y(arguments))},f.prototype.raw=function(c){let m=!Array.isArray(c),b=[].slice.call(m?arguments:c,0);for(let G=0;G<b.length&&m;G++)if(!v(b[G])){b.splice(G,b.length-G);break}b.push(...k(arguments,0,!0));var C=y(arguments);return b.length?this._runTask(U(b,this._trimmed),C):this._runTask(a("Raw: must supply one or more command to execute"),C)},f.prototype.submoduleAdd=function(c,m,b){return this._runTask(Ii(c,m),y(arguments))},f.prototype.submoduleUpdate=function(c,m){return this._runTask(Ui(k(arguments,!0)),y(arguments))},f.prototype.submoduleInit=function(c,m){return this._runTask(Ni(k(arguments,!0)),y(arguments))},f.prototype.subModule=function(c,m){return this._runTask(Gi(k(arguments)),y(arguments))},f.prototype.listRemote=function(){return this._runTask(ji(k(arguments)),y(arguments))},f.prototype.addRemote=function(c,m,b){return this._runTask(Ci(c,m,k(arguments)),y(arguments))},f.prototype.removeRemote=function(c,m){return this._runTask(Li(c),y(arguments))},f.prototype.getRemotes=function(c,m){return this._runTask($i(c===!0),y(arguments))},f.prototype.remote=function(c,m){return this._runTask(Di(k(arguments)),y(arguments))},f.prototype.tag=function(c,m){let b=k(arguments);return b[0]!=="tag"&&b.unshift("tag"),this._runTask(U(b),y(arguments))},f.prototype.updateServerInfo=function(c){return this._runTask(U(["update-server-info"]),y(arguments))},f.prototype.pushTags=function(c,m){let b=Oi({remote:P(c,g)},k(arguments));return this._runTask(b,y(arguments))},f.prototype.rm=function(c){return this._runTask(U(["rm","-f",...u(c)]),y(arguments))},f.prototype.rmKeepLocal=function(c){return this._runTask(U(["rm","--cached",...u(c)]),y(arguments))},f.prototype.catFile=function(c,m){return this._catFile("utf-8",arguments)},f.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},f.prototype._catFile=function(c,m){var b=y(m),C=["cat-file"],G=m[0];if(typeof G=="string")return this._runTask(a("Git.catFile: options must be supplied as an array of strings"),b);Array.isArray(G)&&C.push.apply(C,G);let Yt=c==="buffer"?Qi(C):U(C);return this._runTask(Yt,b)},f.prototype.diff=function(c,m){let b=g(c)?a("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):U(["diff",...k(arguments)]);return this._runTask(b,y(arguments))},f.prototype.diffSummary=function(){return this._runTask(Ai(k(arguments,1)),y(arguments))},f.prototype.applyPatch=function(c){let m=w(c)?di(u(c),k([].slice.call(arguments,1))):a("git.applyPatch requires one or more string patches as the first argument");return this._runTask(m,y(arguments))},f.prototype.revparse=function(){let c=["rev-parse",...k(arguments,!0)];return this._runTask(U(c,!0),y(arguments))},f.prototype.clean=function(c,m,b){let C=xi(c),G=C&&c.join("")||P(c,g)||"",Yt=k([].slice.call(arguments,C?1:0));return this._runTask(Si(G,Yt),y(arguments))},f.prototype.exec=function(c){let m={commands:[],format:"utf-8",parser(){typeof c=="function"&&c()}};return this._runTask(m)},f.prototype.clearQueue=function(){return this._runTask(o(()=>console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},f.prototype.checkIgnore=function(c,m){return this._runTask(ki(u(P(c,w,[]))),y(arguments))},f.prototype.checkIsRepo=function(c,m){return this._runTask(_i(P(c,g)),y(arguments))},e.exports=f}});vt();Y();var Yu=class extends Q{static{s(this,"GitConstructError")}constructor(t,e){super(void 0,e),this.config=t}};Y();Y();var z=class extends Q{static{s(this,"GitPluginError")}constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};lt();fn();Cn();Un();zn();Vn();Yn();ts();function Ku(t){return t?[{type:"spawn.before",action(n,i){t.aborted&&i.kill(new z(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,i){function o(){i.kill(new z(void 0,"abort","Abort signal received"))}s(o,"kill"),t.addEventListener("abort",o),i.spawned.on("close",()=>t.removeEventListener("abort",o))}}]:void 0}s(Ku,"abortPlugin");function Xu(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}s(Xu,"isConfigSwitch");function Zu(t,e){if(typeof e!="string"||!e.includes(t))return!1;let r=e.replace(/\0g/,"").replace(/^(--no)?-{1,2}/,"");return/^[\dlsqvnobucj]+\b/.test(r)}s(Zu,"isCloneSwitch");function tc(t,e){if(Xu(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new z(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}s(tc,"preventProtocolOverride");function ec(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new z(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&Zu("u",t))throw new z(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 z(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}s(ec,"preventUploadPack");function rc({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((i,o)=>{let a=o<r.length?r[o+1]:"";t||tc(i,a),e||ec(i,n.method)}),r}}}s(rc,"blockUnsafeOperationsPlugin");h();function nc(t){let e=gt(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}s(nc,"commandConfigPrefixingPlugin");h();var un=(0,ut.deferred)().promise;function sc({onClose:t=!0,onExit:e=50}={}){function r(){let i=-1,o={close:(0,ut.deferred)(),closeTimeout:(0,ut.deferred)(),exit:(0,ut.deferred)(),exitTimeout:(0,ut.deferred)()},a=Promise.race([t===!1?un:o.closeTimeout.promise,e===!1?un:o.exitTimeout.promise]);return n(t,o.close,o.closeTimeout),n(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}}s(r,"createEvents");function n(i,o,a){i!==!1&&(i===!0?o.promise:o.promise.then(()=>fe(i))).then(a.done)}return s(n,"configureTimeout"),{type:"spawn.after",async action(i,{spawned:o,close:a}){let u=r(),p=!0,v=s(()=>{p=!1},"quickClose");o.stdout?.on("data",v),o.stderr?.on("data",v),o.on("error",v),o.on("close",g=>u.close(g)),o.on("exit",g=>u.exit(g));try{await u.result,p&&await fe(50),a(u.exitCode)}catch(g){a(u.exitCode,g)}}}}s(sc,"completionDetectionPlugin");h();var ic="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",cn="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function oc(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}s(oc,"isBadArgument");function ln(t,e){if(t.length<1||t.length>2)throw new z(void 0,"binary",ic);if(t.some(oc))if(e)console.warn(cn);else throw new z(void 0,"binary",cn);let[n,i]=t;return{binary:n,prefix:i}}s(ln,"toBinaryConfig");function ac(t,e=["git"],r=!1){let n=ln(q(e),r);t.on("binary",i=>{n=ln(q(i),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}s(ac,"customBinaryPlugin");Y();function uc(t){return!!(t.exitCode&&t.stdErr.length)}s(uc,"isTaskError");function cc(t){return Buffer.concat([...t.stdOut,...t.stdErr])}s(cc,"getErrorMessage");function lc(t=!1,e=uc,r=cc){return(n,i)=>!t&&n||!e(i)?n:r(i)}s(lc,"errorDetectionHandler");function pn(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new Q(void 0,n.toString("utf-8"))}:{error:n}}}}s(pn,"errorDetectionPlugin");h();var mc=class{static{s(this,"PluginStore")}constructor(){this.plugins=new Set,this.events=new pc}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=N(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return q(t).forEach(r=>r&&this.plugins.add(N(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,i=Object.freeze(Object.create(r));for(let o of this.plugins)o.type===t&&(n=o.action(n,i));return n}};h();function fc(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(o,a){return r.includes(a.method)?bn(o,e):o}},{type:"spawn.after",action(o,a){a.commands.includes(e)&&a.spawned.stderr?.on("data",u=>{let p=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(u.toString("utf8"));p&&t({method:a.method,stage:hc(p[1]),progress:_(p[2]),processed:_(p[3]),total:_(p[4])})})}}]}s(fc,"progressMonitorPlugin");function hc(t){return String(t.toLowerCase().split(" ",1))||"unknown"}s(hc,"progressEventStage");h();function dc(t){let e=_n(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}s(dc,"spawnOptionsPlugin");function gc({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,i){let o;function a(){o&&clearTimeout(o),o=setTimeout(p,t)}s(a,"wait");function u(){i.spawned.stdout?.off("data",a),i.spawned.stderr?.off("data",a),i.spawned.off("exit",u),i.spawned.off("close",u),o&&clearTimeout(o)}s(u,"stop");function p(){u(),i.kill(new z(void 0,"timeout","block timeout reached"))}s(p,"kill"),r&&i.spawned.stdout?.on("data",a),e&&i.spawned.stderr?.on("data",a),i.spawned.on("exit",u),i.spawned.on("close",u),a()}}}s(gc,"timeoutPlugin");vt();function yc(){return{type:"spawn.args",action(t){let e=[],r;function n(i){(r=r||[]).push(...i)}s(n,"append2");for(let i=0;i<t.length;i++){let o=t[i];if(Dt(o)){n(Dr(o));continue}if(o==="--"){n(t.slice(i+1).flatMap(a=>Dt(a)&&Dr(a)||a));break}e.push(o)}return r?[...e,"--",...r.map(String)]:e}}}s(yc,"suffixPathsPlugin");h();var vc=Hu();function bc(t,e){let r=new mc,n=xn(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Oe(n.baseDir))throw new Yu(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(nc(n.config)),r.add(rc(n.unsafe)),r.add(yc()),r.add(sc(n.completion)),n.abort&&r.add(Ku(n.abort)),n.progress&&r.add(fc(n.progress)),n.timeout&&r.add(gc(n.timeout)),n.spawnOptions&&r.add(dc(n.spawnOptions)),r.add(pn(lc(!0))),n.errors&&r.add(pn(n.errors)),ac(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new vc(n,r)}s(bc,"gitInstanceFactory");lt();var mi=bc;var Pp={...Cr,"--allow-different-app":Boolean,"--allow-unknown-directory":Boolean},Xe=class t{constructor(e,r,n,i,o,a){this.ctx=e;this.args=r;this.directory=n;this.appIdentity=i;this.previousEnvironment=o;this.state=a;this.ctx=e.child({name:"sync-json",fields:s(()=>({syncJson:{directory:this.directory.path,branch:this.gitBranch,...this.state}}),"fields")})}static{s(this,"SyncJson")}gitBranch;get edit(){return this.appIdentity.edit}get application(){return this.appIdentity.application}get environment(){return this.appIdentity.environment}get filesVersion(){let e=this.state.environments[this.state.environment];return Ke(e,"environment must exist in environments"),BigInt(e.filesVersion)}static async load(e,{command:r,args:n,directory:i,appIdentity:o}){e=e.child({name:"sync-json"}),o??=await ht.load(e,{command:r,args:n,directory:i});let a=o.syncJsonState;if(!a)return;if(a.application!==o.application.slug){if(n["--allow-different-app"]){let v={application:o.application.slug,environment:o.environment.name,environments:{[o.environment.name]:{filesVersion:"0"}}},g=o.environment.type===ot.Production?new St(e,n,i,o,void 0,v):new t(e,n,i,o,void 0,v);return await g.loadGitBranch(),g}throw new J(T`
|
|
86
|
-
You were about to sync the following app to the following directory:
|
|
87
|
-
|
|
88
|
-
${o.application.slug} (${o.environment.name}) → ${i.path}
|
|
89
|
-
|
|
90
|
-
However, that directory has already been synced with this app:
|
|
91
|
-
|
|
92
|
-
${a.application} (${a.environment})
|
|
93
|
-
|
|
94
|
-
If you're sure that you want to sync:
|
|
95
|
-
|
|
96
|
-
${o.application.slug} (${o.environment.name}) → ${i.path}
|
|
97
|
-
|
|
98
|
-
Run "ggt dev" with the {bold --allow-different-app} flag.
|
|
99
|
-
`)}let u;a.environment!==o.environment.name&&(o.environment.type!=="production"&&mt({ensureEmptyLineAbove:!0,content:T`
|
|
100
|
-
Changing environment.
|
|
101
|
-
|
|
102
|
-
${a.environment} → ${o.environment.name}
|
|
103
|
-
`}),u=a.environment,a.environment=o.environment.name,a.environments[o.environment.name]||(a.environments[o.environment.name]={filesVersion:"0"}));let p=o.environment.type===ot.Production?new St(e,n,i,o,u,a):new t(e,n,i,o,u,a);return await p.save(p.filesVersion),await p.loadGitBranch(),p}static async loadOrAskAndInit(e,{command:r,args:n,directory:i}){e=e.child({name:"sync-json"});let o=await ht.load(e,{command:r,args:n,directory:i}),a=await t.load(e,{command:r,args:n,directory:i,appIdentity:o});if(a)return a;if(await i.hasFiles()&&!n["--allow-unknown-directory"])throw new At({command:r,args:n,directory:i});await Ye.default.ensureDir(i.path);let u={application:o.application.slug,environment:o.environment.name,environments:{[o.environment.name]:{filesVersion:"0"}}};return a=o.environment.type==="production"?new St(e,n,i,o,void 0,u):new t(e,n,i,o,void 0,u),await a.save(a.filesVersion),await a.loadGitBranch(),a}async save(e){let r=this.state.environments[this.state.environment];Ke(r,"environment must exist in environments"),r.filesVersion=String(e),this.ctx.log.debug("saving .gadget/sync.json"),await Ye.default.outputJSON(this.directory.absolute(".gadget/sync.json"),this.state,{spaces:2})}async loadGitBranch(){this.gitBranch=await kc(this.ctx,{directory:this.directory})}sprint(e={}){let r=$`
|
|
104
|
-
Application ${this.environment.application.slug}
|
|
105
|
-
Environment ${this.environment.name}
|
|
106
|
-
`;this.gitBranch&&(r+=$({indent:5,content:`Branch ${this.gitBranch}`}));let n=Xt.domains.app;return nt.isSupported?r+=$({ensureEmptyLineAbove:!0,content:`${nt(ft.link("Preview"),`https://${this.environment.application.slug}--${this.environment.name}.${n}`)} ${nt(ft.link("Editor"),`https://${this.environment.application.primaryDomain}/edit/${this.environment.name}`)} ${nt(ft.link("Playground"),`https://${this.environment.application.primaryDomain}/api/playground/javascript?environment=${this.environment.name}`)} ${nt(ft.link("Docs"),`https://docs.gadget.dev/api/${this.environment.application.slug}`)}`}):r+=$`
|
|
107
|
-
------------------------
|
|
108
|
-
Preview https://${this.environment.application.slug}--${this.environment.name}.${n}
|
|
109
|
-
Editor https://${this.environment.application.primaryDomain}/edit/${this.environment.name}
|
|
110
|
-
Playground https://${this.environment.application.primaryDomain}/api/playground/javascript?environment=${this.environment.name}
|
|
111
|
-
Docs https://docs.gadget.dev/api/${this.environment.application.slug}
|
|
112
|
-
`,$({...e,content:r})}print(e){e=lr(e,{ensureEmptyLineAbove:!0}),mt(this.sprint(e))}},St=class extends Xe{static{s(this,"EphemeralSyncJson")}async save(e){let r=this.state.environments[this.state.environment];return Ke(r,"environment must exist in environments"),r.filesVersion=String(e),Promise.resolve()}},Op=s(async t=>{Xt.windows&&t.startsWith("~/")&&(t=pr(t.slice(2)));let e=await ur(".gadget/sync.json",{cwd:t});return e&&(t=fi.join(e,"../..")),t=fi.resolve(t),await yr.init(t)},"loadSyncJsonDirectory"),kc=s(async(t,{directory:e})=>{try{return await mi(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},"loadBranch");export{Ac as a,ee as b,Ec as c,Rc as d,Pc as e,Tr as f,At as g,Sr as h,xr as i,Ar as j,Hi as k,Nc as l,Et as m,Cr as n,ht as o,Pp as p,Xe as q,Op as r};
|
|
113
|
-
//# sourceMappingURL=chunk-XC4F2TLW.js.map
|