@capgo/cli 7.61.0 → 7.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/index.js +328 -263
- package/dist/package.json +7 -2
- package/dist/src/mcp/server.d.ts +6 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/sdk.js +1 -1
- package/package.json +7 -2
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.62.0",
|
|
4
4
|
"description": "A CLI to upload to capgo servers",
|
|
5
5
|
"author": "Martin martin@capgo.app",
|
|
6
6
|
"license": "Apache 2.0",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@capacitor/cli": "^8.0.0",
|
|
74
74
|
"@capgo/find-package-manager": "^0.0.18",
|
|
75
75
|
"@clack/prompts": "^0.11.0",
|
|
76
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
76
77
|
"@sauber/table": "npm:@jsr/sauber__table",
|
|
77
78
|
"@std/semver": "npm:@jsr/std__semver@1.0.6",
|
|
78
79
|
"@supabase/supabase-js": "^2.79.0",
|
|
@@ -93,6 +94,10 @@
|
|
|
93
94
|
"prettyjson": "^1.2.5",
|
|
94
95
|
"tmp": "^0.2.5",
|
|
95
96
|
"tus-js-client": "^4.3.1",
|
|
96
|
-
"typescript": "^5.9.3"
|
|
97
|
+
"typescript": "^5.9.3",
|
|
98
|
+
"zod": "^3.24.0"
|
|
99
|
+
},
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"micromatch": "^4.0.8"
|
|
97
102
|
}
|
|
98
103
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA+hBpD"}
|
package/dist/src/sdk.js
CHANGED
|
@@ -296,7 +296,7 @@ ${X.default.gray(hs)} ${t}
|
|
|
296
296
|
`);let w=0,S=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let k=X.default.magenta(e[w]);if(n)process.stdout.write(`${k} ${a}...`);else if(t==="timer")process.stdout.write(`${k} ${a} ${v(c)}`);else{let _=".".repeat(Math.floor(S)).slice(0,3);process.stdout.write(`${k} ${a}${_}`)}w=w+1<e.length?w+1:0,S=S<e.length?S+.125:0},r)},m=(D="",w=0)=>{o=!1,clearInterval(s),y();let S=w===0?X.default.green(Hm):w===1?X.default.red(D_):X.default.red(w_);a=b(D??a),t==="timer"?process.stdout.write(`${S} ${a} ${v(c)}
|
|
297
297
|
`):process.stdout.write(`${S} ${a}
|
|
298
298
|
`),p(),i()};return{start:A,stop:m,message:(D="")=>{a=b(D??a)}}};function v_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var yt=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let i=0;i<r.length;i++){let s=this.cast(n[i]).length;s>r[i]&&(r[i]=s)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let i=this.cast(e),s=n?v_("bold",i):i,o=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(o)+s;case"string":return s+a.repeat(o);case"boolean":case"object":return a.repeat(Math.ceil(o/2))+v_("italic",i)+a.repeat(Math.floor(o/2));default:return a.repeat(o)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((s,o)=>this.renderCell(s,i[o],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
|
|
299
|
-
`)}};var g8=require("node:child_process"),De=require("node:fs"),Xp=require("node:os"),he=Ee(require("node:path")),qn=require("node:process"),ss=Ee(Ml());var Zt=require("fs"),wu=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},ql=(t=wu(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},E_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function Ul(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function S_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Gm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var To="0|[1-9]\\d*",h4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",p4=`(?<major>${To})\\.(?<minor>${To})\\.(?<patch>${To})`,__=`(?:${To}|${h4})`,A_=`(?:-(?<prerelease>${__}(?:\\.${__})*))`,C_="[0-9A-Za-z-]+",O_=`(?:\\+(?<buildmetadata>${C_}(?:\\.${C_})*))`,x_=`v?${p4}${A_}?${O_}?`,T_=new RegExp(`^${x_}$`),I_="(?:<|>)?=?",m4="x|X|\\*",Km=`${To}|${m4}`,Hl=`[v=\\s]*(?<major>${Km})(?:\\.(?<minor>${Km})(?:\\.(?<patch>${Km})${A_}?${O_}?)?)?`,P_=new RegExp(`^(?<operator>~>?|\\^|${I_})\\s*${Hl}$`),F_=new RegExp(`^(?<operator>${I_})\\s*(${x_})$|^$`);function Wm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Xm=256;var g4=new RegExp(`^${To}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(g4.test(e)){let r=Number(e);if(Wm(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Ii(t,e){let r=Number(t);if(!Wm(r))throw new TypeError(e);return r}function Gn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function er(t,e){return t===e?0:Ul(t.major,e.major)||Ul(t.minor,e.minor)||Ul(t.patch,e.patch)||S_(t.prerelease,e.prerelease)||Gm(t.prerelease,e.prerelease)}function Ym(t){return t.toFixed(0)}function sn(t){let e=Ym(t.major),r=Ym(t.minor),n=Ym(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function y4(t,e){if(Gn(e))return!0;let r=er(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function Vl(t,e){for(let r of e)if(!y4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Gn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function bu(t,e){return e.some(r=>Vl(t,r))}function D4(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function vu(t=[],e){let r=D4(t);if(!e)return r;let n=Qt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function Eu(t,e,r={}){let n=r.build!==void 0?nn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:vu(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:vu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var zl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Io={operator:void 0,...zl};function Jm(t,e){return er(t,e)>0}function ps(t,e){return er(t,e)<0}function w4(t){let r=t.match(F_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Ii(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Ii(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Ii(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?nn(s):[]}:zl;return{operator:n||void 0,...o}}function Ge(t){return!t||t.toLowerCase()==="x"||t==="*"}function b4(t){if(!Ge(t.major))return Ge(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Ge(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?Qt(t.prerelease):[],build:[]}}function v4(t){if(!Ge(t.major))return Ge(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Ge(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function E4(t){let e=t.match(new RegExp(`^${Hl}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Hl}\\s*$`))?.groups;if(!a)return null;let u=b4(r),c=v4(a);return[u,c].filter(Boolean)}function _4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Qt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function C4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function S4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function A4(t){let e=Ge(t.minor),r=Ge(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Qt(t.prerelease??""),a=nn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function O4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function x4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function T4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function I4(t){let e=t.match(P_)?.groups;if(!e)return w4(t);switch(e.operator){case"^":return _4(e);case"~":case"~>":return C4(e);case"<":return S4(e);case"<=":return A4(e);case">":return O4(e);case">=":return x4(e);case"=":case"":return T4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function P4(t){return t.split(/\s+/).flatMap(I4)}function Kl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>E4(r)||P4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function lt(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Xm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Xm}`);t=t.trim();let e=t.match(T_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Ii(e.major,`Cannot parse version ${t}: invalid major version`),n=Ii(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Ii(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?nn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function k_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Gn(t)?!0:bu(t,[[e]]);if(n===void 0)return Gn(e)?!0:bu(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function F4(t){return t.every(e=>e.some(r=>k4(r)))}function k4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!k_(r,n))return!1}return!0}function R_(t,e){return F4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>k_(i,s)))))}function N_(t){try{return lt(t),!0}catch{return!1}}function $_(t,e){return er(t,e)>=0}var ru=Ee(kS()),yE=Ee(dD()),y8=Ee(UA()),Yp=Ee(Xd());var ri={name:"@capgo/cli",version:"7.61.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'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:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"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:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Yd(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function Je(){let t=await Yd("@capgo/cli")??"",e=t?.split(".")[0];t!==ri.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${ri.version} it's not the latest version.
|
|
299
|
+
`)}};var g8=require("node:child_process"),De=require("node:fs"),Xp=require("node:os"),he=Ee(require("node:path")),qn=require("node:process"),ss=Ee(Ml());var Zt=require("fs"),wu=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},ql=(t=wu(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},E_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function Ul(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function S_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Gm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var To="0|[1-9]\\d*",h4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",p4=`(?<major>${To})\\.(?<minor>${To})\\.(?<patch>${To})`,__=`(?:${To}|${h4})`,A_=`(?:-(?<prerelease>${__}(?:\\.${__})*))`,C_="[0-9A-Za-z-]+",O_=`(?:\\+(?<buildmetadata>${C_}(?:\\.${C_})*))`,x_=`v?${p4}${A_}?${O_}?`,T_=new RegExp(`^${x_}$`),I_="(?:<|>)?=?",m4="x|X|\\*",Km=`${To}|${m4}`,Hl=`[v=\\s]*(?<major>${Km})(?:\\.(?<minor>${Km})(?:\\.(?<patch>${Km})${A_}?${O_}?)?)?`,P_=new RegExp(`^(?<operator>~>?|\\^|${I_})\\s*${Hl}$`),F_=new RegExp(`^(?<operator>${I_})\\s*(${x_})$|^$`);function Wm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Xm=256;var g4=new RegExp(`^${To}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(g4.test(e)){let r=Number(e);if(Wm(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Ii(t,e){let r=Number(t);if(!Wm(r))throw new TypeError(e);return r}function Gn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function er(t,e){return t===e?0:Ul(t.major,e.major)||Ul(t.minor,e.minor)||Ul(t.patch,e.patch)||S_(t.prerelease,e.prerelease)||Gm(t.prerelease,e.prerelease)}function Ym(t){return t.toFixed(0)}function sn(t){let e=Ym(t.major),r=Ym(t.minor),n=Ym(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function y4(t,e){if(Gn(e))return!0;let r=er(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function Vl(t,e){for(let r of e)if(!y4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Gn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function bu(t,e){return e.some(r=>Vl(t,r))}function D4(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function vu(t=[],e){let r=D4(t);if(!e)return r;let n=Qt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function Eu(t,e,r={}){let n=r.build!==void 0?nn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:vu(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:vu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var zl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Io={operator:void 0,...zl};function Jm(t,e){return er(t,e)>0}function ps(t,e){return er(t,e)<0}function w4(t){let r=t.match(F_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Ii(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Ii(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Ii(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?nn(s):[]}:zl;return{operator:n||void 0,...o}}function Ge(t){return!t||t.toLowerCase()==="x"||t==="*"}function b4(t){if(!Ge(t.major))return Ge(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Ge(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?Qt(t.prerelease):[],build:[]}}function v4(t){if(!Ge(t.major))return Ge(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Ge(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function E4(t){let e=t.match(new RegExp(`^${Hl}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Hl}\\s*$`))?.groups;if(!a)return null;let u=b4(r),c=v4(a);return[u,c].filter(Boolean)}function _4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Qt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function C4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function S4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function A4(t){let e=Ge(t.minor),r=Ge(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Qt(t.prerelease??""),a=nn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function O4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function x4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function T4(t){let e=Ge(t.major),r=Ge(t.minor),n=Ge(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Io];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function I4(t){let e=t.match(P_)?.groups;if(!e)return w4(t);switch(e.operator){case"^":return _4(e);case"~":case"~>":return C4(e);case"<":return S4(e);case"<=":return A4(e);case">":return O4(e);case">=":return x4(e);case"=":case"":return T4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function P4(t){return t.split(/\s+/).flatMap(I4)}function Kl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>E4(r)||P4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function lt(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Xm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Xm}`);t=t.trim();let e=t.match(T_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Ii(e.major,`Cannot parse version ${t}: invalid major version`),n=Ii(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Ii(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?nn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function k_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Gn(t)?!0:bu(t,[[e]]);if(n===void 0)return Gn(e)?!0:bu(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function F4(t){return t.every(e=>e.some(r=>k4(r)))}function k4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!k_(r,n))return!1}return!0}function R_(t,e){return F4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>k_(i,s)))))}function N_(t){try{return lt(t),!0}catch{return!1}}function $_(t,e){return er(t,e)>=0}var ru=Ee(kS()),yE=Ee(dD()),y8=Ee(UA()),Yp=Ee(Xd());var ri={name:"@capgo/cli",version:"7.62.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'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:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"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:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^1.0.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",zod:"^3.24.0"},dependencies:{micromatch:"^4.0.8"}};async function Yd(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function Je(){let t=await Yd("@capgo/cli")??"",e=t?.split(".")[0];t!==ri.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${ri.version} it's not the latest version.
|
|
300
300
|
Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function e1(t,e,r,n,i,s="\u2705"){await Se(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var Sw=require("node:buffer"),t1=require("node:crypto"),UY=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function HY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=UY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function ni(t,e="sha256"){let r=Sw.Buffer.isBuffer(t)?t:Sw.Buffer.from(t);if(e==="crc32")return HY(r);let n=(0,t1.createHash)(e);return n.update(r),n.digest("hex")}var ul=Ee(_M());async function CM(){let t=await(0,ul.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Gv(t,e,r=!1){let n=await(0,ul.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,ul.writeConfig)(i,n.app.extConfigFilePath))}async function Za(t,e=!1){await Gv("CapacitorUpdater",t,e)}var nu=".capgo_key",$r=".capgo_key_v2",Jp=`${nu}.pub`,bi=`${$r}.pub`,f8="https://capgo.app",d8="https://files.capgo.app",h8="https://api.capgo.app",p8="https://console.capgo.app",DE=12e4,ofe=1024*1024*20,afe=1024*1024*1024,ufe=1024*1024*99,po="package.json",iu=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,W=t=>t?`
|
|
301
301
|
${y8.default.render(t)}`:"";function Wp(t){return new Promise(e=>{setTimeout(e,t)})}function Lr(t){return(0,ss.isMonorepo)(t)?(0,ss.findMonorepoRoot)(t):(0,ss.isNXMonorepo)(t)?(0,ss.findNXMonorepoRoot)(t):t}function cfe(t=Lr((0,qn.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,De.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,De.readFileSync)(r??(0,he.join)(t,po));return JSON.parse(n)}function os(t=Lr((0,qn.cwd)()),e=void 0){return cfe(t,e).version??""}function lfe(t){let e=t.replace("^","").replace("~","");if(N_(e))try{let r=lt(e);return sn(r)}catch{return e}return e}async function as(t,e=(0,qn.cwd)(),r){let n=r?(0,he.dirname)(r):e;try{let o=`${t}/package.json`,{createRequire:a}=await import("node:module"),c=a((0,he.join)(n,"package.json")).resolve(o),l=JSON.parse((0,De.readFileSync)(c,"utf-8"));if(l.version)return l.version}catch{}let i=n,s=he.default.parse(i).root;for(;i!==s;){let o=(0,he.join)(i,"node_modules",t,po);if((0,De.existsSync)(o))try{let u=JSON.parse((0,De.readFileSync)(o,"utf-8"));if(u.version)return u.version}catch{}let a=(0,he.dirname)(i);if(a===i)break;i=a}if(t==="@capgo/capacitor-updater"){let o=null,a=(0,he.join)(e,"ios","App","Podfile");if((0,De.existsSync)(a))try{let c=(0,De.readFileSync)(a,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(o=(0,he.resolve)((0,he.join)(e,"ios","App",c[1])))}catch{}if(!o){let u=(0,he.join)(e,"android","capacitor.settings.gradle");if((0,De.existsSync)(u))try{let l=(0,De.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);l?.[1]&&(o=(0,he.resolve)((0,he.join)(e,"android",l[1])).replace(/\/android$/,""))}catch{}}if(o){let u=(0,he.join)(o,po);if((0,De.existsSync)(u))try{let c=JSON.parse((0,De.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}}try{let a=(await Zp(e)).get(t);if(a)return a}catch{}return null}async function Zp(t=Lr((0,qn.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,he.join)(t,po)],r){for(let s of r)if(!(0,De.existsSync)(s)){let o=`Package.json at ${s} does not exist`;throw g.error(o),new Error(o)}}let n=new Map,{createRequire:i}=await import("node:module");for(let s of r){let o=(0,De.readFileSync)(s),a=JSON.parse(o),u=(0,he.dirname)(s),c=(l,d)=>{try{let y=i((0,he.join)(u,"package.json")).resolve(`${l}/package.json`),b=JSON.parse((0,De.readFileSync)(y,"utf-8"));if(b.version)return b.version}catch{}let h=u,f=he.default.parse(h).root;for(;h!==f;){let p=(0,he.join)(h,"node_modules",l,po);if((0,De.existsSync)(p))try{let b=JSON.parse((0,De.readFileSync)(p,"utf-8"));if(b.version)return b.version}catch{}let y=(0,he.dirname)(h);if(y===h)break;h=y}return lfe(d)};for(let l in a.dependencies)n.set(l,c(l,a.dependencies[l]));for(let l in a.devDependencies)n.set(l,c(l,a.devDependencies[l]))}return n}async function pe(){try{let t=await CM();if(!t){let e="No capacitor config file found, run `cap init` first";throw g.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw g.error(e),new Error(e)}}async function ffe(t,e){let r=await pe();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Gv(t,r)),r}async function D8(t){return ffe("CapacitorUpdater",t)}async function Sn(){try{let t=await pe(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||f8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||p8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||d8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||h8};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(g.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:f8,hostWeb:p8,hostFilesApi:d8,hostApi:h8}}}var w8=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Qp(){let t=await Sn();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return g.info(`Local config ${W(t)}`),t}}async function b8(){let t=await Sn();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:afe,maxChunkSize:ufe,alertUploadSize:ofe}}}async function me(t,e,r){let n=await Qp();if(e&&r&&(g.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw g.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,ru.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function dfe(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){g.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw g.error(s),new Error("Invalid API key or insufficient permissions.")}}async function v8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function E8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function hfe(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function pfe(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var hr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(hr||{}),su=(t,e)=>t>=e;async function _8(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw g.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(g.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(g.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw g.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function C8(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){g.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){g.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){g.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(g.error(`${a.message.replaceAll("\\n",`
|
|
302
302
|
`)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.62.0",
|
|
4
4
|
"description": "A CLI to upload to capgo servers",
|
|
5
5
|
"author": "Martin martin@capgo.app",
|
|
6
6
|
"license": "Apache 2.0",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@capacitor/cli": "^8.0.0",
|
|
74
74
|
"@capgo/find-package-manager": "^0.0.18",
|
|
75
75
|
"@clack/prompts": "^0.11.0",
|
|
76
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
76
77
|
"@sauber/table": "npm:@jsr/sauber__table",
|
|
77
78
|
"@std/semver": "npm:@jsr/std__semver@1.0.6",
|
|
78
79
|
"@supabase/supabase-js": "^2.79.0",
|
|
@@ -93,6 +94,10 @@
|
|
|
93
94
|
"prettyjson": "^1.2.5",
|
|
94
95
|
"tmp": "^0.2.5",
|
|
95
96
|
"tus-js-client": "^4.3.1",
|
|
96
|
-
"typescript": "^5.9.3"
|
|
97
|
+
"typescript": "^5.9.3",
|
|
98
|
+
"zod": "^3.24.0"
|
|
99
|
+
},
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"micromatch": "^4.0.8"
|
|
97
102
|
}
|
|
98
103
|
}
|