Skip to content

Commit 75ff7dc

Browse files
authored
feat: add --no-commit flag to bump command (#4087)
Allows updating version files without creating a commit, branch, or PR.
1 parent 38b0b12 commit 75ff7dc

File tree

1 file changed

+58
-45
lines changed
  • lib/devtools/src/crewai_devtools

1 file changed

+58
-45
lines changed

lib/devtools/src/crewai_devtools/cli.py

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,17 @@ def cli() -> None:
323323
"--dry-run", is_flag=True, help="Show what would be done without making changes"
324324
)
325325
@click.option("--no-push", is_flag=True, help="Don't push changes to remote")
326-
def bump(version: str, dry_run: bool, no_push: bool) -> None:
326+
@click.option(
327+
"--no-commit", is_flag=True, help="Don't commit changes (just update files)"
328+
)
329+
def bump(version: str, dry_run: bool, no_push: bool, no_commit: bool) -> None:
327330
"""Bump version across all packages in lib/.
328331
329332
Args:
330333
version: New version to set (e.g., 1.0.0, 1.0.0a1).
331334
dry_run: Show what would be done without making changes.
332335
no_push: Don't push changes to remote.
336+
no_commit: Don't commit changes (just update files).
333337
"""
334338
try:
335339
# Check prerequisites
@@ -397,51 +401,60 @@ def bump(version: str, dry_run: bool, no_push: bool) -> None:
397401
else:
398402
console.print("[dim][DRY RUN][/dim] Would run: uv sync")
399403

400-
branch_name = f"feat/bump-version-{version}"
401-
if not dry_run:
402-
console.print(f"\nCreating branch {branch_name}...")
403-
run_command(["git", "checkout", "-b", branch_name])
404-
console.print("[green]✓[/green] Branch created")
405-
406-
console.print("\nCommitting changes...")
407-
run_command(["git", "add", "."])
408-
run_command(["git", "commit", "-m", f"feat: bump versions to {version}"])
409-
console.print("[green]✓[/green] Changes committed")
410-
411-
if not no_push:
412-
console.print("\nPushing branch...")
413-
run_command(["git", "push", "-u", "origin", branch_name])
414-
console.print("[green]✓[/green] Branch pushed")
415-
else:
416-
console.print(f"[dim][DRY RUN][/dim] Would create branch: {branch_name}")
417-
console.print(
418-
f"[dim][DRY RUN][/dim] Would commit: feat: bump versions to {version}"
419-
)
420-
if not no_push:
421-
console.print(f"[dim][DRY RUN][/dim] Would push branch: {branch_name}")
422-
423-
if not dry_run and not no_push:
424-
console.print("\nCreating pull request...")
425-
run_command(
426-
[
427-
"gh",
428-
"pr",
429-
"create",
430-
"--base",
431-
"main",
432-
"--title",
433-
f"feat: bump versions to {version}",
434-
"--body",
435-
"",
436-
]
437-
)
438-
console.print("[green]✓[/green] Pull request created")
439-
elif dry_run:
440-
console.print(
441-
f"[dim][DRY RUN][/dim] Would create PR: feat: bump versions to {version}"
442-
)
404+
if no_commit:
405+
console.print("\nSkipping git operations (--no-commit flag set)")
443406
else:
444-
console.print("\nSkipping PR creation (--no-push flag set)")
407+
branch_name = f"feat/bump-version-{version}"
408+
if not dry_run:
409+
console.print(f"\nCreating branch {branch_name}...")
410+
run_command(["git", "checkout", "-b", branch_name])
411+
console.print("[green]✓[/green] Branch created")
412+
413+
console.print("\nCommitting changes...")
414+
run_command(["git", "add", "."])
415+
run_command(
416+
["git", "commit", "-m", f"feat: bump versions to {version}"]
417+
)
418+
console.print("[green]✓[/green] Changes committed")
419+
420+
if not no_push:
421+
console.print("\nPushing branch...")
422+
run_command(["git", "push", "-u", "origin", branch_name])
423+
console.print("[green]✓[/green] Branch pushed")
424+
else:
425+
console.print(
426+
f"[dim][DRY RUN][/dim] Would create branch: {branch_name}"
427+
)
428+
console.print(
429+
f"[dim][DRY RUN][/dim] Would commit: feat: bump versions to {version}"
430+
)
431+
if not no_push:
432+
console.print(
433+
f"[dim][DRY RUN][/dim] Would push branch: {branch_name}"
434+
)
435+
436+
if not dry_run and not no_push:
437+
console.print("\nCreating pull request...")
438+
run_command(
439+
[
440+
"gh",
441+
"pr",
442+
"create",
443+
"--base",
444+
"main",
445+
"--title",
446+
f"feat: bump versions to {version}",
447+
"--body",
448+
"",
449+
]
450+
)
451+
console.print("[green]✓[/green] Pull request created")
452+
elif dry_run:
453+
console.print(
454+
f"[dim][DRY RUN][/dim] Would create PR: feat: bump versions to {version}"
455+
)
456+
else:
457+
console.print("\nSkipping PR creation (--no-push flag set)")
445458

446459
console.print(f"\n[green]✓[/green] Version bump to {version} complete!")
447460

0 commit comments

Comments
 (0)