fix(add-task): removes stdout in add-task which will crash MCP server (#593)

* fix(add-task): fixes an isse in which stdout leaks out of add-task causing the mcp server to crash if used.

* chore: add changeset

---------

Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
This commit is contained in:
Eyal Toledano
2025-05-25 22:10:03 -04:00
committed by Ralph Khreish
parent b60e1cf835
commit 2d520de269
2 changed files with 31 additions and 24 deletions

View File

@@ -0,0 +1,5 @@
---
'task-master-ai': patch
---
Fix add-task MCP command causing an error

View File

@@ -852,30 +852,32 @@ async function addTask(
: 0; : 0;
} }
// Add a visual transition to show we're moving to AI generation // Add a visual transition to show we're moving to AI generation - only for CLI
console.log( if (outputFormat === 'text') {
boxen( console.log(
chalk.white.bold('AI Task Generation') + boxen(
`\n\n${chalk.gray('Analyzing context and generating task details using AI...')}` + chalk.white.bold('AI Task Generation') +
`\n${chalk.cyan('Context size: ')}${chalk.yellow(contextTasks.length.toLocaleString())} characters` + `\n\n${chalk.gray('Analyzing context and generating task details using AI...')}` +
`\n${chalk.cyan('Dependency detection: ')}${chalk.yellow(numericDependencies.length > 0 ? 'Explicit dependencies' : 'Auto-discovery mode')}` + `\n${chalk.cyan('Context size: ')}${chalk.yellow(contextTasks.length.toLocaleString())} characters` +
`\n${chalk.cyan('Detailed tasks: ')}${chalk.yellow( `\n${chalk.cyan('Dependency detection: ')}${chalk.yellow(numericDependencies.length > 0 ? 'Explicit dependencies' : 'Auto-discovery mode')}` +
numericDependencies.length > 0 `\n${chalk.cyan('Detailed tasks: ')}${chalk.yellow(
? dependentTasks.length // Use length of tasks from explicit dependency path numericDependencies.length > 0
: uniqueDetailedTasks.length // Use length of tasks from fuzzy search path ? dependentTasks.length // Use length of tasks from explicit dependency path
)}` + : uniqueDetailedTasks.length // Use length of tasks from fuzzy search path
(promptCategory )}` +
? `\n${chalk.cyan('Category detected: ')}${chalk.yellow(promptCategory.label)}` (promptCategory
: ''), ? `\n${chalk.cyan('Category detected: ')}${chalk.yellow(promptCategory.label)}`
{ : ''),
padding: { top: 0, bottom: 1, left: 1, right: 1 }, {
margin: { top: 1, bottom: 0 }, padding: { top: 0, bottom: 1, left: 1, right: 1 },
borderColor: 'white', margin: { top: 1, bottom: 0 },
borderStyle: 'round' borderColor: 'white',
} borderStyle: 'round'
) }
); )
console.log(); // Add spacing );
console.log(); // Add spacing
}
// System Prompt - Enhanced for dependency awareness // System Prompt - Enhanced for dependency awareness
const systemPrompt = const systemPrompt =