@@ -428,7 +428,7 @@ export class TaskMaster {
428428 * @param numTasksToGenerate Number of tasks to generate (default: 10)
429429 * @param allowAdvancedResearch Allow advanced research for task generation
430430 * @param appendToExistingTasks Whether to append to existing tasks
431- * @param tag tag for the generated tasks
431+ * @param tag Context tag
432432 */
433433 public async parseAsync (
434434 inputFilePath : string ,
@@ -480,7 +480,7 @@ export class TaskMaster {
480480 // TODO: done
481481 /**
482482 * @description Decomposes all tasks using AI
483- * @param tag tag for the tasks to decompose
483+ * @param tag Context tag
484484 */
485485 public async decomposeAsync ( tag : string ) : Promise < void > {
486486 await this . executeCommandAsync (
@@ -690,7 +690,7 @@ export class TaskMaster {
690690 * @description Adds a new task using AI
691691 * @param prompt Description of the task to create
692692 * @param allowAdvancedResearch Use research capabilities
693- * @param tag Tag context for the task
693+ * @param tag Context tag
694694 */
695695 public async addTaskByAIAsync (
696696 prompt : string ,
@@ -888,26 +888,25 @@ export class TaskMaster {
888888 * @description Updates the status of one or more tasks
889889 * @param ids Array of task IDs (can be main tasks or hierarchical subtask IDs)
890890 * @param status The new status to set for the tasks
891- * @param tag Optional tag to filter tasks
891+ * @param tag Context tag
892892 */
893893 public async updateTaskStatusAsync (
894894 ids : string [ ] ,
895895 status : string ,
896- tag ? : string ,
896+ tag : string ,
897897 ) : Promise < void > {
898898 const formatedIds = ids . length > 1 ? ids . join ( "," ) : ids [ 0 ] ;
899- const args = [ "set-status" , `--id=${ formatedIds } ` , `--status=${ status } ` ] ;
900-
901- if ( tag ) {
902- args . push ( `--tag=${ tag } ` ) ;
903- }
904-
905899 await this . executeCommandAsync (
906900 `Updating status of task(s) ${ formatedIds } to ${ status } ...` ,
907901 `Status of task(s) ${ formatedIds } updated successfully!` ,
908902 `Failed to update status of task(s) ${ formatedIds } ` ,
909903 this . _mainCommand ,
910- args ,
904+ [
905+ "set-status" ,
906+ `--id=${ formatedIds } ` ,
907+ `--status=${ status } ` ,
908+ `--tag=${ tag } ` ,
909+ ] ,
911910 ) ;
912911 }
913912
@@ -932,7 +931,93 @@ export class TaskMaster {
932931 }
933932
934933 // ==============================================
935- // Dependencies
934+ // Deleting Methods
935+ // ==============================================
936+
937+ /**
938+ * @description Delete a task by ID (including subtasks)
939+ * @param id The ID of the task to remove
940+ * @param tag Context tag
941+ */
942+ public async deleteTaskAsync ( id : number , tag : string ) : Promise < void > {
943+ const { confirm } = await inquirer . prompt ( {
944+ type : "confirm" ,
945+ name : "confirm" ,
946+ message : chalk . red ( `Are you sure you want to delete task ${ id } ?` ) ,
947+ default : false ,
948+ } ) ;
949+
950+ if ( confirm ) {
951+ await this . executeCommandAsync (
952+ `Deleting task ${ id } ...` ,
953+ `Task ${ id } deleted successfully!` ,
954+ `Failed to delete task ${ id } ` ,
955+ this . _mainCommand ,
956+ [ "remove-task" , `--id=${ id } ` , `--tag=${ tag } ` , "-y" ] ,
957+ ) ;
958+ }
959+ }
960+
961+ /**
962+ * @description Delete a specific subtask
963+ * @param hierarchicalId The hierarchical ID of the subtask
964+ * @param tag Context tag
965+ */
966+ public async deleteSubtaskAsync (
967+ hierarchicalId : string ,
968+ tag : string ,
969+ ) : Promise < void > {
970+ const { confirm } = await inquirer . prompt ( {
971+ type : "confirm" ,
972+ name : "confirm" ,
973+ message : chalk . red (
974+ `Are you sure you want to delete subtask ${ hierarchicalId } ?` ,
975+ ) ,
976+ default : false ,
977+ } ) ;
978+
979+ if ( confirm ) {
980+ await this . executeCommandAsync (
981+ `Deleting subtask ${ hierarchicalId } ...` ,
982+ `Subtask ${ hierarchicalId } deleted successfully!` ,
983+ `Failed to delete subtask ${ hierarchicalId } ` ,
984+ this . _mainCommand ,
985+ [ "remove-subtask" , `--id=${ hierarchicalId } ` , `--tag=${ tag } ` ] ,
986+ ) ;
987+ }
988+ }
989+
990+ /**
991+ * @description Deletes all subtasks from a specific task
992+ * @param id The ID of the task to clear subtasks from
993+ * @param tag Context tag
994+ */
995+ public async deleteAllSubtasksFromTaskAsync (
996+ id : number ,
997+ tag : string ,
998+ ) : Promise < void > {
999+ const { confirm } = await inquirer . prompt ( {
1000+ type : "confirm" ,
1001+ name : "confirm" ,
1002+ message : chalk . red (
1003+ `Are you sure you want to delete all subtasks from task ${ id } ?` ,
1004+ ) ,
1005+ default : false ,
1006+ } ) ;
1007+
1008+ if ( confirm ) {
1009+ await this . executeCommandAsync (
1010+ `Deleting all subtasks from task ${ id } ...` ,
1011+ `All subtasks deleted from task ${ id } successfully!` ,
1012+ `Failed to delete subtasks from task ${ id } ` ,
1013+ this . _mainCommand ,
1014+ [ "clear-subtasks" , `--id=${ id } ` , `--tag=${ tag } ` ] ,
1015+ ) ;
1016+ }
1017+ }
1018+
1019+ // ==============================================
1020+ // Dependencies Methods
9361021 // ==============================================
9371022
9381023 // TODO: in-progress
0 commit comments