Skip to content

jwandekoken/cli-tl

Repository files navigation

CLI-TL (CLI Tech Leader)

AI-powered code review assistant for developers.

Features

  • 🔍 Interactive Git Diff Review: File-by-file navigation of your changes
  • 🤖 AI Code Reviews: Powered by Google Gemini for intelligent code analysis
  • 📊 Risk Assessment: Automated evaluation of code changes
  • 🎯 Structured Output: Clear, actionable feedback on your code
  • 💡 Best Practices: Suggestions for improving code quality
  • 🗂️ Flexible Review Options: Review unstaged, staged, or all changes from HEAD
  • 🚀 AI-Generated Commit Messages: Automatically generate and use commit messages based on your changes

Installation

Option 1: Using Build Scripts (Recommended)

# Clone the repository
git clone <repository-url>
cd cli-tl

# Build and install as a tool
./scripts/build-and-install.sh

Option 2: Manual Installation

# Clone and build manually
git clone <repository-url>
cd cli-tl
uv build
uv tool install --force dist/*.whl

Option 3: Development Installation

# Install from source for development
git clone <repository-url>
cd cli-tl
uv sync
uv pip install -e .

Setup

1. Configure AI (Optional but recommended)

Create a .env file in the project root:

cp .env-example .env

Get your Google AI API key from Google AI Studio and add it to your .env file:

GOOGLE_API_KEY=your_google_api_key_here

2. Usage

# Review unstaged changes (default)
cli-tl review

# Review staged changes
cli-tl review --staged

# Review all changes from HEAD
cli-tl review --from-head

# Force enable AI reviews (even if not configured)
cli-tl review --ai

# Disable AI reviews for this run
cli-tl review --no-ai

AI Configuration Options

You can customize AI behavior via environment variables:

# Model selection (default: gemini/gemini-2.5-flash)
CLI_TL_AI_MODEL=gemini/gemini-2.5-flash

# Enable/disable AI globally (default: true if API key is set)
CLI_TL_AI_ENABLED=true

# Maximum tokens for AI responses (default: 8000)
CLI_TL_AI_MAX_TOKENS=8000

# AI response temperature (default: 0.1)
CLI_TL_AI_TEMPERATURE=0.1

# Request timeout in seconds (default: 30)
CLI_TL_AI_TIMEOUT=30

Example Output

🔍 Analyzing git changes...
📋 Reviewing: Unstaged changes

📊 Summary: 3 files changed, 45 insertions(+), 12 deletions(-)

🤖 Running AI code review...
============================================================
🤖 AI REVIEW SUMMARY
============================================================

📊 The changes implement a new AI code review system with proper error handling and configuration management.

⚡ Risk Assessment: low - Well-structured implementation with appropriate safeguards

📝 Detailed Review:
The implementation follows good software engineering practices with proper separation of concerns...
============================================================

🤖 AI-Generated Commit Message
┌─────────────────────────────────────────────────────────────┐
│ feat: implement AI code review system with error handling   │
│                                                             │
│ - Add AICodeReviewer class with DSPy integration            │
│ - Implement proper error handling and configuration         │
│ - Add risk assessment and detailed review capabilities      │
└─────────────────────────────────────────────────────────────┘
💡 Press 'c' during review to commit with this message

============================================================
📁 INTERACTIVE FILE REVIEW
============================================================

📄 File 1/3: app/ai/reviewer.py
Changes: +32 -5

[Detailed diff display follows...]

► Press [Enter] to continue, 's' to skip remaining, 'c' to commit with AI message, 'q' to quit

Interactive Navigation

During the file-by-file review, you can:

  • Enter: Continue to next file
  • s: Skip remaining files
  • c: Commit staged changes with AI-generated message (when available)
  • q: Quit the review session

AI-Powered Commits

When AI reviews are enabled, CLI-TL will automatically generate intelligent commit messages based on your code changes. You can:

  1. Review the AI-generated commit message - Displayed in a highlighted panel during review
  2. Commit during review - Press 'c' at any point to commit with the AI message
  3. Commit after review - Choose to commit at the end of the review process

The AI analyzes your changes and creates commit messages that follow conventional commit format when appropriate, describing what was changed and why.

Development

Build Scripts

The project includes convenient build scripts in the scripts/ directory:

# Build and install (recommended for development)
./scripts/build-and-install.sh

# Build wheel only
./scripts/build.sh

# Uninstall the tool
./scripts/uninstall.sh

See scripts/README.md for detailed documentation.

Development Commands

# Install development dependencies
uv sync --group dev

# Run tests
uv run pytest

# Lint code
uv run ruff check

Requirements

  • Python >=3.13
  • Git repository
  • Google AI API key (for AI features)

License

MIT License - see LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published