feat(tags): Complete tagged task lists system with enhanced use-tag command

- Multi-context task management with full CLI support
- Enhanced use-tag command shows next available task after switching
- Universal --tag flag support across all commands
- Seamless migration with zero disruption
- Complete tag management suite (add, delete, rename, copy, list)
- Smart confirmation logic and data integrity protection
- State management and configuration integration
- Real-world use cases for teams, features, and releases
This commit is contained in:
Eyal Toledano
2025-06-13 03:21:20 -04:00
parent 6b929fa9fa
commit 3db62b5b88
5 changed files with 210 additions and 67 deletions

View File

@@ -2,34 +2,124 @@
"task-master-ai": minor
---
Implements core tagged task lists system with full CLI support
Introduces Tagged Lists: AI Multi-Context Task Management System
This release adds tagged task lists for multi-context task management, enabling users to organize tasks into separate contexts like "master", "feature-branch", teammate names or "v2" without conflicts.
This major release introduces Tagged Lists, a comprehensive system that transforms Task Master into a multi-context task management powerhouse. You can now organize tasks into completely isolated contexts, enabling parallel (agentic) development workflows, team collaboration, and project experimentation without conflicts.
**New Features:**
**🏷️ Tagged Task Lists Architecture:**
- **Complete Tag Management CLI**: Full suite of tag commands (`tags`, `add-tag`, `delete-tag`, `use-tag`, `rename-tag`, `copy-tag`)
- **Tagged Task Lists**: Organize tasks into separate contexts with complete isolation between tags
- **Seamless Migration**: Existing projects automatically migrate to use a "master" tag with zero disruption
- **Enhanced Delete Confirmation**: Double confirmation with inquirer prompts for destructive tag operations
- **Master Tag Metadata**: Automatic metadata enhancement for existing tags with creation dates and descriptions
- **Dynamic Task Counting**: Real-time task count calculation without stored counters
- **Full Terminal Width Tables**: Responsive table layouts that adapt to terminal size
- **Backward Compatibility**: All existing commands continue to work exactly as before
The new tagged system fundamentally changes how tasks are organized:
- **Legacy Format**: `{ "tasks": [...] }`
- **New Tagged Format**: `{ "master": { "tasks": [...], "metadata": {...} }, "feature-xyz": { "tasks": [...], "metadata": {...} } }`
- **Automatic Migration**: Existing projects seamlessly migrate to tagged format with zero user intervention
- **State Management**: New `.taskmaster/state.json` tracks current tag, last switched time, and migration status
- **Configuration Integration**: Enhanced `.taskmaster/config.json` with tag-specific settings and defaults
**Tag Management Commands:**
**🚀 Complete Tag Management Suite:**
- `task-master tags [--show-metadata]` - List all available tags with task counts and metadata
- `task-master add-tag <name> [--copy-from-current] [--copy-from=<tag>] [-d="<desc>"]` - Create new tag contexts
- `task-master delete-tag <name> [--yes]` - Delete tags with double confirmation (changed from `--force` to `--yes`)
- `task-master use-tag <name>` - Switch between tag contexts
- `task-master rename-tag <old> <new>` - Rename existing tags
- `task-master copy-tag <source> <target> [-d="<desc>"]` - Copy tags to create new contexts
**Core Tag Commands:**
- `task-master tags [--show-metadata]` - List all tags with task counts, completion stats, and metadata
- `task-master add-tag <name> [options]` - Create new tag contexts with optional task copying
- `task-master delete-tag <name> [--yes]` - Delete tags with double confirmation protection
- `task-master use-tag <name>` - Switch contexts and immediately see next available task
- `task-master rename-tag <old> <new>` - Rename tags with automatic current tag reference updates
- `task-master copy-tag <source> <target> [options]` - Duplicate tag contexts for experimentation
**Migration & Compatibility:**
**Tag Creation Options:**
- `--copy-from-current` - Copy tasks from currently active tag
- `--copy-from=<tag>` - Copy tasks from specific tag
- `--description="<text>"` - Add custom tag descriptions
- Empty tag creation for fresh contexts
- Existing `tasks.json` files are automatically migrated to tagged format
- Master tag gets proper metadata (creation date, description) during migration
**🎯 Universal --tag Flag Support:**
Every task operation now supports tag-specific execution:
- `task-master list --tag=feature-branch` - View tasks in specific context
- `task-master add-task --tag=experiment --prompt="..."` - Create tasks in specific tag
- `task-master parse-prd document.txt --tag=v2-redesign` - Parse PRDs into dedicated contexts
- `task-master analyze-complexity --tag=performance-work` - Generate tag-specific reports
- `task-master set-status --tag=hotfix --id=5 --status=done` - Update tasks in specific contexts
- `task-master expand --tag=research --id=3` - Break down tasks within tag contexts
**📊 Enhanced Workflow Features:**
**Smart Context Switching:**
- `use-tag` command shows immediate next task after switching
- Automatic tag creation when targeting non-existent tags
- Current tag persistence across terminal sessions
- Branch-tag mapping for future Git integration
**Intelligent File Management:**
- Tag-specific complexity reports: `task-complexity-report_tagname.json`
- Master tag uses default filenames: `task-complexity-report.json`
- Automatic file isolation prevents cross-tag contamination
**Advanced Confirmation Logic:**
- Commands only prompt when target tag has existing tasks
- Empty tags allow immediate operations without confirmation
- Smart append vs overwrite detection
**🔄 Seamless Migration & Compatibility:**
**Zero-Disruption Migration:**
- Existing `tasks.json` files automatically migrate on first command
- Master tag receives proper metadata (creation date, description)
- Migration notice shown once with helpful explanation
- All existing commands work identically to before
**State Management:**
- `.taskmaster/state.json` tracks current tag and migration status
- Automatic state creation and maintenance
- Branch-tag mapping foundation for Git integration
- Migration notice tracking to avoid repeated notifications
- Grounds for future context additions
**Backward Compatibility:**
- All existing workflows continue unchanged
- Silent migration with user-friendly notifications
- Legacy commands work exactly as before
- Gradual adoption - users can ignore tags entirely if desired
- No breaking changes to existing tasks or file formats
**💡 Real-World Use Cases:**
**Team Collaboration:**
- `task-master add-tag alice --copy-from-current` - Create teammate-specific contexts
- `task-master add-tag bob --copy-from=master` - Onboard new team members
- `task-master use-tag alice` - Switch to teammate's work context
**Feature Development:**
- `task-master parse-prd feature-spec.txt --tag=user-auth` - Dedicated feature planning
- `task-master add-tag experiment --copy-from=user-auth` - Safe experimentation
- `task-master analyze-complexity --tag=user-auth` - Feature-specific analysis
**Release Management:**
- `task-master add-tag v2.0 --description="Next major release"` - Version-specific planning
- `task-master copy-tag master v2.1` - Release branch preparation
- `task-master use-tag hotfix` - Emergency fix context
**Project Phases:**
- `task-master add-tag research --description="Discovery phase"` - Research tasks
- `task-master add-tag implementation --copy-from=research` - Development phase
- `task-master add-tag testing --copy-from=implementation` - QA phase
**🛠️ Technical Implementation:**
**Data Structure:**
- Tagged format with complete isolation between contexts
- Rich metadata per tag (creation date, description, update tracking)
- Automatic metadata enhancement for existing tags
- Clean separation of tag data and internal state
**Performance Optimizations:**
- Dynamic task counting without stored counters
- Efficient tag resolution and caching
- Minimal file I/O with smart data loading
- Responsive table layouts adapting to terminal width
**Error Handling:**
- Comprehensive validation for tag names (alphanumeric, hyphens, underscores)
- Reserved name protection (master, main, default)
- Graceful handling of missing tags and corrupted data
- Detailed error messages with suggested corrections
This release establishes the foundation for advanced multi-context workflows while maintaining the simplicity and power that makes Task Master effective for individual developers.

