@computesdk/workbench 3.0.0 → 3.1.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 +64 -0
- package/dist/bin/workbench.js +484 -129
- package/dist/bin/workbench.js.map +1 -1
- package/dist/index.js +495 -137
- package/dist/index.js.map +1 -1
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -72,6 +72,7 @@ drwxr-xr-x 2 user user 4096 Dec 12 19:01 repo
|
|
|
72
72
|
- `providers` - List all providers with status
|
|
73
73
|
- `restart` - Restart current sandbox
|
|
74
74
|
- `destroy` - Destroy current sandbox
|
|
75
|
+
- `connect <url> [token]` - Connect to existing sandbox via URL (e.g., `connect https://sandbox-123.localhost:8080` or `connect https://sandbox-123.localhost:8080 your_token`)
|
|
75
76
|
- `info` - Show sandbox info (provider, uptime)
|
|
76
77
|
- `env` - Show environment/credentials status
|
|
77
78
|
- `help` - Show this help
|
|
@@ -161,6 +162,69 @@ Running: pwd
|
|
|
161
162
|
✅ Completed (0.1s)
|
|
162
163
|
```
|
|
163
164
|
|
|
165
|
+
## Connect to Existing Sandboxes
|
|
166
|
+
|
|
167
|
+
You can connect to an existing sandbox instance via its URL. This is particularly useful for:
|
|
168
|
+
- Connecting to locally running sandboxes
|
|
169
|
+
- Attaching to sandboxes created by other tools
|
|
170
|
+
- Debugging existing sandbox instances
|
|
171
|
+
|
|
172
|
+
### Without Authentication
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
workbench> connect https://sandbox-123.localhost:8080
|
|
176
|
+
⏳ Connecting to https://sandbox-123.localhost:8080...
|
|
177
|
+
✅ Connected to sandbox (0.5s)
|
|
178
|
+
Provider: e2b
|
|
179
|
+
Sandbox ID: sandbox-123
|
|
180
|
+
|
|
181
|
+
connected:sandbox-123> ls('/home')
|
|
182
|
+
Running: ls /home
|
|
183
|
+
total 8
|
|
184
|
+
drwxr-xr-x 3 user user 4096 Dec 12 19:00 app
|
|
185
|
+
✅ Completed (0.1s)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### With Access Token
|
|
189
|
+
|
|
190
|
+
If the sandbox requires authentication, you can provide an access token:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
workbench> connect https://sandbox-123.localhost:8080 your_access_token_here
|
|
194
|
+
⏳ Connecting to https://sandbox-123.localhost:8080...
|
|
195
|
+
✅ Connected to sandbox (0.5s)
|
|
196
|
+
Provider: e2b
|
|
197
|
+
Sandbox ID: sandbox-123
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Note: When you exit the workbench after connecting to an external sandbox, it will disconnect without destroying the sandbox (since you don't own it).
|
|
201
|
+
|
|
202
|
+
## Creating and Switching Sandboxes
|
|
203
|
+
|
|
204
|
+
When you create a sandbox using `create()`, `findOrCreate()`, or `find()`, it automatically becomes your current active sandbox. All subsequent commands will run on this sandbox.
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
> create({ namespace: "h" })
|
|
208
|
+
✅ Switched to sandbox sandbox-123
|
|
209
|
+
{ sandboxId: 'sandbox-123', provider: 'gateway', metadata: {} }
|
|
210
|
+
gateway:sandbox-123> // Prompt shows you're now on this sandbox
|
|
211
|
+
|
|
212
|
+
> ls('/home') // Runs on sandbox-123
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Switching Between Sandboxes
|
|
216
|
+
|
|
217
|
+
If you already have an active sandbox and create/find another one, the workbench will prompt you:
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
e2b:sandbox-456> create({ namespace: "prod" })
|
|
221
|
+
Switch to new sandbox? (Y/n): y
|
|
222
|
+
✅ Switched to sandbox sandbox-789
|
|
223
|
+
gateway:sandbox-789>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Press Enter or type "y" to switch. Type "n" to create the sandbox without switching to it.
|
|
227
|
+
|
|
164
228
|
## Tab Autocomplete
|
|
165
229
|
|
|
166
230
|
Autocomplete works for all commands:
|