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,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: