feat: implement optimization #2 - automated tag pushing control
Added --push/--no-push flag to release tag command for explicit control over tag pushing behavior. **Implementation**: - Added --push/--no-push flag to CLI tag command (default: --push) - Updated ReleaseManager.create_tag to accept push parameter - Updated GitManager.create_tag to conditionally push based on flag - Maintains backward compatibility (defaults to pushing) **Usage**: ```bash # Default behavior - creates and pushes tag release tag --version 0.11.0 # Explicit push (same as default) release tag --version 0.11.0 --push # Create tag but don't push (manual push later) release tag --version 0.11.0 --no-push ``` **Output when --no-push used**: ``` ✅ Tag v0.11.0 created 💡 Push tag with: git push origin v0.11.0 ``` **Benefits**: - Makes push behavior explicit and controllable - Prevents accidental pushes in some workflows - Defaults to safe behavior (automatic push) - Helpful reminder shown when --no-push used **Files Modified**: - capabilities/release-management/src/release_management/cli/main.py - capabilities/release-management/src/release_management/core/manager.py - capabilities/release-management/src/release_management/git/manager.py Optimizations completed: 2/9 (High Priority)
This commit is contained in:
@@ -113,8 +113,10 @@ def validate(ctx):
|
||||
@main.command()
|
||||
@click.option('--version', required=True, help='Version to tag (e.g., 0.8.0)')
|
||||
@click.option('--message', help='Tag message')
|
||||
@click.option('--push/--no-push', default=True,
|
||||
help='Automatically push tag to origin (default: --push)')
|
||||
@click.pass_context
|
||||
def tag(ctx, version: str, message: Optional[str]):
|
||||
def tag(ctx, version: str, message: Optional[str], push: bool):
|
||||
"""Create git tag for version."""
|
||||
manager = ReleaseManager(
|
||||
project_root=ctx.obj['project_root'],
|
||||
@@ -122,8 +124,10 @@ def tag(ctx, version: str, message: Optional[str]):
|
||||
force=ctx.obj['force']
|
||||
)
|
||||
|
||||
if manager.create_tag(version, message):
|
||||
if manager.create_tag(version, message, push=push):
|
||||
print(f"✅ Successfully created tag for version {version}")
|
||||
if not push:
|
||||
print(f"💡 Push tag with: git push origin v{version}")
|
||||
else:
|
||||
print(f"❌ Failed to create tag for version {version}")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user