1+ import { PlanResponseData } from 'codify-schemas' ;
12import { render } from 'ink' ;
23import { EventEmitter } from 'node:events' ;
34import React from 'react' ;
45
56import { ctx , Event } from '../../events/context.js' ;
6- import { PlanComponent } from '../components/plan -component.js' ;
7+ import { DefaultComponent } from '../components/default -component.js' ;
78import { Reporter } from './reporter.js' ;
89
910export enum ProcessStatus {
@@ -38,14 +39,19 @@ export class DefaultReporter implements Reporter {
3839 ctx . on ( Event . SUB_PROCESS_START , ( name , processName ) => this . onSubprocessStartEvent ( name , processName ) ) ;
3940 ctx . on ( Event . SUB_PROCESS_FINISH , ( name , processName ) => this . onSubprocessFinishEvent ( name , processName ) )
4041
41- render ( < PlanComponent eventTarget = { this . renderEmitter } /> )
42+ render ( < DefaultComponent emitter = { this . renderEmitter } /> )
4243
4344 }
4445
4546 async promptConfirmation ( ) : Promise < boolean > {
4647 return true ;
4748 }
4849
50+ displayPlan ( plan : PlanResponseData [ ] ) : void {
51+ this . renderEmitter . emit ( 'process' , [ ] ) ;
52+ this . renderEmitter . emit ( 'plan' , plan ) ;
53+ }
54+
4955 private onOutputEvent ( ...args : unknown [ ] ) {
5056 this . staticOutput . push ( ...args )
5157 this . renderEmitter . emit ( 'static_output' , this . staticOutput ) ;
@@ -58,6 +64,7 @@ export class DefaultReporter implements Reporter {
5864 subprocess : [ ] ,
5965 } )
6066
67+ this . onOutputEvent ( `${ name } started` )
6168 this . renderEmitter . emit ( 'process' , this . processState ) ;
6269 }
6370
@@ -70,6 +77,7 @@ export class DefaultReporter implements Reporter {
7077
7178 process . status = ProcessStatus . FINISHED ;
7279
80+ this . onOutputEvent ( `${ name } finished successfully` )
7381 this . renderEmitter . emit ( 'process' , this . processState . process ) ;
7482
7583 }
@@ -85,6 +93,7 @@ export class DefaultReporter implements Reporter {
8593 status : ProcessStatus . IN_PROGRESS ,
8694 } )
8795
96+ this . onOutputEvent ( `${ name } started` )
8897 this . renderEmitter . emit ( 'process' , this . processState ) ;
8998 }
9099
@@ -102,7 +111,7 @@ export class DefaultReporter implements Reporter {
102111
103112 subprocess . status = ProcessStatus . FINISHED ;
104113
105- this . onOutputEvent ( `${ name } finished processing ` )
114+ this . onOutputEvent ( `${ name } finished successfully ` )
106115 this . renderEmitter . emit ( 'process' , this . processState ) ;
107116 }
108117
0 commit comments