Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 262 additions & 0 deletions App/BUILD_SCRIPTS_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# Pointer Build & Setup Scripts

Umfassende Build- und Setup-Skripte mit erweiterten Fehlerbehandlung, Debugging und automatischer Problemlösung.

## 📋 Verfügbare Scripts

### Windows
- **`build.bat`** - Batch-Script für Windows (cmd.exe)
- **`build.ps1`** - PowerShell-Script für Windows (PowerShell 5.0+)

### macOS & Linux
- **`build.sh`** - Bash-Script für macOS und Linux

## 🚀 Quick Start

### Windows (Command Prompt)
```bash
build.bat
```

### Windows (PowerShell)
```powershell
.\build.ps1
```

### macOS / Linux
```bash
chmod +x build.sh
./build.sh
```

## 📝 Optionen

Alle Scripts unterstützen die gleichen Optionen:

| Option | Kurz | Beschreibung |
|--------|------|-------------|
| `--skip-checks` | `-s` | Überspringe Voraussetzungsprüfung (schneller) |
| `--debug` | `-d` | Aktiviere Debug-Modus (verbose Output) |
| `--background` | `-b` | Starte Komponenten im Hintergrund |
| `--clean` | `-c` | Saubere Installation (lösche node_modules) |
| `--help` | `-h` | Zeige Hilfe an |

## 💡 Beispiele

### Schnelle Installation ohne Checks
```bash
# Windows (CMD)
build.bat --skip-checks

# Windows (PowerShell)
.\build.ps1 -SkipChecks

# macOS/Linux
./build.sh --skip-checks
```

### Saubere Installation mit Debug
```bash
# Windows (CMD)
build.bat --clean --debug

# Windows (PowerShell)
.\build.ps1 -CleanInstall -Debug

# macOS/Linux
./build.sh --clean --debug
```

### Installation mit allen Checks
```bash
# Windows (CMD)
build.bat

# macOS/Linux
./build.sh
```

## ✨ Features

### 🔍 Automatische Voraussetzungsprüfung
- ✓ Node.js Verfügbarkeit prüfen
- ✓ Yarn/npm Verfügbarkeit prüfen
- ✓ Python Verfügbarkeit prüfen
- ✓ Git (optional) prüfen
- ✓ Port-Konflikte erkennen

### 🛡️ Fehlerbehandlung
- ✓ Automatische Alternativen bei Fehlern
- ✓ Detaillierte Error-Messages
- ✓ Exit-Codes für Scripting
- ✓ Graceful Degradation

### 🐛 Debug & Logging
- ✓ Farbcodierte Output
- ✓ Timestamps bei allen Logs
- ✓ Debug-Modus mit `-d`/`--debug`
- ✓ Schritt-für-Schritt Fortschritt

### 🔧 Plattformspezifische Unterstützung
- ✓ Windows-spezifische Requirements
- ✓ macOS-spezifische Requirements
- ✓ Linux-spezifische Requirements
- ✓ Automatische OS-Erkennung

### 📦 Intelligente Installation
- ✓ Prüfung auf existierende Installation
- ✓ Yarn-Fallback zu npm
- ✓ Python3/Python Fallback
- ✓ Saubere Installation mit `--clean`

## 🔄 Was wird installiert?

### Frontend
```
Frontend-Abhängigkeiten (via yarn/npm)
├─ React & TypeScript
├─ Vite Build-Tool
├─ Monaco Editor
├─ Electron
└─ Weitere UI-Komponenten
```

### Backend
```
Backend-Abhängigkeiten (via pip)
├─ FastAPI
├─ Python Dependencies (OS-spezifisch)
├─ spaCy NLP Models
└─ Weitere Backend-Tools
```

### Umgebung
```
Konfiguration
├─ .env File (falls nicht vorhanden)
└─ Environment Variables
```

## 📊 Script-Ablauf

```
1. Parse Arguments
2. Check Prerequisites
3. Check Ports
4. Setup Frontend (yarn/npm install)
5. Setup Backend (pip install)
6. Setup Environment (.env)
7. Summary & Troubleshooting
8. Optional: Starte Anwendung
```

## 🆘 Troubleshooting

### Problem: "Node.js nicht gefunden"
```bash
# Installiere Node.js von https://nodejs.org/
# Dann versuche erneut:
build.bat
```

### Problem: "Port 23816 bereits in Verwendung"
```bash
# Windows: Finde Prozess und beende ihn
netstat -an | findstr :23816
taskkill /PID <PID> /F

# macOS/Linux:
lsof -i :23816
kill -9 <PID>
```

### Problem: "Python-Abhängigkeiten fehlgeschlagen"
```bash
# Erstelle virtuelle Umgebung
python -m venv venv

# Aktiviere sie
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# Versuche Installation erneut
build.bat --clean
```

### Problem: "yarn: command not found"
Das Script fällt automatisch zu npm zurück. Alternativ installiere Yarn:
```bash
npm install -g yarn
```

## 🎯 Start nach Installation

Nach erfolgreicher Installation hast du mehrere Optionen:

### Option 1: Entwicklungsmodus (empfohlen)
```bash
yarn dev
```
Startet Frontend, Backend und optional Electron zusammen.

### Option 2: Produktionsmodus
```bash
node start-pointer.js
```

### Option 3: Komponenten separat
```bash
# Terminal 1: Backend
cd backend
python run.py

# Terminal 2: Frontend
yarn start

# Terminal 3: Electron (optional)
yarn electron:dev
```

## 🔐 Environment Variablen

Das Script erstellt eine `.env` Datei mit Standard-Konfiguration:

