This commit is contained in:
2026-11-12 09:32:23 +01:00
commit 53f1896d05
27 changed files with 6336 additions and 0 deletions

11
.claude/settings.json Normal file
View File

@@ -0,0 +1,11 @@
{
"permissions": {
"allow": [
"PowerShell($c = Get-NetTCPConnection -LocalPort 4949 -State Listen -ErrorAction SilentlyContinue; foreach \\($x in $c\\) { $p = Get-CimInstance Win32_Process -Filter \"ProcessId=$\\($x.OwningProcess\\)\"; \"$\\($p.ProcessId\\) $\\($p.CommandLine\\)\"; if \\($p.CommandLine -match 'server\\\\.js'\\) { Stop-Process -Id $p.ProcessId -Confirm:$false } })",
"PowerShell(\\(Get-Content public\\\\app.js -Raw\\) -replace 'const rootPaths = \\\\\\(\\\\\\) =>', 'const rowRootPaths = \\(\\) =>' -replace 'have: rootPaths\\\\\\(\\\\\\)', 'have: rowRootPaths\\(\\)' | Set-Content public\\\\app.js -Encoding utf8 -NoNewline; Select-String -Path public\\\\app.js -Pattern 'rootPaths\\\\\\(\\\\\\)|rowRootPaths' | ForEach-Object { \"$\\($_.LineNumber\\): $\\($_.Line.Trim\\(\\)\\)\" }; node --check public/app.js; if \\($?\\) { 'OK' })",
"PowerShell($b = [IO.File]::ReadAllBytes\\(\"$PWD\\\\public\\\\app.js\"\\); if \\($b[0] -eq 0xEF -and $b[1] -eq 0xBB\\) { [IO.File]::WriteAllBytes\\(\"$PWD\\\\public\\\\app.js\", $b[3..\\($b.Length-1\\)]\\); 'BOM removed' } else { 'no BOM' }; node --check public/app.js; if \\($?\\) { 'OK' })",
"PowerShell($f = \"$PWD\\\\public\\\\app.js\"; $txt = [IO.File]::ReadAllText\\($f, [Text.UTF8Encoding]::new\\($false\\)\\); $orig = [Text.Encoding]::GetEncoding\\(1252\\).GetBytes\\($txt\\); $fixed = [Text.UTF8Encoding]::new\\($false, $true\\).GetString\\($orig\\); [IO.File]::WriteAllText\\($f, $fixed, [Text.UTF8Encoding]::new\\($false\\)\\); \"mojibake left: \" + \\([regex]::Matches\\($fixed, 'Ã|Â'\\).Count\\); \"umlauts: \" + \\([regex]::Matches\\($fixed, '[äöüÄÖÜß–…→]'\\).Count\\); node --check public/app.js; if \\($?\\) { 'OK' })",
"PowerShell($c = Get-NetTCPConnection -LocalPort 4848 -State Listen -ErrorAction SilentlyContinue; foreach \\($x in $c\\) { Get-CimInstance Win32_Process -Filter \"ProcessId=$\\($x.OwningProcess\\)\" | Select-Object ProcessId, CreationDate, CommandLine, ExecutablePath | Format-List }; \\(Get-Item server.js\\).LastWriteTime; try { \\(Invoke-WebRequest -UseBasicParsing -Method Post -Uri 'http://127.0.0.1:4848/api/projects/xyz/git-init' -Headers @{Origin='http://127.0.0.1:4848'} -ContentType 'application/json' -Body '{}'\\).Content } catch { $_.Exception.Response.StatusCode; \\(New-Object IO.StreamReader\\($_.Exception.Response.GetResponseStream\\(\\)\\)\\).ReadToEnd\\(\\).Substring\\(0,120\\) })"
]
}
}

9
.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
node_modules/
.cache/
launcher/bin/
launcher/obj/
launcher/publish/
release/
launcher/payload.zip
launcher/payload-stage/
launcher/publish-portable/

BIN
ProjectDashboard.exe Normal file

Binary file not shown.

201
README.md Normal file
View File

