@@ -151,9 +151,15 @@ export function registerPreActionHooks(program: Command, programVersion: string)
151151 return ;
152152 }
153153 let beforeStateMigrations : ( ( snapshot ?: ConfigFileSnapshot ) => Promise < boolean > ) | undefined ;
154+ let skipPristineStartupStateMigrations = false ;
155+ let skipPristineCoreStateMigrations = false ;
154156 if ( isGatewayRunAction ( actionCommand ) ) {
155- const { prepareGatewayRunBootstrap, recheckGatewayRunBootstrap } =
156- await import ( "../gateway-cli/pre-bootstrap.js" ) ;
157+ const {
158+ prepareGatewayRunBootstrap,
159+ recheckGatewayRunBootstrap,
160+ wasPreparedGatewayRunCoreStatePristine,
161+ wasPreparedGatewayRunStatePristine,
162+ } = await import ( "../gateway-cli/pre-bootstrap.js" ) ;
157163 const { resolveGatewayRunOptions } = await import ( "../gateway-cli/run-options.js" ) ;
158164 const resolvedOptions = resolveGatewayRunOptions ( actionCommand . opts ( ) , actionCommand ) ;
159165 const opts = {
@@ -164,6 +170,8 @@ export function registerPreActionHooks(program: Command, programVersion: string)
164170 if ( ! shouldBootstrap ) {
165171 return ;
166172 }
173+ skipPristineStartupStateMigrations = wasPreparedGatewayRunStatePristine ( ) ;
174+ skipPristineCoreStateMigrations = wasPreparedGatewayRunCoreStatePristine ( ) ;
167175 beforeStateMigrations = ( snapshot ) =>
168176 recheckGatewayRunBootstrap ( {
169177 opts,
@@ -177,6 +185,8 @@ export function registerPreActionHooks(program: Command, programVersion: string)
177185 startupPolicy,
178186 allowInvalid : shouldAllowInvalidConfigForAction ( actionCommand , commandPath ) ,
179187 ...( beforeStateMigrations ? { beforeStateMigrations } : { } ) ,
188+ ...( skipPristineStartupStateMigrations ? { skipPristineStartupStateMigrations : true } : { } ) ,
189+ ...( skipPristineCoreStateMigrations ? { skipPristineCoreStateMigrations : true } : { } ) ,
180190 skipConfigGuard : shouldBypassConfigGuardForCommandPath ( commandPath ) ,
181191 } ) ;
182192 if ( beforeStateMigrations ) {
0 commit comments