feat(tags): Complete show and add-task command tag support

- show command: Added --tag flag, fixed projectRoot passing to UI functions
- add-task command: Already had proper tag support and projectRoot handling
- Both commands now work correctly with tagged task lists system
- Migration logic works properly when viewing and adding tasks
- Updated subtask 103.5 with progress on high-priority command fixes
This commit is contained in:
Eyal Toledano
2025-06-12 22:20:22 -04:00
parent b28479a09d
commit 5d9748af89
4 changed files with 157 additions and 16 deletions

View File

@@ -1776,6 +1776,7 @@ ${result.result}
'-r, --research',
'Whether to use research capabilities for task creation'
)
.option('--tag <tag>', 'Specify tag context for task operations')
.action(async (options) => {
const isManualCreation = options.title && options.description;
@@ -1800,6 +1801,10 @@ ${result.result}
// Correctly determine projectRoot
const projectRoot = findProjectRoot();
if (!projectRoot) {
console.error(chalk.red('Error: Could not find project root.'));
process.exit(1);
}
let manualTaskData = null;
if (isManualCreation) {
@@ -1835,6 +1840,7 @@ ${result.result}
const context = {
projectRoot,
tag: options.tag,
commandName: 'add-task',
outputType: 'cli'
};
@@ -1907,9 +1913,17 @@ ${result.result}
'Path to the complexity report file',
COMPLEXITY_REPORT_FILE
)
.option('--tag <tag>', 'Specify tag context for task operations')
.action(async (taskId, options) => {
const projectRoot = findProjectRoot();
if (!projectRoot) {
console.error(chalk.red('Error: Could not find project root.'));
process.exit(1);
}
const idArg = taskId || options.id;
const statusFilter = options.status;
const tag = options.tag;
if (!idArg) {
console.error(chalk.red('Error: Please provide a task ID'));
@@ -1931,11 +1945,19 @@ ${result.result}
tasksPath,
taskIds,
reportPath,
statusFilter
statusFilter,
{ projectRoot, tag }
);
} else {
// Single task - use detailed view
await displayTaskById(tasksPath, taskIds[0], reportPath, statusFilter);
await displayTaskById(
tasksPath,
taskIds[0],
reportPath,
statusFilter,
tag,
{ projectRoot }
);
}
});

View File

@@ -1177,10 +1177,14 @@ async function displayTaskById(
taskId,
complexityReportPath = null,
statusFilter = null,
tag = null
tag = null,
context = {}
) {
// Read the tasks file
const data = readJSON(tasksPath, tag);
// Extract projectRoot from context
const projectRoot = context.projectRoot || null;
// Read the tasks file with proper projectRoot for tag resolution
const data = readJSON(tasksPath, projectRoot, tag);
if (!data || !data.tasks) {
log('error', 'No valid tasks found.');
process.exit(1);
@@ -2220,17 +2224,23 @@ function displayAiUsageSummary(telemetryData, outputType = 'cli') {
* @param {Array<string>} taskIds - Array of task IDs to display
* @param {string} complexityReportPath - Path to complexity report
* @param {string} statusFilter - Optional status filter for subtasks
* @param {Object} context - Optional context object containing projectRoot and tag
*/
async function displayMultipleTasksSummary(
tasksPath,
taskIds,
complexityReportPath = null,
statusFilter = null
statusFilter = null,
context = {}
) {
displayBanner();
// Read the tasks file
const data = readJSON(tasksPath);
// Extract projectRoot and tag from context
const projectRoot = context.projectRoot || null;
const tag = context.tag || null;
// Read the tasks file with proper projectRoot for tag resolution
const data = readJSON(tasksPath, projectRoot, tag);
if (!data || !data.tasks) {
log('error', 'No valid tasks found.');
process.exit(1);
@@ -2564,7 +2574,9 @@ async function displayMultipleTasksSummary(
tasksPath,
choice.trim(),
complexityReportPath,
statusFilter
statusFilter,
tag,
context
);
}
} else {