@@ -0,0 +1,201 @@
# Project Dashboard
Kleines lokales Kanban-Board für alle Ordner unter `D:\Oculusquest\Projekt`.
Kein Account, keine Cloud - Status/Priorität/Notizen landen als
`.dashboard.json` direkt im jeweiligen Projektordner.
Liegt als Werkzeug in `_Tools\ProjectDashboard` und verwaltet die Ordner zwei Ebenen höher
(`D:\Oculusquest\Projekt`; anders per Umgebungsvariable `DASHBOARD_ROOT`).
## Starten
**Als Programm:** `ProjectDashboard.exe` doppelklicken (Verknüpfung „Projekt-Dashboard“ liegt auf dem
Desktop und im Startmenü). Eigenes Fenster, kein Konsolenfenster. Die exe startet `server.js` unsichtbar
(beim ersten Mal auch `npm install`) und beendet ihn beim Schließen wieder. Läuft der Server schon
(zweites Fenster, `.bat`), wird er mitbenutzt. Server-Log: `%LOCALAPPDATA%\ProjectDashboard\server.log`.
Braucht Node.js, die .NET 8 Desktop Runtime und WebView2 (bei Windows 11 dabei).
**Im Browser:** `start-dashboard.bat` doppelklicken oder `npm install` + `npm start`,
dann http://127.0.0.1:4848 – der Server ist **nur lokal** erreichbar.
**Weitergeben (an Freunde):** `powershell -ExecutionPolicy Bypass -File build.ps1 -Release` →
`release\ProjectDashboard.exe` (~100 MB, **eine Datei**, nichts zu installieren: .NET, Node.js und das Dashboard sind drin).
Beim ersten Start entpackt sie sich nach `%LOCALAPPDATA%\ProjectDashboard\app\` und zeigt **Einrichten**:
Projektordner wählen (Pflicht), Backup-Ziel wählen (optional: externe Platte, NAS, anderes Laufwerk) – je mit „Durchsuchen…“.
Später änderbar über das **Zahnrad** oben. Einstellungen, Scan- und Backup-Stand liegen in `%LOCALAPPDATA%\ProjectDashboard\data\`.
**Mehrere Projektordner:** im Zahnrad-Menü einzeln hinzufügen („Ordner hinzufügen“) oder gesammelt
(„Mehrere einlesen…“: übergeordneten Ordner wählen, Unterordner ankreuzen) – beides auch direkt im Dropdown oben
links neben dem Logo. Dort per Häkchen **mehrere Ordner gleichzeitig anzeigen** (Klick auf den Namen = nur dieser).
Bei mehreren sichtbaren Ordnern zeigen die Karten ihren Ordner; gleichnamige Projekte heißen „Name (Ordner)“.
Scan- und Backup-Stand gelten je Ordner; „Backup“ sichert alle angezeigten Ordner. Im Backup-Ziel landet der erste
Ordner direkt, jeder weitere in einem Unterordner mit seinem Namen (liegt er im ersten Ordner: sein Pfad darunter).
**Git im Info-Tab:** Remote (SSH `git@github.com:name/projekt.git` oder https) eintragen/ändern, „Git einrichten“
(`git init -b main`) für Projekte ohne Repo, „Push“ bzw. „Commit & Push“ mit Nachricht – läuft in einem
Konsolenfenster (SSH-Passphrase/Fehler sichtbar). Der eigene SSH-Public-Key lässt sich dort kopieren.
**Neu / Klonen:** Knopf „Neu“ oben legt ein leeres Projekt (Ordner + `README.md` + `.dashboard.json`) oder einen Klon an,
„Klonen“ im Projekt-Panel klont direkt. Ziel: beliebiger Projektordner. Der Klon lässt `node_modules`, Caches und
(abwählbar) Build-Ordner weg, den git-Verlauf nur auf Wunsch; er startet als „Idee“ ohne itch.io-Link, nur mit offenen Aufgaben.
Voraussetzung: Windows 10/11 mit WebView2 (bei Windows 11 immer dabei; fehlt sie, zeigt die exe den Download-Link).
Git, VS Code, Unity usw. sind optional – fehlen sie, fehlen nur die passenden Anzeigen/Knöpfe.
Eigener Rechner (dieser Ordner): Einstellungen kommen automatisch aus dem Ordner-Aufbau
(`<Projekte>\_Tools\ProjectDashboard`) und `_Tools\Backup\backup-config.json`; Änderungen im Zahnrad-Menü
werden auch dorthin geschrieben, damit `backup-projekte.bat` dasselbe sichert.
**exe neu bauen** (nach Änderungen an `launcher\`): `powershell -ExecutionPolicy Bypass -File build.ps1`
(braucht .NET SDK 8+). Icon neu zeichnen: `launcher\make-icon.ps1`, dann `launcher\app.ico` löschen und bauen.
Änderungen an `server.js`, `lib\` oder `public\` brauchen keinen Neubau – nur das Fenster neu öffnen.
Zweite Instanz zum Testen: `DASHBOARD_PORT=4849` setzen (gilt für exe und Server).
## Ansichten & Bedienung
- **Board** (Kanban; Umschalter **Karten | Liste** – „Liste“ = zwei Zeilen pro Projekt: Name, darunter Größe,
letzte Änderung, Git, Backup, offene Aufgaben; mit ▶, ebenfalls per Drag & Drop verschiebbar; die Wahl wird gemerkt).
**Größe** = Ordnergröße aus dem Scan. **Letzte Änderung** = neueste Datei im Projekt (ohne node_modules, Build-,
Cache- und .git-Ordner; Tooltip nennt die Datei), wird im Hintergrund ermittelt und alle 5 Minuten aufgefrischt.
„Zuletzt geändert“ sortiert danach. **Galerie** (Kacheln mit Icon, Hover: Starten / Ordner / VS Code), **Liste** (Tabelle, Spaltenkopf klicken = sortieren),
**Aufgaben** (alle Aufgaben aller Projekte: Offen / Erledigt / Alle, abhaken, löschen, oben oder pro Projekt neue eintragen; Zähler am Reiter = offene Aufgaben).
- **VS-Code-Knopf `</>`** links neben ▶ auf Karten und Zeilen (Galerie: Hover „Code“, Liste: eigener Knopf).
- **▶ Schnellstart** auf Karte, Kachel und in der Liste: festgelegtes Programm (Aktionen → 📌) → eigener Start-Befehl →
sonst Haupt-exe (zum Projektnamen passend, „Server/Helper“ nach hinten, beste Kopie aus publish/release/dist/bin) →
sonst HTML-Seite, die per Doppelklick läuft (`release\*.html` → `game\index.html` → `index.html` / `<Projektname>.html`;
Vite-/Modul-Seiten nicht, die laufen über npm) → sonst Start-Skript (.bat mit „start/run/spiel …“ im Namen) →
sonst erste Start-Aktion (Unity, npm run dev, Python …). Vite-Server öffnen dabei den Browser (`-- --open`),
fehlt `node_modules`, läuft vorher `npm install`. Fehlt die Datei, kommt eine Meldung statt eines stillen Fehlschlags.
- **itch.io veröffentlicht** (🚀 rot, Klick öffnet die Spielseite): auf Karte, Zeile, Kachel, Liste und im Editor.
Das Dashboard liest das öffentliche Profil (Einstellungen → „itch.io-Profil“, hier `https://sn09.itch.io`,
stündlich, ↻ = sofort) und ordnet Spiele per Namen zu (gleicher Name, oder itch-Titel = Projektname + kurzer
Zusatz). Im Editor unter **Bearbeiten → itch.io-Seite**: leer = automatisch, Link = manuell (`"itch"` in
`.dashboard.json`), `-` = „nicht veröffentlicht“. Die Einstellungen zeigen itch-Spiele ohne Projekt.
Schnellfilter **itch.io** und **Fertig, nicht auf itch**.
- Kennzahlen oben: Projekte, ohne Backup (klickbar = filtern), belegter Speicher, aufräumbar (klickbar), Scan-Fortschritt.
- Schnellfilter-Chips: Ohne Backup, Ungesichert, Aufräumbar, npm install, Ohne Icon, Generator-Kopie.
- Seitenpanel rechts (Klick auf Projekt), `Esc` schließt, `/` springt in die Suche.
- Darstellung oben rechts wählbar: **Hell / System / Dunkel** (System folgt Windows, auch live). Wird im Browser gemerkt; per Link: `?theme=light` / `?theme=dark`.
- Direktlinks: `#gallery`, `#list`, `#board/GallerySwiper/info` (öffnet Projekt + Reiter).
- Icons: [Lucide](https://lucide.dev) (ISC-Lizenz), lokal aus `node_modules/lucide-static` unter `/icons.svg`.
## Backup auf die MyCloud
Knopf **Backup** oben (zeigt „vor … Tagen“, gelb wenn älter als 7 Tage oder noch nie):
1. **Prüfen, was neu ist** – listet neue / geänderte Dateien (fehlen im Backup) und Dateien, die nur noch im Backup liegen, mit Größe pro Projekt.
2. **Jetzt kopieren** – kopiert genau das, mit Fortschrittsbalken, abbrechbar.
**Einzelnes Projekt:** im Projekt unter **Aktionen → Sichern auf MyCloud → Jetzt sichern**. Ein Klick prüft
`<Ziel>\<Projekt>` und kopiert sofort, was fehlt oder sich geändert hat (mit Fortschritt). Dort steht auch
„zuletzt gesichert“ (eigenes Projekt-Backup oder letztes Komplett-Backup, was neuer ist).
Es läuft immer nur ein Backup gleichzeitig.
**Mehrere Backup-Ziele** (z. B. MyCloud + USB-Platte): Zahnrad → „Ziel hinzufügen“ (Name + Ordner). Jedes Ziel hat
seinen eigenen Stand. Im Backup-Fenster und unter „Sichern“ im Projekt oben das Ziel per Reiter wählen – die Wahl gilt
auch für die Backup-Anzeige auf Karten/Kacheln/Liste. Im Projekt steht zusätzlich „Alle Ziele“ mit dem Stand jedes Ziels.
Es läuft immer nur ein Backup gleichzeitig. Ein Ziel muss beim Eintragen erreichbar sein.
Im Backup wird **nie** etwas gelöscht. Nicht gesichert: `node_modules`, `__pycache__`, `.gradle`, `.venv`, `.bin`
(`.bin`: Build-Ausgaben; die WD MyCloud versteckt Ordner mit diesem Namen, sie ließen sich dort gar nicht anlegen).
Scheitern bei einem Komplett-Backup einzelne Ordner, gilt nur das betroffene Projekt als „unvollständig“ (rot),
alle anderen als gesichert.
Ziele und Ausnahmen: `_Tools\Backup\backup-config.json` – dieselbe Datei nutzt `backup-projekte.bat`
(ohne Dashboard, auch für die Aufgabenplanung; sichert auf das **erste** Ziel der Liste). Protokolle: `_Tools\Backup\logs\`.
Schließen der exe während eines Backups fragt nach und bricht es sauber ab (Kopiertes bleibt).
## Projektverwaltung (Karten, Galerie, Editor)
Jede Karte/Kachel zeigt zusätzlich:
- **Ampel Git/Backup**: 🔴 kein Git oder kein Remote (liegt nur auf dieser Platte) ·
🟡 ungesicherte Änderungen, nicht gepusht oder kein Upstream · 🟢 gesichert.
- **Technik** (Unity, Node/Electron/Expo/Capacitor, .NET, Flutter, Android, C++/CMake, Python, Web, Arduino)
und „npm install nötig“, wenn `node_modules` fehlt.
- **Speicher** (nach Scan): Größe und 🧹 löschbare Menge.
- **Werkzeuge**: „ComfyGen“ = Generator nutzt `_Tools\ComfyGen` · „eigene Generator-Kopie“ = eigene Skripte.
- **Icon**: echtes App-Icon (Android `mipmap…/ic_launcher`, `.ico`, `icon.png`, `logo`) wird als Bild genutzt,
sonst „kein Icon“.
Kopfzeile: Anzahl ohne Backup, Gesamtgröße, löschbar (Cache / alles), **💾 Alle scannen**.
Galerie: Filter „Zeigen“ (ohne Backup, ohne Icon, aufräumbar, npm install nötig, Generator-Kopie), Sortierung nach Größe.
Editor-Reiter:
- **Info** – Git-Details + **git push** (in sichtbarer Konsole), Technik, Generator, Icon
(fehlt es: fertiger `gen generate icon`-Befehl zum Kopieren), Speicher mit Ordnerliste.
**Scannen** misst das Projekt, **Ausgewählte löschen** löscht angehakte Ordner (Cache ist vorausgewählt,
fertige Builds/Rohbilder nur bewusst). Was löschbar ist, entscheidet `_Tools\Cleanup\cleanup.ps1`
(Ordner mit git-getrackten Dateien bleiben immer).
- **Aktionen** – oben **Programm starten**: gefundene exe und HTML-Seiten als große Knöpfe. 📌 an einem Knopf legt fest,
was ▶ auf der Karte startet; darunter Feld + **Durchsuchen…** (Datei-Dialog, nur in der exe) für jede andere Datei im
Projekt (exe, html, bat, cmd, lnk) und ↺ zum Zurücksetzen auf „automatisch“ (`"program"` in `.dashboard.json`, Pfad relativ
zum Projekt). Dann VS Code, Explorer, Konsole, npm install / npm run …, dotnet build/run, flutter run,
Unity (passende Editor-Version), Gradle, Python (.venv wenn vorhanden), Generator-Konsole.
Befehle laufen **sichtbar** in einem eigenen Konsolenfenster.
- **Bearbeiten** – wie bisher, plus **Eigener Start-Befehl** (`"start"` in `.dashboard.json`).
Sicherheit: Server hört nur auf `127.0.0.1`; Anfragen mit fremdem `Host` oder (bei Änderungen) fremdem
`Origin` werden abgelehnt (403). Der Browser schickt nur die ID einer Aktion – die Befehle selbst baut der Server.
Scan-Ergebnisse liegen in `.cache\scan.json`.
Code: `server.js` (Routen), `lib\git.js`, `lib\tech.js`, `lib\storage.js`, `lib\tools.js`, `lib\icons.js`, `lib\proc.js`.
## Tabs
Oben zwischen **Board** (Kanban) und **Galerie** (Thumbnail-Kacheln) umschalten.
### Galerie
- Kachel pro Projekt mit Vorschaubild, Name, Status-Chip, Prioritäts-Punkt
und Datum. Klick auf die Kachel öffnet dasselbe Bearbeiten-Fenster wie im
Board, der 📂-Knopf oben rechts öffnet direkt den Ordner im Explorer.
- Das Vorschaubild wird automatisch im Projektordner gesucht (bis 3 Ebenen
tief, `node_modules`/`.git`/Build-Ordner werden übersprungen). Bevorzugt
werden Dateien wie `icon`, `logo`, `thumb`, `preview`, `screenshot`,
`cover`, `splash` und flach liegende Bilder.
- Ohne passendes Bild zeigt die Kachel eine farbige Kachel mit den
Anfangsbuchstaben (Farbe ist pro Projektname stabil).
- Manuell festlegen: Feld **Thumbnail** im Bearbeiten-Fenster, Pfad relativ
zum Projektordner (z.B. `assets/icon.png`); landet als `"thumbnail"` in
der `.dashboard.json`.
- Raster: feste 10 Kacheln pro Reihe, auf schmalen Fenstern stufenweise
weniger (6 unter 1400px, 4 unter 1000px, 2 unter 640px).
- Eigene Filter für Status und Sortierung (zuletzt geändert / Name /
Priorität); die Suche oben filtert beide Tabs.
- Gefundene Bilder werden 5 Minuten im Speicher gecacht, Speichern eines
Projekts leert dessen Cache sofort.
## Wie es funktioniert
- Scannt jeden Unterordner von `D:\Oculusquest\Projekt` (außer sich selbst).
- Zeigt pro Projekt: Status-Spalte (Idee/Aktiv/Pausiert/Fertig/Archiviert),
Priorität, Tags, Notizen, Aufgaben-Fortschritt, und wenn vorhanden das
letzte Git-Commit-Datum - sonst den Zeitpunkt der letzten
Ordner-Änderung als Fallback.
- **Drag & Drop**: Karten zwischen Spalten ziehen ändert den Status direkt.
- **Aufgaben**: Klick auf eine Karte öffnet das Bearbeiten-Fenster - dort
Aufgaben anlegen (Enter oder +), abhaken, löschen. Die Karte zeigt den
Fortschritt als Balken (z.B. "2/5 ✓").
- **Tags**: frei vergebbar (mit Komma getrennt), werden als Chips auf der
Karte angezeigt und von der Suche mit durchsucht.
- **Suche**: Feld oben rechts filtert live über Name, Notizen und Tags.
- **📂 Ordner**: Knopf im Bearbeiten-Fenster öffnet den Projektordner im
Windows Explorer.
- Speichern schreibt `.dashboard.json` in den Projektordner.
- Neue Projektordner tauchen automatisch in der Spalte "Idee" auf, sobald
du die Seite neu lädst.
- Innerhalb einer Spalte sortiert: hohe Priorität zuerst, dann zuletzt
geändert.
## Bekannte Einschränkung
Die Git-Commit-Erkennung ruft `git` als Kindprozess auf. Falls das in
deiner Umgebung nicht klappt (z.B. `git` nicht im PATH der Node-Umgebung),
fällt die Karte automatisch auf das Ordner-Änderungsdatum zurück - keine
Fehlfunktion, nur ein fehlendes Detail.
Galerie-Bilder werden in Originalgröße ausgeliefert (keine serverseitige
Skalierung, dafür keine zusätzliche Abhängigkeit). Bei sehr großen PNGs
lädt die Kachel entsprechend etwas länger - lokal unkritisch, die Bilder
werden lazy geladen.

85
build.ps1 Normal file
View File

@@ -0,0 +1,85 @@
# Builds the dashboard exe.
#
# powershell -ExecutionPolicy Bypass -File build.ps1 -> ProjectDashboard.exe next to server.js
# small, for this folder: uses the installed Node.js and .NET 8 Desktop Runtime.
#
# powershell -ExecutionPolicy Bypass -File build.ps1 -Release -> release\ProjectDashboard.exe
# ONE exe to pass on: .NET runtime, node.exe and all dashboard files are inside.
# On another PC it unpacks itself to %LOCALAPPDATA%\ProjectDashboard on first start
# and asks for the projects folder and the backup target.
#
# Needs the .NET 8+ SDK (and Node.js on this PC, which is copied into the release exe).
param([switch]$Release)
$ErrorActionPreference = 'Stop'
$here = $PSScriptRoot
$launcher = Join-Path $here 'launcher'
$csproj = Join-Path $launcher 'ProjectDashboard.csproj'
if (-not (Test-Path (Join-Path $launcher 'app.ico'))) { & (Join-Path $launcher 'make-icon.ps1') }
if (-not $Release) {
$stage = Join-Path $launcher 'publish'
dotnet publish $csproj -c Release -o $stage --nologo -v q
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed ($LASTEXITCODE)" }
Copy-Item (Join-Path $stage 'ProjectDashboard.exe') (Join-Path $here 'ProjectDashboard.exe') -Force
Remove-Item $stage -Recurse -Force
Write-Host "-> $(Join-Path $here 'ProjectDashboard.exe')"
return
}
# ── release: assemble the payload ────────────────────────────────────────────
$payload = Join-Path $launcher 'payload-stage'
$zip = Join-Path $launcher 'payload.zip'
if (Test-Path $payload) { Remove-Item $payload -Recurse -Force }
New-Item -ItemType Directory $payload | Out-Null
Write-Host '1/3 Paket zusammenstellen ...'
foreach ($f in 'server.js', 'package.json') { Copy-Item (Join-Path $here $f) $payload }
foreach ($d in 'lib', 'public') { Copy-Item (Join-Path $here $d) (Join-Path $payload $d) -Recurse }
# node_modules: everything the server needs, but from lucide-static only the icon sprite
$nm = Join-Path $payload 'node_modules'
New-Item -ItemType Directory $nm | Out-Null
Get-ChildItem (Join-Path $here 'node_modules') -Directory -Force | Where-Object { $_.Name -ne 'lucide-static' -and $_.Name -ne '.bin' } |
ForEach-Object { Copy-Item $_.FullName (Join-Path $nm $_.Name) -Recurse }
$lucide = Join-Path $nm 'lucide-static'
New-Item -ItemType Directory $lucide | Out-Null
foreach ($f in 'sprite.svg', 'LICENSE', 'package.json') { Copy-Item (Join-Path $here "node_modules\lucide-static\$f") $lucide }
# cleanup.ps1 (shipped copy, used when the projects folder has no _Tools\Cleanup)
$cleanup = Join-Path (Split-Path $here -Parent) 'Cleanup\cleanup.ps1'
New-Item -ItemType Directory (Join-Path $payload 'tools') | Out-Null
Copy-Item $cleanup (Join-Path $payload 'tools\cleanup.ps1')
# node.exe of this PC (MIT license, copied alongside)
$nodeExe = (Get-Command node -ErrorAction Stop).Source
New-Item -ItemType Directory (Join-Path $payload 'node') | Out-Null
Copy-Item $nodeExe (Join-Path $payload 'node\node.exe')
$nodeLicense = Join-Path (Split-Path $nodeExe -Parent) 'LICENSE'
if (Test-Path $nodeLicense) { Copy-Item $nodeLicense (Join-Path $payload 'node\LICENSE') }
Set-Content -Encoding UTF8 (Join-Path $payload 'THIRD-PARTY.txt') @"
Enthaltene Software:
- Node.js $(& $nodeExe --version) (MIT) - node\LICENSE
- Express (MIT) - node_modules\express
- Lucide Icons (ISC) - node_modules\lucide-static\LICENSE
"@
Write-Host '2/3 Packen ...'
if (Test-Path $zip) { Remove-Item $zip -Force }
Add-Type -AssemblyName System.IO.Compression.FileSystem
[IO.Compression.ZipFile]::CreateFromDirectory($payload, $zip, [IO.Compression.CompressionLevel]::Optimal, $false)
# ── release: one self-contained exe with the payload inside ─────────────────
Write-Host '3/3 exe bauen ...'
$stage = Join-Path $launcher 'publish-portable'
dotnet publish $csproj -c Release -p:Portable=true -o $stage --nologo -v q
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed ($LASTEXITCODE)" }
$outDir = Join-Path $here 'release'
New-Item -ItemType Directory -Force $outDir | Out-Null
$out = Join-Path $outDir 'ProjectDashboard.exe'
Copy-Item (Join-Path $stage 'ProjectDashboard.exe') $out -Force
Remove-Item $stage, $payload, $zip -Recurse -Force
# the normal build must not pick up the self-contained restore state
Remove-Item (Join-Path $launcher 'obj') -Recurse -Force -ErrorAction SilentlyContinue
Write-Host ("-> {0} ({1:N0} MB)" -f $out, ((Get-Item $out).Length / 1MB))

364
launcher/Program.cs Normal file
View File

@@ -0,0 +1,364 @@
using System.Diagnostics;
using System.IO.Compression;
using System.Reflection;
using System.Security.Cryptography;
using System.Text.Json;
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.WinForms;
namespace ProjectDashboard;
static class Program
{
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
Application.Run(new MainForm());
}
}
// One window: makes sure the Node server runs, then shows
// http://127.0.0.1:4848 in WebView2. A server that is already running
// (second window, start-dashboard.bat) is reused and left alone.
//
// Two modes:
// source - server.js lies next to the exe (Michi's _Tools\ProjectDashboard):
// system Node, data in the app's .cache folder.
// portable - the exe carries everything as embedded payload.zip (node.exe +
// dashboard files) and unpacks it once to %LOCALAPPDATA%\ProjectDashboard\app\<hash>.
sealed class MainForm : Form
{
// DASHBOARD_PORT (also read by server.js) allows a second instance, e.g. for tests
static readonly int Port = int.TryParse(Environment.GetEnvironmentVariable("DASHBOARD_PORT"), out var p) ? p : 4848;
static readonly string BaseUrl = $"http://127.0.0.1:{Port}/";
// DASHBOARD_HOME moves everything (window state, WebView2, unpacked app, data) - used for tests
static readonly string DataDir = Environment.GetEnvironmentVariable("DASHBOARD_HOME") is { Length: > 0 } home
? Path.GetFullPath(home)
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ProjectDashboard");
const string WebView2Download = "https://go.microsoft.com/fwlink/p/?LinkId=2124703";
string appDir = AppContext.BaseDirectory;
bool portable;
readonly WebView2 web = new() { Dock = DockStyle.Fill, Visible = false };
readonly Label status = new()
{
Dock = DockStyle.Fill,
TextAlign = ContentAlignment.MiddleCenter,
Font = new Font("Segoe UI", 12f),
ForeColor = Color.FromArgb(107, 113, 131),
};
Process? server; // only set when this window started the server
StreamWriter? serverLog;
public MainForm()
{
Text = "Projekte";
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
MinimumSize = new Size(900, 560);
RestoreWindow();
FormClosing += (_, e) =>
{
if (server != null && BackupRunning() &&
MessageBox.Show(this, "Das Backup läuft noch.\n\nBeim Schließen wird es abgebrochen (bereits kopierte Dateien bleiben). Trotzdem schließen?",
"Projekte", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
{
e.Cancel = true;
return;
}
SaveWindow();
};
BackColor = Color.FromArgb(245, 246, 250);
status.Text = "Starte Dashboard …";
Controls.Add(web);
Controls.Add(status);
Shown += async (_, _) => await StartAsync();
FormClosed += (_, _) => StopServer();
}
async Task StartAsync()
{
try
{
Directory.CreateDirectory(DataDir);
if (!await IsServerUp())
{
string node;
if (File.Exists(Path.Combine(appDir, "server.js")))
{
node = FindNode() ?? throw new Exception("Node.js nicht gefunden. Bitte von nodejs.org installieren.");
if (!Directory.Exists(Path.Combine(appDir, "node_modules")))
{
status.Text = "Installiere einmalig die Abhängigkeiten (npm install) …";
await RunHidden("cmd.exe", "/c npm install --no-audit --no-fund", Path.GetDirectoryName(node)!);
}
}
else
{
status.Text = "Richte das Dashboard ein …";
appDir = await Task.Run(UnpackPayload);
portable = true;
node = Path.Combine(appDir, "node", "node.exe");
}
StartServer(node);
status.Text = "Starte Server …";
var until = DateTime.Now.AddSeconds(25);
while (!await IsServerUp())
{
if (server is { HasExited: true }) throw new Exception($"Server ist abgestürzt. Details:\n{Path.Combine(DataDir, "server.log")}");
if (DateTime.Now > until) throw new Exception($"Server antwortet nicht (Port {Port} belegt?).");
await Task.Delay(300);
}
}
var env = await CoreWebView2Environment.CreateAsync(null, Path.Combine(DataDir, "WebView2"));
await web.EnsureCoreWebView2Async(env);
var core = web.CoreWebView2;
core.Settings.IsStatusBarEnabled = false;
core.Settings.AreDevToolsEnabled = true;
// Anything outside the dashboard opens in the normal browser.
core.NewWindowRequested += (_, e) => { e.Handled = true; OpenExternal(e.Uri); };
core.NavigationStarting += (_, e) =>
{
if (!e.Uri.StartsWith(BaseUrl, StringComparison.OrdinalIgnoreCase)) { e.Cancel = true; OpenExternal(e.Uri); }
};
core.DocumentTitleChanged += (_, _) => Text = core.DocumentTitle;
core.WebMessageReceived += OnWebMessage;
if (savedZoom is > 0.3 and < 3) web.ZoomFactor = savedZoom;
web.Source = new Uri(BaseUrl);
web.Visible = true;
status.Visible = false;
}
catch (WebView2RuntimeNotFoundException)
{
ShowError("Für das Fenster fehlt die „Microsoft Edge WebView2 Runtime“.\n\nHier klicken, um sie herunterzuladen und zu installieren,\ndanach das Dashboard neu starten.");
status.Cursor = Cursors.Hand;
status.Click += (_, _) => OpenExternal(WebView2Download);
}
catch (Exception ex)
{
ShowError("Dashboard konnte nicht starten:\n\n" + ex.Message);
}
}
void ShowError(string text)
{
status.Text = text;
status.ForeColor = Color.FromArgb(220, 38, 38);
status.Visible = true;
web.Visible = false;
}
// The page asks for a folder dialog ("Durchsuchen…" in the settings):
// { type: "pickFolder", id, title, initial } → { type: "folderPicked", id, path }
// or for a file dialog (program to start in "Aktionen"):
// { type: "pickFile", id, title, initial } → { type: "filePicked", id, path }
void OnWebMessage(object? sender, CoreWebView2WebMessageReceivedEventArgs e)
{
if (!e.Source.StartsWith(BaseUrl, StringComparison.OrdinalIgnoreCase)) return;
try
{
using var doc = JsonDocument.Parse(e.WebMessageAsJson);
var m = doc.RootElement;
if (m.ValueKind != JsonValueKind.Object) return;
var type = m.GetProperty("type").GetString();
if (type != "pickFolder" && type != "pickFile") return;
var id = m.GetProperty("id").GetString() ?? "";
var title = m.TryGetProperty("title", out var t) ? t.GetString() : null;
var initial = m.TryGetProperty("initial", out var i) ? i.GetString() : null;
if (type == "pickFile")
{
BeginInvoke(() =>
{
using var fd = new OpenFileDialog
{
Title = title ?? "Datei wählen",
Filter = "Programme und Seiten (*.exe;*.html;*.htm;*.bat;*.cmd;*.lnk)|*.exe;*.html;*.htm;*.bat;*.cmd;*.lnk|Alle Dateien (*.*)|*.*",
CheckFileExists = true,
DereferenceLinks = false,
};
if (!string.IsNullOrWhiteSpace(initial) && Directory.Exists(initial)) fd.InitialDirectory = initial;
var file = fd.ShowDialog(this) == DialogResult.OK ? fd.FileName : "";
web.CoreWebView2?.PostWebMessageAsJson(JsonSerializer.Serialize(new { type = "filePicked", id, path = file }));
});
return;
}
BeginInvoke(() =>
{
using var dlg = new FolderBrowserDialog
{
Description = title ?? "Ordner wählen",
UseDescriptionForTitle = true,
ShowNewFolderButton = true,
};
if (!string.IsNullOrWhiteSpace(initial) && Directory.Exists(initial)) dlg.InitialDirectory = initial;
var path = dlg.ShowDialog(this) == DialogResult.OK ? dlg.SelectedPath : "";
web.CoreWebView2?.PostWebMessageAsJson(JsonSerializer.Serialize(new { type = "folderPicked", id, path }));
});
}
catch { }
}
// Unpacks the embedded payload.zip once per version to <DataDir>\app\<hash>
// and removes older versions. Returns the app folder.
string UnpackPayload()
{
var asm = Assembly.GetExecutingAssembly();
using var res = asm.GetManifestResourceStream("payload.zip")
?? throw new Exception("Diese exe enthält kein Dashboard-Paket (server.js fehlt daneben).");
string hash;
using (var sha = SHA256.Create()) hash = Convert.ToHexString(sha.ComputeHash(res))[..12].ToLowerInvariant();
var appsRoot = Path.Combine(DataDir, "app");
var target = Path.Combine(appsRoot, hash);
if (File.Exists(Path.Combine(target, ".ok"))) return target;
Directory.CreateDirectory(appsRoot);
var tmp = target + ".tmp";
if (Directory.Exists(tmp)) Directory.Delete(tmp, true);
res.Position = 0;
using (var zip = new ZipArchive(res, ZipArchiveMode.Read)) zip.ExtractToDirectory(tmp);
File.WriteAllText(Path.Combine(tmp, ".ok"), DateTime.Now.ToString("s"));
if (Directory.Exists(target)) Directory.Delete(target, true);
Directory.Move(tmp, target);
foreach (var old in Directory.GetDirectories(appsRoot))
{
if (!string.Equals(old, target, StringComparison.OrdinalIgnoreCase))
try { Directory.Delete(old, true); } catch { } // may be in use by another window
}
return target;
}
// Window size/position/zoom are remembered in %LOCALAPPDATA%\ProjectDashboard\window.txt
// ("x y w h maximized zoom"). First start: maximized.
static readonly string WindowFile = Path.Combine(DataDir, "window.txt");
double savedZoom = 1.0;
void RestoreWindow()
{
StartPosition = FormStartPosition.CenterScreen;
Size = new Size(1500, 950);
WindowState = FormWindowState.Maximized;
try
{
var v = File.ReadAllText(WindowFile).Split(' ');
var inv = System.Globalization.CultureInfo.InvariantCulture;
var rect = new Rectangle(int.Parse(v[0]), int.Parse(v[1]), int.Parse(v[2]), int.Parse(v[3]));
savedZoom = double.Parse(v[5], inv);
// only restore a position that is still on a connected screen
if (Screen.AllScreens.Any(s => s.WorkingArea.IntersectsWith(rect)) && rect.Width >= MinimumSize.Width)
{
StartPosition = FormStartPosition.Manual;
Bounds = rect;
}
WindowState = v[4] == "1" ? FormWindowState.Maximized : FormWindowState.Normal;
}
catch { }
}
void SaveWindow()
{
try
{
var b = WindowState == FormWindowState.Normal ? Bounds : RestoreBounds;
var zoom = web.CoreWebView2 != null ? web.ZoomFactor : savedZoom;
Directory.CreateDirectory(DataDir);
File.WriteAllText(WindowFile, string.Join(' ', b.X, b.Y, b.Width, b.Height,
WindowState == FormWindowState.Maximized ? "1" : "0",
zoom.ToString(System.Globalization.CultureInfo.InvariantCulture)));
}
catch { }
}
static bool BackupRunning()
{
try
{
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(1) };
var json = http.GetStringAsync(BaseUrl + "api/backup").GetAwaiter().GetResult();
return json.Contains("\"phase\":\"copying\"") || json.Contains("\"phase\":\"checking\"");
}
catch { return false; }
}
static async Task<bool> IsServerUp()
{
try
{
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(1.5) };
var res = await http.GetAsync(BaseUrl + "api/scan");
return res.IsSuccessStatusCode;
}
catch { return false; }
}
string? FindNode()
{
foreach (var dir in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(';', StringSplitOptions.RemoveEmptyEntries))
{
try
{
var p = Path.Combine(dir.Trim('"'), "node.exe");
if (File.Exists(p)) return p;
}
catch { }
}
var std = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "nodejs", "node.exe");
return File.Exists(std) ? std : null;
}
void StartServer(string node)
{
serverLog = new StreamWriter(Path.Combine(DataDir, "server.log"), append: false) { AutoFlush = true };
var psi = new ProcessStartInfo(node, "server.js")
{
WorkingDirectory = appDir,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
};
// npm/git/code started by the server must be found
psi.Environment["PATH"] = Path.GetDirectoryName(node) + ";" + Environment.GetEnvironmentVariable("PATH");
// portable: settings, cache and logs live next to the window state, not in the unpacked app
if (portable) psi.Environment["DASHBOARD_DATA"] = Path.Combine(DataDir, "data");
server = Process.Start(psi) ?? throw new Exception("Node konnte nicht gestartet werden.");
server.OutputDataReceived += (_, e) => { if (e.Data != null) lock (serverLog) serverLog.WriteLine(e.Data); };
server.ErrorDataReceived += (_, e) => { if (e.Data != null) lock (serverLog) serverLog.WriteLine("ERR " + e.Data); };
server.BeginOutputReadLine();
server.BeginErrorReadLine();
}
async Task RunHidden(string exe, string args, string extraPath)
{
var psi = new ProcessStartInfo(exe, args) { WorkingDirectory = appDir, UseShellExecute = false, CreateNoWindow = true };
psi.Environment["PATH"] = extraPath + ";" + Environment.GetEnvironmentVariable("PATH");
using var p = Process.Start(psi)!;
await p.WaitForExitAsync();
if (p.ExitCode != 0) throw new Exception("npm install ist fehlgeschlagen.");
}
// Only node itself is stopped: programs it launched (Unity, consoles, ...)
// were started detached and keep running.
void StopServer()
{
if (server is { HasExited: false })
{
// a running backup (robocopy, child of node) is stopped cleanly first
try
{
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(2) };
using var req = new HttpRequestMessage(HttpMethod.Post, BaseUrl + "api/backup/cancel");
req.Headers.Add("Origin", BaseUrl.TrimEnd('/'));
http.Send(req);
}
catch { }
}
try { if (server is { HasExited: false }) server.Kill(entireProcessTree: false); } catch { }
serverLog?.Dispose();
}
static void OpenExternal(string uri)
{
try { Process.Start(new ProcessStartInfo(uri) { UseShellExecute = true }); } catch { }
}
}

View File

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- Desktop window for the project dashboard: starts server.js (Node) hidden
and shows the UI in a WebView2 window. Build with ..\build.ps1. -->
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>ProjectDashboard</AssemblyName>
<RootNamespace>ProjectDashboard</RootNamespace>
<ApplicationIcon>app.ico</ApplicationIcon>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<Product>Projekt-Dashboard</Product>
<Version>1.0.0</Version>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<DebugType>none</DebugType>
<SatelliteResourceLanguages>de</SatelliteResourceLanguages>
<!-- WebView2 also ships a WPF control; its WindowsBase reference clashes harmlessly with WinForms -->
<NoWarn>$(NoWarn);MSB3277</NoWarn>
</PropertyGroup>
<!-- Portable build (build.ps1 -Release): one exe for other PCs - .NET runtime
included, and the whole dashboard incl. node.exe embedded as payload.zip. -->
<PropertyGroup Condition="'$(Portable)' == 'true'">
<SelfContained>true</SelfContained>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>
<ItemGroup Condition="'$(Portable)' == 'true'">
<EmbeddedResource Include="payload.zip" LogicalName="payload.zip" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
</ItemGroup>
</Project>

BIN
launcher/app.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
launcher/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

63
launcher/make-icon.ps1 Normal file
View File

@@ -0,0 +1,63 @@
# Draws the app icon (indigo/violet rounded square with a white "layers" glyph,
# same look as the dashboard logo) and writes launcher\app.ico with 16-256 px.
Add-Type -AssemblyName System.Drawing
$ErrorActionPreference = 'Stop'
$out = Join-Path $PSScriptRoot 'app.ico'
function New-IconPng([int]$size) {
$bmp = New-Object System.Drawing.Bitmap $size, $size
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.SmoothingMode = 'AntiAlias'
$g.Clear([System.Drawing.Color]::Transparent)
# rounded square with diagonal gradient
$r = [single]($size * 0.22)
$rect = New-Object System.Drawing.RectangleF 0, 0, $size, $size
$path = New-Object System.Drawing.Drawing2D.GraphicsPath
$d = $r * 2
$path.AddArc(0, 0, $d, $d, 180, 90)
$path.AddArc($size - $d, 0, $d, $d, 270, 90)
$path.AddArc($size - $d, $size - $d, $d, $d, 0, 90)
$path.AddArc(0, $size - $d, $d, $d, 90, 90)
$path.CloseFigure()
$brush = New-Object System.Drawing.Drawing2D.LinearGradientBrush $rect, ([System.Drawing.Color]::FromArgb(99, 102, 241)), ([System.Drawing.Color]::FromArgb(139, 92, 246)), 45
$g.FillPath($brush, $path)
# layers glyph: a diamond on top, two chevrons below (Lucide "layers" shape)
$s = $size / 24.0
$pen = New-Object System.Drawing.Pen ([System.Drawing.Color]::White), ([single][Math]::Max(1.2, 1.9 * $s))
$pen.LineJoin = 'Round'; $pen.StartCap = 'Round'; $pen.EndCap = 'Round'
$ox = 0; $oy = 0.6 * $s
function P($x, $y) { New-Object System.Drawing.PointF ([single]($x * $s + $ox)), ([single]($y * $s + $oy)) }
$g.DrawPolygon($pen, [System.Drawing.PointF[]]@((P 12 4.2), (P 19.5 7.6), (P 12 11), (P 4.5 7.6)))
$g.DrawLines($pen, [System.Drawing.PointF[]]@((P 4.5 11.8), (P 12 15.2), (P 19.5 11.8)))
$g.DrawLines($pen, [System.Drawing.PointF[]]@((P 4.5 15.8), (P 12 19.2), (P 19.5 15.8)))
$g.Dispose()
$ms = New-Object System.IO.MemoryStream
$bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
return , $ms.ToArray()
}
# ICO container with PNG-compressed entries
$sizes = 16, 24, 32, 48, 64, 128, 256
$images = foreach ($sz in $sizes) { , (New-IconPng $sz) }
$fs = [System.IO.File]::Create($out)
$w = New-Object System.IO.BinaryWriter $fs
$w.Write([uint16]0); $w.Write([uint16]1); $w.Write([uint16]$sizes.Count)
$offset = 6 + 16 * $sizes.Count
for ($i = 0; $i -lt $sizes.Count; $i++) {
$sz = $sizes[$i]; $data = $images[$i]
$w.Write([byte]($(if ($sz -ge 256) { 0 } else { $sz })))
$w.Write([byte]($(if ($sz -ge 256) { 0 } else { $sz })))
$w.Write([byte]0); $w.Write([byte]0)
$w.Write([uint16]1); $w.Write([uint16]32)
$w.Write([uint32]$data.Length); $w.Write([uint32]$offset)
$offset += $data.Length
}
foreach ($data in $images) { $w.Write($data) }
$w.Close()
# also a PNG preview for the dashboard / README
[System.IO.File]::WriteAllBytes((Join-Path $PSScriptRoot 'app.png'), (New-IconPng 256))
Write-Host "icon -> $out"

76
lib/activity.js Normal file
View File

@@ -0,0 +1,76 @@
// "Last change" of a project = newest modified file inside it, ignoring
// folders that change by themselves (node_modules, build output, caches, .git).
// The folder's own mtime is useless for this (it only changes when direct
// children are added/removed). Bounded walk, cached for a few minutes.
const fs = require('fs')
const path = require('path')
const SKIP = /^(node_modules|\.git|\.gradle|\.gradle-local|Library|Temp|Logs|obj|bin|build|builds|dist|out|release|publish|\.venv.*|venv|env|__pycache__|\.cache|\.expo|\.next|\.idea|\.vs|\.vscode|output|CMakeFiles|_deps|\.dart_tool|\.cxx|\.externalNativeBuild|cmake-build-.*)$/i
const IGNORE_FILES = /^(\.dashboard\.json|thumbs\.db|desktop\.ini|\.ds_store)$/i
const MAX_ENTRIES = 30000
const MAX_DEPTH = 10
const TTL_MS = 5 * 60 * 1000
const cache = new Map() // projectPath -> { value, at }
function scan(projectPath) {
let best = 0
let bestFile = ''
let seen = 0
const stack = [{ dir: projectPath, depth: 0 }]
while (stack.length) {
const { dir, depth } = stack.pop()
let entries
try { entries = fs.readdirSync(dir, { withFileTypes: true }) } catch { continue }
for (const e of entries) {
if (++seen > MAX_ENTRIES) return finish()
const full = path.join(dir, e.name)
if (e.isDirectory()) {
if (depth < MAX_DEPTH && !SKIP.test(e.name)) stack.push({ dir: full, depth: depth + 1 })
} else if (e.isFile() && !IGNORE_FILES.test(e.name)) {
let m = 0
try { m = fs.statSync(full).mtimeMs } catch { continue }
if (m > best) { best = m; bestFile = full }
}
}
}
return finish()
function finish() {
return best ? { at: new Date(best).toISOString(), file: path.relative(projectPath, bestFile), partial: seen > MAX_ENTRIES } : null
}
}
// Scans run in the background, one project per tick, so the server stays
// responsive; the list always gets the latest known value right away.
const queue = []
const queued = new Set()
let running = false
function enqueue(projectPath) {
if (queued.has(projectPath)) return
queued.add(projectPath)
queue.push(projectPath)
if (!running) { running = true; setImmediate(work) }
}
function work() {
const p = queue.shift()
if (!p) { running = false; return }
queued.delete(p)
try { cache.set(p, { value: scan(p), at: Date.now() }) } catch {}
setImmediate(work)
}
// -> { at, file, partial } | null (empty project) | undefined (not known yet);
// a stale or missing value is refreshed in the background.
function lastChange(projectPath) {
const c = cache.get(projectPath)
if (!c || Date.now() - c.at > TTL_MS) enqueue(projectPath)
return c ? c.value : undefined
}
function warm(projectPaths) { for (const p of projectPaths) enqueue(p) }
function pending() { return queue.length + (running ? 1 : 0) }
function forget(projectPath) { cache.delete(projectPath) }
function clear() { cache.clear(); queue.length = 0; queued.clear() }
module.exports = { lastChange, warm, pending, forget, clear }

344
lib/backup.js Normal file
View File

@@ -0,0 +1,344 @@
// Backup to one or more targets (folder / drive / NAS), in two steps like
// _Tools\Backup\backup-projekte.ps1:
// check: robocopy /L lists what is new/changed (missing in the backup) and
// what exists only in the backup
// copy: robocopy /E copies exactly that - nothing is ever deleted in the backup
// Scope: all shown projects folders (scope = null; several can be selected,
// see lib/settings.js) or one project (<root>\<folder> -> <dest>\<folder>).
// Each projects folder lands in its own place on the target (settings.backupSubdir):
// the first registered folder directly in the target, further ones in a subfolder.
// One job at a time (for one target), in the background; the UI polls getState().
// Excludes come from the settings, which also keep _Tools\Backup\backup-config.json
// in sync (backup-projekte.bat uses the first target). Every projects folder keeps
// its own "last backup" info per target.
const fs = require('fs')
const path = require('path')
const { spawn } = require('child_process')
const settings = require('./settings')
let roots = [] // selected projects folders (paths)
let keyOf = (root, folder) => folder // display name of a project (set by the server)
let logDir = null
const STATE_FILE = path.join(settings.DATA_DIR, 'backup.json')
// the running / last job
const state = {
phase: 'idle', // idle | checking | ready | copying | done | cancelled | error
target: null, // target id of the job
scope: null, // null = everything, else the project's display name
autoCopy: false, // copy right after the check (per-project "Sichern")
error: null,
check: null, // summary of the last check
progress: null, // { files, filesTotal, bytes, bytesTotal, current }
}
let job = null // { scope: {root, folder} | null, items: [{ root, source, target }] }
let all = {} // root (lower case) -> target id -> { path, last, lastByProject }
let child = null
const rootKey = (r) => (r ?? '').toLowerCase()
const targets = () => settings.get().backup.targets
const targetById = (id) => targets().find((t) => t.id === id) ?? null
// where a projects folder lands on a target
const destOf = (t, root) => path.join(t.path, settings.backupSubdir(root))
// per root and target; starts fresh when the destination changed
function dataFor(t, root) {
const r = (all[rootKey(root)] ??= {})
let d = r[t.id]
const dest = destOf(t, root)
if (!d || d.path.toLowerCase() !== dest.toLowerCase()) d = r[t.id] = { path: dest, last: null, lastByProject: {} }
return d
}
// (Re)initialise for the current settings. rootList: selected projects folders,
// key: (root, folder) -> name of the project in the UI.
function init(rootList, key) {
roots = (Array.isArray(rootList) ? rootList : [rootList]).filter(Boolean)
if (key) keyOf = key
const first = roots[0] ?? ''
const own = first ? path.join(first, '_Tools', 'Backup') : ''
logDir = own && fs.existsSync(own) ? path.join(own, 'logs') : path.join(settings.DATA_DIR, 'logs')
if (!busy()) Object.assign(state, { phase: 'idle', target: null, scope: null, error: null, check: null, progress: null })
all = {}
try {
const saved = JSON.parse(fs.readFileSync(STATE_FILE, 'utf-8'))
if (saved.roots && typeof saved.roots === 'object') all = saved.roots
else if (saved.targets) all[rootKey(saved.root ?? first)] = saved.targets
else {
// old format: one target
const t = targets().find((x) => !saved.target || x.path.toLowerCase() === saved.target.toLowerCase())
if (t) all[rootKey(first)] = { [t.id]: { path: t.path, last: saved.last ?? null, lastByProject: saved.lastByProject ?? {} } }
}
} catch {}
const ids = new Set(targets().map((t) => t.id))
for (const r of Object.values(all)) for (const id of Object.keys(r)) if (!ids.has(id)) delete r[id]
}
function save() {
fs.mkdirSync(path.dirname(STATE_FILE), { recursive: true })
fs.writeFileSync(STATE_FILE, JSON.stringify({ roots: all }, null, 1))
}
function config(targetId) {
const s = settings.get()
if (!s.backup.targets.length) throw new Error('Kein Backup-Ziel eingerichtet – in den Einstellungen (⚙) festlegen.')
const t = targetById(targetId) ?? s.backup.targets[0]
return { t, excludeDirs: s.backup.excludeDirs, excludeFiles: s.backup.excludeFiles }
}
function baseArgs(cfg) {
return ['/E', '/FFT', '/XJ', '/R:2', '/W:5', '/COPY:DAT', '/DCOPY:T',
'/XD', ...cfg.excludeDirs, '/XF', ...cfg.excludeFiles]
}
// robocopy runs of a job: one per projects folder, or one for a single project
function itemsFor(t, scope) {
if (scope) return [{ root: scope.root, source: path.join(scope.root, scope.folder), target: path.join(destOf(t, scope.root), scope.folder) }]
return roots.map((root) => ({ root, source: root, target: destOf(t, root) }))
}
const stamp = () => new Date().toISOString().slice(0, 16).replace('T', '_').replace(':', '-')
const slug = (s) => (s ? '-' + s.replace(/[^\w.-]+/g, '_').slice(0, 40) : '')
// Runs robocopy and calls onLine for every line it writes to `logFile`.
// robocopy's stdout uses the old OEM code page (umlauts break), but /UNILOG
// writes real UTF-16 - so the log file is tailed while robocopy runs.
function robocopy(args, logFile, onLine) {
return new Promise((resolve) => {
fs.mkdirSync(path.dirname(logFile), { recursive: true })
try { fs.unlinkSync(logFile) } catch {}
child = spawn('robocopy', [...args, `/UNILOG:${logFile}`], { windowsHide: true, stdio: 'ignore' })
const decoder = new TextDecoder('utf-16le')
let offset = 0
let rest = ''
const buf = Buffer.alloc(1 << 20)
const drain = (final) => {
let fd
try { fd = fs.openSync(logFile, 'r') } catch { return }
try {
for (;;) {
const n = fs.readSync(fd, buf, 0, buf.length, offset)
if (n <= 0) break
offset += n
const lines = (rest + decoder.decode(buf.subarray(0, n), { stream: true })).split(/\r?\n/)
rest = lines.pop()
for (const l of lines) onLine(l)
}
} finally { fs.closeSync(fd) }
if (final && rest) { onLine(rest); rest = '' }
}
const timer = setInterval(() => drain(false), 500)
const finish = (code) => { clearInterval(timer); drain(true); child = null; resolve(code ?? 16) }
child.on('close', finish)
child.on('error', () => finish(16))
})
}
// One file line of robocopy output: "<class>\t<size>\t<full path>"
function parseLine(line) {
const parts = line.split('\t').map((s) => s.trim()).filter(Boolean)
if (parts.length < 3) return null
const size = Number(parts[parts.length - 2])
const file = parts[parts.length - 1]
if (!Number.isFinite(size) || file.endsWith('\\')) return null
return { cls: parts[0], size, file }
}
function busy() { return state.phase === 'checking' || state.phase === 'copying' }
// robocopy error line: "2026/11/10 11:17:10 FEHLER 2 (0x00000002) Verzeichnis wird kopiert D:\x\y\" -> path
const ERR_RE = /\b(?:FEHLER|ERROR)\s+\d+\s+\(0x[0-9A-Fa-f]+\).*?\s((?:[A-Za-z]:\\|\\\\).*)$/
// which project folder a source or target path belongs to (null = none / outside)
function projectOfPath(p, source, target, scopeFolder) {
if (scopeFolder) return scopeFolder
const l = p.toLowerCase()
for (const base of [source, target]) {
const b = base.toLowerCase().replace(/\\$/, '') + '\\'
if (l.startsWith(b)) return p.slice(b.length).split('\\')[0] || null
}
return null
}
// projects with errors in a finished robocopy log (for older records without a "failed" list)
function failedFromLog(log, source, target) {
try {
const out = new Set()
for (const line of fs.readFileSync(log, 'utf16le').split(/\r?\n/)) {
const m = line.match(ERR_RE)
const p = m && projectOfPath(m[1].trim(), source, target, null)
if (p) out.add(p)
}
return [...out]
} catch { return null }
}
// scope: null = all shown projects folders, or { root, folder } of one project.
// autoCopy: continue with the copy right away (nothing is deleted, so no question needed).
// targetId: which backup target (default: the first one).
function check(scope = null, autoCopy = false, targetId = null) {
if (busy()) return false
const cfg = config(targetId)
const items = itemsFor(cfg.t, scope)
job = { scope, items }
Object.assign(state, { phase: 'checking', target: cfg.t.id, scope: scope ? keyOf(scope.root, scope.folder) : null, autoCopy, error: null, check: null, progress: null })
run(async () => {
const share = path.dirname(cfg.t.path)
if (!fs.existsSync(cfg.t.path) && !fs.existsSync(share)) throw new Error(`Backup-Ziel „${cfg.t.name}“ nicht erreichbar: ${cfg.t.path} – Laufwerk/NAS angeschlossen und eingeschaltet?`)
const newF = { n: 0, b: 0 }, changed = { n: 0, b: 0 }, extra = { n: 0, b: 0 }
const perProject = new Map()
for (const it of items) {
if (!fs.existsSync(it.source)) throw new Error(`Projektordner fehlt: ${it.source}`)
fs.mkdirSync(it.target, { recursive: true })
const checkLog = path.join(logDir, `pruefung-${stamp()}-${cfg.t.id}${slug(scope?.folder ?? (items.length > 1 ? path.basename(it.root) : ''))}.log`)
const src = it.source
const rc = await robocopy([src, it.target, ...baseArgs(cfg), '/L', '/X', '/NJH', '/NJS', '/NDL', '/NP', '/FP', '/BYTES'], checkLog, (line) => {
const p = parseLine(line)
if (!p) return
if (p.cls.includes('EXTRA')) { extra.n++; extra.b += p.size; return }
if (!p.file.toLowerCase().startsWith(src.toLowerCase())) return
const bucket = /^(Neue Datei|New File)$/i.test(p.cls) ? newF : changed
bucket.n++; bucket.b += p.size
// group by project (all) or by top-level folder inside the project (one project)
const rel = p.file.slice(src.length).replace(/^\\/, '')
const key = scope
? (rel.includes('\\') ? rel.split('\\')[0] : '(Projektordner)')
: rel.includes('\\') ? keyOf(it.root, rel.split('\\')[0]) : rel
const e = perProject.get(key) ?? { name: key, files: 0, bytes: 0 }
e.files++; e.bytes += p.size
perProject.set(key, e)
})
if (state.phase === 'cancelled') return
if (rc >= 8) throw new Error(`Prüfung fehlgeschlagen (robocopy ${rc})`)
}
state.check = {
at: new Date().toISOString(), scope: state.scope,
source: items.map((i) => i.source).join(' + '), target: items.map((i) => i.target).join(' + '),
files: newF.n + changed.n, bytes: newF.b + changed.b,
newFiles: newF.n, newBytes: newF.b, changedFiles: changed.n, changedBytes: changed.b,
extraFiles: extra.n, extraBytes: extra.b,
projects: [...perProject.values()].sort((a, b) => b.bytes - a.bytes),
}
state.phase = 'ready'
if (autoCopy) {
if (state.check.files) startCopy()
else { for (const it of items) record(cfg.t, it.root, scope?.folder, 0, 0, 0, null); state.phase = 'done' } // already complete
}
})
return true
}
function copy() {
if (busy() || state.phase !== 'ready' || !state.check || !job) return false
startCopy()
return true
}
function startCopy() {
const cfg = config(state.target)
const c = state.check
const { scope, items } = job
Object.assign(state, { phase: 'copying', error: null, progress: { files: 0, filesTotal: c.files, bytes: 0, bytesTotal: c.bytes, current: '' } })
run(async () => {
const problems = []
for (const it of items) {
const log = path.join(logDir, `backup-${stamp()}-${cfg.t.id}${slug(scope?.folder ?? (items.length > 1 ? path.basename(it.root) : ''))}.log`)
const failed = new Set() // project folders with copy errors
const before = { files: state.progress.files, bytes: state.progress.bytes }
const rc = await robocopy([it.source, it.target, ...baseArgs(cfg), '/MT:16', '/NJH', '/NDL', '/NP', '/FP', '/BYTES'], log, (line) => {
const err = line.match(ERR_RE)
if (err) { const pr = projectOfPath(err[1].trim(), it.source, it.target, scope?.folder); if (pr) failed.add(pr); return }
const p = parseLine(line)
if (!p || p.cls.includes('EXTRA')) return
state.progress.files++
state.progress.bytes += p.size
state.progress.current = p.file.slice(it.source.length + 1)
})
if (state.phase === 'cancelled') return
record(cfg.t, it.root, scope?.folder, state.progress.files - before.files, state.progress.bytes - before.bytes, rc, log, [...failed])
if (rc >= 8) problems.push({ rc, log, failed: [...failed].map((f) => keyOf(it.root, f)) })
}
if (problems.length) {
const failed = problems.flatMap((p) => p.failed)
const which = failed.length ? ` Betroffen: ${failed.slice(0, 5).join(', ')}${failed.length > 5 ? ' …' : ''} – alle anderen Projekte sind gesichert.` : ''
throw new Error(`Backup unvollständig (robocopy ${problems[0].rc}).${which} Protokoll: ${problems.map((p) => p.log).join(', ')}`)
}
state.phase = 'done'
state.check = null
})
}
function record(t, root, folder, files, bytes, rc, log, failed = []) {
const d = dataFor(t, root)
const entry = { at: new Date().toISOString(), files, bytes, rc, log, ok: rc < 8 }
if (rc >= 8) entry.failed = failed
if (folder) d.lastByProject[folder] = entry
else d.last = entry
save()
}
function cancel() {
if (!busy()) return false
state.phase = 'cancelled'
try { child?.kill() } catch {}
return true
}
// When the dashboard stops (window closed), don't leave robocopy running orphaned.
process.on('exit', () => { try { child?.kill() } catch {} })
function run(fn) {
fn().catch((e) => { state.phase = 'error'; state.error = String(e.message ?? e) })
}
// Last time a project (root + folder) was backed up to a target (default: the first one):
// its own backup or the last full one of its projects folder, whichever is newer.
function lastFor(root, folder, targetId) {
const t = targetById(targetId) ?? targets()[0]
if (!t) return null
const d = dataFor(t, root)
const own = d.lastByProject[folder]
// an incomplete full backup still counts for every project that had no errors
let full = null
if (d.last?.ok) full = { at: d.last.at, ok: true, how: 'Komplett-Backup' }
else if (d.last) {
if (!Array.isArray(d.last.failed) && d.last.log) d.last.failed = failedFromLog(d.last.log, root, destOf(t, root)) ?? undefined
if (Array.isArray(d.last.failed)) {
full = d.last.failed.includes(folder)
? { at: d.last.at, ok: false, how: 'Komplett-Backup – Fehler in diesem Projekt' }
: { at: d.last.at, ok: true, how: 'Komplett-Backup' }
}
}
if (own && (!full || own.at > full.at)) return { ...own, how: 'Projekt' }
return full
}
// One project on every target: [{ id, name, last }]
function lastOnAllTargets(root, folder) {
return targets().map((t) => ({ id: t.id, name: t.name, last: lastFor(root, folder, t.id) }))
}
// "Last full backup" of a target over all shown folders: the oldest of them
// (none if one folder was never backed up there), files/bytes added up.
function combinedLast(t) {
const lasts = roots.map((r) => dataFor(t, r).last)
if (!lasts.length || lasts.some((l) => !l)) return null
if (lasts.length === 1) return lasts[0]
const oldest = lasts.reduce((a, b) => (a.at < b.at ? a : b))
return {
...oldest,
files: lasts.reduce((a, l) => a + (l.files ?? 0), 0),
bytes: lasts.reduce((a, l) => a + (l.bytes ?? 0), 0),
ok: lasts.every((l) => l.ok),
}
}
function getState() {
const list = targets().map((t) => {
// per-project entries, keyed like the projects in the UI
const lastByProject = {}
for (const r of roots) for (const [folder, e] of Object.entries(dataFor(t, r).lastByProject)) lastByProject[keyOf(r, folder)] = e
return { id: t.id, name: t.name, path: roots.map((r) => destOf(t, r)).join(' + ') || t.path, short: settings.targetName(t.path), last: combinedLast(t), lastByProject }
})
if (!list.length) return { ...state, targets: [], configError: 'Kein Backup-Ziel eingerichtet – in den Einstellungen (⚙) festlegen.', notConfigured: true }
return { ...state, source: roots.join(' + '), targets: list }
}
module.exports = { init, check, copy, cancel, getState, lastFor, lastOnAllTargets, busy }

73
lib/create.js Normal file
View File

@@ -0,0 +1,73 @@
// New projects: an empty folder (with .dashboard.json and README.md) or a clone
// of an existing project. Clones are copied with robocopy and leave out what
// can be regenerated (node_modules, caches, optionally build output) and, unless
// asked for, the git history - so the clone does not push to the original's remote.
const fs = require('fs')
const path = require('path')
const { run } = require('./proc')
const settings = require('./settings')
const STATUS_FILE = '.dashboard.json'
// left out when "Build-Ordner und Caches weglassen" is ticked (on top of the backup excludes)
const BUILD_DIRS = ['dist', 'build', 'out', 'bin', 'obj', 'Library', 'Temp', 'Logs', '.gradle', '.next', 'coverage', '.cache']
const RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i
let running = null // name of the project being created
// Throws with a German message if `name` can't be a Windows folder name.
function checkName(raw) {
const name = typeof raw === 'string' ? raw.trim() : ''
if (!name) throw new Error('Bitte einen Namen eingeben.')
if (name.length > 80) throw new Error('Name zu lang (höchstens 80 Zeichen).')
if (/[<>:"/\\|?*\x00-\x1f%]/.test(name)) throw new Error('Diese Zeichen gehen nicht im Namen: < > : " / \\ | ? * %')
if (/[. ]$/.test(name) || name.startsWith('.')) throw new Error('Der Name darf nicht mit einem Punkt beginnen oder mit Punkt/Leerzeichen enden.')
if (RESERVED.test(name)) throw new Error(`„${name}“ ist unter Windows reserviert.`)
return name
}
function readMeta(dir) {
try { return JSON.parse(fs.readFileSync(path.join(dir, STATUS_FILE), 'utf-8')) } catch { return {} }
}
// opts: { rootPath, name, from (absolute project path or null), withGit, skipBuild, status }
async function create(opts) {
if (running) throw new Error(`Es wird gerade schon „${running}“ angelegt.`)
const name = checkName(opts.name)
const dest = path.join(opts.rootPath, name)
if (fs.existsSync(dest)) throw new Error(`Es gibt schon einen Ordner „${name}“ in ${opts.rootPath}.`)
running = name
try {
const now = new Date().toISOString()
if (!opts.from) {
fs.mkdirSync(dest)
fs.writeFileSync(path.join(dest, STATUS_FILE), JSON.stringify({ status: 'idea', priority: 'medium', notes: '', tags: [], tasks: [], updatedAt: now }, null, 2))
fs.writeFileSync(path.join(dest, 'README.md'), `# ${name}\n`)
return { name, path: dest, cloned: false }
}
const src = opts.from
if (dest.toLowerCase().startsWith(src.toLowerCase() + path.sep)) throw new Error('Der Klon darf nicht im Original liegen.')
const b = settings.get().backup
const xd = [...b.excludeDirs, ...(opts.skipBuild ? BUILD_DIRS : []), ...(opts.withGit ? [] : ['.git'])]
const r = await run('robocopy', [src, dest, '/E', '/XJ', '/R:1', '/W:1', '/COPY:DAT', '/DCOPY:T', '/MT:8', '/NJH', '/NJS', '/NP', '/NFL', '/NDL',
'/XD', ...xd, '/XF', ...b.excludeFiles], { timeout: 60 * 60 * 1000 })
// robocopy: 0-7 = success, 8+ = errors
if (r.code < 0 || r.code >= 8) throw new Error(`Kopieren fehlgeschlagen (robocopy ${r.code}). Der angefangene Ordner liegt in ${dest}.`)
if (!fs.existsSync(dest)) fs.mkdirSync(dest)
// the clone starts as a fresh idea: same tags/program/start, no itch link, open tasks only
const m = readMeta(src)
const tasks = Array.isArray(m.tasks) ? m.tasks.filter((t) => !t?.done) : []
const note = `Klon von „${path.basename(src)}“ (${now.slice(0, 10)}).`
fs.writeFileSync(path.join(dest, STATUS_FILE), JSON.stringify({
...m, status: 'idea', itch: '', tasks,
notes: m.notes ? `${note}\n\n${m.notes}` : note,
updatedAt: now,
}, null, 2))
return { name, path: dest, cloned: true }
} finally {
running = null
}
}
const busy = () => !!running
module.exports = { create, checkName, busy }

