An AI-powered Git branch name generator that follows the Conventional Branch naming convention. This tool analyzes your Git diff and automatically generates descriptive, standardized branch names.
aibranch consists of two components:
- Cloudflare Worker (TypeScript/Bun) - An AI workflow service powered by VoltAgent and OpenAI
- CLI Tool (Rust) - A command-line interface that interacts with your Git repository
The CLI tool reads your current Git changes, sends them to the AI service, and suggests a conventional branch name based on your modifications.
- π€ AI-Powered: Uses OpenAI's GPT models to analyze code changes
- π Conventional Branch Standard: Follows industry-standard branch naming conventions
- β‘ Fast & Lightweight: Rust CLI with minimal dependencies
- π Serverless: Runs on Cloudflare Workers for scalability
- π Secure: Uses rustls-tls for secure communications
curl https://i.jpillora.com/sakkeam/aibranch@latest! | bash(main) $ git switch -c work
(work) $ git commit
(work) $ aibranch
Generating the new branch name...
Generated branch name: chore/add-devcontainer
Reason: Adds a new .devcontainer/devcontainer.json to set up devcontainer (VS Code extensions and pnpm onCreateCommand) β non-feature configuration change, classified as chore.
Do you want to approve this branch name? [Y/n] y
(chore/add-devcontainer) $ git push origin chore/add-devcontainer
The tool generates branch names following these prefixes:
feature/orfeat/- New featuresbugfix/orfix/- Bug fixeshotfix/- Urgent fixesrelease/- Release preparationchore/- Non-code tasks (docs, dependencies, etc.)
Branch names are always lowercase with hyphens separating words (e.g., feature/add-user-authentication).
- Bun v1.2.23 or higher
- Rust (latest stable)
- Wrangler CLI for deployment
- Git
- Install dependencies:
bun install- Build the CLI tool:
cd cli
cargo build --releaseThe compiled binary will be available at cli/target/release/cli.
Start the development server:
bun run devThe worker will be available at http://0.0.0.0:8787.
- Make some changes in your Git repository
- Commit or stage your changes
- Run the CLI:
./cli/target/release/cli- The tool will:
- Analyze your Git diff (comparing
main..HEAD) - Generate a suggested branch name
- Provide a reason for the suggestion
- Prompt you to approve and apply the branch name
- Analyze your Git diff (comparing
Configure the CLI to use a custom worker endpoint:
export AIBRANCH_HOST="https://your-custom-domain.workers.dev"Default: https://aibranch-worker.sakkeam.workers.dev
Deploy the worker to Cloudflare:
bun run deployMake sure to configure your environment variables in Wrangler:
OPENAI_API_KEY- Your OpenAI API key (required)VOLTAGENT_PUBLIC_KEY- VoltAgent public key (optional)VOLTAGENT_SECRET_KEY- VoltAgent secret key (optional)
.
βββ src/
β βββ index.ts # Main worker entry point
β βββ workflows/
β βββ branch-name-generator.ts # AI workflow logic
βββ cli/
β βββ src/
β βββ main.rs # CLI implementation
βββ package.json # Bun/Node dependencies
βββ wrangler.jsonc # Cloudflare Worker config
βββ tsconfig.json # TypeScript config
Worker:
- VoltAgent - AI agent framework
- OpenAI SDK - GPT model integration
- Hono - Lightweight web framework
- Cloudflare Workers - Serverless platform
CLI:
- Clap - Command-line argument parsing
- Reqwest - HTTP client with rustls-tls
- Tokio - Async runtime
- Serde - JSON serialization
bun run start # Run TypeScript entry point locally
bun run dev # Start Wrangler dev server
bun run build # Build the worker
bun run deploy # Deploy to Cloudflare- The CLI runs
git diff main..HEADto get your changes - The diff is sent to the Cloudflare Worker's
/workflows/branch-name-generator/executeendpoint - VoltAgent processes the request through the AI workflow
- OpenAI's GPT model analyzes the diff and generates a branch name following Conventional Branch conventions
- The result (branch name + reasoning) is returned to the CLI
- The CLI prompts for approval and can automatically rename your branch
See LICENSE file for details.
Contributions are welcome! Please feel free to submit issues or pull requests.
Built with β€οΈ using Bun, Rust, VoltAgent, and Cloudflare Workers