chore: fix tag-extension and improve debugging#1074
Conversation
|
WalkthroughThe script responsible for tagging extensions now includes improved logic for extracting, normalizing, and validating the repository URL before executing Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
✨ 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(1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 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 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/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 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/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: 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: 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: 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.
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).
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.
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/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'
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
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/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Minimize file I/O operations per feature execution, cache tag resolution results when appropriate, use streaming for large task datasets, and avoid loading all tags when only one is needed.
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
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/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Audit, fix, test, and document each command for tag support as part of the migration strategy
📚 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: 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/* : 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 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 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 : 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:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/*.js : when implementing core logic for new features, do so in 'scripts/m...
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 : When implementing core logic for new features, do so in 'scripts/modules/' before CLI or MCP interfaces, and design functions to work with both legacy and tagged data formats using tag resolution functions.
Applied to files:
.github/scripts/tag-extension.mjs
📚 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:
.github/scripts/tag-extension.mjs
📚 Learning: applies to scripts/modules/**/*.test.js : test core logic independently with both data formats, mock...
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/**/*.test.js : Test core logic independently with both data formats, mock file system operations, test tag resolution behavior, and verify migration compatibility in unit tests.
Applied to files:
.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
🪛 GitHub Actions: CI
.github/scripts/tag-extension.mjs
[error] 89-105: Biome formatter check failed. Formatting differences detected in lines 89-105. Run 'biome format .' to fix code style issues.
🔇 Additional comments (3)
.github/scripts/tag-extension.mjs (3)
65-74: LGTM! Robust URL extraction and normalization.The enhanced logic properly handles both object and string repository formats, with appropriate URL normalization for
git ls-remotecompatibility.
76-81: Good debugging improvements.The added logging and proper encoding/environment handling enhance the script's debuggability and robustness.
105-105: Improved robustness in tag existence check.The explicit String() conversion and trim() make the check more defensive against edge cases.
| if (gitResult.status !== 0) { | ||
| console.error('Git ls-remote failed:'); | ||
| console.error('Exit code:', gitResult.status); | ||
| console.error('Error:', gitResult.error); | ||
| console.error('Stderr:', gitResult.stderr); | ||
| console.error('Command:', `git ls-remote ${repoUrl} ${tag}`); | ||
|
|
||
| // For CI environments, try using origin instead of the full URL | ||
| if (process.env.CI) { | ||
| console.log('Retrying with origin remote...'); | ||
| gitResult = spawnSync('git', ['ls-remote', 'origin', tag], { | ||
| encoding: 'utf8' | ||
| }); | ||
|
|
||
| if (gitResult.status !== 0) { | ||
| throw new Error(`Failed to check remote for tag ${tag}. Exit code: ${gitResult.status}`); | ||
| } | ||
| } else { | ||
| throw new Error(`Failed to check remote for tag ${tag}. Exit code: ${gitResult.status}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Excellent error handling, but fix formatting issues.
The comprehensive error logging and CI retry logic significantly improve the script's robustness. However, there's a formatting issue that needs to be addressed.
The pipeline indicates formatting issues in this section. Run the following to fix:
#!/bin/bash
# Fix Biome formatting issue
cd .github/scripts && biome format tag-extension.mjs --write🤖 Prompt for AI Agents
In .github/scripts/tag-extension.mjs around lines 83 to 103, the code has
formatting issues flagged by the pipeline. To fix this, run the biome formatter
on the file by navigating to the .github/scripts directory and executing "biome
format tag-extension.mjs --write" to automatically correct the formatting
inconsistencies.
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