From b40a872c293344a01a067e925273333c9f4b66b3 Mon Sep 17 00:00:00 2001 From: Meleki Date: Mon, 9 Mar 2026 15:50:11 +0100 Subject: [PATCH] refactor: Build-Output in Build/{OS}/-Ordnerstruktur Plattformspezifische bin/obj/publish-Ordner unter Build/Linux/ und Build/Windows/ statt bin-linux/, obj-linux/, publish/ etc. - Directory.Build.props: OS-Erkennung setzt BaseOutputPath, BaseIntermediateOutputPath und MSBuildProjectExtensionsPath auf Build/{Linux|Windows|macOS}/ - gott.csproj: Vereinfacht auf ein einziges Build/** Exclude - deploy.sh: publish-Output nach Build/Linux/publish - OpenClawEndpoint.cs: DB-Pfad relativ zu AppContext.BaseDirectory - Doku (README, ARCHITECTURE, ARCHITECTURE_QUICK) aktualisiert --- .gitignore | 5 ++--- ARCHITECTURE.md | 18 +++++++++++------- ARCHITECTURE_QUICK.md | 14 +++++++++----- Directory.Build.props | 17 +++++++++++++++++ Endpoints/OpenClawEndpoint.cs | 15 ++------------- README.md | 16 ++++++++++++---- deploy.sh | 2 +- gott.csproj | 20 +++++--------------- 8 files changed, 59 insertions(+), 48 deletions(-) create mode 100644 Directory.Build.props diff --git a/.gitignore b/.gitignore index 14153c1..61dac5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ +Build/ bin/ -data/ obj/ -publish/ -publish-win/ +data/ Temp/ appsettings.Production.json DEVY.md diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index d74d8fd..1d9abda 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -235,7 +235,11 @@ gott/ │ ├── MainWindow.xaml/cs # WebView2 Host Window │ └── appsettings.json # Server-URL Konfiguration │ -└── publish/ # Build-Output (NICHT editieren!) +└── Build/ # Build-Output (NICHT editieren!) + ├── Linux/ + │ ├── bin/ obj/ publish/ + └── Windows/ + ├── bin/ obj/ publish/ └── data/ ├── gott.db # SQLite Datenbank ├── agents/ # Agent Memory-Dateien @@ -1527,7 +1531,7 @@ Im `WindowsApp/`-Ordner liegt ein minimaler **WPF WebView2 Client**: ## OpenClaw Import -Sessions können mit Chatverlauf aus einer **OpenClaw-Instanz** befüllt werden. Die Import-Quelle ist eine SQLite-Datenbank (`publish/data/openclaw-sessions.db`). +Sessions können mit Chatverlauf aus einer **OpenClaw-Instanz** befüllt werden. Die Import-Quelle ist eine SQLite-Datenbank (`Build//publish/data/openclaw-sessions.db`). ### Funktionsweise @@ -1570,7 +1574,7 @@ set -e cd /app/gott export PATH="$HOME/.dotnet:$PATH" systemctl stop gott -dotnet publish -c Release -o publish +dotnet publish -c Release -o Build/Linux/publish systemctl start gott echo "OK" ``` @@ -1578,9 +1582,9 @@ echo "OK" ### Verzeichnisse - **Quell-Code**: `/app/gott/` (wwwroot/, Services/, etc.) -- **Build-Output**: `/app/gott/publish/` -- **Laufzeit-Daten**: `/app/gott/publish/data/` (DB, Agents, Images, Skills) -- **WICHTIG**: Änderungen IMMER in `wwwroot/` machen, NIEMALS in `publish/wwwroot/` +- **Build-Output**: `/app/gott/Build//publish/` +- **Laufzeit-Daten**: `/app/gott/Build//publish/data/` (DB, Agents, Images, Skills) +- **WICHTIG**: Änderungen IMMER in `wwwroot/` machen, NIEMALS in `Build/*/publish/wwwroot/` ### systemd @@ -1606,7 +1610,7 @@ Die Anwendung läuft als systemd Service (`gott.service`), Kestrel auf Port 1900 ### appsettings.Production.json -Überschreibt Werte aus `appsettings.json` im Production-Environment. Wird **nicht** beim Publish mitkopiert (liegt nur im `publish/`-Verzeichnis). Verwaltung über die **Admin-UI** (Servereinstellungen, `#/server-settings`). +Überschreibt Werte aus `appsettings.json` im Production-Environment. Wird **nicht** beim Publish mitkopiert (liegt nur im `Build//publish/`-Verzeichnis). Verwaltung über die **Admin-UI** (Servereinstellungen, `#/server-settings`). ### Environment diff --git a/ARCHITECTURE_QUICK.md b/ARCHITECTURE_QUICK.md index 6676582..1fa2eb4 100644 --- a/ARCHITECTURE_QUICK.md +++ b/ARCHITECTURE_QUICK.md @@ -41,7 +41,11 @@ gott/ │ ├── js/pages/ # Seiten-Komponenten (inkl. telegram-bot-page.js) │ └── css/ # Styles (theme.css = CSS Variables) ├── WindowsApp/ # WPF + WebView2 Desktop Client -└── publish/ # ⛔ NICHT editieren! +└── Build/ # ⛔ NICHT editieren! + ├── Linux/ + │ ├── bin/ obj/ publish/ + └── Windows/ + ├── bin/ obj/ publish/ └── data/ ├── gott.db # SQLite DB ├── agents/{id}/ # Memory-Dateien pro Agent @@ -252,7 +256,7 @@ User-Input → POST /api/chat (SSE) } ``` -Verwaltung über **Admin-UI** (`#/server-settings`): Liest `appsettings.Production.json` (Fallback: `appsettings.json` → Default). Schreibt immer in `appsettings.Production.json`. Die Datei wird **nicht** beim Publish mitkopiert. +Verwaltung über **Admin-UI** (`#/server-settings`): Liest `appsettings.Production.json` (Fallback: `appsettings.json` → Default). Schreibt immer in `appsettings.Production.json`. --- @@ -295,8 +299,8 @@ Eine Session kann bis zu **vier Agents** haben: Worker (Pflicht), Preparer (opti ## Wichtige Regeln beim Entwickeln -- ⚠️ **Quelldateien in `wwwroot/`** editieren, NICHT in `publish/wwwroot/` -- ⛔ **`publish/data/gott.db`** niemals manuell modifizieren/löschen -- ⛔ **`publish/`** generell nicht anfassen +- ⚠️ **Quelldateien in `wwwroot/`** editieren, NICHT in `Build/*/publish/wwwroot/` +- ⛔ **`Build/*/publish/data/gott.db`** niemals manuell modifizieren/löschen +- ⛔ **`Build/`** generell nicht anfassen - 🔧 **.NET 10** ohne Nullable, ohne Implicit Usings - 📦 DB-Migrationen sind idempotent (IF NOT EXISTS Pattern in `DatabaseService`) diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..8eabebf --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,17 @@ + + + Build\Windows\obj\ + Build\Windows\obj\ + Build\Windows\bin\ + + + Build/Linux/obj/ + Build/Linux/obj/ + Build/Linux/bin/ + + + Build/macOS/obj/ + Build/macOS/obj/ + Build/macOS/bin/ + + diff --git a/Endpoints/OpenClawEndpoint.cs b/Endpoints/OpenClawEndpoint.cs index 1cb772b..d469e15 100644 --- a/Endpoints/OpenClawEndpoint.cs +++ b/Endpoints/OpenClawEndpoint.cs @@ -17,7 +17,7 @@ namespace Gott.Endpoints; public static class OpenClawEndpoint { - private const string OpenClawDbRelativePath = "publish/data/openclaw-sessions.db"; + private static readonly string OpenClawDbRelativePath = Path.Combine("data", "openclaw-sessions.db"); private const string ImportTag = "openclaw-import"; public static void MapOpenClawEndpoints(this IEndpointRouteBuilder app) @@ -28,18 +28,7 @@ public static class OpenClawEndpoint private static string GetOpenClawDbPath() { - // Resolve relative to the app base directory - var basePath = AppContext.BaseDirectory; - // Navigate up from bin/Debug/net10.0 or similar to the project root - var candidate = Path.Combine(basePath, OpenClawDbRelativePath); - if (File.Exists(candidate)) return candidate; - - // Try from current directory - candidate = Path.Combine(Directory.GetCurrentDirectory(), OpenClawDbRelativePath); - if (File.Exists(candidate)) return candidate; - - // Try absolute common path - candidate = Path.Combine("/app/gott", OpenClawDbRelativePath); + var candidate = Path.Combine(AppContext.BaseDirectory, OpenClawDbRelativePath); if (File.Exists(candidate)) return candidate; return null; diff --git a/README.md b/README.md index a176934..d7e4bcc 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Self-hosted AI-Coding-Agent auf Basis der Anthropic Claude API. Stellt eine Web- ## Konfiguration -Beim ersten Start wird `appsettings.json` mit Standardwerten verwendet. Für eigene Einstellungen eine `appsettings.Production.json` im `publish/`-Verzeichnis anlegen (oder über die Admin-UI verwalten): +Beim ersten Start wird `appsettings.json` mit Standardwerten verwendet. Für eigene Einstellungen eine `appsettings.Production.json` im `Build/Linux/publish/`-Verzeichnis anlegen (oder über die Admin-UI verwalten): ```json { @@ -79,7 +79,7 @@ Beim ersten Start wird `appsettings.json` mit Standardwerten verwendet. Für eig | `KreaToken` | Krea AI API Token (optional) | – | | `KreaApiKey` | API-Key für Krea-Endpoints ohne User-Auth (optional) | – | -> **Hinweis:** Die `appsettings.Production.json` wird **nicht** beim `dotnet publish` mitkopiert. Sie lebt ausschließlich im `publish/`-Verzeichnis und kann über die Admin-UI (`#/server-settings`) verwaltet werden. +> **Hinweis:** Die `appsettings.Production.json` wird **nicht** beim `dotnet publish` mitkopiert. Sie lebt ausschließlich im `Build/Linux/publish/`-Verzeichnis und kann über die Admin-UI (`#/server-settings`) verwaltet werden. ## Starten @@ -117,7 +117,7 @@ After=network.target [Service] Type=exec WorkingDirectory=/app/gott -ExecStart=/app/gott/publish/gott +ExecStart=/app/gott/Build/Linux/publish/gott Restart=on-failure RestartSec=5 @@ -142,7 +142,15 @@ gott/ │ ├── js/ # App, Router, API, Chat, UI-Module (modular aufgeteilt), Pages │ └── css/ # Styles (theme.css = CSS Variables) ├── WindowsApp/ # WPF + WebView2 Desktop Client -└── publish/ # Build-Output + Laufzeit-Daten +└── Build/ # Build-Output + Laufzeit-Daten + ├── Linux/ + │ ├── bin/ + │ ├── obj/ + │ └── publish/ + └── Windows/ + ├── bin/ + ├── obj/ + └── publish/ └── data/ ├── gott.db # SQLite Datenbank ├── agents/{id}/ # Memory-Dateien pro Agent diff --git a/deploy.sh b/deploy.sh index f1fdfa8..658c6d1 100755 --- a/deploy.sh +++ b/deploy.sh @@ -3,6 +3,6 @@ set -e cd /app/gott export PATH="$HOME/.dotnet:$PATH" systemctl stop gott -dotnet publish -c Release -o publish +dotnet publish -c Release -o Build/Linux/publish systemctl start gott echo "OK" diff --git a/gott.csproj b/gott.csproj index 1f29119..89166b1 100755 --- a/gott.csproj +++ b/gott.csproj @@ -5,18 +5,12 @@ ASP0015;IDE0017;IDE0028;IDE0130;IDE0305;IDE1006;SYSLIB1045 + - - - - - - - - - - - + + + + @@ -37,10 +31,6 @@ - - - -