Skip to content

Commit a236a87

Browse files
authored
Merge pull request #22 from memuguenstig-lab/feature/settings-fix-build-scripts
A lot of fixes for the app
2 parents e6d0686 + 5976f65 commit a236a87

23 files changed

Lines changed: 4387 additions & 472 deletions

App/BUILD_SCRIPTS_README.md

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
# Pointer Build & Setup Scripts
2+
3+
Umfassende Build- und Setup-Skripte mit erweiterten Fehlerbehandlung, Debugging und automatischer Problemlösung.
4+
5+
## 📋 Verfügbare Scripts
6+
7+
### Windows
8+
- **`build.bat`** - Batch-Script für Windows (cmd.exe)
9+
- **`build.ps1`** - PowerShell-Script für Windows (PowerShell 5.0+)
10+
11+
### macOS & Linux
12+
- **`build.sh`** - Bash-Script für macOS und Linux
13+
14+
## 🚀 Quick Start
15+
16+
### Windows (Command Prompt)
17+
```bash
18+
build.bat
19+
```
20+
21+
### Windows (PowerShell)
22+
```powershell
23+
.\build.ps1
24+
```
25+
26+
### macOS / Linux
27+
```bash
28+
chmod +x build.sh
29+
./build.sh
30+
```
31+
32+
## 📝 Optionen
33+
34+
Alle Scripts unterstützen die gleichen Optionen:
35+
36+
| Option | Kurz | Beschreibung |
37+
|--------|------|-------------|
38+
| `--skip-checks` | `-s` | Überspringe Voraussetzungsprüfung (schneller) |
39+
| `--debug` | `-d` | Aktiviere Debug-Modus (verbose Output) |
40+
| `--background` | `-b` | Starte Komponenten im Hintergrund |
41+
| `--clean` | `-c` | Saubere Installation (lösche node_modules) |
42+
| `--help` | `-h` | Zeige Hilfe an |
43+
44+
## 💡 Beispiele
45+
46+
### Schnelle Installation ohne Checks
47+
```bash
48+
# Windows (CMD)
49+
build.bat --skip-checks
50+
51+
# Windows (PowerShell)
52+
.\build.ps1 -SkipChecks
53+
54+
# macOS/Linux
55+
./build.sh --skip-checks
56+
```
57+
58+
### Saubere Installation mit Debug
59+
```bash
60+
# Windows (CMD)
61+
build.bat --clean --debug
62+
63+
# Windows (PowerShell)
64+
.\build.ps1 -CleanInstall -Debug
65+
66+
# macOS/Linux
67+
./build.sh --clean --debug
68+
```
69+
70+
### Installation mit allen Checks
71+
```bash
72+
# Windows (CMD)
73+
build.bat
74+
75+
# macOS/Linux
76+
./build.sh
77+
```
78+
79+
## ✨ Features
80+
81+
### 🔍 Automatische Voraussetzungsprüfung
82+
- ✓ Node.js Verfügbarkeit prüfen
83+
- ✓ Yarn/npm Verfügbarkeit prüfen
84+
- ✓ Python Verfügbarkeit prüfen
85+
- ✓ Git (optional) prüfen
86+
- ✓ Port-Konflikte erkennen
87+
88+
### 🛡️ Fehlerbehandlung
89+
- ✓ Automatische Alternativen bei Fehlern
90+
- ✓ Detaillierte Error-Messages
91+
- ✓ Exit-Codes für Scripting
92+
- ✓ Graceful Degradation
93+
94+
### 🐛 Debug & Logging
95+
- ✓ Farbcodierte Output
96+
- ✓ Timestamps bei allen Logs
97+
- ✓ Debug-Modus mit `-d`/`--debug`
98+
- ✓ Schritt-für-Schritt Fortschritt
99+
100+
### 🔧 Plattformspezifische Unterstützung
101+
- ✓ Windows-spezifische Requirements
102+
- ✓ macOS-spezifische Requirements
103+
- ✓ Linux-spezifische Requirements
104+
- ✓ Automatische OS-Erkennung
105+
106+
### 📦 Intelligente Installation
107+
- ✓ Prüfung auf existierende Installation
108+
- ✓ Yarn-Fallback zu npm
109+
- ✓ Python3/Python Fallback
110+
- ✓ Saubere Installation mit `--clean`
111+
112+
## 🔄 Was wird installiert?
113+
114+
### Frontend
115+
```
116+
Frontend-Abhängigkeiten (via yarn/npm)
117+
├─ React & TypeScript
118+
├─ Vite Build-Tool
119+
├─ Monaco Editor
120+
├─ Electron
121+
└─ Weitere UI-Komponenten
122+
```
123+
124+
### Backend
125+
```
126+
Backend-Abhängigkeiten (via pip)
127+
├─ FastAPI
128+
├─ Python Dependencies (OS-spezifisch)
129+
├─ spaCy NLP Models
130+
└─ Weitere Backend-Tools
131+
```
132+
133+
### Umgebung
134+
```
135+
Konfiguration
136+
├─ .env File (falls nicht vorhanden)
137+
└─ Environment Variables
138+
```
139+
140+
## 📊 Script-Ablauf
141+
142+
```
143+
1. Parse Arguments
144+
2. Check Prerequisites
145+
3. Check Ports
146+
4. Setup Frontend (yarn/npm install)
147+
5. Setup Backend (pip install)
148+
6. Setup Environment (.env)
149+
7. Summary & Troubleshooting
150+
8. Optional: Starte Anwendung
151+
```
152+
153+
## 🆘 Troubleshooting
154+
155+
### Problem: "Node.js nicht gefunden"
156+
```bash
157+
# Installiere Node.js von https://nodejs.org/
158+
# Dann versuche erneut:
159+
build.bat
160+
```
161+
162+
### Problem: "Port 23816 bereits in Verwendung"
163+
```bash
164+
# Windows: Finde Prozess und beende ihn
165+
netstat -an | findstr :23816
166+
taskkill /PID <PID> /F
167+
168+
# macOS/Linux:
169+
lsof -i :23816
170+
kill -9 <PID>
171+
```
172+
173+
### Problem: "Python-Abhängigkeiten fehlgeschlagen"
174+
```bash
175+
# Erstelle virtuelle Umgebung
176+
python -m venv venv
177+
178+
# Aktiviere sie
179+
# Windows:
180+
venv\Scripts\activate
181+
# macOS/Linux:
182+
source venv/bin/activate
183+
184+
# Versuche Installation erneut
185+
build.bat --clean
186+
```
187+
188+
### Problem: "yarn: command not found"
189+
Das Script fällt automatisch zu npm zurück. Alternativ installiere Yarn:
190+
```bash
191+
npm install -g yarn
192+
```
193+
194+
## 🎯 Start nach Installation
195+
196+
Nach erfolgreicher Installation hast du mehrere Optionen:
197+
198+
### Option 1: Entwicklungsmodus (empfohlen)
199+
```bash
200+
yarn dev
201+
```
202+
Startet Frontend, Backend und optional Electron zusammen.
203+
204+
### Option 2: Produktionsmodus
205+
```bash
206+
node start-pointer.js
207+
```
208+
209+
### Option 3: Komponenten separat
210+
```bash
211+
# Terminal 1: Backend
212+
cd backend
213+
python run.py
214+
215+
# Terminal 2: Frontend
216+
yarn start
217+
218+
# Terminal 3: Electron (optional)
219+
yarn electron:dev
220+
```
221+
222+
## 🔐 Environment Variablen
223+
224+
Das Script erstellt eine `.env` Datei mit Standard-Konfiguration:
225+
226+
```env
227+
# Backend API URL
228+
VITE_API_URL=http://localhost:23816
229+
230+
# Development Server Port
231+
VITE_DEV_SERVER_PORT=3000
232+
233+
# Debug Mode
234+
DEBUG=false
235+
236+
# Optional: OpenAI API Key
237+
# OPENAI_API_KEY=your_key_here
238+
```
239+
240+
Passe diese nach Bedarf an.
241+
242+
## 📈 Performance-Tipps
243+
244+
- **`--skip-checks`** für schnellere Startups wenn alles okay ist
245+
- Verwende **`--clean`** nur bei ernsthaften Problemen
246+
- Aktiviere **`--debug`** zur Fehlersuche
247+
- Nutze separate Terminals für jede Komponente beim Debugging
248+
249+
## 🆓 Kostenlos & Open Source
250+
251+
Diese Scripts sind Teil des Pointer Projekts und unter MIT License verfügbar.
252+
253+
## 📞 Support
254+
255+
Bei Problemen:
256+
1. Versuche `./build.sh --clean --debug`
257+
2. Prüfe die Troubleshooting-Sektion
258+
3. Öffne einen Issue im Repository
259+
260+
---
261+
262+
**Viel Spaß mit Pointer! 🚀**

