@e2b/cli 0.0.7 → 0.0.9
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 +30 -147
- package/dist/index.js +74 -74
- package/package.json +5 -14
package/README.md
CHANGED
|
@@ -1,172 +1,55 @@
|
|
|
1
|
-
# e2b CLI
|
|
2
|
-
CLI for managing Devbook environments.
|
|
3
|
-
|
|
4
|
-
An environment is a virtual machine image that you can customize through our CLI. You can add files, install dependencies, and set env vars in the environment. Then with Devbook, every user visiting your website will get a new copy of the environment they can use.
|
|
5
|
-
|
|
6
|
-
* [Installation](#installation)
|
|
7
|
-
* [Quickstart](#quickstart)
|
|
8
|
-
* [Commands](#commands)
|
|
9
|
-
+ [`devbook env create`](#devbook-env-create)
|
|
10
|
-
+ [`devbook env push`](#devbook-env-push)
|
|
11
|
-
+ [`devbook env publish`](#devbook-env-publish)
|
|
12
|
-
+ [`devbook env delete`](#devbook-env-delete)
|
|
13
|
-
+ [`devbook env use`](#devbook-env-use)
|
|
14
|
-
+ [`devbook env set`](#devbook-env-set)
|
|
15
|
-
+ [`devbook env connect`](#devbook-env-connect)
|
|
16
|
-
+ [`devbook env list`](#devbook-env-list)
|
|
17
|
-
* [`dbk.toml` config](#dbktoml-config)
|
|
18
|
-
+ [`id`](#id)
|
|
19
|
-
+ [`template`](#template)
|
|
20
|
-
+ [`title`](#title)
|
|
21
|
-
+ [`filesystem.local_root`](#filesystemlocal_root)
|
|
22
|
-
* [FAQ](#faq)
|
|
23
|
-
+ [Inspect how a published environment looks like](#inspect-how-a-published-environment-looks-like)
|
|
24
|
-
+ [Delete files from an environment](#delete-files-from-an-environment)
|
|
25
|
-
+ [Inspect files in an environment](#inspect-files-in-an-environment)
|
|
26
|
-
+ [Install dependencies in an environment](#install-dependencies-in-an-environment)
|
|
27
|
-
+ [Upload local files to an environment](#upload-local-files-to-an-environment)
|
|
1
|
+
# e2b CLI (WIP)
|
|
28
2
|
|
|
3
|
+
Command line interface for [e2b](https://e2b.dev/).
|
|
29
4
|
|
|
30
5
|
## Installation
|
|
6
|
+
|
|
31
7
|
```sh
|
|
32
|
-
npm install -g @
|
|
8
|
+
npm install -g @e2b/cli
|
|
33
9
|
```
|
|
34
10
|
|
|
35
11
|
Then you can use the CLI with
|
|
12
|
+
|
|
36
13
|
```sh
|
|
37
|
-
|
|
14
|
+
e2b --help
|
|
38
15
|
```
|
|
39
16
|
|
|
40
|
-
You will need
|
|
41
|
-
After you get the API key set the `DEVBOOK_KEY` env var in your terminal, or call the CLI with the env var directly
|
|
17
|
+
You will need to authenticate to use the e2b CLI.
|
|
42
18
|
|
|
43
19
|
```sh
|
|
44
|
-
|
|
20
|
+
e2b login
|
|
45
21
|
```
|
|
46
22
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Create an environment and a dbk.toml config for the environment
|
|
50
|
-
devbook env create
|
|
51
|
-
|
|
52
|
-
# Create a directory for files you want to be in the environment
|
|
53
|
-
mkdir ./files
|
|
23
|
+
<details>
|
|
24
|
+
<summary>Authenticate without the ability to open browser</summary>
|
|
54
25
|
|
|
55
|
-
# Upload files from the ./files directory to the environment
|
|
56
|
-
devbook env push
|
|
57
26
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
devbook env connect
|
|
27
|
+
To authenticate without the ability to open browser, you can provide E2B_ACCESS_TOKEN as an environment variable.
|
|
28
|
+
Obtain your E2B_ACCESS_TOKEN from at [e2b.dev/docs](https://e2b.dev/docs).
|
|
61
29
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# To make all the changes you just made published, call the following command
|
|
65
|
-
devbook env publish
|
|
30
|
+
```sh
|
|
31
|
+
E2B_ACCESS_TOKEN=sk_e2b_... e2b login
|
|
66
32
|
```
|
|
67
33
|
|
|
68
|
-
|
|
69
|
-
By default, commands are referring to an environment defined by a `dbk.toml` in a directory where you called the commands.
|
|
70
|
-
|
|
71
|
-
All commands can be called with a `--path <path-to-dir>` flag that changes the directory where the command will be called, without the need to call `cd`.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
The Devbook CLI has following commands
|
|
75
|
-
|
|
76
|
-
### `devbook env create`
|
|
77
|
-
Create a new environment and `dbk.toml` config.
|
|
78
|
-
|
|
79
|
-
You can specify another environment as a template with `--template <existing-environment-id>` flag. This existing environment will be a base of the new environment — all files, env vars and dependencies from the existing environment will be present in the new environment.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### `devbook env push`
|
|
83
|
-
Upload files from a local directory to an environment. The local directory to upload from is defined by the `filesystem.local_root` field in the `dbk.toml` config (`./files` by default).
|
|
84
|
-
Path of uploaded files in the environment will reflect their paths in the `./files` directory — file `./files/index.ts` will become `/index.ts` in the environment.
|
|
85
|
-
|
|
86
|
-
> Use `devbook env publish --all` to push all environments in subdirectories.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### `devbook env publish`
|
|
90
|
-
Publish changes you made in an environment (uploaded files, installed depedencies, set env vars).
|
|
91
|
-
Users on your website that use the environment cannot see the new changes you made to the environment until you run `devbook env publish` command.
|
|
92
|
-
|
|
93
|
-
> Use `devbook env publish --all` to publish all environments in subdirectories.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### `devbook env delete`
|
|
97
|
-
Delete an environment and a `dbk.toml` config for the environment.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### `devbook env use`
|
|
101
|
-
Create a `dbk.toml` for an existing environment. You can use this to start version tracking environments created through Devbook dashboard.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### `devbook env set`
|
|
105
|
-
Set env vars inside of an environment.
|
|
106
|
-
For example, to set `FOO` and `BAR` call `devbook env set FOO=1 BAR=2`.
|
|
107
|
-
|
|
108
|
-
> You must set all env vars in one `devbook env set --env-vars <KEY=VALUE...>` call — variables from the previous `devbook env set` calls will be overwritten.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
### `devbook env connect`
|
|
112
|
-
Open a terminal connected to an environment that you can use to configure and inspect the environment.
|
|
34
|
+
</details>
|
|
113
35
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
### `devbook env list`
|
|
118
|
-
List all environments and paths to their `dbk.toml` configs (if the configs are in subdirectories of the current directory).
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
## `dbk.toml` config
|
|
122
|
-
The `dbk.toml` config is used for tracking an environment in version control. It is created automatically by `devbook env create` command.
|
|
123
|
-
|
|
124
|
-
The following fields are in each `dbk.toml` config
|
|
125
|
-
|
|
126
|
-
### `id`
|
|
127
|
-
You **should not edit this field** manually.
|
|
128
|
-
The id of this environment.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### `template`
|
|
132
|
-
You **should not edit this field** manually.
|
|
133
|
-
The id of the environment that was used as a template for this environment.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
### `title`
|
|
137
|
-
Title of the environment. The title is used for easier navigation and to distinguish between environments.
|
|
138
|
-
|
|
139
|
-
By default the title is the name of the directory where you called `devbook env create` command.
|
|
140
|
-
You can change this field and use `devbook env push` to save the changes.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
### `filesystem.local_root`
|
|
144
|
-
A directory containing files that will be uploaded with `devbook env push` command.
|
|
145
|
-
By default it is `./files` — that means that the `./files` directory next to this `dbk.toml` will be uploaded to the environment when you use `devbook env push`.
|
|
146
|
-
|
|
147
|
-
For example, if you have a `./files/index.ts` file locally and run `devbook env push` the file `/index.ts` will be created and saved in the environment.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
## FAQ
|
|
151
|
-
|
|
152
|
-
### Inspect how a published environment looks like
|
|
153
|
-
Use `devbook env connect --published` to open a terminal connected to a new instace of the environment.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
### Delete files from an environment
|
|
157
|
-
Use `devbook env connect` to open a terminal connected to the environment. Then you can delete the files from the environment with `rm` shell command.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
### Inspect files in an environment
|
|
161
|
-
Use `devbook env connect` to connect your terminal with the environment then use terminal commands like `ls`, `cd`, `cat`, etc. to inspect files.
|
|
36
|
+
## Commands
|
|
162
37
|
|
|
38
|
+
🔜 All commands can be called with a `--path <path-to-dir>` flag that changes the directory where the command will be called, without the need to call `cd`.
|
|
163
39
|
|
|
164
|
-
|
|
165
|
-
|
|
40
|
+
```
|
|
41
|
+
-V, --version Display e2b CLI version
|
|
42
|
+
-h, --help display help for command
|
|
43
|
+
```
|
|
166
44
|
|
|
167
|
-
|
|
45
|
+
```
|
|
46
|
+
help [command] display help for command
|
|
168
47
|
|
|
48
|
+
login Login to e2b
|
|
49
|
+
logout Logout of e2b
|
|
169
50
|
|
|
170
|
-
|
|
171
|
-
Create
|
|
172
|
-
|
|
51
|
+
env|environment Manage e2b environments
|
|
52
|
+
create|cr [options] Create new environment and e2b.json config
|
|
53
|
+
list|ls List environments
|
|
54
|
+
shell|cn [options] [id] Connect terminal to environment
|
|
55
|
+
```
|