Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Improve the message when selecting a team in CLI
Jakub Novakd0fca6efc2ba
diff --git a/packages/cli/src/commands/auth/configure.ts b/packages/cli/src/commands/auth/configure.tsindex 8e9eabd1e..b27629aa7 100644--- a/packages/cli/src/commands/auth/configure.ts+++ b/packages/cli/src/commands/auth/configure.ts@@ -11,7 +11,7 @@ import {ensureAccessToken,ensureUserConfig,} from 'src/api'-import { asFormattedTeam } from '../../utils/format'+import { asBold, asFormattedTeam } from '../../utils/format'import { handleE2BRequestError } from '../../utils/errors'export const configureCommand = new commander.Command('configure')@@ -42,7 +42,7 @@ export const configureCommand = new commander.Command('configure')type: 'list',pageSize: 50,choices: res.data.map((team: e2b.components['schemas']['Team']) => ({- name: asFormattedTeam(team),+ name: asFormattedTeam(team, userConfig.teamId),value: team,})),},@@ -55,5 +55,5 @@ export const configureCommand = new commander.Command('configure')fs.mkdirSync(path.dirname(USER_CONFIG_PATH), { recursive: true })fs.writeFileSync(USER_CONFIG_PATH, JSON.stringify(userConfig, null, 2))- console.log(`Team ${asFormattedTeam(team)} selected.\n`)+ console.log(`Team ${asBold(team.name)} (${team.teamID}) selected.\n`)})diff --git a/packages/cli/src/utils/format.ts b/packages/cli/src/utils/format.tsindex 9a14df161..8cedde29e 100644--- a/packages/cli/src/utils/format.ts+++ b/packages/cli/src/utils/format.ts@@ -17,11 +17,15 @@ export function asFormattedConfig(config: UserConfig) {return `You are logged in as ${email},\nSelected team: ${team} (${teamId})`}-export function asFormattedTeam(team: e2b.components['schemas']['Team']) {+export function asFormattedTeam(+ team: e2b.components['schemas']['Team'],+ selected: string+) {const name = asBold(team.name)const id = asBold(team.teamID)- const isDefault = team.isDefault ? asPrimary(' (default team)') : ''- return `${name} (${id})${isDefault}`+ const isSelected =+ team.teamID == selected ? asPrimary(' (currently selected team)') : ''+ return `${name} (${id})${isSelected}`}export function asFormattedSandboxTemplate(@@ -29,7 +33,7 @@ export function asFormattedSandboxTemplate(e2b.components['schemas']['Template'],'templateID' | 'aliases'>,- configLocalPath?: string,+ configLocalPath?: string) {const aliases = listAliases(template.aliases)@@ -49,7 +53,7 @@ export function asRed(text: string) {export function asFormattedError(text: string | undefined, err?: any) {return chalk.default.redBright(- `${text ? `${text} \n` : ''}${err ? err.stack : ''}\n`,+ `${text ? `${text} \n` : ''}${err ? err.stack : ''}\n`)}@@ -127,7 +131,7 @@ const verticalPadding = 1export function withDelimiter(content: string,title: string,- isLast?: boolean,+ isLast?: boolean) {return boxen.default(content, {borderStyle: {