```env
# Backend API URL
VITE_API_URL=http://localhost:23816

# Development Server Port
VITE_DEV_SERVER_PORT=3000

# Debug Mode
DEBUG=false

# Optional: OpenAI API Key
# OPENAI_API_KEY=your_key_here
```

Passe diese nach Bedarf an.

## 📈 Performance-Tipps

- **`--skip-checks`** für schnellere Startups wenn alles okay ist
- Verwende **`--clean`** nur bei ernsthaften Problemen
- Aktiviere **`--debug`** zur Fehlersuche
- Nutze separate Terminals für jede Komponente beim Debugging

## 🆓 Kostenlos & Open Source

Diese Scripts sind Teil des Pointer Projekts und unter MIT License verfügbar.

## 📞 Support

Bei Problemen:
1. Versuche `./build.sh --clean --debug`
2. Prüfe die Troubleshooting-Sektion
3. Öffne einen Issue im Repository

---

**Viel Spaß mit Pointer! 🚀**
110 changes: 108 additions & 2 deletions App/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ A modern, AI-powered code editor built with Electron, React, TypeScript, and Pyt

![Pointer Editor](https://img.shields.io/badge/Electron-App-blue) ![Python](https://img.shields.io/badge/Python-Backend-green) ![React](https://img.shields.io/badge/React-Frontend-blue) ![TypeScript](https://img.shields.io/badge/TypeScript-Typed-blue)

> **⚠️ Latest Updates:** Settings loading fixed with improved error handling | New comprehensive build scripts added | Enhanced proxy configuration for API endpoints

## ✨ Features

### 🎨 **Professional Interface**
Expand Down Expand Up @@ -93,14 +95,118 @@ A modern, AI-powered code editor built with Electron, React, TypeScript, and Pyt

6. **Launch Application**
```bash
# Easy start (recommended)
# Easy start (recommended) - uses new build scripts
yarn dev

# Alternative: Use automated build script
# Windows (CMD):
build.bat

# Windows (PowerShell):
.\build.ps1

# macOS/Linux:
./build.sh

# Alternative: Manual start
node start-pointer.js
```

## 🔧 Advanced Setup
### 🎯 Using New Build Scripts (Recommended)

We've added comprehensive build scripts with enhanced error handling and automatic troubleshooting:

```bash
# Windows (Command Prompt)
build.bat [OPTIONS]

# Windows (PowerShell)
.\build.ps1 [OPTIONS]

# macOS/Linux
./build.sh [OPTIONS]
```

**Available Options:**
- `--skip-checks` / `-s` - Skip prerequisite checks (faster)
- `--debug` / `-d` - Enable debug mode with verbose output
- `--clean` / `-c` - Clean installation (removes node_modules)
- `--background` / `-b` - Run components in background
- `--help` / `-h` - Show help message

**Examples:**
```bash
build.bat --clean --debug # Windows: Clean install with debug
./build.sh --skip-checks # macOS/Linux: Skip checks for speed
.\build.ps1 -CleanInstall -Debug # PowerShell: Clean install with debug
```

See [BUILD_SCRIPTS_README.md](./BUILD_SCRIPTS_README.md) for detailed documentation.

## � Recent Changes & Improvements

### 🔧 Fixed Issues

#### Settings Loading Error
**Problem:** `SyntaxError: Unexpected token '<', "<!DOCTYPE "..."`

**Solution:**
- Added global HTTP exception handler in backend (`backend.py`) to ensure JSON responses
- Improved frontend error handling in `FileSystemService.ts` to detect and gracefully handle HTML responses
- Added detailed error logging with response preview for debugging

**Files Modified:**
- `backend/backend.py` - Added `@app.exception_handler(HTTPException)` for JSON error responses
- `src/services/FileSystemService.ts` - Enhanced error handling with content-type validation

#### API Endpoint Proxying
**Problem:** Frontend couldn't reach backend in development mode

**Solution:**
- Added comprehensive proxy configuration in `vite.config.ts` for all API endpoints
- Proxies now include: `/api`, `/read-settings-files`, `/save-settings-files`, `/execute-command`, `/read-file`, `/ws`

**Files Modified:**
- `vite.config.ts` - Added multiple proxy entries for backend communication

#### Settings Request Model
**Problem:** Optional parameters causing validation errors

**Solution:**
- Made `settingsDir` parameter optional with default empty string in `SettingsRequest` model
- Backend now uses its own cross-platform path resolution

**Files Modified:**
- `backend/backend.py` - Updated request model to handle optional parameters

### ✨ New Features

#### Comprehensive Build Scripts
Three unified build scripts with automatic error handling and troubleshooting:

**Scripts Created:**
- `build.bat` - Windows Command Prompt (CMD.exe)
- `build.ps1` - Windows PowerShell (PS 5.0+)
- `build.sh` - macOS/Linux Bash

**Features:**
- ✅ Automatic prerequisite checking (Node.js, Python, Yarn/npm, Git)
- ✅ Port conflict detection
- ✅ Platform-specific requirements installation
- ✅ Error handling with automatic alternatives (npm fallback, Python3/Python)
- ✅ Debug mode with verbose output
- ✅ Clean installation option
- ✅ Integrated troubleshooting guide
- ✅ Colorized output with timestamps
- ✅ Interactive startup assistant

**Files Created:**
- `build.bat` - Windows batch script
- `build.ps1` - PowerShell script
- `build.sh` - Bash script
- `BUILD_SCRIPTS_README.md` - Comprehensive documentation

## �🔧 Advanced Setup

### Manual Component Startup

Expand Down
Loading