View File

@@ -0,0 +1,53 @@
{
"meta": {
"generatedAt": "2025-06-13T06:52:00.611Z",
"tasksAnalyzed": 5,
"totalTasks": 5,
"analysisCount": 5,
"thresholdScore": 5,
"projectName": "Taskmaster",
"usedResearch": true
},
"complexityAnalysis": [
{
"taskId": 1,
"taskTitle": "Setup Project Repository and Node.js Environment",
"complexityScore": 4,
"recommendedSubtasks": 6,
"expansionPrompt": "Break down the setup process into subtasks such as initializing npm, creating directory structure, installing dependencies, configuring package.json, adding configuration files, and setting up the main entry point.",
"reasoning": "This task involves several standard setup steps that are well-defined and sequential, with low algorithmic complexity but moderate procedural detail. Each step is independent and can be assigned as a subtask, making the overall complexity moderate."
},
{
"taskId": 2,
"taskTitle": "Implement Core Functionality and CLI Interface",
"complexityScore": 7,
"recommendedSubtasks": 7,
"expansionPrompt": "Expand into subtasks for implementing main logic, designing CLI commands, creating the CLI entry point, integrating business logic, adding error handling, formatting output, and ensuring CLI executability.",
"reasoning": "This task requires both application logic and user interface (CLI) development, including error handling and integration. The need to coordinate between core logic and CLI, plus ensuring usability, increases complexity and warrants detailed subtasking."
},
{
"taskId": 3,
"taskTitle": "Implement Testing Suite and Validation",
"complexityScore": 6,
"recommendedSubtasks": 6,
"expansionPrompt": "Divide into subtasks for configuring Jest, writing unit tests, writing integration tests, testing CLI commands, setting up coverage reporting, and preparing test fixtures/mocks.",
"reasoning": "Comprehensive testing involves multiple types of tests and configuration steps. While each is straightforward, the breadth of coverage and need for automation and validation increases the overall complexity."
},
{
"taskId": 4,
"taskTitle": "Setup Node.js Project with CLI Interface",
"complexityScore": 5,
"recommendedSubtasks": 7,
"expansionPrompt": "Break down into subtasks for npm initialization, package.json setup, directory structure creation, dependency installation, CLI entry point creation, package.json bin configuration, and CLI executability.",
"reasoning": "This task combines project setup with initial CLI implementation. While each step is standard, the integration of CLI elements adds a layer of complexity beyond a basic setup."
},
{
"taskId": 5,
"taskTitle": "Implement Core Functionality with Testing",
"complexityScore": 8,
"recommendedSubtasks": 8,
"expansionPrompt": "Expand into subtasks for implementing each feature (A, B, C), setting up the testing framework, writing tests for each feature, integrating CLI with core logic, and adding coverage reporting.",
"reasoning": "This task requires simultaneous development of multiple features, integration with CLI, and comprehensive testing. The coordination and depth required for both implementation and validation make it the most complex among the listed tasks."
}
]
}

