Conversation
|
WalkthroughAdds end-to-end AI-driven task expansion: new TaskExpansionService, storage and repository hooks, CLI bridge Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (expand-task.js)
participant Bridge as Expand Bridge (tryExpandViaRemote)
participant TmCore as TmCore / Storage
participant Service as TaskExpansionService
participant API as Backend API
CLI->>Bridge: tryExpandViaRemote(params)
Bridge->>TmCore: init / determine storage
alt storage == "api"
Bridge->>Service: new TaskExpansionService(repo, projectId, apiClient, auth)
Service->>TmCore: fetch task, subtasks, brief, allTasks
Service->>API: POST /expand (payload + query)
API-->>Service: ExpandTaskResponse (queued/jobId/message)
Service-->>Bridge: RemoteExpandResult (taskLink, jobId, message)
Bridge->>Bridge: spinner lifecycle (start → succeed/fail)
Bridge-->>CLI: return RemoteExpandResult (consumed by CLI)
else storage != "api"
Bridge-->>CLI: return null (fallthrough)
CLI->>CLI: perform local file-based expansion
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas to inspect closely:
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/modules/task-manager/update-task-by-id.js (1)
285-303: Restore awaiting promptManager.loadPromptRemoving the
awaitmeanspromptResultis now a Promise. That leavessystemPrompt/userPromptundefined, so we immediately hit the failure branch (Failed to load prompts) and the command can’t update anything. Please put theawaitback so we actually get the resolved prompt payload before proceeding.- const promptResult = promptManager.loadPrompt( + const promptResult = await promptManager.loadPrompt(
🧹 Nitpick comments (4)
packages/tm-core/src/modules/tasks/repositories/supabase/supabase-repository.ts (1)
156-198: Replaceas anywith proper typing.Line 187 uses an unsafe type assertion that bypasses TypeScript's type checking. The document data should have a predictable shape from the Supabase join.
Consider defining a proper type or extracting it from your database schema:
- // Extract document data if available - const document = data.document as any; + // Extract document data if available + const document = data.document as { id: string; title?: string; description?: string } | null;Alternatively, if the database types are available, reference them directly:
- const document = data.document as any; + const document = data.document as Database['public']['Tables']['document']['Row'] | null;packages/tm-core/src/modules/integration/services/task-expansion.service.ts (3)
98-102: UseTaskMasterErrorfor consistency with error handling patterns.The code throws a generic
Errorwhen a task is not found. For consistency with the rest of the error handling in this service, useTaskMasterErrorwith an appropriate error code.Apply this diff:
if (!task) { - throw new Error(`Task ${taskId} not found`); + throw new TaskMasterError( + `Task ${taskId} not found`, + ERROR_CODES.TASK_NOT_FOUND, + { operation: 'expandTask', taskId } + ); }
114-115: Consider the performance impact of loading all tasks.The code retrieves all tasks for AI context without pagination or filtering. For projects with hundreds or thousands of tasks, this could:
- Cause significant memory usage
- Increase API response times
- Potentially timeout for very large projects
The comment indicates this is "optional but helpful for AI" - consider making it configurable or implementing pagination/filtering.
149-154: Reconsider the localhost fallback and hard-coded URL path.Two concerns with the task link construction:
Localhost fallback (lines 150-153): Falling back to
http://localhost:8080when environment variables are missing could result in broken links in production environments. Consider throwing an error or using a more appropriate default.Hard-coded path (line 154): The URL path
/home/hamster/briefs/${briefId}/task/${taskUuid}is hard-coded and product-specific. This makes it brittle and difficult to maintain if routes change. Consider using a URL builder utility or configuration.Consider refactoring to:
// Get base URL with validation const baseUrl = process.env.TM_BASE_DOMAIN || process.env.TM_PUBLIC_BASE_DOMAIN; if (!baseUrl) { throw new TaskMasterError( 'Base URL not configured', ERROR_CODES.CONFIGURATION_ERROR, { operation: 'expandTask', requiredEnvVar: 'TM_BASE_DOMAIN' } ); } // Use a URL builder or configuration for the path const taskLink = buildTaskUrl(baseUrl, context.briefId, taskUuid);
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/tm-core/src/modules/integration/services/task-expansion.service.ts(1 hunks)packages/tm-core/src/modules/storage/adapters/api-storage.ts(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/tm-core/src/modules/storage/adapters/api-storage.ts
🧰 Additional context used
🧠 Learnings (20)
📓 Common learnings
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.claude/commands/taskmaster-complete.md : Create .claude/commands/taskmaster-complete.md with steps to review task, verify, run tests, set status done, and show next task
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.claude/commands/taskmaster-next.md : Create .claude/commands/taskmaster-next.md with steps to run task-master next, then task-master show <id>, summarize, and suggest first step
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/glossary.mdc:0-0
Timestamp: 2025-07-18T17:10:53.657Z
Learning: Guidelines for integrating new features into the Task Master CLI with tagged system considerations (new_features.mdc).
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/taskmaster.mdc:0-0
Timestamp: 2025-07-31T22:08:16.039Z
Learning: For AI-powered tools (parse_prd, analyze_project_complexity, update_subtask, update_task, update, expand_all, expand_task, add_task), inform users that these operations may take up to a minute to complete.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: Use the Taskmaster command set (`task-master` CLI or MCP tools) for all task management operations: listing, expanding, updating, tagging, and status changes.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/glossary.mdc:0-0
Timestamp: 2025-07-18T17:10:53.657Z
Learning: Describes the high-level architecture of the Task Master CLI application, including the new tagged task lists system (architecture.mdc).
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: assets/rules/agentllm.mdc:57-60
Timestamp: 2025-10-15T18:18:36.402Z
Learning: In agentllm delegation mode, the `expand_all` tool returns a list of `delegatedTaskIds` that are eligible for expansion, and the MCP client must then call `expand_task` individually for each returned task ID. This differs from normal mode where `expand_all` automatically submits all eligible tasks for expansion without requiring subsequent `expand_task` calls.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:10:02.683Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-09-26T19:05:47.555Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:11-13
Timestamp: 2025-09-26T19:05:47.555Z
Learning: In the eyaltoledano/claude-task-master repository, internal tm/ packages use a specific export pattern where the "exports" field points to TypeScript source files (./src/index.ts) while "main" points to compiled output (./dist/index.js) and "types" points to source files (./src/index.ts). This pattern is used consistently across internal packages like tm/core and tm/ai-sdk-provider-grok-cli because they are consumed directly during build-time bundling with tsdown rather than being published as separate packages.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-21T02:41:13.453Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-09-24T15:12:12.658Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Subtasks must use consistent properties, maintain simple numeric IDs unique within the parent task, and must not duplicate parent task properties.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Do not call AI-specific getters (like `getMainModelId`, `getMainMaxTokens`) from core logic functions in `scripts/modules/task-manager/*`; instead, pass the `role` to the unified AI service.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Each task object must include all required properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) and provide default values for optional properties. Extra properties not in the standard schema must not be added.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:09:45.690Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not implement fallback or retry logic outside `ai-services-unified.js`.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-31T22:07:49.716Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-31T22:07:49.716Z
Learning: Applies to scripts/modules/commands.js : For AI-powered commands that benefit from project context, use the ContextGatherer utility for multi-source context extraction, support task IDs, file paths, custom context, and project tree, implement fuzzy search for automatic task discovery, and display detailed token breakdown for transparency.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: For CLI usage, install Taskmaster globally with `npm install -g task-master-ai` or use locally via `npx task-master-ai ...`.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
🧬 Code graph analysis (1)
packages/tm-core/src/modules/integration/services/task-expansion.service.ts (2)
packages/tm-core/src/modules/tasks/repositories/task-repository.interface.ts (1)
TaskRepository(16-52)packages/tm-core/src/modules/storage/utils/api-client.ts (1)
ApiClient(24-146)
⏰ 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
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/tm-core/src/modules/integration/services/task-expansion.service.ts (1)
217-230: Consider more specific error codes in the catch-all handler.The code wraps all non-TaskMasterError exceptions as
STORAGE_ERROR, which is reasonable since most would come from repository calls (lines 99, 114, 124). However, if unexpected errors arise from other sources (e.g., payload serialization), they might be misclassified.This is acceptable as-is since
ApiClientalready wraps API failures asTaskMasterError, so they'll be caught by the firstifblock.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/tm-core/src/modules/integration/services/task-expansion.service.ts(1 hunks)tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js(1 hunks)tests/unit/scripts/modules/task-manager/expand-task.test.js(9 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.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:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
🧠 Learnings (51)
📓 Common learnings
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.claude/commands/taskmaster-complete.md : Create .claude/commands/taskmaster-complete.md with steps to review task, verify, run tests, set status done, and show next task
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.claude/commands/taskmaster-next.md : Create .claude/commands/taskmaster-next.md with steps to run task-master next, then task-master show <id>, summarize, and suggest first step
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/git_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:31.810Z
Learning: Pull Request descriptions must use the provided template, including Task Overview, Subtasks Completed, Implementation Details, Testing, Breaking Changes, and Related Tasks
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/taskmaster.mdc:0-0
Timestamp: 2025-07-31T22:08:16.039Z
Learning: For AI-powered tools (parse_prd, analyze_project_complexity, update_subtask, update_task, update, expand_all, expand_task, add_task), inform users that these operations may take up to a minute to complete.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : Mock chalk functions to return the input text to make testing easier while still verifying correct function calls.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.jspackages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Verify modifications on the in-memory task objects passed to writeJSON.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Do not import real AI service clients in tests; create fully mocked versions that return predictable responses.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : 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.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : Mock console output and verify correct formatting in UI function tests. Use flexible assertions like toContain() or toMatch() for formatted output.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : 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.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/**/*.test.js : Test CLI and MCP interfaces with real task data, verify end-to-end workflows across tag contexts, and test error scenarios and recovery in integration tests.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Module dependencies should be mocked before importing the test module, following Jest's hoisting behavior.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Mock API calls (e.g., Anthropic/Claude) by mocking the entire module and providing predictable responses.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/**/*.test.js : Follow the mock-first-then-import pattern and use jest.spyOn() for testing in Jest, clearing mocks between tests.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Mock external libraries (e.g., fs, commander, anthropic-ai/sdk) at the module level in tests.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : For ES modules, use jest.mock() before static imports and jest.unstable_mockModule() before dynamic imports to mock dependencies.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : 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.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Always declare mocks before importing the modules being tested in Jest test files.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : Mock the action handlers for CLI commands and verify they're called with correct arguments.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Follow the mock-first-then-import pattern for all Jest mocks.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Be careful with how you mock or stub functions that depend on module state; use factory functions in mocks to ensure proper initialization order.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:32.622Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ui.mdc:0-0
Timestamp: 2025-07-18T17:16:32.622Z
Learning: Applies to scripts/modules/ui.js : Use chalk.blue for informational messages, chalk.green for success, chalk.yellow for warnings, chalk.red for errors, chalk.cyan for prompts/highlights, and chalk.magenta for subtask information
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Mock output functions from ui.js in tests to verify display calls.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Use jest.spyOn() after imports to create spies on mock functions and reference these spies in test assertions.
Applied to files:
tests/unit/scripts/modules/task-manager/expand-task.test.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
tests/unit/scripts/modules/task-manager/expand-task.test.jstests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.jspackages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
tests/unit/scripts/modules/task-manager/expand-task.test.jspackages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/**/*.test.js : Test core logic independently with both data formats, mock file system operations, test tag resolution behavior, and verify migration compatibility in unit tests.
Applied to files:
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Never use asynchronous operations in tests. Make all mocks return synchronous values when possible.
Applied to files:
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Implement silent migration from legacy to tagged format in the readJSON() function, detect legacy format, convert automatically, and preserve all existing task data during migration.
Applied to files:
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
📚 Learning: 2025-07-18T17:10:02.683Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-09-26T19:05:47.555Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:11-13
Timestamp: 2025-09-26T19:05:47.555Z
Learning: In the eyaltoledano/claude-task-master repository, internal tm/ packages use a specific export pattern where the "exports" field points to TypeScript source files (./src/index.ts) while "main" points to compiled output (./dist/index.js) and "types" points to source files (./src/index.ts). This pattern is used consistently across internal packages like tm/core and tm/ai-sdk-provider-grok-cli because they are consumed directly during build-time bundling with tsdown rather than being published as separate packages.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-21T02:41:13.453Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-09-24T15:12:12.658Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 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:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Subtasks must use consistent properties, maintain simple numeric IDs unique within the parent task, and must not duplicate parent task properties.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Do not call AI-specific getters (like `getMainModelId`, `getMainMaxTokens`) from core logic functions in `scripts/modules/task-manager/*`; instead, pass the `role` to the unified AI service.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:09:45.690Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Each task object must include all required properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) and provide default values for optional properties. Extra properties not in the standard schema must not be added.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not implement fallback or retry logic outside `ai-services-unified.js`.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/config-manager.js : Handle potential `ConfigurationError` if the `.taskmasterconfig` file is missing or invalid when accessed via `getConfig`.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:09:45.690Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Remove references to non-existent tasks during validation
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-21T17:51:07.239Z
Learnt from: joedanz
Repo: eyaltoledano/claude-task-master PR: 748
File: scripts/modules/task-manager/parse-prd.js:726-733
Timestamp: 2025-07-21T17:51:07.239Z
Learning: In CLI contexts within task-manager modules like scripts/modules/task-manager/parse-prd.js, using process.exit(1) for validation failures and error conditions is correct and preferred over throwing errors, as it provides immediate termination with appropriate exit codes for scripting. The code should distinguish between MCP contexts (throw errors) and CLI contexts (use process.exit).
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:09:40.548Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:40.548Z
Learning: Applies to scripts/modules/dependency-manager.js : Check for and remove references to non-existent tasks during cleanup
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-31T22:07:49.716Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-31T22:07:49.716Z
Learning: Applies to scripts/modules/commands.js : For AI-powered commands that benefit from project context, use the ContextGatherer utility for multi-source context extraction, support task IDs, file paths, custom context, and project tree, implement fuzzy search for automatic task discovery, and display detailed token breakdown for transparency.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Applied to files:
packages/tm-core/src/modules/integration/services/task-expansion.service.ts
🧬 Code graph analysis (1)
packages/tm-core/src/modules/integration/services/task-expansion.service.ts (2)
packages/tm-core/src/modules/tasks/repositories/task-repository.interface.ts (1)
TaskRepository(16-52)packages/tm-core/src/modules/storage/utils/api-client.ts (1)
ApiClient(24-146)
⏰ 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 (7)
packages/tm-core/src/modules/integration/services/task-expansion.service.ts (4)
1-61: Well-structured type definitions and imports.The types are clearly documented and properly exported. Good use of TypeScript utility types for
ContextWithBriefto ensure type safety.
101-175: Past review comments properly addressed.The validation logic now correctly:
- Uses
TaskMasterErrorwithVALIDATION_ERRORcode for missing tasks (lines 101-111)- Validates that
databaseIdexists before use (lines 146-158)- Validates UUID format using Zod schema (lines 160-175)
All error messages include descriptive
userMessagefields for better UX.
113-205: Solid implementation of payload building and API integration.The code demonstrates good practices:
- Defensive fallback chain for brief context (line 118)
- Clean query parameter construction (lines 135-144)
- Proper use of validated UUID for API calls (line 178)
- Useful structured logging with job details and task link (lines 197-200)
234-254: Clean context validation helper.The
ensureBriefSelectedmethod provides clear validation with helpful error messages guiding users to the correct CLI commands. The type narrowing toContextWithBriefis safe given the validation logic.tests/unit/scripts/modules/task-manager/expand-task.test.js (2)
165-165: LGTM: Consistent synchronous mock refactor.All
loadPromptmock changes frommockResolvedValuetomockReturnValueare consistent throughout the test file and align with the guideline to prefer synchronous mocks. This improves test performance and simplicity.Based on coding guidelines
Also applies to: 710-710, 1024-1024, 1153-1153, 1181-1181, 1209-1209, 1235-1235, 1261-1261
185-190: LGTM: Chalk mock expanded for additional UI features.The additional chalk methods (
red,blue,magenta,gray,bold,dim) follow the established pattern of returning input text unchanged, consistent with the guideline for mocking chalk functions. This likely supports the new loading spinner UI mentioned in the PR.Based on coding guidelines
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js (1)
366-366: Change is correct—productionloadPromptis synchronous.The production
loadPromptfunction returns values directly (not Promises), confirming that the test mock change frommockResolvedValuetomockReturnValueis appropriate. mockReturnValue sets a mock's synchronous output, matching the production implementation and aligning with the coding guideline to prefer synchronous mocks in tests.
What type of PR is this?
Description
New Features
Improvements
Related Issues
How to Test This
# Example commands or stepsExpected result:
Contributor Checklist
npm run changesetnpm testnpm run format-check(ornpm run formatto fix)Changelog Entry
For Maintainers
Summary by CodeRabbit
New Features
Improvements
Tests