@@ -200,8 +200,12 @@ export class TaskManager {
200200 let planRequired = false ;
201201
202202 if ( params . overall_plan && params . overall_plan . length > 0 ) {
203- for ( const planDescription of params . overall_plan ) {
204- const plan = this . createTaskPlan ( planDescription , timestamp ) ;
203+ for ( let i = 0 ; i < params . overall_plan . length ; i ++ ) {
204+ const plan = this . createTaskPlan (
205+ params . overall_plan [ i ] ,
206+ timestamp ,
207+ i
208+ ) ;
205209 overallPlan . push ( plan ) ;
206210 }
207211 currentPlanId = overallPlan [ 0 ] . id ;
@@ -597,9 +601,13 @@ export class TaskManager {
597601 return { url : story } ;
598602 }
599603
600- private createTaskPlan ( description : string , timestamp : string ) : TaskPlan {
604+ private createTaskPlan (
605+ description : string ,
606+ timestamp : string ,
607+ index ?: number
608+ ) : TaskPlan {
601609 return {
602- id : `plan-${ ulid ( ) } ` ,
610+ id : index !== undefined ? `plan- ${ index + 1 } ` : `plan-${ ulid ( ) } ` ,
603611 description : description . trim ( ) ,
604612 status : TaskStatus . ToDo ,
605613 hints : [ ] ,
@@ -1140,8 +1148,8 @@ export class TaskManager {
11401148 const oldPlanCount = task . overall_plan . length ;
11411149 const newPlanDescriptions = params . content as string [ ] ;
11421150
1143- task . overall_plan = newPlanDescriptions . map ( ( description ) =>
1144- this . createTaskPlan ( description , timestamp )
1151+ task . overall_plan = newPlanDescriptions . map ( ( description , index ) =>
1152+ this . createTaskPlan ( description , timestamp , index )
11451153 ) ;
11461154
11471155 task . current_plan_id =
@@ -1187,8 +1195,8 @@ export class TaskManager {
11871195 const oldStepCount = plan . steps . length ;
11881196 const newStepDescriptions = params . content as string [ ] ;
11891197
1190- plan . steps = newStepDescriptions . map ( ( description ) => ( {
1191- id : `step-${ ulid ( ) } ` ,
1198+ plan . steps = newStepDescriptions . map ( ( description , index ) => ( {
1199+ id : `step-${ index + 1 } ` ,
11921200 description : description . trim ( ) ,
11931201 status : TaskStatus . ToDo ,
11941202 hints : [ ] ,
0 commit comments