fix: added handling for complexity report path
This commit is contained in:
@@ -705,6 +705,7 @@ async function updateTaskById(
|
|||||||
tasksPath,
|
tasksPath,
|
||||||
taskId,
|
taskId,
|
||||||
prompt,
|
prompt,
|
||||||
|
complexityReportPath = null,
|
||||||
useResearch = false,
|
useResearch = false,
|
||||||
{ reportProgress, mcpLog, session } = {}
|
{ reportProgress, mcpLog, session } = {}
|
||||||
) {
|
) {
|
||||||
@@ -768,7 +769,7 @@ async function updateTaskById(
|
|||||||
|
|
||||||
// Read the tasks file and complexity report
|
// Read the tasks file and complexity report
|
||||||
const data = readJSON(tasksPath);
|
const data = readJSON(tasksPath);
|
||||||
const complexityReport = readComplexityReport();
|
const complexityReport = readComplexityReport(complexityReportPath);
|
||||||
if (!data || !data.tasks) {
|
if (!data || !data.tasks) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No valid tasks found in ${tasksPath}. The file may be corrupted or have an invalid format.`
|
`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)
|
* @param {Object} options - Additional options (mcpLog for MCP mode)
|
||||||
* @returns {Object|undefined} Result object in MCP mode, undefined in CLI 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 {
|
try {
|
||||||
// Determine if we're in MCP mode by checking for mcpLog
|
// Determine if we're in MCP mode by checking for mcpLog
|
||||||
const isMcpMode = !!options?.mcpLog;
|
const isMcpMode = !!options?.mcpLog;
|
||||||
|
|
||||||
// Read complexity report once
|
// Read complexity report once
|
||||||
const complexityReport = readComplexityReport();
|
const complexityReport = readComplexityReport(complexityReportPath);
|
||||||
|
|
||||||
log('info', `Reading tasks from ${tasksPath}...`);
|
log('info', `Reading tasks from ${tasksPath}...`);
|
||||||
|
|
||||||
@@ -1516,7 +1522,13 @@ function generateTaskFiles(tasksPath, outputDir, options = {}) {
|
|||||||
* @param {Object} options - Additional options (mcpLog for MCP mode)
|
* @param {Object} options - Additional options (mcpLog for MCP mode)
|
||||||
* @returns {Object|undefined} Result object in MCP mode, undefined in CLI 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 {
|
try {
|
||||||
// Determine if we're in MCP mode by checking for mcpLog
|
// Determine if we're in MCP mode by checking for mcpLog
|
||||||
const isMcpMode = !!options?.mcpLog;
|
const isMcpMode = !!options?.mcpLog;
|
||||||
@@ -1583,7 +1595,7 @@ async function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read complexity report once
|
// Read complexity report once
|
||||||
const complexityReport = readComplexityReport();
|
const complexityReport = readComplexityReport(complexityReportPath);
|
||||||
|
|
||||||
// Return success value for programmatic use
|
// Return success value for programmatic use
|
||||||
return {
|
return {
|
||||||
@@ -2996,7 +3008,7 @@ async function expandAllTasks(
|
|||||||
* @param {string} tasksPath - Path to the tasks.json file
|
* @param {string} tasksPath - Path to the tasks.json file
|
||||||
* @param {string} taskIds - Task IDs to clear subtasks from
|
* @param {string} taskIds - Task IDs to clear subtasks from
|
||||||
*/
|
*/
|
||||||
function clearSubtasks(tasksPath, taskIds) {
|
function clearSubtasks(tasksPath, taskIds, complexityReportPath = null) {
|
||||||
displayBanner();
|
displayBanner();
|
||||||
|
|
||||||
log('info', `Reading tasks from ${tasksPath}...`);
|
log('info', `Reading tasks from ${tasksPath}...`);
|
||||||
@@ -3007,7 +3019,7 @@ function clearSubtasks(tasksPath, taskIds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read complexity report once
|
// Read complexity report once
|
||||||
const complexityReport = readComplexityReport();
|
const complexityReport = readComplexityReport(complexityReportPath);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
boxen(chalk.white.bold('Clearing Subtasks'), {
|
boxen(chalk.white.bold('Clearing Subtasks'), {
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ function truncateString(str, maxLength) {
|
|||||||
* Display the next task to work on
|
* Display the next task to work on
|
||||||
* @param {string} tasksPath - Path to the tasks.json file
|
* @param {string} tasksPath - Path to the tasks.json file
|
||||||
*/
|
*/
|
||||||
async function displayNextTask(tasksPath) {
|
async function displayNextTask(tasksPath, complexityReportPath = null) {
|
||||||
displayBanner();
|
displayBanner();
|
||||||
|
|
||||||
// Read the tasks file
|
// Read the tasks file
|
||||||
@@ -683,7 +683,7 @@ async function displayNextTask(tasksPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read complexity report once
|
// Read complexity report once
|
||||||
const complexityReport = readComplexityReport();
|
const complexityReport = readComplexityReport(complexityReportPath);
|
||||||
|
|
||||||
// Find the next task
|
// Find the next task
|
||||||
const nextTask = findNextTask(data.tasks);
|
const nextTask = findNextTask(data.tasks);
|
||||||
@@ -929,7 +929,7 @@ async function displayNextTask(tasksPath) {
|
|||||||
* @param {string} tasksPath - Path to the tasks.json file
|
* @param {string} tasksPath - Path to the tasks.json file
|
||||||
* @param {string|number} taskId - The ID of the task to display
|
* @param {string|number} taskId - The ID of the task to display
|
||||||
*/
|
*/
|
||||||
async function displayTaskById(tasksPath, taskId) {
|
async function displayTaskById(tasksPath, taskId, complexityReportPath = null) {
|
||||||
displayBanner();
|
displayBanner();
|
||||||
|
|
||||||
// Read the tasks file
|
// Read the tasks file
|
||||||
@@ -940,7 +940,7 @@ async function displayTaskById(tasksPath, taskId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read complexity report once
|
// Read complexity report once
|
||||||
const complexityReport = readComplexityReport();
|
const complexityReport = readComplexityReport(complexityReportPath);
|
||||||
|
|
||||||
// Find the task by ID, passing the complexity report
|
// Find the task by ID, passing the complexity report
|
||||||
const task = findTaskById(data.tasks, taskId, complexityReport);
|
const task = findTaskById(data.tasks, taskId, complexityReport);
|
||||||
|
|||||||
Reference in New Issue
Block a user