@vibengine/cli 2.6.1
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 +9 -0
- package/README.md +40 -0
- package/dist/index.js +397 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/python-build-async.hbs +21 -0
- package/dist/templates/python-build-sync.hbs +16 -0
- package/dist/templates/python-template.hbs +36 -0
- package/dist/templates/readme.hbs +100 -0
- package/dist/templates/typescript-build.hbs +16 -0
- package/dist/templates/typescript-template.hbs +34 -0
- package/package.json +101 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from vibengine import AsyncTemplate, default_build_logger
|
|
3
|
+
from .template import template
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
async def main():
|
|
7
|
+
await AsyncTemplate.build(
|
|
8
|
+
template,
|
|
9
|
+
"{{alias}}",
|
|
10
|
+
{{#if cpuCount}}
|
|
11
|
+
cpu_count={{cpuCount}},
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if memoryMB}}
|
|
14
|
+
memory_mb={{memoryMB}},
|
|
15
|
+
{{/if}}
|
|
16
|
+
on_build_logs=default_build_logger(),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from vibengine import Template, default_build_logger
|
|
2
|
+
from .template import template
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
if __name__ == "__main__":
|
|
6
|
+
Template.build(
|
|
7
|
+
template,
|
|
8
|
+
"{{alias}}",
|
|
9
|
+
{{#if cpuCount}}
|
|
10
|
+
cpu_count={{cpuCount}},
|
|
11
|
+
{{/if}}
|
|
12
|
+
{{#if memoryMB}}
|
|
13
|
+
memory_mb={{memoryMB}},
|
|
14
|
+
{{/if}}
|
|
15
|
+
on_build_logs=default_build_logger(),
|
|
16
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from vibengine import {{#if isAsync}}AsyncTemplate{{else}}Template{{/if}}
|
|
2
|
+
|
|
3
|
+
template = (
|
|
4
|
+
{{#if isAsync}}AsyncTemplate{{else}}Template{{/if}}()
|
|
5
|
+
{{#if fromImage}}
|
|
6
|
+
.from_image("{{{fromImage}}}")
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{#each steps}}
|
|
9
|
+
{{#eq type "WORKDIR"}}
|
|
10
|
+
.set_workdir("{{{args.[0]}}}")
|
|
11
|
+
{{/eq}}
|
|
12
|
+
{{#eq type "USER"}}
|
|
13
|
+
.set_user("{{{args.[0]}}}")
|
|
14
|
+
{{/eq}}
|
|
15
|
+
{{#eq type "ENV"}}
|
|
16
|
+
.set_envs({
|
|
17
|
+
{{#each envVars}}
|
|
18
|
+
"{{{@key}}}": "{{{this}}}",
|
|
19
|
+
{{/each}}
|
|
20
|
+
})
|
|
21
|
+
{{/eq}}
|
|
22
|
+
{{#eq type "RUN"}}
|
|
23
|
+
.run_cmd("{{{args.[0]}}}")
|
|
24
|
+
{{/eq}}
|
|
25
|
+
{{#eq type "COPY"}}
|
|
26
|
+
.copy("{{{src}}}", "{{{dest}}}")
|
|
27
|
+
{{/eq}}
|
|
28
|
+
{{/each}}
|
|
29
|
+
{{#if startCmd}}
|
|
30
|
+
{{#if readyCmd}}
|
|
31
|
+
.set_start_cmd("sudo {{{escapeDoubleQuotes startCmd}}}", "{{{escapeDoubleQuotes readyCmd}}}")
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{else if readyCmd}}
|
|
34
|
+
.set_ready_cmd("sudo {{{escapeDoubleQuotes readyCmd}}}")
|
|
35
|
+
{{/if}}
|
|
36
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# {{alias}} - Vibengine Sandbox Template
|
|
2
|
+
|
|
3
|
+
This is a Vibengine sandbox template that allows you to run code in a controlled environment.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Before you begin, make sure you have:
|
|
8
|
+
- A Vibengine account (sign up at [vibengine.ai](https://vibengine.ai))
|
|
9
|
+
- Your Vibengine API key (get it from your [Vibengine dashboard](https://dashboard.vibengine.ai))
|
|
10
|
+
{{#if isTypeScript}}- Node.js and npm/yarn (or similar) installed{{else if isPython}}- Python installed{{/if}}
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
1. Create a `.env` file in your project root or set the environment variable:
|
|
15
|
+
```
|
|
16
|
+
VIBENGINE_API_KEY=your_api_key_here
|
|
17
|
+
# optional fallback supported by the CLI: E2B_API_KEY
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Installing Dependencies
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
{{#if isTypeScript}}
|
|
24
|
+
npm install @vibengine/sdk
|
|
25
|
+
{{else if isPython}}
|
|
26
|
+
pip install vibengine
|
|
27
|
+
{{/if}}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Building the Template
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
{{#if isTypeScript}}
|
|
34
|
+
# For development
|
|
35
|
+
npm run ve:build:dev
|
|
36
|
+
|
|
37
|
+
# For production
|
|
38
|
+
npm run ve:build:prod
|
|
39
|
+
{{else if isPython}}
|
|
40
|
+
# For development
|
|
41
|
+
make ve:build:dev
|
|
42
|
+
|
|
43
|
+
# For production
|
|
44
|
+
make ve:build:prod
|
|
45
|
+
{{/if}}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Using the Template in a Sandbox
|
|
49
|
+
|
|
50
|
+
Once your template is built, you can use it in your Vibengine sandbox:
|
|
51
|
+
|
|
52
|
+
{{#if isTypeScript}}
|
|
53
|
+
```typescript
|
|
54
|
+
import { Sandbox } from '@vibengine/sdk'
|
|
55
|
+
|
|
56
|
+
// Create a new sandbox instance
|
|
57
|
+
const sandbox = await Sandbox.create('{{alias}}')
|
|
58
|
+
|
|
59
|
+
// Your sandbox is ready to use!
|
|
60
|
+
console.log('Sandbox created successfully')
|
|
61
|
+
```
|
|
62
|
+
{{else if isPythonSync}}
|
|
63
|
+
```python
|
|
64
|
+
from vibengine import Sandbox
|
|
65
|
+
|
|
66
|
+
# Create a new sandbox instance
|
|
67
|
+
sandbox = Sandbox.create('{{alias}}')
|
|
68
|
+
|
|
69
|
+
# Your sandbox is ready to use!
|
|
70
|
+
print('Sandbox created successfully')
|
|
71
|
+
```
|
|
72
|
+
{{else if isPythonAsync}}
|
|
73
|
+
```python
|
|
74
|
+
from vibengine import AsyncSandbox
|
|
75
|
+
import asyncio
|
|
76
|
+
|
|
77
|
+
async def main():
|
|
78
|
+
# Create a new sandbox instance
|
|
79
|
+
sandbox = await AsyncSandbox.create('{{alias}}')
|
|
80
|
+
|
|
81
|
+
# Your sandbox is ready to use!
|
|
82
|
+
print('Sandbox created successfully')
|
|
83
|
+
|
|
84
|
+
# Run the async function
|
|
85
|
+
asyncio.run(main())
|
|
86
|
+
```
|
|
87
|
+
{{/if}}
|
|
88
|
+
|
|
89
|
+
## Template Structure
|
|
90
|
+
|
|
91
|
+
- `{{templateFile}}` - Defines the sandbox template configuration
|
|
92
|
+
- `{{buildDevFile}}` - Builds the template for development
|
|
93
|
+
- `{{buildProdFile}}` - Builds the template for production
|
|
94
|
+
|
|
95
|
+
## Next Steps
|
|
96
|
+
|
|
97
|
+
1. Customize the template in `{{templateFile}}` to fit your needs
|
|
98
|
+
2. Build the template using one of the methods above
|
|
99
|
+
3. Use the template in your Vibengine sandbox code
|
|
100
|
+
4. Check out the [Vibengine documentation](https://vibengine.ai/docs) for more advanced usage
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Template, defaultBuildLogger } from '@vibengine/sdk'
|
|
2
|
+
import { template } from './template'
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
await Template.build(template, '{{alias}}', {
|
|
6
|
+
{{#if cpuCount}}
|
|
7
|
+
cpuCount: {{cpuCount}},
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if memoryMB}}
|
|
10
|
+
memoryMB: {{memoryMB}},
|
|
11
|
+
{{/if}}
|
|
12
|
+
onBuildLogs: defaultBuildLogger(),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Template } from '@vibengine/sdk'
|
|
2
|
+
|
|
3
|
+
export const template = Template()
|
|
4
|
+
{{#if fromImage}}
|
|
5
|
+
.fromImage('{{{fromImage}}}')
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#each steps}}
|
|
8
|
+
{{#eq type "WORKDIR"}}
|
|
9
|
+
.setWorkdir('{{{args.[0]}}}')
|
|
10
|
+
{{/eq}}
|
|
11
|
+
{{#eq type "USER"}}
|
|
12
|
+
.setUser('{{{args.[0]}}}')
|
|
13
|
+
{{/eq}}
|
|
14
|
+
{{#eq type "ENV"}}
|
|
15
|
+
.setEnvs({
|
|
16
|
+
{{#each envVars}}
|
|
17
|
+
'{{{@key}}}': '{{{this}}}',
|
|
18
|
+
{{/each}}
|
|
19
|
+
})
|
|
20
|
+
{{/eq}}
|
|
21
|
+
{{#eq type "RUN"}}
|
|
22
|
+
.runCmd('{{{args.[0]}}}')
|
|
23
|
+
{{/eq}}
|
|
24
|
+
{{#eq type "COPY"}}
|
|
25
|
+
.copy('{{{src}}}', '{{{dest}}}')
|
|
26
|
+
{{/eq}}
|
|
27
|
+
{{/each}}
|
|
28
|
+
{{#if startCmd}}
|
|
29
|
+
{{#if readyCmd}}
|
|
30
|
+
.setStartCmd('sudo {{{escapeQuotes startCmd}}}', '{{{escapeQuotes readyCmd}}}')
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{else if readyCmd}}
|
|
33
|
+
.setReadyCmd('sudo {{{escapeQuotes readyCmd}}}')
|
|
34
|
+
{{/if}}
|
package/package.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibengine/cli",
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "CLI for managing Vibengine sandbox templates",
|
|
5
|
+
"homepage": "https://vibengine.ai",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "FoundryLabs, Inc.",
|
|
9
|
+
"email": "hello@vibengine.ai",
|
|
10
|
+
"url": "https://vibengine.ai"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/e2b-dev/e2b/issues",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/e2b-dev/e2b",
|
|
16
|
+
"directory": "packages/cli"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"vibengine",
|
|
23
|
+
"ai-agents",
|
|
24
|
+
"agents",
|
|
25
|
+
"ai",
|
|
26
|
+
"code-interpreter",
|
|
27
|
+
"sandbox",
|
|
28
|
+
"code",
|
|
29
|
+
"cli",
|
|
30
|
+
"runtime",
|
|
31
|
+
"vm",
|
|
32
|
+
"nodejs",
|
|
33
|
+
"javascript",
|
|
34
|
+
"typescript"
|
|
35
|
+
],
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prepublishOnly": "pnpm build",
|
|
39
|
+
"build": "tsc --noEmit --skipLibCheck && tsup --minify",
|
|
40
|
+
"dev": "tsup --watch",
|
|
41
|
+
"lint": "eslint src",
|
|
42
|
+
"format": "prettier --write src",
|
|
43
|
+
"test:interactive": "pnpm build && ./dist/index.js",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:watch": "vitest watch",
|
|
46
|
+
"test:coverage": "vitest run --coverage",
|
|
47
|
+
"check-deps": "knip",
|
|
48
|
+
"update-deps": "ncu -u && pnpm i",
|
|
49
|
+
"generate-ref": "./scripts/generate_sdk_ref.sh"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/command-exists": "^1.2.3",
|
|
53
|
+
"@types/handlebars": "^4.1.0",
|
|
54
|
+
"@types/inquirer": "^9.0.7",
|
|
55
|
+
"@types/json2md": "^1.5.4",
|
|
56
|
+
"@types/node": "^20.19.19",
|
|
57
|
+
"@types/npmcli__package-json": "^4.0.4",
|
|
58
|
+
"@types/statuses": "^2.0.5",
|
|
59
|
+
"@types/update-notifier": "6.0.5",
|
|
60
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
61
|
+
"json2md": "^2.0.1",
|
|
62
|
+
"knip": "^5.43.6",
|
|
63
|
+
"npm-check-updates": "^16.14.6",
|
|
64
|
+
"tsup": "^8.4.0",
|
|
65
|
+
"typescript": "^5.2.2",
|
|
66
|
+
"vitest": "^3.2.4"
|
|
67
|
+
},
|
|
68
|
+
"files": [
|
|
69
|
+
"dist",
|
|
70
|
+
"LICENSE",
|
|
71
|
+
"README",
|
|
72
|
+
"package.json"
|
|
73
|
+
],
|
|
74
|
+
"bin": {
|
|
75
|
+
"ve": "dist/index.js"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@iarna/toml": "^2.2.5",
|
|
79
|
+
"@inquirer/prompts": "^7.9.0",
|
|
80
|
+
"@npmcli/package-json": "^5.2.1",
|
|
81
|
+
"async-listen": "^3.0.1",
|
|
82
|
+
"boxen": "^7.1.1",
|
|
83
|
+
"chalk": "^5.3.0",
|
|
84
|
+
"cli-highlight": "^2.1.11",
|
|
85
|
+
"command-exists": "^1.2.9",
|
|
86
|
+
"commander": "^11.1.0",
|
|
87
|
+
"console-table-printer": "^2.11.2",
|
|
88
|
+
"dockerfile-ast": "^0.6.1",
|
|
89
|
+
"handlebars": "^4.7.8",
|
|
90
|
+
"inquirer": "^12.10.0",
|
|
91
|
+
"open": "^9.1.0",
|
|
92
|
+
"statuses": "^2.0.1",
|
|
93
|
+
"strip-ansi": "^7.1.0",
|
|
94
|
+
"update-notifier": "^6.0.2",
|
|
95
|
+
"yup": "^1.3.2",
|
|
96
|
+
"@vibengine/sdk": "^2.12.1"
|
|
97
|
+
},
|
|
98
|
+
"engines": {
|
|
99
|
+
"node": ">=20"
|
|
100
|
+
}
|
|
101
|
+
}
|