diff --git a/.taskmaster/tasks/tasks.json b/.taskmaster/tasks/tasks.json index c6be85fe..6cbe9cb4 100644 --- a/.taskmaster/tasks/tasks.json +++ b/.taskmaster/tasks/tasks.json @@ -6681,7 +6681,7 @@ "id": 17, "title": "Implement Task Template Importing from External .json Files", "description": "Implement a mechanism to import tasks from external .json files, treating them as task templates. This allows users to add new .json files to the .taskmaster/tasks folder. The system should read these files, extract tasks under a specific tag, and merge them into the main tasks.json. The 'master' tag from template files must be ignored to prevent conflicts, and the primary tasks.json file will always take precedence over imported tags.", - "details": "Key implementation steps: 1. Develop a file watcher or a manual import command to detect and process new .json files in the tasks directory. 2. Implement logic to read an external json file, identify the tag key, and extract the array of tasks. 3. Handle potential conflicts: if an imported tag already exists in the main tasks.json, the existing tasks should be preserved and new ones appended, or the import should be skipped based on a defined precedence rule. 4. Ignore any 'master' key in template files to protect the integrity of the main task list. 5. Update task ID sequencing to ensure imported tasks are assigned unique IDs that don't conflict with existing tasks.\n\n**UPDATED IMPLEMENTATION PLAN - Silent Task Template Discovery**\n\n**Core Architecture Changes**:\n- Replace manual import workflow with automatic file discovery during tag operations\n- Implement file pattern matching for `tasks_*.json` files in tasks directory\n- Create seamless tag resolution system that checks external files when tags not found in main tasks.json\n\n**Silent Discovery Mechanism**:\n- Scan for `tasks_*.json` files during any tag-related operation (list-tags, use-tag, etc.)\n- Extract tag names from filenames and validate against internal tag keys\n- Build dynamic tag registry combining main tasks.json tags with discovered external tags\n- Apply precedence rule: main tasks.json tags override external files with same tag name\n\n**File Naming and Structure Convention**:\n- External files follow pattern: `tasks_[tagname].json` where tagname must match internal tag key\n- Files contain same structure as main tasks.json but only the specific tag section is used\n- Master key in external files is ignored to prevent conflicts with main task list\n\n**Key Implementation Updates**:\n- Enhance `getAvailableTags()` to include filesystem scan and merge results\n- Modify tag resolution logic to check external files as fallback when tag missing from main file\n- Update `listTags()` to display external tags with visual indicator (e.g., \"[ext]\" suffix)\n- Implement read-only access for external tags - all task modifications route to main tasks.json\n- Add error handling for malformed external files without breaking core functionality\n\n**User Experience Flow**:\n- Users drop `tasks_projectname.json` files into tasks directory\n- Tags become immediately available via `task-master use-tag projectname`\n- No manual import commands or configuration required\n- External tags appear in tag listings alongside main tags\n\n**Benefits Over Manual Import**:\n- Zero-friction workflow for adding new task contexts\n- Supports team collaboration through shared task template files\n- Enables multi-project task management without cluttering main tasks.json\n- Maintains clean separation between permanent tasks and temporary project contexts\n\n\n**Tag Preservation Bug Fix Testing**\n\nConducted testing to verify the fix for the tag preservation bug where tag structures were being lost during operations. The fix ensures that:\n\n- Tag hierarchies and relationships are maintained during file discovery operations\n- External tag files preserve their internal structure when accessed through the silent discovery mechanism\n- Main tasks.json tag integrity is protected during external file scanning\n- Tag metadata and associations remain intact across read operations\n- No data corruption occurs when switching between main and external tag contexts\n\nTesting confirmed that tag structures now persist correctly without loss of organizational data or task relationships within tagged contexts.\n\n\n**MCP Server Update-Subtask Tool Testing**\n\nPerformed testing of the MCP server's update-subtask tool to verify it maintains tag structure integrity during subtask modifications. The test confirms that:\n\n- Tag hierarchies remain intact when subtasks are updated through the MCP interface\n- External tag file references are preserved during update operations\n- Silent discovery mechanism continues to function correctly after subtask modifications\n- No tag disappearance occurs when using the MCP server tools for task management\n- Tag preservation fixes remain effective across different update pathways including MCP server operations\n\nThis validates that the tag structure preservation improvements work consistently across both direct CLI operations and MCP server-mediated task updates.\n\n\n**IMPLEMENTATION STARTED - External File Discovery System**\n\n**Current Progress:**\n- ✅ Analyzed existing tag management architecture\n- ✅ Identified integration points in `readJSON`, `tags()`, and tag resolution logic\n- ✅ Confirmed file naming convention: `tasks_[tagname].json` pattern\n- 🔄 **STARTING**: Implementation of core external file discovery functions\n\n**Implementation Plan:**\n1. **Create External File Discovery Functions** in `utils.js`:\n - `scanForExternalTaskFiles(projectRoot)` - Scan tasks directory for `tasks_*.json` files\n - `getExternalTagsFromFiles(projectRoot)` - Extract tag names from external files\n - `readExternalTagData(projectRoot, tagName)` - Read specific external tag data\n - `getAvailableTags(projectRoot)` - Enhanced to include both main + external tags\n\n2. **Enhance Tag Resolution Logic** in `readJSON`:\n - Add fallback to external files when tag not found in main tasks.json\n - Maintain precedence: main tasks.json tags override external files\n - Preserve read-only access for external tags\n\n3. **Update `tags()` Function** in `tag-management.js`:\n - Display external tags with `[ext]` indicator\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n4. **Integration Points**:\n - `readJSON()` - Add external file fallback in tag resolution\n - `tags()` - Include external tags in listing\n - `useTag()` - Support switching to external tags\n - All tag operations maintain read-only access for external tags\n\n**Next Step:** Implementing external file discovery functions in utils.js\n\n\n**IMPLEMENTATION PROGRESS UPDATE - External File Discovery System**\n\n**Current Status:**\n- ✅ Analyzed existing tag management architecture\n- ✅ Identified integration points in `readJSON`, `tags()`, and tag resolution logic\n- ✅ Confirmed file naming convention: `tasks_[tagname].json` pattern\n- 🔄 **IN PROGRESS**: Implementation of core external file discovery functions\n\n**Updated Implementation Plan:**\n1. **Create External File Discovery Functions** in `utils.js`:\n - `scanForExternalTaskFiles(projectRoot)` - Scan tasks directory for `tasks_*.json` files\n - `getExternalTagsFromFiles(projectRoot)` - Extract tag names from external files\n - `readExternalTagData(projectRoot, tagName)` - Read specific external tag data\n - `getAvailableTags(projectRoot)` - Enhanced to include both main + external tags\n\n2. **Enhance Tag Resolution Logic** in `readJSON`:\n - Add fallback to external files when tag not found in main tasks.json\n - Maintain precedence: main tasks.json tags override external files\n - Preserve read-only access for external tags\n\n3. **Update `tags()` Function** in `tag-management.js`:\n - Display external tags with `(imported)` indicator *(updated from [ext])*\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n4. **Integration Points**:\n - `readJSON()` - Add external file fallback in tag resolution\n - `tags()` - Include external tags in listing with `(imported)` suffix\n - `useTag()` - Support switching to external tags\n - All tag operations maintain read-only access for external tags\n\n**Visual Indicator Change:**\n- **Previous**: External tags shown with `[ext]` suffix\n- **Updated**: External tags shown with `(imported)` suffix for better UX\n\n**Next Step:** Continuing implementation of external file discovery functions in utils.js\n", + "details": "Key implementation steps: 1. Develop a file watcher or a manual import command to detect and process new .json files in the tasks directory. 2. Implement logic to read an external json file, identify the tag key, and extract the array of tasks. 3. Handle potential conflicts: if an imported tag already exists in the main tasks.json, the existing tasks should be preserved and new ones appended, or the import should be skipped based on a defined precedence rule. 4. Ignore any 'master' key in template files to protect the integrity of the main task list. 5. Update task ID sequencing to ensure imported tasks are assigned unique IDs that don't conflict with existing tasks.\n\n**UPDATED IMPLEMENTATION PLAN - Silent Task Template Discovery**\n\n**Core Architecture Changes**:\n- Replace manual import workflow with automatic file discovery during tag operations\n- Implement file pattern matching for `tasks_*.json` files in tasks directory\n- Create seamless tag resolution system that checks external files when tags not found in main tasks.json\n\n**Silent Discovery Mechanism**:\n- Scan for `tasks_*.json` files during any tag-related operation (list-tags, use-tag, etc.)\n- Extract tag names from filenames and validate against internal tag keys\n- Build dynamic tag registry combining main tasks.json tags with discovered external tags\n- Apply precedence rule: main tasks.json tags override external files with same tag name\n\n**File Naming and Structure Convention**:\n- External files follow pattern: `tasks_[tagname].json` where tagname must match internal tag key\n- Files contain same structure as main tasks.json but only the specific tag section is used\n- Master key in external files is ignored to prevent conflicts with main task list\n\n**Key Implementation Updates**:\n- Enhance `getAvailableTags()` to include filesystem scan and merge results\n- Modify tag resolution logic to check external files as fallback when tag missing from main file\n- Update `listTags()` to display external tags with visual indicator (e.g., \"[ext]\" suffix)\n- Implement read-only access for external tags - all task modifications route to main tasks.json\n- Add error handling for malformed external files without breaking core functionality\n\n**User Experience Flow**:\n- Users drop `tasks_projectname.json` files into tasks directory\n- Tags become immediately available via `task-master use-tag projectname`\n- No manual import commands or configuration required\n- External tags appear in tag listings alongside main tags\n\n**Benefits Over Manual Import**:\n- Zero-friction workflow for adding new task contexts\n- Supports team collaboration through shared task template files\n- Enables multi-project task management without cluttering main tasks.json\n- Maintains clean separation between permanent tasks and temporary project contexts\n\n\n**Tag Preservation Bug Fix Testing**\n\nConducted testing to verify the fix for the tag preservation bug where tag structures were being lost during operations. The fix ensures that:\n\n- Tag hierarchies and relationships are maintained during file discovery operations\n- External tag files preserve their internal structure when accessed through the silent discovery mechanism\n- Main tasks.json tag integrity is protected during external file scanning\n- Tag metadata and associations remain intact across read operations\n- No data corruption occurs when switching between main and external tag contexts\n\nTesting confirmed that tag structures now persist correctly without loss of organizational data or task relationships within tagged contexts.\n\n\n**MCP Server Update-Subtask Tool Testing**\n\nPerformed testing of the MCP server's update-subtask tool to verify it maintains tag structure integrity during subtask modifications. The test confirms that:\n\n- Tag hierarchies remain intact when subtasks are updated through the MCP interface\n- External tag file references are preserved during update operations\n- Silent discovery mechanism continues to function correctly after subtask modifications\n- No tag disappearance occurs when using the MCP server tools for task management\n- Tag preservation fixes remain effective across different update pathways including MCP server operations\n\nThis validates that the tag structure preservation improvements work consistently across both direct CLI operations and MCP server-mediated task updates.\n\n\n**IMPLEMENTATION STARTED - External File Discovery System**\n\n**Current Progress:**\n- ✅ Analyzed existing tag management architecture\n- ✅ Identified integration points in `readJSON`, `tags()`, and tag resolution logic\n- ✅ Confirmed file naming convention: `tasks_[tagname].json` pattern\n- 🔄 **STARTING**: Implementation of core external file discovery functions\n\n**Implementation Plan:**\n1. **Create External File Discovery Functions** in `utils.js`:\n - `scanForExternalTaskFiles(projectRoot)` - Scan tasks directory for `tasks_*.json` files\n - `getExternalTagsFromFiles(projectRoot)` - Extract tag names from external files\n - `readExternalTagData(projectRoot, tagName)` - Read specific external tag data\n - `getAvailableTags(projectRoot)` - Enhanced to include both main + external tags\n\n2. **Enhance Tag Resolution Logic** in `readJSON`:\n - Add fallback to external files when tag not found in main tasks.json\n - Maintain precedence: main tasks.json tags override external files\n - Preserve read-only access for external tags\n\n3. **Update `tags()` Function** in `tag-management.js`:\n - Display external tags with `[ext]` indicator\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n4. **Integration Points**:\n - `readJSON()` - Add external file fallback in tag resolution\n - `tags()` - Include external tags in listing\n - `useTag()` - Support switching to external tags\n - All tag operations maintain read-only access for external tags\n\n**Next Step:** Implementing external file discovery functions in utils.js\n\n\n**IMPLEMENTATION PROGRESS UPDATE - External File Discovery System**\n\n**Current Status:**\n- ✅ Analyzed existing tag management architecture\n- ✅ Identified integration points in `readJSON`, `tags()`, and tag resolution logic\n- ✅ Confirmed file naming convention: `tasks_[tagname].json` pattern\n- 🔄 **IN PROGRESS**: Implementation of core external file discovery functions\n\n**Updated Implementation Plan:**\n1. **Create External File Discovery Functions** in `utils.js`:\n - `scanForExternalTaskFiles(projectRoot)` - Scan tasks directory for `tasks_*.json` files\n - `getExternalTagsFromFiles(projectRoot)` - Extract tag names from external files\n - `readExternalTagData(projectRoot, tagName)` - Read specific external tag data\n - `getAvailableTags(projectRoot)` - Enhanced to include both main + external tags\n\n2. **Enhance Tag Resolution Logic** in `readJSON`:\n - Add fallback to external files when tag not found in main tasks.json\n - Maintain precedence: main tasks.json tags override external files\n - Preserve read-only access for external tags\n\n3. **Update `tags()` Function** in `tag-management.js`:\n - Display external tags with `(imported)` indicator *(updated from [ext])*\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n4. **Integration Points**:\n - `readJSON()` - Add external file fallback in tag resolution\n - `tags()` - Include external tags in listing with `(imported)` suffix\n - `useTag()` - Support switching to external tags\n - All tag operations maintain read-only access for external tags\n\n**Visual Indicator Change:**\n- **Previous**: External tags shown with `[ext]` suffix\n- **Updated**: External tags shown with `(imported)` suffix for better UX\n\n**Next Step:** Continuing implementation of external file discovery functions in utils.js\n\n\n**IMPLEMENTATION SIZE ASSESSMENT - External File Discovery System**\n\n**Scope: Moderate Implementation (~150-200 lines total)**\n\n**Core Functions to Add (4-5 functions in utils.js):**\n1. `scanForExternalTaskFiles(projectRoot)` - ~20-30 lines\n - Use fs.readdirSync to scan tasks directory\n - Filter for `tasks_*.json` pattern using regex\n - Return array of discovered external files\n\n2. `getExternalTagsFromFiles(projectRoot)` - ~15-20 lines \n - Call scanForExternalTaskFiles()\n - Extract tag names from filenames using regex\n - Return array of external tag names\n\n3. `readExternalTagData(projectRoot, tagName)` - ~25-35 lines\n - Construct external file path: `tasks/tasks_${tagName}.json`\n - Read and parse JSON with error handling\n - Return tag data or null if not found/invalid\n\n4. `getAvailableTags(projectRoot)` - ~20-30 lines\n - Get main tags from existing readJSON logic\n - Get external tags from getExternalTagsFromFiles()\n - Merge and deduplicate, prioritizing main tags\n - Return combined tag list with metadata\n\n**Integration Points (3 main areas):**\n1. **Enhance `readJSON()` function** - Add ~15-20 lines\n - Add external file fallback when tag not found in main tasks.json\n - Maintain precedence: main tasks.json > external files\n - Preserve existing error handling patterns\n\n2. **Update `tags()` function** in tag-management.js - Modify ~10-15 lines\n - Use enhanced getAvailableTags() instead of current logic\n - Display external tags with `(imported)` indicator\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n3. **Update `useTag()` function** in tag-management.js - Modify ~5-10 lines\n - Allow switching to external tags (read-only mode)\n - Update state.json with external tag context\n - Display appropriate warnings for read-only external tags\n\n**Testing Requirements:**\n- Create test external files: `tasks_feature-branch.json`, `tasks_v2.json`\n- Test tag listing with mixed main/external tags\n- Test tag switching to external tags\n- Test read-only behavior for external tags\n- Test precedence when same tag exists in both main and external\n\n**Total Estimated Lines: ~150-200 lines**\n**Estimated Time: 45-60 minutes**\n**Complexity: Moderate - mostly file I/O and data merging logic**\n", "status": "in-progress", "dependencies": [], "parentTaskId": 103