fix: normalize task IDs to numbers on load to fix comparison issues#1052
fix: normalize task IDs to numbers on load to fix comparison issues#1052cmer wants to merge 14 commits intoeyaltoledano:nextfrom
Conversation
Release 0.22
* Version Packages * chore: fix release 0.22 todo: fix CI * chore: run format --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons. This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations. Fixes task not found errors when using string IDs in tasks.json.
WalkthroughA new changelog entry was added to document a fix for task lookup with string IDs. A utility function, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant readJSON (utils.js)
participant normalizeTaskIds (utils.js)
participant Task Data
User->>readJSON: Load tasks from JSON
readJSON->>Task Data: Retrieve tasks (may have string IDs)
readJSON->>normalizeTaskIds: Normalize all task and subtask IDs
normalizeTaskIds->>Task Data: Convert string IDs to numbers
normalizeTaskIds-->>readJSON: Return with normalized IDs
readJSON-->>User: Return tasks with numeric IDs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
🦋 Changeset detectedLatest commit: b5609f9 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/modules/utils.js(5 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
scripts/modules/*.js
📄 CodeRabbit Inference Engine (.cursor/rules/architecture.mdc)
Each module in scripts/modules/ should be focused on a single responsibility, following the modular architecture (e.g., commands.js for CLI command handling, task-manager.js for task data and core logic, dependency-manager.js for dependency management, ui.js for CLI output formatting, ai-services-unified.js for AI service integration, config-manager.js for configuration management, utils.js for utility functions).
scripts/modules/*.js: Export all core functions, helper functions, and utility methods needed by your new function or command from their respective modules. Explicitly review the module's export block to ensure every required dependency is included.
Pass all required parameters to functions you call within your implementation and verify that direct function parameters match their core function counterparts.
Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Use structured error objects with code and message properties, include clear error messages, and handle both function-specific and file system errors.
Import all silent mode utilities together from 'scripts/modules/utils.js' and always use isSilentMode() to check global silent mode status. Wrap core function calls within direct functions using enableSilentMode() and disableSilentMode() in a try/finally block if the core function might produce console output.
Core functions should check outputFormat === 'text' before displaying UI elements and use internal logging that respects silent mode.
Design functions to accept dependencies as parameters (dependency injection) and avoid hard-coded dependencies that are difficult to mock.
Keep pure logic separate from I/O operations or UI rendering to allow testing the logic without mocking complex dependencies.
When implementing core logic for new features, do so in 'scripts/modules/' before CLI or MCP interfaces, and d...
Files:
scripts/modules/utils.js
scripts/modules/**
📄 CodeRabbit Inference Engine (.cursor/rules/dev_workflow.mdc)
When using the MCP server, restart it if core logic in
scripts/modulesor MCP tool/direct function definitions change.
Files:
scripts/modules/utils.js
scripts/modules/utils.js
📄 CodeRabbit Inference Engine (.cursor/rules/new_features.mdc)
When adding utilities to 'scripts/modules/utils.js', only add functions that could be used by multiple modules, keep utilities single-purpose and purely functional, and document parameters and return values.
scripts/modules/utils.js: Place utilities used primarily by the coretask-masterCLI logic and command modules (scripts/modules/*) intoscripts/modules/utils.js.
Document all parameters and return values using JSDoc format, include descriptions for complex logic, add examples for non-obvious usage, and do not skip documentation for 'simple' functions.
Support multiple log levels (debug, info, warn, error) in logging utilities, use appropriate icons, and respect the configured log level.
Do not add direct console.log calls outside the logging utility.
Use the exported silent mode functions (enableSilentMode,disableSilentMode,isSilentMode) rather than accessing global variables; always useisSilentMode()to check the current silent mode state.
Make thelogfunction respect silent mode.
Use try/catch blocks for all file operations in utility functions, return null or a default value on failure, and log detailed error information using thelogutility.
Create utilities for consistent task ID handling and support different ID formats (numeric, string, dot notation); do not duplicate formatting logic across modules.
Implement reusable task finding utilities that support both task and subtask lookups and add context to subtask results.
Implement cycle detection using graph traversal in utility functions, track visited nodes and recursion stack, and return specific information about cycles.
UsereadJSONandwriteJSONfor all JSON file operations, include error handling, and validate JSON structure after reading; do not use rawfs.readFileSyncorfs.writeFileSyncfor JSON.
Usepath.join()for cross-platform path construction,path.resolve()for absolute paths, and validate paths before file operations.
Use tag resolution functions for a...
Files:
scripts/modules/utils.js
scripts/modules/*
📄 CodeRabbit Inference Engine (.cursor/rules/tags.mdc)
scripts/modules/*: Every command that reads or writes tasks.json must be tag-aware
All command files must import getCurrentTag from utils.js
Every CLI command that operates on tasks must include the --tag CLI option
All commands must resolve the tag using the pattern: options.tag || getCurrentTag(projectRoot) || 'master'
All commands must find projectRoot with error handling before proceeding
All commands must pass { projectRoot, tag } as context to core functions
MCP direct functions must accept and use a context object containing projectRoot and tag, and pass them to core functions
Do not hard-code tag resolution (e.g., const tag = options.tag || 'master';); always use getCurrentTag
Do not omit the --tag CLI option in commands that operate on tasks
Do not omit the context parameter when calling core functions from commands
Do not call readJSON or writeJSON without passing projectRoot and tag
Files:
scripts/modules/utils.js
**/*.js
📄 CodeRabbit Inference Engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
scripts/modules/utils.js
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}
📄 CodeRabbit Inference Engine (.cursor/rules/utilities.mdc)
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}: Use the logger wrapper pattern when passing loggers to preventmcpLog[level] is not a functionerrors; do not pass the FastMCPlogobject directly asmcpLogto core functions.
Ensure silent mode is disabled in afinallyblock to prevent it from staying enabled.
Files:
scripts/modules/utils.js
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}
📄 CodeRabbit Inference Engine (.cursor/rules/utilities.mdc)
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}: Keep utilities relevant to their location, export all utility functions in a single statement per file, group related exports together, export configuration constants, do not use default exports, and do not create circular dependencies.
Export all utility functions explicitly, group related functions logically, and include new tagged system utilities.
Files:
scripts/modules/utils.js
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Use numeric IDs for direct task references
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/git_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:31.810Z
Learning: Pull Request titles must follow the format: Task <ID>: <Task Title>
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Subtasks must use consistent properties, maintain simple numeric IDs unique within the parent task, and must not duplicate parent task properties.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently when adding dependencies
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tagged task system aware functions for task finding and manipulation, handle both task and subtask operations, and validate task IDs before operations.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Use string IDs with dot notation (e.g., "1.2") for subtask references
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
scripts/modules/utils.js (26)
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tagged task system aware functions for task finding and manipulation, handle both task and subtask operations, and validate task IDs before operations.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Implement silent migration from legacy to tagged format in the readJSON() function, detect legacy format, convert automatically, and preserve all existing task data during migration.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Create utilities for consistent task ID handling and support different ID formats (numeric, string, dot notation); do not duplicate formatting logic across modules.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Assign unique sequential IDs to tasks within each tag context by calculating the next ID based on existing tasks in the current tag; do not hardcode or reuse IDs within the same tag.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Tasks must be organized into separate contexts (tags) within tasks.json, using the tagged format: {"master": {"tasks": [...]}, "feature-branch": {"tasks": [...]}}. Legacy format {"tasks": [...]} must be silently migrated to the tagged format on first use.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tag resolution functions for all task data access, provide backward compatibility with legacy format, and default to 'master' tag when no tag is specified.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Subtasks must use consistent properties, maintain simple numeric IDs unique within the parent task, and must not duplicate parent task properties.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/task-manager/* : All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: Applies to tasks.json : Use the tasks.json file (generated by Taskmaster) to store the project's task list, including tags and task structures.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Represent task dependencies as arrays of task IDs
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Ensure new features work with existing projects seamlessly, supporting both legacy and tagged task data formats, and support silent migration during feature usage.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement complete migration for all related files in the tagged task system, handle configuration and state file creation, and provide migration status tracking.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Core functions must receive the legacy format for 100% backward compatibility, using tag resolution functions to abstract the tagged structure.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use tag resolution functions to maintain backward compatibility, returning legacy format to core functions and not exposing the tagged structure to existing core logic.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: Applies to .taskmaster/state.json : Track Taskmaster's current tag context and migration status in .taskmaster/state.json, which is automatically created and managed by the system.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Tasks must be accessed and updated through the tag resolution layer using getTasksForTag(data, tagName) and setTasksForTag(data, tagName, tasks); direct manipulation of the tagged structure in core functions is not allowed.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/* : Every command that reads or writes tasks.json must be tag-aware
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Generate task files from the current tag context, include tag information in generated files, and do not mix tasks from different tags in file generation.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Provide functions for updating task status within the current tag context, handling both individual tasks and subtasks, and considering subtask status when updating parent tasks.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : The default tag 'master' must be used for all existing and new tasks unless otherwise specified.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Applies to scripts/modules/task-manager/*.js : Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.
🔇 Additional comments (1)
scripts/modules/utils.js (1)
349-349: LGTM: Correct normalization placement for legacy format.The normalization is correctly applied to legacy format tasks before migration to the tagged format.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Added normalizeTaskIds function to convert string IDs to numbers - Applied normalization in readJSON for all code paths - Fixed set-task-status, add-task, and move-task to normalize IDs when working with raw data - Exported normalizeTaskIds function for use in other modules - Added test case for string ID normalization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…alls - Normalize all tags' data when creating _rawTaggedData in readJSON - Add support for handling malformed dotted subtask IDs (e.g., "5.1" -> 1) - Remove redundant normalizeTaskIds calls from set-task-status, add-task, and move-task - Add comprehensive test for mixed ID formats (string IDs and dotted notation) - Cleaner, more maintainable solution that normalizes IDs at load time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Crunchyman-ralph
left a comment
There was a problem hiding this comment.
Need to test this PR, but I think if my tests go well, I'm sure we can merge it
There was a problem hiding this comment.
Not sure about this, I believe we had originally kept the main id inside the subtask for when we are trying to move the subtasks, and also for other reasons that I can't recall. There were also issues around expanding a task and their dependencies, cf #1011
|
Hopefully this can be merged in! I've been using my own branch and it solved my issues! |
Crunchyman-ralph
left a comment
There was a problem hiding this comment.
lgtm, just need to git merge origin/next, and npm run format please!
…-specific detection (eyaltoledano#1049) Removes the default empty array value from the complexity report option to properly detect when tags are explicitly provided vs when no tags are provided, fixing the expand --all command behavior with tagged tasks. Co-authored-by: Ben Vargas <ben@example.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
.changeset/fix-tag-complexity-detection.md (1)
1-8: Minor formatting improvements needed.The changeset content accurately describes the fix, but has some formatting issues flagged by static analysis:
- Missing top-level heading: Consider adding a proper markdown heading
- Style improvement: "Previously" instead of "Previously, it would always"
- Missing trailing newline: File should end with a single newline
Apply these formatting improvements:
+# Fix tag-specific complexity report detection in expand command + --- "task-master-ai": patch --- Fix tag-specific complexity report detection in expand command -The expand command now correctly finds and uses tag-specific complexity reports (e.g., `task-complexity-report_feature-xyz.json`) when operating in a tag context. Previously, it would always look for the generic `task-complexity-report.json` file due to a default value in the CLI option definition. +The expand command now correctly finds and uses tag-specific complexity reports (e.g., `task-complexity-report_feature-xyz.json`) when operating in a tag context. Previously, it would consistently look for the generic `task-complexity-report.json` file due to a default value in the CLI option definition. +
♻️ Duplicate comments (3)
scripts/modules/utils.js (3)
265-300: Improve validation and consider architectural implications.The function has several issues that need addressing:
- Validation gaps: While you check for
!isNaN(parsedId) && parsedId > 0, this doesn't handle edge cases likeparseInt("", 10)which returnsNaN- Dot notation handling: The function processes dot notation IDs (lines 286-289), but according to learnings, subtasks should maintain simple numeric IDs unique within the parent task, not dot notation
- Mutation concerns: The function mutates the original tasks array instead of being pure
Consider this approach that aligns better with the codebase architecture:
function normalizeTaskIds(tasks) { if (!Array.isArray(tasks)) return; tasks.forEach(task => { // Convert task ID to number with validation if (task.id !== undefined) { - const parsedId = parseInt(task.id, 10); - if (!isNaN(parsedId) && parsedId > 0) { - task.id = parsedId; - } + const parsedId = parseInt(task.id, 10); + if (!isNaN(parsedId) && parsedId > 0 && isFinite(parsedId)) { + task.id = parsedId; + } } // Convert subtask IDs to numbers with validation if (Array.isArray(task.subtasks)) { task.subtasks.forEach(subtask => { if (subtask.id !== undefined) { - // Check for dot notation (which shouldn't exist in storage) - if (typeof subtask.id === 'string' && subtask.id.includes('.')) { - // Extract the subtask part after the dot - const parts = subtask.id.split('.'); - subtask.id = parseInt(parts[parts.length - 1], 10); - } else { - const parsedSubtaskId = parseInt(subtask.id, 10); - if (!isNaN(parsedSubtaskId) && parsedSubtaskId > 0) { - subtask.id = parsedSubtaskId; - } - } + const parsedSubtaskId = parseInt(subtask.id, 10); + if (!isNaN(parsedSubtaskId) && parsedSubtaskId > 0 && isFinite(parsedSubtaskId)) { + subtask.id = parsedSubtaskId; + } } }); } }); }
500-500: Fix incorrect variable reference.The normalization is being applied to the wrong variable. At this point,
tagData.taskscontains the actual tasks array that needs normalization, notdata.tasks.Apply this fix:
- normalizeTaskIds(data.tasks); + normalizeTaskIds(tagData.tasks);
518-518: Fix incorrect variable reference in fallback case.Same issue as the previous normalization call - using the wrong variable reference.
masterData.tasksshould be normalized, notdata.tasks.Apply this fix:
- normalizeTaskIds(data.tasks); + normalizeTaskIds(masterData.tasks);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
.changeset/fix-tag-complexity-detection.md(1 hunks)scripts/modules/commands.js(1 hunks)scripts/modules/utils.js(7 hunks)tests/unit/task-finder.test.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (16)
.changeset/*.md
📄 CodeRabbit Inference Engine (.cursor/rules/changeset.mdc)
.changeset/*.md: When runningnpm run changesetornpx changeset add, provide a concise summary of the changes for theCHANGELOG.mdin imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.
Files:
.changeset/fix-tag-complexity-detection.md
.changeset/*
📄 CodeRabbit Inference Engine (.cursor/rules/new_features.mdc)
Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Files:
.changeset/fix-tag-complexity-detection.md
scripts/modules/*.js
📄 CodeRabbit Inference Engine (.cursor/rules/architecture.mdc)
Each module in scripts/modules/ should be focused on a single responsibility, following the modular architecture (e.g., commands.js for CLI command handling, task-manager.js for task data and core logic, dependency-manager.js for dependency management, ui.js for CLI output formatting, ai-services-unified.js for AI service integration, config-manager.js for configuration management, utils.js for utility functions).
scripts/modules/*.js: Export all core functions, helper functions, and utility methods needed by your new function or command from their respective modules. Explicitly review the module's export block to ensure every required dependency is included.
Pass all required parameters to functions you call within your implementation and verify that direct function parameters match their core function counterparts.
Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Use structured error objects with code and message properties, include clear error messages, and handle both function-specific and file system errors.
Import all silent mode utilities together from 'scripts/modules/utils.js' and always use isSilentMode() to check global silent mode status. Wrap core function calls within direct functions using enableSilentMode() and disableSilentMode() in a try/finally block if the core function might produce console output.
Core functions should check outputFormat === 'text' before displaying UI elements and use internal logging that respects silent mode.
Design functions to accept dependencies as parameters (dependency injection) and avoid hard-coded dependencies that are difficult to mock.
Keep pure logic separate from I/O operations or UI rendering to allow testing the logic without mocking complex dependencies.
When implementing core logic for new features, do so in 'scripts/modules/' before CLI or MCP interfaces, and d...
Files:
scripts/modules/utils.jsscripts/modules/commands.js
scripts/modules/**
📄 CodeRabbit Inference Engine (.cursor/rules/dev_workflow.mdc)
When using the MCP server, restart it if core logic in
scripts/modulesor MCP tool/direct function definitions change.
Files:
scripts/modules/utils.jsscripts/modules/commands.js
scripts/modules/utils.js
📄 CodeRabbit Inference Engine (.cursor/rules/new_features.mdc)
When adding utilities to 'scripts/modules/utils.js', only add functions that could be used by multiple modules, keep utilities single-purpose and purely functional, and document parameters and return values.
scripts/modules/utils.js: Place utilities used primarily by the coretask-masterCLI logic and command modules (scripts/modules/*) intoscripts/modules/utils.js.
Document all parameters and return values using JSDoc format, include descriptions for complex logic, add examples for non-obvious usage, and do not skip documentation for 'simple' functions.
Support multiple log levels (debug, info, warn, error) in logging utilities, use appropriate icons, and respect the configured log level.
Do not add direct console.log calls outside the logging utility.
Use the exported silent mode functions (enableSilentMode,disableSilentMode,isSilentMode) rather than accessing global variables; always useisSilentMode()to check the current silent mode state.
Make thelogfunction respect silent mode.
Use try/catch blocks for all file operations in utility functions, return null or a default value on failure, and log detailed error information using thelogutility.
Create utilities for consistent task ID handling and support different ID formats (numeric, string, dot notation); do not duplicate formatting logic across modules.
Implement reusable task finding utilities that support both task and subtask lookups and add context to subtask results.
Implement cycle detection using graph traversal in utility functions, track visited nodes and recursion stack, and return specific information about cycles.
UsereadJSONandwriteJSONfor all JSON file operations, include error handling, and validate JSON structure after reading; do not use rawfs.readFileSyncorfs.writeFileSyncfor JSON.
Usepath.join()for cross-platform path construction,path.resolve()for absolute paths, and validate paths before file operations.
Use tag resolution functions for a...
Files:
scripts/modules/utils.js
scripts/modules/*
📄 CodeRabbit Inference Engine (.cursor/rules/tags.mdc)
scripts/modules/*: Every command that reads or writes tasks.json must be tag-aware
All command files must import getCurrentTag from utils.js
Every CLI command that operates on tasks must include the --tag CLI option
All commands must resolve the tag using the pattern: options.tag || getCurrentTag(projectRoot) || 'master'
All commands must find projectRoot with error handling before proceeding
All commands must pass { projectRoot, tag } as context to core functions
MCP direct functions must accept and use a context object containing projectRoot and tag, and pass them to core functions
Do not hard-code tag resolution (e.g., const tag = options.tag || 'master';); always use getCurrentTag
Do not omit the --tag CLI option in commands that operate on tasks
Do not omit the context parameter when calling core functions from commands
Do not call readJSON or writeJSON without passing projectRoot and tag
Files:
scripts/modules/utils.jsscripts/modules/commands.js
**/*.js
📄 CodeRabbit Inference Engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
scripts/modules/utils.jstests/unit/task-finder.test.jsscripts/modules/commands.js
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}
📄 CodeRabbit Inference Engine (.cursor/rules/utilities.mdc)
{scripts/modules/utils.js,mcp-server/src/core/direct-functions/**/*.js}: Use the logger wrapper pattern when passing loggers to preventmcpLog[level] is not a functionerrors; do not pass the FastMCPlogobject directly asmcpLogto core functions.
Ensure silent mode is disabled in afinallyblock to prevent it from staying enabled.
Files:
scripts/modules/utils.js
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}
📄 CodeRabbit Inference Engine (.cursor/rules/utilities.mdc)
{scripts/modules/utils.js,mcp-server/src/core/utils/path-utils.js,mcp-server/src/tools/utils.js}: Keep utilities relevant to their location, export all utility functions in a single statement per file, group related exports together, export configuration constants, do not use default exports, and do not create circular dependencies.
Export all utility functions explicitly, group related functions logically, and include new tagged system utilities.
Files:
scripts/modules/utils.js
tests/{unit,integration,e2e,fixtures}/**/*.js
📄 CodeRabbit Inference Engine (.cursor/rules/architecture.mdc)
Test files must be organized as follows: unit tests in tests/unit/, integration tests in tests/integration/, end-to-end tests in tests/e2e/, and test fixtures in tests/fixtures/.
Files:
tests/unit/task-finder.test.js
tests/unit/*.js
📄 CodeRabbit Inference Engine (.cursor/rules/architecture.mdc)
Each module should have a corresponding unit test file in tests/unit/ that reflects the module structure (one test file per module).
Files:
tests/unit/task-finder.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/git_workflow.mdc)
**/*.{test,spec}.{js,ts,jsx,tsx}: Create a test file and ensure all tests pass when all subtasks are complete; commit tests if added or modified
When all subtasks are complete, run final testing using the appropriate test runner (e.g., npm test, jest, or manual testing)
Files:
tests/unit/task-finder.test.js
**/*.test.js
📄 CodeRabbit Inference Engine (.cursor/rules/tests.mdc)
**/*.test.js: Never use asynchronous operations in tests. Make all mocks return synchronous values when possible.
Always mock tests properly based on the way the tested functions are defined and used.
Follow the test file organization: mocks must be set up before importing modules under test, and spies on mocked modules should be set up after imports.
Use fixtures from tests/fixtures/ for consistent sample data across tests.
Always declare mocks before importing the modules being tested in Jest test files.
Use jest.spyOn() after imports to create spies on mock functions and reference these spies in test assertions.
When testing functions with callbacks, get the callback from your mock's call arguments, execute it directly with test inputs, and verify the results.
For ES modules, use jest.mock() before static imports and jest.unstable_mockModule() before dynamic imports to mock dependencies.
Reset mock functions (mockFn.mockReset()) before dynamic imports if they might have been called previously.
When verifying console assertions, assert against the actual arguments passed (single formatted string), not multiple arguments.
Use mock-fs to mock file system operations in tests, and restore the file system after each test.
Mock API calls (e.g., Anthropic/Claude) by mocking the entire module and providing predictable responses.
Set mock environment variables in test setup and restore them after each test.
Maintain test fixtures separate from test logic.
Follow the mock-first-then-import pattern for all Jest mocks.
Do not define mock variables before jest.mock() calls (they won't be accessible due to hoisting).
Use test-specific file paths (e.g., 'test-tasks.json') for all file operations in tests.
Mock readJSON and writeJSON to avoid real file system interactions in tests.
Verify file operations use the correct paths in expect statements.
Use different file paths for each test to avoid test interdependence.
Verify modifications on the in-memory task objects passed to w...
Files:
tests/unit/task-finder.test.js
tests/unit/**/*.test.js
📄 CodeRabbit Inference Engine (.cursor/rules/tests.mdc)
tests/unit/**/*.test.js: Unit tests must be located in tests/unit/, test individual functions and utilities in isolation, mock all external dependencies, and keep tests small, focused, and fast.
Do not include actual command execution in unit tests.
Files:
tests/unit/task-finder.test.js
tests/{unit,integration,e2e}/**/*.test.js
📄 CodeRabbit Inference Engine (.cursor/rules/tests.mdc)
tests/{unit,integration,e2e}/**/*.test.js: When testing CLI commands built with Commander.js, test the command action handlers directly rather than trying to mock the entire Commander.js chain.
When mocking the Commander.js chain, mock ALL chainable methods (option, argument, action, on, etc.) and return this (or the mock object) from all chainable method mocks.
Explicitly handle all options, including defaults and shorthand flags (e.g., -p for --prompt), and include null/undefined checks in test implementations for parameters that might be optional.
Do not try to use the real action implementation without proper mocking, and do not mock Commander partially—either mock it completely or test the action directly.
Mock the action handlers for CLI commands and verify they're called with correct arguments.
Use sample task fixtures for consistent test data, mock file system operations, and test both success and error paths for task operations.
Mock console output and verify correct formatting in UI function tests. Use flexible assertions like toContain() or toMatch() for formatted output.
Mock chalk functions to return the input text to make testing easier while still verifying correct function calls.
Files:
tests/unit/task-finder.test.js
scripts/modules/commands.js
📄 CodeRabbit Inference Engine (.cursor/rules/ai_services.mdc)
scripts/modules/commands.js: Centralize all LLM calls throughgenerateTextServiceorgenerateObjectService.
Do not import or call anything from the oldai-services.js,ai-client-factory.js, orai-client-utils.jsfiles.
Do not fetch AI-specific parameters (model ID, max tokens, temp) usingconfig-manager.jsgetters for the AI call. Pass theroleinstead.
Do not implement fallback or retry logic outsideai-services-unified.js.
Do not handle API key resolution outside the service layer (it usesutils.jsinternally).
Determine the appropriaterole(main,research,fallback) in your core logic and pass it to the service.
Pass thesessionobject (received in thecontextparameter, especially from direct function wrappers) to the service call when in MCP context.
UsegenerateTextServiceand implement robust manual JSON parsing (with Zod validation after parsing) when structured output is needed, asgenerateObjectServicehas shown unreliability with some providers/schemas.
Be aware of potential reliability issues withgenerateObjectServiceacross different providers and complex schemas. PrefergenerateTextService+ manual parsing as a more robust alternative for structured data needs.
scripts/modules/commands.js: Follow the provided command template structure for all CLI commands using Commander.js, including use of .command(), .description(), .option(), and .action() methods.
Keep action handlers concise and focused; extract core functionality to appropriate modules and import/call relevant functions from core modules, passing parsed options.
Perform basic parameter validation (such as checking for required options) within the action handler or at the start of the called core function.
Do not implement business logic directly in command handlers; delegate to core modules.
Include a confirmation prompt by default for destructive operations (such as remove-task or remove-subtask commands), and provide a --yes or -y flag to skip conf...
Files:
scripts/modules/commands.js
🧠 Learnings (59)
📓 Common learnings
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/git_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:31.810Z
Learning: Pull Request titles must follow the format: Task <ID>: <Task Title>
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Use numeric IDs for direct task references
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/git_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:31.810Z
Learning: Pull Request descriptions must use the provided template, including Task Overview, Subtasks Completed, Implementation Details, Testing, Breaking Changes, and Related Tasks
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Subtasks must use consistent properties, maintain simple numeric IDs unique within the parent task, and must not duplicate parent task properties.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently when adding dependencies
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: For tasks with complexity analysis, use `node scripts/dev.js expand --id=<id>`. Otherwise, use `node scripts/dev.js expand --id=<id> --subtasks=<number>`.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tagged task system aware functions for task finding and manipulation, handle both task and subtask operations, and validate task IDs before operations.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Use string IDs with dot notation (e.g., "1.2") for subtask references
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Allow filtering tasks by status within the current tag context, handle subtask display in lists, and use consistent table formats.
Learnt from: CR
PR: eyaltoledano/claude-task-master#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
📚 Learning: todo comments about adding tag support to internal functions like readcomplexityreport are obsolete ...
Learnt from: mm-parthy
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/list-tasks.js:0-0
Timestamp: 2025-07-18T08:29:52.384Z
Learning: TODO comments about adding tag support to internal functions like readComplexityReport are obsolete in the boundary-first tag resolution pattern because report paths are already resolved at the CLI command boundary layer before reaching these functions.
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/commands.js
📚 Learning: commands such as `analyze-complexity`, `expand-task`, `update-task`, and `add-task` should consider ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/context_gathering.mdc:0-0
Timestamp: 2025-07-18T17:09:13.815Z
Learning: Commands such as `analyze-complexity`, `expand-task`, `update-task`, and `add-task` should consider adopting the context gathering pattern for improved AI-powered assistance.
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/commands.js
📚 Learning: applies to scripts/modules/task-manager.js : use ai to generate detailed subtasks within the current...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use AI to generate detailed subtasks within the current tag context, considering complexity analysis for subtask counts and ensuring proper IDs for newly created subtasks.
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/utils.js
📚 Learning: applies to scripts/modules/*.js : default to current tag when not specified, support explicit tag se...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Default to current tag when not specified, support explicit tag selection in advanced features, validate tag existence before operations, and provide clear messaging about tag context.
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: for tasks with complexity analysis, use `node scripts/dev.js expand --id=`. otherwise, use `node...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: For tasks with complexity analysis, use `node scripts/dev.js expand --id=<id>`. Otherwise, use `node scripts/dev.js expand --id=<id> --subtasks=<number>`.
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/utils.js
📚 Learning: use `task-master complexity-report` to display the task complexity analysis report in a formatted, e...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Use `task-master complexity-report` to display the task complexity analysis report in a formatted, easy-to-read way.
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/commands.js
📚 Learning: guidelines for integrating new features into the task master cli with tagged system considerations (...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/glossary.mdc:0-0
Timestamp: 2025-07-18T17:10:53.657Z
Learning: Guidelines for integrating new features into the Task Master CLI with tagged system considerations (new_features.mdc).
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: applies to scripts/modules/utils.js : use tag resolution functions for all task data access, provide...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tag resolution functions for all task data access, provide backward compatibility with legacy format, and default to 'master' tag when no tag is specified.
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/utils.js
📚 Learning: when breaking down complex tasks, use the `expand_task` command with appropriate flags (`--force`, `...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: When breaking down complex tasks, use the `expand_task` command with appropriate flags (`--force`, `--research`, `--num`, `--prompt`) and review generated subtasks for accuracy.
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: applies to scripts/modules/* : do not omit the --tag cli option in commands that operate on tasks...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/* : Do not omit the --tag CLI option in commands that operate on tasks
Applied to files:
.changeset/fix-tag-complexity-detection.mdscripts/modules/commands.js
📚 Learning: break down complex tasks using `task-master expand --id=` with appropriate flags....
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Break down complex tasks using `task-master expand --id=<id>` with appropriate flags.
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: use the taskmaster command set (`task-master` cli or mcp tools) for all task management operations: ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: Use the Taskmaster command set (`task-master` CLI or MCP tools) for all task management operations: listing, expanding, updating, tagging, and status changes.
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: analyze task complexity with `task-master analyze-complexity --research` before breaking down tasks....
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Analyze task complexity with `task-master analyze-complexity --research` before breaking down tasks.
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: when breaking down complex tasks in taskmaster, use the `expand_task` command with appropriate flags...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:02.683Z
Learning: When breaking down complex tasks in Taskmaster, use the `expand_task` command with appropriate flags (`--num`, `--research`, `--force`, `--prompt`) and review generated subtasks for accuracy.
Applied to files:
.changeset/fix-tag-complexity-detection.md
📚 Learning: applies to scripts/modules/utils.js : use tagged task system aware functions for task finding and ma...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Use tagged task system aware functions for task finding and manipulation, handle both task and subtask operations, and validate task IDs before operations.
Applied to files:
scripts/modules/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/task-manager.js : assign unique sequential ids to tasks within each tag c...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Assign unique sequential IDs to tasks within each tag context by calculating the next ID based on existing tasks in the current tag; do not hardcode or reuse IDs within the same tag.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : implement silent migration from legacy to tagged format...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Implement silent migration from legacy to tagged format in the readJSON() function, detect legacy format, convert automatically, and preserve all existing task data during migration.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/utils.js : create utilities for consistent task id handling and support d...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Create utilities for consistent task ID handling and support different ID formats (numeric, string, dot notation); do not duplicate formatting logic across modules.
Applied to files:
scripts/modules/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/task-manager.js : tasks must be organized into separate contexts (tags) w...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Tasks must be organized into separate contexts (tags) within tasks.json, using the tagged format: {"master": {"tasks": [...]}, "feature-branch": {"tasks": [...]}}. Legacy format {"tasks": [...]} must be silently migrated to the tagged format on first use.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : use tag resolution functions to maintain backward compa...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use tag resolution functions to maintain backward compatibility, returning legacy format to core functions and not exposing the tagged structure to existing core logic.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : use consistent formatting for task files, include all t...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/dependency-manager.js : allow numeric subtask ids to reference other subt...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Allow numeric subtask IDs to reference other subtasks within the same parent
Applied to files:
scripts/modules/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/task-manager.js : subtasks must use consistent properties, maintain simpl...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Subtasks must use consistent properties, maintain simple numeric IDs unique within the parent task, and must not duplicate parent task properties.
Applied to files:
scripts/modules/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/dependency-manager.js : use numeric ids for direct task references...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Use numeric IDs for direct task references
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/dependency-manager.js : format task and dependency ids consistently when ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Format task and dependency IDs consistently when adding dependencies
Applied to files:
scripts/modules/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/task-manager.js : tasks must be accessed and updated through the tag reso...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Tasks must be accessed and updated through the tag resolution layer using getTasksForTag(data, tagName) and setTasksForTag(data, tagName, tasks); direct manipulation of the tagged structure in core functions is not allowed.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : core functions must receive the legacy format for 100% ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Core functions must receive the legacy format for 100% backward compatibility, using tag resolution functions to abstract the tagged structure.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager/**/*.js : do not call ai-specific getters (like `getmainmode...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Do not call AI-specific getters (like `getMainModelId`, `getMainMaxTokens`) from core logic functions in `scripts/modules/task-manager/*`; instead, pass the `role` to the unified AI service.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/* : every command that reads or writes tasks.json must be tag-aware...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/* : Every command that reads or writes tasks.json must be tag-aware
Applied to files:
scripts/modules/utils.jsscripts/modules/commands.js
📚 Learning: applies to scripts/modules/dependency-manager.js : remove references to non-existent tasks during va...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager/*.js : do not implement fallback or retry logic outside `ai-...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not implement fallback or retry logic outside `ai-services-unified.js`.
Applied to files:
scripts/modules/utils.js
📚 Learning: clear existing subtasks if needed using `task-master clear-subtasks --id=` before regenerating....
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Clear existing subtasks if needed using `task-master clear-subtasks --id=<id>` before regenerating.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/dependency-manager.js : use string ids with dot notation (e.g., "1.2") fo...
Learnt from: CR
PR: eyaltoledano/claude-task-master#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/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/task-manager/* : all core functions in scripts/modules/task-manager/ must...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/task-manager/* : All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/*.js : use consistent file naming conventions: 'task_${id.tostring().pads...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to tasks.json : use the `tasks.json` file (generated by taskmaster) to store the project's t...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: Applies to tasks.json : Use the `tasks.json` file (generated by Taskmaster) to store the project's task list, including tags and task structures.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to **/*.test.js : verify modifications on the in-memory task objects passed to writejson....
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Verify modifications on the in-memory task objects passed to writeJSON.
Applied to files:
scripts/modules/utils.jstests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/*.js : ensure new features work with existing projects seamlessly, suppor...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Ensure new features work with existing projects seamlessly, supporting both legacy and tagged task data formats, and support silent migration during feature usage.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/utils.js : implement complete migration for all related files in the tagg...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement complete migration for all related files in the tagged task system, handle configuration and state file creation, and provide migration status tracking.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to .taskmaster/state.json : track taskmaster's current tag context and migration status in `...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: Applies to .taskmaster/state.json : Track Taskmaster's current tag context and migration status in `.taskmaster/state.json`, which is automatically created and managed by the system.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : generate task files from the current tag context, inclu...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Generate task files from the current tag context, include tag information in generated files, and do not mix tasks from different tags in file generation.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : provide functions for updating task status within the c...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Provide functions for updating task status within the current tag context, handling both individual tasks and subtasks, and considering subtask status when updating parent tasks.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : the default tag 'master' must be used for all existing ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : The default tag 'master' must be used for all existing and new tasks unless otherwise specified.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/* : all commands must resolve the tag using the pattern: options.tag || g...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/* : All commands must resolve the tag using the pattern: options.tag || getCurrentTag(projectRoot) || 'master'
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to scripts/modules/task-manager.js : extract tasks from prd documents using ai, create them ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI, create them in the current tag context (defaulting to 'master'), provide clear prompts to guide AI task generation, and validate/clean up AI-generated tasks.
Applied to files:
scripts/modules/utils.js
📚 Learning: applies to tests/{unit,integration,e2e}/**/*.test.js : use sample task fixtures for consistent test ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : Use sample task fixtures for consistent test data, mock file system operations, and test both success and error paths for task operations.
Applied to files:
tests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/utils.js : implement reusable task finding utilities that support both ta...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement reusable task finding utilities that support both task and subtask lookups and add context to subtask results.
Applied to files:
tests/unit/task-finder.test.js
📚 Learning: applies to **/*.test.js : verify file operations use the correct paths in expect statements....
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Verify file operations use the correct paths in expect statements.
Applied to files:
tests/unit/task-finder.test.js
📚 Learning: applies to scripts/modules/commands.js : use consistent option names across similar commands; do not...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:52.788Z
Learning: Applies to scripts/modules/commands.js : Use consistent option names across similar commands; do not use different names for the same concept (e.g., --file vs --path).
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/commands.js : use consistent patterns for option naming and help text in ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/commands.js : Use consistent patterns for option naming and help text in CLI commands.
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to tests/{unit,integration,e2e}/**/*.test.js : explicitly handle all options, including defa...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to tests/{unit,integration,e2e}/**/*.test.js : Explicitly handle all options, including defaults and shorthand flags (e.g., -p for --prompt), and include null/undefined checks in test implementations for parameters that might be optional.
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/commands.js : use kebab-case for command names (e.g., analyze-complexity)...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:52.788Z
Learning: Applies to scripts/modules/commands.js : Use kebab-case for command names (e.g., analyze-complexity), not camelCase.
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/commands.js : use kebab-case for long-form option names (e.g., --output-f...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Use kebab-case for long-form option names (e.g., --output-format), provide single-letter shortcuts when appropriate, and use consistent option names across similar commands.
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/commands.js : use kebab-case for command names (e.g., analyze-complexity)...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Use kebab-case for command names (e.g., analyze-complexity) and descriptive, action-oriented names.
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/commands.js : do not assume default parameters will work for file regener...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Do not assume default parameters will work for file regeneration; always pass explicit parameters.
Applied to files:
scripts/modules/commands.js
📚 Learning: run `node scripts/dev.js analyze-complexity --research` for comprehensive analysis and review the co...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Run `node scripts/dev.js analyze-complexity --research` for comprehensive analysis and review the complexity report in scripts/task-complexity-report.json.
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/* : every cli command that operates on tasks must include the --tag ...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/* : Every CLI command that operates on tasks must include the --tag <tag> CLI option
Applied to files:
scripts/modules/commands.js
📚 Learning: applies to scripts/modules/commands.js : follow the provided structure for adding subtasks, includin...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:52.788Z
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/commands.js
🧬 Code Graph Analysis (2)
scripts/modules/utils.js (15)
scripts/modules/task-manager/move-task.js (1)
tasks(81-81)scripts/modules/task-manager/remove-task.js (1)
tasks(49-49)mcp-server/src/core/direct-functions/clear-subtasks.js (1)
tasks(85-85)scripts/modules/dependency-manager.js (9)
tasks(508-519)tasks(533-559)task(363-363)task(959-959)subtask(962-962)data(36-36)data(226-226)data(577-577)data(702-702)scripts/modules/task-manager/set-task-status.js (3)
task(106-106)subtask(100-100)data(74-78)scripts/modules/task-manager/expand-task.js (2)
task(343-343)data(336-336)mcp-server/src/core/direct-functions/expand-task.js (2)
task(123-123)data(103-103)scripts/modules/task-manager/list-tasks.js (3)
task(816-816)subtask(810-812)data(45-45)scripts/modules/task-manager/research.js (1)
task(820-820)tests/integration/mcp-server/direct-functions.test.js (1)
task(73-108)scripts/modules/task-manager/update-subtask-by-id.js (2)
subtask(137-137)data(95-95)scripts/modules/task-manager/expand-all-tasks.js (1)
data(86-86)mcp-server/src/core/direct-functions/remove-task.js (1)
data(65-65)scripts/modules/task-manager/update-task-by-id.js (1)
data(324-324)scripts/modules/task-manager/generate-task-files.js (1)
tagData(36-36)
tests/unit/task-finder.test.js (3)
scripts/modules/utils.js (2)
task(1020-1020)subtask(991-991)scripts/modules/task-manager/list-tasks.js (2)
task(816-816)subtask(810-812)tests/integration/mcp-server/direct-functions.test.js (1)
task(73-108)
🪛 LanguageTool
.changeset/fix-tag-complexity-detection.md
[style] ~7-~7: Consider a different adverb to strengthen your wording.
Context: ... in a tag context. Previously, it would always look for the generic `task-complexity-r...
(ALWAYS_CONSTANTLY)
🪛 markdownlint-cli2 (0.17.2)
.changeset/fix-tag-complexity-detection.md
5-5: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
7-7: Files should end with a single newline character
(MD047, single-trailing-newline)
🔇 Additional comments (6)
scripts/modules/commands.js (1)
1566-1569: Default removed – behaviour now relies on TaskMaster’s tag-aware auto-detection – OKDropping
COMPLEXITY_REPORT_FILEhere correctly defers to the internal resolver so feature branches pick uptask-complexity-report_<tag>.json. No further action needed.scripts/modules/utils.js (4)
362-362: LGTM: Correct normalization placement.The normalization call is correctly placed after detecting legacy format tasks but before migration.
443-451: LGTM: Proper normalization of all tagged data.The loop correctly normalizes IDs across all tags in the original tagged data structure.
549-549: Fix variable reference consistency.This call correctly uses
masterData.tasks, which is consistent with the intended behavior.
1469-1470: LGTM: Function properly exported.The
normalizeTaskIdsfunction is correctly exported for use by other modules.tests/unit/task-finder.test.js (1)
26-100: Excellent comprehensive test coverage for ID normalization.This test case provides thorough coverage of the string ID normalization scenarios:
✅ Strengths:
- Simulates realistic JSON loading with string IDs
- Tests both simple and dotted notation subtask IDs
- Covers edge cases like mixed ID formats
- Validates both task and subtask finding after normalization
- Clear test structure with descriptive comments
✅ Good practices:
- Manual normalization simulation matches actual
readJSONbehavior- Multiple assertion scenarios for different ID types
- Proper expectation of
isSubtaskflag for subtasksThe test effectively validates that the
normalizeTaskIdsfunction integration works correctly for the reported issue of tasks not being found with string IDs.Consider adding one more test case for error scenarios:
test('should handle invalid string IDs gracefully', () => { const tasksWithInvalidIds = [ { id: 'invalid', title: 'Invalid Task' }, { id: '0', title: 'Zero ID Task' }, // Should be rejected as not > 0 { id: '', title: 'Empty ID Task' } // Should be rejected as NaN ]; // After normalization, invalid IDs should remain unchanged const result = findTaskById(tasksWithInvalidIds, 'invalid'); expect(result.task).toBeNull(); // Should not find invalid ID });
| '-cr, --complexity-report <file>', | ||
| 'Path to the report file', | ||
| COMPLEXITY_REPORT_FILE | ||
| 'Path to the complexity report file (use this to specify the complexity report, not --file)' | ||
| // Removed default value to allow tag-specific auto-detection | ||
| ) |
There was a problem hiding this comment.
Multi-character “short” flag -cr is parsed as two separate flags by Commander – use a single-letter alias instead
Commander treats each character after the single dash as an individual short option (-c -r).
As a result -cr, --complexity-report does not behave as the intended combined alias and may break existing CLI scripts.
- .option(
- '-cr, --complexity-report <file>',
+ .option(
+ '-c, --complexity-report <file>',Choose an unused single-letter alias (-c suggested) or drop the short flag altogether.
Update any docs/tests that refer to -cr.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| '-cr, --complexity-report <file>', | |
| 'Path to the report file', | |
| COMPLEXITY_REPORT_FILE | |
| 'Path to the complexity report file (use this to specify the complexity report, not --file)' | |
| // Removed default value to allow tag-specific auto-detection | |
| ) | |
| .option( | |
| '-c, --complexity-report <file>', | |
| 'Path to the complexity report file (use this to specify the complexity report, not --file)' | |
| // Removed default value to allow tag-specific auto-detection | |
| ) |
🤖 Prompt for AI Agents
In scripts/modules/commands.js around lines 1566 to 1569, the short flag '-cr'
is incorrectly used as a multi-character alias, which Commander parses as two
separate flags '-c' and '-r'. Replace '-cr' with a single-letter alias such as
'-c' or remove the short flag entirely. Also, update any documentation or tests
referencing '-cr' to reflect this change.
|
Weird conflicts and CI issues resolved in #1063, closing this to prioritize the other PR, thanks for contributing! |
What type of PR is this?
Description
When tasks.json contains string IDs (e.g., "5" instead of 5), task lookups fail because the code uses parseInt() and strict equality (===) for comparisons.
This fix normalizes all task and subtask IDs to numbers when loading the JSON, ensuring consistent comparisons throughout the codebase without requiring changes to multiple comparison locations.
Fixes task not found errors when using string IDs in tasks.json.
Related Issues
Reported on Discord: https://discord.com/channels/1354594356702478356/1398333561366642792
How to Test This
idfields within""(as strings) intasks.json./bin/task-master.js show 5Expected result:
Task will be found as it should.
Contributor Checklist
npm run changesetnpm testnpm run format-check(ornpm run formatto fix)Changelog Entry
Fix for tasks not found when using string IDs
For Maintainers
Summary by CodeRabbit
Bug Fixes
Tests
Documentation