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.
This commit is contained in:
@@ -2,6 +2,28 @@
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
- Implement robust project root detection with a hierarchical precedence system:
|
||||
- Environment variable override (TASK_MASTER_PROJECT_ROOT)
|
||||
- Explicitly provided project root (--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
|
||||
|
||||
- Add comprehensive PROJECT_MARKERS array for detecting common project files:
|
||||
- Task Master specific files (tasks.json, tasks/tasks.json)
|
||||
- Version control markers (.git, .svn)
|
||||
- Package files (package.json, pyproject.toml, etc.)
|
||||
- IDE/editor folders (.cursor, .vscode, .idea)
|
||||
- Dependency directories (node_modules, venv)
|
||||
- Configuration files (.env, tsconfig.json, etc.)
|
||||
- CI/CD files (.github/workflows, etc.)
|
||||
|
||||
- Improved error messages with specific troubleshooting guidance
|
||||
- Enhanced logging to indicate the source of project root selection
|
||||
- DRY refactoring by centralizing path utilities in core/utils/path-utils.js
|
||||
- Add caching of lastFoundProjectRoot for improved performance
|
||||
|
||||
- Split monolithic task-master-core.js into separate function files within direct-functions directory
|
||||
- Implement update-task MCP command for updating a single task by ID
|
||||
- Implement update-subtask MCP command for appending information to specific subtasks
|
||||
|
||||
Reference in New Issue
Block a user