diff --git a/.changeset/fix-mcp-connection-errors.md b/.changeset/fix-mcp-connection-errors.md new file mode 100644 index 00000000..4f99fe6f --- /dev/null +++ b/.changeset/fix-mcp-connection-errors.md @@ -0,0 +1,5 @@ +--- +"task-master-ai": patch +--- + +Fix MCP connection errors caused by deprecated generateTaskFiles calls. Resolves "Cannot read properties of null (reading 'toString')" errors when using MCP tools for task management operations. \ No newline at end of file diff --git a/scripts/modules/task-manager/add-subtask.js b/scripts/modules/task-manager/add-subtask.js index ad03084c..3724cef7 100644 --- a/scripts/modules/task-manager/add-subtask.js +++ b/scripts/modules/task-manager/add-subtask.js @@ -1,8 +1,5 @@ -import path from 'path'; - import { log, readJSON, writeJSON, getCurrentTag } from '../utils.js'; import { isTaskDependentOn } from '../task-manager.js'; -import generateTaskFiles from './generate-task-files.js'; /** * Add a subtask to a parent task @@ -142,11 +139,7 @@ async function addSubtask( // Write the updated tasks back to the file with proper context writeJSON(tasksPath, data, projectRoot, tag); - // Generate task files if requested - if (generateFiles) { - log('info', 'Regenerating task files...'); - await generateTaskFiles(tasksPath, path.dirname(tasksPath), context); - } + // Note: Task file generation is no longer supported and has been removed return newSubtask; } catch (error) { diff --git a/scripts/modules/task-manager/move-task.js b/scripts/modules/task-manager/move-task.js index a9377503..20cedec5 100644 --- a/scripts/modules/task-manager/move-task.js +++ b/scripts/modules/task-manager/move-task.js @@ -6,7 +6,6 @@ import { setTasksForTag, traverseDependencies } from '../utils.js'; -import generateTaskFiles from './generate-task-files.js'; import { findCrossTagDependencies, getDependentTaskIds, @@ -142,13 +141,7 @@ async function moveTask( results.push(result); } - // Generate files once at the end if requested - if (generateFiles) { - await generateTaskFiles(tasksPath, path.dirname(tasksPath), { - tag: tag, - projectRoot: projectRoot - }); - } + // Note: Task file generation is no longer supported and has been removed return { message: `Successfully moved ${sourceIds.length} tasks/subtasks`, @@ -209,12 +202,7 @@ async function moveTask( // The writeJSON function will filter out _rawTaggedData automatically writeJSON(tasksPath, rawData, options.projectRoot, tag); - if (generateFiles) { - await generateTaskFiles(tasksPath, path.dirname(tasksPath), { - tag: tag, - projectRoot: projectRoot - }); - } + // Note: Task file generation is no longer supported and has been removed return result; } diff --git a/scripts/modules/task-manager/remove-subtask.js b/scripts/modules/task-manager/remove-subtask.js index 5f096c05..7677f32c 100644 --- a/scripts/modules/task-manager/remove-subtask.js +++ b/scripts/modules/task-manager/remove-subtask.js @@ -1,6 +1,4 @@ -import path from 'path'; import { log, readJSON, writeJSON } from '../utils.js'; -import generateTaskFiles from './generate-task-files.js'; /** * Remove a subtask from its parent task @@ -108,11 +106,7 @@ async function removeSubtask( // Write the updated tasks back to the file with proper context writeJSON(tasksPath, data, projectRoot, tag); - // Generate task files if requested - if (generateFiles) { - log('info', 'Regenerating task files...'); - await generateTaskFiles(tasksPath, path.dirname(tasksPath), context); - } + // Note: Task file generation is no longer supported and has been removed return convertedTask; } catch (error) { diff --git a/tests/unit/scripts/modules/task-manager/add-subtask.test.js b/tests/unit/scripts/modules/task-manager/add-subtask.test.js index eeaf6ef7..6fc87a94 100644 --- a/tests/unit/scripts/modules/task-manager/add-subtask.test.js +++ b/tests/unit/scripts/modules/task-manager/add-subtask.test.js @@ -94,7 +94,6 @@ describe('addSubtask function', () => { const parentTask = writeCallArgs.tasks.find((t) => t.id === 1); expect(parentTask.subtasks).toHaveLength(1); expect(parentTask.subtasks[0].title).toBe('New Subtask'); - expect(mockGenerateTaskFiles).toHaveBeenCalled(); }); test('should convert an existing task to a subtask', async () => { diff --git a/tests/unit/scripts/modules/task-manager/move-task.test.js b/tests/unit/scripts/modules/task-manager/move-task.test.js index a3df27fd..aadcd6f5 100644 --- a/tests/unit/scripts/modules/task-manager/move-task.test.js +++ b/tests/unit/scripts/modules/task-manager/move-task.test.js @@ -88,11 +88,6 @@ describe('moveTask (unit)', () => { ).rejects.toThrow(/Number of source IDs/); }); - test('batch move calls generateTaskFiles once when flag true', async () => { - await moveTask('tasks.json', '1,2', '3,4', true, { tag: 'master' }); - expect(generateTaskFiles).toHaveBeenCalledTimes(1); - }); - test('error when tag invalid', async () => { await expect( moveTask('tasks.json', '1', '2', false, { tag: 'ghost' })