160 Commits

Author SHA1 Message Date
Eyal Toledano
b3b424be93 refactor(ai): Implement unified AI service layer and fix subtask update
- Unified Service: Introduced 'scripts/modules/ai-services-unified.js' to centralize AI interactions using provider modules ('src/ai-providers/') and the Vercel AI SDK.

- Provider Modules: Implemented 'anthropic.js' and 'perplexity.js' wrappers for Vercel SDK.

- 'updateSubtaskById' Fix: Refactored the AI call within 'updateSubtaskById' to use 'generateTextService' from the unified layer, resolving runtime errors related to parameter passing and streaming. This serves as the pattern for refactoring other AI calls in 'scripts/modules/task-manager/'.

- Task Status: Marked Subtask 61.19 as 'done'.

- Rules: Added new 'ai-services.mdc' rule.

This centralizes AI logic, replacing previous direct SDK calls and custom implementations. API keys are resolved via 'resolveEnvVariable' within the service layer. The refactoring of 'updateSubtaskById' establishes the standard approach for migrating other AI-dependent functions in the task manager module to use the unified service.

Relates to Task 61.
2025-04-22 02:42:04 -04:00
Eyal Toledano
515dcae965 refactor(config)!: Enforce .taskmasterconfig and remove env var overrides
BREAKING CHANGE: Taskmaster now requires a `.taskmasterconfig` file for model/parameter settings. Environment variables (except API keys) are no longer used for overrides.

- Throws an error if `.taskmasterconfig` is missing, guiding user to run `task-master models --setup`." -m "- Removed env var checks from config getters in `config-manager.js`." -m "- Updated `env.example` to remove obsolete variables." -m "- Refined missing config file error message in `commands.js`.
2025-04-21 22:25:04 -04:00
Eyal Toledano
a40805adf7 fix(cli): Fix interactive model setup (models --setup)
The interactive model setup triggered by `task-master models --setup` was previously attempting to call non-existent setter functions (`setMainModel`, etc.) in `config-manager.js`, leading to errors and preventing configuration updates.

This commit refactors the `--setup` logic within the `models` command handler in `scripts/modules/commands.js`. It now correctly:

- Loads the current configuration using `getConfig()`." -m "- Updates the appropriate sections of the loaded configuration object based on user selections from `inquirer`." -m "- Saves the modified configuration using the existing `writeConfig()` function from `config-manager.js`." -m "- Handles disabling the fallback model correctly."
2025-04-21 21:43:10 -04:00
Eyal Toledano
4a9f6cd5f5 refactor: Standardize configuration and environment variable access
This commit centralizes configuration and environment variable access across various modules by consistently utilizing getters from scripts/modules/config-manager.js. This replaces direct access to process.env and the global CONFIG object, leading to improved consistency, maintainability, testability, and better handling of session-specific configurations within the MCP context.

Key changes include:

- Centralized Getters: Replaced numerous instances of process.env.* and CONFIG.* with corresponding getter functions (e.g., getLogLevel, getMainModelId, getResearchMaxTokens, getMainTemperature, isApiKeySet, getDebugFlag, getDefaultSubtasks).

- Session Awareness: Ensured that the session object is passed to config getters where necessary, particularly within AI service calls (ai-services.js, add-task.js) and error handling (ai-services.js), allowing for session-specific environment overrides.

- API Key Checks: Standardized API key availability checks using isApiKeySet() instead of directly checking process.env.* (e.g., for Perplexity in commands.js and ai-services.js).

- Client Instantiation Cleanup: Removed now-redundant/obsolete local client instantiation functions (getAnthropicClient, getPerplexityClient) from ai-services.js and the global Anthropic client initialization from dependency-manager.js. Client creation should now rely on the config manager and factory patterns.

- Consistent Debug Flag Usage: Standardized calls to getDebugFlag() in commands.js, removing potentially unnecessary null arguments.

- Accurate Progress Calculation: Updated AI stream progress reporting (ai-services.js, add-task.js) to use getMainMaxTokens(session) for more accurate calculations.

- Minor Cleanup: Removed unused  import from scripts/modules/commands.js.

Specific module updates:

- :

  - Uses getLogLevel() instead of process.env.LOG_LEVEL.

- :

  - Replaced direct env/config access for model IDs, tokens, temperature, API keys, and default subtasks with appropriate getters.

  - Passed session to handleClaudeError.

  - Removed local getPerplexityClient and getAnthropicClient functions.

  - Updated progress calculations to use getMainMaxTokens(session).

- :

  - Uses isApiKeySet('perplexity') for API key checks.

  - Uses getDebugFlag() consistently for debug checks.

  - Removed unused  import.

- :

  - Removed global Anthropic client initialization.

- :

  - Uses config getters (getResearch..., getMain...) for Perplexity and Claude API call parameters, preserving customEnv override logic.

This refactoring also resolves a potential SyntaxError: Identifier 'getPerplexityClient' has already been declared by removing the duplicated/obsolete function definition previously present in ai-services.js.
2025-04-21 21:30:12 -04:00
Eyal Toledano
d46547a80f refactor(config): Standardize env var access and config getters
This commit focuses on standardizing configuration and API key access patterns across key modules as part of subtask 61.34.

Key changes include:

- Refactored `ai-services.js` to remove global AI clients and use `resolveEnvVariable` for API key checks. Client instantiation now relies on `getAnthropicClient`/`getPerplexityClient` accepting a session object.

- Refactored `task-manager.js` (`analyzeTaskComplexity` function) to use the unified `generateTextService` from `ai-services-unified.js`, removing direct AI client calls.

- Replaced direct `process.env` access for model parameters and other configurations (`PERPLEXITY_MODEL`, `CONFIG.*`) in `task-manager.js` with calls to the appropriate getters from `config-manager.js` (e.g., `getResearchModelId(session)`, `getMainMaxTokens(session)`).

- Ensured `utils.js` (`resolveEnvVariable`) correctly handles potentially undefined session objects.

- Updated function signatures where necessary to propagate the `session` object for correct context-aware configuration/key retrieval.

This moves towards the goal of using `ai-client-factory.js` and `ai-services-unified.js` as the standard pattern for AI interactions and centralizing configuration management through `config-manager.js`.
2025-04-21 17:48:30 -04:00
Eyal Toledano
538b874582 feat(config): Implement new config system and resolve refactoring errors Introduced config-manager.js and new utilities (resolveEnvVariable, findProjectRoot). Removed old global CONFIG object from utils.js. Updated .taskmasterconfig, mcp.json, and .env.example. Added generateComplexityAnalysisPrompt to ui.js. Removed unused updateSubtaskById from task-manager.js. Resolved SyntaxError and ReferenceError issues across commands.js, ui.js, task-manager.js, and ai-services.js by replacing CONFIG references with config-manager getters (getDebugFlag, getProjectName, getDefaultSubtasks, isApiKeySet). Refactored 'models' command to use getConfig/writeConfig. Simplified version checking. This stabilizes the codebase after initial Task 61 refactoring, fixing CLI errors and enabling subsequent work on Subtasks 61.34 and 61.35. 2025-04-20 01:09:30 -04:00
Ralph Khreish
3aee9bc840
feat: Add --append flag to parsePRD command - Fixes #207 (#272)
* feat: Add --append flag to parsePRD command - Fixes #207

* chore: format

* chore: implement tests to core logic and commands

* feat: implement MCP for append flag of parse_prd tool

* fix: append not considering existing tasks

* chore: fix tests

---------

