fix: Ensures prompt is properly included in the expand command suggestion in the complexity-report. Makes the table fill the width of the terminal as well.
This commit is contained in:
@@ -950,13 +950,18 @@ async function displayComplexityReport(reportPath) {
|
||||
{ padding: 1, borderColor: 'cyan', borderStyle: 'round', margin: { top: 1, bottom: 1 } }
|
||||
));
|
||||
|
||||
// Create table for tasks that need expansion
|
||||
if (tasksNeedingExpansion.length > 0) {
|
||||
console.log(boxen(
|
||||
chalk.yellow.bold(`Tasks Recommended for Expansion (${tasksNeedingExpansion.length})`),
|
||||
{ padding: { left: 2, right: 2, top: 0, bottom: 0 }, margin: { top: 1, bottom: 0 }, borderColor: 'yellow', borderStyle: 'round' }
|
||||
));
|
||||
// Get terminal width
|
||||
const terminalWidth = process.stdout.columns || 100; // Default to 100 if can't detect
|
||||
|
||||
// Calculate dynamic column widths
|
||||
const idWidth = 5;
|
||||
const titleWidth = Math.floor(terminalWidth * 0.25); // 25% of width
|
||||
const scoreWidth = 8;
|
||||
const subtasksWidth = 8;
|
||||
// Command column gets the remaining space (minus some buffer for borders)
|
||||
const commandWidth = terminalWidth - idWidth - titleWidth - scoreWidth - subtasksWidth - 10;
|
||||
|
||||
// Create table with new column widths and word wrapping
|
||||
const complexTable = new Table({
|
||||
head: [
|
||||
chalk.yellow.bold('ID'),
|
||||
@@ -965,22 +970,26 @@ async function displayComplexityReport(reportPath) {
|
||||
chalk.yellow.bold('Subtasks'),
|
||||
chalk.yellow.bold('Expansion Command')
|
||||
],
|
||||
colWidths: [5, 40, 8, 10, 45],
|
||||
style: { head: [], border: [] }
|
||||
colWidths: [idWidth, titleWidth, scoreWidth, subtasksWidth, commandWidth],
|
||||
style: { head: [], border: [] },
|
||||
wordWrap: true,
|
||||
wrapOnWordBoundary: true
|
||||
});
|
||||
|
||||
// When adding rows, don't truncate the expansion command
|
||||
tasksNeedingExpansion.forEach(task => {
|
||||
const expansionCommand = `task-master expand --id=${task.taskId} --num=${task.recommendedSubtasks}${task.expansionPrompt ? ` --prompt="${task.expansionPrompt}"` : ''}`;
|
||||
|
||||
complexTable.push([
|
||||
task.taskId,
|
||||
truncate(task.taskTitle, 37),
|
||||
truncate(task.taskTitle, titleWidth - 3), // Still truncate title for readability
|
||||
getComplexityWithColor(task.complexityScore),
|
||||
task.recommendedSubtasks,
|
||||
chalk.cyan(`task-master expand --id=${task.taskId} --num=${task.recommendedSubtasks}`)
|
||||
chalk.cyan(expansionCommand) // Don't truncate - allow wrapping
|
||||
]);
|
||||
});
|
||||
|
||||
console.log(complexTable.toString());
|
||||
}
|
||||
|
||||
// Create table for simple tasks
|
||||
if (simpleTasks.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user