fix(next): adjusts CLI output for next when the result is a subtask. previously incorrect suggested creating subtasks for the subtask.
This commit is contained in:
@@ -860,8 +860,11 @@ async function displayNextTask(tasksPath) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show subtasks if they exist
|
// Determine if the nextTask is a subtask
|
||||||
if (nextTask.subtasks && nextTask.subtasks.length > 0) {
|
const isSubtask = !!nextTask.parentId;
|
||||||
|
|
||||||
|
// Show subtasks if they exist (only for parent tasks)
|
||||||
|
if (!isSubtask && nextTask.subtasks && nextTask.subtasks.length > 0) {
|
||||||
console.log(
|
console.log(
|
||||||
boxen(chalk.white.bold('Subtasks'), {
|
boxen(chalk.white.bold('Subtasks'), {
|
||||||
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
||||||
@@ -966,8 +969,10 @@ async function displayNextTask(tasksPath) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log(subtaskTable.toString());
|
console.log(subtaskTable.toString());
|
||||||
} else {
|
}
|
||||||
// Suggest expanding if no subtasks
|
|
||||||
|
// Suggest expanding if no subtasks (only for parent tasks without subtasks)
|
||||||
|
if (!isSubtask && (!nextTask.subtasks || nextTask.subtasks.length === 0)) {
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
chalk.yellow('No subtasks found. Consider breaking down this task:') +
|
chalk.yellow('No subtasks found. Consider breaking down this task:') +
|
||||||
@@ -986,22 +991,30 @@ async function displayNextTask(tasksPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show action suggestions
|
// Show action suggestions
|
||||||
console.log(
|
let suggestedActionsContent = chalk.white.bold('Suggested Actions:') + '\n';
|
||||||
boxen(
|
if (isSubtask) {
|
||||||
chalk.white.bold('Suggested Actions:') +
|
// Suggested actions for a subtask
|
||||||
'\n' +
|
suggestedActionsContent +=
|
||||||
|
`${chalk.cyan('1.')} Mark as in-progress: ${chalk.yellow(`task-master set-status --id=${nextTask.id} --status=in-progress`)}\n` +
|
||||||
|
`${chalk.cyan('2.')} Mark as done when completed: ${chalk.yellow(`task-master set-status --id=${nextTask.id} --status=done`)}\n` +
|
||||||
|
`${chalk.cyan('3.')} View parent task: ${chalk.yellow(`task-master show --id=${nextTask.parentId}`)}`;
|
||||||
|
} else {
|
||||||
|
// Suggested actions for a parent task
|
||||||
|
suggestedActionsContent +=
|
||||||
`${chalk.cyan('1.')} Mark as in-progress: ${chalk.yellow(`task-master set-status --id=${nextTask.id} --status=in-progress`)}\n` +
|
`${chalk.cyan('1.')} Mark as in-progress: ${chalk.yellow(`task-master set-status --id=${nextTask.id} --status=in-progress`)}\n` +
|
||||||
`${chalk.cyan('2.')} Mark as done when completed: ${chalk.yellow(`task-master set-status --id=${nextTask.id} --status=done`)}\n` +
|
`${chalk.cyan('2.')} Mark as done when completed: ${chalk.yellow(`task-master set-status --id=${nextTask.id} --status=done`)}\n` +
|
||||||
(nextTask.subtasks && nextTask.subtasks.length > 0
|
(nextTask.subtasks && nextTask.subtasks.length > 0
|
||||||
? `${chalk.cyan('3.')} Update subtask status: ${chalk.yellow(`task-master set-status --id=${nextTask.id}.1 --status=done`)}`
|
? `${chalk.cyan('3.')} Update subtask status: ${chalk.yellow(`task-master set-status --id=${nextTask.id}.1 --status=done`)}` // Example: first subtask
|
||||||
: `${chalk.cyan('3.')} Break down into subtasks: ${chalk.yellow(`task-master expand --id=${nextTask.id}`)}`),
|
: `${chalk.cyan('3.')} Break down into subtasks: ${chalk.yellow(`task-master expand --id=${nextTask.id}`)}`);
|
||||||
{
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
boxen(suggestedActionsContent, {
|
||||||
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
||||||
borderColor: 'green',
|
borderColor: 'green',
|
||||||
borderStyle: 'round',
|
borderStyle: 'round',
|
||||||
margin: { top: 1 }
|
margin: { top: 1 }
|
||||||
}
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user