e09b318f8c
Clone of #1665, opened in response to `/sdk claim` on that PR. The original #1665 (branch `bangui`, by @mishushakov) can be closed in favour of this one — the tree here is byte-for-byte identical to its head, and the original commit is carried over unmodified so authorship and the `Co-Authored-By` trailer are preserved. ## What changed Eight test files created their fixtures outside a temporary destination, so running the suite left directories behind in the working tree. The five CLI template tests called `fs.mkdtemp` with a bare relative prefix. `mkdtemp` does not imply `os.tmpdir()` — a relative prefix resolves against `process.cwd()`, so each run created `packages/cli/e2b-<name>-testXXXXXX/`. They now join the prefix onto `os.tmpdir()`. On the JS SDK side, `getAllFilesInPath` and `spoolTarArchive` wrote into `__dirname` and now `mkdtemp` under `os.tmpdir()`. `build.test.ts` built its file context at `tests/template/folder`, relying on the implicit caller-directory context; it now creates the context under `os.tmpdir()` and passes it explicitly via `Template({ fileContextPath })`, matching what the Python mirror in `test_build.py` already does with `tempfile.mkdtemp` and `file_context_path`. The Python suite needed no changes: every host-side write already goes through `tmp_path`, `tempfile.mkdtemp`, or `TemporaryDirectory`. No usage examples apply — this is a test-only change with no user-facing surface. ## Verification Re-ran everything on this branch rather than relying on the original PR's numbers: - `packages/cli`: full suite green, 17 files / 109 tests passed. - `packages/js-sdk`: the two util test files, 24 tests passed. - `git status` is clean after both runs, with no leftover fixture directories anywhere in the tree — which is the behaviour this change is about. - `pnpm run format`, `pnpm run lint`, `pnpm run typecheck` all clean across the JS and Python packages; `format` produced no diff. No changeset: test-only changes do not ship in either published package. Fixes SDK-334 <div><a href="https://cursor.com/agents/bc-7faf51ae-b169-4787-9d84-a50ec291b656?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/automations/3b1a5376-9bd3-11f1-ba66-0e7d0216e441"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/view-automation-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/view-automation-light.png"><img alt="View Automation" width="141" height="28" src="https://cursor.com/assets/images/view-automation-dark.png"></picture></a> </div> --------- Co-authored-by: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Mish Ushakov <mishushakov@users.noreply.github.com>
E2B CLI
This CLI tool allows you to build manager your running E2B sandbox and sandbox templates. Learn more in our documentation.
1. Install the CLI
Using Homebrew (on macOS)
brew install e2b
Using NPM
npm install -g @e2b/cli
2. Authenticate
e2b auth login
Note
To authenticate without the ability to open the browser (e.g. in CI/CD), provide
E2B_API_KEYas an environment variable. You can find your API key in the API Keys tab in the E2B dashboard. Then use the CLI like this:E2B_API_KEY=e2b_... e2b template create.
3. Check out docs
Visit our CLI documentation to learn more.
