@@ -7,6 +7,7 @@ import { ProcessName, SubProcessName, ctx } from '../events/context.js';
77import { PluginManager , ResourceDefinitionMap } from '../plugins/plugin-manager.js' ;
88import { DefaultReporter } from '../ui/reporters/default-reporter.js' ;
99import { PromptType , Reporter } from '../ui/reporters/reporter.js' ;
10+ import { SleepInhibitor } from '../utils/sleep-inhibitor.js' ;
1011import { wildCardMatch } from '../utils/wild-card-match.js' ;
1112
1213export interface DestroyArgs {
@@ -15,6 +16,7 @@ export interface DestroyArgs {
1516 secureMode ?: boolean ;
1617 verbosityLevel ?: number ;
1718 autoApprove ?: boolean ;
19+ allowSleep ?: boolean ;
1820}
1921
2022export class DestroyOrchestrator {
@@ -69,15 +71,24 @@ export class DestroyOrchestrator {
6971 } ) ;
7072 }
7173
72- await reporter . displayProgress ( ) ;
73- const applyResult = await ctx . process ( ProcessName . DESTROY , ( ) =>
74- pluginManager . apply ( destroyProject , filteredPlan )
75- )
74+ const inhibitor = args . allowSleep ? null : SleepInhibitor . start ( ) ;
75+ if ( inhibitor && reporter instanceof DefaultReporter ) {
76+ reporter . setSleepPrevented ( true ) ;
77+ }
7678
77- await reporter . displayApplyComplete ( applyResult ) ;
79+ try {
80+ await reporter . displayProgress ( ) ;
81+ const applyResult = await ctx . process ( ProcessName . DESTROY , ( ) =>
82+ pluginManager . apply ( destroyProject , filteredPlan )
83+ )
7884
79- if ( applyResult . isPartialFailure ( ) ) {
80- process . exit ( 1 ) ;
85+ await reporter . displayApplyComplete ( applyResult ) ;
86+
87+ if ( applyResult . isPartialFailure ( ) ) {
88+ process . exit ( 1 ) ;
89+ }
90+ } finally {
91+ inhibitor ?. stop ( ) ;
8192 }
8293 }
8394
0 commit comments