fix: added handling for show cli

This commit is contained in:
Shrey Paharia
2025-04-23 21:11:49 +05:30
parent 3628acab78
commit deaf4a6ff4
2 changed files with 21 additions and 7 deletions

View File

@@ -1004,6 +1004,12 @@ async function displayTaskById(tasksPath, taskId, complexityReportPath = null) {
chalk.cyan.bold('Status:'),
getStatusWithColor(task.status || 'pending', true)
],
[
chalk.cyan.bold('Complexity:'),
task.complexityScore
? getComplexityWithColor(task.complexityScore)
: chalk.gray('N/A')
],
[
chalk.cyan.bold('Description:'),
task.description || 'No description provided.'
@@ -1177,6 +1183,12 @@ async function displayTaskById(tasksPath, taskId, complexityReportPath = null) {
complexityReport
) // Pass complexityReport
],
[
chalk.cyan.bold('Complexity:'),
task.complexityScore
? getComplexityWithColor(task.complexityScore)
: chalk.gray('N/A')
],
[chalk.cyan.bold('Description:'), task.description]
);

View File

@@ -281,14 +281,16 @@ function findTaskById(tasks, taskId, complexityReport = null) {
if (taskResult && complexityReport) {
if (complexityReport && complexityReport.complexityAnalysis) {
// For a main task, look for a direct match
if (!taskResult.isSubtask) {
const taskAnalysis = complexityReport.complexityAnalysis.find(
(analysis) => analysis.taskId === taskResult.id
);
const taskId = taskResult.isSubtask
? taskResult.parentTask.id
: taskResult.id;
if (taskAnalysis) {
taskResult.complexityScore = taskAnalysis.complexityScore;
}
const taskAnalysis = complexityReport.complexityAnalysis.find(
(analysis) => analysis.taskId === taskId
);
if (taskAnalysis) {
taskResult.complexityScore = taskAnalysis.complexityScore;
}
}
}