161 Commits

Author SHA1 Message Date
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
0eb16d5ecb
fix: remove the need for projectName, description, version in mcp and cli (#265)
* fix: remove the need for projectName, description, version in mcp and cli

* chore: add changeset
2025-04-19 00:36:05 +02:00
Eyal Toledano
6599cb0bf9 fix(update/update-task/update-subtask): Updates the parameter descriptions for update, update-task and update-subtask to ensure the MCP server correctly reaches for the right update command based on what is being updated -- all tasks, one task, or a subtask. 2025-04-16 00:40:32 -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
5ed2120ee6 feat(mcp): Fix parse-prd tool path resolution
Refactors parse-prd MCP tool to properly handle project root and path resolution, fixing the 'Input file not found: /scripts/prd.txt' error.

Key changes include: Made projectRoot a required parameter, prioritized args.projectRoot over session-derived paths, added validation to prevent parsing in invalid directories (/, home dir), improved error handling with detailed messages, and added creation of output directory if needed.

This resolves issues similar to those fixed in initialize-project, where the tool was incorrectly resolving paths when session context was incomplete.
2025-04-11 02:27:02 -04: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
65e7886506 fix: threshold parameter validation in analyze-complexity
Change threshold parameter in analyze_project_complexity from union type to coerce.number with min/max validation. Fix Invalid type error that occurred with certain input formats. Add test implementation to avoid real API calls and proper tests for parameter validation.
2025-04-09 21:25:21 -04:00
Eyal Toledano
6ec892b2c1 feat(parse-prd): Improves the numTasks param description to encourage the LLM agent to use a number of tasks to break down the PRD into that is logical relative to project complexity. 2025-04-09 21:17:02 -04:00
Eyal Toledano
d2a5f0e6a9 chore: Adjust next_step information to mention: 'Before creating the PRD for the user, make sure you understand the idea fully and ask questions to eliminate ambiguity' 2025-04-09 20:03:32 -04:00
Eyal Toledano
c414d50bdf fix: Update fileValidator in parse-prd test to return boolean values 2025-04-09 19:49:51 -04:00
Eyal Toledano
729e033fef chore: removes unnecessary output from the createcontentResponse of initialize-project. 2025-04-09 19:21:07 -04:00
Eyal Toledano
69e0b3c393 feat(mcp): Add next_step guidance to initialize-project and add tests
Added detailed next_step guidance to the initialize-project MCP tool response,
providing clear instructions about creating a PRD file and using parse-prd
after initialization. This helps users understand the workflow better after
project initialization.

Also added comprehensive unit tests for the initialize-project MCP tool that:
- Verify tool registration with correct parameters
- Test command construction with proper argument formatting
- Check special character escaping in command arguments
- Validate success response formatting including the new next_step field
- Test error handling and fallback mechanisms
- Verify logging behavior

The tests follow the same pattern as other MCP tool tests in the codebase.
2025-04-09 18:45:38 -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
b78535ac19
fix: adjust mcp to always use absolute path in description (#143) 2025-04-09 20:52:29 +02:00
Ralph Khreish
cfe3ba91e8
fix: MCP config and commands (#141) 2025-04-09 20:01:27 +02: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
e6c062d061 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
Ralph Khreish
141e8a8585 fix: remove master command 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
feddeafd6e feat: Adds initialize-project to the MCP tools to enable onboarding to Taskmaster directly from MCP only. 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
74b67830ac fix(mcp): optimize get_task response payload by removing allTasks data
- Add custom processTaskResponse function to get-task.js to filter response data
- Significantly reduce MCP response size by returning only the requested task
- Preserve allTasks in CLI/UI for dependency status formatting
- Update changeset with documentation of optimization

This change maintains backward compatibility while making MCP responses
more efficient, addressing potential context overflow issues in AI clients.
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
e04c16cec6 refactor(mcp-server): Prioritize session roots for project path discovery
This commit refactors how the MCP server determines the project root directory, prioritizing the path provided by the client session (e.g., Cursor) for increased reliability and simplification.

Previously, project root discovery relied on a complex chain of fallbacks (environment variables, CWD searching, package path checks) within `findTasksJsonPath`. This could be brittle and less accurate when running within an integrated environment like Cursor.

Key changes:

- **Prioritize Session Roots:** MCP tools (`add-task`, `add-dependency`, etc.) now first attempt to extract the project root URI directly from `session.roots[0].uri`.

- **New Utility `getProjectRootFromSession`:** Added a utility function in `mcp-server/src/tools/utils.js` to encapsulate the logic for extracting and decoding the root URI from the session object.

- **Refactor MCP Tools:** Updated tools (`add-task.js`, `add-dependency.js`) to use `getProjectRootFromSession`.

- **Simplify `findTasksJsonPath`:** Prioritized `args.projectRoot`, removed checks for `TASK_MASTER_PROJECT_ROOT` env var and package directory fallback. Retained CWD search and cache check for CLI compatibility.

- **Fix `reportProgress` Usage:** Corrected parameters in `add-dependency.js`.

This change makes project root determination more robust for the MCP server while preserving discovery mechanisms for the standalone CLI.
2025-04-08 15:54:06 -04:00
Eyal Toledano
d5ecca25db fix(mcp): make projectRoot optional in all MCP tools
- Update all tool definitions to use z.string().optional() for projectRoot
- Fix direct function implementations to use findTasksJsonPath(args, log) pattern
- Enables consistent project root detection without requiring explicit params
- Update changeset to document these improvements

This change ensures MCP tools work properly with the smart project root
detection system, removing the need for explicit projectRoot parameters in
client applications. Improves usability and reduces integration friction.
2025-04-08 15:54:06 -04:00
Eyal Toledano
65f56978b2 chore/doc: renames list-tasks to get-tasks and show-tasks to get-tasks in the mcp tools to follow api conventions and likely natural language used (get my tasks). also updates changeset. 2025-04-08 15:54:06 -04:00
Eyal Toledano
f9ef0c1887 feat(paths): Implement robust project root detection and path utilities
Overhauls the project root detection system with a hierarchical precedence mechanism that intelligently locates tasks.json and identifies project roots. This improves user experience by reducing the need for explicit path parameters and enhances cross-platform compatibility.

Key Improvements:
- Implement hierarchical precedence for project root detection:
  * Environment variable override (TASK_MASTER_PROJECT_ROOT)
  * Explicitly provided --project-root parameter
  * Cached project root from previous successful operations
  * Current directory with project markers
  * Parent directory traversal to find tasks.json
  * Package directory as fallback

- Create comprehensive PROJECT_MARKERS detection system with 20+ common indicators:
  * Task Master specific files (tasks.json, tasks/tasks.json)
  * Version control directories (.git, .svn)
  * Package manifests (package.json, pyproject.toml, Gemfile, go.mod, Cargo.toml)
  * IDE/editor configurations (.cursor, .vscode, .idea)
  * Dependency directories (node_modules, venv, .venv)
  * Configuration files (.env, tsconfig.json, webpack.config.js)
  * CI/CD files (.github/workflows, .gitlab-ci.yml, .circleci/config.yml)

- DRY refactoring of path utilities:
  * Centralize path-related functions in core/utils/path-utils.js
  * Export PROJECT_MARKERS as a single source of truth
  * Add caching via lastFoundProjectRoot for performance optimization

- Enhanced user experience:
  * Improve error messages with specific troubleshooting guidance
  * Add detailed logging to indicate project root detection source
  * Update tool parameter descriptions for better clarity
  * Add recursive parent directory searching for tasks.json

Testing:
- Verified in local dev environment
- Added unit tests for the progress bar visualization
- Updated "automatically detected" description in MCP tools

This commit addresses Task #38: Implement robust project root handling for file paths.
2025-04-08 15:53:47 -04:00
Eyal Toledano
0e16d27294 chore: removes the optional from projectRoot. 2025-04-08 15:51:55 -04:00
Eyal Toledano
6a6d06766b feat(mcp): Implement add-dependency MCP command for creating dependency relationships between tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
9f430ca48b chore: task mgmt 2025-04-08 15:51:55 -04:00
Eyal Toledano
fec9e12f49 feat(mcp): Implement complexity-report MCP command for displaying task complexity analysis reports 2025-04-08 15:51:55 -04:00
Eyal Toledano
d06e45bf12 Implement fix-dependencies MCP command for automatically fixing invalid dependencies 2025-04-08 15:51:55 -04:00
Eyal Toledano
535fb5be71 Implement validate-dependencies MCP command for checking dependency validity 2025-04-08 15:51:55 -04:00
Eyal Toledano
fba6131db7 Implement remove-dependency MCP command for removing dependencies from tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
00e01d1d93 Implement expand-all MCP command for expanding all pending tasks with subtasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
995e95263c Implement clear-subtasks MCP command for clearing subtasks from parent tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
0b7b395aa4 Implement analyze-complexity MCP command for analyzing task complexity 2025-04-08 15:51:55 -04:00
Eyal Toledano
1679075b6b Implement remove-subtask MCP command for removing subtasks from parent tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
1908c4a337 Implement add-subtask MCP command for adding subtasks to existing tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
43022d7010 feat: implement add-task MCP command
- Create direct function wrapper in add-task.js with prompt and dependency handling

- Add MCP tool integration for creating new tasks via AI

- Update task-master-core.js to expose addTaskDirect function

- Update changeset to document the new command
2025-04-08 15:51:55 -04:00
Eyal Toledano
04c2dee593 chore: uncomments the addResource and addResourceTemplate calls in the index.js for MCP. TODO: Figure out the project roots so we can do this on other projects vs just our own. 2025-04-08 15:51:55 -04:00
Eyal Toledano
d0092a6e6f feat: implement expand-task MCP command
- Create direct function wrapper in expand-task.js with error handling

- Add MCP tool integration for breaking down tasks into subtasks

- Update task-master-core.js to expose expandTaskDirect function

- Update changeset to document the new command

- Parameter support for subtask generation options (num, research, prompt, force)
2025-04-08 15:51:55 -04:00
Eyal Toledano
729ae4d2d5 feat: implement next-task MCP command
- Create direct function wrapper in next-task.js with error handling and caching

- Add MCP tool integration for finding the next task to work on

- Update task-master-core.js to expose nextTaskDirect function

- Update changeset to document the new command
2025-04-08 15:51:55 -04:00
Eyal Toledano
05950ef318 feat: implement show-task MCP command
- Create direct function wrapper in show-task.js with error handling and caching

- Add MCP tool integration for displaying detailed task information

- Update task-master-core.js to expose showTaskDirect function

- Update changeset to document the new command

- Follow kebab-case/camelCase/snake_case naming conventions
2025-04-08 15:51:55 -04:00
Eyal Toledano
9582c0a91f docs: document MCP server naming conventions and implement set-status
- Update architecture.mdc with file/function naming standards for MCP server components

- Update mcp.mdc with detailed naming conventions section

- Update task 23 to include naming convention details

- Update changeset to capture documentation changes

- Rename MCP tool files to follow kebab-case convention

- Implement set-task-status MCP command
2025-04-08 15:51:55 -04:00
Eyal Toledano
6d01ae3d47 feat: implement set-status MCP command and update changeset 2025-04-08 15:51:55 -04:00
Eyal Toledano
d4f92858c2 feat(mcp): Implement generate MCP command for creating task files from tasks.json 2025-04-08 15:51:55 -04:00