chore: fix tag-extension package.json not found for extension#1073
chore: fix tag-extension package.json not found for extension#1073Crunchyman-ralph merged 2 commits intomainfrom
Conversation
|
✨ Finishing Touches
🧪 Generate unit tests
🪧 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
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/scripts/tag-extension.mjs(2 hunks)
🧰 Additional context used
🧠 Learnings (21)
📓 Common learnings
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#997
File: apps/extension/src/services/task-repository.ts:25-57
Timestamp: 2025-07-31T21:48:00.389Z
Learning: In the eyaltoledano/claude-task-master repository, every task is always part of a tag - there is no concept of untagged tasks. The tag system is mandatory and comprehensive, meaning all tasks exist within a tag context (with 'master' as the default tag if none specified).
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: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#997
File: apps/extension/package.publish.json:2-8
Timestamp: 2025-07-31T20:49:04.638Z
Learning: In the eyaltoledano/claude-task-master repository, the VS Code extension uses a 3-file packaging system where package.json (with name "extension") is for development within the monorepo, while package.publish.json (with name "task-master-hamster") contains the clean manifest for VS Code marketplace publishing. The different names are intentional and serve distinct purposes in the build and publishing workflow.
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: eyaltoledano
PR: eyaltoledano/claude-task-master#1069
File: .changeset/floppy-news-buy.md:7-38
Timestamp: 2025-08-02T14:54:52.216Z
Learning: For major feature additions like new CLI commands, eyaltoledano prefers detailed changesets with comprehensive descriptions, usage examples, and feature explanations rather than minimal single-line summaries.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Every pull request containing new features, bug fixes, breaking changes, performance improvements, significant refactoring, user-facing documentation updates, dependency updates, or impactful build/tooling changes should include a changeset file.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.648Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#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: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: For PRD-driven feature development, create a dedicated tag, draft a PRD in `.taskmaster/docs/`, parse it into tasks, and add a high-level reference in the master tag.
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-31T22:07:14.034Z
Learning: Import Task Master's development workflow commands and guidelines, treat as if import is in the main CLAUDE.md file.
📚 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:
.github/scripts/tag-extension.mjs
📚 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:
.github/scripts/tag-extension.mjs
📚 Learning: in the claude task master system, core task-manager functions are designed with fallback mechanisms ...
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#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.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to mcp-server/src/core/direct-functions/*.js : the *direct function is responsible for findi...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-07-18T17:11:36.732Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : The *Direct function is responsible for finding the exact tasks.json path using findTasksJsonPath, relying on the projectRoot passed in args.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/* : all commands must pass { projectroot, tag } as context to core functi...
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 pass { projectRoot, tag } as context to core functions
Applied to files:
.github/scripts/tag-extension.mjs
📚 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:
.github/scripts/tag-extension.mjs
📚 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:
.github/scripts/tag-extension.mjs
📚 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:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/* : all commands must find projectroot with error handling before proceed...
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 find projectRoot with error handling before proceeding
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/* : do not hard-code tag resolution (e.g., const tag = options.tag || 'ma...
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 hard-code tag resolution (e.g., const tag = options.tag || 'master';); always use getCurrentTag
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to mcp-server/src/core/utils/path-utils.js : call `findtasksjsonpath(args, log)` from within...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to mcp-server/src/core/utils/path-utils.js : Call `findTasksJsonPath(args, log)` from within direct function wrappers in `mcp-server/src/core/direct-functions/` to get the absolute path to the relevant `tasks.json`.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: in the eyaltoledano/claude-task-master repository, the vs code extension uses a 3-file packaging sys...
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#997
File: apps/extension/package.publish.json:2-8
Timestamp: 2025-07-31T20:49:04.638Z
Learning: In the eyaltoledano/claude-task-master repository, the VS Code extension uses a 3-file packaging system where package.json (with name "extension") is for development within the monorepo, while package.publish.json (with name "task-master-hamster") contains the clean manifest for VS Code marketplace publishing. The different names are intentional and serve distinct purposes in the build and publishing workflow.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/commands.js : use path.join() to construct file paths, follow established...
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 path.join() to construct file paths, follow established naming conventions (like task_001.txt), check file existence before deletion, and handle file deletion errors gracefully.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/utils.js : use `path.join()` for cross-platform path construction, `path....
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 `path.join()` for cross-platform path construction, `path.resolve()` for absolute paths, and validate paths before file operations.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: start new projects by running `task-master init` or `node scripts/dev.js parse-prd --input=
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Start new projects by running `task-master init` or `node scripts/dev.js parse-prd --input=<prd-file.txt>` to generate the initial tasks.json.
Applied to files:
.github/scripts/tag-extension.mjs
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Start new projects by running `task-master init` or `node scripts/dev.js parse-prd --input=<prd-file.txt>` to generate the initial tasks.json.
.github/scripts/tag-extension.mjs📚 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:
.github/scripts/tag-extension.mjs
📚 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:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/* : do not call readjson or writejson without passing projectroot and 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/* : Do not call readJSON or writeJSON without passing projectRoot and tag
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to mcp-server/src/tools/utils.js : use `normalizeprojectroot(rawpath, log)`, `getrawprojectr...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to mcp-server/src/tools/utils.js : Use `normalizeProjectRoot(rawPath, log)`, `getRawProjectRootFromSession(session, log)`, and `withNormalizedProjectRoot(executeFn)` in `mcp-server/src/tools/utils.js` to ensure project root paths are normalized for MCP tools.
Applied to files:
.github/scripts/tag-extension.mjs
📚 Learning: applies to mcp-server/src/tools/*.js : all mcp tool execute methods that require access to the proje...
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-07-18T17:11:36.732Z
Learning: Applies to mcp-server/src/tools/*.js : All MCP tool execute methods that require access to the project root MUST be wrapped with the withNormalizedProjectRoot Higher-Order Function (HOF) from mcp-server/src/tools/utils.js.
Applied to files:
.github/scripts/tag-extension.mjs
🔇 Additional comments (4)
.github/scripts/tag-extension.mjs (4)
4-5: LGTM!The additional imports are necessary for the new root directory detection functionality and follow Node.js best practices.
31-31: LGTM!Using
__dirnameas the starting point for root directory detection is appropriate, and allowing the potential error to propagate is correct for a script that should fail fast.
34-34: LGTM!Using the dynamically resolved
rootDirmakes the path construction robust and eliminates assumptions about directory structure. This directly addresses the "package.json not found" issue mentioned in the PR title.
47-47: LGTM!Dynamic root directory resolution ensures the root package.json is found reliably regardless of where the script is executed from.
| function findRootDir(startDir) { | ||
| let currentDir = resolve(startDir); | ||
| while (currentDir !== '/') { | ||
| if (existsSync(join(currentDir, 'package.json'))) { | ||
| // Verify it's the root package.json by checking for expected fields | ||
| try { | ||
| const pkg = JSON.parse( | ||
| readFileSync(join(currentDir, 'package.json'), 'utf8') | ||
| ); | ||
| if (pkg.name === 'task-master-ai' || pkg.repository) { | ||
| return currentDir; | ||
| } | ||
| } catch {} | ||
| } | ||
| currentDir = dirname(currentDir); | ||
| } | ||
| throw new Error('Could not find root directory'); | ||
| } |
There was a problem hiding this comment.
Fix cross-platform compatibility issue.
The termination condition currentDir !== '/' only works on Unix systems and will cause infinite loops on Windows where drive roots are like C:\.
Apply this diff to handle both Unix and Windows paths:
-function findRootDir(startDir) {
- let currentDir = resolve(startDir);
- while (currentDir !== '/') {
+function findRootDir(startDir) {
+ let currentDir = resolve(startDir);
+ let previousDir;
+ while (currentDir !== previousDir) {
+ previousDir = currentDir;This approach works because dirname('/') returns '/' on Unix and dirname('C:\\') returns 'C:\\' on Windows, so the loop will terminate when we reach the filesystem root on any platform.
📝 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.
| function findRootDir(startDir) { | |
| let currentDir = resolve(startDir); | |
| while (currentDir !== '/') { | |
| if (existsSync(join(currentDir, 'package.json'))) { | |
| // Verify it's the root package.json by checking for expected fields | |
| try { | |
| const pkg = JSON.parse( | |
| readFileSync(join(currentDir, 'package.json'), 'utf8') | |
| ); | |
| if (pkg.name === 'task-master-ai' || pkg.repository) { | |
| return currentDir; | |
| } | |
| } catch {} | |
| } | |
| currentDir = dirname(currentDir); | |
| } | |
| throw new Error('Could not find root directory'); | |
| } | |
| function findRootDir(startDir) { | |
| let currentDir = resolve(startDir); | |
| let previousDir; | |
| while (currentDir !== previousDir) { | |
| previousDir = currentDir; | |
| if (existsSync(join(currentDir, 'package.json'))) { | |
| // Verify it's the root package.json by checking for expected fields | |
| try { | |
| const pkg = JSON.parse( | |
| readFileSync(join(currentDir, 'package.json'), 'utf8') | |
| ); | |
| if (pkg.name === 'task-master-ai' || pkg.repository) { | |
| return currentDir; | |
| } | |
| } catch {} | |
| } | |
| currentDir = dirname(currentDir); | |
| } | |
| throw new Error('Could not find root directory'); | |
| } |
🤖 Prompt for AI Agents
In .github/scripts/tag-extension.mjs around lines 12 to 29, the loop termination
condition currentDir !== '/' only works on Unix and causes infinite loops on
Windows. To fix this, change the loop condition to check if currentDir is equal
to dirname(currentDir), and break the loop when they are the same, indicating
the filesystem root. This ensures the loop terminates correctly on both Unix and
Windows platforms.
…ledano#1073) * chore: fix tag-extension package.json not found for extension * chore: fix format
…ledano#1073) * chore: fix tag-extension package.json not found for extension * chore: fix format
…ledano#1073) * chore: fix tag-extension package.json not found for extension * chore: fix format
…ledano#1073) * chore: fix tag-extension package.json not found for extension * chore: fix format
…ledano#1073) * chore: fix tag-extension package.json not found for extension * chore: fix format
What type of PR is this?
Description
Related Issues
How to Test This
# Example commands or stepsExpected result:
Contributor Checklist
npm run changesetnpm testnpm run format-check(ornpm run formatto fix)Changelog Entry
For Maintainers
Summary by CodeRabbit