fix: remove deprecated generateTaskFiles calls from MCP tools (#1277)
Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Resolves issue #1271 - MCP Connection Closed Error After Upgrading to v0.27.3
This commit is contained in:
5
.changeset/fix-mcp-connection-errors.md
Normal file
5
.changeset/fix-mcp-connection-errors.md
Normal file
@@ -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.
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
import path from 'path';
|
|
||||||
|
|
||||||
import { log, readJSON, writeJSON, getCurrentTag } from '../utils.js';
|
import { log, readJSON, writeJSON, getCurrentTag } from '../utils.js';
|
||||||
import { isTaskDependentOn } from '../task-manager.js';
|
import { isTaskDependentOn } from '../task-manager.js';
|
||||||
import generateTaskFiles from './generate-task-files.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a subtask to a parent task
|
* 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
|
// Write the updated tasks back to the file with proper context
|
||||||
writeJSON(tasksPath, data, projectRoot, tag);
|
writeJSON(tasksPath, data, projectRoot, tag);
|
||||||
|
|
||||||
// Generate task files if requested
|
// Note: Task file generation is no longer supported and has been removed
|
||||||
if (generateFiles) {
|
|
||||||
log('info', 'Regenerating task files...');
|
|
||||||
await generateTaskFiles(tasksPath, path.dirname(tasksPath), context);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newSubtask;
|
return newSubtask;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
setTasksForTag,
|
setTasksForTag,
|
||||||
traverseDependencies
|
traverseDependencies
|
||||||
} from '../utils.js';
|
} from '../utils.js';
|
||||||
import generateTaskFiles from './generate-task-files.js';
|
|
||||||
import {
|
import {
|
||||||
findCrossTagDependencies,
|
findCrossTagDependencies,
|
||||||
getDependentTaskIds,
|
getDependentTaskIds,
|
||||||
@@ -142,13 +141,7 @@ async function moveTask(
|
|||||||
results.push(result);
|
results.push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate files once at the end if requested
|
// Note: Task file generation is no longer supported and has been removed
|
||||||
if (generateFiles) {
|
|
||||||
await generateTaskFiles(tasksPath, path.dirname(tasksPath), {
|
|
||||||
tag: tag,
|
|
||||||
projectRoot: projectRoot
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message: `Successfully moved ${sourceIds.length} tasks/subtasks`,
|
message: `Successfully moved ${sourceIds.length} tasks/subtasks`,
|
||||||
@@ -209,12 +202,7 @@ async function moveTask(
|
|||||||
// The writeJSON function will filter out _rawTaggedData automatically
|
// The writeJSON function will filter out _rawTaggedData automatically
|
||||||
writeJSON(tasksPath, rawData, options.projectRoot, tag);
|
writeJSON(tasksPath, rawData, options.projectRoot, tag);
|
||||||
|
|
||||||
if (generateFiles) {
|
// Note: Task file generation is no longer supported and has been removed
|
||||||
await generateTaskFiles(tasksPath, path.dirname(tasksPath), {
|
|
||||||
tag: tag,
|
|
||||||
projectRoot: projectRoot
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import path from 'path';
|
|
||||||
import { log, readJSON, writeJSON } from '../utils.js';
|
import { log, readJSON, writeJSON } from '../utils.js';
|
||||||
import generateTaskFiles from './generate-task-files.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a subtask from its parent task
|
* 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
|
// Write the updated tasks back to the file with proper context
|
||||||
writeJSON(tasksPath, data, projectRoot, tag);
|
writeJSON(tasksPath, data, projectRoot, tag);
|
||||||
|
|
||||||
// Generate task files if requested
|
// Note: Task file generation is no longer supported and has been removed
|
||||||
if (generateFiles) {
|
|
||||||
log('info', 'Regenerating task files...');
|
|
||||||
await generateTaskFiles(tasksPath, path.dirname(tasksPath), context);
|
|
||||||
}
|
|
||||||
|
|
||||||
return convertedTask;
|
return convertedTask;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ describe('addSubtask function', () => {
|
|||||||
const parentTask = writeCallArgs.tasks.find((t) => t.id === 1);
|
const parentTask = writeCallArgs.tasks.find((t) => t.id === 1);
|
||||||
expect(parentTask.subtasks).toHaveLength(1);
|
expect(parentTask.subtasks).toHaveLength(1);
|
||||||
expect(parentTask.subtasks[0].title).toBe('New Subtask');
|
expect(parentTask.subtasks[0].title).toBe('New Subtask');
|
||||||
expect(mockGenerateTaskFiles).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should convert an existing task to a subtask', async () => {
|
test('should convert an existing task to a subtask', async () => {
|
||||||
|
|||||||
@@ -88,11 +88,6 @@ describe('moveTask (unit)', () => {
|
|||||||
).rejects.toThrow(/Number of source IDs/);
|
).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 () => {
|
test('error when tag invalid', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
moveTask('tasks.json', '1', '2', false, { tag: 'ghost' })
|
moveTask('tasks.json', '1', '2', false, { tag: 'ghost' })
|
||||||
|
|||||||
Reference in New Issue
Block a user