Merge branch 'next' of github.com:eyaltoledano/claude-task-master into add-complexity-score-to-task
This commit is contained in:
@@ -21,12 +21,13 @@ import {
|
||||
* @param {string} args.tasksJsonPath - Explicit path to the tasks.json file.
|
||||
* @param {string} args.id - The ID of the task or subtask to show.
|
||||
* @param {string} args.reportPath - Explicit path to the complexity report file.
|
||||
* @param {string} [args.status] - Optional status to filter subtasks by.
|
||||
* @param {Object} log - Logger object
|
||||
* @returns {Promise<Object>} - Task details result { success: boolean, data?: any, error?: { code: string, message: string }, fromCache: boolean }
|
||||
*/
|
||||
export async function showTaskDirect(args, log) {
|
||||
// Destructure expected args
|
||||
const { tasksJsonPath, reportPath, id } = args;
|
||||
const { tasksJsonPath, reportPath, id, status } = args;
|
||||
|
||||
if (!tasksJsonPath) {
|
||||
log.error('showTaskDirect called without tasksJsonPath');
|
||||
@@ -54,8 +55,8 @@ export async function showTaskDirect(args, log) {
|
||||
};
|
||||
}
|
||||
|
||||
// Generate cache key using the provided task path and ID
|
||||
const cacheKey = `showTask:${tasksJsonPath}:${taskId}:${reportPath}`;
|
||||
// Generate cache key using the provided task path, ID, report path, and status filter
|
||||
const cacheKey = `showTask:${tasksJsonPath}:${taskId}:${reportPath}:${status || 'all'}`;
|
||||
|
||||
// Define the action function to be executed on cache miss
|
||||
const coreShowTaskAction = async () => {
|
||||
@@ -64,7 +65,7 @@ export async function showTaskDirect(args, log) {
|
||||
enableSilentMode();
|
||||
|
||||
log.info(
|
||||
`Retrieving task details for ID: ${taskId} from ${tasksJsonPath}`
|
||||
`Retrieving task details for ID: ${taskId} from ${tasksJsonPath}${status ? ` (filtering by status: ${status})` : ''}`
|
||||
);
|
||||
|
||||
// Read tasks data using the provided path
|
||||
@@ -83,8 +84,13 @@ export async function showTaskDirect(args, log) {
|
||||
// Read the complexity report
|
||||
const complexityReport = readComplexityReport(reportPath);
|
||||
|
||||
// Find the specific task
|
||||
const task = findTaskById(data.tasks, taskId, complexityReport);
|
||||
// Find the specific task, passing the status filter
|
||||
const { task, originalSubtaskCount } = findTaskById(
|
||||
data.tasks,
|
||||
taskId,
|
||||
complexityReport,
|
||||
status
|
||||
);
|
||||
|
||||
if (!task) {
|
||||
disableSilentMode(); // Disable before returning
|
||||
@@ -92,7 +98,7 @@ export async function showTaskDirect(args, log) {
|
||||
success: false,
|
||||
error: {
|
||||
code: 'TASK_NOT_FOUND',
|
||||
message: `Task with ID ${taskId} not found`
|
||||
message: `Task with ID ${taskId} not found${status ? ` or no subtasks match status '${status}'` : ''}`
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -100,13 +106,16 @@ export async function showTaskDirect(args, log) {
|
||||
// Restore normal logging
|
||||
disableSilentMode();
|
||||
|
||||
// Return the task data with the full tasks array for reference
|
||||
// (needed for formatDependenciesWithStatus function in UI)
|
||||
log.info(`Successfully found task ${taskId}`);
|
||||
// Return the task data, the original subtask count (if applicable),
|
||||
// and the full tasks array for reference (needed for formatDependenciesWithStatus function in UI)
|
||||
log.info(
|
||||
`Successfully found task ${taskId}${status ? ` (with status filter: ${status})` : ''}`
|
||||
);
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
task,
|
||||
originalSubtaskCount,
|
||||
allTasks: data.tasks
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user