97
lib/git.js Normal file
View File

@@ -0,0 +1,97 @@
// Git and backup status of one project: branch, remote, uncommitted changes,
// commits not pushed, last commit. `level` drives the traffic light in the UI.
const fs = require('fs')
const path = require('path')
const { run } = require('./proc')
// Git is optional (a friend's PC may not have it): checked once.
let gitOk = null
async function gitAvailable() {
if (gitOk === null) gitOk = (await run('git', ['--version'])).ok
return gitOk
}
async function gitInfo(projectPath) {
if (!fs.existsSync(path.join(projectPath, '.git'))) {
return { isRepo: false, level: 'red', label: 'kein Git', lastCommit: null }
}
if (!(await gitAvailable())) {
return { isRepo: true, level: 'red', label: 'Git nicht installiert', remote: '', branch: '', upstream: '', ahead: 0, behind: 0, dirty: 0, lastCommit: null }
}
const [st, rem, log] = await Promise.all([
run('git', ['-C', projectPath, '-c', 'core.quotepath=off', 'status', '--porcelain=v2', '--branch'], { timeout: 8000 }),
run('git', ['-C', projectPath, 'remote', '-v']),
run('git', ['-C', projectPath, 'log', '-1', '--format=%ad|%s', '--date=short']),
])
let branch = '', upstream = '', ahead = 0, behind = 0, dirty = 0
for (const line of st.stdout.split('\n')) {
if (!line) continue
if (line.startsWith('# branch.head ')) branch = line.slice(14).trim()
else if (line.startsWith('# branch.upstream ')) upstream = line.slice(18).trim()
else if (line.startsWith('# branch.ab ')) {
const m = line.match(/\+(\d+) -(\d+)/)
if (m) { ahead = +m[1]; behind = +m[2] }
} else if (!line.startsWith('#')) dirty++
}
const remoteLine = rem.stdout.split('\n').find((l) => l.startsWith('origin\t')) ?? rem.stdout.split('\n').find(Boolean)
const remote = remoteLine ? remoteLine.split('\t')[1].replace(/\s+\((fetch|push)\)$/, '') : ''
let lastCommit = null
const out = log.stdout.trim()
if (out) {
const [date, ...msg] = out.split('|')
lastCommit = { date, message: msg.join('|') }
}
const parts = []
if (dirty) parts.push(`${dirty} geändert`)
if (ahead) parts.push(`${ahead} nicht gepusht`)
if (behind) parts.push(`${behind} hinterher`)
let level, label
if (!remote) { level = 'red'; label = ['kein Remote (nur lokal)', ...parts].join(' · ') }
else if (!upstream) { level = 'yellow'; label = ['kein Upstream', ...parts].join(' · ') }
else if (dirty || ahead) { level = 'yellow'; label = parts.join(' · ') }
else { level = 'green'; label = behind ? parts.join(' · ') : 'gesichert' }
return { isRepo: true, branch, upstream, remote, ahead, behind, dirty, level, label, lastCommit }
}
// Remote URL as typed in the Info tab: SSH (git@host:user/repo.git, ssh://...) or https.
// Never starts with "-", so it can't be taken for a git option.
const REMOTE_RE = /^(?:[\w.-]+@[\w.-]+:[\w./~-]+|ssh:\/\/[^\s"'`]+|https?:\/\/[^\s"'`]+|git:\/\/[^\s"'`]+)$/
// Sets (or with '' removes) the "origin" remote.
async function setRemote(projectPath, url) {
if (!(await gitAvailable())) throw new Error('Git ist nicht installiert.')
if (!fs.existsSync(path.join(projectPath, '.git'))) throw new Error('Kein Git-Repository – erst „Git einrichten“.')
const u = String(url ?? '').trim()
const has = (await run('git', ['-C', projectPath, 'remote'])).stdout.split(/\r?\n/).includes('origin')
if (!u) {
if (has) await run('git', ['-C', projectPath, 'remote', 'remove', 'origin'])
return
}
if (!REMOTE_RE.test(u)) throw new Error('Remote: z. B. git@github.com:name/projekt.git (SSH) oder https://github.com/name/projekt.git')
const r = await run('git', ['-C', projectPath, 'remote', has ? 'set-url' : 'add', 'origin', u])
if (!r.ok) throw new Error(r.stderr.trim() || 'git remote fehlgeschlagen')
}
// git init with branch "main" (no commit yet).
async function initRepo(projectPath) {
if (!(await gitAvailable())) throw new Error('Git ist nicht installiert.')
if (fs.existsSync(path.join(projectPath, '.git'))) throw new Error('Ist schon ein Git-Repository.')
const r = await run('git', ['init', '-b', 'main', projectPath])
if (!r.ok) throw new Error(r.stderr.trim() || 'git init fehlgeschlagen')
}
// The user's SSH public key (to paste into GitHub/GitLab), or null.
function sshKey() {
const dir = path.join(process.env.USERPROFILE || require('os').homedir(), '.ssh')
for (const n of ['id_ed25519.pub', 'id_ecdsa.pub', 'id_rsa.pub']) {
try { return { file: path.join(dir, n), key: fs.readFileSync(path.join(dir, n), 'utf-8').trim() } } catch {}
}
return null
}
module.exports = { gitInfo, setRemote, initRepo, sshKey }

70
lib/icons.js Normal file
View File

@@ -0,0 +1,70 @@
// Finds a real app icon in a project (Android launcher icon, .ico, icon.png, logo).
// Bounded breadth-first walk; results are cached because the list endpoint
// asks for every project.
const fs = require('fs')
const path = require('path')
const { SKIP } = require('./tech')
const EXTRA_SKIP = new Set(['Packages', 'test', 'tests', 'node_modules', 'PackageCache'])
const MAX_DEPTH = 8
const MAX_ENTRIES = 8000
const TTL_MS = 10 * 60 * 1000
const cache = new Map() // projectPath -> { result, at }
function score(rel, fileName) {
const lower = fileName.toLowerCase()
const ext = path.extname(lower)
if (!['.png', '.ico', '.webp', '.jpg', '.jpeg', '.svg'].includes(ext)) return -1
const base = path.basename(lower, ext)
const relL = rel.toLowerCase().replace(/\\/g, '/')
let s = -1
if (relL.includes('mipmap') && base.startsWith('ic_launcher')) {
s = 100
const m = relL.match(/mipmap-(x*)hdpi/)
if (m) s += m[1].length * 2
if (/foreground|background|monochrome/.test(base)) s -= 30
if (base.includes('round')) s -= 1
} else if (ext === '.ico') s = 85
else if (/^(app[_-]?icon|icon|appicon|launcher[_-]?icon|store[_-]?icon|favicon)([_-]?\d+)?$/.test(base) || /^(app[_-]?icon|icon)[_-]/.test(base)) s = 75
else if (/^logo([_-]|$)/.test(base)) s = 50
return s
}
function scan(projectPath) {
const queue = [{ dir: projectPath, depth: 0 }]
let seen = 0
let best = null
let bestScore = -1
while (queue.length) {
const { dir, depth } = queue.shift()
let entries
try { entries = fs.readdirSync(dir, { withFileTypes: true }) } catch { continue }
for (const e of entries) {
if (++seen > MAX_ENTRIES) return best
if (e.isDirectory()) {
if (depth < MAX_DEPTH && !e.name.startsWith('.') && !SKIP.has(e.name) && !EXTRA_SKIP.has(e.name)) {
queue.push({ dir: path.join(dir, e.name), depth: depth + 1 })
}
continue
}
if (!e.isFile()) continue
const s = score(path.relative(projectPath, dir), e.name)
if (s > bestScore) { bestScore = s; best = path.join(dir, e.name) }
}
}
return best
}
// -> absolute path of the icon, or null
function findIcon(projectPath) {
const c = cache.get(projectPath)
if (c && Date.now() - c.at < TTL_MS) return c.result
const result = scan(projectPath)
cache.set(projectPath, { result, at: Date.now() })
return result
}
function forget(projectPath) { cache.delete(projectPath) }
function clear() { cache.clear() }
module.exports = { findIcon, forget, clear }

91
lib/itch.js Normal file
View File

@@ -0,0 +1,91 @@
// itch.io: which projects are published. Reads the public profile page (settings
// "itchProfile", e.g. https://sn09.itch.io) - no API key, no login - and matches the
// game titles/links to project names. A project can override it in .dashboard.json:
// "itch": "" automatic (match by name)
// "itch": "<url>" this page (manual, also for games not listed on the profile)
// "itch": "-" not on itch.io (switch the automatic match off)
const settings = require('./settings')
const TTL_MS = 60 * 60 * 1000
const state = { profile: '', games: [], at: 0, error: null }
let pending = null
const norm = (s) => String(s).toLowerCase().replace(/[^a-z0-9]/g, '')
function profileUrl() {
return (settings.get().itchProfile ?? '').replace(/\/+$/, '')
}
// <a ... href="https://x.itch.io/slug" class="title game_link">Title</a>
function parse(html, profile) {
const games = []
const seen = new Set()
const re = /<a\b[^>]*\bclass="[^"]*\btitle game_link\b[^"]*"[^>]*>([^<]*)<\/a>/g
for (const m of html.matchAll(re)) {
const href = m[0].match(/\bhref="([^"]+)"/)?.[1]
if (!href || seen.has(href)) continue
seen.add(href)
const title = m[1].replace(/&amp;/g, '&').replace(/&#39;/g, "'").replace(/&quot;/g, '"').trim()
games.push({ title, url: href, slug: href.replace(profile + '/', '').replace(/\/.*$/, '') })
}
return games
}
async function refresh() {
const profile = profileUrl()
if (!profile) { Object.assign(state, { profile: '', games: [], at: Date.now(), error: null }); return state }
if (pending) return pending
pending = (async () => {
try {
const res = await fetch(profile + '/', { headers: { 'User-Agent': 'ProjectDashboard' }, signal: AbortSignal.timeout(10000) })
if (!res.ok) throw new Error(`itch.io antwortet ${res.status}`)
const games = parse(await res.text(), profile)
Object.assign(state, { profile, games, at: Date.now(), error: null })
} catch (e) {
// keep the last good list; retry after a few minutes instead of an hour
Object.assign(state, { profile, at: Date.now() - TTL_MS + 5 * 60 * 1000, error: String(e.message ?? e) })
} finally { pending = null }
return state
})()
return pending
}
// For the project list: fresh enough data, but never hold the page up for long.
async function ensure(maxWaitMs = 3000) {
if (state.profile !== profileUrl() || Date.now() - state.at > TTL_MS) {
const p = refresh()
if (!state.games.length) await Promise.race([p, new Promise((r) => setTimeout(r, maxWaitMs))])
}
return state
}
// Same name, or the itch title is the project name plus a short suffix
// ("DataOrganizer" -> "Data Organizer Ultra"). Not the other way round, so
// "CatMaus 2" does not take over "CatMaus".
function autoMatch(name) {
const pn = norm(name)
if (!pn) return null
return state.games.find((g) => norm(g.title) === pn || norm(g.slug) === pn)
?? state.games.find((g) => pn.length >= 5 && norm(g.title).startsWith(pn) && norm(g.title).length - pn.length <= 6)
?? null
}
// -> { url, title, source: 'manual' | 'auto' } or null (not published / switched off)
function forProject(name, manual) {
const m = (manual ?? '').trim()
if (m === '-') return null
if (/^https?:\/\//i.test(m)) {
const g = state.games.find((x) => x.url.replace(/\/+$/, '') === m.replace(/\/+$/, ''))
return { url: m, title: g?.title ?? '', source: 'manual' }
}
const g = autoMatch(name)
return g ? { url: g.url, title: g.title, source: 'auto' } : null
}
// Games on the profile that no project claims (to spot a missing manual link).
function unmatched(claimedUrls) {
const set = new Set(claimedUrls.map((u) => u.replace(/\/+$/, '')))
return state.games.filter((g) => !set.has(g.url.replace(/\/+$/, '')))
}
module.exports = { ensure, refresh, forProject, unmatched, state, parse }

81
lib/proc.js Normal file
View File

@@ -0,0 +1,81 @@
// Small process helpers: run a command and collect its output (never throws),
// run async work with limited concurrency, and open a visible console window.
const { execFile, spawn } = require('child_process')
const fs = require('fs')
const path = require('path')
const RUN_DIR = path.join(__dirname, '..', '.cache', 'run')
function run(cmd, args, opts = {}) {
return new Promise((resolve) => {
execFile(cmd, args, {
encoding: 'utf-8',
timeout: opts.timeout ?? 5000,
windowsHide: true,
maxBuffer: 64 * 1024 * 1024,
cwd: opts.cwd,
}, (err, stdout, stderr) => resolve({
ok: !err,
code: err ? (typeof err.code === 'number' ? err.code : -1) : 0,
stdout: stdout ?? '',
stderr: stderr ?? '',
}))
})
}
async function pool(items, size, fn) {
const out = new Array(items.length)
let next = 0
const workers = Array.from({ length: Math.min(size, items.length) }, async () => {
while (next < items.length) {
const i = next++
out[i] = await fn(items[i], i)
}
})
await Promise.all(workers)
return out
}
// Paths end up quoted inside a .cmd file ("cd /d "<cwd>""), so they must not
// contain quotes, % (variable expansion) or line breaks.
function assertSafe(s) {
if (/["%\r\n]/.test(s)) throw new Error(`unsupported character in: ${s}`)
}
// Opens a new, visible cmd window in `cwd` that runs `command` and stays open.
// The command is written into a small .cmd file, so no shell quoting through
// spawn is needed. `echo on` makes cmd print the command before it runs.
// Commands may contain quotes (call "x.bat", py "main.py"); a line break is
// refused, and % is doubled so file names with % stay literal – except for
// the user's own start command (raw), where %VAR% may be meant.
function openConsole(title, cwd, command, { raw = false } = {}) {
assertSafe(cwd)
if (/[\r\n]/.test(command)) throw new Error('Zeilenumbruch im Befehl')
if (!raw) command = command.replace(/%/g, '%%')
fs.mkdirSync(RUN_DIR, { recursive: true })
const slug = title.replace(/[^\w.-]+/g, '_').slice(0, 60)
const file = path.join(RUN_DIR, `${slug}.cmd`)
const safeTitle = title.replace(/[^\w .:-]+/g, ' ')
fs.writeFileSync(file, [
'@echo off',
`title ${safeTitle}`,
`cd /d "${cwd}"`,
'echo on',
command,
'',
].join('\r\n'))
spawn('cmd.exe', ['/c', `start "" cmd /k "${file}"`], {
windowsVerbatimArguments: true, detached: true, stdio: 'ignore',
}).unref()
}
// Starts a GUI program / opens a file with its default app, detached.
// A start error (file gone, no permission) must not crash the server: without an
// 'error' listener Node throws it as an uncaught exception.
function openDetached(exe, args = [], cwd) {
const child = spawn(exe, args, { detached: true, stdio: 'ignore', cwd })
child.on('error', (e) => console.error(`start failed: ${exe}: ${e.message}`))
child.unref()
}
module.exports = { run, pool, openConsole, openDetached, assertSafe }

284
lib/settings.js Normal file
View File

@@ -0,0 +1,284 @@
// User settings: which folder holds the projects and where backups go.
// Stored in <DATA>\settings.json. DATA is DASHBOARD_DATA (set by the portable
// exe: %LOCALAPPDATA%\ProjectDashboard\data) or, when run from source, the
// app's own .cache folder.
//
// Michi's setup (app inside <Projekte>\_Tools\ProjectDashboard) needs no
// settings file: the projects folder is two levels up and the backup settings
// come from <Projekte>\_Tools\Backup\backup-config.json, which is also kept in
// sync on save because backup-projekte.bat reads it.
const fs = require('fs')
const path = require('path')
const APP_DIR = path.join(__dirname, '..')
const DATA_DIR = process.env.DASHBOARD_DATA
? path.resolve(process.env.DASHBOARD_DATA)
: path.join(APP_DIR, '.cache', process.env.DASHBOARD_ROOT ? 'test' : '') // test instances never touch real data
const FILE = path.join(DATA_DIR, 'settings.json')
// ".bin": build output (e.g. tests\.bin) – WD MyCloud shares hide folders with that name, so it can't be backed up there anyway
const DEFAULT_EXCLUDE_DIRS = ['node_modules', '__pycache__', '.gradle', '.venv', 'venv', '.venv-tts', '.bin']
const DEFAULT_EXCLUDE_FILES = ['Thumbs.db', 'desktop.ini', '~$*']
// <X>\_Tools\ProjectDashboard → X
function devRoot() {
const parent = path.dirname(APP_DIR)
return path.basename(parent).toLowerCase() === '_tools' ? path.dirname(parent) : ''
}
const legacyBackupFile = (root) => (root ? path.join(root, '_Tools', 'Backup', 'backup-config.json') : '')
function readJson(file) {
// strip a BOM (PowerShell's "Out-File -Encoding utf8" writes one)
try { return JSON.parse(fs.readFileSync(file, 'utf-8').replace(/^/, '')) } catch { return null }
}
// short display name: "MYCLOUD-NESYFV" for \\MYCLOUD-NESYFV\..., "E: Backup" for E:\Backup
function targetName(t) {
const unc = t.match(/^\\\\([^\\]+)/)
if (unc) return unc[1]
const drive = t.match(/^([A-Za-z]:)/)
return drive ? `${drive[1]} ${path.basename(t)}`.trim() : path.basename(t)
}
const newId = () => Math.random().toString(36).slice(2, 10)
// one path (older settings / backup-config.json) -> target list
const targetsFrom = (p) => (p ? [{ id: 'main', name: targetName(p), path: p }] : [])
// Projects folders ("roots"): several can be registered, one is active at a time.
// Display name: folder name, "D:" for a drive root.
const rootName = (p) => path.basename(p) || p.replace(/[\\/]+$/, '')
const rootsFrom = (p) => (p ? [{ id: 'main', name: rootName(p), path: p }] : [])
const MAX_ROOTS = 30
const samePath = (a, b) => path.resolve(a).toLowerCase() === path.resolve(b).toLowerCase()
const inside = (child, parent) => path.resolve(child).toLowerCase().startsWith(path.resolve(parent).toLowerCase().replace(/[\\/]+$/, '') + path.sep)
function defaults() {
const root = process.env.DASHBOARD_ROOT ? path.resolve(process.env.DASHBOARD_ROOT) : devRoot()
const legacy = readJson(legacyBackupFile(root))
return {
roots: rootsFrom(root),
projectsRoot: root,
// public itch.io profile ("veröffentlicht" on the cards); Michi's setup knows his
itchProfile: devRoot() && !process.env.DASHBOARD_ROOT ? 'https://sn09.itch.io' : '',
backup: {
// several targets possible (NAS, USB disk, ...); each has its own backup state
targets: Array.isArray(legacy?.targets) ? legacy.targets : targetsFrom(legacy?.target ?? ''),
excludeDirs: legacy?.excludeDirs ?? DEFAULT_EXCLUDE_DIRS,
excludeFiles: legacy?.excludeFiles ?? DEFAULT_EXCLUDE_FILES,
},
}
}
let current = null
function load() {
const d = defaults()
const saved = process.env.DASHBOARD_ROOT && !process.env.DASHBOARD_DATA ? null : readJson(FILE)
const backup = { ...d.backup, ...(saved?.backup ?? {}) }
if (!Array.isArray(saved?.backup?.targets) && typeof saved?.backup?.target === 'string') backup.targets = targetsFrom(saved.backup.target)
delete backup.target
// older settings had one "projectsRoot"
let roots = Array.isArray(saved?.roots)
? saved.roots.filter((r) => r && typeof r.path === 'string' && r.path).map((r) => ({ id: String(r.id || newId()), name: String(r.name || rootName(r.path)), path: r.path }))
: typeof saved?.projectsRoot === 'string' ? rootsFrom(saved.projectsRoot) : d.roots
// an explicit DASHBOARD_ROOT always wins (tests)
if (process.env.DASHBOARD_ROOT) roots = [{ id: 'env', name: rootName(path.resolve(process.env.DASHBOARD_ROOT)), path: path.resolve(process.env.DASHBOARD_ROOT) }]
current = withActive({
roots,
activeRoots: Array.isArray(saved?.activeRoots) ? saved.activeRoots : [saved?.activeRoot],
itchProfile: typeof saved?.itchProfile === 'string' ? saved.itchProfile : d.itchProfile,
backup,
})
return current
}
// Several folders can be shown at once: activeRoots = the selected ids (in list
// order, at least one). activeRoot = the first of them, projectsRoot = its path.
function withActive(s) {
const want = new Set((s.activeRoots ?? [s.activeRoot]).filter(Boolean))
let active = s.roots.filter((r) => want.has(r.id))
if (!active.length && s.roots[0]) active = [s.roots[0]]
const { activeRoot: _, ...rest } = s
return { ...rest, activeRoots: active.map((r) => r.id), activeRoot: active[0]?.id ?? '', projectsRoot: active[0]?.path ?? '' }
}
// the selected folders [{ id, name, path }]
function activeRootList(s = get()) {
return s.roots.filter((r) => s.activeRoots.includes(r.id))
}
// What is written to settings.json (activeRoot/projectsRoot are derived, not stored).
function persist(next) {
const { projectsRoot, activeRoot, ...stored } = next
fs.mkdirSync(DATA_DIR, { recursive: true })
fs.writeFileSync(FILE, JSON.stringify(stored, null, 2))
}
// Backups of several projects folders share the targets: the first folder goes
// straight into the target (as before), the others into a subfolder - their path
// below the first folder if they lie inside it, else their folder name.
function backupSubdir(rootPath, s = get()) {
const first = s.roots[0]?.path
if (!first || !rootPath || samePath(rootPath, first)) return ''
if (inside(rootPath, first)) return path.relative(path.resolve(first), path.resolve(rootPath))
return rootName(path.resolve(rootPath)).replace(/[:\\/]/g, '') || 'Projekte'
}
function get() { return current ?? load() }
function isDir(p) {
try { return fs.statSync(p).isDirectory() } catch { return false }
}
function configured() {
const s = get()
return !!s.projectsRoot && isDir(s.projectsRoot)
}
const cleanList = (v, fallback) =>
Array.isArray(v) ? [...new Set(v.map((x) => String(x).trim()).filter(Boolean))].slice(0, 50) : fallback
// Validates and stores new settings. Throws with a German message on bad input.
function save(input) {
const s = get()
// path.resolve normalises ("D:\x\" → "D:\x") but keeps drive roots intact ("E:\")
const norm = (v) => (v.trim() ? path.resolve(v.trim().replace(/^"(.*)"$/, '$1')) : '')
let roots = s.roots
let activeRoots = Array.isArray(input.activeRoots) ? input.activeRoots.map(String)
: typeof input.activeRoot === 'string' ? [input.activeRoot] : s.activeRoots
let activeRoot = activeRoots[0] // only for the old single-folder form below
if (Array.isArray(input.roots)) {
const renamed = new Map()
roots = []
for (const r of input.roots.slice(0, MAX_ROOTS)) {
const p = typeof r?.path === 'string' ? norm(r.path) : ''
if (!p) continue
if (!isDir(p)) throw new Error(`Projektordner existiert nicht: ${p}`)
if (roots.some((x) => samePath(x.path, p))) throw new Error(`Projektordner doppelt: ${p}`)
const old = s.roots.find((x) => x.id === r.id)
roots.push({
id: old && samePath(old.path, p) ? old.id : newId(),
name: String(r.name ?? '').trim().slice(0, 40) || rootName(p),
path: p,
})
// a selected folder stays selected even if its path (and so its id) changed
if (r.id) renamed.set(String(r.id), roots.at(-1).id)
}
if (!roots.length) throw new Error('Mindestens ein Projektordner ist nötig.')
activeRoots = activeRoots.map((id) => renamed.get(id)).filter(Boolean)
} else if (typeof input.projectsRoot === 'string') {
// old single-folder form: replaces the active folder
const p = norm(input.projectsRoot)
if (!p || !isDir(p)) throw new Error('Der Projektordner existiert nicht.')
const i = Math.max(0, roots.findIndex((r) => r.id === activeRoot))
const existing = roots.find((r) => samePath(r.path, p))
if (existing) activeRoots = [existing.id]
else {
roots = roots.slice()
roots[i] = { id: newId(), name: rootName(p), path: p }
activeRoots = [roots[i].id]
}
}
const sel = withActive({ roots, activeRoots })
const projectsRoot = sel.projectsRoot
if (!projectsRoot || !isDir(projectsRoot)) throw new Error('Der Projektordner existiert nicht.')
let targets = s.backup.targets
if (Array.isArray(input.targets)) {
targets = []
const seen = new Set()
for (const t of input.targets.slice(0, 10)) {
const p = typeof t?.path === 'string' ? norm(t.path) : ''
if (!p) continue
const a = p.toLowerCase()
if (seen.has(a)) throw new Error(`Backup-Ziel doppelt: ${p}`)
seen.add(a)
if (fs.existsSync(p) && !isDir(p)) throw new Error(`Backup-Ziel ist eine Datei, kein Ordner: ${p}`)
if (!isDir(p) && !isDir(path.dirname(p))) throw new Error(`Backup-Ziel nicht erreichbar (Laufwerk/NAS angeschlossen?): ${p}`)
const old = s.backup.targets.find((x) => x.id === t.id)
targets.push({
// a changed path is a new target (its backup state starts fresh)
id: old && old.path.toLowerCase() === a ? old.id : newId(),
name: String(t.name ?? '').trim().slice(0, 40) || targetName(p),
path: p,
})
}
} else if (typeof input.backupTarget === 'string') {
targets = targetsFrom(norm(input.backupTarget)) // old single-target form
}
// checked for every save, so a newly added projects folder can't hold a backup target either
for (const t of targets) {
const clash = roots.find((r) => samePath(t.path, r.path) || inside(t.path, r.path) || inside(r.path, t.path))
if (clash) throw new Error(`Das Backup-Ziel darf nicht in einem Projektordner liegen (und keinen enthalten): ${t.path} ↔ ${clash.path}`)
}
let itchProfile = s.itchProfile ?? ''
if (typeof input.itchProfile === 'string') {
const v = input.itchProfile.trim().replace(/\/+$/, '')
// "sn09" or "sn09.itch.io" is enough
itchProfile = !v ? '' : /^https?:\/\//i.test(v) ? v : `https://${v.includes('.') ? v : `${v}.itch.io`}`
if (itchProfile && !/^https:\/\/[a-z0-9-]+\.itch\.io$/i.test(itchProfile)) throw new Error('itch.io-Profil: z. B. https://name.itch.io')
}
const next = withActive({
roots,
activeRoots: sel.activeRoots,
itchProfile,
backup: {
targets,
excludeDirs: cleanList(input.excludeDirs, s.backup.excludeDirs),
excludeFiles: cleanList(input.excludeFiles, s.backup.excludeFiles),
},
})
persist(next)
// keep backup-projekte.bat in sync where it exists (it backs up the first folder to the first target)
const legacy = legacyBackupFile(roots[0].path)
if (legacy && fs.existsSync(legacy)) {
fs.writeFileSync(legacy, JSON.stringify({ source: roots[0].path, target: targets[0]?.path ?? '', targets, excludeDirs: next.backup.excludeDirs, excludeFiles: next.backup.excludeFiles }, null, 2) + '\n')
}
current = next
return current
}
// Quick switch (dropdown next to the logo): which folders are shown (one id or a list).
function setActive(ids) {
const s = get()
const list = (Array.isArray(ids) ? ids : [ids]).map(String)
const sel = s.roots.filter((x) => list.includes(x.id))
if (!sel.length) throw new Error('Projektordner nicht gefunden.')
const gone = sel.find((r) => !isDir(r.path))
if (gone) throw new Error(`Projektordner nicht erreichbar: ${gone.path}`)
current = withActive({ ...s, activeRoots: sel.map((r) => r.id) })
persist(current)
return current
}
// Adds projects folders (dropdown "Ordner hinzufügen" / "Mehrere einlesen");
// folders already in the list are skipped. activate: show (only) the new ones.
function addRoots(paths, activate = false) {
const s = get()
const fresh = (Array.isArray(paths) ? paths : [])
.filter((p) => typeof p === 'string' && p.trim())
.filter((p, i, all) => !s.roots.some((r) => samePath(r.path, p)) && all.findIndex((q) => samePath(q, p)) === i)
if (!fresh.length) return { settings: s, added: [] }
const before = new Set(s.roots.map((r) => r.id))
const next = save({ roots: [...s.roots, ...fresh.map((p) => ({ id: '', name: '', path: p }))] })
const added = next.roots.filter((r) => !before.has(r.id))
return { settings: activate && added[0] ? setActive(added.map((r) => r.id)) : next, added }
}
// Direct subfolders of a folder (for "Mehrere einlesen"), with how many folders each holds.
function subfolders(dir) {
const p = typeof dir === 'string' && dir.trim() ? path.resolve(dir.trim().replace(/^"(.*)"$/, '$1')) : ''
if (!p || !isDir(p)) throw new Error('Ordner existiert nicht.')
const skip = new Set(['$recycle.bin', 'system volume information', 'recovery', 'config.msi', 'node_modules'])
const list = fs.readdirSync(p, { withFileTypes: true })
.filter((e) => e.isDirectory() && !e.name.startsWith('.') && !skip.has(e.name.toLowerCase()))
.map((e) => {
const full = path.join(p, e.name)
let count = 0
try { count = fs.readdirSync(full, { withFileTypes: true }).filter((x) => x.isDirectory() && !x.name.startsWith('.')).length } catch {}
return { name: e.name, path: full, count }
})
.sort((a, b) => a.name.localeCompare(b.name, 'de'))
return { path: p, folders: list.slice(0, 200) }
}
module.exports = { get, load, save, setActive, addRoots, activeRootList, subfolders, backupSubdir, configured, targetName, DATA_DIR, APP_DIR, DEFAULT_EXCLUDE_DIRS }