App/README.md

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ A modern, AI-powered code editor built with Electron, React, TypeScript, and Pyt
44

55
![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)
66

7+
> **⚠️ Latest Updates:** Settings loading fixed with improved error handling | New comprehensive build scripts added | Enhanced proxy configuration for API endpoints
8+
79
## ✨ Features
810

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

9496
6. **Launch Application**
9597
```bash
96-
# Easy start (recommended)
98+
# Easy start (recommended) - uses new build scripts
9799
yarn dev
98100

101+
# Alternative: Use automated build script
102+
# Windows (CMD):
103+
build.bat
104+
105+
# Windows (PowerShell):
106+
.\build.ps1
107+
108+
# macOS/Linux:
109+
./build.sh
110+
99111
# Alternative: Manual start
100112
node start-pointer.js
101113
```
102114

103-
## 🔧 Advanced Setup
115+
### 🎯 Using New Build Scripts (Recommended)
116+
117+
We've added comprehensive build scripts with enhanced error handling and automatic troubleshooting:
118+
119+
```bash
120+
# Windows (Command Prompt)
121+
build.bat [OPTIONS]
122+
123+
# Windows (PowerShell)
124+
.\build.ps1 [OPTIONS]
125+
126+
# macOS/Linux
127+
./build.sh [OPTIONS]
128+
```
129+
130+
**Available Options:**
131+
- `--skip-checks` / `-s` - Skip prerequisite checks (faster)
132+
- `--debug` / `-d` - Enable debug mode with verbose output
133+
- `--clean` / `-c` - Clean installation (removes node_modules)
134+
- `--background` / `-b` - Run components in background
135+
- `--help` / `-h` - Show help message
136+
137+
**Examples:**
138+
```bash
139+
build.bat --clean --debug # Windows: Clean install with debug
140+
./build.sh --skip-checks # macOS/Linux: Skip checks for speed
141+
.\build.ps1 -CleanInstall -Debug # PowerShell: Clean install with debug
142+
```
143+
144+
See [BUILD_SCRIPTS_README.md](./BUILD_SCRIPTS_README.md) for detailed documentation.
145+
146+
## � Recent Changes & Improvements
147+
148+
### 🔧 Fixed Issues
149+
150+
#### Settings Loading Error
151+
**Problem:** `SyntaxError: Unexpected token '<', "<!DOCTYPE "..."`
152+
153+
**Solution:**
154+
- Added global HTTP exception handler in backend (`backend.py`) to ensure JSON responses
155+
- Improved frontend error handling in `FileSystemService.ts` to detect and gracefully handle HTML responses
156+
- Added detailed error logging with response preview for debugging
157+
158+
**Files Modified:**
159+
- `backend/backend.py` - Added `@app.exception_handler(HTTPException)` for JSON error responses
160+
- `src/services/FileSystemService.ts` - Enhanced error handling with content-type validation
161+
162+
#### API Endpoint Proxying
163+
**Problem:** Frontend couldn't reach backend in development mode
164+
165+
**Solution:**
166+
- Added comprehensive proxy configuration in `vite.config.ts` for all API endpoints
167+
- Proxies now include: `/api`, `/read-settings-files`, `/save-settings-files`, `/execute-command`, `/read-file`, `/ws`
168+
169+
**Files Modified:**
170+
- `vite.config.ts` - Added multiple proxy entries for backend communication
171+
172+
#### Settings Request Model
173+
**Problem:** Optional parameters causing validation errors
174+
175+
**Solution:**
176+
- Made `settingsDir` parameter optional with default empty string in `SettingsRequest` model
177+
- Backend now uses its own cross-platform path resolution
178+
179+
**Files Modified:**
180+
- `backend/backend.py` - Updated request model to handle optional parameters
181+
182+
### ✨ New Features
183+
184+
#### Comprehensive Build Scripts
185+
Three unified build scripts with automatic error handling and troubleshooting:
186+
187+
**Scripts Created:**
188+
- `build.bat` - Windows Command Prompt (CMD.exe)
189+
- `build.ps1` - Windows PowerShell (PS 5.0+)
190+
- `build.sh` - macOS/Linux Bash
191+
192+
**Features:**
193+
- ✅ Automatic prerequisite checking (Node.js, Python, Yarn/npm, Git)
194+
- ✅ Port conflict detection
195+
- ✅ Platform-specific requirements installation
196+
- ✅ Error handling with automatic alternatives (npm fallback, Python3/Python)
197+
- ✅ Debug mode with verbose output
198+
- ✅ Clean installation option
199+
- ✅ Integrated troubleshooting guide
200+
- ✅ Colorized output with timestamps
201+
- ✅ Interactive startup assistant
202+
203+
**Files Created:**
204+
- `build.bat` - Windows batch script
205+
- `build.ps1` - PowerShell script
206+
- `build.sh` - Bash script
207+
- `BUILD_SCRIPTS_README.md` - Comprehensive documentation
208+
209+
## �🔧 Advanced Setup
104210

105211
### Manual Component Startup
106212

0 commit comments

Comments
 (0)