Skip to content

Conversation

dobrac
Copy link
Contributor

@dobrac dobrac commented Aug 28, 2025

🚀 Add template init for new SDK

This PR updates the e2b template init-v2 (or e2b template create) command to leverage the new E2B Templates SDK, providing a more streamlined and developer-friendly experience for creating sandbox templates.

The command will be migrated to just init once the Template SDK becomes the default to create new templates.

🔧 Key Features

Template Structure

my-template/
├── README.md            # Information about the template
├── template.ts          # Template definition using E2B SDK
├── build.dev.ts         # Development build script
└── build.prod.ts        # Production build script

Generated Build Scripts

  • npm run e2b:build:dev - Build development template
  • npm run e2b:build:prod - Build production template

Template Definition Example

const template = Template()
  .fromImage('ubuntu:22.04')
  .runCmd('echo Hello World E2B!')

@dobrac dobrac self-assigned this Aug 28, 2025
@dobrac dobrac added the feature New feature or request label Aug 28, 2025
Copy link

linear bot commented Aug 28, 2025

Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: 0d054f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@e2b/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dobrac dobrac changed the base branch from main to add-template-migration-to-cli August 28, 2025 15:52
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from 870e064 to 03faeb9 Compare August 28, 2025 15:53
@dobrac dobrac force-pushed the add-template-migration-to-cli branch from 17317b7 to cb31989 Compare September 5, 2025 22:21
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from 03faeb9 to e6c7cb1 Compare September 5, 2025 22:28
@dobrac dobrac force-pushed the add-template-migration-to-cli branch from cb31989 to c87de76 Compare September 5, 2025 22:30
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from e6c7cb1 to 2981fc7 Compare September 5, 2025 22:30
@dobrac dobrac force-pushed the add-template-migration-to-cli branch from c87de76 to 475f99c Compare September 6, 2025 10:53
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from 2981fc7 to a6a7425 Compare September 6, 2025 10:53
@dobrac dobrac force-pushed the add-template-migration-to-cli branch from 475f99c to 51f8210 Compare September 6, 2025 11:07
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from a6a7425 to 0eba3d8 Compare September 6, 2025 11:09
@dobrac dobrac marked this pull request as ready for review September 6, 2025 11:10
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from 0eba3d8 to 1e952aa Compare September 6, 2025 11:15
@dobrac dobrac force-pushed the add-template-migration-to-cli branch 2 times, most recently from c03d0b9 to 5c0ea6d Compare September 15, 2025 12:07
@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from 1e952aa to 575ef83 Compare September 15, 2025 12:09
cursor[bot]

This comment was marked as outdated.

@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch 2 times, most recently from 0a97369 to f2b3a92 Compare September 16, 2025 12:06
Base automatically changed from add-template-migration-to-cli to main September 19, 2025 15:41
Copy link
Member

@mishushakov mishushakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor nits, the biggest change is to change package.json to Makefile for Python and create a new one when one does not exist already. In the CLI please do not throw on validation, exit the process with console.error and a error code instead

Comment on lines +230 to +229
isTypeScript: generatedFiles.language === Language.TypeScript,
isPython:
generatedFiles.language === Language.PythonSync ||
generatedFiles.language === Language.PythonAsync,
isPythonSync: generatedFiles.language === Language.PythonSync,
isPythonAsync: generatedFiles.language === Language.PythonAsync,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be just language

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or can't Handlebars handle enums/string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can handle strings, but I think it will be more stable when you for example change the string value in the enum

(it doesn't know enums)

cursor[bot]

This comment was marked as outdated.

@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from 189b7bd to 2071cf0 Compare September 25, 2025 18:15
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@dobrac dobrac force-pushed the cli-template-init-e2b-2689 branch from eb869b2 to 004c142 Compare September 25, 2025 21:03
cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants