Fix: Correct tag handling for expand --all and show commands (#1026)

Fix: Correct tag handling for expand --all and show commands
This commit is contained in:
Parthy
2025-07-21 17:35:29 +02:00
committed by Ralph Khreish
parent d31ef7a39c
commit 77cc5e4537
3 changed files with 24 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"task-master-ai": patch
---
Fix 'expand --all' and 'show' commands to correctly handle tag contexts for complexity reports and task display.

View File

@@ -2381,7 +2381,8 @@ ${result.result}
.action(async (taskId, options) => { .action(async (taskId, options) => {
// Initialize TaskMaster // Initialize TaskMaster
const initOptions = { const initOptions = {
tasksPath: options.file || true tasksPath: options.file || true,
tag: options.tag
}; };
// Only pass complexityReportPath if user provided a custom path // Only pass complexityReportPath if user provided a custom path
if (options.report && options.report !== COMPLEXITY_REPORT_FILE) { if (options.report && options.report !== COMPLEXITY_REPORT_FILE) {
@@ -4483,11 +4484,13 @@ Examples:
TASKMASTER_TASKS_FILE TASKMASTER_TASKS_FILE
) )
.option('--show-metadata', 'Show detailed metadata for each tag') .option('--show-metadata', 'Show detailed metadata for each tag')
.option('--tag <tag>', 'Specify tag context for task operations')
.action(async (options) => { .action(async (options) => {
try { try {
// Initialize TaskMaster // Initialize TaskMaster
const taskMaster = initTaskMaster({ const taskMaster = initTaskMaster({
tasksPath: options.file || true tasksPath: options.file || true,
tag: options.tag
}); });
const tasksPath = taskMaster.getTasksPath(); const tasksPath = taskMaster.getTasksPath();

View File

@@ -22,6 +22,7 @@ import boxen from 'boxen';
* @param {Object} [context.mcpLog] - MCP logger object. * @param {Object} [context.mcpLog] - MCP logger object.
* @param {string} [context.projectRoot] - Project root path * @param {string} [context.projectRoot] - Project root path
* @param {string} [context.tag] - Tag for the task * @param {string} [context.tag] - Tag for the task
* @param {string} [context.complexityReportPath] - Path to the complexity report file
* @param {string} [outputFormat='text'] - Output format ('text' or 'json'). MCP calls should use 'json'. * @param {string} [outputFormat='text'] - Output format ('text' or 'json'). MCP calls should use 'json'.
* @returns {Promise<{success: boolean, expandedCount: number, failedCount: number, skippedCount: number, tasksToExpand: number, telemetryData: Array<Object>}>} - Result summary. * @returns {Promise<{success: boolean, expandedCount: number, failedCount: number, skippedCount: number, tasksToExpand: number, telemetryData: Array<Object>}>} - Result summary.
*/ */
@@ -34,7 +35,13 @@ async function expandAllTasks(
context = {}, context = {},
outputFormat = 'text' // Assume text default for CLI outputFormat = 'text' // Assume text default for CLI
) { ) {
const { session, mcpLog, projectRoot: providedProjectRoot, tag } = context; const {
session,
mcpLog,
projectRoot: providedProjectRoot,
tag,
complexityReportPath
} = context;
const isMCPCall = !!mcpLog; // Determine if called from MCP const isMCPCall = !!mcpLog; // Determine if called from MCP
const projectRoot = providedProjectRoot || findProjectRoot(); const projectRoot = providedProjectRoot || findProjectRoot();
@@ -126,7 +133,12 @@ async function expandAllTasks(
numSubtasks, numSubtasks,
useResearch, useResearch,
additionalContext, additionalContext,
{ ...context, projectRoot, tag: data.tag || tag }, // Pass the whole context object with projectRoot and resolved tag {
...context,
projectRoot,
tag: data.tag || tag,
complexityReportPath
}, // Pass the whole context object with projectRoot and resolved tag
force force
); );
expandedCount++; expandedCount++;