Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

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

Parthy77cc5e453739
diff --git a/.changeset/fresh-bugs-squashed.md b/.changeset/fresh-bugs-squashed.md
new file mode 100644
index 00000000..a691a67a
--- /dev/null
+++ b/.changeset/fresh-bugs-squashed.md
@@ -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.
\ No newline at end of file
diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js
index 25469ee5..f2b9441f 100644
--- a/scripts/modules/commands.js
+++ b/scripts/modules/commands.js
@@ -2381,7 +2381,8 @@ ${result.result}
.action(async (taskId, options) => {
// Initialize TaskMaster
const initOptions = {
- tasksPath: options.file || true
+ tasksPath: options.file || true,
+ tag: options.tag
};
// Only pass complexityReportPath if user provided a custom path
if (options.report && options.report !== COMPLEXITY_REPORT_FILE) {
@@ -4483,11 +4484,13 @@ Examples:
TASKMASTER_TASKS_FILE
)
.option('--show-metadata', 'Show detailed metadata for each tag')
+ .option('--tag <tag>', 'Specify tag context for task operations')
.action(async (options) => {
try {
// Initialize TaskMaster
const taskMaster = initTaskMaster({
- tasksPath: options.file || true
+ tasksPath: options.file || true,
+ tag: options.tag
});
const tasksPath = taskMaster.getTasksPath();
diff --git a/scripts/modules/task-manager/expand-all-tasks.js b/scripts/modules/task-manager/expand-all-tasks.js
index 8e5a2255..3f966897 100644
--- a/scripts/modules/task-manager/expand-all-tasks.js
+++ b/scripts/modules/task-manager/expand-all-tasks.js
@@ -22,6 +22,7 @@ import boxen from 'boxen';
* @param {Object} [context.mcpLog] - MCP logger object.
* @param {string} [context.projectRoot] - Project root path
* @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'.
* @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 = {},
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 projectRoot = providedProjectRoot || findProjectRoot();
@@ -126,7 +133,12 @@ async function expandAllTasks(
numSubtasks,
useResearch,
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
);
expandedCount++;