feat: Add skipped tests for task-manager and utils modules, and address potential issues

This commit introduces a comprehensive set of skipped tests to both  and . These skipped tests serve as a blueprint for future test implementation, outlining the necessary test cases for currently untested functionalities.

- Ensures sync with bin/ folder by adding -r/--research to the  command
- Fixes an issue that improperly parsed command line args
- Ensures confirmation card on dependency add/remove
- Properly formats some sub-task dependencies

**Potentially addressed issues:**

While primarily focused on adding test coverage, this commit also implicitly addresses potential issues by:

- **Improving error handling coverage:** The addition of skipped tests for error scenarios in functions like , , , and  highlights areas where error handling needs to be robustly tested and potentially improved in the codebase.
- **Enhancing dependency validation:** Skipped tests for  include validation of dependencies, prompting a review of the dependency validation logic and ensuring its correctness.
- **Standardizing test coverage:** By creating a clear roadmap for testing all functions, this commit contributes to a more standardized and complete test suite, reducing the likelihood of undiscovered bugs in the future.

**task-manager.test.js:**

- Added skipped test blocks for the following functions:
    - : Includes tests for handling valid JSON responses, malformed JSON, missing tasks in responses, Perplexity AI research integration, Claude fallback, and parallel task processing.
    - : Covers tests for updating tasks based on context, handling Claude streaming, Perplexity AI integration, scenarios with no tasks to update, and error handling during updates.
    - : Includes tests for generating task files from , formatting dependencies with status indicators, handling tasks without subtasks, empty task arrays, and dependency validation before file generation.
    - : Covers tests for updating task status, subtask status using dot notation, updating multiple tasks, automatic subtask status updates, parent task update suggestions, and handling non-existent task IDs.
    - : Includes tests for updating regular and subtask statuses, handling parent tasks without subtasks, and non-existent subtask IDs.
    - : Covers tests for displaying all tasks, filtering by status, displaying subtasks, showing completion statistics, identifying the next task, and handling empty task arrays.
    - : Includes tests for generating subtasks, using complexity reports for subtask counts, Perplexity AI integration, appending subtasks, skipping completed tasks, and error handling during subtask generation.
    - : Covers tests for expanding all pending tasks, sorting by complexity, skipping tasks with existing subtasks (unless forced), using task-specific parameters from complexity reports, handling empty task arrays, and error handling for individual tasks.
    - : Includes tests for clearing subtasks from specific and multiple tasks, handling tasks without subtasks, non-existent task IDs, and regenerating task files after clearing subtasks.
    - : Covers tests for adding new tasks using AI, handling Claude streaming, validating dependencies, handling malformed AI responses, and using existing task context for generation.

**utils.test.js:**

- Added skipped test blocks for the following functions:
    - : Tests for logging messages according to log levels and filtering messages below configured levels.
    - : Tests for reading and parsing valid JSON files, handling file not found errors, and invalid JSON formats.
    - : Tests for writing JSON data to files and handling file write errors.
    - : Tests for escaping double quotes in prompts and handling prompts without special characters.
    - : Tests for reading and parsing complexity reports, handling missing report files, and custom report paths.
    - : Tests for finding tasks in reports by ID, handling non-existent task IDs, and invalid report structures.
    - : Tests for verifying existing task and subtask IDs, handling non-existent IDs, and invalid inputs.
    - : Tests for formatting numeric and string task IDs and preserving dot notation for subtasks.
    - : Tests for detecting simple and complex cycles in dependency graphs, handling acyclic graphs, and empty dependency maps.

These skipped tests provide a clear roadmap for future test development, ensuring comprehensive coverage for core functionalities in both modules. They document the intended behavior of each function and outline various scenarios, including happy paths, edge cases, and error conditions, thereby improving the overall test strategy and maintainability of the Task Master CLI.
This commit is contained in:
Eyal Toledano
2025-03-24 18:54:35 -04:00
parent 85104ae926
commit c5738a2513
32 changed files with 838 additions and 199 deletions

View File

