@capgo/cli 7.97.5 → 7.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "7.97.5",
4
+ "version": "7.98.0",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
@@ -73,6 +73,7 @@
73
73
  "test:credentials-validation": "bun test/test-credentials-validation.mjs",
74
74
  "test:build-zip-filter": "bun test/test-build-zip-filter.mjs",
75
75
  "test:checksum": "bun test/test-checksum-algorithm.mjs",
76
+ "test:build-needed": "bun test/test-build-needed.mjs",
76
77
  "test:ci-prompts": "bun test/test-ci-prompts.mjs",
77
78
  "test:posthog-exception": "bun test/test-posthog-exception.mjs",
78
79
  "test:onboarding-recovery": "bun test/test-onboarding-recovery.mjs",
@@ -87,7 +88,7 @@
87
88
  "test:version-detection:setup": "./test/fixtures/setup-test-projects.sh",
88
89
  "test:platform-paths": "bun test/test-platform-paths.mjs",
89
90
  "test:payload-split": "bun test/test-payload-split.mjs",
90
- "test": "bun run build && 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:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:ci-prompts && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && 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",
91
+ "test": "bun run build && 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:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && 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",
91
92
  "test:build-platform-selection": "bun test/test-build-platform-selection.mjs"
92
93
  },
93
94
  "dependencies": {
@@ -0,0 +1,28 @@
1
+ import type { BuildNeededOptions } from '../schemas/build';
2
+ import type { Compatibility } from '../schemas/common';
3
+ type VersionChangeType = 'major' | 'minor' | 'patch' | 'prerelease' | 'changed' | 'same' | 'new' | 'removed';
4
+ interface PublicChannelRow {
5
+ name: string | null;
6
+ }
7
+ export interface BuildNeededResult {
8
+ required: boolean;
9
+ resolvedAppId: string;
10
+ channel: string;
11
+ finalCompatibility: Compatibility[];
12
+ }
13
+ export declare const BUILD_NEEDED_ERROR_EXIT_CODE = 2;
14
+ interface FormatOptions {
15
+ color?: boolean;
16
+ }
17
+ export declare function getConfiguredDefaultChannel(config: unknown): string | undefined;
18
+ export declare function selectDefaultChannelName(rows: PublicChannelRow[]): string;
19
+ export declare function getVersionChangeType(entry: Compatibility): VersionChangeType;
20
+ export declare function getNativeDiffLabel(entry: Compatibility): string;
21
+ export declare function isBuildNeeded(finalCompatibility: Compatibility[]): boolean;
22
+ export declare function getBuildNeededExitCode(required: boolean): number;
23
+ export declare function formatShortBuildNeeded(required: boolean): string;
24
+ export declare function formatBuildNeededTable(finalCompatibility: Compatibility[], options?: FormatOptions): string;
25
+ export declare function formatVerboseBuildNeeded(result: BuildNeededResult, options?: FormatOptions): string;
26
+ export declare function getBuildNeeded(appId: string | undefined, options: BuildNeededOptions): Promise<BuildNeededResult>;
27
+ export declare function checkBuildNeeded(appId: string | undefined, options: BuildNeededOptions): Promise<void>;
28
+ export {};
@@ -57,6 +57,16 @@ export declare const buildRequestOptionsSchema: z.ZodObject<{
57
57
  verbose: z.ZodOptional<z.ZodBoolean>;
58
58
  }, z.core.$strip>;
59
59
  export type BuildRequestOptions = z.infer<typeof buildRequestOptionsSchema>;
60
+ export declare const buildNeededOptionsSchema: z.ZodObject<{
61
+ apikey: z.ZodString;
62
+ supaHost: z.ZodOptional<z.ZodString>;
63
+ supaAnon: z.ZodOptional<z.ZodString>;
64
+ channel: z.ZodOptional<z.ZodString>;
65
+ packageJson: z.ZodOptional<z.ZodString>;
66
+ nodeModules: z.ZodOptional<z.ZodString>;
67
+ verbose: z.ZodOptional<z.ZodBoolean>;
68
+ }, z.core.$strip>;
69
+ export type BuildNeededOptions = z.infer<typeof buildNeededOptionsSchema>;
60
70
  export declare const buildRequestResultSchema: z.ZodObject<{
61
71
  success: z.ZodBoolean;
62
72
  jobId: z.ZodOptional<z.ZodString>;
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 sv=A((It0,av)=>{var q4=l("constants"),Yq0=process.cwd,KQ=null,Qq0=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!KQ)KQ=Yq0.call(process);return KQ};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(HQ=process.chdir,process.chdir=function(D){KQ=null,HQ.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,HQ)}var HQ;av.exports=Fq0;function Fq0(D){if(q4.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)X(D);if(D.chown=Q(D.chown),D.fchown=Q(D.fchown),D.lchown=Q(D.lchown),D.chmod=J(D.chmod),D.fchmod=J(D.fchmod),D.lchmod=J(D.lchmod),D.chownSync=F(D.chownSync),D.fchownSync=F(D.fchownSync),D.lchownSync=F(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(G,q,B){if(B)process.nextTick(B)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(G,q,B,W){if(W)process.nextTick(W)},D.lchownSync=function(){};if(Qq0==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(G){function q(B,W,K){var H=Date.now(),z=0;G(B,W,function M(I){if(I&&(I.code==="EACCES"||I.code==="EPERM"||I.code==="EBUSY")&&Date.now()-H<60000){if(setTimeout(function(){D.stat(W,function(N,V){if(N&&N.code==="ENOENT")G(B,W,M);else K(I)})},z),z<100)z+=10;return}if(K)K(I)})}if(Object.setPrototypeOf)Object.setPrototypeOf(q,G);return q}(D.rename);D.read=typeof D.read!=="function"?D.read:function(G){function q(B,W,K,H,z,M){var I;if(M&&typeof M==="function"){var N=0;I=function(V,w,E){if(V&&V.code==="EAGAIN"&&N<10)return N++,G.call(D,B,W,K,H,z,I);M.apply(this,arguments)}}return G.call(D,B,W,K,H,z,I)}if(Object.setPrototypeOf)Object.setPrototypeOf(q,G);return q}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(G){return function(q,B,W,K,H){var z=0;while(!0)try{return G.call(D,q,B,W,K,H)}catch(M){if(M.code==="EAGAIN"&&z<10){z++;continue}throw M}}}(D.readSync);function $(G){G.lchmod=function(q,B,W){G.open(q,q4.O_WRONLY|q4.O_SYMLINK,B,function(K,H){if(K){if(W)W(K);return}G.fchmod(H,B,function(z){G.close(H,function(M){if(W)W(z||M)})})})},G.lchmodSync=function(q,B){var W=G.openSync(q,q4.O_WRONLY|q4.O_SYMLINK,B),K=!0,H;try{H=G.fchmodSync(W,B),K=!1}finally{if(K)try{G.closeSync(W)}catch(z){}else G.closeSync(W)}return H}}function X(G){if(q4.hasOwnProperty("O_SYMLINK")&&G.futimes)G.lutimes=function(q,B,W,K){G.open(q,q4.O_SYMLINK,function(H,z){if(H){if(K)K(H);return}G.futimes(z,B,W,function(M){G.close(z,function(I){if(K)K(M||I)})})})},G.lutimesSync=function(q,B,W){var K=G.openSync(q,q4.O_SYMLINK),H,z=!0;try{H=G.futimesSync(K,B,W),z=!1}finally{if(z)try{G.closeSync(K)}catch(M){}else G.closeSync(K)}return H};else if(G.futimes)G.lutimes=function(q,B,W,K){if(K)process.nextTick(K)},G.lutimesSync=function(){}}function J(G){if(!G)return G;return function(q,B,W){return G.call(D,q,B,function(K){if(O(K))K=null;if(W)W.apply(this,arguments)})}}function Y(G){if(!G)return G;return function(q,B){try{return G.call(D,q,B)}catch(W){if(!O(W))throw W}}}function Q(G){if(!G)return G;return function(q,B,W,K){return G.call(D,q,B,W,function(H){if(O(H))H=null;if(K)K.apply(this,arguments)})}}function F(G){if(!G)return G;return function(q,B,W){try{return G.call(D,q,B,W)}catch(K){if(!O(K))throw K}}}function U(G){if(!G)return G;return function(q,B,W){if(typeof B==="function")W=B,B=null;function K(H,z){if(z){if(z.uid<0)z.uid+=4294967296;if(z.gid<0)z.gid+=4294967296}if(W)W.apply(this,arguments)}return B?G.call(D,q,B,K):G.call(D,q,K)}}function Z(G){if(!G)return G;return function(q,B){var W=B?G.call(D,q,B):G.call(D,q);if(W){if(W.uid<0)W.uid+=4294967296;if(W.gid<0)W.gid+=4294967296}return W}}function O(G){if(!G)return!0;if(G.code==="ENOSYS")return!0;var q=!process.getuid||process.getuid()!==0;if(q){if(G.code==="EINVAL"||G.code==="EPERM")return!0}return!1}}});var $u=A((At0,Du)=>{var ev=l("stream").Stream;Du.exports=Uq0;function Uq0(D){return{ReadStream:$,WriteStream:X};function $(J,Y){if(!(this instanceof $))return new $(J,Y);ev.call(this);var Q=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 F=Object.keys(Y);for(var U=0,Z=F.length;U<Z;U++){var O=F[U];this[O]=Y[O]}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(){Q._read()});return}D.open(this.path,this.flags,this.mode,function(G,q){if(G){Q.emit("error",G),Q.readable=!1;return}Q.fd=q,Q.emit("open",q),Q._read()})}function X(J,Y){if(!(this instanceof X))return new X(J,Y);ev.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 Q=Object.keys(Y);for(var F=0,U=Q.length;F<U;F++){var Z=Q[F];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 Ju=A((Rt0,Xu)=>{Xu.exports=Oq0;var Zq0=Object.getPrototypeOf||function(D){return D.__proto__};function Oq0(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:Zq0(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(D,X))}),$}});var uD=A((Et0,kB)=>{var ED=l("fs"),Gq0=sv(),qq0=$u(),Bq0=Ju(),NQ=l("util"),$1,VQ;if(typeof Symbol==="function"&&typeof Symbol.for==="function")$1=Symbol.for("graceful-fs.queue"),VQ=Symbol.for("graceful-fs.previous");else $1="___graceful-fs.queue",VQ="___graceful-fs.previous";function Wq0(){}function Qu(D,$){Object.defineProperty(D,$1,{get:function(){return $}})}var P8=Wq0;if(NQ.debuglog)P8=NQ.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))P8=function(){var D=NQ.format.apply(NQ,arguments);D="GFS4: "+D.split(/\n/).join(`
127
- GFS4: `),console.error(D)};if(!ED[$1]){if(vB=global[$1]||[],Qu(ED,vB),ED.close=function(D){function $(X,J){return D.call(ED,X,function(Y){if(!Y)Yu();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,VQ,{value:D}),$}(ED.close),ED.closeSync=function(D){function $(X){D.apply(ED,arguments),Yu()}return Object.defineProperty($,VQ,{value:D}),$}(ED.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){P8(ED[$1]),l("assert").equal(ED[$1].length,0)})}var vB;if(!global[$1])Qu(global,ED[$1]);kB.exports=uB(Bq0(ED));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ED.__patched)kB.exports=uB(ED),ED.__patched=!0;function uB(D){Gq0(D),D.gracefulify=uB,D.createReadStream=w,D.createWriteStream=E;var $=D.readFile;D.readFile=X;function X(R,u,S){if(typeof u==="function")S=u,u=null;return g(R,u,S);function g(m,r,k,j){return $(m,r,function(P){if(P&&(P.code==="EMFILE"||P.code==="ENFILE"))z5([g,[m,r,k],P,j||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(R,u,S,g){if(typeof S==="function")g=S,S=null;return m(R,u,S,g);function m(r,k,j,P,v){return J(r,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var Q=D.appendFile;if(Q)D.appendFile=F;function F(R,u,S,g){if(typeof S==="function")g=S,S=null;return m(R,u,S,g);function m(r,k,j,P,v){return Q(r,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(R,u,S,g){if(typeof S==="function")g=S,S=0;return m(R,u,S,g);function m(r,k,j,P,v){return U(r,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var O=D.readdir;D.readdir=q;var G=/^v[0-5]\./;function q(R,u,S){if(typeof u==="function")S=u,u=null;var g=G.test(process.version)?function(k,j,P,v){return O(k,m(k,j,P,v))}:function(k,j,P,v){return O(k,j,m(k,j,P,v))};return g(R,u,S);function m(r,k,j,P){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))z5([g,[r,k,j],v,P||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof j==="function")j.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var B=qq0(D);M=B.ReadStream,N=B.WriteStream}var W=D.ReadStream;if(W)M.prototype=Object.create(W.prototype),M.prototype.open=I;var K=D.WriteStream;if(K)N.prototype=Object.create(K.prototype),N.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(R){M=R},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return N},set:function(R){N=R},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(R){H=R},enumerable:!0,configurable:!0});var z=N;Object.defineProperty(D,"FileWriteStream",{get:function(){return z},set:function(R){z=R},enumerable:!0,configurable:!0});function M(R,u){if(this instanceof M)return W.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function I(){var R=this;_(R.path,R.flags,R.mode,function(u,S){if(u){if(R.autoClose)R.destroy();R.emit("error",u)}else R.fd=S,R.emit("open",S),R.read()})}function N(R,u){if(this instanceof N)return K.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function V(){var R=this;_(R.path,R.flags,R.mode,function(u,S){if(u)R.destroy(),R.emit("error",u);else R.fd=S,R.emit("open",S)})}function w(R,u){return new D.ReadStream(R,u)}function E(R,u){return new D.WriteStream(R,u)}var x=D.open;D.open=_;function _(R,u,S,g){if(typeof S==="function")g=S,S=null;return m(R,u,S,g);function m(r,k,j,P,v){return x(r,k,j,function(f,b){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}return D}function z5(D){P8("ENQUEUE",D[0].name,D[1]),ED[$1].push(D),_B()}var zQ;function Yu(){var D=Date.now();for(var $=0;$<ED[$1].length;++$)if(ED[$1][$].length>2)ED[$1][$][3]=D,ED[$1][$][4]=D;_B()}function _B(){if(clearTimeout(zQ),zQ=void 0,ED[$1].length===0)return;var D=ED[$1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],Q=D[4];if(Y===void 0)P8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){P8("TIMEOUT",$.name,X);var F=X.pop();if(typeof F==="function")F.call(null,J)}else{var U=Date.now()-Q,Z=Math.max(Q-Y,1),O=Math.min(Z*1.2,100);if(U>=O)P8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else ED[$1].push(D)}if(zQ===void 0)zQ=setTimeout(_B,0)}});var Uu=A((jt0,Fu)=>{function B$(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)}Fu.exports=B$;B$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};B$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};B$.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};B$.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)};B$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};B$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};B$.prototype.start=B$.prototype.try;B$.prototype.errors=function(){return this._errors};B$.prototype.attempts=function(){return this._attempts};B$.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],Q=Y.message,F=(D[Q]||0)+1;if(D[Q]=F,F>=X)$=Y,X=F}return $}});var Ou=A((Hq0)=>{var Kq0=Uu();Hq0.operation=function(D){var $=Hq0.timeouts(D);return new Kq0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};Hq0.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(Q,F){return Q-F}),J};Hq0.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};Hq0.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 Q=X[Y],F=D[Q];D[Q]=function(Z){var O=Hq0.operation($),G=Array.prototype.slice.call(arguments,1),q=G.pop();G.push(function(B){if(O.retry(B))return;if(B)arguments[0]=O.mainError();q.apply(this,arguments)}),O.attempt(function(){Z.apply(D,G)})}.bind(D,F),D[Q].options=$}}});var Gu=A((Ct0,wQ)=>{wQ.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")wQ.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")wQ.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var IQ=A((St0,w5)=>{var LD=global.process,x8=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(!x8(LD))w5.exports=function(){return function(){}};else{if(fB=l("assert"),v8=Gu(),yB=/^win/i.test(LD.platform),V5=l("events"),typeof V5!=="function")V5=V5.EventEmitter;if(LD.__signal_exit_emitter__)iD=LD.__signal_exit_emitter__;else iD=LD.__signal_exit_emitter__=new V5,iD.count=0,iD.emitted={};if(!iD.infinite)iD.setMaxListeners(1/0),iD.infinite=!0;w5.exports=function(D,$){if(!x8(global.process))return function(){};if(fB.equal(typeof D,"function","a callback must be provided for exit handler"),u8===!1)LQ();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(iD.removeListener(X,D),iD.listeners("exit").length===0&&iD.listeners("afterexit").length===0)Z2()};return iD.on(X,D),J},Z2=function(){if(!u8||!x8(global.process))return;u8=!1,v8.forEach(function($){try{LD.removeListener($,O2[$])}catch(X){}}),LD.emit=G2,LD.reallyExit=MQ,iD.count-=1},w5.exports.unload=Z2,B4=function($,X,J){if(iD.emitted[$])return;iD.emitted[$]=!0,iD.emit($,X,J)},O2={},v8.forEach(function(D){O2[D]=function(){if(!x8(global.process))return;var X=LD.listeners(D);if(X.length===iD.count){if(Z2(),B4("exit",null,D),B4("afterexit",null,D),yB&&D==="SIGHUP")D="SIGINT";LD.kill(LD.pid,D)}}}),w5.exports.signals=function(){return v8},u8=!1,LQ=function(){if(u8||!x8(global.process))return;u8=!0,iD.count+=1,v8=v8.filter(function($){try{return LD.on($,O2[$]),!0}catch(X){return!1}}),LD.emit=hB,LD.reallyExit=bB},w5.exports.load=LQ,MQ=LD.reallyExit,bB=function($){if(!x8(global.process))return;LD.exitCode=$||0,B4("exit",LD.exitCode,null),B4("afterexit",LD.exitCode,null),MQ.call(LD,LD.exitCode)},G2=LD.emit,hB=function($,X){if($==="exit"&&x8(global.process)){if(X!==void 0)LD.exitCode=X;var J=G2.apply(this,arguments);return B4("exit",LD.exitCode,null),B4("afterexit",LD.exitCode,null),J}else return G2.apply(this,arguments)}}var fB,v8,yB,V5,iD,Z2,B4,O2,u8,LQ,MQ,bB,G2,hB});var Bu=A((Mq0,gB)=>{var qu=Symbol();function wq0(D,$,X){let J=$[qu];if(J)return $.stat(D,(Q,F)=>{if(Q)return X(Q);X(null,F.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(Q)=>{if(Q)return X(Q);$.stat(D,(F,U)=>{if(F)return X(F);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,qu,{value:Z}),X(null,U.mtime,Z)})})}function Lq0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}Mq0.probe=wq0;Mq0.getMtime=Lq0});var zu=A((Pq0,B2)=>{var Rq0=l("path"),dB=uD(),Eq0=Ou(),jq0=IQ(),Wu=Bu(),S6={};function q2(D,$){return $.lockfilePath||`${D}.lock`}function nB(D,$,X){if(!$.realpath)return X(null,Rq0.resolve(D));$.fs.realpath(D,X)}function cB(D,$,X){let J=q2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return Wu.probe(J,$.fs,(Q,F,U)=>{if(Q)return $.fs.rmdir(J,()=>{}),X(Q);X(null,F,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,(Q,F)=>{if(Q){if(Q.code==="ENOENT")return cB(D,{...$,stale:0},X);return X(Q)}if(!Ku(F,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));Hu(D,$,(U)=>{if(U)return X(U);cB(D,{...$,stale:0},X)})})})}function Ku(D,$){return D.mtime.getTime()<Date.now()-$.stale}function Hu(D,$,X){$.fs.rmdir(q2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function AQ(D,$){let X=S6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let Q=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||Q)return mB(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,AQ(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return mB(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=Wu.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let O=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||O)return mB(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,AQ(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,AQ(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function mB(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(S6[D]===$)delete S6[D];$.options.onCompromised(X)}function Tq0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:dB,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),nB(D,$,(J,Y)=>{if(J)return X(J);let Q=Eq0.operation($.retries);Q.attempt(()=>{cB(Y,$,(F,U,Z)=>{if(Q.retry(F))return;if(F)return X(Q.mainError());let O=S6[Y]={lockfilePath:q2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};AQ(Y,$),X(null,(G)=>{if(O.released)return G&&G(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));Nu(Y,{...$,realpath:!1},G)})})})})}function Nu(D,$,X){$={fs:dB,realpath:!0,...$},nB(D,$,(J,Y)=>{if(J)return X(J);let Q=S6[Y];if(!Q)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Q.updateTimeout&&clearTimeout(Q.updateTimeout),Q.released=!0,delete S6[Y],Hu(Y,$,X)})}function Cq0(D,$,X){$={stale:1e4,realpath:!0,fs:dB,...$},$.stale=Math.max($.stale||0,2000),nB(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(q2(Y,$),(Q,F)=>{if(Q)return Q.code==="ENOENT"?X(null,!1):X(Q);return X(null,!Ku(F,$))})})}function Sq0(){return S6}jq0(()=>{for(let D in S6){let $=S6[D].options;try{$.fs.rmdirSync(q2(D,$))}catch(X){}}});Pq0.lock=Tq0;Pq0.unlock=Nu;Pq0.check=Cq0;Pq0.getLocks=Sq0});var wu=A((Pt0,Vu)=>{var kq0=uD();function fq0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let Q=Y.pop(),F;try{F=D[`${J}Sync`](...Y)}catch(U){return Q(U)}Q(null,F)}}),X}function yq0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,Q)=>{if(Y)J(Y);else X(Q)}),D(...$)})}function bq0(D){return(...$)=>{let X,J;if($.push((Y,Q)=>{X=Y,J=Q}),D(...$),X)throw X;return J}}function hq0(D){if(D={...D},D.fs=fq0(D.fs||kq0),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}Vu.exports={toPromise:yq0,toSync:bq0,toSyncOptions:hq0}});var Mu=A((xt0,W4)=>{var L5=zu(),{toPromise:RQ,toSync:EQ,toSyncOptions:lB}=wu();async function Lu(D,$){let X=await RQ(L5.lock)(D,$);return RQ(X)}function gq0(D,$){let X=EQ(L5.lock)(D,lB($));return EQ(X)}function mq0(D,$){return RQ(L5.unlock)(D,$)}function cq0(D,$){return EQ(L5.unlock)(D,lB($))}function dq0(D,$){return RQ(L5.check)(D,$)}function nq0(D,$){return EQ(L5.check)(D,lB($))}W4.exports=Lu;W4.exports.lock=Lu;W4.exports.unlock=mq0;W4.exports.lockSync=gq0;W4.exports.unlockSync=cq0;W4.exports.check=dq0;W4.exports.checkSync=nq0});var Cu=A((ju)=>{Object.defineProperty(ju,"__esModule",{value:!0});ju.canStoreURLs=ju.FileUrlStorage=void 0;var Iu=l("fs"),lq0=pq0(ov()),Au=iq0(Mu());function Eu(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(Eu=function(J){return J?X:$})(D)}function iq0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=Eu($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Q in D)if(Q!=="default"&&{}.hasOwnProperty.call(D,Q)){var F=Y?Object.getOwnPropertyDescriptor(D,Q):null;F&&(F.get||F.set)?Object.defineProperty(J,Q,F):J[Q]=D[Q]}return J.default=D,X&&X.set(D,J),J}function pq0(D){return D&&D.__esModule?D:{default:D}}function W2(D){return W2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},W2(D)}function rq0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function Ru(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,oq0(J.key),J)}}function tq0(D,$,X){if($)Ru(D.prototype,$);if(X)Ru(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function oq0(D){var $=aq0(D,"string");return W2($)=="symbol"?$:$+""}function aq0(D,$){if(W2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(W2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var vt0=ju.canStoreURLs=!0,ut0=ju.FileUrlStorage=function(){function D($){rq0(this,D),this.path=$}return tq0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(Q,F){if(Q)Y(Q);else J(F)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,Q){J._getItems("tus::".concat(X),function(F,U){if(F)Q(F);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,Q){J._removeItem(X,function(F){if(F)Q(F);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,Q=Math.round(Math.random()*1000000000000),F="tus::".concat(X,"::").concat(Q);return new Promise(function(U,Z){Y._setItem(F,J,function(O){if(O)Z(O);else U(F)})})}},{key:"_setItem",value:function(X,J,Y){var Q=this;Au.lock(this.path,this._lockfileOptions()).then(function(F){Y=Q._releaseAndCb(F,Y),Q._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,Q._writeData(Z,function(O){return Y(O)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,Q){if(Y){J(Y);return}var F=Object.keys(Q).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=Q[U];return Z.urlStorageKey=U,Z});J(null,F)})}},{key:"_removeItem",value:function(X,J){var Y=this;Au.lock(this.path,this._lockfileOptions()).then(function(Q){J=Y._releaseAndCb(Q,J),Y._getData(function(F,U){if(F){J(F);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(Q){return J((0,lq0.default)([Y,Q]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,Iu.writeFile)(this.path,JSON.stringify(X),Y,function(Q){return J(Q)})}},{key:"_getData",value:function(X){(0,Iu.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(Q){X(Q);return}X(null,Y)})}}])}()});var TQ=A((K4)=>{Object.defineProperty(K4,"__esModule",{value:!0});Object.defineProperty(K4,"DefaultHttpStack",{enumerable:!0,get:function(){return vu.default}});Object.defineProperty(K4,"DetailedError",{enumerable:!0,get:function(){return eq0.default}});Object.defineProperty(K4,"FileUrlStorage",{enumerable:!0,get:function(){return uu.FileUrlStorage}});Object.defineProperty(K4,"StreamSource",{enumerable:!0,get:function(){return YB0.default}});K4.Upload=void 0;Object.defineProperty(K4,"canStoreURLs",{enumerable:!0,get:function(){return uu.canStoreURLs}});K4.defaultOptions=void 0;Object.defineProperty(K4,"enableDebugLog",{enumerable:!0,get:function(){return DB0.enableDebugLog}});K4.isSupported=void 0;var eq0=_8(lq()),DB0=iq(),$B0=_8(MP()),iB=_8(Dx()),XB0=_8(Lx()),JB0=_8(Ex()),vu=_8(mx()),YB0=_8(JB()),uu=Cu();function _8(D){return D&&D.__esModule?D:{default:D}}function I5(D){return I5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},I5(D)}function QB0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function Su(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,ku(J.key),J)}}function FB0(D,$,X){if($)Su(D.prototype,$);if(X)Su(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function UB0(D,$,X){return $=jQ($),ZB0(D,_u()?Reflect.construct($,X||[],jQ(D).constructor):$.apply(D,X))}function ZB0(D,$){if($&&(I5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return OB0(D)}function OB0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function _u(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(_u=function(){return!!D})()}function jQ(D){return jQ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},jQ(D)}function GB0(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}),$)pB(D,$)}function pB(D,$){return pB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},pB(D,$)}function Pu(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 M5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?Pu(Object(X),!0).forEach(function(J){qB0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):Pu(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function qB0(D,$,X){if($=ku($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function ku(D){var $=BB0(D,"string");return I5($)=="symbol"?$:$+""}function BB0(D,$){if(I5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(I5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var xu=K4.defaultOptions=M5(M5({},iB.default.defaultOptions),{},{httpStack:new vu.default,fileReader:new XB0.default,urlStorage:new $B0.default,fingerprint:JB0.default}),kt0=K4.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 QB0(this,$),J=M5(M5({},xu),J),UB0(this,$,[X,J])}return GB0($,D),FB0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=M5(M5({},xu),Y),iB.default.terminate(J,Y)}}])}(iB.default),ft0=K4.isSupported=!0});var x$;var K2=p(()=>{x$={name:"@capgo/cli",type:"module",version:"7.97.5",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:"tsc --noEmit",lint:'eslint "src/**/*.ts"',"lint:fix":'eslint "src/**/*.ts" --fix',"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:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.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:"bun run build && 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:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:ci-prompts && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && 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","test:build-platform-selection":"bun test/test-build-platform-selection.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",qrcode:"^1.5.4",react:"^18.3.1"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"}}});async function CQ(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 KB0(){let D=await CQ("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:x$.version,latestVersion:D,isOutdated:!!D&&D!==x$.version,majorVersion:$}}async function OD(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await KB0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
127
+ GFS4: `),console.error(D)};if(!ED[$1]){if(vB=global[$1]||[],Qu(ED,vB),ED.close=function(D){function $(X,J){return D.call(ED,X,function(Y){if(!Y)Yu();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,VQ,{value:D}),$}(ED.close),ED.closeSync=function(D){function $(X){D.apply(ED,arguments),Yu()}return Object.defineProperty($,VQ,{value:D}),$}(ED.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){P8(ED[$1]),l("assert").equal(ED[$1].length,0)})}var vB;if(!global[$1])Qu(global,ED[$1]);kB.exports=uB(Bq0(ED));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ED.__patched)kB.exports=uB(ED),ED.__patched=!0;function uB(D){Gq0(D),D.gracefulify=uB,D.createReadStream=w,D.createWriteStream=E;var $=D.readFile;D.readFile=X;function X(R,u,S){if(typeof u==="function")S=u,u=null;return g(R,u,S);function g(m,r,k,j){return $(m,r,function(P){if(P&&(P.code==="EMFILE"||P.code==="ENFILE"))z5([g,[m,r,k],P,j||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(R,u,S,g){if(typeof S==="function")g=S,S=null;return m(R,u,S,g);function m(r,k,j,P,v){return J(r,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var Q=D.appendFile;if(Q)D.appendFile=F;function F(R,u,S,g){if(typeof S==="function")g=S,S=null;return m(R,u,S,g);function m(r,k,j,P,v){return Q(r,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(R,u,S,g){if(typeof S==="function")g=S,S=0;return m(R,u,S,g);function m(r,k,j,P,v){return U(r,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var O=D.readdir;D.readdir=q;var G=/^v[0-5]\./;function q(R,u,S){if(typeof u==="function")S=u,u=null;var g=G.test(process.version)?function(k,j,P,v){return O(k,m(k,j,P,v))}:function(k,j,P,v){return O(k,j,m(k,j,P,v))};return g(R,u,S);function m(r,k,j,P){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))z5([g,[r,k,j],v,P||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof j==="function")j.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var B=qq0(D);M=B.ReadStream,N=B.WriteStream}var W=D.ReadStream;if(W)M.prototype=Object.create(W.prototype),M.prototype.open=I;var K=D.WriteStream;if(K)N.prototype=Object.create(K.prototype),N.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(R){M=R},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return N},set:function(R){N=R},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(R){H=R},enumerable:!0,configurable:!0});var z=N;Object.defineProperty(D,"FileWriteStream",{get:function(){return z},set:function(R){z=R},enumerable:!0,configurable:!0});function M(R,u){if(this instanceof M)return W.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function I(){var R=this;_(R.path,R.flags,R.mode,function(u,S){if(u){if(R.autoClose)R.destroy();R.emit("error",u)}else R.fd=S,R.emit("open",S),R.read()})}function N(R,u){if(this instanceof N)return K.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function V(){var R=this;_(R.path,R.flags,R.mode,function(u,S){if(u)R.destroy(),R.emit("error",u);else R.fd=S,R.emit("open",S)})}function w(R,u){return new D.ReadStream(R,u)}function E(R,u){return new D.WriteStream(R,u)}var x=D.open;D.open=_;function _(R,u,S,g){if(typeof S==="function")g=S,S=null;return m(R,u,S,g);function m(r,k,j,P,v){return x(r,k,j,function(f,b){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))z5([m,[r,k,j,P],f,v||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}return D}function z5(D){P8("ENQUEUE",D[0].name,D[1]),ED[$1].push(D),_B()}var zQ;function Yu(){var D=Date.now();for(var $=0;$<ED[$1].length;++$)if(ED[$1][$].length>2)ED[$1][$][3]=D,ED[$1][$][4]=D;_B()}function _B(){if(clearTimeout(zQ),zQ=void 0,ED[$1].length===0)return;var D=ED[$1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],Q=D[4];if(Y===void 0)P8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){P8("TIMEOUT",$.name,X);var F=X.pop();if(typeof F==="function")F.call(null,J)}else{var U=Date.now()-Q,Z=Math.max(Q-Y,1),O=Math.min(Z*1.2,100);if(U>=O)P8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else ED[$1].push(D)}if(zQ===void 0)zQ=setTimeout(_B,0)}});var Uu=A((jt0,Fu)=>{function B$(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)}Fu.exports=B$;B$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};B$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};B$.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};B$.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)};B$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};B$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};B$.prototype.start=B$.prototype.try;B$.prototype.errors=function(){return this._errors};B$.prototype.attempts=function(){return this._attempts};B$.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],Q=Y.message,F=(D[Q]||0)+1;if(D[Q]=F,F>=X)$=Y,X=F}return $}});var Ou=A((Hq0)=>{var Kq0=Uu();Hq0.operation=function(D){var $=Hq0.timeouts(D);return new Kq0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};Hq0.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(Q,F){return Q-F}),J};Hq0.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};Hq0.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 Q=X[Y],F=D[Q];D[Q]=function(Z){var O=Hq0.operation($),G=Array.prototype.slice.call(arguments,1),q=G.pop();G.push(function(B){if(O.retry(B))return;if(B)arguments[0]=O.mainError();q.apply(this,arguments)}),O.attempt(function(){Z.apply(D,G)})}.bind(D,F),D[Q].options=$}}});var Gu=A((Ct0,wQ)=>{wQ.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")wQ.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")wQ.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var IQ=A((St0,w5)=>{var LD=global.process,x8=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(!x8(LD))w5.exports=function(){return function(){}};else{if(fB=l("assert"),v8=Gu(),yB=/^win/i.test(LD.platform),V5=l("events"),typeof V5!=="function")V5=V5.EventEmitter;if(LD.__signal_exit_emitter__)iD=LD.__signal_exit_emitter__;else iD=LD.__signal_exit_emitter__=new V5,iD.count=0,iD.emitted={};if(!iD.infinite)iD.setMaxListeners(1/0),iD.infinite=!0;w5.exports=function(D,$){if(!x8(global.process))return function(){};if(fB.equal(typeof D,"function","a callback must be provided for exit handler"),u8===!1)LQ();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(iD.removeListener(X,D),iD.listeners("exit").length===0&&iD.listeners("afterexit").length===0)Z2()};return iD.on(X,D),J},Z2=function(){if(!u8||!x8(global.process))return;u8=!1,v8.forEach(function($){try{LD.removeListener($,O2[$])}catch(X){}}),LD.emit=G2,LD.reallyExit=MQ,iD.count-=1},w5.exports.unload=Z2,B4=function($,X,J){if(iD.emitted[$])return;iD.emitted[$]=!0,iD.emit($,X,J)},O2={},v8.forEach(function(D){O2[D]=function(){if(!x8(global.process))return;var X=LD.listeners(D);if(X.length===iD.count){if(Z2(),B4("exit",null,D),B4("afterexit",null,D),yB&&D==="SIGHUP")D="SIGINT";LD.kill(LD.pid,D)}}}),w5.exports.signals=function(){return v8},u8=!1,LQ=function(){if(u8||!x8(global.process))return;u8=!0,iD.count+=1,v8=v8.filter(function($){try{return LD.on($,O2[$]),!0}catch(X){return!1}}),LD.emit=hB,LD.reallyExit=bB},w5.exports.load=LQ,MQ=LD.reallyExit,bB=function($){if(!x8(global.process))return;LD.exitCode=$||0,B4("exit",LD.exitCode,null),B4("afterexit",LD.exitCode,null),MQ.call(LD,LD.exitCode)},G2=LD.emit,hB=function($,X){if($==="exit"&&x8(global.process)){if(X!==void 0)LD.exitCode=X;var J=G2.apply(this,arguments);return B4("exit",LD.exitCode,null),B4("afterexit",LD.exitCode,null),J}else return G2.apply(this,arguments)}}var fB,v8,yB,V5,iD,Z2,B4,O2,u8,LQ,MQ,bB,G2,hB});var Bu=A((Mq0,gB)=>{var qu=Symbol();function wq0(D,$,X){let J=$[qu];if(J)return $.stat(D,(Q,F)=>{if(Q)return X(Q);X(null,F.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(Q)=>{if(Q)return X(Q);$.stat(D,(F,U)=>{if(F)return X(F);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,qu,{value:Z}),X(null,U.mtime,Z)})})}function Lq0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}Mq0.probe=wq0;Mq0.getMtime=Lq0});var zu=A((Pq0,B2)=>{var Rq0=l("path"),dB=uD(),Eq0=Ou(),jq0=IQ(),Wu=Bu(),S6={};function q2(D,$){return $.lockfilePath||`${D}.lock`}function nB(D,$,X){if(!$.realpath)return X(null,Rq0.resolve(D));$.fs.realpath(D,X)}function cB(D,$,X){let J=q2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return Wu.probe(J,$.fs,(Q,F,U)=>{if(Q)return $.fs.rmdir(J,()=>{}),X(Q);X(null,F,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,(Q,F)=>{if(Q){if(Q.code==="ENOENT")return cB(D,{...$,stale:0},X);return X(Q)}if(!Ku(F,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));Hu(D,$,(U)=>{if(U)return X(U);cB(D,{...$,stale:0},X)})})})}function Ku(D,$){return D.mtime.getTime()<Date.now()-$.stale}function Hu(D,$,X){$.fs.rmdir(q2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function AQ(D,$){let X=S6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let Q=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||Q)return mB(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,AQ(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return mB(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=Wu.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let O=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||O)return mB(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,AQ(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,AQ(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function mB(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(S6[D]===$)delete S6[D];$.options.onCompromised(X)}function Tq0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:dB,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),nB(D,$,(J,Y)=>{if(J)return X(J);let Q=Eq0.operation($.retries);Q.attempt(()=>{cB(Y,$,(F,U,Z)=>{if(Q.retry(F))return;if(F)return X(Q.mainError());let O=S6[Y]={lockfilePath:q2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};AQ(Y,$),X(null,(G)=>{if(O.released)return G&&G(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));Nu(Y,{...$,realpath:!1},G)})})})})}function Nu(D,$,X){$={fs:dB,realpath:!0,...$},nB(D,$,(J,Y)=>{if(J)return X(J);let Q=S6[Y];if(!Q)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Q.updateTimeout&&clearTimeout(Q.updateTimeout),Q.released=!0,delete S6[Y],Hu(Y,$,X)})}function Cq0(D,$,X){$={stale:1e4,realpath:!0,fs:dB,...$},$.stale=Math.max($.stale||0,2000),nB(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(q2(Y,$),(Q,F)=>{if(Q)return Q.code==="ENOENT"?X(null,!1):X(Q);return X(null,!Ku(F,$))})})}function Sq0(){return S6}jq0(()=>{for(let D in S6){let $=S6[D].options;try{$.fs.rmdirSync(q2(D,$))}catch(X){}}});Pq0.lock=Tq0;Pq0.unlock=Nu;Pq0.check=Cq0;Pq0.getLocks=Sq0});var wu=A((Pt0,Vu)=>{var kq0=uD();function fq0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let Q=Y.pop(),F;try{F=D[`${J}Sync`](...Y)}catch(U){return Q(U)}Q(null,F)}}),X}function yq0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,Q)=>{if(Y)J(Y);else X(Q)}),D(...$)})}function bq0(D){return(...$)=>{let X,J;if($.push((Y,Q)=>{X=Y,J=Q}),D(...$),X)throw X;return J}}function hq0(D){if(D={...D},D.fs=fq0(D.fs||kq0),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}Vu.exports={toPromise:yq0,toSync:bq0,toSyncOptions:hq0}});var Mu=A((xt0,W4)=>{var L5=zu(),{toPromise:RQ,toSync:EQ,toSyncOptions:lB}=wu();async function Lu(D,$){let X=await RQ(L5.lock)(D,$);return RQ(X)}function gq0(D,$){let X=EQ(L5.lock)(D,lB($));return EQ(X)}function mq0(D,$){return RQ(L5.unlock)(D,$)}function cq0(D,$){return EQ(L5.unlock)(D,lB($))}function dq0(D,$){return RQ(L5.check)(D,$)}function nq0(D,$){return EQ(L5.check)(D,lB($))}W4.exports=Lu;W4.exports.lock=Lu;W4.exports.unlock=mq0;W4.exports.lockSync=gq0;W4.exports.unlockSync=cq0;W4.exports.check=dq0;W4.exports.checkSync=nq0});var Cu=A((ju)=>{Object.defineProperty(ju,"__esModule",{value:!0});ju.canStoreURLs=ju.FileUrlStorage=void 0;var Iu=l("fs"),lq0=pq0(ov()),Au=iq0(Mu());function Eu(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(Eu=function(J){return J?X:$})(D)}function iq0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=Eu($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Q in D)if(Q!=="default"&&{}.hasOwnProperty.call(D,Q)){var F=Y?Object.getOwnPropertyDescriptor(D,Q):null;F&&(F.get||F.set)?Object.defineProperty(J,Q,F):J[Q]=D[Q]}return J.default=D,X&&X.set(D,J),J}function pq0(D){return D&&D.__esModule?D:{default:D}}function W2(D){return W2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},W2(D)}function rq0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function Ru(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,oq0(J.key),J)}}function tq0(D,$,X){if($)Ru(D.prototype,$);if(X)Ru(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function oq0(D){var $=aq0(D,"string");return W2($)=="symbol"?$:$+""}function aq0(D,$){if(W2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(W2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var vt0=ju.canStoreURLs=!0,ut0=ju.FileUrlStorage=function(){function D($){rq0(this,D),this.path=$}return tq0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(Q,F){if(Q)Y(Q);else J(F)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,Q){J._getItems("tus::".concat(X),function(F,U){if(F)Q(F);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,Q){J._removeItem(X,function(F){if(F)Q(F);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,Q=Math.round(Math.random()*1000000000000),F="tus::".concat(X,"::").concat(Q);return new Promise(function(U,Z){Y._setItem(F,J,function(O){if(O)Z(O);else U(F)})})}},{key:"_setItem",value:function(X,J,Y){var Q=this;Au.lock(this.path,this._lockfileOptions()).then(function(F){Y=Q._releaseAndCb(F,Y),Q._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,Q._writeData(Z,function(O){return Y(O)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,Q){if(Y){J(Y);return}var F=Object.keys(Q).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=Q[U];return Z.urlStorageKey=U,Z});J(null,F)})}},{key:"_removeItem",value:function(X,J){var Y=this;Au.lock(this.path,this._lockfileOptions()).then(function(Q){J=Y._releaseAndCb(Q,J),Y._getData(function(F,U){if(F){J(F);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(Q){return J((0,lq0.default)([Y,Q]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,Iu.writeFile)(this.path,JSON.stringify(X),Y,function(Q){return J(Q)})}},{key:"_getData",value:function(X){(0,Iu.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(Q){X(Q);return}X(null,Y)})}}])}()});var TQ=A((K4)=>{Object.defineProperty(K4,"__esModule",{value:!0});Object.defineProperty(K4,"DefaultHttpStack",{enumerable:!0,get:function(){return vu.default}});Object.defineProperty(K4,"DetailedError",{enumerable:!0,get:function(){return eq0.default}});Object.defineProperty(K4,"FileUrlStorage",{enumerable:!0,get:function(){return uu.FileUrlStorage}});Object.defineProperty(K4,"StreamSource",{enumerable:!0,get:function(){return YB0.default}});K4.Upload=void 0;Object.defineProperty(K4,"canStoreURLs",{enumerable:!0,get:function(){return uu.canStoreURLs}});K4.defaultOptions=void 0;Object.defineProperty(K4,"enableDebugLog",{enumerable:!0,get:function(){return DB0.enableDebugLog}});K4.isSupported=void 0;var eq0=_8(lq()),DB0=iq(),$B0=_8(MP()),iB=_8(Dx()),XB0=_8(Lx()),JB0=_8(Ex()),vu=_8(mx()),YB0=_8(JB()),uu=Cu();function _8(D){return D&&D.__esModule?D:{default:D}}function I5(D){return I5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},I5(D)}function QB0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function Su(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,ku(J.key),J)}}function FB0(D,$,X){if($)Su(D.prototype,$);if(X)Su(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function UB0(D,$,X){return $=jQ($),ZB0(D,_u()?Reflect.construct($,X||[],jQ(D).constructor):$.apply(D,X))}function ZB0(D,$){if($&&(I5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return OB0(D)}function OB0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function _u(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(_u=function(){return!!D})()}function jQ(D){return jQ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},jQ(D)}function GB0(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}),$)pB(D,$)}function pB(D,$){return pB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},pB(D,$)}function Pu(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 M5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?Pu(Object(X),!0).forEach(function(J){qB0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):Pu(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function qB0(D,$,X){if($=ku($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function ku(D){var $=BB0(D,"string");return I5($)=="symbol"?$:$+""}function BB0(D,$){if(I5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(I5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var xu=K4.defaultOptions=M5(M5({},iB.default.defaultOptions),{},{httpStack:new vu.default,fileReader:new XB0.default,urlStorage:new $B0.default,fingerprint:JB0.default}),kt0=K4.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 QB0(this,$),J=M5(M5({},xu),J),UB0(this,$,[X,J])}return GB0($,D),FB0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=M5(M5({},xu),Y),iB.default.terminate(J,Y)}}])}(iB.default),ft0=K4.isSupported=!0});var x$;var K2=p(()=>{x$={name:"@capgo/cli",type:"module",version:"7.98.0",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:"tsc --noEmit",lint:'eslint "src/**/*.ts"',"lint:fix":'eslint "src/**/*.ts" --fix',"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:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-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:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.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:"bun run build && 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:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && 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","test:build-platform-selection":"bun test/test-build-platform-selection.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",qrcode:"^1.5.4",react:"^18.3.1"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"}}});async function CQ(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 KB0(){let D=await CQ("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:x$.version,latestVersion:D,isOutdated:!!D&&D!==x$.version,majorVersion:$}}async function OD(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await KB0();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 w1=p(()=>{_0();K2()});async function hu(D,$,X,J,Y,Q="✅"){await E0(X,{channel:D,event:J,icon:Q,user_id:$,...Y?{tags:{"app-id":Y}}:{},notify:!1})}var gu=p(()=>{_0();M6();w1();k0()});import{Buffer as mu}from"node:buffer";import{createHash as HB0}from"node:crypto";function zB0(D){let $=4294967295;for(let X=0;X<D.length;X++){let J=D[X];$=NB0[($^J)&255]^$>>>8}return $=$^4294967295,($>>>0).toString(16).padStart(8,"0")}async function H4(D,$="sha256"){let X=mu.isBuffer(D)?D:mu.from(D);if($==="crc32")return zB0(X);let J=HB0($);return J.update(X),J.digest("hex")}var NB0;var H2=p(()=>{NB0=(()=>{let D=[];for(let $=0;$<256;$++){let X=$;for(let J=0;J<8;J++)X=X&1?3988292384^X>>>1:X>>>1;D[$]=X}return D})()});var du=A((st0,cu)=>{var A5=1000,R5=A5*60,E5=R5*60,k8=E5*24,VB0=k8*7,wB0=k8*365.25;cu.exports=function(D,$){$=$||{};var X=typeof D;if(X==="string"&&D.length>0)return LB0(D);else if(X==="number"&&isFinite(D))return $.long?IB0(D):MB0(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function LB0(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*wB0;case"weeks":case"week":case"w":return X*VB0;case"days":case"day":case"d":return X*k8;case"hours":case"hour":case"hrs":case"hr":case"h":return X*E5;case"minutes":case"minute":case"mins":case"min":case"m":return X*R5;case"seconds":case"second":case"secs":case"sec":case"s":return X*A5;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return X;default:return}}function MB0(D){var $=Math.abs(D);if($>=k8)return Math.round(D/k8)+"d";if($>=E5)return Math.round(D/E5)+"h";if($>=R5)return Math.round(D/R5)+"m";if($>=A5)return Math.round(D/A5)+"s";return D+"ms"}function IB0(D){var $=Math.abs(D);if($>=k8)return SQ(D,$,k8,"day");if($>=E5)return SQ(D,$,E5,"hour");if($>=R5)return SQ(D,$,R5,"minute");if($>=A5)return SQ(D,$,A5,"second");return D+" ms"}function SQ(D,$,X,J){var Y=$>=X*1.5;return Math.round(D/X)+" "+J+(Y?"s":"")}});var rB=A((et0,nu)=>{function AB0(D){X.debug=X,X.default=X,X.coerce=Z,X.disable=F,X.enable=Y,X.enabled=U,X.humanize=du(),X.destroy=O,Object.keys(D).forEach((G)=>{X[G]=D[G]}),X.names=[],X.skips=[],X.formatters={};function $(G){let q=0;for(let B=0;B<G.length;B++)q=(q<<5)-q+G.charCodeAt(B),q|=0;return X.colors[Math.abs(q)%X.colors.length]}X.selectColor=$;function X(G){let q,B=null,W,K;function H(...z){if(!H.enabled)return;let M=H,I=Number(new Date),N=I-(q||I);if(M.diff=N,M.prev=q,M.curr=I,q=I,z[0]=X.coerce(z[0]),typeof z[0]!=="string")z.unshift("%O");let V=0;z[0]=z[0].replace(/%([a-zA-Z%])/g,(E,x)=>{if(E==="%%")return"%";V++;let _=X.formatters[x];if(typeof _==="function"){let R=z[V];E=_.call(M,R),z.splice(V,1),V--}return E}),X.formatArgs.call(M,z),(M.log||X.log).apply(M,z)}if(H.namespace=G,H.useColors=X.useColors(),H.color=X.selectColor(G),H.extend=J,H.destroy=X.destroy,Object.defineProperty(H,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(B!==null)return B;if(W!==X.namespaces)W=X.namespaces,K=X.enabled(G);return K},set:(z)=>{B=z}}),typeof X.init==="function")X.init(H);return H}function J(G,q){let B=X(this.namespace+(typeof q>"u"?":":q)+G);return B.log=this.log,B}function Y(G){X.save(G),X.namespaces=G,X.names=[],X.skips=[];let q=(typeof G==="string"?G:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let B of q)if(B[0]==="-")X.skips.push(B.slice(1));else X.names.push(B)}function Q(G,q){let B=0,W=0,K=-1,H=0;while(B<G.length)if(W<q.length&&(q[W]===G[B]||q[W]==="*"))if(q[W]==="*")K=W,H=B,W++;else B++,W++;else if(K!==-1)W=K+1,H++,B=H;else return!1;while(W<q.length&&q[W]==="*")W++;return W===q.length}function F(){let G=[...X.names,...X.skips.map((q)=>"-"+q)].join(",");return X.enable(""),G}function U(G){for(let q of X.skips)if(Q(G,q))return!1;for(let q of X.names)if(Q(G,q))return!0;return!1}function Z(G){if(G instanceof Error)return G.stack||G.message;return G}function O(){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}nu.exports=AB0});var iu=A((lu,PQ)=>{lu.formatArgs=EB0;lu.save=jB0;lu.load=TB0;lu.useColors=RB0;lu.storage=CB0();lu.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`.")}})();lu.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 RB0(){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 EB0(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+PQ.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,$)}lu.log=console.debug||console.log||(()=>{});function jB0(D){try{if(D)lu.storage.setItem("debug",D);else lu.storage.removeItem("debug")}catch($){}}function TB0(){let D;try{D=lu.storage.getItem("debug")||lu.storage.getItem("DEBUG")}catch($){}if(!D&&typeof process<"u"&&"env"in process)D=process.env.DEBUG;return D}function CB0(){try{return localStorage}catch(D){}}PQ.exports=rB()(lu);var{formatters:SB0}=PQ.exports;SB0.j=function(D){try{return JSON.stringify(D)}catch($){return"[UnexpectedJSONParseError]: "+$.message}}});var ru=A(($o0,pu)=>{pu.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 au=A((Xo0,ou)=>{var yB0=l("os"),tu=l("tty"),W$=ru(),{env:tD}=process,N4;if(W$("no-color")||W$("no-colors")||W$("color=false")||W$("color=never"))N4=0;else if(W$("color")||W$("colors")||W$("color=true")||W$("color=always"))N4=1;if("FORCE_COLOR"in tD)if(tD.FORCE_COLOR==="true")N4=1;else if(tD.FORCE_COLOR==="false")N4=0;else N4=tD.FORCE_COLOR.length===0?1:Math.min(parseInt(tD.FORCE_COLOR,10),3);function tB(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function oB(D,$){if(N4===0)return 0;if(W$("color=16m")||W$("color=full")||W$("color=truecolor"))return 3;if(W$("color=256"))return 2;if(D&&!$&&N4===void 0)return 0;let X=N4||0;if(tD.TERM==="dumb")return X;if(process.platform==="win32"){let J=yB0.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in tD){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((J)=>(J in tD))||tD.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in tD)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(tD.TEAMCITY_VERSION)?1:0;if(tD.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in tD){let J=parseInt((tD.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(tD.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(tD.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(tD.TERM))return 1;if("COLORTERM"in tD)return 1;return X}function bB0(D){let $=oB(D,D&&D.isTTY);return tB($)}ou.exports={supportsColor:bB0,stdout:tB(oB(!0,tu.isatty(1))),stderr:tB(oB(!0,tu.isatty(2)))}});var $_=A((eu,vQ)=>{var hB0=l("tty"),xQ=l("util");eu.init=iB0;eu.log=dB0;eu.formatArgs=mB0;eu.save=nB0;eu.load=lB0;eu.useColors=gB0;eu.destroy=xQ.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");eu.colors=[6,2,3,4,5,1];try{let D=au();if(D&&(D.stderr||D).level>=2)eu.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){}eu.inspectOpts=Object.keys(process.env).filter((D)=>{return/^debug_/i.test(D)}).reduce((D,$)=>{let X=$.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,Q)=>{return Q.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 gB0(){return"colors"in eu.inspectOpts?Boolean(eu.inspectOpts.colors):hB0.isatty(process.stderr.fd)}function mB0(D){let{namespace:$,useColors:X}=this;if(X){let J=this.color,Y="\x1B[3"+(J<8?J:"8;5;"+J),Q=` ${Y};1m${$} \x1B[0m`;D[0]=Q+D[0].split(`
129
129
  `).join(`
130
130
  `+Q),D.push(Y+"m+"+vQ.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=cB0()+$+" "+D[0]}function cB0(){if(eu.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function dB0(...D){return process.stderr.write(xQ.formatWithOptions(eu.inspectOpts,...D)+`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "7.97.5",
4
+ "version": "7.98.0",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
@@ -73,6 +73,7 @@
73
73
  "test:credentials-validation": "bun test/test-credentials-validation.mjs",
74
74
  "test:build-zip-filter": "bun test/test-build-zip-filter.mjs",
75
75
  "test:checksum": "bun test/test-checksum-algorithm.mjs",
76
+ "test:build-needed": "bun test/test-build-needed.mjs",
76
77
  "test:ci-prompts": "bun test/test-ci-prompts.mjs",
77
78
  "test:posthog-exception": "bun test/test-posthog-exception.mjs",
78
79
  "test:onboarding-recovery": "bun test/test-onboarding-recovery.mjs",
@@ -87,7 +88,7 @@
87
88
  "test:version-detection:setup": "./test/fixtures/setup-test-projects.sh",
88
89
  "test:platform-paths": "bun test/test-platform-paths.mjs",
89
90
  "test:payload-split": "bun test/test-payload-split.mjs",
90
- "test": "bun run build && 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:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:ci-prompts && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && 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",
91
+ "test": "bun run build && 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:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && 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",
91
92
  "test:build-platform-selection": "bun test/test-build-platform-selection.mjs"
92
93
  },
93
94
  "dependencies": {
@@ -74,6 +74,17 @@ interface BuildLogger {
74
74
 
75
75
  ## Core build request
76
76
 
77
+ ### `build needed [appId]`
78
+
79
+ - Example: `npx @capgo/cli@latest build needed com.example.app --channel production --verbose`
80
+ - Prints `yes` or `no` and exits with code `1` only when local native dependency metadata requires a new native build.
81
+ - If `--channel` is omitted, it uses `plugins.CapacitorUpdater.defaultChannel` from local config, then the public default channel in Capgo Cloud.
82
+ - Key options:
83
+ - `-c, --channel <channel>`
84
+ - `--verbose`
85
+ - `--package-json <packageJson>`
86
+ - `--node-modules <nodeModules>`
87
+
77
88
  ### `build request [appId]`
78
89
 
79
90
  - Example: `npx @capgo/cli@latest build request com.example.app --platform ios --path .`
@@ -64,6 +64,7 @@ Load `skills/release-management/SKILL.md` when working with:
64
64
  Load `skills/native-builds/SKILL.md` when working with:
65
65
 
66
66
  - `build request`
67
+ - `build needed`
67
68
  - `build credentials save`
68
69
  - `build credentials list`
69
70
  - `build credentials clear`