@capgo/cli 8.4.1 → 8.5.1

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/dist/src/sdk.js CHANGED
@@ -124,7 +124,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
124
124
  `)}),$.__defineSetter__("stack",function(X){return[X].concat($.stack).join(`
125
125
 
126
126
  `)}),$}});var sx=E((ke0,ax)=>{var I4=l("constants"),TW0=process.cwd,yF=null,CW0=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!yF)yF=TW0.call(process);return yF};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(bF=process.chdir,process.chdir=function(D){yF=null,bF.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,bF)}var bF;ax.exports=PW0;function PW0(D){if(I4.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)X(D);if(D.chown=F(D.chown),D.fchown=F(D.fchown),D.lchown=F(D.lchown),D.chmod=J(D.chmod),D.fchmod=J(D.fchmod),D.lchmod=J(D.lchmod),D.chownSync=Q(D.chownSync),D.fchownSync=Q(D.fchownSync),D.lchownSync=Q(D.lchownSync),D.chmodSync=Y(D.chmodSync),D.fchmodSync=Y(D.fchmodSync),D.lchmodSync=Y(D.lchmodSync),D.stat=U(D.stat),D.fstat=U(D.fstat),D.lstat=U(D.lstat),D.statSync=Z(D.statSync),D.fstatSync=Z(D.fstatSync),D.lstatSync=Z(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(O,q,w){if(w)process.nextTick(w)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(O,q,w,W){if(W)process.nextTick(W)},D.lchownSync=function(){};if(CW0==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(O){function q(w,W,K){var H=Date.now(),B=0;O(w,W,function M(j){if(j&&(j.code==="EACCES"||j.code==="EPERM"||j.code==="EBUSY")&&Date.now()-H<60000){if(setTimeout(function(){D.stat(W,function(z,V){if(z&&z.code==="ENOENT")O(w,W,M);else K(j)})},B),B<100)B+=10;return}if(K)K(j)})}if(Object.setPrototypeOf)Object.setPrototypeOf(q,O);return q}(D.rename);D.read=typeof D.read!=="function"?D.read:function(O){function q(w,W,K,H,B,M){var j;if(M&&typeof M==="function"){var z=0;j=function(V,N,A){if(V&&V.code==="EAGAIN"&&z<10)return z++,O.call(D,w,W,K,H,B,j);M.apply(this,arguments)}}return O.call(D,w,W,K,H,B,j)}if(Object.setPrototypeOf)Object.setPrototypeOf(q,O);return q}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(O){return function(q,w,W,K,H){var B=0;while(!0)try{return O.call(D,q,w,W,K,H)}catch(M){if(M.code==="EAGAIN"&&B<10){B++;continue}throw M}}}(D.readSync);function $(O){O.lchmod=function(q,w,W){O.open(q,I4.O_WRONLY|I4.O_SYMLINK,w,function(K,H){if(K){if(W)W(K);return}O.fchmod(H,w,function(B){O.close(H,function(M){if(W)W(B||M)})})})},O.lchmodSync=function(q,w){var W=O.openSync(q,I4.O_WRONLY|I4.O_SYMLINK,w),K=!0,H;try{H=O.fchmodSync(W,w),K=!1}finally{if(K)try{O.closeSync(W)}catch(B){}else O.closeSync(W)}return H}}function X(O){if(I4.hasOwnProperty("O_SYMLINK")&&O.futimes)O.lutimes=function(q,w,W,K){O.open(q,I4.O_SYMLINK,function(H,B){if(H){if(K)K(H);return}O.futimes(B,w,W,function(M){O.close(B,function(j){if(K)K(M||j)})})})},O.lutimesSync=function(q,w,W){var K=O.openSync(q,I4.O_SYMLINK),H,B=!0;try{H=O.futimesSync(K,w,W),B=!1}finally{if(B)try{O.closeSync(K)}catch(M){}else O.closeSync(K)}return H};else if(O.futimes)O.lutimes=function(q,w,W,K){if(K)process.nextTick(K)},O.lutimesSync=function(){}}function J(O){if(!O)return O;return function(q,w,W){return O.call(D,q,w,function(K){if(G(K))K=null;if(W)W.apply(this,arguments)})}}function Y(O){if(!O)return O;return function(q,w){try{return O.call(D,q,w)}catch(W){if(!G(W))throw W}}}function F(O){if(!O)return O;return function(q,w,W,K){return O.call(D,q,w,W,function(H){if(G(H))H=null;if(K)K.apply(this,arguments)})}}function Q(O){if(!O)return O;return function(q,w,W){try{return O.call(D,q,w,W)}catch(K){if(!G(K))throw K}}}function U(O){if(!O)return O;return function(q,w,W){if(typeof w==="function")W=w,w=null;function K(H,B){if(B){if(B.uid<0)B.uid+=4294967296;if(B.gid<0)B.gid+=4294967296}if(W)W.apply(this,arguments)}return w?O.call(D,q,w,K):O.call(D,q,K)}}function Z(O){if(!O)return O;return function(q,w){var W=w?O.call(D,q,w):O.call(D,q);if(W){if(W.uid<0)W.uid+=4294967296;if(W.gid<0)W.gid+=4294967296}return W}}function G(O){if(!O)return!0;if(O.code==="ENOSYS")return!0;var q=!process.getuid||process.getuid()!==0;if(q){if(O.code==="EINVAL"||O.code==="EPERM")return!0}return!1}}});var $_=E((ye0,D_)=>{var ex=l("stream").Stream;D_.exports=SW0;function SW0(D){return{ReadStream:$,WriteStream:X};function $(J,Y){if(!(this instanceof $))return new $(J,Y);ex.call(this);var F=this;this.path=J,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,Y=Y||{};var Q=Object.keys(Y);for(var U=0,Z=Q.length;U<Z;U++){var G=Q[U];this[G]=Y[G]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){F._read()});return}D.open(this.path,this.flags,this.mode,function(O,q){if(O){F.emit("error",O),F.readable=!1;return}F.fd=q,F.emit("open",q),F._read()})}function X(J,Y){if(!(this instanceof X))return new X(J,Y);ex.call(this),this.path=J,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,Y=Y||{};var F=Object.keys(Y);for(var Q=0,U=F.length;Q<U;Q++){var Z=F[Q];this[Z]=Y[Z]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var J_=E((be0,X_)=>{X_.exports=uW0;var vW0=Object.getPrototypeOf||function(D){return D.__proto__};function uW0(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:vW0(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(D,X))}),$}});var mD=E((ge0,NW)=>{var xD=l("fs"),xW0=sx(),_W0=$_(),fW0=J_(),gF=l("util"),Z1,mF;if(typeof Symbol==="function"&&typeof Symbol.for==="function")Z1=Symbol.for("graceful-fs.queue"),mF=Symbol.for("graceful-fs.previous");else Z1="___graceful-fs.queue",mF="___graceful-fs.previous";function kW0(){}function F_(D,$){Object.defineProperty(D,Z1,{get:function(){return $}})}var n8=kW0;if(gF.debuglog)n8=gF.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))n8=function(){var D=gF.format.apply(gF,arguments);D="GFS4: "+D.split(/\n/).join(`
