Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

feat: update grit guide

Morgante Pell995062976e28
diff --git a/apps/web/src/app/(docs)/docs/quickstart/migrating-from-v0/page.mdx b/apps/web/src/app/(docs)/docs/quickstart/migrating-from-v0/page.mdx
index e9d5b4849..d978e6978 100644
--- a/apps/web/src/app/(docs)/docs/quickstart/migrating-from-v0/page.mdx
+++ b/apps/web/src/app/(docs)/docs/quickstart/migrating-from-v0/page.mdx
@@ -28,135 +28,20 @@ git add .
git commit -m "Last changes made"
```
-## Step 3: Add Custom Migration Patterns
+## Step 3: Run Grit with the Custom Pattern
-You can paste the following content into the appropriate files for JavaScript/TypeScript and Python.
-
-### JavaScript/TypeScript Pattern (e2b_v0_to_v1_js.grit)
-
-Create or edit the file `.grit/patterns/e2b_v0_to_v1_js.grit` and paste the following:
-
-```bash
-engine marzano(0.1)
-language js
-
-pattern e2b_v0_to_v1_js() {
- or {
- `Sandbox.create({$params})` where {
- $params <: contains `template: $name` => ., // `timeoutMs: 300_000`,
- $params <: contains `cwd: $cwd` => .
- } => `Sandbox.create($name, {$params}) // TODO: cwd $cwd was removed, it can't be set on sbx anymore`,
- `Sandbox.create({$params})` where {
- $params <: contains `template: $name` => . // `timeoutMs: 300_000`
- } => `Sandbox.create($name, {$params})`,
- `Sandbox.create({$params})` where {
- $params <: contains `cwd: $cwd` => ., // `timeoutMs: 300_000`,
- } => `Sandbox.create({$params}) // TODO: cwd $cwd was removed, it can't be set on sbx anymore`,
- `$sbx.keepAlive($time)` => `$sbx.setTimeout($time)`,
- `Sandbox.reconnect($x)` => `Sandbox.connect($x)`,
- `$sbx.filesystem.write($path, $text)` => `$sbx.files.write($path, $text)`,
- `$sbx.uploadFile($file, $path)` => `$sbx.files.write($path, $file)`,
- `$sbx.downloadFile($path)` => `$sbx.files.read($path)`,
- `$sbx.process.startAndWait({$params})` where {
- $params <: contains `cmd: $cmd` => .,
- } => `$sbx.commands.run($cmd, {$params)`,
- `$sbx.process.startAndWait` => `$sbx.commands.run`,
- `$sbx.process.start({$params})` where {
- $params <: contains `cmd: $cmd` => .,
- } => `$sbx.commands.run($cmd, {$params})` where $params += `backgrund: true`,
- `const $watcher = $sbx.filesystem.watchDir($path)` => `` where {
- $program <: contains `$watcher.addEventListener($body)` => .,
- $program <: contains `await $watcher.start()` => `await $sbx.files.watchDir($path, $body)`
- },
- `let $watcher = $sbx.filesystem.watchDir($path)` => `` where {
- $program <: contains `$watcher.addEventListener($body)` => .,
- $program <: contains `await $watcher.start()` => `await $sbx.files.watchDir($path, $body)`
- },
- `var $watcher = $sbx.filesystem.watchDir($path)` => `` where {
- $program <: contains `$watcher.addEventListener($body)` => .,
- $program <: contains `await $watcher.start()` => `await $sbx.files.watchDir($path, $body)`
- },
- `$watcher = $sbx.filesystem.watchDir($path)` => `` where {
- $program <: contains `$watcher.addEventListener($body)` => .,
- $program <: contains `await $watcher.start()` => `await $sbx.files.watchDir($path, $body)`
- },
- `$sbx.id` => `$sbx.sandboxId`,
- `$sbx.fileURL` => `$sbx.uploadUrl()`,
- `$sbx.getHostname` => `$sbx.getHost()`,
- `$sbx.close()` => `$sbx.kill()`,
- $msg => `Sandbox` where { $msg <: "CodeInterpreter", $msg <: imported_from(`"@e2b/code-interpreter"`) },
- `$sbx.notebook.execCell($params)` => `$sbx.runCode($params)`,
- `ProcessMessage` => `OutputMessage`,
- } where or {
- $program <: contains `import $_ from "@e2b/code-interpreter"`,
- $program <: contains `import $_ from "@e2b"`
- }
-}
-```
-
-### Python Pattern (e2b_v0_to_v1_py.grit)
-
-Create or edit the file `.grit/patterns/e2b_v0_to_v1_py.grit` and paste the following:
-
-```bash
-engine marzano(0.1)
-language python
-
-pattern e2b_v0_to_v1_py() {
- or {
- `Sandbox.create($params)` where {
- $params <: contains `template="$name"` => ., // `timeout_ms=300_000`,
- $params <: contains `cwd="$cwd"` => .
- } => `Sandbox.create(template="$name", $params) # TODO: cwd "$cwd" was removed, it can't be set on sbx anymore`,
- `Sandbox.create($params)` where {
- $params <: contains `template="$name"` => . // `timeout_ms=300_000`
- } => `Sandbox.create(template="$name", $params)`,
- `Sandbox.create($params)` where {
- $params <: contains `cwd="$cwd"` => ., // `timeout_ms=300_000`,
- } => `Sandbox.create($params) # TODO: cwd "$cwd" was removed, it can't be set on sbx anymore`,
- `$sbx.keep_alive($time)` => `$sbx.set_timeout($time)`,
- `Sandbox.reconnect($x)` => `Sandbox.connect($x)`,
- `$sbx.filesystem.write($path, $text)` => `$sbx.files.write($path, $text)`,
- `$sbx.upload_file($file)` => `$sbx.files.write($file)`,
- `$sbx.download_file($path)` => `$sbx.files.read($path)`,
- `$sbx.process.start_and_wait($params)` where {
- $params <: contains `cmd="$cmd"` => .,
- } => `$sbx.commands.run($cmd, $params)`,
- `$sbx.process.start_and_wait` => `$sbx.commands.run`,
- `$sbx.process.start($params)` where {
- $params <: contains `cmd="$cmd"` => .,
- } => `$sbx.commands.run($cmd, $params, background=True)`,
- `watcher = $sbx.filesystem.watch_dir($path)` => `` where {
- $program <: contains `watcher.add_event_listener($body)` => .,
- $program <: contains `await watcher.start()` => `await $sbx.files.watch_dir($path, $body)`
- },
- `$sbx.id` => `$sbx.sandbox_id`,
- `$sbx.file_url` => `$sbx.upload_url`,
- `$sbx.get_hostname` => `$sbx.getHost`,
- `$sbx.close()` => `$sbx.kill()`,
- $msg => `Sandbox` where { $msg <: "CodeInterpreter", $msg <: imported_from(`e2b_code_interpreter`) },
- `$sbx.notebook.exec_cell($params)` => `$sbx.run_code($params)`,
- } where or {
- $program <: contains `from e2b import $_`,
- $program <: contains `from e2b_code_interpreter import $_`
- }
-}
-```
-
-## Step 4: Run Grit with the Custom Pattern
-
-To apply the custom migration pattern, run the following command for your project.
+To apply the custom migration pattern, run the following command for your project. The `--interactive` flag allows you to review each change as it is made.
### For JavaScript/TypeScript:
```bash
-grit apply github.com/e2b-dev/e2b-cookbook#e2b_v0_to_v1_js
+grit apply github.com/e2b-dev/e2b-cookbook#e2b_v0_to_v1_js --interactive
```
### For Python:
```bash
-grit apply github.com/e2b-dev/e2b-cookbook#e2b_v0_to_v1_py
+grit apply github.com/e2b-dev/e2b-cookbook#e2b_v0_to_v1_py --interactive
```
## Step 5: Review changes