@computesdk/workbench 0.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/LICENSE +21 -0
- package/README.md +225 -0
- package/dist/bin/workbench.d.ts +1 -0
- package/dist/bin/workbench.js +893 -0
- package/dist/bin/workbench.js.map +1 -0
- package/dist/helpers.d.ts +42 -0
- package/dist/helpers.js +26 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +883 -0
- package/dist/index.js.map +1 -0
- package/package.json +105 -0
- package/src/bin/workbench-ts.ts +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 computesdk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# @computesdk/workbench
|
|
2
|
+
|
|
3
|
+
Interactive REPL for testing ComputeSDK sandbox operations with instant feedback and autocomplete.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Zero ceremony** - Just run commands, no sandbox ID management
|
|
8
|
+
- ✨ **Tab autocomplete** - All 100+ `@computesdk/cmd` functions autocomplete
|
|
9
|
+
- 🔄 **Provider switching** - Seamlessly switch between e2b, railway, daytona, etc.
|
|
10
|
+
- ⚡ **Smart evaluation** - Type `npm.install('express')` and it just runs
|
|
11
|
+
- 📊 **Real-time feedback** - See timing, output, and errors instantly
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -D @computesdk/workbench
|
|
17
|
+
|
|
18
|
+
# Install at least one provider
|
|
19
|
+
npm install @computesdk/e2b
|
|
20
|
+
# or
|
|
21
|
+
npm install @computesdk/railway
|
|
22
|
+
# or any other provider
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
1. **Configure credentials** in `.env`:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# E2B Provider
|
|
31
|
+
E2B_API_KEY=e2b_your_api_key_here
|
|
32
|
+
|
|
33
|
+
# Railway Provider
|
|
34
|
+
RAILWAY_API_KEY=your_railway_api_key
|
|
35
|
+
RAILWAY_PROJECT_ID=your_project_id
|
|
36
|
+
RAILWAY_ENVIRONMENT_ID=your_environment_id
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. **Start workbench**:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx workbench
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3. **Run commands** (autocomplete works!):
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
workbench> npm.install('express')
|
|
49
|
+
⏳ Creating sandbox with e2b...
|
|
50
|
+
✅ Sandbox ready (1.2s)
|
|
51
|
+
Running: npm install express
|
|
52
|
+
✅ Completed (3.2s)
|
|
53
|
+
|
|
54
|
+
workbench> git.clone('https://github.com/user/repo')
|
|
55
|
+
Running: git clone https://github.com/user/repo
|
|
56
|
+
✅ Completed (2.1s)
|
|
57
|
+
|
|
58
|
+
workbench> ls('/home')
|
|
59
|
+
Running: ls /home
|
|
60
|
+
total 8
|
|
61
|
+
drwxr-xr-x 3 user user 4096 Dec 12 19:00 node_modules
|
|
62
|
+
drwxr-xr-x 2 user user 4096 Dec 12 19:01 repo
|
|
63
|
+
✅ Completed (0.1s)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Commands
|
|
67
|
+
|
|
68
|
+
### Workbench Commands
|
|
69
|
+
|
|
70
|
+
- `provider <name>` - Switch provider (e2b, railway, etc.)
|
|
71
|
+
- `providers` - List all providers with status
|
|
72
|
+
- `restart` - Restart current sandbox
|
|
73
|
+
- `destroy` - Destroy current sandbox
|
|
74
|
+
- `info` - Show sandbox info (provider, uptime)
|
|
75
|
+
- `env` - Show environment/credentials status
|
|
76
|
+
- `help` - Show this help
|
|
77
|
+
- `exit` - Exit workbench
|
|
78
|
+
|
|
79
|
+
### Running Commands
|
|
80
|
+
|
|
81
|
+
Just type any `@computesdk/cmd` function. Tab autocomplete works!
|
|
82
|
+
|
|
83
|
+
**Package Managers:**
|
|
84
|
+
```javascript
|
|
85
|
+
npm.install('express')
|
|
86
|
+
npm.run('dev')
|
|
87
|
+
pnpm.install()
|
|
88
|
+
yarn.add('lodash')
|
|
89
|
+
pip.install('requests')
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Git:**
|
|
93
|
+
```javascript
|
|
94
|
+
git.clone('https://...')
|
|
95
|
+
git.commit('Initial commit')
|
|
96
|
+
git.push()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Filesystem:**
|
|
100
|
+
```javascript
|
|
101
|
+
mkdir('/app/src')
|
|
102
|
+
ls('/home')
|
|
103
|
+
cat('/home/file.txt')
|
|
104
|
+
cp('/src', '/dest', { recursive: true })
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Network:**
|
|
108
|
+
```javascript
|
|
109
|
+
curl('https://api.example.com')
|
|
110
|
+
wget('https://file.com/download.zip')
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**And 100+ more!** Press Tab to explore.
|
|
114
|
+
|
|
115
|
+
## Provider Switching
|
|
116
|
+
|
|
117
|
+
Switch between providers on the fly:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
workbench> provider railway
|
|
121
|
+
Destroy current sandbox? (y/N): y
|
|
122
|
+
✅ Destroyed e2b sandbox
|
|
123
|
+
⏳ Creating sandbox with railway...
|
|
124
|
+
✅ Sandbox ready (2.1s)
|
|
125
|
+
Switched to railway
|
|
126
|
+
|
|
127
|
+
workbench> npm.install('lodash')
|
|
128
|
+
Running: npm install lodash
|
|
129
|
+
✅ Completed (2.8s)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Tab Autocomplete
|
|
133
|
+
|
|
134
|
+
Autocomplete works for all commands:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
workbench> npm.<TAB>
|
|
138
|
+
install run init uninstall
|
|
139
|
+
|
|
140
|
+
workbench> git.<TAB>
|
|
141
|
+
add branch checkout clone commit diff fetch
|
|
142
|
+
init log pull push reset stash status
|
|
143
|
+
|
|
144
|
+
workbench> provider <TAB>
|
|
145
|
+
e2b railway daytona modal runloop vercel
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Supported Providers
|
|
149
|
+
|
|
150
|
+
### Gateway Provider (Zero-Config)
|
|
151
|
+
|
|
152
|
+
The **gateway** provider uses the ComputeSDK API to automatically route to any provider:
|
|
153
|
+
|
|
154
|
+
- No provider packages needed
|
|
155
|
+
- Just set `COMPUTESDK_API_KEY` + provider credentials
|
|
156
|
+
- Auto-detects provider from your environment
|
|
157
|
+
|
|
158
|
+
### Direct Provider Packages
|
|
159
|
+
|
|
160
|
+
Install any combination of:
|
|
161
|
+
|
|
162
|
+
- `@computesdk/e2b` - E2B sandboxes
|
|
163
|
+
- `@computesdk/railway` - Railway environments
|
|
164
|
+
- `@computesdk/daytona` - Daytona workspaces
|
|
165
|
+
- `@computesdk/modal` - Modal containers
|
|
166
|
+
- `@computesdk/runloop` - Runloop instances
|
|
167
|
+
- `@computesdk/vercel` - Vercel functions
|
|
168
|
+
- `@computesdk/cloudflare` - Cloudflare Workers
|
|
169
|
+
- `@computesdk/codesandbox` - CodeSandbox boxes
|
|
170
|
+
- `@computesdk/blaxel` - Blaxel environments
|
|
171
|
+
|
|
172
|
+
## Environment Variables
|
|
173
|
+
|
|
174
|
+
Set provider credentials in `.env`:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Gateway Provider (Zero-Config)
|
|
178
|
+
COMPUTESDK_API_KEY=computesdk_live_xxx
|
|
179
|
+
|
|
180
|
+
# E2B
|
|
181
|
+
E2B_API_KEY=e2b_xxx
|
|
182
|
+
|
|
183
|
+
# Railway
|
|
184
|
+
RAILWAY_API_KEY=xxx
|
|
185
|
+
RAILWAY_PROJECT_ID=xxx
|
|
186
|
+
RAILWAY_ENVIRONMENT_ID=xxx
|
|
187
|
+
|
|
188
|
+
# Daytona
|
|
189
|
+
DAYTONA_API_KEY=xxx
|
|
190
|
+
|
|
191
|
+
# Modal
|
|
192
|
+
MODAL_TOKEN_ID=xxx
|
|
193
|
+
MODAL_TOKEN_SECRET=xxx
|
|
194
|
+
|
|
195
|
+
# Runloop
|
|
196
|
+
RUNLOOP_API_KEY=xxx
|
|
197
|
+
|
|
198
|
+
# Vercel
|
|
199
|
+
VERCEL_TOKEN=xxx
|
|
200
|
+
VERCEL_TEAM_ID=xxx
|
|
201
|
+
VERCEL_PROJECT_ID=xxx
|
|
202
|
+
|
|
203
|
+
# Cloudflare
|
|
204
|
+
CLOUDFLARE_API_TOKEN=xxx
|
|
205
|
+
CLOUDFLARE_ACCOUNT_ID=xxx
|
|
206
|
+
|
|
207
|
+
# CodeSandbox
|
|
208
|
+
CSB_API_KEY=xxx
|
|
209
|
+
|
|
210
|
+
# Blaxel
|
|
211
|
+
BL_API_KEY=xxx
|
|
212
|
+
BL_WORKSPACE=xxx
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Tips
|
|
216
|
+
|
|
217
|
+
- **Command history**: Use ↑/↓ arrows to navigate previous commands
|
|
218
|
+
- **Exit gracefully**: Type `exit` or `.exit`, optionally destroy sandbox
|
|
219
|
+
- **Check status**: Run `env` to see which providers are configured
|
|
220
|
+
- **Auto-create**: First command automatically creates a sandbox
|
|
221
|
+
- **Stay in context**: Workbench maintains "current sandbox" - no IDs to track
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|