fix: fixed next cli command handling

This commit is contained in:
Shrey Paharia
2025-04-23 21:25:42 +05:30
parent deaf4a6ff4
commit fdbb25e185
3 changed files with 23 additions and 17 deletions

View File

@@ -21,7 +21,7 @@ import {
sanitizePrompt,
findTaskById,
readComplexityReport,
findTaskInComplexityReport,
addComplexityToTask,
truncate,
enableSilentMode,
disableSilentMode,
@@ -4543,7 +4543,7 @@ DO NOT include any text before or after the JSON array. No explanations, no mark
* @param {Object[]} tasks - The array of tasks
* @returns {Object|null} The next task to work on or null if no eligible tasks
*/
function findNextTask(tasks) {
function findNextTask(tasks, complexityReport = null) {
// Get all completed task IDs
const completedTaskIds = new Set(
tasks
@@ -4591,6 +4591,9 @@ function findNextTask(tasks) {
return a.id - b.id; // Lower ID first
})[0]; // Return the first (highest priority) task
// Add complexity to the task
addComplexityToTask(nextTask, complexityReport);
return nextTask;
}