Co-authored-by: Kresna Sucandra <kresnasucandra@gmail.com>
2025-04-19 23:49:50 +02:00
Eyal Toledano
11b8d1bda5 feat(ai-client-factory): Add xAI and OpenRouter provider support, enhance tests
- Integrate  for Grok models and  for OpenRouter into the AI client factory ().
- Install necessary provider dependencies (, , and other related  packages, updated  core).
- Update environment variable checks () and client creation logic () for the new providers.
- Add and correct unit tests in  to cover xAI and OpenRouter instantiation, error handling, and environment variable resolution.
- Corrected mock paths and names in tests to align with official package names.
- Verify all tests (28 total) pass for .
- Confirm test coverage remains high (~90%) after additions.
2025-04-19 17:00:47 -04:00
Ralph Khreish
3e872f8afb
feat: Enhance remove-task command to handle multiple comma-separated task IDs (#268)
* feat: Enhance remove-task command to handle multiple comma-separated task IDs

* chore: fix formatting issues

* fix: implement support for MCP

---------

Co-authored-by: Kresna Sucandra <kresnasucandra@gmail.com>
2025-04-19 10:55:59 +02:00
Ralph Khreish
c17d912237
Prompt engineering prd breakdown (#267)
* prompt engineering prd breakdown

* chore: add back important elements of the parsePRD prompt

---------

Co-authored-by: chen kinnrot <chen.kinnrot@lemonade.com>
2025-04-19 00:05:20 +02:00
Eyal Toledano
1ab836f191 feat(config): Add Fallback Model and Expanded Provider Support
Introduces a configurable fallback model and adds support for additional AI provider API keys in the environment setup.

- **Add Fallback Model Configuration (.taskmasterconfig):**
  - Implemented a new  section in .
  - Configured  as the default fallback model, enhancing resilience if the primary model fails.

- **Update Default Model Configuration (.taskmasterconfig):**
  - Changed the default  model to .
  - Changed the default  model to .

- **Add API Key Examples (assets/env.example):**
  - Added example environment variables for:
    -  (for OpenAI/OpenRouter)
    -  (for Google Gemini)
    -  (for XAI Grok)
  - Included format comments for clarity.
2025-04-16 00:45:02 -04:00
Eyal Toledano
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.
2025-04-16 00:45:02 -04:00
Eyal Toledano
329839aeb8 fix: Correct TTY check for AI progress indicator in CLI
Addresses `process.stdout.clearLine is not a function` error when running AI-dependent commands non-interactively (e.g., `update-subtask`).

Adds `process.stdout.isTTY` check before attempting to use terminal-specific output manipulations.

feat: Implement initial config manager for AI models

Adds `scripts/modules/config-manager.js` to handle reading/writing model selections from/to `.taskmasterconfig`.

Implements core functions: findProjectRoot, read/writeConfig, validateModel, get/setModel.

Defines valid model lists. Completes initial work for Subtask 61.1.
2025-04-16 00:45:02 -04:00
Eyal Toledano
c7fefb0549 fix(ai-services): Prevent TTY errors during AI streaming output
The  function used terminal manipulation functions
(like , ) for the CLI
streaming progress indicator. This caused errors when Task Master commands
involving AI streaming were run in non-interactive terminals (e.g., via
output redirection, some CI environments, or integrated terminals).

This commit adds a check for  to the condition
that controls the display of the CLI progress indicator, ensuring these
functions are only called when standard output is a fully interactive TTY.
2025-04-16 00:45:02 -04:00
Eyal Toledano
9a482789f7 feat(ai): Enhance Perplexity research calls & fix docs examples
Improves the quality and relevance of research-backed AI operations:
- Tweaks Perplexity AI calls to use max input tokens (8700), temperature 0.1, high context size, and day-fresh search recency.
- Adds a system prompt to guide Perplexity research output.

Docs:
- Updates CLI examples in taskmaster.mdc to use ANSI-C quoting ($'...') for multi-line prompts, ensuring they work correctly in bash/zsh.
2025-04-16 00:45:02 -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
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
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
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
bad16b200f chore: changeset + update rules. 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
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
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
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
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
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
Eyal Toledano
4643852110 fix: subtask id is truncated in task show subtask table. 2025-03-26 00:42:12 -04:00
Eyal Toledano
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.
2025-03-25 17:20:09 -04:00