@@ -549,6 +549,116 @@ export class TaskMaster {
549549 ) ;
550550 }
551551
552+ // ==============================================
553+ // Updating Methods
554+ // ==============================================
555+
556+ // TODO: in-progress
557+ /**
558+ * @description Modifies a task using AI
559+ * @param id ID of the task to modify
560+ * @param prompt Modification prompt
561+ * @param allowAdvancedResearch Use advanced research
562+ * @param tag Context tag
563+ */
564+ public async updateTaskByAIAsync (
565+ id : number ,
566+ prompt : string ,
567+ allowAdvancedResearch : boolean ,
568+ tag : string ,
569+ ) : Promise < void > {
570+ await this . executeCommandAsync (
571+ `Modifying task ${ id } with AI...` ,
572+ `Task ${ id } modified successfully!` ,
573+ `Failed to modify task ${ id } ` ,
574+ this . _mainCommand ,
575+ [
576+ "update-task" ,
577+ `--id=${ id } ` ,
578+ `--prompt=${ prompt } ` ,
579+ allowAdvancedResearch ? "--research" : "" ,
580+ tag ? `--tag=${ tag } ` : "" ,
581+ ] . filter ( Boolean ) ,
582+ ) ;
583+ }
584+
585+ // TODO: validate
586+ /**
587+ * @description Updates multiple tasks using AI from a starting ID
588+ * @param startingId Starting ID for the update
589+ * @param prompt Global modification prompt
590+ * @param allowAdvancedResearch Use advanced research
591+ * @param tag Context tag
592+ */
593+ public async updateMultipleTasksByAIAsync (
594+ startingId : number ,
595+ prompt : string ,
596+ allowAdvancedResearch : boolean ,
597+ tag : string ,
598+ ) : Promise < void > {
599+ await this . executeCommandAsync (
600+ `Updating tasks from ${ startingId } with AI...` ,
601+ "Tasks updated successfully!" ,
602+ "Failed to update tasks" ,
603+ this . _mainCommand ,
604+ [
605+ "update" ,
606+ `--from=${ startingId } ` ,
607+ `--prompt=${ prompt } ` ,
608+ allowAdvancedResearch ? "--research" : "" ,
609+ tag ? `--tag=${ tag } ` : "" ,
610+ ] . filter ( Boolean ) ,
611+ ) ;
612+ }
613+
614+ // TODO: validate
615+ /**
616+ * @description Modifies a subtask using AI
617+ * @param hierarchicalId Hierarchical ID of the subtask
618+ * @param prompt Modification prompt
619+ * @param allowAdvancedResearch Use advanced research
620+ * @param tag Context tag
621+ */
622+ public async updateSubtaskByAIAsync (
623+ hierarchicalId : string ,
624+ prompt : string ,
625+ allowAdvancedResearch : boolean ,
626+ tag : string ,
627+ ) : Promise < void > {
628+ await this . executeCommandAsync (
629+ `Modifying subtask ${ hierarchicalId } with AI...` ,
630+ `Subtask ${ hierarchicalId } modified successfully!` ,
631+ `Failed to modify subtask ${ hierarchicalId } ` ,
632+ this . _mainCommand ,
633+ [
634+ "update-subtask" ,
635+ `--id=${ hierarchicalId } ` ,
636+ `--prompt=${ prompt } ` ,
637+ allowAdvancedResearch ? "--research" : "" ,
638+ tag ? `--tag=${ tag } ` : "" ,
639+ ] . filter ( Boolean ) ,
640+ ) ;
641+ }
642+
643+ // TODO: validate
644+ /**
645+ * @description Converts an existing task to a subtask
646+ * @param subtaskId ID of the task to convert into a subtask
647+ * @param parentId ID of the task to which the converted task should be added as a subtask
648+ */
649+ public async convertTaskToSubtaskAsync (
650+ subtaskId : number ,
651+ parentId : number ,
652+ ) : Promise < void > {
653+ await this . executeCommandAsync (
654+ `Converting task ${ subtaskId } to subtask of ${ parentId } ...` ,
655+ `Task ${ subtaskId } converted to subtask successfully!` ,
656+ `Failed to convert task ${ subtaskId } to subtask` ,
657+ this . _mainCommand ,
658+ [ "add-subtask" , `--parent=${ parentId } ` , `--task-id=${ subtaskId } ` ] ,
659+ ) ;
660+ }
661+
552662 // ==============================================
553663 // Backup, Restore and Clear Methods
554664 // ==============================================
0 commit comments