@@ -1,7 +1,7 @@
# Task ID: 2
# Title: Develop Command Line Interface Foundation
# Status: done
# Dependencies: ✅ 1 (done)
# Dependencies: 1
# Priority: high
# Description: Create the basic CLI structure using Commander.js with command parsing and help documentation.
# Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 3
# Title: Implement Basic Task Operations
# Status: done
# Dependencies: ✅ 1 (done), ✅ 2 (done)
# Dependencies: 1, 2
# Priority: high
# Description: Create core functionality for managing tasks including listing, creating, updating, and deleting tasks.
# Details:
@@ -25,31 +25,31 @@ Test each operation with valid and invalid inputs. Verify that dependencies are
## 2. Develop Task Creation Functionality [done]
### Dependencies: 1 (done)
### Dependencies: 3.1
### Description: Implement a 'create' command in the CLI that allows users to add new tasks to the tasks.json file. Prompt for required fields (title, description, priority) and optional fields (dependencies, details, test strategy). Validate input and assign a unique ID to the new task.
### Details:
## 3. Implement Task Update Operations [done]
### Dependencies: 1 (done), 2 (done)
### Dependencies: 3.1, 3.2
### Description: Create an 'update' command that allows modification of existing task properties. Implement options to update individual fields or enter an interactive mode for multiple updates. Ensure that updates maintain data integrity, especially for dependencies.
### Details:
## 4. Develop Task Deletion Functionality [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 3.1, 3.2, 3.3
### Description: Implement a 'delete' command to remove tasks from tasks.json. Include safeguards against deleting tasks with dependencies and provide a force option to override. Update any tasks that had the deleted task as a dependency.
### Details:
## 5. Implement Task Status Management [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 3.1, 3.2, 3.3
### Description: Create a 'status' command to change the status of tasks (pending/done/deferred). Implement logic to handle status changes, including updating dependent tasks if necessary. Add a batch mode for updating multiple task statuses at once.
### Details:
## 6. Develop Task Dependency and Priority Management [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 3.1, 3.2, 3.3
### Description: Implement 'dependency' and 'priority' commands to manage task relationships and importance. Create functions to add/remove dependencies and change priorities. Ensure the system prevents circular dependencies and maintains consistent priority levels.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 4
# Title: Create Task File Generation System
# Status: done
# Dependencies: ✅ 1 (done), ✅ 3 (done)
# Dependencies: 1, 3
# Priority: medium
# Description: Implement the system for generating individual task files from the tasks.json data structure.
# Details:
@@ -23,25 +23,25 @@ Generate task files from sample tasks.json data and verify the content matches t
## 2. Implement Task File Generation Logic [done]
### Dependencies: 1 (done)
### Dependencies: 4.1
### Description: Develop the core functionality to generate individual task files from the tasks.json data structure. This includes reading the tasks.json file, iterating through each task, applying the template to each task's data, and writing the resulting content to appropriately named files in the tasks directory. Ensure proper error handling for file operations and data validation.
### Details:
## 3. Implement File Naming and Organization System [done]
### Dependencies: 1 (done)
### Dependencies: 4.1
### Description: Create a consistent system for naming and organizing task files. Implement a function that generates standardized filenames based on task IDs (e.g., task_001.txt for task ID 1). Design the directory structure for storing task files according to the PRD specification. Ensure the system handles task ID formatting consistently and prevents filename collisions.
### Details:
## 4. Implement Task File to JSON Synchronization [done]
### Dependencies: 1 (done), 3 (done), 2 (done)
### Dependencies: 4.1, 4.3, 4.2
### Description: Develop functionality to read modified task files and update the corresponding entries in tasks.json. This includes parsing the task file format, extracting structured data, validating the changes, and updating the tasks.json file accordingly. Ensure the system can handle concurrent modifications and resolve conflicts appropriately.
### Details:
## 5. Implement Change Detection and Update Handling [done]
### Dependencies: 1 (done), 3 (done), 4 (done), 2 (done)
### Dependencies: 4.1, 4.3, 4.4, 4.2
### Description: Create a system to detect changes in task files and tasks.json, and handle updates bidirectionally. This includes implementing file watching or comparison mechanisms, determining which version is newer, and applying changes in the appropriate direction. Ensure the system handles edge cases like deleted files, new tasks, and conflicting changes.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 5
# Title: Integrate Anthropic Claude API
# Status: done
# Dependencies: ✅ 1 (done)
# Dependencies: 1
# Priority: high
# Description: Set up the integration with Claude API for AI-powered task generation and expansion.
# Details:
@@ -24,31 +24,31 @@ Test API connectivity with sample prompts. Verify authentication works correctly
## 2. Develop Prompt Template System [done]
### Dependencies: 1 (done)
### Dependencies: 5.1
### Description: Create a flexible prompt template system for Claude API interactions. Implement a PromptTemplate class that can handle variable substitution, system and user messages, and proper formatting according to Claude's requirements. Include templates for different operations (task generation, task expansion, etc.) with appropriate instructions and constraints for each use case.
### Details:
## 3. Implement Response Handling and Parsing [done]
### Dependencies: 1 (done), 2 (done)
### Dependencies: 5.1, 5.2
### Description: Create a response handling system that processes Claude API responses. Implement JSON parsing for structured outputs, error detection in responses, and extraction of relevant information. Build utility functions to transform Claude's responses into the application's data structures. Include validation to ensure responses meet expected formats.
### Details:
## 4. Build Error Management with Retry Logic [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 5.1, 5.3
### Description: Implement a robust error handling system for Claude API interactions. Create middleware that catches API errors, network issues, and timeout problems. Implement exponential backoff retry logic that increases wait time between retries. Add configurable retry limits and timeout settings. Include detailed logging for troubleshooting API issues.
### Details:
## 5. Implement Token Usage Tracking [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 5.1, 5.3
### Description: Create a token tracking system to monitor Claude API usage. Implement functions to count tokens in prompts and responses. Build a logging system that records token usage per operation. Add reporting capabilities to show token usage trends and costs. Implement configurable limits to prevent unexpected API costs.
### Details:
## 6. Create Model Parameter Configuration System [done]
### Dependencies: 1 (done), 5 (done)
### Dependencies: 5.1, 5.5
### Description: Implement a flexible system for configuring Claude model parameters. Create a configuration module that manages model selection, temperature, top_p, max_tokens, and other parameters. Build functions to customize parameters based on operation type. Add validation to ensure parameters are within acceptable ranges. Include preset configurations for different use cases (creative, precise, etc.).
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 6
# Title: Build PRD Parsing System
# Status: done
# Dependencies: ✅ 1 (done), ✅ 5 (done)
# Dependencies: 1, 5
# Priority: high
# Description: Create the system for parsing Product Requirements Documents into structured task lists.
# Details:
@@ -30,25 +30,25 @@ Test with sample PRDs of varying complexity. Verify that generated tasks accurat
## 3. Implement PRD to Task Conversion System [done]
### Dependencies: 1 (done)
### Dependencies: 6.1
### Description: Develop the core functionality that sends PRD content to Claude API and converts the response into the task data structure. This includes sending the engineered prompts with PRD content to Claude, parsing the structured response, and transforming it into valid task objects that conform to the task model. Implement validation to ensure the generated tasks meet all requirements.
### Details:
## 4. Build Intelligent Dependency Inference System [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 6.1, 6.3
### Description: Create an algorithm that analyzes the generated tasks and infers logical dependencies between them. The system should identify which tasks must be completed before others based on the content and context of each task. Implement both explicit dependency detection (from Claude's output) and implicit dependency inference (based on task relationships and logical ordering).
### Details:
## 5. Implement Priority Assignment Logic [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 6.1, 6.3
### Description: Develop a system that assigns appropriate priorities (high, medium, low) to tasks based on their content, dependencies, and position in the PRD. Create algorithms that analyze task descriptions, identify critical path tasks, and consider factors like technical risk and business value. Implement both automated priority assignment and manual override capabilities.
### Details:
## 6. Implement PRD Chunking for Large Documents [done]
### Dependencies: 1 (done), 5 (done), 3 (done)
### Dependencies: 6.1, 6.5, 6.3
### Description: Create a system that can handle large PRDs by breaking them into manageable chunks for processing. Implement intelligent document segmentation that preserves context across chunks, tracks section relationships, and maintains coherence in the generated tasks. Develop a mechanism to reassemble and deduplicate tasks generated from different chunks into a unified task list.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 7
# Title: Implement Task Expansion with Claude
# Status: done
# Dependencies: ✅ 3 (done), ✅ 5 (done)
# Dependencies: 3, 5
# Priority: medium
# Description: Create functionality to expand tasks into subtasks using Claude's AI capabilities.
# Details:
@@ -24,25 +24,25 @@ Test expanding various types of tasks into subtasks. Verify that subtasks are pr
## 2. Develop Task Expansion Workflow and UI [done]
### Dependencies: 5 (done)
### Dependencies: 7.5
### Description: Implement the command-line interface and workflow for expanding tasks into subtasks. Create a new command that allows users to select a task, specify the number of subtasks, and add optional context. Design the interaction flow to handle the API request, process the response, and update the tasks.json file with the newly generated subtasks.
### Details:
## 3. Implement Context-Aware Expansion Capabilities [done]
### Dependencies: 1 (done)
### Dependencies: 7.1
### Description: Enhance the task expansion functionality to incorporate project context when generating subtasks. Develop a system to gather relevant information from the project, such as related tasks, dependencies, and previously completed work. Implement logic to include this context in the Claude prompts to improve the relevance and quality of generated subtasks.
### Details:
## 4. Build Parent-Child Relationship Management [done]
### Dependencies: 3 (done)
### Dependencies: 7.3
### Description: Implement the data structure and operations for managing parent-child relationships between tasks and subtasks. Create functions to establish these relationships in the tasks.json file, update the task model to support subtask arrays, and develop utilities to navigate, filter, and display task hierarchies. Ensure all basic task operations (update, delete, etc.) properly handle subtask relationships.
### Details:
## 5. Implement Subtask Regeneration Mechanism [done]
### Dependencies: 1 (done), 2 (done), 4 (done)
### Dependencies: 7.1, 7.2, 7.4
### Description: Create functionality that allows users to regenerate unsatisfactory subtasks. Implement a command that can target specific subtasks for regeneration, preserve satisfactory subtasks, and incorporate feedback to improve the new generation. Design the system to maintain proper parent-child relationships and task IDs during regeneration.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 8
# Title: Develop Implementation Drift Handling
# Status: done
# Dependencies: ✅ 3 (done), ✅ 5 (done), ✅ 7 (done)
# Dependencies: 3, 5, 7
# Priority: medium
# Description: Create system to handle changes in implementation that affect future tasks.
# Details:
@@ -35,13 +35,13 @@ Simulate implementation changes and test the system's ability to update future t
## 4. Implement Completed Work Preservation [done]
### Dependencies: 3 (done)
### Dependencies: 8.3
### Description: Develop a mechanism to ensure that updates to future tasks don't affect completed work. This includes creating a versioning system for tasks, tracking task history, and implementing safeguards to prevent modifications to completed tasks. The system should maintain a record of task changes while ensuring that completed work remains stable.
### Details:
## 5. Create Update Analysis and Suggestion Command [done]
### Dependencies: 3 (done)
### Dependencies: 8.3
### Description: Implement a CLI command that analyzes the current state of tasks, identifies potential drift between completed and pending tasks, and suggests updates. This command should provide a comprehensive report of potential inconsistencies and offer recommendations for task updates without automatically applying them. It should include options to apply all suggested changes, select specific changes to apply, or ignore suggestions.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 9
# Title: Integrate Perplexity API
# Status: done
# Dependencies: ✅ 5 (done)
# Dependencies: 5
# Priority: low
# Description: Add integration with Perplexity API for research-backed task generation.
# Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 10
# Title: Create Research-Backed Subtask Generation
# Status: done
# Dependencies: ✅ 7 (done), ✅ 9 (done)
# Dependencies: 7, 9
# Priority: low
# Description: Enhance subtask generation with research capabilities from Perplexity API.
# Details:
@@ -29,25 +29,25 @@ Compare subtasks generated with and without research backing. Verify that resear
## 3. Develop Context Enrichment Pipeline [done]
### Dependencies: 2 (done)
### Dependencies: 10.2
### Description: Create a pipeline that processes research results and enriches the task context with relevant information. This should include filtering irrelevant information, organizing research findings by category (tools, libraries, best practices, etc.), and formatting the enriched context for use in subtask generation. Implement a scoring mechanism to prioritize the most relevant research findings.
### Details:
## 4. Implement Domain-Specific Knowledge Incorporation [done]
### Dependencies: 3 (done)
### Dependencies: 10.3
### Description: Develop a system to incorporate domain-specific knowledge into the subtask generation process. This should include identifying key domain concepts, technical requirements, and industry standards from the research results. Create a knowledge base structure that organizes domain information and can be referenced during subtask generation.
### Details:
## 5. Enhance Subtask Generation with Technical Details [done]
### Dependencies: 3 (done), 4 (done)
### Dependencies: 10.3, 10.4
### Description: Extend the existing subtask generation functionality to incorporate research findings and produce more technically detailed subtasks. This includes modifying the Claude prompt templates to leverage the enriched context, implementing specific sections for technical approach, implementation notes, and potential challenges. Ensure generated subtasks include concrete technical details rather than generic steps.
### Details:
## 6. Implement Reference and Resource Inclusion [done]
### Dependencies: 3 (done), 5 (done)
### Dependencies: 10.3, 10.5
### Description: Create a system to include references to relevant libraries, tools, documentation, and other resources in generated subtasks. This should extract specific references from research results, validate their relevance, and format them as actionable links or citations within subtasks. Implement a verification step to ensure referenced resources are current and applicable.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 11
# Title: Implement Batch Operations
# Status: done
# Dependencies: ✅ 3 (done)
# Dependencies: 3
# Priority: medium
# Description: Add functionality for performing operations on multiple tasks simultaneously.
# Details:
@@ -18,13 +18,13 @@ Test batch operations with various filters and operations. Verify that operation
# Subtasks:
## 1. Implement Multi-Task Status Update Functionality [done]
### Dependencies: 3 (done)
### Dependencies: 11.3
### Description: Create a command-line interface command that allows users to update the status of multiple tasks simultaneously. Implement the backend logic to process batch status changes, validate the requested changes, and update the tasks.json file accordingly. The implementation should include options for filtering tasks by various criteria (ID ranges, status, priority, etc.) and applying status changes to the filtered set.
### Details:
## 2. Develop Bulk Subtask Generation System [done]
### Dependencies: 3 (done), 4 (done)
### Dependencies: 11.3, 11.4
### Description: Create functionality to generate multiple subtasks across several parent tasks at once. This should include a command-line interface that accepts filtering parameters to select parent tasks and either a template for subtasks or an AI-assisted generation option. The system should validate parent tasks, generate appropriate subtasks with proper ID assignments, and update the tasks.json file.
### Details:
@@ -36,13 +36,13 @@ Test batch operations with various filters and operations. Verify that operation
## 4. Create Advanced Dependency Management System [done]
### Dependencies: 3 (done)
### Dependencies: 11.3
### Description: Implement batch operations for managing dependencies between tasks. This includes commands for adding, removing, and updating dependencies across multiple tasks simultaneously. The system should validate dependency changes to prevent circular dependencies, update the tasks.json file, and regenerate task files to reflect the changes.
### Details:
## 5. Implement Batch Task Prioritization and Command System [done]
### Dependencies: 3 (done)
### Dependencies: 11.3
### Description: Create a system for batch prioritization of tasks and a command framework for operating on filtered task sets. This includes commands for changing priorities of multiple tasks at once and a generic command execution system that can apply custom operations to filtered task sets. The implementation should include a plugin architecture that allows for extending the system with new batch operations.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 12
# Title: Develop Project Initialization System
# Status: done
# Dependencies: ✅ 1 (done), ✅ 2 (done), ✅ 3 (done), ✅ 4 (done), ✅ 6 (done)
# Dependencies: 1, 2, 3, 4, 6
# Priority: medium
# Description: Create functionality for initializing new projects with task structure and configuration.
# Details:
@@ -18,31 +18,31 @@ Test project initialization in empty directories. Verify that all required files
# Subtasks:
## 1. Create Project Template Structure [done]
### Dependencies: 4 (done)
### Dependencies: 12.4
### Description: Design and implement a flexible project template system that will serve as the foundation for new project initialization. This should include creating a base directory structure, template files (e.g., default tasks.json, .env.example), and a configuration file to define customizable aspects of the template.
### Details:
## 2. Implement Interactive Setup Wizard [done]
### Dependencies: 3 (done)
### Dependencies: 12.3
### Description: Develop an interactive command-line wizard using a library like Inquirer.js to guide users through the project initialization process. The wizard should prompt for project name, description, initial task structure, and other configurable options defined in the template configuration.
### Details:
## 3. Generate Environment Configuration [done]
### Dependencies: 2 (done)
### Dependencies: 12.2
### Description: Create functionality to generate environment-specific configuration files based on user input and template defaults. This includes creating a .env file with necessary API keys and configuration values, and updating the tasks.json file with project-specific metadata.
### Details:
## 4. Implement Directory Structure Creation [done]
### Dependencies: 1 (done)
### Dependencies: 12.1
### Description: Develop the logic to create the initial directory structure for new projects based on the selected template and user inputs. This should include creating necessary subdirectories (e.g., tasks/, scripts/, .cursor/rules/) and copying template files to appropriate locations.
### Details:
## 5. Generate Example Tasks.json [done]
### Dependencies: 6 (done)
### Dependencies: 12.6
### Description: Create functionality to generate an initial tasks.json file with example tasks based on the project template and user inputs from the setup wizard. This should include creating a set of starter tasks that demonstrate the task structure and provide a starting point for the project.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 13
# Title: Create Cursor Rules Implementation
# Status: done
# Dependencies: ✅ 1 (done), ✅ 2 (done), ✅ 3 (done)
# Dependencies: 1, 2, 3
# Priority: medium
# Description: Develop the Cursor AI integration rules and documentation.
# Details:
@@ -24,25 +24,25 @@ Review rules documentation for clarity and completeness. Test with Cursor AI to
## 2. Create dev_workflow.mdc Documentation [done]
### Dependencies: 1 (done)
### Dependencies: 13.1
### Description: Develop the dev_workflow.mdc file that documents the development workflow for Cursor AI. This file should outline how Cursor AI should assist with task discovery, implementation, and verification within the project. Include specific examples of commands and interactions that demonstrate the optimal workflow.
### Details:
## 3. Implement cursor_rules.mdc [done]
### Dependencies: 1 (done)
### Dependencies: 13.1
### Description: Create the cursor_rules.mdc file that defines specific rules and guidelines for how Cursor AI should interact with the codebase. This should include code style preferences, architectural patterns to follow, documentation requirements, and any project-specific conventions that Cursor AI should adhere to when generating or modifying code.
### Details:
## 4. Add self_improve.mdc Documentation [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 13.1, 13.2, 13.3
### Description: Develop the self_improve.mdc file that instructs Cursor AI on how to continuously improve its assistance capabilities within the project context. This document should outline how Cursor AI should learn from feedback, adapt to project evolution, and enhance its understanding of the codebase over time.
### Details:
## 5. Create Cursor AI Integration Documentation [done]
### Dependencies: 1 (done), 2 (done), 3 (done), 4 (done)
### Dependencies: 13.1, 13.2, 13.3, 13.4
### Description: Develop comprehensive documentation on how Cursor AI integrates with the task management system. This should include detailed instructions on how Cursor AI should interpret tasks.json, individual task files, and how it should assist with implementation. Document the specific commands and workflows that Cursor AI should understand and support.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 14
# Title: Develop Agent Workflow Guidelines
# Status: done
# Dependencies: ✅ 13 (done)
# Dependencies: 13
# Priority: medium
# Description: Create comprehensive guidelines for how AI agents should interact with the task system.
# Details:
@@ -24,25 +24,25 @@ Review guidelines with actual AI agents to verify they can follow the procedures
## 2. Implement Task Selection Algorithm [done]
### Dependencies: 1 (done)
### Dependencies: 14.1
### Description: Develop an algorithm for AI agents to select the most appropriate task to work on based on priority, dependencies, and current project status. This should include logic for evaluating task urgency, managing blocked tasks, and optimizing workflow efficiency. Implement the algorithm in JavaScript and integrate it with the existing task management system.
### Details:
## 3. Create Implementation Guidance Generator [done]
### Dependencies: 5 (done)
### Dependencies: 14.5
### Description: Develop a system that generates detailed implementation guidance for AI agents based on task descriptions and project context. This should leverage the Anthropic Claude API to create step-by-step instructions, suggest relevant libraries or tools, and provide code snippets or pseudocode where appropriate. Implement caching to reduce API calls and improve performance.
### Details:
## 4. Develop Verification Procedure Framework [done]
### Dependencies: 1 (done), 2 (done)
### Dependencies: 14.1, 14.2
### Description: Create a flexible framework for defining and executing verification procedures for completed tasks. This should include a DSL (Domain Specific Language) for specifying acceptance criteria, automated test generation where possible, and integration with popular testing frameworks. Implement hooks for both automated and manual verification steps.
### Details:
## 5. Implement Dynamic Task Prioritization System [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 14.1, 14.2, 14.3
### Description: Develop a system that dynamically adjusts task priorities based on project progress, dependencies, and external factors. This should include an algorithm for recalculating priorities, a mechanism for propagating priority changes through dependency chains, and an API for external systems to influence priorities. Implement this as a background process that periodically updates the tasks.json file.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 15
# Title: Optimize Agent Integration with Cursor and dev.js Commands
# Status: done
# Dependencies: ✅ 2 (done), ✅ 14 (done)
# Dependencies: 2, 14
# Priority: medium
# Description: Document and enhance existing agent interaction patterns through Cursor rules and dev.js commands.
# Details:
@@ -29,25 +29,25 @@ Test the enhanced commands with AI agents to verify they can correctly interpret
## 3. Optimize Command Responses for Agent Consumption [done]
### Dependencies: 2 (done)
### Dependencies: 15.2
### Description: Refine the output format of existing commands to ensure they are easily parseable by AI agents. Focus on consistent, structured outputs that agents can reliably interpret without requiring a separate parsing system.
### Details:
## 4. Improve Agent Workflow Documentation in Cursor Rules [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 15.1, 15.3
### Description: Enhance the agent workflow documentation in dev_workflow.mdc and cursor_rules.mdc to provide clear guidance on how agents should interact with the task system. Include example interactions and best practices for agents.
### Details:
## 5. Add Agent-Specific Features to Existing Commands [done]
### Dependencies: 2 (done)
### Dependencies: 15.2
### Description: Identify and implement any missing agent-specific features in the existing command system. This may include additional flags, parameters, or output formats that are particularly useful for agent interactions.
### Details:
## 6. Create Agent Usage Examples and Patterns [done]
### Dependencies: 3 (done), 4 (done)
### Dependencies: 15.3, 15.4
### Description: Develop a set of example interactions and usage patterns that demonstrate how agents should effectively use the task system. Include these examples in the documentation to guide future agent implementations.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 16
# Title: Create Configuration Management System
# Status: done
# Dependencies: ✅ 1 (done), ✅ 2 (done)
# Dependencies: 1, 2
# Priority: high
# Description: Implement robust configuration handling with environment variables and .env files.
# Details:
@@ -25,31 +25,31 @@ Test configuration loading from various sources (environment variables, .env fil
## 2. Implement .env File Support [done]
### Dependencies: 1 (done)
### Dependencies: 16.1
### Description: Add support for loading configuration from .env files using dotenv or a similar library. Implement file detection, parsing, and merging with existing environment variables. Handle multiple environments (.env.development, .env.production, etc.) and implement proper error handling for file reading issues.
### Details:
## 3. Implement Configuration Validation [done]
### Dependencies: 1 (done), 2 (done)
### Dependencies: 16.1, 16.2
### Description: Create a validation system for configuration values using a schema validation library like Joi, Zod, or Ajv. Define schemas for all configuration categories (API keys, file paths, feature flags, etc.). Implement validation that runs at startup and provides clear error messages for invalid configurations.
### Details:
## 4. Create Configuration Defaults and Override System [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 16.1, 16.2, 16.3
### Description: Implement a system of sensible defaults for all configuration values with the ability to override them via environment variables or .env files. Create a unified configuration object that combines defaults, .env values, and environment variables with proper precedence. Implement a caching mechanism to avoid repeated environment lookups.
### Details:
## 5. Create .env.example Template [done]
### Dependencies: 1 (done), 2 (done), 3 (done), 4 (done)
### Dependencies: 16.1, 16.2, 16.3, 16.4
### Description: Generate a comprehensive .env.example file that documents all supported environment variables, their purpose, format, and default values. Include comments explaining the purpose of each variable and provide examples. Ensure sensitive values are not included but have clear placeholders.
### Details:
## 6. Implement Secure API Key Handling [done]
### Dependencies: 1 (done), 2 (done), 3 (done), 4 (done)
### Dependencies: 16.1, 16.2, 16.3, 16.4
### Description: Create a secure mechanism for handling sensitive configuration values like API keys. Implement masking of sensitive values in logs and error messages. Add validation for API key formats and implement a mechanism to detect and warn about insecure storage of API keys (e.g., committed to git). Add support for key rotation and refresh.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 17
# Title: Implement Comprehensive Logging System
# Status: done
# Dependencies: ✅ 2 (done), ✅ 16 (done)
# Dependencies: 2, 16
# Priority: medium
# Description: Create a flexible logging system with configurable levels and output formats.
# Details:
@@ -25,25 +25,25 @@ Test logging at different verbosity levels. Verify that logs contain appropriate
## 2. Implement Configurable Output Destinations [done]
### Dependencies: 1 (done)
### Dependencies: 17.1
### Description: Extend the logging framework to support multiple output destinations simultaneously. Implement adapters for console output, file output, and potentially other destinations (like remote logging services). Create a configuration system that allows specifying which log levels go to which destinations. Ensure thread-safe writing to prevent log corruption.
### Details:
## 3. Implement Command and API Interaction Logging [done]
### Dependencies: 1 (done), 2 (done)
### Dependencies: 17.1, 17.2
### Description: Create specialized logging functionality for command execution and API interactions. For commands, log the command name, arguments, options, and execution status. For API interactions, log request details (URL, method, headers), response status, and timing information. Implement sanitization to prevent logging sensitive data like API keys or passwords.
### Details:
## 4. Implement Error Tracking and Performance Metrics [done]
### Dependencies: 1 (done)
### Dependencies: 17.1
### Description: Enhance the logging system to provide detailed error tracking and performance metrics. For errors, capture stack traces, error codes, and contextual information. For performance metrics, implement timing utilities to measure execution duration of key operations. Create a consistent format for these specialized log types to enable easier analysis.
### Details:
## 5. Implement Log File Rotation and Management [done]
### Dependencies: 2 (done)
### Dependencies: 17.2
### Description: Create a log file management system that handles rotation based on file size or time intervals. Implement compression of rotated logs, automatic cleanup of old logs, and configurable retention policies. Ensure that log rotation happens without disrupting the application and that no log messages are lost during rotation.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 18
# Title: Create Comprehensive User Documentation
# Status: done
# Dependencies: ✅ 1 (done), ✅ 2 (done), ✅ 3 (done), ✅ 4 (done), ✅ 5 (done), ✅ 6 (done), ✅ 7 (done), ✅ 11 (done), ✅ 12 (done), ✅ 16 (done)
# Dependencies: 1, 2, 3, 4, 5, 6, 7, 11, 12, 16
# Priority: medium
# Description: Develop complete user documentation including README, examples, and troubleshooting guides.
# Details:
@@ -20,13 +20,13 @@ Review documentation for clarity and completeness. Have users unfamiliar with th
# Subtasks:
## 1. Create Detailed README with Installation and Usage Instructions [done]
### Dependencies: 3 (done)
### Dependencies: 18.3
### Description: Develop a comprehensive README.md file that serves as the primary documentation entry point. Include project overview, installation steps for different environments, basic usage examples, and links to other documentation sections. Structure the README with clear headings, code blocks for commands, and screenshots where helpful.
### Details:
## 2. Develop Command Reference Documentation [done]
### Dependencies: 3 (done)
### Dependencies: 18.3
### Description: Create detailed documentation for all CLI commands, their options, arguments, and examples. Organize commands by functionality category, include syntax diagrams, and provide real-world examples for each command. Document all global options and environment variables that affect command behavior.
### Details:
@@ -38,19 +38,19 @@ Review documentation for clarity and completeness. Have users unfamiliar with th
## 4. Develop Example Workflows and Use Cases [done]
### Dependencies: 3 (done), 6 (done)
### Dependencies: 18.3, 18.6
### Description: Create detailed documentation of common workflows and use cases, showing how to use the tool effectively for different scenarios. Include step-by-step guides with command sequences, expected outputs, and explanations. Cover basic to advanced workflows, including PRD parsing, task expansion, and implementation drift handling.
### Details:
## 5. Create Troubleshooting Guide and FAQ [done]
### Dependencies: 1 (done), 2 (done), 3 (done)
### Dependencies: 18.1, 18.2, 18.3
### Description: Develop a comprehensive troubleshooting guide that addresses common issues, error messages, and their solutions. Include a FAQ section covering common questions about usage, configuration, and best practices. Document known limitations and workarounds for edge cases.
### Details:
## 6. Develop API Integration and Extension Documentation [done]
### Dependencies: 5 (done)
### Dependencies: 18.5
### Description: Create technical documentation for API integrations (Claude, Perplexity) and extension points. Include details on prompt templates, response handling, token optimization, and custom integrations. Document the internal architecture to help developers extend the tool with new features or integrations.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 19
# Title: Implement Error Handling and Recovery
# Status: done
# Dependencies: ✅ 1 (done), ✅ 2 (done), ✅ 3 (done), ✅ 5 (done), ✅ 9 (done), ✅ 16 (done), ✅ 17 (done)
# Dependencies: 1, 2, 3, 5, 9, 16, 17
# Priority: high
# Description: Create robust error handling throughout the system with helpful error messages and recovery options.
# Details:
@@ -31,25 +31,25 @@ Deliberately trigger various error conditions and verify that the system handles
## 3. Develop File System Error Recovery Mechanisms [done]
### Dependencies: 1 (done)
### Dependencies: 19.1
### Description: Implement error handling and recovery mechanisms for file system operations, focusing on tasks.json and individual task files. This should include handling of file not found errors, permission issues, and data corruption scenarios. Implement automatic backups and recovery procedures to ensure data integrity.
### Details:
## 4. Enhance Data Validation with Detailed Error Feedback [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 19.1, 19.3
### Description: Improve the existing data validation system to provide more specific and actionable error messages. Implement detailed validation checks for all user inputs and task data, with clear error messages that pinpoint the exact issue and how to resolve it. This should cover task creation, updates, and any data imported from external sources.
### Details:
## 5. Implement Command Syntax Error Handling and Guidance [done]
### Dependencies: 2 (done)
### Dependencies: 19.2
### Description: Enhance the CLI to provide more helpful error messages and guidance when users input invalid commands or options. Implement a "did you mean?" feature for close matches to valid commands, and provide context-sensitive help for command syntax errors. This should integrate with the existing Commander.js setup.
### Details:
## 6. Develop System State Recovery After Critical Failures [done]
### Dependencies: 1 (done), 3 (done)
### Dependencies: 19.1, 19.3
### Description: Implement a system state recovery mechanism to handle critical failures that could leave the task management system in an inconsistent state. This should include creating periodic snapshots of the system state, implementing a recovery procedure to restore from these snapshots, and providing tools for manual intervention if automatic recovery fails.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 20
# Title: Create Token Usage Tracking and Cost Management
# Status: done
# Dependencies: ✅ 5 (done), ✅ 9 (done), ✅ 17 (done)
# Dependencies: 5, 9, 17
# Priority: medium
# Description: Implement system for tracking API token usage and managing costs.
# Details:
@@ -19,7 +19,7 @@ Track token usage across various operations and verify accuracy. Test that limit
# Subtasks:
## 1. Implement Token Usage Tracking for API Calls [done]
### Dependencies: 5 (done)
### Dependencies: 20.5
### Description: Create a middleware or wrapper function that intercepts all API calls to OpenAI, Anthropic, and Perplexity. This function should count the number of tokens used in both the request and response, storing this information in a persistent data store (e.g., SQLite database). Implement a caching mechanism to reduce redundant API calls and token usage.
### Details:
@@ -31,7 +31,7 @@ Track token usage across various operations and verify accuracy. Test that limit
## 3. Implement Token Usage Reporting and Cost Estimation [done]
### Dependencies: 1 (done), 2 (done)
### Dependencies: 20.1, 20.2
### Description: Develop a reporting module that generates detailed token usage reports. Include breakdowns by API, user, and time period. Implement cost estimation features by integrating current pricing information for each API. Create both command-line and programmatic interfaces for generating reports and estimates.
### Details:
@@ -43,7 +43,7 @@ Track token usage across various operations and verify accuracy. Test that limit
## 5. Develop Token Usage Alert System [done]
### Dependencies: 2 (done), 3 (done)
### Dependencies: 20.2, 20.3
### Description: Create an alert system that monitors token usage in real-time and sends notifications when usage approaches or exceeds defined thresholds. Implement multiple notification channels (e.g., email, Slack, system logs) and allow for customizable alert rules. Integrate this system with the existing logging and reporting modules.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 21
# Title: Refactor dev.js into Modular Components
# Status: done
# Dependencies: ✅ 3 (done), ✅ 16 (done), ✅ 17 (done)
# Dependencies: 3, 16, 17
# Priority: high
# Description: Restructure the monolithic dev.js file into separate modular components to improve code maintainability, readability, and testability while preserving all existing functionality.
# Details:
@@ -65,19 +65,19 @@ Testing should verify that functionality remains identical after refactoring:
## 2. Create Core Module Structure and Entry Point Refactoring [done]
### Dependencies: 1 (done)
### Dependencies: 21.1
### Description: Create the skeleton structure for all module files (commands.js, ai-services.js, task-manager.js, ui.js, utils.js) with proper export statements. Refactor dev.js to serve as the entry point that imports and orchestrates these modules. Implement the basic initialization flow and command-line argument parsing in the new structure.
### Details:
## 3. Implement Core Module Functionality with Dependency Injection [done]
### Dependencies: 2 (done)
### Dependencies: 21.2
### Description: Migrate the core functionality from dev.js into the appropriate modules following the mapping document. Implement proper dependency injection to avoid circular dependencies. Ensure each module has a clear API and properly encapsulates its internal state. Focus on the critical path functionality first.
### Details:
## 4. Implement Error Handling and Complete Module Migration [done]
### Dependencies: 3 (done)
### Dependencies: 21.3
### Description: Establish a consistent error handling pattern across all modules. Complete the migration of remaining functionality from dev.js to the appropriate modules. Ensure all edge cases, error scenarios, and helper functions are properly moved and integrated. Update all import/export statements throughout the codebase to reference the new module structure.
### Details:

View File

@@ -1,7 +1,7 @@
# Task ID: 22
# Title: Create Comprehensive Test Suite for Task Master CLI
# Status: in-progress
# Dependencies: ✅ 21 (done)
# Dependencies: 21
# Priority: high
# Description: Develop a complete testing infrastructure for the Task Master CLI that includes unit, integration, and end-to-end tests to verify all core functionality and error handling.
# Details:
@@ -64,13 +64,13 @@ The task will be considered complete when all tests pass consistently, coverage
## 2. Implement Unit Tests for Core Components [pending]
### Dependencies: 1 (done)
### Dependencies: 22.1
### Description: Create a comprehensive set of unit tests for all utility functions, core logic components, and individual modules of the Task Master CLI. This includes tests for task creation, parsing, manipulation, data storage, retrieval, and formatting functions. Ensure all edge cases and error scenarios are covered.
### Details:
## 3. Develop Integration and End-to-End Tests [pending]
### Dependencies: 1 (done), 2 (pending)
### Dependencies: 22.1, 22.2
### Description: Create integration tests that verify the correct interaction between different components of the CLI, including command execution, option parsing, and data flow. Implement end-to-end tests that simulate complete user workflows, such as creating a task, expanding it, and updating its status. Include tests for error scenarios, recovery processes, and handling large numbers of tasks.
### Details:

View File

@@ -1,42 +1,42 @@
# Task ID: 23
# Title: Implement MCP (Model Context Protocol) Server Functionality for Task Master
# Title: Implement MCP Server Functionality for Task Master using FastMCP
# Status: pending
# Dependencies: ⏱️ 22 (in-progress)
# Dependencies: 22
# Priority: medium
# Description: Extend Task Master to function as an MCP server, allowing it to provide context management services to other applications following the Model Context Protocol specification.
# Description: Extend Task Master to function as an MCP server by leveraging FastMCP's JavaScript/TypeScript implementation for efficient context management services.
# Details:
This task involves implementing the Model Context Protocol server capabilities within Task Master. The implementation should:
This task involves implementing the Model Context Protocol server capabilities within Task Master using FastMCP. The implementation should:
1. Create a new module `mcp-server.js` that implements the core MCP server functionality
2. Implement the required MCP endpoints:
1. Use FastMCP to create the MCP server module (`mcp-server.ts` or equivalent)
2. Implement the required MCP endpoints using FastMCP:
- `/context` - For retrieving and updating context
- `/models` - For listing available models
- `/execute` - For executing operations with context
3. Develop a context management system that can:
- Store and retrieve context data efficiently
- Handle context windowing and truncation when limits are reached
- Support context metadata and tagging
4. Add authentication and authorization mechanisms for MCP clients
5. Implement proper error handling and response formatting according to MCP specifications
6. Create configuration options in Task Master to enable/disable the MCP server functionality
7. Add documentation for how to use Task Master as an MCP server
8. Ensure the implementation is compatible with existing MCP clients
9. Optimize for performance, especially for context retrieval operations
10. Add logging for MCP server operations
3. Utilize FastMCP's built-in features for context management, including:
- Efficient context storage and retrieval
- Context windowing and truncation
- Metadata and tagging support
4. Add authentication and authorization mechanisms using FastMCP capabilities
5. Implement error handling and response formatting as per MCP specifications
6. Configure Task Master to enable/disable MCP server functionality via FastMCP settings
7. Add documentation on using Task Master as an MCP server with FastMCP
8. Ensure compatibility with existing MCP clients by adhering to FastMCP's compliance features
9. Optimize performance using FastMCP tools, especially for context retrieval operations
10. Add logging for MCP server operations using FastMCP's logging utilities
The implementation should follow RESTful API design principles and should be able to handle concurrent requests from multiple clients.
The implementation should follow RESTful API design principles and leverage FastMCP's concurrency handling for multiple client requests. Consider using TypeScript for better type safety and integration with FastMCP[1][2].
# Test Strategy:
Testing for the MCP server functionality should include:
1. Unit tests:
- Test each MCP endpoint handler function independently
- Verify context storage and retrieval mechanisms
- Test each MCP endpoint handler function independently using FastMCP
- Verify context storage and retrieval mechanisms provided by FastMCP
- Test authentication and authorization logic
- Validate error handling for various failure scenarios
2. Integration tests:
- Set up a test MCP server instance
- Set up a test MCP server instance using FastMCP
- Test complete request/response cycles for each endpoint
- Verify context persistence across multiple requests
- Test with various payload sizes and content types
@@ -44,11 +44,11 @@ Testing for the MCP server functionality should include:
3. Compatibility tests:
- Test with existing MCP client libraries
- Verify compliance with the MCP specification
- Ensure backward compatibility with any MCP versions supported
- Ensure backward compatibility with any MCP versions supported by FastMCP
4. Performance tests:
- Measure response times for context operations with various context sizes
- Test concurrent request handling
- Test concurrent request handling using FastMCP's concurrency tools
- Verify memory usage remains within acceptable limits during extended operation
5. Security tests:

View File

@@ -1,32 +1,32 @@
# Task ID: 24
# Title: Implement AI-Powered Test Generation Command
# Title: Implement AI-Powered Test Generation Command using FastMCP
# Status: pending
# Dependencies: ⏱️ 22 (in-progress)
# Dependencies: 22
# Priority: high
# Description: Create a new 'generate-test' command that leverages AI to automatically produce Jest test files for tasks based on their descriptions and subtasks.
# Description: Create a new 'generate-test' command in Task Master that leverages AI to automatically produce Jest test files for tasks based on their descriptions and subtasks, utilizing FastMCP for AI integration.
# Details:
Implement a new command in the Task Master CLI that generates comprehensive Jest test files for tasks. The command should be callable as 'task-master generate-test --id=1' and should:
1. Accept a task ID parameter to identify which task to generate tests for
2. Retrieve the task and its subtasks from the task store
3. Analyze the task description, details, and subtasks to understand implementation requirements
4. Construct an appropriate prompt for an AI service (e.g., OpenAI API) that requests generation of Jest tests
5. Process the AI response to create a well-formatted test file named 'task_XXX.test.js' where XXX is the zero-padded task ID
4. Construct an appropriate prompt for the AI service using FastMCP
5. Process the AI response to create a well-formatted test file named 'task_XXX.test.ts' where XXX is the zero-padded task ID
6. Include appropriate test cases that cover the main functionality described in the task
7. Generate mocks for external dependencies identified in the task description
8. Create assertions that validate the expected behavior
9. Handle both parent tasks and subtasks appropriately (for subtasks, name the file 'task_XXX_YYY.test.js' where YYY is the subtask ID)
9. Handle both parent tasks and subtasks appropriately (for subtasks, name the file 'task_XXX_YYY.test.ts' where YYY is the subtask ID)
10. Include error handling for API failures, invalid task IDs, etc.
11. Add appropriate documentation for the command in the help system
The implementation should utilize the existing AI service integration in the codebase and maintain consistency with the current command structure and error handling patterns.
The implementation should utilize FastMCP for AI service integration and maintain consistency with the current command structure and error handling patterns. Consider using TypeScript for better type safety and integration with FastMCP[1][2].
# Test Strategy:
Testing for this feature should include:
1. Unit tests for the command handler function to verify it correctly processes arguments and options
2. Mock tests for the AI service integration to ensure proper prompt construction and response handling
3. Integration tests that verify the end-to-end flow using a mock AI response
2. Mock tests for the FastMCP integration to ensure proper prompt construction and response handling
3. Integration tests that verify the end-to-end flow using a mock FastMCP response
4. Tests for error conditions including:
- Invalid task IDs
- Network failures when contacting the AI service
@@ -41,10 +41,10 @@ Create a test fixture with sample tasks of varying complexity to evaluate the te
# Subtasks:
## 1. Create command structure for 'generate-test' [pending]
### Dependencies: None
### Description: Implement the basic structure for the 'generate-test' command, including command registration, parameter validation, and help documentation
### Description: Implement the basic structure for the 'generate-test' command, including command registration, parameter validation, and help documentation.
### Details:
Implementation steps:
1. Create a new file `src/commands/generate-test.js`
1. Create a new file `src/commands/generate-test.ts`
2. Implement the command structure following the pattern of existing commands
3. Register the new command in the CLI framework
4. Add command options for task ID (--id=X) parameter
@@ -59,32 +59,31 @@ Testing approach:
- Test error handling for non-existent task IDs
- Test basic command flow with a mock task store
## 2. Implement AI prompt construction and API integration [pending]
### Dependencies: 1 (pending)
### Description: Develop the logic to analyze tasks, construct appropriate AI prompts, and interact with the AI service to generate test content
## 2. Implement AI prompt construction and FastMCP integration [pending]
### Dependencies: 24.1
### Description: Develop the logic to analyze tasks, construct appropriate AI prompts, and interact with the AI service using FastMCP to generate test content.
### Details:
Implementation steps:
1. Create a utility function to analyze task descriptions and subtasks for test requirements
2. Implement a prompt builder that formats task information into an effective AI prompt
3. The prompt should request Jest test generation with specifics about mocking dependencies and creating assertions
4. Integrate with the existing AI service in the codebase to send the prompt
5. Process the AI response to extract the generated test code
6. Implement error handling for API failures, rate limits, and malformed responses
7. Add appropriate logging for the AI interaction process
3. Use FastMCP to send the prompt and receive the response
4. Process the FastMCP response to extract the generated test code
5. Implement error handling for FastMCP failures, rate limits, and malformed responses
6. Add appropriate logging for the FastMCP interaction process
Testing approach:
- Test prompt construction with various task types
- Test AI service integration with mocked responses
- Test error handling for API failures
- Test response processing with sample AI outputs
- Test FastMCP integration with mocked responses
- Test error handling for FastMCP failures
- Test response processing with sample FastMCP outputs
## 3. Implement test file generation and output [pending]
### Dependencies: 2 (pending)
### Description: Create functionality to format AI-generated tests into proper Jest test files and save them to the appropriate location
### Dependencies: 24.2
### Description: Create functionality to format AI-generated tests into proper Jest test files and save them to the appropriate location.
### Details:
Implementation steps:
1. Create a utility to format the AI response into a well-structured Jest test file
2. Implement naming logic for test files (task_XXX.test.js for parent tasks, task_XXX_YYY.test.js for subtasks)
1. Create a utility to format the FastMCP response into a well-structured Jest test file
2. Implement naming logic for test files (task_XXX.test.ts for parent tasks, task_XXX_YYY.test.ts for subtasks)
3. Add logic to determine the appropriate file path for saving the test
4. Implement file system operations to write the test file
5. Add validation to ensure the generated test follows Jest conventions
@@ -94,7 +93,7 @@ Implementation steps:
Testing approach:
- Test file naming logic for various task/subtask combinations
- Test file content formatting with sample AI outputs
- Test file content formatting with sample FastMCP outputs
- Test file system operations with mocked fs module
- Test the complete flow from command input to file output
- Verify generated tests can be executed by Jest

View File

@@ -25,7 +25,7 @@
"description": "Create the basic CLI structure using Commander.js with command parsing and help documentation.",
"status": "done",
"dependencies": [
1
"1"
],
"priority": "high",
"details": "Implement the CLI foundation including:\n- Set up Commander.js for command parsing\n- Create help documentation for all commands\n- Implement colorized console output for better readability\n- Add logging system with configurable levels\n- Handle global options (--help, --version, --file, --quiet, --debug, --json)",
@@ -1410,56 +1410,56 @@
},
{
"id": 23,
"title": "Implement MCP (Model Context Protocol) Server Functionality for Task Master",
"description": "Extend Task Master to function as an MCP server, allowing it to provide context management services to other applications following the Model Context Protocol specification.",
"title": "Implement MCP Server Functionality for Task Master using FastMCP",
"description": "Extend Task Master to function as an MCP server by leveraging FastMCP's JavaScript/TypeScript implementation for efficient context management services.",
"status": "pending",
"dependencies": [
22
],
"priority": "medium",
"details": "This task involves implementing the Model Context Protocol server capabilities within Task Master. The implementation should:\n\n1. Create a new module `mcp-server.js` that implements the core MCP server functionality\n2. Implement the required MCP endpoints:\n - `/context` - For retrieving and updating context\n - `/models` - For listing available models\n - `/execute` - For executing operations with context\n3. Develop a context management system that can:\n - Store and retrieve context data efficiently\n - Handle context windowing and truncation when limits are reached\n - Support context metadata and tagging\n4. Add authentication and authorization mechanisms for MCP clients\n5. Implement proper error handling and response formatting according to MCP specifications\n6. Create configuration options in Task Master to enable/disable the MCP server functionality\n7. Add documentation for how to use Task Master as an MCP server\n8. Ensure the implementation is compatible with existing MCP clients\n9. Optimize for performance, especially for context retrieval operations\n10. Add logging for MCP server operations\n\nThe implementation should follow RESTful API design principles and should be able to handle concurrent requests from multiple clients.",
"testStrategy": "Testing for the MCP server functionality should include:\n\n1. Unit tests:\n - Test each MCP endpoint handler function independently\n - Verify context storage and retrieval mechanisms\n - Test authentication and authorization logic\n - Validate error handling for various failure scenarios\n\n2. Integration tests:\n - Set up a test MCP server instance\n - Test complete request/response cycles for each endpoint\n - Verify context persistence across multiple requests\n - Test with various payload sizes and content types\n\n3. Compatibility tests:\n - Test with existing MCP client libraries\n - Verify compliance with the MCP specification\n - Ensure backward compatibility with any MCP versions supported\n\n4. Performance tests:\n - Measure response times for context operations with various context sizes\n - Test concurrent request handling\n - Verify memory usage remains within acceptable limits during extended operation\n\n5. Security tests:\n - Verify authentication mechanisms cannot be bypassed\n - Test for common API vulnerabilities (injection, CSRF, etc.)\n\nAll tests should be automated and included in the CI/CD pipeline. Documentation should include examples of how to test the MCP server functionality manually using tools like curl or Postman."
"details": "This task involves implementing the Model Context Protocol server capabilities within Task Master using FastMCP. The implementation should:\n\n1. Use FastMCP to create the MCP server module (`mcp-server.ts` or equivalent)\n2. Implement the required MCP endpoints using FastMCP:\n - `/context` - For retrieving and updating context\n - `/models` - For listing available models\n - `/execute` - For executing operations with context\n3. Utilize FastMCP's built-in features for context management, including:\n - Efficient context storage and retrieval\n - Context windowing and truncation\n - Metadata and tagging support\n4. Add authentication and authorization mechanisms using FastMCP capabilities\n5. Implement error handling and response formatting as per MCP specifications\n6. Configure Task Master to enable/disable MCP server functionality via FastMCP settings\n7. Add documentation on using Task Master as an MCP server with FastMCP\n8. Ensure compatibility with existing MCP clients by adhering to FastMCP's compliance features\n9. Optimize performance using FastMCP tools, especially for context retrieval operations\n10. Add logging for MCP server operations using FastMCP's logging utilities\n\nThe implementation should follow RESTful API design principles and leverage FastMCP's concurrency handling for multiple client requests. Consider using TypeScript for better type safety and integration with FastMCP[1][2].",
"testStrategy": "Testing for the MCP server functionality should include:\n\n1. Unit tests:\n - Test each MCP endpoint handler function independently using FastMCP\n - Verify context storage and retrieval mechanisms provided by FastMCP\n - Test authentication and authorization logic\n - Validate error handling for various failure scenarios\n\n2. Integration tests:\n - Set up a test MCP server instance using FastMCP\n - Test complete request/response cycles for each endpoint\n - Verify context persistence across multiple requests\n - Test with various payload sizes and content types\n\n3. Compatibility tests:\n - Test with existing MCP client libraries\n - Verify compliance with the MCP specification\n - Ensure backward compatibility with any MCP versions supported by FastMCP\n\n4. Performance tests:\n - Measure response times for context operations with various context sizes\n - Test concurrent request handling using FastMCP's concurrency tools\n - Verify memory usage remains within acceptable limits during extended operation\n\n5. Security tests:\n - Verify authentication mechanisms cannot be bypassed\n - Test for common API vulnerabilities (injection, CSRF, etc.)\n\nAll tests should be automated and included in the CI/CD pipeline. Documentation should include examples of how to test the MCP server functionality manually using tools like curl or Postman."
},
{
"id": 24,
"title": "Implement AI-Powered Test Generation Command",
"description": "Create a new 'generate-test' command that leverages AI to automatically produce Jest test files for tasks based on their descriptions and subtasks.",
"title": "Implement AI-Powered Test Generation Command using FastMCP",
"description": "Create a new 'generate-test' command in Task Master that leverages AI to automatically produce Jest test files for tasks based on their descriptions and subtasks, utilizing FastMCP for AI integration.",
"status": "pending",
"dependencies": [
22
],
"priority": "high",
"details": "Implement a new command in the Task Master CLI that generates comprehensive Jest test files for tasks. The command should be callable as 'task-master generate-test --id=1' and should:\n\n1. Accept a task ID parameter to identify which task to generate tests for\n2. Retrieve the task and its subtasks from the task store\n3. Analyze the task description, details, and subtasks to understand implementation requirements\n4. Construct an appropriate prompt for an AI service (e.g., OpenAI API) that requests generation of Jest tests\n5. Process the AI response to create a well-formatted test file named 'task_XXX.test.js' where XXX is the zero-padded task ID\n6. Include appropriate test cases that cover the main functionality described in the task\n7. Generate mocks for external dependencies identified in the task description\n8. Create assertions that validate the expected behavior\n9. Handle both parent tasks and subtasks appropriately (for subtasks, name the file 'task_XXX_YYY.test.js' where YYY is the subtask ID)\n10. Include error handling for API failures, invalid task IDs, etc.\n11. Add appropriate documentation for the command in the help system\n\nThe implementation should utilize the existing AI service integration in the codebase and maintain consistency with the current command structure and error handling patterns.",
"testStrategy": "Testing for this feature should include:\n\n1. Unit tests for the command handler function to verify it correctly processes arguments and options\n2. Mock tests for the AI service integration to ensure proper prompt construction and response handling\n3. Integration tests that verify the end-to-end flow using a mock AI response\n4. Tests for error conditions including:\n - Invalid task IDs\n - Network failures when contacting the AI service\n - Malformed AI responses\n - File system permission issues\n5. Verification that generated test files follow Jest conventions and can be executed\n6. Tests for both parent task and subtask handling\n7. Manual verification of the quality of generated tests by running them against actual task implementations\n\nCreate a test fixture with sample tasks of varying complexity to evaluate the test generation capabilities across different scenarios. The tests should verify that the command outputs appropriate success/error messages to the console and creates files in the expected location with proper content structure.",
"details": "Implement a new command in the Task Master CLI that generates comprehensive Jest test files for tasks. The command should be callable as 'task-master generate-test --id=1' and should:\n\n1. Accept a task ID parameter to identify which task to generate tests for\n2. Retrieve the task and its subtasks from the task store\n3. Analyze the task description, details, and subtasks to understand implementation requirements\n4. Construct an appropriate prompt for the AI service using FastMCP\n5. Process the AI response to create a well-formatted test file named 'task_XXX.test.ts' where XXX is the zero-padded task ID\n6. Include appropriate test cases that cover the main functionality described in the task\n7. Generate mocks for external dependencies identified in the task description\n8. Create assertions that validate the expected behavior\n9. Handle both parent tasks and subtasks appropriately (for subtasks, name the file 'task_XXX_YYY.test.ts' where YYY is the subtask ID)\n10. Include error handling for API failures, invalid task IDs, etc.\n11. Add appropriate documentation for the command in the help system\n\nThe implementation should utilize FastMCP for AI service integration and maintain consistency with the current command structure and error handling patterns. Consider using TypeScript for better type safety and integration with FastMCP[1][2].",
"testStrategy": "Testing for this feature should include:\n\n1. Unit tests for the command handler function to verify it correctly processes arguments and options\n2. Mock tests for the FastMCP integration to ensure proper prompt construction and response handling\n3. Integration tests that verify the end-to-end flow using a mock FastMCP response\n4. Tests for error conditions including:\n - Invalid task IDs\n - Network failures when contacting the AI service\n - Malformed AI responses\n - File system permission issues\n5. Verification that generated test files follow Jest conventions and can be executed\n6. Tests for both parent task and subtask handling\n7. Manual verification of the quality of generated tests by running them against actual task implementations\n\nCreate a test fixture with sample tasks of varying complexity to evaluate the test generation capabilities across different scenarios. The tests should verify that the command outputs appropriate success/error messages to the console and creates files in the expected location with proper content structure.",
"subtasks": [
{
"id": 1,
"title": "Create command structure for 'generate-test'",
"description": "Implement the basic structure for the 'generate-test' command, including command registration, parameter validation, and help documentation",
"description": "Implement the basic structure for the 'generate-test' command, including command registration, parameter validation, and help documentation.",
"dependencies": [],
"details": "Implementation steps:\n1. Create a new file `src/commands/generate-test.js`\n2. Implement the command structure following the pattern of existing commands\n3. Register the new command in the CLI framework\n4. Add command options for task ID (--id=X) parameter\n5. Implement parameter validation to ensure a valid task ID is provided\n6. Add help documentation for the command\n7. Create the basic command flow that retrieves the task from the task store\n8. Implement error handling for invalid task IDs and other basic errors\n\nTesting approach:\n- Test command registration\n- Test parameter validation (missing ID, invalid ID format)\n- Test error handling for non-existent task IDs\n- Test basic command flow with a mock task store",
"details": "Implementation steps:\n1. Create a new file `src/commands/generate-test.ts`\n2. Implement the command structure following the pattern of existing commands\n3. Register the new command in the CLI framework\n4. Add command options for task ID (--id=X) parameter\n5. Implement parameter validation to ensure a valid task ID is provided\n6. Add help documentation for the command\n7. Create the basic command flow that retrieves the task from the task store\n8. Implement error handling for invalid task IDs and other basic errors\n\nTesting approach:\n- Test command registration\n- Test parameter validation (missing ID, invalid ID format)\n- Test error handling for non-existent task IDs\n- Test basic command flow with a mock task store",
"status": "pending",
"parentTaskId": 24
},
{
"id": 2,
"title": "Implement AI prompt construction and API integration",
"description": "Develop the logic to analyze tasks, construct appropriate AI prompts, and interact with the AI service to generate test content",
"title": "Implement AI prompt construction and FastMCP integration",
"description": "Develop the logic to analyze tasks, construct appropriate AI prompts, and interact with the AI service using FastMCP to generate test content.",
"dependencies": [
1
],
"details": "Implementation steps:\n1. Create a utility function to analyze task descriptions and subtasks for test requirements\n2. Implement a prompt builder that formats task information into an effective AI prompt\n3. The prompt should request Jest test generation with specifics about mocking dependencies and creating assertions\n4. Integrate with the existing AI service in the codebase to send the prompt\n5. Process the AI response to extract the generated test code\n6. Implement error handling for API failures, rate limits, and malformed responses\n7. Add appropriate logging for the AI interaction process\n\nTesting approach:\n- Test prompt construction with various task types\n- Test AI service integration with mocked responses\n- Test error handling for API failures\n- Test response processing with sample AI outputs",
"details": "Implementation steps:\n1. Create a utility function to analyze task descriptions and subtasks for test requirements\n2. Implement a prompt builder that formats task information into an effective AI prompt\n3. Use FastMCP to send the prompt and receive the response\n4. Process the FastMCP response to extract the generated test code\n5. Implement error handling for FastMCP failures, rate limits, and malformed responses\n6. Add appropriate logging for the FastMCP interaction process\n\nTesting approach:\n- Test prompt construction with various task types\n- Test FastMCP integration with mocked responses\n- Test error handling for FastMCP failures\n- Test response processing with sample FastMCP outputs",
"status": "pending",
"parentTaskId": 24
},
{
"id": 3,
"title": "Implement test file generation and output",
"description": "Create functionality to format AI-generated tests into proper Jest test files and save them to the appropriate location",
"description": "Create functionality to format AI-generated tests into proper Jest test files and save them to the appropriate location.",
"dependencies": [
2
],
"details": "Implementation steps:\n1. Create a utility to format the AI response into a well-structured Jest test file\n2. Implement naming logic for test files (task_XXX.test.js for parent tasks, task_XXX_YYY.test.js for subtasks)\n3. Add logic to determine the appropriate file path for saving the test\n4. Implement file system operations to write the test file\n5. Add validation to ensure the generated test follows Jest conventions\n6. Implement formatting of the test file for consistency with project coding standards\n7. Add user feedback about successful test generation and file location\n8. Implement handling for both parent tasks and subtasks\n\nTesting approach:\n- Test file naming logic for various task/subtask combinations\n- Test file content formatting with sample AI outputs\n- Test file system operations with mocked fs module\n- Test the complete flow from command input to file output\n- Verify generated tests can be executed by Jest",
"details": "Implementation steps:\n1. Create a utility to format the FastMCP response into a well-structured Jest test file\n2. Implement naming logic for test files (task_XXX.test.ts for parent tasks, task_XXX_YYY.test.ts for subtasks)\n3. Add logic to determine the appropriate file path for saving the test\n4. Implement file system operations to write the test file\n5. Add validation to ensure the generated test follows Jest conventions\n6. Implement formatting of the test file for consistency with project coding standards\n7. Add user feedback about successful test generation and file location\n8. Implement handling for both parent tasks and subtasks\n\nTesting approach:\n- Test file naming logic for various task/subtask combinations\n- Test file content formatting with sample FastMCP outputs\n- Test file system operations with mocked fs module\n- Test the complete flow from command input to file output\n- Verify generated tests can be executed by Jest",
"status": "pending",
"parentTaskId": 24
}