View File

@@ -1,6 +1,6 @@
{
"currentTag": "test-prd-tag",
"lastSwitched": "2025-06-13T06:07:05.204Z",
"currentTag": "master",
"lastSwitched": "2025-06-13T07:11:05.210Z",
"branchTagMapping": {},
"migrationNoticeShown": true
}

File diff suppressed because one or more lines are too long

View File

@@ -17,6 +17,7 @@ import {
truncate
} from '../utils.js';
import { displayBanner, getStatusWithColor } from '../ui.js';
import findNextTask from './find-next-task.js';
/**
* Create a new tag context
@@ -734,10 +735,14 @@ async function useTag(
// Switch to the new tag
await switchCurrentTag(projectRoot, tagName);
// Get task count for the new tag
const tasks = getTasksForTag(data, tagName);
// Get task count for the new tag - read tasks specifically for this tag
const tagData = readJSON(tasksPath, projectRoot, tagName);
const tasks = tagData ? tagData.tasks || [] : [];
const taskCount = tasks.length;
// Find the next task to work on in this tag
const nextTask = findNextTask(tasks);
logFn.success(`Successfully switched to tag "${tagName}"`);
// For JSON output, return structured data
@@ -746,18 +751,27 @@ async function useTag(
previousTag,
currentTag: tagName,
switched: true,
taskCount
taskCount,
nextTask
};
}
// For text output, display success message
if (outputFormat === 'text') {
let nextTaskInfo = '';
if (nextTask) {
nextTaskInfo = `\nNext Task: ${chalk.cyan(`#${nextTask.id}`)} - ${chalk.white(nextTask.title)}`;
} else {
nextTaskInfo = `\nNext Task: ${chalk.gray('No eligible tasks available')}`;
}
console.log(
boxen(
chalk.green.bold('✓ Tag Switched Successfully') +
`\n\nPrevious Tag: ${chalk.cyan(previousTag)}` +
`\nCurrent Tag: ${chalk.green.bold(tagName)}` +
`\nAvailable Tasks: ${chalk.yellow(taskCount)}`,
`\nAvailable Tasks: ${chalk.yellow(taskCount)}` +
nextTaskInfo,
{
padding: 1,
borderColor: 'green',
@@ -772,7 +786,8 @@ async function useTag(
previousTag,
currentTag: tagName,
switched: true,
taskCount
taskCount,
nextTask
};
} catch (error) {
logFn.error(`Error switching tag: ${error.message}`);