Skip to content

23.16 23.30#71

Merged
eyaltoledano merged 75 commits intonextfrom
23.16-23.30
Apr 8, 2025
Merged

23.16 23.30#71
eyaltoledano merged 75 commits intonextfrom
23.16-23.30

Conversation

@eyaltoledano
Copy link
Owner

@eyaltoledano eyaltoledano commented Mar 31, 2025

Working through moving the MCP functions to use the direct functions.

MCP is feature complete, the last thing missing is to ensure the root is properly handled.

@eyaltoledano eyaltoledano self-assigned this Mar 31, 2025
@changeset-bot
Copy link

changeset-bot bot commented Mar 31, 2025

🦋 Changeset detected

Latest commit: 4386d01

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
task-master-ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@Crunchyman-ralph Crunchyman-ralph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not going to review yet, just a small nit pick

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a patch, this is a minor for sure

@eyaltoledano
Copy link
Owner Author

Did i use changeset properly or still need adjutsments

@Crunchyman-ralph
Copy link
Collaborator

Yup pretty good

@eyaltoledano
Copy link
Owner Author

eyaltoledano commented Apr 1, 2025

OK so the issue with the root path stuff is that we're conflating two paths in one

If we think about it, we have 2 paths to keep track of:

Package Path:

  • Where the task-master-ai npm package is installed
  • For global installs: In the global node_modules directory
  • For local installs: In ./node_modules/task-master

Project Path:

  • Where the user's project containing tasks/tasks.json is located
  • This is where tasks.json should be found
  • Usually the current working directory or a parent directory

So we need to be identify and grab both in a recursive way. researching

This is the main blocker for MCP rn

@eyaltoledano
Copy link
Owner Author

OK so the issue with the root path stuff is that we're conflating two paths in one

If we think about it, we have 2 paths to keep track of:

Package Path:

  • Where the task-master-ai npm package is installed
  • For global installs: In the global node_modules directory
  • For local installs: In ./node_modules/task-master

Project Path:

  • Where the user's project containing tasks/tasks.json is located
  • This is where tasks.json should be found
  • Usually the current working directory or a parent directory

So we need to be identify and grab both in a recursive way. researching

This is the main blocker for MCP rn

I've updated subtask 23.38 with more specific information about the path handling challenges and advanced solutions.

The update includes:

Key Challenges to Avoid:

  • Relying solely on process.cwd() with detailed explanation of why it's problematic
  • Dual Path Requirements clearly defined (Package Path vs Project Path)
  • Specific Edge Cases that need to be handled (non-project directories, nested structures, workspaces, etc.)

Advanced Solutions:

  • Project Marker Detection using find-up package to search for package.json or .git
  • Package Path Resolution using import.meta.url with fileURLToPath
  • Workspace-Aware Resolution for Yarn/pnpm workspaces
  • Monorepo Handling with cascading configuration search
  • CLI Tool Inspiration from ESLint, Jest, and Next.js
  • Robust Path Resolution Algorithm with code example
  • Environment Variable Overrides for explicit path setting

This additional information should help us do the path handling in task-master in a way that should work across all npm installation scenarios without requiring manual path specification.

The research confirms using import.meta.url for package path and recursive directory traversal for project path, while also suggesting additional techniques like using environment variables and dedicated packages like find-up for even more robust handling.

@eyaltoledano
Copy link
Owner Author

This is now feature complete and tested on a fresh install with npm link

Two main changes

I'm seeing some commands still failing to find the project root but they may just need a touch to work list the list-tasks does, which doesnt need the root. Fixing now and pushing here, at which point i only need to check in on all the other tasks to verify no errors, then update the rules and readme, and get this into next for a release

Readme really will need some help

Gonna be a busy day tomorrow

@eyaltoledano
Copy link
Owner Author

That fixes it 👌 All commands are verified on my end.

Just need to adjust the rules and readmes at this point

I also would like to make the ENV variables work in the mcp set up instead of only through env but that is an improvement.. we can patch that in if need be on day 2

The  function aimed to abstract the common flow within MCP tool  methods (logging, calling direct function, handling result).

However, the established pattern (e.g., in ) involves the  method directly calling the  function (which handles its own caching via ) and then passing the result to . This pattern is clear, functional, and leverages the core utilities effectively.

Removing the unused  simplifies , eliminates a redundant abstraction layer, and clarifies the standard implementation pattern for MCP tools.
…et command with contextual information based on how we want to use it. not to be called for internal dev stuff.
Split monolithic task-master-core.js into separate function files within
the mcp-server/src/core/direct-functions/ directory. This change:

- Creates individual files for each direct function implementation
- Moves findTasksJsonPath to a dedicated utils/path-utils.js file
- Converts task-master-core.js to be a simple import/export hub
- Improves maintainability and organization of the codebase
- Reduces potential merge conflicts when multiple developers contribute
- Follows standard module separation patterns

Each function is now in its own self-contained file with clear imports and
focused responsibility, while maintaining the same API endpoints.
…s by ID with proper direct function wrapper, MCP tool implementation, and registration
- 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
- 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
- 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
- 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)
…e index.js for MCP. TODO: Figure out the project roots so we can do this on other projects vs just our own.
- 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
eyaltoledano and others added 20 commits April 8, 2025 15:55
…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.
…n 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."
- 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.
@eyaltoledano eyaltoledano merged commit 0dfecec into next Apr 8, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Review to Done in Taskmaster Core Apr 8, 2025
@github-actions github-actions bot mentioned this pull request Apr 11, 2025
ProdByBuddha pushed a commit to ProdByBuddha/claude-task-master that referenced this pull request Apr 12, 2025
@eyaltoledano eyaltoledano removed their assignment Apr 14, 2025
johnjac-cisco pushed a commit to johnjac-cisco/local-task-master that referenced this pull request Apr 30, 2025
mustafamagdy pushed a commit to mustafamagdy/task-master-ai that referenced this pull request May 24, 2025
stephanschielke pushed a commit to stephanschielke/cursor-task-master that referenced this pull request Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants