From 193d6f625ccc3a671240c4a0509cf48bd71f097b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Oct 2025 17:28:08 +0000 Subject: [PATCH 1/2] Initial plan From cc47c4c0fa330a54850984af3984a02d534a674c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Oct 2025 17:30:45 +0000 Subject: [PATCH 2/2] Add deprecation notice to README Co-authored-by: deesh-code <180828181+deesh-code@users.noreply.github.com> --- README.md | 321 +++------------------------------------------ README.original.md | 321 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 339 insertions(+), 303 deletions(-) create mode 100644 README.original.md diff --git a/README.md b/README.md index cd93625..8134f4a 100644 --- a/README.md +++ b/README.md @@ -1,321 +1,36 @@ -# 🤖 Codestral CLI +# ⚠️ DEPRECATED: Codestral CLI -A modern GitHub Copilot-style terminal interface for **Codestral** - Mistral's code generation AI. Real-time streaming responses with beautiful terminal UI and powerful developer tools. +## 🔴 This package is no longer maintained -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/) -[![Codestral](https://img.shields.io/badge/AI-Codestral-purple.svg)](https://codestral.mistral.ai/) - -## ✨ Features - -- 💬 **Interactive Chat** - GitHub Copilot-like terminal experience -- ⚡ **Real-time Streaming** - See responses as they generate, token by token -- 🎨 **Rich Terminal UI** - Beautiful formatting with live updates and markdown support -- 🤖 **AI Function Calling** - Native Mistral function calling with automatic tool selection -- 🛠️ **Smart Developer Tools** - AI-powered code review, debugging, analysis with 11+ tools -- 🚀 **Async Architecture** - Non-blocking, responsive interface -- 🔧 **Easy Setup** - One-command installation with automatic SSL handling - -## 🚀 Quick Start - -### Installation -```bash -git clone https://github.com/momominds/codestral-cli.git -cd codestral-cli -./install.sh -``` - -### Setup API Key -Get your API key from [Mistral Console](https://console.mistral.ai/): -```bash -export MISTRAL_API_KEY="your-api-key" -``` - -### Usage -```bash -# Interactive mode -codestral-cli - -# Single prompt -codestral-cli "Write a Python function to sort a list" - -# With options -codestral-cli "Explain async Python" --max-tokens 500 -``` - -## 💻 Interactive Experience - -```bash -$ codestral-cli - -🚀 Codestral CLI (Function Calling Mode) -Model: codestral-latest • Tools: 11 available • AI Selection: ON - -👤 You: Can you review my main.py file for security issues? - -🤖 Codestral: I'll analyze your file for security concerns... -[🔧 AI automatically calls: review(file_path="main.py", focus="security")] - -✅ Security Review Complete: -╭─ Code Review Results ─────────────────────────────────────────╮ -│ • No SQL injection vulnerabilities detected │ -│ • Input validation properly implemented │ -│ • Authentication mechanisms secure │ -│ • Recommendation: Consider adding rate limiting │ -╰───────────────────────────────── Tokens: 120 • Time: 2.1s ──╯ - -👤 You: Debug this error: ImportError: No module named 'requests' - -🤖 Codestral: Let me help debug that import error... -[🔧 AI automatically calls: debug(error_message="ImportError: No module named 'requests'")] - -✅ Debug Analysis: -╭─ Error Diagnosis & Solution ──────────────────────────────────╮ -│ Issue: Missing dependency - requests module not installed │ -│ Solution: pip install requests │ -│ Prevention: Add requests to requirements.txt │ -╰───────────────────────────────── Tokens: 85 • Time: 1.5s ───╯ - -👤 You: What's the weather like? - -🤖 Codestral: I don't have access to weather data, but I can help with coding tasks! -Try asking me to review code, debug errors, or explain commands. - -👤 You: exit -👋 Goodbye! -``` - -## 🤖 AI-Powered Function Calling - -Codestral CLI uses **Mistral AI's native function calling** to intelligently select and execute the right tools for your requests. Just speak naturally - the AI automatically chooses what to do! - -### 🎯 How It Works -1. **Natural Language**: "Review my code for bugs" -2. **AI Selection**: Codestral automatically calls `review(file="code.py", focus="bugs")` -3. **Execution**: Tool runs and returns formatted results -4. **Response**: See actionable insights immediately - -### 🛠️ Available Tools (AI Auto-Selected) - -| Tool | Purpose | Example Trigger | -|------|---------|----------------| -| **`analyze`** | Code structure & complexity analysis | "Analyze main.py complexity" | -| **`review`** | Detailed code review & feedback | "Review this file for security issues" | -| **`test`** | Generate comprehensive unit tests | "Generate tests for utils.py" | -| **`docs`** | Create documentation | "Document this function" | -| **`debug`** | Analyze & fix errors | "Debug: ImportError: No module named 'x'" | -| **`explain`** | Explain shell commands | "Explain 'docker run -it ubuntu'" | -| **`suggest`** | Suggest commands for tasks | "How do I deploy to AWS?" | -| **`commit`** | Generate commit messages | "Help me commit these changes" | -| **`search`** | Find code patterns | "Find all database queries" | -| **`git`** | Git workflow help | "Help with git merge conflicts" | - -### 💡 Function Calling vs Manual Commands -```bash -# Old way (still works) -/review main.py --focus security - -# New AI way (preferred) -"Can you review main.py for security issues?" -# → AI automatically calls review(file_path="main.py", focus="security") -``` - -## ⚙️ Configuration - -### Environment Variables -```bash -export MISTRAL_API_KEY="your-key" # Required -export MISTRAL_MODEL="codestral-latest" # Optional -export MISTRAL_MAX_TOKENS=2000 # Optional -``` - -### Config File (`~/.codestral/config.json`) -```json -{ - "api_key": "your-key", - "model": "codestral-latest", - "max_tokens": 2000, - "temperature": 0.1 -} -``` - -## 🔧 Command Line Options - -```bash -codestral-cli [prompt] [options] - -Arguments: - prompt Prompt to send (if not provided, enters interactive mode) - -Options: - --max-tokens INT Maximum tokens in response - --version Show version information - --help Show help message -``` - -## 🆘 Troubleshooting - -### SSL Certificate Issues -If you get SSL certificate errors: -```bash -# Automatic fix -python3 fix_ssl.py - -# Manual fix -pip3 install --upgrade certifi - -# Temporary bypass (not recommended for production) -PYTHONHTTPSVERIFY=0 codestral-cli "test prompt" -``` - -### Common Issues -- **API Key**: Make sure `MISTRAL_API_KEY` is set correctly -- **Dependencies**: Run `pip3 install -r requirements.txt` -- **Permissions**: Run `chmod +x install.sh main.py fix_ssl.py` - -## 📚 Documentation - -Complete documentation available in the [`docs/`](docs/) directory: - -- **[Quick Start Guide](docs/quick-start.md)** - Get up and running in 5 minutes -- **[Commands Reference](docs/commands.md)** - All available commands and tools -- **[Configuration Guide](docs/configuration.md)** - Advanced configuration options -- **[Troubleshooting](docs/troubleshooting.md)** - Solutions for common issues - -## 🎯 Key Differences from Traditional CLIs - -| Traditional CLI | Codestral CLI | -|----------------|---------------| -| Block and wait | ⚡ Stream live responses | -| Plain text output | 🎨 Rich markdown formatting | -| Single request/response | 💬 Conversational context | -| No developer tools | 🛠️ Built-in code tools | -| Basic error handling | 🔧 Comprehensive troubleshooting | - -## 🏗️ Architecture - -- **Async Streaming**: Real-time token-by-token responses using `aiohttp` -- **Rich Terminal UI**: Beautiful formatting with `rich` library -- **Modular Tools**: Extensible developer tool system -- **Smart Error Handling**: SSL troubleshooting and helpful error messages -- **Clean Configuration**: Multiple config methods with priority system - -## 🤝 Contributing - -We welcome contributions! Please see: -- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines -- **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** - Community standards -- **[Issues](https://github.com/momominds/codestral-cli/issues)** - Bug reports and feature requests - -## 📄 License - -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. - -## 🙏 Acknowledgments - -- **[Mistral AI](https://mistral.ai/)** for the excellent Codestral model -- **[Rich](https://github.com/Textualize/rich)** for beautiful terminal UI -- The Python async ecosystem (`aiohttp`, `asyncio`) -- The open-source community for inspiration and feedback - -## 🔗 Links - -- **GitHub Repository**: https://github.com/momominds/codestral-cli -- **Mistral AI**: https://mistral.ai/ -- **Codestral API**: https://docs.mistral.ai/capabilities/code_generation/ -- **Get API Key**: https://console.mistral.ai/ +This project has been **deprecated** and is no longer actively maintained. We recommend users to migrate to alternative solutions. --- -**Built with ❤️ for developers who love beautiful, responsive terminal experiences.** - -# Use with any OpenAI-compatible tool -export OPENAI_API_BASE="http://localhost:8080/v1" -``` - -## 🛠️ Built-in Tools - -The CLI includes powerful developer tools accessible via `/command`: +## 📚 For Historical Reference -- `/explain ` - Explain shell commands -- `/suggest ` - Suggest commands for tasks -- `/review ` - Code review and feedback -- `/analyze ` - Analyze code structure -- `/commit` - Generate git commit messages -- `/debug ` - Help debug errors -- `/test ` - Generate unit tests -- `/docs ` - Generate documentation +If you're interested in the original functionality and documentation of this project, please refer to: -## 📁 Project Structure +**[README.original.md](README.original.md)** - Complete original documentation -``` -codestral-cli/ -├── main.py # CLI entry point -├── codestral_cli/ # Main package -│ ├── core/ # Core functionality -│ │ ├── client.py # API client -│ │ ├── config.py # Configuration -│ │ └── cli.py # CLI interface -│ ├── tools/ # Developer tools -│ ├── ui/ # User interface -│ └── utils/ # Utilities -├── proxy/ # OpenAI-compatible proxy -│ ├── server.py # Async server -│ └── simple_server.py # Simple HTTP server -├── examples/ # Usage examples -└── tests/ # Test suite -``` - -## ⚙️ Configuration - -### Environment Variables -- `MISTRAL_API_KEY` - Your Codestral API key (required) -- `MISTRAL_MODEL` - Model to use (default: codestral-latest) -- `MISTRAL_BASE_URL` - API base URL (default: https://codestral.mistral.ai/v1) - -### Config File -Create `~/.codestral/config.json`: -```json -{ - "model": "codestral-latest", - "max_tokens": 2000, - "temperature": 0.1, - "show_loader": true -} -``` - -## 🔗 Integration Examples - -### With VS Code -```bash -# Start proxy -python3 proxy/server.py & - -# Configure VS Code to use local endpoint -# Settings → OpenAI: Base URL → http://localhost:8080/v1 -``` +--- -### With curl -```bash -curl -X POST http://localhost:8080/v1/chat/completions \ - -H "Content-Type: application/json" \ - -d '{"messages": [{"role": "user", "content": "Write a Python hello world"}]}' -``` +## 🔄 Recommended Alternatives -## 🤝 Contributing +We recommend exploring the following alternatives: -We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. +- **[Mistral AI Official CLI](https://docs.mistral.ai/)** - Official Mistral AI tools +- **[Aider](https://github.com/paul-gauthier/aider)** - AI pair programming in your terminal +- **[GitHub Copilot CLI](https://githubnext.com/projects/copilot-cli)** - GitHub's official CLI tool -## 📝 License +--- -This project is licensed under the MIT License - see [LICENSE](LICENSE) for details. +## ❓ Questions? -## 🙏 Acknowledgments +If you have questions about this deprecation or need assistance migrating, please: -- **Mistral AI** for the excellent Codestral model -- **OpenAI** for the API standard enabling easy integration -- The open-source community for inspiration and tools +- Check the [Issues](https://github.com/developers-nightmare/codestral-cli/issues) page +- Review the [original documentation](README.original.md) --- -**Built for developers, by developers** ❤️ +**Thank you to everyone who used and contributed to this project! 🙏** diff --git a/README.original.md b/README.original.md new file mode 100644 index 0000000..cd93625 --- /dev/null +++ b/README.original.md @@ -0,0 +1,321 @@ +# 🤖 Codestral CLI + +A modern GitHub Copilot-style terminal interface for **Codestral** - Mistral's code generation AI. Real-time streaming responses with beautiful terminal UI and powerful developer tools. + +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/) +[![Codestral](https://img.shields.io/badge/AI-Codestral-purple.svg)](https://codestral.mistral.ai/) + +## ✨ Features + +- 💬 **Interactive Chat** - GitHub Copilot-like terminal experience +- ⚡ **Real-time Streaming** - See responses as they generate, token by token +- 🎨 **Rich Terminal UI** - Beautiful formatting with live updates and markdown support +- 🤖 **AI Function Calling** - Native Mistral function calling with automatic tool selection +- 🛠️ **Smart Developer Tools** - AI-powered code review, debugging, analysis with 11+ tools +- 🚀 **Async Architecture** - Non-blocking, responsive interface +- 🔧 **Easy Setup** - One-command installation with automatic SSL handling + +## 🚀 Quick Start + +### Installation +```bash +git clone https://github.com/momominds/codestral-cli.git +cd codestral-cli +./install.sh +``` + +### Setup API Key +Get your API key from [Mistral Console](https://console.mistral.ai/): +```bash +export MISTRAL_API_KEY="your-api-key" +``` + +### Usage +```bash +# Interactive mode +codestral-cli + +# Single prompt +codestral-cli "Write a Python function to sort a list" + +# With options +codestral-cli "Explain async Python" --max-tokens 500 +``` + +## 💻 Interactive Experience + +```bash +$ codestral-cli + +🚀 Codestral CLI (Function Calling Mode) +Model: codestral-latest • Tools: 11 available • AI Selection: ON + +👤 You: Can you review my main.py file for security issues? + +🤖 Codestral: I'll analyze your file for security concerns... +[🔧 AI automatically calls: review(file_path="main.py", focus="security")] + +✅ Security Review Complete: +╭─ Code Review Results ─────────────────────────────────────────╮ +│ • No SQL injection vulnerabilities detected │ +│ • Input validation properly implemented │ +│ • Authentication mechanisms secure │ +│ • Recommendation: Consider adding rate limiting │ +╰───────────────────────────────── Tokens: 120 • Time: 2.1s ──╯ + +👤 You: Debug this error: ImportError: No module named 'requests' + +🤖 Codestral: Let me help debug that import error... +[🔧 AI automatically calls: debug(error_message="ImportError: No module named 'requests'")] + +✅ Debug Analysis: +╭─ Error Diagnosis & Solution ──────────────────────────────────╮ +│ Issue: Missing dependency - requests module not installed │ +│ Solution: pip install requests │ +│ Prevention: Add requests to requirements.txt │ +╰───────────────────────────────── Tokens: 85 • Time: 1.5s ───╯ + +👤 You: What's the weather like? + +🤖 Codestral: I don't have access to weather data, but I can help with coding tasks! +Try asking me to review code, debug errors, or explain commands. + +👤 You: exit +👋 Goodbye! +``` + +## 🤖 AI-Powered Function Calling + +Codestral CLI uses **Mistral AI's native function calling** to intelligently select and execute the right tools for your requests. Just speak naturally - the AI automatically chooses what to do! + +### 🎯 How It Works +1. **Natural Language**: "Review my code for bugs" +2. **AI Selection**: Codestral automatically calls `review(file="code.py", focus="bugs")` +3. **Execution**: Tool runs and returns formatted results +4. **Response**: See actionable insights immediately + +### 🛠️ Available Tools (AI Auto-Selected) + +| Tool | Purpose | Example Trigger | +|------|---------|----------------| +| **`analyze`** | Code structure & complexity analysis | "Analyze main.py complexity" | +| **`review`** | Detailed code review & feedback | "Review this file for security issues" | +| **`test`** | Generate comprehensive unit tests | "Generate tests for utils.py" | +| **`docs`** | Create documentation | "Document this function" | +| **`debug`** | Analyze & fix errors | "Debug: ImportError: No module named 'x'" | +| **`explain`** | Explain shell commands | "Explain 'docker run -it ubuntu'" | +| **`suggest`** | Suggest commands for tasks | "How do I deploy to AWS?" | +| **`commit`** | Generate commit messages | "Help me commit these changes" | +| **`search`** | Find code patterns | "Find all database queries" | +| **`git`** | Git workflow help | "Help with git merge conflicts" | + +### 💡 Function Calling vs Manual Commands +```bash +# Old way (still works) +/review main.py --focus security + +# New AI way (preferred) +"Can you review main.py for security issues?" +# → AI automatically calls review(file_path="main.py", focus="security") +``` + +## ⚙️ Configuration + +### Environment Variables +```bash +export MISTRAL_API_KEY="your-key" # Required +export MISTRAL_MODEL="codestral-latest" # Optional +export MISTRAL_MAX_TOKENS=2000 # Optional +``` + +### Config File (`~/.codestral/config.json`) +```json +{ + "api_key": "your-key", + "model": "codestral-latest", + "max_tokens": 2000, + "temperature": 0.1 +} +``` + +## 🔧 Command Line Options + +```bash +codestral-cli [prompt] [options] + +Arguments: + prompt Prompt to send (if not provided, enters interactive mode) + +Options: + --max-tokens INT Maximum tokens in response + --version Show version information + --help Show help message +``` + +## 🆘 Troubleshooting + +### SSL Certificate Issues +If you get SSL certificate errors: +```bash +# Automatic fix +python3 fix_ssl.py + +# Manual fix +pip3 install --upgrade certifi + +# Temporary bypass (not recommended for production) +PYTHONHTTPSVERIFY=0 codestral-cli "test prompt" +``` + +### Common Issues +- **API Key**: Make sure `MISTRAL_API_KEY` is set correctly +- **Dependencies**: Run `pip3 install -r requirements.txt` +- **Permissions**: Run `chmod +x install.sh main.py fix_ssl.py` + +## 📚 Documentation + +Complete documentation available in the [`docs/`](docs/) directory: + +- **[Quick Start Guide](docs/quick-start.md)** - Get up and running in 5 minutes +- **[Commands Reference](docs/commands.md)** - All available commands and tools +- **[Configuration Guide](docs/configuration.md)** - Advanced configuration options +- **[Troubleshooting](docs/troubleshooting.md)** - Solutions for common issues + +## 🎯 Key Differences from Traditional CLIs + +| Traditional CLI | Codestral CLI | +|----------------|---------------| +| Block and wait | ⚡ Stream live responses | +| Plain text output | 🎨 Rich markdown formatting | +| Single request/response | 💬 Conversational context | +| No developer tools | 🛠️ Built-in code tools | +| Basic error handling | 🔧 Comprehensive troubleshooting | + +## 🏗️ Architecture + +- **Async Streaming**: Real-time token-by-token responses using `aiohttp` +- **Rich Terminal UI**: Beautiful formatting with `rich` library +- **Modular Tools**: Extensible developer tool system +- **Smart Error Handling**: SSL troubleshooting and helpful error messages +- **Clean Configuration**: Multiple config methods with priority system + +## 🤝 Contributing + +We welcome contributions! Please see: +- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines +- **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** - Community standards +- **[Issues](https://github.com/momominds/codestral-cli/issues)** - Bug reports and feature requests + +## 📄 License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## 🙏 Acknowledgments + +- **[Mistral AI](https://mistral.ai/)** for the excellent Codestral model +- **[Rich](https://github.com/Textualize/rich)** for beautiful terminal UI +- The Python async ecosystem (`aiohttp`, `asyncio`) +- The open-source community for inspiration and feedback + +## 🔗 Links + +- **GitHub Repository**: https://github.com/momominds/codestral-cli +- **Mistral AI**: https://mistral.ai/ +- **Codestral API**: https://docs.mistral.ai/capabilities/code_generation/ +- **Get API Key**: https://console.mistral.ai/ + +--- + +**Built with ❤️ for developers who love beautiful, responsive terminal experiences.** + +# Use with any OpenAI-compatible tool +export OPENAI_API_BASE="http://localhost:8080/v1" +``` + +## 🛠️ Built-in Tools + +The CLI includes powerful developer tools accessible via `/command`: + +- `/explain ` - Explain shell commands +- `/suggest ` - Suggest commands for tasks +- `/review ` - Code review and feedback +- `/analyze ` - Analyze code structure +- `/commit` - Generate git commit messages +- `/debug ` - Help debug errors +- `/test ` - Generate unit tests +- `/docs ` - Generate documentation + +## 📁 Project Structure + +``` +codestral-cli/ +├── main.py # CLI entry point +├── codestral_cli/ # Main package +│ ├── core/ # Core functionality +│ │ ├── client.py # API client +│ │ ├── config.py # Configuration +│ │ └── cli.py # CLI interface +│ ├── tools/ # Developer tools +│ ├── ui/ # User interface +│ └── utils/ # Utilities +├── proxy/ # OpenAI-compatible proxy +│ ├── server.py # Async server +│ └── simple_server.py # Simple HTTP server +├── examples/ # Usage examples +└── tests/ # Test suite +``` + +## ⚙️ Configuration + +### Environment Variables +- `MISTRAL_API_KEY` - Your Codestral API key (required) +- `MISTRAL_MODEL` - Model to use (default: codestral-latest) +- `MISTRAL_BASE_URL` - API base URL (default: https://codestral.mistral.ai/v1) + +### Config File +Create `~/.codestral/config.json`: +```json +{ + "model": "codestral-latest", + "max_tokens": 2000, + "temperature": 0.1, + "show_loader": true +} +``` + +## 🔗 Integration Examples + +### With VS Code +```bash +# Start proxy +python3 proxy/server.py & + +# Configure VS Code to use local endpoint +# Settings → OpenAI: Base URL → http://localhost:8080/v1 +``` + +### With curl +```bash +curl -X POST http://localhost:8080/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{"messages": [{"role": "user", "content": "Write a Python hello world"}]}' +``` + +## 🤝 Contributing + +We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. + +## 📝 License + +This project is licensed under the MIT License - see [LICENSE](LICENSE) for details. + +## 🙏 Acknowledgments + +- **Mistral AI** for the excellent Codestral model +- **OpenAI** for the API standard enabling easy integration +- The open-source community for inspiration and tools + +--- + +**Built for developers, by developers** ❤️