@e2b/cli 0.0.3 → 0.0.4
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/index.js +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ Content-Type: ${u.type||"application/octet-stream"}\r
|
|
|
71
71
|
`);return u!==-1&&(e=rD(e,i,n,u)),n+e+i};Object.defineProperties(si.prototype,Hr);var uw=si(),oH=si({level:iD?iD.level:0});var ur=uw;o();var Sm=I(zD()),Re=I(require("path")),wm=I(require("util"));var $t=I(require("fs")),Am=I(tp()),Tm=I(ap()),Rm=I(xm()),qR=wm.promisify(Sm.walk);async function vm(t,e){let r;if(e!=null&&e.respectGitignore){let u=Re.join(t,".gitignore");$t.existsSync(u)&&(r=(0,Am.default)().add($t.readFileSync(u).toString()))}let n;if(e!=null&&e.respectDockerignore){let u=Re.join(t,".dockerignore");if($t.existsSync(u)){let f=$t.readFileSync(u,"utf-8").split(`
|
|
72
72
|
`).map(h=>h.trim());n=(0,Tm.default)().add(f)}}let i=await qR(t,{entryFilter:u=>{var l;return[!!((l=u.stats)!=null&&l.isFile()),e!=null&&e.extension?u.name.endsWith(e.extension):!0,e!=null&&e.name?u.name===e.name:!0,!(r&&r.ignores(Re.relative(t,u.path))),!(n&&n.ignores(Re.relative(t,u.path)))].every(Boolean)},stats:!0});return await Promise.all(i.map(async u=>({path:u.path,rootPath:Re.join("/",Re.relative(t,u.path)),name:u.name})))}function Om(t){let e=process.cwd();return t?Re.isAbsolute(t)?t:Re.resolve(e,t):e}function Bm(t){return Re.relative(process.cwd(),t)}var Pm=(t,e,r)=>new Promise((n,i)=>{Rm.default.pack(t,{entries:e}).pipe($t.createWriteStream(r)).on("error",i).on("finish",n)});function Jr(t,e){return ur.redBright(`> ${t} ${e?`:
|
|
73
73
|
`+e:""}
|
|
74
|
-
`)}function gt(t){return ur.bold(t)}function hu(t){return ur.blue(t)}function Im(t){return t?hu("./"+Bm(t)):""}o();var r0=I(Jm()),n0=I(e0());var Hl=I(require("path")),i0=I(require("os")),Dr=I(require("fs")),s0=I(require("http"));var Nl={};ih(Nl,{author:()=>o3,bin:()=>p3,bugs:()=>a3,default:()=>Ml,dependencies:()=>m3,description:()=>i3,devDependencies:()=>d3,engines:()=>g3,files:()=>D3,homepage:()=>s3,license:()=>u3,name:()=>n3,publishConfig:()=>c3,repository:()=>l3,scripts:()=>h3,sideEffects:()=>f3,version:()=>ql});var n3="@e2b/cli",ql="0.0.3",i3="CLI for managing e2b environments",s3="https://usedevbook.com",u3="SEE LICENSE IN LICENSE",o3={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},a3="https://github.com/e2b-dev/e2b/issues",l3={type:"git",url:"https://github.com/e2b-dev/e2b/tree/main/packages/cli"},c3={access:"public"},f3=!1,h3={prepublishOnly:"pnpm build",build:"rm -rf ./dist && tsup --minify",dev:"tsup --watch",fix:"npx eslint **/src/**/*.{ts,js} --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore ."},d3={"@trivago/prettier-plugin-sort-imports":"^3.3.0","@types/common-tags":"^1.8.2","@types/inquirer":"^8.0.0","@types/node":"16.11","@types/node-fetch":"^2.6.5","@types/parse-gitignore":"^1.0.0","@types/update-notifier":"5.1.0","@typescript-eslint/eslint-plugin":"^5.38.1","@typescript-eslint/parser":"^5.38.1",eslint:"^8.24.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0",prettier:"^2.7.1",tsup:"^6.5.0",typescript:"^4.9.3"},D3=["dist","LICENSE","README","package.json"],p3={e2b:"dist/index.js"},m3={"@devbookhq/sdk":"^2.6.88","@e2b/sdk":"file:../js-sdk/dist","@iarna/toml":"^2.2.5","@nodelib/fs.walk":"^1.2.8","@types/tar-fs":"^2.0.2","@zeit/dockerignore":"^0.0.5","async-listen":"^3.0.1",boxen:"^7.0.0",chalk:"^5.1.2",chokidar:"^3.5.3",commander:"^9.4.1","common-tags":"^1.8.2","docker-names":"^1.2.1","get-port":"^7.0.0",ignore:"^5.2.4",inquirer:"^8.0.0","node-fetch":"^3.3.2",open:"^8.4.2","parse-gitignore":"^2.0.0","tar-fs":"^3.0.4","update-notifier":"5.1.0",yup:"^0.32.11"},g3={node:">=16"},Ml={name:n3,version:ql,description:i3,homepage:s3,license:u3,author:o3,bugs:a3,repository:l3,publishConfig:c3,sideEffects:f3,scripts:h3,devDependencies:d3,files:D3,bin:p3,dependencies:m3,engines:g3};var en=Hl.default.join(i0.homedir(),".e2b","config.json"),t0=process.env.E2B_DOCS_BASE||"https://e2b.dev/docs",u0=new We("login").description("Login to e2b").action(async()=>{let t;try{t=$l()}catch(e){console.error(Jr("Failed to read user config",e))}if(t){console.log(`Already logged in as ${gt(t.email)}, if you want to login as a different user, logout first.`);return}else if(!t){if(console.log("Attempting to login..."),t=await _3(),!t){console.info("Login aborted");return}Dr.default.mkdirSync(Hl.default.dirname(en),{recursive:!0}),Dr.default.writeFileSync(en,JSON.stringify(t,null,2))}console.log(`Logged in as ${gt(t.email)}`),process.exit(0)}),o0=new We("logout").description("Logout of e2b").action(()=>{Dr.default.existsSync(en)?(Dr.default.unlinkSync(en),console.log("Logged out.")):console.log("Not logged in, nothing to do")});function $l(){return Dr.default.existsSync(en)?JSON.parse(Dr.default.readFileSync(en,"utf8")):null}async function _3(){let t=s0.default.createServer(),{port:e}=await(0,n0.listen)(t,0,"127.0.0.1"),r=new URL(`${t0}/api/cli`);return r.searchParams.set("next",`http://localhost:${e}`),r.searchParams.set("cliVersion",Ml.version),new Promise((n,i)=>(t.once("request",(u,l)=>{l.setHeader("connection","close");let f=new URL(`${t0}/api/cli`),h=new URL(u.url||"/","http://localhost").searchParams,d=Object.fromEntries(h.entries()),{error:p}=d;p?(i(new Error(p)),f.searchParams.set("state","error"),f.searchParams.set("error",p)):(n(d),f.searchParams.set("state","success"),f.searchParams.set("email",d.email)),l.statusCode=302,l.setHeader("location",f.href),l.end()}),(0,r0.default)(r.toString())))}var Ci=process.env.E2B_API_BASE??"http://localhost:3003",bU=process.env.E2B_API_KEY,gu=process.env.E2B_ACCESS_TOKEN,b3=ua(`You must be logged in to use this command. Run ${gt("e2b login")}.`,{width:70,float:"center",padding:.5,margin:1,borderStyle:"round",borderColor:"redBright"});function _u(){if(!gu){let t=$l();gu=t==null?void 0:t.accessToken}if(!gu)console.error(b3),process.exit(1);else return gu}o();o();o();o();o();var Ul;try{Ul=Map}catch{}var jl;try{jl=Set}catch{}function a0(t,e,r){if(!t||typeof t!="object"||typeof t=="function")return t;if(t.nodeType&&"cloneNode"in t)return t.cloneNode(!0);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);if(Array.isArray(t))return t.map(Ei);if(Ul&&t instanceof Ul)return new Map(Array.from(t.entries()));if(jl&&t instanceof jl)return new Set(Array.from(t.values()));if(t instanceof Object){e.push(t);var n=Object.create(t);r.push(n);for(var i in t){var u=e.findIndex(function(l){return l===t[i]});n[i]=u>-1?r[u]:a0(t[i],e,r)}return n}return t}function Ei(t){return a0(t,[],[])}o();o();var C3=Object.prototype.toString,E3=Error.prototype.toString,y3=RegExp.prototype.toString,F3=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",x3=/^Symbol\((.*)\)(.*)$/;function S3(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function l0(t,e=!1){if(t==null||t===!0||t===!1)return""+t;let r=typeof t;if(r==="number")return S3(t);if(r==="string")return e?`"${t}"`:t;if(r==="function")return"[Function "+(t.name||"anonymous")+"]";if(r==="symbol")return F3.call(t).replace(x3,"Symbol($1)");let n=C3.call(t).slice(8,-1);return n==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):n==="Error"||t instanceof Error?"["+E3.call(t)+"]":n==="RegExp"?y3.call(t):null}function Qe(t,e){let r=l0(t,e);return r!==null?r:JSON.stringify(t,function(n,i){let u=l0(this[n],e);return u!==null?u:i},2)}var Ut={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:r,originalValue:n})=>{let i=n!=null&&n!==r,u=`${t} must be a \`${e}\` type, but the final value was: \`${Qe(r,!0)}\``+(i?` (cast from the value \`${Qe(n,!0)}\`).`:".");return r===null&&(u+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),u},defined:"${path} must be defined"},Le={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},_t={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},bu={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Cu={isValue:"${path} field must be ${value}"},Eu={noUnknown:"${path} field has unspecified keys: ${unknown}"},yi={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},w3=Object.assign(Object.create(null),{mixed:Ut,string:Le,number:_t,date:bu,object:Eu,array:yi,boolean:Cu});o();var n_=I(Tu());o();var IO=t=>t&&t.__isYupSchema__,Wt=IO;var ec=class{constructor(e,r){if(this.fn=void 0,this.refs=e,this.refs=e,typeof r=="function"){this.fn=r;return}if(!(0,n_.default)(r,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:u}=r,l=typeof n=="function"?n:(...f)=>f.every(h=>h===n);this.fn=function(...f){let h=f.pop(),d=f.pop(),p=l(...f)?i:u;if(p)return typeof p=="function"?p(d):d.concat(p.resolve(h))}}resolve(e,r){let n=this.refs.map(u=>u.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn.apply(e,n.concat(e,r));if(i===void 0||i===e)return e;if(!Wt(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}},i_=ec;o();o();o();function vi(t){return t==null?[]:[].concat(t)}function tc(){return tc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},tc.apply(this,arguments)}var kO=/\$\{\s*(\w+)\s*\}/g,re=class extends Error{static formatError(e,r){let n=r.label||r.path||"this";return n!==r.path&&(r=tc({},r,{path:n})),typeof e=="string"?e.replace(kO,(i,u)=>Qe(r[u])):typeof e=="function"?e(r):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,r,n,i){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],vi(e).forEach(u=>{re.isError(u)?(this.errors.push(...u.errors),this.inner=this.inner.concat(u.inner.length?u.inner:u)):this.errors.push(u)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,re)}};var LO=t=>{let e=!1;return(...r)=>{e||(e=!0,t(...r))}};function zt(t,e){let{endEarly:r,tests:n,args:i,value:u,errors:l,sort:f,path:h}=t,d=LO(e),p=n.length,g=[];if(l=l||[],!p)return l.length?d(new re(l,u,h)):d(null,u);for(let _=0;_<n.length;_++){let E=n[_];E(i,function(w){if(w){if(!re.isError(w))return d(w,u);if(r)return w.value=u,d(w,u);g.push(w)}if(--p<=0){if(g.length&&(f&&g.sort(f),l.length&&g.push(...l),l=g),l.length){d(new re(l,u,h),u);return}d(null,u)}})}}o();var WC=I(Ec());o();var jC=I(Ii()),Bu={context:"$",value:"."};var de=class{constructor(e,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Bu.context,this.isValue=this.key[0]===Bu.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?Bu.context:this.isValue?Bu.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&(0,jC.getter)(this.path,!0),this.map=r.map}getValue(e,r,n){let i=this.isContext?n:this.isValue?e:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,r){return this.getValue(e,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}};de.prototype.__isYupRef=!0;function Pu(){return Pu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Pu.apply(this,arguments)}function rI(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,u;for(u=0;u<n.length;u++)i=n[u],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function hn(t){function e(r,n){let{value:i,path:u="",label:l,options:f,originalValue:h,sync:d}=r,p=rI(r,["value","path","label","options","originalValue","sync"]),{name:g,test:_,params:E,message:C}=t,{parent:w,context:A}=f;function R(S){return de.isRef(S)?S.getValue(i,w,A):S}function B(S={}){let O=(0,WC.default)(Pu({value:i,originalValue:h,label:l,path:S.path||u},E,S.params),R),V=new re(re.formatError(S.message||C,O),i,O.path,S.type||g);return V.params=O,V}let k=Pu({path:u,parent:w,type:g,createError:B,resolve:R,options:f,originalValue:h},p);if(!d){try{Promise.resolve(_.call(k,i,k)).then(S=>{re.isError(S)?n(S):S?n(null,S):n(B())}).catch(n)}catch(S){n(S)}return}let F;try{var T;if(F=_.call(k,i,k),typeof((T=F)==null?void 0:T.then)=="function")throw new Error(`Validation test of type: "${k.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(S){n(S);return}re.isError(F)?n(F):F?n(null,F):n(B())}return e.OPTIONS=t,e}o();var zC=I(Ii()),nI=t=>t.substr(0,t.length-1).substr(1);function VC(t,e,r,n=r){let i,u,l;return e?((0,zC.forEach)(e,(f,h,d)=>{let p=h?nI(f):f;if(t=t.resolve({context:n,parent:i,value:r}),t.innerType){let g=d?parseInt(p,10):0;if(r&&g>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${f}, in the path: ${e}. because there is no value at that index. `);i=r,r=r&&r[g],t=t.innerType}if(!d){if(!t.fields||!t.fields[p])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${l} which is a type: "${t._type}")`);i=r,r=r&&r[p],t=t.fields[p]}u=p,l=h?"["+f+"]":"."+f}),{schema:t,parent:i,parentPath:u}):{parent:i,parentPath:e,schema:t}}o();var Vt=class{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){let e=[];for(let r of this.list)e.push(r);for(let[,r]of this.refs)e.push(r.describe());return e}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(e){return this.toArray().reduce((r,n)=>r.concat(de.isRef(n)?e(n):n),[])}add(e){de.isRef(e)?this.refs.set(e.key,e):this.list.add(e)}delete(e){de.isRef(e)?this.refs.delete(e.key):this.list.delete(e)}clone(){let e=new Vt;return e.list=new Set(this.list),e.refs=new Map(this.refs),e}merge(e,r){let n=this.clone();return e.list.forEach(i=>n.add(i)),e.refs.forEach(i=>n.add(i)),r.list.forEach(i=>n.delete(i)),r.refs.forEach(i=>n.delete(i)),n}};function Ne(){return Ne=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ne.apply(this,arguments)}var W=class{constructor(e){this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this._typeError=void 0,this._whitelist=new Vt,this._blacklist=new Vt,this.exclusiveTests=Object.create(null),this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Ut.notType)}),this.type=(e==null?void 0:e.type)||"mixed",this.spec=Ne({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},e==null?void 0:e.spec)}get _type(){return this.type}_typeCheck(e){return!0}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;let r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeError=this._typeError,r._whitelistError=this._whitelistError,r._blacklistError=this._blacklistError,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.exclusiveTests=Ne({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=Ei(Ne({},this.spec,e)),r}label(e){let r=this.clone();return r.spec.label=e,r}meta(...e){if(e.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},e[0]),r}withMutation(e){let r=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=r,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let r=this,n=e.clone(),i=Ne({},r.spec,n.spec);return n.spec=i,n._typeError||(n._typeError=r._typeError),n._whitelistError||(n._whitelistError=r._whitelistError),n._blacklistError||(n._blacklistError=r._blacklistError),n._whitelist=r._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=r._blacklist.merge(e._blacklist,e._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(u=>{e.tests.forEach(l=>{u.test(l.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(e){return this.spec.nullable&&e===null?!0:this._typeCheck(e)}resolve(e){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,u)=>u.resolve(i,e),r),r=r.resolve(e)}return r}cast(e,r={}){let n=this.resolve(Ne({value:e},r)),i=n._cast(e,r);if(e!==void 0&&r.assert!==!1&&n.isType(i)!==!0){let u=Qe(e),l=Qe(i);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n._type}".
|
|
74
|
+
`)}function gt(t){return ur.bold(t)}function hu(t){return ur.blue(t)}function Im(t){return t?hu("./"+Bm(t)):""}o();var r0=I(Jm()),n0=I(e0());var Hl=I(require("path")),i0=I(require("os")),Dr=I(require("fs")),s0=I(require("http"));var Nl={};ih(Nl,{author:()=>o3,bin:()=>p3,bugs:()=>a3,default:()=>Ml,dependencies:()=>m3,description:()=>i3,devDependencies:()=>d3,engines:()=>g3,files:()=>D3,homepage:()=>s3,license:()=>u3,name:()=>n3,publishConfig:()=>c3,repository:()=>l3,scripts:()=>h3,sideEffects:()=>f3,version:()=>ql});var n3="@e2b/cli",ql="0.0.4",i3="CLI for managing e2b environments",s3="https://usedevbook.com",u3="SEE LICENSE IN LICENSE",o3={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},a3="https://github.com/e2b-dev/e2b/issues",l3={type:"git",url:"https://github.com/e2b-dev/e2b/tree/main/packages/cli"},c3={access:"public"},f3=!1,h3={prepublishOnly:"pnpm build",build:"rm -rf ./dist && tsup --minify",dev:"tsup --watch",fix:"npx eslint **/src/**/*.{ts,js} --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore ."},d3={"@trivago/prettier-plugin-sort-imports":"^3.3.0","@types/common-tags":"^1.8.2","@types/inquirer":"^8.0.0","@types/node":"16.11","@types/node-fetch":"^2.6.5","@types/parse-gitignore":"^1.0.0","@types/update-notifier":"5.1.0","@typescript-eslint/eslint-plugin":"^5.38.1","@typescript-eslint/parser":"^5.38.1",eslint:"^8.24.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0",prettier:"^2.7.1",tsup:"^6.5.0",typescript:"^4.9.3"},D3=["dist","LICENSE","README","package.json"],p3={e2b:"dist/index.js"},m3={"@devbookhq/sdk":"^2.6.88","@iarna/toml":"^2.2.5","@nodelib/fs.walk":"^1.2.8","@types/tar-fs":"^2.0.2","@zeit/dockerignore":"^0.0.5","async-listen":"^3.0.1",boxen:"^7.0.0",chalk:"^5.1.2",chokidar:"^3.5.3",commander:"^9.4.1","common-tags":"^1.8.2","docker-names":"^1.2.1","get-port":"^7.0.0",ignore:"^5.2.4",inquirer:"^8.0.0","node-fetch":"^3.3.2",open:"^8.4.2","parse-gitignore":"^2.0.0","tar-fs":"^3.0.4","update-notifier":"5.1.0",yup:"^0.32.11"},g3={node:">=16"},Ml={name:n3,version:ql,description:i3,homepage:s3,license:u3,author:o3,bugs:a3,repository:l3,publishConfig:c3,sideEffects:f3,scripts:h3,devDependencies:d3,files:D3,bin:p3,dependencies:m3,engines:g3};var en=Hl.default.join(i0.homedir(),".e2b","config.json"),t0=process.env.E2B_DOCS_BASE||"https://e2b.dev/docs",u0=new We("login").description("Login to e2b").action(async()=>{let t;try{t=$l()}catch(e){console.error(Jr("Failed to read user config",e))}if(t){console.log(`Already logged in as ${gt(t.email)}, if you want to login as a different user, logout first.`);return}else if(!t){if(console.log("Attempting to login..."),t=await _3(),!t){console.info("Login aborted");return}Dr.default.mkdirSync(Hl.default.dirname(en),{recursive:!0}),Dr.default.writeFileSync(en,JSON.stringify(t,null,2))}console.log(`Logged in as ${gt(t.email)}`),process.exit(0)}),o0=new We("logout").description("Logout of e2b").action(()=>{Dr.default.existsSync(en)?(Dr.default.unlinkSync(en),console.log("Logged out.")):console.log("Not logged in, nothing to do")});function $l(){return Dr.default.existsSync(en)?JSON.parse(Dr.default.readFileSync(en,"utf8")):null}async function _3(){let t=s0.default.createServer(),{port:e}=await(0,n0.listen)(t,0,"127.0.0.1"),r=new URL(`${t0}/api/cli`);return r.searchParams.set("next",`http://localhost:${e}`),r.searchParams.set("cliVersion",Ml.version),new Promise((n,i)=>(t.once("request",(u,l)=>{l.setHeader("connection","close");let f=new URL(`${t0}/api/cli`),h=new URL(u.url||"/","http://localhost").searchParams,d=Object.fromEntries(h.entries()),{error:p}=d;p?(i(new Error(p)),f.searchParams.set("state","error"),f.searchParams.set("error",p)):(n(d),f.searchParams.set("state","success"),f.searchParams.set("email",d.email)),l.statusCode=302,l.setHeader("location",f.href),l.end()}),(0,r0.default)(r.toString())))}var Ci=process.env.E2B_API_BASE??"http://localhost:3003",bU=process.env.E2B_API_KEY,gu=process.env.E2B_ACCESS_TOKEN,b3=ua(`You must be logged in to use this command. Run ${gt("e2b login")}.`,{width:70,float:"center",padding:.5,margin:1,borderStyle:"round",borderColor:"redBright"});function _u(){if(!gu){let t=$l();gu=t==null?void 0:t.accessToken}if(!gu)console.error(b3),process.exit(1);else return gu}o();o();o();o();o();var Ul;try{Ul=Map}catch{}var jl;try{jl=Set}catch{}function a0(t,e,r){if(!t||typeof t!="object"||typeof t=="function")return t;if(t.nodeType&&"cloneNode"in t)return t.cloneNode(!0);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);if(Array.isArray(t))return t.map(Ei);if(Ul&&t instanceof Ul)return new Map(Array.from(t.entries()));if(jl&&t instanceof jl)return new Set(Array.from(t.values()));if(t instanceof Object){e.push(t);var n=Object.create(t);r.push(n);for(var i in t){var u=e.findIndex(function(l){return l===t[i]});n[i]=u>-1?r[u]:a0(t[i],e,r)}return n}return t}function Ei(t){return a0(t,[],[])}o();o();var C3=Object.prototype.toString,E3=Error.prototype.toString,y3=RegExp.prototype.toString,F3=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",x3=/^Symbol\((.*)\)(.*)$/;function S3(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function l0(t,e=!1){if(t==null||t===!0||t===!1)return""+t;let r=typeof t;if(r==="number")return S3(t);if(r==="string")return e?`"${t}"`:t;if(r==="function")return"[Function "+(t.name||"anonymous")+"]";if(r==="symbol")return F3.call(t).replace(x3,"Symbol($1)");let n=C3.call(t).slice(8,-1);return n==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):n==="Error"||t instanceof Error?"["+E3.call(t)+"]":n==="RegExp"?y3.call(t):null}function Qe(t,e){let r=l0(t,e);return r!==null?r:JSON.stringify(t,function(n,i){let u=l0(this[n],e);return u!==null?u:i},2)}var Ut={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:r,originalValue:n})=>{let i=n!=null&&n!==r,u=`${t} must be a \`${e}\` type, but the final value was: \`${Qe(r,!0)}\``+(i?` (cast from the value \`${Qe(n,!0)}\`).`:".");return r===null&&(u+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),u},defined:"${path} must be defined"},Le={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},_t={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},bu={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Cu={isValue:"${path} field must be ${value}"},Eu={noUnknown:"${path} field has unspecified keys: ${unknown}"},yi={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},w3=Object.assign(Object.create(null),{mixed:Ut,string:Le,number:_t,date:bu,object:Eu,array:yi,boolean:Cu});o();var n_=I(Tu());o();var IO=t=>t&&t.__isYupSchema__,Wt=IO;var ec=class{constructor(e,r){if(this.fn=void 0,this.refs=e,this.refs=e,typeof r=="function"){this.fn=r;return}if(!(0,n_.default)(r,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:u}=r,l=typeof n=="function"?n:(...f)=>f.every(h=>h===n);this.fn=function(...f){let h=f.pop(),d=f.pop(),p=l(...f)?i:u;if(p)return typeof p=="function"?p(d):d.concat(p.resolve(h))}}resolve(e,r){let n=this.refs.map(u=>u.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn.apply(e,n.concat(e,r));if(i===void 0||i===e)return e;if(!Wt(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}},i_=ec;o();o();o();function vi(t){return t==null?[]:[].concat(t)}function tc(){return tc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},tc.apply(this,arguments)}var kO=/\$\{\s*(\w+)\s*\}/g,re=class extends Error{static formatError(e,r){let n=r.label||r.path||"this";return n!==r.path&&(r=tc({},r,{path:n})),typeof e=="string"?e.replace(kO,(i,u)=>Qe(r[u])):typeof e=="function"?e(r):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,r,n,i){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],vi(e).forEach(u=>{re.isError(u)?(this.errors.push(...u.errors),this.inner=this.inner.concat(u.inner.length?u.inner:u)):this.errors.push(u)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,re)}};var LO=t=>{let e=!1;return(...r)=>{e||(e=!0,t(...r))}};function zt(t,e){let{endEarly:r,tests:n,args:i,value:u,errors:l,sort:f,path:h}=t,d=LO(e),p=n.length,g=[];if(l=l||[],!p)return l.length?d(new re(l,u,h)):d(null,u);for(let _=0;_<n.length;_++){let E=n[_];E(i,function(w){if(w){if(!re.isError(w))return d(w,u);if(r)return w.value=u,d(w,u);g.push(w)}if(--p<=0){if(g.length&&(f&&g.sort(f),l.length&&g.push(...l),l=g),l.length){d(new re(l,u,h),u);return}d(null,u)}})}}o();var WC=I(Ec());o();var jC=I(Ii()),Bu={context:"$",value:"."};var de=class{constructor(e,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Bu.context,this.isValue=this.key[0]===Bu.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?Bu.context:this.isValue?Bu.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&(0,jC.getter)(this.path,!0),this.map=r.map}getValue(e,r,n){let i=this.isContext?n:this.isValue?e:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,r){return this.getValue(e,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}};de.prototype.__isYupRef=!0;function Pu(){return Pu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Pu.apply(this,arguments)}function rI(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,u;for(u=0;u<n.length;u++)i=n[u],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function hn(t){function e(r,n){let{value:i,path:u="",label:l,options:f,originalValue:h,sync:d}=r,p=rI(r,["value","path","label","options","originalValue","sync"]),{name:g,test:_,params:E,message:C}=t,{parent:w,context:A}=f;function R(S){return de.isRef(S)?S.getValue(i,w,A):S}function B(S={}){let O=(0,WC.default)(Pu({value:i,originalValue:h,label:l,path:S.path||u},E,S.params),R),V=new re(re.formatError(S.message||C,O),i,O.path,S.type||g);return V.params=O,V}let k=Pu({path:u,parent:w,type:g,createError:B,resolve:R,options:f,originalValue:h},p);if(!d){try{Promise.resolve(_.call(k,i,k)).then(S=>{re.isError(S)?n(S):S?n(null,S):n(B())}).catch(n)}catch(S){n(S)}return}let F;try{var T;if(F=_.call(k,i,k),typeof((T=F)==null?void 0:T.then)=="function")throw new Error(`Validation test of type: "${k.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(S){n(S);return}re.isError(F)?n(F):F?n(null,F):n(B())}return e.OPTIONS=t,e}o();var zC=I(Ii()),nI=t=>t.substr(0,t.length-1).substr(1);function VC(t,e,r,n=r){let i,u,l;return e?((0,zC.forEach)(e,(f,h,d)=>{let p=h?nI(f):f;if(t=t.resolve({context:n,parent:i,value:r}),t.innerType){let g=d?parseInt(p,10):0;if(r&&g>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${f}, in the path: ${e}. because there is no value at that index. `);i=r,r=r&&r[g],t=t.innerType}if(!d){if(!t.fields||!t.fields[p])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${l} which is a type: "${t._type}")`);i=r,r=r&&r[p],t=t.fields[p]}u=p,l=h?"["+f+"]":"."+f}),{schema:t,parent:i,parentPath:u}):{parent:i,parentPath:e,schema:t}}o();var Vt=class{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){let e=[];for(let r of this.list)e.push(r);for(let[,r]of this.refs)e.push(r.describe());return e}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(e){return this.toArray().reduce((r,n)=>r.concat(de.isRef(n)?e(n):n),[])}add(e){de.isRef(e)?this.refs.set(e.key,e):this.list.add(e)}delete(e){de.isRef(e)?this.refs.delete(e.key):this.list.delete(e)}clone(){let e=new Vt;return e.list=new Set(this.list),e.refs=new Map(this.refs),e}merge(e,r){let n=this.clone();return e.list.forEach(i=>n.add(i)),e.refs.forEach(i=>n.add(i)),r.list.forEach(i=>n.delete(i)),r.refs.forEach(i=>n.delete(i)),n}};function Ne(){return Ne=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ne.apply(this,arguments)}var W=class{constructor(e){this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this._typeError=void 0,this._whitelist=new Vt,this._blacklist=new Vt,this.exclusiveTests=Object.create(null),this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Ut.notType)}),this.type=(e==null?void 0:e.type)||"mixed",this.spec=Ne({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},e==null?void 0:e.spec)}get _type(){return this.type}_typeCheck(e){return!0}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;let r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeError=this._typeError,r._whitelistError=this._whitelistError,r._blacklistError=this._blacklistError,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.exclusiveTests=Ne({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=Ei(Ne({},this.spec,e)),r}label(e){let r=this.clone();return r.spec.label=e,r}meta(...e){if(e.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},e[0]),r}withMutation(e){let r=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=r,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let r=this,n=e.clone(),i=Ne({},r.spec,n.spec);return n.spec=i,n._typeError||(n._typeError=r._typeError),n._whitelistError||(n._whitelistError=r._whitelistError),n._blacklistError||(n._blacklistError=r._blacklistError),n._whitelist=r._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=r._blacklist.merge(e._blacklist,e._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(u=>{e.tests.forEach(l=>{u.test(l.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(e){return this.spec.nullable&&e===null?!0:this._typeCheck(e)}resolve(e){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,u)=>u.resolve(i,e),r),r=r.resolve(e)}return r}cast(e,r={}){let n=this.resolve(Ne({value:e},r)),i=n._cast(e,r);if(e!==void 0&&r.assert!==!1&&n.isType(i)!==!0){let u=Qe(e),l=Qe(i);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n._type}".
|
|
75
75
|
|
|
76
76
|
attempted value: ${u}
|
|
77
77
|
`+(l!==u?`result of cast: ${l}`:""))}return i}_cast(e,r){let n=e===void 0?e:this.transforms.reduce((i,u)=>u.call(this,i,e,this),e);return n===void 0&&(n=this.getDefault()),n}_validate(e,r={},n){let{sync:i,path:u,from:l=[],originalValue:f=e,strict:h=this.spec.strict,abortEarly:d=this.spec.abortEarly}=r,p=e;h||(p=this._cast(p,Ne({assert:!1},r)));let g={value:p,path:u,options:r,originalValue:f,schema:this,label:this.spec.label,sync:i,from:l},_=[];this._typeError&&_.push(this._typeError);let E=[];this._whitelistError&&E.push(this._whitelistError),this._blacklistError&&E.push(this._blacklistError),zt({args:g,value:p,path:u,sync:i,tests:_,endEarly:d},C=>{if(C)return void n(C,p);zt({tests:this.tests.concat(E),args:g,path:u,sync:i,value:p,endEarly:d},n)})}validate(e,r,n){let i=this.resolve(Ne({},r,{value:e}));return typeof n=="function"?i._validate(e,r,n):new Promise((u,l)=>i._validate(e,r,(f,h)=>{f?l(f):u(h)}))}validateSync(e,r){let n=this.resolve(Ne({},r,{value:e})),i;return n._validate(e,Ne({},r,{sync:!0}),(u,l)=>{if(u)throw u;i=l}),i}isValid(e,r){return this.validate(e,r).then(()=>!0,n=>{if(re.isError(n))return!1;throw n})}isValidSync(e,r){try{return this.validateSync(e,r),!0}catch(n){if(re.isError(n))return!1;throw n}}_getDefault(){let e=this.spec.default;return e==null?e:typeof e=="function"?e.call(this):Ei(e)}getDefault(e){return this.resolve(e||{})._getDefault()}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){let r=this.clone();return r.spec.strict=e,r}_isPresent(e){return e!=null}defined(e=Ut.defined){return this.test({message:e,name:"defined",exclusive:!0,test(r){return r!==void 0}})}required(e=Ut.required){return this.clone({presence:"required"}).withMutation(r=>r.test({message:e,name:"required",exclusive:!0,test(n){return this.schema._isPresent(n)}}))}notRequired(){let e=this.clone({presence:"optional"});return e.tests=e.tests.filter(r=>r.OPTIONS.name!=="required"),e}nullable(e=!0){return this.clone({nullable:e!==!1})}transform(e){let r=this.clone();return r.transforms.push(e),r}test(...e){let r;if(e.length===1?typeof e[0]=="function"?r={test:e[0]}:r=e[0]:e.length===2?r={name:e[0],test:e[1]}:r={name:e[0],message:e[1],test:e[2]},r.message===void 0&&(r.message=Ut.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=hn(r),u=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(l=>!(l.OPTIONS.name===r.name&&(u||l.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(e,r){!Array.isArray(e)&&typeof e!="string"&&(r=e,e=".");let n=this.clone(),i=vi(e).map(u=>new de(u));return i.forEach(u=>{u.isSibling&&n.deps.push(u.key)}),n.conditions.push(new i_(i,r)),n}typeError(e){let r=this.clone();return r._typeError=hn({message:e,name:"typeError",test(n){return n!==void 0&&!this.schema.isType(n)?this.createError({params:{type:this.schema._type}}):!0}}),r}oneOf(e,r=Ut.oneOf){let n=this.clone();return e.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n._whitelistError=hn({message:r,name:"oneOf",test(i){if(i===void 0)return!0;let u=this.schema._whitelist,l=u.resolveAll(this.resolve);return l.includes(i)?!0:this.createError({params:{values:u.toArray().join(", "),resolved:l}})}}),n}notOneOf(e,r=Ut.notOneOf){let n=this.clone();return e.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n._blacklistError=hn({message:r,name:"notOneOf",test(i){let u=this.schema._blacklist,l=u.resolveAll(this.resolve);return l.includes(i)?this.createError({params:{values:u.toArray().join(", "),resolved:l}}):!0}}),n}strip(e=!0){let r=this.clone();return r.spec.strip=e,r}describe(){let e=this.clone(),{label:r,meta:n}=e.spec;return{meta:n,label:r,type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map(u=>({name:u.OPTIONS.name,params:u.OPTIONS.params})).filter((u,l,f)=>f.findIndex(h=>h.name===u.name)===l)}}};W.prototype.__isYupSchema__=!0;for(let t of["validate","validateSync"])W.prototype[`${t}At`]=function(e,r,n={}){let{parent:i,parentPath:u,schema:l}=VC(this,e,r,n.context);return l[t](i&&i[u],Ne({},n,{parent:i,path:e}))};for(let t of["equals","is"])W.prototype[t]=W.prototype.oneOf;for(let t of["not","nope"])W.prototype[t]=W.prototype.notOneOf;W.prototype.optional=W.prototype.notRequired;var GC=W;function YC(){return new GC}YC.prototype=GC.prototype;o();o();var iI=t=>t==null,z=iI;function KC(){return new dn}var dn=class extends W{constructor(){super({type:"boolean"}),this.withMutation(()=>{this.transform(function(e){if(!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}_typeCheck(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}isTrue(e=Cu.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return z(r)||r===!0}})}isFalse(e=Cu.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return z(r)||r===!1}})}};KC.prototype=dn.prototype;o();var sI=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,uI=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,oI=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,aI=t=>z(t)||t===t.trim(),lI={}.toString();function nt(){return new Dn}var Dn=class extends W{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(e){if(this.isType(e)||Array.isArray(e))return e;let r=e!=null&&e.toString?e.toString():e;return r===lI?e:r})})}_typeCheck(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}_isPresent(e){return super._isPresent(e)&&!!e.length}length(e,r=Le.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:e},test(n){return z(n)||n.length===this.resolve(e)}})}min(e,r=Le.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(n){return z(n)||n.length>=this.resolve(e)}})}max(e,r=Le.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:e},test(n){return z(n)||n.length<=this.resolve(e)}})}matches(e,r){let n=!1,i,u;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:u}=r:i=r),this.test({name:u||"matches",message:i||Le.matches,params:{regex:e},test:l=>z(l)||l===""&&n||l.search(e)!==-1})}email(e=Le.email){return this.matches(sI,{name:"email",message:e,excludeEmptyString:!0})}url(e=Le.url){return this.matches(uI,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Le.uuid){return this.matches(oI,{name:"uuid",message:e,excludeEmptyString:!1})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=Le.trim){return this.transform(r=>r!=null?r.trim():r).test({message:e,name:"trim",test:aI})}lowercase(e=Le.lowercase){return this.transform(r=>z(r)?r:r.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,test:r=>z(r)||r===r.toLowerCase()})}uppercase(e=Le.uppercase){return this.transform(r=>z(r)?r:r.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,test:r=>z(r)||r===r.toUpperCase()})}};nt.prototype=Dn.prototype;o();var cI=t=>t!=+t;function QC(){return new pn}var pn=class extends W{constructor(){super({type:"number"}),this.withMutation(()=>{this.transform(function(e){let r=e;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)?r:parseFloat(r)})})}_typeCheck(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!cI(e)}min(e,r=_t.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(n){return z(n)||n>=this.resolve(e)}})}max(e,r=_t.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:e},test(n){return z(n)||n<=this.resolve(e)}})}lessThan(e,r=_t.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:e},test(n){return z(n)||n<this.resolve(e)}})}moreThan(e,r=_t.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:e},test(n){return z(n)||n>this.resolve(e)}})}positive(e=_t.positive){return this.moreThan(0,e)}negative(e=_t.negative){return this.lessThan(0,e)}integer(e=_t.integer){return this.test({name:"integer",message:e,test:r=>z(r)||Number.isInteger(r)})}truncate(){return this.transform(e=>z(e)?e:e|0)}round(e){var r;let n=["ceil","floor","round","trunc"];if(e=((r=e)==null?void 0:r.toLowerCase())||"round",e==="trunc")return this.truncate();if(n.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>z(i)?i:Math[e](i))}};QC.prototype=pn.prototype;o();o();var fI=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function wc(t){var e=[1,4,5,6,7,10,11],r=0,n,i;if(i=fI.exec(t)){for(var u=0,l;l=e[u];++u)i[l]=+i[l]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,i[7]=i[7]?String(i[7]).substr(0,3):0,(i[8]===void 0||i[8]==="")&&(i[9]===void 0||i[9]==="")?n=+new Date(i[1],i[2],i[3],i[4],i[5],i[6],i[7]):(i[8]!=="Z"&&i[9]!==void 0&&(r=i[10]*60+i[11],i[9]==="+"&&(r=0-r)),n=Date.UTC(i[1],i[2],i[3],i[4],i[5]+r,i[6],i[7]))}else n=Date.parse?Date.parse(t):NaN;return n}var Ac=new Date(""),hI=t=>Object.prototype.toString.call(t)==="[object Date]";function Tc(){return new gr}var gr=class extends W{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(e){return this.isType(e)?e:(e=wc(e),isNaN(e)?Ac:new Date(e))})})}_typeCheck(e){return hI(e)&&!isNaN(e.getTime())}prepareParam(e,r){let n;if(de.isRef(e))n=e;else{let i=this.cast(e);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(e,r=bu.min){let n=this.prepareParam(e,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(i){return z(i)||i>=this.resolve(n)}})}max(e,r=bu.max){let n=this.prepareParam(e,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:e},test(i){return z(i)||i<=this.resolve(n)}})}};gr.INVALID_DATE=Ac;Tc.prototype=gr.prototype;Tc.INVALID_DATE=Ac;o();var kc=I(Tu()),Lc=I(BE()),dy=I(ny()),Dy=I(sy()),py=I(Ec()),my=I(Ii());o();var ay=I(Tu()),ly=I(oy()),cy=I(Ii());function Ic(t,e=[]){let r=[],n=new Set,i=new Set(e.map(([l,f])=>`${l}-${f}`));function u(l,f){let h=(0,cy.split)(l)[0];n.add(h),i.has(`${f}-${h}`)||r.push([f,h])}for(let l in t)if((0,ay.default)(t,l)){let f=t[l];n.add(l),de.isRef(f)&&f.isSibling?u(f.path,l):Wt(f)&&"deps"in f&&f.deps.forEach(h=>u(h,l))}return ly.default.array(Array.from(n),r).reverse()}o();function fy(t,e){let r=1/0;return t.some((n,i)=>{var u;if(((u=e.path)==null?void 0:u.indexOf(n))!==-1)return r=i,!0}),r}function Iu(t){return(e,r)=>fy(t,e)-fy(t,r)}function gn(){return gn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gn.apply(this,arguments)}var hy=t=>Object.prototype.toString.call(t)==="[object Object]";function cL(t,e){let r=Object.keys(t.fields);return Object.keys(e).filter(n=>r.indexOf(n)===-1)}var fL=Iu([]),_n=class extends W{constructor(e){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=fL,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{this.transform(function(n){if(typeof n=="string")try{n=JSON.parse(n)}catch{n=null}return this.isType(n)?n:null}),e&&this.shape(e)})}_typeCheck(e){return hy(e)||typeof e=="function"}_cast(e,r={}){var n;let i=super._cast(e,r);if(i===void 0)return this.getDefault();if(!this._typeCheck(i))return i;let u=this.fields,l=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,f=this._nodes.concat(Object.keys(i).filter(g=>this._nodes.indexOf(g)===-1)),h={},d=gn({},r,{parent:h,__validating:r.__validating||!1}),p=!1;for(let g of f){let _=u[g],E=(0,kc.default)(i,g);if(_){let C,w=i[g];d.path=(r.path?`${r.path}.`:"")+g,_=_.resolve({value:w,context:r.context,parent:h});let A="spec"in _?_.spec:void 0,R=A==null?void 0:A.strict;if(A!=null&&A.strip){p=p||g in i;continue}C=!r.__validating||!R?_.cast(i[g],d):i[g],C!==void 0&&(h[g]=C)}else E&&!l&&(h[g]=i[g]);h[g]!==i[g]&&(p=!0)}return p?h:i}_validate(e,r={},n){let i=[],{sync:u,from:l=[],originalValue:f=e,abortEarly:h=this.spec.abortEarly,recursive:d=this.spec.recursive}=r;l=[{schema:this,value:f},...l],r.__validating=!0,r.originalValue=f,r.from=l,super._validate(e,r,(p,g)=>{if(p){if(!re.isError(p)||h)return void n(p,g);i.push(p)}if(!d||!hy(g)){n(i[0]||null,g);return}f=f||g;let _=this._nodes.map(E=>(C,w)=>{let A=E.indexOf(".")===-1?(r.path?`${r.path}.`:"")+E:`${r.path||""}["${E}"]`,R=this.fields[E];if(R&&"validate"in R){R.validate(g[E],gn({},r,{path:A,from:l,strict:!0,parent:g,originalValue:f[E]}),w);return}w(null)});zt({sync:u,tests:_,value:g,errors:i,endEarly:h,sort:this._sortErrors,path:r.path},n)})}clone(e){let r=super.clone(e);return r.fields=gn({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(e){let r=super.concat(e),n=r.fields;for(let[i,u]of Object.entries(this.fields)){let l=n[i];l===void 0?n[i]=u:l instanceof W&&u instanceof W&&(n[i]=u.concat(l))}return r.withMutation(()=>r.shape(n,this._excludedEdges))}getDefaultFromShape(){let e={};return this._nodes.forEach(r=>{let n=this.fields[r];e[r]="default"in n?n.getDefault():void 0}),e}_getDefault(){if("default"in this.spec)return super._getDefault();if(this._nodes.length)return this.getDefaultFromShape()}shape(e,r=[]){let n=this.clone(),i=Object.assign(n.fields,e);return n.fields=i,n._sortErrors=Iu(Object.keys(i)),r.length&&(Array.isArray(r[0])||(r=[r]),n._excludedEdges=[...n._excludedEdges,...r]),n._nodes=Ic(i,n._excludedEdges),n}pick(e){let r={};for(let n of e)this.fields[n]&&(r[n]=this.fields[n]);return this.clone().withMutation(n=>(n.fields={},n.shape(r)))}omit(e){let r=this.clone(),n=r.fields;r.fields={};for(let i of e)delete n[i];return r.withMutation(()=>r.shape(n))}from(e,r,n){let i=(0,my.getter)(e,!0);return this.transform(u=>{if(u==null)return u;let l=u;return(0,kc.default)(u,e)&&(l=gn({},u),n||delete l[e],l[r]=i(u)),l})}noUnknown(e=!0,r=Eu.noUnknown){typeof e=="string"&&(r=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;let u=cL(this.schema,i);return!e||u.length===0||this.createError({params:{unknown:u.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,r=Eu.noUnknown){return this.noUnknown(!e,r)}transformKeys(e){return this.transform(r=>r&&(0,Dy.default)(r,(n,i)=>e(i)))}camelCase(){return this.transformKeys(dy.default)}snakeCase(){return this.transformKeys(Lc.default)}constantCase(){return this.transformKeys(e=>(0,Lc.default)(e).toUpperCase())}describe(){let e=super.describe();return e.fields=(0,py.default)(this.fields,r=>r.describe()),e}};function _r(t){return new _n(t)}_r.prototype=_n.prototype;o();function ku(){return ku=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ku.apply(this,arguments)}function gy(t){return new bn(t)}var bn=class extends W{constructor(e){super({type:"array"}),this.innerType=void 0,this.innerType=e,this.withMutation(()=>{this.transform(function(r){if(typeof r=="string")try{r=JSON.parse(r)}catch{r=null}return this.isType(r)?r:null})})}_typeCheck(e){return Array.isArray(e)}get _subType(){return this.innerType}_cast(e,r){let n=super._cast(e,r);if(!this._typeCheck(n)||!this.innerType)return n;let i=!1,u=n.map((l,f)=>{let h=this.innerType.cast(l,ku({},r,{path:`${r.path||""}[${f}]`}));return h!==l&&(i=!0),h});return i?u:n}_validate(e,r={},n){var i,u;let l=[],f=r.sync,h=r.path,d=this.innerType,p=(i=r.abortEarly)!=null?i:this.spec.abortEarly,g=(u=r.recursive)!=null?u:this.spec.recursive,_=r.originalValue!=null?r.originalValue:e;super._validate(e,r,(E,C)=>{if(E){if(!re.isError(E)||p)return void n(E,C);l.push(E)}if(!g||!d||!this._typeCheck(C)){n(l[0]||null,C);return}_=_||C;let w=new Array(C.length);for(let A=0;A<C.length;A++){let R=C[A],B=`${r.path||""}[${A}]`,k=ku({},r,{path:B,strict:!0,parent:C,index:A,originalValue:_[A]});w[A]=(F,T)=>d.validate(R,k,T)}zt({sync:f,path:h,value:C,errors:l,endEarly:p,tests:w},n)})}clone(e){let r=super.clone(e);return r.innerType=this.innerType,r}concat(e){let r=super.concat(e);return r.innerType=this.innerType,e.innerType&&(r.innerType=r.innerType?r.innerType.concat(e.innerType):e.innerType),r}of(e){let r=this.clone();if(!Wt(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Qe(e));return r.innerType=e,r}length(e,r=yi.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:e},test(n){return z(n)||n.length===this.resolve(e)}})}min(e,r){return r=r||yi.min,this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(n){return z(n)||n.length>=this.resolve(e)}})}max(e,r){return r=r||yi.max,this.test({message:r,name:"max",exclusive:!0,params:{max:e},test(n){return z(n)||n.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,r)=>this._typeCheck(e)?e:r==null?[]:[].concat(r))}compact(e){let r=e?(n,i,u)=>!e(n,i,u):n=>!!n;return this.transform(n=>n!=null?n.filter(r):n)}describe(){let e=super.describe();return this.innerType&&(e.innerType=this.innerType.describe()),e}nullable(e=!0){return super.nullable(e)}defined(){return super.defined()}required(e){return super.required(e)}};gy.prototype=bn.prototype;o();o();var eF=I(Ky());var ML=Xy(),tF="e2b.json";function HL(){return ML.getRandomName().replace("_","-")}var vQ=_r({id:nt().required(),template:nt().required(),title:nt().default(HL),filesystem:_r({change_hash:nt(),local_root:nt().required().default("./files")})});o();var kQ=new Mn("-a, --all","Call this command in all subdirectories"),LQ=new Mn("-s, --select","Select environment from interactive list"),NQ=new Mn("-s, --select","Select environments from interactive list"),rF=new Mn("-p, --path <path>",`Call this command in ${gt("<path>")} directory`);var nF=new We("create").description(`Create new environment and ${hu(tF)} config`).option("-id, --id <id>",`Use ${gt("<id>")} to override already existing environment, otherwise new environment will be created`).option("--respect-gitignore","Respect .gitignore file in the root directory",!0).option("--respect-dockerignore","Respect .dockerignore file in the root directory",!0).addOption(rF).alias("cr").action(async t=>{try{let e=_u();process.stdout.write(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e2b/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "CLI for managing e2b environments",
|
|
5
5
|
"homepage": "https://usedevbook.com",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@devbookhq/sdk": "^2.6.88",
|
|
58
|
-
"@e2b/sdk": "file:../js-sdk/dist",
|
|
59
58
|
"@iarna/toml": "^2.2.5",
|
|
60
59
|
"@nodelib/fs.walk": "^1.2.8",
|
|
61
60
|
"@types/tar-fs": "^2.0.2",
|