AI-powered SonarQube issue remediation that automatically fixes your code quality problems using Claude Code or Aider.
vibe-heal integrates with SonarQube to automatically fix code quality issues using AI coding assistants. It:
# Clone the repository
git clone https://github.com/alexeieleusis/vibe-heal.git
cd vibe-heal
# Install with uv
uv pip install -e .
Option A: Claude Code
# Install Claude Code CLI (if not already installed)
# See https://docs.claude.com/claude-code for installation instructions
Option B: Aider
# Install Aider
pip install aider-chat
# If using Ollama, make sure it's running
# Download and start Ollama from https://ollama.ai
ollama pull gemma3:27b # or your preferred model
For Claude Code (auto-detected):
cat > .env.vibeheal <<EOF
SONARQUBE_URL=https://sonar.example.com
SONARQUBE_TOKEN=your_token_here
SONARQUBE_PROJECT_KEY=your_project_key
EOF
For Aider with Ollama:
cat > .env.vibeheal <<EOF
SONARQUBE_URL=https://sonar.example.com
SONARQUBE_TOKEN=your_token_here
SONARQUBE_PROJECT_KEY=your_project_key
AI_TOOL=aider
AIDER_MODEL=ollama_chat/gemma3:27b
AIDER_API_BASE=http://127.0.0.1:11434
EOF
Option A: Fix a single file
# Test with dry-run first
vibe-heal fix src/main.py --dry-run
# Fix a single issue to test
vibe-heal fix src/main.py --max-issues 1
# Fix all MAJOR and above issues
vibe-heal fix src/main.py --min-severity MAJOR
# Use a custom environment file
vibe-heal fix src/main.py --env-file .env.production
Option B: Remove code duplications from a file
# Remove duplications with dry-run first
vibe-heal dedupe src/main.py --dry-run
# Remove all duplications
vibe-heal dedupe src/main.py
# Limit number of duplications to fix
vibe-heal dedupe src/main.py --max-duplications 5
# Use a custom environment file
vibe-heal dedupe src/main.py --env-file .env.production
Option C: Clean up entire branch (recommended before code review)
# Clean up all modified files in your branch
vibe-heal cleanup
# Clean up with custom base branch
vibe-heal cleanup --base-branch develop
# Clean up only Python files
vibe-heal cleanup --pattern "*.py"
# Clean up with more iterations per file
vibe-heal cleanup --max-iterations 20
# Use a custom environment file
vibe-heal cleanup --env-file .env.production
Option D: Remove duplications from entire branch
# Remove duplications from all modified files
vibe-heal dedupe-branch
# Remove duplications with custom base branch
vibe-heal dedupe-branch --base-branch develop
# Remove duplications only from Python files
vibe-heal dedupe-branch --pattern "*.py"
# More iterations per file for complex duplications
vibe-heal dedupe-branch --max-iterations 20
# Use a custom environment file
vibe-heal dedupe-branch --env-file .env.production
For developers contributing to vibe-heal:
git clone https://github.com/alexeieleusis/vibe-heal.git
cd vibe-heal
# Install with uv
make install
# Run all tests
make test
# Run with coverage
uv run pytest --cov=src/vibe_heal
# Run specific module tests
uv run pytest tests/config/ -v
uv run pytest tests/sonarqube/ -v
# Run type checking
make check
# Run all pre-commit hooks
uv run pre-commit run -a
See CLAUDE.md for detailed development commands and project structure.
By default, vibe-heal looks for configuration in .env.vibeheal or .env in the current directory.
Create a .env.vibeheal file with:
# SonarQube Configuration (Required)
SONARQUBE_URL=https://sonarqube.example.com
SONARQUBE_TOKEN=your_token_here
# OR use username/password (token is preferred)
# SONARQUBE_USERNAME=your_username
# SONARQUBE_PASSWORD=your_password
SONARQUBE_PROJECT_KEY=your_project_key
# AI Tool Configuration (Optional - will auto-detect if not set)
# AI_TOOL=claude-code # Use Claude Code
# AI_TOOL=aider # Use Aider
# Aider-Specific Configuration (only when using Aider)
# AIDER_MODEL=ollama_chat/gemma3:27b # Model to use
# AIDER_API_KEY=your-api-key # API key (if needed)
# AIDER_API_BASE=http://127.0.0.1:11434 # API base URL
# Context Enrichment (Optional - enhances AI fix quality)
# CODE_CONTEXT_LINES=5 # Lines before/after issue to show AI (default: 5)
# INCLUDE_RULE_DESCRIPTION=true # Include full rule docs in prompts (default: true)
You can specify a custom environment file using the --env-file option:
# Use a different environment file for production SonarQube
vibe-heal fix src/main.py --env-file .env.production
# Use different configs for different projects
vibe-heal cleanup --env-file ~/configs/project-a.env
# View configuration from a specific file
vibe-heal config --env-file .env.staging
This is useful for:
Example configurations:
SONARQUBE_URL=https://sonar.example.com
SONARQUBE_TOKEN=your_token
SONARQUBE_PROJECT_KEY=your_project
SONARQUBE_URL=https://sonar.example.com
SONARQUBE_TOKEN=your_token
SONARQUBE_PROJECT_KEY=your_project
AI_TOOL=aider
AIDER_MODEL=ollama_chat/gemma3:27b
AIDER_API_BASE=http://127.0.0.1:11434
SONARQUBE_URL=https://sonar.example.com
SONARQUBE_TOKEN=your_token
SONARQUBE_PROJECT_KEY=your_project
AI_TOOL=aider
AIDER_MODEL=gpt-4
AIDER_API_KEY=sk-your-openai-key
vibe-heal/
├── src/vibe_heal/
│ ├── config/ # Configuration management
│ ├── sonarqube/ # SonarQube API client
│ ├── ai_tools/ # AI tool integrations (Claude Code + Aider)
│ ├── processor/ # Issue processing logic
│ ├── git/ # Git operations & branch analysis
│ ├── cleanup/ # Branch cleanup orchestration
│ ├── deduplication/ # Code deduplication
│ ├── cli.py # Command-line interface
│ ├── orchestrator.py # Workflow orchestration
│ └── models.py # Top-level models
├── tests/ # Comprehensive test suite
└── docs/ # Documentation
Contributions are welcome! However, vibe-heal is intentionally focused on doing one thing well: automatically fixing SonarQube issues using AI tools. There are no plans to add heavy new features that would increase complexity or bloat.
Before submitting a pull request:
For bug fixes and improvements to existing functionality, please see CONTRIBUTING.md for development setup and guidelines.
See docs/ARCHITECTURE.md for system architecture details.
Repository initiated with fpgmaas/cookiecutter-uv.