feat: implement optimization #4 - version-tag consistency check
Add version-tag consistency validation to prevent mismatched releases: - Integrate validate_changelog_version() into create_tag() workflow to ensure CHANGELOG has version section before creating git tag - Add check_version_consistency() method to ReleaseManager for manual consistency verification - Add 'release check-consistency --version X.Y.Z' CLI command to verify CHANGELOG and git tag alignment - Prevent tag creation if CHANGELOG missing version section - Provide helpful tips when validation fails This ensures git tags and CHANGELOG versions stay synchronized, preventing incomplete or inconsistent releases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,15 @@ class ReleaseManager:
|
||||
print(f" - {issue}")
|
||||
return False
|
||||
|
||||
# Check version-tag consistency (ensure CHANGELOG has version section)
|
||||
changelog_valid, changelog_issues = self.validator.validate_changelog_version(version)
|
||||
if not changelog_valid and not self.force:
|
||||
print(f"❌ Cannot create tag for version {version}:")
|
||||
for issue in changelog_issues:
|
||||
print(f" - {issue}")
|
||||
print("\n💡 Tip: Add a section for version {version} to CHANGELOG.md before tagging")
|
||||
return False
|
||||
|
||||
return self.git_manager.create_tag(version, message, push=push)
|
||||
|
||||
def build_packages(self) -> bool:
|
||||
@@ -213,4 +222,15 @@ class ReleaseManager:
|
||||
Returns:
|
||||
List of commit messages since last tag
|
||||
"""
|
||||
return self.git_manager.get_commits_since_tag()
|
||||
return self.git_manager.get_commits_since_tag()
|
||||
|
||||
def check_version_consistency(self, version: str) -> Tuple[bool, List[str]]:
|
||||
"""Check consistency between CHANGELOG version and git tags.
|
||||
|
||||
Args:
|
||||
version: Version to check (e.g., "0.10.0")
|
||||
|
||||
Returns:
|
||||
Tuple of (is_consistent, list_of_issues)
|
||||
"""
|
||||
return self.validator.check_version_tag_consistency(version)
|
||||
Reference in New Issue
Block a user