135
lib/storage.js Normal file
View File

@@ -0,0 +1,135 @@
// Disk usage and cleanup. Sizes are slow to measure, so scans run in the
// background and land in <DATA>\scan.json (per projects folder - several can
// be shown at once, see lib/settings.js). Which folders may be deleted is
// decided only by cleanup.ps1 (same safety rules as on the CLI): the one in
// <Projekte>\_Tools\Cleanup if it exists, else the copy shipped in tools\.
// A project is addressed by its projects folder (root) and folder name.
const fs = require('fs')
const path = require('path')
const { run, pool } = require('./proc')
const { DATA_DIR, APP_DIR } = require('./settings')
const CACHE_FILE = path.join(DATA_DIR, 'scan.json')
const ALL_TIERS = 'Cache,Release,Output'
let roots = [] // selected projects folders (paths)
let all = {} // root (lower case) -> { folder -> { at, sizeMB, candidates: [{Tier, MB, Skip, Path}], deletable: {Cache, Release, Output} } }
const state = { running: false, current: [], done: 0, total: 0, error: null }
const rootKey = (r) => (r ?? '').toLowerCase()
const shipped = path.join(APP_DIR, 'tools', 'cleanup.ps1')
const own = (root) => (root ? path.join(root, '_Tools', 'Cleanup', 'cleanup.ps1') : '')
function readAll(first) {
try {
const saved = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf-8'))
if (saved?.roots && typeof saved.roots === 'object') return saved.roots
// older formats: { root, projects } or the bare projects map of one folder
if (saved?.projects && typeof saved.root === 'string') return { [rootKey(saved.root)]: saved.projects }
if (saved && first) return { [rootKey(first)]: saved }
} catch {}
return {}
}
let known = [] // all registered projects folders (their _Tools\Cleanup can stand in)
// rootList: paths of the selected projects folders; registered: all of them
function init(rootList, registered = []) {
roots = (Array.isArray(rootList) ? rootList : [rootList]).filter(Boolean)
known = registered.filter(Boolean)
all = readAll(roots[0])
}
function save() {
fs.mkdirSync(DATA_DIR, { recursive: true })
fs.writeFileSync(CACHE_FILE, JSON.stringify({ roots: all }, null, 1))
}
function busy() { return state.running }
// cleanup.ps1 for a folder: its own, else one of another registered folder, else the shipped copy
function scriptFor(root) {
for (const s of [own(root), ...roots.map(own), ...known.map(own), shipped]) if (s && fs.existsSync(s)) return s
return null
}
function available() { return !!scriptFor(roots[0]) }
function psArgs(root, extra) {
return ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', scriptFor(root), '-Root', root, ...extra, '-Json']
}
function parseJson(stdout) {
const text = stdout.trim()
const start = text.search(/[[{]/)
if (start < 0) throw new Error('cleanup.ps1 gave no JSON')
return JSON.parse(text.slice(start))
}
async function dirSizeMB(dir) {
// robocopy /L only lists; fast and copes with long node_modules paths
const r = await run('robocopy', [dir, 'C:\\__nul__', '/L', '/S', '/NJH', '/BYTES', '/FP', '/NC', '/NDL', '/NFL', '/XJ', '/R:0', '/W:0'], { timeout: 10 * 60 * 1000 })
const line = r.stdout.split(/\r?\n/).find((l) => /^\s*Bytes\s*:/.test(l))
const m = line && line.match(/:\s*(\d+)/)
return m ? Math.round(+m[1] / 1048576) : null
}
async function scanProject(root, folder) {
const dir = path.join(root, folder)
const [sizeMB, cand] = await Promise.all([
dirSizeMB(dir),
scriptFor(root) ? run('powershell.exe', psArgs(root, ['-Project', folder, '-Tier', ALL_TIERS]), { timeout: 10 * 60 * 1000 }) : null,
])
const candidates = cand ? parseJson(cand.stdout) : []
const deletable = { Cache: 0, Release: 0, Output: 0 }
for (const c of candidates) if (!c.Skip) deletable[c.Tier] += c.MB
const d = (all[rootKey(root)] ??= {})
d[folder] = { at: new Date().toISOString(), sizeMB, candidates, deletable }
save()
return d[folder]
}
// Starts a background scan; returns immediately. items: [{ root, folder, key }]
function startScan(items) {
if (state.running) return false
Object.assign(state, { running: true, current: [], done: 0, total: items.length, error: null })
pool(items, 3, async (it) => {
const label = it.key ?? it.folder
state.current.push(label)
try { await scanProject(it.root, it.folder) } catch (e) { state.error = `${label}: ${e.message}` }
state.current = state.current.filter((n) => n !== label)
state.done++
}).finally(() => { state.running = false })
return true
}
// Deletes only the given paths (relative to the projects folder, as listed by
// the scan), then rescans the project. cleanup.ps1 checks every path again.
async function clean(root, folder, paths) {
const prefix = folder + path.sep
const only = paths.filter((p) => typeof p === 'string' && p.startsWith(prefix) && !p.includes('|'))
if (!only.length) throw new Error('nichts ausgewählt')
if (!scriptFor(root)) throw new Error('cleanup.ps1 nicht gefunden')
const r = await run('powershell.exe', psArgs(root, ['-Project', folder, '-Tier', ALL_TIERS, '-Only', only.join('|'), '-Apply']), { timeout: 30 * 60 * 1000 })
const result = parseJson(r.stdout)
await scanProject(root, folder)
return result
}
function get(root, folder) { return all[rootKey(root)]?.[folder] ?? null }
// items: [{ root, folder }]
function totals(items) {
let sizeMB = 0, cacheMB = 0, allMB = 0, scanned = 0
for (const it of items) {
const d = get(it.root, it.folder)
if (!d) continue
scanned++
sizeMB += d.sizeMB ?? 0
cacheMB += d.deletable.Cache
allMB += d.deletable.Cache + d.deletable.Release + d.deletable.Output
}
return { sizeMB, cacheMB, allMB, scanned }
}
module.exports = { init, startScan, clean, get, totals, state, available, busy }

320
lib/tech.js Normal file
View File

@@ -0,0 +1,320 @@
// Detects what a project is made of (Unity, Node, .NET, ...) from marker files
// and builds the list of start actions. Actions are always built here on the
// server; the browser only sends back an action id.
const fs = require('fs')
const path = require('path')
const SKIP = new Set([
'node_modules', '.git', 'dist', 'build', 'builds', 'out', 'bin', 'obj', 'target', 'venv', '.venv', 'env',
'__pycache__', '.gradle', '.idea', '.vscode', 'Library', 'Temp', 'Logs', 'output', '_archiv', '_Archiv',
'sprite-generator', 'Spritegenerator', 'sprite-gen', 'design-gen', '.expo', '.claude',
])
const NPM_SCRIPTS = ['dev', 'start', 'electron', 'android', 'web', 'build', 'preview', 'serve', 'tauri']
const PY_MAIN = ['main.py', 'app.py', 'run.py', 'game.py', 'server.py', 'gui.py']
const UNITY_EDITORS = 'C:\\Program Files\\Unity\\Hub\\Editor'
const UNITY_HUB = 'C:\\Program Files\\Unity Hub\\Unity Hub.exe'
function ls(dir) {
try { return fs.readdirSync(dir, { withFileTypes: true }) } catch { return [] }
}
function readJson(file) {
try { return JSON.parse(fs.readFileSync(file, 'utf-8')) } catch { return null }
}
// Looks at the project root and its direct subfolders (e.g. "DesktopAnt\DesktopAnt").
function detect(projectPath) {
const subdirs = ls(projectPath)
.filter((e) => e.isDirectory() && !e.name.startsWith('.') && !SKIP.has(e.name))
.map((e) => path.join(projectPath, e.name))
const found = []
for (const dir of [projectPath, ...subdirs]) {
const isRoot = dir === projectPath
const entries = ls(dir)
const names = new Set(entries.map((e) => e.name))
const files = entries.filter((e) => e.isFile()).map((e) => e.name)
const rel = path.relative(projectPath, dir)
const unity = names.has('Assets') && names.has('ProjectSettings')
if (unity) found.push({ type: 'unity', dir, rel })
if (names.has('package.json')) {
const pkg = readJson(path.join(dir, 'package.json')) ?? {}
const deps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) }
const flavor = deps.electron ? 'electron' : deps.expo ? 'expo' : deps['@capacitor/core'] ? 'capacitor' : deps.vite ? 'vite' : deps.react ? 'react' : null
found.push({
type: 'node', dir, rel, flavor,
scripts: Object.keys(pkg.scripts ?? {}),
scriptCmds: pkg.scripts ?? {},
needsInstall: Object.keys(deps).length > 0 && !names.has('node_modules'),
})
}
if (!unity) {
const sln = files.filter((f) => /\.sln$/i.test(f))
const proj = files.filter((f) => /\.(cs|fs|vb)proj$/i.test(f))
if (sln.length || proj.length) found.push({ type: 'dotnet', dir, rel, sln, proj })
}
if (names.has('pubspec.yaml')) found.push({ type: 'flutter', dir, rel })
if (['build.gradle', 'build.gradle.kts', 'settings.gradle', 'settings.gradle.kts'].some((n) => names.has(n))) {
found.push({ type: 'android', dir, rel, gradlew: names.has('gradlew.bat') })
}
if (names.has('CMakeLists.txt')) found.push({ type: 'cmake', dir, rel })
const ino = files.filter((f) => /\.ino$/i.test(f))
if (ino.length) found.push({ type: 'arduino', dir, rel, ino })
if (isRoot) {
const py = files.filter((f) => /\.py$/i.test(f))
if (py.length || names.has('requirements.txt') || names.has('pyproject.toml')) {
const venv = path.join(dir, '.venv', 'Scripts', 'python.exe')
found.push({ type: 'python', dir, rel, py, venv: fs.existsSync(venv) ? venv : null })
}
}
}
return found
}
const TYPE_LABEL = {
unity: 'Unity', node: 'Node', dotnet: '.NET', flutter: 'Flutter', android: 'Android',
cmake: 'C++/CMake', arduino: 'Arduino', python: 'Python', web: 'Web',
}
function summary(found) {
const labels = []
for (const f of found) {
const l = f.type === 'node' && f.flavor ? f.flavor[0].toUpperCase() + f.flavor.slice(1) : TYPE_LABEL[f.type]
if (!labels.includes(l)) labels.push(l)
}
return { types: labels, needsInstall: found.some((f) => f.type === 'node' && f.needsInstall) }
}
function unityEditor(dir) {
try {
const txt = fs.readFileSync(path.join(dir, 'ProjectSettings', 'ProjectVersion.txt'), 'utf-8')
const ver = txt.match(/m_EditorVersion:\s*(\S+)/)?.[1]
const exe = ver && path.join(UNITY_EDITORS, ver, 'Editor', 'Unity.exe')
return { ver, exe: exe && fs.existsSync(exe) ? exe : null }
} catch { return { ver: null, exe: null } }
}
// ── startable programs & scripts ─────────────────────────────────────────
// Folders that never hold the project's own program (tests, drivers, caches, ...)
const EXE_SKIP_DIRS = /^(node_modules|\.git|\.gradle|\.gradle-local|gradle|Library|Temp|Logs|obj|\.venv.*|venv|env|__pycache__|tests?|Tests|symbols|CMakeFiles|_deps|drivers?|_archiv|output|sprite-?generator|spritegenerator|sprite-?gen|design-?gen|\.expo|\.idea|\.vscode|\.cache|\.claude|android|ios|packages|Packages)$/i
// Helper executables that are not "the app"
const EXE_SKIP_NAMES = /^(unins.*|.*setup.*|.*install.*|.*redist.*|.*crash.?handler.*|createdump|butler|adb|aapt2?|ffmpeg|ffprobe|7za?|python.*|pythonw|node|npm|remove|remover|elevate|squirrel|update|dotnet|apphost|notification_helper|chrome_.*|.*\.vshost)$/i
// Programs that exist next to the real app but are not what you want to start first
const EXE_SECONDARY = /(server|helper|updater|console|cli|worker|daemon|service)$/i
const SCRIPT_SKIP = /^(gradlew|gradle|gen|ctlstisc)\.(bat|cmd)$/i
// Where a copy of an exe came from - better sources win when the same exe exists several times
function exeRank(rel) {
const r = rel.toLowerCase()
if (/(^|\\)publish[^\\]*\\/.test(r)) return 6
if (/(^|\\)release\\/.test(r) && !/\\bin\\/.test(r)) return 5
if (/(^|\\)(dist|builds?|spiel|game)\\/.test(r)) return 4
if (!r.includes('\\')) return 4 // next to the project
if (/\\bin\\release\\/.test(r) || /^bin\\release\\/.test(r)) return 3
if (/\\bin\\debug\\/.test(r) || /^bin\\debug\\/.test(r)) return 1
return 2
}
const norm = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, '')
function walkFiles(root, maxDepth, test) {
const out = []
const queue = [{ dir: root, depth: 0 }]
let seen = 0
while (queue.length) {
const { dir, depth } = queue.shift()
for (const e of ls(dir)) {
if (++seen > 20000) return out
if (e.isDirectory()) {
// "_name" subfolders hold vendored or archived stuff (_vbcable, _archiv, ...)
if (depth < maxDepth && !EXE_SKIP_DIRS.test(e.name) && !e.name.startsWith('_')) queue.push({ dir: path.join(dir, e.name), depth: depth + 1 })
} else if (e.isFile() && test(e.name)) out.push(path.join(dir, e.name))
}
}
return out
}
function ago(ms) {
const d = Math.floor((Date.now() - ms) / 86400000)
return d <= 0 ? 'heute' : d === 1 ? 'gestern' : d < 30 ? `vor ${d} T.` : d < 365 ? `vor ${Math.floor(d / 30)} Mon.` : `vor ${Math.floor(d / 365)} J.`
}
// The project's own programs: one entry per exe name (best copy), the one
// named like the project first, then newest.
function findPrograms(name, projectPath) {
const best = new Map()
for (const file of walkFiles(projectPath, 6, (n) => /\.exe$/i.test(n) && !EXE_SKIP_NAMES.test(n.replace(/\.exe$/i, '')))) {
const rel = path.relative(projectPath, file)
let mtime = 0
try { mtime = fs.statSync(file).mtimeMs } catch {}
const key = path.basename(file).toLowerCase()
const cand = { file, rel, mtime, rank: exeRank(rel) }
const cur = best.get(key)
if (!cur || cand.rank > cur.rank || (cand.rank === cur.rank && cand.mtime > cur.mtime)) best.set(key, cand)
}
const pn = norm(name)
return [...best.values()]
.map((c) => {
const en = norm(path.basename(c.file, path.extname(c.file)))
return { ...c, match: nameMatches(pn, en) ? 1 : 0, secondary: EXE_SECONDARY.test(en) ? 1 : 0 }
})
.sort((a, b) => (b.match - a.match) || (a.secondary - b.secondary) || (b.rank - a.rank) || (b.mtime - a.mtime))
.slice(0, 12)
}
// "TinyWold" (folder) should still match "TinyWorld.exe": contained, or a
// common start of at least 5 letters.
function nameMatches(projectNorm, exeNorm) {
if (!projectNorm || !exeNorm) return false
if (exeNorm.includes(projectNorm) || projectNorm.includes(exeNorm)) return true
let i = 0
while (i < projectNorm.length && i < exeNorm.length && projectNorm[i] === exeNorm[i]) i++
return i >= 5
}
// HTML pages that run by double-click: index.html up to 3 folders deep (game\index.html),
// any .html directly in a release folder (single-file builds) and a root page named like
// the project (Stammbaum\stammbaum.html). Pages that cannot run from file:// are left out:
// ES modules (Vite dev page and built dist - browsers block module scripts on file://) and
// absolute /paths. Those start via npm.
const HTML_SKIP_PARTS = /(^|\\)(public|src|docs?|archive|_?archiv|mockups?|templates?|backups?|old|alt|kopie|copy|bak|node_modules|coverage|test-results|playwright-report|cache|\.cache)(\\|$)/i
function findWebPages(name, projectPath) {
const out = []
const pn = norm(name)
for (const file of walkFiles(projectPath, 3, (n) => /\.html?$/i.test(n))) {
const rel = path.relative(projectPath, file)
const dir = path.dirname(rel)
const base = path.basename(file, path.extname(file))
const isIndex = /^index$/i.test(base)
const inRelease = /(^|\\)release$/i.test(dir)
const namedRoot = dir === '.' && nameMatches(pn, norm(base))
if (!isIndex && !inRelease && !namedRoot) continue
if (HTML_SKIP_PARTS.test(dir)) continue
let head = ''
try { head = fs.readFileSync(file, 'utf-8').slice(0, 200000) } catch { continue }
if (/<script[^>]+type=["']module["']/i.test(head) || /<script[^>]+src=["']\/(?!\/)/i.test(head) || /\/@vite\//.test(head)) continue
let mtime = 0
try { mtime = fs.statSync(file).mtimeMs } catch {}
const rank = inRelease ? 3 : /^(game|spiel|web|www|app|html)(\\|$)/i.test(dir) ? 2 : dir === '.' ? 1 : 0
out.push({ file, rel, mtime, rank })
}
// single-file release first, then game\index.html, then the root page
return out.sort((a, b) => (b.rank - a.rank) || (b.mtime - a.mtime)).slice(0, 6)
}
// How a file is started: exe directly, html/lnk with the default app, bat/cmd in a console.
function fileAction(id, label, file, projectPath, detail) {
const rel = path.relative(projectPath, file)
const ext = path.extname(file).toLowerCase()
const base = { id, label, group: 'Programm', rel, file, detail }
if (ext === '.exe') return { ...base, kind: 'exe', exe: file, args: [], cwd: path.dirname(file) }
if (ext === '.bat' || ext === '.cmd') return { ...base, kind: 'console', cwd: path.dirname(file), command: `call "${path.basename(file)}"` }
return { ...base, kind: 'open' }
}
// The program chosen in "Aktionen" (.dashboard.json "program", path inside the project)
function resolveProgram(projectPath, program) {
if (!program) return null
const file = path.resolve(projectPath, program)
if (!file.startsWith(projectPath + path.sep)) return null
return { file, exists: fs.existsSync(file) && fs.statSync(file).isFile() }
}
// .bat/.cmd in the project root and one level below (e.g. Spiel\3D-Ansicht.bat)
function findScripts(projectPath) {
return walkFiles(projectPath, 1, (n) => /\.(bat|cmd)$/i.test(n) && !SCRIPT_SKIP.test(n))
.map((file) => {
const base = path.basename(file)
const group = /^(build|publish|deploy|release|make|compile|pack)/i.test(base) ? 'Bauen'
: /(install|setup|einricht)/i.test(base) ? 'Einrichten' : 'Starten'
return { file, rel: path.relative(projectPath, file), base, group }
})
.slice(0, 12)
}
const where = (rel) => (rel ? ` (${rel})` : '')
// Every action: { id, label, group, kind, cwd, command | exe+args | file }
// kind: console = visible cmd window, exe = start program, open = default app, vscode
function actions(name, projectPath, found, meta, tools) {
const list = [
{ id: 'vscode', label: 'In VS Code öffnen', group: 'Öffnen', kind: 'vscode', cwd: projectPath },
{ id: 'explorer', label: 'Ordner im Explorer', group: 'Öffnen', kind: 'open', file: projectPath },
{ id: 'console', label: 'Konsole im Projekt', group: 'Öffnen', kind: 'console', cwd: projectPath, command: 'git status 2>nul' },
]
if (meta.start) list.push({ id: 'custom', label: `Eigener Start: ${meta.start}`, group: 'Starten', kind: 'console', cwd: projectPath, command: meta.start })
// the program chosen for ▶ comes first; a missing file stays visible so it can be fixed
const chosen = resolveProgram(projectPath, meta.program)
if (chosen?.exists) {
list.push(fileAction('program', path.basename(chosen.file, path.extname(chosen.file)), chosen.file, projectPath, `${path.relative(projectPath, chosen.file)} · für ▶ festgelegt`))
}
const chosenFile = chosen?.exists ? chosen.file.toLowerCase() : null
for (const f of found) {
const r = f.rel
switch (f.type) {
case 'node':
if (f.needsInstall) list.push({ id: `npm-install:${r}`, label: `npm install${where(r)}`, group: 'Einrichten', kind: 'console', cwd: f.dir, command: 'npm install' })
for (const s of NPM_SCRIPTS.filter((s) => f.scripts.includes(s))) {
// a Vite dev server alone opens nothing visible - let it open the browser;
// without node_modules the script would just fail, so install first
const vite = /^\s*vite(\s|$)(?!.*\bbuild\b)/.test(f.scriptCmds?.[s] ?? '') && !/--open/.test(f.scriptCmds?.[s] ?? '')
const cmd = `${f.needsInstall && s !== 'build' ? 'npm install && ' : ''}npm run ${s}${vite ? ' -- --open' : ''}`
list.push({ id: `npm:${r}:${s}`, label: `npm run ${s}${where(r)}${vite ? ' (Browser)' : ''}`, group: s === 'build' ? 'Bauen' : 'Starten', kind: 'console', cwd: f.dir, command: cmd })
}
break
case 'dotnet': {
const target = f.sln[0] ?? f.proj[0]
list.push({ id: `dotnet-build:${r}:${target}`, label: `dotnet build ${target}`, group: 'Bauen', kind: 'console', cwd: f.dir, command: `dotnet build "${target}"` })
for (const p of f.proj.slice(0, 4)) list.push({ id: `dotnet-run:${r}:${p}`, label: `dotnet run ${p}`, group: 'Starten', kind: 'console', cwd: f.dir, command: `dotnet run --project "${p}"` })
break
}
case 'flutter':
list.push({ id: `flutter:${r}`, label: `flutter run${where(r)}`, group: 'Starten', kind: 'console', cwd: f.dir, command: 'flutter pub get && flutter run' })
break
case 'android':
if (f.gradlew) list.push({ id: `gradle:${r}`, label: `Gradle assembleDebug${where(r)}`, group: 'Bauen', kind: 'console', cwd: f.dir, command: 'gradlew.bat assembleDebug' })
break
case 'unity': {
const ed = unityEditor(f.dir)
if (ed.exe) list.push({ id: `unity:${r}`, label: `In Unity ${ed.ver} öffnen${where(r)}`, group: 'Starten', kind: 'exe', exe: ed.exe, args: ['-projectPath', f.dir] })
else if (fs.existsSync(UNITY_HUB)) list.push({ id: `unity-hub:${r}`, label: `Unity Hub öffnen${ed.ver ? ` (braucht ${ed.ver})` : ''}`, group: 'Starten', kind: 'exe', exe: UNITY_HUB, args: [] })
break
}
case 'python': {
const main = PY_MAIN.find((m) => f.py.includes(m)) ?? f.py.find((p) => p.toLowerCase() === `${name.toLowerCase()}.py`) ?? (f.py.length === 1 ? f.py[0] : null)
if (main) {
const py = f.venv ? `"${f.venv}"` : 'py -3.12'
list.push({ id: `py:${main}`, label: `Python: ${main}${f.venv ? ' (.venv)' : ''}`, group: 'Starten', kind: 'console', cwd: f.dir, command: `${py} "${main}"` })
}
break
}
case 'arduino':
list.push({ id: `ino:${r}:${f.ino[0]}`, label: `Arduino: ${f.ino[0]}`, group: 'Starten', kind: 'open', file: path.join(f.dir, f.ino[0]) })
break
}
}
for (const p of findPrograms(name, projectPath)) {
if (p.file.toLowerCase() === chosenFile) continue
list.push({
id: `exe:${p.rel}`, label: path.basename(p.file, path.extname(p.file)), group: 'Programm', kind: 'exe',
exe: p.file, args: [], cwd: path.dirname(p.file), rel: p.rel,
detail: `${p.rel} · ${ago(p.mtime)}`,
})
}
for (const w of findWebPages(name, projectPath)) {
if (w.file.toLowerCase() === chosenFile) continue
const label = /^index\.html?$/i.test(path.basename(w.file)) ? `Web: ${path.dirname(w.rel) === '.' ? name : path.dirname(w.rel)}` : `Web: ${path.basename(w.file)}`
list.push(fileAction(`html:${w.rel}`, label, w.file, projectPath, `${w.rel} · ${ago(w.mtime)} · im Browser`))
}
for (const s of findScripts(projectPath)) {
list.push({
id: `bat:${s.rel}`, label: s.base, group: s.group, kind: 'console',
cwd: path.dirname(s.file), command: `call "${s.base}"`, detail: s.rel,
})
}
for (const g of tools.generators.filter((g) => g.kind === 'comfygen')) {
list.push({ id: `gen:${g.rel}`, label: `Generator-Konsole (${g.rel})`, group: 'Werkzeuge', kind: 'console', cwd: path.join(projectPath, g.rel), command: 'gen' })
}
return list
}
module.exports = { detect, summary, actions, resolveProgram, SKIP }

32
lib/tools.js Normal file
View File

@@ -0,0 +1,32 @@
// Which projects use the shared generator in _Tools\ComfyGen (via gen.cmd) and
// which still carry their own copy of generator scripts.
const fs = require('fs')
const path = require('path')
const GEN_DIR = /^(sprite-?generator|sprite-?gen|design-?gen|asset-?gen)$/i
function ls(dir) {
try { return fs.readdirSync(dir, { withFileTypes: true }) } catch { return [] }
}
function toolInfo(projectPath) {
const generators = []
const dirs = [projectPath, ...ls(projectPath).filter((e) => e.isDirectory() && !e.name.startsWith('.') && !/^(_archiv|node_modules)$/i.test(e.name)).map((e) => path.join(projectPath, e.name))]
for (const dir of dirs) {
for (const e of ls(dir)) {
if (!e.isDirectory() || !GEN_DIR.test(e.name)) continue
const gdir = path.join(dir, e.name)
const files = ls(gdir).filter((f) => f.isFile()).map((f) => f.name)
const shared = files.includes('gen.cmd')
generators.push({
rel: path.relative(projectPath, gdir),
kind: shared ? 'comfygen' : 'copy',
scripts: files.filter((f) => f.endsWith('.py')),
hasOutput: fs.existsSync(path.join(gdir, 'output')),
})
}
}
return { generators }
}
module.exports = { toolInfo }

835
package-lock.json generated Normal file
View File

@@ -0,0 +1,835 @@
{
"name": "project-dashboard",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "project-dashboard",
"version": "1.0.0",
"dependencies": {
"express": "^4.19.2",
"lucide-static": "1.58.0"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"license": "MIT",
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
"license": "MIT"
},
"node_modules/body-parser": {
"version": "1.20.6",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.6.tgz",
"integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "~1.2.0",
"http-errors": "~2.0.1",
"iconv-lite": "~0.4.24",
"on-finished": "~2.4.1",
"qs": "~6.15.1",
"raw-body": "~2.5.3",
"type-is": "~1.6.18",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
"license": "MIT"
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
"license": "MIT",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "4.22.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
"integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "~1.20.5",
"content-disposition": "~0.5.4",
"content-type": "~1.0.4",
"cookie": "~0.7.1",
"cookie-signature": "~1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.3.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.0",
"merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "~0.1.12",
"proxy-addr": "~2.0.7",
"qs": "~6.15.1",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "~0.19.0",
"serve-static": "~1.16.2",
"setprototypeof": "1.2.0",
"statuses": "~2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/finalhandler": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"statuses": "~2.0.2",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"license": "MIT",
"dependencies": {
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/lucide-static": {
"version": "1.58.0",
"resolved": "https://registry.npmjs.org/lucide-static/-/lucide-static-1.58.0.tgz",
"integrity": "sha512-VFE2ZEq3yEwjBH0El9CA9lHgDWKKXPKgKxFzX+/JN1FPa4maQbtl/pT4B62aJkUEpODT5octDsyGy7tPVE2svQ==",
"license": "ISC"
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/merge-descriptors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"license": "MIT",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"license": "MIT"
},
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
"license": "MIT"
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"license": "MIT",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.15.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
"integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
"license": "BSD-3-Clause",
"dependencies": {
"es-define-property": "^1.0.1",
"side-channel": "^1.1.1"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"http-errors": "~2.0.1",
"iconv-lite": "~0.4.24",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/send": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.1",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "~2.4.1",
"range-parser": "~1.2.1",
"statuses": "~2.0.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/serve-static": {
"version": "1.16.3",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
"license": "MIT",
"dependencies": {
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "~0.19.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
"node_modules/side-channel": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.4",
"side-channel-list": "^1.0.1",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.4"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"license": "MIT",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"license": "MIT",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
"license": "MIT",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
}
}
}

14
package.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "project-dashboard",
"version": "1.0.0",
"private": true,
"description": "Local Kanban dashboard for everything under D:\\Oculusquest\\Projekt",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.19.2",
"lucide-static": "1.58.0"
}
}

1712
public/app.js Normal file

File diff suppressed because it is too large Load Diff

770
public/index.html Normal file
View File

@@ -0,0 +1,770 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Projekte</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z'/%3E%3Cpath d='m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65'/%3E%3Cpath d='m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65'/%3E%3C/svg%3E">
<style>
:root {
--bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f2f7; --surface-3: #e7eaf1;
--text: #151823; --muted: #6b7183; --border: #e3e6ee; --border-strong: #cfd4df;
--accent: #6366f1; --accent-2: #8b5cf6; --accent-soft: #eef0ff; --accent-text: #4338ca;
--green: #16a34a; --green-soft: #dcfce7; --yellow: #d97706; --yellow-soft: #fef3c7;
--red: #dc2626; --red-soft: #fee2e2; --blue: #2563eb; --blue-soft: #dbeafe;
--violet: #7c3aed; --violet-soft: #ede9fe; --cyan: #0e7490; --cyan-soft: #e0f7fa;
--shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
--shadow-lg: 0 12px 32px rgba(16,24,40,.14);
--radius: 12px;
color-scheme: light;
}
:root[data-theme="dark"] {
--bg: #0e1016; --surface: #171a23; --surface-2: #1e222d; --surface-3: #272c39;
--text: #e8eaf1; --muted: #9097a8; --border: #2a2f3c; --border-strong: #3a4050;
--accent: #818cf8; --accent-2: #a78bfa; --accent-soft: #252a4a; --accent-text: #c7d2fe;
--green: #4ade80; --green-soft: #14321f; --yellow: #fbbf24; --yellow-soft: #3a2c0c;
--red: #f87171; --red-soft: #3b1717; --blue: #60a5fa; --blue-soft: #172a4a;
--violet: #a78bfa; --violet-soft: #2a1f47; --cyan: #67e8f9; --cyan-soft: #0f2e35;
--shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI Variable", "Segoe UI", -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font-family: inherit; color: inherit; }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: -3px; }
.i.sm { width: 13px; height: 13px; vertical-align: -2px; }
.i.lg { width: 20px; height: 20px; }
.i.xl { width: 26px; height: 26px; }
/* ── top bar ─────────────────────────────────────────────────────────── */
header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px rgba(99,102,241,.35); }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.brand .count { color: var(--muted); font-size: 12px; }
.rootpick { position: relative; }
#rootBtn { display: flex; align-items: center; gap: 5px; border: none; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 7px; cursor: pointer; max-width: 260px; }
#rootBtn h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rootBtn:hover, #rootBtn[aria-expanded="true"] { background: var(--surface-2); }
#rootBtn .i { color: var(--muted); }
.rootmenu { position: absolute; top: calc(100% + 6px); left: -6px; min-width: 280px; max-width: 420px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 30; }
.rootmenu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: none; background: none; padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.rootmenu button:hover, .rootmenu button:focus-visible { background: var(--surface-2); outline: none; }
.rootmenu button .rn { font-weight: 600; }
.rootmenu button .rp { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 330px; }
.rootmenu button .chk { width: 16px; color: var(--accent-text); }
.rootmenu button[aria-selected="true"] { background: var(--accent-soft); }
.rootmenu .rmrow { display: flex; align-items: stretch; gap: 2px; }
.rootmenu .rmrow [data-root] { flex: 1; min-width: 0; }
.rootmenu .rmbox { width: 34px; flex: 0 0 auto; justify-content: center; padding: 0; color: var(--muted); }
.rootmenu .rmbox[aria-checked="true"] { color: var(--accent-text); }
.rootmenu .rmbox .i { width: 16px; height: 16px; }
.rtag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; margin-left: 6px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.card .sub .rtag { margin-left: 0; }
.rootmenu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.seg { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; border: 1px solid var(--border); }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.searchbox { margin-left: auto; position: relative; }
.searchbox .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
#search { padding: 8px 12px 8px 32px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; width: 240px; background: var(--surface); outline: none; }
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg.theme button { padding: 6px 10px; }
@media (max-width: 1300px) { .seg.theme button span { display: none; } }
.iconbtn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { color: var(--text); border-color: var(--border-strong); }
.btn { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 5px 7px; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
/* ── KPI cards ──────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; padding: 16px 22px 4px; align-items: stretch; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); cursor: default; }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--accent); }
.kpi .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.kpi .val { font-size: 20px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi .lbl { font-size: 12px; color: var(--muted); }
.kpi.c-accent .ico { background: var(--accent-soft); color: var(--accent); }
.kpi.c-red .ico { background: var(--red-soft); color: var(--red); }
.kpi.c-blue .ico { background: var(--blue-soft); color: var(--blue); }
.kpi.c-yellow .ico { background: var(--yellow-soft); color: var(--yellow); }
.scanbox { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 190px; }
.progress { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.scanbox .sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
/* ── toolbar ─────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 22px 0; flex-wrap: wrap; }
.toolbar .sel { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 0 4px 0 10px; color: var(--muted); }
.toolbar select { border: none; background: transparent; padding: 7px 4px; font-size: 13px; outline: none; color: var(--text); cursor: pointer; }
.toolbar select option { background: var(--surface); }
.chipfilters { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.fchip:hover { color: var(--text); }
.fchip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.fchip .n { font-size: 11px; opacity: .8; }
main { padding: 14px 22px 40px; }
.view { display: none; }
.view.active { display: block; }
/* ── shared bits ─────────────────────────────────────────────────────── */
.avatar { position: relative; width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; background: var(--c); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
.avatar.lg { width: 52px; height: 52px; border-radius: 13px; font-size: 18px; }
.git { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.git.green { color: var(--green); } .git.yellow { color: var(--yellow); } .git.red { color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 500; }
.chip.tech { background: var(--cyan-soft); color: var(--cyan); }
.chip.neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.chip.warn { background: var(--yellow-soft); color: var(--yellow); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.tag { background: var(--accent-soft); color: var(--accent-text); }
/* itch.io published */
.chip.pub { background: #fa5c5c22; color: #e0454a; text-decoration: none; cursor: pointer; }
.chip.pub:hover { background: #fa5c5c3a; }
.tbadge.pub, .ri.pub { color: #e0454a; text-decoration: none; }
.st { font-size: 11px; padding: 2px 9px 2px 7px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.st.idea { background: var(--surface-2); color: var(--muted); }
.st.active { background: var(--green-soft); color: var(--green); }
.st.paused { background: var(--yellow-soft); color: var(--yellow); }
.st.done { background: var(--blue-soft); color: var(--blue); }
.st.archived { background: var(--violet-soft); color: var(--violet); }
.prio { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.prio.high { color: var(--red); }
.empty { color: var(--muted); font-size: 13px; padding: 24px; text-align: center; }
/* ── board ───────────────────────────────────────────────────────────── */
#board.active { display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; align-items: start; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; min-height: 140px; transition: background .15s, border-color .15s; }
.column.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.column h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 2px 4px 10px; display: flex; align-items: center; gap: 7px; }
.column h2 .n { margin-left: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 11px; color: var(--text); }
.column h2 .bar { width: 4px; height: 14px; border-radius: 3px; background: var(--c); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); transition: border-color .12s, transform .12s, box-shadow .12s; }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card.dragging { opacity: .45; }
.card .head { display: flex; gap: 10px; align-items: center; }
.card .name { font-weight: 650; font-size: 14px; word-break: break-word; line-height: 1.25; }
.card .sub { font-size: 11px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.card .row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; gap: 6px; }
.card .commit { font-size: 11px; color: var(--muted); margin-top: 7px; display: flex; gap: 5px; align-items: flex-start; }
.card .commit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .chips { margin-top: 8px; }
.card .notes { font-size: 12px; color: var(--muted); margin-top: 8px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.taskbar { margin-top: 9px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.taskbar .bar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.taskbar .bar > div { height: 100%; background: var(--green); }
/* ── gallery ─────────────────────────────────────────────────────────── */
#galleryGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s, border-color .12s, box-shadow .12s; position: relative; display: flex; flex-direction: column; }
.tile:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.tile .thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; position: relative; background: var(--c); }
.tile .thumb .ini { font-size: 44px; font-weight: 800; color: rgba(255,255,255,.95); letter-spacing: .02em; }
.tile .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 14%; background: radial-gradient(circle at 50% 40%, var(--surface), var(--surface-2)); }
.tile .thumb img.photo { object-fit: cover; padding: 0; }
.tile .st { position: absolute; top: 10px; left: 10px; box-shadow: var(--shadow); }
/* top-right badges on tiles: MyCloud backup (hard drive) + git (cloud) */
.tile .tbadges { position: absolute; top: 9px; right: 9px; display: flex; gap: 5px; }
.tile .tbadge { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.tbadge.green { color: var(--green); } .tbadge.yellow { color: var(--yellow); } .tbadge.red { color: var(--red); }
/* MyCloud chip on cards and in the list */
.bk { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; white-space: nowrap; flex: 0 0 auto; }
.bk.green { color: var(--green); } .bk.yellow { color: var(--yellow); } .bk.red { color: var(--red); }
.card .row2 .bk { margin-left: auto; }
.tile .info { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.tile .name { font-size: 14px; font-weight: 650; word-break: break-word; line-height: 1.25; }
.tile .ghead { display: flex; align-items: flex-start; gap: 8px; }
.tile .ghead { align-items: center; }
.tile .ghead .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; }
.tile .meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; margin-top: auto; }
/* ── list ────────────────────────────────────────────────────────────── */
.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: auto; box-shadow: var(--shadow); }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; cursor: pointer; user-select: none; white-space: nowrap; }
table.list th:hover { color: var(--text); }
table.list th.num, table.list td.num { text-align: right; }
table.list td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--surface-2); }
table.list .nm { display: flex; align-items: center; gap: 10px; font-weight: 600; }
table.list .avatar { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
table.list .acts { display: flex; gap: 2px; justify-content: flex-end; }
.bigval { font-variant-numeric: tabular-nums; }
.clean-val { color: var(--yellow); font-weight: 600; }
/* ── drawer (editor) ────────────────────────────────────────────────── */
#overlay { position: fixed; inset: 0; background: rgba(10,12,20,.45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
#overlay.open { opacity: 1; pointer-events: auto; }
#panel { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease; z-index: 21; display: flex; flex-direction: column; }
#panel.open { transform: none; }
.phead { padding: 18px 20px 0; display: flex; gap: 14px; align-items: center; }
.phead h3 { margin: 0; font-size: 18px; word-break: break-word; }
.phead .sub { margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.phead .close { margin-left: auto; align-self: flex-start; }
.pquick { display: flex; gap: 6px; padding: 12px 20px 0; flex-wrap: wrap; }
#ptabs { margin: 14px 20px 0; }
#ptabs button { flex: 1; justify-content: center; }
.pbody { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.pfoot { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.pfoot .btn { flex: 1; justify-content: center; padding: 9px; font-weight: 600; }
.psec { display: none; } .psec.active { display: block; }
.field label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 14px 0 5px; font-weight: 500; }
.field select, .field textarea, .field input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface); outline: none; }
.field select:focus, .field textarea:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { min-height: 80px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
#taskList { margin: 4px 0 0; padding: 0; list-style: none; }
#taskList li { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 13px; }
#taskList li.done span { text-decoration: line-through; color: var(--muted); }
#taskList li span { flex: 1; word-break: break-word; }
#taskList input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
#taskAddRow { display: flex; gap: 8px; margin-top: 8px; }
#taskAddRow input { flex: 1; }
.card-sec { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.card-sec h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.card-sec h4 .i { color: var(--accent); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv > div { word-break: break-word; }
.actgroup { display: flex; flex-wrap: wrap; gap: 7px; }
.cand { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.cand td { padding: 6px 4px; border-top: 1px solid var(--border); }
.cand td.mb { text-align: right; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.cand input { accent-color: var(--red); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
code.cmd { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 12px; margin-top: 6px; word-break: break-all; user-select: all; font-family: Consolas, monospace; }
.iconprev { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); vertical-align: middle; margin-right: 6px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 10px); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 30; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
/* ── fit-to-window layout ────────────────────────────────────────────
The page itself never scrolls: header, KPIs and toolbar stay fixed,
<main> takes the remaining height, and only the content inside it
(board columns, gallery, list) scrolls – vertically, never sideways. */
html, body { height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; }
header { position: static; flex: 0 0 auto; }
.kpis, .toolbar { flex: 0 0 auto; }
.kpis { padding: 12px 22px 0; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(150px, auto); container-type: inline-size; }
.kpi { padding: 9px 12px; gap: 10px; min-width: 0; }
.kpi > div:last-child { min-width: 0; }
.kpi .ico { width: 34px; height: 34px; }
.kpi .val { font-size: 18px; }
.kpi .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scanbox { min-width: 150px; }
.toolbar { padding: 10px 22px 0; }
main { flex: 1 1 auto; min-height: 0; padding: 10px 22px 14px; overflow: hidden; container-type: inline-size; container-name: main; }
.view.active { height: 100%; }
#gallery.active { overflow-y: auto; overflow-x: hidden; padding: 2px 4px 8px 2px; }
#list.active .tablewrap { max-height: 100%; overflow-y: auto; overflow-x: hidden; }
#board.active { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; overflow: hidden; align-items: stretch; }
.column { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 8px; container-type: inline-size; }
.column h2 { flex: 0 0 auto; }
.column .cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 2px 2px 0; margin-right: -4px; padding-right: 4px; }
.card { min-width: 0; }
.card .head > div:not(.avatar) { flex: 1 1 auto; }
.avatar { flex: 0 0 auto; }
.card .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .row2 { min-width: 0; }
.git { min-width: 0; max-width: 100%; }
.git .gl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card .git { flex: 1 1 auto; }
/* toolbar stays one row: chips drop their labels first */
.toolbar { flex-wrap: nowrap; container-type: inline-size; container-name: toolbar; }
.chipfilters { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
.toolbar .sel { flex: 0 0 auto; }
@container toolbar (max-width: 1050px) { .fchip:not(.active) .fl { display: none; } .fchip { padding: 5px 9px; } }
@container toolbar (max-width: 700px) { .fchip .fl { display: none; } }
/* narrow columns → compact cards */
@container (max-width: 250px) {
.card { padding: 9px 10px; }
.card .commit, .card .notes { display: none; }
.card .head { gap: 8px; }
.card .avatar { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
.card .name { font-size: 13px; }
.card .sub span:last-child { display: none; }
.card .chip { font-size: 10px; padding: 1px 6px; }
.card .row2 { margin-top: 7px; }
.column h2 { font-size: 11px; letter-spacing: .03em; }
}
@container (max-width: 190px) {
.card .chip.neutral, .card .chip.tag { display: none; }
.card .git { font-size: 11px; }
}
/* KPIs: shrink instead of wrapping into more rows */
@container (max-width: 980px) { .kpi .ico { display: none; } .kpi .val { font-size: 16px; } }
@container (max-width: 720px) { .kpi .lbl { font-size: 11px; } .scanbox .sub { display: none; } }
/* list: drop less important columns instead of scrolling sideways */
table.list td, table.list th { white-space: nowrap; }
table.list .nm span { overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: inline-block; vertical-align: middle; }
@container main (max-width: 1350px) { table.list .c-act { display: none; } }
@container main (max-width: 1180px) { table.list .c-tech { display: none; } table.list .nm span { max-width: 180px; } }
@container main (max-width: 900px) { table.list .c-clean, table.list .c-status { display: none; } }
/* top bar stays one row: extra texts go first, then tab labels */
.topbar { flex-wrap: nowrap; }
.topbar > * { flex-shrink: 0; }
.searchbox { flex: 1 1 240px; max-width: 280px; min-width: 110px; margin-left: auto; }
#search { width: 100%; }
.seg#tabs button .tl { white-space: nowrap; }
@media (max-width: 1350px) { .brand .count { display: none; } #btnBackup .bsub { display: none; } }
@media (max-width: 1180px) { .seg#tabs button .tl { display: none; } .seg#tabs button { padding: 6px 10px; } }
@media (max-width: 760px) { #btnBackup span:not(.bsub):not(.tabn) { display: none; } .brand h1 { display: none; } }
/* ── board: compact row mode ────────────────────────────────────────── */
#boardMode { flex: 0 0 auto; }
#boardMode button { padding: 5px 10px; font-size: 12px; }
@container toolbar (max-width: 900px) { #boardMode .bm-l { display: none; } }
.card.row { padding: 6px 8px; margin-bottom: 4px; border-radius: 9px; }
.card.row:hover { transform: none; box-shadow: var(--shadow); }
.card.row .rhead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card.row .avatar { width: 26px; height: 26px; border-radius: 7px; font-size: 10px; }
.card.row .name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.row .ricons { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.card.row .ricons .ri { display: inline-flex; align-items: center; gap: 2px; }
.card.row .ricons .ri.green { color: var(--green); } .card.row .ricons .ri.yellow { color: var(--yellow); } .card.row .ricons .ri.red { color: var(--red); }
.card.row .prio-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--border-strong); }
.card.row .prio-dot.high { background: var(--red); } .card.row .prio-dot.low { background: transparent; border: 1px solid var(--border-strong); }
.card.row .qs { width: 24px; height: 24px; border-radius: 7px; margin-left: 0; }
.card.row .qs .i { width: 12px; height: 12px; }
.card.row .qs-ph { width: 24px; flex: 0 0 auto; } /* keeps the icons aligned when there is no ▶ */
.card.row .avatar { width: 30px; height: 30px; }
.card.row .rmain { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.card.row .rsub { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.card.row .rsub > span { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.card.row .rsub .ri.green { color: var(--green); } .card.row .rsub .ri.yellow { color: var(--yellow); } .card.row .rsub .ri.red { color: var(--red); }
.card.row .rsub .ds { display: none; }
/* narrower columns: first drop the small icons, then the year, then the size */
@container (max-width: 275px) { .card.row .rsub .rsize > .i, .card.row .rsub .rdate > .i { display: none; } .card.row .rsub { gap: 7px; } }
@container (max-width: 235px) { .card.row .rsub .dl { display: none; } .card.row .rsub .ds { display: inline; } }
@container (max-width: 190px) { .card.row .rsub .rsize { display: none; } }
/* size + last change on cards */
.card .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 7px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .facts span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.card .row2 { margin-top: 6px; }
@container (max-width: 210px) { .card.row .ricons .tasks { display: none; } }
@container (max-width: 170px) { .card.row .avatar { display: none; } }
/* ── quick start ▶ ──────────────────────────────────────────────────── */
.qs { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--accent); display: grid; place-items: center; cursor: pointer; margin-left: auto; transition: background .12s, color .12s, border-color .12s; }
.qs:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.qs.cmd { color: var(--muted); }
.qs.cmd:hover { color: #fff; }
.qs .i { width: 14px; height: 14px; }
/* corner group on cards/rows: [VS Code] [▶] */
.qsg { flex: 0 0 auto; margin-left: auto; display: flex; align-items: center; gap: 4px; }
.qsg .qs { margin-left: 0; }
.qs.vs { color: var(--muted); }
.qs.vs:hover { color: #fff; }
@container (max-width: 190px) { .card .qs { width: 26px; height: 26px; } }
table.list .acts .btn.play { color: var(--accent); }
/* ── tasks view ─────────────────────────────────────────────────────── */
.tabn { font-size: 10px; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 2px; line-height: 16px; }
.tabn:empty { display: none; }
#tasks.active { display: flex; flex-direction: column; gap: 10px; }
.taskbarTop { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; flex-wrap: wrap; }
.taskadd { display: flex; gap: 6px; flex: 1 1 420px; min-width: 0; }
.taskadd select, .taskadd input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface); outline: none; min-width: 0; }
.taskadd select { flex: 0 1 220px; }
.taskadd input { flex: 1 1 auto; }
.taskadd input:focus, .taskadd select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#taskGroups { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; columns: 340px; column-gap: 12px; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
#taskGroups.isEmpty { columns: auto; display: grid; place-items: center; }
#taskGroups.isEmpty .empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tgroup { break-inside: avoid; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; box-shadow: var(--shadow); }
.tgroup .tg-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; cursor: pointer; }
.tgroup .tg-head .avatar { width: 28px; height: 28px; border-radius: 7px; font-size: 11px; }
.tgroup .tg-head b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tgroup .tg-head .cnt { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tgroup .progress { margin: 0 0 6px; height: 4px; }
.tgroup .progress > div { background: var(--green); }
.titem { display: flex; align-items: flex-start; gap: 8px; padding: 6px 2px; border-top: 1px solid var(--border); font-size: 13px; }
.titem input[type=checkbox] { accent-color: var(--green); width: 15px; height: 15px; margin-top: 2px; flex: 0 0 auto; cursor: pointer; }
.titem span { flex: 1; word-break: break-word; }
.titem.done span { text-decoration: line-through; color: var(--muted); }
.titem .del { opacity: 0; border: none; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.titem:hover .del { opacity: 1; }
.titem .del:hover { color: var(--red); }
.tg-add { display: flex; gap: 6px; margin-top: 6px; }
.tg-add input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px dashed var(--border-strong); border-radius: 7px; font-size: 12px; background: transparent; outline: none; }
.tg-add input:focus { border-style: solid; border-color: var(--accent); background: var(--surface); }
/* ── program start buttons (Aktionen) ───────────────────────────────── */
.progs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.prog { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-width: 0; transition: border-color .12s, box-shadow .12s, transform .12s; }
.prog:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.prog .pico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent); }
.prog.first .pico { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.prog .ptxt { display: flex; flex-direction: column; min-width: 0; }
.prog .ptxt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog .ptxt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progwrap { position: relative; display: flex; min-width: 0; }
.progwrap .prog { flex: 1; padding-right: 36px; }
.progwrap .pin { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; opacity: .55; }
.progwrap:hover .pin, .progwrap .pin.on { opacity: 1; }
.progwrap .pin:hover { border-color: var(--border); background: var(--surface-2, var(--surface)); color: var(--accent); }
.progwrap .pin.on { color: var(--accent); background: var(--accent-soft); }
.progset { margin-top: 12px; }
.progset label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hint.warn { color: var(--danger, #c0392b); margin-top: 8px; }
/* ── settings panel ─────────────────────────────────────────────────── */
#spanel { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease; z-index: 22; display: flex; flex-direction: column; }
#spanel.open { transform: none; }
#spanel.setup #btnCloseSettings, #spanel.setup #spCancel { display: none; }
.pickrow { display: flex; gap: 6px; }
.pickrow input { flex: 1; min-width: 0; }
.pickrow .btn { flex: 0 0 auto; }
body.no-picker .pickbtn { display: none; }
.trow { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.trow input { min-width: 0; }
body.no-picker .trow { grid-template-columns: 130px minmax(0, 1fr) auto; }
.dlg { border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; width: 480px; max-width: calc(100vw - 32px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dlg::backdrop { background: rgba(15, 23, 42, .45); }
.dlg select, .dlg > form > input[type=text] { width: 100%; }
.dlg label.chk { color: var(--text); font-weight: 400; font-size: 13px; margin: 8px 0 0; }
.dlg .hint { margin-top: 8px; }
body.no-picker #rdPick { display: none; }
.dlgfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.rrow { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto auto auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.rrow input { min-width: 0; }
body.no-picker .rrow { grid-template-columns: 130px minmax(0, 1fr) auto auto; }
.rrow.active .tname { border-color: var(--accent); }
.rowbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.importbox { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-top: 8px; background: var(--surface-2); }
.importbox[hidden] { display: none; }
.implist { max-height: 240px; overflow: auto; margin: 8px 0; display: grid; gap: 2px; }
.implist label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 6px; border-radius: 6px; font-size: 13px; color: var(--text); font-weight: 400; cursor: pointer; }
.implist label:hover { background: var(--surface); }
.implist .n { color: var(--muted); font-size: 11px; margin-left: auto; }
.implist label.dis { opacity: .5; cursor: default; }
#fAddTarget { margin-top: 2px; }
.ttabs { display: inline-flex; flex-wrap: wrap; margin: 12px 0 2px; }
.ttabs button:disabled { opacity: .45; cursor: default; }
.tlast { display: flex; flex-wrap: wrap; gap: 6px; }
.tlast .bk { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
/* ── backup panel ───────────────────────────────────────────────────── */
#bpanel { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease; z-index: 21; display: flex; flex-direction: column; }
#bpanel.open { transform: none; }
#bpanel .pbody { padding-top: 6px; }
#btnBackup .bsub { font-size: 11px; color: var(--muted); font-weight: 400; }
#btnBackup .bsub.warn { color: var(--yellow); }
.bstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bstat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; min-width: 0; }
.bstat .v { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.bstat .l { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.bstat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bstat.new .v { color: var(--accent); } .bstat.chg .v { color: var(--yellow); }
.btn.big { padding: 11px 16px; font-size: 14px; font-weight: 600; width: 100%; justify-content: center; }
.bactions { display: flex; gap: 8px; margin-top: 14px; }
.bactions .btn { flex: 1; justify-content: center; }
.bproj { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.bproj td { padding: 5px 4px; border-top: 1px solid var(--border); }
.bproj td.r { text-align: right; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress.big { height: 9px; margin: 10px 0 6px; }
.curfile { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: Consolas, monospace; }
.msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-top: 14px; }
.msg.ok { background: var(--green-soft); color: var(--green); }
.msg.err { background: var(--red-soft); color: var(--red); }
.msg.info { background: var(--accent-soft); color: var(--accent-text); }
@media (max-width: 1100px) { #btnBackup .bsub { display: none; } }
/* thin scrollbars inside the content areas */
.column .cards, #gallery, .tablewrap, .pbody { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
@media (max-width: 640px) {
.topbar, .kpis, .toolbar, main { padding-left: 12px; padding-right: 12px; }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scanbox { grid-column: span 2; }
}
</style>
</head>
<body>
<header>
<div class="topbar">
<div class="brand">
<div class="logo"><svg class="i lg"><use href="/icons.svg#layers"/></svg></div>
<div class="rootpick">
<button type="button" id="rootBtn" aria-haspopup="listbox" aria-expanded="false" title="Projektordner wechseln">
<h1 id="rootName">Projekte</h1><svg class="i sm"><use href="/icons.svg#chevron-down"/></svg>
</button>
<div class="count" id="count"></div>
<div class="rootmenu" id="rootMenu" role="listbox" hidden></div>
</div>
</div>
<div class="seg" id="tabs">
<button data-view="board" class="active" title="Board"><svg class="i"><use href="/icons.svg#kanban"/></svg><span class="tl">Board</span></button>
<button data-view="gallery" title="Galerie"><svg class="i"><use href="/icons.svg#layout-grid"/></svg><span class="tl">Galerie</span></button>
<button data-view="list" title="Liste"><svg class="i"><use href="/icons.svg#list"/></svg><span class="tl">Liste</span></button>
<button data-view="tasks" title="Aufgaben"><svg class="i"><use href="/icons.svg#list-checks"/></svg><span class="tl">Aufgaben</span><span class="tabn" id="taskCount"></span></button>
</div>
<div class="searchbox">
<svg class="i"><use href="/icons.svg#search"/></svg>
<input id="search" type="text" placeholder="Projekte, Tags, Notizen…">
</div>
<button class="btn" id="btnNew" title="Neues Projekt anlegen oder ein vorhandenes klonen"><svg class="i"><use href="/icons.svg#plus"/></svg><span>Neu</span></button>
<button class="btn" id="btnBackup" title="Alle Projekte auf die MyCloud sichern"><svg class="i"><use href="/icons.svg#hard-drive-upload"/></svg><span>Backup</span><span class="bsub" id="backupSub"></span></button>
<button class="iconbtn" id="btnSettings" title="Einstellungen: Projektordner und Backup-Ziel"><svg class="i"><use href="/icons.svg#settings"/></svg></button>
<div class="seg theme" id="themeSeg" title="Darstellung">
<button data-mode="light" title="Hell"><svg class="i"><use href="/icons.svg#sun"/></svg><span>Hell</span></button>
<button data-mode="system" title="Wie Windows"><svg class="i"><use href="/icons.svg#monitor"/></svg><span>System</span></button>
<button data-mode="dark" title="Dunkel"><svg class="i"><use href="/icons.svg#moon"/></svg><span>Dunkel</span></button>
</div>
</div>
</header>
<section class="kpis" id="kpis"></section>
<div class="toolbar">
<div class="chipfilters" id="chipfilters"></div>
<div style="flex:1"></div>
<div class="seg" id="boardMode" title="Darstellung im Board">
<button data-mode="cards" class="active" title="Karten mit Details"><svg class="i sm"><use href="/icons.svg#layout-dashboard"/></svg><span class="bm-l">Karten</span></button>
<button data-mode="rows" title="Kompakte Liste – eine Zeile pro Projekt"><svg class="i sm"><use href="/icons.svg#rows-3"/></svg><span class="bm-l">Liste</span></button>
</div>
<div class="sel" id="selStatusWrap"><svg class="i sm"><use href="/icons.svg#funnel"/></svg>
<select id="fltStatus">
<option value="all">Alle Status</option>
<option value="idea">Idee</option>
<option value="active">Aktiv</option>
<option value="paused">Pausiert</option>
<option value="done">Fertig</option>
<option value="archived">Archiviert</option>
</select>
</div>
<div class="sel" id="selSortWrap"><svg class="i sm"><use href="/icons.svg#arrow-up-down"/></svg>
<select id="fltSort">
<option value="mtime">Zuletzt geändert</option>
<option value="name">Name (A–Z)</option>
<option value="priority">Priorität</option>
<option value="size">Größe</option>
<option value="clean">Aufräumbar</option>
</select>
</div>
</div>
<main>
<div id="board" class="view active"></div>
<div id="gallery" class="view"><div id="galleryGrid"></div></div>
<div id="list" class="view"><div class="tablewrap"><table class="list" id="listTable"></table></div></div>
<div id="tasks" class="view">
<div class="taskbarTop">
<div class="seg" id="taskMode">
<button data-mode="open" class="active"><svg class="i sm"><use href="/icons.svg#circle"/></svg>Offen</button>
<button data-mode="done"><svg class="i sm"><use href="/icons.svg#circle-check"/></svg>Erledigt</button>
<button data-mode="all"><svg class="i sm"><use href="/icons.svg#list"/></svg>Alle</button>
</div>
<div class="taskadd">
<select id="taskProject" title="Projekt"></select>
<input type="text" id="taskNew" placeholder="Neue Aufgabe… (Enter)">
<button class="btn primary" id="taskNewBtn"><svg class="i"><use href="/icons.svg#plus"/></svg>Hinzufügen</button>
</div>
</div>
<div id="taskGroups"></div>
</div>
</main>
<div id="overlay"></div>
<aside id="panel" aria-hidden="true">
<div class="phead">
<div id="pAvatar"></div>
<div style="min-width:0">
<h3 id="panelTitle"></h3>
<div class="sub" id="panelSub"></div>
</div>
<button class="iconbtn close" id="btnClose" title="Schließen (Esc)"><svg class="i"><use href="/icons.svg#x"/></svg></button>
</div>
<div class="pquick">
<button class="btn" id="btnOpenFolder"><svg class="i"><use href="/icons.svg#folder-open"/></svg>Explorer</button>
<button class="btn" id="btnVsCode"><svg class="i"><use href="/icons.svg#code-xml"/></svg>VS Code</button>
<button class="btn" id="btnClone" title="Kopie dieses Projekts als neues Projekt anlegen"><svg class="i"><use href="/icons.svg#copy-plus"/></svg>Klonen</button>
</div>
<div class="seg" id="ptabs">
<button data-sec="edit" class="active"><svg class="i"><use href="/icons.svg#pencil"/></svg>Bearbeiten</button>
<button data-sec="info"><svg class="i"><use href="/icons.svg#info"/></svg>Info</button>
<button data-sec="actions"><svg class="i"><use href="/icons.svg#play"/></svg>Aktionen</button>
</div>
<div class="pbody">
<div id="sec-info" class="psec"></div>
<div id="sec-actions" class="psec"></div>
<div id="sec-edit" class="psec active field">
<div class="grid2">
<div>
<label><svg class="i sm"><use href="/icons.svg#flag"/></svg>Status</label>
<select id="fStatus">
<option value="idea">Idee</option>
<option value="active">Aktiv</option>
<option value="paused">Pausiert</option>
<option value="done">Fertig</option>
<option value="archived">Archiviert</option>
</select>
</div>
<div>
<label><svg class="i sm"><use href="/icons.svg#signal"/></svg>Priorität</label>
<select id="fPriority">
<option value="low">Niedrig</option>
<option value="medium">Mittel</option>
<option value="high">Hoch</option>
</select>
</div>
</div>
<label><svg class="i sm"><use href="/icons.svg#tags"/></svg>Tags (mit Komma getrennt)</label>
<input type="text" id="fTags" placeholder="spiel, android, tool…">
<label><svg class="i sm"><use href="/icons.svg#image"/></svg>Bild / Icon (Pfad im Projekt, optional)</label>
<input type="text" id="fThumb" placeholder="assets/icon.png">
<label><svg class="i sm"><use href="/icons.svg#square-terminal"/></svg>Eigener Start-Befehl (läuft sichtbar in einer Konsole)</label>
<input type="text" id="fStart" placeholder="npm run dev">
<label><svg class="i sm"><use href="/icons.svg#rocket"/></svg>itch.io-Seite (leer = automatisch erkennen, „-“ = nicht veröffentlicht)</label>
<input type="text" id="fItch" placeholder="https://sn09.itch.io/spielname">
<div class="hint" id="fItchHint" style="margin-top:-4px"></div>
<label><svg class="i sm"><use href="/icons.svg#notebook-pen"/></svg>Notizen</label>
<textarea id="fNotes" placeholder="Was fehlt noch, nächste Schritte…"></textarea>
<label><svg class="i sm"><use href="/icons.svg#list-checks"/></svg>Aufgaben</label>
<ul id="taskList"></ul>
<div id="taskAddRow">
<input type="text" id="taskInput" placeholder="Neue Aufgabe…">
<button class="btn primary" id="btnAddTask"><svg class="i"><use href="/icons.svg#plus"/></svg></button>
</div>
</div>
</div>
<div class="pfoot">
<button class="btn" id="btnCancel">Abbrechen</button>
<button class="btn primary" id="btnSave"><svg class="i"><use href="/icons.svg#save"/></svg>Speichern</button>
</div>
</aside>
<aside id="bpanel" aria-hidden="true">
<div class="phead">
<div class="avatar lg" style="--c:linear-gradient(135deg,#0ea5e9,#6366f1)"><svg class="i xl"><use href="/icons.svg#hard-drive-upload"/></svg></div>
<div style="min-width:0">
<h3>Backup</h3>
<div class="sub hint" id="bpTarget"></div>
</div>
<button class="iconbtn close" id="btnCloseBackup" title="Schließen (Esc)"><svg class="i"><use href="/icons.svg#x"/></svg></button>
</div>
<div class="pbody" id="bpBody"></div>
</aside>
<aside id="spanel" aria-hidden="true">
<div class="phead">
<div class="avatar lg" style="--c:linear-gradient(135deg,#6366f1,#8b5cf6)"><svg class="i xl"><use href="/icons.svg#settings"/></svg></div>
<div style="min-width:0">
<h3 id="spTitle">Einstellungen</h3>
<div class="sub hint" id="spSub">Projektordner und Backup-Ziele</div>
</div>
<button class="iconbtn close" id="btnCloseSettings" title="Schließen (Esc)"><svg class="i"><use href="/icons.svg#x"/></svg></button>
</div>
<div class="pbody field">
<div id="spWelcome" class="msg info" style="display:none">
<svg class="i lg"><use href="/icons.svg#sparkles"/></svg>
<div><b>Willkommen!</b> Wähle den Ordner, in dem alle deine Projekte liegen – jeder Unterordner wird ein Projekt.
Mehrere solche Ordner sind möglich; oben neben dem Logo wechselst du zwischen ihnen.
Ein Backup-Ziel (z. B. externe Platte oder NAS) kannst du jetzt oder später festlegen.</div>
</div>
<label><svg class="i sm"><use href="/icons.svg#folders"/></svg>Projektordner (mindestens einer)</label>
<div id="fRoots"></div>
<div class="rowbtns">
<button class="btn" id="fAddRoot" type="button"><svg class="i"><use href="/icons.svg#plus"/></svg>Ordner hinzufügen</button>
<button class="btn" id="fImportOpen" type="button"><svg class="i"><use href="/icons.svg#folder-plus"/></svg>Mehrere einlesen…</button>
</div>
<div class="importbox" id="fImport" hidden>
<div class="hint" style="margin:0 0 6px">Übergeordneten Ordner wählen – seine Unterordner werden als Projektordner angeboten.</div>
<div class="pickrow">
<input type="text" id="fImportPath" placeholder="z. B. D:\Arbeit">
<button class="btn pickbtn" data-for="fImportPath" data-title="Übergeordneten Ordner wählen"><svg class="i"><use href="/icons.svg#folder-search"/></svg>Durchsuchen…</button>
<button class="btn" type="button" id="fImportList"><svg class="i"><use href="/icons.svg#list"/></svg>Anzeigen</button>
</div>
<div id="fImportBody"></div>
</div>
<div class="hint">Jeder Unterordner eines Projektordners ist ein Projekt. Der markierte ist gerade aktiv; wechseln geht oben neben dem Logo.</div>
<label><svg class="i sm"><use href="/icons.svg#hard-drive-upload"/></svg>Backup-Ziele (optional, mehrere möglich)</label>
<div id="fTargets"></div>
<button class="btn" id="fAddTarget" type="button"><svg class="i"><use href="/icons.svg#plus"/></svg>Ziel hinzufügen</button>
<div class="hint">Jedes Projekt landet dort in einem gleichnamigen Unterordner. Bei mehreren Projektordnern geht der erste direkt ins Ziel, jeder weitere in einen Unterordner mit seinem Namen. Jedes Ziel hat seinen eigenen Backup-Stand; <code>backup-projekte.bat</code> sichert auf das erste. Im Backup wird nie etwas gelöscht.</div>
<label><svg class="i sm"><use href="/icons.svg#folder-x"/></svg>Nicht sichern (Ordnernamen, mit Komma getrennt)</label>
<input type="text" id="fExDirs">
<div class="hint">Werden überall im Projekt übersprungen, weil sie sich neu erzeugen lassen.</div>
<label><svg class="i sm"><use href="/icons.svg#rocket"/></svg>itch.io-Profil (für „veröffentlicht“)</label>
<div class="pickrow">
<input type="text" id="fItchProfile" placeholder="https://name.itch.io">
<button class="btn" type="button" id="btnItchRefresh" title="Profil jetzt neu lesen"><svg class="i"><use href="/icons.svg#refresh-cw"/></svg></button>
</div>
<div class="hint" id="spItch"></div>
<div class="hint" id="spData" style="margin-top:16px"></div>
<div class="msg err" id="spError" style="display:none"></div>
</div>
<div class="pfoot">
<button class="btn" id="spCancel">Abbrechen</button>
<button class="btn primary" id="spSave"><svg class="i"><use href="/icons.svg#save"/></svg>Speichern</button>
</div>
</aside>
<dialog id="rootDlg" class="dlg">
<div class="field">
<h3 style="margin:0 0 4px;display:flex;gap:8px;align-items:center"><svg class="i lg"><use href="/icons.svg#folders"/></svg>Projektordner einlesen</h3>
<div class="hint" style="margin-top:4px">Übergeordneten Ordner wählen und ankreuzen, was als Projektordner dazukommen soll – der Ordner selbst und/oder seine Unterordner.</div>
<div class="pickrow" style="margin-top:10px">
<input type="text" id="rdPath" placeholder="z. B. D:\Arbeit">
<button class="btn pickbtn" type="button" id="rdPick"><svg class="i"><use href="/icons.svg#folder-search"/></svg>Durchsuchen…</button>
<button class="btn" type="button" id="rdList"><svg class="i"><use href="/icons.svg#list"/></svg>Anzeigen</button>
</div>
<div id="rdBody"></div>
<label class="chk"><input type="checkbox" id="rdActivate" checked> Danach zum ersten neuen Ordner wechseln</label>
<div class="msg err" id="rdError" style="display:none"></div>
<div class="dlgfoot"><button class="btn" type="button" id="rdClose">Schließen</button></div>
</div>
</dialog>
<dialog id="newDlg" class="dlg">
<form method="dialog" class="field" id="newForm">
<h3 style="margin:0 0 4px;display:flex;gap:8px;align-items:center"><svg class="i lg"><use href="/icons.svg#folder-plus"/></svg><span id="newTitle">Neues Projekt</span></h3>
<label><svg class="i sm"><use href="/icons.svg#copy"/></svg>Vorlage</label>
<select id="nFrom"></select>
<label><svg class="i sm"><use href="/icons.svg#type"/></svg>Name (wird der Ordnername)</label>
<input type="text" id="nName" maxlength="80" autocomplete="off">
<label><svg class="i sm"><use href="/icons.svg#folders"/></svg>Anlegen in</label>
<select id="nRoot"></select>
<div id="nCloneOpts">
<label class="chk"><input type="checkbox" id="nSkipBuild" checked> Build-Ordner und Caches weglassen (dist, build, bin, obj, Library …)</label>
<label class="chk"><input type="checkbox" id="nGit"> git-Verlauf mitkopieren (Achtung: gleicher Remote wie das Original)</label>
<div class="hint">Nie kopiert: <span id="nExcl"></span>. Der Klon startet als „Idee“, ohne itch.io-Link und nur mit offenen Aufgaben.</div>
</div>
<div class="hint" id="nEmptyHint">Legt einen leeren Ordner mit <code>README.md</code> an. Für ein Spiel/eine App aus den Library-Vorlagen: Skill <code>neues-projekt</code> in Claude Code.</div>
<div class="msg err" id="nError" style="display:none"></div>
<div class="dlgfoot">
<button class="btn" type="button" id="nCancel">Abbrechen</button>
<button class="btn primary" type="submit" id="nOk"><svg class="i"><use href="/icons.svg#plus"/></svg><span>Anlegen</span></button>
</div>
</form>
</dialog>
<div id="toast"></div>
<script src="app.js"></script>
</body>
</html>

618
server.js Normal file
View File

@@ -0,0 +1,618 @@
// Local project dashboard - scans every folder in ROOT_DIR, reads an
// optional .dashboard.json per project for status/priority/notes/tasks, and
// serves a small Kanban UI to view/edit them. No accounts, no database -
// state lives as a JSON file inside each project folder.
//
// Also shows git/backup status, detected tech, disk usage (via
// _Tools\Cleanup\cleanup.ps1), generator usage and app icons, and can start
// predefined actions in a visible console window.
//
// Security: listens on 127.0.0.1 only, and every request must carry a local
// Host header and (for writes) a local Origin, so other web pages can't drive it.
const express = require('express')
const fs = require('fs')
const path = require('path')
const { pool, openConsole, openDetached, run } = require('./lib/proc')
const { gitInfo, setRemote, initRepo, sshKey } = require('./lib/git')
const tech = require('./lib/tech')
const { toolInfo } = require('./lib/tools')
const icons = require('./lib/icons')
const storage = require('./lib/storage')
const backup = require('./lib/backup')
const settings = require('./lib/settings')
const activity = require('./lib/activity')
const itch = require('./lib/itch')
const create = require('./lib/create')
// The projects folder comes from the settings (lib/settings.js) and can be
// changed at runtime; '' until it is set up. DASHBOARD_PORT allows a test instance.
let ROOT_DIR = ''
const STATUS_FILE = '.dashboard.json'
const HOST = '127.0.0.1'
const PORT = Number(process.env.DASHBOARD_PORT) || 4848
const ALLOWED_HOSTS = new Set([`localhost:${PORT}`, `127.0.0.1:${PORT}`])
const STATUSES = ['idea', 'active', 'paused', 'done', 'archived']
const PRIORITIES = ['low', 'medium', 'high']
// Thumbnail discovery: every project folder is scanned (shallow, breadth-first)
// for a representative image. A project can override the pick by setting
// "thumbnail": "relative/path.png" in its .dashboard.json. A real app icon
// (lib/icons.js) wins over a generic image.
const IMAGE_EXT = { '.png': 3, '.jpg': 3, '.jpeg': 3, '.webp': 3, '.gif': 2, '.bmp': 2, '.svg': 2, '.ico': 1 }
const SKIP_DIRS = new Set([
'node_modules', '.git', '.svn', 'dist', 'build', 'out', 'bin', 'obj', 'target',
'venv', '.venv', 'env', '__pycache__', '.gradle', '.idea', '.vscode', 'Library',
'Temp', 'Logs', 'coverage', 'vendor', '.next', '.cache',
])
const PREFERRED_NAMES = ['icon', 'logo', 'thumb', 'thumbnail', 'preview', 'screenshot', 'cover', 'banner', 'splash', 'title', 'header', 'app_icon', 'appicon']
const MAX_DEPTH = 3
const MAX_ENTRIES = 3000
const THUMB_TTL_MS = 5 * 60 * 1000
const thumbCache = new Map() // project name -> { file: string|null, at: number }
function scoreImage(fileName, depth) {
const lower = fileName.toLowerCase()
const ext = path.extname(lower)
const base = path.basename(lower, ext)
let score = IMAGE_EXT[ext] ?? 0
if (PREFERRED_NAMES.includes(base)) score += 20
else if (PREFERRED_NAMES.some((n) => base.includes(n))) score += 12
score += Math.max(0, 6 - depth * 2) // shallower files win
return score
}
function sanitizeTasks(tasks) {
if (!Array.isArray(tasks)) return []
return tasks.slice(0, 200).map((t) => ({
id: String(t?.id ?? Date.now() + Math.random().toString(36).slice(2)),
text: String(t?.text ?? '').slice(0, 500),
done: !!t?.done,
})).filter((t) => t.text.length > 0)
}
function readStatusFile(projectPath) {
const file = path.join(projectPath, STATUS_FILE)
try {
const raw = fs.readFileSync(file, 'utf-8')
const data = JSON.parse(raw)
return {
status: STATUSES.includes(data.status) ? data.status : 'idea',
priority: PRIORITIES.includes(data.priority) ? data.priority : 'medium',
notes: typeof data.notes === 'string' ? data.notes : '',
tags: Array.isArray(data.tags) ? data.tags.map(String).slice(0, 10) : [],
tasks: sanitizeTasks(data.tasks),
thumbnail: typeof data.thumbnail === 'string' ? data.thumbnail.slice(0, 300) : '',
start: typeof data.start === 'string' ? data.start.slice(0, 300) : '',
program: typeof data.program === 'string' ? data.program.slice(0, 300) : '',
itch: typeof data.itch === 'string' ? data.itch.slice(0, 300) : '',
updatedAt: data.updatedAt ?? null,
}
} catch {
return { status: 'idea', priority: 'medium', notes: '', tags: [], tasks: [], thumbnail: '', start: '', program: '', itch: '', updatedAt: null }
}
}
// Breadth-first walk of the project folder, returning the best-scoring image
// path (absolute) or null. Bounded by depth and total entries so a huge folder
// can't stall the request.
function scanForImage(projectPath) {
let queue = [{ dir: projectPath, depth: 0 }]
let seen = 0
let best = null
let bestScore = -1
while (queue.length) {
const { dir, depth } = queue.shift()
let entries
try {
entries = fs.readdirSync(dir, { withFileTypes: true })
} catch {
continue
}
for (const e of entries) {
if (++seen > MAX_ENTRIES) return best
if (e.isDirectory()) {
if (depth >= MAX_DEPTH || e.name.startsWith('.') || SKIP_DIRS.has(e.name)) continue
queue.push({ dir: path.join(dir, e.name), depth: depth + 1 })
continue
}
if (!e.isFile()) continue
const ext = path.extname(e.name).toLowerCase()
if (!(ext in IMAGE_EXT)) continue
const score = scoreImage(e.name, depth)
if (score > bestScore) {
bestScore = score
best = path.join(dir, e.name)
}
}
}
return best
}
function findThumbnail(name, projectPath) {
const cached = thumbCache.get(name)
if (cached && Date.now() - cached.at < THUMB_TTL_MS) return cached.file
let file = null
const override = readStatusFile(projectPath).thumbnail
if (override) {
const candidate = path.resolve(projectPath, override)
if (candidate.startsWith(projectPath + path.sep) && fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
file = candidate
}
}
if (!file) file = icons.findIcon(projectPath)
if (!file) file = scanForImage(projectPath)
thumbCache.set(name, { file, at: Date.now() })
return file
}
// Several projects folders can be shown at once (ROOTS). A project is named in
// the API by its key: the folder name, or "Folder (Projects folder)" when the
// same folder name exists in more than one shown projects folder.
let ROOTS = [] // [{ id, name, path }] shown, path resolved
let projMap = new Map() // key -> { key, folder, root }
// Folders that are never projects (drive roots of a friend's PC may contain these)
const NOT_PROJECTS = new Set(['project-dashboard', '$recycle.bin', 'system volume information', 'recovery', 'config.msi'])
function projectList() {
const raw = []
for (const root of ROOTS) {
let entries
try { entries = fs.readdirSync(root.path, { withFileTypes: true }) } catch { continue }
for (const e of entries) {
if (e.isDirectory() && !e.name.startsWith('.') && !NOT_PROJECTS.has(e.name.toLowerCase())) raw.push({ folder: e.name, root })
}
}
const count = new Map()
for (const p of raw) count.set(p.folder.toLowerCase(), (count.get(p.folder.toLowerCase()) ?? 0) + 1)
const used = new Set()
const list = raw.map((p) => {
let key = count.get(p.folder.toLowerCase()) > 1 ? `${p.folder} (${p.root.name})` : p.folder
while (used.has(key.toLowerCase())) key += ` [${p.root.id}]`
used.add(key.toLowerCase())
return { key, folder: p.folder, root: p.root }
})
projMap = new Map(list.map((p) => [p.key, p]))
return list
}
function projectNames() { return projectList().map((p) => p.key) }
// key -> { key, folder, root, path } or null
function projectRef(key) {
if (typeof key !== 'string' || !key) return null
const p = projMap.get(key) ?? (projectList(), projMap.get(key))
return p ? { ...p, path: path.join(p.root.path, p.folder) } : null
}
// key of a project folder (for lib/backup.js)
function keyOf(rootPath, folder) {
for (const p of projMap.values()) if (p.folder === folder && p.root.path.toLowerCase() === rootPath.toLowerCase()) return p.key
return folder
}
// Resolves a project key to its directory, or null if it isn't an existing
// direct child of a shown projects folder (guards the write/open endpoints
// against path traversal).
function resolveProject(key) {
const p = projectRef(key)
if (!p) return null
if (!fs.existsSync(p.path) || !fs.statSync(p.path).isDirectory() || path.dirname(p.path) !== p.root.path) return null
return p.path
}
// Applies the current settings: projects folders, backup target, caches.
function applySettings() {
const s = settings.get()
ROOTS = settings.configured()
? settings.activeRootList(s).map((r) => ({ ...r, path: path.resolve(r.path) })).filter((r) => fs.existsSync(r.path))
: []
ROOT_DIR = ROOTS[0]?.path ?? ''
projectList()
storage.init(ROOTS.map((r) => r.path), s.roots.map((r) => r.path))
backup.init(ROOTS.map((r) => r.path), keyOf)
thumbCache.clear()
quickCache.clear()
icons.clear()
activity.clear()
activity.warm([...projMap.values()].map((p) => path.join(p.root.path, p.folder)))
}
function storageSummary(p) {
const s = storage.get(p.root.path, p.folder)
if (!s) return null
return { at: s.at, sizeMB: s.sizeMB, deletable: s.deletable }
}
// target = backup target id whose "last backup" the cards show (default: the first)
async function describeProject(p, target) {
const projectPath = path.join(p.root.path, p.folder)
const stat = fs.statSync(projectPath)
const meta = readStatusFile(projectPath)
const found = tech.detect(projectPath)
const tools = toolInfo(projectPath)
const git = await gitInfo(projectPath)
return {
name: p.key,
folder: p.folder,
root: p.root.id,
rootName: p.root.name,
mtime: stat.mtime.toISOString(),
lastCommit: git.lastCommit,
git,
tech: tech.summary(found),
tools,
hasIcon: !!icons.findIcon(projectPath),
quickStart: quickStartFor(p.key, projectPath),
lastChange: activity.lastChange(projectPath),
lastBackup: backup.lastFor(p.root.path, p.folder, target),
storage: storageSummary(p),
...meta,
published: itch.forProject(p.folder, meta.itch),
}
}
async function listProjects(target) {
await itch.ensure()
const list = await pool(projectList(), 8, (p) => describeProject(p, target))
return list.sort((a, b) => new Date(b.mtime) - new Date(a.mtime))
}
// tech.actions matches programs against the folder name; the key names the console windows
function actionsFor(key, projectPath) {
const found = tech.detect(projectPath)
return tech.actions(path.basename(projectPath), projectPath, found, readStatusFile(projectPath), toolInfo(projectPath))
}
// The ▶ button on cards: the program chosen in "Aktionen", else own start command, else the main program (exe/html),
// else a start script of the project ("Soundclick starten.bat", run.bat, ...),
// else the first "Starten" action (Unity, npm run dev, Python, ...).
// Finding programs walks the project folder, so the pick is cached a while.
const QUICK_TTL_MS = 3 * 60 * 1000
const quickCache = new Map() // name -> { value, at }
function quickStartFor(name, projectPath) {
const c = quickCache.get(name)
if (c && Date.now() - c.at < QUICK_TTL_MS) return c.value
let value = null
try {
const list = actionsFor(name, projectPath)
const startScript = (a) => a.group === 'Starten' && a.id.startsWith('bat:') && /(start|run|launch|spiel|play|öffne|open)/i.test(a.label)
const pick = list.find((a) => a.id === 'program') ?? list.find((a) => a.id === 'custom') ?? list.find((a) => a.group === 'Programm')
?? list.find(startScript) ?? list.find((a) => a.group === 'Starten')
if (pick) value = { id: pick.id, label: pick.label, detail: pick.detail ?? '', kind: pick.kind === 'console' ? 'cmd' : 'exe' }
} catch {}
quickCache.set(name, { value, at: Date.now() })
return value
}
// Wraps async handlers so a thrown error becomes a 500 instead of a crash.
const handle = (fn) => async (req, res) => {
try { await fn(req, res) } catch (e) { if (!res.headersSent) res.status(500).json({ error: String(e.message ?? e) }) }
}
const app = express()
// Blocks other web pages (CSRF) and DNS rebinding: Host must be local, and
// writes must come from this dashboard's own origin.
app.use((req, res, next) => {
if (!ALLOWED_HOSTS.has(req.headers.host)) return res.status(403).send('forbidden host')
if (req.method !== 'GET' && req.method !== 'HEAD') {
const origin = req.headers.origin
if (!origin || !ALLOWED_HOSTS.has(origin.replace(/^https?:\/\//, ''))) return res.status(403).json({ error: 'forbidden origin' })
}
next()
})
app.use(express.json())
app.use(express.static(path.join(__dirname, 'public')))
// Lucide icon sprite (ISC license), used as <svg><use href="/icons.svg#name"/></svg>
const ICON_SPRITE = path.join(__dirname, 'node_modules', 'lucide-static', 'sprite.svg')
app.get('/icons.svg', (req, res) => {
res.setHeader('Cache-Control', 'public, max-age=86400')
res.sendFile(ICON_SPRITE, (err) => { if (err && !res.headersSent) res.status(404).end() })
})
app.get('/api/projects', handle(async (req, res) => {
const list = await listProjects(String(req.query.target ?? '') || null)
const s = settings.get()
res.json({
root: ROOT_DIR,
rootPaths: ROOTS.map((r) => r.path),
roots: s.roots,
activeRoot: s.activeRoot,
activeRoots: s.activeRoots,
setupNeeded: !ROOT_DIR,
projects: list,
totals: { ...storage.totals(list.map((p) => ({ root: ROOTS.find((r) => r.id === p.root)?.path, folder: p.folder }))), noBackup: list.filter((p) => p.git.level === 'red').length },
scan: storage.state,
cleanupAvailable: storage.available(),
activityPending: activity.pending(),
})
}))
// itch.io profile: games found + which project claims them (lib/itch.js)
async function itchStatus() {
const s = itch.state
const claimed = projectList().map((p) => itch.forProject(p.folder, readStatusFile(path.join(p.root.path, p.folder)).itch)?.url).filter(Boolean)
return { profile: s.profile, at: s.at, error: s.error, games: s.games, unmatched: itch.unmatched(claimed) }
}
app.get('/api/itch', handle(async (req, res) => { await itch.ensure(); res.json(await itchStatus()) }))
app.post('/api/itch/refresh', handle(async (req, res) => { await itch.refresh(); res.json(await itchStatus()) }))
// Settings: projects folder, backup target, excludes (lib/settings.js)
app.get('/api/settings', (req, res) => {
res.json({ ...settings.get(), configured: !!ROOT_DIR, dataDir: settings.DATA_DIR })
})
app.post('/api/settings', (req, res) => {
if (storage.busy() || backup.busy() || create.busy()) return res.status(409).json({ error: 'Erst warten, bis Scan/Backup fertig ist.' })
try {
settings.save(req.body ?? {})
applySettings()
res.json({ ...settings.get(), configured: !!ROOT_DIR, dataDir: settings.DATA_DIR })
} catch (e) {
res.status(400).json({ error: String(e.message ?? e) })
}
})
// Which registered projects folders are shown (dropdown next to the logo). body: { ids: [...] } or { id }
app.post('/api/roots/active', (req, res) => {
if (storage.busy() || backup.busy() || create.busy()) return res.status(409).json({ error: 'Erst warten, bis Scan/Backup fertig ist.' })
try {
settings.setActive(Array.isArray(req.body?.ids) ? req.body.ids : String(req.body?.id ?? ''))
applySettings()
res.json({ ...settings.get(), configured: !!ROOT_DIR, dataDir: settings.DATA_DIR })
} catch (e) {
res.status(400).json({ error: String(e.message ?? e) })
}
})
// New project (empty) or clone of a project of the active folder (lib/create.js).
// body: { name, root (folder id, default: active), from (project name), withGit, skipBuild }
app.post('/api/projects/new', handle(async (req, res) => {
const s = settings.get()
const b = req.body ?? {}
const root = s.roots.find((r) => r.id === (b.root || s.activeRoot))
if (!root || !fs.existsSync(root.path)) return res.status(400).json({ error: 'Projektordner nicht gefunden.' })
let from = null
if (b.from) {
from = resolveProject(String(b.from))
if (!from) return res.status(404).json({ error: 'Vorlage nicht gefunden.' })
}
try {
const r = await create.create({ rootPath: path.resolve(root.path), name: b.name, from, withGit: !!b.withGit, skipBuild: b.skipBuild !== false })
const shown = ROOTS.some((x) => x.id === root.id)
if (shown) { activity.warm([r.path]); projectList() }
// key: the name the UI knows it by (may get "(Ordner)" when the name exists in another shown folder)
res.json({ ...r, root: root.id, shown, key: shown ? keyOf(path.resolve(root.path), r.name) : r.name })
} catch (e) {
res.status(400).json({ error: String(e.message ?? e) })
}
}))
// Adds projects folders from the dropdown. body: { paths: [...], activate }
app.post('/api/roots/add', (req, res) => {
if (storage.busy() || backup.busy() || create.busy()) return res.status(409).json({ error: 'Erst warten, bis Scan/Backup fertig ist.' })
try {
const before = settings.get().activeRoots.join('|')
const { settings: s, added } = settings.addRoots(req.body?.paths, !!req.body?.activate)
if (s.activeRoots.join('|') !== before) applySettings()
res.json({ ...s, added, configured: !!ROOT_DIR, dataDir: settings.DATA_DIR })
} catch (e) {
res.status(400).json({ error: String(e.message ?? e) })
}
})
// Subfolders of a folder, for adding several projects folders at once
app.get('/api/subfolders', (req, res) => {
try { res.json(settings.subfolders(String(req.query.path ?? ''))) } catch (e) { res.status(400).json({ error: String(e.message ?? e) }) }
})
app.patch('/api/projects/:name', (req, res) => {
const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
const current = readStatusFile(projectPath)
const { status, priority, notes, tags, tasks, thumbnail, start, program, itch: itchLink } = req.body ?? {}
// itch: '' = automatic, '-' = not published, otherwise the game's page
let nextItch = current.itch
if (typeof itchLink === 'string') {
const v = itchLink.trim()
if (v && v !== '-' && !/^https:\/\/[a-z0-9-]+\.itch\.io\/[^\s"<>]+$/i.test(v)) return res.status(400).json({ error: 'itch.io-Link: z. B. https://name.itch.io/spiel – oder „-“ für „nicht veröffentlicht“' })
nextItch = v.slice(0, 300)
}
// program: absolute path (file dialog) or relative; stored relative, must lie inside the project
let nextProgram = current.program
if (typeof program === 'string') {
const p = program.trim().replace(/^"|"$/g, '')
if (!p) nextProgram = ''
else {
const abs = path.resolve(projectPath, p)
if (!abs.startsWith(projectPath + path.sep)) return res.status(400).json({ error: 'Die Datei muss im Projektordner liegen.' })
if (!fs.existsSync(abs) || !fs.statSync(abs).isFile()) return res.status(400).json({ error: `Datei nicht gefunden: ${p}` })
nextProgram = path.relative(projectPath, abs).slice(0, 300)
}
}
const next = {
status: STATUSES.includes(status) ? status : current.status,
priority: PRIORITIES.includes(priority) ? priority : current.priority,
notes: typeof notes === 'string' ? notes : current.notes,
tags: Array.isArray(tags) ? tags.map(String).slice(0, 10) : current.tags,
tasks: tasks !== undefined ? sanitizeTasks(tasks) : current.tasks,
thumbnail: typeof thumbnail === 'string' ? thumbnail.slice(0, 300) : current.thumbnail,
start: typeof start === 'string' ? start.replace(/[\r\n]+/g, ' ').slice(0, 300) : current.start,
program: nextProgram,
itch: nextItch,
updatedAt: new Date().toISOString(),
}
fs.writeFileSync(path.join(projectPath, STATUS_FILE), JSON.stringify(next, null, 2))
thumbCache.delete(req.params.name)
icons.forget(projectPath)
quickCache.delete(req.params.name)
res.json(next)
})
// Serves the project's thumbnail image; 404 when the folder has no usable
// image (the UI then falls back to a generated letter tile).
app.get('/api/projects/:name/thumb', (req, res) => {
const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).end()
const file = findThumbnail(req.params.name, projectPath)
if (!file) return res.status(404).end()
res.setHeader('Cache-Control', 'public, max-age=300')
res.sendFile(file, (err) => { if (err && !res.headersSent) res.status(404).end() })
})
// The program chosen for ▶ ({ rel, missing }) or null.
function programInfo(projectPath) {
const rel = readStatusFile(projectPath).program
if (!rel) return null
const r = tech.resolveProgram(projectPath, rel)
return { rel, missing: !r?.exists }
}
// Everything the editor's Info/Aktionen tabs need.
app.get('/api/projects/:name/details', handle(async (req, res) => {
const name = req.params.name
const projectPath = resolveProject(name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
const icon = icons.findIcon(projectPath)
const p = projectRef(name)
res.json({
git: await gitInfo(projectPath),
tech: tech.summary(tech.detect(projectPath)),
tools: toolInfo(projectPath),
icon: icon ? path.relative(projectPath, icon) : null,
storage: storage.get(p.root.path, p.folder),
lastBackup: backup.lastFor(p.root.path, p.folder, String(req.query.target ?? '') || null),
backupTargets: backup.lastOnAllTargets(p.root.path, p.folder),
actions: actionsFor(name, projectPath).map(({ id, label, group, detail, rel }) => ({ id, label, group, detail, rel })),
program: programInfo(projectPath),
path: projectPath,
sshKey: sshKey(),
})
}))
// Opens the project folder in Windows Explorer.
app.post('/api/projects/:name/open', (req, res) => {
const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
try {
openDetached('explorer.exe', [projectPath])
res.json({ ok: true })
} catch (e) {
res.status(500).json({ error: String(e) })
}
})
// Runs one of the server-built actions; the body only names its id.
app.post('/api/projects/:name/run', handle(async (req, res) => {
const name = req.params.name
const projectPath = resolveProject(name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
const action = actionsFor(name, projectPath).find((a) => a.id === req.body?.id)
if (!action) return res.status(400).json({ error: 'unknown action' })
const target = action.kind === 'exe' ? action.exe : action.kind === 'open' ? action.file : null
if (target && !fs.existsSync(target)) {
quickCache.delete(name)
return res.status(400).json({ error: `Nicht gefunden: ${path.relative(projectPath, target) || target}` })
}
switch (action.kind) {
case 'console': openConsole(`${name} ${action.id}`, action.cwd, action.command, { raw: action.id === 'custom' }); break
case 'exe': openDetached(action.exe, action.args, action.cwd); break
case 'open': openDetached('explorer.exe', [action.file]); break
case 'vscode': {
// code is a .cmd shim, so go through cmd; the path was checked by resolveProject
const r = await run('cmd.exe', ['/c', 'code', projectPath], { timeout: 15000 })
if (!r.ok) return res.status(500).json({ error: 'VS Code (code) nicht gefunden' })
break
}
}
res.json({ ok: true, label: action.label })
}))
// git push in a visible console, so SSH/credential prompts and errors are seen.
// body.message: commit all changes with this message first ("Commit & Push").
app.post('/api/projects/:name/push', handle(async (req, res) => {
const name = req.params.name
const projectPath = resolveProject(name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
const git = await gitInfo(projectPath)
if (!git.remote) return res.status(400).json({ error: 'kein Remote eingerichtet' })
if (!/^[\w./-]+$/.test(git.branch)) return res.status(400).json({ error: `Branch-Name nicht unterstützt: ${git.branch || '(keiner)'}` })
const steps = []
if (typeof req.body?.message === 'string' && req.body.message.trim()) {
// the message sits in "..." in a .cmd file: no quotes, no line breaks
const msg = req.body.message.replace(/["\r\n]+/g, ' ').trim().slice(0, 200)
steps.push('git add -A', `git commit -m "${msg}"`)
}
steps.push(git.upstream ? 'git push' : `git push -u origin ${git.branch}`)
openConsole(`${name} push`, projectPath, steps.join(' && '))
res.json({ ok: true })
}))
// Sets the "origin" remote (SSH or https URL; '' removes it).
app.post('/api/projects/:name/remote', handle(async (req, res) => {
const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
try { await setRemote(projectPath, req.body?.url) } catch (e) { return res.status(400).json({ error: String(e.message ?? e) }) }
res.json({ ok: true, git: await gitInfo(projectPath) })
}))
// git init for a project without repository.
app.post('/api/projects/:name/git-init', handle(async (req, res) => {
const projectPath = resolveProject(req.params.name)
if (!projectPath) return res.status(404).json({ error: 'unknown project' })
try { await initRepo(projectPath) } catch (e) { return res.status(400).json({ error: String(e.message ?? e) }) }
res.json({ ok: true, git: await gitInfo(projectPath) })
}))
// Background disk scan: one project ({name}) or all (empty body).
app.post('/api/scan', (req, res) => {
if (!storage.available()) return res.status(400).json({ error: 'cleanup.ps1 nicht gefunden' })
const name = req.body?.name
const refs = name ? [name].filter((n) => resolveProject(n)).map(projectRef) : projectList().filter((p) => p.folder !== '_Tools')
if (!refs.length) return res.status(404).json({ error: 'unknown project' })
if (!storage.startScan(refs.map((p) => ({ root: p.root.path, folder: p.folder, key: p.key })))) return res.status(409).json({ error: 'Scan läuft schon' })
res.json({ ok: true, state: storage.state })
})
app.get('/api/scan', (req, res) => res.json(storage.state))
// Deletes selected cleanup candidates of one project (cleanup.ps1 re-checks them).
app.post('/api/projects/:name/clean', handle(async (req, res) => {
const ref = resolveProject(req.params.name) && projectRef(req.params.name)
if (!ref) return res.status(404).json({ error: 'unknown project' })
if (ref.folder === '_Tools') return res.status(400).json({ error: '_Tools wird nie aufgeräumt' })
// paths are relative to the projects folder, as cleanup.ps1 listed them ("<folder>\...")
const paths = (Array.isArray(req.body?.paths) ? req.body.paths : [])
.filter((p) => typeof p === 'string' && p.startsWith(ref.folder + path.sep))
if (!paths.length) return res.status(400).json({ error: 'nichts ausgewählt' })
const result = await storage.clean(ref.root.path, ref.folder, paths)
res.json(result)
}))
// NAS backup (lib/backup.js): check → copy, never deletes in the backup.
app.get('/api/backup', (req, res) => res.json(backup.getState()))
// body: { target } = check everything · { target, project, autoCopy: true } = "Sichern" of one project
app.post('/api/backup/check', handle(async (req, res) => {
const project = req.body?.project ?? null
const ref = project && resolveProject(project) ? projectRef(project) : null
if (project && (!ref || ref.folder === '_Tools')) return res.status(404).json({ error: 'unknown project' })
const target = String(req.body?.target ?? '') || null
if (target && !settings.get().backup.targets.some((t) => t.id === target)) return res.status(404).json({ error: 'Backup-Ziel nicht gefunden' })
if (!ROOTS.length) return res.status(400).json({ error: 'Kein Projektordner gewählt' })
if (!backup.check(ref ? { root: ref.root.path, folder: ref.folder } : null, !!req.body?.autoCopy, target)) return res.status(409).json({ error: 'Es läuft schon ein Backup' })
res.json(backup.getState())
}))
app.post('/api/backup/copy', handle(async (req, res) => {
if (!backup.copy()) return res.status(409).json({ error: 'Erst prüfen (oder läuft schon)' })
res.json(backup.getState())
}))
app.post('/api/backup/cancel', (req, res) => {
backup.cancel()
res.json(backup.getState())
})
applySettings()
app.listen(PORT, HOST, () => {
console.log(`Project dashboard running at http://${HOST}:${PORT}`)
console.log(`Scanning: ${ROOT_DIR}`)
})

9
start-dashboard.bat Normal file
View File

@@ -0,0 +1,9 @@
@echo off
cd /d "%~dp0"
if not exist "node_modules" (
echo node_modules fehlt - installiere einmalig ...
call npm install
)
start "Project Dashboard" cmd /k "npm start"
timeout /t 2 /nobreak >nul
start "" http://127.0.0.1:4848