@buddy-works/sandbox-sdk 0.1.0-rc.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 +81 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Buddy Works
|
|
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,81 @@
|
|
|
1
|
+
# Buddy Sandbox SDK
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for managing Buddy sandboxes - isolated Ubuntu environments for running commands.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @buddy-works/sandbox-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Sandbox } from "@buddy-works/sandbox-sdk";
|
|
15
|
+
|
|
16
|
+
const identifier = "my-sandbox";
|
|
17
|
+
|
|
18
|
+
let sandbox: Sandbox;
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
sandbox = await Sandbox.getByIdentifier(identifier);
|
|
22
|
+
} catch {
|
|
23
|
+
sandbox = await Sandbox.create({
|
|
24
|
+
identifier,
|
|
25
|
+
name: "My Sandbox",
|
|
26
|
+
os: "ubuntu:24.04",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
await sandbox.runCommand({
|
|
31
|
+
command: "ping -c 5 buddy.works",
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Set required environment variables:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
export BUDDY_TOKEN="your-api-token"
|
|
39
|
+
export BUDDY_WORKSPACE="your-workspace"
|
|
40
|
+
export BUDDY_PROJECT="your-project"
|
|
41
|
+
export BUDDY_REGION="US" # Optional: US (default), EU, or AP
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Regions
|
|
45
|
+
|
|
46
|
+
Configure the API region:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Via environment variable (recommended)
|
|
50
|
+
export BUDDY_REGION="EU"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Or via connection config
|
|
55
|
+
const sandbox = await Sandbox.create({
|
|
56
|
+
identifier: "my-sandbox",
|
|
57
|
+
name: "My Sandbox",
|
|
58
|
+
os: "ubuntu:24.04",
|
|
59
|
+
connection: {
|
|
60
|
+
region: "EU" // US, EU, or AP
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Connection overrides
|
|
66
|
+
|
|
67
|
+
Override workspace/auth per call:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
await Sandbox.create({
|
|
71
|
+
identifier: "my-sandbox",
|
|
72
|
+
name: "My Sandbox",
|
|
73
|
+
os: "ubuntu:24.04",
|
|
74
|
+
connection: {
|
|
75
|
+
workspace: "different-workspace",
|
|
76
|
+
project: "different-project",
|
|
77
|
+
token: "custom-token",
|
|
78
|
+
region: "EU"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buddy-works/sandbox-sdk",
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "TypeScript SDK for managing sandboxes through the Buddy API",
|
|
6
|
+
"main": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.mts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.mts",
|
|
11
|
+
"default": "./dist/index.mjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"sandbox",
|
|
19
|
+
"api",
|
|
20
|
+
"sdk",
|
|
21
|
+
"ci",
|
|
22
|
+
"cd",
|
|
23
|
+
"devops",
|
|
24
|
+
"cloud",
|
|
25
|
+
"typescript"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"author": "Cyprian Zdebski <cyprian.zdebski@buddy.works>",
|
|
32
|
+
"homepage": "https://github.com/buddy/sandbox-sdk#readme",
|
|
33
|
+
"bugs": "https://github.com/buddy/sandbox-sdk/issues",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/buddy/sandbox-sdk.git"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@biomejs/biome": "2.3.11",
|
|
41
|
+
"@dotenvx/dotenvx": "1.51.4",
|
|
42
|
+
"@hey-api/openapi-ts": "0.90.3",
|
|
43
|
+
"@tsconfig/node20": "20",
|
|
44
|
+
"@tsconfig/strictest": "2.0.8",
|
|
45
|
+
"@types/node": "20",
|
|
46
|
+
"knip": "5.81.0",
|
|
47
|
+
"msw": "2.12.7",
|
|
48
|
+
"tsdown": "0.20.0-beta.3",
|
|
49
|
+
"typescript": "5.9.3",
|
|
50
|
+
"vitest": "4.0.17"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"p-retry": "7.1.1",
|
|
54
|
+
"zod": "4.3.5"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"fetch:schemas": "openapi-ts",
|
|
58
|
+
"build": "tsdown",
|
|
59
|
+
"test": "NODE_OPTIONS='--enable-source-maps' dotenvx run -q -- vitest run",
|
|
60
|
+
"test:watch": "NODE_OPTIONS='--enable-source-maps' dotenvx run -q -- vitest",
|
|
61
|
+
"lint:check": "tsc --skipLibCheck --noEmit && biome check",
|
|
62
|
+
"lint:fix": "tsc --skipLibCheck --noEmit && biome check --write",
|
|
63
|
+
"knip": "knip"
|
|
64
|
+
}
|
|
65
|
+
}
|