Metadata-Version: 2.4
Name: codesonor
Version: 0.5.0
Summary: AI-Powered GitHub Repository Analyzer - 8 LLM providers, Code Archaeology, Team DNA, Dependency Risk, ML Forecasting, Cross-Repo Learning, and 7 more unique features
Author: Farhan Mir
License: MIT
Project-URL: Homepage, https://github.com/farhanmir/CodeSonor
Project-URL: Repository, https://github.com/farhanmir/CodeSonor
Project-URL: Bug Tracker, https://github.com/farhanmir/CodeSonor/issues
Keywords: github,repository,analyzer,ai,code-analysis,gemini,cli,quality,caching
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: google-generativeai>=0.3.2
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: click>=8.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: gitpython>=3.1.40
Requires-Dist: scikit-learn>=1.3.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: networkx>=3.0
Requires-Dist: packaging>=23.0
Requires-Dist: license-expression>=30.0.0
Provides-Extra: gemini
Requires-Dist: google-generativeai>=0.3.0; extra == "gemini"
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.18.0; extra == "anthropic"
Provides-Extra: mistral
Requires-Dist: mistralai>=0.1.0; extra == "mistral"
Provides-Extra: groq
Requires-Dist: groq>=0.4.0; extra == "groq"
Provides-Extra: all-llm
Requires-Dist: google-generativeai>=0.3.0; extra == "all-llm"
Requires-Dist: openai>=1.0.0; extra == "all-llm"
Requires-Dist: anthropic>=0.18.0; extra == "all-llm"
Requires-Dist: mistralai>=0.1.0; extra == "all-llm"
Requires-Dist: groq>=0.4.0; extra == "all-llm"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Provides-Extra: web
Requires-Dist: Flask>=3.0.0; extra == "web"
Requires-Dist: Flask-CORS>=4.0.0; extra == "web"
Dynamic: license-file

# CodeSonor CLI 🔍

**AI-Powered GitHub Repository Analyzer with Multi-LLM Support**

[![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Analyze any GitHub repository with AI-powered insights. Choose from 8 different AI providers!

## 🚀 Installation

### Basic (includes Gemini)
```bash
pip install codesonor
```

### With Specific Provider
```bash
pip install codesonor[openai]      # OpenAI GPT
pip install codesonor[anthropic]   # Anthropic Claude
pip install codesonor[mistral]     # Mistral AI
pip install codesonor[groq]        # Groq (fastest)
pip install codesonor[all-llm]     # All providers
```

## 🤖 Supported AI Providers

| Provider | Free Tier | Speed | Get API Key |
|----------|-----------|-------|-------------|
| **Gemini** ⭐ | ✅ Yes | Fast | [Get Key](https://aistudio.google.com/app/apikey) |
| **OpenAI** | ❌ Paid | Medium | [Get Key](https://platform.openai.com/api-keys) |
| **Claude** | ❌ Paid | Fast | [Get Key](https://console.anthropic.com/settings/keys) |
| **Mistral** | ❌ Paid | Fast | [Get Key](https://console.mistral.ai/api-keys/) |
| **Groq** ⚡ | ✅ Yes | Ultra-fast | [Get Key](https://console.groq.com/keys) |
| **OpenRouter** 🌐 | 💳 Pay-per-use | Fast | [Get Key](https://openrouter.ai/keys) |
| **xAI Grok** | ❌ Paid | Fast | [Get Key](https://console.x.ai) |
| **Ollama** 🆓 | ✅ FREE | Medium | [Download](https://ollama.ai/download) |

⭐ Default | ⚡ Fastest | 🌐 100+ models | 🆓 Local & FREE

## ⚙️ Configuration

### One-Time Setup (Recommended)
```bash
codesonor setup
```
This interactive wizard will:
- ✅ Let you choose your AI provider
- ✅ Guide you to get the API key  
- ✅ Save everything to `~/.codesonor/config.json`
- ✅ Never ask again!

### Check Your Configuration
```bash
codesonor config
```

### Alternative Methods

**Environment Variables** (if you prefer):
```bash
# Windows (PowerShell)
$env:GEMINI_API_KEY = "your_key"
$env:GITHUB_TOKEN = "your_token"

# Linux/Mac
export GEMINI_API_KEY="your_key"
export GITHUB_TOKEN="your_token"
```

**Per-Command** (override saved config):
```bash
codesonor analyze URL --gemini-key YOUR_KEY --github-token YOUR_TOKEN
```

## 📖 Usage

### Full Analysis with AI
```bash
codesonor analyze https://github.com/owner/repo
```

### Quick Summary (No AI)
```bash
codesonor summary https://github.com/owner/repo
```

### Advanced Options
```bash
# Skip AI analysis (faster)
codesonor analyze https://github.com/owner/repo --no-ai

# Limit number of files analyzed
codesonor analyze https://github.com/owner/repo --max-files 200

# Export results as JSON
codesonor analyze https://github.com/owner/repo --json-output results.json
```

## 📊 Example Output

```
╭─────────────────────────────────────────────────╮
│  CodeSonor Analysis: awesome-project            │
╰─────────────────────────────────────────────────╯

Repository Information
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Field      ┃ Value                          ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Owner      │ awesome-owner                  │
│ Repository │ awesome-project                │
│ Stars      │ 1,234                          │
│ Forks      │ 567                            │
│ Language   │ Python                         │
└────────────┴────────────────────────────────┘

Language Distribution
┏━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┓
┃ Language   ┃ Files    ┃ %      ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━┩
│ Python     │ 45       │ 78.5%  │
│ JavaScript │ 8        │ 14.0%  │
│ CSS        │ 4        │ 7.0%   │
│ HTML       │ 1        │ 0.5%   │
└────────────┴──────────┴────────┘

🤖 AI-Generated Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This repository implements a modern web application
framework with clean architecture and comprehensive
testing. Key features include...
```

## 🎯 Features

- **🤖 AI Analysis**: Get intelligent insights about repository purpose, architecture, and key features
- **📊 Language Stats**: Detailed breakdown of programming languages used
- **📁 Smart Filtering**: Automatically skips common directories (node_modules, dist, build)
- **⚡ Performance**: File limits and optimizations for fast analysis
- **🎨 Beautiful Output**: Rich terminal formatting with colors and tables
- **💾 Export Options**: Save results as JSON for further processing

## 🛠️ Development

Install with development dependencies:
```bash
pip install codesonor[dev]
```

Run tests:
```bash
pytest
```

## 📦 Web App Version

CodeSonor also comes with a Flask web application. To use it:

```bash
# Install with web dependencies
pip install codesonor[web]

# Clone the repository for web app files
git clone https://github.com/farhanmir/CodeSonor.git
cd CodeSonor

# Run the web server
python app.py
```

Visit `http://localhost:5000` in your browser.

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

## 👤 Author

**Farhan Mir**

- GitHub: [@farhanmir](https://github.com/farhanmir)

## 🙏 Acknowledgments

- Powered by Google Gemini AI
- Built with Python, Click, and Rich
- GitHub REST API v3

---

**Note**: This tool analyzes public repositories. Ensure you have appropriate permissions before analyzing private repositories.