127
- GFS4: `),console.error(D)};if(!xD[Z1]){if(HW=global[Z1]||[],F_(xD,HW),xD.close=function(D){function $(X,J){return D.call(xD,X,function(Y){if(!Y)Y_();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,mF,{value:D}),$}(xD.close),xD.closeSync=function(D){function $(X){D.apply(xD,arguments),Y_()}return Object.defineProperty($,mF,{value:D}),$}(xD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n8(xD[Z1]),l("assert").equal(xD[Z1].length,0)})}var HW;if(!global[Z1])F_(global,xD[Z1]);NW.exports=zW(fW0(xD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xD.__patched)NW.exports=zW(xD),xD.__patched=!0;function zW(D){xW0(D),D.gracefulify=zW,D.createReadStream=N,D.createWriteStream=A;var $=D.readFile;D.readFile=X;function X(I,x,P){if(typeof x==="function")P=x,x=null;return m(I,x,P);function m(b,p,k,R){return $(b,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))x5([m,[b,p,k],S,R||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return J(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Q;function Q(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return F(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(I,x,P,m){if(typeof P==="function")m=P,P=0;return b(I,x,P,m);function b(p,k,R,S,v){return U(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=q;var O=/^v[0-5]\./;function q(I,x,P){if(typeof x==="function")P=x,x=null;var m=O.test(process.version)?function(k,R,S,v){return G(k,b(k,R,S,v))}:function(k,R,S,v){return G(k,R,b(k,R,S,v))};return m(I,x,P);function b(p,k,R,S){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))x5([m,[p,k,R],v,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof R==="function")R.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var w=_W0(D);M=w.ReadStream,z=w.WriteStream}var W=D.ReadStream;if(W)M.prototype=Object.create(W.prototype),M.prototype.open=j;var K=D.WriteStream;if(K)z.prototype=Object.create(K.prototype),z.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(I){M=I},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(I){z=I},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(I){H=I},enumerable:!0,configurable:!0});var B=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return B},set:function(I){B=I},enumerable:!0,configurable:!0});function M(I,x){if(this instanceof M)return W.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function j(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x){if(I.autoClose)I.destroy();I.emit("error",x)}else I.fd=P,I.emit("open",P),I.read()})}function z(I,x){if(this instanceof z)return K.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function V(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x)I.destroy(),I.emit("error",x);else I.fd=P,I.emit("open",P)})}function N(I,x){return new D.ReadStream(I,x)}function A(I,x){return new D.WriteStream(I,x)}var u=D.open;D.open=_;function _(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return u(p,k,R,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function x5(D){n8("ENQUEUE",D[0].name,D[1]),xD[Z1].push(D),VW()}var hF;function Y_(){var D=Date.now();for(var $=0;$<xD[Z1].length;++$)if(xD[Z1][$].length>2)xD[Z1][$][3]=D,xD[Z1][$][4]=D;VW()}function VW(){if(clearTimeout(hF),hF=void 0,xD[Z1].length===0)return;var D=xD[Z1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],F=D[4];if(Y===void 0)n8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){n8("TIMEOUT",$.name,X);var Q=X.pop();if(typeof Q==="function")Q.call(null,J)}else{var U=Date.now()-F,Z=Math.max(F-Y,1),G=Math.min(Z*1.2,100);if(U>=G)n8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else xD[Z1].push(D)}if(hF===void 0)hF=setTimeout(VW,0)}});var U_=E((he0,Q_)=>{function E$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}Q_.exports=E$;E$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};E$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};E$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var J=this,Y=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},X);if(this._options.unref)Y.unref();return!0};E$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};E$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};E$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};E$.prototype.start=E$.prototype.try;E$.prototype.errors=function(){return this._errors};E$.prototype.attempts=function(){return this._attempts};E$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var J=0;J<this._errors.length;J++){var Y=this._errors[J],F=Y.message,Q=(D[F]||0)+1;if(D[F]=Q,Q>=X)$=Y,X=Q}return $}});var G_=E((bW0)=>{var yW0=U_();bW0.operation=function(D){var $=bW0.timeouts(D);return new yW0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};bW0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var Y=0;Y<$.retries;Y++)J.push(this.createTimeout(Y,$));if(D&&D.forever&&!J.length)J.push(this.createTimeout(Y,$));return J.sort(function(F,Q){return F-Q}),J};bW0.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,J=Math.round(X*$.minTimeout*Math.pow($.factor,D));return J=Math.min(J,$.maxTimeout),J};bW0.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var J in D)if(typeof D[J]==="function")X.push(J)}for(var Y=0;Y<X.length;Y++){var F=X[Y],Q=D[F];D[F]=function(Z){var G=bW0.operation($),O=Array.prototype.slice.call(arguments,1),q=O.pop();O.push(function(w){if(G.retry(w))return;if(w)arguments[0]=G.mainError();q.apply(this,arguments)}),G.attempt(function(){Z.apply(D,O)})}.bind(D,Q),D[F].options=$}}});var O_=E((ce0,cF)=>{cF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")cF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lF=E((de0,f5)=>{var TD=global.process,l8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!l8(TD))f5.exports=function(){return function(){}};else{if(LW=l("assert"),i8=O_(),BW=/^win/i.test(TD.platform),_5=l("events"),typeof _5!=="function")_5=_5.EventEmitter;if(TD.__signal_exit_emitter__)sD=TD.__signal_exit_emitter__;else sD=TD.__signal_exit_emitter__=new _5,sD.count=0,sD.emitted={};if(!sD.infinite)sD.setMaxListeners(1/0),sD.infinite=!0;f5.exports=function(D,$){if(!l8(global.process))return function(){};if(LW.equal(typeof D,"function","a callback must be provided for exit handler"),p8===!1)dF();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(sD.removeListener(X,D),sD.listeners("exit").length===0&&sD.listeners("afterexit").length===0)v2()};return sD.on(X,D),J},v2=function(){if(!p8||!l8(global.process))return;p8=!1,i8.forEach(function($){try{TD.removeListener($,u2[$])}catch(X){}}),TD.emit=x2,TD.reallyExit=nF,sD.count-=1},f5.exports.unload=v2,E4=function($,X,J){if(sD.emitted[$])return;sD.emitted[$]=!0,sD.emit($,X,J)},u2={},i8.forEach(function(D){u2[D]=function(){if(!l8(global.process))return;var X=TD.listeners(D);if(X.length===sD.count){if(v2(),E4("exit",null,D),E4("afterexit",null,D),BW&&D==="SIGHUP")D="SIGINT";TD.kill(TD.pid,D)}}}),f5.exports.signals=function(){return i8},p8=!1,dF=function(){if(p8||!l8(global.process))return;p8=!0,sD.count+=1,i8=i8.filter(function($){try{return TD.on($,u2[$]),!0}catch(X){return!1}}),TD.emit=jW,TD.reallyExit=MW},f5.exports.load=dF,nF=TD.reallyExit,MW=function($){if(!l8(global.process))return;TD.exitCode=$||0,E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),nF.call(TD,TD.exitCode)},x2=TD.emit,jW=function($,X){if($==="exit"&&l8(global.process)){if(X!==void 0)TD.exitCode=X;var J=x2.apply(this,arguments);return E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),J}else return x2.apply(this,arguments)}}var LW,i8,BW,_5,sD,v2,E4,u2,p8,dF,nF,MW,x2,jW});var w_=E((nW0,IW)=>{var q_=Symbol();function cW0(D,$,X){let J=$[q_];if(J)return $.stat(D,(F,Q)=>{if(F)return X(F);X(null,Q.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(F)=>{if(F)return X(F);$.stat(D,(Q,U)=>{if(Q)return X(Q);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,q_,{value:Z}),X(null,U.mtime,Z)})})}function dW0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}nW0.probe=cW0;nW0.getMtime=dW0});var V_=E((eW0,f2)=>{var pW0=l("path"),RW=mD(),rW0=G_(),tW0=lF(),W_=w_(),c6={};function _2(D,$){return $.lockfilePath||`${D}.lock`}function TW(D,$,X){if(!$.realpath)return X(null,pW0.resolve(D));$.fs.realpath(D,X)}function AW(D,$,X){let J=_2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return W_.probe(J,$.fs,(F,Q,U)=>{if(F)return $.fs.rmdir(J,()=>{}),X(F);X(null,Q,U)});if(Y.code!=="EEXIST")return X(Y);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(J,(F,Q)=>{if(F){if(F.code==="ENOENT")return AW(D,{...$,stale:0},X);return X(F)}if(!K_(Q,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));H_(D,$,(U)=>{if(U)return X(U);AW(D,{...$,stale:0},X)})})})}function K_(D,$){return D.mtime.getTime()<Date.now()-$.stale}function H_(D,$,X){$.fs.rmdir(_2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function iF(D,$){let X=c6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let F=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||F)return EW(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return EW(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=W_.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||G)return EW(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,iF(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function EW(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(c6[D]===$)delete c6[D];$.options.onCompromised(X)}function oW0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:RW,onCompromised:(J)=>{throw J},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),TW(D,$,(J,Y)=>{if(J)return X(J);let F=rW0.operation($.retries);F.attempt(()=>{AW(Y,$,(Q,U,Z)=>{if(F.retry(Q))return;if(Q)return X(F.mainError());let G=c6[Y]={lockfilePath:_2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};iF(Y,$),X(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));z_(Y,{...$,realpath:!1},O)})})})})}function z_(D,$,X){$={fs:RW,realpath:!0,...$},TW(D,$,(J,Y)=>{if(J)return X(J);let F=c6[Y];if(!F)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete c6[Y],H_(Y,$,X)})}function aW0(D,$,X){$={stale:1e4,realpath:!0,fs:RW,...$},$.stale=Math.max($.stale||0,2000),TW(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(_2(Y,$),(F,Q)=>{if(F)return F.code==="ENOENT"?X(null,!1):X(F);return X(null,!K_(Q,$))})})}function sW0(){return c6}tW0(()=>{for(let D in c6){let $=c6[D].options;try{$.fs.rmdirSync(_2(D,$))}catch(X){}}});eW0.lock=oW0;eW0.unlock=z_;eW0.check=aW0;eW0.getLocks=sW0});var L_=E((ne0,N_)=>{var YK0=mD();function FK0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let F=Y.pop(),Q;try{Q=D[`${J}Sync`](...Y)}catch(U){return F(U)}F(null,Q)}}),X}function QK0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,F)=>{if(Y)J(Y);else X(F)}),D(...$)})}function UK0(D){return(...$)=>{let X,J;if($.push((Y,F)=>{X=Y,J=F}),D(...$),X)throw X;return J}}function ZK0(D){if(D={...D},D.fs=FK0(D.fs||YK0),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}N_.exports={toPromise:QK0,toSync:UK0,toSyncOptions:ZK0}});var M_=E((le0,A4)=>{var k5=V_(),{toPromise:pF,toSync:rF,toSyncOptions:CW}=L_();async function B_(D,$){let X=await pF(k5.lock)(D,$);return pF(X)}function GK0(D,$){let X=rF(k5.lock)(D,CW($));return rF(X)}function OK0(D,$){return pF(k5.unlock)(D,$)}function qK0(D,$){return rF(k5.unlock)(D,CW($))}function wK0(D,$){return pF(k5.check)(D,$)}function WK0(D,$){return rF(k5.check)(D,CW($))}A4.exports=B_;A4.exports.lock=B_;A4.exports.unlock=OK0;A4.exports.lockSync=GK0;A4.exports.unlockSync=qK0;A4.exports.check=wK0;A4.exports.checkSync=WK0});var C_=E((R_)=>{Object.defineProperty(R_,"__esModule",{value:!0});R_.canStoreURLs=R_.FileUrlStorage=void 0;var j_=l("fs"),KK0=zK0(ox()),I_=HK0(M_());function A_(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(A_=function(J){return J?X:$})(D)}function HK0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=A_($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Q=Y?Object.getOwnPropertyDescriptor(D,F):null;Q&&(Q.get||Q.set)?Object.defineProperty(J,F,Q):J[F]=D[F]}return J.default=D,X&&X.set(D,J),J}function zK0(D){return D&&D.__esModule?D:{default:D}}function k2(D){return k2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},k2(D)}function VK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function E_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,LK0(J.key),J)}}function NK0(D,$,X){if($)E_(D.prototype,$);if(X)E_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function LK0(D){var $=BK0(D,"string");return k2($)=="symbol"?$:$+""}function BK0(D,$){if(k2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(k2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var ie0=R_.canStoreURLs=!0,pe0=R_.FileUrlStorage=function(){function D($){VK0(this,D),this.path=$}return NK0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(F,Q){if(F)Y(F);else J(Q)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,F){J._getItems("tus::".concat(X),function(Q,U){if(Q)F(Q);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,F){J._removeItem(X,function(Q){if(Q)F(Q);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,F=Math.round(Math.random()*1000000000000),Q="tus::".concat(X,"::").concat(F);return new Promise(function(U,Z){Y._setItem(Q,J,function(G){if(G)Z(G);else U(Q)})})}},{key:"_setItem",value:function(X,J,Y){var F=this;I_.lock(this.path,this._lockfileOptions()).then(function(Q){Y=F._releaseAndCb(Q,Y),F._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,F._writeData(Z,function(G){return Y(G)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,F){if(Y){J(Y);return}var Q=Object.keys(F).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=F[U];return Z.urlStorageKey=U,Z});J(null,Q)})}},{key:"_removeItem",value:function(X,J){var Y=this;I_.lock(this.path,this._lockfileOptions()).then(function(F){J=Y._releaseAndCb(F,J),Y._getData(function(Q,U){if(Q){J(Q);return}delete U[X],Y._writeData(U,function(Z){return J(Z)})})}).catch(J)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,J){return function(Y){if(Y){X().then(function(){return J(Y)}).catch(function(F){return J((0,KK0.default)([Y,F]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,j_.writeFile)(this.path,JSON.stringify(X),Y,function(F){return J(F)})}},{key:"_getData",value:function(X){(0,j_.readFile)(this.path,"utf8",function(J,Y){if(J){if(J.code==="ENOENT")X(null,{});else X(J);return}try{Y=!Y.trim().length?{}:JSON.parse(Y)}catch(F){X(F);return}X(null,Y)})}}])}()});var oF=E((R4)=>{Object.defineProperty(R4,"__esModule",{value:!0});Object.defineProperty(R4,"DefaultHttpStack",{enumerable:!0,get:function(){return u_.default}});Object.defineProperty(R4,"DetailedError",{enumerable:!0,get:function(){return jK0.default}});Object.defineProperty(R4,"FileUrlStorage",{enumerable:!0,get:function(){return x_.FileUrlStorage}});Object.defineProperty(R4,"StreamSource",{enumerable:!0,get:function(){return TK0.default}});R4.Upload=void 0;Object.defineProperty(R4,"canStoreURLs",{enumerable:!0,get:function(){return x_.canStoreURLs}});R4.defaultOptions=void 0;Object.defineProperty(R4,"enableDebugLog",{enumerable:!0,get:function(){return IK0.enableDebugLog}});R4.isSupported=void 0;var jK0=r8(Cw()),IK0=Pw(),EK0=r8(Mv()),PW=r8(Du()),AK0=r8(Bu()),RK0=r8(Au()),u_=r8(mu()),TK0=r8(hw()),x_=C_();function r8(D){return D&&D.__esModule?D:{default:D}}function b5(D){return b5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},b5(D)}function CK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function P_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,f_(J.key),J)}}function PK0(D,$,X){if($)P_(D.prototype,$);if(X)P_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function SK0(D,$,X){return $=tF($),vK0(D,__()?Reflect.construct($,X||[],tF(D).constructor):$.apply(D,X))}function vK0(D,$){if($&&(b5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return uK0(D)}function uK0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function __(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(__=function(){return!!D})()}function tF(D){return tF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},tF(D)}function xK0(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)SW(D,$)}function SW(D,$){return SW=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},SW(D,$)}function S_(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(D);$&&(J=J.filter(function(Y){return Object.getOwnPropertyDescriptor(D,Y).enumerable})),X.push.apply(X,J)}return X}function y5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?S_(Object(X),!0).forEach(function(J){_K0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):S_(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function _K0(D,$,X){if($=f_($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function f_(D){var $=fK0(D,"string");return b5($)=="symbol"?$:$+""}function fK0(D,$){if(b5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(b5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var v_=R4.defaultOptions=y5(y5({},PW.default.defaultOptions),{},{httpStack:new u_.default,fileReader:new AK0.default,urlStorage:new EK0.default,fingerprint:RK0.default}),te0=R4.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return CK0(this,$),J=y5(y5({},v_),J),SK0(this,$,[X,J])}return xK0($,D),PK0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=y5(y5({},v_),Y),PW.default.terminate(J,Y)}}])}(PW.default),oe0=R4.isSupported=!0});var B1;var T4=r(()=>{B1={name:"@capgo/cli",type:"module",version:"8.4.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-keychain-darwin-arm64":"^1.0.0","@capgo/cli-keychain-darwin-x64":"^1.0.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});async function aF(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,J=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!J.ok)return null;return(await J.json())["dist-tags"]?.latest||null}catch{return null}}async function yK0(){let D=await aF("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:B1.version,latestVersion:D,isOutdated:!!D&&D!==B1.version,majorVersion:$}}async function VD(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await yK0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
127
+ GFS4: `),console.error(D)};if(!xD[Z1]){if(HW=global[Z1]||[],F_(xD,HW),xD.close=function(D){function $(X,J){return D.call(xD,X,function(Y){if(!Y)Y_();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,mF,{value:D}),$}(xD.close),xD.closeSync=function(D){function $(X){D.apply(xD,arguments),Y_()}return Object.defineProperty($,mF,{value:D}),$}(xD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n8(xD[Z1]),l("assert").equal(xD[Z1].length,0)})}var HW;if(!global[Z1])F_(global,xD[Z1]);NW.exports=zW(fW0(xD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xD.__patched)NW.exports=zW(xD),xD.__patched=!0;function zW(D){xW0(D),D.gracefulify=zW,D.createReadStream=N,D.createWriteStream=A;var $=D.readFile;D.readFile=X;function X(I,x,P){if(typeof x==="function")P=x,x=null;return m(I,x,P);function m(b,p,k,R){return $(b,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))x5([m,[b,p,k],S,R||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return J(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Q;function Q(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return F(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(I,x,P,m){if(typeof P==="function")m=P,P=0;return b(I,x,P,m);function b(p,k,R,S,v){return U(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=q;var O=/^v[0-5]\./;function q(I,x,P){if(typeof x==="function")P=x,x=null;var m=O.test(process.version)?function(k,R,S,v){return G(k,b(k,R,S,v))}:function(k,R,S,v){return G(k,R,b(k,R,S,v))};return m(I,x,P);function b(p,k,R,S){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))x5([m,[p,k,R],v,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof R==="function")R.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var w=_W0(D);M=w.ReadStream,z=w.WriteStream}var W=D.ReadStream;if(W)M.prototype=Object.create(W.prototype),M.prototype.open=j;var K=D.WriteStream;if(K)z.prototype=Object.create(K.prototype),z.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(I){M=I},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(I){z=I},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(I){H=I},enumerable:!0,configurable:!0});var B=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return B},set:function(I){B=I},enumerable:!0,configurable:!0});function M(I,x){if(this instanceof M)return W.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function j(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x){if(I.autoClose)I.destroy();I.emit("error",x)}else I.fd=P,I.emit("open",P),I.read()})}function z(I,x){if(this instanceof z)return K.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function V(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x)I.destroy(),I.emit("error",x);else I.fd=P,I.emit("open",P)})}function N(I,x){return new D.ReadStream(I,x)}function A(I,x){return new D.WriteStream(I,x)}var u=D.open;D.open=_;function _(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return u(p,k,R,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function x5(D){n8("ENQUEUE",D[0].name,D[1]),xD[Z1].push(D),VW()}var hF;function Y_(){var D=Date.now();for(var $=0;$<xD[Z1].length;++$)if(xD[Z1][$].length>2)xD[Z1][$][3]=D,xD[Z1][$][4]=D;VW()}function VW(){if(clearTimeout(hF),hF=void 0,xD[Z1].length===0)return;var D=xD[Z1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],F=D[4];if(Y===void 0)n8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){n8("TIMEOUT",$.name,X);var Q=X.pop();if(typeof Q==="function")Q.call(null,J)}else{var U=Date.now()-F,Z=Math.max(F-Y,1),G=Math.min(Z*1.2,100);if(U>=G)n8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else xD[Z1].push(D)}if(hF===void 0)hF=setTimeout(VW,0)}});var U_=E((he0,Q_)=>{function E$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}Q_.exports=E$;E$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};E$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};E$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var J=this,Y=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},X);if(this._options.unref)Y.unref();return!0};E$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};E$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};E$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};E$.prototype.start=E$.prototype.try;E$.prototype.errors=function(){return this._errors};E$.prototype.attempts=function(){return this._attempts};E$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var J=0;J<this._errors.length;J++){var Y=this._errors[J],F=Y.message,Q=(D[F]||0)+1;if(D[F]=Q,Q>=X)$=Y,X=Q}return $}});var G_=E((bW0)=>{var yW0=U_();bW0.operation=function(D){var $=bW0.timeouts(D);return new yW0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};bW0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var Y=0;Y<$.retries;Y++)J.push(this.createTimeout(Y,$));if(D&&D.forever&&!J.length)J.push(this.createTimeout(Y,$));return J.sort(function(F,Q){return F-Q}),J};bW0.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,J=Math.round(X*$.minTimeout*Math.pow($.factor,D));return J=Math.min(J,$.maxTimeout),J};bW0.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var J in D)if(typeof D[J]==="function")X.push(J)}for(var Y=0;Y<X.length;Y++){var F=X[Y],Q=D[F];D[F]=function(Z){var G=bW0.operation($),O=Array.prototype.slice.call(arguments,1),q=O.pop();O.push(function(w){if(G.retry(w))return;if(w)arguments[0]=G.mainError();q.apply(this,arguments)}),G.attempt(function(){Z.apply(D,O)})}.bind(D,Q),D[F].options=$}}});var O_=E((ce0,cF)=>{cF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")cF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lF=E((de0,f5)=>{var TD=global.process,l8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!l8(TD))f5.exports=function(){return function(){}};else{if(LW=l("assert"),i8=O_(),BW=/^win/i.test(TD.platform),_5=l("events"),typeof _5!=="function")_5=_5.EventEmitter;if(TD.__signal_exit_emitter__)sD=TD.__signal_exit_emitter__;else sD=TD.__signal_exit_emitter__=new _5,sD.count=0,sD.emitted={};if(!sD.infinite)sD.setMaxListeners(1/0),sD.infinite=!0;f5.exports=function(D,$){if(!l8(global.process))return function(){};if(LW.equal(typeof D,"function","a callback must be provided for exit handler"),p8===!1)dF();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(sD.removeListener(X,D),sD.listeners("exit").length===0&&sD.listeners("afterexit").length===0)v2()};return sD.on(X,D),J},v2=function(){if(!p8||!l8(global.process))return;p8=!1,i8.forEach(function($){try{TD.removeListener($,u2[$])}catch(X){}}),TD.emit=x2,TD.reallyExit=nF,sD.count-=1},f5.exports.unload=v2,E4=function($,X,J){if(sD.emitted[$])return;sD.emitted[$]=!0,sD.emit($,X,J)},u2={},i8.forEach(function(D){u2[D]=function(){if(!l8(global.process))return;var X=TD.listeners(D);if(X.length===sD.count){if(v2(),E4("exit",null,D),E4("afterexit",null,D),BW&&D==="SIGHUP")D="SIGINT";TD.kill(TD.pid,D)}}}),f5.exports.signals=function(){return i8},p8=!1,dF=function(){if(p8||!l8(global.process))return;p8=!0,sD.count+=1,i8=i8.filter(function($){try{return TD.on($,u2[$]),!0}catch(X){return!1}}),TD.emit=jW,TD.reallyExit=MW},f5.exports.load=dF,nF=TD.reallyExit,MW=function($){if(!l8(global.process))return;TD.exitCode=$||0,E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),nF.call(TD,TD.exitCode)},x2=TD.emit,jW=function($,X){if($==="exit"&&l8(global.process)){if(X!==void 0)TD.exitCode=X;var J=x2.apply(this,arguments);return E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),J}else return x2.apply(this,arguments)}}var LW,i8,BW,_5,sD,v2,E4,u2,p8,dF,nF,MW,x2,jW});var w_=E((nW0,IW)=>{var q_=Symbol();function cW0(D,$,X){let J=$[q_];if(J)return $.stat(D,(F,Q)=>{if(F)return X(F);X(null,Q.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(F)=>{if(F)return X(F);$.stat(D,(Q,U)=>{if(Q)return X(Q);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,q_,{value:Z}),X(null,U.mtime,Z)})})}function dW0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}nW0.probe=cW0;nW0.getMtime=dW0});var V_=E((eW0,f2)=>{var pW0=l("path"),RW=mD(),rW0=G_(),tW0=lF(),W_=w_(),c6={};function _2(D,$){return $.lockfilePath||`${D}.lock`}function TW(D,$,X){if(!$.realpath)return X(null,pW0.resolve(D));$.fs.realpath(D,X)}function AW(D,$,X){let J=_2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return W_.probe(J,$.fs,(F,Q,U)=>{if(F)return $.fs.rmdir(J,()=>{}),X(F);X(null,Q,U)});if(Y.code!=="EEXIST")return X(Y);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(J,(F,Q)=>{if(F){if(F.code==="ENOENT")return AW(D,{...$,stale:0},X);return X(F)}if(!K_(Q,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));H_(D,$,(U)=>{if(U)return X(U);AW(D,{...$,stale:0},X)})})})}function K_(D,$){return D.mtime.getTime()<Date.now()-$.stale}function H_(D,$,X){$.fs.rmdir(_2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function iF(D,$){let X=c6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let F=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||F)return EW(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return EW(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=W_.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||G)return EW(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,iF(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function EW(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(c6[D]===$)delete c6[D];$.options.onCompromised(X)}function oW0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:RW,onCompromised:(J)=>{throw J},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),TW(D,$,(J,Y)=>{if(J)return X(J);let F=rW0.operation($.retries);F.attempt(()=>{AW(Y,$,(Q,U,Z)=>{if(F.retry(Q))return;if(Q)return X(F.mainError());let G=c6[Y]={lockfilePath:_2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};iF(Y,$),X(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));z_(Y,{...$,realpath:!1},O)})})})})}function z_(D,$,X){$={fs:RW,realpath:!0,...$},TW(D,$,(J,Y)=>{if(J)return X(J);let F=c6[Y];if(!F)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete c6[Y],H_(Y,$,X)})}function aW0(D,$,X){$={stale:1e4,realpath:!0,fs:RW,...$},$.stale=Math.max($.stale||0,2000),TW(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(_2(Y,$),(F,Q)=>{if(F)return F.code==="ENOENT"?X(null,!1):X(F);return X(null,!K_(Q,$))})})}function sW0(){return c6}tW0(()=>{for(let D in c6){let $=c6[D].options;try{$.fs.rmdirSync(_2(D,$))}catch(X){}}});eW0.lock=oW0;eW0.unlock=z_;eW0.check=aW0;eW0.getLocks=sW0});var L_=E((ne0,N_)=>{var YK0=mD();function FK0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let F=Y.pop(),Q;try{Q=D[`${J}Sync`](...Y)}catch(U){return F(U)}F(null,Q)}}),X}function QK0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,F)=>{if(Y)J(Y);else X(F)}),D(...$)})}function UK0(D){return(...$)=>{let X,J;if($.push((Y,F)=>{X=Y,J=F}),D(...$),X)throw X;return J}}function ZK0(D){if(D={...D},D.fs=FK0(D.fs||YK0),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}N_.exports={toPromise:QK0,toSync:UK0,toSyncOptions:ZK0}});var M_=E((le0,A4)=>{var k5=V_(),{toPromise:pF,toSync:rF,toSyncOptions:CW}=L_();async function B_(D,$){let X=await pF(k5.lock)(D,$);return pF(X)}function GK0(D,$){let X=rF(k5.lock)(D,CW($));return rF(X)}function OK0(D,$){return pF(k5.unlock)(D,$)}function qK0(D,$){return rF(k5.unlock)(D,CW($))}function wK0(D,$){return pF(k5.check)(D,$)}function WK0(D,$){return rF(k5.check)(D,CW($))}A4.exports=B_;A4.exports.lock=B_;A4.exports.unlock=OK0;A4.exports.lockSync=GK0;A4.exports.unlockSync=qK0;A4.exports.check=wK0;A4.exports.checkSync=WK0});var C_=E((R_)=>{Object.defineProperty(R_,"__esModule",{value:!0});R_.canStoreURLs=R_.FileUrlStorage=void 0;var j_=l("fs"),KK0=zK0(ox()),I_=HK0(M_());function A_(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(A_=function(J){return J?X:$})(D)}function HK0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=A_($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Q=Y?Object.getOwnPropertyDescriptor(D,F):null;Q&&(Q.get||Q.set)?Object.defineProperty(J,F,Q):J[F]=D[F]}return J.default=D,X&&X.set(D,J),J}function zK0(D){return D&&D.__esModule?D:{default:D}}function k2(D){return k2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},k2(D)}function VK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function E_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,LK0(J.key),J)}}function NK0(D,$,X){if($)E_(D.prototype,$);if(X)E_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function LK0(D){var $=BK0(D,"string");return k2($)=="symbol"?$:$+""}function BK0(D,$){if(k2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(k2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var ie0=R_.canStoreURLs=!0,pe0=R_.FileUrlStorage=function(){function D($){VK0(this,D),this.path=$}return NK0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(F,Q){if(F)Y(F);else J(Q)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,F){J._getItems("tus::".concat(X),function(Q,U){if(Q)F(Q);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,F){J._removeItem(X,function(Q){if(Q)F(Q);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,F=Math.round(Math.random()*1000000000000),Q="tus::".concat(X,"::").concat(F);return new Promise(function(U,Z){Y._setItem(Q,J,function(G){if(G)Z(G);else U(Q)})})}},{key:"_setItem",value:function(X,J,Y){var F=this;I_.lock(this.path,this._lockfileOptions()).then(function(Q){Y=F._releaseAndCb(Q,Y),F._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,F._writeData(Z,function(G){return Y(G)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,F){if(Y){J(Y);return}var Q=Object.keys(F).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=F[U];return Z.urlStorageKey=U,Z});J(null,Q)})}},{key:"_removeItem",value:function(X,J){var Y=this;I_.lock(this.path,this._lockfileOptions()).then(function(F){J=Y._releaseAndCb(F,J),Y._getData(function(Q,U){if(Q){J(Q);return}delete U[X],Y._writeData(U,function(Z){return J(Z)})})}).catch(J)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,J){return function(Y){if(Y){X().then(function(){return J(Y)}).catch(function(F){return J((0,KK0.default)([Y,F]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,j_.writeFile)(this.path,JSON.stringify(X),Y,function(F){return J(F)})}},{key:"_getData",value:function(X){(0,j_.readFile)(this.path,"utf8",function(J,Y){if(J){if(J.code==="ENOENT")X(null,{});else X(J);return}try{Y=!Y.trim().length?{}:JSON.parse(Y)}catch(F){X(F);return}X(null,Y)})}}])}()});var oF=E((R4)=>{Object.defineProperty(R4,"__esModule",{value:!0});Object.defineProperty(R4,"DefaultHttpStack",{enumerable:!0,get:function(){return u_.default}});Object.defineProperty(R4,"DetailedError",{enumerable:!0,get:function(){return jK0.default}});Object.defineProperty(R4,"FileUrlStorage",{enumerable:!0,get:function(){return x_.FileUrlStorage}});Object.defineProperty(R4,"StreamSource",{enumerable:!0,get:function(){return TK0.default}});R4.Upload=void 0;Object.defineProperty(R4,"canStoreURLs",{enumerable:!0,get:function(){return x_.canStoreURLs}});R4.defaultOptions=void 0;Object.defineProperty(R4,"enableDebugLog",{enumerable:!0,get:function(){return IK0.enableDebugLog}});R4.isSupported=void 0;var jK0=r8(Cw()),IK0=Pw(),EK0=r8(Mv()),PW=r8(Du()),AK0=r8(Bu()),RK0=r8(Au()),u_=r8(mu()),TK0=r8(hw()),x_=C_();function r8(D){return D&&D.__esModule?D:{default:D}}function b5(D){return b5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},b5(D)}function CK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function P_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,f_(J.key),J)}}function PK0(D,$,X){if($)P_(D.prototype,$);if(X)P_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function SK0(D,$,X){return $=tF($),vK0(D,__()?Reflect.construct($,X||[],tF(D).constructor):$.apply(D,X))}function vK0(D,$){if($&&(b5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return uK0(D)}function uK0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function __(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(__=function(){return!!D})()}function tF(D){return tF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},tF(D)}function xK0(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)SW(D,$)}function SW(D,$){return SW=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},SW(D,$)}function S_(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(D);$&&(J=J.filter(function(Y){return Object.getOwnPropertyDescriptor(D,Y).enumerable})),X.push.apply(X,J)}return X}function y5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?S_(Object(X),!0).forEach(function(J){_K0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):S_(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function _K0(D,$,X){if($=f_($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function f_(D){var $=fK0(D,"string");return b5($)=="symbol"?$:$+""}function fK0(D,$){if(b5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(b5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var v_=R4.defaultOptions=y5(y5({},PW.default.defaultOptions),{},{httpStack:new u_.default,fileReader:new AK0.default,urlStorage:new EK0.default,fingerprint:RK0.default}),te0=R4.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return CK0(this,$),J=y5(y5({},v_),J),SK0(this,$,[X,J])}return xK0($,D),PK0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=y5(y5({},v_),Y),PW.default.terminate(J,Y)}}])}(PW.default),oe0=R4.isSupported=!0});var B1;var T4=r(()=>{B1={name:"@capgo/cli",type:"module",version:"8.5.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.0","@capgo/cli-helper-darwin-x64":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});async function aF(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,J=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!J.ok)return null;return(await J.json())["dist-tags"]?.latest||null}catch{return null}}async function yK0(){let D=await aF("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:B1.version,latestVersion:D,isOutdated:!!D&&D!==B1.version,majorVersion:$}}async function VD(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await yK0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
128
128
  Please use @capgo/cli@${X}" or @capgo/cli@${J} to keep up to date with the latest features and bug fixes.`)}var x1=r(()=>{g0();T4()});async function g_(D,$,X,J,Y,F="✅"){await j0(X,{channel:D,event:J,icon:F,org_id:$,tracking_version:2,...Y?{tags:{"app-id":Y}}:{},notify:!1})}var h_=r(()=>{g0();i9();x1();_0()});var c_=E((G0D,m_)=>{var g5=1000,h5=g5*60,m5=h5*60,t8=m5*24,bK0=t8*7,gK0=t8*365.25;m_.exports=function(D,$){$=$||{};var X=typeof D;if(X==="string"&&D.length>0)return hK0(D);else if(X==="number"&&isFinite(D))return $.long?cK0(D):mK0(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function hK0(D){if(D=String(D),D.length>100)return;var $=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!$)return;var X=parseFloat($[1]),J=($[2]||"ms").toLowerCase();switch(J){case"years":case"year":case"yrs":case"yr":case"y":return X*gK0;case"weeks":case"week":case"w":return X*bK0;case"days":case"day":case"d":return X*t8;case"hours":case"hour":case"hrs":case"hr":case"h":return X*m5;case"minutes":case"minute":case"mins":case"min":case"m":return X*h5;case"seconds":case"second":case"secs":case"sec":case"s":return X*g5;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return X;default:return}}function mK0(D){var $=Math.abs(D);if($>=t8)return Math.round(D/t8)+"d";if($>=m5)return Math.round(D/m5)+"h";if($>=h5)return Math.round(D/h5)+"m";if($>=g5)return Math.round(D/g5)+"s";return D+"ms"}function cK0(D){var $=Math.abs(D);if($>=t8)return sF(D,$,t8,"day");if($>=m5)return sF(D,$,m5,"hour");if($>=h5)return sF(D,$,h5,"minute");if($>=g5)return sF(D,$,g5,"second");return D+" ms"}function sF(D,$,X,J){var Y=$>=X*1.5;return Math.round(D/X)+" "+J+(Y?"s":"")}});var vW=E((O0D,d_)=>{function dK0(D){X.debug=X,X.default=X,X.coerce=Z,X.disable=Q,X.enable=Y,X.enabled=U,X.humanize=c_(),X.destroy=G,Object.keys(D).forEach((O)=>{X[O]=D[O]}),X.names=[],X.skips=[],X.formatters={};function $(O){let q=0;for(let w=0;w<O.length;w++)q=(q<<5)-q+O.charCodeAt(w),q|=0;return X.colors[Math.abs(q)%X.colors.length]}X.selectColor=$;function X(O){let q,w=null,W,K;function H(...B){if(!H.enabled)return;let M=H,j=Number(new Date),z=j-(q||j);if(M.diff=z,M.prev=q,M.curr=j,q=j,B[0]=X.coerce(B[0]),typeof B[0]!=="string")B.unshift("%O");let V=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(A,u)=>{if(A==="%%")return"%";V++;let _=X.formatters[u];if(typeof _==="function"){let I=B[V];A=_.call(M,I),B.splice(V,1),V--}return A}),X.formatArgs.call(M,B),(M.log||X.log).apply(M,B)}if(H.namespace=O,H.useColors=X.useColors(),H.color=X.selectColor(O),H.extend=J,H.destroy=X.destroy,Object.defineProperty(H,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(w!==null)return w;if(W!==X.namespaces)W=X.namespaces,K=X.enabled(O);return K},set:(B)=>{w=B}}),typeof X.init==="function")X.init(H);return H}function J(O,q){let w=X(this.namespace+(typeof q>"u"?":":q)+O);return w.log=this.log,w}function Y(O){X.save(O),X.namespaces=O,X.names=[],X.skips=[];let q=(typeof O==="string"?O:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let w of q)if(w[0]==="-")X.skips.push(w.slice(1));else X.names.push(w)}function F(O,q){let w=0,W=0,K=-1,H=0;while(w<O.length)if(W<q.length&&(q[W]===O[w]||q[W]==="*"))if(q[W]==="*")K=W,H=w,W++;else w++,W++;else if(K!==-1)W=K+1,H++,w=H;else return!1;while(W<q.length&&q[W]==="*")W++;return W===q.length}function Q(){let O=[...X.names,...X.skips.map((q)=>"-"+q)].join(",");return X.enable(""),O}function U(O){for(let q of X.skips)if(F(O,q))return!1;for(let q of X.names)if(F(O,q))return!0;return!1}function Z(O){if(O instanceof Error)return O.stack||O.message;return O}function G(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return X.enable(X.load()),X}d_.exports=dK0});var l_=E((n_,eF)=>{n_.formatArgs=lK0;n_.save=iK0;n_.load=pK0;n_.useColors=nK0;n_.storage=rK0();n_.destroy=(()=>{let D=!1;return()=>{if(!D)D=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();n_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function nK0(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let D;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(D=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(D[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function lK0(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+eF.exports.humanize(this.diff),!this.useColors)return;let $="color: "+this.color;D.splice(1,0,$,"color: inherit");let X=0,J=0;D[0].replace(/%[a-zA-Z%]/g,(Y)=>{if(Y==="%%")return;if(X++,Y==="%c")J=X}),D.splice(J,0,$)}n_.log=console.debug||console.log||(()=>{});function iK0(D){try{if(D)n_.storage.setItem("debug",D);else n_.storage.removeItem("debug")}catch($){}}function pK0(){let D;try{D=n_.storage.getItem("debug")||n_.storage.getItem("DEBUG")}catch($){}if(!D&&typeof process<"u"&&"env"in process)D=process.env.DEBUG;return D}function rK0(){try{return localStorage}catch(D){}}eF.exports=vW()(n_);var{formatters:tK0}=eF.exports;tK0.j=function(D){try{return JSON.stringify(D)}catch($){return"[UnexpectedJSONParseError]: "+$.message}}});var p_=E((w0D,i_)=>{i_.exports=(D,$=process.argv)=>{let X=D.startsWith("-")?"":D.length===1?"-":"--",J=$.indexOf(X+D),Y=$.indexOf("--");return J!==-1&&(Y===-1||J<Y)}});var o_=E((W0D,t_)=>{var JH0=l("os"),r_=l("tty"),A$=p_(),{env:X1}=process,C4;if(A$("no-color")||A$("no-colors")||A$("color=false")||A$("color=never"))C4=0;else if(A$("color")||A$("colors")||A$("color=true")||A$("color=always"))C4=1;if("FORCE_COLOR"in X1)if(X1.FORCE_COLOR==="true")C4=1;else if(X1.FORCE_COLOR==="false")C4=0;else C4=X1.FORCE_COLOR.length===0?1:Math.min(parseInt(X1.FORCE_COLOR,10),3);function uW(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function xW(D,$){if(C4===0)return 0;if(A$("color=16m")||A$("color=full")||A$("color=truecolor"))return 3;if(A$("color=256"))return 2;if(D&&!$&&C4===void 0)return 0;let X=C4||0;if(X1.TERM==="dumb")return X;if(process.platform==="win32"){let J=JH0.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in X1){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((J)=>(J in X1))||X1.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in X1)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X1.TEAMCITY_VERSION)?1:0;if(X1.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in X1){let J=parseInt((X1.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X1.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(X1.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X1.TERM))return 1;if("COLORTERM"in X1)return 1;return X}function YH0(D){let $=xW(D,D&&D.isTTY);return uW($)}t_.exports={supportsColor:YH0,stdout:uW(xW(!0,r_.isatty(1))),stderr:uW(xW(!0,r_.isatty(2)))}});var Df=E((s_,$Q)=>{var FH0=l("tty"),DQ=l("util");s_.init=wH0;s_.log=GH0;s_.formatArgs=UH0;s_.save=OH0;s_.load=qH0;s_.useColors=QH0;s_.destroy=DQ.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");s_.colors=[6,2,3,4,5,1];try{let D=o_();if(D&&(D.stderr||D).level>=2)s_.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(D){}s_.inspectOpts=Object.keys(process.env).filter((D)=>{return/^debug_/i.test(D)}).reduce((D,$)=>{let X=$.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,F)=>{return F.toUpperCase()}),J=process.env[$];if(/^(yes|on|true|enabled)$/i.test(J))J=!0;else if(/^(no|off|false|disabled)$/i.test(J))J=!1;else if(J==="null")J=null;else J=Number(J);return D[X]=J,D},{});function QH0(){return"colors"in s_.inspectOpts?Boolean(s_.inspectOpts.colors):FH0.isatty(process.stderr.fd)}function UH0(D){let{namespace:$,useColors:X}=this;if(X){let J=this.color,Y="\x1B[3"+(J<8?J:"8;5;"+J),F=` ${Y};1m${$} \x1B[0m`;D[0]=F+D[0].split(`
129
129
  `).join(`
130
130
  `+F),D.push(Y+"m+"+$Q.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=ZH0()+$+" "+D[0]}function ZH0(){if(s_.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function GH0(...D){return process.stderr.write(DQ.formatWithOptions(s_.inspectOpts,...D)+`
@@ -549,7 +549,7 @@ ${S9(`${T6.bold}${T6.green}`,X[2])}`;let J=D.match(/^([ \t]*)(\d+)\. +(\S.*)$/);
549
549
  `)}function Y$0(D,$){if(!$)return{feed:D,flush:()=>{}};let X=VI(),J="",Y=!0,F=(Q)=>{let U=NI(Q,X);if(U===null)return;D(Y?U:`
550
550
  ${U}`),Y=!1};return{feed(Q){J+=Q;let U=J.indexOf(`
551
551
  `);while(U!==-1)F(J.slice(0,U)),J=J.slice(U+1),U=J.indexOf(`
552
- `)},flush(){F(J),J=""}}}_0();function F$0(D){if(D.kind==="ok")return"success";if(D.kind==="already_analyzed")return"already_analyzed";if(D.kind==="too_big")return"too_big";if(D.kind==="upgrade_required")return"upgrade_required";return D.partial!==void 0?"mid_stream_error":"error"}async function GO(D){try{await j0(D.apikey,{event:"CLI AI Build Analysis Choice",channel:"build-lifecycle",icon:"\uD83E\uDD16",notify:!1,org_id:D.orgId,tracking_version:2,tags:{app_id:D.appId,platform:D.platform,job_id:D.jobId,choice:D.choice,triggered_by:D.triggeredBy}})}catch{}}async function Q$0(D){let $={app_id:D.appId,platform:D.platform,job_id:D.jobId,result:D.result};if(D.result==="error"&&typeof D.errorStatus==="number"&&Number.isFinite(D.errorStatus))$.error_status=String(D.errorStatus);try{await j0(D.apikey,{event:"CLI AI Build Analysis Result",channel:"build-lifecycle",icon:"\uD83E\uDD16",notify:!1,org_id:D.orgId,tracking_version:2,tags:$})}catch{}}T4();import{mkdirSync as Mb0,writeFileSync as U$0}from"node:fs";import{homedir as jb0}from"node:os";import{join as BI}from"node:path";import qO from"node:process";import{gzipSync as Ib0}from"node:zlib";var Lb0=/-----BEGIN [^-]+-----[\s\S]*?-----END [^-]+-----/g,Bb0=[{re:/(authorization\s*:\s*bearer\s+)[\w.\-+/=]+/gi,replace:"$1[REDACTED]"},{re:/\bcapg_[A-Za-z0-9]{8,}\b/g,replace:"[REDACTED]"},{re:/(capgkey\s*[=:]\s*)[\w-]{6,}/gi,replace:"$1[REDACTED]"},{re:/\b(api[_-]?key|secret|token|password|passwd|pwd)(\s*[=:]\s*)["']?[\w.\-+/=]{6,}["']?/gi,replace:"$1$2[REDACTED]"},{re:/("(?:access_token|refresh_token|id_token|client_secret|private_key|api[_-]?key|token|secret|password)"\s*:\s*")[^"]+(")/gi,replace:"$1[REDACTED]$2"}];function OO(D){let $=D.replace(Lb0,"[REDACTED PRIVATE KEY]");for(let{re:X,replace:J}of Bb0)$=$.replace(X,J);return $}function Eb0(){let D=globalThis.Bun;return[`CLI version: ${B1.version}`,`OS: ${qO.platform} ${qO.arch}`,`Runtime: ${D?`bun ${D.version}`:`node ${qO.version}`}`,`cwd: ${qO.cwd()}`]}var Ab0=/[^\w.-]+/g,Rb0=/-+/g,Tb0=/^-|-$/g,Cb0=/[:.]/g;function Z$0(D,$){let X=D?.trim();if(!X)return $;return X.replaceAll(Ab0,"-").replaceAll(Rb0,"-").replaceAll(Tb0,"")||$}function Pb0(){return new Date().toISOString().replaceAll(Cb0,"-")}function wO(D,$,X){if(X)D.push(`${$}: ${X}`)}function G$0(D,$,X){if(!X?.length)return;D.push("",`${$}:`,...X.map((J)=>`- ${J}`))}function O$0(D,$,X){if(!X?.length)return;D.push("",`${$}:`,...X)}function Sb0(D){let $=[`Capgo ${D.kind} support bundle`,`Generated: ${new Date().toISOString()}`,...Eb0(),`Error: ${D.error}`];wO($,"App ID",D.appId),wO($,"Current step",D.currentStep),wO($,"Package manager",D.packageManager),wO($,"Working directory",D.cwd),G$0($,"Recommended commands",D.commands),G$0($,"Docs",D.docs);for(let X of D.sections??[])O$0($,X.title,X.lines);return O$0($,"Recent logs",D.logs),`${$.join(`
552
+ `)},flush(){F(J),J=""}}}_0();function F$0(D){if(D.kind==="ok")return"success";if(D.kind==="already_analyzed")return"already_analyzed";if(D.kind==="too_big")return"too_big";if(D.kind==="upgrade_required")return"upgrade_required";return D.partial!==void 0?"mid_stream_error":"error"}async function GO(D){try{await j0(D.apikey,{event:"CLI AI Build Analysis Choice",channel:"build-lifecycle",icon:"\uD83E\uDD16",notify:!1,org_id:D.orgId,tracking_version:2,tags:{app_id:D.appId,platform:D.platform,job_id:D.jobId,choice:D.choice,triggered_by:D.triggeredBy}})}catch{}}async function Q$0(D){let $={app_id:D.appId,platform:D.platform,job_id:D.jobId,result:D.result};if(D.result==="error"&&typeof D.errorStatus==="number"&&Number.isFinite(D.errorStatus))$.error_status=String(D.errorStatus);try{await j0(D.apikey,{event:"CLI AI Build Analysis Result",channel:"build-lifecycle",icon:"\uD83E\uDD16",notify:!1,org_id:D.orgId,tracking_version:2,tags:$})}catch{}}T4();import{mkdirSync as Mb0,writeFileSync as U$0}from"node:fs";import{homedir as jb0}from"node:os";import{join as BI}from"node:path";import qO from"node:process";import{gzipSync as Ib0}from"node:zlib";var Lb0=/-----BEGIN [^-]+-----[\s\S]*?-----END [^-]+-----/g,Bb0=[{re:/(authorization\s*:\s*bearer\s+)[\w.\-+/=]+/gi,replace:"$1[REDACTED]"},{re:/\bcapg_[A-Za-z0-9]{8,}\b/g,replace:"[REDACTED]"},{re:/(capgkey\s*[=:]\s*)[\w-]{6,}/gi,replace:"$1[REDACTED]"},{re:/\b(api[_-]?key|secret|token|password|passwd|pwd)(\s*[=:]\s*)["']?[\w.\-+/=]{6,}["']?/gi,replace:"$1$2[REDACTED]"},{re:/("(?:access_token|refresh_token|id_token|client_secret|private[_-]?key|apple_key_content|api[_-]?key|token|secret|password|p8|pem)"\s*:\s*")[^"]+(")/gi,replace:"$1[REDACTED]$2"}];function OO(D){let $=D.replace(Lb0,"[REDACTED PRIVATE KEY]");for(let{re:X,replace:J}of Bb0)$=$.replace(X,J);return $}function Eb0(){let D=globalThis.Bun;return[`CLI version: ${B1.version}`,`OS: ${qO.platform} ${qO.arch}`,`Runtime: ${D?`bun ${D.version}`:`node ${qO.version}`}`,`cwd: ${qO.cwd()}`]}var Ab0=/[^\w.-]+/g,Rb0=/-+/g,Tb0=/^-|-$/g,Cb0=/[:.]/g;function Z$0(D,$){let X=D?.trim();if(!X)return $;return X.replaceAll(Ab0,"-").replaceAll(Rb0,"-").replaceAll(Tb0,"")||$}function Pb0(){return new Date().toISOString().replaceAll(Cb0,"-")}function wO(D,$,X){if(X)D.push(`${$}: ${X}`)}function G$0(D,$,X){if(!X?.length)return;D.push("",`${$}:`,...X.map((J)=>`- ${J}`))}function O$0(D,$,X){if(!X?.length)return;D.push("",`${$}:`,...X)}function Sb0(D){let $=[`Capgo ${D.kind} support bundle`,`Generated: ${new Date().toISOString()}`,...Eb0(),`Error: ${D.error}`];wO($,"App ID",D.appId),wO($,"Current step",D.currentStep),wO($,"Package manager",D.packageManager),wO($,"Working directory",D.cwd),G$0($,"Recommended commands",D.commands),G$0($,"Docs",D.docs);for(let X of D.sections??[])O$0($,X.title,X.lines);return O$0($,"Recent logs",D.logs),`${$.join(`
553
553
  `)}
554
554
  `}var vb0=10485760;function ub0(D,$){return`[... ${D} earlier lines omitted to fit the ${Math.round($/1048576)} MB support upload limit ...]`}var xb0=100,_b0=1024;function fb0(D,$,X,J,Y){let F=D.get(),Q=F.length,U=(q)=>{return Y(),D.set(F.slice(Math.min(q,Q))),J()};if(U(Q)>$)return D.set([]),Q;let Z=0,G=Q,O=Math.min(Q,Math.max(1,Math.ceil(Q*(1-$/X))));if(U(O)<=$)G=O;else Z=O;while(G-Z>xb0){let q=Z+Math.floor((G-Z)/2);if(U(q)<=$)G=q;else Z=q}return D.set(F.slice(G)),G}function kb0(D,$=vb0,X){let J=(w)=>{let W=OO(Sb0(w));return{rendered:W,gz:Ib0(W)}},Y=J(D);if(X?.(),Y.gz.length<=$)return Y;let F=(D.sections??[]).map((w)=>({...w,lines:[...w.lines]})),Q={...D,sections:F,logs:D.logs?[...D.logs]:D.logs},U=()=>{return Y=J(Q),Y.gz.length},Z=[],G=F.find((w)=>w.title.startsWith("Build output"));if(G)Z.push({get:()=>G.lines,set:(w)=>{G.lines=w}});if(Q.logs)Z.push({get:()=>Q.logs??[],set:(w)=>{Q.logs=w}});let O=F.find((w)=>w.title==="Internal log");if(O)Z.push({get:()=>O.lines,set:(w)=>{O.lines=w}});let q=Math.max(1,$-_b0);for(let w of Z){if(Y.gz.length<=$)break;let W=fb0(w,q,Y.gz.length,U,()=>X?.());if(W>0)w.set([ub0(W,$),...w.get()]);Y=J(Q)}return Y}function q$0(D,$=BI(jb0(),".capgo-credentials","support")){try{Mb0($,{recursive:!0});let X=Z$0(D.kind,"onboarding"),J=Z$0(D.appId,"unknown-app"),Y=`builder-support-${X}-${J}-${Pb0()}`,F=BI($,`${Y}.log`),Q=BI($,`${Y}.log.gz`),{rendered:U,gz:Z}=kb0(D);return U$0(F,U,"utf8"),U$0(Q,Z),{logPath:F,gzPath:Q}}catch{return null}}import{spawnSync as w$0}from"node:child_process";function W$0(D){let $=process.platform,X=[];if($==="darwin")X.push({cmd:"pbcopy",args:[]});else if($==="win32")X.push({cmd:"clip",args:[]});else X.push({cmd:"wl-copy",args:[]}),X.push({cmd:"xclip",args:["-selection","clipboard"]}),X.push({cmd:"xsel",args:["--clipboard","--input"]});for(let J of X)try{let Y=w$0(J.cmd,J.args,{input:D});if(Y.error)continue;if(Y.status===0)return{ok:!0,method:J.cmd}}catch{}return{ok:!1}}function K$0(D){if(process.platform!=="darwin")return!1;try{let $=w$0("open",["-R",D]);return!$.error&&$.status===0}catch{return!1}}import{rmSync as z$0}from"node:fs";var H$0=1500;function MI(D){let $=D.body;if($.length>1500)$=$.slice(0,1488)+"…(truncated)";let X=encodeURIComponent(D.subject),J=encodeURIComponent($);return`mailto:${D.to}?subject=${X}&body=${J}`}var v9="support@capgo.app";function yb0(D){if(D)return"We'll upload your logs to Capgo support (kept 30 days) and open a pre-filled email to support@capgo.app in your mail app. Continue?";return`We'll save a logs file for you to attach${process.platform==="darwin"?" and reveal it in Finder":""}, then open a pre-filled email to support@capgo.app in your mail app. Continue?`}function V$0(D,$){let X=H$0-$.length;if(D.length<=X)return D;let J="…(truncated)";return D.slice(0,Math.max(0,X-J.length))+J}var jI=!1,N$0=null;async function L$0(D){if(jI)return"cancelled";jI=!0;try{return await bb0(D)}finally{jI=!1}}async function bb0(D){let $=await D.buildFiles();if(!$)return D.print("Could not save your logs locally. Please email support@capgo.app and describe the issue."),"failed";if(!await D.confirm(yb0(Boolean(D.upload)),$.logPath))return"cancelled";let J=D.upload?N$0:null,Y=J!==null;if(D.upload&&!J){if(J=await D.upload($.gzPath),J)N$0=J}if(D.upload&&!J)D.print("(Logs upload to Capgo failed or is unavailable — the email will include attach instructions instead.)");if(J){let K=`
555
555
 
@@ -635,7 +635,7 @@ ${o(Z.error)}`);throw Error(`Cannot create channel: ${o(Z.error)}`)}if(await j0(
635
635
  ${X}
636
636
  ${$}
637
637
 
638
- `)}async function L50(D,$,X){await bp0(D,$),await hp0(X)}_0();function B50(D){let $=D.map((X)=>{let J=F8(X);return[X.name,X.localVersion||"-",X.remoteVersion||"-",J.compatible?"✅":"❌",J.message]});L.info(M3({headers:["Package","Local","Remote","Status","Details"],rows:$}))}var M50=["major","minor","metadata","patch","none"];async function j50(D,$,X,J=!1){if(!J)B0("Set channel");X.apikey=X.apikey||z0();let Y=await E0();if($=i0($,Y?.config),!X.apikey){if(!J)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!$){if(!J)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!D){if(!J)L.error("Missing argument, you need to provide a channel");throw Error("Missing channel id")}let F=await C0(X.apikey,X.supaHost,X.supaAnon);await tD(F,$,J);let Q=await $D(F,X.apikey);await fD(F,X.apikey,$,4,J,!0);let U=await rD(F,$),{bundle:Z,state:G,downgrade:O,latest:q,latestRemote:w,ios:W,android:K,selfAssign:H,disableAutoUpdate:B,dev:M,emulator:j,device:z,prod:V}=X;if(q&&Z){if(!J)L.error("Cannot set latest and bundle at the same time");throw Error("Cannot set both latest and bundle simultaneously")}if(w&&Z){if(!J)L.error("Cannot set latest remote and bundle at the same time");throw Error("Cannot set both latest remote and bundle simultaneously")}if(w&&q){if(!J)L.error("Cannot set latest remote and latest at the same time");throw Error("Cannot set both latest remote and latest simultaneously")}if(Z==null&&G==null&&q==null&&w==null&&O==null&&W==null&&K==null&&H==null&&M==null&&j==null&&z==null&&V==null&&B==null){if(!J)L.error("Missing argument, you need to provide a option to set");throw Error("No channel option provided")}await l00(F,U,X.apikey,$);let N={created_by:Q,app_id:$,name:D,owner_org:U,version:void 0},{error:A}=await F.from("channels").select().eq("app_id",$).eq("name",D).single();if(A){if(!J)L.error(`Cannot find channel ${D}`);throw Error(`Cannot find channel ${D}`)}let u=q?Y?.config?.plugins?.CapacitorUpdater?.version||J8("",X.packageJson):Z;if(u!=null){let{data:I,error:x}=await F.from("app_versions").select().eq("app_id",$).eq("name",u).eq("user_id",Q).eq("deleted",!1).single();if(x||!I){if(!J)L.error(`Cannot find version ${u}`);throw Error(`Cannot find version ${u}`)}if(!X.ignoreMetadataCheck){let{finalCompatibility:P,localDependencies:m}=await tj(F,$,D,I.native_packages??[]),b=P.filter((p)=>!E6(p));if(m.length>0&&b.length>0){if(!J)L.warn(`Bundle NOT compatible with ${D} channel`),L.warn(""),B50(P),L.warn(""),L.warn("An app store update may be required for these changes to take effect.");throw Error(`Bundle is not compatible with ${D} channel`)}if(!J)if(m.length===0&&P.length>0)L.info(`Ignoring check compatibility with ${D} channel because the bundle does not contain any native packages`);else L.info(`Bundle is compatible with ${D} channel`)}if(!J)L.info(`Set ${$} channel: ${D} to @${u}`);N.version=I.id}if(w){let{data:I,error:x}=await F.from("app_versions").select().eq("app_id",$).eq("user_id",Q).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(x||!I){if(!J)L.error("Cannot find latest remote version");throw Error("Cannot find latest remote version")}if(!X.ignoreMetadataCheck){let{finalCompatibility:P}=await tj(F,$,D,I.native_packages??[]);if(P.filter((b)=>!E6(b)).length>0){if(!J)L.warn(`Bundle NOT compatible with ${D} channel`),L.warn(""),B50(P),L.warn(""),L.warn("An app store update may be required for these changes to take effect.");throw Error(`Latest remote bundle is not compatible with ${D} channel`)}}if(!J)L.info(`Set ${$} channel: ${D} to @${I.name}`);N.version=I.id}if(G!=null){if(G!=="normal"&&G!=="default"){if(!J)L.error(`State ${G} is not known. The possible values are: normal, default.`);throw Error(`Unknown state ${G}. Expected normal or default`)}if(!J)L.info(`Set ${$} channel: ${D} to ${G}`);N.public=G==="default"}if(O!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${O?"allow":"disallow"} downgrade`);N.disable_auto_update_under_native=!O}if(W!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${W?"allow":"disallow"} ios update`);N.ios=!!W}if(K!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${K?"allow":"disallow"} android update`);N.android=!!K}if(H!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${H?"allow":"disallow"} self assign to this channel`);N.allow_device_self_set=!!H}if(M!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${M?"allow":"disallow"} dev devices`);N.allow_dev=!!M}if(j!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${j?"allow":"disallow"} emulator devices`);N.allow_emulator=!!j}if(z!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${z?"allow":"disallow"} physical devices`);N.allow_device=!!z}if(V!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${V?"allow":"disallow"} prod builds`);N.allow_prod=!!V}if(B!=null){let I=B.toLowerCase();if(!M50.includes(I)){if(!J)L.error(`Channel strategy ${I} is not known. The possible values are: ${M50.join(", ")}.`);throw Error(`Unknown channel strategy ${I}`)}if(I==="metadata")I="version_number";if(N.disable_auto_update=I,!J)L.info(`Set ${$} channel: ${D} to ${I} disable update strategy to this channel`)}let{error:_}=await cG(F,N);if(_){if(!J)L.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.');throw Error("Upload key is not allowed to set this channel")}if(X.qrPreview&&!J){let I=await N50(F,$,D);if(!I)throw Error(`Channel ${D} not found for app ${$}`);await L50(F,$,I)}if(await j0(X.apikey,{channel:"channel",event:"Set channel",icon:"✅",org_id:U,tracking_version:2,tags:{"app-id":$},notify:!1}).catch(()=>{}),!J)M0("Done ✅");return!0}g0();H1();import{existsSync as P3,readFileSync as mp0,unlinkSync as I50,writeFileSync as E50}from"node:fs";x1();cU();_0();function A50(D){return D.plugins??={},D.plugins.extConfig??={},D.plugins.CapacitorUpdater??={},D.plugins.CapacitorUpdater}async function R50(D,$=!1){if(!$)B0("Save keys \uD83D\uDD11");let X=await E0(),J=D.key||F4,Y=D.keyData||"";if(!P3(J)&&!Y){if(!$)L.error(`Cannot find a public key at ${J} or as keyData option or in ${X.path}`);throw Error("Missing public key")}if(P3(J))Y=mp0(J,"utf8");if(!Y.startsWith("-----BEGIN RSA PUBLIC KEY-----")){if(!$)L.error("The public key provided is not a valid RSA Public key");throw Error("Invalid RSA public key")}if(X?.config){let F=A50(X.config);if(F.privateKey){if(delete F.privateKey,!$)L.info("Old private key deleted from config file");if($?D.setupChannel??!1:D.setupChannel??await kD({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))F.defaultChannel="encryption_v2"}F.publicKey=Y,await W7(X),l0({channel:"key",event:"Key Saved",icon:"\uD83D\uDCBE",tags:{}})}if(!$)L.success(`Public key saved into ${X.path} file in local directory`),L.success("Your app will decode the zip archive with this key");return!0}async function T50(D,$=!1){if(!$)B0("Deleting old private key \uD83D\uDDD1️");let X=await E0(),J=X?.config?.plugins?.CapacitorUpdater;if(J?.privateKey){if(delete J.privateKey,await W7(X),P3(o7))try{if(I50(o7),!$)L.success(`Old private key file deleted: ${o7}`)}catch(Y){if(!$)L.error(`Failed to delete old private key file: ${o7} (${String(Y)})`)}if(P3(_G))try{if(I50(_G),!$)L.success(`Old public key file deleted: ${_G}`)}catch(Y){if(!$)L.error(`Failed to delete old public key file: ${F4} (${String(Y)})`)}if(!$)L.success(`Old private key deleted from ${X.path} file`),M0("Done ✅");return l0({channel:"key",event:"Old Key Deleted",icon:"\uD83E\uDDF9",tags:{}}),!0}if(!$)L.info("No old private key found in config file");return!1}async function C50(D,$=!1){if(!$)B0("Create keys \uD83D\uDD11");let{publicKey:X,privateKey:J}=G80();if(P3(F4)&&!D.force){if(!$)L.error("Public Key already exists, use --force to overwrite");throw Error("Public key already exists")}if(E50(F4,X),P3(V$)&&!D.force){if(!$)L.error("Private Key already exists, use --force to overwrite");throw Error("Private key already exists")}E50(V$,J);let Y=await E0();if(Y){let F=A50(Y.config);if(F.privateKey){if(delete F.privateKey,!$)L.info("Old private key deleted from config file");if($?D.setupChannel??!1:D.setupChannel??await kD({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))F.defaultChannel="encryption_v2"}F.publicKey=X,await W7(Y)}if(l0({channel:"key",event:"Encryption Keys Generated",icon:"\uD83D\uDD11",tags:{}}),!$){L.success("Your RSA key has been generated"),L.success(`Private key saved in ${V$}`),L.success("This key will be used to encrypt your bundle before sending it to Capgo"),L.success("Keep it safe"),L.success("Then make it unreadable by Capgo and unmodifiable by anyone"),L.success(`Public key saved in ${Y.path}`),L.success("Your app will be the only one having it"),L.success("Only your users can decrypt your update"),L.success("Only you can send them an update");try{await FD0(void 0,void 0,void 0,{validateIosUpdater:!0}),M0("Done ✅")}catch(F){if(F instanceof Error&&F.message==="Capacitor sync cancelled")return!0;throw F}}return!0}g0();x1();_0();import{existsSync as cp0}from"node:fs";import{homedir as dp0}from"node:os";async function P50(D,$,X=!1){if(!X)B0("Login to Capgo");if(!D&&!X){let F=await tA({message:"Enter your API key:",mask:"*"});if(c0(F))throw L.error("Login cancelled"),Error("Login cancelled");D=F}if(!D){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!X)await VD();let{local:J}=$;if(J&&!cp0(".git")){if(!X)L.error("To use local you should be in a git repository");throw Error("Not in a git repository")}let Y=await C0(D,$.supaHost,$.supaAnon);if(await $D(Y,D),J)await w3(".capgo",`${D}
638
+ `)}async function L50(D,$,X){await bp0(D,$),await hp0(X)}_0();function B50(D){let $=D.map((X)=>{let J=F8(X);return[X.name,X.localVersion||"-",X.remoteVersion||"-",J.compatible?"✅":"❌",J.message]});L.info(M3({headers:["Package","Local","Remote","Status","Details"],rows:$}))}var M50=["major","minor","metadata","patch","none"];async function j50(D,$,X,J=!1){if(!J)B0("Set channel");X.apikey=X.apikey||z0();let Y=await E0();if($=i0($,Y?.config),!X.apikey){if(!J)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!$){if(!J)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!D){if(!J)L.error("Missing argument, you need to provide a channel");throw Error("Missing channel id")}let F=await C0(X.apikey,X.supaHost,X.supaAnon);await tD(F,$,J);let Q=await $D(F,X.apikey);await fD(F,X.apikey,$,3,J,!0);let U=await rD(F,$),{bundle:Z,state:G,downgrade:O,latest:q,latestRemote:w,ios:W,android:K,selfAssign:H,disableAutoUpdate:B,dev:M,emulator:j,device:z,prod:V}=X;if(q&&Z){if(!J)L.error("Cannot set latest and bundle at the same time");throw Error("Cannot set both latest and bundle simultaneously")}if(w&&Z){if(!J)L.error("Cannot set latest remote and bundle at the same time");throw Error("Cannot set both latest remote and bundle simultaneously")}if(w&&q){if(!J)L.error("Cannot set latest remote and latest at the same time");throw Error("Cannot set both latest remote and latest simultaneously")}if(Z==null&&G==null&&q==null&&w==null&&O==null&&W==null&&K==null&&H==null&&M==null&&j==null&&z==null&&V==null&&B==null){if(!J)L.error("Missing argument, you need to provide a option to set");throw Error("No channel option provided")}await l00(F,U,X.apikey,$);let N={created_by:Q,app_id:$,name:D,owner_org:U,version:void 0},{error:A}=await F.from("channels").select().eq("app_id",$).eq("name",D).single();if(A){if(!J)L.error(`Cannot find channel ${D}`);throw Error(`Cannot find channel ${D}`)}let u=q?Y?.config?.plugins?.CapacitorUpdater?.version||J8("",X.packageJson):Z;if(u!=null){let{data:I,error:x}=await F.from("app_versions").select().eq("app_id",$).eq("name",u).eq("user_id",Q).eq("deleted",!1).single();if(x||!I){if(!J)L.error(`Cannot find version ${u}`);throw Error(`Cannot find version ${u}`)}if(!X.ignoreMetadataCheck){let{finalCompatibility:P,localDependencies:m}=await tj(F,$,D,I.native_packages??[]),b=P.filter((p)=>!E6(p));if(m.length>0&&b.length>0){if(!J)L.warn(`Bundle NOT compatible with ${D} channel`),L.warn(""),B50(P),L.warn(""),L.warn("An app store update may be required for these changes to take effect.");throw Error(`Bundle is not compatible with ${D} channel`)}if(!J)if(m.length===0&&P.length>0)L.info(`Ignoring check compatibility with ${D} channel because the bundle does not contain any native packages`);else L.info(`Bundle is compatible with ${D} channel`)}if(!J)L.info(`Set ${$} channel: ${D} to @${u}`);N.version=I.id}if(w){let{data:I,error:x}=await F.from("app_versions").select().eq("app_id",$).eq("user_id",Q).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(x||!I){if(!J)L.error("Cannot find latest remote version");throw Error("Cannot find latest remote version")}if(!X.ignoreMetadataCheck){let{finalCompatibility:P}=await tj(F,$,D,I.native_packages??[]);if(P.filter((b)=>!E6(b)).length>0){if(!J)L.warn(`Bundle NOT compatible with ${D} channel`),L.warn(""),B50(P),L.warn(""),L.warn("An app store update may be required for these changes to take effect.");throw Error(`Latest remote bundle is not compatible with ${D} channel`)}}if(!J)L.info(`Set ${$} channel: ${D} to @${I.name}`);N.version=I.id}if(G!=null){if(G!=="normal"&&G!=="default"){if(!J)L.error(`State ${G} is not known. The possible values are: normal, default.`);throw Error(`Unknown state ${G}. Expected normal or default`)}if(!J)L.info(`Set ${$} channel: ${D} to ${G}`);N.public=G==="default"}if(O!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${O?"allow":"disallow"} downgrade`);N.disable_auto_update_under_native=!O}if(W!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${W?"allow":"disallow"} ios update`);N.ios=!!W}if(K!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${K?"allow":"disallow"} android update`);N.android=!!K}if(H!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${H?"allow":"disallow"} self assign to this channel`);N.allow_device_self_set=!!H}if(M!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${M?"allow":"disallow"} dev devices`);N.allow_dev=!!M}if(j!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${j?"allow":"disallow"} emulator devices`);N.allow_emulator=!!j}if(z!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${z?"allow":"disallow"} physical devices`);N.allow_device=!!z}if(V!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${V?"allow":"disallow"} prod builds`);N.allow_prod=!!V}if(B!=null){let I=B.toLowerCase();if(!M50.includes(I)){if(!J)L.error(`Channel strategy ${I} is not known. The possible values are: ${M50.join(", ")}.`);throw Error(`Unknown channel strategy ${I}`)}if(I==="metadata")I="version_number";if(N.disable_auto_update=I,!J)L.info(`Set ${$} channel: ${D} to ${I} disable update strategy to this channel`)}let{error:_}=await cG(F,N);if(_){if(!J)L.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.');throw Error("Upload key is not allowed to set this channel")}if(X.qrPreview&&!J){let I=await N50(F,$,D);if(!I)throw Error(`Channel ${D} not found for app ${$}`);await L50(F,$,I)}if(await j0(X.apikey,{channel:"channel",event:"Set channel",icon:"✅",org_id:U,tracking_version:2,tags:{"app-id":$},notify:!1}).catch(()=>{}),!J)M0("Done ✅");return!0}g0();H1();import{existsSync as P3,readFileSync as mp0,unlinkSync as I50,writeFileSync as E50}from"node:fs";x1();cU();_0();function A50(D){return D.plugins??={},D.plugins.extConfig??={},D.plugins.CapacitorUpdater??={},D.plugins.CapacitorUpdater}async function R50(D,$=!1){if(!$)B0("Save keys \uD83D\uDD11");let X=await E0(),J=D.key||F4,Y=D.keyData||"";if(!P3(J)&&!Y){if(!$)L.error(`Cannot find a public key at ${J} or as keyData option or in ${X.path}`);throw Error("Missing public key")}if(P3(J))Y=mp0(J,"utf8");if(!Y.startsWith("-----BEGIN RSA PUBLIC KEY-----")){if(!$)L.error("The public key provided is not a valid RSA Public key");throw Error("Invalid RSA public key")}if(X?.config){let F=A50(X.config);if(F.privateKey){if(delete F.privateKey,!$)L.info("Old private key deleted from config file");if($?D.setupChannel??!1:D.setupChannel??await kD({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))F.defaultChannel="encryption_v2"}F.publicKey=Y,await W7(X),l0({channel:"key",event:"Key Saved",icon:"\uD83D\uDCBE",tags:{}})}if(!$)L.success(`Public key saved into ${X.path} file in local directory`),L.success("Your app will decode the zip archive with this key");return!0}async function T50(D,$=!1){if(!$)B0("Deleting old private key \uD83D\uDDD1️");let X=await E0(),J=X?.config?.plugins?.CapacitorUpdater;if(J?.privateKey){if(delete J.privateKey,await W7(X),P3(o7))try{if(I50(o7),!$)L.success(`Old private key file deleted: ${o7}`)}catch(Y){if(!$)L.error(`Failed to delete old private key file: ${o7} (${String(Y)})`)}if(P3(_G))try{if(I50(_G),!$)L.success(`Old public key file deleted: ${_G}`)}catch(Y){if(!$)L.error(`Failed to delete old public key file: ${F4} (${String(Y)})`)}if(!$)L.success(`Old private key deleted from ${X.path} file`),M0("Done ✅");return l0({channel:"key",event:"Old Key Deleted",icon:"\uD83E\uDDF9",tags:{}}),!0}if(!$)L.info("No old private key found in config file");return!1}async function C50(D,$=!1){if(!$)B0("Create keys \uD83D\uDD11");let{publicKey:X,privateKey:J}=G80();if(P3(F4)&&!D.force){if(!$)L.error("Public Key already exists, use --force to overwrite");throw Error("Public key already exists")}if(E50(F4,X),P3(V$)&&!D.force){if(!$)L.error("Private Key already exists, use --force to overwrite");throw Error("Private key already exists")}E50(V$,J);let Y=await E0();if(Y){let F=A50(Y.config);if(F.privateKey){if(delete F.privateKey,!$)L.info("Old private key deleted from config file");if($?D.setupChannel??!1:D.setupChannel??await kD({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))F.defaultChannel="encryption_v2"}F.publicKey=X,await W7(Y)}if(l0({channel:"key",event:"Encryption Keys Generated",icon:"\uD83D\uDD11",tags:{}}),!$){L.success("Your RSA key has been generated"),L.success(`Private key saved in ${V$}`),L.success("This key will be used to encrypt your bundle before sending it to Capgo"),L.success("Keep it safe"),L.success("Then make it unreadable by Capgo and unmodifiable by anyone"),L.success(`Public key saved in ${Y.path}`),L.success("Your app will be the only one having it"),L.success("Only your users can decrypt your update"),L.success("Only you can send them an update");try{await FD0(void 0,void 0,void 0,{validateIosUpdater:!0}),M0("Done ✅")}catch(F){if(F instanceof Error&&F.message==="Capacitor sync cancelled")return!0;throw F}}return!0}g0();x1();_0();import{existsSync as cp0}from"node:fs";import{homedir as dp0}from"node:os";async function P50(D,$,X=!1){if(!X)B0("Login to Capgo");if(!D&&!X){let F=await tA({message:"Enter your API key:",mask:"*"});if(c0(F))throw L.error("Login cancelled"),Error("Login cancelled");D=F}if(!D){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!X)await VD();let{local:J}=$;if(J&&!cp0(".git")){if(!X)L.error("To use local you should be in a git repository");throw Error("Not in a git repository")}let Y=await C0(D,$.supaHost,$.supaAnon);if(await $D(Y,D),J)await w3(".capgo",`${D}
639
639
  `,{mode:384}),await I$0(".gitignore",`.capgo
640
640
  `,384);else{let F=dp0();await w3(`${F}/.capgo`,`${D}
641
641
  `,{mode:384})}if(await j0(D,{channel:"user-login",event:"User CLI login",icon:"✅",tracking_version:2,notify:!1}).catch(),!X)L.success(`login saved into .capgo file in ${J?"local":"home"} directory`),M0("Done ✅")}g0();x1();_0();async function S50(D,$=!1){if(!$)B0("Adding organization");await VD();let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to add an organization");throw Error("Missing API key")}let J=await C0(X.apikey,X.supaHost,X.supaAnon),Y=await $D(J,X.apikey),{name:F,email:Q}=X;if(!$&&!F){let G=await H4({message:"Organization name:",placeholder:"My Organization"});if(c0(G))throw L.error("Canceled adding organization"),Error("Organization creation cancelled");F=G}if(!$&&!Q){let G=await H4({message:"Management email:",placeholder:"admin@example.com"});if(c0(G))throw L.error("Canceled adding organization"),Error("Organization creation cancelled");Q=G}if(!F||!Q){if(!$)L.error("Missing arguments, you need to provide an organization name and management email");throw Error("Missing organization name or management email")}if(!$)L.info(`Adding organization "${F}" to Capgo`);let{data:U,error:Z}=await J.from("orgs").insert({name:F,management_email:Q,created_by:Y}).select().single();if(Z){if(!$)L.error(`Could not add organization ${o(Z)}`);throw Error(`Could not add organization: ${o(Z)}`)}if(await j0(X.apikey,{channel:"organization",event:"Organization Created",icon:"\uD83C\uDFE2",org_id:U.id,tracking_version:2,tags:{"org-name":F},notify:!1}).catch(()=>{}),!$)L.success(`Organization "${F}" added to Capgo`),M0("Done ✅");return U}g0();x1();_0();async function v50(D,$,X=!1){if(!X)B0("Deleting organization");await VD();let J={...$,apikey:$.apikey||z0()};if(!J.apikey){if(!X)L.error("Missing API key, you need to provide an API key to delete an organization");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let Y=await C0(J.apikey,J.supaHost,J.supaAnon);await nG(Y,J.apikey,"org.delete",D,`Insufficient permissions to delete organization ${D}`,X),await fG(Y,D,X);let{data:F,error:Q}=await Y.from("orgs").select("created_by, name").eq("id",D).single();if(Q||!F){if(!X)L.error(`Cannot get organization details ${o(Q)}`);throw Error(`Cannot get organization details: ${o(Q)}`)}if(!X&&!J.autoConfirm){let Z=await kD({message:`Are you sure you want to delete organization "${F.name}"? This action cannot be undone.`});if(c0(Z)||!Z)throw L.error("Canceled deleting the organization"),Error("Organization deletion cancelled")}if(!X)L.info(`Deleting organization "${F.name}"`);let{error:U}=await Y.from("orgs").delete().eq("id",D);if(U){if(!X)L.error(`Could not delete organization ${o(U)}`);throw Error(`Could not delete organization: ${o(U)}`)}if(await j0(J.apikey,{channel:"organization",event:"Organization Deleted",icon:"\uD83D\uDDD1️",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)L.success(`Organization "${F.name}" deleted from Capgo`),M0("Done ✅");return!0}g0();i9();H1();x1();_0();function np0(D,$){if($)return;if(!D.length){L.error("No organizations found");return}let X=new G$;X.headers=["Name","ID","Role","Apps","2FA Required","2FA Access"],X.rows=[];for(let Y of D.toReversed()){let F=Y.enforcing_2fa?"✓ Yes":"✗ No",Q=Y["2fa_has_access"]?"✓ Yes":"✗ No";X.rows.push([Y.name??"Unknown",Y.gid,Y.role,Y.app_count?.toString()||"0",F,Q])}L.success("Organizations"),L.success(X.toString());let J=D.filter((Y)=>Y.enforcing_2fa&&!Y["2fa_has_access"]);if(J.length>0){L.warn(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "8.4.1",
4
+ "version": "8.5.1",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
@@ -72,6 +72,7 @@
72
72
  "test:upload": "bun test/test-upload-validation.mjs",
73
73
  "test:fail-on-incompatible": "bun test/test-fail-on-incompatible.mjs",
74
74
  "test:credentials": "bun test/test-credentials.mjs",
75
+ "test:asc-key-protocol": "bun test/test-asc-key-protocol.mjs",
75
76
  "test:credentials-validation": "bun test/test-credentials-validation.mjs",
76
77
  "test:android-service-account-validation": "bun test/test-android-service-account-validation.mjs",
77
78
  "test:build-zip-filter": "bun test/test-build-zip-filter.mjs",
@@ -138,7 +139,7 @@
138
139
  "test:ios-verify-app": "bun test/test-ios-verify-app.mjs",
139
140
  "test:platform-flow-contract": "bun test/test-platform-flow-contract.mjs",
140
141
  "test:tail-engine-shared": "bun test/test-tail-engine-shared.mjs",
141
- "test": "bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared",
142
+ "test": "bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared",
142
143
  "test:build-platform-selection": "bun test/test-build-platform-selection.mjs",
143
144
  "test:ai-log-capture": "bun test/test-ai-log-capture.mjs",
144
145
  "test:ai-analyze-flow": "bun test/test-ai-analyze-flow.mjs",
@@ -175,8 +176,8 @@
175
176
  "string-width": "^8.2.1"
176
177
  },
177
178
  "optionalDependencies": {
178
- "@capgo/cli-keychain-darwin-arm64": "^1.0.0",
179
- "@capgo/cli-keychain-darwin-x64": "^1.0.0"
179
+ "@capgo/cli-helper-darwin-arm64": "^1.1.0",
180
+ "@capgo/cli-helper-darwin-x64": "^1.1.0"
180
181
  },
181
182
  "devDependencies": {
182
183
  "@antfu/eslint-config": "^9.0.0",