foxus/README.md

151 lines
4.1 KiB
Markdown

# Foxus - Local-First AI Coding Assistant
A privacy-focused, fully offline coding assistant that provides AI-powered code completion, refactoring, bug fixing, and code explanation using locally running language models.
## Features
- 🔒 **Fully Local & Private**: No internet connection required, all data stays on your machine
- 🧠 **AI-Powered Assistance**: Code completion, refactoring, bug fixing, and explanation
- 🌐 **Multi-Language Support**: Python, JavaScript, TypeScript, Go, Java, Rust, and more
- 💻 **Cross-Platform**: Windows, Linux, and macOS support
- ⌨️ **Keyboard Shortcuts**: Quick AI commands (`/explain`, `/refactor`, `/fix`, etc.)
- 📁 **Project Context**: Multi-file analysis and understanding
- 🎨 **Modern UI**: Clean, responsive interface built with React and Tauri
## Architecture
```
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Tauri + React │◄──►│ FastAPI Server │◄──►│ Ollama/LLM │
│ (Frontend) │ │ (Backend) │ │ (Local Models) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
```
### Technology Stack
- **Frontend**: Tauri + React + TypeScript + Monaco Editor
- **Backend**: FastAPI (Python) + uvicorn
- **LLM Runtime**: Ollama
- **Models**: CodeLlama, Deepseek-Coder, StarCoder
- **Styling**: Tailwind CSS
- **State Management**: Zustand
## Quick Start
### Prerequisites
- Node.js (v18+)
- Python (3.9+)
- Rust (for Tauri)
- Ollama
### Installation
1. **Clone and setup the project**:
```bash
git clone <repository>
cd foxus
```
2. **Install dependencies**:
```bash
# Install frontend dependencies
cd frontend
npm install
cd ..
# Install backend dependencies
cd backend
pip install -r requirements.txt
cd ..
```
3. **Install and start Ollama**:
```bash
# Install Ollama (Linux/macOS)
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a coding model
ollama pull codellama:7b-code
```
4. **Start the application**:
```bash
# Terminal 1: Start backend
cd backend
python main.py
# Terminal 2: Start frontend
cd frontend
npm run tauri dev
```
## Project Structure
```
foxus/
├── frontend/ # Tauri + React application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── services/ # API services
│ │ ├── hooks/ # Custom React hooks
│ │ ├── stores/ # State management
│ │ └── utils/ # Utility functions
│ ├── src-tauri/ # Tauri backend (Rust)
│ └── package.json
├── backend/ # FastAPI server
│ ├── app/
│ │ ├── api/ # API routes
│ │ ├── core/ # Core functionality
│ │ ├── models/ # Pydantic models
│ │ └── services/ # Business logic
│ ├── main.py
│ └── requirements.txt
├── docs/ # Documentation
└── README.md
```
## Usage
### AI Commands
- `/explain` - Explain selected code
- `/refactor` - Suggest refactoring improvements
- `/fix` - Fix bugs in selected code
- `/complete` - Auto-complete code
- `/comment` - Add comments to code
- `/test` - Generate unit tests
### Keyboard Shortcuts
- `Ctrl+K` (or `Cmd+K`) - Open AI command palette
- `Ctrl+Shift+E` - Explain code
- `Ctrl+Shift+R` - Refactor code
- `Ctrl+Shift+F` - Fix code
## Development
### Adding New AI Commands
1. Add command to `backend/app/api/ai.py`
2. Update frontend command palette in `frontend/src/components/CommandPalette.tsx`
3. Add keyboard shortcut in `frontend/src/hooks/useKeyboardShortcuts.ts`
### Supported Models
- CodeLlama (7B, 13B, 34B)
- Deepseek-Coder (1.3B, 6.7B, 33B)
- StarCoder (1B, 3B, 7B, 15B)
- CodeT5+ (220M, 770M, 2B, 6B)
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request
## License
MIT License - see LICENSE file for details.