diff --git a/scripts/modules/task-manager.js b/scripts/modules/task-manager.js index c7bcd579..4afa4cfc 100644 --- a/scripts/modules/task-manager.js +++ b/scripts/modules/task-manager.js @@ -705,6 +705,7 @@ async function updateTaskById( tasksPath, taskId, prompt, + complexityReportPath = null, useResearch = false, { reportProgress, mcpLog, session } = {} ) { @@ -768,7 +769,7 @@ async function updateTaskById( // Read the tasks file and complexity report const data = readJSON(tasksPath); - const complexityReport = readComplexityReport(); + const complexityReport = readComplexityReport(complexityReportPath); if (!data || !data.tasks) { throw new Error( `No valid tasks found in ${tasksPath}. The file may be corrupted or have an invalid format.` @@ -1364,13 +1365,18 @@ Return only the updated task as a valid JSON object.` * @param {Object} options - Additional options (mcpLog for MCP mode) * @returns {Object|undefined} Result object in MCP mode, undefined in CLI mode */ -function generateTaskFiles(tasksPath, outputDir, options = {}) { +function generateTaskFiles( + tasksPath, + outputDir, + complexityReportPath = null, + options = {} +) { try { // Determine if we're in MCP mode by checking for mcpLog const isMcpMode = !!options?.mcpLog; // Read complexity report once - const complexityReport = readComplexityReport(); + const complexityReport = readComplexityReport(complexityReportPath); log('info', `Reading tasks from ${tasksPath}...`); @@ -1516,7 +1522,13 @@ function generateTaskFiles(tasksPath, outputDir, options = {}) { * @param {Object} options - Additional options (mcpLog for MCP mode) * @returns {Object|undefined} Result object in MCP mode, undefined in CLI mode */ -async function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) { +async function setTaskStatus( + tasksPath, + taskIdInput, + newStatus, + complexityReportPath = null, + options = {} +) { try { // Determine if we're in MCP mode by checking for mcpLog const isMcpMode = !!options?.mcpLog; @@ -1583,7 +1595,7 @@ async function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) { } // Read complexity report once - const complexityReport = readComplexityReport(); + const complexityReport = readComplexityReport(complexityReportPath); // Return success value for programmatic use return { @@ -2996,7 +3008,7 @@ async function expandAllTasks( * @param {string} tasksPath - Path to the tasks.json file * @param {string} taskIds - Task IDs to clear subtasks from */ -function clearSubtasks(tasksPath, taskIds) { +function clearSubtasks(tasksPath, taskIds, complexityReportPath = null) { displayBanner(); log('info', `Reading tasks from ${tasksPath}...`); @@ -3007,7 +3019,7 @@ function clearSubtasks(tasksPath, taskIds) { } // Read complexity report once - const complexityReport = readComplexityReport(); + const complexityReport = readComplexityReport(complexityReportPath); console.log( boxen(chalk.white.bold('Clearing Subtasks'), { diff --git a/scripts/modules/ui.js b/scripts/modules/ui.js index 0d4ef5a6..98a151dc 100644 --- a/scripts/modules/ui.js +++ b/scripts/modules/ui.js @@ -672,7 +672,7 @@ function truncateString(str, maxLength) { * Display the next task to work on * @param {string} tasksPath - Path to the tasks.json file */ -async function displayNextTask(tasksPath) { +async function displayNextTask(tasksPath, complexityReportPath = null) { displayBanner(); // Read the tasks file @@ -683,7 +683,7 @@ async function displayNextTask(tasksPath) { } // Read complexity report once - const complexityReport = readComplexityReport(); + const complexityReport = readComplexityReport(complexityReportPath); // Find the next task const nextTask = findNextTask(data.tasks); @@ -929,7 +929,7 @@ async function displayNextTask(tasksPath) { * @param {string} tasksPath - Path to the tasks.json file * @param {string|number} taskId - The ID of the task to display */ -async function displayTaskById(tasksPath, taskId) { +async function displayTaskById(tasksPath, taskId, complexityReportPath = null) { displayBanner(); // Read the tasks file @@ -940,7 +940,7 @@ async function displayTaskById(tasksPath, taskId) { } // Read complexity report once - const complexityReport = readComplexityReport(); + const complexityReport = readComplexityReport(complexityReportPath); // Find the task by ID, passing the complexity report const task = findTaskById(data.tasks, taskId, complexityReport);