mirror of
https://github.com/eyaltoledano/claude-task-master.git
synced 2025-07-30 20:34:19 +00:00
10 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
d84c2486e4 |
fix(config): Improve config manager flexibility & test mocks
Refactored `config-manager.js` to handle different execution contexts (CLI vs. MCP) and fixed related Jest tests. - Modified `readConfig` and `writeConfig` to accept an optional `explicitRoot` parameter, allowing explicit path specification (e.g., from MCP) while retaining automatic project root finding for CLI usage. - Updated getter/setter functions (`getMainProvider`, `setMainModel`, etc.) to accept and propagate the `explicitRoot`. - Resolved Jest testing issues for dynamic imports by using `jest.unstable_mockModule` for `fs` and `chalk` dependencies *before* the dynamic `import()`. - Corrected console error assertions in tests to match exact logged messages. - Updated `.cursor/rules/tests.mdc` with guidelines for `jest.unstable_mockModule` and precise console assertions. |
||
![]() |
12519946b4 |
fix(commands): implement manual creation mode for add-task command
- Add support for --title/-t and --description/-d flags in add-task command - Fix validation for manual creation mode (title + description) - Implement proper testing for both prompt and manual creation modes - Update testing documentation with Commander.js testing best practices - Add guidance on handling variable hoisting and module initialization issues Changeset: brave-doors-open.md |
||
![]() |
709ea63350 | fix(add-task): sets up test and new test rules for the fix for add-task to support flags for manually setting title and subtitle (stashed, next commit) | ||
![]() |
cd4f4e66d7 |
feat(mcp): Refactor MCP tools for direct function calls & add docs
This commit introduces a major refactoring of the MCP server implementation to prioritize direct function calls over CLI execution, enhancing performance and reliability. It also includes substantial updates to documentation for consistency and interlinking. **MCP Server & Core Logic Refactoring:** 1. **Introduce Direct Function Wrappers ():** * Created to house direct wrappers for core Task Master functions (imported from ). * Implemented as the first wrapper, calling . * Added utility within to centralize file location logic, removing duplication. * Established the map for registering these wrappers. 2. **Enhance MCP Utilities ():** * Added : A primary utility function to streamline MCP tool methods. It handles logging, argument processing (incl. project root normalization), calling the direct action function (e.g., ), processing results via , and formatting the final MCP response. * Added : Standardizes processing of objects returned by direct function wrappers. * Added : Filters sensitive/large fields (like , ) from responses sent to the MCP client. * Added , , to support the new workflow. * Refactored to use internally, simplifying its usage (though it's now primarily a fallback). 3. **Update MCP Tools (, ):** * Refactored to use with , significantly simplifying the tool's method. * Updated (initially) to use the improved (Note: further refactoring to use a direct wrapper for would follow the pattern). **Documentation Enhancements:** 4. **Comprehensive Interlinking:** Added links across rule files (, , , , , ) to connect related guidelines, improving navigation. 5. **Standardize CLI Syntax ():** Removed legacy ℹ️ Initialized Perplexity client with OpenAI compatibility layer examples, reinforcing ℹ️ Initialized Perplexity client with OpenAI compatibility layer _____ _ __ __ _ |_ _|_ _ ___| | __ | \/ | __ _ ___| |_ ___ _ __ | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__| | | (_| \__ \ < | | | | (_| \__ \ || __/ | |_|\__,_|___/_|\_\ |_| |_|\__,_|___/\__\___|_| by https://x.com/eyaltoledano ╭────────────────────────────────────────────╮ │ │ │ Version: 0.9.30 Project: Task Master │ │ │ ╰────────────────────────────────────────────╯ ╭─────────────────────╮ │ │ │ Task Master CLI │ │ │ ╰─────────────────────╯ ╭───────────────────╮ │ Task Generation │ ╰───────────────────╯ parse-prd --input=<file.txt> [--tasks=10] Generate tasks from a PRD document generate Create individual task files from tasks… ╭───────────────────╮ │ Task Management │ ╰───────────────────╯ list [--status=<status>] [--with-subtas… List all tasks with their status set-status --id=<id> --status=<status> Update task status (done, pending, etc.) update --from=<id> --prompt="<context>" Update tasks based on new requirements add-task --prompt="<text>" [--dependencies=… Add a new task using AI add-dependency --id=<id> --depends-on=<id> Add a dependency to a task remove-dependency --id=<id> --depends-on=<id> Remove a dependency from a task ╭──────────────────────────╮ │ Task Analysis & Detail │ ╰──────────────────────────╯ analyze-complexity [--research] [--threshold=5] Analyze tasks and generate expansion re… complexity-report [--file=<path>] Display the complexity analysis report expand --id=<id> [--num=5] [--research] [… Break down tasks into detailed subtasks expand --all [--force] [--research] Expand all pending tasks with subtasks clear-subtasks --id=<id> Remove subtasks from specified tasks ╭─────────────────────────────╮ │ Task Navigation & Viewing │ ╰─────────────────────────────╯ next Show the next task to work on based on … show <id> Display detailed information about a sp… ╭─────────────────────────╮ │ Dependency Management │ ╰─────────────────────────╯ validate-dependenci… Identify invalid dependencies without f… fix-dependencies Fix invalid dependencies automatically ╭─────────────────────────╮ │ Environment Variables │ ╰─────────────────────────╯ ANTHROPIC_API_KEY Your Anthropic API key Required MODEL Claude model to use Default: claude-3-7-sonn… MAX_TOKENS Maximum tokens for responses Default: 4000 TEMPERATURE Temperature for model responses Default: 0.7 PERPLEXITY_API_KEY Perplexity API key for research Optional PERPLEXITY_MODEL Perplexity model to use Default: sonar-pro DEBUG Enable debug logging Default: false LOG_LEVEL Console output level (debug,info,warn,error) Default: info DEFAULT_SUBTASKS Default number of subtasks to generate Default: 3 DEFAULT_PRIORITY Default task priority Default: medium PROJECT_NAME Project name displayed in UI Default: Task Master _____ _ __ __ _ |_ _|_ _ ___| | __ | \/ | __ _ ___| |_ ___ _ __ | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__| | | (_| \__ \ < | | | | (_| \__ \ || __/ | |_|\__,_|___/_|\_\ |_| |_|\__,_|___/\__\___|_| by https://x.com/eyaltoledano ╭────────────────────────────────────────────╮ │ │ │ Version: 0.9.30 Project: Task Master │ │ │ ╰────────────────────────────────────────────╯ ╭─────────────────────╮ │ │ │ Task Master CLI │ │ │ ╰─────────────────────╯ ╭───────────────────╮ │ Task Generation │ ╰───────────────────╯ parse-prd --input=<file.txt> [--tasks=10] Generate tasks from a PRD document generate Create individual task files from tasks… ╭───────────────────╮ │ Task Management │ ╰───────────────────╯ list [--status=<status>] [--with-subtas… List all tasks with their status set-status --id=<id> --status=<status> Update task status (done, pending, etc.) update --from=<id> --prompt="<context>" Update tasks based on new requirements add-task --prompt="<text>" [--dependencies=… Add a new task using AI add-dependency --id=<id> --depends-on=<id> Add a dependency to a task remove-dependency --id=<id> --depends-on=<id> Remove a dependency from a task ╭──────────────────────────╮ │ Task Analysis & Detail │ ╰──────────────────────────╯ analyze-complexity [--research] [--threshold=5] Analyze tasks and generate expansion re… complexity-report [--file=<path>] Display the complexity analysis report expand --id=<id> [--num=5] [--research] [… Break down tasks into detailed subtasks expand --all [--force] [--research] Expand all pending tasks with subtasks clear-subtasks --id=<id> Remove subtasks from specified tasks ╭─────────────────────────────╮ │ Task Navigation & Viewing │ ╰─────────────────────────────╯ next Show the next task to work on based on … show <id> Display detailed information about a sp… ╭─────────────────────────╮ │ Dependency Management │ ╰─────────────────────────╯ validate-dependenci… Identify invalid dependencies without f… fix-dependencies Fix invalid dependencies automatically ╭─────────────────────────╮ │ Environment Variables │ ╰─────────────────────────╯ ANTHROPIC_API_KEY Your Anthropic API key Required MODEL Claude model to use Default: claude-3-7-sonn… MAX_TOKENS Maximum tokens for responses Default: 4000 TEMPERATURE Temperature for model responses Default: 0.7 PERPLEXITY_API_KEY Perplexity API key for research Optional PERPLEXITY_MODEL Perplexity model to use Default: sonar-pro DEBUG Enable debug logging Default: false LOG_LEVEL Console output level (debug,info,warn,error) Default: info DEFAULT_SUBTASKS Default number of subtasks to generate Default: 3 DEFAULT_PRIORITY Default task priority Default: medium PROJECT_NAME Project name displayed in UI Default: Task Master as the primary CLI. 6. **Add MCP Architecture & Workflow Sections:** Added detailed sections in and explaining MCP server structure and the workflow for adding new MCP tool integrations using the direct function pattern. 7. **Clarify MCP Role:** Updated and to better explain the MCP server's role and its specific utilities. Overall, this establishes a cleaner, more performant, and maintainable pattern for integrating Task Master functionality with the MCP server, supported by improved documentation. |
||
![]() |
6322a1a66f |
fix: improve testing and CLI command implementation
- Fix tests using ES Module best practices instead of complex mocking - Replace Commander.js mocking with direct action handler testing - Resolve ES Module import/mock issues and function redeclaration errors - Fix circular reference issues with console.log spies - Properly setup mock functions with jest.fn() for method access - Improve parse-prd command functionality - Add default PRD path support (scripts/prd.txt) so you can just run `task-master parse-prd` and it will use the default PRD if it exists. - Improve error handling and user feedback - Enhance help text with more detailed information - Fix detectCamelCaseFlags implementation in utils.js yet again with more tests this time - Improve regex pattern to correctly detect camelCase flags - Skip flags already in kebab-case format - Enhance tests with proper test-specific implementations - Document testing best practices - Add comprehensive "Common Testing Pitfalls and Solutions" section to tests.mdc - Provide clear examples of correct testing patterns for ES modules - Document techniques for test isolation and mock organization |
||
![]() |
9e19b54518 |
feat: Enhance testing, CLI flag validation, and AI capabilities
This commit introduces several significant improvements: - **Enhanced Unit Testing:** Vastly improved unit tests for the module, covering core functions, edge cases, and error handling. Simplified test functions and comprehensive mocking were implemented for better isolation and reliability. Added new section to tests.mdc detailing reliable testing techniques. - **CLI Kebab-Case Flag Enforcement:** The CLI now enforces kebab-case for flags, providing helpful error messages when camelCase is used. This improves consistency and user experience. - **AI Enhancements:** - Enabled 128k token output for Claude 3.7 Sonnet by adding the header. - Added a new task to to document this change and its testing strategy. - Added unit tests to verify the Anthropic client configuration. - Added and utility functions. - **Improved Test Coverage:** Added tests for the new CLI flag validation logic. |
||
![]() |
002612bdf9 | chore: implements the integration tests for setTaskStatus, updateSingleTaskSTatus, listTasks and addTask | ||
![]() |
4690c99d4a | feat: Adds unit test for generateTaskFiles and updates tests.mdc with new insights for effectively writing tests for an ES Module | ||
![]() |
c5738a2513 |
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. |
||
![]() |
7df58df199 |
feat: Enhance Task Master CLI with Testing Framework, Perplexity AI Integration, and Refactored Core Logic
This commit introduces significant enhancements and refactoring to the Task Master CLI, focusing on improved testing, integration with Perplexity AI for research-backed task updates, and core logic refactoring for better maintainability and functionality. **Testing Infrastructure Setup:** - Implemented Jest as the primary testing framework, setting up a comprehensive testing environment. - Added new test scripts to including , , and for streamlined testing workflows. - Integrated necessary devDependencies for testing, such as , , , , and , to support unit, integration, and end-to-end testing. **Dependency Updates:** - Updated and to reflect the latest dependency versions, ensuring project stability and access to the newest features and security patches. - Upgraded to version 0.9.16 and usage: openai [-h] [-v] [-b API_BASE] [-k API_KEY] [-p PROXY [PROXY ...]] [-o ORGANIZATION] [-t {openai,azure}] [--api-version API_VERSION] [--azure-endpoint AZURE_ENDPOINT] [--azure-ad-token AZURE_AD_TOKEN] [-V] {api,tools,migrate,grit} ... positional arguments: {api,tools,migrate,grit} api Direct API calls tools Client side tools for convenience options: -h, --help show this help message and exit -v, --verbose Set verbosity. -b, --api-base API_BASE What API base url to use. -k, --api-key API_KEY What API key to use. -p, --proxy PROXY [PROXY ...] What proxy to use. -o, --organization ORGANIZATION Which organization to run as (will use your default organization if not specified) -t, --api-type {openai,azure} The backend API to call, must be `openai` or `azure` --api-version API_VERSION The Azure API version, e.g. 'https://learn.microsoft.com/en-us/azure/ai- services/openai/reference#rest-api-versioning' --azure-endpoint AZURE_ENDPOINT The Azure endpoint, e.g. 'https://endpoint.openai.azure.com' --azure-ad-token AZURE_AD_TOKEN A token from Azure Active Directory, https://www.microsoft.com/en- us/security/business/identity-access/microsoft-entra- id -V, --version show program's version number and exit to 4.89.0. - Added dependency (version 2.3.0) and updated related dependencies to their latest versions. **Perplexity AI Integration for Research-Backed Updates:** - Introduced an option to leverage Perplexity AI for task updates, enabling research-backed enhancements to task details. - Implemented logic to initialize a Perplexity AI client if the environment variable is available. - Modified the function to accept a parameter, allowing dynamic selection between Perplexity AI and Claude AI for task updates based on API key availability and user preference. - Enhanced to handle responses from Perplexity AI and update tasks accordingly, including improved error handling and logging for robust operation. **Core Logic Refactoring and Improvements:** - Refactored the function to utilize task IDs instead of dependency IDs, ensuring consistency and clarity in dependency management. - Implemented a new function to rigorously check for both circular dependencies and self-dependencies within tasks, improving task relationship integrity. - Enhanced UI elements in : - Refactored to incorporate icons for different task statuses and utilize a object for color mapping, improving visual representation of task status. - Updated to display colored complexity scores with emojis, providing a more intuitive and visually appealing representation of task complexity. - Refactored the task data structure creation and validation process: - Updated the JSON Schema for to reflect a more streamlined and efficient task structure. - Implemented Task Model Classes for better data modeling and type safety. - Improved File System Operations for task data management. - Developed robust Validation Functions and an Error Handling System to ensure data integrity and application stability. **Testing Guidelines Implementation:** - Implemented guidelines for writing testable code when developing new features, promoting a test-driven development approach. - Added testing requirements and best practices for unit, integration, and edge case testing to ensure comprehensive test coverage. - Updated the development workflow to mandate writing tests before proceeding with configuration and documentation updates, reinforcing the importance of testing throughout the development lifecycle. This commit collectively enhances the Task Master CLI's reliability, functionality, and developer experience through improved testing practices, AI-powered research capabilities, and a more robust and maintainable codebase. |