Compare commits
305 Commits
crunchyman
...
readme-npm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de785a99c | ||
|
|
8188fdd832 | ||
|
|
3fadc2f1ef | ||
|
|
dd36111367 | ||
|
|
c58ab8963c | ||
|
|
3eeb4721aa | ||
|
|
7ea905f2c5 | ||
|
|
51dd4f625b | ||
|
|
2e55757b26 | ||
|
|
54bfc72baa | ||
|
|
faae0b419d | ||
|
|
27edbd8f3f | ||
|
|
b1390e4ddf | ||
|
|
cc04d53720 | ||
|
|
bfd86eb9cc | ||
|
|
9eb3842f04 | ||
|
|
bf2053e140 | ||
|
|
ee0be04302 | ||
|
|
c0707fc399 | ||
|
|
1ece6f1904 | ||
|
|
f4a9ad1095 | ||
|
|
cba86510d3 | ||
|
|
86ea6d1dbc | ||
|
|
a22d2a45b5 | ||
|
|
d73c8e17ec | ||
|
|
4f23751d25 | ||
|
|
7d5c028ca0 | ||
|
|
f18df6da19 | ||
|
|
1754a31372 | ||
|
|
3096ccdfb3 | ||
|
|
6464bb11e5 | ||
|
|
edaa5fe0d5 | ||
|
|
41d9dbbe6d | ||
|
|
6e0d866756 | ||
|
|
926aa61a4e | ||
|
|
9b4168bb4e | ||
|
|
ad612763ff | ||
|
|
293b59bac6 | ||
|
|
1809c4ed7b | ||
|
|
6e406958c1 | ||
|
|
074b7ec0bc | ||
|
|
e0438c8fb8 | ||
|
|
1f6694fb3d | ||
|
|
b0dfcf345e | ||
|
|
3f64202c9f | ||
|
|
669b744ced | ||
|
|
f058543888 | ||
|
|
acd5c1ea3d | ||
|
|
682b54e103 | ||
|
|
6a8a68e1a3 | ||
|
|
80735f9e60 | ||
|
|
48732d5423 | ||
|
|
2d520de269 | ||
|
|
b60e1cf835 | ||
|
|
d1e45ff50e | ||
|
|
1513858da4 | ||
|
|
59dcf4bd64 | ||
|
|
a09ba021c5 | ||
|
|
e906166141 | ||
|
|
231e569e84 | ||
|
|
09add37423 | ||
|
|
91fc779714 | ||
|
|
8c69c0aafd | ||
|
|
43ad75c7fa | ||
|
|
a59dd037cf | ||
|
|
3293c7858b | ||
|
|
b371808524 | ||
|
|
86d8f00af8 | ||
|
|
0c55ce0165 | ||
|
|
5a91941913 | ||
|
|
04af16de27 | ||
|
|
edf0f23005 | ||
|
|
e0e1155260 | ||
|
|
70f4054f26 | ||
|
|
34c769bcd0 | ||
|
|
34df2c8bbd | ||
|
|
5e9bc28abe | ||
|
|
d2e64318e2 | ||
|
|
4c835264ac | ||
|
|
c882f89a8c | ||
|
|
20e1b72a17 | ||
|
|
db631f43a5 | ||
|
|
3b9402f1f8 | ||
|
|
c8c0fc2a57 | ||
|
|
60b8e97a1c | ||
|
|
3a6d6dd671 | ||
|
|
f4a83ec047 | ||
|
|
0699f64299 | ||
|
|
60b8f5faa3 | ||
|
|
cd6e42249e | ||
|
|
fcd80623b6 | ||
|
|
026815353f | ||
|
|
8a3b611fc2 | ||
|
|
6ba42b53dc | ||
|
|
3e304232ab | ||
|
|
70fa5b0031 | ||
|
|
314c0de8c4 | ||
|
|
58b417a8ce | ||
|
|
a8dabf4485 | ||
|
|
bc19bc7927 | ||
|
|
da317f2607 | ||
|
|
ed17cb0e0a | ||
|
|
e96734a6cc | ||
|
|
17294ff259 | ||
|
|
a96215a359 | ||
|
|
0a611843b5 | ||
|
|
a1f8d52474 | ||
|
|
da636f6681 | ||
|
|
ca5ec03cd8 | ||
|
|
c47deeb869 | ||
|
|
dd90c9cb5d | ||
|
|
c7042845d6 | ||
|
|
79a41543d5 | ||
|
|
efce37469b | ||
|
|
4117f71c18 | ||
|
|
9f4bac8d6a | ||
|
|
e53d5e1577 | ||
|
|
59230c4d91 | ||
|
|
04b6a3cb21 | ||
|
|
37178ff1b9 | ||
|
|
bbc8b9cc1f | ||
|
|
c955431753 | ||
|
|
21c3cb8cda | ||
|
|
ab84afd036 | ||
|
|
f89d2aacc0 | ||
|
|
0288311965 | ||
|
|
8ae772086d | ||
|
|
2b3ae8bf89 | ||
|
|
245c3cb398 | ||
|
|
09d839fff5 | ||
|
|
90068348d3 | ||
|
|
02e347d2d7 | ||
|
|
0527c363e3 | ||
|
|
735135efe9 | ||
|
|
4fee667a05 | ||
|
|
01963af2cb | ||
|
|
0633895f3b | ||
|
|
10442c1119 | ||
|
|
734a4fdcfc | ||
|
|
8dace2186c | ||
|
|
095e373843 | ||
|
|
0bc9bac392 | ||
|
|
0a45f4329c | ||
|
|
c4b2f7e514 | ||
|
|
9684beafc3 | ||
|
|
302b916045 | ||
|
|
e7f18f65b9 | ||
|
|
655c7c225a | ||
|
|
e1218b3747 | ||
|
|
ffa621a37c | ||
|
|
cd32fd9edf | ||
|
|
590e4bd66d | ||
|
|
70d3f2f103 | ||
|
|
424aae10ed | ||
|
|
a48d1f13e2 | ||
|
|
25ca1a45a0 | ||
|
|
2e17437da3 | ||
|
|
1f44ea5299 | ||
|
|
d63964a10e | ||
|
|
33559e368c | ||
|
|
9f86306766 | ||
|
|
8f8a3dc45d | ||
|
|
d18351dc38 | ||
|
|
9d437f8594 | ||
|
|
ad89253e31 | ||
|
|
70c5097553 | ||
|
|
c9e4558a19 | ||
|
|
cd4d8e335f | ||
|
|
16297058bb | ||
|
|
ae2d43de29 | ||
|
|
f5585e6c31 | ||
|
|
303b13e3d4 | ||
|
|
1862ca2360 | ||
|
|
ad1c234b4e | ||
|
|
d07f8fddc5 | ||
|
|
c7158d4910 | ||
|
|
2a07d366be | ||
|
|
40df57f969 | ||
|
|
d4a2e34b3b | ||
|
|
d67b21fd43 | ||
|
|
b1beae3042 | ||
|
|
d2f761c652 | ||
|
|
4cf7e8a74a | ||
|
|
5f504fafb8 | ||
|
|
e69a47d382 | ||
|
|
89bb62d44b | ||
|
|
5aea93d4c0 | ||
|
|
66ac9ab9f6 | ||
|
|
ca7b0457f1 | ||
|
|
87d97bba00 | ||
|
|
3516efdc3b | ||
|
|
c8722b0a7a | ||
|
|
ed79d4f473 | ||
|
|
2517bc112c | ||
|
|
842eaf7224 | ||
|
|
96aeeffc19 | ||
|
|
5a2371b7cc | ||
|
|
b47f189cc2 | ||
|
|
36d559db26 | ||
|
|
afb47584bd | ||
|
|
3721359782 | ||
|
|
ef782ff5bd | ||
|
|
99b1a0ad7a | ||
|
|
70cc15bc87 | ||
|
|
ce51b0d3ef | ||
|
|
a82284a2db | ||
|
|
205a11e82c | ||
|
|
be3f68e777 | ||
|
|
90c6c1e587 | ||
|
|
6cb213ebbd | ||
|
|
bd0ee1b6e3 | ||
|
|
8ed651c165 | ||
|
|
2829194d3c | ||
|
|
2acba945c0 | ||
|
|
78a5376796 | ||
|
|
b3b424be93 | ||
|
|
c90578b6da | ||
|
|
3a3ad9f4fe | ||
|
|
abdc15eab2 | ||
|
|
515dcae965 | ||
|
|
a40805adf7 | ||
|
|
4a9f6cd5f5 | ||
|
|
d46547a80f | ||
|
|
bcb885e0ba | ||
|
|
ddf0947710 | ||
|
|
3a6bc43778 | ||
|
|
73aa7ac32e | ||
|
|
538b874582 | ||
|
|
0300582b46 | ||
|
|
3aee9bc840 | ||
|
|
11b8d1bda5 | ||
|
|
ff8e75cded | ||
|
|
3e872f8afb | ||
|
|
0eb16d5ecb | ||
|
|
c17d912237 | ||
|
|
41b979c239 | ||
|
|
d99fa00980 | ||
|
|
b2ccd60526 | ||
|
|
454a1d9d37 | ||
|
|
d181c40a95 | ||
|
|
1ab836f191 | ||
|
|
d84c2486e4 | ||
|
|
329839aeb8 | ||
|
|
c7fefb0549 | ||
|
|
cde23946e9 | ||
|
|
1ceb545d86 | ||
|
|
9a482789f7 | ||
|
|
4c57537157 | ||
|
|
6599cb0bf9 | ||
|
|
48a8d952bc | ||
|
|
94601f1e11 | ||
|
|
9f834f5a27 | ||
|
|
f5c4eda132 | ||
|
|
9122e516b6 | ||
|
|
04de6d9698 | ||
|
|
3530e28ee3 | ||
|
|
08f0319058 | ||
|
|
6f2cda0a6f | ||
|
|
cb720ca298 | ||
|
|
c6b8783bce | ||
|
|
9c0ed3c799 | ||
|
|
d3d9dc6ebe | ||
|
|
30e6d47577 | ||
|
|
140bd3d265 | ||
|
|
5ed2120ee6 | ||
|
|
34c980ee51 | ||
|
|
e88682f881 | ||
|
|
59208ab7a9 | ||
|
|
a86e9affc5 | ||
|
|
6403e96ef9 | ||
|
|
51919950f1 | ||
|
|
39efd11979 | ||
|
|
65e7886506 | ||
|
|
b8e55dd612 | ||
|
|
819fc5d2f7 | ||
|
|
6ec892b2c1 | ||
|
|
08589b2796 | ||
|
|
d2a5f0e6a9 | ||
|
|
e1e3e31998 | ||
|
|
c414d50bdf | ||
|
|
2c63742a85 | ||
|
|
729e033fef | ||
|
|
69e0b3c393 | ||
|
|
da95466ee1 | ||
|
|
4f68bf3b47 | ||
|
|
12519946b4 | ||
|
|
709ea63350 | ||
|
|
ca3d54f7d6 | ||
|
|
8c5d609c9c | ||
|
|
b78535ac19 | ||
|
|
cfe3ba91e8 | ||
|
|
34501878b2 | ||
|
|
af9421b9ae | ||
|
|
42bf897f81 | ||
|
|
5e01399dca | ||
|
|
e6fe5dac85 | ||
|
|
66f16870c6 | ||
|
|
01a5be25a8 | ||
|
|
4386e74ed2 | ||
|
|
5d3d66ee64 | ||
|
|
bf38baf858 | ||
|
|
ab6746a0c0 | ||
|
|
c02483bc41 | ||
|
|
3148b57f1b | ||
|
|
47b79c0e29 |
5
.changeset/curly-dragons-design.md
Normal file
5
.changeset/curly-dragons-design.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
improve findTasks algorithm for resolving tasks path
|
||||
5
.changeset/eleven-news-check.md
Normal file
5
.changeset/eleven-news-check.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix update tool on MCP giving `No valid tasks found`
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Add CI for testing
|
||||
39
.changeset/four-cups-enter.md
Normal file
39
.changeset/four-cups-enter.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Enhanced add-task fuzzy search intelligence and improved user experience
|
||||
|
||||
**Smarter Task Discovery:**
|
||||
|
||||
- Remove hardcoded category system that always matched "Task management"
|
||||
- Eliminate arbitrary limits on fuzzy search results (5→25 high relevance, 3→10 medium relevance, 8→20 detailed tasks)
|
||||
- Improve semantic weighting in Fuse.js search (details=3, description=2, title=1.5) for better relevance
|
||||
- Generate context-driven task recommendations based on true semantic similarity
|
||||
|
||||
**Enhanced Terminal Experience:**
|
||||
|
||||
- Fix duplicate banner display issue that was "eating" terminal history (closes #553)
|
||||
- Remove console.clear() and redundant displayBanner() calls from UI functions
|
||||
- Preserve command history for better development workflow
|
||||
- Streamline banner display across all commands (list, next, show, set-status, clear-subtasks, dependency commands)
|
||||
|
||||
**Visual Improvements:**
|
||||
|
||||
- Replace emoji complexity indicators with clean filled circle characters (●) for professional appearance
|
||||
- Improve consistency and readability of task complexity display
|
||||
|
||||
**AI Provider Compatibility:**
|
||||
|
||||
- Change generateObject mode from 'tool' to 'auto' for better cross-provider compatibility
|
||||
- Add qwen3-235n-a22b:free model support (closes #687)
|
||||
- Add smart warnings for free OpenRouter models with limitations (rate limits, restricted context, no tool_use)
|
||||
|
||||
**Technical Improvements:**
|
||||
|
||||
- Enhanced context generation in add-task to rely on semantic similarity rather than rigid pattern matching
|
||||
- Improved dependency analysis and common pattern detection
|
||||
- Better handling of task relationships and relevance scoring
|
||||
- More intelligent task suggestion algorithms
|
||||
|
||||
The add-task system now provides truly relevant task context based on semantic understanding rather than arbitrary categories and limits, while maintaining a cleaner and more professional terminal experience.
|
||||
7
.changeset/pink-houses-lay.md
Normal file
7
.changeset/pink-houses-lay.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix double .taskmaster directory paths in file resolution utilities
|
||||
|
||||
- Closes #636
|
||||
5
.changeset/polite-areas-shave.md
Normal file
5
.changeset/polite-areas-shave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Add one-click MCP server installation for Cursor
|
||||
11
.changeset/pre.json
Normal file
11
.changeset/pre.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"mode": "exit",
|
||||
"tag": "rc",
|
||||
"initialVersions": {
|
||||
"task-master-ai": "0.16.1"
|
||||
},
|
||||
"changesets": [
|
||||
"pink-houses-lay",
|
||||
"polite-areas-shave"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix github actions creating npm releases on next branch push
|
||||
@@ -1,302 +0,0 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
- Adjusts the MCP server invokation in the mcp.json we ship with `task-master init`. Fully functional now.
|
||||
- Rename the npx -y command. It's now `npx -y task-master-ai task-master-mcp`
|
||||
- Add additional binary alias: `task-master-mcp-server` pointing to the same MCP server script
|
||||
|
||||
- **Significant improvements to model configuration:**
|
||||
- Increase context window from 64k to 128k tokens (MAX_TOKENS=128000) for handling larger codebases
|
||||
- Reduce temperature from 0.4 to 0.2 for more consistent, deterministic outputs
|
||||
- Set default model to "claude-3-7-sonnet-20250219" in configuration
|
||||
- Update Perplexity model to "sonar-pro" for research operations
|
||||
- Increase default subtasks generation from 4 to 5 for more granular task breakdown
|
||||
- Set consistent default priority to "medium" for all new tasks
|
||||
|
||||
- **Clarify environment configuration approaches:**
|
||||
- For direct MCP usage: Configure API keys directly in `.cursor/mcp.json`
|
||||
- For npm package usage: Configure API keys in `.env` file
|
||||
- Update templates with clearer placeholder values and formatting
|
||||
- Provide explicit documentation about configuration methods in both environments
|
||||
- Use consistent placeholder format "YOUR_ANTHROPIC_API_KEY_HERE" in mcp.json
|
||||
|
||||
- Rename MCP tools to better align with API conventions and natural language in client chat:
|
||||
- Rename `list-tasks` to `get-tasks` for more intuitive client requests like "get my tasks"
|
||||
- Rename `show-task` to `get-task` for consistency with GET-based API naming conventions
|
||||
|
||||
- **Refine AI-based MCP tool implementation patterns:**
|
||||
- Establish clear responsibilities for direct functions vs MCP tools when handling AI operations
|
||||
- Update MCP direct function signatures to expect `context = { session }` for AI-based tools, without `reportProgress`
|
||||
- Clarify that AI client initialization, API calls, and response parsing should be handled within the direct function
|
||||
- Define standard error codes for AI operations (`AI_CLIENT_ERROR`, `RESPONSE_PARSING_ERROR`, etc.)
|
||||
- Document that `reportProgress` should not be used within direct functions due to client validation issues
|
||||
- Establish that progress indication within direct functions should use standard logging (`log.info()`)
|
||||
- Clarify that `AsyncOperationManager` should manage progress reporting at the MCP tool layer, not in direct functions
|
||||
- Update `mcp.mdc` rule to reflect the refined patterns for AI-based MCP tools
|
||||
- **Document and implement the Logger Wrapper Pattern:**
|
||||
- Add comprehensive documentation in `mcp.mdc` and `utilities.mdc` on the Logger Wrapper Pattern
|
||||
- Explain the dual purpose of the wrapper: preventing runtime errors and controlling output format
|
||||
- Include implementation examples with detailed explanations of why and when to use this pattern
|
||||
- Clearly document that this pattern has proven successful in resolving issues in multiple MCP tools
|
||||
- Cross-reference between rule files to ensure consistent guidance
|
||||
- **Fix critical issue in `analyze-project-complexity` MCP tool:**
|
||||
- Implement proper logger wrapper in `analyzeTaskComplexityDirect` to fix `mcpLog[level] is not a function` errors
|
||||
- Update direct function to handle both Perplexity and Claude AI properly for research-backed analysis
|
||||
- Improve silent mode handling with proper wasSilent state tracking
|
||||
- Add comprehensive error handling for AI client errors and report file parsing
|
||||
- Ensure proper report format detection and analysis with fallbacks
|
||||
- Fix variable name conflicts between the `report` logging function and data structures in `analyzeTaskComplexity`
|
||||
- **Fix critical issue in `update-task` MCP tool:**
|
||||
- Implement proper logger wrapper in `updateTaskByIdDirect` to ensure mcpLog[level] calls work correctly
|
||||
- Update Zod schema in `update-task.js` to accept both string and number type IDs
|
||||
- Fix silent mode implementation with proper try/finally blocks
|
||||
- Add comprehensive error handling for missing parameters, invalid task IDs, and failed updates
|
||||
- **Refactor `update-subtask` MCP tool to follow established patterns:**
|
||||
- Update `updateSubtaskByIdDirect` function to accept `context = { session }` parameter
|
||||
- Add proper AI client initialization with error handling for both Anthropic and Perplexity
|
||||
- Implement the Logger Wrapper Pattern to prevent mcpLog[level] errors
|
||||
- Support both string and number subtask IDs with appropriate validation
|
||||
- Update MCP tool to pass session to direct function but not reportProgress
|
||||
- Remove commented-out calls to reportProgress for cleaner code
|
||||
- Add comprehensive error handling for various failure scenarios
|
||||
- Implement proper silent mode with try/finally blocks
|
||||
- Ensure detailed successful update response information
|
||||
- **Fix issues in `set-task-status` MCP tool:**
|
||||
- Remove reportProgress parameter as it's not needed
|
||||
- Improve project root handling for better session awareness
|
||||
- Reorganize function call arguments for setTaskStatusDirect
|
||||
- Add proper silent mode handling with try/catch/finally blocks
|
||||
- Enhance logging for both success and error cases
|
||||
- **Refactor `update` MCP tool to follow established patterns:**
|
||||
- Update `updateTasksDirect` function to accept `context = { session }` parameter
|
||||
- Add proper AI client initialization with error handling
|
||||
- Update MCP tool to pass session to direct function but not reportProgress
|
||||
- Simplify parameter validation using string type for 'from' parameter
|
||||
- Improve error handling for AI client errors
|
||||
- Implement proper silent mode handling with try/finally blocks
|
||||
- Use `isSilentMode()` function instead of accessing global variables directly
|
||||
- **Refactor `expand-task` MCP tool to follow established patterns:**
|
||||
- Update `expandTaskDirect` function to accept `context = { session }` parameter
|
||||
- Add proper AI client initialization with error handling
|
||||
- Update MCP tool to pass session to direct function but not reportProgress
|
||||
- Add comprehensive tests for the refactored implementation
|
||||
- Improve error handling for AI client errors
|
||||
- Remove non-existent 'force' parameter from direct function implementation
|
||||
- Ensure direct function parameters match core function parameters
|
||||
- Implement proper silent mode handling with try/finally blocks
|
||||
- Use `isSilentMode()` function instead of accessing global variables directly
|
||||
- **Refactor `parse-prd` MCP tool to follow established patterns:**
|
||||
- Update `parsePRDDirect` function to accept `context = { session }` parameter for proper AI initialization
|
||||
- Implement AI client initialization with proper error handling using `getAnthropicClientForMCP`
|
||||
- Add the Logger Wrapper Pattern to ensure proper logging via `mcpLog`
|
||||
- Update the core `parsePRD` function to accept an AI client parameter
|
||||
- Implement proper silent mode handling with try/finally blocks
|
||||
- Remove `reportProgress` usage from MCP tool for better client compatibility
|
||||
- Fix console output that was breaking the JSON response format
|
||||
- Improve error handling with specific error codes
|
||||
- Pass session object to the direct function correctly
|
||||
- Update task-manager-core.js to export AI client utilities for better organization
|
||||
- Ensure proper option passing between functions to maintain logging context
|
||||
|
||||
- **Update MCP Logger to respect silent mode:**
|
||||
- Import and check `isSilentMode()` function in logger implementation
|
||||
- Skip all logging when silent mode is enabled
|
||||
- Prevent console output from interfering with JSON responses
|
||||
- Fix "Unexpected token 'I', "[INFO] Gene"... is not valid JSON" errors by suppressing log output during silent mode
|
||||
|
||||
- **Refactor `expand-all` MCP tool to follow established patterns:**
|
||||
- Update `expandAllTasksDirect` function to accept `context = { session }` parameter
|
||||
- Add proper AI client initialization with error handling for research-backed expansion
|
||||
- Pass session to direct function but not reportProgress in the MCP tool
|
||||
- Implement directory switching to work around core function limitations
|
||||
- Add comprehensive error handling with specific error codes
|
||||
- Ensure proper restoration of working directory after execution
|
||||
- Use try/finally pattern for both silent mode and directory management
|
||||
- Add comprehensive tests for the refactored implementation
|
||||
|
||||
- **Standardize and improve silent mode implementation across MCP direct functions:**
|
||||
- Add proper import of all silent mode utilities: `import { enableSilentMode, disableSilentMode, isSilentMode } from 'utils.js'`
|
||||
- Replace direct access to global silentMode variable with `isSilentMode()` function calls
|
||||
- Implement consistent try/finally pattern to ensure silent mode is always properly disabled
|
||||
- Add error handling with finally blocks to prevent silent mode from remaining enabled after errors
|
||||
- Create proper mixed parameter/global silent mode check pattern: `const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())`
|
||||
- Update all direct functions to follow the new implementation pattern
|
||||
- Fix issues with silent mode not being properly disabled when errors occur
|
||||
|
||||
- **Improve parameter handling between direct functions and core functions:**
|
||||
- Verify direct function parameters match core function signatures
|
||||
- Remove extraction and use of parameters that don't exist in core functions (e.g., 'force')
|
||||
- Implement appropriate type conversion for parameters (e.g., `parseInt(args.id, 10)`)
|
||||
- Set defaults that match core function expectations
|
||||
- Add detailed documentation on parameter matching in guidelines
|
||||
- Add explicit examples of correct parameter handling patterns
|
||||
|
||||
- **Create standardized MCP direct function implementation checklist:**
|
||||
- Comprehensive imports and dependencies section
|
||||
- Parameter validation and matching guidelines
|
||||
- Silent mode implementation best practices
|
||||
- Error handling and response format patterns
|
||||
- Path resolution and core function call guidelines
|
||||
- Function export and testing verification steps
|
||||
- Specific issues to watch for related to silent mode, parameters, and error cases
|
||||
- Add checklist to subtasks for uniform implementation across all direct functions
|
||||
|
||||
- **Implement centralized AI client utilities for MCP tools:**
|
||||
- Create new `ai-client-utils.js` module with standardized client initialization functions
|
||||
- Implement session-aware AI client initialization for both Anthropic and Perplexity
|
||||
- Add comprehensive error handling with user-friendly error messages
|
||||
- Create intelligent AI model selection based on task requirements
|
||||
- Implement model configuration utilities that respect session environment variables
|
||||
- Add extensive unit tests for all utility functions
|
||||
- Significantly improve MCP tool reliability for AI operations
|
||||
- **Specific implementations include:**
|
||||
- `getAnthropicClientForMCP`: Initializes Anthropic client with session environment variables
|
||||
- `getPerplexityClientForMCP`: Initializes Perplexity client with session environment variables
|
||||
- `getModelConfig`: Retrieves model parameters from session or fallbacks to defaults
|
||||
- `getBestAvailableAIModel`: Selects the best available model based on requirements
|
||||
- `handleClaudeError`: Processes Claude API errors into user-friendly messages
|
||||
- **Updated direct functions to use centralized AI utilities:**
|
||||
- Refactored `addTaskDirect` to use the new AI client utilities with proper AsyncOperationManager integration
|
||||
- Implemented comprehensive error handling for API key validation, AI processing, and response parsing
|
||||
- Added session-aware parameter handling with proper propagation of context to AI streaming functions
|
||||
- Ensured proper fallback to process.env when session variables aren't available
|
||||
|
||||
- **Refine AI services for reusable operations:**
|
||||
- Refactor `ai-services.js` to support consistent AI operations across CLI and MCP
|
||||
- Implement shared helpers for streaming responses, prompt building, and response parsing
|
||||
- Standardize client initialization patterns with proper session parameter handling
|
||||
- Enhance error handling and loading indicator management
|
||||
- Fix process exit issues to prevent MCP server termination on API errors
|
||||
- Ensure proper resource cleanup in all execution paths
|
||||
- Add comprehensive test coverage for AI service functions
|
||||
- **Key improvements include:**
|
||||
- Stream processing safety with explicit completion detection
|
||||
- Standardized function parameter patterns
|
||||
- Session-aware parameter extraction with sensible defaults
|
||||
- Proper cleanup using try/catch/finally patterns
|
||||
|
||||
- **Optimize MCP response payloads:**
|
||||
- Add custom `processTaskResponse` function to `get-task` MCP tool to filter out unnecessary `allTasks` array data
|
||||
- Significantly reduce response size by returning only the specific requested task instead of all tasks
|
||||
- Preserve dependency status relationships for the UI/CLI while keeping MCP responses lean and efficient
|
||||
|
||||
- **Implement complete remove-task functionality:**
|
||||
- Add `removeTask` core function to permanently delete tasks or subtasks from tasks.json
|
||||
- Implement CLI command `remove-task` with confirmation prompt and force flag support
|
||||
- Create MCP `remove_task` tool for AI-assisted task removal
|
||||
- Automatically handle dependency cleanup by removing references to deleted tasks
|
||||
- Update task files after removal to maintain consistency
|
||||
- Provide robust error handling and detailed feedback messages
|
||||
|
||||
- **Update Cursor rules and documentation:**
|
||||
- Enhance `new_features.mdc` with comprehensive guidelines for implementing removal commands
|
||||
- Update `commands.mdc` with best practices for confirmation flows and cleanup procedures
|
||||
- Expand `mcp.mdc` with detailed instructions for MCP tool implementation patterns
|
||||
- Add examples of proper error handling and parameter validation to all relevant rules
|
||||
- Include new sections about handling dependencies during task removal operations
|
||||
- Document naming conventions and implementation patterns for destructive operations
|
||||
- Update silent mode implementation documentation with proper examples
|
||||
- Add parameter handling guidelines emphasizing matching with core functions
|
||||
- Update architecture documentation with dedicated section on silent mode implementation
|
||||
|
||||
- **Implement silent mode across all direct functions:**
|
||||
- Add `enableSilentMode` and `disableSilentMode` utility imports to all direct function files
|
||||
- Wrap all core function calls with silent mode to prevent console logs from interfering with JSON responses
|
||||
- Add comprehensive error handling to ensure silent mode is disabled even when errors occur
|
||||
- Fix "Unexpected token 'I', "[INFO] Gene"... is not valid JSON" errors by suppressing log output
|
||||
- Apply consistent silent mode pattern across all MCP direct functions
|
||||
- Maintain clean JSON responses for better integration with client tools
|
||||
|
||||
- **Implement AsyncOperationManager for background task processing:**
|
||||
- Add new `async-manager.js` module to handle long-running operations asynchronously
|
||||
- Support background execution of computationally intensive tasks like expansion and analysis
|
||||
- Implement unique operation IDs with UUID generation for reliable tracking
|
||||
- Add operation status tracking (pending, running, completed, failed)
|
||||
- Create `get_operation_status` MCP tool to check on background task progress
|
||||
- Forward progress reporting from background tasks to the client
|
||||
- Implement operation history with automatic cleanup of completed operations
|
||||
- Support proper error handling in background tasks with detailed status reporting
|
||||
- Maintain context (log, session) for background operations ensuring consistent behavior
|
||||
|
||||
- **Implement initialize_project command:**
|
||||
- Add new MCP tool to allow project setup via integrated MCP clients
|
||||
- Create `initialize_project` direct function with proper parameter handling
|
||||
- Improve onboarding experience by adding to mcp.json configuration
|
||||
- Support project-specific metadata like name, description, and version
|
||||
- Handle shell alias creation with proper confirmation
|
||||
- Improve first-time user experience in AI environments
|
||||
|
||||
- **Refactor project root handling for MCP Server:**
|
||||
- **Prioritize Session Roots**: MCP tools now extract the project root path directly from `session.roots[0].uri` provided by the client (e.g., Cursor).
|
||||
- **New Utility `getProjectRootFromSession`**: Added to `mcp-server/src/tools/utils.js` to encapsulate session root extraction and decoding. **Further refined for more reliable detection, especially in integrated environments, including deriving root from script path and avoiding fallback to '/'.**
|
||||
- **Simplify `findTasksJsonPath`**: The core path finding utility in `mcp-server/src/core/utils/path-utils.js` now prioritizes the `projectRoot` passed in `args` (originating from the session). Removed checks for `TASK_MASTER_PROJECT_ROOT` env var (we do not use this anymore) and package directory fallback. **Enhanced error handling to include detailed debug information (paths searched, CWD, server dir, etc.) and clearer potential solutions when `tasks.json` is not found.**
|
||||
- **Retain CLI Fallbacks**: Kept `lastFoundProjectRoot` cache check and CWD search in `findTasksJsonPath` for compatibility with direct CLI usage.
|
||||
|
||||
- Updated all MCP tools to use the new project root handling:
|
||||
- Tools now call `getProjectRootFromSession` to determine the root.
|
||||
- This root is passed explicitly as `projectRoot` in the `args` object to the corresponding `*Direct` function.
|
||||
- Direct functions continue to use the (now simplified) `findTasksJsonPath` to locate `tasks.json` within the provided root.
|
||||
- This ensures tools work reliably in integrated environments without requiring the user to specify `--project-root`.
|
||||
|
||||
- Add comprehensive PROJECT_MARKERS array for detecting common project files (used in CLI fallback logic).
|
||||
- Improved error messages with specific troubleshooting guidance.
|
||||
- **Enhanced logging:**
|
||||
- Indicate the source of project root selection more clearly.
|
||||
- **Add verbose logging in `get-task.js` to trace session object content and resolved project root path, aiding debugging.**
|
||||
|
||||
- DRY refactoring by centralizing path utilities in `core/utils/path-utils.js` and session handling in `tools/utils.js`.
|
||||
- Keep caching of `lastFoundProjectRoot` for CLI 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.
|
||||
- Implement generate MCP command for creating individual task files from tasks.json.
|
||||
- Implement set-status MCP command for updating task status.
|
||||
- Implement get-task MCP command for displaying detailed task information (renamed from show-task).
|
||||
- Implement next-task MCP command for finding the next task to work on.
|
||||
- Implement expand-task MCP command for breaking down tasks into subtasks.
|
||||
- Implement add-task MCP command for creating new tasks using AI assistance.
|
||||
- Implement add-subtask MCP command for adding subtasks to existing tasks.
|
||||
- Implement remove-subtask MCP command for removing subtasks from parent tasks.
|
||||
- Implement expand-all MCP command for expanding all tasks into subtasks.
|
||||
- Implement analyze-complexity MCP command for analyzing task complexity.
|
||||
- Implement clear-subtasks MCP command for clearing subtasks from parent tasks.
|
||||
- Implement remove-dependency MCP command for removing dependencies from tasks.
|
||||
- Implement validate-dependencies MCP command for checking validity of task dependencies.
|
||||
- Implement fix-dependencies MCP command for automatically fixing invalid dependencies.
|
||||
- Implement complexity-report MCP command for displaying task complexity analysis reports.
|
||||
- Implement add-dependency MCP command for creating dependency relationships between tasks.
|
||||
- Implement get-tasks MCP command for listing all tasks (renamed from list-tasks).
|
||||
- Implement `initialize_project` MCP tool to allow project setup via MCP client and radically improve and simplify onboarding by adding to mcp.json (e.g., Cursor).
|
||||
|
||||
- Enhance documentation and tool descriptions:
|
||||
- Create new `taskmaster.mdc` Cursor rule for comprehensive MCP tool and CLI command reference.
|
||||
- Bundle taskmaster.mdc with npm package and include in project initialization.
|
||||
- Add detailed descriptions for each tool's purpose, parameters, and common use cases.
|
||||
- Include natural language patterns and keywords for better intent recognition.
|
||||
- Document parameter descriptions with clear examples and default values.
|
||||
- Add usage examples and context for each command/tool.
|
||||
- **Update documentation (`mcp.mdc`, `utilities.mdc`, `architecture.mdc`, `new_features.mdc`, `commands.mdc`) to reflect the new session-based project root handling and the preferred MCP vs. CLI interaction model.**
|
||||
- Improve clarity around project root auto-detection in tool documentation.
|
||||
- Update tool descriptions to better reflect their actual behavior and capabilities.
|
||||
- Add cross-references between related tools and commands.
|
||||
- Include troubleshooting guidance in tool descriptions.
|
||||
- **Add default values for `DEFAULT_SUBTASKS` and `DEFAULT_PRIORITY` to the example `.cursor/mcp.json` configuration.**
|
||||
|
||||
- Document MCP server naming conventions in architecture.mdc and mcp.mdc files (file names use kebab-case, direct functions use camelCase with Direct suffix, tool registration functions use camelCase with Tool suffix, and MCP tool names use snake_case).
|
||||
- Update MCP tool naming to follow more intuitive conventions that better align with natural language requests in client chat applications.
|
||||
- Enhance task show view with a color-coded progress bar for visualizing subtask completion percentage.
|
||||
- Add "cancelled" status to UI module status configurations for marking tasks as cancelled without deletion.
|
||||
- Improve MCP server resource documentation with comprehensive implementation examples and best practices.
|
||||
- Enhance progress bars with status breakdown visualization showing proportional sections for different task statuses.
|
||||
- Add improved status tracking for both tasks and subtasks with detailed counts by status.
|
||||
- Optimize progress bar display with width constraints to prevent UI overflow on smaller terminals.
|
||||
- Improve status counts display with clear text labels beside status icons for better readability.
|
||||
- Treat deferred and cancelled tasks as effectively complete for progress calculation while maintaining visual distinction.
|
||||
- **Fix `reportProgress` calls** to use the correct `{ progress, total? }` format.
|
||||
- **Standardize logging in core task-manager functions (`expandTask`, `expandAllTasks`, `updateTasks`, `updateTaskById`, `updateSubtaskById`, `parsePRD`, `analyzeTaskComplexity`):**
|
||||
- Implement a local `report` function in each to handle context-aware logging.
|
||||
- Use `report` to choose between `mcpLog` (if available) and global `log` (from `utils.js`).
|
||||
- Only call global `log` when `outputFormat` is 'text' and silent mode is off.
|
||||
- Wrap CLI UI elements (tables, boxes, spinners) in `outputFormat === 'text'` checks.
|
||||
22
.changeset/vast-shrimps-happen.md
Normal file
22
.changeset/vast-shrimps-happen.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
"task-master-ai": minor
|
||||
---
|
||||
|
||||
Add sync-readme command for a task export to GitHub README
|
||||
|
||||
Introduces a new `sync-readme` command that exports your task list to your project's README.md file.
|
||||
|
||||
**Features:**
|
||||
|
||||
- **Flexible filtering**: Supports `--status` filtering (e.g., pending, done) and `--with-subtasks` flag
|
||||
- **Smart content management**: Automatically replaces existing exports or appends to new READMEs
|
||||
- **Metadata display**: Shows export timestamp, subtask inclusion status, and filter settings
|
||||
|
||||
**Usage:**
|
||||
|
||||
- `task-master sync-readme` - Export tasks without subtasks
|
||||
- `task-master sync-readme --with-subtasks` - Include subtasks in export
|
||||
- `task-master sync-readme --status=pending` - Only export pending tasks
|
||||
- `task-master sync-readme --status=done --with-subtasks` - Export completed tasks with subtasks
|
||||
|
||||
Perfect for showcasing project progress on GitHub. Experimental. Open to feedback.
|
||||
@@ -1,20 +1,19 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"taskmaster-ai": {
|
||||
"command": "node",
|
||||
"args": [
|
||||
"./mcp-server/server.js"
|
||||
],
|
||||
"env": {
|
||||
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
|
||||
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",
|
||||
"MODEL": "claude-3-7-sonnet-20250219",
|
||||
"PERPLEXITY_MODEL": "sonar-pro",
|
||||
"MAX_TOKENS": 128000,
|
||||
"TEMPERATURE": 0.2,
|
||||
"DEFAULT_SUBTASKS": 5,
|
||||
"DEFAULT_PRIORITY": "medium"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"mcpServers": {
|
||||
"task-master-ai": {
|
||||
"command": "node",
|
||||
"args": ["./mcp-server/server.js"],
|
||||
"env": {
|
||||
"ANTHROPIC_API_KEY": "ANTHROPIC_API_KEY_HERE",
|
||||
"PERPLEXITY_API_KEY": "PERPLEXITY_API_KEY_HERE",
|
||||
"OPENAI_API_KEY": "OPENAI_API_KEY_HERE",
|
||||
"GOOGLE_API_KEY": "GOOGLE_API_KEY_HERE",
|
||||
"XAI_API_KEY": "XAI_API_KEY_HERE",
|
||||
"OPENROUTER_API_KEY": "OPENROUTER_API_KEY_HERE",
|
||||
"MISTRAL_API_KEY": "MISTRAL_API_KEY_HERE",
|
||||
"AZURE_OPENAI_API_KEY": "AZURE_OPENAI_API_KEY_HERE",
|
||||
"OLLAMA_API_KEY": "OLLAMA_API_KEY_HERE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
155
.cursor/rules/ai_providers.mdc
Normal file
155
.cursor/rules/ai_providers.mdc
Normal file
@@ -0,0 +1,155 @@
|
||||
---
|
||||
description: Guidelines for managing Task Master AI providers and models.
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Task Master AI Provider Management
|
||||
|
||||
This rule guides AI assistants on how to view, configure, and interact with the different AI providers and models supported by Task Master. For internal implementation details of the service layer, see [`ai_services.mdc`](mdc:.cursor/rules/ai_services.mdc).
|
||||
|
||||
- **Primary Interaction:**
|
||||
- Use the `models` MCP tool or the `task-master models` CLI command to manage AI configurations. See [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc) for detailed command/tool usage.
|
||||
|
||||
- **Configuration Roles:**
|
||||
- Task Master uses three roles for AI models:
|
||||
- `main`: Primary model for general tasks (generation, updates).
|
||||
- `research`: Model used when the `--research` flag or `research: true` parameter is used (typically models with web access or specialized knowledge).
|
||||
- `fallback`: Model used if the primary (`main`) model fails.
|
||||
- Each role is configured with a specific `provider:modelId` pair (e.g., `openai:gpt-4o`).
|
||||
|
||||
- **Viewing Configuration & Available Models:**
|
||||
- To see the current model assignments for each role and list all models available for assignment:
|
||||
- **MCP Tool:** `models` (call with no arguments or `listAvailableModels: true`)
|
||||
- **CLI Command:** `task-master models`
|
||||
- The output will show currently assigned models and a list of others, prefixed with their provider (e.g., `google:gemini-2.5-pro-exp-03-25`).
|
||||
|
||||
- **Setting Models for Roles:**
|
||||
- To assign a model to a role:
|
||||
- **MCP Tool:** `models` with `setMain`, `setResearch`, or `setFallback` parameters.
|
||||
- **CLI Command:** `task-master models` with `--set-main`, `--set-research`, or `--set-fallback` flags.
|
||||
- **Crucially:** When providing the model ID to *set*, **DO NOT include the `provider:` prefix**. Use only the model ID itself.
|
||||
- ✅ **DO:** `models(setMain='gpt-4o')` or `task-master models --set-main=gpt-4o`
|
||||
- ❌ **DON'T:** `models(setMain='openai:gpt-4o')` or `task-master models --set-main=openai:gpt-4o`
|
||||
- The tool/command will automatically determine the provider based on the model ID.
|
||||
|
||||
- **Setting Custom Models (Ollama/OpenRouter):**
|
||||
- To set a model ID not in the internal list for Ollama or OpenRouter:
|
||||
- **MCP Tool:** Use `models` with `set<Role>` and **also** `ollama: true` or `openrouter: true`.
|
||||
- Example: `models(setMain='my-custom-ollama-model', ollama=true)`
|
||||
- Example: `models(setMain='some-openrouter-model', openrouter=true)`
|
||||
- **CLI Command:** Use `task-master models` with `--set-<role>` and **also** `--ollama` or `--openrouter`.
|
||||
- Example: `task-master models --set-main=my-custom-ollama-model --ollama`
|
||||
- Example: `task-master models --set-main=some-openrouter-model --openrouter`
|
||||
- **Interactive Setup:** Use `task-master models --setup` and select the `Ollama (Enter Custom ID)` or `OpenRouter (Enter Custom ID)` options.
|
||||
- **OpenRouter Validation:** When setting a custom OpenRouter model, Taskmaster attempts to validate the ID against the live OpenRouter API.
|
||||
- **Ollama:** No live validation occurs for custom Ollama models; ensure the model is available on your Ollama server.
|
||||
|
||||
- **Supported Providers & Required API Keys:**
|
||||
- Task Master integrates with various providers via the Vercel AI SDK.
|
||||
- **API keys are essential** for most providers and must be configured correctly.
|
||||
- **Key Locations** (See [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc) - Configuration Management):
|
||||
- **MCP/Cursor:** Set keys in the `env` section of `.cursor/mcp.json`.
|
||||
- **CLI:** Set keys in a `.env` file in the project root.
|
||||
- **Provider List & Keys:**
|
||||
- **`anthropic`**: Requires `ANTHROPIC_API_KEY`.
|
||||
- **`google`**: Requires `GOOGLE_API_KEY`.
|
||||
- **`openai`**: Requires `OPENAI_API_KEY`.
|
||||
- **`perplexity`**: Requires `PERPLEXITY_API_KEY`.
|
||||
- **`xai`**: Requires `XAI_API_KEY`.
|
||||
- **`mistral`**: Requires `MISTRAL_API_KEY`.
|
||||
- **`azure`**: Requires `AZURE_OPENAI_API_KEY` and `AZURE_OPENAI_ENDPOINT`.
|
||||
- **`openrouter`**: Requires `OPENROUTER_API_KEY`.
|
||||
- **`ollama`**: Might require `OLLAMA_API_KEY` (not currently supported) *and* `OLLAMA_BASE_URL` (default: `http://localhost:11434/api`). *Check specific setup.*
|
||||
|
||||
- **Troubleshooting:**
|
||||
- If AI commands fail (especially in MCP context):
|
||||
1. **Verify API Key:** Ensure the correct API key for the *selected provider* (check `models` output) exists in the appropriate location (`.cursor/mcp.json` env or `.env`).
|
||||
2. **Check Model ID:** Ensure the model ID set for the role is valid (use `models` listAvailableModels/`task-master models`).
|
||||
3. **Provider Status:** Check the status of the external AI provider's service.
|
||||
4. **Restart MCP:** If changes were made to configuration or provider code, restart the MCP server.
|
||||
|
||||
## Adding a New AI Provider (Vercel AI SDK Method)
|
||||
|
||||
Follow these steps to integrate a new AI provider that has an official Vercel AI SDK adapter (`@ai-sdk/<provider>`):
|
||||
|
||||
1. **Install Dependency:**
|
||||
- Install the provider-specific package:
|
||||
```bash
|
||||
npm install @ai-sdk/<provider-name>
|
||||
```
|
||||
|
||||
2. **Create Provider Module:**
|
||||
- Create a new file in `src/ai-providers/` named `<provider-name>.js`.
|
||||
- Use existing modules (`openai.js`, `anthropic.js`, etc.) as a template.
|
||||
- **Import:**
|
||||
- Import the provider's `create<ProviderName>` function from `@ai-sdk/<provider-name>`.
|
||||
- Import `generateText`, `streamText`, `generateObject` from the core `ai` package.
|
||||
- Import the `log` utility from `../../scripts/modules/utils.js`.
|
||||
- **Implement Core Functions:**
|
||||
- `generate<ProviderName>Text(params)`:
|
||||
- Accepts `params` (apiKey, modelId, messages, etc.).
|
||||
- Instantiate the client: `const client = create<ProviderName>({ apiKey });`
|
||||
- Call `generateText({ model: client(modelId), ... })`.
|
||||
- Return `result.text`.
|
||||
- Include basic validation and try/catch error handling.
|
||||
- `stream<ProviderName>Text(params)`:
|
||||
- Similar structure to `generateText`.
|
||||
- Call `streamText({ model: client(modelId), ... })`.
|
||||
- Return the full stream result object.
|
||||
- Include basic validation and try/catch.
|
||||
- `generate<ProviderName>Object(params)`:
|
||||
- Similar structure.
|
||||
- Call `generateObject({ model: client(modelId), schema, messages, ... })`.
|
||||
- Return `result.object`.
|
||||
- Include basic validation and try/catch.
|
||||
- **Export Functions:** Export the three implemented functions (`generate<ProviderName>Text`, `stream<ProviderName>Text`, `generate<ProviderName>Object`).
|
||||
|
||||
3. **Integrate with Unified Service:**
|
||||
- Open `scripts/modules/ai-services-unified.js`.
|
||||
- **Import:** Add `import * as <providerName> from '../../src/ai-providers/<provider-name>.js';`
|
||||
- **Map:** Add an entry to the `PROVIDER_FUNCTIONS` map:
|
||||
```javascript
|
||||
'<provider-name>': {
|
||||
generateText: <providerName>.generate<ProviderName>Text,
|
||||
streamText: <providerName>.stream<ProviderName>Text,
|
||||
generateObject: <providerName>.generate<ProviderName>Object
|
||||
},
|
||||
```
|
||||
|
||||
4. **Update Configuration Management:**
|
||||
- Open `scripts/modules/config-manager.js`.
|
||||
- **`MODEL_MAP`:** Add the new `<provider-name>` key to the `MODEL_MAP` loaded from `supported-models.json` (or ensure the loading handles new providers dynamically if `supported-models.json` is updated first).
|
||||
- **`VALID_PROVIDERS`:** Ensure the new `<provider-name>` is included in the `VALID_PROVIDERS` array (this should happen automatically if derived from `MODEL_MAP` keys).
|
||||
- **API Key Handling:**
|
||||
- Update the `keyMap` in `_resolveApiKey` and `isApiKeySet` with the correct environment variable name (e.g., `PROVIDER_API_KEY`).
|
||||
- Update the `switch` statement in `getMcpApiKeyStatus` to check the corresponding key in `mcp.json` and its placeholder value.
|
||||
- Add a case to the `switch` statement in `getMcpApiKeyStatus` for the new provider, including its placeholder string if applicable.
|
||||
- **Ollama Exception:** If adding Ollama or another provider *not* requiring an API key, add a specific check at the beginning of `isApiKeySet` and `getMcpApiKeyStatus` to return `true` immediately for that provider.
|
||||
|
||||
5. **Update Supported Models List:**
|
||||
- Edit `scripts/modules/supported-models.json`.
|
||||
- Add a new key for the `<provider-name>`.
|
||||
- Add an array of model objects under the provider key, each including:
|
||||
- `id`: The specific model identifier (e.g., `claude-3-opus-20240229`).
|
||||
- `name`: A user-friendly name (optional).
|
||||
- `swe_score`, `cost_per_1m_tokens`: (Optional) Add performance/cost data if available.
|
||||
- `allowed_roles`: An array of roles (`"main"`, `"research"`, `"fallback"`) the model is suitable for.
|
||||
- `max_tokens`: (Optional but recommended) The maximum token limit for the model.
|
||||
|
||||
6. **Update Environment Examples:**
|
||||
- Add the new `PROVIDER_API_KEY` to `.env.example`.
|
||||
- Add the new `PROVIDER_API_KEY` with its placeholder (`YOUR_PROVIDER_API_KEY_HERE`) to the `env` section for `taskmaster-ai` in `.cursor/mcp.json.example` (if it exists) or update instructions.
|
||||
|
||||
7. **Add Unit Tests:**
|
||||
- Create `tests/unit/ai-providers/<provider-name>.test.js`.
|
||||
- Mock the `@ai-sdk/<provider-name>` module and the core `ai` module functions (`generateText`, `streamText`, `generateObject`).
|
||||
- Write tests for each exported function (`generate<ProviderName>Text`, etc.) to verify:
|
||||
- Correct client instantiation.
|
||||
- Correct parameters passed to the mocked Vercel AI SDK functions.
|
||||
- Correct handling of results.
|
||||
- Error handling (missing API key, SDK errors).
|
||||
|
||||
8. **Documentation:**
|
||||
- Update any relevant documentation (like `README.md` or other rules) mentioning supported providers or configuration.
|
||||
|
||||
*(Note: For providers **without** an official Vercel AI SDK adapter, the process would involve directly using the provider's own SDK or API within the `src/ai-providers/<provider-name>.js` module and manually constructing responses compatible with the unified service layer, which is significantly more complex.)*
|
||||
102
.cursor/rules/ai_services.mdc
Normal file
102
.cursor/rules/ai_services.mdc
Normal file
@@ -0,0 +1,102 @@
|
||||
---
|
||||
description: Guidelines for interacting with the unified AI service layer.
|
||||
globs: scripts/modules/ai-services-unified.js, scripts/modules/task-manager/*.js, scripts/modules/commands.js
|
||||
---
|
||||
|
||||
# AI Services Layer Guidelines
|
||||
|
||||
This document outlines the architecture and usage patterns for interacting with Large Language Models (LLMs) via Task Master's unified AI service layer (`ai-services-unified.js`). The goal is to centralize configuration, provider selection, API key management, fallback logic, and error handling.
|
||||
|
||||
**Core Components:**
|
||||
|
||||
* **Configuration (`.taskmasterconfig` & [`config-manager.js`](mdc:scripts/modules/config-manager.js)):**
|
||||
* Defines the AI provider and model ID for different **roles** (`main`, `research`, `fallback`).
|
||||
* Stores parameters like `maxTokens` and `temperature` per role.
|
||||
* Managed via the `task-master models --setup` CLI command.
|
||||
* [`config-manager.js`](mdc:scripts/modules/config-manager.js) provides **getters** (e.g., `getMainProvider()`, `getParametersForRole()`) to access these settings. Core logic should **only** use these getters for *non-AI related application logic* (e.g., `getDefaultSubtasks`). The unified service fetches necessary AI parameters internally based on the `role`.
|
||||
* **API keys** are **NOT** stored here; they are resolved via `resolveEnvVariable` (in [`utils.js`](mdc:scripts/modules/utils.js)) from `.env` (for CLI) or the MCP `session.env` object (for MCP calls). See [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc) and [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc).
|
||||
|
||||
* **Unified Service (`ai-services-unified.js`):**
|
||||
* Exports primary interaction functions: `generateTextService`, `generateObjectService`. (Note: `streamTextService` exists but has known reliability issues with some providers/payloads).
|
||||
* Contains the core `_unifiedServiceRunner` logic.
|
||||
* Internally uses `config-manager.js` getters to determine the provider/model/parameters based on the requested `role`.
|
||||
* Implements the **fallback sequence** (e.g., main -> fallback -> research) if the primary provider/model fails.
|
||||
* Constructs the `messages` array required by the Vercel AI SDK.
|
||||
* Implements **retry logic** for specific API errors (`_attemptProviderCallWithRetries`).
|
||||
* Resolves API keys automatically via `_resolveApiKey` (using `resolveEnvVariable`).
|
||||
* Maps requests to the correct provider implementation (in `src/ai-providers/`) via `PROVIDER_FUNCTIONS`.
|
||||
* Returns a structured object containing the primary AI result (`mainResult`) and telemetry data (`telemetryData`). See [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc) for details on how this telemetry data is propagated and handled.
|
||||
|
||||
* **Provider Implementations (`src/ai-providers/*.js`):**
|
||||
* Contain provider-specific wrappers around Vercel AI SDK functions (`generateText`, `generateObject`).
|
||||
|
||||
**Usage Pattern (from Core Logic like `task-manager/*.js`):**
|
||||
|
||||
1. **Import Service:** Import `generateTextService` or `generateObjectService` from `../ai-services-unified.js`.
|
||||
```javascript
|
||||
// Preferred for most tasks (especially with complex JSON)
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
|
||||
// Use if structured output is reliable for the specific use case
|
||||
// import { generateObjectService } from '../ai-services-unified.js';
|
||||
```
|
||||
|
||||
2. **Prepare Parameters:** Construct the parameters object for the service call.
|
||||
* `role`: **Required.** `'main'`, `'research'`, or `'fallback'`. Determines the initial provider/model/parameters used by the unified service.
|
||||
* `session`: **Required if called from MCP context.** Pass the `session` object received by the direct function wrapper. The unified service uses `session.env` to find API keys.
|
||||
* `systemPrompt`: Your system instruction string.
|
||||
* `prompt`: The user message string (can be long, include stringified data, etc.).
|
||||
* (For `generateObjectService` only): `schema` (Zod schema), `objectName`.
|
||||
|
||||
3. **Call Service:** Use `await` to call the service function.
|
||||
```javascript
|
||||
// Example using generateTextService (most common)
|
||||
try {
|
||||
const resultText = await generateTextService({
|
||||
role: useResearch ? 'research' : 'main', // Determine role based on logic
|
||||
session: context.session, // Pass session from context object
|
||||
systemPrompt: "You are...",
|
||||
prompt: userMessageContent
|
||||
});
|
||||
// Process the raw text response (e.g., parse JSON, use directly)
|
||||
// ...
|
||||
} catch (error) {
|
||||
// Handle errors thrown by the unified service (if all fallbacks/retries fail)
|
||||
report('error', `Unified AI service call failed: ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Example using generateObjectService (use cautiously)
|
||||
try {
|
||||
const resultObject = await generateObjectService({
|
||||
role: 'main',
|
||||
session: context.session,
|
||||
schema: myZodSchema,
|
||||
objectName: 'myDataObject',
|
||||
systemPrompt: "You are...",
|
||||
prompt: userMessageContent
|
||||
});
|
||||
// resultObject is already a validated JS object
|
||||
// ...
|
||||
} catch (error) {
|
||||
report('error', `Unified AI service call failed: ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
```
|
||||
|
||||
4. **Handle Results/Errors:** Process the returned text/object or handle errors thrown by the unified service layer.
|
||||
|
||||
**Key Implementation Rules & Gotchas:**
|
||||
|
||||
* ✅ **DO**: Centralize **all** LLM calls through `generateTextService` or `generateObjectService`.
|
||||
* ✅ **DO**: Determine the appropriate `role` (`main`, `research`, `fallback`) in your core logic and pass it to the service.
|
||||
* ✅ **DO**: Pass the `session` object (received in the `context` parameter, especially from direct function wrappers) to the service call when in MCP context.
|
||||
* ✅ **DO**: Ensure API keys are correctly configured in `.env` (for CLI) or `.cursor/mcp.json` (for MCP).
|
||||
* ✅ **DO**: Ensure `.taskmasterconfig` exists and has valid provider/model IDs for the roles you intend to use (manage via `task-master models --setup`).
|
||||
* ✅ **DO**: Use `generateTextService` and implement robust manual JSON parsing (with Zod validation *after* parsing) when structured output is needed, as `generateObjectService` has shown unreliability with some providers/schemas.
|
||||
* ❌ **DON'T**: Import or call anything from the old `ai-services.js`, `ai-client-factory.js`, or `ai-client-utils.js` files.
|
||||
* ❌ **DON'T**: Initialize AI clients (Anthropic, Perplexity, etc.) directly within core logic (`task-manager/`) or MCP direct functions.
|
||||
* ❌ **DON'T**: Fetch AI-specific parameters (model ID, max tokens, temp) using `config-manager.js` getters *for the AI call*. Pass the `role` instead.
|
||||
* ❌ **DON'T**: Implement fallback or retry logic outside `ai-services-unified.js`.
|
||||
* ❌ **DON'T**: Handle API key resolution outside the service layer (it uses `utils.js` internally).
|
||||
* ⚠️ **generateObjectService Caution**: Be aware of potential reliability issues with `generateObjectService` across different providers and complex schemas. Prefer `generateTextService` + manual parsing as a more robust alternative for structured data needs.
|
||||
@@ -3,7 +3,6 @@ description: Describes the high-level architecture of the Task Master CLI applic
|
||||
globs: scripts/modules/*.js
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Application Architecture Overview
|
||||
|
||||
- **Modular Structure**: The Task Master CLI is built using a modular architecture, with distinct modules responsible for different aspects of the application. This promotes separation of concerns, maintainability, and testability.
|
||||
@@ -14,148 +13,75 @@ alwaysApply: false
|
||||
- **Purpose**: Defines and registers all CLI commands using Commander.js.
|
||||
- **Responsibilities** (See also: [`commands.mdc`](mdc:.cursor/rules/commands.mdc)):
|
||||
- Parses command-line arguments and options.
|
||||
- Invokes appropriate functions from other modules to execute commands.
|
||||
- Handles user input and output related to command execution.
|
||||
- Implements input validation and error handling for CLI commands.
|
||||
- **Key Components**:
|
||||
- `programInstance` (Commander.js `Command` instance): Manages command definitions.
|
||||
- `registerCommands(programInstance)`: Function to register all application commands.
|
||||
- Command action handlers: Functions executed when a specific command is invoked.
|
||||
- Invokes appropriate core logic functions from `scripts/modules/`.
|
||||
- Handles user input/output for CLI.
|
||||
- Implements CLI-specific validation.
|
||||
|
||||
- **[`task-manager.js`](mdc:scripts/modules/task-manager.js): Task Data Management**
|
||||
- **Purpose**: Manages task data, including loading, saving, creating, updating, deleting, and querying tasks.
|
||||
- **[`task-manager.js`](mdc:scripts/modules/task-manager.js) & `task-manager/` directory: Task Data & Core Logic**
|
||||
- **Purpose**: Contains core functions for task data manipulation (CRUD), AI interactions, and related logic.
|
||||
- **Responsibilities**:
|
||||
- Reads and writes task data to `tasks.json` file.
|
||||
- Implements functions for task CRUD operations (Create, Read, Update, Delete).
|
||||
- Handles task parsing from PRD documents using AI.
|
||||
- Manages task expansion and subtask generation.
|
||||
- Updates task statuses and properties.
|
||||
- Implements task listing and display logic.
|
||||
- Performs task complexity analysis using AI.
|
||||
- **Key Functions**:
|
||||
- `readTasks(tasksPath)` / `writeTasks(tasksPath, tasksData)`: Load and save task data.
|
||||
- `parsePRD(prdFilePath, outputPath, numTasks)`: Parses PRD document to create tasks.
|
||||
- `expandTask(taskId, numSubtasks, useResearch, prompt, force)`: Expands a task into subtasks.
|
||||
- `setTaskStatus(tasksPath, taskIdInput, newStatus)`: Updates task status.
|
||||
- `listTasks(tasksPath, statusFilter, withSubtasks)`: Lists tasks with filtering and subtask display options.
|
||||
- `analyzeComplexity(tasksPath, reportPath, useResearch, thresholdScore)`: Analyzes task complexity.
|
||||
- Reading/writing `tasks.json`.
|
||||
- Implementing functions for task CRUD, parsing PRDs, expanding tasks, updating status, etc.
|
||||
- **Delegating AI interactions** to the `ai-services-unified.js` layer.
|
||||
- Accessing non-AI configuration via `config-manager.js` getters.
|
||||
- **Key Files**: Individual files within `scripts/modules/task-manager/` handle specific actions (e.g., `add-task.js`, `expand-task.js`).
|
||||
|
||||
- **[`dependency-manager.js`](mdc:scripts/modules/dependency-manager.js): Dependency Management**
|
||||
- **Purpose**: Manages task dependencies, including adding, removing, validating, and fixing dependency relationships.
|
||||
- **Responsibilities**:
|
||||
- Adds and removes task dependencies.
|
||||
- Validates dependency relationships to prevent circular dependencies and invalid references.
|
||||
- Fixes invalid dependencies by removing non-existent or self-referential dependencies.
|
||||
- Provides functions to check for circular dependencies.
|
||||
- **Key Functions**:
|
||||
- `addDependency(tasksPath, taskId, dependencyId)`: Adds a dependency between tasks.
|
||||
- `removeDependency(tasksPath, taskId, dependencyId)`: Removes a dependency.
|
||||
- `validateDependencies(tasksPath)`: Validates task dependencies.
|
||||
- `fixDependencies(tasksPath)`: Fixes invalid task dependencies.
|
||||
- `isCircularDependency(tasks, taskId, dependencyChain)`: Detects circular dependencies.
|
||||
- **Purpose**: Manages task dependencies.
|
||||
- **Responsibilities**: Add/remove/validate/fix dependencies.
|
||||
|
||||
- **[`ui.js`](mdc:scripts/modules/ui.js): User Interface Components**
|
||||
- **Purpose**: Handles all user interface elements, including displaying information, formatting output, and providing user feedback.
|
||||
- **Responsibilities**:
|
||||
- Displays task lists, task details, and command outputs in a formatted way.
|
||||
- Uses `chalk` for colored output and `boxen` for boxed messages.
|
||||
- Implements table display using `cli-table3`.
|
||||
- Shows loading indicators using `ora`.
|
||||
- Provides helper functions for status formatting, dependency display, and progress reporting.
|
||||
- Suggests next actions to the user after command execution.
|
||||
- **Key Functions**:
|
||||
- `displayTaskList(tasks, statusFilter, withSubtasks)`: Displays a list of tasks in a table.
|
||||
- `displayTaskDetails(task)`: Displays detailed information for a single task.
|
||||
- `displayComplexityReport(reportPath)`: Displays the task complexity report.
|
||||
- `startLoadingIndicator(message)` / `stopLoadingIndicator(indicator)`: Manages loading indicators.
|
||||
- `getStatusWithColor(status)`: Returns status string with color formatting.
|
||||
- `formatDependenciesWithStatus(dependencies, allTasks, inTable)`: Formats dependency list with status indicators.
|
||||
- **Purpose**: Handles CLI output formatting (tables, colors, boxes, spinners).
|
||||
- **Responsibilities**: Displaying tasks, reports, progress, suggestions.
|
||||
|
||||
- **[`ai-services.js`](mdc:scripts/modules/ai-services.js) (Conceptual): AI Integration**
|
||||
- **Purpose**: Abstracts interactions with AI models (like Anthropic Claude and Perplexity AI) for various features. *Note: This module might be implicitly implemented within `task-manager.js` and `utils.js` or could be explicitly created for better organization as the project evolves.*
|
||||
- **Responsibilities**:
|
||||
- Handles API calls to AI services.
|
||||
- Manages prompts and parameters for AI requests.
|
||||
- Parses AI responses and extracts relevant information.
|
||||
- Implements logic for task complexity analysis, task expansion, and PRD parsing using AI.
|
||||
- **Potential Functions**:
|
||||
- `getAIResponse(prompt, model, maxTokens, temperature)`: Generic function to interact with AI model.
|
||||
- `analyzeTaskComplexityWithAI(taskDescription)`: Sends task description to AI for complexity analysis.
|
||||
- `expandTaskWithAI(taskDescription, numSubtasks, researchContext)`: Generates subtasks using AI.
|
||||
- `parsePRDWithAI(prdContent)`: Extracts tasks from PRD content using AI.
|
||||
- **[`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js): Unified AI Service Layer**
|
||||
- **Purpose**: Centralized interface for all LLM interactions using Vercel AI SDK.
|
||||
- **Responsibilities** (See also: [`ai_services.mdc`](mdc:.cursor/rules/ai_services.mdc)):
|
||||
- Exports `generateTextService`, `generateObjectService`.
|
||||
- Handles provider/model selection based on `role` and `.taskmasterconfig`.
|
||||
- Resolves API keys (from `.env` or `session.env`).
|
||||
- Implements fallback and retry logic.
|
||||
- Orchestrates calls to provider-specific implementations (`src/ai-providers/`).
|
||||
- Telemetry data generated by the AI service layer is propagated upwards through core logic, direct functions, and MCP tools. See [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc) for the detailed integration pattern.
|
||||
|
||||
- **[`utils.js`](mdc:scripts/modules/utils.js): Utility Functions and Configuration**
|
||||
- **Purpose**: Provides reusable utility functions and global configuration settings used across the **CLI application**.
|
||||
- **[`src/ai-providers/*.js`](mdc:src/ai-providers/): Provider-Specific Implementations**
|
||||
- **Purpose**: Provider-specific wrappers for Vercel AI SDK functions.
|
||||
- **Responsibilities**: Interact directly with Vercel AI SDK adapters.
|
||||
|
||||
- **[`config-manager.js`](mdc:scripts/modules/config-manager.js): Configuration Management**
|
||||
- **Purpose**: Loads, validates, and provides access to configuration.
|
||||
- **Responsibilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
||||
- Manages global configuration settings loaded from environment variables and defaults.
|
||||
- Implements logging utility with different log levels and output formatting.
|
||||
- Provides file system operation utilities (read/write JSON files).
|
||||
- Includes string manipulation utilities (e.g., `truncate`, `sanitizePrompt`).
|
||||
- Offers task-specific utility functions (e.g., `formatTaskId`, `findTaskById`, `taskExists`).
|
||||
- Implements graph algorithms like cycle detection for dependency management.
|
||||
- **Silent Mode Control**: Provides `enableSilentMode` and `disableSilentMode` functions to control log output.
|
||||
- **Key Components**:
|
||||
- `CONFIG`: Global configuration object.
|
||||
- `log(level, ...args)`: Logging function.
|
||||
- `readJSON(filepath)` / `writeJSON(filepath, data)`: File I/O utilities for JSON files.
|
||||
- `truncate(text, maxLength)`: String truncation utility.
|
||||
- `formatTaskId(id)` / `findTaskById(tasks, taskId)`: Task ID and search utilities.
|
||||
- `findCycles(subtaskId, dependencyMap)`: Cycle detection algorithm.
|
||||
- `enableSilentMode()` / `disableSilentMode()`: Control console logging output.
|
||||
- Reads and merges `.taskmasterconfig` with defaults.
|
||||
- Provides getters (e.g., `getMainProvider`, `getLogLevel`, `getDefaultSubtasks`) for accessing settings.
|
||||
- **Note**: Does **not** store or directly handle API keys (keys are in `.env` or MCP `session.env`).
|
||||
|
||||
- **[`utils.js`](mdc:scripts/modules/utils.js): Core Utility Functions**
|
||||
- **Purpose**: Low-level, reusable CLI utilities.
|
||||
- **Responsibilities** (See also: [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)):
|
||||
- Logging (`log` function), File I/O (`readJSON`, `writeJSON`), String utils (`truncate`).
|
||||
- Task utils (`findTaskById`), Dependency utils (`findCycles`).
|
||||
- API Key Resolution (`resolveEnvVariable`).
|
||||
- Silent Mode Control (`enableSilentMode`, `disableSilentMode`).
|
||||
|
||||
- **[`mcp-server/`](mdc:mcp-server/): MCP Server Integration**
|
||||
- **Purpose**: Provides an MCP (Model Context Protocol) interface for Task Master, allowing integration with external tools like Cursor. Uses FastMCP framework.
|
||||
- **Purpose**: Provides MCP interface using FastMCP.
|
||||
- **Responsibilities** (See also: [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)):
|
||||
- Registers Task Master functionalities as tools consumable via MCP.
|
||||
- Handles MCP requests via tool `execute` methods defined in `mcp-server/src/tools/*.js`.
|
||||
- Tool `execute` methods call corresponding **direct function wrappers**.
|
||||
- Tool `execute` methods use `getProjectRootFromSession` (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)) to determine the project root from the client session and pass it to the direct function.
|
||||
- **Direct function wrappers (`*Direct` functions in `mcp-server/src/core/direct-functions/*.js`) contain the main logic for handling MCP requests**, including path resolution, argument validation, caching, and calling core Task Master functions.
|
||||
- Direct functions use `findTasksJsonPath` (from [`core/utils/path-utils.js`](mdc:mcp-server/src/core/utils/path-utils.js)) to locate `tasks.json` based on the provided `projectRoot`.
|
||||
- **Silent Mode Implementation**: Direct functions use `enableSilentMode` and `disableSilentMode` to prevent logs from interfering with JSON responses.
|
||||
- **Async Operations**: Uses `AsyncOperationManager` to handle long-running operations in the background.
|
||||
- **Project Initialization**: Provides `initialize_project` command for setting up new projects from within integrated clients.
|
||||
- Tool `execute` methods use `handleApiResult` from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) to process the result from the direct function and format the final MCP response.
|
||||
- Uses CLI execution via `executeTaskMasterCommand` as a fallback only when necessary.
|
||||
- **Implements Robust Path Finding**: The utility [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) (specifically `getProjectRootFromSession`) and [`core/utils/path-utils.js`](mdc:mcp-server/src/core/utils/path-utils.js) (specifically `findTasksJsonPath`) work together. The tool gets the root via session, passes it to the direct function, which uses `findTasksJsonPath` to locate the specific `tasks.json` file within that root.
|
||||
- **Implements Caching**: Utilizes a caching layer (`ContextManager` with `lru-cache`). Caching logic is invoked *within* the direct function wrappers using the `getCachedOrExecute` utility for performance-sensitive read operations.
|
||||
- Standardizes response formatting and data filtering using utilities in [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js).
|
||||
- **Resource Management**: Provides access to static and dynamic resources.
|
||||
- **Key Components**:
|
||||
- `mcp-server/src/index.js`: Main server class definition with FastMCP initialization, resource registration, and server lifecycle management.
|
||||
- `mcp-server/src/server.js`: Main server setup and initialization.
|
||||
- `mcp-server/src/tools/`: Directory containing individual tool definitions. Each tool's `execute` method orchestrates the call to core logic and handles the response.
|
||||
- `mcp-server/src/tools/utils.js`: Provides MCP-specific utilities like `handleApiResult`, `processMCPResponseData`, `getCachedOrExecute`, and **`getProjectRootFromSession`**.
|
||||
- `mcp-server/src/core/utils/`: Directory containing utility functions specific to the MCP server, like **`path-utils.js` for resolving `tasks.json` within a given root** and **`async-manager.js` for handling background operations**.
|
||||
- `mcp-server/src/core/direct-functions/`: Directory containing individual files for each **direct function wrapper (`*Direct`)**. These files contain the primary logic for MCP tool execution.
|
||||
- `mcp-server/src/core/resources/`: Directory containing resource handlers for task templates, workflow definitions, and other static/dynamic data exposed to LLM clients.
|
||||
- [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js): Acts as an import/export hub, collecting and exporting direct functions from the `direct-functions` directory and MCP utility functions.
|
||||
- **Naming Conventions**:
|
||||
- **Files** use **kebab-case**: `list-tasks.js`, `set-task-status.js`, `parse-prd.js`
|
||||
- **Direct Functions** use **camelCase** with `Direct` suffix: `listTasksDirect`, `setTaskStatusDirect`, `parsePRDDirect`
|
||||
- **Tool Registration Functions** use **camelCase** with `Tool` suffix: `registerListTasksTool`, `registerSetTaskStatusTool`
|
||||
- **MCP Tool Names** use **snake_case**: `list_tasks`, `set_task_status`, `parse_prd_document`
|
||||
- **Resource Handlers** use **camelCase** with pattern URI: `@mcp.resource("tasks://templates/{template_id}")`
|
||||
- **AsyncOperationManager**:
|
||||
- **Purpose**: Manages background execution of long-running operations.
|
||||
- **Location**: `mcp-server/src/core/utils/async-manager.js`
|
||||
- **Key Features**:
|
||||
- Operation tracking with unique IDs using UUID
|
||||
- Status management (pending, running, completed, failed)
|
||||
- Progress reporting forwarded from background tasks
|
||||
- Operation history with automatic cleanup of completed operations
|
||||
- Context preservation (log, session, reportProgress)
|
||||
- Robust error handling for background tasks
|
||||
- **Usage**: Used for CPU-intensive operations like task expansion and PRD parsing
|
||||
- Registers tools (`mcp-server/src/tools/*.js`). Tool `execute` methods **should be wrapped** with the `withNormalizedProjectRoot` HOF (from `tools/utils.js`) to ensure consistent path handling.
|
||||
- The HOF provides a normalized `args.projectRoot` to the `execute` method.
|
||||
- Tool `execute` methods call **direct function wrappers** (`mcp-server/src/core/direct-functions/*.js`), passing the normalized `projectRoot` and other args.
|
||||
- Direct functions use path utilities (`mcp-server/src/core/utils/`) to resolve paths based on `projectRoot` from session.
|
||||
- Direct functions implement silent mode, logger wrappers, and call core logic functions from `scripts/modules/`.
|
||||
- Manages MCP caching and response formatting.
|
||||
|
||||
- **Data Flow and Module Dependencies**:
|
||||
- **[`init.js`](mdc:scripts/init.js): Project Initialization Logic**
|
||||
- **Purpose**: Sets up new Task Master project structure.
|
||||
- **Responsibilities**: Creates directories, copies templates, manages `package.json`, sets up `.cursor/mcp.json`.
|
||||
|
||||
- **Commands Initiate Actions**: User commands entered via the CLI (handled by [`commands.js`](mdc:scripts/modules/commands.js)) are the entry points for most operations.
|
||||
- **Command Handlers Delegate to Managers**: Command handlers in [`commands.js`](mdc:scripts/modules/commands.js) call functions in [`task-manager.js`](mdc:scripts/modules/task-manager.js) and [`dependency-manager.js`](mdc:scripts/modules/dependency-manager.js) to perform core task and dependency management logic.
|
||||
- **UI for Presentation**: [`ui.js`](mdc:scripts/modules/ui.js) is used by command handlers and task/dependency managers to display information to the user. UI functions primarily consume data and format it for output, without modifying core application state.
|
||||
- **Utilities for Common Tasks**: [`utils.js`](mdc:scripts/modules/utils.js) provides helper functions used by all other modules for configuration, logging, file operations, and common data manipulations.
|
||||
- **AI Services Integration**: AI functionalities (complexity analysis, task expansion, PRD parsing) are invoked from [`task-manager.js`](mdc:scripts/modules/task-manager.js) and potentially [`commands.js`](mdc:scripts/modules/commands.js), likely using functions that would reside in a dedicated `ai-services.js` module or be integrated within `utils.js` or `task-manager.js`.
|
||||
- **MCP Server Interaction**: External tools interact with the `mcp-server`. MCP Tool `execute` methods use `getProjectRootFromSession` to find the project root, then call direct function wrappers (in `mcp-server/src/core/direct-functions/`) passing the root in `args`. These wrappers handle path finding for `tasks.json` (using `path-utils.js`), validation, caching, call the core logic from `scripts/modules/` (passing logging context via the standard wrapper pattern detailed in mcp.mdc), and return a standardized result. The final MCP response is formatted by `mcp-server/src/tools/utils.js`. See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc) for details.
|
||||
- **Data Flow and Module Dependencies (Updated)**:
|
||||
|
||||
- **CLI**: `bin/task-master.js` -> `scripts/dev.js` (loads `.env`) -> `scripts/modules/commands.js` -> Core Logic (`scripts/modules/*`) -> Unified AI Service (`ai-services-unified.js`) -> Provider Adapters -> LLM API.
|
||||
- **MCP**: External Tool -> `mcp-server/server.js` -> Tool (`mcp-server/src/tools/*`) -> Direct Function (`mcp-server/src/core/direct-functions/*`) -> Core Logic (`scripts/modules/*`) -> Unified AI Service (`ai-services-unified.js`) -> Provider Adapters -> LLM API.
|
||||
- **Configuration**: Core logic needing non-AI settings calls `config-manager.js` getters (passing `session.env` via `explicitRoot` if from MCP). Unified AI Service internally calls `config-manager.js` getters (using `role`) for AI params and `utils.js` (`resolveEnvVariable` with `session.env`) for API keys.
|
||||
|
||||
## Silent Mode Implementation Pattern in MCP Direct Functions
|
||||
|
||||
@@ -353,19 +279,8 @@ The `initialize_project` command provides a way to set up a new Task Master proj
|
||||
- Configures project metadata (name, description, version)
|
||||
- Handles shell alias creation if requested
|
||||
- Works in both interactive and non-interactive modes
|
||||
|
||||
## Async Operation Management
|
||||
|
||||
The AsyncOperationManager provides background task execution capabilities:
|
||||
|
||||
- **Location**: `mcp-server/src/core/utils/async-manager.js`
|
||||
- **Key Components**:
|
||||
- `asyncOperationManager` singleton instance
|
||||
- `addOperation(operationFn, args, context)` method
|
||||
- `getStatus(operationId)` method
|
||||
- **Usage Flow**:
|
||||
1. Client calls an MCP tool that may take time to complete
|
||||
2. Tool uses AsyncOperationManager to run the operation in background
|
||||
3. Tool returns immediate response with operation ID
|
||||
4. Client polls `get_operation_status` tool with the ID
|
||||
5. Once completed, client can access operation results
|
||||
- Creates necessary directories and files for a new project
|
||||
- Sets up `tasks.json` and initial task files
|
||||
- Configures project metadata (name, description, version)
|
||||
- Handles shell alias creation if requested
|
||||
- Works in both interactive and non-interactive modes
|
||||
@@ -24,7 +24,7 @@ While this document details the implementation of Task Master's **CLI commands**
|
||||
programInstance
|
||||
.command('command-name')
|
||||
.description('Clear, concise description of what the command does')
|
||||
.option('-s, --short-option <value>', 'Option description', 'default value')
|
||||
.option('-o, --option <value>', 'Option description', 'default value')
|
||||
.option('--long-option <value>', 'Option description')
|
||||
.action(async (options) => {
|
||||
// Command implementation
|
||||
@@ -34,7 +34,8 @@ While this document details the implementation of Task Master's **CLI commands**
|
||||
- **Command Handler Organization**:
|
||||
- ✅ DO: Keep action handlers concise and focused
|
||||
- ✅ DO: Extract core functionality to appropriate modules
|
||||
- ✅ DO: Include validation for required parameters
|
||||
- ✅ DO: Have the action handler import and call the relevant functions from core modules, like `task-manager.js` or `init.js`, passing the parsed `options`.
|
||||
- ✅ DO: Perform basic parameter validation, such as checking for required options, within the action handler or at the start of the called core function.
|
||||
- ❌ DON'T: Implement business logic in command handlers
|
||||
|
||||
## Best Practices for Removal/Delete Commands
|
||||
@@ -43,7 +44,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
|
||||
- **Confirmation Prompts**:
|
||||
- ✅ **DO**: Include a confirmation prompt by default for destructive operations
|
||||
- ✅ **DO**: Provide a `--yes` or `-y` flag to skip confirmation for scripting/automation
|
||||
- ✅ **DO**: Provide a `--yes` or `-y` flag to skip confirmation, useful for scripting or automation
|
||||
- ✅ **DO**: Show what will be deleted in the confirmation message
|
||||
- ❌ **DON'T**: Perform destructive operations without user confirmation unless explicitly overridden
|
||||
|
||||
@@ -77,7 +78,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
|
||||
- **File Path Handling**:
|
||||
- ✅ **DO**: Use `path.join()` to construct file paths
|
||||
- ✅ **DO**: Follow established naming conventions for tasks (e.g., `task_001.txt`)
|
||||
- ✅ **DO**: Follow established naming conventions for tasks, like `task_001.txt`
|
||||
- ✅ **DO**: Check if files exist before attempting to delete them
|
||||
- ✅ **DO**: Handle file deletion errors gracefully
|
||||
- ❌ **DON'T**: Construct paths with string concatenation
|
||||
@@ -165,10 +166,10 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
- ✅ DO: Use descriptive, action-oriented names
|
||||
|
||||
- **Option Names**:
|
||||
- ✅ DO: Use kebab-case for long-form option names (`--output-format`)
|
||||
- ✅ DO: Provide single-letter shortcuts when appropriate (`-f, --file`)
|
||||
- ✅ DO: Use kebab-case for long-form option names, like `--output-format`
|
||||
- ✅ DO: Provide single-letter shortcuts when appropriate, like `-f, --file`
|
||||
- ✅ DO: Use consistent option names across similar commands
|
||||
- ❌ DON'T: Use different names for the same concept (`--file` in one command, `--path` in another)
|
||||
- ❌ DON'T: Use different names for the same concept, such as `--file` in one command and `--path` in another
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Use consistent option naming
|
||||
@@ -180,7 +181,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
.option('-p, --path <dir>', 'Output directory') // Should be --output
|
||||
```
|
||||
|
||||
> **Note**: Although options are defined with kebab-case (`--num-tasks`), Commander.js stores them internally as camelCase properties. Access them in code as `options.numTasks`, not `options['num-tasks']`.
|
||||
> **Note**: Although options are defined with kebab-case, like `--num-tasks`, Commander.js stores them internally as camelCase properties. Access them in code as `options.numTasks`, not `options['num-tasks']`.
|
||||
|
||||
- **Boolean Flag Conventions**:
|
||||
- ✅ DO: Use positive flags with `--skip-` prefix for disabling behavior
|
||||
@@ -209,7 +210,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
- **Required Parameters**:
|
||||
- ✅ DO: Check that required parameters are provided
|
||||
- ✅ DO: Provide clear error messages when parameters are missing
|
||||
- ✅ DO: Use early returns with process.exit(1) for validation failures
|
||||
- ✅ DO: Use early returns with `process.exit(1)` for validation failures
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Validate required parameters early
|
||||
@@ -220,7 +221,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
```
|
||||
|
||||
- **Parameter Type Conversion**:
|
||||
- ✅ DO: Convert string inputs to appropriate types (numbers, booleans)
|
||||
- ✅ DO: Convert string inputs to appropriate types, such as numbers or booleans
|
||||
- ✅ DO: Handle conversion errors gracefully
|
||||
|
||||
```javascript
|
||||
@@ -253,7 +254,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
const taskId = parseInt(options.id, 10);
|
||||
if (isNaN(taskId) || taskId <= 0) {
|
||||
console.error(chalk.red(`Error: Invalid task ID: ${options.id}. Task ID must be a positive integer.`));
|
||||
console.log(chalk.yellow('Usage example: task-master update-task --id=\'23\' --prompt=\'Update with new information.\nEnsure proper error handling.\''));
|
||||
console.log(chalk.yellow("Usage example: task-master update-task --id='23' --prompt='Update with new information.\\nEnsure proper error handling.'"));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -391,9 +392,9 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
process.on('uncaughtException', (err) => {
|
||||
// Handle Commander-specific errors
|
||||
if (err.code === 'commander.unknownOption') {
|
||||
const option = err.message.match(/'([^']+)'/)?.[1];
|
||||
const option = err.message.match(/'([^']+)'/)?.[1]; // Safely extract option name
|
||||
console.error(chalk.red(`Error: Unknown option '${option}'`));
|
||||
console.error(chalk.yellow(`Run 'task-master <command> --help' to see available options`));
|
||||
console.error(chalk.yellow("Run 'task-master <command> --help' to see available options"));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -463,9 +464,9 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||
.option('-p, --parent <id>', 'ID of the parent task (required)')
|
||||
.option('-i, --task-id <id>', 'Existing task ID to convert to subtask')
|
||||
.option('-t, --title <title>', 'Title for the new subtask (when not converting)')
|
||||
.option('-d, --description <description>', 'Description for the new subtask (when not converting)')
|
||||
.option('--details <details>', 'Implementation details for the new subtask (when not converting)')
|
||||
.option('-t, --title <title>', 'Title for the new subtask, required if not converting')
|
||||
.option('-d, --description <description>', 'Description for the new subtask, optional')
|
||||
.option('--details <details>', 'Implementation details for the new subtask, optional')
|
||||
.option('--dependencies <ids>', 'Comma-separated list of subtask IDs this subtask depends on')
|
||||
.option('--status <status>', 'Initial status for the subtask', 'pending')
|
||||
.option('--skip-generate', 'Skip regenerating task files')
|
||||
@@ -488,8 +489,8 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
.command('remove-subtask')
|
||||
.description('Remove a subtask from its parent task, optionally converting it to a standalone task')
|
||||
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||
.option('-i, --id <id>', 'ID of the subtask to remove in format "parentId.subtaskId" (required)')
|
||||
.option('-c, --convert', 'Convert the subtask to a standalone task')
|
||||
.option('-i, --id <id>', 'ID of the subtask to remove in format parentId.subtaskId, required')
|
||||
.option('-c, --convert', 'Convert the subtask to a standalone task instead of deleting')
|
||||
.option('--skip-generate', 'Skip regenerating task files')
|
||||
.action(async (options) => {
|
||||
// Implementation with detailed error handling
|
||||
@@ -512,7 +513,8 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
// ✅ DO: Implement version checking function
|
||||
async function checkForUpdate() {
|
||||
// Implementation details...
|
||||
return { currentVersion, latestVersion, needsUpdate };
|
||||
// Example return structure:
|
||||
return { currentVersion, latestVersion, updateAvailable };
|
||||
}
|
||||
|
||||
// ✅ DO: Implement semantic version comparison
|
||||
@@ -552,7 +554,7 @@ When implementing commands that delete or remove data (like `remove-task` or `re
|
||||
|
||||
// After command execution, check if an update is available
|
||||
const updateInfo = await updateCheckPromise;
|
||||
if (updateInfo.needsUpdate) {
|
||||
if (updateInfo.updateAvailable) {
|
||||
displayUpgradeNotification(updateInfo.currentVersion, updateInfo.latestVersion);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -3,7 +3,6 @@ description: Guide for using Task Master to manage task-driven development workf
|
||||
globs: **/*
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Task Master Development Workflow
|
||||
|
||||
This guide outlines the typical process for using Task Master to manage software development projects.
|
||||
@@ -29,53 +28,55 @@ Task Master offers two primary ways to interact:
|
||||
|
||||
## Standard Development Workflow Process
|
||||
|
||||
- Start new projects by running `init` tool / `task-master init` or `parse_prd` / `task-master parse-prd --input='<prd-file.txt>'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to generate initial tasks.json
|
||||
- Start new projects by running `initialize_project` tool / `task-master init` or `parse_prd` / `task-master parse-prd --input='<prd-file.txt>'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to generate initial tasks.json
|
||||
- Begin coding sessions with `get_tasks` / `task-master list` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to see current tasks, status, and IDs
|
||||
- Determine the next task to work on using `next_task` / `task-master next` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Analyze task complexity with `analyze_complexity` / `task-master analyze-complexity --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) before breaking down tasks
|
||||
- Analyze task complexity with `analyze_project_complexity` / `task-master analyze-complexity --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) before breaking down tasks
|
||||
- Review complexity report using `complexity_report` / `task-master complexity-report` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Select tasks based on dependencies (all marked 'done'), priority level, and ID order
|
||||
- Clarify tasks by checking task files in tasks/ directory or asking for user input
|
||||
- View specific task details using `get_task` / `task-master show <id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to understand implementation requirements
|
||||
- Break down complex tasks using `expand_task` / `task-master expand --id=<id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) with appropriate flags
|
||||
- Break down complex tasks using `expand_task` / `task-master expand --id=<id> --force --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) with appropriate flags like `--force` (to replace existing subtasks) and `--research`.
|
||||
- Clear existing subtasks if needed using `clear_subtasks` / `task-master clear-subtasks --id=<id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) before regenerating
|
||||
- Implement code following task details, dependencies, and project standards
|
||||
- Verify tasks according to test strategies before marking as complete (See [`tests.mdc`](mdc:.cursor/rules/tests.mdc))
|
||||
- Mark completed tasks with `set_task_status` / `task-master set-status --id=<id> --status=done` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||
- Update dependent tasks when implementation differs from original plan using `update` / `task-master update --from=<id> --prompt="..."` or `update_task` / `task-master update-task --id=<id> --prompt="..."` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||
- Add new tasks discovered during implementation using `add_task` / `task-master add-task --prompt="..."` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Add new tasks discovered during implementation using `add_task` / `task-master add-task --prompt="..." --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Add new subtasks as needed using `add_subtask` / `task-master add-subtask --parent=<id> --title="..."` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Append notes or details to subtasks using `update_subtask` / `task-master update-subtask --id=<subtaskId> --prompt='Add implementation notes here...\nMore details...'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Generate task files with `generate` / `task-master generate` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) after updating tasks.json
|
||||
- Maintain valid dependency structure with `add_dependency`/`remove_dependency` tools or `task-master add-dependency`/`remove-dependency` commands, `validate_dependencies` / `task-master validate-dependencies`, and `fix_dependencies` / `task-master fix-dependencies` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) when needed
|
||||
- Respect dependency chains and task priorities when selecting work
|
||||
- Report progress regularly using `get_tasks` / `task-master list`
|
||||
- Reorganize tasks as needed using `move_task` / `task-master move --from=<id> --to=<id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to change task hierarchy or ordering
|
||||
|
||||
## Task Complexity Analysis
|
||||
|
||||
- Run `analyze_complexity` / `task-master analyze-complexity --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) for comprehensive analysis
|
||||
- Run `analyze_project_complexity` / `task-master analyze-complexity --research` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) for comprehensive analysis
|
||||
- Review complexity report via `complexity_report` / `task-master complexity-report` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) for a formatted, readable version.
|
||||
- Focus on tasks with highest complexity scores (8-10) for detailed breakdown
|
||||
- Use analysis results to determine appropriate subtask allocation
|
||||
- Note that reports are automatically used by the `expand` tool/command
|
||||
- Note that reports are automatically used by the `expand_task` tool/command
|
||||
|
||||
## Task Breakdown Process
|
||||
|
||||
- For tasks with complexity analysis, use `expand_task` / `task-master expand --id=<id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc))
|
||||
- Otherwise use `expand_task` / `task-master expand --id=<id> --num=<number>`
|
||||
- Add `--research` flag to leverage Perplexity AI for research-backed expansion
|
||||
- Use `--prompt="<context>"` to provide additional context when needed
|
||||
- Review and adjust generated subtasks as necessary
|
||||
- Use `--all` flag with `expand` or `expand_all` to expand multiple pending tasks at once
|
||||
- If subtasks need regeneration, clear them first with `clear_subtasks` / `task-master clear-subtasks` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
- Use `expand_task` / `task-master expand --id=<id>`. It automatically uses the complexity report if found, otherwise generates default number of subtasks.
|
||||
- Use `--num=<number>` to specify an explicit number of subtasks, overriding defaults or complexity report recommendations.
|
||||
- Add `--research` flag to leverage Perplexity AI for research-backed expansion.
|
||||
- Add `--force` flag to clear existing subtasks before generating new ones (default is to append).
|
||||
- Use `--prompt="<context>"` to provide additional context when needed.
|
||||
- Review and adjust generated subtasks as necessary.
|
||||
- Use `expand_all` tool or `task-master expand --all` to expand multiple pending tasks at once, respecting flags like `--force` and `--research`.
|
||||
- If subtasks need complete replacement (regardless of the `--force` flag on `expand`), clear them first with `clear_subtasks` / `task-master clear-subtasks --id=<id>`.
|
||||
|
||||
## Implementation Drift Handling
|
||||
|
||||
- When implementation differs significantly from planned approach
|
||||
- When future tasks need modification due to current implementation choices
|
||||
- When new dependencies or requirements emerge
|
||||
- Use `update` / `task-master update --from=<futureTaskId> --prompt='<explanation>\nUpdate context...'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to update multiple future tasks.
|
||||
- Use `update_task` / `task-master update-task --id=<taskId> --prompt='<explanation>\nUpdate context...'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to update a single specific task.
|
||||
- Use `update` / `task-master update --from=<futureTaskId> --prompt='<explanation>\nUpdate context...' --research` to update multiple future tasks.
|
||||
- Use `update_task` / `task-master update-task --id=<taskId> --prompt='<explanation>\nUpdate context...' --research` to update a single specific task.
|
||||
|
||||
## Task Status Management
|
||||
|
||||
@@ -97,28 +98,32 @@ Task Master offers two primary ways to interact:
|
||||
- **details**: In-depth implementation instructions (Example: `"Use GitHub client ID/secret, handle callback, set session token."`)
|
||||
- **testStrategy**: Verification approach (Example: `"Deploy and call endpoint to confirm 'Hello World' response."`)
|
||||
- **subtasks**: List of smaller, more specific tasks (Example: `[{"id": 1, "title": "Configure OAuth", ...}]`)
|
||||
- Refer to [`tasks.mdc`](mdc:.cursor/rules/tasks.mdc) for more details on the task data structure.
|
||||
- Refer to task structure details (previously linked to `tasks.mdc`).
|
||||
|
||||
## Environment Variables Configuration
|
||||
## Configuration Management (Updated)
|
||||
|
||||
- Task Master behavior is configured via environment variables:
|
||||
- **ANTHROPIC_API_KEY** (Required): Your Anthropic API key for Claude.
|
||||
- **MODEL**: Claude model to use (e.g., `claude-3-opus-20240229`).
|
||||
- **MAX_TOKENS**: Maximum tokens for AI responses.
|
||||
- **TEMPERATURE**: Temperature for AI model responses.
|
||||
- **DEBUG**: Enable debug logging (`true`/`false`).
|
||||
- **LOG_LEVEL**: Console output level (`debug`, `info`, `warn`, `error`).
|
||||
- **DEFAULT_SUBTASKS**: Default number of subtasks for `expand`.
|
||||
- **DEFAULT_PRIORITY**: Default priority for new tasks.
|
||||
- **PROJECT_NAME**: Project name used in metadata.
|
||||
- **PROJECT_VERSION**: Project version used in metadata.
|
||||
- **PERPLEXITY_API_KEY**: API key for Perplexity AI (for `--research` flags).
|
||||
- **PERPLEXITY_MODEL**: Perplexity model to use (e.g., `sonar-medium-online`).
|
||||
- See [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc) for default values and examples.
|
||||
Taskmaster configuration is managed through two main mechanisms:
|
||||
|
||||
1. **`.taskmaster/config.json` File (Primary):**
|
||||
* Located in the project root directory.
|
||||
* Stores most configuration settings: AI model selections (main, research, fallback), parameters (max tokens, temperature), logging level, default subtasks/priority, project name, etc.
|
||||
* **Managed via `task-master models --setup` command.** Do not edit manually unless you know what you are doing.
|
||||
* **View/Set specific models via `task-master models` command or `models` MCP tool.**
|
||||
* Created automatically when you run `task-master models --setup` for the first time.
|
||||
|
||||
2. **Environment Variables (`.env` / `mcp.json`):**
|
||||
* Used **only** for sensitive API keys and specific endpoint URLs.
|
||||
* Place API keys (one per provider) in a `.env` file in the project root for CLI usage.
|
||||
* For MCP/Cursor integration, configure these keys in the `env` section of `.cursor/mcp.json`.
|
||||
* Available keys/variables: See `assets/env.example` or the Configuration section in the command reference (previously linked to `taskmaster.mdc`).
|
||||
|
||||
**Important:** Non-API key settings (like model selections, `MAX_TOKENS`, `TASKMASTER_LOG_LEVEL`) are **no longer configured via environment variables**. Use the `task-master models` command (or `--setup` for interactive configuration) or the `models` MCP tool.
|
||||
**If AI commands FAIL in MCP** verify that the API key for the selected provider is present in the `env` section of `.cursor/mcp.json`.
|
||||
**If AI commands FAIL in CLI** verify that the API key for the selected provider is present in the `.env` file in the root of the project.
|
||||
|
||||
## Determining the Next Task
|
||||
|
||||
- Run `next_task` / `task-master next` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to show the next task to work on
|
||||
- Run `next_task` / `task-master next` to show the next task to work on.
|
||||
- The command identifies tasks with all dependencies satisfied
|
||||
- Tasks are prioritized by priority level, dependency count, and ID
|
||||
- The command shows comprehensive task information including:
|
||||
@@ -133,7 +138,7 @@ Task Master offers two primary ways to interact:
|
||||
|
||||
## Viewing Specific Task Details
|
||||
|
||||
- Run `get_task` / `task-master show <id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to view a specific task
|
||||
- Run `get_task` / `task-master show <id>` to view a specific task.
|
||||
- Use dot notation for subtasks: `task-master show 1.2` (shows subtask 2 of task 1)
|
||||
- Displays comprehensive information similar to the next command, but for a specific task
|
||||
- For parent tasks, shows all subtasks and their current status
|
||||
@@ -143,13 +148,32 @@ Task Master offers two primary ways to interact:
|
||||
|
||||
## Managing Task Dependencies
|
||||
|
||||
- Use `add_dependency` / `task-master add-dependency --id=<id> --depends-on=<id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to add a dependency
|
||||
- Use `remove_dependency` / `task-master remove-dependency --id=<id> --depends-on=<id>` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)) to remove a dependency
|
||||
- Use `add_dependency` / `task-master add-dependency --id=<id> --depends-on=<id>` to add a dependency.
|
||||
- Use `remove_dependency` / `task-master remove-dependency --id=<id> --depends-on=<id>` to remove a dependency.
|
||||
- The system prevents circular dependencies and duplicate dependency entries
|
||||
- Dependencies are checked for existence before being added or removed
|
||||
- Task files are automatically regenerated after dependency changes
|
||||
- Dependencies are visualized with status indicators in task listings and files
|
||||
|
||||
## Task Reorganization
|
||||
|
||||
- Use `move_task` / `task-master move --from=<id> --to=<id>` to move tasks or subtasks within the hierarchy
|
||||
- This command supports several use cases:
|
||||
- Moving a standalone task to become a subtask (e.g., `--from=5 --to=7`)
|
||||
- Moving a subtask to become a standalone task (e.g., `--from=5.2 --to=7`)
|
||||
- Moving a subtask to a different parent (e.g., `--from=5.2 --to=7.3`)
|
||||
- Reordering subtasks within the same parent (e.g., `--from=5.2 --to=5.4`)
|
||||
- Moving a task to a new, non-existent ID position (e.g., `--from=5 --to=25`)
|
||||
- Moving multiple tasks at once using comma-separated IDs (e.g., `--from=10,11,12 --to=16,17,18`)
|
||||
- The system includes validation to prevent data loss:
|
||||
- Allows moving to non-existent IDs by creating placeholder tasks
|
||||
- Prevents moving to existing task IDs that have content (to avoid overwriting)
|
||||
- Validates source tasks exist before attempting to move them
|
||||
- The system maintains proper parent-child relationships and dependency integrity
|
||||
- Task files are automatically regenerated after the move operation
|
||||
- This provides greater flexibility in organizing and refining your task structure as project understanding evolves
|
||||
- This is especially useful when dealing with potential merge conflicts arising from teams creating tasks on separate branches. Solve these conflicts very easily by moving your tasks and keeping theirs.
|
||||
|
||||
## Iterative Subtask Implementation
|
||||
|
||||
Once a task has been broken down into subtasks using `expand_task` or similar methods, follow this iterative process for implementation:
|
||||
@@ -164,14 +188,14 @@ Once a task has been broken down into subtasks using `expand_task` or similar me
|
||||
* Gather *all* relevant details from this exploration phase.
|
||||
|
||||
3. **Log the Plan:**
|
||||
* Run `update_subtask` / `task-master update-subtask --id=<subtaskId> --prompt='<detailed plan>'` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
* Run `update_subtask` / `task-master update-subtask --id=<subtaskId> --prompt='<detailed plan>'`.
|
||||
* Provide the *complete and detailed* findings from the exploration phase in the prompt. Include file paths, line numbers, proposed diffs, reasoning, and any potential challenges identified. Do not omit details. The goal is to create a rich, timestamped log within the subtask's `details`.
|
||||
|
||||
4. **Verify the Plan:**
|
||||
* Run `get_task` / `task-master show <subtaskId>` again to confirm that the detailed implementation plan has been successfully appended to the subtask's details.
|
||||
|
||||
5. **Begin Implementation:**
|
||||
* Set the subtask status using `set_task_status` / `task-master set-status --id=<subtaskId> --status=in-progress` (see [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc)).
|
||||
* Set the subtask status using `set_task_status` / `task-master set-status --id=<subtaskId> --status=in-progress`.
|
||||
* Start coding based on the logged plan.
|
||||
|
||||
6. **Refine and Log Progress (Iteration 2+):**
|
||||
@@ -189,7 +213,7 @@ Once a task has been broken down into subtasks using `expand_task` or similar me
|
||||
7. **Review & Update Rules (Post-Implementation):**
|
||||
* Once the implementation for the subtask is functionally complete, review all code changes and the relevant chat history.
|
||||
* Identify any new or modified code patterns, conventions, or best practices established during the implementation.
|
||||
* Create new or update existing Cursor rules in the `.cursor/rules/` directory to capture these patterns, following the guidelines in [`cursor_rules.mdc`](mdc:.cursor/rules/cursor_rules.mdc) and [`self_improve.mdc`](mdc:.cursor/rules/self_improve.mdc).
|
||||
* Create new or update existing rules following internal guidelines (previously linked to `cursor_rules.mdc` and `self_improve.mdc`).
|
||||
|
||||
8. **Mark Task Complete:**
|
||||
* After verifying the implementation and updating any necessary rules, mark the subtask as completed: `set_task_status` / `task-master set-status --id=<subtaskId> --status=done`.
|
||||
@@ -198,10 +222,10 @@ Once a task has been broken down into subtasks using `expand_task` or similar me
|
||||
* Stage the relevant code changes and any updated/new rule files (`git add .`).
|
||||
* Craft a comprehensive Git commit message summarizing the work done for the subtask, including both code implementation and any rule adjustments.
|
||||
* Execute the commit command directly in the terminal (e.g., `git commit -m 'feat(module): Implement feature X for subtask <subtaskId>\n\n- Details about changes...\n- Updated rule Y for pattern Z'`).
|
||||
* Consider if a Changeset is needed according to [`changeset.mdc`](mdc:.cursor/rules/changeset.mdc). If so, run `npm run changeset`, stage the generated file, and amend the commit or create a new one.
|
||||
* Consider if a Changeset is needed according to internal versioning guidelines (previously linked to `changeset.mdc`). If so, run `npm run changeset`, stage the generated file, and amend the commit or create a new one.
|
||||
|
||||
10. **Proceed to Next Subtask:**
|
||||
* Identify the next subtask in the dependency chain (e.g., using `next_task` / `task-master next`) and repeat this iterative process starting from step 1.
|
||||
* Identify the next subtask (e.g., using `next_task` / `task-master next`).
|
||||
|
||||
## Code Analysis & Refactoring Techniques
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ description: Glossary of other Cursor rules
|
||||
globs: **/*
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Glossary of Task Master Cursor Rules
|
||||
|
||||
This file provides a quick reference to the purpose of each rule file located in the `.cursor/rules` directory.
|
||||
@@ -23,4 +22,5 @@ This file provides a quick reference to the purpose of each rule file located in
|
||||
- **[`tests.mdc`](mdc:.cursor/rules/tests.mdc)**: Guidelines for implementing and maintaining tests for Task Master CLI.
|
||||
- **[`ui.mdc`](mdc:.cursor/rules/ui.mdc)**: Guidelines for implementing and maintaining user interface components.
|
||||
- **[`utilities.mdc`](mdc:.cursor/rules/utilities.mdc)**: Guidelines for implementing utility functions.
|
||||
- **[`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc)**: Guidelines for integrating AI usage telemetry across Task Master.
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ description: Guidelines for implementing and interacting with the Task Master MC
|
||||
globs: mcp-server/src/**/*, scripts/modules/**/*
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Task Master MCP Server Guidelines
|
||||
|
||||
This document outlines the architecture and implementation patterns for the Task Master Model Context Protocol (MCP) server, designed for integration with tools like Cursor.
|
||||
@@ -90,69 +89,54 @@ When implementing a new direct function in `mcp-server/src/core/direct-functions
|
||||
```
|
||||
|
||||
5. **Handling Logging Context (`mcpLog`)**:
|
||||
- **Requirement**: Core functions that use the internal `report` helper function (common in `task-manager.js`, `dependency-manager.js`, etc.) expect the `options` object to potentially contain an `mcpLog` property. This `mcpLog` object **must** have callable methods for each log level (e.g., `mcpLog.info(...)`, `mcpLog.error(...)`).
|
||||
- **Challenge**: The `log` object provided by FastMCP to the direct function's context, while functional, might not perfectly match this expected structure or could change in the future. Passing it directly can lead to runtime errors like `mcpLog[level] is not a function`.
|
||||
- **Solution: The Logger Wrapper Pattern**: To reliably bridge the FastMCP `log` object and the core function's `mcpLog` expectation, use a simple wrapper object within the direct function:
|
||||
- **Requirement**: Core functions (like those in `task-manager.js`) may accept an `options` object containing an optional `mcpLog` property. If provided, the core function expects this object to have methods like `mcpLog.info(...)`, `mcpLog.error(...)`.
|
||||
- **Solution: The Logger Wrapper Pattern**: When calling a core function from a direct function, pass the `log` object provided by FastMCP *wrapped* in the standard `logWrapper` object. This ensures the core function receives a logger with the expected method structure.
|
||||
```javascript
|
||||
// Standard logWrapper pattern within a Direct Function
|
||||
const logWrapper = {
|
||||
info: (message, ...args) => log.info(message, ...args),
|
||||
warn: (message, ...args) => log.warn(message, ...args),
|
||||
error: (message, ...args) => log.error(message, ...args),
|
||||
debug: (message, ...args) => log.debug && log.debug(message, ...args), // Handle optional debug
|
||||
success: (message, ...args) => log.info(message, ...args) // Map success to info if needed
|
||||
debug: (message, ...args) => log.debug && log.debug(message, ...args),
|
||||
success: (message, ...args) => log.info(message, ...args)
|
||||
};
|
||||
|
||||
// ... later when calling the core function ...
|
||||
await coreFunction(
|
||||
// ... other arguments ...
|
||||
tasksPath,
|
||||
taskId,
|
||||
{
|
||||
mcpLog: logWrapper, // Pass the wrapper object
|
||||
session
|
||||
session // Also pass session if needed by core logic or AI service
|
||||
},
|
||||
'json' // Pass 'json' output format if supported by core function
|
||||
);
|
||||
```
|
||||
- **Critical For JSON Output Format**: Passing the `logWrapper` as `mcpLog` serves a dual purpose:
|
||||
1. **Prevents Runtime Errors**: It ensures the `mcpLog[level](...)` calls within the core function succeed
|
||||
2. **Controls Output Format**: In functions like `updateTaskById` and `updateSubtaskById`, the presence of `mcpLog` in the options triggers setting `outputFormat = 'json'` (instead of 'text'). This prevents UI elements (spinners, boxes) from being generated, which would break the JSON response.
|
||||
- **Proven Solution**: This pattern has successfully fixed multiple issues in our MCP tools (including `update-task` and `update-subtask`), where direct passing of the `log` object or omitting `mcpLog` led to either runtime errors or JSON parsing failures from UI output.
|
||||
- **When To Use**: Implement this wrapper in any direct function that calls a core function with an `options` object that might use `mcpLog` for logging or output format control.
|
||||
- **Why it Works**: The `logWrapper` explicitly defines the `.info()`, `.warn()`, `.error()`, etc., methods that the core function's `report` helper needs, ensuring the `mcpLog[level](...)` call succeeds. It simply forwards the logging calls to the actual FastMCP `log` object.
|
||||
- **Combined with Silent Mode**: Remember that using the `logWrapper` for `mcpLog` is **necessary *in addition* to using `enableSilentMode()` / `disableSilentMode()`** (see next point). The wrapper handles structured logging *within* the core function, while silent mode suppresses direct `console.log` and UI elements (spinners, boxes) that would break the MCP JSON response.
|
||||
- **JSON Output**: Passing `mcpLog` (via the wrapper) often triggers the core function to use a JSON-friendly output format, suppressing spinners/boxes.
|
||||
- ✅ **DO**: Implement this pattern in direct functions calling core functions that might use `mcpLog`.
|
||||
|
||||
6. **Silent Mode Implementation**:
|
||||
- ✅ **DO**: Import silent mode utilities at the top: `import { enableSilentMode, disableSilentMode, isSilentMode } from '../../../../scripts/modules/utils.js';`
|
||||
- ✅ **DO**: Ensure core Task Master functions called from direct functions do **not** pollute `stdout` with console output (banners, spinners, logs) that would break MCP's JSON communication.
|
||||
- **Preferred**: Modify the core function to accept an `outputFormat: 'json'` parameter and check it internally before printing UI elements. Pass `'json'` from the direct function.
|
||||
- **Required Fallback/Guarantee**: If the core function cannot be modified or its output suppression is unreliable, **wrap the core function call** within the direct function using `enableSilentMode()` / `disableSilentMode()` in a `try/finally` block. This guarantees no console output interferes with the MCP response.
|
||||
- ✅ **DO**: Use `isSilentMode()` function to check global silent mode status if needed (rare in direct functions), NEVER access the global `silentMode` variable directly.
|
||||
- ❌ **DON'T**: Wrap AI client initialization or AI API calls in `enable/disableSilentMode`; their logging is controlled via the `log` object (passed potentially within the `logWrapper` for core functions).
|
||||
- ❌ **DON'T**: Assume a core function is silent just because it *should* be. Verify or use the `enable/disableSilentMode` wrapper.
|
||||
- **Example (Direct Function Guaranteeing Silence and using Log Wrapper)**:
|
||||
- ✅ **DO**: Import silent mode utilities: `import { enableSilentMode, disableSilentMode, isSilentMode } from '../../../../scripts/modules/utils.js';`
|
||||
- ✅ **DO**: Wrap core function calls *within direct functions* using `enableSilentMode()` / `disableSilentMode()` in a `try/finally` block if the core function might produce console output (spinners, boxes, direct `console.log`) that isn't reliably controlled by passing `{ mcpLog }` or an `outputFormat` parameter.
|
||||
- ✅ **DO**: Always disable silent mode in the `finally` block.
|
||||
- ❌ **DON'T**: Wrap calls to the unified AI service (`generateTextService`, `generateObjectService`) in silent mode; their logging is handled internally.
|
||||
- **Example (Direct Function Guaranteeing Silence & using Log Wrapper)**:
|
||||
```javascript
|
||||
export async function coreWrapperDirect(args, log, context = {}) {
|
||||
const { session } = context;
|
||||
const tasksPath = findTasksJsonPath(args, log);
|
||||
|
||||
// Create the logger wrapper
|
||||
const logWrapper = { /* ... as defined above ... */ };
|
||||
const logWrapper = { /* ... */ };
|
||||
|
||||
enableSilentMode(); // Ensure silence for direct console output
|
||||
try {
|
||||
// Call core function, passing wrapper and 'json' format
|
||||
const result = await coreFunction(
|
||||
tasksPath,
|
||||
args.param1,
|
||||
{ mcpLog: logWrapper, session },
|
||||
'json' // Explicitly request JSON format if supported
|
||||
);
|
||||
tasksPath,
|
||||
args.param1,
|
||||
{ mcpLog: logWrapper, session }, // Pass context
|
||||
'json' // Request JSON format if supported
|
||||
);
|
||||
return { success: true, data: result };
|
||||
} catch (error) {
|
||||
log.error(`Error: ${error.message}`);
|
||||
// Return standardized error object
|
||||
return { success: false, error: { /* ... */ } };
|
||||
} finally {
|
||||
disableSilentMode(); // Critical: Always disable in finally
|
||||
@@ -163,32 +147,6 @@ When implementing a new direct function in `mcp-server/src/core/direct-functions
|
||||
7. **Debugging MCP/Core Logic Interaction**:
|
||||
- ✅ **DO**: If an MCP tool fails with unclear errors (like JSON parsing failures), run the equivalent `task-master` CLI command in the terminal. The CLI often provides more detailed error messages originating from the core logic (e.g., `ReferenceError`, stack traces) that are obscured by the MCP layer.
|
||||
|
||||
### Specific Guidelines for AI-Based Direct Functions
|
||||
|
||||
Direct functions that interact with AI (e.g., `addTaskDirect`, `expandTaskDirect`) have additional responsibilities:
|
||||
|
||||
- **Context Parameter**: These functions receive an additional `context` object as their third parameter. **Critically, this object should only contain `{ session }`**. Do NOT expect or use `reportProgress` from this context.
|
||||
```javascript
|
||||
export async function yourAIDirect(args, log, context = {}) {
|
||||
const { session } = context; // Only expect session
|
||||
// ...
|
||||
}
|
||||
```
|
||||
- **AI Client Initialization**:
|
||||
- ✅ **DO**: Use the utilities from [`mcp-server/src/core/utils/ai-client-utils.js`](mdc:mcp-server/src/core/utils/ai-client-utils.js) (e.g., `getAnthropicClientForMCP(session, log)`) to get AI client instances. These correctly use the `session` object to resolve API keys.
|
||||
- ✅ **DO**: Wrap client initialization in a try/catch block and return a specific `AI_CLIENT_ERROR` on failure.
|
||||
- **AI Interaction**:
|
||||
- ✅ **DO**: Build prompts using helper functions where appropriate (e.g., from `ai-prompt-helpers.js`).
|
||||
- ✅ **DO**: Make the AI API call using appropriate helpers (e.g., `_handleAnthropicStream`). Pass the `log` object to these helpers for internal logging. **Do NOT pass `reportProgress`**.
|
||||
- ✅ **DO**: Parse the AI response using helpers (e.g., `parseTaskJsonResponse`) and handle parsing errors with a specific code (e.g., `RESPONSE_PARSING_ERROR`).
|
||||
- **Calling Core Logic**:
|
||||
- ✅ **DO**: After successful AI interaction, call the relevant core Task Master function (from `scripts/modules/`) if needed (e.g., `addTaskDirect` calls `addTask`).
|
||||
- ✅ **DO**: Pass necessary data, including potentially the parsed AI results, to the core function.
|
||||
- ✅ **DO**: If the core function can produce console output, call it with an `outputFormat: 'json'` argument (or similar, depending on the function) to suppress CLI output. Ensure the core function is updated to respect this. Use `enableSilentMode/disableSilentMode` around the core function call as a fallback if `outputFormat` is not supported or insufficient.
|
||||
- **Progress Indication**:
|
||||
- ❌ **DON'T**: Call `reportProgress` within the direct function.
|
||||
- ✅ **DO**: If intermediate progress status is needed *within* the long-running direct function, use standard logging: `log.info('Progress: Processing AI response...')`.
|
||||
|
||||
## Tool Definition and Execution
|
||||
|
||||
### Tool Structure
|
||||
@@ -221,151 +179,78 @@ server.addTool({
|
||||
The `execute` function receives validated arguments and the FastMCP context:
|
||||
|
||||
```javascript
|
||||
// Standard signature
|
||||
execute: async (args, context) => {
|
||||
// Tool implementation
|
||||
}
|
||||
|
||||
// Destructured signature (recommended)
|
||||
execute: async (args, { log, reportProgress, session }) => {
|
||||
execute: async (args, { log, session }) => {
|
||||
// Tool implementation
|
||||
}
|
||||
```
|
||||
|
||||
- **args**: The first parameter contains all the validated parameters defined in the tool's schema.
|
||||
- **context**: The second parameter is an object containing `{ log, reportProgress, session }` provided by FastMCP.
|
||||
- ✅ **DO**: Use `{ log, session }` when calling direct functions.
|
||||
- ⚠️ **WARNING**: Avoid passing `reportProgress` down to direct functions due to client compatibility issues. See Progress Reporting Convention below.
|
||||
- **args**: Validated parameters.
|
||||
- **context**: Contains `{ log, session }` from FastMCP. (Removed `reportProgress`).
|
||||
|
||||
### Standard Tool Execution Pattern
|
||||
### Standard Tool Execution Pattern with Path Normalization (Updated)
|
||||
|
||||
The `execute` method within each MCP tool (in `mcp-server/src/tools/*.js`) should follow this standard pattern:
|
||||
To ensure consistent handling of project paths across different client environments (Windows, macOS, Linux, WSL) and input formats (e.g., `file:///...`, URI encoded paths), all MCP tool `execute` methods that require access to the project root **MUST** be wrapped with the `withNormalizedProjectRoot` Higher-Order Function (HOF).
|
||||
|
||||
1. **Log Entry**: Log the start of the tool execution with relevant arguments.
|
||||
2. **Get Project Root**: Use the `getProjectRootFromSession(session, log)` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)) to extract the project root path from the client session. Fall back to `args.projectRoot` if the session doesn't provide a root.
|
||||
3. **Call Direct Function**: Invoke the corresponding `*Direct` function wrapper (e.g., `listTasksDirect` from [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js)), passing an updated `args` object that includes the resolved `projectRoot`. Crucially, the third argument (context) passed to the direct function should **only include `{ log, session }`**. **Do NOT pass `reportProgress`**.
|
||||
```javascript
|
||||
// Example call to a non-AI direct function
|
||||
const result = await someDirectFunction({ ...args, projectRoot }, log);
|
||||
|
||||
// Example call to an AI-based direct function
|
||||
const resultAI = await someAIDirect({ ...args, projectRoot }, log, { session });
|
||||
```
|
||||
4. **Handle Result**: Receive the result object (`{ success, data/error, fromCache }`) from the `*Direct` function.
|
||||
5. **Format Response**: Pass this result object to the `handleApiResult` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)) for standardized MCP response formatting and error handling.
|
||||
6. **Return**: Return the formatted response object provided by `handleApiResult`.
|
||||
This HOF, defined in [`mcp-server/src/tools/utils.js`](mdc:mcp-server/src/tools/utils.js), performs the following before calling the tool's core logic:
|
||||
|
||||
1. **Determines the Raw Root:** It prioritizes `args.projectRoot` if provided by the client, otherwise it calls `getRawProjectRootFromSession` to extract the path from the session.
|
||||
2. **Normalizes the Path:** It uses the `normalizeProjectRoot` helper to decode URIs, strip `file://` prefixes, fix potential Windows drive letter prefixes (e.g., `/C:/`), convert backslashes (`\`) to forward slashes (`/`), and resolve the path to an absolute path suitable for the server's OS.
|
||||
3. **Injects Normalized Path:** It updates the `args` object by replacing the original `projectRoot` (or adding it) with the normalized, absolute path.
|
||||
4. **Executes Original Logic:** It calls the original `execute` function body, passing the updated `args` object.
|
||||
|
||||
**Implementation Example:**
|
||||
|
||||
```javascript
|
||||
// Example execute method structure for a tool calling an AI-based direct function
|
||||
import { getProjectRootFromSession, handleApiResult, createErrorResponse } from './utils.js';
|
||||
import { someAIDirectFunction } from '../core/task-master-core.js';
|
||||
// In mcp-server/src/tools/your-tool.js
|
||||
import {
|
||||
handleApiResult,
|
||||
createErrorResponse,
|
||||
withNormalizedProjectRoot // <<< Import HOF
|
||||
} from './utils.js';
|
||||
import { yourDirectFunction } from '../core/task-master-core.js';
|
||||
import { findTasksJsonPath } from '../core/utils/path-utils.js'; // If needed
|
||||
|
||||
// ... inside server.addTool({...})
|
||||
execute: async (args, { log, session }) => { // Note: reportProgress is omitted here
|
||||
try {
|
||||
log.info(`Starting AI tool execution with args: ${JSON.stringify(args)}`);
|
||||
export function registerYourTool(server) {
|
||||
server.addTool({
|
||||
name: "your_tool",
|
||||
description: "...".
|
||||
parameters: z.object({
|
||||
// ... other parameters ...
|
||||
projectRoot: z.string().optional().describe('...') // projectRoot is optional here, HOF handles fallback
|
||||
}),
|
||||
// Wrap the entire execute function
|
||||
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||
// args.projectRoot is now guaranteed to be normalized and absolute
|
||||
const { /* other args */, projectRoot } = args;
|
||||
|
||||
// 1. Get Project Root
|
||||
let rootFolder = getProjectRootFromSession(session, log);
|
||||
if (!rootFolder && args.projectRoot) { // Fallback if needed
|
||||
rootFolder = args.projectRoot;
|
||||
log.info(`Using project root from args as fallback: ${rootFolder}`);
|
||||
}
|
||||
try {
|
||||
log.info(`Executing your_tool with normalized root: ${projectRoot}`);
|
||||
|
||||
// 2. Call AI-Based Direct Function (passing only log and session in context)
|
||||
const result = await someAIDirectFunction({
|
||||
...args,
|
||||
projectRoot: rootFolder // Ensure projectRoot is explicitly passed
|
||||
}, log, { session }); // Pass session here, NO reportProgress
|
||||
// Resolve paths using the normalized projectRoot
|
||||
let tasksPath = findTasksJsonPath({ projectRoot, file: args.file }, log);
|
||||
|
||||
// 3. Handle and Format Response
|
||||
return handleApiResult(result, log);
|
||||
// Call direct function, passing normalized projectRoot if needed by direct func
|
||||
const result = await yourDirectFunction(
|
||||
{
|
||||
/* other args */,
|
||||
projectRoot // Pass it if direct function needs it
|
||||
},
|
||||
log,
|
||||
{ session }
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
log.error(`Error during AI tool execution: ${error.message}`);
|
||||
return createErrorResponse(error.message);
|
||||
}
|
||||
return handleApiResult(result, log);
|
||||
} catch (error) {
|
||||
log.error(`Error in your_tool: ${error.message}`);
|
||||
return createErrorResponse(error.message);
|
||||
}
|
||||
}) // End HOF wrap
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Using AsyncOperationManager for Background Tasks
|
||||
|
||||
For tools that execute potentially long-running operations *where the AI call is just one part* (e.g., `expand-task`, `update`), use the AsyncOperationManager. The `add-task` command, as refactored, does *not* require this in the MCP tool layer because the direct function handles the primary AI work and returns the final result synchronously from the perspective of the MCP tool.
|
||||
|
||||
For tools that *do* use `AsyncOperationManager`:
|
||||
|
||||
```javascript
|
||||
import { AsyncOperationManager } from '../utils/async-operation-manager.js'; // Correct path assuming utils location
|
||||
import { getProjectRootFromSession, createContentResponse, createErrorResponse } from './utils.js';
|
||||
import { someIntensiveDirect } from '../core/task-master-core.js';
|
||||
|
||||
// ... inside server.addTool({...})
|
||||
execute: async (args, { log, session }) => { // Note: reportProgress omitted
|
||||
try {
|
||||
log.info(`Starting background operation with args: ${JSON.stringify(args)}`);
|
||||
|
||||
// 1. Get Project Root
|
||||
let rootFolder = getProjectRootFromSession(session, log);
|
||||
if (!rootFolder && args.projectRoot) {
|
||||
rootFolder = args.projectRoot;
|
||||
log.info(`Using project root from args as fallback: ${rootFolder}`);
|
||||
}
|
||||
|
||||
// Create operation description
|
||||
const operationDescription = `Expanding task ${args.id}...`; // Example
|
||||
|
||||
// 2. Start async operation using AsyncOperationManager
|
||||
const operation = AsyncOperationManager.createOperation(
|
||||
operationDescription,
|
||||
async (reportProgressCallback) => { // This callback is provided by AsyncOperationManager
|
||||
// This runs in the background
|
||||
try {
|
||||
// Report initial progress *from the manager's callback*
|
||||
reportProgressCallback({ progress: 0, status: 'Starting operation...' });
|
||||
|
||||
// Call the direct function (passing only session context)
|
||||
const result = await someIntensiveDirect(
|
||||
{ ...args, projectRoot: rootFolder },
|
||||
log,
|
||||
{ session } // Pass session, NO reportProgress
|
||||
);
|
||||
|
||||
// Report final progress *from the manager's callback*
|
||||
reportProgressCallback({
|
||||
progress: 100,
|
||||
status: result.success ? 'Operation completed' : 'Operation failed',
|
||||
result: result.data, // Include final data if successful
|
||||
error: result.error // Include error object if failed
|
||||
});
|
||||
|
||||
return result; // Return the direct function's result
|
||||
} catch (error) {
|
||||
// Handle errors within the async task
|
||||
reportProgressCallback({
|
||||
progress: 100,
|
||||
status: 'Operation failed critically',
|
||||
error: { message: error.message, code: error.code || 'ASYNC_OPERATION_FAILED' }
|
||||
});
|
||||
throw error; // Re-throw for the manager to catch
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// 3. Return immediate response with operation ID
|
||||
return {
|
||||
status: 202, // StatusCodes.ACCEPTED
|
||||
body: {
|
||||
success: true,
|
||||
message: 'Operation started',
|
||||
operationId: operation.id
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
log.error(`Error starting background operation: ${error.message}`);
|
||||
return createErrorResponse(`Failed to start operation: ${error.message}`); // Use standard error response
|
||||
}
|
||||
}
|
||||
```
|
||||
By using this HOF, the core logic within the `execute` method and any downstream functions (like `findTasksJsonPath` or direct functions) can reliably expect `args.projectRoot` to be a clean, absolute path suitable for the server environment.
|
||||
|
||||
### Project Initialization Tool
|
||||
|
||||
@@ -417,19 +302,13 @@ log.error(`Error occurred: ${error.message}`, { stack: error.stack });
|
||||
log.info('Progress: 50% - AI call initiated...'); // Example progress logging
|
||||
```
|
||||
|
||||
### Progress Reporting Convention
|
||||
|
||||
- ⚠️ **DEPRECATED within Direct Functions**: The `reportProgress` function passed in the `context` object should **NOT** be called from within `*Direct` functions. Doing so can cause client-side validation errors due to missing/incorrect `progressToken` handling.
|
||||
- ✅ **DO**: For tools using `AsyncOperationManager`, use the `reportProgressCallback` function *provided by the manager* within the background task definition (as shown in the `AsyncOperationManager` example above) to report progress updates for the *overall operation*.
|
||||
- ✅ **DO**: If finer-grained progress needs to be indicated *during* the execution of a `*Direct` function (whether called directly or via `AsyncOperationManager`), use `log.info()` statements (e.g., `log.info('Progress: Parsing AI response...')`).
|
||||
|
||||
### Session Usage Convention
|
||||
## Session Usage Convention
|
||||
|
||||
The `session` object (destructured from `context`) contains authenticated session data and client information.
|
||||
|
||||
- **Authentication**: Access user-specific data (`session.userId`, etc.) if authentication is implemented.
|
||||
- **Project Root**: The primary use in Task Master is accessing `session.roots` to determine the client's project root directory via the `getProjectRootFromSession` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)). See the Standard Tool Execution Pattern above.
|
||||
- **Environment Variables**: The `session.env` object is critical for AI tools. Pass the `session` object to the `*Direct` function's context, and then to AI client utility functions (like `getAnthropicClientForMCP`) which will extract API keys and other relevant environment settings (e.g., `MODEL`, `MAX_TOKENS`) from `session.env`.
|
||||
- **Environment Variables**: The `session.env` object provides access to environment variables set in the MCP client configuration (e.g., `.cursor/mcp.json`). This is the **primary mechanism** for the unified AI service layer (`ai-services-unified.js`) to securely access **API keys** when called from MCP context.
|
||||
- **Capabilities**: Can be used to check client capabilities (`session.clientCapabilities`).
|
||||
|
||||
## Direct Function Wrappers (`*Direct`)
|
||||
@@ -438,24 +317,25 @@ These functions, located in `mcp-server/src/core/direct-functions/`, form the co
|
||||
|
||||
- **Purpose**: Bridge MCP tools and core Task Master modules (`scripts/modules/*`). Handle AI interactions if applicable.
|
||||
- **Responsibilities**:
|
||||
- Receive `args` (including the `projectRoot` determined by the tool), `log` object, and optionally a `context` object (containing **only `{ session }` if needed).
|
||||
- **Find `tasks.json`**: Use `findTasksJsonPath(args, log)` from [`core/utils/path-utils.js`](mdc:mcp-server/src/core/utils/path-utils.js).
|
||||
- Validate arguments specific to the core logic.
|
||||
- **Handle AI Logic (if applicable)**: Initialize AI clients (using `session` from context), build prompts, make AI calls, parse responses.
|
||||
- **Implement Caching (if applicable)**: Use `getCachedOrExecute` from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js) for read operations.
|
||||
- **Call Core Logic**: Call the underlying function from the core Task Master modules, passing necessary data (including AI results if applicable).
|
||||
- ✅ **DO**: Pass `outputFormat: 'json'` (or similar) to the core function if it might produce console output.
|
||||
- ✅ **DO**: Wrap the core function call with `enableSilentMode/disableSilentMode` if necessary.
|
||||
- Handle errors gracefully (AI errors, core logic errors, file errors).
|
||||
- Return a standardized result object: `{ success: boolean, data?: any, error?: { code: string, message: string }, fromCache?: boolean }`.
|
||||
- ❌ **DON'T**: Call `reportProgress`. Use `log.info` for progress indication if needed.
|
||||
- Receive `args` (including `projectRoot`), `log`, and optionally `{ session }` context.
|
||||
- Find `tasks.json` using `findTasksJsonPath`.
|
||||
- Validate arguments.
|
||||
- **Implement Caching (if applicable)**: Use `getCachedOrExecute`.
|
||||
- **Call Core Logic**: Invoke function from `scripts/modules/*`.
|
||||
- Pass `outputFormat: 'json'` if applicable.
|
||||
- Wrap with `enableSilentMode/disableSilentMode` if needed.
|
||||
- Pass `{ mcpLog: logWrapper, session }` context if core logic needs it.
|
||||
- Handle errors.
|
||||
- Return standardized result object.
|
||||
- ❌ **DON'T**: Call `reportProgress`.
|
||||
- ❌ **DON'T**: Initialize AI clients or call AI services directly.
|
||||
|
||||
## Key Principles
|
||||
|
||||
- **Prefer Direct Function Calls**: MCP tools should always call `*Direct` wrappers instead of `executeTaskMasterCommand`.
|
||||
- **Standardized Execution Flow**: Follow the pattern: MCP Tool -> `getProjectRootFromSession` -> `*Direct` Function -> Core Logic / AI Logic.
|
||||
- **Path Resolution via Direct Functions**: The `*Direct` function is responsible for finding the exact `tasks.json` path using `findTasksJsonPath`, relying on the `projectRoot` passed in `args`.
|
||||
- **AI Logic in Direct Functions**: For AI-based tools, the `*Direct` function handles AI client initialization, calls, and parsing, using the `session` object passed in its context.
|
||||
- **AI Logic in Core Modules**: AI interactions (prompt building, calling unified service) reside within the core logic functions (`scripts/modules/*`), not direct functions.
|
||||
- **Silent Mode in Direct Functions**: Wrap *core function* calls (from `scripts/modules`) with `enableSilentMode()` and `disableSilentMode()` if they produce console output not handled by `outputFormat`. Do not wrap AI calls.
|
||||
- **Selective Async Processing**: Use `AsyncOperationManager` in the *MCP Tool layer* for operations involving multiple steps or long waits beyond a single AI call (e.g., file processing + AI call + file writing). Simple AI calls handled entirely within the `*Direct` function (like `addTaskDirect`) may not need it at the tool layer.
|
||||
- **No `reportProgress` in Direct Functions**: Do not pass or use `reportProgress` within `*Direct` functions. Use `log.info()` for internal progress or report progress from the `AsyncOperationManager` callback in the MCP tool layer.
|
||||
@@ -480,7 +360,7 @@ Follow these steps to add MCP support for an existing Task Master command (see [
|
||||
|
||||
1. **Ensure Core Logic Exists**: Verify the core functionality is implemented and exported from the relevant module in `scripts/modules/`. Ensure the core function can suppress console output (e.g., via an `outputFormat` parameter).
|
||||
|
||||
2. **Create Direct Function File in `mcp-server/src/core/direct-functions/`**:
|
||||
2. **Create Direct Function File in `mcp-server/src/core/direct-functions/`**:
|
||||
- Create a new file (e.g., `your-command.js`) using **kebab-case** naming.
|
||||
- Import necessary core functions, `findTasksJsonPath`, silent mode utilities, and potentially AI client/prompt utilities.
|
||||
- Implement `async function yourCommandDirect(args, log, context = {})` using **camelCase** with `Direct` suffix. **Remember `context` should only contain `{ session }` if needed (for AI keys/config).**
|
||||
@@ -642,3 +522,8 @@ Follow these steps to add MCP support for an existing Task Master command (see [
|
||||
// Add more functions as implemented
|
||||
};
|
||||
```
|
||||
|
||||
## Telemetry Integration
|
||||
|
||||
- Direct functions calling core logic that involves AI should receive and pass through `telemetryData` within their successful `data` payload. See [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc) for the standard pattern.
|
||||
- MCP tools use `handleApiResult`, which ensures the `data` object (potentially including `telemetryData`) from the direct function is correctly included in the final response.
|
||||
|
||||
@@ -3,7 +3,6 @@ description: Guidelines for integrating new features into the Task Master CLI
|
||||
globs: scripts/modules/*.js
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Task Master Feature Integration Guidelines
|
||||
|
||||
## Feature Placement Decision Process
|
||||
@@ -25,11 +24,17 @@ alwaysApply: false
|
||||
The standard pattern for adding a feature follows this workflow:
|
||||
|
||||
1. **Core Logic**: Implement the business logic in the appropriate module (e.g., [`task-manager.js`](mdc:scripts/modules/task-manager.js)).
|
||||
2. **UI Components**: Add any display functions to [`ui.js`](mdc:scripts/modules/ui.js) following [`ui.mdc`](mdc:.cursor/rules/ui.mdc).
|
||||
3. **Command Integration**: Add the CLI command to [`commands.js`](mdc:scripts/modules/commands.js) following [`commands.mdc`](mdc:.cursor/rules/commands.mdc).
|
||||
4. **Testing**: Write tests for all components of the feature (following [`tests.mdc`](mdc:.cursor/rules/tests.mdc))
|
||||
5. **Configuration**: Update any configuration in [`utils.js`](mdc:scripts/modules/utils.js) if needed, following [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc).
|
||||
6. **Documentation**: Update help text and documentation in [dev_workflow.mdc](mdc:scripts/modules/dev_workflow.mdc)
|
||||
2. **AI Integration (If Applicable)**:
|
||||
- Import necessary service functions (e.g., `generateTextService`, `streamTextService`) from [`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js).
|
||||
- Prepare parameters (`role`, `session`, `systemPrompt`, `prompt`).
|
||||
- Call the service function.
|
||||
- Handle the response (direct text or stream object).
|
||||
- **Important**: Prefer `generateTextService` for calls sending large context (like stringified JSON) where incremental display is not needed. See [`ai_services.mdc`](mdc:.cursor/rules/ai_services.mdc) for detailed usage patterns and cautions.
|
||||
3. **UI Components**: Add any display functions to [`ui.js`](mdc:scripts/modules/ui.js) following [`ui.mdc`](mdc:.cursor/rules/ui.mdc).
|
||||
4. **Command Integration**: Add the CLI command to [`commands.js`](mdc:scripts/modules/commands.js) following [`commands.mdc`](mdc:.cursor/rules/commands.mdc).
|
||||
5. **Testing**: Write tests for all components of the feature (following [`tests.mdc`](mdc:.cursor/rules/tests.mdc))
|
||||
6. **Configuration**: Update configuration settings or add new ones in [`config-manager.js`](mdc:scripts/modules/config-manager.js) and ensure getters/setters are appropriate. Update documentation in [`utilities.mdc`](mdc:.cursor/rules/utilities.mdc) and [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc). Update the `.taskmasterconfig` structure if needed.
|
||||
7. **Documentation**: Update help text and documentation in [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc) and [`taskmaster.mdc`](mdc:.cursor/rules/taskmaster.mdc).
|
||||
|
||||
## Critical Checklist for New Features
|
||||
|
||||
@@ -190,6 +195,8 @@ The standard pattern for adding a feature follows this workflow:
|
||||
- ✅ **DO**: If an MCP tool fails with vague errors (e.g., JSON parsing issues like `Unexpected token ... is not valid JSON`), **try running the equivalent CLI command directly in the terminal** (e.g., `task-master expand --all`). CLI output often provides much more specific error messages (like missing function definitions or stack traces from the core logic) that pinpoint the root cause.
|
||||
- ❌ **DON'T**: Rely solely on MCP logs if the error is unclear; use the CLI as a complementary debugging tool for core logic issues.
|
||||
|
||||
- **Telemetry Integration**: Ensure AI calls correctly handle and propagate `telemetryData` as described in [`telemetry.mdc`](mdc:.cursor/rules/telemetry.mdc).
|
||||
|
||||
```javascript
|
||||
// 1. CORE LOGIC: Add function to appropriate module (example in task-manager.js)
|
||||
/**
|
||||
@@ -211,7 +218,29 @@ export {
|
||||
```
|
||||
|
||||
```javascript
|
||||
// 2. UI COMPONENTS: Add display function to ui.js
|
||||
// 2. AI Integration: Add import and use necessary service functions
|
||||
import { generateTextService } from './ai-services-unified.js';
|
||||
|
||||
// Example usage:
|
||||
async function handleAIInteraction() {
|
||||
const role = 'user';
|
||||
const session = 'exampleSession';
|
||||
const systemPrompt = 'You are a helpful assistant.';
|
||||
const prompt = 'What is the capital of France?';
|
||||
|
||||
const result = await generateTextService(role, session, systemPrompt, prompt);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
// Export from the module
|
||||
export {
|
||||
// ... existing exports ...
|
||||
handleAIInteraction,
|
||||
};
|
||||
```
|
||||
|
||||
```javascript
|
||||
// 3. UI COMPONENTS: Add display function to ui.js
|
||||
/**
|
||||
* Display archive operation results
|
||||
* @param {string} archivePath - Path to the archive file
|
||||
@@ -232,7 +261,7 @@ export {
|
||||
```
|
||||
|
||||
```javascript
|
||||
// 3. COMMAND INTEGRATION: Add to commands.js
|
||||
// 4. COMMAND INTEGRATION: Add to commands.js
|
||||
import { archiveTasks } from './task-manager.js';
|
||||
import { displayArchiveResults } from './ui.js';
|
||||
|
||||
@@ -452,7 +481,7 @@ npm test
|
||||
For each new feature:
|
||||
|
||||
1. Add help text to the command definition
|
||||
2. Update [`dev_workflow.mdc`](mdc:scripts/modules/dev_workflow.mdc) with command reference
|
||||
2. Update [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc) with command reference
|
||||
3. Consider updating [`architecture.mdc`](mdc:.cursor/rules/architecture.mdc) if the feature significantly changes module responsibilities.
|
||||
|
||||
Follow the existing command reference format:
|
||||
@@ -495,14 +524,24 @@ Integrating Task Master commands with the MCP server (for use by tools like Curs
|
||||
|
||||
4. **Create MCP Tool (`mcp-server/src/tools/`)**:
|
||||
- Create a new file (e.g., `your-command.js`) using **kebab-case**.
|
||||
- Import `zod`, `handleApiResult`, `createErrorResponse`, **`getProjectRootFromSession`**, and your `yourCommandDirect` function.
|
||||
- Import `zod`, `handleApiResult`, **`withNormalizedProjectRoot` HOF**, and your `yourCommandDirect` function.
|
||||
- Implement `registerYourCommandTool(server)`.
|
||||
- Define the tool `name` using **snake_case** (e.g., `your_command`).
|
||||
- Define the `parameters` using `zod`. **Crucially, define `projectRoot` as optional**: `projectRoot: z.string().optional().describe(...)`. Include `file` if applicable.
|
||||
- Implement the standard `async execute(args, { log, reportProgress, session })` method:
|
||||
- Get `rootFolder` using `getProjectRootFromSession` (with fallback to `args.projectRoot`).
|
||||
- Call `yourCommandDirect({ ...args, projectRoot: rootFolder }, log)`.
|
||||
- Pass the result to `handleApiResult(result, log, 'Error Message')`.
|
||||
- **Define parameters**: Make `projectRoot` optional (`z.string().optional().describe(...)`) as the HOF handles fallback.
|
||||
- Consider if this operation should run in the background using `AsyncOperationManager`.
|
||||
- Implement the standard `execute` method **wrapped with `withNormalizedProjectRoot`**:
|
||||
```javascript
|
||||
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||
// args.projectRoot is now normalized
|
||||
const { projectRoot /*, other args */ } = args;
|
||||
// ... resolve tasks path if needed using normalized projectRoot ...
|
||||
const result = await yourCommandDirect(
|
||||
{ /* other args */, projectRoot /* if needed by direct func */ },
|
||||
log,
|
||||
{ session }
|
||||
);
|
||||
return handleApiResult(result, log);
|
||||
})
|
||||
```
|
||||
|
||||
5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`.
|
||||
|
||||
|
||||
@@ -69,5 +69,4 @@ alwaysApply: true
|
||||
- Update references to external docs
|
||||
- Maintain links between related rules
|
||||
- Document breaking changes
|
||||
|
||||
Follow [cursor_rules.mdc](mdc:.cursor/rules/cursor_rules.mdc) for proper rule formatting and structure.
|
||||
Follow [cursor_rules.mdc](mdc:.cursor/rules/cursor_rules.mdc) for proper rule formatting and structure.
|
||||
|
||||
@@ -3,14 +3,13 @@ description: Comprehensive reference for Taskmaster MCP tools and CLI commands.
|
||||
globs: **/*
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Taskmaster Tool & Command Reference
|
||||
|
||||
This document provides a detailed reference for interacting with Taskmaster, covering both the recommended MCP tools (for integrations like Cursor) and the corresponding `task-master` CLI commands (for direct user interaction or fallback).
|
||||
This document provides a detailed reference for interacting with Taskmaster, covering both the recommended MCP tools, suitable for integrations like Cursor, and the corresponding `task-master` CLI commands, designed for direct user interaction or fallback.
|
||||
|
||||
**Note:** For interacting with Taskmaster programmatically or via integrated tools, using the **MCP tools is strongly recommended** due to better performance, structured data, and error handling. The CLI commands serve as a user-friendly alternative and fallback. See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc) for MCP implementation details and [`commands.mdc`](mdc:.cursor/rules/commands.mdc) for CLI implementation guidelines.
|
||||
**Note:** For interacting with Taskmaster programmatically or via integrated tools, using the **MCP tools is strongly recommended** due to better performance, structured data, and error handling. The CLI commands serve as a user-friendly alternative and fallback.
|
||||
|
||||
**Important:** Several MCP tools involve AI processing and are long-running operations that may take up to a minute to complete. When using these tools, always inform users that the operation is in progress and to wait patiently for results. The AI-powered tools include: `parse_prd`, `analyze_project_complexity`, `update_subtask`, `update_task`, `update`, `expand_all`, `expand_task`, and `add_task`.
|
||||
**Important:** Several MCP tools involve AI processing... The AI-powered tools include `parse_prd`, `analyze_project_complexity`, `update_subtask`, `update_task`, `update`, `expand_all`, `expand_task`, and `add_task`.
|
||||
|
||||
---
|
||||
|
||||
@@ -24,34 +23,64 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **Key CLI Options:**
|
||||
* `--name <name>`: `Set the name for your project in Taskmaster's configuration.`
|
||||
* `--description <text>`: `Provide a brief description for your project.`
|
||||
* `--version <version>`: `Set the initial version for your project (e.g., '0.1.0').`
|
||||
* `--version <version>`: `Set the initial version for your project, e.g., '0.1.0'.`
|
||||
* `-y, --yes`: `Initialize Taskmaster quickly using default settings without interactive prompts.`
|
||||
* **Usage:** Run this once at the beginning of a new project.
|
||||
* **MCP Variant Description:** `Set up the basic Taskmaster file structure and configuration in the current directory for a new project by running the 'task-master init' command.`
|
||||
* **Key MCP Parameters/Options:**
|
||||
* `projectName`: `Set the name for your project.` (CLI: `--name <name>`)
|
||||
* `projectDescription`: `Provide a brief description for your project.` (CLI: `--description <text>`)
|
||||
* `projectVersion`: `Set the initial version for your project (e.g., '0.1.0').` (CLI: `--version <version>`)
|
||||
* `projectVersion`: `Set the initial version for your project, e.g., '0.1.0'.` (CLI: `--version <version>`)
|
||||
* `authorName`: `Author name.` (CLI: `--author <author>`)
|
||||
* `skipInstall`: `Skip installing dependencies (default: false).` (CLI: `--skip-install`)
|
||||
* `addAliases`: `Add shell aliases (tm, taskmaster) (default: false).` (CLI: `--aliases`)
|
||||
* `yes`: `Skip prompts and use defaults/provided arguments (default: false).` (CLI: `-y, --yes`)
|
||||
* **Usage:** Run this once at the beginning of a new project, typically via an integrated tool like Cursor. Operates on the current working directory of the MCP server.
|
||||
|
||||
* `skipInstall`: `Skip installing dependencies. Default is false.` (CLI: `--skip-install`)
|
||||
* `addAliases`: `Add shell aliases tm and taskmaster. Default is false.` (CLI: `--aliases`)
|
||||
* `yes`: `Skip prompts and use defaults/provided arguments. Default is false.` (CLI: `-y, --yes`)
|
||||
* **Usage:** Run this once at the beginning of a new project, typically via an integrated tool like Cursor. Operates on the current working directory of the MCP server.
|
||||
* **Important:** Once complete, you *MUST* parse a prd in order to generate tasks. There will be no tasks files until then. The next step after initializing should be to create a PRD using the example PRD in .taskmaster/templates/example_prd.txt.
|
||||
|
||||
### 2. Parse PRD (`parse_prd`)
|
||||
|
||||
* **MCP Tool:** `parse_prd`
|
||||
* **CLI Command:** `task-master parse-prd [file] [options]`
|
||||
* **Description:** `Parse a Product Requirements Document (PRD) or text file with Taskmaster to automatically generate an initial set of tasks in tasks.json.`
|
||||
* **Description:** `Parse a Product Requirements Document, PRD, or text file with Taskmaster to automatically generate an initial set of tasks in tasks.json.`
|
||||
* **Key Parameters/Options:**
|
||||
* `input`: `Path to your PRD or requirements text file that Taskmaster should parse for tasks.` (CLI: `[file]` positional or `-i, --input <file>`)
|
||||
* `output`: `Specify where Taskmaster should save the generated 'tasks.json' file (default: 'tasks/tasks.json').` (CLI: `-o, --output <file>`)
|
||||
* `output`: `Specify where Taskmaster should save the generated 'tasks.json' file. Defaults to '.taskmaster/tasks/tasks.json'.` (CLI: `-o, --output <file>`)
|
||||
* `numTasks`: `Approximate number of top-level tasks Taskmaster should aim to generate from the document.` (CLI: `-n, --num-tasks <number>`)
|
||||
* `force`: `Use this to allow Taskmaster to overwrite an existing 'tasks.json' without asking for confirmation.` (CLI: `-f, --force`)
|
||||
* **Usage:** Useful for bootstrapping a project from an existing requirements document.
|
||||
* **Notes:** Task Master will strictly adhere to any specific requirements mentioned in the PRD (libraries, database schemas, frameworks, tech stacks, etc.) while filling in any gaps where the PRD isn't fully specified. Tasks are designed to provide the most direct implementation path while avoiding over-engineering.
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
* **Notes:** Task Master will strictly adhere to any specific requirements mentioned in the PRD, such as libraries, database schemas, frameworks, tech stacks, etc., while filling in any gaps where the PRD isn't fully specified. Tasks are designed to provide the most direct implementation path while avoiding over-engineering.
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress. If the user does not have a PRD, suggest discussing their idea and then use the example PRD in `.taskmaster/templates/example_prd.txt` as a template for creating the PRD based on their idea, for use with `parse-prd`.
|
||||
|
||||
---
|
||||
|
||||
## AI Model Configuration
|
||||
|
||||
### 2. Manage Models (`models`)
|
||||
* **MCP Tool:** `models`
|
||||
* **CLI Command:** `task-master models [options]`
|
||||
* **Description:** `View the current AI model configuration or set specific models for different roles (main, research, fallback). Allows setting custom model IDs for Ollama and OpenRouter.`
|
||||
* **Key MCP Parameters/Options:**
|
||||
* `setMain <model_id>`: `Set the primary model ID for task generation/updates.` (CLI: `--set-main <model_id>`)
|
||||
* `setResearch <model_id>`: `Set the model ID for research-backed operations.` (CLI: `--set-research <model_id>`)
|
||||
* `setFallback <model_id>`: `Set the model ID to use if the primary fails.` (CLI: `--set-fallback <model_id>`)
|
||||
* `ollama <boolean>`: `Indicates the set model ID is a custom Ollama model.` (CLI: `--ollama`)
|
||||
* `openrouter <boolean>`: `Indicates the set model ID is a custom OpenRouter model.` (CLI: `--openrouter`)
|
||||
* `listAvailableModels <boolean>`: `If true, lists available models not currently assigned to a role.` (CLI: No direct equivalent; CLI lists available automatically)
|
||||
* `projectRoot <string>`: `Optional. Absolute path to the project root directory.` (CLI: Determined automatically)
|
||||
* **Key CLI Options:**
|
||||
* `--set-main <model_id>`: `Set the primary model.`
|
||||
* `--set-research <model_id>`: `Set the research model.`
|
||||
* `--set-fallback <model_id>`: `Set the fallback model.`
|
||||
* `--ollama`: `Specify that the provided model ID is for Ollama (use with --set-*).`
|
||||
* `--openrouter`: `Specify that the provided model ID is for OpenRouter (use with --set-*). Validates against OpenRouter API.`
|
||||
* `--setup`: `Run interactive setup to configure models, including custom Ollama/OpenRouter IDs.`
|
||||
* **Usage (MCP):** Call without set flags to get current config. Use `setMain`, `setResearch`, or `setFallback` with a valid model ID to update the configuration. Use `listAvailableModels: true` to get a list of unassigned models. To set a custom model, provide the model ID and set `ollama: true` or `openrouter: true`.
|
||||
* **Usage (CLI):** Run without flags to view current configuration and available models. Use set flags to update specific roles. Use `--setup` for guided configuration, including custom models. To set a custom model via flags, use `--set-<role>=<model_id>` along with either `--ollama` or `--openrouter`.
|
||||
* **Notes:** Configuration is stored in `.taskmaster/config.json` in the project root. This command/tool modifies that file. Use `listAvailableModels` or `task-master models` to see internally supported models. OpenRouter custom models are validated against their live API. Ollama custom models are not validated live.
|
||||
* **API note:** API keys for selected AI providers (based on their model) need to exist in the mcp.json file to be accessible in MCP context. The API keys must be present in the local .env file for the CLI to be able to read them.
|
||||
* **Model costs:** The costs in supported models are expressed in dollars. An input/output value of 3 is $3.00. A value of 0.8 is $0.80.
|
||||
* **Warning:** DO NOT MANUALLY EDIT THE .taskmaster/config.json FILE. Use the included commands either in the MCP or CLI format as needed. Always prioritize MCP tools when available and use the CLI as a fallback.
|
||||
|
||||
---
|
||||
|
||||
@@ -63,9 +92,9 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master list [options]`
|
||||
* **Description:** `List your Taskmaster tasks, optionally filtering by status and showing subtasks.`
|
||||
* **Key Parameters/Options:**
|
||||
* `status`: `Show only Taskmaster tasks matching this status (e.g., 'pending', 'done').` (CLI: `-s, --status <status>`)
|
||||
* `status`: `Show only Taskmaster tasks matching this status, e.g., 'pending' or 'done'.` (CLI: `-s, --status <status>`)
|
||||
* `withSubtasks`: `Include subtasks indented under their parent tasks in the list.` (CLI: `--with-subtasks`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Get an overview of the project status, often used at the start of a work session.
|
||||
|
||||
### 4. Get Next Task (`next_task`)
|
||||
@@ -74,7 +103,7 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master next [options]`
|
||||
* **Description:** `Ask Taskmaster to show the next available task you can work on, based on status and completed dependencies.`
|
||||
* **Key Parameters/Options:**
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Identify what to work on next according to the plan.
|
||||
|
||||
### 5. Get Task Details (`get_task`)
|
||||
@@ -83,8 +112,8 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master show [id] [options]`
|
||||
* **Description:** `Display detailed information for a specific Taskmaster task or subtask by its ID.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The ID of the Taskmaster task (e.g., '15') or subtask (e.g., '15.2') you want to view.` (CLI: `[id]` positional or `-i, --id <id>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `id`: `Required. The ID of the Taskmaster task, e.g., '15', or subtask, e.g., '15.2', you want to view.` (CLI: `[id]` positional or `-i, --id <id>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Understand the full details, implementation notes, and test strategy for a specific task before starting work.
|
||||
|
||||
---
|
||||
@@ -97,10 +126,11 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master add-task [options]`
|
||||
* **Description:** `Add a new task to Taskmaster by describing it; AI will structure it.`
|
||||
* **Key Parameters/Options:**
|
||||
* `prompt`: `Required. Describe the new task you want Taskmaster to create (e.g., "Implement user authentication using JWT").` (CLI: `-p, --prompt <text>`)
|
||||
* `dependencies`: `Specify the IDs of any Taskmaster tasks that must be completed before this new one can start (e.g., '12,14').` (CLI: `-d, --dependencies <ids>`)
|
||||
* `priority`: `Set the priority for the new task ('high', 'medium', 'low'; default: 'medium').` (CLI: `--priority <priority>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `prompt`: `Required. Describe the new task you want Taskmaster to create, e.g., "Implement user authentication using JWT".` (CLI: `-p, --prompt <text>`)
|
||||
* `dependencies`: `Specify the IDs of any Taskmaster tasks that must be completed before this new one can start, e.g., '12,14'.` (CLI: `-d, --dependencies <ids>`)
|
||||
* `priority`: `Set the priority for the new task: 'high', 'medium', or 'low'. Default is 'medium'.` (CLI: `--priority <priority>`)
|
||||
* `research`: `Enable Taskmaster to use the research role for potentially more informed task creation.` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Quickly add newly identified tasks during development.
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
@@ -112,13 +142,13 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **Key Parameters/Options:**
|
||||
* `id` / `parent`: `Required. The ID of the Taskmaster task that will be the parent.` (MCP: `id`, CLI: `-p, --parent <id>`)
|
||||
* `taskId`: `Use this if you want to convert an existing top-level Taskmaster task into a subtask of the specified parent.` (CLI: `-i, --task-id <id>`)
|
||||
* `title`: `Required (if not using taskId). The title for the new subtask Taskmaster should create.` (CLI: `-t, --title <title>`)
|
||||
* `title`: `Required if not using taskId. The title for the new subtask Taskmaster should create.` (CLI: `-t, --title <title>`)
|
||||
* `description`: `A brief description for the new subtask.` (CLI: `-d, --description <text>`)
|
||||
* `details`: `Provide implementation notes or details for the new subtask.` (CLI: `--details <text>`)
|
||||
* `dependencies`: `Specify IDs of other tasks or subtasks (e.g., '15', '16.1') that must be done before this new subtask.` (CLI: `--dependencies <ids>`)
|
||||
* `status`: `Set the initial status for the new subtask (default: 'pending').` (CLI: `-s, --status <status>`)
|
||||
* `dependencies`: `Specify IDs of other tasks or subtasks, e.g., '15' or '16.1', that must be done before this new subtask.` (CLI: `--dependencies <ids>`)
|
||||
* `status`: `Set the initial status for the new subtask. Default is 'pending'.` (CLI: `-s, --status <status>`)
|
||||
* `skipGenerate`: `Prevent Taskmaster from automatically regenerating markdown task files after adding the subtask.` (CLI: `--skip-generate`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Break down tasks manually or reorganize existing tasks.
|
||||
|
||||
### 8. Update Tasks (`update`)
|
||||
@@ -127,10 +157,10 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master update [options]`
|
||||
* **Description:** `Update multiple upcoming tasks in Taskmaster based on new context or changes, starting from a specific task ID.`
|
||||
* **Key Parameters/Options:**
|
||||
* `from`: `Required. The ID of the first task Taskmaster should update. All tasks with this ID or higher (and not 'done') will be considered.` (CLI: `--from <id>`)
|
||||
* `prompt`: `Required. Explain the change or new context for Taskmaster to apply to the tasks (e.g., "We are now using React Query instead of Redux Toolkit for data fetching").` (CLI: `-p, --prompt <text>`)
|
||||
* `research`: `Enable Taskmaster to use Perplexity AI for more informed updates based on external knowledge (requires PERPLEXITY_API_KEY).` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `from`: `Required. The ID of the first task Taskmaster should update. All tasks with this ID or higher that are not 'done' will be considered.` (CLI: `--from <id>`)
|
||||
* `prompt`: `Required. Explain the change or new context for Taskmaster to apply to the tasks, e.g., "We are now using React Query instead of Redux Toolkit for data fetching".` (CLI: `-p, --prompt <text>`)
|
||||
* `research`: `Enable Taskmaster to use the research role for more informed updates. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Handle significant implementation changes or pivots that affect multiple future tasks. Example CLI: `task-master update --from='18' --prompt='Switching to React Query.\nNeed to refactor data fetching...'`
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
@@ -138,12 +168,12 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
|
||||
* **MCP Tool:** `update_task`
|
||||
* **CLI Command:** `task-master update-task [options]`
|
||||
* **Description:** `Modify a specific Taskmaster task (or subtask) by its ID, incorporating new information or changes.`
|
||||
* **Description:** `Modify a specific Taskmaster task or subtask by its ID, incorporating new information or changes.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The specific ID of the Taskmaster task (e.g., '15') or subtask (e.g., '15.2') you want to update.` (CLI: `-i, --id <id>`)
|
||||
* `id`: `Required. The specific ID of the Taskmaster task, e.g., '15', or subtask, e.g., '15.2', you want to update.` (CLI: `-i, --id <id>`)
|
||||
* `prompt`: `Required. Explain the specific changes or provide the new information Taskmaster should incorporate into this task.` (CLI: `-p, --prompt <text>`)
|
||||
* `research`: `Enable Taskmaster to use Perplexity AI for more informed updates (requires PERPLEXITY_API_KEY).` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `research`: `Enable Taskmaster to use the research role for more informed updates. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Refine a specific task based on new understanding or feedback. Example CLI: `task-master update-task --id='15' --prompt='Clarification: Use PostgreSQL instead of MySQL.\nUpdate schema details...'`
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
@@ -153,10 +183,10 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master update-subtask [options]`
|
||||
* **Description:** `Append timestamped notes or details to a specific Taskmaster subtask without overwriting existing content. Intended for iterative implementation logging.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The specific ID of the Taskmaster subtask (e.g., '15.2') you want to add information to.` (CLI: `-i, --id <id>`)
|
||||
* `id`: `Required. The specific ID of the Taskmaster subtask, e.g., '15.2', you want to add information to.` (CLI: `-i, --id <id>`)
|
||||
* `prompt`: `Required. Provide the information or notes Taskmaster should append to the subtask's details. Ensure this adds *new* information not already present.` (CLI: `-p, --prompt <text>`)
|
||||
* `research`: `Enable Taskmaster to use Perplexity AI for more informed updates (requires PERPLEXITY_API_KEY).` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `research`: `Enable Taskmaster to use the research role for more informed updates. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Add implementation notes, code snippets, or clarifications to a subtask during development. Before calling, review the subtask's current details to append only fresh insights, helping to build a detailed log of the implementation journey and avoid redundancy. Example CLI: `task-master update-subtask --id='15.2' --prompt='Discovered that the API requires header X.\nImplementation needs adjustment...'`
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
@@ -164,11 +194,11 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
|
||||
* **MCP Tool:** `set_task_status`
|
||||
* **CLI Command:** `task-master set-status [options]`
|
||||
* **Description:** `Update the status of one or more Taskmaster tasks or subtasks (e.g., 'pending', 'in-progress', 'done').`
|
||||
* **Description:** `Update the status of one or more Taskmaster tasks or subtasks, e.g., 'pending', 'in-progress', 'done'.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The ID(s) of the Taskmaster task(s) or subtask(s) (e.g., '15', '15.2', '16,17.1') to update.` (CLI: `-i, --id <id>`)
|
||||
* `status`: `Required. The new status to set (e.g., 'done', 'pending', 'in-progress', 'review', 'cancelled').` (CLI: `-s, --status <status>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `id`: `Required. The ID(s) of the Taskmaster task(s) or subtask(s), e.g., '15', '15.2', or '16,17.1', to update.` (CLI: `-i, --id <id>`)
|
||||
* `status`: `Required. The new status to set, e.g., 'done', 'pending', 'in-progress', 'review', 'cancelled'.` (CLI: `-s, --status <status>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Mark progress as tasks move through the development cycle.
|
||||
|
||||
### 12. Remove Task (`remove_task`)
|
||||
@@ -177,9 +207,9 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master remove-task [options]`
|
||||
* **Description:** `Permanently remove a task or subtask from the Taskmaster tasks list.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The ID of the Taskmaster task (e.g., '5') or subtask (e.g., '5.2') to permanently remove.` (CLI: `-i, --id <id>`)
|
||||
* `id`: `Required. The ID of the Taskmaster task, e.g., '5', or subtask, e.g., '5.2', to permanently remove.` (CLI: `-i, --id <id>`)
|
||||
* `yes`: `Skip the confirmation prompt and immediately delete the task.` (CLI: `-y, --yes`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Permanently delete tasks or subtasks that are no longer needed in the project.
|
||||
* **Notes:** Use with caution as this operation cannot be undone. Consider using 'blocked', 'cancelled', or 'deferred' status instead if you just want to exclude a task from active planning but keep it for reference. The command automatically cleans up dependency references in other tasks.
|
||||
|
||||
@@ -191,28 +221,28 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
|
||||
* **MCP Tool:** `expand_task`
|
||||
* **CLI Command:** `task-master expand [options]`
|
||||
* **Description:** `Use Taskmaster's AI to break down a complex task (or all tasks) into smaller, manageable subtasks.`
|
||||
* **Description:** `Use Taskmaster's AI to break down a complex task into smaller, manageable subtasks. Appends subtasks by default.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `The ID of the specific Taskmaster task you want to break down into subtasks.` (CLI: `-i, --id <id>`)
|
||||
* `num`: `Suggests how many subtasks Taskmaster should aim to create (uses complexity analysis by default).` (CLI: `-n, --num <number>`)
|
||||
* `research`: `Enable Taskmaster to use Perplexity AI for more informed subtask generation (requires PERPLEXITY_API_KEY).` (CLI: `-r, --research`)
|
||||
* `prompt`: `Provide extra context or specific instructions to Taskmaster for generating the subtasks.` (CLI: `-p, --prompt <text>`)
|
||||
* `force`: `Use this to make Taskmaster replace existing subtasks with newly generated ones.` (CLI: `--force`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Generate a detailed implementation plan for a complex task before starting coding.
|
||||
* `num`: `Optional: Suggests how many subtasks Taskmaster should aim to create. Uses complexity analysis/defaults otherwise.` (CLI: `-n, --num <number>`)
|
||||
* `research`: `Enable Taskmaster to use the research role for more informed subtask generation. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||
* `prompt`: `Optional: Provide extra context or specific instructions to Taskmaster for generating the subtasks.` (CLI: `-p, --prompt <text>`)
|
||||
* `force`: `Optional: If true, clear existing subtasks before generating new ones. Default is false (append).` (CLI: `--force`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Generate a detailed implementation plan for a complex task before starting coding. Automatically uses complexity report recommendations if available and `num` is not specified.
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
### 14. Expand All Tasks (`expand_all`)
|
||||
|
||||
* **MCP Tool:** `expand_all`
|
||||
* **CLI Command:** `task-master expand --all [options]` (Note: CLI uses the `expand` command with the `--all` flag)
|
||||
* **Description:** `Tell Taskmaster to automatically expand all 'pending' tasks based on complexity analysis.`
|
||||
* **Description:** `Tell Taskmaster to automatically expand all eligible pending/in-progress tasks based on complexity analysis or defaults. Appends subtasks by default.`
|
||||
* **Key Parameters/Options:**
|
||||
* `num`: `Suggests how many subtasks Taskmaster should aim to create per task.` (CLI: `-n, --num <number>`)
|
||||
* `research`: `Enable Perplexity AI for more informed subtask generation (requires PERPLEXITY_API_KEY).` (CLI: `-r, --research`)
|
||||
* `prompt`: `Provide extra context for Taskmaster to apply generally during expansion.` (CLI: `-p, --prompt <text>`)
|
||||
* `force`: `Make Taskmaster replace existing subtasks.` (CLI: `--force`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `num`: `Optional: Suggests how many subtasks Taskmaster should aim to create per task.` (CLI: `-n, --num <number>`)
|
||||
* `research`: `Enable research role for more informed subtask generation. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||
* `prompt`: `Optional: Provide extra context for Taskmaster to apply generally during expansion.` (CLI: `-p, --prompt <text>`)
|
||||
* `force`: `Optional: If true, clear existing subtasks before generating new ones for each eligible task. Default is false (append).` (CLI: `--force`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Useful after initial task generation or complexity analysis to break down multiple tasks at once.
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
@@ -222,9 +252,9 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master clear-subtasks [options]`
|
||||
* **Description:** `Remove all subtasks from one or more specified Taskmaster parent tasks.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `The ID(s) of the Taskmaster parent task(s) whose subtasks you want to remove (e.g., '15', '16,18').` (Required unless using `all`) (CLI: `-i, --id <ids>`)
|
||||
* `id`: `The ID(s) of the Taskmaster parent task(s) whose subtasks you want to remove, e.g., '15' or '16,18'. Required unless using `all`.) (CLI: `-i, --id <ids>`)
|
||||
* `all`: `Tell Taskmaster to remove subtasks from all parent tasks.` (CLI: `--all`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Used before regenerating subtasks with `expand_task` if the previous breakdown needs replacement.
|
||||
|
||||
### 16. Remove Subtask (`remove_subtask`)
|
||||
@@ -233,28 +263,53 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **CLI Command:** `task-master remove-subtask [options]`
|
||||
* **Description:** `Remove a subtask from its Taskmaster parent, optionally converting it into a standalone task.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The ID(s) of the Taskmaster subtask(s) to remove (e.g., '15.2', '16.1,16.3').` (CLI: `-i, --id <id>`)
|
||||
* `id`: `Required. The ID(s) of the Taskmaster subtask(s) to remove, e.g., '15.2' or '16.1,16.3'.` (CLI: `-i, --id <id>`)
|
||||
* `convert`: `If used, Taskmaster will turn the subtask into a regular top-level task instead of deleting it.` (CLI: `-c, --convert`)
|
||||
* `skipGenerate`: `Prevent Taskmaster from automatically regenerating markdown task files after removing the subtask.` (CLI: `--skip-generate`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Delete unnecessary subtasks or promote a subtask to a top-level task.
|
||||
|
||||
### 17. Move Task (`move_task`)
|
||||
|
||||
* **MCP Tool:** `move_task`
|
||||
* **CLI Command:** `task-master move [options]`
|
||||
* **Description:** `Move a task or subtask to a new position within the task hierarchy.`
|
||||
* **Key Parameters/Options:**
|
||||
* `from`: `Required. ID of the task/subtask to move (e.g., "5" or "5.2"). Can be comma-separated for multiple tasks.` (CLI: `--from <id>`)
|
||||
* `to`: `Required. ID of the destination (e.g., "7" or "7.3"). Must match the number of source IDs if comma-separated.` (CLI: `--to <id>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Reorganize tasks by moving them within the hierarchy. Supports various scenarios like:
|
||||
* Moving a task to become a subtask
|
||||
* Moving a subtask to become a standalone task
|
||||
* Moving a subtask to a different parent
|
||||
* Reordering subtasks within the same parent
|
||||
* Moving a task to a new, non-existent ID (automatically creates placeholders)
|
||||
* Moving multiple tasks at once with comma-separated IDs
|
||||
* **Validation Features:**
|
||||
* Allows moving tasks to non-existent destination IDs (creates placeholder tasks)
|
||||
* Prevents moving to existing task IDs that already have content (to avoid overwriting)
|
||||
* Validates that source tasks exist before attempting to move them
|
||||
* Maintains proper parent-child relationships
|
||||
* **Example CLI:** `task-master move --from=5.2 --to=7.3` to move subtask 5.2 to become subtask 7.3.
|
||||
* **Example Multi-Move:** `task-master move --from=10,11,12 --to=16,17,18` to move multiple tasks to new positions.
|
||||
* **Common Use:** Resolving merge conflicts in tasks.json when multiple team members create tasks on different branches.
|
||||
|
||||
---
|
||||
|
||||
## Dependency Management
|
||||
|
||||
### 17. Add Dependency (`add_dependency`)
|
||||
### 18. Add Dependency (`add_dependency`)
|
||||
|
||||
* **MCP Tool:** `add_dependency`
|
||||
* **CLI Command:** `task-master add-dependency [options]`
|
||||
* **Description:** `Define a dependency in Taskmaster, making one task a prerequisite for another.`
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The ID of the Taskmaster task that will depend on another.` (CLI: `-i, --id <id>`)
|
||||
* `dependsOn`: `Required. The ID of the Taskmaster task that must be completed first (the prerequisite).` (CLI: `-d, --depends-on <id>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `dependsOn`: `Required. The ID of the Taskmaster task that must be completed first, the prerequisite.` (CLI: `-d, --depends-on <id>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <path>`)
|
||||
* **Usage:** Establish the correct order of execution between tasks.
|
||||
|
||||
### 18. Remove Dependency (`remove_dependency`)
|
||||
### 19. Remove Dependency (`remove_dependency`)
|
||||
|
||||
* **MCP Tool:** `remove_dependency`
|
||||
* **CLI Command:** `task-master remove-dependency [options]`
|
||||
@@ -262,92 +317,91 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
||||
* **Key Parameters/Options:**
|
||||
* `id`: `Required. The ID of the Taskmaster task you want to remove a prerequisite from.` (CLI: `-i, --id <id>`)
|
||||
* `dependsOn`: `Required. The ID of the Taskmaster task that should no longer be a prerequisite.` (CLI: `-d, --depends-on <id>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Update task relationships when the order of execution changes.
|
||||
|
||||
### 19. Validate Dependencies (`validate_dependencies`)
|
||||
### 20. Validate Dependencies (`validate_dependencies`)
|
||||
|
||||
* **MCP Tool:** `validate_dependencies`
|
||||
* **CLI Command:** `task-master validate-dependencies [options]`
|
||||
* **Description:** `Check your Taskmaster tasks for dependency issues (like circular references or links to non-existent tasks) without making changes.`
|
||||
* **Key Parameters/Options:**
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Audit the integrity of your task dependencies.
|
||||
|
||||
### 20. Fix Dependencies (`fix_dependencies`)
|
||||
### 21. Fix Dependencies (`fix_dependencies`)
|
||||
|
||||
* **MCP Tool:** `fix_dependencies`
|
||||
* **CLI Command:** `task-master fix-dependencies [options]`
|
||||
* **Description:** `Automatically fix dependency issues (like circular references or links to non-existent tasks) in your Taskmaster tasks.`
|
||||
* **Key Parameters/Options:**
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Clean up dependency errors automatically.
|
||||
|
||||
---
|
||||
|
||||
## Analysis & Reporting
|
||||
|
||||
### 21. Analyze Project Complexity (`analyze_project_complexity`)
|
||||
### 22. Analyze Project Complexity (`analyze_project_complexity`)
|
||||
|
||||
* **MCP Tool:** `analyze_project_complexity`
|
||||
* **CLI Command:** `task-master analyze-complexity [options]`
|
||||
* **Description:** `Have Taskmaster analyze your tasks to determine their complexity and suggest which ones need to be broken down further.`
|
||||
* **Key Parameters/Options:**
|
||||
* `output`: `Where to save the complexity analysis report (default: 'scripts/task-complexity-report.json').` (CLI: `-o, --output <file>`)
|
||||
* `output`: `Where to save the complexity analysis report (default: '.taskmaster/reports/task-complexity-report.json').` (CLI: `-o, --output <file>`)
|
||||
* `threshold`: `The minimum complexity score (1-10) that should trigger a recommendation to expand a task.` (CLI: `-t, --threshold <number>`)
|
||||
* `research`: `Enable Perplexity AI for more accurate complexity analysis (requires PERPLEXITY_API_KEY).` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `research`: `Enable research role for more accurate complexity analysis. Requires appropriate API key.` (CLI: `-r, --research`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Used before breaking down tasks to identify which ones need the most attention.
|
||||
* **Important:** This MCP tool makes AI calls and can take up to a minute to complete. Please inform users to hang tight while the operation is in progress.
|
||||
|
||||
### 22. View Complexity Report (`complexity_report`)
|
||||
### 23. View Complexity Report (`complexity_report`)
|
||||
|
||||
* **MCP Tool:** `complexity_report`
|
||||
* **CLI Command:** `task-master complexity-report [options]`
|
||||
* **Description:** `Display the task complexity analysis report in a readable format.`
|
||||
* **Key Parameters/Options:**
|
||||
* `file`: `Path to the complexity report (default: 'scripts/task-complexity-report.json').` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to the complexity report (default: '.taskmaster/reports/task-complexity-report.json').` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Review and understand the complexity analysis results after running analyze-complexity.
|
||||
|
||||
---
|
||||
|
||||
## File Management
|
||||
|
||||
### 23. Generate Task Files (`generate`)
|
||||
### 24. Generate Task Files (`generate`)
|
||||
|
||||
* **MCP Tool:** `generate`
|
||||
* **CLI Command:** `task-master generate [options]`
|
||||
* **Description:** `Create or update individual Markdown files for each task based on your tasks.json.`
|
||||
* **Key Parameters/Options:**
|
||||
* `output`: `The directory where Taskmaster should save the task files (default: in a 'tasks' directory).` (CLI: `-o, --output <directory>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file (default relies on auto-detection).` (CLI: `-f, --file <file>`)
|
||||
* `file`: `Path to your Taskmaster 'tasks.json' file. Default relies on auto-detection.` (CLI: `-f, --file <file>`)
|
||||
* **Usage:** Run this after making changes to tasks.json to keep individual task files up to date.
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables Configuration
|
||||
## Environment Variables Configuration (Updated)
|
||||
|
||||
Taskmaster's behavior can be customized via environment variables. These affect both CLI and MCP server operation:
|
||||
Taskmaster primarily uses the **`.taskmaster/config.json`** file (in project root) for configuration (models, parameters, logging level, etc.), managed via `task-master models --setup`.
|
||||
|
||||
* **ANTHROPIC_API_KEY** (Required): Your Anthropic API key for Claude.
|
||||
* **MODEL**: Claude model to use (default: `claude-3-opus-20240229`).
|
||||
* **MAX_TOKENS**: Maximum tokens for AI responses (default: 8192).
|
||||
* **TEMPERATURE**: Temperature for AI model responses (default: 0.7).
|
||||
* **DEBUG**: Enable debug logging (`true`/`false`, default: `false`).
|
||||
* **LOG_LEVEL**: Console output level (`debug`, `info`, `warn`, `error`, default: `info`).
|
||||
* **DEFAULT_SUBTASKS**: Default number of subtasks for `expand` (default: 5).
|
||||
* **DEFAULT_PRIORITY**: Default priority for new tasks (default: `medium`).
|
||||
* **PROJECT_NAME**: Project name used in metadata.
|
||||
* **PROJECT_VERSION**: Project version used in metadata.
|
||||
* **PERPLEXITY_API_KEY**: API key for Perplexity AI (for `--research` flags).
|
||||
* **PERPLEXITY_MODEL**: Perplexity model to use (default: `sonar-medium-online`).
|
||||
Environment variables are used **only** for sensitive API keys related to AI providers and specific overrides like the Ollama base URL:
|
||||
|
||||
Set these in your `.env` file in the project root or in your environment before running Taskmaster.
|
||||
* **API Keys (Required for corresponding provider):**
|
||||
* `ANTHROPIC_API_KEY`
|
||||
* `PERPLEXITY_API_KEY`
|
||||
* `OPENAI_API_KEY`
|
||||
* `GOOGLE_API_KEY`
|
||||
* `MISTRAL_API_KEY`
|
||||
* `AZURE_OPENAI_API_KEY` (Requires `AZURE_OPENAI_ENDPOINT` too)
|
||||
* `OPENROUTER_API_KEY`
|
||||
* `XAI_API_KEY`
|
||||
* `OLLAMA_API_KEY` (Requires `OLLAMA_BASE_URL` too)
|
||||
* **Endpoints (Optional/Provider Specific inside .taskmaster/config.json):**
|
||||
* `AZURE_OPENAI_ENDPOINT`
|
||||
* `OLLAMA_BASE_URL` (Default: `http://localhost:11434/api`)
|
||||
|
||||
**Set API keys** in your **`.env`** file in the project root (for CLI use) or within the `env` section of your **`.cursor/mcp.json`** file (for MCP/Cursor integration). All other settings (model choice, max tokens, temperature, log level, custom endpoints) are managed in `.taskmaster/config.json` via `task-master models` command or `models` MCP tool.
|
||||
|
||||
---
|
||||
|
||||
For implementation details:
|
||||
* CLI commands: See [`commands.mdc`](mdc:.cursor/rules/commands.mdc)
|
||||
* MCP server: See [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)
|
||||
* Task structure: See [`tasks.mdc`](mdc:.cursor/rules/tasks.mdc)
|
||||
* Workflow: See [`dev_workflow.mdc`](mdc:.cursor/rules/dev_workflow.mdc)
|
||||
For details on how these commands fit into the development process, see the [Development Workflow Guide](mdc:.cursor/rules/dev_workflow.mdc).
|
||||
|
||||
228
.cursor/rules/telemetry.mdc
Normal file
228
.cursor/rules/telemetry.mdc
Normal file
@@ -0,0 +1,228 @@
|
||||
---
|
||||
description: Guidelines for integrating AI usage telemetry across Task Master.
|
||||
globs: scripts/modules/**/*.js,mcp-server/src/**/*.js
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# AI Usage Telemetry Integration
|
||||
|
||||
This document outlines the standard pattern for capturing, propagating, and handling AI usage telemetry data (cost, tokens, model, etc.) across the Task Master stack. This ensures consistent telemetry for both CLI and MCP interactions.
|
||||
|
||||
## Overview
|
||||
|
||||
Telemetry data is generated within the unified AI service layer ([`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js)) and then passed upwards through the calling functions.
|
||||
|
||||
- **Data Source**: [`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js) (specifically its `generateTextService`, `generateObjectService`, etc.) returns an object like `{ mainResult: AI_CALL_OUTPUT, telemetryData: TELEMETRY_OBJECT }`.
|
||||
- **`telemetryData` Object Structure**:
|
||||
```json
|
||||
{
|
||||
"timestamp": "ISO_STRING_DATE",
|
||||
"userId": "USER_ID_FROM_CONFIG",
|
||||
"commandName": "invoking_command_or_tool_name",
|
||||
"modelUsed": "ai_model_id",
|
||||
"providerName": "ai_provider_name",
|
||||
"inputTokens": NUMBER,
|
||||
"outputTokens": NUMBER,
|
||||
"totalTokens": NUMBER,
|
||||
"totalCost": NUMBER, // e.g., 0.012414
|
||||
"currency": "USD" // e.g., "USD"
|
||||
}
|
||||
```
|
||||
|
||||
## Integration Pattern by Layer
|
||||
|
||||
The key principle is that each layer receives telemetry data from the layer below it (if applicable) and passes it to the layer above it, or handles it for display in the case of the CLI.
|
||||
|
||||
### 1. Core Logic Functions (e.g., in `scripts/modules/task-manager/`)
|
||||
|
||||
Functions in this layer that invoke AI services are responsible for handling the `telemetryData` they receive from [`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js).
|
||||
|
||||
- **Actions**:
|
||||
1. Call the appropriate AI service function (e.g., `generateObjectService`).
|
||||
- Pass `commandName` (e.g., `add-task`, `expand-task`) and `outputType` (e.g., `cli` or `mcp`) in the `params` object to the AI service. The `outputType` can be derived from context (e.g., presence of `mcpLog`).
|
||||
2. The AI service returns an object, e.g., `aiServiceResponse = { mainResult: {/*AI output*/}, telemetryData: {/*telemetry data*/} }`.
|
||||
3. Extract `aiServiceResponse.mainResult` for the core processing.
|
||||
4. **Must return an object that includes `aiServiceResponse.telemetryData`**.
|
||||
Example: `return { operationSpecificData: /*...*/, telemetryData: aiServiceResponse.telemetryData };`
|
||||
|
||||
- **CLI Output Handling (If Applicable)**:
|
||||
- If the core function also handles CLI output (e.g., it has an `outputFormat` parameter that can be `'text'` or `'cli'`):
|
||||
1. Check if `outputFormat === 'text'` (or `'cli'`).
|
||||
2. If so, and if `aiServiceResponse.telemetryData` is available, call `displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli')` from [`scripts/modules/ui.js`](mdc:scripts/modules/ui.js).
|
||||
- This ensures telemetry is displayed directly to CLI users after the main command output.
|
||||
|
||||
- **Example Snippet (Core Logic in `scripts/modules/task-manager/someAiAction.js`)**:
|
||||
```javascript
|
||||
import { generateObjectService } from '../ai-services-unified.js';
|
||||
import { displayAiUsageSummary } from '../ui.js';
|
||||
|
||||
async function performAiRelatedAction(params, context, outputFormat = 'text') {
|
||||
const { commandNameFromContext, /* other context vars */ } = context;
|
||||
let aiServiceResponse = null;
|
||||
|
||||
try {
|
||||
aiServiceResponse = await generateObjectService({
|
||||
// ... other parameters for AI service ...
|
||||
commandName: commandNameFromContext || 'default-action-name',
|
||||
outputType: context.mcpLog ? 'mcp' : 'cli' // Derive outputType
|
||||
});
|
||||
|
||||
const usefulAiOutput = aiServiceResponse.mainResult.object;
|
||||
// ... do work with usefulAiOutput ...
|
||||
|
||||
if (outputFormat === 'text' && aiServiceResponse.telemetryData) {
|
||||
displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli');
|
||||
}
|
||||
|
||||
return {
|
||||
actionData: /* results of processing */,
|
||||
telemetryData: aiServiceResponse.telemetryData
|
||||
};
|
||||
} catch (error) {
|
||||
// ... handle error ...
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Direct Function Wrappers (in `mcp-server/src/core/direct-functions/`)
|
||||
|
||||
These functions adapt core logic for the MCP server, ensuring structured responses.
|
||||
|
||||
- **Actions**:
|
||||
1. Call the corresponding core logic function.
|
||||
- Pass necessary context (e.g., `session`, `mcpLog`, `projectRoot`).
|
||||
- Provide the `commandName` (typically derived from the MCP tool name) and `outputType: 'mcp'` in the context object passed to the core function.
|
||||
- If the core function supports an `outputFormat` parameter, pass `'json'` to suppress CLI-specific UI.
|
||||
2. The core logic function returns an object (e.g., `coreResult = { actionData: ..., telemetryData: ... }`).
|
||||
3. Include `coreResult.telemetryData` as a field within the `data` object of the successful response returned by the direct function.
|
||||
|
||||
- **Example Snippet (Direct Function `someAiActionDirect.js`)**:
|
||||
```javascript
|
||||
import { performAiRelatedAction } from '../../../../scripts/modules/task-manager/someAiAction.js'; // Core function
|
||||
import { createLogWrapper } from '../../tools/utils.js'; // MCP Log wrapper
|
||||
|
||||
export async function someAiActionDirect(args, log, context = {}) {
|
||||
const { session } = context;
|
||||
// ... prepare arguments for core function from args, including args.projectRoot ...
|
||||
|
||||
try {
|
||||
const coreResult = await performAiRelatedAction(
|
||||
{ /* parameters for core function */ },
|
||||
{ // Context for core function
|
||||
session,
|
||||
mcpLog: createLogWrapper(log),
|
||||
projectRoot: args.projectRoot,
|
||||
commandNameFromContext: 'mcp_tool_some_ai_action', // Example command name
|
||||
outputType: 'mcp'
|
||||
},
|
||||
'json' // Request 'json' output format from core function
|
||||
);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
operationSpecificData: coreResult.actionData,
|
||||
telemetryData: coreResult.telemetryData // Pass telemetry through
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
// ... error handling, return { success: false, error: ... } ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. MCP Tools (in `mcp-server/src/tools/`)
|
||||
|
||||
These are the exposed endpoints for MCP clients.
|
||||
|
||||
- **Actions**:
|
||||
1. Call the corresponding direct function wrapper.
|
||||
2. The direct function returns an object structured like `{ success: true, data: { operationSpecificData: ..., telemetryData: ... } }` (or an error object).
|
||||
3. Pass this entire result object to `handleApiResult(result, log)` from [`mcp-server/src/tools/utils.js`](mdc:mcp-server/src/tools/utils.js).
|
||||
4. `handleApiResult` ensures that the `data` field from the direct function's response (which correctly includes `telemetryData`) is part of the final MCP response.
|
||||
|
||||
- **Example Snippet (MCP Tool `some_ai_action.js`)**:
|
||||
```javascript
|
||||
import { someAiActionDirect } from '../core/task-master-core.js';
|
||||
import { handleApiResult, withNormalizedProjectRoot } from './utils.js';
|
||||
// ... zod for parameters ...
|
||||
|
||||
export function registerSomeAiActionTool(server) {
|
||||
server.addTool({
|
||||
name: "some_ai_action",
|
||||
// ... description, parameters ...
|
||||
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||
try {
|
||||
const resultFromDirectFunction = await someAiActionDirect(
|
||||
{ /* args including projectRoot */ },
|
||||
log,
|
||||
{ session }
|
||||
);
|
||||
return handleApiResult(resultFromDirectFunction, log); // This passes the nested telemetryData through
|
||||
} catch (error) {
|
||||
// ... error handling ...
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### 4. CLI Commands (`scripts/modules/commands.js`)
|
||||
|
||||
These define the command-line interface.
|
||||
|
||||
- **Actions**:
|
||||
1. Call the appropriate core logic function.
|
||||
2. Pass `outputFormat: 'text'` (or ensure the core function defaults to text-based output for CLI).
|
||||
3. The core logic function (as per Section 1) is responsible for calling `displayAiUsageSummary` if telemetry data is available and it's in CLI mode.
|
||||
4. The command action itself **should not** call `displayAiUsageSummary` if the core logic function already handles this. This avoids duplicate display.
|
||||
|
||||
- **Example Snippet (CLI Command in `commands.js`)**:
|
||||
```javascript
|
||||
// In scripts/modules/commands.js
|
||||
import { performAiRelatedAction } from './task-manager/someAiAction.js'; // Core function
|
||||
|
||||
programInstance
|
||||
.command('some-cli-ai-action')
|
||||
// ... .option() ...
|
||||
.action(async (options) => {
|
||||
try {
|
||||
const projectRoot = findProjectRoot() || '.'; // Example root finding
|
||||
// ... prepare parameters for core function from command options ...
|
||||
await performAiRelatedAction(
|
||||
{ /* parameters for core function */ },
|
||||
{ // Context for core function
|
||||
projectRoot,
|
||||
commandNameFromContext: 'some-cli-ai-action',
|
||||
outputType: 'cli'
|
||||
},
|
||||
'text' // Explicitly request text output format for CLI
|
||||
);
|
||||
// Core function handles displayAiUsageSummary internally for 'text' outputFormat
|
||||
} catch (error) {
|
||||
// ... error handling ...
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Summary Flow
|
||||
|
||||
The telemetry data flows as follows:
|
||||
|
||||
1. **[`ai-services-unified.js`](mdc:scripts/modules/ai-services-unified.js)**: Generates `telemetryData` and returns `{ mainResult, telemetryData }`.
|
||||
2. **Core Logic Function**:
|
||||
* Receives `{ mainResult, telemetryData }`.
|
||||
* Uses `mainResult`.
|
||||
* If CLI (`outputFormat: 'text'`), calls `displayAiUsageSummary(telemetryData)`.
|
||||
* Returns `{ operationSpecificData, telemetryData }`.
|
||||
3. **Direct Function Wrapper**:
|
||||
* Receives `{ operationSpecificData, telemetryData }` from core logic.
|
||||
* Returns `{ success: true, data: { operationSpecificData, telemetryData } }`.
|
||||
4. **MCP Tool**:
|
||||
* Receives direct function response.
|
||||
* `handleApiResult` ensures the final MCP response to the client is `{ success: true, data: { operationSpecificData, telemetryData } }`.
|
||||
5. **CLI Command**:
|
||||
* Calls core logic with `outputFormat: 'text'`. Display is handled by core logic.
|
||||
|
||||
This pattern ensures telemetry is captured and appropriately handled/exposed across all interaction modes.
|
||||
@@ -5,6 +5,8 @@ globs: "**/*.test.js,tests/**/*"
|
||||
|
||||
# Testing Guidelines for Task Master CLI
|
||||
|
||||
*Note:* Never use asynchronous operations in tests. Always mock tests properly based on the way the tested functions are defined and used. Do not arbitrarily create tests. Based them on the low-level details and execution of the underlying code being tested.
|
||||
|
||||
## Test Organization Structure
|
||||
|
||||
- **Unit Tests** (See [`architecture.mdc`](mdc:.cursor/rules/architecture.mdc) for module breakdown)
|
||||
@@ -88,6 +90,122 @@ describe('Feature or Function Name', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## Commander.js Command Testing Best Practices
|
||||
|
||||
When testing CLI commands built with Commander.js, several special considerations must be made to avoid common pitfalls:
|
||||
|
||||
- **Direct Action Handler Testing**
|
||||
- ✅ **DO**: Test the command action handlers directly rather than trying to mock the entire Commander.js chain
|
||||
- ✅ **DO**: Create simplified test-specific implementations of command handlers that match the original behavior
|
||||
- ✅ **DO**: Explicitly handle all options, including defaults and shorthand flags (e.g., `-p` for `--prompt`)
|
||||
- ✅ **DO**: Include null/undefined checks in test implementations for parameters that might be optional
|
||||
- ✅ **DO**: Use fixtures from `tests/fixtures/` for consistent sample data across tests
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Create a simplified test version of the command handler
|
||||
const testAddTaskAction = async (options) => {
|
||||
options = options || {}; // Ensure options aren't undefined
|
||||
|
||||
// Validate parameters
|
||||
const isManualCreation = options.title && options.description;
|
||||
const prompt = options.prompt || options.p; // Handle shorthand flags
|
||||
|
||||
if (!prompt && !isManualCreation) {
|
||||
throw new Error('Expected error message');
|
||||
}
|
||||
|
||||
// Call the mocked task manager
|
||||
return mockTaskManager.addTask(/* parameters */);
|
||||
};
|
||||
|
||||
test('should handle required parameters correctly', async () => {
|
||||
// Call the test implementation directly
|
||||
await expect(async () => {
|
||||
await testAddTaskAction({ file: 'tasks.json' });
|
||||
}).rejects.toThrow('Expected error message');
|
||||
});
|
||||
```
|
||||
|
||||
- **Commander Chain Mocking (If Necessary)**
|
||||
- ✅ **DO**: Mock ALL chainable methods (`option`, `argument`, `action`, `on`, etc.)
|
||||
- ✅ **DO**: Return `this` (or the mock object) from all chainable method mocks
|
||||
- ✅ **DO**: Remember to mock not only the initial object but also all objects returned by methods
|
||||
- ✅ **DO**: Implement a mechanism to capture the action handler for direct testing
|
||||
|
||||
```javascript
|
||||
// If you must mock the Commander.js chain:
|
||||
const mockCommand = {
|
||||
command: jest.fn().mockReturnThis(),
|
||||
description: jest.fn().mockReturnThis(),
|
||||
option: jest.fn().mockReturnThis(),
|
||||
argument: jest.fn().mockReturnThis(), // Don't forget this one
|
||||
action: jest.fn(fn => {
|
||||
actionHandler = fn; // Capture the handler for testing
|
||||
return mockCommand;
|
||||
}),
|
||||
on: jest.fn().mockReturnThis() // Don't forget this one
|
||||
};
|
||||
```
|
||||
|
||||
- **Parameter Handling**
|
||||
- ✅ **DO**: Check for both main flag and shorthand flags (e.g., `prompt` and `p`)
|
||||
- ✅ **DO**: Handle parameters like Commander would (comma-separated lists, etc.)
|
||||
- ✅ **DO**: Set proper default values as defined in the command
|
||||
- ✅ **DO**: Validate that required parameters are actually required in tests
|
||||
|
||||
```javascript
|
||||
// Parse dependencies like Commander would
|
||||
const dependencies = options.dependencies
|
||||
? options.dependencies.split(',').map(id => id.trim())
|
||||
: [];
|
||||
```
|
||||
|
||||
- **Environment and Session Handling**
|
||||
- ✅ **DO**: Properly mock session objects when required by functions
|
||||
- ✅ **DO**: Reset environment variables between tests if modified
|
||||
- ✅ **DO**: Use a consistent pattern for environment-dependent tests
|
||||
|
||||
```javascript
|
||||
// Session parameter mock pattern
|
||||
const sessionMock = { session: process.env };
|
||||
|
||||
// In test:
|
||||
expect(mockAddTask).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'Test prompt',
|
||||
[],
|
||||
'medium',
|
||||
sessionMock,
|
||||
false,
|
||||
null,
|
||||
null
|
||||
);
|
||||
```
|
||||
|
||||
- **Common Pitfalls to Avoid**
|
||||
- ❌ **DON'T**: Try to use the real action implementation without proper mocking
|
||||
- ❌ **DON'T**: Mock Commander partially - either mock it completely or test the action directly
|
||||
- ❌ **DON'T**: Forget to handle optional parameters that may be undefined
|
||||
- ❌ **DON'T**: Neglect to test shorthand flag functionality (e.g., `-p`, `-r`)
|
||||
- ❌ **DON'T**: Create circular dependencies in your test mocks
|
||||
- ❌ **DON'T**: Access variables before initialization in your test implementations
|
||||
- ❌ **DON'T**: Include actual command execution in unit tests
|
||||
- ❌ **DON'T**: Overwrite the same file path in multiple tests
|
||||
|
||||
```javascript
|
||||
// ❌ DON'T: Create circular references in mocks
|
||||
const badMock = {
|
||||
method: jest.fn().mockImplementation(() => badMock.method())
|
||||
};
|
||||
|
||||
// ❌ DON'T: Access uninitialized variables
|
||||
const badImplementation = () => {
|
||||
const result = uninitialized;
|
||||
let uninitialized = 'value';
|
||||
return result;
|
||||
};
|
||||
```
|
||||
|
||||
## Jest Module Mocking Best Practices
|
||||
|
||||
- **Mock Hoisting Behavior**
|
||||
@@ -165,107 +283,97 @@ When testing ES modules (`"type": "module"` in package.json), traditional mockin
|
||||
- Imported functions may not use your mocked dependencies even with proper jest.mock() setup
|
||||
- ES module exports are read-only properties (cannot be reassigned during tests)
|
||||
|
||||
- **Mocking Entire Modules**
|
||||
- **Mocking Modules Statically Imported**
|
||||
- For modules imported with standard `import` statements at the top level:
|
||||
- Use `jest.mock('path/to/module', factory)` **before** any imports.
|
||||
- Jest hoists these mocks.
|
||||
- Ensure the factory function returns the mocked structure correctly.
|
||||
|
||||
- **Mocking Dependencies for Dynamically Imported Modules**
|
||||
- **Problem**: Standard `jest.mock()` often fails for dependencies of modules loaded later using dynamic `import('path/to/module')`. The mocks aren't applied correctly when the dynamic import resolves.
|
||||
- **Solution**: Use `jest.unstable_mockModule(modulePath, factory)` **before** the dynamic `import()` call.
|
||||
```javascript
|
||||
// Mock the entire module with custom implementation
|
||||
jest.mock('../../scripts/modules/task-manager.js', () => {
|
||||
// Get original implementation for functions you want to preserve
|
||||
const originalModule = jest.requireActual('../../scripts/modules/task-manager.js');
|
||||
|
||||
// Return mix of original and mocked functionality
|
||||
return {
|
||||
...originalModule,
|
||||
generateTaskFiles: jest.fn() // Replace specific functions
|
||||
};
|
||||
// 1. Define mock function instances
|
||||
const mockExistsSync = jest.fn();
|
||||
const mockReadFileSync = jest.fn();
|
||||
// ... other mocks
|
||||
|
||||
// 2. Mock the dependency module *before* the dynamic import
|
||||
jest.unstable_mockModule('fs', () => ({
|
||||
__esModule: true, // Important for ES module mocks
|
||||
// Mock named exports
|
||||
existsSync: mockExistsSync,
|
||||
readFileSync: mockReadFileSync,
|
||||
// Mock default export if necessary
|
||||
// default: { ... }
|
||||
}));
|
||||
|
||||
// 3. Dynamically import the module under test (e.g., in beforeAll or test case)
|
||||
let moduleUnderTest;
|
||||
beforeAll(async () => {
|
||||
// Ensure mocks are reset if needed before import
|
||||
mockExistsSync.mockReset();
|
||||
mockReadFileSync.mockReset();
|
||||
// ... reset other mocks ...
|
||||
|
||||
// Import *after* unstable_mockModule is called
|
||||
moduleUnderTest = await import('../../scripts/modules/module-using-fs.js');
|
||||
});
|
||||
|
||||
// Import after mocks
|
||||
import * as taskManager from '../../scripts/modules/task-manager.js';
|
||||
|
||||
// Now you can use the mock directly
|
||||
const { generateTaskFiles } = taskManager;
|
||||
|
||||
// 4. Now tests can use moduleUnderTest, and its 'fs' calls will hit the mocks
|
||||
test('should use mocked fs.readFileSync', () => {
|
||||
mockReadFileSync.mockReturnValue('mock data');
|
||||
moduleUnderTest.readFileAndProcess();
|
||||
expect(mockReadFileSync).toHaveBeenCalled();
|
||||
// ... other assertions
|
||||
});
|
||||
```
|
||||
- ✅ **DO**: Call `jest.unstable_mockModule()` before `await import()`.
|
||||
- ✅ **DO**: Include `__esModule: true` in the mock factory for ES modules.
|
||||
- ✅ **DO**: Mock named and default exports as needed within the factory.
|
||||
- ✅ **DO**: Reset mock functions (`mockFn.mockReset()`) before the dynamic import if they might have been called previously.
|
||||
|
||||
- **Mocking Entire Modules (Static Import)**
|
||||
```javascript
|
||||
// Mock the entire module with custom implementation for static imports
|
||||
// ... (existing example remains valid) ...
|
||||
```
|
||||
|
||||
- **Direct Implementation Testing**
|
||||
- Instead of calling the actual function which may have module-scope reference issues:
|
||||
```javascript
|
||||
test('should perform expected actions', () => {
|
||||
// Setup mocks for this specific test
|
||||
mockReadJSON.mockImplementationOnce(() => sampleData);
|
||||
|
||||
// Manually simulate the function's behavior
|
||||
const data = mockReadJSON('path/file.json');
|
||||
mockValidateAndFixDependencies(data, 'path/file.json');
|
||||
|
||||
// Skip calling the actual function and verify mocks directly
|
||||
expect(mockReadJSON).toHaveBeenCalledWith('path/file.json');
|
||||
expect(mockValidateAndFixDependencies).toHaveBeenCalledWith(data, 'path/file.json');
|
||||
});
|
||||
// ... (existing example remains valid) ...
|
||||
```
|
||||
|
||||
- **Avoiding Module Property Assignment**
|
||||
```javascript
|
||||
// ❌ DON'T: This causes "Cannot assign to read only property" errors
|
||||
const utils = await import('../../scripts/modules/utils.js');
|
||||
utils.readJSON = mockReadJSON; // Error: read-only property
|
||||
|
||||
// ✅ DO: Use the module factory pattern in jest.mock()
|
||||
jest.mock('../../scripts/modules/utils.js', () => ({
|
||||
readJSON: mockReadJSONFunc,
|
||||
writeJSON: mockWriteJSONFunc
|
||||
}));
|
||||
// ... (existing example remains valid) ...
|
||||
```
|
||||
|
||||
- **Handling Mock Verification Failures**
|
||||
- If verification like `expect(mockFn).toHaveBeenCalled()` fails:
|
||||
1. Check that your mock setup is before imports
|
||||
2. Ensure you're using the right mock instance
|
||||
3. Verify your test invokes behavior that would call the mock
|
||||
4. Use `jest.clearAllMocks()` in beforeEach to reset mock state
|
||||
5. Consider implementing a simpler test that directly verifies mock behavior
|
||||
|
||||
- **Full Example Pattern**
|
||||
```javascript
|
||||
// 1. Define mock implementations
|
||||
const mockReadJSON = jest.fn();
|
||||
const mockValidateAndFixDependencies = jest.fn();
|
||||
|
||||
// 2. Mock modules
|
||||
jest.mock('../../scripts/modules/utils.js', () => ({
|
||||
readJSON: mockReadJSON,
|
||||
// Include other functions as needed
|
||||
}));
|
||||
|
||||
jest.mock('../../scripts/modules/dependency-manager.js', () => ({
|
||||
validateAndFixDependencies: mockValidateAndFixDependencies
|
||||
}));
|
||||
|
||||
// 3. Import after mocks
|
||||
import * as taskManager from '../../scripts/modules/task-manager.js';
|
||||
|
||||
describe('generateTaskFiles function', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test('should generate task files', () => {
|
||||
// 4. Setup test-specific mock behavior
|
||||
const sampleData = { tasks: [{ id: 1, title: 'Test' }] };
|
||||
mockReadJSON.mockReturnValueOnce(sampleData);
|
||||
|
||||
// 5. Create direct implementation test
|
||||
// Instead of calling: taskManager.generateTaskFiles('path', 'dir')
|
||||
|
||||
// Simulate reading data
|
||||
const data = mockReadJSON('path');
|
||||
expect(mockReadJSON).toHaveBeenCalledWith('path');
|
||||
|
||||
// Simulate other operations the function would perform
|
||||
mockValidateAndFixDependencies(data, 'path');
|
||||
expect(mockValidateAndFixDependencies).toHaveBeenCalledWith(data, 'path');
|
||||
});
|
||||
});
|
||||
```
|
||||
1. Check that your mock setup (`jest.mock` or `jest.unstable_mockModule`) is correctly placed **before** imports (static or dynamic).
|
||||
2. Ensure you're using the right mock instance and it's properly passed to the module.
|
||||
3. Verify your test invokes behavior that *should* call the mock.
|
||||
4. Use `jest.clearAllMocks()` or specific `mockFn.mockReset()` in `beforeEach` to prevent state leakage between tests.
|
||||
5. **Check Console Assertions**: If verifying `console.log`, `console.warn`, or `console.error` calls, ensure your assertion matches the *actual* arguments passed. If the code logs a single formatted string, assert against that single string (using `expect.stringContaining` or exact match), not multiple `expect.stringContaining` arguments.
|
||||
```javascript
|
||||
// Example: Code logs console.error(`Error: ${message}. Details: ${details}`)
|
||||
// ❌ DON'T: Assert multiple arguments if only one is logged
|
||||
// expect(console.error).toHaveBeenCalledWith(
|
||||
// expect.stringContaining('Error:'),
|
||||
// expect.stringContaining('Details:')
|
||||
// );
|
||||
// ✅ DO: Assert the single string argument
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Error: Specific message. Details: More details')
|
||||
);
|
||||
// or for exact match:
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
'Error: Specific message. Details: More details'
|
||||
);
|
||||
```
|
||||
6. Consider implementing a simpler test that *only* verifies the mock behavior in isolation.
|
||||
|
||||
## Mocking Guidelines
|
||||
|
||||
@@ -552,6 +660,102 @@ npm test -- -t "pattern to match"
|
||||
});
|
||||
```
|
||||
|
||||
## Testing AI Service Integrations
|
||||
|
||||
- **DO NOT import real AI service clients**
|
||||
- ❌ DON'T: Import actual AI clients from their libraries
|
||||
- ✅ DO: Create fully mocked versions that return predictable responses
|
||||
|
||||
```javascript
|
||||
// ❌ DON'T: Import and instantiate real AI clients
|
||||
import { Anthropic } from '@anthropic-ai/sdk';
|
||||
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
|
||||
|
||||
// ✅ DO: Mock the entire module with controlled behavior
|
||||
jest.mock('@anthropic-ai/sdk', () => ({
|
||||
Anthropic: jest.fn().mockImplementation(() => ({
|
||||
messages: {
|
||||
create: jest.fn().mockResolvedValue({
|
||||
content: [{ type: 'text', text: 'Mocked AI response' }]
|
||||
})
|
||||
}
|
||||
}))
|
||||
}));
|
||||
```
|
||||
|
||||
- **DO NOT rely on environment variables for API keys**
|
||||
- ❌ DON'T: Assume environment variables are set in tests
|
||||
- ✅ DO: Set mock environment variables in test setup
|
||||
|
||||
```javascript
|
||||
// In tests/setup.js or at the top of test file
|
||||
process.env.ANTHROPIC_API_KEY = 'test-mock-api-key-for-tests';
|
||||
process.env.PERPLEXITY_API_KEY = 'test-mock-perplexity-key-for-tests';
|
||||
```
|
||||
|
||||
- **DO NOT use real AI client initialization logic**
|
||||
- ❌ DON'T: Use code that attempts to initialize or validate real AI clients
|
||||
- ✅ DO: Create test-specific paths that bypass client initialization
|
||||
|
||||
```javascript
|
||||
// ❌ DON'T: Test functions that require valid AI client initialization
|
||||
// This will fail without proper API keys or network access
|
||||
test('should use AI client', async () => {
|
||||
const result = await functionThatInitializesAIClient();
|
||||
expect(result).toBeDefined();
|
||||
});
|
||||
|
||||
// ✅ DO: Test with bypassed initialization or manual task paths
|
||||
test('should handle manual task creation without AI', () => {
|
||||
// Using a path that doesn't require AI client initialization
|
||||
const result = addTaskDirect({
|
||||
title: 'Manual Task',
|
||||
description: 'Test Description'
|
||||
}, mockLogger);
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
```
|
||||
|
||||
## Testing Asynchronous Code
|
||||
|
||||
- **DO NOT rely on asynchronous operations in tests**
|
||||
- ❌ DON'T: Use real async/await or Promise resolution in tests
|
||||
- ✅ DO: Make all mocks return synchronous values when possible
|
||||
|
||||
```javascript
|
||||
// ❌ DON'T: Use real async functions that might fail unpredictably
|
||||
test('should handle async operation', async () => {
|
||||
const result = await realAsyncFunction(); // Can time out or fail for external reasons
|
||||
expect(result).toBe(expectedValue);
|
||||
});
|
||||
|
||||
// ✅ DO: Make async operations synchronous in tests
|
||||
test('should handle operation', () => {
|
||||
mockAsyncFunction.mockReturnValue({ success: true, data: 'test' });
|
||||
const result = functionUnderTest();
|
||||
expect(result).toEqual({ success: true, data: 'test' });
|
||||
});
|
||||
```
|
||||
|
||||
- **DO NOT test exact error messages**
|
||||
- ❌ DON'T: Assert on exact error message text that might change
|
||||
- ✅ DO: Test for error presence and general properties
|
||||
|
||||
```javascript
|
||||
// ❌ DON'T: Test for exact error message text
|
||||
expect(result.error).toBe('Could not connect to API: Network error');
|
||||
|
||||
// ✅ DO: Test for general error properties or message patterns
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.error).toContain('Could not connect');
|
||||
// Or even better:
|
||||
expect(result).toMatchObject({
|
||||
success: false,
|
||||
error: expect.stringContaining('connect')
|
||||
});
|
||||
```
|
||||
|
||||
## Reliable Testing Techniques
|
||||
|
||||
- **Create Simplified Test Functions**
|
||||
@@ -564,99 +768,125 @@ npm test -- -t "pattern to match"
|
||||
const setTaskStatus = async (taskId, newStatus) => {
|
||||
const tasksPath = 'tasks/tasks.json';
|
||||
const data = await readJSON(tasksPath);
|
||||
// Update task status logic
|
||||
// [implementation]
|
||||
await writeJSON(tasksPath, data);
|
||||
return data;
|
||||
return { success: true };
|
||||
};
|
||||
|
||||
// Test-friendly simplified function (easy to test)
|
||||
const testSetTaskStatus = (tasksData, taskIdInput, newStatus) => {
|
||||
// Same core logic without file operations
|
||||
// Update task status logic on provided tasksData object
|
||||
return tasksData; // Return updated data for assertions
|
||||
// Test-friendly version (easier to test)
|
||||
const updateTaskStatus = (tasks, taskId, newStatus) => {
|
||||
// Pure logic without side effects
|
||||
const updatedTasks = [...tasks];
|
||||
const taskIndex = findTaskById(updatedTasks, taskId);
|
||||
if (taskIndex === -1) return { success: false, error: 'Task not found' };
|
||||
updatedTasks[taskIndex].status = newStatus;
|
||||
return { success: true, tasks: updatedTasks };
|
||||
};
|
||||
```
|
||||
|
||||
- **Avoid Real File System Operations**
|
||||
- Never write to real files during tests
|
||||
- Create test-specific versions of file operation functions
|
||||
- Mock all file system operations including read, write, exists, etc.
|
||||
- Verify function behavior using the in-memory data structures
|
||||
|
||||
```javascript
|
||||
// Mock file operations
|
||||
const mockReadJSON = jest.fn();
|
||||
const mockWriteJSON = jest.fn();
|
||||
|
||||
jest.mock('../../scripts/modules/utils.js', () => ({
|
||||
readJSON: mockReadJSON,
|
||||
writeJSON: mockWriteJSON,
|
||||
}));
|
||||
|
||||
test('should update task status correctly', () => {
|
||||
// Setup mock data
|
||||
const testData = JSON.parse(JSON.stringify(sampleTasks));
|
||||
mockReadJSON.mockReturnValue(testData);
|
||||
|
||||
// Call the function that would normally modify files
|
||||
const result = testSetTaskStatus(testData, '1', 'done');
|
||||
|
||||
// Assert on the in-memory data structure
|
||||
expect(result.tasks[0].status).toBe('done');
|
||||
});
|
||||
```
|
||||
|
||||
- **Data Isolation Between Tests**
|
||||
- Always create fresh copies of test data for each test
|
||||
- Use `JSON.parse(JSON.stringify(original))` for deep cloning
|
||||
- Reset all mocks before each test with `jest.clearAllMocks()`
|
||||
- Avoid state that persists between tests
|
||||
|
||||
```javascript
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
// Deep clone the test data
|
||||
testTasksData = JSON.parse(JSON.stringify(sampleTasks));
|
||||
});
|
||||
```
|
||||
|
||||
- **Test All Path Variations**
|
||||
- Regular tasks and subtasks
|
||||
- Single items and multiple items
|
||||
- Success paths and error paths
|
||||
- Edge cases (empty data, invalid inputs, etc.)
|
||||
|
||||
```javascript
|
||||
// Multiple test cases covering different scenarios
|
||||
test('should update regular task status', () => {
|
||||
/* test implementation */
|
||||
});
|
||||
|
||||
test('should update subtask status', () => {
|
||||
/* test implementation */
|
||||
});
|
||||
|
||||
test('should update multiple tasks when given comma-separated IDs', () => {
|
||||
/* test implementation */
|
||||
});
|
||||
|
||||
test('should throw error for non-existent task ID', () => {
|
||||
/* test implementation */
|
||||
});
|
||||
```
|
||||
|
||||
- **Stabilize Tests With Predictable Input/Output**
|
||||
- Use consistent, predictable test fixtures
|
||||
- Avoid random values or time-dependent data
|
||||
- Make tests deterministic for reliable CI/CD
|
||||
- Control all variables that might affect test outcomes
|
||||
|
||||
```javascript
|
||||
// Use a specific known date instead of current date
|
||||
const fixedDate = new Date('2023-01-01T12:00:00Z');
|
||||
jest.spyOn(global, 'Date').mockImplementation(() => fixedDate);
|
||||
```
|
||||
|
||||
See [tests/README.md](mdc:tests/README.md) for more details on the testing approach.
|
||||
|
||||
Refer to [jest.config.js](mdc:jest.config.js) for Jest configuration options.
|
||||
Refer to [jest.config.js](mdc:jest.config.js) for Jest configuration options.
|
||||
|
||||
## Variable Hoisting and Module Initialization Issues
|
||||
|
||||
When testing ES modules or working with complex module imports, you may encounter variable hoisting and initialization issues. These can be particularly tricky to debug and often appear as "Cannot access 'X' before initialization" errors.
|
||||
|
||||
- **Understanding Module Initialization Order**
|
||||
- ✅ **DO**: Declare and initialize global variables at the top of modules
|
||||
- ✅ **DO**: Use proper function declarations to avoid hoisting issues
|
||||
- ✅ **DO**: Initialize variables before they are referenced, especially in imported modules
|
||||
- ✅ **DO**: Be aware that imports are hoisted to the top of the file
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Define global state variables at the top of the module
|
||||
let silentMode = false; // Declare and initialize first
|
||||
|
||||
const CONFIG = { /* configuration */ };
|
||||
|
||||
function isSilentMode() {
|
||||
return silentMode; // Reference variable after it's initialized
|
||||
}
|
||||
|
||||
function log(level, message) {
|
||||
if (isSilentMode()) return; // Use the function instead of accessing variable directly
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
- **Testing Modules with Initialization-Dependent Functions**
|
||||
- ✅ **DO**: Create test-specific implementations that initialize all variables correctly
|
||||
- ✅ **DO**: Use factory functions in mocks to ensure proper initialization order
|
||||
- ✅ **DO**: Be careful with how you mock or stub functions that depend on module state
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Test-specific implementation that avoids initialization issues
|
||||
const testLog = (level, ...args) => {
|
||||
// Local implementation with proper initialization
|
||||
const isSilent = false; // Explicit initialization
|
||||
if (isSilent) return;
|
||||
// Test implementation...
|
||||
};
|
||||
```
|
||||
|
||||
- **Common Hoisting-Related Errors to Avoid**
|
||||
- ❌ **DON'T**: Reference variables before their declaration in module scope
|
||||
- ❌ **DON'T**: Create circular dependencies between modules
|
||||
- ❌ **DON'T**: Rely on variable initialization order across module boundaries
|
||||
- ❌ **DON'T**: Define functions that use hoisted variables before they're initialized
|
||||
|
||||
```javascript
|
||||
// ❌ DON'T: Create reference-before-initialization patterns
|
||||
function badFunction() {
|
||||
if (silentMode) { /* ... */ } // ReferenceError if silentMode is declared later
|
||||
}
|
||||
|
||||
let silentMode = false;
|
||||
|
||||
// ❌ DON'T: Create cross-module references that depend on initialization order
|
||||
// module-a.js
|
||||
import { getSetting } from './module-b.js';
|
||||
export const config = { value: getSetting() };
|
||||
|
||||
// module-b.js
|
||||
import { config } from './module-a.js';
|
||||
export function getSetting() {
|
||||
return config.value; // Circular dependency causing initialization issues
|
||||
}
|
||||
```
|
||||
|
||||
- **Dynamic Imports as a Solution**
|
||||
- ✅ **DO**: Use dynamic imports (`import()`) to avoid initialization order issues
|
||||
- ✅ **DO**: Structure modules to avoid circular dependencies that cause initialization issues
|
||||
- ✅ **DO**: Consider factory functions for modules with complex state
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Use dynamic imports to avoid initialization issues
|
||||
async function getTaskManager() {
|
||||
return import('./task-manager.js');
|
||||
}
|
||||
|
||||
async function someFunction() {
|
||||
const taskManager = await getTaskManager();
|
||||
return taskManager.someMethod();
|
||||
}
|
||||
```
|
||||
|
||||
- **Testing Approach for Modules with Initialization Issues**
|
||||
- ✅ **DO**: Create self-contained test implementations rather than using real implementations
|
||||
- ✅ **DO**: Mock dependencies at module boundaries instead of trying to mock deep dependencies
|
||||
- ✅ **DO**: Isolate module-specific state in tests
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Create isolated test implementation instead of reusing module code
|
||||
test('should log messages when not in silent mode', () => {
|
||||
// Local test implementation instead of importing from module
|
||||
const testLog = (level, message) => {
|
||||
if (false) return; // Always non-silent for this test
|
||||
mockConsole(level, message);
|
||||
};
|
||||
|
||||
testLog('info', 'test message');
|
||||
expect(mockConsole).toHaveBeenCalledWith('info', 'test message');
|
||||
});
|
||||
```
|
||||
@@ -3,7 +3,6 @@ description: Guidelines for implementing utility functions
|
||||
globs: scripts/modules/utils.js, mcp-server/src/**/*
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Utility Function Guidelines
|
||||
|
||||
## General Principles
|
||||
@@ -79,28 +78,30 @@ alwaysApply: false
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Management (in `scripts/modules/utils.js`)
|
||||
## Configuration Management (via `config-manager.js`)
|
||||
|
||||
- **Environment Variables**:
|
||||
- ✅ DO: Provide default values for all configuration
|
||||
- ✅ DO: Use environment variables for customization
|
||||
- ✅ DO: Document available configuration options
|
||||
- ❌ DON'T: Hardcode values that should be configurable
|
||||
Taskmaster configuration (excluding API keys) is primarily managed through the `.taskmasterconfig` file located in the project root and accessed via getters in [`scripts/modules/config-manager.js`](mdc:scripts/modules/config-manager.js).
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Set up configuration with defaults and environment overrides
|
||||
const CONFIG = {
|
||||
model: process.env.MODEL || 'claude-3-opus-20240229', // Updated default model
|
||||
maxTokens: parseInt(process.env.MAX_TOKENS || '4000'),
|
||||
temperature: parseFloat(process.env.TEMPERATURE || '0.7'),
|
||||
debug: process.env.DEBUG === "true",
|
||||
logLevel: process.env.LOG_LEVEL || "info",
|
||||
defaultSubtasks: parseInt(process.env.DEFAULT_SUBTASKS || "3"),
|
||||
defaultPriority: process.env.DEFAULT_PRIORITY || "medium",
|
||||
projectName: process.env.PROJECT_NAME || "Task Master Project", // Generic project name
|
||||
projectVersion: "1.5.0" // Version should be updated via release process
|
||||
};
|
||||
```
|
||||
- **`.taskmasterconfig` File**:
|
||||
- ✅ DO: Use this JSON file to store settings like AI model selections (main, research, fallback), parameters (temperature, maxTokens), logging level, default priority/subtasks, etc.
|
||||
- ✅ DO: Manage this file using the `task-master models --setup` CLI command or the `models` MCP tool.
|
||||
- ✅ DO: Rely on [`config-manager.js`](mdc:scripts/modules/config-manager.js) to load this file (using the correct project root passed from MCP or found via CLI utils), merge with defaults, and provide validated settings.
|
||||
- ❌ DON'T: Store API keys in this file.
|
||||
- ❌ DON'T: Manually edit this file unless necessary.
|
||||
|
||||
- **Configuration Getters (`config-manager.js`)**:
|
||||
- ✅ DO: Import and use specific getters from `config-manager.js` (e.g., `getMainProvider()`, `getLogLevel()`, `getMainMaxTokens()`) to access configuration values *needed for application logic* (like `getDefaultSubtasks`).
|
||||
- ✅ DO: Pass the `explicitRoot` parameter to getters if calling from MCP direct functions to ensure the correct project's config is loaded.
|
||||
- ❌ DON'T: Call AI-specific getters (like `getMainModelId`, `getMainMaxTokens`) from core logic functions (`scripts/modules/task-manager/*`). Instead, pass the `role` to the unified AI service.
|
||||
- ❌ DON'T: Access configuration values directly from environment variables (except API keys).
|
||||
|
||||
- **API Key Handling (`utils.js` & `ai-services-unified.js`)**:
|
||||
- ✅ DO: Store API keys **only** in `.env` (for CLI, loaded by `dotenv` in `scripts/dev.js`) or `.cursor/mcp.json` (for MCP, accessed via `session.env`).
|
||||
- ✅ DO: Use `isApiKeySet(providerName, session)` from `config-manager.js` to check if a provider's key is available *before* potentially attempting an AI call if needed, but note the unified service performs its own internal check.
|
||||
- ✅ DO: Understand that the unified service layer (`ai-services-unified.js`) internally resolves API keys using `resolveEnvVariable(key, session)` from `utils.js`.
|
||||
|
||||
- **Error Handling**:
|
||||
- ✅ DO: Handle potential `ConfigurationError` if the `.taskmasterconfig` file is missing or invalid when accessed via `getConfig` (e.g., in `commands.js` or direct functions).
|
||||
|
||||
## Logging Utilities (in `scripts/modules/utils.js`)
|
||||
|
||||
@@ -427,36 +428,69 @@ alwaysApply: false
|
||||
|
||||
## MCP Server Tool Utilities (`mcp-server/src/tools/utils.js`)
|
||||
|
||||
- **Purpose**: These utilities specifically support the MCP server tools ([`mcp-server/src/tools/*.js`](mdc:mcp-server/src/tools/*.js)), handling MCP communication patterns, response formatting, caching integration, and the CLI fallback mechanism.
|
||||
- **Refer to [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)** for detailed usage patterns within the MCP tool `execute` methods and direct function wrappers.
|
||||
These utilities specifically support the implementation and execution of MCP tools.
|
||||
|
||||
- **`getProjectRootFromSession(session, log)`**:
|
||||
- ✅ **DO**: Call this utility **within the MCP tool's `execute` method** to extract the project root path from the `session` object.
|
||||
- Decodes the `file://` URI and handles potential errors.
|
||||
- Returns the project path string or `null`.
|
||||
- The returned path should then be passed in the `args` object when calling the corresponding `*Direct` function (e.g., `yourDirectFunction({ ...args, projectRoot: rootFolder }, log)`).
|
||||
- **`normalizeProjectRoot(rawPath, log)`**:
|
||||
- **Purpose**: Takes a raw project root path (potentially URI encoded, with `file://` prefix, Windows slashes) and returns a normalized, absolute path suitable for the server's OS.
|
||||
- **Logic**: Decodes URI, strips `file://`, handles Windows drive prefix (`/C:/`), replaces `\` with `/`, uses `path.resolve()`.
|
||||
- **Usage**: Used internally by `withNormalizedProjectRoot` HOF.
|
||||
|
||||
- **`getRawProjectRootFromSession(session, log)`**:
|
||||
- **Purpose**: Extracts the *raw* project root URI string from the session object (`session.roots[0].uri` or `session.roots.roots[0].uri`) without performing normalization.
|
||||
- **Usage**: Used internally by `withNormalizedProjectRoot` HOF as a fallback if `args.projectRoot` isn't provided.
|
||||
|
||||
- **`withNormalizedProjectRoot(executeFn)`**:
|
||||
- **Purpose**: A Higher-Order Function (HOF) designed to wrap a tool's `execute` method.
|
||||
- **Logic**:
|
||||
1. Determines the raw project root (from `args.projectRoot` or `getRawProjectRootFromSession`).
|
||||
2. Normalizes the raw path using `normalizeProjectRoot`.
|
||||
3. Injects the normalized, absolute path back into the `args` object as `args.projectRoot`.
|
||||
4. Calls the original `executeFn` with the updated `args`.
|
||||
- **Usage**: Should wrap the `execute` function of *every* MCP tool that needs a reliable, normalized project root path.
|
||||
- **Example**:
|
||||
```javascript
|
||||
// In mcp-server/src/tools/your-tool.js
|
||||
import { withNormalizedProjectRoot } from './utils.js';
|
||||
|
||||
export function registerYourTool(server) {
|
||||
server.addTool({
|
||||
// ... name, description, parameters ...
|
||||
execute: withNormalizedProjectRoot(async (args, context) => {
|
||||
// args.projectRoot is now normalized here
|
||||
const { projectRoot /*, other args */ } = args;
|
||||
// ... rest of tool logic using normalized projectRoot ...
|
||||
})
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
- **`handleApiResult(result, log, errorPrefix, processFunction)`**:
|
||||
- ✅ **DO**: Call this from the MCP tool's `execute` method after receiving the result from the `*Direct` function wrapper.
|
||||
- Takes the standard `{ success, data/error, fromCache }` object.
|
||||
- Formats the standard MCP success or error response, including the `fromCache` flag.
|
||||
- Uses `processMCPResponseData` by default to filter response data.
|
||||
|
||||
- **`executeTaskMasterCommand(command, log, args, projectRootRaw)`**:
|
||||
- Executes a Task Master CLI command as a child process.
|
||||
- Handles fallback between global `task-master` and local `node scripts/dev.js`.
|
||||
- ❌ **DON'T**: Use this as the primary method for MCP tools. Prefer direct function calls via `*Direct` wrappers.
|
||||
|
||||
- **`processMCPResponseData(taskOrData, fieldsToRemove)`**:
|
||||
- Filters task data (e.g., removing `details`, `testStrategy`) before sending to the MCP client. Called by `handleApiResult`.
|
||||
- **Purpose**: Standardizes the formatting of responses returned by direct functions (`{ success, data/error, fromCache }`) into the MCP response format.
|
||||
- **Usage**: Call this at the end of the tool's `execute` method, passing the result from the direct function call.
|
||||
|
||||
- **`createContentResponse(content)` / `createErrorResponse(errorMessage)`**:
|
||||
- Formatters for standard MCP success/error responses.
|
||||
- **Purpose**: Helper functions to create the basic MCP response structure for success or error messages.
|
||||
- **Usage**: Used internally by `handleApiResult` and potentially directly for simple responses.
|
||||
|
||||
- **`createLogWrapper(log)`**:
|
||||
- **Purpose**: Creates a logger object wrapper with standard methods (`info`, `warn`, `error`, `debug`, `success`) mapping to the passed MCP `log` object's methods. Ensures compatibility when passing loggers to core functions.
|
||||
- **Usage**: Used within direct functions before passing the `log` object down to core logic that expects the standard method names.
|
||||
|
||||
- **`getCachedOrExecute({ cacheKey, actionFn, log })`**:
|
||||
- ✅ **DO**: Use this utility *inside direct function wrappers* to implement caching.
|
||||
- Checks cache, executes `actionFn` on miss, stores result.
|
||||
- Returns standard `{ success, data/error, fromCache: boolean }`.
|
||||
- **Purpose**: Utility for implementing caching within direct functions. Checks cache for `cacheKey`; if miss, executes `actionFn`, caches successful result, and returns.
|
||||
- **Usage**: Wrap the core logic execution within a direct function call.
|
||||
|
||||
- **`processMCPResponseData(taskOrData, fieldsToRemove)`**:
|
||||
- **Purpose**: Utility to filter potentially sensitive or large fields (like `details`, `testStrategy`) from task objects before sending the response back via MCP.
|
||||
- **Usage**: Passed as the default `processFunction` to `handleApiResult`.
|
||||
|
||||
- **`getProjectRootFromSession(session, log)`**:
|
||||
- **Purpose**: Legacy function to extract *and normalize* the project root from the session. Replaced by the HOF pattern but potentially still used.
|
||||
- **Recommendation**: Prefer using the `withNormalizedProjectRoot` HOF in tools instead of calling this directly.
|
||||
|
||||
- **`executeTaskMasterCommand(...)`**:
|
||||
- **Purpose**: Executes `task-master` CLI command as a fallback.
|
||||
- **Recommendation**: Deprecated for most uses; prefer direct function calls.
|
||||
|
||||
## Export Organization
|
||||
|
||||
|
||||
33
.env.example
33
.env.example
@@ -1,20 +1,15 @@
|
||||
# API Keys (Required)
|
||||
ANTHROPIC_API_KEY=your_anthropic_api_key_here # Format: sk-ant-api03-...
|
||||
PERPLEXITY_API_KEY=your_perplexity_api_key_here # Format: pplx-...
|
||||
# API Keys (Required for using in any role i.e. main/research/fallback -- see `task-master models`)
|
||||
ANTHROPIC_API_KEY=YOUR_ANTHROPIC_KEY_HERE
|
||||
PERPLEXITY_API_KEY=YOUR_PERPLEXITY_KEY_HERE
|
||||
OPENAI_API_KEY=YOUR_OPENAI_KEY_HERE
|
||||
GOOGLE_API_KEY=YOUR_GOOGLE_KEY_HERE
|
||||
MISTRAL_API_KEY=YOUR_MISTRAL_KEY_HERE
|
||||
OPENROUTER_API_KEY=YOUR_OPENROUTER_KEY_HERE
|
||||
XAI_API_KEY=YOUR_XAI_KEY_HERE
|
||||
AZURE_OPENAI_API_KEY=YOUR_AZURE_KEY_HERE
|
||||
|
||||
# Model Configuration
|
||||
MODEL=claude-3-7-sonnet-20250219 # Recommended models: claude-3-7-sonnet-20250219, claude-3-opus-20240229
|
||||
PERPLEXITY_MODEL=sonar-pro # Perplexity model for research-backed subtasks
|
||||
MAX_TOKENS=128000 # Maximum tokens for model responses
|
||||
TEMPERATURE=0.2 # Temperature for model responses (0.0-1.0)
|
||||
|
||||
# Logging Configuration
|
||||
DEBUG=false # Enable debug logging (true/false)
|
||||
LOG_LEVEL=info # Log level (debug, info, warn, error)
|
||||
|
||||
# Task Generation Settings
|
||||
DEFAULT_SUBTASKS=5 # Default number of subtasks when expanding
|
||||
DEFAULT_PRIORITY=medium # Default priority for generated tasks (high, medium, low)
|
||||
|
||||
# Project Metadata (Optional)
|
||||
PROJECT_NAME=Your Project Name # Override default project name in tasks.json
|
||||
# Google Vertex AI Configuration
|
||||
VERTEX_PROJECT_ID=your-gcp-project-id
|
||||
VERTEX_LOCATION=us-central1
|
||||
# Optional: Path to service account credentials JSON file (alternative to API key)
|
||||
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-credentials.json
|
||||
|
||||
39
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
39
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: 'bug: '
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
### Description
|
||||
|
||||
Detailed description of the problem, including steps to reproduce the issue.
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
1. Step-by-step instructions to reproduce the issue
|
||||
2. Include command examples or UI interactions
|
||||
|
||||
### Expected Behavior
|
||||
|
||||
Describe clearly what the expected outcome or behavior should be.
|
||||
|
||||
### Actual Behavior
|
||||
|
||||
Describe clearly what the actual outcome or behavior is.
|
||||
|
||||
### Screenshots or Logs
|
||||
|
||||
Provide screenshots, logs, or error messages if applicable.
|
||||
|
||||
### Environment
|
||||
|
||||
- Task Master version:
|
||||
- Node.js version:
|
||||
- Operating system:
|
||||
- IDE (if applicable):
|
||||
|
||||
### Additional Context
|
||||
|
||||
Any additional information or context that might help diagnose the issue.
|
||||
51
.github/ISSUE_TEMPLATE/enhancements---feature-requests.md
vendored
Normal file
51
.github/ISSUE_TEMPLATE/enhancements---feature-requests.md
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: Enhancements & feature requests
|
||||
about: Suggest an idea for this project
|
||||
title: 'feat: '
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
> "Direct quote or clear summary of user request or need or user story."
|
||||
|
||||
### Motivation
|
||||
|
||||
Detailed explanation of why this feature is important. Describe the problem it solves or the benefit it provides.
|
||||
|
||||
### Proposed Solution
|
||||
|
||||
Clearly describe the proposed feature, including:
|
||||
|
||||
- High-level overview of the feature
|
||||
- Relevant technologies or integrations
|
||||
- How it fits into the existing workflow or architecture
|
||||
|
||||
### High-Level Workflow
|
||||
|
||||
1. Step-by-step description of how the feature will be implemented
|
||||
2. Include necessary intermediate milestones
|
||||
|
||||
### Key Elements
|
||||
|
||||
- Bullet-point list of technical or UX/UI enhancements
|
||||
- Mention specific integrations or APIs
|
||||
- Highlight changes needed in existing data models or commands
|
||||
|
||||
### Example Workflow
|
||||
|
||||
Provide a clear, concrete example demonstrating the feature:
|
||||
|
||||
```shell
|
||||
$ task-master [action]
|
||||
→ Expected response/output
|
||||
```
|
||||
|
||||
### Implementation Considerations
|
||||
|
||||
- Dependencies on external components or APIs
|
||||
- Backward compatibility requirements
|
||||
- Potential performance impacts or resource usage
|
||||
|
||||
### Out of Scope (Future Considerations)
|
||||
|
||||
Clearly list any features or improvements not included but relevant for future iterations.
|
||||
31
.github/ISSUE_TEMPLATE/feedback.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/feedback.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: Feedback
|
||||
about: Give us specific feedback on the product/approach/tech
|
||||
title: 'feedback: '
|
||||
labels: feedback
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
### Feedback Summary
|
||||
|
||||
Provide a clear summary or direct quote from user feedback.
|
||||
|
||||
### User Context
|
||||
|
||||
Explain the user's context or scenario in which this feedback was provided.
|
||||
|
||||
### User Impact
|
||||
|
||||
Describe how this feedback affects the user experience or workflow.
|
||||
|
||||
### Suggestions
|
||||
|
||||
Provide any initial thoughts, potential solutions, or improvements based on the feedback.
|
||||
|
||||
### Relevant Screenshots or Examples
|
||||
|
||||
Attach screenshots, logs, or examples that illustrate the feedback.
|
||||
|
||||
### Additional Notes
|
||||
|
||||
Any additional context or related information.
|
||||
60
.github/workflows/ci.yml
vendored
60
.github/workflows/ci.yml
vendored
@@ -14,7 +14,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
setup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -24,21 +24,55 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "npm"
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Dependencies
|
||||
id: install
|
||||
run: npm ci
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
*/*/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
timeout-minutes: 2
|
||||
format-check:
|
||||
needs: setup
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Restore node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Format Check
|
||||
run: npm run format-check
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
test:
|
||||
needs: setup
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Restore node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
@@ -47,13 +81,13 @@ jobs:
|
||||
NODE_ENV: test
|
||||
CI: true
|
||||
FORCE_COLOR: 1
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 10
|
||||
|
||||
- name: Upload Test Results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-node
|
||||
name: test-results
|
||||
path: |
|
||||
test-results
|
||||
coverage
|
||||
|
||||
62
.github/workflows/pre-release.yml
vendored
Normal file
62
.github/workflows/pre-release.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Pre-Release (RC)
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Allows manual triggering from GitHub UI/API
|
||||
|
||||
concurrency: pre-release-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
rc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
*/*/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: Enter RC mode
|
||||
run: |
|
||||
npx changeset pre exit || true
|
||||
npx changeset pre enter rc
|
||||
|
||||
- name: Version RC packages
|
||||
run: npx changeset version
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Create Release Candidate Pull Request or Publish Release Candidate to npm
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
publish: npm run release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Exit RC mode
|
||||
run: npx changeset pre exit
|
||||
|
||||
- name: Commit & Push changes
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: ${{ github.ref }}
|
||||
message: 'chore: rc version bump'
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -3,6 +3,9 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -14,7 +17,7 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "npm"
|
||||
cache: 'npm'
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
@@ -30,6 +33,9 @@ jobs:
|
||||
run: npm ci
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: Exit pre-release mode (safety check)
|
||||
run: npx changeset pre exit || true
|
||||
|
||||
- name: Create Release Pull Request or Publish to npm
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
|
||||
40
.github/workflows/update-models-md.yml
vendored
Normal file
40
.github/workflows/update-models-md.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Update models.md from supported-models.json
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- next
|
||||
paths:
|
||||
- 'scripts/modules/supported-models.json'
|
||||
- 'docs/scripts/models-json-to-markdown.js'
|
||||
|
||||
jobs:
|
||||
update_markdown:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Run transformation script
|
||||
run: node docs/scripts/models-json-to-markdown.js
|
||||
|
||||
- name: Format Markdown with Prettier
|
||||
run: npx prettier --write docs/models.md
|
||||
|
||||
- name: Stage docs/models.md
|
||||
run: git add docs/models.md
|
||||
|
||||
- name: Commit & Push docs/models.md
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: ${{ github.ref_name }}
|
||||
message: 'docs: Auto-update and format models.md'
|
||||
author_name: 'github-actions[bot]'
|
||||
author_email: 'github-actions[bot]@users.noreply.github.com'
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -19,6 +19,8 @@ npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
tests/e2e/_runs/
|
||||
tests/e2e/log/
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
@@ -58,4 +60,7 @@ dist
|
||||
# Debug files
|
||||
*.debug
|
||||
init-debug.log
|
||||
dev-debug.log
|
||||
dev-debug.log
|
||||
|
||||
# NPMRC
|
||||
.npmrc
|
||||
|
||||
33
.taskmaster/config.json
Normal file
33
.taskmaster/config.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"models": {
|
||||
"main": {
|
||||
"provider": "anthropic",
|
||||
"modelId": "claude-sonnet-4-20250514",
|
||||
"maxTokens": 50000,
|
||||
"temperature": 0.2
|
||||
},
|
||||
"research": {
|
||||
"provider": "perplexity",
|
||||
"modelId": "sonar-pro",
|
||||
"maxTokens": 8700,
|
||||
"temperature": 0.1
|
||||
},
|
||||
"fallback": {
|
||||
"provider": "anthropic",
|
||||
"modelId": "claude-3-7-sonnet-20250219",
|
||||
"maxTokens": 128000,
|
||||
"temperature": 0.2
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"userId": "1234567890",
|
||||
"logLevel": "info",
|
||||
"debug": false,
|
||||
"defaultSubtasks": 5,
|
||||
"defaultPriority": "medium",
|
||||
"projectName": "Taskmaster",
|
||||
"ollamaBaseURL": "http://localhost:11434/api",
|
||||
"bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com",
|
||||
"azureBaseURL": "https://your-endpoint.azure.com/"
|
||||
}
|
||||
}
|
||||
528
.taskmaster/docs/prd.txt
Normal file
528
.taskmaster/docs/prd.txt
Normal file
@@ -0,0 +1,528 @@
|
||||
|
||||
# Claude Task Master - Product Requirements Document
|
||||
|
||||
<PRD>
|
||||
# Technical Architecture
|
||||
|
||||
## System Components
|
||||
1. **Task Management Core**
|
||||
- Tasks.json file structure (single source of truth)
|
||||
- Task model with dependencies, priorities, and metadata
|
||||
- Task state management system
|
||||
- Task file generation subsystem
|
||||
|
||||
2. **AI Integration Layer**
|
||||
- Anthropic Claude API integration
|
||||
- Perplexity API integration (optional)
|
||||
- Prompt engineering components
|
||||
- Response parsing and processing
|
||||
|
||||
3. **Command Line Interface**
|
||||
- Command parsing and execution
|
||||
- Interactive user input handling
|
||||
- Display and formatting utilities
|
||||
- Status reporting and feedback system
|
||||
|
||||
4. **Cursor AI Integration**
|
||||
- Cursor rules documentation
|
||||
- Agent interaction patterns
|
||||
- Workflow guideline specifications
|
||||
|
||||
## Data Models
|
||||
|
||||
### Task Model
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Task Title",
|
||||
"description": "Brief task description",
|
||||
"status": "pending|done|deferred",
|
||||
"dependencies": [0],
|
||||
"priority": "high|medium|low",
|
||||
"details": "Detailed implementation instructions",
|
||||
"testStrategy": "Verification approach details",
|
||||
"subtasks": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Subtask Title",
|
||||
"description": "Subtask description",
|
||||
"status": "pending|done|deferred",
|
||||
"dependencies": [],
|
||||
"acceptanceCriteria": "Verification criteria"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Tasks Collection Model
|
||||
```json
|
||||
{
|
||||
"meta": {
|
||||
"projectName": "Project Name",
|
||||
"version": "1.0.0",
|
||||
"prdSource": "path/to/prd.txt",
|
||||
"createdAt": "ISO-8601 timestamp",
|
||||
"updatedAt": "ISO-8601 timestamp"
|
||||
},
|
||||
"tasks": [
|
||||
// Array of Task objects
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Task File Format
|
||||
```
|
||||
# Task ID: <id>
|
||||
# Title: <title>
|
||||
# Status: <status>
|
||||
# Dependencies: <comma-separated list of dependency IDs>
|
||||
# Priority: <priority>
|
||||
# Description: <brief description>
|
||||
# Details:
|
||||
<detailed implementation notes>
|
||||
|
||||
# Test Strategy:
|
||||
<verification approach>
|
||||
|
||||
# Subtasks:
|
||||
1. <subtask title> - <subtask description>
|
||||
```
|
||||
|
||||
## APIs and Integrations
|
||||
1. **Anthropic Claude API**
|
||||
- Authentication via API key
|
||||
- Prompt construction and streaming
|
||||
- Response parsing and extraction
|
||||
- Error handling and retries
|
||||
|
||||
2. **Perplexity API (via OpenAI client)**
|
||||
- Authentication via API key
|
||||
- Research-oriented prompt construction
|
||||
- Enhanced contextual response handling
|
||||
- Fallback mechanisms to Claude
|
||||
|
||||
3. **File System API**
|
||||
- Reading/writing tasks.json
|
||||
- Managing individual task files
|
||||
- Command execution logging
|
||||
- Debug logging system
|
||||
|
||||
## Infrastructure Requirements
|
||||
1. **Node.js Runtime**
|
||||
- Version 14.0.0 or higher
|
||||
- ES Module support
|
||||
- File system access rights
|
||||
- Command execution capabilities
|
||||
|
||||
2. **Configuration Management**
|
||||
- Environment variable handling
|
||||
- .env file support
|
||||
- Configuration validation
|
||||
- Sensible defaults with overrides
|
||||
|
||||
3. **Development Environment**
|
||||
- Git repository
|
||||
- NPM package management
|
||||
- Cursor editor integration
|
||||
- Command-line terminal access
|
||||
|
||||
# Development Roadmap
|
||||
|
||||
## Phase 1: Core Task Management System
|
||||
1. **Task Data Structure**
|
||||
- Design and implement the tasks.json structure
|
||||
- Create task model validation
|
||||
- Implement basic task operations (create, read, update)
|
||||
- Develop file system interactions
|
||||
|
||||
2. **Command Line Interface Foundation**
|
||||
- Implement command parsing with Commander.js
|
||||
- Create help documentation
|
||||
- Implement colorized console output
|
||||
- Add logging system with configurable levels
|
||||
|
||||
3. **Basic Task Operations**
|
||||
- Implement task listing functionality
|
||||
- Create task status update capability
|
||||
- Add dependency tracking
|
||||
- Implement priority management
|
||||
|
||||
4. **Task File Generation**
|
||||
- Create task file templates
|
||||
- Implement generation from tasks.json
|
||||
- Add bi-directional synchronization
|
||||
- Implement proper file naming and organization
|
||||
|
||||
## Phase 2: AI Integration
|
||||
1. **Claude API Integration**
|
||||
- Implement API authentication
|
||||
- Create prompt templates for PRD parsing
|
||||
- Design response handlers
|
||||
- Add error management and retries
|
||||
|
||||
2. **PRD Parsing System**
|
||||
- Implement PRD file reading
|
||||
- Create PRD to task conversion logic
|
||||
- Add intelligent dependency inference
|
||||
- Implement priority assignment logic
|
||||
|
||||
3. **Task Expansion With Claude**
|
||||
- Create subtask generation prompts
|
||||
- Implement subtask creation workflow
|
||||
- Add context-aware expansion capabilities
|
||||
- Implement parent-child relationship management
|
||||
|
||||
4. **Implementation Drift Handling**
|
||||
- Add capability to update future tasks
|
||||
- Implement task rewriting based on new context
|
||||
- Create dependency chain updates
|
||||
- Preserve completed work while updating future tasks
|
||||
|
||||
## Phase 3: Advanced Features
|
||||
1. **Perplexity Integration**
|
||||
- Implement Perplexity API authentication
|
||||
- Create research-oriented prompts
|
||||
- Add fallback to Claude when unavailable
|
||||
- Implement response quality comparison logic
|
||||
|
||||
2. **Research-Backed Subtask Generation**
|
||||
- Create specialized research prompts
|
||||
- Implement context enrichment
|
||||
- Add domain-specific knowledge incorporation
|
||||
- Create more detailed subtask generation
|
||||
|
||||
3. **Batch Operations**
|
||||
- Implement multi-task status updates
|
||||
- Add bulk subtask generation
|
||||
- Create task filtering and querying
|
||||
- Implement advanced dependency management
|
||||
|
||||
4. **Project Initialization**
|
||||
- Create project templating system
|
||||
- Implement interactive setup
|
||||
- Add environment configuration
|
||||
- Create documentation generation
|
||||
|
||||
## Phase 4: Cursor AI Integration
|
||||
1. **Cursor Rules Implementation**
|
||||
- Create dev_workflow.mdc documentation
|
||||
- Implement cursor_rules.mdc
|
||||
- Add self_improve.mdc
|
||||
- Design rule integration documentation
|
||||
|
||||
2. **Agent Workflow Guidelines**
|
||||
- Document task discovery workflow
|
||||
- Create task selection guidelines
|
||||
- Implement implementation guidance
|
||||
- Add verification procedures
|
||||
|
||||
3. **Agent Command Integration**
|
||||
- Document command syntax for agents
|
||||
- Create example interactions
|
||||
- Implement agent response patterns
|
||||
- Add context management for agents
|
||||
|
||||
4. **User Documentation**
|
||||
- Create detailed README
|
||||
- Add scripts documentation
|
||||
- Implement example workflows
|
||||
- Create troubleshooting guides
|
||||
|
||||
# Logical Dependency Chain
|
||||
|
||||
## Foundation Layer
|
||||
1. **Task Data Structure**
|
||||
- Must be implemented first as all other functionality depends on this
|
||||
- Defines the core data model for the entire system
|
||||
- Establishes the single source of truth concept
|
||||
|
||||
2. **Command Line Interface**
|
||||
- Built on top of the task data structure
|
||||
- Provides the primary user interaction mechanism
|
||||
- Required for all subsequent operations to be accessible
|
||||
|
||||
3. **Basic Task Operations**
|
||||
- Depends on both task data structure and CLI
|
||||
- Provides the fundamental operations for task management
|
||||
- Enables the minimal viable workflow
|
||||
|
||||
## Functional Layer
|
||||
4. **Task File Generation**
|
||||
- Depends on task data structure and basic operations
|
||||
- Creates the individual task files for reference
|
||||
- Enables the file-based workflow complementing tasks.json
|
||||
|
||||
5. **Claude API Integration**
|
||||
- Independent of most previous components but needs the task data structure
|
||||
- Provides the AI capabilities that enhance the system
|
||||
- Gateway to advanced task generation features
|
||||
|
||||
6. **PRD Parsing System**
|
||||
- Depends on Claude API integration and task data structure
|
||||
- Enables the initial task generation workflow
|
||||
- Creates the starting point for new projects
|
||||
|
||||
## Enhancement Layer
|
||||
7. **Task Expansion With Claude**
|
||||
- Depends on Claude API integration and basic task operations
|
||||
- Enhances existing tasks with more detailed subtasks
|
||||
- Improves the implementation guidance
|
||||
|
||||
8. **Implementation Drift Handling**
|
||||
- Depends on Claude API integration and task operations
|
||||
- Addresses a key challenge in AI-driven development
|
||||
- Maintains the relevance of task planning as implementation evolves
|
||||
|
||||
9. **Perplexity Integration**
|
||||
- Can be developed in parallel with other features after Claude integration
|
||||
- Enhances the quality of generated content
|
||||
- Provides research-backed improvements
|
||||
|
||||
## Advanced Layer
|
||||
10. **Research-Backed Subtask Generation**
|
||||
- Depends on Perplexity integration and task expansion
|
||||
- Provides higher quality, more contextual subtasks
|
||||
- Enhances the value of the task breakdown
|
||||
|
||||
11. **Batch Operations**
|
||||
- Depends on basic task operations
|
||||
- Improves efficiency for managing multiple tasks
|
||||
- Quality-of-life enhancement for larger projects
|
||||
|
||||
12. **Project Initialization**
|
||||
- Depends on most previous components being stable
|
||||
- Provides a smooth onboarding experience
|
||||
- Creates a complete project setup in one step
|
||||
|
||||
## Integration Layer
|
||||
13. **Cursor Rules Implementation**
|
||||
- Can be developed in parallel after basic functionality
|
||||
- Provides the guidance for Cursor AI agent
|
||||
- Enhances the AI-driven workflow
|
||||
|
||||
14. **Agent Workflow Guidelines**
|
||||
- Depends on Cursor rules implementation
|
||||
- Structures how the agent interacts with the system
|
||||
- Ensures consistent agent behavior
|
||||
|
||||
15. **Agent Command Integration**
|
||||
- Depends on agent workflow guidelines
|
||||
- Provides specific command patterns for the agent
|
||||
- Optimizes the agent-user interaction
|
||||
|
||||
16. **User Documentation**
|
||||
- Should be developed alongside all features
|
||||
- Must be completed before release
|
||||
- Ensures users can effectively use the system
|
||||
|
||||
# Risks and Mitigations
|
||||
|
||||
## Technical Challenges
|
||||
|
||||
### API Reliability
|
||||
**Risk**: Anthropic or Perplexity API could have downtime, rate limiting, or breaking changes.
|
||||
**Mitigation**:
|
||||
- Implement robust error handling with exponential backoff
|
||||
- Add fallback mechanisms (Claude fallback for Perplexity)
|
||||
- Cache important responses to reduce API dependency
|
||||
- Support offline mode for critical functions
|
||||
|
||||
### Model Output Variability
|
||||
**Risk**: AI models may produce inconsistent or unexpected outputs.
|
||||
**Mitigation**:
|
||||
- Design robust prompt templates with strict output formatting requirements
|
||||
- Implement response validation and error detection
|
||||
- Add self-correction mechanisms and retries with improved prompts
|
||||
- Allow manual editing of generated content
|
||||
|
||||
### Node.js Version Compatibility
|
||||
**Risk**: Differences in Node.js versions could cause unexpected behavior.
|
||||
**Mitigation**:
|
||||
- Clearly document minimum Node.js version requirements
|
||||
- Use transpilers if needed for compatibility
|
||||
- Test across multiple Node.js versions
|
||||
- Handle version-specific features gracefully
|
||||
|
||||
## MVP Definition
|
||||
|
||||
### Feature Prioritization
|
||||
**Risk**: Including too many features in the MVP could delay release and adoption.
|
||||
**Mitigation**:
|
||||
- Define MVP as core task management + basic Claude integration
|
||||
- Ensure each phase delivers a complete, usable product
|
||||
- Implement feature flags for easy enabling/disabling of features
|
||||
- Get early user feedback to validate feature importance
|
||||
|
||||
### Scope Creep
|
||||
**Risk**: The project could expand beyond its original intent, becoming too complex.
|
||||
**Mitigation**:
|
||||
- Maintain a strict definition of what the tool is and isn't
|
||||
- Focus on task management for AI-driven development
|
||||
- Evaluate new features against core value proposition
|
||||
- Implement extensibility rather than building every feature
|
||||
|
||||
### User Expectations
|
||||
**Risk**: Users might expect a full project management solution rather than a task tracking system.
|
||||
**Mitigation**:
|
||||
- Clearly communicate the tool's purpose and limitations
|
||||
- Provide integration points with existing project management tools
|
||||
- Focus on the unique value of AI-driven development
|
||||
- Document specific use cases and example workflows
|
||||
|
||||
## Resource Constraints
|
||||
|
||||
### Development Capacity
|
||||
**Risk**: Limited development resources could delay implementation.
|
||||
**Mitigation**:
|
||||
- Phase implementation to deliver value incrementally
|
||||
- Focus on core functionality first
|
||||
- Leverage open source libraries where possible
|
||||
- Design for extensibility to allow community contributions
|
||||
|
||||
### AI Cost Management
|
||||
**Risk**: Excessive API usage could lead to high costs.
|
||||
**Mitigation**:
|
||||
- Implement token usage tracking and reporting
|
||||
- Add configurable limits to prevent unexpected costs
|
||||
- Cache responses where appropriate
|
||||
- Optimize prompts for token efficiency
|
||||
- Support local LLM options in the future
|
||||
|
||||
### Documentation Overhead
|
||||
**Risk**: Complexity of the system requires extensive documentation that is time-consuming to maintain.
|
||||
**Mitigation**:
|
||||
- Use AI to help generate and maintain documentation
|
||||
- Create self-documenting commands and features
|
||||
- Implement progressive documentation (basic to advanced)
|
||||
- Build help directly into the CLI
|
||||
|
||||
# Appendix
|
||||
|
||||
## AI Prompt Engineering Specifications
|
||||
|
||||
### PRD Parsing Prompt Structure
|
||||
```
|
||||
You are assisting with transforming a Product Requirements Document (PRD) into a structured set of development tasks.
|
||||
|
||||
Given the following PRD, create a comprehensive list of development tasks that would be needed to implement the described product.
|
||||
|
||||
For each task:
|
||||
1. Assign a short, descriptive title
|
||||
2. Write a concise description
|
||||
3. Identify dependencies (which tasks must be completed before this one)
|
||||
4. Assign a priority (high, medium, low)
|
||||
5. Include detailed implementation notes
|
||||
6. Describe a test strategy to verify completion
|
||||
|
||||
Structure the tasks in a logical order of implementation.
|
||||
|
||||
PRD:
|
||||
{prd_content}
|
||||
```
|
||||
|
||||
### Task Expansion Prompt Structure
|
||||
```
|
||||
You are helping to break down a development task into more manageable subtasks.
|
||||
|
||||
Main task:
|
||||
Title: {task_title}
|
||||
Description: {task_description}
|
||||
Details: {task_details}
|
||||
|
||||
Please create {num_subtasks} specific subtasks that together would accomplish this main task.
|
||||
|
||||
For each subtask, provide:
|
||||
1. A clear, actionable title
|
||||
2. A concise description
|
||||
3. Any dependencies on other subtasks
|
||||
4. Specific acceptance criteria to verify completion
|
||||
|
||||
Additional context:
|
||||
{additional_context}
|
||||
```
|
||||
|
||||
### Research-Backed Expansion Prompt Structure
|
||||
```
|
||||
You are a technical researcher and developer helping to break down a software development task into detailed, well-researched subtasks.
|
||||
|
||||
Main task:
|
||||
Title: {task_title}
|
||||
Description: {task_description}
|
||||
Details: {task_details}
|
||||
|
||||
Research the latest best practices, technologies, and implementation patterns for this type of task. Then create {num_subtasks} specific, actionable subtasks that together would accomplish the main task.
|
||||
|
||||
For each subtask:
|
||||
1. Provide a clear, specific title
|
||||
2. Write a detailed description including technical approach
|
||||
3. Identify dependencies on other subtasks
|
||||
4. Include specific acceptance criteria
|
||||
5. Reference any relevant libraries, tools, or resources that should be used
|
||||
|
||||
Consider security, performance, maintainability, and user experience in your recommendations.
|
||||
```
|
||||
|
||||
## Task File System Specification
|
||||
|
||||
### Directory Structure
|
||||
```
|
||||
/
|
||||
├── .cursor/
|
||||
│ └── rules/
|
||||
│ ├── dev_workflow.mdc
|
||||
│ ├── cursor_rules.mdc
|
||||
│ └── self_improve.mdc
|
||||
├── scripts/
|
||||
│ ├── dev.js
|
||||
│ └── README.md
|
||||
├── tasks/
|
||||
│ ├── task_001.txt
|
||||
│ ├── task_002.txt
|
||||
│ └── ...
|
||||
├── .env
|
||||
├── .env.example
|
||||
├── .gitignore
|
||||
├── package.json
|
||||
├── README.md
|
||||
└── tasks.json
|
||||
```
|
||||
|
||||
### Task ID Specification
|
||||
- Main tasks: Sequential integers (1, 2, 3, ...)
|
||||
- Subtasks: Parent ID + dot + sequential integer (1.1, 1.2, 2.1, ...)
|
||||
- ID references: Used in dependencies, command parameters
|
||||
- ID ordering: Implies suggested implementation order
|
||||
|
||||
## Command-Line Interface Specification
|
||||
|
||||
### Global Options
|
||||
- `--help`: Display help information
|
||||
- `--version`: Display version information
|
||||
- `--file=<file>`: Specify an alternative tasks.json file
|
||||
- `--quiet`: Reduce output verbosity
|
||||
- `--debug`: Increase output verbosity
|
||||
- `--json`: Output in JSON format (for programmatic use)
|
||||
|
||||
### Command Structure
|
||||
- `node scripts/dev.js <command> [options]`
|
||||
- All commands operate on tasks.json by default
|
||||
- Commands follow consistent parameter naming
|
||||
- Common parameter styles: `--id=<id>`, `--status=<status>`, `--prompt="<text>"`
|
||||
- Boolean flags: `--all`, `--force`, `--with-subtasks`
|
||||
|
||||
## API Integration Specifications
|
||||
|
||||
### Anthropic API Configuration
|
||||
- Authentication: ANTHROPIC_API_KEY environment variable
|
||||
- Model selection: MODEL environment variable
|
||||
- Default model: claude-3-7-sonnet-20250219
|
||||
- Maximum tokens: MAX_TOKENS environment variable (default: 4000)
|
||||
- Temperature: TEMPERATURE environment variable (default: 0.7)
|
||||
|
||||
### Perplexity API Configuration
|
||||
- Authentication: PERPLEXITY_API_KEY environment variable
|
||||
- Model selection: PERPLEXITY_MODEL environment variable
|
||||
- Default model: sonar-medium-online
|
||||
- Connection: Via OpenAI client
|
||||
- Fallback: Use Claude if Perplexity unavailable
|
||||
</PRD>
|
||||
357
.taskmaster/reports/task-complexity-report.json
Normal file
357
.taskmaster/reports/task-complexity-report.json
Normal file
@@ -0,0 +1,357 @@
|
||||
{
|
||||
"meta": {
|
||||
"generatedAt": "2025-05-22T05:48:33.026Z",
|
||||
"tasksAnalyzed": 6,
|
||||
"totalTasks": 88,
|
||||
"analysisCount": 43,
|
||||
"thresholdScore": 5,
|
||||
"projectName": "Taskmaster",
|
||||
"usedResearch": true
|
||||
},
|
||||
"complexityAnalysis": [
|
||||
{
|
||||
"taskId": 24,
|
||||
"taskTitle": "Implement AI-Powered Test Generation Command",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Break down the implementation of the AI-powered test generation command into detailed subtasks covering: command structure setup, AI prompt engineering, test file generation logic, integration with Claude API, and comprehensive error handling.",
|
||||
"reasoning": "This task involves complex integration with an AI service (Claude), requires sophisticated prompt engineering, and needs to generate structured code files. The existing 3 subtasks are a good start but could be expanded to include more detailed steps for AI integration, error handling, and test file formatting."
|
||||
},
|
||||
{
|
||||
"taskId": 26,
|
||||
"taskTitle": "Implement Context Foundation for AI Operations",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for implementing the context foundation appear comprehensive. Consider if any additional subtasks are needed for testing, documentation, or integration with existing systems.",
|
||||
"reasoning": "This task involves creating a foundation for context integration with several well-defined components. The existing 4 subtasks cover the main implementation areas (context-file flag, cursor rules integration, context extraction utility, and command handler updates). The complexity is moderate as it requires careful integration with existing systems but has clear requirements."
|
||||
},
|
||||
{
|
||||
"taskId": 27,
|
||||
"taskTitle": "Implement Context Enhancements for AI Operations",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for implementing context enhancements appear well-structured. Consider if any additional subtasks are needed for testing, documentation, or performance optimization.",
|
||||
"reasoning": "This task builds upon the foundation from Task #26 and adds more sophisticated context handling features. The 4 existing subtasks cover the main implementation areas (code context extraction, task history context, PRD context integration, and context formatting). The complexity is higher than the foundation task due to the need for intelligent context selection and optimization."
|
||||
},
|
||||
{
|
||||
"taskId": 28,
|
||||
"taskTitle": "Implement Advanced ContextManager System",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the advanced ContextManager system appear comprehensive. Consider if any additional subtasks are needed for testing, documentation, or backward compatibility with previous context implementations.",
|
||||
"reasoning": "This task represents the most complex phase of the context implementation, requiring a sophisticated class design, optimization algorithms, and integration with multiple systems. The 5 existing subtasks cover the core implementation areas, but the complexity is high due to the need for intelligent context prioritization, token management, and performance monitoring."
|
||||
},
|
||||
{
|
||||
"taskId": 40,
|
||||
"taskTitle": "Implement 'plan' Command for Task Implementation Planning",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for implementing the 'plan' command appear well-structured. Consider if any additional subtasks are needed for testing, documentation, or integration with existing task management workflows.",
|
||||
"reasoning": "This task involves creating a new command that leverages AI to generate implementation plans. The existing 4 subtasks cover the main implementation areas (retrieving task content, generating plans with AI, formatting in XML, and error handling). The complexity is moderate as it builds on existing patterns for task updates but requires careful AI integration."
|
||||
},
|
||||
{
|
||||
"taskId": 41,
|
||||
"taskTitle": "Implement Visual Task Dependency Graph in Terminal",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 10,
|
||||
"expansionPrompt": "The current 10 subtasks for implementing the visual task dependency graph appear comprehensive. Consider if any additional subtasks are needed for performance optimization with large graphs or additional visualization options.",
|
||||
"reasoning": "This task involves creating a sophisticated visualization system for terminal display, which is inherently complex due to layout algorithms, ASCII/Unicode rendering, and handling complex dependency relationships. The 10 existing subtasks cover all major aspects of implementation, from CLI interface to accessibility features."
|
||||
},
|
||||
{
|
||||
"taskId": 42,
|
||||
"taskTitle": "Implement MCP-to-MCP Communication Protocol",
|
||||
"complexityScore": 9,
|
||||
"recommendedSubtasks": 8,
|
||||
"expansionPrompt": "The current 8 subtasks for implementing the MCP-to-MCP communication protocol appear well-structured. Consider if any additional subtasks are needed for security hardening, performance optimization, or comprehensive documentation.",
|
||||
"reasoning": "This task involves designing and implementing a complex communication protocol between different MCP tools and servers. It requires sophisticated adapter patterns, client-server architecture, and handling of multiple operational modes. The complexity is very high due to the need for standardization, security, and backward compatibility."
|
||||
},
|
||||
{
|
||||
"taskId": 44,
|
||||
"taskTitle": "Implement Task Automation with Webhooks and Event Triggers",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "The current 7 subtasks for implementing task automation with webhooks appear comprehensive. Consider if any additional subtasks are needed for security testing, rate limiting implementation, or webhook monitoring tools.",
|
||||
"reasoning": "This task involves creating a sophisticated event system with webhooks for integration with external services. The complexity is high due to the need for secure authentication, reliable delivery mechanisms, and handling of various webhook formats and protocols. The existing subtasks cover the main implementation areas but security and monitoring could be emphasized more."
|
||||
},
|
||||
{
|
||||
"taskId": 45,
|
||||
"taskTitle": "Implement GitHub Issue Import Feature",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the GitHub issue import feature appear well-structured. Consider if any additional subtasks are needed for handling GitHub API rate limiting, caching, or supporting additional issue metadata.",
|
||||
"reasoning": "This task involves integrating with the GitHub API to import issues as tasks. The complexity is moderate as it requires API authentication, data mapping, and error handling. The existing 5 subtasks cover the main implementation areas from design to end-to-end implementation."
|
||||
},
|
||||
{
|
||||
"taskId": 46,
|
||||
"taskTitle": "Implement ICE Analysis Command for Task Prioritization",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the ICE analysis command appear comprehensive. Consider if any additional subtasks are needed for visualization of ICE scores or integration with other prioritization methods.",
|
||||
"reasoning": "This task involves creating an AI-powered analysis system for task prioritization using the ICE methodology. The complexity is high due to the need for sophisticated scoring algorithms, AI integration, and report generation. The existing subtasks cover the main implementation areas from algorithm design to integration with existing systems."
|
||||
},
|
||||
{
|
||||
"taskId": 47,
|
||||
"taskTitle": "Enhance Task Suggestion Actions Card Workflow",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for enhancing the task suggestion actions card workflow appear well-structured. Consider if any additional subtasks are needed for user testing, accessibility improvements, or performance optimization.",
|
||||
"reasoning": "This task involves redesigning the UI workflow for task expansion and management. The complexity is moderate as it requires careful UX design and state management but builds on existing components. The 6 existing subtasks cover the main implementation areas from design to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 48,
|
||||
"taskTitle": "Refactor Prompts into Centralized Structure",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 3,
|
||||
"expansionPrompt": "The current 3 subtasks for refactoring prompts into a centralized structure appear appropriate. Consider if any additional subtasks are needed for prompt versioning, documentation, or testing.",
|
||||
"reasoning": "This task involves a straightforward refactoring to improve code organization. The complexity is relatively low as it primarily involves moving code rather than creating new functionality. The 3 existing subtasks cover the main implementation areas from directory structure to integration."
|
||||
},
|
||||
{
|
||||
"taskId": 49,
|
||||
"taskTitle": "Implement Code Quality Analysis Command",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing the code quality analysis command appear comprehensive. Consider if any additional subtasks are needed for performance optimization with large codebases or integration with existing code quality tools.",
|
||||
"reasoning": "This task involves creating a sophisticated code analysis system with pattern recognition, best practice verification, and AI-powered recommendations. The complexity is high due to the need for code parsing, complex analysis algorithms, and integration with AI services. The existing subtasks cover the main implementation areas from algorithm design to user interface."
|
||||
},
|
||||
{
|
||||
"taskId": 50,
|
||||
"taskTitle": "Implement Test Coverage Tracking System by Task",
|
||||
"complexityScore": 9,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the test coverage tracking system appear well-structured. Consider if any additional subtasks are needed for integration with CI/CD systems, performance optimization, or visualization tools.",
|
||||
"reasoning": "This task involves creating a complex system that maps test coverage to specific tasks and subtasks. The complexity is very high due to the need for sophisticated data structures, integration with coverage tools, and AI-powered test generation. The existing subtasks are comprehensive and cover the main implementation areas from data structure design to AI integration."
|
||||
},
|
||||
{
|
||||
"taskId": 51,
|
||||
"taskTitle": "Implement Perplexity Research Command",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the Perplexity research command appear comprehensive. Consider if any additional subtasks are needed for caching optimization, result formatting, or integration with other research tools.",
|
||||
"reasoning": "This task involves creating a new command that integrates with the Perplexity AI API for research. The complexity is moderate as it requires API integration, context extraction, and result formatting. The 5 existing subtasks cover the main implementation areas from API client to caching system."
|
||||
},
|
||||
{
|
||||
"taskId": 52,
|
||||
"taskTitle": "Implement Task Suggestion Command for CLI",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the task suggestion command appear well-structured. Consider if any additional subtasks are needed for suggestion quality evaluation, user feedback collection, or integration with existing task workflows.",
|
||||
"reasoning": "This task involves creating a new CLI command that generates contextually relevant task suggestions using AI. The complexity is moderate as it requires AI integration, context collection, and interactive CLI interfaces. The existing subtasks cover the main implementation areas from data collection to user interface."
|
||||
},
|
||||
{
|
||||
"taskId": 53,
|
||||
"taskTitle": "Implement Subtask Suggestion Feature for Parent Tasks",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing the subtask suggestion feature appear comprehensive. Consider if any additional subtasks are needed for suggestion quality metrics, user feedback collection, or performance optimization.",
|
||||
"reasoning": "This task involves creating a feature that suggests contextually relevant subtasks for parent tasks. The complexity is moderate as it builds on existing task management systems but requires sophisticated AI integration and context analysis. The 6 existing subtasks cover the main implementation areas from validation to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 55,
|
||||
"taskTitle": "Implement Positional Arguments Support for CLI Commands",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing positional arguments support appear well-structured. Consider if any additional subtasks are needed for backward compatibility testing, documentation updates, or user experience improvements.",
|
||||
"reasoning": "This task involves modifying the command parsing logic to support positional arguments alongside the existing flag-based syntax. The complexity is moderate as it requires careful handling of different argument styles and edge cases. The 5 existing subtasks cover the main implementation areas from analysis to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 57,
|
||||
"taskTitle": "Enhance Task-Master CLI User Experience and Interface",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for enhancing the CLI user experience appear comprehensive. Consider if any additional subtasks are needed for accessibility testing, internationalization, or performance optimization.",
|
||||
"reasoning": "This task involves a significant overhaul of the CLI interface to improve user experience. The complexity is high due to the breadth of changes (logging, visual elements, interactive components, etc.) and the need for consistent design across all commands. The 6 existing subtasks cover the main implementation areas from log management to help systems."
|
||||
},
|
||||
{
|
||||
"taskId": 60,
|
||||
"taskTitle": "Implement Mentor System with Round-Table Discussion Feature",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "The current 7 subtasks for implementing the mentor system appear well-structured. Consider if any additional subtasks are needed for mentor personality consistency, discussion quality evaluation, or performance optimization with multiple mentors.",
|
||||
"reasoning": "This task involves creating a sophisticated mentor simulation system with round-table discussions. The complexity is high due to the need for personality simulation, complex LLM integration, and structured discussion management. The 7 existing subtasks cover the main implementation areas from architecture to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 62,
|
||||
"taskTitle": "Add --simple Flag to Update Commands for Direct Text Input",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 8,
|
||||
"expansionPrompt": "The current 8 subtasks for implementing the --simple flag appear comprehensive. Consider if any additional subtasks are needed for user experience testing or documentation updates.",
|
||||
"reasoning": "This task involves adding a simple flag option to bypass AI processing for updates. The complexity is relatively low as it primarily involves modifying existing command handlers and adding a flag. The 8 existing subtasks are very detailed and cover all aspects of implementation from command parsing to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 63,
|
||||
"taskTitle": "Add pnpm Support for the Taskmaster Package",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 8,
|
||||
"expansionPrompt": "The current 8 subtasks for adding pnpm support appear comprehensive. Consider if any additional subtasks are needed for CI/CD integration, performance comparison, or documentation updates.",
|
||||
"reasoning": "This task involves ensuring the package works correctly with pnpm as an alternative package manager. The complexity is moderate as it requires careful testing of installation processes and scripts across different environments. The 8 existing subtasks cover all major aspects from documentation to binary verification."
|
||||
},
|
||||
{
|
||||
"taskId": 64,
|
||||
"taskTitle": "Add Yarn Support for Taskmaster Installation",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 9,
|
||||
"expansionPrompt": "The current 9 subtasks for adding Yarn support appear comprehensive. Consider if any additional subtasks are needed for performance testing, CI/CD integration, or compatibility with different Yarn versions.",
|
||||
"reasoning": "This task involves ensuring the package works correctly with Yarn as an alternative package manager. The complexity is moderate as it requires careful testing of installation processes and scripts across different environments. The 9 existing subtasks are very detailed and cover all aspects from configuration to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 65,
|
||||
"taskTitle": "Add Bun Support for Taskmaster Installation",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for adding Bun support appear well-structured. Consider if any additional subtasks are needed for handling Bun-specific issues, performance testing, or documentation updates.",
|
||||
"reasoning": "This task involves adding support for the newer Bun package manager. The complexity is slightly higher than the other package manager tasks due to Bun's differences from Node.js and potential compatibility issues. The 6 existing subtasks cover the main implementation areas from research to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 67,
|
||||
"taskTitle": "Add CLI JSON output and Cursor keybindings integration",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing JSON output and Cursor keybindings appear well-structured. Consider if any additional subtasks are needed for testing across different operating systems, documentation updates, or user experience improvements.",
|
||||
"reasoning": "This task involves two distinct features: adding JSON output to CLI commands and creating a keybindings installation command. The complexity is moderate as it requires careful handling of different output formats and OS-specific file paths. The 5 existing subtasks cover the main implementation areas for both features."
|
||||
},
|
||||
{
|
||||
"taskId": 68,
|
||||
"taskTitle": "Ability to create tasks without parsing PRD",
|
||||
"complexityScore": 3,
|
||||
"recommendedSubtasks": 2,
|
||||
"expansionPrompt": "The current 2 subtasks for implementing task creation without PRD appear appropriate. Consider if any additional subtasks are needed for validation, error handling, or integration with existing task management workflows.",
|
||||
"reasoning": "This task involves a relatively simple modification to allow task creation without requiring a PRD document. The complexity is low as it primarily involves creating a form interface and saving functionality. The 2 existing subtasks cover the main implementation areas of UI design and data saving."
|
||||
},
|
||||
{
|
||||
"taskId": 72,
|
||||
"taskTitle": "Implement PDF Generation for Project Progress and Dependency Overview",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing PDF generation appear comprehensive. Consider if any additional subtasks are needed for handling large projects, additional visualization options, or integration with existing reporting tools.",
|
||||
"reasoning": "This task involves creating a feature to generate PDF reports of project progress and dependency visualization. The complexity is high due to the need for PDF generation, data collection, and visualization integration. The 6 existing subtasks cover the main implementation areas from library selection to export options."
|
||||
},
|
||||
{
|
||||
"taskId": 75,
|
||||
"taskTitle": "Integrate Google Search Grounding for Research Role",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for integrating Google Search Grounding appear well-structured. Consider if any additional subtasks are needed for testing with different query types, error handling, or performance optimization.",
|
||||
"reasoning": "This task involves updating the AI service layer to enable Google Search Grounding for research roles. The complexity is moderate as it requires careful integration with the existing AI service architecture and conditional logic. The 4 existing subtasks cover the main implementation areas from service layer modification to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 76,
|
||||
"taskTitle": "Develop E2E Test Framework for Taskmaster MCP Server (FastMCP over stdio)",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "The current 7 subtasks for developing the E2E test framework appear comprehensive. Consider if any additional subtasks are needed for test result reporting, CI/CD integration, or performance benchmarking.",
|
||||
"reasoning": "This task involves creating a sophisticated end-to-end testing framework for the MCP server. The complexity is high due to the need for subprocess management, protocol handling, and robust test case definition. The 7 existing subtasks cover the main implementation areas from architecture to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 77,
|
||||
"taskTitle": "Implement AI Usage Telemetry for Taskmaster (with external analytics endpoint)",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 18,
|
||||
"expansionPrompt": "The current 18 subtasks for implementing AI usage telemetry appear very comprehensive. Consider if any additional subtasks are needed for security hardening, privacy compliance, or user feedback collection.",
|
||||
"reasoning": "This task involves creating a telemetry system to track AI usage metrics. The complexity is high due to the need for secure data transmission, comprehensive data collection, and integration across multiple commands. The 18 existing subtasks are extremely detailed and cover all aspects of implementation from core utility to provider-specific updates."
|
||||
},
|
||||
{
|
||||
"taskId": 80,
|
||||
"taskTitle": "Implement Unique User ID Generation and Storage During Installation",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing unique user ID generation appear well-structured. Consider if any additional subtasks are needed for privacy compliance, security auditing, or integration with the telemetry system.",
|
||||
"reasoning": "This task involves generating and storing a unique user identifier during installation. The complexity is relatively low as it primarily involves UUID generation and configuration file management. The 5 existing subtasks cover the main implementation areas from script structure to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 81,
|
||||
"taskTitle": "Task #81: Implement Comprehensive Local Telemetry System with Future Server Integration Capability",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing the comprehensive local telemetry system appear well-structured. Consider if any additional subtasks are needed for data migration, storage optimization, or visualization tools.",
|
||||
"reasoning": "This task involves expanding the telemetry system to capture additional metrics and implement local storage with future server integration capability. The complexity is high due to the breadth of data collection, storage requirements, and privacy considerations. The 6 existing subtasks cover the main implementation areas from data collection to user-facing benefits."
|
||||
},
|
||||
{
|
||||
"taskId": 82,
|
||||
"taskTitle": "Update supported-models.json with token limit fields",
|
||||
"complexityScore": 3,
|
||||
"recommendedSubtasks": 1,
|
||||
"expansionPrompt": "This task appears straightforward enough to be implemented without further subtasks. Focus on researching accurate token limit values for each model and ensuring backward compatibility.",
|
||||
"reasoning": "This task involves a simple update to the supported-models.json file to include new token limit fields. The complexity is low as it primarily involves research and data entry. No subtasks are necessary as the task is well-defined and focused."
|
||||
},
|
||||
{
|
||||
"taskId": 83,
|
||||
"taskTitle": "Update config-manager.js defaults and getters",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 1,
|
||||
"expansionPrompt": "This task appears straightforward enough to be implemented without further subtasks. Focus on updating the DEFAULTS object and related getter functions while maintaining backward compatibility.",
|
||||
"reasoning": "This task involves updating the config-manager.js module to replace maxTokens with more specific token limit fields. The complexity is relatively low as it primarily involves modifying existing code rather than creating new functionality. No subtasks are necessary as the task is well-defined and focused."
|
||||
},
|
||||
{
|
||||
"taskId": 84,
|
||||
"taskTitle": "Implement token counting utility",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 1,
|
||||
"expansionPrompt": "This task appears well-defined enough to be implemented without further subtasks. Focus on implementing accurate token counting for different models and proper fallback mechanisms.",
|
||||
"reasoning": "This task involves creating a utility function to count tokens for different AI models. The complexity is moderate as it requires integration with the tiktoken library and handling different tokenization schemes. No subtasks are necessary as the task is well-defined and focused."
|
||||
},
|
||||
{
|
||||
"taskId": 69,
|
||||
"taskTitle": "Enhance Analyze Complexity for Specific Task IDs",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "Break down the task 'Enhance Analyze Complexity for Specific Task IDs' into 6 subtasks focusing on: 1) Core logic modification to accept ID parameters, 2) Report merging functionality, 3) CLI interface updates, 4) MCP tool integration, 5) Documentation updates, and 6) Comprehensive testing across all components.",
|
||||
"reasoning": "This task involves modifying existing functionality across multiple components (core logic, CLI, MCP) with complex logic for filtering tasks and merging reports. The implementation requires careful handling of different parameter combinations and edge cases. The task has interdependent components that need to work together seamlessly, and the report merging functionality adds significant complexity."
|
||||
},
|
||||
{
|
||||
"taskId": 70,
|
||||
"taskTitle": "Implement 'diagram' command for Mermaid diagram generation",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Break down the 'diagram' command implementation into 5 subtasks: 1) Command interface and parameter handling, 2) Task data extraction and transformation to Mermaid syntax, 3) Diagram rendering with status color coding, 4) Output formatting and file export functionality, and 5) Error handling and edge case management.",
|
||||
"reasoning": "This task requires implementing a new feature rather than modifying existing code, which reduces complexity from integration challenges. However, it involves working with visualization logic, dependency mapping, and multiple output formats. The color coding based on status and handling of dependency relationships adds moderate complexity. The task is well-defined but requires careful attention to diagram formatting and error handling."
|
||||
},
|
||||
{
|
||||
"taskId": 85,
|
||||
"taskTitle": "Update ai-services-unified.js for dynamic token limits",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Break down the update of ai-services-unified.js for dynamic token limits into subtasks such as: (1) Import and integrate the token counting utility, (2) Refactor _unifiedServiceRunner to calculate and enforce dynamic token limits, (3) Update error handling for token limit violations, (4) Add and verify logging for token usage, (5) Write and execute tests for various prompt and model scenarios.",
|
||||
"reasoning": "This task involves significant code changes to a core function, integration of a new utility, dynamic logic for multiple models, and robust error handling. It also requires comprehensive testing for edge cases and integration, making it moderately complex and best managed by splitting into focused subtasks."
|
||||
},
|
||||
{
|
||||
"taskId": 86,
|
||||
"taskTitle": "Update .taskmasterconfig schema and user guide",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "Expand this task into subtasks: (1) Draft a migration guide for users, (2) Update user documentation to explain new config fields, (3) Modify schema validation logic in config-manager.js, (4) Test and validate backward compatibility and error messaging.",
|
||||
"reasoning": "The task spans documentation, schema changes, migration guidance, and validation logic. While not algorithmically complex, it requires careful coordination and thorough testing to ensure a smooth user transition and robust validation."
|
||||
},
|
||||
{
|
||||
"taskId": 87,
|
||||
"taskTitle": "Implement validation and error handling",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "Decompose this task into: (1) Add validation logic for model and config loading, (2) Implement error handling and fallback mechanisms, (3) Enhance logging and reporting for token usage, (4) Develop helper functions for configuration suggestions and improvements.",
|
||||
"reasoning": "This task is primarily about adding validation, error handling, and logging. While important for robustness, the logic is straightforward and can be modularized into a few clear subtasks."
|
||||
},
|
||||
{
|
||||
"taskId": 89,
|
||||
"taskTitle": "Introduce Prioritize Command with Enhanced Priority Levels",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Expand this task into: (1) Implement the prioritize command with all required flags and shorthands, (2) Update CLI output and help documentation for new priority levels, (3) Ensure backward compatibility with existing commands, (4) Add error handling for invalid inputs, (5) Write and run tests for all command scenarios.",
|
||||
"reasoning": "This CLI feature requires command parsing, updating internal logic for new priority levels, documentation, and robust error handling. The complexity is moderate due to the need for backward compatibility and comprehensive testing."
|
||||
},
|
||||
{
|
||||
"taskId": 90,
|
||||
"taskTitle": "Implement Subtask Progress Analyzer and Reporting System",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "Break down the analyzer implementation into: (1) Design and implement progress tracking logic, (2) Develop status validation and issue detection, (3) Build the reporting system with multiple output formats, (4) Integrate analyzer with the existing task management system, (5) Optimize for performance and scalability, (6) Write unit, integration, and performance tests.",
|
||||
"reasoning": "This is a complex, multi-faceted feature involving data analysis, reporting, integration, and performance optimization. It touches many parts of the system and requires careful design, making it one of the most complex tasks in the list."
|
||||
},
|
||||
{
|
||||
"taskId": 91,
|
||||
"taskTitle": "Implement Move Command for Tasks and Subtasks",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Expand this task into: (1) Implement move logic for tasks and subtasks, (2) Handle edge cases (invalid ids, non-existent parents, circular dependencies), (3) Update CLI to support move command with flags, (4) Ensure data integrity and update relationships, (5) Write and execute tests for various move scenarios.",
|
||||
"reasoning": "Moving tasks and subtasks requires careful handling of hierarchical data, edge cases, and data integrity. The command must be robust and user-friendly, necessitating multiple focused subtasks for safe implementation."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -46,3 +46,20 @@ Generate task files from sample tasks.json data and verify the content matches t
|
||||
### Details:
|
||||
|
||||
|
||||
<info added on 2025-05-01T21:59:10.551Z>
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Implement Change Detection and Update Handling",
|
||||
"description": "Create a system to detect changes in task files and tasks.json, and handle updates bidirectionally. This includes implementing file watching or comparison mechanisms, determining which version is newer, and applying changes in the appropriate direction. Ensure the system handles edge cases like deleted files, new tasks, and conflicting changes.",
|
||||
"status": "done",
|
||||
"dependencies": [
|
||||
1,
|
||||
3,
|
||||
4,
|
||||
2
|
||||
],
|
||||
"acceptanceCriteria": "- Detects changes in both task files and tasks.json\n- Determines which version is newer based on modification timestamps or content\n- Applies changes in the appropriate direction (file to JSON or JSON to file)\n- Handles edge cases like deleted files, new tasks, and renamed tasks\n- Provides options for manual conflict resolution when necessary\n- Maintains data integrity during the synchronization process\n- Includes a command to force synchronization in either direction\n- Logs all synchronization activities for troubleshooting\n\nEach of these subtasks addresses a specific component of the task file generation system, following a logical progression from template design to bidirectional synchronization. The dependencies ensure that prerequisites are completed before dependent work begins, and the acceptance criteria provide clear guidelines for verifying each subtask's completion.",
|
||||
"details": "[2025-05-01 21:59:07] Adding another note via MCP test."
|
||||
}
|
||||
</info added on 2025-05-01T21:59:10.551Z>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 23
|
||||
# Title: Complete MCP Server Implementation for Task Master using FastMCP
|
||||
# Status: in-progress
|
||||
# Status: done
|
||||
# Dependencies: 22
|
||||
# Priority: medium
|
||||
# Description: Finalize the MCP server functionality for Task Master by leveraging FastMCP's capabilities, transitioning from CLI-based execution to direct function imports, and optimizing performance, authentication, and context management. Ensure the server integrates seamlessly with Cursor via `mcp.json` and supports proper tool registration, efficient context handling, and transport type handling (focusing on stdio). Additionally, ensure the server can be instantiated properly when installed via `npx` or `npm i -g`. Evaluate and address gaps in the current implementation, including function imports, context management, caching, tool registration, and adherence to FastMCP best practices.
|
||||
@@ -221,7 +221,7 @@ Testing approach:
|
||||
- Test error handling with invalid inputs
|
||||
- Benchmark endpoint performance
|
||||
|
||||
## 6. Refactor MCP Server to Leverage ModelContextProtocol SDK [cancelled]
|
||||
## 6. Refactor MCP Server to Leverage ModelContextProtocol SDK [done]
|
||||
### Dependencies: 23.1, 23.2, 23.3
|
||||
### Description: Integrate the ModelContextProtocol SDK directly into the MCP server implementation to streamline tool registration and resource handling.
|
||||
### Details:
|
||||
@@ -329,7 +329,7 @@ function listTasks(tasksPath, statusFilter, withSubtasks = false, outputFormat =
|
||||
7. Add cache statistics for monitoring performance
|
||||
8. Create unit tests for context management and caching functionality
|
||||
|
||||
## 10. Enhance Tool Registration and Resource Management [deferred]
|
||||
## 10. Enhance Tool Registration and Resource Management [done]
|
||||
### Dependencies: 23.1, 23.8
|
||||
### Description: Refactor tool registration to follow FastMCP best practices, using decorators and improving the overall structure. Implement proper resource management for task templates and other shared resources.
|
||||
### Details:
|
||||
@@ -412,7 +412,7 @@ Best practices for integrating resources with Task Master functionality:
|
||||
By properly implementing these resources and resource templates, we can provide rich, contextual data to LLM clients, enhancing the Task Master's capabilities and user experience.
|
||||
</info added on 2025-03-31T18:35:21.513Z>
|
||||
|
||||
## 11. Implement Comprehensive Error Handling [deferred]
|
||||
## 11. Implement Comprehensive Error Handling [done]
|
||||
### Dependencies: 23.1, 23.3
|
||||
### Description: Implement robust error handling using FastMCP's MCPError, including custom error types for different categories and standardized error responses.
|
||||
### Details:
|
||||
@@ -424,7 +424,7 @@ By properly implementing these resources and resource templates, we can provide
|
||||
### Details:
|
||||
1. Design structured log format for consistent parsing\n2. Implement different log levels (debug, info, warn, error)\n3. Add request/response logging middleware\n4. Implement correlation IDs for request tracking\n5. Add performance metrics logging\n6. Configure log output destinations (console, file)\n7. Document logging patterns and usage
|
||||
|
||||
## 13. Create Testing Framework and Test Suite [deferred]
|
||||
## 13. Create Testing Framework and Test Suite [done]
|
||||
### Dependencies: 23.1, 23.3
|
||||
### Description: Implement a comprehensive testing framework for the MCP server, including unit tests, integration tests, and end-to-end tests.
|
||||
### Details:
|
||||
@@ -436,7 +436,7 @@ By properly implementing these resources and resource templates, we can provide
|
||||
### Details:
|
||||
1. Create functionality to detect if .cursor/mcp.json exists in the project\n2. Implement logic to create a new mcp.json file with proper structure if it doesn't exist\n3. Add functionality to read and parse existing mcp.json if it exists\n4. Create method to add a new taskmaster-ai server entry to the mcpServers object\n5. Implement intelligent JSON merging that avoids trailing commas and syntax errors\n6. Ensure proper formatting and indentation in the generated/updated JSON\n7. Add validation to verify the updated configuration is valid JSON\n8. Include this functionality in the init workflow\n9. Add error handling for file system operations and JSON parsing\n10. Document the mcp.json structure and integration process
|
||||
|
||||
## 15. Implement SSE Support for Real-time Updates [deferred]
|
||||
## 15. Implement SSE Support for Real-time Updates [done]
|
||||
### Dependencies: 23.1, 23.3, 23.11
|
||||
### Description: Add Server-Sent Events (SSE) capabilities to the MCP server to enable real-time updates and streaming of task execution progress, logs, and status changes to clients
|
||||
### Details:
|
||||
@@ -923,7 +923,7 @@ Following MCP implementation standards:
|
||||
8. Update tests to reflect the new naming conventions
|
||||
9. Create a linting rule to enforce naming conventions in future development
|
||||
|
||||
## 34. Review functionality of all MCP direct functions [in-progress]
|
||||
## 34. Review functionality of all MCP direct functions [done]
|
||||
### Dependencies: None
|
||||
### Description: Verify that all implemented MCP direct functions work correctly with edge cases
|
||||
### Details:
|
||||
@@ -1130,13 +1130,13 @@ By implementing these advanced techniques, task-master can achieve robust path h
|
||||
### Details:
|
||||
|
||||
|
||||
## 44. Implement init MCP command [deferred]
|
||||
## 44. Implement init MCP command [done]
|
||||
### Dependencies: None
|
||||
### Description: Create MCP tool implementation for the init command
|
||||
### Details:
|
||||
|
||||
|
||||
## 45. Support setting env variables through mcp server [pending]
|
||||
## 45. Support setting env variables through mcp server [done]
|
||||
### Dependencies: None
|
||||
### Description: currently we need to access the env variables through the env file present in the project (that we either create or find and append to). we could abstract this by allowing users to define the env vars in the mcp.json directly as folks currently do. mcp.json should then be in gitignore if thats the case. but for this i think in fastmcp all we need is to access ENV in a specific way. we need to find that way and then implement it
|
||||
### Details:
|
||||
603
.taskmaster/tasks/task_024.txt
Normal file
603
.taskmaster/tasks/task_024.txt
Normal file
@@ -0,0 +1,603 @@
|
||||
# Task ID: 24
|
||||
# Title: Implement AI-Powered Test Generation Command
|
||||
# Status: pending
|
||||
# Dependencies: 22
|
||||
# Priority: high
|
||||
# Description: Create a new 'generate-test' command in Task Master that leverages AI to automatically produce Jest test files for tasks based on their descriptions and subtasks, utilizing Claude API for AI integration.
|
||||
# Details:
|
||||
Implement a new command in the Task Master CLI that generates comprehensive Jest test files for tasks. The command should be callable as 'task-master generate-test --id=1' and should:
|
||||
|
||||
1. Accept a task ID parameter to identify which task to generate tests for
|
||||
2. Retrieve the task and its subtasks from the task store
|
||||
3. Analyze the task description, details, and subtasks to understand implementation requirements
|
||||
4. Construct an appropriate prompt for the AI service using Claude API
|
||||
5. Process the AI response to create a well-formatted test file named 'task_XXX.test.ts' where XXX is the zero-padded task ID
|
||||
6. Include appropriate test cases that cover the main functionality described in the task
|
||||
7. Generate mocks for external dependencies identified in the task description
|
||||
8. Create assertions that validate the expected behavior
|
||||
9. Handle both parent tasks and subtasks appropriately (for subtasks, name the file 'task_XXX_YYY.test.ts' where YYY is the subtask ID)
|
||||
10. Include error handling for API failures, invalid task IDs, etc.
|
||||
11. Add appropriate documentation for the command in the help system
|
||||
|
||||
The implementation should utilize the Claude API for AI service integration and maintain consistency with the current command structure and error handling patterns. Consider using TypeScript for better type safety and integration with the Claude API.
|
||||
|
||||
# Test Strategy:
|
||||
Testing for this feature should include:
|
||||
|
||||
1. Unit tests for the command handler function to verify it correctly processes arguments and options
|
||||
2. Mock tests for the Claude API integration to ensure proper prompt construction and response handling
|
||||
3. Integration tests that verify the end-to-end flow using a mock Claude API response
|
||||
4. Tests for error conditions including:
|
||||
- Invalid task IDs
|
||||
- Network failures when contacting the AI service
|
||||
- Malformed AI responses
|
||||
- File system permission issues
|
||||
5. Verification that generated test files follow Jest conventions and can be executed
|
||||
6. Tests for both parent task and subtask handling
|
||||
7. Manual verification of the quality of generated tests by running them against actual task implementations
|
||||
|
||||
Create a test fixture with sample tasks of varying complexity to evaluate the test generation capabilities across different scenarios. The tests should verify that the command outputs appropriate success/error messages to the console and creates files in the expected location with proper content structure.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Create command structure for 'generate-test' [pending]
|
||||
### Dependencies: None
|
||||
### Description: Implement the basic structure for the 'generate-test' command, including command registration, parameter validation, and help documentation.
|
||||
### Details:
|
||||
Implementation steps:
|
||||
1. Create a new file `src/commands/generate-test.ts`
|
||||
2. Implement the command structure following the pattern of existing commands
|
||||
3. Register the new command in the CLI framework
|
||||
4. Add command options for task ID (--id=X) parameter
|
||||
5. Implement parameter validation to ensure a valid task ID is provided
|
||||
6. Add help documentation for the command
|
||||
7. Create the basic command flow that retrieves the task from the task store
|
||||
8. Implement error handling for invalid task IDs and other basic errors
|
||||
|
||||
Testing approach:
|
||||
- Test command registration
|
||||
- Test parameter validation (missing ID, invalid ID format)
|
||||
- Test error handling for non-existent task IDs
|
||||
- Test basic command flow with a mock task store
|
||||
<info added on 2025-05-23T21:02:03.909Z>
|
||||
## Updated Implementation Approach
|
||||
|
||||
Based on code review findings, the implementation approach needs to be revised:
|
||||
|
||||
1. Implement the command in `scripts/modules/commands.js` instead of creating a new file
|
||||
2. Add command registration in the `registerCommands()` function (around line 482)
|
||||
3. Follow existing command structure pattern:
|
||||
```javascript
|
||||
programInstance
|
||||
.command('generate-test')
|
||||
.description('Generate test cases for a task using AI')
|
||||
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||
.option('-i, --id <id>', 'Task ID parameter')
|
||||
.option('-p, --prompt <text>', 'Additional prompt context')
|
||||
.option('-r, --research', 'Use research model')
|
||||
.action(async (options) => {
|
||||
// Implementation
|
||||
});
|
||||
```
|
||||
|
||||
4. Use the following utilities:
|
||||
- `findProjectRoot()` for resolving project paths
|
||||
- `findTaskById()` for retrieving task data
|
||||
- `chalk` for formatted console output
|
||||
|
||||
5. Implement error handling following the pattern:
|
||||
```javascript
|
||||
try {
|
||||
// Implementation
|
||||
} catch (error) {
|
||||
console.error(chalk.red(`Error generating test: ${error.message}`));
|
||||
if (error.details) {
|
||||
console.error(chalk.red(error.details));
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
```
|
||||
|
||||
6. Required imports:
|
||||
- chalk for colored output
|
||||
- path for file path operations
|
||||
- findProjectRoot and findTaskById from './utils.js'
|
||||
</info added on 2025-05-23T21:02:03.909Z>
|
||||
|
||||
## 2. Implement AI prompt construction and FastMCP integration [pending]
|
||||
### Dependencies: 24.1
|
||||
### Description: Develop the logic to analyze tasks, construct appropriate AI prompts, and interact with the AI service using FastMCP to generate test content.
|
||||
### Details:
|
||||
Implementation steps:
|
||||
1. Create a utility function to analyze task descriptions and subtasks for test requirements
|
||||
2. Implement a prompt builder that formats task information into an effective AI prompt
|
||||
3. Use FastMCP to send the prompt and receive the response
|
||||
4. Process the FastMCP response to extract the generated test code
|
||||
5. Implement error handling for FastMCP failures, rate limits, and malformed responses
|
||||
6. Add appropriate logging for the FastMCP interaction process
|
||||
|
||||
Testing approach:
|
||||
- Test prompt construction with various task types
|
||||
- Test FastMCP integration with mocked responses
|
||||
- Test error handling for FastMCP failures
|
||||
- Test response processing with sample FastMCP outputs
|
||||
<info added on 2025-05-23T21:04:33.890Z>
|
||||
## AI Integration Implementation
|
||||
|
||||
### AI Service Integration
|
||||
- Use the unified AI service layer, not FastMCP directly
|
||||
- Implement with `generateObjectService` from '../ai-services-unified.js'
|
||||
- Define Zod schema for structured test generation output:
|
||||
- testContent: Complete Jest test file content
|
||||
- fileName: Suggested filename for the test file
|
||||
- mockRequirements: External dependencies that need mocking
|
||||
|
||||
### Prompt Construction
|
||||
- Create system prompt defining AI's role as test generator
|
||||
- Build user prompt with task context (ID, title, description, details)
|
||||
- Include test strategy and subtasks context in the prompt
|
||||
- Follow patterns from add-task.js for prompt structure
|
||||
|
||||
### Task Analysis
|
||||
- Retrieve task data using `findTaskById()` from utils.js
|
||||
- Build context by analyzing task description, details, and testStrategy
|
||||
- Examine project structure for import patterns
|
||||
- Parse specific testing requirements from task.testStrategy field
|
||||
|
||||
### File System Operations
|
||||
- Determine output path in same directory as tasks.json
|
||||
- Generate standardized filename based on task ID
|
||||
- Use fs.writeFileSync for writing test content to file
|
||||
|
||||
### Error Handling & UI
|
||||
- Implement try/catch blocks for AI service calls
|
||||
- Display user-friendly error messages with chalk
|
||||
- Use loading indicators during AI processing
|
||||
- Support both research and main AI models
|
||||
|
||||
### Telemetry
|
||||
- Pass through telemetryData from AI service response
|
||||
- Display AI usage summary for CLI output
|
||||
|
||||
### Required Dependencies
|
||||
- generateObjectService from ai-services-unified.js
|
||||
- UI components (loading indicators, display functions)
|
||||
- Zod for schema validation
|
||||
- Chalk for formatted console output
|
||||
</info added on 2025-05-23T21:04:33.890Z>
|
||||
|
||||
## 3. Implement test file generation and output [pending]
|
||||
### Dependencies: 24.2
|
||||
### Description: Create functionality to format AI-generated tests into proper Jest test files and save them to the appropriate location.
|
||||
### Details:
|
||||
Implementation steps:
|
||||
1. Create a utility to format the FastMCP response into a well-structured Jest test file
|
||||
2. Implement naming logic for test files (task_XXX.test.ts for parent tasks, task_XXX_YYY.test.ts for subtasks)
|
||||
3. Add logic to determine the appropriate file path for saving the test
|
||||
4. Implement file system operations to write the test file
|
||||
5. Add validation to ensure the generated test follows Jest conventions
|
||||
6. Implement formatting of the test file for consistency with project coding standards
|
||||
7. Add user feedback about successful test generation and file location
|
||||
8. Implement handling for both parent tasks and subtasks
|
||||
|
||||
Testing approach:
|
||||
- Test file naming logic for various task/subtask combinations
|
||||
- Test file content formatting with sample FastMCP outputs
|
||||
- Test file system operations with mocked fs module
|
||||
- Test the complete flow from command input to file output
|
||||
- Verify generated tests can be executed by Jest
|
||||
<info added on 2025-05-23T21:06:32.457Z>
|
||||
## Detailed Implementation Guidelines
|
||||
|
||||
### File Naming Convention Implementation
|
||||
```javascript
|
||||
function generateTestFileName(taskId, isSubtask = false) {
|
||||
if (isSubtask) {
|
||||
// For subtasks like "24.1", generate "task_024_001.test.js"
|
||||
const [parentId, subtaskId] = taskId.split('.');
|
||||
return `task_${parentId.padStart(3, '0')}_${subtaskId.padStart(3, '0')}.test.js`;
|
||||
} else {
|
||||
// For parent tasks like "24", generate "task_024.test.js"
|
||||
return `task_${taskId.toString().padStart(3, '0')}.test.js`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### File Location Strategy
|
||||
- Place generated test files in the `tasks/` directory alongside task files
|
||||
- This ensures co-location with task documentation and simplifies implementation
|
||||
|
||||
### File Content Structure Template
|
||||
```javascript
|
||||
/**
|
||||
* Test file for Task ${taskId}: ${taskTitle}
|
||||
* Generated automatically by Task Master
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
// Additional imports based on task requirements
|
||||
|
||||
describe('Task ${taskId}: ${taskTitle}', () => {
|
||||
beforeEach(() => {
|
||||
// Setup code
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Cleanup code
|
||||
});
|
||||
|
||||
test('should ${testDescription}', () => {
|
||||
// Test implementation
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Code Formatting Standards
|
||||
- Follow project's .prettierrc configuration:
|
||||
- Tab width: 2 spaces (useTabs: true)
|
||||
- Print width: 80 characters
|
||||
- Semicolons: Required (semi: true)
|
||||
- Quotes: Single quotes (singleQuote: true)
|
||||
- Trailing commas: None (trailingComma: "none")
|
||||
- Bracket spacing: True
|
||||
- Arrow parens: Always
|
||||
|
||||
### File System Operations Implementation
|
||||
```javascript
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
// Determine output path
|
||||
const tasksDir = path.dirname(tasksPath); // Same directory as tasks.json
|
||||
const fileName = generateTestFileName(task.id, isSubtask);
|
||||
const filePath = path.join(tasksDir, fileName);
|
||||
|
||||
// Ensure directory exists
|
||||
if (!fs.existsSync(tasksDir)) {
|
||||
fs.mkdirSync(tasksDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Write test file with proper error handling
|
||||
try {
|
||||
fs.writeFileSync(filePath, formattedTestContent, 'utf8');
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to write test file: ${error.message}`);
|
||||
}
|
||||
```
|
||||
|
||||
### Error Handling for File Operations
|
||||
```javascript
|
||||
try {
|
||||
// File writing operation
|
||||
fs.writeFileSync(filePath, testContent, 'utf8');
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
throw new Error(`Directory does not exist: ${path.dirname(filePath)}`);
|
||||
} else if (error.code === 'EACCES') {
|
||||
throw new Error(`Permission denied writing to: ${filePath}`);
|
||||
} else if (error.code === 'ENOSPC') {
|
||||
throw new Error('Insufficient disk space to write test file');
|
||||
} else {
|
||||
throw new Error(`Failed to write test file: ${error.message}`);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### User Feedback Implementation
|
||||
```javascript
|
||||
// Success feedback
|
||||
console.log(chalk.green('✅ Test file generated successfully:'));
|
||||
console.log(chalk.cyan(` File: ${fileName}`));
|
||||
console.log(chalk.cyan(` Location: ${filePath}`));
|
||||
console.log(chalk.gray(` Size: ${testContent.length} characters`));
|
||||
|
||||
// Additional info
|
||||
if (mockRequirements && mockRequirements.length > 0) {
|
||||
console.log(chalk.yellow(` Mocks needed: ${mockRequirements.join(', ')}`));
|
||||
}
|
||||
```
|
||||
|
||||
### Content Validation Requirements
|
||||
1. Jest Syntax Validation:
|
||||
- Ensure proper describe/test structure
|
||||
- Validate import statements
|
||||
- Check for balanced brackets and parentheses
|
||||
|
||||
2. Code Quality Checks:
|
||||
- Verify no syntax errors
|
||||
- Ensure proper indentation
|
||||
- Check for required imports
|
||||
|
||||
3. Test Completeness:
|
||||
- At least one test case
|
||||
- Proper test descriptions
|
||||
- Appropriate assertions
|
||||
|
||||
### Required Dependencies
|
||||
```javascript
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import chalk from 'chalk';
|
||||
import { log } from '../utils.js';
|
||||
```
|
||||
|
||||
### Integration with Existing Patterns
|
||||
Follow the pattern from `generate-task-files.js`:
|
||||
1. Read task data using existing utilities
|
||||
2. Process content with proper formatting
|
||||
3. Write files with error handling
|
||||
4. Provide feedback to user
|
||||
5. Return success data for MCP integration
|
||||
</info added on 2025-05-23T21:06:32.457Z>
|
||||
<info added on 2025-05-23T21:18:25.369Z>
|
||||
## Corrected Implementation Approach
|
||||
|
||||
### Updated File Location Strategy
|
||||
|
||||
**CORRECTION**: Tests should go in `/tests/` directory, not `/tasks/` directory.
|
||||
|
||||
Based on Jest configuration analysis:
|
||||
- Jest is configured with `roots: ['<rootDir>/tests']`
|
||||
- Test pattern: `**/?(*.)+(spec|test).js`
|
||||
- Current test structure has `/tests/unit/`, `/tests/integration/`, etc.
|
||||
|
||||
### Recommended Directory Structure:
|
||||
```
|
||||
tests/
|
||||
├── unit/ # Manual unit tests
|
||||
├── integration/ # Manual integration tests
|
||||
├── generated/ # AI-generated tests
|
||||
│ ├── tasks/ # Generated task tests
|
||||
│ │ ├── task_024.test.js
|
||||
│ │ └── task_024_001.test.js
|
||||
│ └── README.md # Explains generated tests
|
||||
└── fixtures/ # Test fixtures
|
||||
```
|
||||
|
||||
### Updated File Path Logic:
|
||||
```javascript
|
||||
// Determine output path - place in tests/generated/tasks/
|
||||
const projectRoot = findProjectRoot() || '.';
|
||||
const testsDir = path.join(projectRoot, 'tests', 'generated', 'tasks');
|
||||
const fileName = generateTestFileName(task.id, isSubtask);
|
||||
const filePath = path.join(testsDir, fileName);
|
||||
|
||||
// Ensure directory structure exists
|
||||
if (!fs.existsSync(testsDir)) {
|
||||
fs.mkdirSync(testsDir, { recursive: true });
|
||||
}
|
||||
```
|
||||
|
||||
### Testing Framework Configuration
|
||||
|
||||
The generate-test command should read the configured testing framework from `.taskmasterconfig`:
|
||||
|
||||
```javascript
|
||||
// Read testing framework from config
|
||||
const config = getConfig(projectRoot);
|
||||
const testingFramework = config.testingFramework || 'jest'; // Default to Jest
|
||||
|
||||
// Generate different templates based on framework
|
||||
switch (testingFramework) {
|
||||
case 'jest':
|
||||
return generateJestTest(task, context);
|
||||
case 'mocha':
|
||||
return generateMochaTest(task, context);
|
||||
case 'vitest':
|
||||
return generateVitestTest(task, context);
|
||||
default:
|
||||
throw new Error(`Unsupported testing framework: ${testingFramework}`);
|
||||
}
|
||||
```
|
||||
|
||||
### Framework-Specific Templates
|
||||
|
||||
**Jest Template** (current):
|
||||
```javascript
|
||||
/**
|
||||
* Test file for Task ${taskId}: ${taskTitle}
|
||||
* Generated automatically by Task Master
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
// Task-specific imports
|
||||
|
||||
describe('Task ${taskId}: ${taskTitle}', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test('should ${testDescription}', () => {
|
||||
// Test implementation
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
**Mocha Template**:
|
||||
```javascript
|
||||
/**
|
||||
* Test file for Task ${taskId}: ${taskTitle}
|
||||
* Generated automatically by Task Master
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import sinon from 'sinon';
|
||||
// Task-specific imports
|
||||
|
||||
describe('Task ${taskId}: ${taskTitle}', () => {
|
||||
beforeEach(() => {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it('should ${testDescription}', () => {
|
||||
// Test implementation
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
**Vitest Template**:
|
||||
```javascript
|
||||
/**
|
||||
* Test file for Task ${taskId}: ${taskTitle}
|
||||
* Generated automatically by Task Master
|
||||
*/
|
||||
|
||||
import { describe, test, expect, vi, beforeEach } from 'vitest';
|
||||
// Task-specific imports
|
||||
|
||||
describe('Task ${taskId}: ${taskTitle}', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('should ${testDescription}', () => {
|
||||
// Test implementation
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### AI Prompt Enhancement for Mocking
|
||||
|
||||
To address the mocking challenge, enhance the AI prompt with project context:
|
||||
|
||||
```javascript
|
||||
const systemPrompt = `You are an expert at generating comprehensive test files. When generating tests, pay special attention to mocking external dependencies correctly.
|
||||
|
||||
CRITICAL MOCKING GUIDELINES:
|
||||
1. Analyze the task requirements to identify external dependencies (APIs, databases, file system, etc.)
|
||||
2. Mock external dependencies at the module level, not inline
|
||||
3. Use the testing framework's mocking utilities (jest.mock(), sinon.stub(), vi.mock())
|
||||
4. Create realistic mock data that matches the expected API responses
|
||||
5. Test both success and error scenarios for mocked dependencies
|
||||
6. Ensure mocks are cleared between tests to prevent test pollution
|
||||
|
||||
Testing Framework: ${testingFramework}
|
||||
Project Structure: ${projectStructureContext}
|
||||
`;
|
||||
```
|
||||
|
||||
### Integration with Future Features
|
||||
|
||||
This primitive command design enables:
|
||||
1. **Automatic test generation**: `task-master add-task --with-test`
|
||||
2. **Batch test generation**: `task-master generate-tests --all`
|
||||
3. **Framework-agnostic**: Support multiple testing frameworks
|
||||
4. **Smart mocking**: LLM analyzes dependencies and generates appropriate mocks
|
||||
|
||||
### Updated Implementation Requirements:
|
||||
|
||||
1. **Read testing framework** from `.taskmasterconfig`
|
||||
2. **Create tests directory structure** if it doesn't exist
|
||||
3. **Generate framework-specific templates** based on configuration
|
||||
4. **Enhanced AI prompts** with mocking best practices
|
||||
5. **Project structure analysis** for better import resolution
|
||||
6. **Mock dependency detection** from task requirements
|
||||
</info added on 2025-05-23T21:18:25.369Z>
|
||||
|
||||
## 4. Implement MCP tool integration for generate-test command [pending]
|
||||
### Dependencies: 24.3
|
||||
### Description: Create MCP server tool support for the generate-test command to enable integration with Claude Code and other MCP clients.
|
||||
### Details:
|
||||
Implementation steps:
|
||||
1. Create direct function wrapper in mcp-server/src/core/direct-functions/
|
||||
2. Create MCP tool registration in mcp-server/src/tools/
|
||||
3. Add tool to the main tools index
|
||||
4. Implement proper parameter validation and error handling
|
||||
5. Ensure telemetry data is properly passed through
|
||||
6. Add tool to MCP server registration
|
||||
|
||||
The MCP tool should support the same parameters as the CLI command:
|
||||
- id: Task ID to generate tests for
|
||||
- file: Path to tasks.json file
|
||||
- research: Whether to use research model
|
||||
- prompt: Additional context for test generation
|
||||
|
||||
Follow the existing pattern from other MCP tools like add-task.js and expand-task.js.
|
||||
|
||||
## 5. Add testing framework configuration to project initialization [pending]
|
||||
### Dependencies: 24.3
|
||||
### Description: Enhance the init.js process to let users choose their preferred testing framework (Jest, Mocha, Vitest, etc.) and store this choice in .taskmasterconfig for use by the generate-test command.
|
||||
### Details:
|
||||
Implementation requirements:
|
||||
|
||||
1. **Add Testing Framework Prompt to init.js**:
|
||||
- Add interactive prompt asking users to choose testing framework
|
||||
- Support Jest (default), Mocha + Chai, Vitest, Ava, Jasmine
|
||||
- Include brief descriptions of each framework
|
||||
- Allow --testing-framework flag for non-interactive mode
|
||||
|
||||
2. **Update .taskmasterconfig Template**:
|
||||
- Add testingFramework field to configuration file
|
||||
- Include default dependencies for each framework
|
||||
- Store framework-specific configuration options
|
||||
|
||||
3. **Framework-Specific Setup**:
|
||||
- Generate appropriate config files (jest.config.js, vitest.config.ts, etc.)
|
||||
- Add framework dependencies to package.json suggestions
|
||||
- Create sample test file for the chosen framework
|
||||
|
||||
4. **Integration Points**:
|
||||
- Ensure generate-test command reads testingFramework from config
|
||||
- Add validation to prevent conflicts between framework choices
|
||||
- Support switching frameworks later via models command or separate config command
|
||||
|
||||
This makes the generate-test command truly framework-agnostic and sets up the foundation for --with-test flags in other commands.
|
||||
<info added on 2025-05-23T21:22:02.048Z>
|
||||
# Implementation Plan for Testing Framework Integration
|
||||
|
||||
## Code Structure
|
||||
|
||||
### 1. Update init.js
|
||||
- Add testing framework prompt after addAliases prompt
|
||||
- Implement framework selection with descriptions
|
||||
- Support non-interactive mode with --testing-framework flag
|
||||
- Create setupTestingFramework() function to handle framework-specific setup
|
||||
|
||||
### 2. Create New Module Files
|
||||
- Create `scripts/modules/testing-frameworks.js` for framework templates and setup
|
||||
- Add sample test generators for each supported framework
|
||||
- Implement config file generation for each framework
|
||||
|
||||
### 3. Update Configuration Templates
|
||||
- Modify `assets/.taskmasterconfig` to include testing fields:
|
||||
```json
|
||||
"testingFramework": "{{testingFramework}}",
|
||||
"testingConfig": {
|
||||
"framework": "{{testingFramework}}",
|
||||
"setupFiles": [],
|
||||
"testDirectory": "tests",
|
||||
"testPattern": "**/*.test.js",
|
||||
"coverage": {
|
||||
"enabled": false,
|
||||
"threshold": 80
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Create Framework-Specific Templates
|
||||
- `assets/jest.config.template.js`
|
||||
- `assets/vitest.config.template.ts`
|
||||
- `assets/.mocharc.template.json`
|
||||
- `assets/ava.config.template.js`
|
||||
- `assets/jasmine.json.template`
|
||||
|
||||
### 5. Update commands.js
|
||||
- Add `--testing-framework <framework>` option to init command
|
||||
- Add validation for supported frameworks
|
||||
|
||||
## Error Handling
|
||||
- Validate selected framework against supported list
|
||||
- Handle existing config files gracefully with warning/overwrite prompt
|
||||
- Provide recovery options if framework setup fails
|
||||
- Add conflict detection for multiple testing frameworks
|
||||
|
||||
## Integration Points
|
||||
- Ensure generate-test command reads testingFramework from config
|
||||
- Prepare for future --with-test flag in other commands
|
||||
- Support framework switching via config command
|
||||
|
||||
## Testing Requirements
|
||||
- Unit tests for framework selection logic
|
||||
- Integration tests for config file generation
|
||||
- Validation tests for each supported framework
|
||||
</info added on 2025-05-23T21:22:02.048Z>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 32
|
||||
# Title: Implement "learn" Command for Automatic Cursor Rule Generation
|
||||
# Status: pending
|
||||
# Status: deferred
|
||||
# Dependencies: None
|
||||
# Priority: high
|
||||
# Description: Create a new "learn" command that analyzes Cursor's chat history and code changes to automatically generate or update rule files in the .cursor/rules directory, following the cursor_rules.mdc template format. This command will help Cursor autonomously improve its ability to follow development standards by learning from successful implementations.
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 35
|
||||
# Title: Integrate Grok3 API for Research Capabilities
|
||||
# Status: pending
|
||||
# Status: cancelled
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Replace the current Perplexity API integration with Grok3 API for all research-related functionalities while maintaining existing feature parity.
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 36
|
||||
# Title: Add Ollama Support for AI Services as Claude Alternative
|
||||
# Status: pending
|
||||
# Status: deferred
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Implement Ollama integration as an alternative to Claude for all main AI services, allowing users to run local language models instead of relying on cloud-based Claude API.
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 37
|
||||
# Title: Add Gemini Support for Main AI Services as Claude Alternative
|
||||
# Status: pending
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Implement Google's Gemini API integration as an alternative to Claude for all main AI services, allowing users to switch between different LLM providers.
|
||||
@@ -37,3 +37,29 @@ Test cases should include:
|
||||
- Running the command on tasks with existing implementation plans to ensure proper appending
|
||||
|
||||
Manually review the quality of generated plans to ensure they provide actionable, step-by-step guidance that accurately reflects the task requirements.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Retrieve Task Content [in-progress]
|
||||
### Dependencies: None
|
||||
### Description: Fetch the content of the specified task from the task management system. This includes the task title, description, and any associated details.
|
||||
### Details:
|
||||
Implement a function to retrieve task details based on a task ID. Handle cases where the task does not exist.
|
||||
|
||||
## 2. Generate Implementation Plan with AI [pending]
|
||||
### Dependencies: 40.1
|
||||
### Description: Use an AI model (Claude or Perplexity) to generate an implementation plan based on the retrieved task content. The plan should outline the steps required to complete the task.
|
||||
### Details:
|
||||
Implement logic to switch between Claude and Perplexity APIs. Handle API authentication and rate limiting. Prompt the AI model with the task content and request a detailed implementation plan.
|
||||
|
||||
## 3. Format Plan in XML [pending]
|
||||
### Dependencies: 40.2, 40.2
|
||||
### Description: Format the generated implementation plan within XML tags. Each step in the plan should be represented as an XML element with appropriate attributes.
|
||||
### Details:
|
||||
Define the XML schema for the implementation plan. Implement a function to convert the AI-generated plan into the defined XML format. Ensure proper XML syntax and validation.
|
||||
|
||||
## 4. Error Handling and Output [pending]
|
||||
### Dependencies: 40.3
|
||||
### Description: Implement error handling for all steps, including API failures and XML formatting errors. Output the formatted XML plan to the console or a file.
|
||||
### Details:
|
||||
Add try-except blocks to handle potential exceptions. Log errors for debugging. Provide informative error messages to the user. Output the XML plan in a user-friendly format.
|
||||
|
||||
373
.taskmaster/tasks/task_041.txt
Normal file
373
.taskmaster/tasks/task_041.txt
Normal file
@@ -0,0 +1,373 @@
|
||||
# Task ID: 41
|
||||
# Title: Implement Visual Task Dependency Graph in Terminal
|
||||
# Status: pending
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Create a feature that renders task dependencies as a visual graph using ASCII/Unicode characters in the terminal, with color-coded nodes representing tasks and connecting lines showing dependency relationships.
|
||||
# Details:
|
||||
This implementation should include:
|
||||
|
||||
1. Create a new command `graph` or `visualize` that displays the dependency graph.
|
||||
|
||||
2. Design an ASCII/Unicode-based graph rendering system that:
|
||||
- Represents each task as a node with its ID and abbreviated title
|
||||
- Shows dependencies as directional lines between nodes (→, ↑, ↓, etc.)
|
||||
- Uses color coding for different task statuses (e.g., green for completed, yellow for in-progress, red for blocked)
|
||||
- Handles complex dependency chains with proper spacing and alignment
|
||||
|
||||
3. Implement layout algorithms to:
|
||||
- Minimize crossing lines for better readability
|
||||
- Properly space nodes to avoid overlapping
|
||||
- Support both vertical and horizontal graph orientations (as a configurable option)
|
||||
|
||||
4. Add detection and highlighting of circular dependencies with a distinct color/pattern
|
||||
|
||||
5. Include a legend explaining the color coding and symbols used
|
||||
|
||||
6. Ensure the graph is responsive to terminal width, with options to:
|
||||
- Automatically scale to fit the current terminal size
|
||||
- Allow zooming in/out of specific sections for large graphs
|
||||
- Support pagination or scrolling for very large dependency networks
|
||||
|
||||
7. Add options to filter the graph by:
|
||||
- Specific task IDs or ranges
|
||||
- Task status
|
||||
- Dependency depth (e.g., show only direct dependencies or N levels deep)
|
||||
|
||||
8. Ensure accessibility by using distinct patterns in addition to colors for users with color vision deficiencies
|
||||
|
||||
9. Optimize performance for projects with many tasks and complex dependency relationships
|
||||
|
||||
# Test Strategy:
|
||||
1. Unit Tests:
|
||||
- Test the graph generation algorithm with various dependency structures
|
||||
- Verify correct node placement and connection rendering
|
||||
- Test circular dependency detection
|
||||
- Verify color coding matches task statuses
|
||||
|
||||
2. Integration Tests:
|
||||
- Test the command with projects of varying sizes (small, medium, large)
|
||||
- Verify correct handling of different terminal sizes
|
||||
- Test all filtering options
|
||||
|
||||
3. Visual Verification:
|
||||
- Create test cases with predefined dependency structures and verify the visual output matches expected patterns
|
||||
- Test with terminals of different sizes, including very narrow terminals
|
||||
- Verify readability of complex graphs
|
||||
|
||||
4. Edge Cases:
|
||||
- Test with no dependencies (single nodes only)
|
||||
- Test with circular dependencies
|
||||
- Test with very deep dependency chains
|
||||
- Test with wide dependency networks (many parallel tasks)
|
||||
- Test with the maximum supported number of tasks
|
||||
|
||||
5. Usability Testing:
|
||||
- Have team members use the feature and provide feedback on readability and usefulness
|
||||
- Test in different terminal emulators to ensure compatibility
|
||||
- Verify the feature works in terminals with limited color support
|
||||
|
||||
6. Performance Testing:
|
||||
- Measure rendering time for large projects
|
||||
- Ensure reasonable performance with 100+ interconnected tasks
|
||||
|
||||
# Subtasks:
|
||||
## 1. CLI Command Setup [pending]
|
||||
### Dependencies: None
|
||||
### Description: Design and implement the command-line interface for the dependency graph tool, including argument parsing and help documentation.
|
||||
### Details:
|
||||
Define commands for input file specification, output options, filtering, and other user-configurable parameters.
|
||||
<info added on 2025-05-23T21:02:26.442Z>
|
||||
Implement a new 'diagram' command (with 'graph' alias) in commands.js following the Commander.js pattern. The command should:
|
||||
|
||||
1. Import diagram-generator.js module functions for generating visual representations
|
||||
2. Support multiple visualization types with --type option:
|
||||
- dependencies: show task dependency relationships
|
||||
- subtasks: show task/subtask hierarchy
|
||||
- flow: show task workflow
|
||||
- gantt: show timeline visualization
|
||||
|
||||
3. Include the following options:
|
||||
- --task <id>: Filter diagram to show only specified task and its relationships
|
||||
- --mermaid: Output raw Mermaid markdown for external rendering
|
||||
- --visual: Render diagram directly in terminal
|
||||
- --format <format>: Output format (text, svg, png)
|
||||
|
||||
4. Implement proper error handling and validation:
|
||||
- Validate task IDs using existing taskExists() function
|
||||
- Handle invalid option combinations
|
||||
- Provide descriptive error messages
|
||||
|
||||
5. Integrate with UI components:
|
||||
- Use ui.js display functions for consistent output formatting
|
||||
- Apply chalk coloring for terminal output
|
||||
- Use boxen formatting consistent with other commands
|
||||
|
||||
6. Handle file operations:
|
||||
- Resolve file paths using findProjectRoot() pattern
|
||||
- Support saving diagrams to files when appropriate
|
||||
|
||||
7. Include comprehensive help text following the established pattern in other commands
|
||||
</info added on 2025-05-23T21:02:26.442Z>
|
||||
|
||||
## 2. Graph Layout Algorithms [pending]
|
||||
### Dependencies: 41.1
|
||||
### Description: Develop or integrate algorithms to compute optimal node and edge placement for clear and readable graph layouts in a terminal environment.
|
||||
### Details:
|
||||
Consider topological sorting, hierarchical, and force-directed layouts suitable for ASCII/Unicode rendering.
|
||||
<info added on 2025-05-23T21:02:49.434Z>
|
||||
Create a new diagram-generator.js module in the scripts/modules/ directory following Task Master's module architecture pattern. The module should include:
|
||||
|
||||
1. Core functions for generating Mermaid diagrams:
|
||||
- generateDependencyGraph(tasks, options) - creates flowchart showing task dependencies
|
||||
- generateSubtaskDiagram(task, options) - creates hierarchy diagram for subtasks
|
||||
- generateProjectFlow(tasks, options) - creates overall project workflow
|
||||
- generateGanttChart(tasks, options) - creates timeline visualization
|
||||
|
||||
2. Integration with existing Task Master data structures:
|
||||
- Use the same task object format from task-manager.js
|
||||
- Leverage dependency analysis from dependency-manager.js
|
||||
- Support complexity scores from analyze-complexity functionality
|
||||
- Handle both main tasks and subtasks with proper ID notation (parentId.subtaskId)
|
||||
|
||||
3. Layout algorithm considerations for Mermaid:
|
||||
- Topological sorting for dependency flows
|
||||
- Hierarchical layouts for subtask trees
|
||||
- Circular dependency detection and highlighting
|
||||
- Terminal width-aware formatting for ASCII fallback
|
||||
|
||||
4. Export functions following the existing module pattern at the bottom of the file
|
||||
</info added on 2025-05-23T21:02:49.434Z>
|
||||
|
||||
## 3. ASCII/Unicode Rendering Engine [pending]
|
||||
### Dependencies: 41.2
|
||||
### Description: Implement rendering logic to display the dependency graph using ASCII and Unicode characters in the terminal.
|
||||
### Details:
|
||||
Support for various node and edge styles, and ensure compatibility with different terminal types.
|
||||
<info added on 2025-05-23T21:03:10.001Z>
|
||||
Extend ui.js with diagram display functions that integrate with Task Master's existing UI patterns:
|
||||
|
||||
1. Implement core diagram display functions:
|
||||
- displayTaskDiagram(tasksPath, diagramType, options) as the main entry point
|
||||
- displayMermaidCode(mermaidCode, title) for formatted code output with boxen
|
||||
- displayDiagramLegend() to explain symbols and colors
|
||||
|
||||
2. Ensure UI consistency by:
|
||||
- Using established chalk color schemes (blue/green/yellow/red)
|
||||
- Applying boxen for consistent component formatting
|
||||
- Following existing display function patterns (displayTaskById, displayComplexityReport)
|
||||
- Utilizing cli-table3 for any diagram metadata tables
|
||||
|
||||
3. Address terminal rendering challenges:
|
||||
- Implement ASCII/Unicode fallback when Mermaid rendering isn't available
|
||||
- Respect terminal width constraints using process.stdout.columns
|
||||
- Integrate with loading indicators via startLoadingIndicator/stopLoadingIndicator
|
||||
|
||||
4. Update task file generation to include Mermaid diagram sections in individual task files
|
||||
|
||||
5. Support both CLI and MCP output formats through the outputFormat parameter
|
||||
</info added on 2025-05-23T21:03:10.001Z>
|
||||
|
||||
## 4. Color Coding Support [pending]
|
||||
### Dependencies: 41.3
|
||||
### Description: Add color coding to nodes and edges to visually distinguish types, statuses, or other attributes in the graph.
|
||||
### Details:
|
||||
Use ANSI escape codes for color; provide options for colorblind-friendly palettes.
|
||||
<info added on 2025-05-23T21:03:35.762Z>
|
||||
Integrate color coding with Task Master's existing status system:
|
||||
|
||||
1. Extend getStatusWithColor() in ui.js to support diagram contexts:
|
||||
- Add 'diagram' parameter to determine rendering context
|
||||
- Modify color intensity for better visibility in graph elements
|
||||
|
||||
2. Implement Task Master's established color scheme using ANSI codes:
|
||||
- Green (\x1b[32m) for 'done'/'completed' tasks
|
||||
- Yellow (\x1b[33m) for 'pending' tasks
|
||||
- Orange (\x1b[38;5;208m) for 'in-progress' tasks
|
||||
- Red (\x1b[31m) for 'blocked' tasks
|
||||
- Gray (\x1b[90m) for 'deferred'/'cancelled' tasks
|
||||
- Magenta (\x1b[35m) for 'review' tasks
|
||||
|
||||
3. Create diagram-specific color functions:
|
||||
- getDependencyLineColor(fromTaskStatus, toTaskStatus) - color dependency arrows based on relationship status
|
||||
- getNodeBorderColor(task) - style node borders using priority/complexity indicators
|
||||
- getSubtaskGroupColor(parentTask) - visually group related subtasks
|
||||
|
||||
4. Integrate complexity visualization:
|
||||
- Use getComplexityWithColor() for node background or border thickness
|
||||
- Map complexity scores to visual weight in the graph
|
||||
|
||||
5. Ensure accessibility:
|
||||
- Add text-based indicators (symbols like ✓, ⚠, ⏳) alongside colors
|
||||
- Implement colorblind-friendly palettes as user-selectable option
|
||||
- Include shape variations for different statuses
|
||||
|
||||
6. Follow existing ANSI patterns:
|
||||
- Maintain consistency with terminal UI color usage
|
||||
- Reuse color constants from the codebase
|
||||
|
||||
7. Support graceful degradation:
|
||||
- Check terminal capabilities using existing detection
|
||||
- Provide monochrome fallbacks with distinctive patterns
|
||||
- Use bold/underline as alternatives when colors unavailable
|
||||
</info added on 2025-05-23T21:03:35.762Z>
|
||||
|
||||
## 5. Circular Dependency Detection [pending]
|
||||
### Dependencies: 41.2
|
||||
### Description: Implement algorithms to detect and highlight circular dependencies within the graph.
|
||||
### Details:
|
||||
Clearly mark cycles in the rendered output and provide warnings or errors as appropriate.
|
||||
<info added on 2025-05-23T21:04:20.125Z>
|
||||
Integrate with Task Master's existing circular dependency detection:
|
||||
|
||||
1. Import the dependency detection logic from dependency-manager.js module
|
||||
2. Utilize the findCycles function from utils.js or dependency-manager.js
|
||||
3. Extend validateDependenciesCommand functionality to highlight cycles in diagrams
|
||||
|
||||
Visual representation in Mermaid diagrams:
|
||||
- Apply red/bold styling to nodes involved in dependency cycles
|
||||
- Add warning annotations to cyclic edges
|
||||
- Implement cycle path highlighting with distinctive line styles
|
||||
|
||||
Integration with validation workflow:
|
||||
- Execute dependency validation before diagram generation
|
||||
- Display cycle warnings consistent with existing CLI error messaging
|
||||
- Utilize chalk.red and boxen for error highlighting following established patterns
|
||||
|
||||
Add diagram legend entries that explain cycle notation and warnings
|
||||
|
||||
Ensure detection of cycles in both:
|
||||
- Main task dependencies
|
||||
- Subtask dependencies within parent tasks
|
||||
|
||||
Follow Task Master's error handling patterns for graceful cycle reporting and user notification
|
||||
</info added on 2025-05-23T21:04:20.125Z>
|
||||
|
||||
## 6. Filtering and Search Functionality [pending]
|
||||
### Dependencies: 41.1, 41.2
|
||||
### Description: Enable users to filter nodes and edges by criteria such as name, type, or dependency depth.
|
||||
### Details:
|
||||
Support command-line flags for filtering and interactive search if feasible.
|
||||
<info added on 2025-05-23T21:04:57.811Z>
|
||||
Implement MCP tool integration for task dependency visualization:
|
||||
|
||||
1. Create task_diagram.js in mcp-server/src/tools/ following existing tool patterns
|
||||
2. Implement taskDiagramDirect.js in mcp-server/src/core/direct-functions/
|
||||
3. Use Zod schema for parameter validation:
|
||||
- diagramType (dependencies, subtasks, flow, gantt)
|
||||
- taskId (optional string)
|
||||
- format (mermaid, text, json)
|
||||
- includeComplexity (boolean)
|
||||
|
||||
4. Structure response data with:
|
||||
- mermaidCode for client-side rendering
|
||||
- metadata (nodeCount, edgeCount, cycleWarnings)
|
||||
- support for both task-specific and project-wide diagrams
|
||||
|
||||
5. Integrate with session management and project root handling
|
||||
6. Implement error handling using handleApiResult pattern
|
||||
7. Register the tool in tools/index.js
|
||||
|
||||
Maintain compatibility with existing command-line flags for filtering and interactive search.
|
||||
</info added on 2025-05-23T21:04:57.811Z>
|
||||
|
||||
## 7. Accessibility Features [pending]
|
||||
### Dependencies: 41.3, 41.4
|
||||
### Description: Ensure the tool is accessible, including support for screen readers, high-contrast modes, and keyboard navigation.
|
||||
### Details:
|
||||
Provide alternative text output and ensure color is not the sole means of conveying information.
|
||||
<info added on 2025-05-23T21:05:54.584Z>
|
||||
# Accessibility and Export Integration
|
||||
|
||||
## Accessibility Features
|
||||
- Provide alternative text output for visual elements
|
||||
- Ensure color is not the sole means of conveying information
|
||||
- Support keyboard navigation through the dependency graph
|
||||
- Add screen reader compatible node descriptions
|
||||
|
||||
## Export Integration
|
||||
- Extend generateTaskFiles function in task-manager.js to include Mermaid diagram sections
|
||||
- Add Mermaid code blocks to task markdown files under ## Diagrams header
|
||||
- Follow existing task file generation patterns and markdown structure
|
||||
- Support multiple diagram types per task file:
|
||||
* Task dependencies (prerequisite relationships)
|
||||
* Subtask hierarchy visualization
|
||||
* Task flow context in project workflow
|
||||
- Integrate with existing fs module file writing operations
|
||||
- Add diagram export options to the generate command in commands.js
|
||||
- Support SVG and PNG export using Mermaid CLI when available
|
||||
- Implement error handling for diagram generation failures
|
||||
- Reference exported diagrams in task markdown with proper paths
|
||||
- Update CLI generate command with options like --include-diagrams
|
||||
</info added on 2025-05-23T21:05:54.584Z>
|
||||
|
||||
## 8. Performance Optimization [pending]
|
||||
### Dependencies: 41.2, 41.3, 41.4, 41.5, 41.6
|
||||
### Description: Profile and optimize the tool for large graphs to ensure responsive rendering and low memory usage.
|
||||
### Details:
|
||||
Implement lazy loading, efficient data structures, and parallel processing where appropriate.
|
||||
<info added on 2025-05-23T21:06:14.533Z>
|
||||
# Mermaid Library Integration and Terminal-Specific Handling
|
||||
|
||||
## Package Dependencies
|
||||
- Add mermaid package as an optional dependency in package.json for generating raw Mermaid diagram code
|
||||
- Consider mermaid-cli for SVG/PNG conversion capabilities
|
||||
- Evaluate terminal-image or similar libraries for terminals with image support
|
||||
- Explore ascii-art-ansi or box-drawing character libraries for text-only terminals
|
||||
|
||||
## Terminal Capability Detection
|
||||
- Leverage existing terminal detection from ui.js to assess rendering capabilities
|
||||
- Implement detection for:
|
||||
- iTerm2 and other terminals with image protocol support
|
||||
- Terminals with Unicode/extended character support
|
||||
- Basic terminals requiring pure ASCII output
|
||||
|
||||
## Rendering Strategy with Fallbacks
|
||||
1. Primary: Generate raw Mermaid code for user copy/paste
|
||||
2. Secondary: Render simplified ASCII tree/flow representation using box characters
|
||||
3. Tertiary: Present dependencies in tabular format for minimal terminals
|
||||
|
||||
## Implementation Approach
|
||||
- Use dynamic imports for optional rendering libraries to maintain lightweight core
|
||||
- Implement graceful degradation when optional packages aren't available
|
||||
- Follow Task Master's philosophy of minimal dependencies
|
||||
- Ensure performance optimization through lazy loading where appropriate
|
||||
- Design modular rendering components that can be swapped based on terminal capabilities
|
||||
</info added on 2025-05-23T21:06:14.533Z>
|
||||
|
||||
## 9. Documentation [pending]
|
||||
### Dependencies: 41.1, 41.2, 41.3, 41.4, 41.5, 41.6, 41.7, 41.8
|
||||
### Description: Write comprehensive user and developer documentation covering installation, usage, configuration, and extension.
|
||||
### Details:
|
||||
Include examples, troubleshooting, and contribution guidelines.
|
||||
|
||||
## 10. Testing and Validation [pending]
|
||||
### Dependencies: 41.1, 41.2, 41.3, 41.4, 41.5, 41.6, 41.7, 41.8, 41.9
|
||||
### Description: Develop automated tests for all major features, including CLI parsing, layout correctness, rendering, color coding, filtering, and cycle detection.
|
||||
### Details:
|
||||
Include unit, integration, and regression tests; validate accessibility and performance claims.
|
||||
<info added on 2025-05-23T21:08:36.329Z>
|
||||
# Documentation Tasks for Visual Task Dependency Graph
|
||||
|
||||
## User Documentation
|
||||
1. Update README.md with diagram command documentation following existing command reference format
|
||||
2. Add examples to CLI command help text in commands.js matching patterns from other commands
|
||||
3. Create docs/diagrams.md with detailed usage guide including:
|
||||
- Command examples for each diagram type
|
||||
- Mermaid code samples and output
|
||||
- Terminal compatibility notes
|
||||
- Integration with task workflow examples
|
||||
- Troubleshooting section for common diagram rendering issues
|
||||
- Accessibility features and terminal fallback options
|
||||
|
||||
## Developer Documentation
|
||||
1. Update MCP tool documentation to include the new task_diagram tool
|
||||
2. Add JSDoc comments to all new functions following existing code standards
|
||||
3. Create contributor documentation for extending diagram types
|
||||
4. Update API documentation for any new MCP interface endpoints
|
||||
|
||||
## Integration Documentation
|
||||
1. Document integration with existing commands (analyze-complexity, generate, etc.)
|
||||
2. Provide examples showing how diagrams complement other Task Master features
|
||||
</info added on 2025-05-23T21:08:36.329Z>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 43
|
||||
# Title: Add Research Flag to Add-Task Command
|
||||
# Status: pending
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Implement a '--research' flag for the add-task command that enables users to automatically generate research-related subtasks when creating a new task.
|
||||
94
.taskmaster/tasks/task_044.txt
Normal file
94
.taskmaster/tasks/task_044.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
# Task ID: 44
|
||||
# Title: Implement Task Automation with Webhooks and Event Triggers
|
||||
# Status: pending
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Design and implement a system that allows users to automate task actions through webhooks and event triggers, enabling integration with external services and automated workflows.
|
||||
# Details:
|
||||
This feature will enable users to create automated workflows based on task events and external triggers. Implementation should include:
|
||||
|
||||
1. A webhook registration system that allows users to specify URLs to be called when specific task events occur (creation, status change, completion, etc.)
|
||||
2. An event system that captures and processes all task-related events
|
||||
3. A trigger definition interface where users can define conditions for automation (e.g., 'When task X is completed, create task Y')
|
||||
4. Support for both incoming webhooks (external services triggering actions in Taskmaster) and outgoing webhooks (Taskmaster notifying external services)
|
||||
5. A secure authentication mechanism for webhook calls
|
||||
6. Rate limiting and retry logic for failed webhook deliveries
|
||||
7. Integration with the existing task management system
|
||||
8. Command-line interface for managing webhooks and triggers
|
||||
9. Payload templating system allowing users to customize the data sent in webhooks
|
||||
10. Logging system for webhook activities and failures
|
||||
|
||||
The implementation should be compatible with both the solo/local mode and the multiplayer/remote mode, with appropriate adaptations for each context. When operating in MCP mode, the system should leverage the MCP communication protocol implemented in Task #42.
|
||||
|
||||
# Test Strategy:
|
||||
Testing should verify both the functionality and security of the webhook system:
|
||||
|
||||
1. Unit tests:
|
||||
- Test webhook registration, modification, and deletion
|
||||
- Verify event capturing for all task operations
|
||||
- Test payload generation and templating
|
||||
- Validate authentication logic
|
||||
|
||||
2. Integration tests:
|
||||
- Set up a mock server to receive webhooks and verify payload contents
|
||||
- Test the complete flow from task event to webhook delivery
|
||||
- Verify rate limiting and retry behavior with intentionally failing endpoints
|
||||
- Test webhook triggers creating new tasks and modifying existing ones
|
||||
|
||||
3. Security tests:
|
||||
- Verify that authentication tokens are properly validated
|
||||
- Test for potential injection vulnerabilities in webhook payloads
|
||||
- Verify that sensitive information is not leaked in webhook payloads
|
||||
- Test rate limiting to prevent DoS attacks
|
||||
|
||||
4. Mode-specific tests:
|
||||
- Verify correct operation in both solo/local and multiplayer/remote modes
|
||||
- Test the interaction with MCP protocol when in multiplayer mode
|
||||
|
||||
5. Manual verification:
|
||||
- Set up integrations with common services (GitHub, Slack, etc.) to verify real-world functionality
|
||||
- Verify that the CLI interface for managing webhooks works as expected
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design webhook registration API endpoints [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create API endpoints for registering, updating, and deleting webhook subscriptions
|
||||
### Details:
|
||||
Implement RESTful API endpoints that allow clients to register webhook URLs, specify event types they want to subscribe to, and manage their subscriptions. Include validation for URL format, required parameters, and authentication requirements.
|
||||
|
||||
## 2. Implement webhook authentication and security measures [pending]
|
||||
### Dependencies: 44.1
|
||||
### Description: Develop security mechanisms for webhook verification and payload signing
|
||||
### Details:
|
||||
Implement signature verification using HMAC, rate limiting to prevent abuse, IP whitelisting options, and webhook secret management. Create a secure token system for webhook verification and implement TLS for all webhook communications.
|
||||
|
||||
## 3. Create event trigger definition interface [pending]
|
||||
### Dependencies: None
|
||||
### Description: Design and implement the interface for defining event triggers and conditions
|
||||
### Details:
|
||||
Develop a user interface or API that allows defining what events should trigger webhooks. Include support for conditional triggers based on event properties, filtering options, and the ability to specify payload formats.
|
||||
|
||||
## 4. Build event processing and queuing system [pending]
|
||||
### Dependencies: 44.1, 44.3
|
||||
### Description: Implement a robust system for processing and queuing events before webhook delivery
|
||||
### Details:
|
||||
Create an event queue using a message broker (like RabbitMQ or Kafka) to handle high volumes of events. Implement event deduplication, prioritization, and persistence to ensure reliable delivery even during system failures.
|
||||
|
||||
## 5. Develop webhook delivery and retry mechanism [pending]
|
||||
### Dependencies: 44.2, 44.4
|
||||
### Description: Create a reliable system for webhook delivery with retry logic and failure handling
|
||||
### Details:
|
||||
Implement exponential backoff retry logic, configurable retry attempts, and dead letter queues for failed deliveries. Add monitoring for webhook delivery success rates and performance metrics. Include timeout handling for unresponsive webhook endpoints.
|
||||
|
||||
## 6. Implement comprehensive error handling and logging [pending]
|
||||
### Dependencies: 44.5
|
||||
### Description: Create robust error handling, logging, and monitoring for the webhook system
|
||||
### Details:
|
||||
Develop detailed error logging for webhook failures, including response codes, error messages, and timing information. Implement alerting for critical failures and create a dashboard for monitoring system health. Add debugging tools for webhook delivery issues.
|
||||
|
||||
## 7. Create webhook testing and simulation tools [pending]
|
||||
### Dependencies: 44.3, 44.5, 44.6
|
||||
### Description: Develop tools for testing webhook integrations and simulating event triggers
|
||||
### Details:
|
||||
Build a webhook testing console that allows manual triggering of events, viewing delivery history, and replaying failed webhooks. Create a webhook simulator for developers to test their endpoint implementations without generating real system events.
|
||||
|
||||
@@ -53,3 +53,35 @@ Testing should cover the following scenarios:
|
||||
- Test the interaction with other flags and commands
|
||||
|
||||
Create mock GitHub API responses for testing to avoid hitting rate limits during development and testing. Use environment variables to configure test credentials if needed.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design GitHub API integration architecture [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a technical design document outlining the architecture for GitHub API integration, including authentication flow, rate limiting considerations, and error handling strategies.
|
||||
### Details:
|
||||
Document should include: API endpoints to be used, authentication method (OAuth vs Personal Access Token), data flow diagrams, and security considerations. Research GitHub API rate limits and implement appropriate throttling mechanisms.
|
||||
|
||||
## 2. Implement GitHub URL parsing and validation [pending]
|
||||
### Dependencies: 45.1
|
||||
### Description: Create a module to parse and validate GitHub issue URLs, extracting repository owner, repository name, and issue number.
|
||||
### Details:
|
||||
Handle various GitHub URL formats (e.g., github.com/owner/repo/issues/123, github.com/owner/repo/pull/123). Implement validation to ensure the URL points to a valid issue or pull request. Return structured data with owner, repo, and issue number for valid URLs.
|
||||
|
||||
## 3. Develop GitHub API client for issue fetching [pending]
|
||||
### Dependencies: 45.1, 45.2
|
||||
### Description: Create a service to authenticate with GitHub and fetch issue details using the GitHub REST API.
|
||||
### Details:
|
||||
Implement authentication using GitHub Personal Access Tokens or OAuth. Handle API responses, including error cases (rate limiting, authentication failures, not found). Extract relevant issue data: title, description, labels, assignees, and comments.
|
||||
|
||||
## 4. Create task formatter for GitHub issues [pending]
|
||||
### Dependencies: 45.3
|
||||
### Description: Develop a formatter to convert GitHub issue data into the application's task format.
|
||||
### Details:
|
||||
Map GitHub issue fields to task fields (title, description, etc.). Convert GitHub markdown to the application's supported format. Handle special GitHub features like issue references and user mentions. Generate appropriate tags based on GitHub labels.
|
||||
|
||||
## 5. Implement end-to-end import flow with UI [pending]
|
||||
### Dependencies: 45.4
|
||||
### Description: Create the user interface and workflow for importing GitHub issues, including progress indicators and error handling.
|
||||
### Details:
|
||||
Design and implement UI for URL input and import confirmation. Show loading states during API calls. Display meaningful error messages for various failure scenarios. Allow users to review and modify imported task details before saving. Add automated tests for the entire import flow.
|
||||
|
||||
@@ -53,3 +53,35 @@ The command should follow the same design patterns as `analyze-complexity` for c
|
||||
- The ranking should prioritize high-impact, high-confidence, easy-to-implement tasks
|
||||
- Performance should be acceptable even with a large number of tasks
|
||||
- The command should handle edge cases gracefully (empty projects, missing data)
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design ICE scoring algorithm [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create the algorithm for calculating Impact, Confidence, and Ease scores for tasks
|
||||
### Details:
|
||||
Define the mathematical formula for ICE scoring (Impact × Confidence × Ease). Determine the scale for each component (e.g., 1-10). Create rules for how AI will evaluate each component based on task attributes like complexity, dependencies, and descriptions. Document the scoring methodology for future reference.
|
||||
|
||||
## 2. Implement AI integration for ICE scoring [pending]
|
||||
### Dependencies: 46.1
|
||||
### Description: Develop the AI component that will analyze tasks and generate ICE scores
|
||||
### Details:
|
||||
Create prompts for the AI to evaluate Impact, Confidence, and Ease. Implement error handling for AI responses. Add caching to prevent redundant AI calls. Ensure the AI provides justification for each score component. Test with various task types to ensure consistent scoring.
|
||||
|
||||
## 3. Create report file generator [pending]
|
||||
### Dependencies: 46.2
|
||||
### Description: Build functionality to generate a structured report file with ICE analysis results
|
||||
### Details:
|
||||
Design the report file format (JSON, CSV, or Markdown). Implement sorting of tasks by ICE score. Include task details, individual I/C/E scores, and final ICE score in the report. Add timestamp and project metadata. Create a function to save the report to the specified location.
|
||||
|
||||
## 4. Implement CLI rendering for ICE analysis [pending]
|
||||
### Dependencies: 46.3
|
||||
### Description: Develop the command-line interface for displaying ICE analysis results
|
||||
### Details:
|
||||
Design a tabular format for displaying ICE scores in the terminal. Use color coding to highlight high/medium/low priority tasks. Implement filtering options (by score range, task type, etc.). Add sorting capabilities. Create a summary view that shows top N tasks by ICE score.
|
||||
|
||||
## 5. Integrate with existing complexity reports [pending]
|
||||
### Dependencies: 46.3, 46.4
|
||||
### Description: Connect the ICE analysis functionality with the existing complexity reporting system
|
||||
### Details:
|
||||
Modify the existing complexity report to include ICE scores. Ensure consistent formatting between complexity and ICE reports. Add cross-referencing between reports. Update the command-line help documentation. Test the integrated system with various project sizes and configurations.
|
||||
|
||||
@@ -64,3 +64,41 @@ Testing should verify the complete workflow functions correctly:
|
||||
5. Regression Testing:
|
||||
- Verify that existing functionality continues to work
|
||||
- Ensure compatibility with keyboard shortcuts and accessibility features
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design Task Expansion UI Components [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create UI components for the expanded task suggestion actions card that allow for task breakdown and additional context input.
|
||||
### Details:
|
||||
Design mockups for expanded card view, including subtask creation interface, context input fields, and task management controls. Ensure the design is consistent with existing UI patterns and responsive across different screen sizes. Include animations for card expansion/collapse.
|
||||
|
||||
## 2. Implement State Management for Task Expansion [pending]
|
||||
### Dependencies: 47.1
|
||||
### Description: Develop the state management logic to handle expanded task states, subtask creation, and context additions.
|
||||
### Details:
|
||||
Create state handlers for expanded/collapsed states, subtask array management, and context data. Implement proper validation for user inputs and error handling. Ensure state persistence across user sessions and synchronization with backend services.
|
||||
|
||||
## 3. Build Context Addition Functionality [pending]
|
||||
### Dependencies: 47.2
|
||||
### Description: Create the functionality that allows users to add additional context to tasks and subtasks.
|
||||
### Details:
|
||||
Implement context input fields with support for rich text, attachments, links, and references to other tasks. Add auto-save functionality for context changes and version history if applicable. Include context suggestion features based on task content.
|
||||
|
||||
## 4. Develop Task Management Controls [pending]
|
||||
### Dependencies: 47.2
|
||||
### Description: Implement controls for managing tasks within the expanded card view, including prioritization, scheduling, and assignment.
|
||||
### Details:
|
||||
Create UI controls for task prioritization (drag-and-drop ranking), deadline setting with calendar integration, assignee selection with user search, and status updates. Implement notification triggers for task changes and deadline reminders.
|
||||
|
||||
## 5. Integrate with Existing Task Systems [pending]
|
||||
### Dependencies: 47.3, 47.4
|
||||
### Description: Ensure the enhanced actions card workflow integrates seamlessly with existing task management functionality.
|
||||
### Details:
|
||||
Connect the new UI components to existing backend APIs. Update data models if necessary to support new features. Ensure compatibility with existing task filters, search, and reporting features. Implement data migration plan for existing tasks if needed.
|
||||
|
||||
## 6. Test and Optimize User Experience [pending]
|
||||
### Dependencies: 47.5
|
||||
### Description: Conduct thorough testing of the enhanced workflow and optimize based on user feedback and performance metrics.
|
||||
### Details:
|
||||
Perform usability testing with representative users. Collect metrics on task completion time, error rates, and user satisfaction. Optimize performance for large task lists and complex subtask hierarchies. Implement A/B testing for alternative UI approaches if needed.
|
||||
|
||||
@@ -42,3 +42,23 @@ Testing should verify that the refactoring maintains identical functionality whi
|
||||
4. Documentation:
|
||||
- Verify documentation is updated to reflect the new prompt organization
|
||||
- Confirm the index.js export pattern works as expected for importing prompts
|
||||
|
||||
# Subtasks:
|
||||
## 1. Create prompts directory structure [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a centralized 'prompts' directory with appropriate subdirectories for different prompt categories
|
||||
### Details:
|
||||
Create a 'prompts' directory at the project root. Within this directory, create subdirectories based on functional categories (e.g., 'core', 'agents', 'utils'). Add an index.js file in each subdirectory to facilitate imports. Create a root index.js file that re-exports all prompts for easy access.
|
||||
|
||||
## 2. Extract prompts into individual files [pending]
|
||||
### Dependencies: 48.1
|
||||
### Description: Identify all hardcoded prompts in the codebase and extract them into individual files in the prompts directory
|
||||
### Details:
|
||||
Search through the codebase for all hardcoded prompt strings. For each prompt, create a new file in the appropriate subdirectory with a descriptive name (e.g., 'taskBreakdownPrompt.js'). Format each file to export the prompt string as a constant. Add JSDoc comments to document the purpose and expected usage of each prompt.
|
||||
|
||||
## 3. Update functions to import prompts [pending]
|
||||
### Dependencies: 48.1, 48.2
|
||||
### Description: Modify all functions that use hardcoded prompts to import them from the centralized structure
|
||||
### Details:
|
||||
For each function that previously used a hardcoded prompt, add an import statement to pull in the prompt from the centralized structure. Test each function after modification to ensure it still works correctly. Update any tests that might be affected by the refactoring. Create a pull request with the changes and document the new prompt structure in the project documentation.
|
||||
|
||||
@@ -64,3 +64,41 @@ Testing should verify all aspects of the code analysis command:
|
||||
- Generated recommendations are specific and actionable
|
||||
- Created tasks follow the project's task format standards
|
||||
- Analysis results are consistent across multiple runs on the same codebase
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design pattern recognition algorithm [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create an algorithm to identify common code patterns and anti-patterns in the codebase
|
||||
### Details:
|
||||
Develop a system that can scan code files and identify common design patterns (Factory, Singleton, etc.) and anti-patterns (God objects, excessive coupling, etc.). Include detection for language-specific patterns and create a classification system for identified patterns.
|
||||
|
||||
## 2. Implement best practice verification [pending]
|
||||
### Dependencies: 49.1
|
||||
### Description: Build verification checks against established coding standards and best practices
|
||||
### Details:
|
||||
Create a framework to compare code against established best practices for the specific language/framework. Include checks for naming conventions, function length, complexity metrics, comment coverage, and other industry-standard quality indicators.
|
||||
|
||||
## 3. Develop AI integration for code analysis [pending]
|
||||
### Dependencies: 49.1, 49.2
|
||||
### Description: Integrate AI capabilities to enhance code analysis and provide intelligent recommendations
|
||||
### Details:
|
||||
Connect to AI services (like OpenAI) to analyze code beyond rule-based checks. Configure the AI to understand context, project-specific patterns, and provide nuanced analysis that rule-based systems might miss.
|
||||
|
||||
## 4. Create recommendation generation system [pending]
|
||||
### Dependencies: 49.2, 49.3
|
||||
### Description: Build a system to generate actionable improvement recommendations based on analysis results
|
||||
### Details:
|
||||
Develop algorithms to transform analysis results into specific, actionable recommendations. Include priority levels, effort estimates, and potential impact assessments for each recommendation.
|
||||
|
||||
## 5. Implement task creation functionality [pending]
|
||||
### Dependencies: 49.4
|
||||
### Description: Add capability to automatically create tasks from code quality recommendations
|
||||
### Details:
|
||||
Build functionality to convert recommendations into tasks in the project management system. Include appropriate metadata, assignee suggestions based on code ownership, and integration with existing workflow systems.
|
||||
|
||||
## 6. Create comprehensive reporting interface [pending]
|
||||
### Dependencies: 49.4, 49.5
|
||||
### Description: Develop a user interface to display analysis results and recommendations
|
||||
### Details:
|
||||
Build a dashboard showing code quality metrics, identified patterns, recommendations, and created tasks. Include filtering options, trend analysis over time, and the ability to drill down into specific issues with code snippets and explanations.
|
||||
|
||||
452
.taskmaster/tasks/task_051.txt
Normal file
452
.taskmaster/tasks/task_051.txt
Normal file
@@ -0,0 +1,452 @@
|
||||
# Task ID: 51
|
||||
# Title: Implement Perplexity Research Command
|
||||
# Status: pending
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Create an interactive REPL-style chat interface for AI-powered research that maintains conversation context, integrates project information, and provides session management capabilities.
|
||||
# Details:
|
||||
Develop an interactive REPL-style chat interface for AI-powered research that allows users to have ongoing research conversations with context awareness. The system should:
|
||||
|
||||
1. Create an interactive REPL using inquirer that:
|
||||
- Maintains conversation history and context
|
||||
- Provides a natural chat-like experience
|
||||
- Supports special commands with the '/' prefix
|
||||
|
||||
2. Integrate with the existing ai-services-unified.js using research mode:
|
||||
- Leverage our unified AI service architecture
|
||||
- Configure appropriate system prompts for research context
|
||||
- Handle streaming responses for real-time feedback
|
||||
|
||||
3. Support multiple context sources:
|
||||
- Task/subtask IDs for project context
|
||||
- File paths for code or document context
|
||||
- Custom prompts for specific research directions
|
||||
- Project file tree for system context
|
||||
|
||||
4. Implement chat commands including:
|
||||
- `/save` - Save conversation to file
|
||||
- `/task` - Associate with or load context from a task
|
||||
- `/help` - Show available commands and usage
|
||||
- `/exit` - End the research session
|
||||
- `/copy` - Copy last response to clipboard
|
||||
- `/summary` - Generate summary of conversation
|
||||
- `/detail` - Adjust research depth level
|
||||
|
||||
5. Create session management capabilities:
|
||||
- Generate and track unique session IDs
|
||||
- Save/load sessions automatically
|
||||
- Browse and switch between previous sessions
|
||||
- Export sessions to portable formats
|
||||
|
||||
6. Design a consistent UI using ui.js patterns:
|
||||
- Color-coded messages for user/AI distinction
|
||||
- Support for markdown rendering in terminal
|
||||
- Progressive display of AI responses
|
||||
- Clear visual hierarchy and readability
|
||||
|
||||
7. Follow the "taskmaster way":
|
||||
- Create something new and exciting
|
||||
- Focus on usefulness and practicality
|
||||
- Avoid over-engineering
|
||||
- Maintain consistency with existing patterns
|
||||
|
||||
The REPL should feel like a natural conversation while providing powerful research capabilities that integrate seamlessly with the rest of the system.
|
||||
|
||||
# Test Strategy:
|
||||
1. Unit tests:
|
||||
- Test the REPL command parsing and execution
|
||||
- Mock AI service responses to test different scenarios
|
||||
- Verify context extraction and integration from various sources
|
||||
- Test session serialization and deserialization
|
||||
|
||||
2. Integration tests:
|
||||
- Test actual AI service integration with the REPL
|
||||
- Verify session persistence across application restarts
|
||||
- Test conversation state management with long interactions
|
||||
- Verify context switching between different tasks and files
|
||||
|
||||
3. User acceptance testing:
|
||||
- Have team members use the REPL for real research needs
|
||||
- Test the conversation flow and command usability
|
||||
- Verify the UI is intuitive and responsive
|
||||
- Test with various terminal sizes and environments
|
||||
|
||||
4. Performance testing:
|
||||
- Measure and optimize response time for queries
|
||||
- Test behavior with large conversation histories
|
||||
- Verify performance with complex context sources
|
||||
- Test under poor network conditions
|
||||
|
||||
5. Specific test scenarios:
|
||||
- Verify markdown rendering for complex formatting
|
||||
- Test streaming display with various response lengths
|
||||
- Verify export features create properly formatted files
|
||||
- Test session recovery from simulated crashes
|
||||
- Validate handling of special characters and unicode
|
||||
|
||||
# Subtasks:
|
||||
## 1. Create Perplexity API Client Service [cancelled]
|
||||
### Dependencies: None
|
||||
### Description: Develop a service module that handles all interactions with the Perplexity AI API, including authentication, request formatting, and response handling.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a new service file `services/perplexityService.js`
|
||||
2. Implement authentication using the PERPLEXITY_API_KEY from environment variables
|
||||
3. Create functions for making API requests to Perplexity with proper error handling:
|
||||
- `queryPerplexity(searchQuery, options)` - Main function to query the API
|
||||
- `handleRateLimiting(response)` - Logic to handle rate limits with exponential backoff
|
||||
4. Implement response parsing and formatting functions
|
||||
5. Add proper error handling for network issues, authentication problems, and API limitations
|
||||
6. Create a simple caching mechanism using a Map or object to store recent query results
|
||||
7. Add configuration options for different detail levels (quick vs comprehensive)
|
||||
|
||||
Testing approach:
|
||||
- Write unit tests using Jest to verify API client functionality with mocked responses
|
||||
- Test error handling with simulated network failures
|
||||
- Verify caching mechanism works correctly
|
||||
- Test with various query types and options
|
||||
<info added on 2025-05-23T21:06:45.726Z>
|
||||
DEPRECATION NOTICE: This subtask is no longer needed and has been marked for removal. Instead of creating a new Perplexity service, we will leverage the existing ai-services-unified.js with research mode. This approach allows us to maintain a unified architecture for AI services rather than implementing a separate service specifically for Perplexity.
|
||||
</info added on 2025-05-23T21:06:45.726Z>
|
||||
|
||||
## 2. Implement Task Context Extraction Logic [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create utility functions to extract relevant context from tasks and subtasks to enhance research queries with project-specific information.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a new utility file `utils/contextExtractor.js`
|
||||
2. Implement a function `extractTaskContext(taskId)` that:
|
||||
- Loads the task/subtask data from tasks.json
|
||||
- Extracts relevant information (title, description, details)
|
||||
- Formats the extracted information into a context string for research
|
||||
3. Add logic to handle both task and subtask IDs
|
||||
4. Implement a function to combine extracted context with the user's search query
|
||||
5. Create a function to identify and extract key terminology from tasks
|
||||
6. Add functionality to include parent task context when a subtask ID is provided
|
||||
7. Implement proper error handling for invalid task IDs
|
||||
|
||||
Testing approach:
|
||||
- Write unit tests to verify context extraction from sample tasks
|
||||
- Test with various task structures and content types
|
||||
- Verify error handling for missing or invalid tasks
|
||||
- Test the quality of extracted context with sample queries
|
||||
<info added on 2025-05-23T21:11:44.560Z>
|
||||
Updated Implementation Approach:
|
||||
|
||||
REFACTORED IMPLEMENTATION:
|
||||
1. Extract the fuzzy search logic from add-task.js (lines ~240-400) into `utils/contextExtractor.js`
|
||||
2. Implement a reusable `TaskContextExtractor` class with the following methods:
|
||||
- `extractTaskContext(taskId)` - Base context extraction
|
||||
- `performFuzzySearch(query, options)` - Enhanced Fuse.js implementation
|
||||
- `getRelevanceScore(task, query)` - Scoring mechanism from add-task.js
|
||||
- `detectPurposeCategories(task)` - Category classification logic
|
||||
- `findRelatedTasks(taskId)` - Identify dependencies and relationships
|
||||
- `aggregateMultiQueryContext(queries)` - Support for multiple search terms
|
||||
|
||||
3. Add configurable context depth levels:
|
||||
- Minimal: Just task title and description
|
||||
- Standard: Include details and immediate relationships
|
||||
- Comprehensive: Full context with all dependencies and related tasks
|
||||
|
||||
4. Implement context formatters:
|
||||
- `formatForSystemPrompt(context)` - Structured for AI system instructions
|
||||
- `formatForChatContext(context)` - Conversational format for chat
|
||||
- `formatForResearchQuery(context, query)` - Optimized for research commands
|
||||
|
||||
5. Add caching layer for performance optimization:
|
||||
- Implement LRU cache for expensive fuzzy search results
|
||||
- Cache invalidation on task updates
|
||||
|
||||
6. Ensure backward compatibility with existing context extraction requirements
|
||||
|
||||
This approach leverages our existing sophisticated search logic rather than rebuilding from scratch, while making it more flexible and reusable across the application.
|
||||
</info added on 2025-05-23T21:11:44.560Z>
|
||||
|
||||
## 3. Build Research Command CLI Interface [pending]
|
||||
### Dependencies: 51.1, 51.2
|
||||
### Description: Implement the Commander.js command structure for the 'research' command with all required options and parameters.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a new command file `commands/research.js`
|
||||
2. Set up the Commander.js command structure with the following options:
|
||||
- Required search query parameter
|
||||
- `--task` or `-t` option for task/subtask ID
|
||||
- `--prompt` or `-p` option for custom research prompt
|
||||
- `--save` or `-s` option to save results to a file
|
||||
- `--copy` or `-c` option to copy results to clipboard
|
||||
- `--summary` or `-m` option to generate a summary
|
||||
- `--detail` or `-d` option to set research depth (default: medium)
|
||||
3. Implement command validation logic
|
||||
4. Connect the command to the Perplexity service created in subtask 1
|
||||
5. Integrate the context extraction logic from subtask 2
|
||||
6. Register the command in the main CLI application
|
||||
7. Add help text and examples
|
||||
|
||||
Testing approach:
|
||||
- Test command registration and option parsing
|
||||
- Verify command validation logic works correctly
|
||||
- Test with various combinations of options
|
||||
- Ensure proper error messages for invalid inputs
|
||||
<info added on 2025-05-23T21:09:08.478Z>
|
||||
Implementation details:
|
||||
1. Create a new module `repl/research-chat.js` for the interactive research experience
|
||||
2. Implement REPL-style chat interface using inquirer with:
|
||||
- Persistent conversation history management
|
||||
- Context-aware prompting system
|
||||
- Command parsing for special instructions
|
||||
3. Implement REPL commands:
|
||||
- `/save` - Save conversation to file
|
||||
- `/task` - Associate with or load context from a task
|
||||
- `/help` - Show available commands and usage
|
||||
- `/exit` - End the research session
|
||||
- `/copy` - Copy last response to clipboard
|
||||
- `/summary` - Generate summary of conversation
|
||||
- `/detail` - Adjust research depth level
|
||||
4. Create context initialization system:
|
||||
- Task/subtask context loading
|
||||
- File content integration
|
||||
- System prompt configuration
|
||||
5. Integrate with ai-services-unified.js research mode
|
||||
6. Implement conversation state management:
|
||||
- Track message history
|
||||
- Maintain context window
|
||||
- Handle context pruning for long conversations
|
||||
7. Design consistent UI patterns using ui.js library
|
||||
8. Add entry point in main CLI application
|
||||
|
||||
Testing approach:
|
||||
- Test REPL command parsing and execution
|
||||
- Verify context initialization with various inputs
|
||||
- Test conversation state management
|
||||
- Ensure proper error handling and recovery
|
||||
- Validate UI consistency across different terminal environments
|
||||
</info added on 2025-05-23T21:09:08.478Z>
|
||||
|
||||
## 4. Implement Results Processing and Output Formatting [pending]
|
||||
### Dependencies: 51.1, 51.3
|
||||
### Description: Create functionality to process, format, and display research results in the terminal with options for saving, copying, and summarizing.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a new module `utils/researchFormatter.js`
|
||||
2. Implement terminal output formatting with:
|
||||
- Color-coded sections for better readability
|
||||
- Proper text wrapping for terminal width
|
||||
- Highlighting of key points
|
||||
3. Add functionality to save results to a file:
|
||||
- Create a `research-results` directory if it doesn't exist
|
||||
- Save results with timestamp and query in filename
|
||||
- Support multiple formats (text, markdown, JSON)
|
||||
4. Implement clipboard copying using a library like `clipboardy`
|
||||
5. Create a summarization function that extracts key points from research results
|
||||
6. Add progress indicators during API calls
|
||||
7. Implement pagination for long results
|
||||
|
||||
Testing approach:
|
||||
- Test output formatting with various result lengths and content types
|
||||
- Verify file saving functionality creates proper files with correct content
|
||||
- Test clipboard functionality
|
||||
- Verify summarization produces useful results
|
||||
<info added on 2025-05-23T21:10:00.181Z>
|
||||
Implementation details:
|
||||
1. Create a new module `utils/chatFormatter.js` for REPL interface formatting
|
||||
2. Implement terminal output formatting for conversational display:
|
||||
- Color-coded messages distinguishing user inputs and AI responses
|
||||
- Proper text wrapping and indentation for readability
|
||||
- Support for markdown rendering in terminal
|
||||
- Visual indicators for system messages and status updates
|
||||
3. Implement streaming/progressive display of AI responses:
|
||||
- Character-by-character or chunk-by-chunk display
|
||||
- Cursor animations during response generation
|
||||
- Ability to interrupt long responses
|
||||
4. Design chat history visualization:
|
||||
- Scrollable history with clear message boundaries
|
||||
- Timestamp display options
|
||||
- Session identification
|
||||
5. Create specialized formatters for different content types:
|
||||
- Code blocks with syntax highlighting
|
||||
- Bulleted and numbered lists
|
||||
- Tables and structured data
|
||||
- Citations and references
|
||||
6. Implement export functionality:
|
||||
- Save conversations to markdown or text files
|
||||
- Export individual responses
|
||||
- Copy responses to clipboard
|
||||
7. Adapt existing ui.js patterns for conversational context:
|
||||
- Maintain consistent styling while supporting chat flow
|
||||
- Handle multi-turn context appropriately
|
||||
|
||||
Testing approach:
|
||||
- Test streaming display with various response lengths and speeds
|
||||
- Verify markdown rendering accuracy for complex formatting
|
||||
- Test history navigation and scrolling functionality
|
||||
- Verify export features create properly formatted files
|
||||
- Test display on various terminal sizes and configurations
|
||||
- Verify handling of special characters and unicode
|
||||
</info added on 2025-05-23T21:10:00.181Z>
|
||||
|
||||
## 5. Implement Caching and Results Management System [cancelled]
|
||||
### Dependencies: 51.1, 51.4
|
||||
### Description: Create a persistent caching system for research results and implement functionality to manage, retrieve, and reference previous research.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a research results database using a simple JSON file or SQLite:
|
||||
- Store queries, timestamps, and results
|
||||
- Index by query and related task IDs
|
||||
2. Implement cache retrieval and validation:
|
||||
- Check for cached results before making API calls
|
||||
- Validate cache freshness with configurable TTL
|
||||
3. Add commands to manage research history:
|
||||
- List recent research queries
|
||||
- Retrieve past research by ID or search term
|
||||
- Clear cache or delete specific entries
|
||||
4. Create functionality to associate research results with tasks:
|
||||
- Add metadata linking research to specific tasks
|
||||
- Implement command to show all research related to a task
|
||||
5. Add configuration options for cache behavior in user settings
|
||||
6. Implement export/import functionality for research data
|
||||
|
||||
Testing approach:
|
||||
- Test cache storage and retrieval with various queries
|
||||
- Verify cache invalidation works correctly
|
||||
- Test history management commands
|
||||
- Verify task association functionality
|
||||
- Test with large cache sizes to ensure performance
|
||||
<info added on 2025-05-23T21:10:28.544Z>
|
||||
Implementation details:
|
||||
1. Create a session management system for the REPL experience:
|
||||
- Generate and track unique session IDs
|
||||
- Store conversation history with timestamps
|
||||
- Maintain context and state between interactions
|
||||
2. Implement session persistence:
|
||||
- Save sessions to disk automatically
|
||||
- Load previous sessions on startup
|
||||
- Handle graceful recovery from crashes
|
||||
3. Build session browser and selector:
|
||||
- List available sessions with preview
|
||||
- Filter sessions by date, topic, or content
|
||||
- Enable quick switching between sessions
|
||||
4. Implement conversation state serialization:
|
||||
- Capture full conversation context
|
||||
- Preserve user preferences per session
|
||||
- Handle state migration during updates
|
||||
5. Add session sharing capabilities:
|
||||
- Export sessions to portable formats
|
||||
- Import sessions from files
|
||||
- Generate shareable links (if applicable)
|
||||
6. Create session management commands:
|
||||
- Create new sessions
|
||||
- Clone existing sessions
|
||||
- Archive or delete old sessions
|
||||
|
||||
Testing approach:
|
||||
- Verify session persistence across application restarts
|
||||
- Test session recovery from simulated crashes
|
||||
- Validate state serialization with complex conversations
|
||||
- Ensure session switching maintains proper context
|
||||
- Test session import/export functionality
|
||||
- Verify performance with large conversation histories
|
||||
</info added on 2025-05-23T21:10:28.544Z>
|
||||
|
||||
## 6. Implement Project Context Generation [pending]
|
||||
### Dependencies: 51.2
|
||||
### Description: Create functionality to generate and include project-level context such as file trees, repository structure, and codebase insights for more informed research.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a new module `utils/projectContextGenerator.js` for project-level context extraction
|
||||
2. Implement file tree generation functionality:
|
||||
- Scan project directory structure recursively
|
||||
- Filter out irrelevant files (node_modules, .git, etc.)
|
||||
- Format file tree for AI consumption
|
||||
- Include file counts and structure statistics
|
||||
3. Add code analysis capabilities:
|
||||
- Extract key imports and dependencies
|
||||
- Identify main modules and their relationships
|
||||
- Generate high-level architecture overview
|
||||
4. Implement context summarization:
|
||||
- Create concise project overview
|
||||
- Identify key technologies and patterns
|
||||
- Summarize project purpose and structure
|
||||
5. Add caching for expensive operations:
|
||||
- Cache file tree with invalidation on changes
|
||||
- Store analysis results with TTL
|
||||
6. Create integration with research REPL:
|
||||
- Add project context to system prompts
|
||||
- Support `/project` command to refresh context
|
||||
- Allow selective inclusion of project components
|
||||
|
||||
Testing approach:
|
||||
- Test file tree generation with various project structures
|
||||
- Verify filtering logic works correctly
|
||||
- Test context summarization quality
|
||||
- Measure performance impact of context generation
|
||||
- Verify caching mechanism effectiveness
|
||||
|
||||
## 7. Create REPL Command System [pending]
|
||||
### Dependencies: 51.3
|
||||
### Description: Implement a flexible command system for the research REPL that allows users to control the conversation flow, manage sessions, and access additional functionality.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Create a new module `repl/commands.js` for REPL command handling
|
||||
2. Implement a command parser that:
|
||||
- Detects commands starting with `/`
|
||||
- Parses arguments and options
|
||||
- Handles quoted strings and special characters
|
||||
3. Create a command registry system:
|
||||
- Register command handlers with descriptions
|
||||
- Support command aliases
|
||||
- Enable command discovery and help
|
||||
4. Implement core commands:
|
||||
- `/save [filename]` - Save conversation
|
||||
- `/task <taskId>` - Load task context
|
||||
- `/file <path>` - Include file content
|
||||
- `/help [command]` - Show help
|
||||
- `/exit` - End session
|
||||
- `/copy [n]` - Copy nth response
|
||||
- `/summary` - Generate conversation summary
|
||||
- `/detail <level>` - Set detail level
|
||||
- `/clear` - Clear conversation
|
||||
- `/project` - Refresh project context
|
||||
- `/session <id|new>` - Switch/create session
|
||||
5. Add command completion and suggestions
|
||||
6. Implement error handling for invalid commands
|
||||
7. Create a help system with examples
|
||||
|
||||
Testing approach:
|
||||
- Test command parsing with various inputs
|
||||
- Verify command execution and error handling
|
||||
- Test command completion functionality
|
||||
- Verify help system provides useful information
|
||||
- Test with complex command sequences
|
||||
|
||||
## 8. Integrate with AI Services Unified [pending]
|
||||
### Dependencies: 51.3, 51.4
|
||||
### Description: Integrate the research REPL with the existing ai-services-unified.js to leverage the unified AI service architecture with research mode.
|
||||
### Details:
|
||||
Implementation details:
|
||||
1. Update `repl/research-chat.js` to integrate with ai-services-unified.js
|
||||
2. Configure research mode in AI service:
|
||||
- Set appropriate system prompts
|
||||
- Configure temperature and other parameters
|
||||
- Enable streaming responses
|
||||
3. Implement context management:
|
||||
- Format conversation history for AI context
|
||||
- Include task and project context
|
||||
- Handle context window limitations
|
||||
4. Add support for different research styles:
|
||||
- Exploratory research with broader context
|
||||
- Focused research with specific questions
|
||||
- Comparative analysis between concepts
|
||||
5. Implement response handling:
|
||||
- Process streaming chunks
|
||||
- Format and display responses
|
||||
- Handle errors and retries
|
||||
6. Add configuration options for AI service selection
|
||||
7. Implement fallback mechanisms for service unavailability
|
||||
|
||||
Testing approach:
|
||||
- Test integration with mocked AI services
|
||||
- Verify context formatting and management
|
||||
- Test streaming response handling
|
||||
- Verify error handling and recovery
|
||||
- Test with various research styles and queries
|
||||
|
||||
@@ -49,3 +49,35 @@ Testing should verify both the functionality and user experience of the suggest-
|
||||
- Test with extremely large numbers of existing tasks
|
||||
|
||||
Manually verify the command produces contextually appropriate suggestions that align with the project's current state and needs.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design data collection mechanism for existing tasks [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a module to collect and format existing task data from the system for AI processing
|
||||
### Details:
|
||||
Implement a function that retrieves all existing tasks from storage, formats them appropriately for AI context, and handles edge cases like empty task lists or corrupted data. Include metadata like task status, dependencies, and creation dates to provide rich context for suggestions.
|
||||
|
||||
## 2. Implement AI integration for task suggestions [pending]
|
||||
### Dependencies: 52.1
|
||||
### Description: Develop the core functionality to generate task suggestions using AI based on existing tasks
|
||||
### Details:
|
||||
Create an AI prompt template that effectively communicates the existing task context and request for suggestions. Implement error handling for API failures, rate limiting, and malformed responses. Include parameters for controlling suggestion quantity and specificity.
|
||||
|
||||
## 3. Build interactive CLI interface for suggestions [pending]
|
||||
### Dependencies: 52.2
|
||||
### Description: Create the command-line interface for requesting and displaying task suggestions
|
||||
### Details:
|
||||
Design a user-friendly CLI command structure with appropriate flags for customization. Implement progress indicators during AI processing and format the output of suggestions in a clear, readable format. Include help text and examples in the command documentation.
|
||||
|
||||
## 4. Implement suggestion selection and task creation [pending]
|
||||
### Dependencies: 52.3
|
||||
### Description: Allow users to interactively select suggestions to convert into actual tasks
|
||||
### Details:
|
||||
Create an interactive selection interface where users can review suggestions, select which ones to create as tasks, and optionally modify them before creation. Implement batch creation capabilities and validation to ensure new tasks meet system requirements.
|
||||
|
||||
## 5. Add configuration options and flag handling [pending]
|
||||
### Dependencies: 52.3, 52.4
|
||||
### Description: Implement various configuration options and command flags for customizing suggestion behavior
|
||||
### Details:
|
||||
Create a comprehensive set of command flags for controlling suggestion quantity, specificity, format, and other parameters. Implement persistent configuration options that users can set as defaults. Document all available options and provide examples of common usage patterns.
|
||||
|
||||
@@ -51,3 +51,41 @@ Testing should verify both the functionality and the quality of suggestions:
|
||||
- Test with a parent task that has no description
|
||||
- Test with a parent task that already has many subtasks
|
||||
- Test with a newly created system with minimal task history
|
||||
|
||||
# Subtasks:
|
||||
## 1. Implement parent task validation [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create validation logic to ensure subtasks are being added to valid parent tasks
|
||||
### Details:
|
||||
Develop functions to verify that the parent task exists in the system before allowing subtask creation. Handle error cases gracefully with informative messages. Include validation for task ID format and existence in the database.
|
||||
|
||||
## 2. Build context gathering mechanism [pending]
|
||||
### Dependencies: 53.1
|
||||
### Description: Develop a system to collect relevant context from parent task and existing subtasks
|
||||
### Details:
|
||||
Create functions to extract information from the parent task including title, description, and metadata. Also gather information about any existing subtasks to provide context for AI suggestions. Format this data appropriately for the AI prompt.
|
||||
|
||||
## 3. Develop AI suggestion logic for subtasks [pending]
|
||||
### Dependencies: 53.2
|
||||
### Description: Create the core AI integration to generate relevant subtask suggestions
|
||||
### Details:
|
||||
Implement the AI prompt engineering and response handling for subtask generation. Ensure the AI provides structured output with appropriate fields for subtasks. Include error handling for API failures and malformed responses.
|
||||
|
||||
## 4. Create interactive CLI interface [pending]
|
||||
### Dependencies: 53.3
|
||||
### Description: Build a user-friendly command-line interface for the subtask suggestion feature
|
||||
### Details:
|
||||
Develop CLI commands and options for requesting subtask suggestions. Include interactive elements for selecting, modifying, or rejecting suggested subtasks. Ensure clear user feedback throughout the process.
|
||||
|
||||
## 5. Implement subtask linking functionality [pending]
|
||||
### Dependencies: 53.4
|
||||
### Description: Create system to properly link suggested subtasks to their parent task
|
||||
### Details:
|
||||
Develop the database operations to save accepted subtasks and link them to the parent task. Include functionality for setting dependencies between subtasks. Ensure proper transaction handling to maintain data integrity.
|
||||
|
||||
## 6. Perform comprehensive testing [pending]
|
||||
### Dependencies: 53.5
|
||||
### Description: Test the subtask suggestion feature across various scenarios
|
||||
### Details:
|
||||
Create unit tests for each component. Develop integration tests for the full feature workflow. Test edge cases including invalid inputs, API failures, and unusual task structures. Document test results and fix any identified issues.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 54
|
||||
# Title: Add Research Flag to Add-Task Command
|
||||
# Status: pending
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Enhance the add-task command with a --research flag that allows users to perform quick research on the task topic before finalizing task creation.
|
||||
@@ -48,3 +48,35 @@ Testing should verify both the new positional argument functionality and continu
|
||||
- Verify examples in documentation show both styles where appropriate
|
||||
|
||||
All tests should pass with 100% of commands supporting both argument styles without any regression in existing functionality.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Analyze current CLI argument parsing structure [pending]
|
||||
### Dependencies: None
|
||||
### Description: Review the existing CLI argument parsing code to understand how arguments are currently processed and identify integration points for positional arguments.
|
||||
### Details:
|
||||
Document the current argument parsing flow, identify key classes and methods responsible for argument handling, and determine how named arguments are currently processed. Create a technical design document outlining the current architecture and proposed changes.
|
||||
|
||||
## 2. Design positional argument specification format [pending]
|
||||
### Dependencies: 55.1
|
||||
### Description: Create a specification for how positional arguments will be defined in command definitions, including their order, required/optional status, and type validation.
|
||||
### Details:
|
||||
Define a clear syntax for specifying positional arguments in command definitions. Consider how to handle mixed positional and named arguments, default values, and type constraints. Document the specification with examples for different command types.
|
||||
|
||||
## 3. Implement core positional argument parsing logic [pending]
|
||||
### Dependencies: 55.1, 55.2
|
||||
### Description: Modify the argument parser to recognize and process positional arguments according to the specification, while maintaining compatibility with existing named arguments.
|
||||
### Details:
|
||||
Update the parser to identify arguments without flags as positional, map them to the correct parameter based on order, and apply appropriate validation. Ensure the implementation handles missing required positional arguments and provides helpful error messages.
|
||||
|
||||
## 4. Handle edge cases and error conditions [pending]
|
||||
### Dependencies: 55.3
|
||||
### Description: Implement robust handling for edge cases such as too many/few arguments, type mismatches, and ambiguous situations between positional and named arguments.
|
||||
### Details:
|
||||
Create comprehensive error handling for scenarios like: providing both positional and named version of the same argument, incorrect argument types, missing required positional arguments, and excess positional arguments. Ensure error messages are clear and actionable for users.
|
||||
|
||||
## 5. Update documentation and create usage examples [pending]
|
||||
### Dependencies: 55.2, 55.3, 55.4
|
||||
### Description: Update CLI documentation to explain positional argument support and provide clear examples showing how to use positional arguments with different commands.
|
||||
### Details:
|
||||
Revise user documentation to include positional argument syntax, update command reference with positional argument information, and create example command snippets showing both positional and named argument usage. Include a migration guide for users transitioning from named-only to positional arguments.
|
||||
|
||||
32
.taskmaster/tasks/task_056.txt
Normal file
32
.taskmaster/tasks/task_056.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
# Task ID: 56
|
||||
# Title: Refactor Task-Master Files into Node Module Structure
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Restructure the task-master files by moving them from the project root into a proper node module structure to improve organization and maintainability.
|
||||
# Details:
|
||||
This task involves a significant refactoring of the task-master system to follow better Node.js module practices. Currently, task-master files are located in the project root, which creates clutter and doesn't follow best practices for Node.js applications. The refactoring should:
|
||||
|
||||
1. Create a dedicated directory structure within node_modules or as a local package
|
||||
2. Update all import/require paths throughout the codebase to reference the new module location
|
||||
3. Reorganize the files into a logical structure (lib/, utils/, commands/, etc.)
|
||||
4. Ensure the module has a proper package.json with dependencies and exports
|
||||
5. Update any build processes, scripts, or configuration files to reflect the new structure
|
||||
6. Maintain backward compatibility where possible to minimize disruption
|
||||
7. Document the new structure and any changes to usage patterns
|
||||
|
||||
This is a high-risk refactoring as it touches many parts of the system, so it should be approached methodically with frequent testing. Consider using a feature branch and implementing the changes incrementally rather than all at once.
|
||||
|
||||
# Test Strategy:
|
||||
Testing for this refactoring should be comprehensive to ensure nothing breaks during the restructuring:
|
||||
|
||||
1. Create a complete inventory of existing functionality through automated tests before starting
|
||||
2. Implement unit tests for each module to verify they function correctly in the new structure
|
||||
3. Create integration tests that verify the interactions between modules work as expected
|
||||
4. Test all CLI commands to ensure they continue to function with the new module structure
|
||||
5. Verify that all import/require statements resolve correctly
|
||||
6. Test on different environments (development, staging) to ensure compatibility
|
||||
7. Perform regression testing on all features that depend on task-master functionality
|
||||
8. Create a rollback plan and test it to ensure we can revert changes if critical issues arise
|
||||
9. Conduct performance testing to ensure the refactoring doesn't introduce overhead
|
||||
10. Have multiple developers test the changes on their local environments before merging
|
||||
105
.taskmaster/tasks/task_057.txt
Normal file
105
.taskmaster/tasks/task_057.txt
Normal file
@@ -0,0 +1,105 @@
|
||||
# Task ID: 57
|
||||
# Title: Enhance Task-Master CLI User Experience and Interface
|
||||
# Status: pending
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Improve the Task-Master CLI's user experience by refining the interface, reducing verbose logging, and adding visual polish to create a more professional and intuitive tool.
|
||||
# Details:
|
||||
The current Task-Master CLI interface is functional but lacks polish and produces excessive log output. This task involves several key improvements:
|
||||
|
||||
1. Log Management:
|
||||
- Implement log levels (ERROR, WARN, INFO, DEBUG, TRACE)
|
||||
- Only show INFO and above by default
|
||||
- Add a --verbose flag to show all logs
|
||||
- Create a dedicated log file for detailed logs
|
||||
|
||||
2. Visual Enhancements:
|
||||
- Add a clean, branded header when the tool starts
|
||||
- Implement color-coding for different types of messages (success in green, errors in red, etc.)
|
||||
- Use spinners or progress indicators for operations that take time
|
||||
- Add clear visual separation between command input and output
|
||||
|
||||
3. Interactive Elements:
|
||||
- Add loading animations for longer operations
|
||||
- Implement interactive prompts for complex inputs instead of requiring all parameters upfront
|
||||
- Add confirmation dialogs for destructive operations
|
||||
|
||||
4. Output Formatting:
|
||||
- Format task listings in tables with consistent spacing
|
||||
- Implement a compact mode and a detailed mode for viewing tasks
|
||||
- Add visual indicators for task status (icons or colors)
|
||||
|
||||
5. Help and Documentation:
|
||||
- Enhance help text with examples and clearer descriptions
|
||||
- Add contextual hints for common next steps after commands
|
||||
|
||||
Use libraries like chalk, ora, inquirer, and boxen to implement these improvements. Ensure the interface remains functional in CI/CD environments where interactive elements might not be supported.
|
||||
|
||||
# Test Strategy:
|
||||
Testing should verify both functionality and user experience improvements:
|
||||
|
||||
1. Automated Tests:
|
||||
- Create unit tests for log level filtering functionality
|
||||
- Test that all commands still function correctly with the new UI
|
||||
- Verify that non-interactive mode works in CI environments
|
||||
- Test that verbose and quiet modes function as expected
|
||||
|
||||
2. User Experience Testing:
|
||||
- Create a test script that runs through common user flows
|
||||
- Capture before/after screenshots for visual comparison
|
||||
- Measure and compare the number of lines output for common operations
|
||||
|
||||
3. Usability Testing:
|
||||
- Have 3-5 team members perform specific tasks using the new interface
|
||||
- Collect feedback on clarity, ease of use, and visual appeal
|
||||
- Identify any confusion points or areas for improvement
|
||||
|
||||
4. Edge Case Testing:
|
||||
- Test in terminals with different color schemes and sizes
|
||||
- Verify functionality in environments without color support
|
||||
- Test with very large task lists to ensure formatting remains clean
|
||||
|
||||
Acceptance Criteria:
|
||||
- Log output is reduced by at least 50% in normal operation
|
||||
- All commands provide clear visual feedback about their progress and completion
|
||||
- Help text is comprehensive and includes examples
|
||||
- Interface is visually consistent across all commands
|
||||
- Tool remains fully functional in non-interactive environments
|
||||
|
||||
# Subtasks:
|
||||
## 1. Implement Configurable Log Levels [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a logging system with different verbosity levels that users can configure
|
||||
### Details:
|
||||
Design and implement a logging system with at least 4 levels (ERROR, WARNING, INFO, DEBUG). Add command-line options to set the verbosity level. Ensure logs are color-coded by severity and can be redirected to files. Include timestamp formatting options.
|
||||
|
||||
## 2. Design Terminal Color Scheme and Visual Elements [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a consistent and accessible color scheme for the CLI interface
|
||||
### Details:
|
||||
Define a color palette that works across different terminal environments. Implement color-coding for different task states, priorities, and command categories. Add support for terminals without color capabilities. Design visual separators, headers, and footers for different output sections.
|
||||
|
||||
## 3. Implement Progress Indicators and Loading Animations [pending]
|
||||
### Dependencies: 57.2
|
||||
### Description: Add visual feedback for long-running operations
|
||||
### Details:
|
||||
Create spinner animations for operations that take time to complete. Implement progress bars for operations with known completion percentages. Ensure animations degrade gracefully in terminals with limited capabilities. Add estimated time remaining calculations where possible.
|
||||
|
||||
## 4. Develop Interactive Selection Menus [pending]
|
||||
### Dependencies: 57.2
|
||||
### Description: Create interactive menus for task selection and configuration
|
||||
### Details:
|
||||
Implement arrow-key navigation for selecting tasks from a list. Add checkbox and radio button interfaces for multi-select and single-select options. Include search/filter functionality for large task lists. Ensure keyboard shortcuts are consistent and documented.
|
||||
|
||||
## 5. Design Tabular and Structured Output Formats [pending]
|
||||
### Dependencies: 57.2
|
||||
### Description: Improve the formatting of task lists and detailed information
|
||||
### Details:
|
||||
Create table layouts with proper column alignment for task lists. Implement tree views for displaying task hierarchies and dependencies. Add support for different output formats (plain text, JSON, CSV). Ensure outputs are properly paginated for large datasets.
|
||||
|
||||
## 6. Create Help System and Interactive Documentation [pending]
|
||||
### Dependencies: 57.2, 57.4, 57.5
|
||||
### Description: Develop an in-CLI help system with examples and contextual assistance
|
||||
### Details:
|
||||
Implement a comprehensive help command with examples for each feature. Add contextual help that suggests relevant commands based on user actions. Create interactive tutorials for new users. Include command auto-completion suggestions and syntax highlighting for command examples.
|
||||
|
||||
63
.taskmaster/tasks/task_058.txt
Normal file
63
.taskmaster/tasks/task_058.txt
Normal file
@@ -0,0 +1,63 @@
|
||||
# Task ID: 58
|
||||
# Title: Implement Elegant Package Update Mechanism for Task-Master
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Create a robust update mechanism that handles package updates gracefully, ensuring all necessary files are updated when the global package is upgraded.
|
||||
# Details:
|
||||
Develop a comprehensive update system with these components:
|
||||
|
||||
1. **Update Detection**: When task-master runs, check if the current version matches the installed version. If not, notify the user an update is available.
|
||||
|
||||
2. **Update Command**: Implement a dedicated `task-master update` command that:
|
||||
- Updates the global package (`npm -g task-master-ai@latest`)
|
||||
- Automatically runs necessary initialization steps
|
||||
- Preserves user configurations while updating system files
|
||||
|
||||
3. **Smart File Management**:
|
||||
- Create a manifest of core files with checksums
|
||||
- During updates, compare existing files with the manifest
|
||||
- Only overwrite files that have changed in the update
|
||||
- Preserve user-modified files with an option to merge changes
|
||||
|
||||
4. **Configuration Versioning**:
|
||||
- Add version tracking to configuration files
|
||||
- Implement migration paths for configuration changes between versions
|
||||
- Provide backward compatibility for older configurations
|
||||
|
||||
5. **Update Notifications**:
|
||||
- Add a non-intrusive notification when updates are available
|
||||
- Include a changelog summary of what's new
|
||||
|
||||
This system should work seamlessly with the existing `task-master init` command but provide a more automated and user-friendly update experience.
|
||||
|
||||
# Test Strategy:
|
||||
Test the update mechanism with these specific scenarios:
|
||||
|
||||
1. **Version Detection Test**:
|
||||
- Install an older version, then verify the system correctly detects when a newer version is available
|
||||
- Test with minor and major version changes
|
||||
|
||||
2. **Update Command Test**:
|
||||
- Verify `task-master update` successfully updates the global package
|
||||
- Confirm all necessary files are updated correctly
|
||||
- Test with and without user-modified files present
|
||||
|
||||
3. **File Preservation Test**:
|
||||
- Modify configuration files, then update
|
||||
- Verify user changes are preserved while system files are updated
|
||||
- Test with conflicts between user changes and system updates
|
||||
|
||||
4. **Rollback Test**:
|
||||
- Implement and test a rollback mechanism if updates fail
|
||||
- Verify system returns to previous working state
|
||||
|
||||
5. **Integration Test**:
|
||||
- Create a test project with the current version
|
||||
- Run through the update process
|
||||
- Verify all functionality continues to work after update
|
||||
|
||||
6. **Edge Case Tests**:
|
||||
- Test updating with insufficient permissions
|
||||
- Test updating with network interruptions
|
||||
- Test updating from very old versions to latest
|
||||
68
.taskmaster/tasks/task_059.txt
Normal file
68
.taskmaster/tasks/task_059.txt
Normal file
@@ -0,0 +1,68 @@
|
||||
# Task ID: 59
|
||||
# Title: Remove Manual Package.json Modifications and Implement Automatic Dependency Management
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Eliminate code that manually modifies users' package.json files and implement proper npm dependency management that automatically handles package requirements when users install task-master-ai.
|
||||
# Details:
|
||||
Currently, the application is attempting to manually modify users' package.json files, which is not the recommended approach for npm packages. Instead:
|
||||
|
||||
1. Review all code that directly manipulates package.json files in users' projects
|
||||
2. Remove these manual modifications
|
||||
3. Properly define all dependencies in the package.json of task-master-ai itself
|
||||
4. Ensure all peer dependencies are correctly specified
|
||||
5. For any scripts that need to be available to users, use proper npm bin linking or npx commands
|
||||
6. Update the installation process to leverage npm's built-in dependency management
|
||||
7. If configuration is needed in users' projects, implement a proper initialization command that creates config files rather than modifying package.json
|
||||
8. Document the new approach in the README and any other relevant documentation
|
||||
|
||||
This change will make the package more reliable, follow npm best practices, and prevent potential conflicts or errors when modifying users' project files.
|
||||
|
||||
# Test Strategy:
|
||||
1. Create a fresh test project directory
|
||||
2. Install the updated task-master-ai package using npm install task-master-ai
|
||||
3. Verify that no code attempts to modify the test project's package.json
|
||||
4. Confirm all dependencies are properly installed in node_modules
|
||||
5. Test all commands to ensure they work without the previous manual package.json modifications
|
||||
6. Try installing in projects with various existing configurations to ensure no conflicts occur
|
||||
7. Test the uninstall process to verify it cleanly removes the package without leaving unwanted modifications
|
||||
8. Verify the package works in different npm environments (npm 6, 7, 8) and with different Node.js versions
|
||||
9. Create an integration test that simulates a real user workflow from installation through usage
|
||||
|
||||
# Subtasks:
|
||||
## 1. Conduct Code Audit for Dependency Management [done]
|
||||
### Dependencies: None
|
||||
### Description: Review the current codebase to identify all areas where dependencies are manually managed, modified, or referenced outside of npm best practices.
|
||||
### Details:
|
||||
Focus on scripts, configuration files, and any custom logic related to dependency installation or versioning.
|
||||
|
||||
## 2. Remove Manual Dependency Modifications [done]
|
||||
### Dependencies: 59.1
|
||||
### Description: Eliminate any custom scripts or manual steps that alter dependencies outside of npm's standard workflow.
|
||||
### Details:
|
||||
Refactor or delete code that manually installs, updates, or modifies dependencies, ensuring all dependency management is handled via npm.
|
||||
|
||||
## 3. Update npm Dependencies [done]
|
||||
### Dependencies: 59.2
|
||||
### Description: Update all project dependencies using npm, ensuring versions are current and compatible, and resolve any conflicts.
|
||||
### Details:
|
||||
Run npm update, audit for vulnerabilities, and adjust package.json and package-lock.json as needed.
|
||||
|
||||
## 4. Update Initialization and Installation Commands [done]
|
||||
### Dependencies: 59.3
|
||||
### Description: Revise project setup scripts and documentation to reflect the new npm-based dependency management approach.
|
||||
### Details:
|
||||
Ensure that all initialization commands (e.g., npm install) are up-to-date and remove references to deprecated manual steps.
|
||||
|
||||
## 5. Update Documentation [done]
|
||||
### Dependencies: 59.4
|
||||
### Description: Revise project documentation to describe the new dependency management process and provide clear setup instructions.
|
||||
### Details:
|
||||
Update README, onboarding guides, and any developer documentation to align with npm best practices.
|
||||
|
||||
## 6. Perform Regression Testing [done]
|
||||
### Dependencies: 59.5
|
||||
### Description: Run comprehensive tests to ensure that the refactor has not introduced any regressions or broken existing functionality.
|
||||
### Details:
|
||||
Execute automated and manual tests, focusing on areas affected by dependency management changes.
|
||||
|
||||
117
.taskmaster/tasks/task_060.txt
Normal file
117
.taskmaster/tasks/task_060.txt
Normal file
@@ -0,0 +1,117 @@
|
||||
# Task ID: 60
|
||||
# Title: Implement Mentor System with Round-Table Discussion Feature
|
||||
# Status: pending
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Create a mentor system that allows users to add simulated mentors to their projects and facilitate round-table discussions between these mentors to gain diverse perspectives and insights on tasks.
|
||||
# Details:
|
||||
Implement a comprehensive mentor system with the following features:
|
||||
|
||||
1. **Mentor Management**:
|
||||
- Create a `mentors.json` file to store mentor data including name, personality, expertise, and other relevant attributes
|
||||
- Implement `add-mentor` command that accepts a name and prompt describing the mentor's characteristics
|
||||
- Implement `remove-mentor` command to delete mentors from the system
|
||||
- Implement `list-mentors` command to display all configured mentors and their details
|
||||
- Set a recommended maximum of 5 mentors with appropriate warnings
|
||||
|
||||
2. **Round-Table Discussion**:
|
||||
- Create a `round-table` command with the following parameters:
|
||||
- `--prompt`: Optional text prompt to guide the discussion
|
||||
- `--id`: Optional task/subtask ID(s) to provide context (support comma-separated values)
|
||||
- `--turns`: Number of discussion rounds (each mentor speaks once per turn)
|
||||
- `--output`: Optional flag to export results to a file
|
||||
- Implement an interactive CLI experience using inquirer for the round-table
|
||||
- Generate a simulated discussion where each mentor speaks in turn based on their personality
|
||||
- After all turns complete, generate insights, recommendations, and a summary
|
||||
- Display results in the CLI
|
||||
- When `--output` is specified, create a `round-table.txt` file containing:
|
||||
- Initial prompt
|
||||
- Target task ID(s)
|
||||
- Full round-table discussion transcript
|
||||
- Recommendations and insights section
|
||||
|
||||
3. **Integration with Task System**:
|
||||
- Enhance `update`, `update-task`, and `update-subtask` commands to accept a round-table.txt file
|
||||
- Use the round-table output as input for updating tasks or subtasks
|
||||
- Allow appending round-table insights to subtasks
|
||||
|
||||
4. **LLM Integration**:
|
||||
- Configure the system to effectively simulate different personalities using LLM
|
||||
- Ensure mentors maintain consistent personalities across different round-tables
|
||||
- Implement proper context handling to ensure relevant task information is included
|
||||
|
||||
Ensure all commands have proper help text and error handling for cases like no mentors configured, invalid task IDs, etc.
|
||||
|
||||
# Test Strategy:
|
||||
1. **Unit Tests**:
|
||||
- Test mentor data structure creation and validation
|
||||
- Test mentor addition with various input formats
|
||||
- Test mentor removal functionality
|
||||
- Test listing of mentors with different configurations
|
||||
- Test round-table parameter parsing and validation
|
||||
|
||||
2. **Integration Tests**:
|
||||
- Test the complete flow of adding mentors and running a round-table
|
||||
- Test round-table with different numbers of turns
|
||||
- Test round-table with task context vs. custom prompt
|
||||
- Test output file generation and format
|
||||
- Test using round-table output to update tasks and subtasks
|
||||
|
||||
3. **Edge Cases**:
|
||||
- Test behavior when no mentors are configured but round-table is called
|
||||
- Test with invalid task IDs in the --id parameter
|
||||
- Test with extremely long discussions (many turns)
|
||||
- Test with mentors that have similar personalities
|
||||
- Test removing a mentor that doesn't exist
|
||||
- Test adding more than the recommended 5 mentors
|
||||
|
||||
4. **Manual Testing Scenarios**:
|
||||
- Create mentors with distinct personalities (e.g., Vitalik Buterin, Steve Jobs, etc.)
|
||||
- Run a round-table on a complex task and verify the insights are helpful
|
||||
- Verify the personality simulation is consistent and believable
|
||||
- Test the round-table output file readability and usefulness
|
||||
- Verify that using round-table output to update tasks produces meaningful improvements
|
||||
|
||||
# Subtasks:
|
||||
## 1. Design Mentor System Architecture [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a comprehensive architecture for the mentor system, defining data models, relationships, and interaction patterns.
|
||||
### Details:
|
||||
Define mentor profiles structure, expertise categorization, availability tracking, and relationship to user accounts. Design the database schema for storing mentor information and interactions. Create flowcharts for mentor-mentee matching algorithms and interaction workflows.
|
||||
|
||||
## 2. Implement Mentor Profile Management [pending]
|
||||
### Dependencies: 60.1
|
||||
### Description: Develop the functionality for creating, editing, and managing mentor profiles in the system.
|
||||
### Details:
|
||||
Build UI components for mentor profile creation and editing. Implement backend APIs for profile CRUD operations. Create expertise tagging system and availability calendar. Add profile verification and approval workflows for quality control.
|
||||
|
||||
## 3. Develop Round-Table Discussion Framework [pending]
|
||||
### Dependencies: 60.1
|
||||
### Description: Create the core framework for hosting and managing round-table discussions between mentors and users.
|
||||
### Details:
|
||||
Design the discussion room data model and state management. Implement discussion scheduling and participant management. Create discussion topic and agenda setting functionality. Develop discussion moderation tools and rules enforcement mechanisms.
|
||||
|
||||
## 4. Implement LLM Integration for AI Mentors [pending]
|
||||
### Dependencies: 60.3
|
||||
### Description: Integrate LLM capabilities to simulate AI mentors that can participate in round-table discussions.
|
||||
### Details:
|
||||
Select appropriate LLM models for mentor simulation. Develop prompt engineering templates for different mentor personas and expertise areas. Implement context management to maintain conversation coherence. Create fallback mechanisms for handling edge cases in discussions.
|
||||
|
||||
## 5. Build Discussion Output Formatter [pending]
|
||||
### Dependencies: 60.3, 60.4
|
||||
### Description: Create a system to format and present round-table discussion outputs in a structured, readable format.
|
||||
### Details:
|
||||
Design templates for discussion summaries and transcripts. Implement real-time formatting of ongoing discussions. Create exportable formats for discussion outcomes (PDF, markdown, etc.). Develop highlighting and annotation features for key insights.
|
||||
|
||||
## 6. Integrate Mentor System with Task Management [pending]
|
||||
### Dependencies: 60.2, 60.3
|
||||
### Description: Connect the mentor system with the existing task management functionality to enable task-specific mentoring.
|
||||
### Details:
|
||||
Create APIs to link tasks with relevant mentors based on expertise. Implement functionality to initiate discussions around specific tasks. Develop mechanisms for mentors to provide feedback and guidance on tasks. Build notification system for task-related mentor interactions.
|
||||
|
||||
## 7. Test and Optimize Round-Table Discussions [pending]
|
||||
### Dependencies: 60.4, 60.5, 60.6
|
||||
### Description: Conduct comprehensive testing of the round-table discussion feature and optimize for performance and user experience.
|
||||
### Details:
|
||||
Perform load testing with multiple concurrent discussions. Test AI mentor responses for quality and relevance. Optimize LLM usage for cost efficiency. Conduct user testing sessions and gather feedback. Implement performance monitoring and analytics for ongoing optimization.
|
||||
|
||||
2698
.taskmaster/tasks/task_061.txt
Normal file
2698
.taskmaster/tasks/task_061.txt
Normal file
File diff suppressed because it is too large
Load Diff
90
.taskmaster/tasks/task_062.txt
Normal file
90
.taskmaster/tasks/task_062.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
# Task ID: 62
|
||||
# Title: Add --simple Flag to Update Commands for Direct Text Input
|
||||
# Status: pending
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Implement a --simple flag for update-task and update-subtask commands that allows users to add timestamped notes without AI processing, directly using the text from the prompt.
|
||||
# Details:
|
||||
This task involves modifying the update-task and update-subtask commands to accept a new --simple flag option. When this flag is present, the system should bypass the AI processing pipeline and directly use the text provided by the user as the update content. The implementation should:
|
||||
|
||||
1. Update the command parsers for both update-task and update-subtask to recognize the --simple flag
|
||||
2. Modify the update logic to check for this flag and conditionally skip AI processing
|
||||
3. When the flag is present, format the user's input text with a timestamp in the same format as AI-processed updates
|
||||
4. Ensure the update is properly saved to the task or subtask's history
|
||||
5. Update the help documentation to include information about this new flag
|
||||
6. The timestamp format should match the existing format used for AI-generated updates
|
||||
7. The simple update should be visually distinguishable from AI updates in the display (consider adding a 'manual update' indicator)
|
||||
8. Maintain all existing functionality when the flag is not used
|
||||
|
||||
# Test Strategy:
|
||||
Testing should verify both the functionality and user experience of the new feature:
|
||||
|
||||
1. Unit tests:
|
||||
- Test that the command parser correctly recognizes the --simple flag
|
||||
- Verify that AI processing is bypassed when the flag is present
|
||||
- Ensure timestamps are correctly formatted and added
|
||||
|
||||
2. Integration tests:
|
||||
- Update a task with --simple flag and verify the exact text is saved
|
||||
- Update a subtask with --simple flag and verify the exact text is saved
|
||||
- Compare the output format with AI-processed updates to ensure consistency
|
||||
|
||||
3. User experience tests:
|
||||
- Verify help documentation correctly explains the new flag
|
||||
- Test with various input lengths to ensure proper formatting
|
||||
- Ensure the update appears correctly when viewing task history
|
||||
|
||||
4. Edge cases:
|
||||
- Test with empty input text
|
||||
- Test with very long input text
|
||||
- Test with special characters and formatting in the input
|
||||
|
||||
# Subtasks:
|
||||
## 1. Update command parsers to recognize --simple flag [pending]
|
||||
### Dependencies: None
|
||||
### Description: Modify the command parsers for both update-task and update-subtask commands to recognize and process the new --simple flag option.
|
||||
### Details:
|
||||
Add the --simple flag option to the command parser configurations in the CLI module. This should be implemented as a boolean flag that doesn't require any additional arguments. Update both the update-task and update-subtask command definitions to include this new option.
|
||||
|
||||
## 2. Implement conditional logic to bypass AI processing [pending]
|
||||
### Dependencies: 62.1
|
||||
### Description: Modify the update logic to check for the --simple flag and conditionally skip the AI processing pipeline when the flag is present.
|
||||
### Details:
|
||||
In the update handlers for both commands, add a condition to check if the --simple flag is set. If it is, create a path that bypasses the normal AI processing flow. This will require modifying the update functions to accept the flag parameter and branch the execution flow accordingly.
|
||||
|
||||
## 3. Format user input with timestamp for simple updates [pending]
|
||||
### Dependencies: 62.2
|
||||
### Description: Implement functionality to format the user's direct text input with a timestamp in the same format as AI-processed updates when the --simple flag is used.
|
||||
### Details:
|
||||
Create a utility function that takes the user's raw input text and prepends a timestamp in the same format used for AI-generated updates. This function should be called when the --simple flag is active. Ensure the timestamp format is consistent with the existing format used throughout the application.
|
||||
|
||||
## 4. Add visual indicator for manual updates [pending]
|
||||
### Dependencies: 62.3
|
||||
### Description: Make simple updates visually distinguishable from AI-processed updates by adding a 'manual update' indicator or other visual differentiation.
|
||||
### Details:
|
||||
Modify the update formatting to include a visual indicator (such as '[Manual Update]' prefix or different styling) when displaying updates that were created using the --simple flag. This will help users distinguish between AI-processed and manually entered updates.
|
||||
|
||||
## 5. Implement storage of simple updates in history [pending]
|
||||
### Dependencies: 62.3, 62.4
|
||||
### Description: Ensure that updates made with the --simple flag are properly saved to the task or subtask's history in the same way as AI-processed updates.
|
||||
### Details:
|
||||
Modify the storage logic to save the formatted simple updates to the task or subtask history. The storage format should be consistent with AI-processed updates, but include the manual indicator. Ensure that the update is properly associated with the correct task or subtask.
|
||||
|
||||
## 6. Update help documentation for the new flag [pending]
|
||||
### Dependencies: 62.1
|
||||
### Description: Update the help documentation for both update-task and update-subtask commands to include information about the new --simple flag.
|
||||
### Details:
|
||||
Add clear descriptions of the --simple flag to the help text for both commands. The documentation should explain that the flag allows users to add timestamped notes without AI processing, directly using the text from the prompt. Include examples of how to use the flag.
|
||||
|
||||
## 7. Implement integration tests for the simple update feature [pending]
|
||||
### Dependencies: 62.1, 62.2, 62.3, 62.4, 62.5
|
||||
### Description: Create comprehensive integration tests to verify that the --simple flag works correctly in both commands and integrates properly with the rest of the system.
|
||||
### Details:
|
||||
Develop integration tests that verify the entire flow of using the --simple flag with both update commands. Tests should confirm that updates are correctly formatted, stored, and displayed. Include edge cases such as empty input, very long input, and special characters.
|
||||
|
||||
## 8. Perform final validation and documentation [pending]
|
||||
### Dependencies: 62.1, 62.2, 62.3, 62.4, 62.5, 62.6, 62.7
|
||||
### Description: Conduct final validation of the feature across all use cases and update the user documentation to include the new functionality.
|
||||
### Details:
|
||||
Perform end-to-end testing of the feature to ensure it works correctly in all scenarios. Update the user documentation with detailed information about the new --simple flag, including its purpose, how to use it, and examples. Ensure that the documentation clearly explains the difference between AI-processed updates and simple updates.
|
||||
|
||||
138
.taskmaster/tasks/task_063.txt
Normal file
138
.taskmaster/tasks/task_063.txt
Normal file
@@ -0,0 +1,138 @@
|
||||
# Task ID: 63
|
||||
# Title: Add pnpm Support for the Taskmaster Package
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: medium
|
||||
# Description: Implement full support for pnpm as an alternative package manager in the Taskmaster application, ensuring users have the exact same experience as with npm when installing and managing the package. The installation process, including any CLI prompts or web interfaces, must serve the exact same content and user experience regardless of whether npm or pnpm is used. The project uses 'module' as the package type, defines binaries 'task-master' and 'task-master-mcp', and its core logic resides in 'scripts/modules/'. The 'init' command (via scripts/init.js) creates the directory structure (.cursor/rules, scripts, tasks), copies templates (.env.example, .gitignore, rule files, dev.js), manages package.json merging, and sets up MCP config (.cursor/mcp.json). All dependencies are standard npm dependencies listed in package.json, and manual modifications are being removed.
|
||||
# Details:
|
||||
This task involves:
|
||||
|
||||
1. Update the installation documentation to include pnpm installation commands (e.g., `pnpm add taskmaster`).
|
||||
|
||||
2. Ensure all package scripts are compatible with pnpm's execution model:
|
||||
- Review and modify package.json scripts if necessary
|
||||
- Test script execution with pnpm syntax (`pnpm run <script>`)
|
||||
- Address any pnpm-specific path or execution differences
|
||||
- Confirm that scripts responsible for showing a website or prompt during install behave identically with pnpm and npm
|
||||
|
||||
3. Create a pnpm-lock.yaml file by installing dependencies with pnpm.
|
||||
|
||||
4. Test the application's installation and operation when installed via pnpm:
|
||||
- Global installation (`pnpm add -g taskmaster`)
|
||||
- Local project installation
|
||||
- Verify CLI commands work correctly when installed with pnpm
|
||||
- Verify binaries `task-master` and `task-master-mcp` are properly linked
|
||||
- Ensure the `init` command (scripts/init.js) correctly creates directory structure and copies templates as described
|
||||
|
||||
5. Update CI/CD pipelines to include testing with pnpm:
|
||||
- Add a pnpm test matrix to GitHub Actions workflows
|
||||
- Ensure tests pass when dependencies are installed with pnpm
|
||||
|
||||
6. Handle any pnpm-specific dependency resolution issues:
|
||||
- Address potential hoisting differences between npm and pnpm
|
||||
- Test with pnpm's strict mode to ensure compatibility
|
||||
- Verify proper handling of 'module' package type
|
||||
|
||||
7. Document any pnpm-specific considerations or commands in the README and documentation.
|
||||
|
||||
8. Verify that the `scripts/init.js` file works correctly with pnpm:
|
||||
- Ensure it properly creates `.cursor/rules`, `scripts`, and `tasks` directories
|
||||
- Verify template copying (`.env.example`, `.gitignore`, rule files, `dev.js`)
|
||||
- Confirm `package.json` merging works correctly
|
||||
- Test MCP config setup (`.cursor/mcp.json`)
|
||||
|
||||
9. Ensure core logic in `scripts/modules/` works correctly when installed via pnpm.
|
||||
|
||||
This implementation should maintain full feature parity and identical user experience regardless of which package manager is used to install Taskmaster.
|
||||
|
||||
# Test Strategy:
|
||||
1. Manual Testing:
|
||||
- Install Taskmaster globally using pnpm: `pnpm add -g taskmaster`
|
||||
- Install Taskmaster locally in a test project: `pnpm add taskmaster`
|
||||
- Verify all CLI commands function correctly with both installation methods
|
||||
- Test all major features to ensure they work identically to npm installations
|
||||
- Verify binaries `task-master` and `task-master-mcp` are properly linked and executable
|
||||
- Test the `init` command to ensure it correctly sets up the directory structure and files as defined in scripts/init.js
|
||||
|
||||
2. Automated Testing:
|
||||
- Create a dedicated test workflow in GitHub Actions that uses pnpm
|
||||
- Run the full test suite using pnpm to install dependencies
|
||||
- Verify all tests pass with the same results as npm
|
||||
|
||||
3. Documentation Testing:
|
||||
- Review all documentation to ensure pnpm commands are correctly documented
|
||||
- Verify installation instructions work as written
|
||||
- Test any pnpm-specific instructions or notes
|
||||
|
||||
4. Compatibility Testing:
|
||||
- Test on different operating systems (Windows, macOS, Linux)
|
||||
- Verify compatibility with different pnpm versions (latest stable and LTS)
|
||||
- Test in environments with multiple package managers installed
|
||||
- Verify proper handling of 'module' package type
|
||||
|
||||
5. Edge Case Testing:
|
||||
- Test installation in a project that uses pnpm workspaces
|
||||
- Verify behavior when upgrading from an npm installation to pnpm
|
||||
- Test with pnpm's various flags and modes (--frozen-lockfile, --strict-peer-dependencies)
|
||||
|
||||
6. Performance Comparison:
|
||||
- Measure and document any performance differences between package managers
|
||||
- Compare installation times and disk space usage
|
||||
|
||||
7. Structure Testing:
|
||||
- Verify that the core logic in `scripts/modules/` is accessible and functions correctly
|
||||
- Confirm that the `init` command properly creates all required directories and files as per scripts/init.js
|
||||
- Test package.json merging functionality
|
||||
- Verify MCP config setup
|
||||
|
||||
Success criteria: Taskmaster should install and function identically regardless of whether it was installed via npm or pnpm, with no degradation in functionality, performance, or user experience. All binaries should be properly linked, and the directory structure should be correctly created.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Update Documentation for pnpm Support [done]
|
||||
### Dependencies: None
|
||||
### Description: Revise installation and usage documentation to include pnpm commands and instructions for installing and managing Taskmaster with pnpm. Clearly state that the installation process, including any website or UI shown, is identical to npm. Ensure documentation reflects the use of 'module' package type, binaries, and the init process as defined in scripts/init.js.
|
||||
### Details:
|
||||
Add pnpm installation commands (e.g., `pnpm add taskmaster`) and update all relevant sections in the README and official docs to reflect pnpm as a supported package manager. Document that any installation website or prompt is the same as with npm. Include notes on the 'module' package type, binaries, and the directory/template setup performed by scripts/init.js.
|
||||
|
||||
## 2. Ensure Package Scripts Compatibility with pnpm [done]
|
||||
### Dependencies: 63.1
|
||||
### Description: Review and update package.json scripts to ensure they work seamlessly with pnpm's execution model. Confirm that any scripts responsible for showing a website or prompt during install behave identically with pnpm and npm. Ensure compatibility with 'module' package type and correct binary definitions.
|
||||
### Details:
|
||||
Test all scripts using `pnpm run <script>`, address any pnpm-specific path or execution differences, and modify scripts as needed for compatibility. Pay special attention to any scripts that trigger a website or prompt during installation, ensuring they serve the same content as npm. Validate that scripts/init.js and binaries are referenced correctly for ESM ('module') projects.
|
||||
|
||||
## 3. Generate and Validate pnpm Lockfile [done]
|
||||
### Dependencies: 63.2
|
||||
### Description: Install dependencies using pnpm to create a pnpm-lock.yaml file and ensure it accurately reflects the project's dependency tree, considering the 'module' package type.
|
||||
### Details:
|
||||
Run `pnpm install` to generate the lockfile, check it into version control, and verify that dependency resolution is correct and consistent. Ensure that all dependencies listed in package.json are resolved as expected for an ESM project.
|
||||
|
||||
## 4. Test Taskmaster Installation and Operation with pnpm [done]
|
||||
### Dependencies: 63.3
|
||||
### Description: Thoroughly test Taskmaster's installation and CLI operation when installed via pnpm, both globally and locally. Confirm that any website or UI shown during installation is identical to npm. Validate that binaries and the init process (scripts/init.js) work as expected.
|
||||
### Details:
|
||||
Perform global (`pnpm add -g taskmaster`) and local installations, verify CLI commands, and check for any pnpm-specific issues or incompatibilities. Ensure any installation UIs or websites appear identical to npm installations, including any website or prompt shown during install. Test that binaries 'task-master' and 'task-master-mcp' are linked and that scripts/init.js creates the correct structure and templates.
|
||||
|
||||
## 5. Integrate pnpm into CI/CD Pipeline [done]
|
||||
### Dependencies: 63.4
|
||||
### Description: Update CI/CD workflows to include pnpm in the test matrix, ensuring all tests pass when dependencies are installed with pnpm. Confirm that tests cover the 'module' package type, binaries, and init process.
|
||||
### Details:
|
||||
Modify GitHub Actions or other CI configurations to use pnpm/action-setup, run tests with pnpm, and cache pnpm dependencies for efficiency. Ensure that CI covers CLI commands, binary linking, and the directory/template setup performed by scripts/init.js.
|
||||
|
||||
## 6. Verify Installation UI/Website Consistency [done]
|
||||
### Dependencies: 63.4
|
||||
### Description: Ensure any installation UIs, websites, or interactive prompts—including any website or prompt shown during install—appear and function identically when installing with pnpm compared to npm. Confirm that the experience is consistent for the 'module' package type and the init process.
|
||||
### Details:
|
||||
Identify all user-facing elements during the installation process, including any website or prompt shown during install, and verify they are consistent across package managers. If a website is shown during installation, ensure it appears the same regardless of package manager used. Validate that any prompts or UIs triggered by scripts/init.js are identical.
|
||||
|
||||
## 7. Test init.js Script with pnpm [done]
|
||||
### Dependencies: 63.4
|
||||
### Description: Verify that the scripts/init.js file works correctly when Taskmaster is installed via pnpm, creating the proper directory structure and copying all required templates as defined in the project structure.
|
||||
### Details:
|
||||
Test the init command to ensure it properly creates .cursor/rules, scripts, and tasks directories, copies templates (.env.example, .gitignore, rule files, dev.js), handles package.json merging, and sets up MCP config (.cursor/mcp.json) as per scripts/init.js.
|
||||
|
||||
## 8. Verify Binary Links with pnpm [done]
|
||||
### Dependencies: 63.4
|
||||
### Description: Ensure that the task-master and task-master-mcp binaries are properly defined in package.json, linked, and executable when installed via pnpm, in both global and local installations.
|
||||
### Details:
|
||||
Check that the binaries defined in package.json are correctly linked in node_modules/.bin when installed with pnpm, and that they can be executed without errors. Validate that binaries work for ESM ('module') projects and are accessible after both global and local installs.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user