Implementation:CrewAIInc CrewAI DevTools CLI
| Knowledge Sources | |
|---|---|
| Domains | CLI, Release Management, DevOps |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
cli.py implements a Click-based CLI tool for CrewAI release management, providing two main commands: bump for version bumping across all monorepo packages and tag for creating Git tags with AI-generated release notes.
Description
This is the primary release automation tool for the CrewAI project, ensuring consistent version management across the monorepo's multiple packages (crewai, crewai-tools, crewai-devtools). The CLI is built with the Click framework and uses Rich for formatted console output.
The bump command automates the full version bump workflow:
- Checks prerequisites: GitHub CLI (gh) installed, clean git working directory.
- Discovers all packages in lib/ and finds __init__.py files containing __version__.
- Updates __version__ strings in all found files using update_version_in_file.
- Updates workspace dependency versions in pyproject.toml files using update_pyproject_dependencies.
- Runs uv sync to synchronize the workspace.
- Creates a feature branch (feat/bump-version-{version}), commits changes, pushes to remote, and creates a pull request via gh pr create.
- Supports --dry-run, --no-push, and --no-commit flags for controlled execution.
The tag command automates the release tagging workflow:
- Validates all package versions are consistent across the monorepo.
- Checks out main branch and pulls latest changes.
- Collects commits since the last version bump commit (or last tag) using get_commits_from_last_tag.
- Fetches GitHub contributor usernames via the GitHub API (including co-authors from commit messages) using get_github_contributors.
- Generates AI-powered release notes using the OpenAI API (gpt-4o-mini model) with a structured prompt from RELEASE_NOTES_PROMPT.
- Optionally allows editing the generated notes via click.edit.
- Creates an annotated Git tag, pushes it, and creates a GitHub release (marking pre-releases for alpha/beta/rc versions).
- Supports --dry-run and --no-edit flags.
Helper functions include run_command (subprocess wrapper), check_gh_installed (with macOS Homebrew auto-install), check_git_clean, find_version_files, and get_packages.
Usage
Use this CLI tool for managing CrewAI releases. Run bump to initiate a version bump across all packages, and tag after the bump PR has been merged to create the release tag with AI-generated notes.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/devtools/src/crewai_devtools/cli.py
- Lines: 1-718
CLI Group Signature
@click.group()
def cli() -> None:
"""Development tools for version bumping and git automation."""
Bump Command Signature
@click.command()
@click.argument("version")
@click.option("--dry-run", is_flag=True, help="Show what would be done without making changes")
@click.option("--no-push", is_flag=True, help="Don't push changes to remote")
@click.option("--no-commit", is_flag=True, help="Don't commit changes (just update files)")
def bump(version: str, dry_run: bool, no_push: bool, no_commit: bool) -> None:
"""Bump version across all packages in lib/."""
Tag Command Signature
@click.command()
@click.option("--dry-run", is_flag=True, help="Show what would be done without making changes")
@click.option("--no-edit", is_flag=True, help="Skip editing release notes")
def tag(dry_run: bool, no_edit: bool) -> None:
"""Create and push a version tag on main branch."""
Import / Entry Point
from crewai_devtools.cli import cli, main
# Or as a CLI entry point:
# crewai-devtools bump 1.2.3
# crewai-devtools tag
I/O Contract
bump Command
| Name | Type | Required | Description |
|---|---|---|---|
| version | str (argument) | Yes | New version to set (e.g., "1.0.0", "1.0.0a1") |
| --dry-run | flag | No | Show what would be done without making changes |
| --no-push | flag | No | Do not push changes to remote |
| --no-commit | flag | No | Do not commit changes (just update files) |
tag Command
| Name | Type | Required | Description |
|---|---|---|---|
| --dry-run | flag | No | Show what would be done without making changes |
| --no-edit | flag | No | Skip editing release notes interactively |
Helper Functions
| Function | Description |
|---|---|
| run_command(cmd, cwd) | Runs a shell command and returns output; raises CalledProcessError on failure |
| check_gh_installed() | Validates GitHub CLI is installed; offers macOS Homebrew auto-install |
| check_git_clean() | Verifies git working directory has no uncommitted changes |
| update_version_in_file(file_path, new_version) | Updates __version__ attribute in a Python file |
| update_pyproject_dependencies(file_path, new_version) | Updates workspace dependency versions in pyproject.toml |
| find_version_files(base_path) | Finds all __init__.py files containing __version__ |
| get_packages(lib_dir) | Gets all package directories from lib/ |
| get_commits_from_last_tag(tag_name, version) | Gets commits from the last tag, excluding current version |
| get_github_contributors(commit_range) | Gets GitHub usernames from commit range using GitHub API |
Usage Examples
Basic Usage
# Version bump with dry run
# $ crewai-devtools bump 1.2.3 --dry-run
# Version bump (full workflow: update files, commit, push, create PR)
# $ crewai-devtools bump 1.2.3
# Version bump without pushing
# $ crewai-devtools bump 1.2.3 --no-push
# Create release tag with AI-generated notes
# $ crewai-devtools tag
# Create release tag without editing
# $ crewai-devtools tag --no-edit
# Dry run of tag creation
# $ crewai-devtools tag --dry-run