fix: improve display of subtasks based on storageType (#1400)

This commit is contained in:
Ralph Khreish
2025-11-12 21:51:24 +01:00
committed by GitHub
parent 63134a222c
commit c62cf845da
5 changed files with 29 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
---
"task-master-ai": patch
---
Fix subtasks not showing parent task when displaying in cli (eg. tm show 10)

View File

@@ -211,7 +211,8 @@ export class NextCommand extends Command {
displayTaskDetails(task, {
customHeader,
headerColor: 'green',
showSuggestedActions: true
showSuggestedActions: true,
storageType: result.storageType
});
}

View File

@@ -272,7 +272,8 @@ export class ShowCommand extends Command {
displayTaskDetails(result.task, {
statusFilter: options.status,
showSuggestedActions: true,
originalTaskId: result.originalTaskId
originalTaskId: result.originalTaskId,
storageType: result.storageType
});
}

View File

@@ -7,6 +7,7 @@
import { spawn } from 'child_process';
import {
type StartTaskResult as CoreStartTaskResult,
type StorageType,
type TmCore,
createTmCore
} from '@tm/core';
@@ -16,8 +17,8 @@ import { Command } from 'commander';
import ora, { type Ora } from 'ora';
import { displayTaskDetails } from '../ui/components/task-detail.component.js';
import { displayError } from '../utils/error-handler.js';
import * as ui from '../utils/ui.js';
import { getProjectRoot } from '../utils/project-root.js';
import * as ui from '../utils/ui.js';
/**
* CLI-specific options interface for the start command
@@ -36,7 +37,7 @@ export interface StartCommandOptions {
* Extends the core result with CLI-specific display information
*/
export interface StartCommandResult extends CoreStartTaskResult {
storageType?: string;
storageType?: Exclude<StorageType, 'auto'>;
}
/**
@@ -366,7 +367,8 @@ export class StartCommand extends Command {
displayTaskDetails(task, {
customHeader: headerText,
headerColor: 'yellow'
headerColor: 'yellow',
storageType: result.storageType
});
// Show claude-code prompt

View File

@@ -3,7 +3,7 @@
* Displays detailed task information in a structured format
*/
import type { Subtask, Task } from '@tm/core';
import type { StorageType, Subtask, Task } from '@tm/core';
import boxen from 'boxen';
import chalk from 'chalk';
import Table from 'cli-table3';
@@ -198,7 +198,9 @@ export function displaySubtasks(
status: any;
description?: string;
dependencies?: string[];
}>
}>,
parentTaskId?: string | number,
storageType?: Exclude<StorageType, 'auto'>
): void {
const terminalWidth = process.stdout.columns * 0.95 || 100;
// Display subtasks header
@@ -233,7 +235,13 @@ export function displaySubtasks(
});
subtasks.forEach((subtask) => {
const subtaskId = String(subtask.id);
// Format subtask ID based on storage type:
// - File storage: Show parent prefix (e.g., 10.1, 10.2)
// - API storage: Show subtask ID only (e.g., 1, 2)
const subtaskId =
storageType === 'file' && parentTaskId
? `${parentTaskId}.${subtask.id}`
: String(subtask.id);
// Format dependencies
const deps =
@@ -285,6 +293,7 @@ export function displayTaskDetails(
customHeader?: string;
headerColor?: string;
originalTaskId?: string;
storageType?: Exclude<StorageType, 'auto'>;
}
): void {
const {
@@ -292,7 +301,8 @@ export function displayTaskDetails(
showSuggestedActions = false,
customHeader,
headerColor = 'blue',
originalTaskId
originalTaskId,
storageType
} = options || {};
// Display header - either custom or default
@@ -338,7 +348,7 @@ export function displayTaskDetails(
console.log(chalk.gray(` No subtasks with status '${statusFilter}'`));
} else if (filteredSubtasks.length > 0) {
console.log(); // Empty line for spacing
displaySubtasks(filteredSubtasks);
displaySubtasks(filteredSubtasks, task.id, storageType);
}
}