Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
chore(cli): remove dead e2b.toml write path (#1569)
Mish Ushakov04827ab1631f
diff --git a/.changeset/wise-donuts-refuse.md b/.changeset/wise-donuts-refuse.mdnew file mode 100644index 000000000..8828b1298--- /dev/null+++ b/.changeset/wise-donuts-refuse.md@@ -0,0 +1,5 @@+---+'@e2b/cli': patch+---++Remove dead `e2b.toml` code paths — the CLI no longer writes the file, so `saveConfig` is gone, and the unused `team_id` field is no longer part of the config schema or team ID resolution. Parsing stays for legacy projects (`template migrate`, `template publish`, `template delete`, `sandbox create`)diff --git a/packages/cli/src/api.ts b/packages/cli/src/api.tsindex 35f4d87b4..e765eb90b 100644--- a/packages/cli/src/api.ts+++ b/packages/cli/src/api.ts@@ -83,17 +83,12 @@ export function ensureAccessToken() {* Resolve team ID with proper precedence:* 1. CLI --team flag* 2. E2B_TEAM_ID env var- * 3. Local e2b.toml team_id (if provided)- * 4. ~/.e2b/config.json teamId (only if E2B_API_KEY env var is NOT set,+ * 3. ~/.e2b/config.json teamId (only if E2B_API_KEY env var is NOT set,* to avoid mismatch between env var API key and config file team ID)*/-export function resolveTeamId(- cliTeamId?: string,- localConfigTeamId?: string-): string | undefined {+export function resolveTeamId(cliTeamId?: string): string | undefined {if (cliTeamId) return cliTeamIdif (teamId) return teamId- if (localConfigTeamId) return localConfigTeamIdif (!process.env.E2B_API_KEY) {const config = getUserConfig()return config?.teamIddiff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.tsindex bc136d98b..1533cd9fe 100644--- a/packages/cli/src/config/index.ts+++ b/packages/cli/src/config/index.ts@@ -1,37 +1,10 @@import * as yup from 'yup'import * as toml from '@iarna/toml'import * as fsPromise from 'fs/promises'-import * as fs from 'fs'import * as path from 'path'-import { asFormattedSandboxTemplate, asLocalRelative } from 'src/utils/format'-export const configName = 'e2b.toml'-function getConfigHeader(config: E2BConfig) {- return `# This is a config for E2B sandbox template.-# You can use template ID (${config.template_id}) ${- config.template_name ? `or template name (${config.template_name}) ` : ''- }to create a sandbox:--# Python SDK-# from e2b import Sandbox, AsyncSandbox-# sandbox = Sandbox.create("${- config.template_name || config.template_id- }") # Sync sandbox-# sandbox = await AsyncSandbox.create("${- config.template_name || config.template_id- }") # Async sandbox--# JS SDK-# import { Sandbox } from 'e2b'-# const sandbox = await Sandbox.create('${- config.template_name || config.template_id- }')--`-}-export const configSchema = yup.object({template_id: yup.string().required(),template_name: yup.string().optional(),@@ -40,7 +13,6 @@ export const configSchema = yup.object({ready_cmd: yup.string().optional(),cpu_count: yup.number().integer().min(1).optional(),memory_mb: yup.number().integer().min(128).optional(),- team_id: yup.string().optional(),})export type E2BConfig = yup.InferType<typeof configSchema>@@ -85,39 +57,6 @@ export async function loadConfig(configPath: string) {return (await configSchema.validate(migratedConfig)) as E2BConfig}-export async function saveConfig(- configPath: string,- config: E2BConfig,- overwrite?: boolean-) {- try {- if (!overwrite) {- const configExists = fs.existsSync(configPath)- if (configExists) {- throw new Error(- `Config already exists on path ${asLocalRelative(configPath)}`- )- }- }-- const validatedConfig: any = await configSchema.validate(config, {- stripUnknown: true,- })-- const tomlRaw = toml.stringify(validatedConfig)- await fsPromise.writeFile(configPath, getConfigHeader(config) + tomlRaw)- } catch (err: any) {- throw new Error(- `E2B sandbox template config ${asFormattedSandboxTemplate(- {- templateID: config.template_id,- },- configPath- )} cannot be saved: ${err.message}`- )- }-}-export async function deleteConfig(configPath: string) {await fsPromise.unlink(configPath)}