fix: expand_all now uses complexity analysis recommendations#1287
Conversation
🦋 Changeset detectedLatest commit: 112d1ad The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughAdds optional complexityReportPath resolution and propagation through the expand-all flow: a new path-utils wrapper, runtime resolution/logging at tool and direct-function layers, forwarding complexityReportPath in the context to core expansion, and a unit test verifying the forwarding. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Tool as Tool (expand-all)
participant Direct as expandAllTasksDirect
participant Utils as resolveComplexityReportOutputPath
participant Core as Core expandAllTasks
participant Expand as expandTask
Tool->>Direct: invoke with { projectRoot, tag, ... }
alt no complexityReportPath provided
Direct->>Utils: resolveComplexityReportOutputPath(null, { projectRoot, tag }, log)
Utils-->>Direct: complexityReportPath
else provided
Note right of Direct: use provided complexityReportPath
end
Direct->>Core: expandAllTasks(..., context:{ session, mcpLog, projectRoot, tag, complexityReportPath })
loop per task
Core->>Expand: expandTask(..., context:{ ..., complexityReportPath })
Expand-->>Core: result
end
Core-->>Direct: expansion results
Direct-->>Tool: results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used📓 Path-based instructions (21).changeset/*.md📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)
Files:
.changeset/*📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
Files:
.changeset/**/*.md📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.js📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
Files:
mcp-server/src/{core/utils,tools}/**/*.js📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Files:
mcp-server/src/core/utils/path-utils.js📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Files:
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Files:
mcp-server/src/tools/*.js📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
Files:
mcp-server/src/{tools,core/direct-functions}/*.js📄 CodeRabbit inference engine (.cursor/rules/mcp.mdc)
Files:
mcp-server/src/tools/**/*.js📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
Files:
mcp-server/src/core/direct-functions/*.js📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
Files:
mcp-server/src/core/direct-functions/**/*.js📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
Files:
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Files:
tests/{unit,integration,e2e,fixtures}/**/*.js📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
Files:
**/*.{test,spec}.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/git_workflow.mdc)
Files:
**/*.test.js📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
Files:
tests/unit/**/*.test.js📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
Files:
tests/{unit,integration,e2e}/**/*.test.js📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
Files:
**/*.{test,spec}.*📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
Files:
tests/{unit,integration,e2e}/**📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
Files:
**/*.{test,spec}.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (26)📓 Common learnings📚 Learning: 2025-07-18T17:09:13.815ZApplied to files:
📚 Learning: 2025-09-24T15:12:12.658ZApplied to files:
📚 Learning: 2025-09-24T15:12:12.658ZApplied to files:
📚 Learning: 2025-07-18T17:10:02.683ZApplied to files:
📚 Learning: 2025-07-18T17:14:29.399ZApplied to files:
📚 Learning: 2025-07-18T17:10:12.881ZApplied to files:
📚 Learning: 2025-09-24T15:12:12.658ZApplied to files:
📚 Learning: 2025-07-18T17:12:57.903ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T08:29:52.384ZApplied to files:
📚 Learning: 2025-07-18T17:11:36.732ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T17:11:36.732ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T17:07:39.336ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T17:11:36.732ZApplied to files:
📚 Learning: 2025-07-18T17:13:30.188ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-18T17:18:17.759ZApplied to files:
📚 Learning: 2025-07-21T02:41:13.453ZApplied to files:
📚 Learning: 2025-07-18T17:14:29.399ZApplied to files:
📚 Learning: 2025-07-18T17:16:13.793ZApplied to files:
🧬 Code graph analysis (4)mcp-server/src/core/utils/path-utils.js (5)
mcp-server/src/tools/expand-all.js (4)
mcp-server/src/core/direct-functions/expand-all-tasks.js (4)
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js (2)
🪛 markdownlint-cli2 (0.18.1).changeset/smart-owls-relax.md5-5: Trailing spaces (MD009, no-trailing-spaces) 5-5: First line in a file should be a top-level heading (MD041, first-line-heading, first-line-h1) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (5)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
mcp-server/src/core/direct-functions/expand-all-tasks.js(3 hunks)mcp-server/src/core/utils/path-utils.js(2 hunks)mcp-server/src/tools/expand-all.js(3 hunks)tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (18)
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
mcp-server/src/core/utils/path-utils.jstests/unit/scripts/modules/task-manager/expand-all-tasks.test.jsmcp-server/src/core/direct-functions/expand-all-tasks.jsmcp-server/src/tools/expand-all.js
mcp-server/src/{core/utils,tools}/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Place utilities specifically designed to support the MCP server implementation into the appropriate subdirectories within
mcp-server/src/(e.g., path/core logic helpers inmcp-server/src/core/utils/, tool execution/response helpers inmcp-server/src/tools/utils.js).
Files:
mcp-server/src/core/utils/path-utils.jsmcp-server/src/tools/expand-all.js
mcp-server/src/core/utils/path-utils.js
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Call
findTasksJsonPath(args, log)from within direct function wrappers inmcp-server/src/core/direct-functions/to get the absolute path to the relevanttasks.json.
Files:
mcp-server/src/core/utils/path-utils.js
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}: Keep utilities relevant to their location, export all utility functions in a single statement per file, group related exports together, export configuration constants, do not use default exports, and do not create circular dependencies.
Export all utility functions explicitly, group related functions logically, and include new tagged system utilities.
Files:
mcp-server/src/core/utils/path-utils.js
tests/{unit,integration,e2e,fixtures}/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
Test files must be organized as follows: unit tests in tests/unit/, integration tests in tests/integration/, end-to-end tests in tests/e2e/, and test fixtures in tests/fixtures/.
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/git_workflow.mdc)
**/*.{test,spec}.{js,ts,jsx,tsx}: Create a test file and ensure all tests pass when all subtasks are complete; commit tests if added or modified
When all subtasks are complete, run final testing using the appropriate test runner (e.g., npm test, jest, or manual testing)
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
**/*.test.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.test.js: Never use asynchronous operations in tests. Make all mocks return synchronous values when possible.
Always mock tests properly based on the way the tested functions are defined and used.
Follow the test file organization: mocks must be set up before importing modules under test, and spies on mocked modules should be set up after imports.
Use fixtures from tests/fixtures/ for consistent sample data across tests.
Always declare mocks before importing the modules being tested in Jest test files.
Use jest.spyOn() after imports to create spies on mock functions and reference these spies in test assertions.
When testing functions with callbacks, get the callback from your mock's call arguments, execute it directly with test inputs, and verify the results.
For ES modules, use jest.mock() before static imports and jest.unstable_mockModule() before dynamic imports to mock dependencies.
Reset mock functions (mockFn.mockReset()) before dynamic imports if they might have been called previously.
When verifying console assertions, assert against the actual arguments passed (single formatted string), not multiple arguments.
Use mock-fs to mock file system operations in tests, and restore the file system after each test.
Mock API calls (e.g., Anthropic/Claude) by mocking the entire module and providing predictable responses.
Set mock environment variables in test setup and restore them after each test.
Maintain test fixtures separate from test logic.
Follow the mock-first-then-import pattern for all Jest mocks.
Do not define mock variables before jest.mock() calls (they won't be accessible due to hoisting).
Use test-specific file paths (e.g., 'test-tasks.json') for all file operations in tests.
Mock readJSON and writeJSON to avoid real file system interactions in tests.
Verify file operations use the correct paths in expect statements.
Use different file paths for each test to avoid test interdependence.
Verify modifications on the in-memory task objects passed to w...
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
tests/unit/**/*.test.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
tests/unit/**/*.test.js: Unit tests must be located in tests/unit/, test individual functions and utilities in isolation, mock all external dependencies, and keep tests small, focused, and fast.
Do not include actual command execution in unit tests.
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
tests/{unit,integration,e2e}/**/*.test.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
tests/{unit,integration,e2e}/**/*.test.js: When testing CLI commands built with Commander.js, test the command action handlers directly rather than trying to mock the entire Commander.js chain.
When mocking the Commander.js chain, mock ALL chainable methods (option, argument, action, on, etc.) and return this (or the mock object) from all chainable method mocks.
Explicitly handle all options, including defaults and shorthand flags (e.g., -p for --prompt), and include null/undefined checks in test implementations for parameters that might be optional.
Do not try to use the real action implementation without proper mocking, and do not mock Commander partially—either mock it completely or test the action directly.
Mock the action handlers for CLI commands and verify they're called with correct arguments.
Use sample task fixtures for consistent test data, mock file system operations, and test both success and error paths for task operations.
Mock console output and verify correct formatting in UI function tests. Use flexible assertions like toContain() or toMatch() for formatted output.
Mock chalk functions to return the input text to make testing easier while still verifying correct function calls.
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
**/*.{test,spec}.*
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
Test files should follow naming conventions: .test., .spec., or _test. depending on the language
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
tests/{unit,integration,e2e}/**
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
Organize test directories by test type (unit, integration, e2e) and mirror source structure where possible
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
**/*.{test,spec}.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{test,spec}.{js,jsx,ts,tsx}: NEVER use async/await in test functions unless testing actual asynchronous operations
Use synchronous top-level imports in tests; avoid dynamic await import()
Keep test bodies synchronous whenever possible
Files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
mcp-server/src/core/direct-functions/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
mcp-server/src/core/direct-functions/*.js: Direct function files in mcp-server/src/core/direct-functions/.js must implement silent mode using enableSilentMode and disableSilentMode from scripts/modules/utils.js, and always restore silent mode state using a try/finally block.
Direct function parameters in mcp-server/src/core/direct-functions/.js must match the corresponding core function signatures; do not add extra parameters not present in the core function.
Always use the isSilentMode() function to check silent mode state in mcp-server/src/core/direct-functions/*.js; do not access global variables like silentMode directly.
mcp-server/src/core/direct-functions/*.js: Check that all helper functions your direct function needs are properly exported from their source modules and import these dependencies explicitly at the top of your file in direct functions.
Verify the signature of core functions you're calling in direct functions and ensure all required parameters are provided, passing explicit values for required parameters rather than relying on defaults.
Use path.join() instead of string concatenation for file paths, and follow established file naming conventions (e.g., 'task_001.txt') in direct functions.
Wrap core function calls and AI calls in try/catch blocks in direct functions, log errors with appropriate severity and context, and return standardized error objects with code and message.
When calling a core function from a direct function, pass the log object provided by FastMCP wrapped in the standard logWrapper object as the mcpLog property in the options argument.
Wrap core function calls within direct functions using enableSilentMode() and disableSilentMode() in a try/finally block if the core function might produce console output that isn't reliably controlled by passing { mcpLog } or an outputFormat parameter.
Do not wrap calls to the unified AI service (generateTextService, generateObjectService) in silent mode; their logging is handled internal...
Files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
mcp-server/src/{tools,core/direct-functions}/*.js
📄 CodeRabbit inference engine (.cursor/rules/mcp.mdc)
mcp-server/src/{tools,core/direct-functions}/*.js: Use kebab-case for all file names in mcp-server/src/tools/ and mcp-server/src/core/direct-functions/.
Use helpers from mcp-server/src/tools/utils.js, mcp-server/src/core/utils/path-utils.js, and mcp-server/src/core/utils/ai-client-utils.js for centralized utilities.
Files:
mcp-server/src/core/direct-functions/expand-all-tasks.jsmcp-server/src/tools/expand-all.js
mcp-server/src/core/direct-functions/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
mcp-server/src/core/direct-functions/**/*.js: Direct function wrappers in mcp-server/src/core/direct-functions/ must call the corresponding core logic function, passing commandName and outputType: 'mcp' in the context, and outputFormat: 'json' if supported.
Direct function wrappers in mcp-server/src/core/direct-functions/ must include coreResult.telemetryData as a field within the data object of the successful response.In direct functions (
mcp-server/src/core/direct-functions/*) that call core functions (scripts/modules/*), ensure console output from the core function is suppressed to avoid breaking MCP JSON responses, preferably by passing anoutputFormatparameter or by wrapping the call with silent mode.
Files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}: Use the logger wrapper pattern when passing loggers to preventmcpLog[level] is not a functionerrors; do not pass the FastMCPlogobject directly asmcpLogto core functions.
Ensure silent mode is disabled in afinallyblock to prevent it from staying enabled.
Files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
mcp-server/src/tools/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
MCP server tools in mcp-server/src/tools/*.js must have their execute methods wrapped with the withNormalizedProjectRoot higher-order function from tools/utils.js to ensure consistent path handling.
mcp-server/src/tools/*.js: MCP tools must follow a specific structure: use server.addTool with snake_case tool names, define parameters using Zod, and implement the execute function as an async function.
All MCP tool execute methods that require access to the project root MUST be wrapped with the withNormalizedProjectRoot Higher-Order Function (HOF) from mcp-server/src/tools/utils.js.
MCP tools should always call *Direct wrappers instead of executeTaskMasterCommand, except as a fallback if a direct function is not yet implemented.
Use camelCase with Tool suffix for tool registration functions in mcp-server/src/tools/.
Use snake_case for tool names exposed to MCP clients in server.addTool definitions.
Log the start of execution with arguments (sanitized if sensitive), log successful completion with result summary, log all error conditions with appropriate log levels, and include the cache status in result logs in MCP tool files.
Do not log entire large data structures or sensitive information in MCP tool files.
Use handleApiResult to format and return the response from MCP tools.
mcp-server/src/tools/*.js: Create tool definitions in 'mcp-server/src/tools/', use Zod for parameter validation, include optional tag parameter for multi-context support, and follow established naming conventions.
For long-running operations that should not block the client, use the AsyncOperationManager in MCP tools and implement progress reporting.
Files:
mcp-server/src/tools/expand-all.js
mcp-server/src/tools/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
MCP tool files in mcp-server/src/tools/ must call the corresponding direct function wrapper and pass the result to handleApiResult(result, log) from mcp-server/src/tools/utils.js, ensuring telemetryData is included in the final MCP response.
Files:
mcp-server/src/tools/expand-all.js
🧠 Learnings (15)
📓 Common learnings
Learnt from: mm-parthy
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/list-tasks.js:0-0
Timestamp: 2025-07-18T08:29:52.384Z
Learning: TODO comments about adding tag support to internal functions like readComplexityReport are obsolete in the boundary-first tag resolution pattern because report paths are already resolved at the CLI command boundary layer before reaching these functions.
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to mcp-server/src/core/utils/path-utils.js : Call `findTasksJsonPath(args, log)` from within direct function wrappers in `mcp-server/src/core/direct-functions/` to get the absolute path to the relevant `tasks.json`.
Applied to files:
mcp-server/src/core/utils/path-utils.jsmcp-server/src/core/direct-functions/expand-all-tasks.jsmcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-21T02:41:13.453Z
Learnt from: rtmcrc
PR: eyaltoledano/claude-task-master#933
File: scripts/modules/task-manager/expand-all-tasks.js:0-0
Timestamp: 2025-07-21T02:41:13.453Z
Learning: In scripts/modules/task-manager/expand-all-tasks.js, the success flag should always be true when the expansion process completes successfully, even if individual tasks fail due to LLM errors. Failed tasks are designed to be expanded on subsequent iterations, so individual task failures don't constitute overall operation failure.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.jsmcp-server/src/core/direct-functions/expand-all-tasks.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : Use sample task fixtures for consistent test data, mock file system operations, and test both success and error paths for task operations.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js
📚 Learning: 2025-07-18T17:11:36.732Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-07-18T17:11:36.732Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : The *Direct function is responsible for finding the exact tasks.json path using findTasksJsonPath, relying on the projectRoot passed in args.
Applied to files:
mcp-server/src/core/direct-functions/expand-all-tasks.jsmcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement reusable task finding utilities that support both task and subtask lookups and add context to subtask results.
Applied to files:
mcp-server/src/core/direct-functions/expand-all-tasks.jsmcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: When breaking down complex tasks, use the `expand_task` command with appropriate flags (`--force`, `--research`, `--num`, `--prompt`) and review generated subtasks for accuracy.
Applied to files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
📚 Learning: 2025-07-18T17:10:02.683Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:02.683Z
Learning: When breaking down complex tasks in Taskmaster, use the `expand_task` command with appropriate flags (`--num`, `--research`, `--force`, `--prompt`) and review generated subtasks for accuracy.
Applied to files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use AI to generate detailed subtasks within the current tag context, considering complexity analysis for subtask counts and ensuring proper IDs for newly created subtasks.
Applied to files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI, create them in the current tag context (defaulting to 'master'), provide clear prompts to guide AI task generation, and validate/clean up AI-generated tasks.
Applied to files:
mcp-server/src/core/direct-functions/expand-all-tasks.js
📚 Learning: 2025-07-18T08:29:52.384Z
Learnt from: mm-parthy
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/list-tasks.js:0-0
Timestamp: 2025-07-18T08:29:52.384Z
Learning: TODO comments about adding tag support to internal functions like readComplexityReport are obsolete in the boundary-first tag resolution pattern because report paths are already resolved at the CLI command boundary layer before reaching these functions.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to {scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js} : Export all utility functions explicitly, group related functions logically, and include new tagged system utilities.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:13:30.188Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/task-manager/* : All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tag resolution functions for all task data access, provide backward compatibility with legacy format, and default to 'master' tag when no tag is specified.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tagged task system aware functions for task finding and manipulation, handle both task and subtask operations, and validate task IDs before operations.
Applied to files:
mcp-server/src/tools/expand-all.js
🧬 Code graph analysis (4)
mcp-server/src/core/utils/path-utils.js (1)
src/utils/path-utils.js (1)
resolveComplexityReportOutputPath(363-408)
tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js (2)
mcp-server/src/core/direct-functions/expand-all-tasks.js (1)
result(77-85)scripts/modules/task-manager/expand-all-tasks.js (1)
result(130-143)
mcp-server/src/core/direct-functions/expand-all-tasks.js (4)
mcp-server/src/core/direct-functions/expand-task.js (4)
args(38-48)numSubtasks(91-91)useResearch(92-92)additionalContext(93-93)mcp-server/src/core/utils/path-utils.js (1)
resolveComplexityReportOutputPath(235-241)src/utils/path-utils.js (1)
resolveComplexityReportOutputPath(363-408)scripts/modules/task-manager/expand-all-tasks.js (1)
result(130-143)
mcp-server/src/tools/expand-all.js (3)
mcp-server/src/core/direct-functions/expand-all-tasks.js (1)
complexityReportPath(45-47)mcp-server/src/core/utils/path-utils.js (1)
resolveComplexityReportOutputPath(235-241)src/utils/path-utils.js (1)
resolveComplexityReportOutputPath(363-408)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (6)
mcp-server/src/core/utils/path-utils.js (1)
228-241: LGTM! Clean wrapper implementation.The new
resolveComplexityReportOutputPathwrapper follows the established pattern in this file, correctly delegating to the core implementation with appropriate defaults.tests/unit/scripts/modules/task-manager/expand-all-tasks.test.js (1)
247-292: LGTM! Comprehensive test for path propagation.The test properly verifies that
complexityReportPathflows from the execution context through toexpandTask. The use ofexpect.objectContainingcorrectly validates the context parameter without over-specifying implementation details.mcp-server/src/tools/expand-all.js (1)
91-97: LGTM! Proper path resolution at the tool boundary.The tool correctly resolves the complexity report path using the MCP wrapper and logs it for visibility. This implements the boundary-first resolution pattern mentioned in the learnings.
Based on learnings
mcp-server/src/core/direct-functions/expand-all-tasks.js (3)
29-39: LGTM! Clear parameter destructuring.The destructuring clearly separates the provided
complexityReportPath(aliased asprovidedComplexityReportPath) from the computed value, making the fallback logic on lines 44-47 easy to understand.
76-83: Consider updating the comment to reflect all context fields.The comment on line 76 mentions
projectRootandtagbut doesn't mention the newly addedcomplexityReportPath. Consider updating for completeness.Apply this diff to update the comment:
- // Call the core function, passing options and the context object { session, mcpLog, projectRoot, tag, complexityReportPath } + // Call the core function, passing options and the context object { session, mcpLog, projectRoot, tag, complexityReportPath }Actually, the comment already mentions
complexityReportPathcorrectly. No change needed.
44-51: expandTask gracefully handles missing or unparseable complexity reportIt checks for file existence, logs and skips complexity analysis if the report is absent, and catches read/parse errors before falling back to default subtask counts. No changes required.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
mcp-server/src/tools/expand-all.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
mcp-server/src/tools/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
MCP server tools in mcp-server/src/tools/*.js must have their execute methods wrapped with the withNormalizedProjectRoot higher-order function from tools/utils.js to ensure consistent path handling.
mcp-server/src/tools/*.js: MCP tools must follow a specific structure: use server.addTool with snake_case tool names, define parameters using Zod, and implement the execute function as an async function.
All MCP tool execute methods that require access to the project root MUST be wrapped with the withNormalizedProjectRoot Higher-Order Function (HOF) from mcp-server/src/tools/utils.js.
MCP tools should always call *Direct wrappers instead of executeTaskMasterCommand, except as a fallback if a direct function is not yet implemented.
Use camelCase with Tool suffix for tool registration functions in mcp-server/src/tools/.
Use snake_case for tool names exposed to MCP clients in server.addTool definitions.
Log the start of execution with arguments (sanitized if sensitive), log successful completion with result summary, log all error conditions with appropriate log levels, and include the cache status in result logs in MCP tool files.
Do not log entire large data structures or sensitive information in MCP tool files.
Use handleApiResult to format and return the response from MCP tools.
mcp-server/src/tools/*.js: Create tool definitions in 'mcp-server/src/tools/', use Zod for parameter validation, include optional tag parameter for multi-context support, and follow established naming conventions.
For long-running operations that should not block the client, use the AsyncOperationManager in MCP tools and implement progress reporting.
Files:
mcp-server/src/tools/expand-all.js
mcp-server/src/{tools,core/direct-functions}/*.js
📄 CodeRabbit inference engine (.cursor/rules/mcp.mdc)
mcp-server/src/{tools,core/direct-functions}/*.js: Use kebab-case for all file names in mcp-server/src/tools/ and mcp-server/src/core/direct-functions/.
Use helpers from mcp-server/src/tools/utils.js, mcp-server/src/core/utils/path-utils.js, and mcp-server/src/core/utils/ai-client-utils.js for centralized utilities.
Files:
mcp-server/src/tools/expand-all.js
mcp-server/src/tools/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
MCP tool files in mcp-server/src/tools/ must call the corresponding direct function wrapper and pass the result to handleApiResult(result, log) from mcp-server/src/tools/utils.js, ensuring telemetryData is included in the final MCP response.
Files:
mcp-server/src/tools/expand-all.js
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
mcp-server/src/tools/expand-all.js
mcp-server/src/{core/utils,tools}/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Place utilities specifically designed to support the MCP server implementation into the appropriate subdirectories within
mcp-server/src/(e.g., path/core logic helpers inmcp-server/src/core/utils/, tool execution/response helpers inmcp-server/src/tools/utils.js).
Files:
mcp-server/src/tools/expand-all.js
🧠 Learnings (11)
📓 Common learnings
Learnt from: mm-parthy
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/list-tasks.js:0-0
Timestamp: 2025-07-18T08:29:52.384Z
Learning: TODO comments about adding tag support to internal functions like readComplexityReport are obsolete in the boundary-first tag resolution pattern because report paths are already resolved at the CLI command boundary layer before reaching these functions.
📚 Learning: 2025-07-18T08:29:52.384Z
Learnt from: mm-parthy
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/list-tasks.js:0-0
Timestamp: 2025-07-18T08:29:52.384Z
Learning: TODO comments about adding tag support to internal functions like readComplexityReport are obsolete in the boundary-first tag resolution pattern because report paths are already resolved at the CLI command boundary layer before reaching these functions.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to {scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js} : Export all utility functions explicitly, group related functions logically, and include new tagged system utilities.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tag resolution functions for all task data access, provide backward compatibility with legacy format, and default to 'master' tag when no tag is specified.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement reusable task finding utilities that support both task and subtask lookups and add context to subtask results.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tagged task system aware functions for task finding and manipulation, handle both task and subtask operations, and validate task IDs before operations.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use AI to generate detailed subtasks within the current tag context, considering complexity analysis for subtask counts and ensuring proper IDs for newly created subtasks.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use tag resolution functions to maintain backward compatibility, returning legacy format to core functions and not exposing the tagged structure to existing core logic.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Generate task files from the current tag context, include tag information in generated files, and do not mix tasks from different tags in file generation.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Core functions must receive the legacy format for 100% backward compatibility, using tag resolution functions to abstract the tagged structure.
Applied to files:
mcp-server/src/tools/expand-all.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Applies to scripts/modules/task-manager/*.js : Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.
Applied to files:
mcp-server/src/tools/expand-all.js
🧬 Code graph analysis (1)
mcp-server/src/tools/expand-all.js (3)
mcp-server/src/core/direct-functions/expand-all-tasks.js (1)
complexityReportPath(45-47)mcp-server/src/core/utils/path-utils.js (1)
resolveComplexityReportOutputPath(235-241)src/utils/path-utils.js (1)
resolveComplexityReportOutputPath(363-408)
🔇 Additional comments (2)
mcp-server/src/tools/expand-all.js (2)
89-95: LGTM! Complexity report path resolution at boundary.The complexity report path is correctly resolved at the MCP tool boundary with tag awareness, aligning with the boundary-first tag resolution pattern. The resolved path is properly logged and will be forwarded to downstream functions.
Based on learnings.
105-106: LGTM! Correct parameter forwarding.The
resolvedTagandcomplexityReportPathparameters are correctly passed toexpandAllTasksDirect, enabling the downstream expansion logic to use tag-aware complexity analysis recommendations.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.changeset/smart-owls-relax.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
.changeset/*.md
📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)
.changeset/*.md: When runningnpm run changesetornpx changeset add, provide a concise summary of the changes for theCHANGELOG.mdin imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.
Files:
.changeset/smart-owls-relax.md
.changeset/*
📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Files:
.changeset/smart-owls-relax.md
.changeset/**/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
Changeset entries should be user-facing, describing the end-user impact rather than code specifics
Files:
.changeset/smart-owls-relax.md
🧠 Learnings (8)
📓 Common learnings
Learnt from: mm-parthy
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/list-tasks.js:0-0
Timestamp: 2025-07-18T08:29:52.384Z
Learning: TODO comments about adding tag support to internal functions like readComplexityReport are obsolete in the boundary-first tag resolution pattern because report paths are already resolved at the CLI command boundary layer before reaching these functions.
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/context_gathering.mdc:0-0
Timestamp: 2025-07-18T17:09:13.815Z
Learning: Commands such as `analyze-complexity`, `expand-task`, `update-task`, and `add-task` should consider adopting the context gathering pattern for improved AI-powered assistance.
Applied to files:
.changeset/smart-owls-relax.md
📚 Learning: 2025-09-24T15:12:12.658Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-09-24T15:12:12.658Z
Learning: Analyze task complexity with task-master analyze-complexity --research and use results to plan breakdown
Applied to files:
.changeset/smart-owls-relax.md
📚 Learning: 2025-09-24T15:12:12.658Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-09-24T15:12:12.658Z
Learning: Use task-master complexity-report to view formatted complexity insights and recommendations
Applied to files:
.changeset/smart-owls-relax.md
📚 Learning: 2025-07-18T17:10:02.683Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:02.683Z
Learning: When breaking down complex tasks in Taskmaster, use the `expand_task` command with appropriate flags (`--num`, `--research`, `--force`, `--prompt`) and review generated subtasks for accuracy.
Applied to files:
.changeset/smart-owls-relax.md
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use AI to generate detailed subtasks within the current tag context, considering complexity analysis for subtask counts and ensuring proper IDs for newly created subtasks.
Applied to files:
.changeset/smart-owls-relax.md
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: When breaking down complex tasks, use the `expand_task` command with appropriate flags (`--force`, `--research`, `--num`, `--prompt`) and review generated subtasks for accuracy.
Applied to files:
.changeset/smart-owls-relax.md
📚 Learning: 2025-09-24T15:12:12.658Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-09-24T15:12:12.658Z
Learning: Break down tasks using task-master expand --id=<id> with appropriate flags; clear and regenerate subtasks as needed
Applied to files:
.changeset/smart-owls-relax.md
🪛 markdownlint-cli2 (0.18.1)
.changeset/smart-owls-relax.md
5-5: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
5-5: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
| "task-master-ai": minor | ||
| --- | ||
|
|
||
| Enhance `expand_all` to intelligently use complexity analysis recommendations when expanding tasks. |
There was a problem hiding this comment.
Drop trailing space in summary line.
Line 5 ends with a stray space, which violates our markdownlint (MD009) check and will keep the lint job red. Please trim it.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
5-5: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
5-5: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
🤖 Prompt for AI Agents
In .changeset/smart-owls-relax.md around line 5, the summary line contains a
trailing space that violates MD009; remove the trailing whitespace at the end of
line 5 so the line ends without any extra space character and commit the updated
file to resolve the lint failure.
- Added resolveComplexityReportOutputPath to MCP path utilities - Updated expand_all MCP tool to compute and pass complexityReportPath - Updated expandAllTasksDirect to accept and use complexityReportPath - Added unit test to verify complexityReportPath is passed through call chain - Fixes issue where expand_all ignored analyze-complexity recommendations Previously, expand_all was creating 5 subtasks for every task (the default) and tasks with dependencies weren't being expanded at all. Now it properly reads the complexity report and uses the recommendedSubtasks field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
b381267 to
112d1ad
Compare
This PR was automatically generated to update documentation based on recent changes. Original commit: fix: expand_all now uses complexity analysis recommendations (#1287)\n\nCo-authored-by: Claude <noreply@anthropic.com>\n\n Co-authored-by: Claude <claude-assistant@anthropic.com>
…edano#1287) Co-authored-by: Claude <noreply@anthropic.com>
Summary
Fixed a bug where
expand_allwas ignoring complexity analysis recommendations fromanalyze-complexity.Problem
expand_allwas creating 5 subtasks for every task (the default).taskmaster/reports/task-complexity-report.jsonwere being ignoredRoot Cause
The
expand_allfunctionality wasn't computing or passing thecomplexityReportPathto the underlying functions, so the complexity analysis recommendations were completely ignored.Solution
resolveComplexityReportOutputPathto MCP path utilities - Wraps the core utility function for use in MCP contextcomplexityReportPathfrom args or computes it as fallback, then passes it through contextcomplexityReportPathis correctly passed through the entire call chainCall Chain (Fixed)
Files Changed
mcp-server/src/core/utils/path-utils.js- Added wrapper for complexity report path resolutionmcp-server/src/tools/expand-all.js- Computes and passes complexityReportPathmcp-server/src/core/direct-functions/expand-all-tasks.js- Accepts and uses complexityReportPathtests/unit/scripts/modules/task-manager/expand-all-tasks.test.js- Added test caseTesting
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests