@@ -72,6 +72,7 @@ async function handleDeployCLI(options: DeployOptions): Promise<void> {
7272 target : options . target ! ,
7373 autoConfirm : options . yes ,
7474 verbose : options . verbose ,
75+ plan : options . plan ,
7576 onProgress,
7677 onResourceEvent,
7778 } ) ;
@@ -84,22 +85,28 @@ async function handleDeployCLI(options: DeployOptions): Promise<void> {
8485 if ( options . json ) {
8586 console . log ( JSON . stringify ( result ) ) ;
8687 } else if ( result . success ) {
87- console . log ( `\n✓ Deployed to '${ result . targetName } ' (stack: ${ result . stackName } )` ) ;
88+ if ( options . plan ) {
89+ console . log ( `\n✓ Plan complete for '${ result . targetName } ' (stack: ${ result . stackName } )` ) ;
90+ console . log ( '\nRun `agentcore deploy` to deploy.' ) ;
91+ } else {
92+ console . log ( `\n✓ Deployed to '${ result . targetName } ' (stack: ${ result . stackName } )` ) ;
93+
94+ // Show stack outputs in non-JSON mode
95+ if ( result . outputs && Object . keys ( result . outputs ) . length > 0 ) {
96+ console . log ( '\nOutputs:' ) ;
97+ for ( const [ key , value ] of Object . entries ( result . outputs ) ) {
98+ console . log ( ` ${ key } : ${ value } ` ) ;
99+ }
100+ }
88101
89- // Show stack outputs in non-JSON mode
90- if ( result . outputs && Object . keys ( result . outputs ) . length > 0 ) {
91- console . log ( '\nOutputs:' ) ;
92- for ( const [ key , value ] of Object . entries ( result . outputs ) ) {
93- console . log ( ` ${ key } : ${ value } ` ) ;
102+ if ( result . nextSteps && result . nextSteps . length > 0 ) {
103+ console . log ( `Next: ${ result . nextSteps . join ( ' | ' ) } ` ) ;
94104 }
95105 }
96106
97107 if ( result . logPath ) {
98108 console . log ( `\nLog: ${ result . logPath } ` ) ;
99109 }
100- if ( result . nextSteps && result . nextSteps . length > 0 ) {
101- console . log ( `Next: ${ result . nextSteps . join ( ' | ' ) } ` ) ;
102- }
103110 } else {
104111 console . error ( result . error ) ;
105112 if ( result . logPath ) {
@@ -120,23 +127,26 @@ export const registerDeploy = (program: Command) => {
120127 . option ( '--progress' , 'Show deployment progress in real-time' )
121128 . option ( '-v, --verbose' , 'Show resource-level deployment events' )
122129 . option ( '--json' , 'Output as JSON' )
123- . action ( async ( cliOptions : { target ?: string ; yes ?: boolean ; progress ?: boolean ; json ?: boolean } ) => {
124- try {
125- requireProject ( ) ;
126- if ( cliOptions . json || cliOptions . target || cliOptions . progress ) {
127- // Default to "default" target in CLI mode
128- const options = { ...cliOptions , target : cliOptions . target ?? 'default' } ;
129- await handleDeployCLI ( options as DeployOptions ) ;
130- } else {
131- handleDeployTUI ( { autoConfirm : cliOptions . yes } ) ;
132- }
133- } catch ( error ) {
134- if ( cliOptions . json ) {
135- console . log ( JSON . stringify ( { success : false , error : getErrorMessage ( error ) } ) ) ;
136- } else {
137- render ( < Text color = "red" > Error: { getErrorMessage ( error ) } </ Text > ) ;
130+ . option ( '--plan' , 'Preview deployment without deploying (dry-run)' )
131+ . action (
132+ async ( cliOptions : { target ?: string ; yes ?: boolean ; progress ?: boolean ; json ?: boolean ; plan ?: boolean } ) => {
133+ try {
134+ requireProject ( ) ;
135+ if ( cliOptions . json || cliOptions . target || cliOptions . progress || cliOptions . plan ) {
136+ // Default to "default" target in CLI mode
137+ const options = { ...cliOptions , target : cliOptions . target ?? 'default' } ;
138+ await handleDeployCLI ( options as DeployOptions ) ;
139+ } else {
140+ handleDeployTUI ( { autoConfirm : cliOptions . yes } ) ;
141+ }
142+ } catch ( error ) {
143+ if ( cliOptions . json ) {
144+ console . log ( JSON . stringify ( { success : false , error : getErrorMessage ( error ) } ) ) ;
145+ } else {
146+ render ( < Text color = "red" > Error: { getErrorMessage ( error ) } </ Text > ) ;
147+ }
148+ process . exit ( 1 ) ;
138149 }
139- process . exit ( 1 ) ;
140150 }
141- } ) ;
151+ ) ;
142152} ;
0 commit comments