@pocketenv/cli 0.2.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 +341 -0
- package/bun.lock +601 -0
- package/dist/index.js +1181 -0
- package/package.json +57 -0
- package/src/client.ts +6 -0
- package/src/cmd/create.ts +46 -0
- package/src/cmd/env.ts +126 -0
- package/src/cmd/list.ts +80 -0
- package/src/cmd/login.ts +49 -0
- package/src/cmd/logout.ts +20 -0
- package/src/cmd/rm.ts +24 -0
- package/src/cmd/secret.ts +127 -0
- package/src/cmd/ssh/cloudflare.ts +212 -0
- package/src/cmd/ssh/index.ts +96 -0
- package/src/cmd/ssh/terminal.ts +0 -0
- package/src/cmd/ssh/tty.ts +221 -0
- package/src/cmd/sshkeys.ts +176 -0
- package/src/cmd/start.ts +25 -0
- package/src/cmd/stop.ts +22 -0
- package/src/cmd/tailscale.ts +106 -0
- package/src/cmd/whoami.ts +24 -0
- package/src/index.ts +187 -0
- package/src/lib/env.ts +11 -0
- package/src/lib/getAccessToken.ts +36 -0
- package/src/lib/sodium.ts +15 -0
- package/src/lib/sshKeys.ts +122 -0
- package/src/types/file.ts +5 -0
- package/src/types/profile.ts +9 -0
- package/src/types/providers.ts +1 -0
- package/src/types/sandbox.ts +23 -0
- package/src/types/secret.ts +5 -0
- package/src/types/sshkeys.ts +6 -0
- package/src/types/tailscale-auth-key.ts +5 -0
- package/src/types/variable.ts +6 -0
- package/src/types/volume.ts +6 -0
- package/tsconfig.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# Pocketenv CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@pocketenv/cli)
|
|
4
|
+
[](https://discord.gg/9ada4pFUFS)
|
|
5
|
+
[](https://opensource.org/licenses/MPL-2.0)
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
The official CLI for [Pocketenv](https://pocketenv.io) — create, manage, and connect to isolated sandboxes from your terminal. Powered by [AT Protocol](https://atproto.com) for open, portable, and vendor-agnostic sandbox definitions.
|
|
10
|
+
|
|
11
|
+
> [!NOTE]
|
|
12
|
+
> **Still in development**
|
|
13
|
+
>
|
|
14
|
+
> This project is in early development. Expect breaking changes and rapid iteration.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 💡 Use Cases
|
|
19
|
+
|
|
20
|
+
- Run AI agents (Codex, Claude, Gemini, OpenClaw, Copilot ...) safely in isolated environments
|
|
21
|
+
- Spin up ephemeral dev sandboxes for quick prototyping
|
|
22
|
+
- Share reproducible developer environments via [AT Protocol](https://atproto.com)
|
|
23
|
+
- Test untrusted or third-party code securely
|
|
24
|
+
- Provide sandbox infrastructure as a service
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🚚 Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
# Build and install locally
|
|
32
|
+
npm run build && npm install -g .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install globally
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install -g @pocketenv/cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
pnpm add -g @pocketenv/cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
bun add -g @pocketenv/cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Verify the installation:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
pocketenv --version
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## ⚡ Quick Start
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
# 1. Log in with your AT Proto account (e.g. Bluesky)
|
|
59
|
+
pocketenv login <handle>.bsky.social
|
|
60
|
+
|
|
61
|
+
# 2. Create a sandbox
|
|
62
|
+
pocketenv create
|
|
63
|
+
|
|
64
|
+
# 3. Start it
|
|
65
|
+
pocketenv start <sandbox-name>
|
|
66
|
+
|
|
67
|
+
# 4. Open an interactive shell inside it
|
|
68
|
+
pocketenv console <sandbox-name>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 🔐 Authentication
|
|
72
|
+
|
|
73
|
+
Pocketenv uses [AT Protocol](https://atproto.com) for authentication. You need an AT Proto account (e.g. a [Bluesky](https://bsky.app) account) to use the CLI.
|
|
74
|
+
|
|
75
|
+
### 🔑 Login
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
pocketenv login <handle>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Authenticates with your AT Proto handle. A browser window will open for you to authorize the app. Your session token is saved locally at `~/.pocketenv/token.json`.
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
pocketenv login alice.bsky.social
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 👤 Whoami
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
pocketenv whoami
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Displays the currently logged-in user.
|
|
96
|
+
|
|
97
|
+
### 🚪 Logout
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
pocketenv logout
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Removes your local session token.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 🛠️ Commands
|
|
108
|
+
|
|
109
|
+
### 📦 Sandbox Management
|
|
110
|
+
|
|
111
|
+
#### `pocketenv create [name]`
|
|
112
|
+
|
|
113
|
+
Create a new sandbox. Aliases: `new`
|
|
114
|
+
|
|
115
|
+
| Option | Description |
|
|
116
|
+
|-----------------------------|---------------------------------------------|
|
|
117
|
+
| `--provider, -p <provider>` | The provider to use (default: `cloudflare`) |
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
pocketenv create my-sandbox
|
|
121
|
+
pocketenv create my-sandbox --provider cloudflare
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Supported providers: `cloudflare`, `daytona`, `deno`, `vercel`, `sprites`.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
#### `pocketenv ls`
|
|
129
|
+
|
|
130
|
+
List all your sandboxes with their status and creation time.
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
pocketenv ls
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Output example:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
NAME BASE STATUS CREATED AT
|
|
140
|
+
true-punter-0nan openclaw RUNNING 33 minutes ago
|
|
141
|
+
ruinous-straw-wz8n nix STOPPED 2 days ago
|
|
142
|
+
narrative-shift-j80dx zeroclaw STOPPED 11 days ago
|
|
143
|
+
mad-ambulance-k9eu nullclaw STOPPED 11 days ago
|
|
144
|
+
revered-amateur-n6rz opencrust STOPPED 11 days ago
|
|
145
|
+
high-priced-vac-ek73 picoclaw STOPPED 11 days ago
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
#### `pocketenv start <sandbox>`
|
|
151
|
+
|
|
152
|
+
Start a stopped sandbox.
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
pocketenv start my-sandbox
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
#### `pocketenv stop <sandbox>`
|
|
161
|
+
|
|
162
|
+
Stop a running sandbox.
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
pocketenv stop my-sandbox
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
#### `pocketenv rm <sandbox>`
|
|
171
|
+
|
|
172
|
+
Delete a sandbox permanently. Aliases: `delete`, `remove`
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
pocketenv rm my-sandbox
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### 🖥️ Interactive Shell
|
|
181
|
+
|
|
182
|
+
#### `pocketenv console [sandbox]`
|
|
183
|
+
|
|
184
|
+
Open an interactive shell inside a running sandbox. Aliases: `shell`, `ssh`, `s`
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
# Connect to a specific sandbox
|
|
188
|
+
pocketenv console my-sandbox
|
|
189
|
+
|
|
190
|
+
# Omit the name to auto-connect to the first running sandbox
|
|
191
|
+
pocketenv console
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### 🌍 Environment Variables
|
|
197
|
+
|
|
198
|
+
Manage environment variables scoped to a sandbox.
|
|
199
|
+
|
|
200
|
+
#### `pocketenv env put <sandbox> <key> <value>`
|
|
201
|
+
|
|
202
|
+
Set an environment variable.
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
pocketenv env put my-sandbox DATABASE_URL postgres://localhost/mydb
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### `pocketenv env list <sandbox>`
|
|
209
|
+
|
|
210
|
+
List all environment variables for a sandbox. Aliases: `ls`
|
|
211
|
+
|
|
212
|
+
```sh
|
|
213
|
+
pocketenv env list my-sandbox
|
|
214
|
+
pocketenv env ls my-sandbox
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### `pocketenv env delete <variable_id>`
|
|
218
|
+
|
|
219
|
+
Remove an environment variable. Aliases: `rm`, `remove`
|
|
220
|
+
|
|
221
|
+
```sh
|
|
222
|
+
pocketenv env delete var_d6qt6q8d60de420001jf
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### 🤫 Secrets
|
|
228
|
+
|
|
229
|
+
Manage encrypted secrets scoped to a sandbox.
|
|
230
|
+
|
|
231
|
+
#### `pocketenv secret put <sandbox> <key>`
|
|
232
|
+
|
|
233
|
+
Store a secret in a sandbox (value is prompted securely).
|
|
234
|
+
|
|
235
|
+
```sh
|
|
236
|
+
pocketenv secret put my-sandbox API_KEY
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### `pocketenv secret list <sandbox>`
|
|
240
|
+
|
|
241
|
+
List all secret keys stored in a sandbox. Aliases: `ls`
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
pocketenv secret list my-sandbox
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### `pocketenv secret delete <secret_id>`
|
|
248
|
+
|
|
249
|
+
Delete a secret from a sandbox. Aliases: `rm`, `remove`
|
|
250
|
+
|
|
251
|
+
```sh
|
|
252
|
+
pocketenv secret delete secret_d6qt6q8d60de420000jg
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
### 🗝️ SSH Keys
|
|
258
|
+
|
|
259
|
+
Manage SSH keys associated with a sandbox.
|
|
260
|
+
|
|
261
|
+
#### `pocketenv sshkeys put <sandbox>`
|
|
262
|
+
|
|
263
|
+
Upload an SSH key pair to a sandbox.
|
|
264
|
+
|
|
265
|
+
| Option | Description |
|
|
266
|
+
|-----------------|-----------------------------|
|
|
267
|
+
| `--private-key` | Path to the SSH private key |
|
|
268
|
+
| `--public-key` | Path to the SSH public key |
|
|
269
|
+
| `--generate` | Generate a new key pair |
|
|
270
|
+
|
|
271
|
+
```sh
|
|
272
|
+
pocketenv sshkeys put my-sandbox
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
#### `pocketenv sshkeys get <sandbox>`
|
|
276
|
+
|
|
277
|
+
Retrieve the public SSH key from a sandbox.
|
|
278
|
+
|
|
279
|
+
```sh
|
|
280
|
+
pocketenv sshkeys get my-sandbox
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### 🔒 Tailscale
|
|
286
|
+
|
|
287
|
+
Manage Tailscale integration for your sandboxes.
|
|
288
|
+
|
|
289
|
+
#### `pocketenv tailscale put <sandbox>`
|
|
290
|
+
|
|
291
|
+
Store a Tailscale auth key in a sandbox.
|
|
292
|
+
|
|
293
|
+
```sh
|
|
294
|
+
pocketenv tailscale put my-sandbox
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### `pocketenv tailscale get <sandbox>`
|
|
298
|
+
|
|
299
|
+
Retrieve the stored Tailscale auth key (redacted) from a sandbox.
|
|
300
|
+
|
|
301
|
+
```sh
|
|
302
|
+
pocketenv tailscale get my-sandbox
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## ⚙️ Configuration
|
|
308
|
+
|
|
309
|
+
The CLI can be configured via the following environment variables:
|
|
310
|
+
|
|
311
|
+
| Variable | Default | Description |
|
|
312
|
+
|---------------------|----------------------------|-----------------------------------------------|
|
|
313
|
+
| `POCKETENV_TOKEN` | _(none)_ | Override the session token (useful for CI/CD) |
|
|
314
|
+
| `POCKETENV_API_URL` | `https://api.pocketenv.io` | Override the API base URL |
|
|
315
|
+
| `POCKETENV_CF_URL` | `https://sbx.pocketenv.io` | Override the Cloudflare sandbox URL |
|
|
316
|
+
| `POCKETENV_TTY_URL` | `https://api.pocketenv.io` | Override the TTY URL |
|
|
317
|
+
|
|
318
|
+
**Example — using a token in CI:**
|
|
319
|
+
|
|
320
|
+
```sh
|
|
321
|
+
POCKETENV_TOKEN=<your-token> pocketenv ls
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## 📚 Documentation
|
|
325
|
+
|
|
326
|
+
Full documentation is available at **[docs.pocketenv.io](https://docs.pocketenv.io)**.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 🤝 Contributing
|
|
331
|
+
|
|
332
|
+
Contributions are welcome! Please read the [Contributing Guidelines](https://github.com/pocketenv-io/pocketenv/blob/main/CONTRIBUTING.md) before submitting a pull request.
|
|
333
|
+
|
|
334
|
+
- **Bug reports & feature requests:** [Open an issue](https://github.com/pocketenv-io/pocketenv/issues/new)
|
|
335
|
+
- **Community & feedback:** [Join our Discord](https://discord.gg/9ada4pFUFS)
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## 📄 License
|
|
340
|
+
|
|
341
|
+
[Mozilla Public License 2.0](https://github.com/pocketenv-io/pocketenv/blob/main/LICENSE)
|