atles / docs /guides /README_Code_Studio.md
spartan8806's picture
ATLES codebase - Source code only
99b8067
# 💻 ATLES Code Studio - VS Code-like Development Environment
**A professional, AI-powered development environment built with PyQt6**
## 🌟 **Overview**
ATLES Code Studio transforms your ATLES AI assistant into a full-featured development environment, combining the power of VS Code's interface with intelligent AI assistance for coding, debugging, and project management.
## ✨ **Key Features**
### **🎨 VS Code-like Interface**
- **Professional dark theme** with VS Code styling
- **Multi-panel layout**: File explorer, editor area, AI assistant
- **Familiar shortcuts** and menu structure
- **Responsive design** with resizable panels
### **📁 File Explorer & Project Management**
- **Tree view file explorer** with folder navigation
- **Project workspace** support
- **File type icons** and syntax detection
- **Quick file operations** (open, create, delete)
- **Real-time file watching** for external changes
### **📝 Advanced Code Editor**
- **Multi-tab editing** with unlimited tabs
- **Syntax highlighting** for 20+ programming languages
- **Code folding** and line numbers
- **Auto-indentation** and smart brackets
- **Find & replace** with regex support
- **Undo/redo** with full history
### **🖥️ Integrated Terminal**
- **Built-in terminal** with full shell access
- **Command execution** and output capture
- **Working directory** sync with current project
- **Resizable terminal panel**
- **Cross-platform** support (Windows/Linux/macOS)
### **🤖 AI Code Assistant (Self-Aware & Advanced)**
- **🧠 Self-aware AI** - Reads its own source code for better context
- **Real-time code help** and explanations
- **⚡ Direct code insertion** - AI can write code directly to your editor
- **🔒 Safety controls** - Manual mode by default, direct insertion on request
- **Code optimization** suggestions with architectural understanding
- **Debugging assistance** and error analysis
- **Code generation** from natural language
- **Context-aware responses** based on current code AND AI's own implementation
- **Multiple AI models** (qwen2.5-coder, llama3.2, etc.)
- **Self-analysis capabilities** - AI can explain its own workings
### **⚡ Developer Productivity**
- **Quick actions**: Explain, optimize, debug code
- **Keyboard shortcuts** for all major functions
- **Auto-save** and session restoration
- **Project templates** and scaffolding
- **Git integration** (planned)
- **Extension system** (planned)
## 🚀 **Getting Started**
### **Quick Launch**
```powershell
# Option 1: Use main launcher
.\run_desktop.bat
# Choose option 2 for Code Studio
# Option 2: Direct launch
.\run_code_studio.bat
# Option 3: Manual launch
python atles_code_studio.py
```
### **First Time Setup**
1. **Launch the application** using any method above
2. **Open a project folder**: File → Open Folder (Ctrl+Shift+O)
3. **Start coding**: Create new files or open existing ones
4. **Enable AI assistant**: Ask questions in the right panel
5. **Use the terminal**: Toggle with Ctrl+` for command line access
## 📋 **System Requirements**
### **Core Requirements**
```bash
# Essential dependencies
PyQt6>=6.4.0 # GUI framework
psutil>=5.9.0 # System monitoring
pywin32>=306 # Windows integration (Windows only)
```
### **Enhanced Features**
```bash
# Syntax highlighting
pygments>=2.14.0 # Code syntax highlighting
# Code formatting
black>=23.0.0 # Python code formatter
flake8>=6.0.0 # Code linting
autopep8>=2.0.0 # Auto code formatting
# Git integration
GitPython>=3.1.0 # Git operations
# File monitoring
watchdog>=3.0.0 # Auto-reload on file changes
```
### **Installation**
```bash
# Install all dependencies
pip install -r code_studio_requirements.txt
# Or install manually
pip install PyQt6 psutil pywin32 pygments black flake8
```
## 🎮 **User Interface Guide**
### **Layout Overview**
```
┌─────────────────────────────────────────────────────────────────────┐
│ File Edit View AI [- □ ×] │
├─────────────────────────────────────────────────────────────────────┤
│ 📁 Explorer │ Editor Tabs │ 🤖 AI Assistant │
│ │ ┌─────┬─────┬─────┬─────┐ │ │
│ 📂 Project │ │file1│file2│file3│ + │ │ Ask AI about │
│ └📄 file1.py │ └─────┴─────┴─────┴─────┘ │ your code... │
│ └📄 file2.js │ │ │
│ └📄 README.md │ ┌─────────────────────────────┐ │ [Explain Code] │
│ │ │ │ │ [Optimize] │
│ 🔍 Search │ │ Code Editor Area │ │ [Debug Help] │
│ 🔧 Extensions │ │ │ │ │
│ │ │ 1 def hello_world(): │ │ Recent: │
│ │ │ 2 print("Hello!") │ │ • Explained │
│ │ │ 3 │ │ function │
│ │ └─────────────────────────────┘ │ • Fixed bug │
│ │ │ in line 42 │
│ ├─────────────────────────────────────┤ │
│ │ 🖥️ Terminal │ │
│ │ $ python file1.py │ │
│ │ Hello! │ │
│ │ $ _ │ │
├─────────────────────────────────────────────────────────────────────┤
│ Ln 2, Col 8 │ Python │ UTF-8 │ ✓ Saved │ 🔗 Git: main │ 🟢 Ready │
└─────────────────────────────────────────────────────────────────────┘
```
### **File Explorer Panel**
- **📁 Folder icons** for directories
- **📄 File icons** based on file type (🐍 .py, 📜 .js, 🌐 .html, etc.)
- **Double-click** to open files
- **Right-click** for context menu (planned)
- **Drag & drop** support (planned)
### **Editor Area**
- **Tabbed interface** for multiple files
- **Syntax highlighting** with language detection
- **Line numbers** and code folding
- **Modified indicator** (● for unsaved changes)
- **Close buttons** on each tab
### **AI Assistant Panel**
- **Chat interface** for code questions
- **Quick action buttons** for common tasks
- **Context awareness** of current code
- **Model selection** for different AI capabilities
- **History** of previous interactions
### **Terminal Panel**
- **Full shell access** with command execution
- **Resizable** and collapsible
- **Working directory** synced with project
- **Output capture** and scrollback history
## ⌨️ **Keyboard Shortcuts**
### **File Operations**
| Shortcut | Action |
|----------|--------|
| `Ctrl+N` | New File |
| `Ctrl+O` | Open File |
| `Ctrl+Shift+O` | Open Folder |
| `Ctrl+S` | Save File |
| `Ctrl+Shift+S` | Save As |
| `Ctrl+W` | Close Tab |
### **Editor Navigation**
| Shortcut | Action |
|----------|--------|
| `Ctrl+PageUp` | Previous Tab |
| `Ctrl+PageDown` | Next Tab |
| `Ctrl+Z` | Undo |
| `Ctrl+Y` | Redo |
| `Ctrl+F` | Find |
| `Ctrl+H` | Replace |
### **View & Panels**
| Shortcut | Action |
|----------|--------|
| `Ctrl+`` | Toggle Terminal |
| `Ctrl+Shift+E` | Focus Explorer |
| `F11` | Toggle Fullscreen |
### **AI Assistant**
| Shortcut | Action |
|----------|--------|
| `Ctrl+Shift+E` | Explain Code |
| `Ctrl+Shift+O` | Optimize Code |
| `Ctrl+Shift+D` | Debug Help |
## 🗣️ **AI Command Reference**
### **🧠 Self-Awareness Commands**
| Command | Result |
|---------|--------|
| `"analyze yourself"` | AI explains its own architecture and components |
| `"read your code"` | AI shows how it's implemented internally |
| `"how do you work?"` | AI explains its internal workings and design |
| `"explain yourself"` | AI gives a comprehensive tour of its codebase |
| `"show your code structure"` | AI describes its file organization and patterns |
### **⚡ Direct Code Insertion Commands**
| Command Pattern | Mode | Result |
|----------------|------|--------|
| `"make a [thing]"` | 🔒 Safe | Generates code with copy/paste instructions |
| `"create a [thing]"` | 🔒 Safe | Generates code with manual insertion |
| `"insert a [thing]"` | 🚀 Direct | Automatically inserts code into editor |
| `"add to editor: [description]"` | 🚀 Direct | Writes code directly to current file |
| `"put in file: [description]"` | 🚀 Direct | Places code in active editor tab |
| `"write to file: [description]"` | 🚀 Direct | Generates and inserts code automatically |
### **📝 Code Analysis Commands**
| Command | Purpose |
|---------|---------|
| `"explain this code"` | Detailed explanation of selected/current code |
| `"optimize this function"` | Performance and efficiency suggestions |
| `"debug this code"` | Error detection and debugging help |
| `"review this code"` | Code quality and best practices analysis |
| `"document this function"` | Generate documentation for code |
| `"test this function"` | Create unit tests for the code |
### **🎯 Smart Context Commands**
| Command | AI Behavior |
|---------|-------------|
| `"what can you do?"` | Lists capabilities based on self-knowledge |
| `"help me with [language]"` | Language-specific assistance |
| `"show me examples"` | Provides examples using its own implementation |
| `"best practices for [topic]"` | Recommendations based on AI's architecture |
## 🤖 **AI Integration Features**
### **🧠 Self-Aware AI Capabilities**
- **Self-analysis**: Ask "analyze yourself" to see AI's architecture
- **Code introspection**: AI reads its own source for better context
- **Implementation explanations**: "How do you work?" reveals internal workings
- **Architecture understanding**: AI knows its own components and design patterns
- **Smart suggestions**: Uses self-knowledge for better recommendations
### **⚡ Direct Code Insertion Modes**
#### **🔒 Safe Mode (Default)**
- **Manual control**: AI generates code with copy/paste instructions
- **Review before insertion**: You decide what gets added
- **Zero risk**: No accidental file modifications
- **Example**: `"Make a hello world program"` → Copy/paste instructions
#### **🚀 Direct Insertion Mode**
- **Automatic insertion**: AI writes code directly to your editor
- **Triggered by keywords**: "insert", "add to editor", "put in file", "write to file"
- **Smart placement**: Replaces welcome text or inserts at cursor
- **Example**: `"Insert a hello world program"` → Code appears in editor instantly
### **Code Explanation**
- **Select code** and ask "Explain this function"
- **Get detailed explanations** of algorithms and logic
- **Understand complex code** written by others
- **Learn new programming concepts**
- **AI references its own implementation** for better examples
### **Code Optimization**
- **Performance improvements** suggestions
- **Memory usage** optimization
- **Algorithm efficiency** recommendations
- **Best practices** enforcement
- **Architectural insights** from AI's self-knowledge
### **Debugging Assistance**
- **Error analysis** and solutions
- **Bug detection** in code logic
- **Testing strategies** recommendations
- **Code review** and quality checks
- **AI debugging techniques** from its own codebase
### **Code Generation**
- **Natural language to code** conversion
- **Function scaffolding** from descriptions
- **Documentation generation**
- **Unit test creation**
- **Design pattern implementation** based on AI's architecture
## 🔧 **Advanced Configuration**
### **Themes & Appearance**
```python
# Custom theme configuration (planned)
{
"theme": "dark",
"font_family": "Consolas",
"font_size": 11,
"line_numbers": true,
"word_wrap": false
}
```
### **AI Model Selection**
```python
# Available AI models
models = [
"qwen2.5-coder:latest", # Best for coding
"llama3.2:latest", # General purpose
"qwen2.5:latest", # Balanced performance
"llava:latest" # Vision capabilities
]
```
### **Language Support**
- **Python** 🐍 - Full support with linting
- **JavaScript/TypeScript** 📜 - Syntax highlighting
- **HTML/CSS** 🌐 - Web development
- **C/C++** ⚙️ - Systems programming
- **Java** ☕ - Enterprise development
- **Go** 🐹 - Modern systems language
- **Rust** 🦀 - Memory-safe systems
- **PHP** 🐘 - Web backend
- **Ruby** 💎 - Dynamic scripting
- **Shell/Bash** 🐚 - System administration
- **SQL** 🗃️ - Database queries
- **JSON/YAML** 📋 - Configuration files
- **Markdown** 📝 - Documentation
## 🚀 **Performance & Optimization**
### **System Resources**
- **Memory Usage**: 200-400MB (depending on project size)
- **CPU Usage**: <5% during normal editing
- **Startup Time**: 2-4 seconds
- **File Loading**: Instant for files <10MB
### **Scalability**
- **Large Projects**: Handles 1000+ files efficiently
- **Multiple Tabs**: No limit on open files
- **Real-time Monitoring**: Minimal performance impact
- **AI Responses**: 1-3 seconds average
## 🔮 **Planned Features**
### **Version Control**
- **Git integration** with visual diff
- **Branch management** and merging
- **Commit history** and blame view
- **Pull request** integration
### **Extensions & Plugins**
- **Plugin system** for custom functionality
- **Language servers** for advanced IntelliSense
- **Custom themes** and color schemes
- **Third-party integrations**
### **Collaboration**
- **Real-time collaboration** (like VS Code Live Share)
- **Code sharing** and snippets
- **Team workspaces**
- **Integrated chat**
### **Advanced AI Features**
- **Code completion** with AI suggestions
- **Refactoring assistance**
- **Architecture recommendations**
- **Security vulnerability** detection
## 🆚 **Comparison with Other IDEs**
### **ATLES Code Studio vs VS Code**
| Feature | ATLES Code Studio | VS Code |
|---------|------------------|---------|
| **🧠 Self-Aware AI** | ✅ AI reads its own code | ❌ No self-awareness |
| **⚡ Direct Code Insertion** | ✅ AI writes code directly | ❌ Manual copy/paste only |
| **AI Integration** | ✅ Built-in, context-aware | ❌ Extension required |
| **Offline Operation** | ✅ Fully offline | ⚠️ Some features need internet |
| **Setup Complexity** | ✅ One-click install | ⚠️ Extensions needed |
| **Performance** | ✅ Native Python/Qt | ⚠️ Electron overhead |
| **Customization** | ⚠️ Limited (growing) | ✅ Extensive |
| **Extension Ecosystem** | ❌ Not yet | ✅ Massive |
### **ATLES Code Studio vs PyCharm**
| Feature | ATLES Code Studio | PyCharm |
|---------|------------------|---------|
| **🧠 Self-Aware AI** | ✅ AI understands itself | ❌ No self-awareness |
| **⚡ Direct Code Insertion** | ✅ AI writes code directly | ❌ Manual insertion only |
| **AI Assistant** | ✅ Integrated & context-aware | ⚠️ Separate service |
| **Resource Usage** | ✅ Lightweight | ❌ Heavy |
| **Startup Time** | ✅ Fast (2-4s) | ❌ Slow (10-30s) |
| **Multi-language** | ✅ 20+ languages | ⚠️ Python-focused |
| **Price** | ✅ Free | ❌ Paid (Professional) |
| **Advanced Features** | ⚠️ Growing | ✅ Comprehensive |
## 🛠️ **Troubleshooting**
### **Common Issues**
#### **Application Won't Start**
```bash
# Check Python version
python --version # Should be 3.8+
# Check PyQt installation
python -c "import PyQt6; print('PyQt6 OK')"
# Install missing dependencies
pip install -r code_studio_requirements.txt
```
#### **Syntax Highlighting Not Working**
```bash
# Install pygments
pip install pygments
# Restart the application
```
#### **AI Assistant Not Responding**
```bash
# Check ATLES installation
python -c "from atles.ollama_client_enhanced import OllamaFunctionCaller; print('ATLES OK')"
# Check Ollama service
ollama list
# Restart Ollama
ollama serve
```
#### **Terminal Not Working**
- **Windows**: Ensure `cmd.exe` is available in PATH
- **Linux/macOS**: Ensure `/bin/bash` exists
- **Permissions**: Check terminal execution permissions
### **Performance Issues**
- **Large files**: Files >50MB may be slow to load
- **Many tabs**: Consider closing unused tabs
- **Memory usage**: Restart application if memory >1GB
- **AI responses**: Check Ollama service status
## 📞 **Support & Community**
### **Getting Help**
1. **Check documentation** - This README and inline help
2. **Use AI assistant** - Ask questions directly in the app
3. **Check console output** - Look for error messages
4. **Restart application** - Often fixes temporary issues
### **Feature Requests**
- Use the AI assistant to suggest improvements
- Document your workflow needs
- Contribute to the codebase
### **Contributing**
- **Code contributions** welcome
- **Theme development**
- **Language support** additions
- **Documentation** improvements
---
## 🎉 **Conclusion**
ATLES Code Studio brings together the best of modern IDE design with powerful AI assistance, creating a development environment that's both familiar and innovative. Whether you're a beginner learning to code or an experienced developer working on complex projects, the AI-powered features help you write better code faster.
**Start coding smarter with ATLES Code Studio!** 🚀
---
*Last Updated: December 2024*
*Version: 1.1.0 - Self-Aware AI Edition*
*Status: ✅ READY FOR USE - Now with Self-Aware AI & Direct Code Insertion!*