70 Commits

Author SHA1 Message Date
Eyal Toledano
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
2025-04-09 18:18:13 -04:00
Ralph Khreish
c02483bc41 chore: run npm run format 2025-04-09 00:30:05 +02:00
Eyal Toledano
b7580e038d Recovers lost files and commits work from the past 5-6 days. Holy shit that was a close call. 2025-04-08 15:55:22 -04:00
Eyal Toledano
cdd87ccc5e feat: adds remove-task command + MCP implementation. 2025-04-08 15:54:33 -04:00
Ralph Khreish
9dc5e75760 Revert "Update analyze-complexity with realtime feedback and enhanced complex…"
This reverts commit 16f4d4b93210f072e771fad4d938c5ab29129e00.
2025-04-02 19:28:01 +02:00
Joe Danziger
16f4d4b932
Update analyze-complexity with realtime feedback and enhanced complexity report (#70)
* Update analyze-complexity with realtime feedback

* PR fixes

* include changeset
2025-04-02 01:57:19 +02:00
Eyal Toledano
2c3986c097
Merge pull request #67 from joedanz/confirm-tasks.json-overwrite
Added confirmation for task overwrite if tasks.json exists.
Fully tested

POPS @JOEDANZ' DEV CHERRY!
2025-03-30 23:00:53 -04:00
Joe Danziger
7086a77625 Added confirmation for task overwrite if tasks.json exists.
Slight refactor moving numTasks and outputPath to top with the other variables.  Eliminates duplication, and keeps us from having to check path twice.
Resolves #65
2025-03-30 18:30:00 -04:00
Eyal Toledano
4604f96a92 New update-subtask command. 2025-03-29 19:14:44 -04:00
Eyal Toledano
e70f44b6fb fix: Correct handling of dependencies between subtasks
This commit fixes an issue with the dependency management system where
dependencies between subtasks of the same parent task were not being
handled correctly. Previously, when trying to add a dependency between
subtasks (e.g., making 23.8 depend on 23.13), the system incorrectly
interpreted it as a circular dependency of the parent task depending
on itself.

Changes:
- Modified add-dependency and remove-dependency commands to preserve
  string format for subtask IDs containing dots instead of converting
  them to integers
- Updated dependency detection logic to properly handle string-based
  subtask IDs
- Added specific tests verifying both successful dependency chains
  and circular dependency detection between subtasks of the same parent

The fix ensures proper task ordering for development workflows where
related subtasks must be completed in sequence (like establishing tests
before implementing a feature). It maintains backward compatibility with
existing task structures while correctly enforcing dependency chains
within subtask groups.

Tests:
- Added tests for valid dependency chains between subtasks of the same parent
- Added tests for circular dependency detection in subtask relationships
- Added specific test for the 23.8->23.13->23.10 subtask dependency chain

Resolves the issue where the suggested task development workflow couldn't
be properly enforced through the dependency management system.
2025-03-29 18:19:39 -04:00
Eyal Toledano
1d807541ae feat: enhance commands with multi-subtask support, MCP integration, and update notifications
- Add support for comma-separated subtask IDs in remove-subtask command
- Implement MCP configuration in project initialization
- Add package update notification system with version comparison
- Improve command documentation with boolean flag conventions
- Add comprehensive error handling for unknown options
- Update help text with better examples and formatting
- Implement proper validation for command inputs
- Add global error handling patterns with helpful user messages
2025-03-27 16:14:12 -04:00
Eyal Toledano
08d3f2db26 git commit -m "fix: improve CLI error handling and standardize option flags
This commit fixes several issues with command line interface error handling:

   1. Fix inconsistent behavior between --no-generate and --skip-generate:
      - Standardized on --skip-generate across all commands
      - Updated bin/task-master.js to use --skip-generate instead of --no-generate
      - Modified add-subtask and remove-subtask commands to use --skip-generate

   2. Enhance error handling for unknown options:
      - Removed .allowUnknownOption() from commands to properly detect unknown options
      - Added global error handler in bin/task-master.js for unknown commands/options
      - Added command-specific error handlers with helpful error messages

   3. Improve user experience with better help messages:
      - Added helper functions to display formatted command help on errors
      - Created command-specific help displays for add-subtask and remove-subtask
      - Show available options when encountering unknown options

   4. Update MCP server configuration:
      - Modified .cursor/mcp.json to use node ./mcp-server/server.js directly
      - Removed npx -y usage for more reliable execution

   5. Other minor improvements:
      - Adjusted column width for task ID display in UI
      - Updated version number in package-lock.json to 0.9.30

   This resolves issues where users would see confusing error messages like
   'error: unknown option --generate' when using an incorrect flag."
2025-03-27 13:32:56 -04:00
Eyal Toledano
707618ca5d Implements updateTask command to update a single task instead of all tasks as of a certain one. Useful when iterating and R&D'ing bit by bit and needing more research after what has been done. 2025-03-27 01:33:20 -04:00
Eyal Toledano
c59bd8c9fc fix: Improve CLI flag validation for single-word flags
Fix issue with kebab-case validator incorrectly flagging single-word flags like --prompt. Refactor detectCamelCaseFlags to properly handle all single-word flags. Update tests to verify correct behavior with single-word and camelCase flags. Add support for alternative flag formats in init command (e.g., -my_name). This fixes a bug where users couldn't use the --prompt flag directly and had to use -p instead.
2025-03-26 15:54:51 -04:00
Eyal Toledano
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
2025-03-26 15:07:31 -04:00
Eyal Toledano
b3d6e61e6b fix: ensure CLI correctly handles kebab-case options
- Fixed CLI wrapper to convert camelCase options to kebab-case when passing to dev.js
- Added explicit support for --input option in parse-prd command
- Updated commands.mdc to clarify Commander.js camelCase/kebab-case behavior
2025-03-25 00:42:59 -04:00
Eyal Toledano
a26e7adf8c feat: adds ability to add or remove subtasks. Can also turn subtasks into standalone features. Also refactors the task-master.js by deleting 200+ lines of duplicate code. Instead properly imports the commands from commands.js which is the single source of truth for command definitions. 2025-03-24 21:18:49 -04:00
Eyal Toledano
be3fe9c55e fixes issue with perplexity model used by default (now sonar-pro in all cases). Fixes an issue preventing analyzeTaskComplexity to work as designed. Fixes an issue that prevented parse-prd from working. Stubs in the test for analyzeTaskComplexity to be done later. 2025-03-24 16:30:27 -04:00
Eyal Toledano
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.
2025-03-24 13:28:08 -04:00
Eyal Toledano
633a5b963e Refactor: Modularize Task Master CLI into Modules Directory
Simplified the Task Master CLI by organizing code into modules within the  directory.

**Why:**

- **Better Organization:** Code is now grouped by function (AI, commands, dependencies, tasks, UI, utilities).
- **Easier to Maintain:**  Smaller modules are simpler to update and fix.
- **Scalable:**  New features can be added more easily in a structured way.

**What Changed:**

- Moved code from single   _____         _      __  __           _
 |_   _|_ _ ___| | __ |  \/  | __ _ ___| |_ ___ _ __
   | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__|
   | | (_| \__ \   <  | |  | | (_| \__ \ ||  __/ |
   |_|\__,_|___/_|\_\ |_|  |_|\__,_|___/\__\___|_|

by https://x.com/eyaltoledano
╭────────────────────────────────────────────╮
│                                            │
│   Version: 0.9.16   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-small-onl…
    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       file into these new modules:
    - : AI interactions (Claude, Perplexity)
    - :  CLI command definitions (Commander.js)
    - : Task dependency handling
    - : Core task operations (create, list, update, etc.)
    - : User interface elements (display, formatting)
    - : Utility functions and configuration
    - :  Exports all modules
- Replaced direct use of   _____         _      __  __           _
 |_   _|_ _ ___| | __ |  \/  | __ _ ___| |_ ___ _ __
   | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__|
   | | (_| \__ \   <  | |  | | (_| \__ \ ||  __/ |
   |_|\__,_|___/_|\_\ |_|  |_|\__,_|___/\__\___|_|

by https://x.com/eyaltoledano
╭────────────────────────────────────────────╮
│                                            │
│   Version: 0.9.16   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-small-onl…
    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       with the global  command (see ).
- Updated documentation () to reflect the new  command.

**Benefits:**

Code is now cleaner, easier to work with, and ready for future growth.

Use the  command (or ) to run the CLI.  See  for command details.
2025-03-23 23:19:37 -04:00