-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Handle missing jsonSchema export in AI SDK #1556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle missing jsonSchema export in AI SDK #1556
Conversation
🦋 Changeset detectedLatest commit: 10f31fd 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 |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughRoutes schema handling in the base AI provider through a new buildSafeSchema flow, adds schema-sanitization helpers, falls back when Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant BaseProvider
participant Zod as ZodLib
participant AISDK
participant jsonSchemaHelper
Client->>BaseProvider: generateObject(params { schema })
BaseProvider->>Zod: build base zodSchema from params.schema
Zod-->>BaseProvider: zodSchema
BaseProvider->>BaseProvider: sanitize jsonSchema (sanitizeIntegerConstraints)
alt jsonSchemaHelper available
BaseProvider->>jsonSchemaHelper: convert/validate sanitized schema
jsonSchemaHelper-->>BaseProvider: enhanced schema
BaseProvider->>AISDK: generateObject({ schema: enhanced schema, ... })
else jsonSchemaHelper unavailable
BaseProvider->>AISDK: generateObject({ schema: sanitized zodSchema, ... })
end
AISDK-->>BaseProvider: structured output / stream
BaseProvider->>BaseProvider: parse/validate (repair fallback if needed)
BaseProvider-->>Client: return parsed object
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Use AI SDK namespace import with jsonSchema fallback so older versions load. Update structured-output test expectations and relax perf threshold flakiness in tool registration tests.
fe783c2 to
0a75d2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.changeset/silent-donkeys-share.mdscripts/modules/task-manager/scope-adjustment.jssrc/ai-providers/base-provider.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.jssrc/schemas/parse-prd.jstests/unit/ai-providers/gemini-cli-structured-output.test.jstests/unit/mcp/tools/tool-registration.test.js
🧰 Additional context used
📓 Path-based instructions (16)
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
**/*.js: Always use isSilentMode() function to check current silent mode status instead of directly accessing the global silentMode variable or global.silentMode
Use try/finally block pattern when wrapping core function calls with enableSilentMode/disableSilentMode to ensure silent mode is always restored, even if errors occur
For functions that need to handle both a passed silentMode parameter and check global state, check both the function parameter and global state: const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())
Functions should accept their dependencies as parameters rather than using globals to promote testability and explicit dependency injection
Define callbacks as separate functions for easier testing rather than inline functions
Files:
scripts/modules/task-manager/scope-adjustment.jstests/unit/ai-providers/gemini-cli-structured-output.test.jssrc/schemas/parse-prd.jstests/unit/mcp/tools/tool-registration.test.jssrc/ai-providers/base-provider.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.js
scripts/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/context_gathering.mdc)
scripts/**/*.js: Use theContextGathererclass fromscripts/modules/utils/contextGatherer.jsto extract context from multiple sources (tasks, files, custom text, project tree) with token counting usinggpt-tokenslibrary
InitializeContextGathererwith project root and tasks path, then callgather()method with tasks array, files array, customContext, includeProjectTree, format ('research', 'chat', or 'system-prompt'), and includeTokenCounts options
Use theFuzzyTaskSearchclass fromscripts/modules/utils/fuzzyTaskSearch.jsfor intelligent task discovery with semantic matching, purpose categorization, and relevance scoring using Fuse.js
Implement a three-step initialization pattern for context-aware commands: (1) validate and parse parameters, (2) initialize context gatherer and find project root, (3) auto-discover relevant tasks using fuzzy search if task IDs not specified
Display token breakdown usingboxenlibrary with sections for tasks, files, and prompts, showing formatted token counts and file sizes in a clean bordered box with title
Process AI result responses usingcli-highlightlibrary to apply syntax highlighting to code blocks with language detection in the formatlanguage\ncode
Set reasonable file size limits (50KB default) and project tree depth limits (3-5 levels) when gathering context to maintain performance
Implement graceful error handling for context gathering: handle missing files with warnings, validate task IDs with helpful messages, continue processing if some context sources fail, and provide fallback behavior
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/**/*
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
Restart the MCP server if core logic in
scripts/modulesor MCP tool definitions change
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/*/[!.]*
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/*/[!.]*: All command files in Task Master must importgetCurrentTagfrom utils.js for tag-aware operations
Every CLI command that operates on tasks must include a--tag <tag>CLI option
Tag resolution must follow the priority order: explicit--tagflag, thengetCurrentTag(projectRoot), then default to 'master'
Find and validate project root in commands with error handling before processing tasks
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.{js,mjs}
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/task-manager/**/*.{js,mjs}: Pass context object{ projectRoot, tag }to all core functions that read or write tasks
Core task functions must accept a context parameter with{ projectRoot, tag }properties
UsereadJSON(tasksPath, projectRoot, tag)andwriteJSON(tasksPath, data, projectRoot, tag)for all task data access
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: AI service functions in core logic (e.g., in scripts/modules/task-manager/) must call the appropriate AI service function (e.g., generateObjectService) and pass commandName and outputType in the params object
Core logic functions must extract mainResult from aiServiceResponse and return an object that includes aiServiceResponse.telemetryData
Core logic functions with outputFormat parameter must check if outputFormat === 'text' and call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js when applicable
Files:
scripts/modules/task-manager/scope-adjustment.js
**/*.{js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
JavaScript test files using Jest must follow the same testing patterns as TypeScript files, include proper mocking of external dependencies, and achieve the same coverage thresholds
Files:
scripts/modules/task-manager/scope-adjustment.jstests/unit/ai-providers/gemini-cli-structured-output.test.jssrc/schemas/parse-prd.jstests/unit/mcp/tools/tool-registration.test.jssrc/ai-providers/base-provider.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts}: Import and use specific getters from config-manager.js (e.g., getMainProvider(), getLogLevel(), getMainMaxTokens()) to access configuration values needed for application logic
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Do not add direct console.log calls outside the logging utility - use the central log function instead
Ensure silent mode is disabled in a finally block to prevent it from staying enabled
Do not access the global silentMode variable directly - use the exported silent mode control functions instead
Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Use ContextGatherer class from utils/contextGatherer.js for AI-powered commands that need project context, supporting tasks, files, custom text, and project tree context
Use FuzzyTaskSearch class from utils/fuzzyTaskSearch.js for automatic task relevance detection with configurable search parameters
Use fuzzy search to supplement user-provided task IDs and display discovered task IDs to users for transparency
Do not replace explicit user task selections with fuzzy results - fuzzy search should supplement, not replace user selections
Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Include error handling for JSON file operations and validate JSON structure after reading
Use path.join() for cross-platform path construction and path.resolve() for absolute paths, validating paths before file operations
Support both .env files and MCP session environment for environment variable resolution with fallbacks for missing values
Prefer updating the core function to accept an outputFormat parameter and check outputFormat === 'json' before displaying UI elements
Files:
scripts/modules/task-manager/scope-adjustment.jstests/unit/ai-providers/gemini-cli-structured-output.test.jssrc/schemas/parse-prd.jstests/unit/mcp/tools/tool-registration.test.jssrc/ai-providers/base-provider.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.js
scripts/modules/task-manager/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
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
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
scripts/modules/**/*.{js,ts}: Implement silent migration for tasks.json files that transforms old format to tagged format, marking global flag and performing complete migration
Implement tag resolution functions (getTasksForTag, setTasksForTag, getCurrentTag) that provide backward compatibility with legacy format and default to master tag
Implement complete migration functions for tagged task lists that handle configuration, state file creation, and migration status tracking
When a logger object is passed as a parameter to core functions, ensure the receiving function can call methods like .info, .warn, .error on that object
Files:
scripts/modules/task-manager/scope-adjustment.js
tests/unit/ai-providers/*.test.js
📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)
Create unit tests in
tests/unit/ai-providers/<provider-name>.test.jsthat mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Files:
tests/unit/ai-providers/gemini-cli-structured-output.test.js
tests/unit/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
Unit tests should be located in tests/unit/ and reflect the module structure with one test file per module
Files:
tests/unit/ai-providers/gemini-cli-structured-output.test.jstests/unit/mcp/tools/tool-registration.test.js
**/*.test.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
**/*.test.{js,ts}: Follow the mock-first-then-import pattern for Jest mocking; use jest.spyOn() for spy functions; clear mocks between tests; verify mocks with the pattern described intests.mdc
Test new features with both legacy and tagged task data formats; verify tag resolution behavior; test migration compatibility; ensure pre-migration projects are handled correctly
Files:
tests/unit/ai-providers/gemini-cli-structured-output.test.jstests/unit/mcp/tools/tool-registration.test.js
**/*.test.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.test.js: Never use asynchronous operations in tests. Always mock tests properly based on the way the tested functions are defined and used.
Follow Jest test file structure: 1) Imports, 2) Mock setup before importing modules under test, 3) Import modules after mocks, 4) Set up spies on mocked modules, 5) Describe suite with descriptive name, 6) Setup/teardown hooks, 7) Grouped tests for related functionality, 8) Individual test cases with clear descriptions using Arrange-Act-Assert pattern.
When testing CLI commands built with Commander.js: test command action handlers directly rather than mocking the entire Commander chain; create simplified test-specific implementations of command handlers; explicitly handle all options including defaults and shorthand flags; include null/undefined checks for optional parameters; use fixtures for consistent sample data.
Usejest.mock()before any imports. Jest hoists mock calls to the top of the file. Always declare mocks before importing modules being tested. Use factory pattern for complex mocks that need access to other variables.
When testing ES modules with dynamic imports, usejest.unstable_mockModule()beforeawait import(). Include__esModule: truein mock factories. Reset mock functions before dynamic import. Mock named and default exports as needed.
Mock file system operations usingmock-fslibrary. Mock API calls by providing jest.fn() implementations that return expected structures. Mock environment variables in test setup.
When testing functions with callbacks: get the callback from mock's call arguments usingmock.calls[index][argIndex]; execute it directly with test inputs; verify results match expectations.
For task file operations in tests: use test-specific file paths (e.g., 'test-tasks.json'); mockreadJSONandwriteJSONto avoid real file system interactions; verify file operations use correct paths; use different paths for each test; verify modifications on in-memory task objects passed t...
Files:
tests/unit/ai-providers/gemini-cli-structured-output.test.jstests/unit/mcp/tools/tool-registration.test.js
tests/unit/**/*.test.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
Locate unit tests in
tests/unit/directory. Test individual functions and utilities in isolation, mock all external dependencies, keep tests small and focused.
Files:
tests/unit/ai-providers/gemini-cli-structured-output.test.jstests/unit/mcp/tools/tool-registration.test.js
src/ai-providers/*.js
📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)
src/ai-providers/*.js: Create a new provider module insrc/ai-providers/<provider-name>.jsthat implementsgenerate<ProviderName>Text,stream<ProviderName>Text, andgenerate<ProviderName>Objectfunctions using the Vercel AI SDK
Provider modules insrc/ai-providers/must importgenerateText,streamText,generateObjectfrom theaipackage, the provider'screate<ProviderName>function from@ai-sdk/<provider-name>, and thelogutility from../../scripts/modules/utils.js
Provider functions must include basic validation and try/catch error handlingsrc/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters
Files:
src/ai-providers/base-provider.js
🧠 Learnings (53)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent and convert between formats appropriately when needed, avoiding circular dependencies between subtasks
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.js
📚 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 : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent properties for subtasks (id, title, description, status, dependencies, details) without duplicating parent task properties, maintaining simple numeric IDs unique within the parent task
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.js
📚 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 : Use numeric IDs for direct task references
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Assign unique sequential IDs to tasks within each tag context by calculating the next ID based on existing tasks (highest existing ID + 1) rather than hardcoding or reusing IDs
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Represent task dependencies as arrays of task IDs, using numeric IDs for direct task references and string IDs with dot notation (e.g., '1.2') for subtask references
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Include all required task properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) in each task object without adding extra properties outside the standard schema
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/analyze-complexity.jssrc/schemas/base-schemas.js
📚 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 : Use string IDs with dot notation (e.g., "1.2") for subtask references
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/base-schemas.js
📚 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 : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently, check for existing dependencies to prevent duplicates, and sort dependencies for better readability when adding dependencies
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/base-schemas.js
📚 Learning: 2025-12-11T14:45:14.973Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-12-11T14:45:14.973Z
Learning: Use task ID format: main tasks as `1`, `2`, `3`; subtasks as `1.1`, `1.2`; sub-subtasks as `1.1.1`, `1.1.2`, etc.
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/base-schemas.js
📚 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 : Represent task dependencies as arrays of task IDs
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/parse-prd.jssrc/schemas/base-schemas.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Follow the provided structure for adding subtasks, including required options and detailed error handling.
Applied to files:
scripts/modules/task-manager/scope-adjustment.jssrc/schemas/base-schemas.js
📚 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 : Support both task and subtask dependencies in cycle detection
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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:
tests/unit/ai-providers/gemini-cli-structured-output.test.jssrc/ai-providers/base-provider.jssrc/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Applied to files:
tests/unit/ai-providers/gemini-cli-structured-output.test.jssrc/ai-providers/base-provider.js
📚 Learning: 2025-11-24T18:03:46.713Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-11-24T18:03:46.713Z
Learning: Applies to **/*.test.js : Do not import or instantiate real AI service clients. Create fully mocked versions that return predictable responses. Mock the entire module with controlled behavior.
Applied to files:
tests/unit/ai-providers/gemini-cli-structured-output.test.jstests/unit/mcp/tools/tool-registration.test.jssrc/ai-providers/base-provider.js
📚 Learning: 2025-11-24T18:03:46.713Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-11-24T18:03:46.713Z
Learning: Applies to **/*.test.js : When testing CLI commands built with Commander.js: test command action handlers directly rather than mocking the entire Commander chain; create simplified test-specific implementations of command handlers; explicitly handle all options including defaults and shorthand flags; include null/undefined checks for optional parameters; use fixtures for consistent sample data.
Applied to files:
tests/unit/ai-providers/gemini-cli-structured-output.test.js
📚 Learning: 2025-11-24T17:57:31.417Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-11-24T17:57:31.417Z
Learning: Applies to scripts/modules/task-manager/*.js, scripts/modules/commands.js : Use `generateTextService` with robust manual JSON parsing and Zod validation instead of `generateObjectService` for structured output needs
Applied to files:
tests/unit/ai-providers/gemini-cli-structured-output.test.js
📚 Learning: 2025-11-24T18:03:46.713Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-11-24T18:03:46.713Z
Learning: Applies to **/*.test.js : When testing functions with callbacks: get the callback from mock's call arguments using `mock.calls[index][argIndex]`; execute it directly with test inputs; verify results match expectations.
Applied to files:
tests/unit/ai-providers/gemini-cli-structured-output.test.js
📚 Learning: 2025-07-20T01:35:05.831Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/task-manager/parse-prd.js:226-226
Timestamp: 2025-07-20T01:35:05.831Z
Learning: The parsePRD function in scripts/modules/task-manager/parse-prd.js has a different parameter structure than other task-manager functions - it uses `options` parameter instead of `context` parameter because it generates tasks from PRD documents rather than operating on existing tasks.
Applied to files:
src/schemas/parse-prd.js
📚 Learning: 2025-12-11T14:45:14.973Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-12-11T14:45:14.973Z
Learning: Applies to assets/.taskmaster/docs/prd.md : Use `task-master parse-prd .taskmaster/docs/prd.md` to generate tasks from PRD document
Applied to files:
src/schemas/parse-prd.js
📚 Learning: 2025-11-25T18:32:29.828Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1444
File: apps/cli/src/utils/auto-update/changelog.ts:103-111
Timestamp: 2025-11-25T18:32:29.828Z
Learning: The claude-task-master project uses a custom changelog format with PR numbers and author acknowledgements in the pattern `- [#PR](...) Thanks [author]! - Description`, which is parsed by the regex in apps/cli/src/utils/auto-update/changelog.ts.
Applied to files:
src/schemas/parse-prd.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI within the current tag context (defaulting to "master"), providing clear prompts to guide AI task generation and validating/cleaning up AI-generated tasks
Applied to files:
src/schemas/parse-prd.js
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Use camelCase with Tool suffix for tool registration functions (e.g., registerListTasksTool)
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: New MCP tools should be imported and registered in mcp-server/src/tools/index.js and tool definitions should be added to mcp.json
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to mcp-server/src/tools/*.js : In MCP tool registration, include optional tag parameter for multi-context support in the Zod schema
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to mcp-server/src/tools/index.js : Register MCP tools by importing and calling registration functions in `mcp-server/src/tools/index.js`
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to **/*.test.{js,ts} : Test new features with both legacy and tagged task data formats; verify tag resolution behavior; test migration compatibility; ensure pre-migration projects are handled correctly
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Include projectRoot as an optional parameter in tool definitions using zod schema
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:03:13.456Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/test_workflow.mdc:0-0
Timestamp: 2025-11-24T18:03:13.456Z
Learning: Applies to tests/e2e/**/*.test.ts : End-to-end tests must test complete user workflows across multiple API endpoints in sequence, verify state changes between workflow steps, use extended timeouts (30000ms), and validate final outcomes without mocking business logic
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:03:46.713Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-11-24T18:03:46.713Z
Learning: Applies to **/*.test.js : Never use asynchronous operations in tests. Always mock tests properly based on the way the tested functions are defined and used.
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T18:03:13.456Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/test_workflow.mdc:0-0
Timestamp: 2025-11-24T18:03:13.456Z
Learning: Applies to tests/setup.ts : Create global test setup file that configures jest.setTimeout(10000), clears all mocks after each test with jest.clearAllMocks(), and initializes global test configuration
Applied to files:
tests/unit/mcp/tools/tool-registration.test.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider modules in `src/ai-providers/` must import `generateText`, `streamText`, `generateObject` from the `ai` package, the provider's `create<ProviderName>` function from `ai-sdk/<provider-name>`, and the `log` utility from `../../scripts/modules/utils.js`
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider functions must include basic validation and try/catch error handling
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to src/ai-providers/*.js : src/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/ai-services-unified.js : In `scripts/modules/ai-services-unified.js`, import new providers and add entries to the `PROVIDER_FUNCTIONS` map with `generateText`, `streamText`, and `generateObject` properties
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-09-24T15:46:28.029Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1114
File: src/ai-providers/gemini-cli.js:12-12
Timestamp: 2025-09-24T15:46:28.029Z
Learning: When AI SDK provider packages are moved from optional dependencies to required dependencies in package.json, static imports should be used instead of dynamic imports with error handling, as the package is guaranteed to be available at runtime.
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/*.{js,ts} : Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T17:57:31.417Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-11-24T17:57:31.417Z
Learning: Applies to scripts/modules/task-manager/*.js, scripts/modules/commands.js, scripts/modules/ai-services-unified.js : Do not import or call anything from deprecated AI service files (`ai-services.js`, `ai-client-factory.js`, `ai-client-utils.js`)
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to scripts/modules/ai-services-unified.js : ai-services-unified.js should export generateTextService and generateObjectService, handle provider/model selection based on role and .taskmasterconfig, resolve API keys, implement fallback and retry logic, and orchestrate calls to provider-specific implementations
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-24T18:02:49.782Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-11-24T18:02:49.782Z
Learning: The telemetryData object structure must include: timestamp (ISO string), userId, commandName, modelUsed, providerName, inputTokens, outputTokens, totalTokens, totalCost, and currency fields
Applied to files:
src/ai-providers/base-provider.js
📚 Learning: 2025-11-12T18:23:46.054Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1386
File: apps/cli/src/ui/formatters/complexity-formatters.ts:27-37
Timestamp: 2025-11-12T18:23:46.054Z
Learning: In the eyaltoledano/claude-task-master codebase, task complexity scores are always integers, never fractional values (e.g., never 7.8 or 8.8). Using parseInt for complexity parsing is appropriate and correct.
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:05:02.114Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/.windsurfrules:0-0
Timestamp: 2025-11-24T18:05:02.114Z
Learning: Use `node scripts/dev.js analyze-complexity --research` to review complexity report in scripts/task-complexity-report.json before task breakdown
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Generate appropriate numbers of subtasks based on task complexity analysis, using recommended subtask counts from complexity analysis when available instead of always using default counts
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:00:06.827Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-11-24T18:00:06.827Z
Learning: Review complexity report via `task-master complexity-report` and focus on tasks with highest complexity scores (8-10) for detailed breakdown
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:00:06.827Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-11-24T18:00:06.827Z
Learning: Run `task-master analyze-complexity --research` for comprehensive complexity analysis before breaking down tasks
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:02:22.305Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/taskmaster.mdc:0-0
Timestamp: 2025-11-24T18:02:22.305Z
Learning: Use analyze_project_complexity before breaking down tasks to identify which tasks need the most attention based on complexity scores and recommendations
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:05:02.114Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/.windsurfrules:0-0
Timestamp: 2025-11-24T18:05:02.114Z
Learning: Analyze task complexity with `task-master analyze-complexity --research` before breaking down tasks
Applied to files:
src/schemas/analyze-complexity.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Format task files with consistent structure including task metadata (ID, title, status), dependencies with status indicators, and tag context information in the file header
Applied to files:
src/schemas/base-schemas.js
📚 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 : Format task and dependency IDs consistently when adding dependencies
Applied to files:
src/schemas/base-schemas.js
⏰ 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: Cursor Bugbot
🔇 Additional comments (7)
.changeset/silent-donkeys-share.md (1)
1-5: LGTM - Changeset documentation is clear.The changeset appropriately documents the patch-level update removing integer constraints from schemas for Anthropic compatibility.
tests/unit/mcp/tools/tool-registration.test.js (1)
332-332: LGTM - Reasonable adjustment to reduce test flakiness.Increasing the performance threshold from 100ms to 200ms is appropriate to reduce false failures while still maintaining a reasonable performance expectation for tool registration.
tests/unit/ai-providers/gemini-cli-structured-output.test.js (1)
104-104: LGTM - Test correctly updated to match schema wrapper behavior.The test expectation now correctly validates that the schema is wrapped with the
_zodSchemaproperty, aligning with thezodSchemawrapper behavior used in bothgenerateObjectandstreamObjectcalls. This is consistent with the implementation changes in base-provider.js.src/ai-providers/base-provider.js (4)
20-49: LGTM - Well-organized schema traversal constants.The constants clearly define which JSON Schema properties need to be traversed during sanitization. The
isIntegerTypehelper correctly handles both string and array type values.
454-454: LGTM - Consistent use of safe schema across structured output methods.Both
streamObjectandgenerateObjectnow consistently usebuildSafeSchemato sanitize schemas before passing them to the AI SDK. This ensures uniform behavior across all structured output operations.Also applies to: 519-519
1-18: Namespace import pattern safely handles missing jsonSchema export.The code correctly uses namespace import with conditional type checking to provide fallback behavior for AI SDK versions that don't export
jsonSchema. At line 18,ai.jsonSchemais safely assigned (returningundefinedif missing). ThebuildSafeSchemafunction then validates this at line 111 withtypeof jsonSchemaHelper === 'function', calling it if available or falling back to a reconstructed schema object at line 115. This defensive pattern maintains backward compatibility while supporting newer AI SDK versions.
51-97: Remove the deadbuildSafeSchemaandsanitizeIntegerConstraintsfunctions—they are never called and create misleading code.The
buildSafeSchemafunction is defined but never exported or invoked anywhere in the codebase. Schemas flow directly fromCOMMAND_SCHEMASthroughgenerateObjectServiceto the Vercel AI SDK with all Zod constraints intact (e.g.,ComplexityAnalysisItemSchema'scomplexityScore: z.number().min(1).max(10)andBaseTaskSchema'sid: z.number().int().positive()). The integer constraint removal logic is dead code that should be removed to avoid future confusion about schema validation behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Ensure structured-output calls use buildSafeSchema so the jsonSchema fallback path is exercised.
Ensure AI-generated subtasks have unique ids and a 1..N sequence before normalization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
scripts/modules/task-manager/scope-adjustment.js (2)
445-464: Consider enhancing error messages with specific ID details.The validation logic is sound and correctly enforces unique, sequential IDs starting from 1. However, the error messages could be more helpful for debugging by including the problematic ID values.
🔎 Proposed enhancement for more informative error messages
function ensureSequentialSubtaskIds(subtasks) { if (!Array.isArray(subtasks) || subtasks.length === 0) { return; } const ids = subtasks.map((subtask) => subtask.id); const uniqueIds = new Set(ids); if (uniqueIds.size !== ids.length) { + const duplicates = ids.filter((id, index) => ids.indexOf(id) !== index); - throw new Error('Generated subtasks must have unique ids'); + throw new Error( + `Generated subtasks must have unique ids. Duplicate IDs found: ${[...new Set(duplicates)].join(', ')}` + ); } const sortedIds = [...uniqueIds].sort((a, b) => a - b); for (let index = 0; index < sortedIds.length; index += 1) { if (sortedIds[index] !== index + 1) { throw new Error( - 'Generated subtask ids must be sequential starting from 1' + `Generated subtask ids must be sequential starting from 1. Expected ${index + 1}, found ${sortedIds[index]}. IDs: [${sortedIds.join(', ')}]` ); } } }
445-464: Consider exporting for potential reuse in expand-task.js.The validation function is currently internal to this module. If expand-task.js or other modules also generate subtasks and need the same validation, consider exporting this function to promote code reuse and consistent validation across the codebase.
Based on the relevant code snippet showing
expand-task.jshas ageneratedSubtasksvariable, that module might benefit from this same validation logic.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/fix-ai-sdk-jsonschema-fallback.mdscripts/modules/task-manager/scope-adjustment.js
🧰 Additional context used
📓 Path-based instructions (10)
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
**/*.js: Always use isSilentMode() function to check current silent mode status instead of directly accessing the global silentMode variable or global.silentMode
Use try/finally block pattern when wrapping core function calls with enableSilentMode/disableSilentMode to ensure silent mode is always restored, even if errors occur
For functions that need to handle both a passed silentMode parameter and check global state, check both the function parameter and global state: const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())
Functions should accept their dependencies as parameters rather than using globals to promote testability and explicit dependency injection
Define callbacks as separate functions for easier testing rather than inline functions
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/context_gathering.mdc)
scripts/**/*.js: Use theContextGathererclass fromscripts/modules/utils/contextGatherer.jsto extract context from multiple sources (tasks, files, custom text, project tree) with token counting usinggpt-tokenslibrary
InitializeContextGathererwith project root and tasks path, then callgather()method with tasks array, files array, customContext, includeProjectTree, format ('research', 'chat', or 'system-prompt'), and includeTokenCounts options
Use theFuzzyTaskSearchclass fromscripts/modules/utils/fuzzyTaskSearch.jsfor intelligent task discovery with semantic matching, purpose categorization, and relevance scoring using Fuse.js
Implement a three-step initialization pattern for context-aware commands: (1) validate and parse parameters, (2) initialize context gatherer and find project root, (3) auto-discover relevant tasks using fuzzy search if task IDs not specified
Display token breakdown usingboxenlibrary with sections for tasks, files, and prompts, showing formatted token counts and file sizes in a clean bordered box with title
Process AI result responses usingcli-highlightlibrary to apply syntax highlighting to code blocks with language detection in the formatlanguage\ncode
Set reasonable file size limits (50KB default) and project tree depth limits (3-5 levels) when gathering context to maintain performance
Implement graceful error handling for context gathering: handle missing files with warnings, validate task IDs with helpful messages, continue processing if some context sources fail, and provide fallback behavior
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/**/*
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
Restart the MCP server if core logic in
scripts/modulesor MCP tool definitions change
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/*/[!.]*
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/*/[!.]*: All command files in Task Master must importgetCurrentTagfrom utils.js for tag-aware operations
Every CLI command that operates on tasks must include a--tag <tag>CLI option
Tag resolution must follow the priority order: explicit--tagflag, thengetCurrentTag(projectRoot), then default to 'master'
Find and validate project root in commands with error handling before processing tasks
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.{js,mjs}
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/task-manager/**/*.{js,mjs}: Pass context object{ projectRoot, tag }to all core functions that read or write tasks
Core task functions must accept a context parameter with{ projectRoot, tag }properties
UsereadJSON(tasksPath, projectRoot, tag)andwriteJSON(tasksPath, data, projectRoot, tag)for all task data access
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: AI service functions in core logic (e.g., in scripts/modules/task-manager/) must call the appropriate AI service function (e.g., generateObjectService) and pass commandName and outputType in the params object
Core logic functions must extract mainResult from aiServiceResponse and return an object that includes aiServiceResponse.telemetryData
Core logic functions with outputFormat parameter must check if outputFormat === 'text' and call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js when applicable
Files:
scripts/modules/task-manager/scope-adjustment.js
**/*.{js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
JavaScript test files using Jest must follow the same testing patterns as TypeScript files, include proper mocking of external dependencies, and achieve the same coverage thresholds
Files:
scripts/modules/task-manager/scope-adjustment.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts}: Import and use specific getters from config-manager.js (e.g., getMainProvider(), getLogLevel(), getMainMaxTokens()) to access configuration values needed for application logic
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Do not add direct console.log calls outside the logging utility - use the central log function instead
Ensure silent mode is disabled in a finally block to prevent it from staying enabled
Do not access the global silentMode variable directly - use the exported silent mode control functions instead
Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Use ContextGatherer class from utils/contextGatherer.js for AI-powered commands that need project context, supporting tasks, files, custom text, and project tree context
Use FuzzyTaskSearch class from utils/fuzzyTaskSearch.js for automatic task relevance detection with configurable search parameters
Use fuzzy search to supplement user-provided task IDs and display discovered task IDs to users for transparency
Do not replace explicit user task selections with fuzzy results - fuzzy search should supplement, not replace user selections
Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Include error handling for JSON file operations and validate JSON structure after reading
Use path.join() for cross-platform path construction and path.resolve() for absolute paths, validating paths before file operations
Support both .env files and MCP session environment for environment variable resolution with fallbacks for missing values
Prefer updating the core function to accept an outputFormat parameter and check outputFormat === 'json' before displaying UI elements
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
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
Files:
scripts/modules/task-manager/scope-adjustment.js
scripts/modules/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
scripts/modules/**/*.{js,ts}: Implement silent migration for tasks.json files that transforms old format to tagged format, marking global flag and performing complete migration
Implement tag resolution functions (getTasksForTag, setTasksForTag, getCurrentTag) that provide backward compatibility with legacy format and default to master tag
Implement complete migration functions for tagged task lists that handle configuration, state file creation, and migration status tracking
When a logger object is passed as a parameter to core functions, ensure the receiving function can call methods like .info, .warn, .error on that object
Files:
scripts/modules/task-manager/scope-adjustment.js
🧠 Learnings (28)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1444
File: apps/cli/src/utils/auto-update/changelog.ts:103-111
Timestamp: 2025-11-25T18:32:29.828Z
Learning: The claude-task-master project uses a custom changelog format with PR numbers and author acknowledgements in the pattern `- [#PR](...) Thanks [author]! - Description`, which is parsed by the regex in apps/cli/src/utils/auto-update/changelog.ts.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/oauth-service.ts:20-20
Timestamp: 2025-09-03T13:46:00.640Z
Learning: For Node.js v22 and later, JSON imports should use `with { type: 'json' }` syntax, not `assert { type: 'json' }`. The `assert` syntax was removed in Node.js v22 in favor of the `with` syntax for import attributes. This applies to the eyaltoledano/claude-task-master codebase which uses Node.js v24.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 943
File: scripts/modules/task-manager/move-task.js:24-24
Timestamp: 2025-07-18T05:38:17.352Z
Learning: In the Claude Task Master system, core task-manager functions are designed with fallback mechanisms for missing projectRoot parameters using the pattern `const projectRoot = providedProjectRoot || findProjectRoot();`. The readJSON and writeJSON functions have default parameters (projectRoot = null, tag = null) and handle missing parameters gracefully. Adding strict validation to these core functions would break the established flexible architecture pattern.
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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider functions must include basic validation and try/catch error handling
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Assign unique sequential IDs to tasks within each tag context by calculating the next ID based on existing tasks (highest existing ID + 1) rather than hardcoding or reusing IDs
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent and convert between formats appropriately when needed, avoiding circular dependencies between subtasks
Applied to files:
scripts/modules/task-manager/scope-adjustment.js.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 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 : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
scripts/modules/task-manager/scope-adjustment.js.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent properties for subtasks (id, title, description, status, dependencies, details) without duplicating parent task properties, maintaining simple numeric IDs unique within the parent task
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Generate appropriate numbers of subtasks based on task complexity analysis, using recommended subtask counts from complexity analysis when available instead of always using default counts
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Do not create circular dependencies between subtasks
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently, check for existing dependencies to prevent duplicates, and sort dependencies for better readability when adding dependencies
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Implement status update functions that handle both individual tasks and subtasks within the current tag context, considering subtask status when updating parent tasks and suggesting parent task updates when all subtasks are done
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Represent task dependencies as arrays of task IDs, using numeric IDs for direct task references and string IDs with dot notation (e.g., '1.2') for subtask references
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Support both task and subtask dependencies in cycle detection
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Use numeric IDs for direct task references
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Use string IDs with dot notation (e.g., "1.2") for subtask references
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: `task_${id.toString().padStart(3, '0')}.txt` for task files; use `path.join()` for composing paths; use appropriate extensions (.txt for tasks, .json for data)
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI within the current tag context (defaulting to "master"), providing clear prompts to guide AI task generation and validating/cleaning up AI-generated tasks
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:49.782Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-11-24T18:02:49.782Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Core logic functions must extract mainResult from aiServiceResponse and return an object that includes aiServiceResponse.telemetryData
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-12-01T20:55:21.627Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/hamster.mdc:0-0
Timestamp: 2025-12-01T20:55:21.627Z
Learning: Implement subtasks one at a time and check for subtasks when starting a task
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-12-01T20:55:21.627Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/hamster.mdc:0-0
Timestamp: 2025-12-01T20:55:21.627Z
Learning: When parallelizing subtask execution, ensure work and files to adjust are not the same across subtasks and spawn sub-agents for each parallel subtask
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Follow the provided structure for adding subtasks, including required options and detailed error handling.
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T18:02:22.305Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/taskmaster.mdc:0-0
Timestamp: 2025-11-24T18:02:22.305Z
Learning: Applies to .taskmaster/config.json : The .taskmaster/config.json file stores AI model configuration (main, research, fallback models) managed via 'task-master models' command
Applied to files:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to scripts/modules/task-manager/**/*.{js,ts} : 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:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to scripts/modules/task-manager.js : task-manager.js should handle reading/writing tasks.json with tagged task lists support, implement CRUD operations, delegate AI interactions to ai-services-unified.js layer, and access non-AI configuration via config-manager.js getters
Applied to files:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T17:57:31.417Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-11-24T17:57:31.417Z
Learning: Applies to scripts/modules/task-manager/*.js, scripts/modules/commands.js, scripts/modules/ai-services-unified.js : Do not import or call anything from deprecated AI service files (`ai-services.js`, `ai-client-factory.js`, `ai-client-utils.js`)
Applied to files:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T17:57:31.417Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-11-24T17:57:31.417Z
Learning: Applies to scripts/modules/task-manager/*.js, scripts/modules/commands.js : Do not fetch AI-specific parameters (model ID, max tokens, temperature) using `config-manager.js` getters for AI calls; pass the `role` parameter instead to the unified service
Applied to files:
.changeset/fix-ai-sdk-jsonschema-fallback.md
📚 Learning: 2025-11-24T17:57:31.417Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-11-24T17:57:31.417Z
Learning: Applies to scripts/modules/task-manager/*.js, scripts/modules/commands.js : Do not implement fallback or retry logic outside `ai-services-unified.js`; all fallback sequences and retry logic must be centralized in the unified service
Applied to files:
.changeset/fix-ai-sdk-jsonschema-fallback.md
🧬 Code graph analysis (1)
scripts/modules/task-manager/scope-adjustment.js (1)
scripts/modules/task-manager/expand-task.js (1)
generatedSubtasks(304-304)
⏰ 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: Cursor Bugbot
🔇 Additional comments (2)
scripts/modules/task-manager/scope-adjustment.js (1)
381-381: LGTM: Validation called at the right time.The validation is correctly placed immediately after extracting AI-generated subtasks and before the expensive ID remapping operations. This fail-fast approach prevents wasted processing on invalid data.
.changeset/fix-ai-sdk-jsonschema-fallback.md (1)
1-12: LGTM: Changeset properly documents the patch changes.The changeset follows the correct format, appropriately specifies a patch version bump for this compatibility fix, and clearly summarizes both the jsonSchema fallback handling and the subtask ID validation improvements.
|
Ran full test suite: |
|
Fixed the review note: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (1)
178-211: Consider exporting for testability and add documentation.The validation logic is solid and thorough. A few optional improvements:
Testability: Consider exporting this function to enable unit testing of the validation logic in isolation.
Documentation: Add a JSDoc comment explaining why the function accepts tasks starting at either
1orexpectedStartId. This dual acceptance (line 198-202) is intentional but might confuse future maintainers. Based on the PR objectives, this appears to support both fresh PRD parsing (IDs start at 1) and append scenarios (IDs might start at nextId).Defensive check: Line 183 could explicitly validate that
task.idexists before mapping:const ids = rawTasks.map((task) => { if (task.id === undefined || task.id === null) { throw new Error('All PRD tasks must have an id property.'); } return task.id; });While the integer check catches this later, an explicit check would provide clearer error messages.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
🧰 Additional context used
📓 Path-based instructions (10)
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
**/*.js: Always use isSilentMode() function to check current silent mode status instead of directly accessing the global silentMode variable or global.silentMode
Use try/finally block pattern when wrapping core function calls with enableSilentMode/disableSilentMode to ensure silent mode is always restored, even if errors occur
For functions that need to handle both a passed silentMode parameter and check global state, check both the function parameter and global state: const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())
Functions should accept their dependencies as parameters rather than using globals to promote testability and explicit dependency injection
Define callbacks as separate functions for easier testing rather than inline functions
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/context_gathering.mdc)
scripts/**/*.js: Use theContextGathererclass fromscripts/modules/utils/contextGatherer.jsto extract context from multiple sources (tasks, files, custom text, project tree) with token counting usinggpt-tokenslibrary
InitializeContextGathererwith project root and tasks path, then callgather()method with tasks array, files array, customContext, includeProjectTree, format ('research', 'chat', or 'system-prompt'), and includeTokenCounts options
Use theFuzzyTaskSearchclass fromscripts/modules/utils/fuzzyTaskSearch.jsfor intelligent task discovery with semantic matching, purpose categorization, and relevance scoring using Fuse.js
Implement a three-step initialization pattern for context-aware commands: (1) validate and parse parameters, (2) initialize context gatherer and find project root, (3) auto-discover relevant tasks using fuzzy search if task IDs not specified
Display token breakdown usingboxenlibrary with sections for tasks, files, and prompts, showing formatted token counts and file sizes in a clean bordered box with title
Process AI result responses usingcli-highlightlibrary to apply syntax highlighting to code blocks with language detection in the formatlanguage\ncode
Set reasonable file size limits (50KB default) and project tree depth limits (3-5 levels) when gathering context to maintain performance
Implement graceful error handling for context gathering: handle missing files with warnings, validate task IDs with helpful messages, continue processing if some context sources fail, and provide fallback behavior
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/modules/**/*
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
Restart the MCP server if core logic in
scripts/modulesor MCP tool definitions change
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.{js,mjs}
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/task-manager/**/*.{js,mjs}: Pass context object{ projectRoot, tag }to all core functions that read or write tasks
Core task functions must accept a context parameter with{ projectRoot, tag }properties
UsereadJSON(tasksPath, projectRoot, tag)andwriteJSON(tasksPath, data, projectRoot, tag)for all task data access
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: AI service functions in core logic (e.g., in scripts/modules/task-manager/) must call the appropriate AI service function (e.g., generateObjectService) and pass commandName and outputType in the params object
Core logic functions must extract mainResult from aiServiceResponse and return an object that includes aiServiceResponse.telemetryData
Core logic functions with outputFormat parameter must check if outputFormat === 'text' and call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js when applicable
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
**/*.{js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
JavaScript test files using Jest must follow the same testing patterns as TypeScript files, include proper mocking of external dependencies, and achieve the same coverage thresholds
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts}: Import and use specific getters from config-manager.js (e.g., getMainProvider(), getLogLevel(), getMainMaxTokens()) to access configuration values needed for application logic
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Do not add direct console.log calls outside the logging utility - use the central log function instead
Ensure silent mode is disabled in a finally block to prevent it from staying enabled
Do not access the global silentMode variable directly - use the exported silent mode control functions instead
Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Use ContextGatherer class from utils/contextGatherer.js for AI-powered commands that need project context, supporting tasks, files, custom text, and project tree context
Use FuzzyTaskSearch class from utils/fuzzyTaskSearch.js for automatic task relevance detection with configurable search parameters
Use fuzzy search to supplement user-provided task IDs and display discovered task IDs to users for transparency
Do not replace explicit user task selections with fuzzy results - fuzzy search should supplement, not replace user selections
Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Include error handling for JSON file operations and validate JSON structure after reading
Use path.join() for cross-platform path construction and path.resolve() for absolute paths, validating paths before file operations
Support both .env files and MCP session environment for environment variable resolution with fallbacks for missing values
Prefer updating the core function to accept an outputFormat parameter and check outputFormat === 'json' before displaying UI elements
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/modules/task-manager/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
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
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/modules/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
scripts/modules/**/*.{js,ts}: Implement silent migration for tasks.json files that transforms old format to tagged format, marking global flag and performing complete migration
Implement tag resolution functions (getTasksForTag, setTasksForTag, getCurrentTag) that provide backward compatibility with legacy format and default to master tag
Implement complete migration functions for tagged task lists that handle configuration, state file creation, and migration status tracking
When a logger object is passed as a parameter to core functions, ensure the receiving function can call methods like .info, .warn, .error on that object
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
scripts/modules/*/[!.]*
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/*/[!.]*: All command files in Task Master must importgetCurrentTagfrom utils.js for tag-aware operations
Every CLI command that operates on tasks must include a--tag <tag>CLI option
Tag resolution must follow the priority order: explicit--tagflag, thengetCurrentTag(projectRoot), then default to 'master'
Find and validate project root in commands with error handling before processing tasks
Files:
scripts/modules/task-manager/scope-adjustment.js
🧠 Learnings (30)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1444
File: apps/cli/src/utils/auto-update/changelog.ts:103-111
Timestamp: 2025-11-25T18:32:29.828Z
Learning: The claude-task-master project uses a custom changelog format with PR numbers and author acknowledgements in the pattern `- [#PR](...) Thanks [author]! - Description`, which is parsed by the regex in apps/cli/src/utils/auto-update/changelog.ts.
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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI within the current tag context (defaulting to "master"), providing clear prompts to guide AI task generation and validating/cleaning up AI-generated tasks
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider functions must include basic validation and try/catch error handling
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Assign unique sequential IDs to tasks within each tag context by calculating the next ID based on existing tasks (highest existing ID + 1) rather than hardcoding or reusing IDs
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI within the current tag context (defaulting to "master"), providing clear prompts to guide AI task generation and validating/cleaning up AI-generated tasks
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent properties for subtasks (id, title, description, status, dependencies, details) without duplicating parent task properties, maintaining simple numeric IDs unique within the parent task
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent and convert between formats appropriately when needed, avoiding circular dependencies between subtasks
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently, check for existing dependencies to prevent duplicates, and sort dependencies for better readability when adding dependencies
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/*.{js,ts} : Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 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 : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-07-20T01:35:05.831Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/task-manager/parse-prd.js:226-226
Timestamp: 2025-07-20T01:35:05.831Z
Learning: The parsePRD function in scripts/modules/task-manager/parse-prd.js has a different parameter structure than other task-manager functions - it uses `options` parameter instead of `context` parameter because it generates tasks from PRD documents rather than operating on existing tasks.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 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 : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Format task files with consistent structure including task metadata (ID, title, status), dependencies with status indicators, and tag context information in the file header
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to scripts/modules/*.js : Design core logic to work with both legacy (flat tasks array) and tagged task data formats; use tag resolution functions (getTasksForTag, setTasksForTag) for task data access; support silent migration during feature usage
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:05:02.114Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/.windsurfrules:0-0
Timestamp: 2025-11-24T18:05:02.114Z
Learning: Select tasks based on dependencies (all marked 'done'), priority level, and ID order
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 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 : Represent task dependencies as arrays of task IDs
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Represent task dependencies as arrays of task IDs, using numeric IDs for direct task references and string IDs with dot notation (e.g., '1.2') for subtask references
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Generate appropriate numbers of subtasks based on task complexity analysis, using recommended subtask counts from complexity analysis when available instead of always using default counts
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/{utils,utilities}/**/*.{js,ts} : Create utilities for consistent task ID handling that support different ID formats (numeric, string, dot notation)
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Include all required task properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) in each task object without adding extra properties outside the standard schema
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:04.644Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-11-24T18:02:04.644Z
Learning: Applies to scripts/modules/task-manager/**/*.{js,mjs} : Use `readJSON(tasksPath, projectRoot, tag)` and `writeJSON(tasksPath, data, projectRoot, tag)` for all task data access
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: `task_${id.toString().padStart(3, '0')}.txt` for task files; use `path.join()` for composing paths; use appropriate extensions (.txt for tasks, .json for data)
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jsscripts/modules/task-manager/scope-adjustment.js
📚 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 : Do not create circular dependencies between subtasks
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Implement status update functions that handle both individual tasks and subtasks within the current tag context, considering subtask status when updating parent tasks and suggesting parent task updates when all subtasks are done
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Support both task and subtask dependencies in cycle detection
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Use numeric IDs for direct task references
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 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 : Use string IDs with dot notation (e.g., "1.2") for subtask references
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-12T18:23:46.054Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1386
File: apps/cli/src/ui/formatters/complexity-formatters.ts:27-37
Timestamp: 2025-11-12T18:23:46.054Z
Learning: In the eyaltoledano/claude-task-master codebase, task complexity scores are always integers, never fractional values (e.g., never 7.8 or 8.8). Using parseInt for complexity parsing is appropriate and correct.
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-11-24T18:02:49.782Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-11-24T18:02:49.782Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Core logic functions must extract mainResult from aiServiceResponse and return an object that includes aiServiceResponse.telemetryData
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-12-01T20:55:21.627Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/hamster.mdc:0-0
Timestamp: 2025-12-01T20:55:21.627Z
Learning: Implement subtasks one at a time and check for subtasks when starting a task
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-12-01T20:55:21.627Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/hamster.mdc:0-0
Timestamp: 2025-12-01T20:55:21.627Z
Learning: When parallelizing subtask execution, ensure work and files to adjust are not the same across subtasks and spawn sub-agents for each parallel subtask
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Follow the provided structure for adding subtasks, including required options and detailed error handling.
Applied to files:
scripts/modules/task-manager/scope-adjustment.js
⏰ 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: Cursor Bugbot
🔇 Additional comments (4)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (1)
136-137: Good addition of validation guard.Adding this runtime validation ensures that AI-generated tasks have unique, sequential IDs before processing. This will catch malformed AI responses early and provide clear error messages to users.
scripts/modules/task-manager/scope-adjustment.js (3)
445-467: LGTM! Robust validation ensures ID integrity.The
ensureSequentialSubtaskIdsfunction correctly validates that AI-generated subtasks have:
- Positive integer IDs (line 451)
- Unique IDs (lines 454-457)
- Sequential ordering starting from 1 (lines 459-466)
This provides essential validation beyond the Zod schema constraints, ensuring that subtasks meet the sequential ID requirements documented in the learnings before ID remapping occurs.
381-381: LGTM! Validation placement follows fail-fast pattern.Calling
ensureSequentialSubtaskIdsimmediately after extracting the AI result (line 381) is the correct approach. This validates that the AI followed the sequential ID instructions before the ID remapping logic (lines 391-418) assigns final IDs to avoid conflicts with preserved subtasks. The fail-fast validation aligns with the project's broader pattern of enforcing sequential, unique IDs during generation (as seen in parse-prd-helpers.js).
358-358: The code correctly uses Zod 4 API. The.positive()method is available for number schemas in Zod 4 and validates that values are strictly greater than 0. The linez.int().positive()is valid and properly implements the schema constraint for sequential positive integers starting from 1.
|
@coderabbitai generate docstrings |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @TheLazyIndianTechie. * #1556 (comment) The following files were modified: * `scripts/modules/task-manager/parse-prd/parse-prd-helpers.js` * `scripts/modules/task-manager/scope-adjustment.js`
Crunchyman-ralph
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix CI and should be good to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (1)
178-213: Consider renaming local variable for clarity.The local variable
startIdon line 199 conceptually shadows the parameterexpectedStartId, which may reduce readability. While the logic is correct, renaming the local variable (e.g.,actualStartIdorfirstId) would make the distinction clearer.🔎 Suggested refactor for clarity
function validateSequentialTaskIds(rawTasks, expectedStartId = 1) { if (!Array.isArray(rawTasks) || rawTasks.length === 0) { return; } const ids = rawTasks.map((task) => task.id); if (ids.some((id) => !Number.isInteger(id) || id < 1)) { throw new Error( 'PRD tasks must use sequential positive integer IDs starting at 1.' ); } const uniqueIds = new Set(ids); if (uniqueIds.size !== ids.length) { throw new Error( 'PRD task IDs must be unique and sequential starting at 1.' ); } const sortedIds = [...uniqueIds].sort((a, b) => a - b); - const startId = sortedIds[0]; - if (startId !== 1 && startId !== expectedStartId) { + const actualStartId = sortedIds[0]; + if (actualStartId !== 1 && actualStartId !== expectedStartId) { throw new Error( `PRD task IDs must start at 1 or ${expectedStartId} and be sequential.` ); } for (let index = 0; index < sortedIds.length; index += 1) { - if (sortedIds[index] !== startId + index) { + if (sortedIds[index] !== actualStartId + index) { throw new Error( - `PRD task IDs must be a contiguous sequence starting at ${startId}.` + `PRD task IDs must be a contiguous sequence starting at ${actualStartId}.` ); } } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/ai-providers/base-provider.jssrc/schemas/base-schemas.js
🚧 Files skipped from review as they are similar to previous changes (1)
- src/ai-providers/base-provider.js
🧰 Additional context used
📓 Path-based instructions (9)
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
**/*.js: Always use isSilentMode() function to check current silent mode status instead of directly accessing the global silentMode variable or global.silentMode
Use try/finally block pattern when wrapping core function calls with enableSilentMode/disableSilentMode to ensure silent mode is always restored, even if errors occur
For functions that need to handle both a passed silentMode parameter and check global state, check both the function parameter and global state: const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())
Functions should accept their dependencies as parameters rather than using globals to promote testability and explicit dependency injection
Define callbacks as separate functions for easier testing rather than inline functions
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
scripts/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/context_gathering.mdc)
scripts/**/*.js: Use theContextGathererclass fromscripts/modules/utils/contextGatherer.jsto extract context from multiple sources (tasks, files, custom text, project tree) with token counting usinggpt-tokenslibrary
InitializeContextGathererwith project root and tasks path, then callgather()method with tasks array, files array, customContext, includeProjectTree, format ('research', 'chat', or 'system-prompt'), and includeTokenCounts options
Use theFuzzyTaskSearchclass fromscripts/modules/utils/fuzzyTaskSearch.jsfor intelligent task discovery with semantic matching, purpose categorization, and relevance scoring using Fuse.js
Implement a three-step initialization pattern for context-aware commands: (1) validate and parse parameters, (2) initialize context gatherer and find project root, (3) auto-discover relevant tasks using fuzzy search if task IDs not specified
Display token breakdown usingboxenlibrary with sections for tasks, files, and prompts, showing formatted token counts and file sizes in a clean bordered box with title
Process AI result responses usingcli-highlightlibrary to apply syntax highlighting to code blocks with language detection in the formatlanguage\ncode
Set reasonable file size limits (50KB default) and project tree depth limits (3-5 levels) when gathering context to maintain performance
Implement graceful error handling for context gathering: handle missing files with warnings, validate task IDs with helpful messages, continue processing if some context sources fail, and provide fallback behavior
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
scripts/modules/**/*
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
Restart the MCP server if core logic in
scripts/modulesor MCP tool definitions change
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
scripts/modules/task-manager/**/*.{js,mjs}
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/task-manager/**/*.{js,mjs}: Pass context object{ projectRoot, tag }to all core functions that read or write tasks
Core task functions must accept a context parameter with{ projectRoot, tag }properties
UsereadJSON(tasksPath, projectRoot, tag)andwriteJSON(tasksPath, data, projectRoot, tag)for all task data access
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: AI service functions in core logic (e.g., in scripts/modules/task-manager/) must call the appropriate AI service function (e.g., generateObjectService) and pass commandName and outputType in the params object
Core logic functions must extract mainResult from aiServiceResponse and return an object that includes aiServiceResponse.telemetryData
Core logic functions with outputFormat parameter must check if outputFormat === 'text' and call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js when applicable
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
**/*.{js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
JavaScript test files using Jest must follow the same testing patterns as TypeScript files, include proper mocking of external dependencies, and achieve the same coverage thresholds
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts}: Import and use specific getters from config-manager.js (e.g., getMainProvider(), getLogLevel(), getMainMaxTokens()) to access configuration values needed for application logic
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Do not add direct console.log calls outside the logging utility - use the central log function instead
Ensure silent mode is disabled in a finally block to prevent it from staying enabled
Do not access the global silentMode variable directly - use the exported silent mode control functions instead
Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Use ContextGatherer class from utils/contextGatherer.js for AI-powered commands that need project context, supporting tasks, files, custom text, and project tree context
Use FuzzyTaskSearch class from utils/fuzzyTaskSearch.js for automatic task relevance detection with configurable search parameters
Use fuzzy search to supplement user-provided task IDs and display discovered task IDs to users for transparency
Do not replace explicit user task selections with fuzzy results - fuzzy search should supplement, not replace user selections
Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Include error handling for JSON file operations and validate JSON structure after reading
Use path.join() for cross-platform path construction and path.resolve() for absolute paths, validating paths before file operations
Support both .env files and MCP session environment for environment variable resolution with fallbacks for missing values
Prefer updating the core function to accept an outputFormat parameter and check outputFormat === 'json' before displaying UI elements
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
scripts/modules/task-manager/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
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
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
scripts/modules/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
scripts/modules/**/*.{js,ts}: Implement silent migration for tasks.json files that transforms old format to tagged format, marking global flag and performing complete migration
Implement tag resolution functions (getTasksForTag, setTasksForTag, getCurrentTag) that provide backward compatibility with legacy format and default to master tag
Implement complete migration functions for tagged task lists that handle configuration, state file creation, and migration status tracking
When a logger object is passed as a parameter to core functions, ensure the receiving function can call methods like .info, .warn, .error on that object
Files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
🧠 Learnings (27)
📓 Common learnings
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.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI within the current tag context (defaulting to "master"), providing clear prompts to guide AI task generation and validating/cleaning up AI-generated tasks
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider functions must include basic validation and try/catch error handling
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to scripts/modules/task-manager.js : task-manager.js should handle reading/writing tasks.json with tagged task lists support, implement CRUD operations, delegate AI interactions to ai-services-unified.js layer, and access non-AI configuration via config-manager.js getters
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Assign unique sequential IDs to tasks within each tag context by calculating the next ID based on existing tasks (highest existing ID + 1) rather than hardcoding or reusing IDs
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI within the current tag context (defaulting to "master"), providing clear prompts to guide AI task generation and validating/cleaning up AI-generated tasks
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent properties for subtasks (id, title, description, status, dependencies, details) without duplicating parent task properties, maintaining simple numeric IDs unique within the parent task
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently, check for existing dependencies to prevent duplicates, and sort dependencies for better readability when adding dependencies
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent and convert between formats appropriately when needed, avoiding circular dependencies between subtasks
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/*.{js,ts} : Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-07-20T01:35:05.831Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/task-manager/parse-prd.js:226-226
Timestamp: 2025-07-20T01:35:05.831Z
Learning: The parsePRD function in scripts/modules/task-manager/parse-prd.js has a different parameter structure than other task-manager functions - it uses `options` parameter instead of `context` parameter because it generates tasks from PRD documents rather than operating on existing tasks.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Format task files with consistent structure including task metadata (ID, title, status), dependencies with status indicators, and tag context information in the file header
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 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 : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/{utils,utilities}/**/*.{js,ts} : Create utilities for consistent task ID handling that support different ID formats (numeric, string, dot notation)
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to scripts/modules/*.js : Design core logic to work with both legacy (flat tasks array) and tagged task data formats; use tag resolution functions (getTasksForTag, setTasksForTag) for task data access; support silent migration during feature usage
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:05:02.114Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/.windsurfrules:0-0
Timestamp: 2025-11-24T18:05:02.114Z
Learning: Select tasks based on dependencies (all marked 'done'), priority level, and ID order
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 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 : Represent task dependencies as arrays of task IDs
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T17:59:18.662Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-11-24T17:59:18.662Z
Learning: Applies to scripts/modules/dependency-manager.js : Represent task dependencies as arrays of task IDs, using numeric IDs for direct task references and string IDs with dot notation (e.g., '1.2') for subtask references
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Generate appropriate numbers of subtasks based on task complexity analysis, using recommended subtask counts from complexity analysis when available instead of always using default counts
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 Learning: 2025-11-24T18:02:36.388Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-11-24T18:02:36.388Z
Learning: Applies to scripts/modules/task-manager.js : Include all required task properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) in each task object without adding extra properties outside the standard schema
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.jssrc/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:02:04.644Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-11-24T18:02:04.644Z
Learning: Applies to scripts/modules/task-manager/**/*.{js,mjs} : Use `readJSON(tasksPath, projectRoot, tag)` and `writeJSON(tasksPath, data, projectRoot, tag)` for all task data access
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
📚 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 : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
src/schemas/base-schemas.js
📚 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 : Use numeric IDs for direct task references
Applied to files:
src/schemas/base-schemas.js
📚 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 : Support both task and subtask dependencies in cycle detection
Applied to files:
src/schemas/base-schemas.js
📚 Learning: 2025-11-12T18:23:46.054Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1386
File: apps/cli/src/ui/formatters/complexity-formatters.ts:27-37
Timestamp: 2025-11-12T18:23:46.054Z
Learning: In the eyaltoledano/claude-task-master codebase, task complexity scores are always integers, never fractional values (e.g., never 7.8 or 8.8). Using parseInt for complexity parsing is appropriate and correct.
Applied to files:
src/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: `task_${id.toString().padStart(3, '0')}.txt` for task files; use `path.join()` for composing paths; use appropriate extensions (.txt for tasks, .json for data)
Applied to files:
src/schemas/base-schemas.js
📚 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 : Use string IDs with dot notation (e.g., "1.2") for subtask references
Applied to files:
src/schemas/base-schemas.js
📚 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 : Format task and dependency IDs consistently when adding dependencies
Applied to files:
src/schemas/base-schemas.js
📚 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 : Do not create circular dependencies between subtasks
Applied to files:
src/schemas/base-schemas.js
📚 Learning: 2025-11-24T18:05:02.114Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/.windsurfrules:0-0
Timestamp: 2025-11-24T18:05:02.114Z
Learning: Applies to assets/.taskmaster/tasks/*.md : Task files must follow the specified format with fields: ID, Title, Status, Dependencies, Priority, Description, Details, and Test Strategy
Applied to files:
src/schemas/base-schemas.js
🧬 Code graph analysis (1)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (3)
scripts/modules/task-manager/expand-task.js (1)
task(104-104)scripts/modules/task-manager/parse-prd/parse-prd-streaming.js (4)
task(381-381)task(503-503)task(519-519)task(589-589)src/ui/indicators.js (1)
index(92-92)
⏰ 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: Cursor Bugbot
🔇 Additional comments (3)
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (1)
136-137: Runtime validation correctly enforces sequential task ID integrity.The guard ensures PRD tasks have unique, sequential IDs starting at 1 before ID remapping occurs, which aligns with the project's requirement for sequential positive integer IDs.
src/schemas/base-schemas.js (2)
29-29: Schema constraint correctly enforces positive dependency IDs.Adding
.positive()to numeric dependency IDs ensures they must be >= 1, aligning with the project's requirement for sequential positive integer task IDs. This schema-level validation complements the runtime validation added inparse-prd-helpers.js(validateSequentialTaskIds).The PR's schema sanitization layer in
base-provider.jshandles provider compatibility separately, so this constraint won't break providers that don't support it.
41-41: Subtask dependency validation now consistent with task dependencies.Adding
.positive()to subtask dependency IDs maintains consistency with the parent task dependency schema (line 29) and ensures subtask references are valid positive integers.
Summary
Testing
Changeset
Note
Improves structured-output robustness and ID integrity.
buildSafeSchemainbase-provider.jsto tolerate missingai.jsonSchema, sanitize integer constraints, and use the safe schema instreamObject/generateObjectBaseTaskSchema/SubtaskSchemato require positive integer dependenciesvalidateSequentialTaskIdsin PRD parsing andensureSequentialSubtaskIdsduring scope adjustment; applies guard before subtask remapping/regenerationzodSchemaand relaxes tool registration perf threshold (100→200ms)Written by Cursor Bugbot for commit 10f31fd. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.