@@ -33,9 +33,7 @@ export async function deleteContainerAction(
3333 const apiUrl = options . apiUrl || 'https://www.elizacloud.ai' ;
3434
3535 if ( ! apiKey ) {
36- logger . error (
37- '❌ Error: API key is required. Use --api-key or set ELIZA_SERVER_AUTH_TOKEN environment variable.'
38- ) ;
36+ logger . error ( { src : 'cli' , command : 'containers-delete' } , 'API key is required. Use --api-key or set ELIZA_SERVER_AUTH_TOKEN environment variable' ) ;
3937 process . exit ( 1 ) ;
4038 }
4139
@@ -46,7 +44,7 @@ export async function deleteContainerAction(
4644
4745 if ( ! targetContainerId ) {
4846 projectName = options . projectName || path . basename ( process . cwd ( ) ) ;
49- logger . info ( `🔍 Auto-detecting container for project " ${ projectName } "...` ) ;
47+ logger . info ( { src : 'cli' , command : 'containers-delete' , projectName } , ' Auto-detecting container for project' ) ;
5048
5149 // Fetch all containers
5250 const listResponse = await fetch ( `${ apiUrl } /api/v1/containers` , {
@@ -69,25 +67,25 @@ export async function deleteContainerAction(
6967 const matchingContainer = containers . find ( ( c ) => c . project_name === projectName ) ;
7068
7169 if ( ! matchingContainer ) {
72- logger . error ( `❌ Error: No container found for project " ${ projectName } "` ) ;
73- logger . info ( `\n💡 Available projects:` ) ;
70+ logger . error ( { src : 'cli' , command : 'containers-delete' , projectName } , ' No container found for project' ) ;
71+ logger . info ( { src : 'cli' , command : 'containers-delete' } , ' Available projects:' ) ;
7472 const uniqueProjects = [ ...new Set ( containers . map ( ( c ) => c . project_name ) ) ] ;
7573 uniqueProjects . forEach ( ( proj ) => {
76- logger . info ( ` - ${ proj } ` ) ;
74+ logger . info ( { src : 'cli' , command : 'containers-delete' , project : proj } , ' - ' + proj ) ;
7775 } ) ;
78- logger . info ( `\nRun "elizaos containers list" to see all containers.` ) ;
76+ logger . info ( { src : 'cli' , command : 'containers-delete' } , 'Run "elizaos containers list" to see all containers' ) ;
7977 process . exit ( 1 ) ;
8078 }
8179
8280 targetContainerId = matchingContainer . id ;
8381 containerName = matchingContainer . name ;
84- logger . info ( `✅ Found container: ${ containerName } ( ${ targetContainerId } )` ) ;
82+ logger . info ( { src : 'cli' , command : 'containers-delete' , containerName, containerId : targetContainerId } , 'Found container' ) ;
8583 }
8684
8785 if ( ! options . force && containerName ) {
8886 const confirmed = await confirmDeletion ( containerName , projectName ) ;
8987 if ( ! confirmed ) {
90- logger . info ( '❌ Deletion cancelled. ') ;
88+ logger . info ( { src : 'cli' , command : 'containers-delete' } , ' Deletion cancelled') ;
9189 return ;
9290 }
9391 } else if ( ! options . force ) {
@@ -105,13 +103,13 @@ export async function deleteContainerAction(
105103 const container : Container = detailsResult . data ;
106104 const confirmed = await confirmDeletion ( container . name , container . project_name ) ;
107105 if ( ! confirmed ) {
108- logger . info ( '❌ Deletion cancelled. ') ;
106+ logger . info ( { src : 'cli' , command : 'containers-delete' } , ' Deletion cancelled') ;
109107 return ;
110108 }
111109 }
112110 }
113111
114- logger . info ( `🗑️ Deleting container ${ targetContainerId } ...` ) ;
112+ logger . info ( { src : 'cli' , command : 'containers-delete' , containerId : targetContainerId } , 'Deleting container' ) ;
115113
116114 const response = await fetch ( `${ apiUrl } /api/v1/containers/${ targetContainerId } ` , {
117115 method : 'DELETE' ,
@@ -126,12 +124,10 @@ export async function deleteContainerAction(
126124 throw new Error ( errorData . error || `Failed to delete container: ${ response . statusText } ` ) ;
127125 }
128126
129- logger . info ( `✅ Container ${ targetContainerId } deleted successfully.` ) ;
130- logger . info ( 'ℹ️ Note: CloudFormation stack deletion may take a few minutes to complete. ') ;
127+ logger . info ( { src : 'cli' , command : 'containers-delete' , containerId : targetContainerId } , 'Container deleted successfully' ) ;
128+ logger . info ( { src : 'cli' , command : 'containers-delete' } , ' Note: CloudFormation stack deletion may take a few minutes to complete') ;
131129 } catch ( error : unknown ) {
132- logger . error (
133- `❌ Error: ${ error instanceof Error ? error . message : 'Failed to delete container' } `
134- ) ;
130+ logger . error ( { src : 'cli' , command : 'containers-delete' , error : error instanceof Error ? error . message : 'Failed to delete container' } , 'Error deleting container' ) ;
135131 process . exit ( 1 ) ;
136132 }
137133}
0 commit comments