python-unfuck 1.0.2
🔥 The magical Python error fixing tool that automatically fixes your code with a single command! Features AI integration, 5 personality modes, and fixes 50+ common errors in under 2 seconds.
License: MIT
Requires Python: >=3.8
Keywords: python, debug, error, fix, automation, tool

# 🔥 UNFUCK - The Magical Python Error Fixer 🔥

*Because life's too short to debug!*

[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![GitHub](https://img.shields.io/badge/GitHub-Sherin--SEF--AI-blue.svg)](https://github.com/Sherin-SEF-AI)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-Sherin%20Joseph-blue.svg)](https://www.linkedin.com/in/sherin-roy-deepmost/)

**Unfuck** is a magical Python tool that automatically fixes your code errors with a single command. When your Python script crashes, simply type `unfuck` and watch the magic happen! ✨

## 🚀 Quick Start

```bash
# Install unfuck
pip install unfuck

# Run your script (it will probably break)
python my_script.py

# Unfuck it!
unfuck

# Your code is now working! 🎉
```

## ✨ Features

### 🔥 **Instant Error Fixing**
- Fixes 50+ common Python errors automatically
- Works in under 2 seconds
- Zero configuration required
- Creates backups before making changes

### 🤖 **AI-Powered Analysis**
- Uses local Ollama LLM for complex errors
- Learns from your mistakes
- Gets smarter over time
- Explains what went wrong

### 🎭 **Personality Modes**
- **Encouraging**: "I got you! Let me fix that error..."
- **Sarcastic**: "This again? *sigh* fixing..."
- **Zen**: "Breathe... let me find the balance in your code..."
- **Professional**: "Error detected. Initiating repair sequence..."
- **Meme**: "TO THE MOON! (with your fixed code)"

### 🛠️ **Error Types Fixed**

| Error Type | Examples | Fix |
|------------|----------|-----|
| **Import Errors** | `ModuleNotFoundError`, `ImportError` | Install packages, fix typos |
| **Syntax Errors** | Missing colons, brackets, quotes | Add missing syntax elements |
| **Type Errors** | String + Integer, NoneType calls | Add type conversions, null checks |
| **Name Errors** | Undefined variables, scope issues | Define variables, fix scope |
| **Index/Key Errors** | List out of range, missing dict keys | Add bounds checking, use .get() |
| **Attribute Errors** | Wrong method calls, typos | Fix method names, add checks |
| **Value Errors** | Invalid conversions, empty sequences | Add validation, defaults |
| **File Errors** | Missing files, permission issues | Create files, fix paths |
| **Indentation Errors** | Mixed tabs/spaces, wrong levels | Fix indentation consistently |

## 🎯 Usage Examples

### Basic Usage
```bash
# Fix the last error
unfuck

# Fix with explanations
unfuck --explain

# Preview fixes without applying
unfuck --preview

# Use AI for complex errors
unfuck --ai
```

### Personality Modes
```bash
# Encouraging mode (default)
unfuck --mode encouraging

# Sarcastic mode
unfuck --mode sarcastic

# Zen mode
unfuck --mode zen

# Professional mode
unfuck --mode professional

# Meme mode
unfuck --mode meme
```

### Advanced Features
```bash
# Try harder fixes
unfuck --aggressive

# Show fix history
unfuck --history

# Show success statistics
unfuck --stats

# Undo last fix
unfuck --undo

# Fix everything possible (rampage mode!)
unfuck --rampage
```

## 🎮 Fun Commands

```bash
# Fix everything it can find
unfuck --rampage

# Add meditation comments to code
unfuck --zen

# Git blame with sarcastic comments
unfuck --blame

# Russian roulette - random fix from top options
unfuck --russian-roulette
```

## 🏆 Achievement System

- 🎉 **First Unfuck!** - Your first successful fix
- 🔥 **Unfuck Streak** - Fix 10 errors in a row
- 💎 **Unfuck Master** - Fix 100 errors
- 👑 **Unfuck Royalty** - Fix 500 errors
- 🏆 **Unfuck Legend** - Fix 1000 errors

## 🤖 AI Integration

Unfuck can use local AI models via Ollama for complex error analysis:

```bash
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh

# Pull a model
ollama pull llama2

# Use AI-powered unfucking
unfuck --ai --explain
```

## 📊 Statistics & Learning

Unfuck tracks your debugging journey:

```bash
# View your unfuck statistics
unfuck --stats

# View fix history
unfuck --history

# Export your unfuck story
unfuck --export-story
```

## 🔧 Configuration

Create `~/.unfuck/config.json` to customize:

```json
{
  "ai_enabled": true,
  "ai_model": "llama2",
  "personality_mode": "encouraging",
  "auto_backup": true,
  "max_fix_attempts": 3,
  "confidence_threshold": 0.6,
  "show_animations": true,
  "verbose_output": false
}
```

## 🧪 Testing

Try unfuck with these example broken scripts:

```bash
# Test import errors
python examples/test_imports.py
unfuck

# Test syntax errors  
python examples/test_syntax.py
unfuck

# Test various errors
python examples/broken_script.py
unfuck
```

## 🎨 Screenshots

```
🔥 UNFUCK - The Magical Python Error Fixer 🔥

🔍 Error Analysis
┌─────────────┬─────────────────────────────────────┐
│ Property    │ Value                               │
├─────────────┼─────────────────────────────────────┤
│ Error Type  │ ModuleNotFoundError                 │
│ Message     │ No module named 'numpy'             │
│ File        │ /path/to/script.py                  │
│ Line        │ 3                                   │
└─────────────┴─────────────────────────────────────┘

🛠️ Fix Suggestions
┌──────┬─────────────────────────┬────────────┬──────────┐
│ Rank │ Description             │ Confidence │ Type     │
├──────┼─────────────────────────┼────────────┼──────────┤
│ 1    │ Install missing module  │ 95%        │ install  │
│ 2    │ Fix typo in import name │ 80%        │ typo     │
└──────┴─────────────────────────┴────────────┴──────────┘

🎉 Unfucked! Your code is running!
🔥 You're on fire! 5 fixes in a row!
```

## 🤝 Contributing

We welcome contributions! Here's how to get started:

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Add your fix patterns to the database
4. Test with broken scripts
5. Submit a pull request

### Adding New Fix Patterns

```python
# Add to unfuck/core/pattern_database.py
FixPattern(
    error_type="YourError",
    error_pattern="error message pattern",
    fix_type="your_fix_type",
    fix_code="fix implementation",
    confidence=0.9,
    description="What this fix does",
    examples=["example usage"]
)
```

## 📈 Roadmap

- [ ] JavaScript/TypeScript support
- [ ] VS Code extension
- [ ] Team collaboration features
- [ ] Cloud-based fix sharing
- [ ] Machine learning improvements
- [ ] Plugin system for custom fixes

## 🐛 Bug Reports

Found a bug? We want to fix it! Please report issues with:

- The error that occurred
- What unfuck tried to do
- What actually happened
- Your Python version and OS

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- The Python community for all the Stack Overflow questions that inspired this
- Ollama for making local AI accessible
- Rich for beautiful terminal output
- All the developers who've ever been frustrated by debugging

## 🌟 Star History

[![Star History Chart](https://api.star-history.com/svg?repos=unfuck/unfuck&type=Date)](https://star-history.com/#unfuck/unfuck&Date)

---

**Made with ❤️ by the unfuck team**

*"Because life's too short to debug"* 🚀

[Website](https://unfuck.dev) • [Documentation](https://docs.unfuck.dev) • [Discord](https://discord.gg/unfuck) • [Twitter](https://twitter.com/unfuck_python)