Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Improve texting in CLI, add reference to docs
Jakub Novakb88feb0779f1
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.tsindex 8ca093f9a..b852d3ff0 100644--- a/packages/cli/src/commands/template/build.ts+++ b/packages/cli/src/commands/template/build.ts@@ -8,7 +8,14 @@ import * as stripAnsi from 'strip-ansi'import { wait } from 'src/utils/wait'import { ensureAccessToken } from 'src/api'import { getFiles, getRoot } from 'src/utils/filesystem'-import { asBold, asBuildLogs, asFormattedSandboxTemplate, asLocal, asLocalRelative, asPrimary } from 'src/utils/format'+import {+ asBold,+ asBuildLogs,+ asFormattedSandboxTemplate,+ asLocal,+ asLocalRelative,+ asPrimary,+} from 'src/utils/format'import { pathOption } from 'src/options'import { createBlobFromFiles } from 'src/docker/archive'import { defaultDockerfileName, fallbackDockerfileName } from 'src/docker/constants'@@ -207,7 +214,9 @@ async function waitForBuildFinish(console.log(`\n✅ Building sandbox template ${asFormattedSandboxTemplate(template.data,- )} finished.\n`,+ )} finished.\n+ Now you can start creating your sandboxes from this template. You can find more here:+ ${asPrimary('https://e2b.dev/docs/guide/custom-sandbox')}, section ${asBold('Spawn and control your sandbox')}\n`,)breakdiff --git a/packages/cli/src/commands/template/list.ts b/packages/cli/src/commands/template/list.tsindex 7b0efd076..5d30d5275 100644--- a/packages/cli/src/commands/template/list.ts+++ b/packages/cli/src/commands/template/list.ts@@ -1,8 +1,8 @@-import * as chalk from 'chalk'import * as commander from 'commander'import * as e2b from '@e2b/sdk'import { ensureAccessToken } from 'src/api'+import { asHeadline, asPrimary } from '../../utils/format'const listTemplates = e2b.withAccessToken(e2b.api.path('/envs').method('get').create(),@@ -18,14 +18,14 @@ export const listCommand = new commander.Command('list')const templatesResponse = await listTemplates(accessToken, {})- console.log(- chalk.default.underline(chalk.default.green('Sandbox templates')),- )+ console.log(asHeadline('Sandbox templates:'))+const templates = templatesResponse.dataif (!templates?.length) {- console.log('No templates found.')+ console.log(`No templates found.\n+You can create a template by running ${asPrimary('e2b template build')} or visit E2B docs ${asPrimary('(https://e2b.dev/docs/guide/custom-sandbox)')} to learn more.`)} else {templates.sort((a, b) => a.envID.localeCompare(b.envID))diff --git a/packages/cli/src/commands/template/shell.ts b/packages/cli/src/commands/template/shell.tsindex a8d6d56ea..c94873f81 100644--- a/packages/cli/src/commands/template/shell.ts+++ b/packages/cli/src/commands/template/shell.ts@@ -3,11 +3,11 @@ import * as commander from 'commander'import { ensureAPIKey } from 'src/api'import { spawnConnectedTerminal } from 'src/terminal'-import { asBold, asFormattedSandboxTemplate } from 'src/utils/format'+import { asBold, asFormattedSandboxTemplate, asPrimary } from 'src/utils/format'export const shellCommand = new commander.Command('shell')- .description('Connect terminal to sandbox')- .argument('<id>', `Connect to sandbox specified by ${asBold('<id>')}`)+ .description('Connect to the terminal in the sandbox')+ .argument('<id>', `Connect to sandbox specified by ${asPrimary('template id')}`).alias('sh').action(async (id: string) => {try {@@ -35,13 +35,11 @@ async function connectSandbox({apiKey: string;template: Pick<e2b.components['schemas']['Environment'], 'envID'>;}) {- const sandbox = new e2b.Sandbox({+ const sandbox = await e2b.Sandbox.create({apiKey,id: template.envID,})- await sandbox.open({})-if (sandbox.terminal) {const { exited } = await spawnConnectedTerminal(sandbox.terminal,diff --git a/packages/cli/src/utils/format.ts b/packages/cli/src/utils/format.tsindex 66d435bcc..7f2de9a80 100644--- a/packages/cli/src/utils/format.ts+++ b/packages/cli/src/utils/format.ts@@ -49,3 +49,7 @@ export function asLocalRelative(absolutePathInLocal?: string) {export function asBuildLogs(content: string) {return chalk.default.blueBright(content)}++export function asHeadline(content: string) {+ return chalk.default.underline(asPrimary(asBold(content)))+}\ No newline at end of file