Merge branch 'next' of github.com:eyaltoledano/claude-task-master into add-complexity-score-to-task

This commit is contained in:
Shrey Paharia
2025-05-03 16:34:47 +05:30
76 changed files with 3056 additions and 1933 deletions

View File

@@ -7,7 +7,7 @@ import { z } from 'zod';
import {
handleApiResult,
createErrorResponse,
getProjectRootFromSession
withNormalizedProjectRoot
} from './utils.js';
import { nextTaskDirect } from '../core/task-master-core.js';
import {
@@ -36,26 +36,15 @@ export function registerNextTaskTool(server) {
.string()
.describe('The directory of the project. Must be an absolute path.')
}),
execute: async (args, { log, session }) => {
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
try {
log.info(`Finding next task with args: ${JSON.stringify(args)}`);
// Get project root from args or session
const rootFolder =
args.projectRoot || getProjectRootFromSession(session, log);
// Ensure project root was determined
if (!rootFolder) {
return createErrorResponse(
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
);
}
// Resolve the path to tasks.json
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
let tasksJsonPath;
try {
tasksJsonPath = findTasksJsonPath(
{ projectRoot: rootFolder, file: args.file },
{ projectRoot: args.projectRoot, file: args.file },
log
);
} catch (error) {
@@ -78,10 +67,8 @@ export function registerNextTaskTool(server) {
}
const result = await nextTaskDirect(
{
// Pass the explicitly resolved path
tasksJsonPath: tasksJsonPath,
reportPath: complexityReportPath
// No other args specific to this tool
},
log
);
@@ -101,6 +88,6 @@ export function registerNextTaskTool(server) {
log.error(`Error in nextTask tool: ${error.message}`);
return createErrorResponse(error.message);
}
}
})
});
}