@@ -11,7 +11,6 @@ import {
1111 DEFAULT_TAG ,
1212 DEFAULT_TASKS_TO_GENERATE ,
1313 MAX_DESCRIPTION_LENGTH ,
14- MAX_DETAILS_LENGTH ,
1514 MAX_PROMPT_LENGTH ,
1615 MAX_SUBTASKS_TO_GENERATE ,
1716 MAX_TASKS_TO_GENERATE ,
@@ -20,7 +19,6 @@ import {
2019 MIN_SUBTASKS_TO_GENERATE ,
2120 MIN_TASKS_TO_GENERATE ,
2221 PRD_PATH ,
23- TASKS_PRIORITIES ,
2422 TASKS_STATUSES ,
2523 TASKS_BCK_DEST_PATH ,
2624} from "@/constants" ;
@@ -33,7 +31,7 @@ import { existsAsync } from "@/utils/extras";
3331/**
3432 * @description Asks the user for confirmation to overwrite the existing tasks.json file.
3533 */
36- export async function askOverwriteConfirmation ( ) {
34+ export async function askOverwriteConfirmation ( ) : Promise < boolean > {
3735 const { overwrite } = await inquirer . prompt ( {
3836 type : "confirm" ,
3937 name : "overwrite" ,
@@ -48,7 +46,7 @@ export async function askOverwriteConfirmation() {
4846/**
4947 * @description Asks the user for the path to their PRD file.
5048 */
51- export async function askPrdPath ( ) {
49+ export async function askPrdPath ( ) : Promise < string > {
5250 const { prdPath } = await inquirer . prompt ( {
5351 type : "input" ,
5452 name : "prdPath" ,
@@ -68,7 +66,7 @@ export async function askPrdPath() {
6866/**
6967 * @description Asks the user for the number of tasks to generate.
7068 */
71- export async function askNumTasksToGenerate ( ) {
69+ export async function askNumTasksToGenerate ( ) : Promise < number > {
7270 const { numTasksToGenerate } = await inquirer . prompt ( {
7371 type : "number" ,
7472 name : "numTasksToGenerate" ,
@@ -86,13 +84,13 @@ export async function askNumTasksToGenerate() {
8684 return true ;
8785 } ,
8886 } ) ;
89- return numTasksToGenerate ;
87+ return Number ( numTasksToGenerate ) ;
9088}
9189
9290/**
9391 * @description Asks the user for confirmation to allow advanced research for task generation (using AI).
9492 */
95- export async function askAdvancedResearchConfirmation ( ) {
93+ export async function askAdvancedResearchConfirmation ( ) : Promise < boolean > {
9694 const { allowAdvancedResearch } = await inquirer . prompt ( {
9795 type : "confirm" ,
9896 name : "allowAdvancedResearch" ,
@@ -105,7 +103,7 @@ export async function askAdvancedResearchConfirmation() {
105103/**
106104 * @description Asks the user to enter a tag for the tasks.
107105 */
108- export async function askTaskTag ( ) {
106+ export async function askTaskTag ( ) : Promise < string > {
109107 const { tag } = await inquirer . prompt ( {
110108 type : "input" ,
111109 name : "tag" ,
@@ -125,7 +123,7 @@ export async function askTaskTag() {
125123/**
126124 * @description Asks the user for confirmation to decompose all tasks.
127125 */
128- export async function askDecompositionConfirmation ( ) {
126+ export async function askDecompositionConfirmation ( ) : Promise < boolean > {
129127 const { confirmDecomposition } = await inquirer . prompt ( {
130128 type : "confirm" ,
131129 name : "confirmDecomposition" ,
@@ -140,7 +138,7 @@ export async function askDecompositionConfirmation() {
140138/**
141139 * @description Asks the user to select task statuses.
142140 */
143- export async function askStatusSelection ( ) {
141+ export async function askStatusSelection ( ) : Promise < string > {
144142 const { status : validatedStatus } = await inquirer . prompt ( [
145143 {
146144 type : "checkbox" ,
@@ -163,7 +161,10 @@ export async function askStatusSelection() {
163161/**
164162 * @description Asks the user for display options when listing tasks.
165163 */
166- export async function askDisplayOptions ( ) {
164+ export async function askDisplayOptions ( ) : Promise < {
165+ quickly : boolean ;
166+ withSubtasks : boolean ;
167+ } > {
167168 const { quickly, withSubtasks } = await inquirer . prompt ( [
168169 {
169170 type : "confirm" ,
@@ -182,16 +183,41 @@ export async function askDisplayOptions() {
182183}
183184
184185/**
185- * @description Asks the user to enter a tag for the tasks.
186+ * @description Asks the user for the parent task ID
187+ */
188+ export async function askTaskId ( tasksLength : number ) : Promise < number > {
189+ const { parentId } = await inquirer . prompt ( {
190+ type : "number" ,
191+ name : "parentId" ,
192+ message : "Enter task ID:" ,
193+ default : 1 ,
194+ validate : ( input ) => {
195+ const num = Number ( input ) ;
196+ if (
197+ Number . isNaN ( num ) ||
198+ ! Number . isInteger ( num ) ||
199+ num < MIN_PARENT_ID ||
200+ num > tasksLength
201+ ) {
202+ return `Please enter a valid integer between ${ MIN_PARENT_ID } and ${ tasksLength } ` ;
203+ }
204+ return true ;
205+ } ,
206+ } ) ;
207+ return Number ( parentId ) ;
208+ }
209+
210+ /**
211+ * @description Asks the user to enter subtask ID
186212 */
187- export async function askTaskIdInput ( ) {
213+ export async function askHierarchicalTaskId ( ) : Promise < string > {
188214 const { taskId } = await inquirer . prompt ( {
189215 type : "input" ,
190216 name : "taskId" ,
191- message : "Enter the task ID:" ,
217+ message : "Enter the hierarchical task ID:" ,
192218 validate : ( input ) => {
193- if ( ! input || ! / ^ ( \d + ) ( \. \d + ) * $ / . test ( input ) ) {
194- return "Invalid task ID. Must be an integer or hierarchical ID (e.g. 1, 2 .1, 5 .1.1)" ;
219+ if ( ! input || ! / ^ ( \d + ( \. \d + ) * \. \d + ) $ / . test ( input ) ) {
220+ return "Invalid subtask ID. Must be a hierarchical ID (e.g: 1 .1, 2 .1.1)" ;
195221 }
196222 return true ;
197223 } ,
@@ -202,7 +228,7 @@ export async function askTaskIdInput() {
202228/**
203229 * @description Asks the user for the task creation prompt
204230 */
205- export async function askTaskPrompt ( ) {
231+ export async function askTaskPrompt ( ) : Promise < string > {
206232 const { prompt } = await inquirer . prompt ( {
207233 type : "input" ,
208234 name : "prompt" ,
@@ -217,34 +243,10 @@ export async function askTaskPrompt() {
217243 return prompt ;
218244}
219245
220- /**
221- * @description Asks the user for the parent task ID
222- */
223- export async function askSubtaskParentId ( tasksLength : number ) {
224- const { parentId } = await inquirer . prompt ( {
225- type : "input" ,
226- name : "parentId" ,
227- message : "Enter parent task ID:" ,
228- validate : ( input ) => {
229- const num = Number ( input ) ;
230- if (
231- Number . isNaN ( num ) ||
232- ! Number . isInteger ( num ) ||
233- num < MIN_PARENT_ID ||
234- num > tasksLength
235- ) {
236- return `Please enter a valid integer between ${ MIN_PARENT_ID } and ${ tasksLength } ` ;
237- }
238- return true ;
239- } ,
240- } ) ;
241- return Number ( parentId ) ;
242- }
243-
244246/**
245247 * @description Asks the user for the number of subtasks to generate
246248 */
247- export async function askNumSubtasks ( ) {
249+ export async function askNumSubtasks ( ) : Promise < number > {
248250 const { num } = await inquirer . prompt ( {
249251 type : "number" ,
250252 name : "num" ,
@@ -261,13 +263,13 @@ export async function askNumSubtasks() {
261263 return true ;
262264 } ,
263265 } ) ;
264- return num ;
266+ return Number ( num ) ;
265267}
266268
267269/**
268270 * @description Asks the user for manual subtask parameters
269271 */
270- export async function askBackupSlot ( ) {
272+ export async function askBackupSlot ( ) : Promise < string > {
271273 const slots = [ 1 , 2 , 3 ] ;
272274 const slotChoices = [ ] ;
273275
@@ -308,7 +310,10 @@ export async function askBackupSlot() {
308310 return selectedSlot ;
309311}
310312
311- export async function askSubtaskManualParams ( ) {
313+ export async function askSubtaskManualParams ( ) : Promise < {
314+ title : string ;
315+ description : string ;
316+ } > {
312317 return await inquirer . prompt ( [
313318 {
314319 type : "input" ,
0 commit comments