292 Commits

Author SHA1 Message Date
Eyal Toledano
c6b8783bce chore: clean up default env value references across the code to be consistent. 2025-04-11 13:38:12 -04:00
Ralph Khreish
d3d9dc6ebe
fix: replace tool parameter inputs with root directory paths (#147)
* wip: replace tool parameter inputs with root directory paths

* fix: moved path resolving responsibility to tools

- made path in parameters to optional for AI
- internalised path resolving using session roots

* chore: update package-lock.json

* chore: fix regressions and fix CI

* fix: make projectRoot required

* fix: add-task tool

* fix: updateTask tool

* fix: remove reportProgress

* chore: cleanup

* fix: expand-task tool

* chore: remove usless logs

* fix: dependency manager logging in mcp server
2025-04-11 18:57:43 +02:00
Joe Danziger
30e6d47577
Don't add task-master-mcp to mcp.json if it already exists (#169) 2025-04-11 18:07:58 +02:00
Eyal Toledano
e88682f881 feat(mcp): Refactor initialize_project tool for direct execution
Refactors the initialize_project MCP tool to call a dedicated direct function (initializeProjectDirect) instead of executing the CLI command. This improves reliability and aligns it with other MCP tools.

Key changes include: Modified initialize-project.js to call initializeProjectDirect, required projectRoot parameter, implemented handleApiResult for MCP response formatting, enhanced direct function to prioritize args.projectRoot over session-derived paths, added validation to prevent initialization in invalid directories, forces yes:true for non-interactive use, ensures process.chdir() targets validated directory, and added isSilentMode() checks to suppress console output during MCP operations.

This resolves issues where the tool previously failed due to incorrect fallback directory resolution when session context was incomplete.
2025-04-11 01:16:32 -04:00
Eyal Toledano
a86e9affc5 refactor(init): Fix init command execution and argument handling
Centralizes init command logic within the main CLI structure. The action handler in commands.js now directly calls initializeProject from the init.js module, resolving issues with argument parsing (like -y) and removing the need for the separate bin/task-master-init.js executable. Updates package.json and bin/task-master.js accordingly.
2025-04-10 22:32:08 -04:00
Eyal Toledano
4f68bf3b47 chore: prettier formatting 2025-04-09 18:20:47 -04:00
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
cfe3ba91e8
fix: MCP config and commands (#141) 2025-04-09 20:01:27 +02:00
Eyal Toledano
34501878b2
Merge pull request #130 from eyaltoledano/expand-all-bug
fix(expand-all): resolve NaN errors and improve error reporting
2025-04-09 12:01:07 -04:00
Ralph Khreish
42bf897f81 fix: Remove fallback subtasks in parseSubtasksFromText to properly throw errors on invalid input 2025-04-09 10:22:16 +02:00
Ralph Khreish
5e01399dca chore: run formatting on codebase to pass CI 2025-04-09 10:07:49 +02:00
Eyal Toledano
e6fe5dac85
fix: Remove task-master-ai as a dependency from the package.json generated during init (#129)
Co-authored-by: Eyal Toledano <eyal@microangel.so>
2025-04-09 10:06:40 +02:00
Eyal Toledano
01a5be25a8 fix(expand-all): resolve NaN errors and improve error reporting
- Fix expand-all command bugs that caused NaN errors with --all option and JSON formatting errors with research enabled

- Improve error handling to provide clear feedback when subtask generation fails

- Include task IDs and actionable suggestions in error messages
2025-04-09 01:24:14 -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
76ecfc086a Makes default command npx -y task-master-mcp-server 2025-04-08 15:55:22 -04:00
Eyal Toledano
8e478f9e5e chore: Adjusts the mcp server command from task-master-mcp-server to task-master-mcp. It cannot be simpler because global installations of the npm package would expose this as a globally available command. Calling it like 'mcp' could collide and also is lacking in branding and clarity of what command would be run. This is as good as we can make it. 2025-04-08 15:55:22 -04:00
Eyal Toledano
bad16b200f chore: changeset + update rules. 2025-04-08 15:55:22 -04:00
Eyal Toledano
d71e7872ea chore: adds task-master-ai to the createProjectStructure which merges/creates the package.json. This is so that onboarding via MCP is possible. When the MCP server runs and does npm i, it will get task-master, and get the ability to run task-master init. 2025-04-08 15:54:36 -04:00
Eyal Toledano
01bd121de2 chore: Adjust init with new dependencies for MCP and other missing dependencies. 2025-04-08 15:54:36 -04:00
Eyal Toledano
cdd87ccc5e feat: adds remove-task command + MCP implementation. 2025-04-08 15:54:33 -04:00
Eyal Toledano
f16a574ad8 feat: Adjustst the parsePRD system prompt and cursor rule so to improve following specific details that may already be outliend in the PRD. This reduces cases where the AI will not use those details and come up with its own approach. Next commit will reduce detfault temperature to do this at scale across the system too. 2025-04-08 15:54:06 -04:00
Eyal Toledano
6393f9f7fb chore: adjust the setupMCPConfiguration so it adds in the new env stuff. 2025-04-08 15:54:06 -04:00
Eyal Toledano
a49a77d19f fix: Improve MCP server robustness and debugging
- Refactor  for more reliable project root detection, particularly when running within integrated environments like Cursor IDE. Includes deriving root from script path and avoiding fallback to '/'.
- Enhance error handling in :
    - Add detailed debug information (paths searched, CWD, etc.) to the error message when  is not found in the provided project root.
    - Improve clarity of error messages and potential solutions.
- Add verbose logging in  to trace session object content and the finally resolved project root path, aiding in debugging path-related issues.
- Add default values for  and  to the example  environment configuration.
2025-04-08 15:54:06 -04:00
Eyal Toledano
3af469b35f feat(mcp): major MCP server improvements and documentation overhaul
- Enhance MCP server robustness and usability:
  - Implement smart project root detection with hierarchical fallbacks
  - Make projectRoot parameter optional across all MCP tools
  - Add comprehensive PROJECT_MARKERS for reliable project detection
  - Improve error messages and logging for better debugging
  - Split monolithic core into focused direct-function files

- Implement full suite of MCP commands:
  - Add task management: update-task, update-subtask, generate
  - Add task organization: expand-task, expand-all, clear-subtasks
  - Add dependency handling: add/remove/validate/fix dependencies
  - Add analysis tools: analyze-complexity, complexity-report
  - Rename commands for better API consistency (list-tasks → get-tasks)

- Enhance documentation and developer experience:
  - Create and bundle new taskmaster.mdc as comprehensive reference
  - Document all tools with natural language patterns and examples
  - Clarify project root auto-detection in documentation
  - Standardize naming conventions across MCP components
  - Add cross-references between related tools and commands

- Improve UI and progress tracking:
  - Add color-coded progress bars with status breakdown
  - Implement cancelled/deferred task status handling
  - Enhance status visualization and counting
  - Optimize display for various terminal sizes

This major update significantly improves the robustness and usability
of the MCP server while providing comprehensive documentation for both
users and developers. The changes make Task Master more intuitive to
use programmatically while maintaining full CLI functionality.
2025-04-08 15:54:06 -04:00
Eyal Toledano
c98b0cea11 Adjusts the taskmaster mcp invokation command in mcp.json shipped with taskmaster init. 2025-04-08 15:54:06 -04:00
Eyal Toledano
3bfbe19fe3 Enhance progress bars with status breakdown, improve readability, optimize display width, and update changeset 2025-04-08 15:51:55 -04:00
Eyal Toledano
087de784fa feat(ui): add cancelled status and improve MCP resource docs
- Add cancelled status to UI module for marking tasks cancelled without deletion
- Improve MCP server resource documentation with implementation examples
- Update architecture.mdc with detailed resource management info
- Add comprehensive resource handling guide to mcp.mdc
- Update changeset to reflect new features and documentation
- Mark task 23.6 as cancelled (MCP SDK integration no longer needed)
- Complete task 23.12 (structured logging system)
2025-04-08 15:51:55 -04:00
Eyal Toledano
fb4a8b6cb7 feat(ui): add color-coded progress bar to task show view for visualizing subtask completion status 2025-04-08 15:51:55 -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
Ralph Khreish
757fd478d2
Add License (#45) 2025-03-31 17:09:31 +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
42585519d3 feat(cache): Implement caching for listTasks MCP endpoint
Implemented LRU caching for the  function to improve performance for repeated requests.

Key changes include:
- Added  dependency.
- Introduced a reusable  utility function in  leveraging a .
- Refactored  in  to use the caching utility with a key based on task path, filter, and subtask flag.
- Modified  to include the  boolean flag in the final JSON response structure, nesting the original data under a  key.
- Added  function and corresponding MCP tool () for monitoring cache performance.
- Improved error handling in  for cases where  is not found.

This addresses the previous issue of the empty task list likely caused by stale cache entries and provides clear visibility into whether a response is served from the cache.

Relates to #23.9
2025-03-30 02:25:24 -04:00
Eyal Toledano
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.
2025-03-30 00:29:12 -04:00
Eyal Toledano
1094f50014 fix(ui): Display subtask details in 'show' command output
Ensures that the 'details' field, which can be updated via 'update-subtask', is correctly rendered when viewing a specific subtask.

fix(test): Remove empty describe block causing Jest error

Removes a redundant  block in  that contained a  hook but no tests.

chore: Add  npm script
2025-03-29 20:33:18 -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
472b517e22 chore: task management, adjust readmes, adjust cursor rules, add mcp_integration.md to docs 2025-03-27 23:40:13 -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
cea14b55b3 Ensures that the updateTask (single task) doesn't change the title of the task. 2025-03-27 01:46:13 -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
1abcf69ecd Adds 3 docs for MCP related context provision. Also updates the system prompt for the task update command. Updated the system prompt with clear guidelines about:
Preserving completed subtasks exactly as they are
Building upon what has already been done
Creating new subtasks instead of modifying completed ones
Making new subtasks specific and targeted
Added specific instructions to the Perplexity AI system message to emphasize preserving completed subtasks
Added an informative boxed message to the user explaining how completed subtasks will be handled during the update process
Added emphatic instructions in the user prompts to both Claude and Perplexity to highlight completed subtasks that must be preserved
These changes ensure that:
Completed subtasks will be preserved
The AI will build on top of what's already been done
If something needs to be changed/undone, it will be handled through new subtasks
The user is clearly informed about how subtasks are handled.
2025-03-27 00:58:14 -04:00
Eyal Toledano
751854d5ee adds 'tm' and 'taskmaster' aliases to zshrc or bashrc automatically, added as options in the init questions. 2025-03-27 00:00:38 -04:00
Eyal Toledano
dac1ea61e8 feat: Adds .windsurfrules to the init package. It's composed of the 3 rules we currently package, and has been edited to be Windsurf specific. Rules are added in as sections. The init function will search for an existing .windsurfrules document, and if it finds it, it will append to it. Otherwise it will create it. 2025-03-26 21:24:47 -04:00
Eyal Toledano
5b0552fc20 fix: Tweak table column widths. Will probably make them dynamicalyl adjust based on the longest string in the column. But that's an overoptimization for now. 2025-03-26 20:25:02 -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