chore: 提交所有工作进度 — SaaS 后端增强、Admin UI、桌面端集成

包含大量 SaaS 平台改进、Admin 管理后台更新、桌面端集成完善、
文档同步、测试文件重构等内容。为 QA 测试准备干净工作树。
This commit is contained in:
iven
2026-03-29 10:46:26 +08:00
parent 9a5fad2b59
commit 5fdf96c3f5
268 changed files with 22011 additions and 3886 deletions

View File

@@ -1,5 +1,5 @@
# ZCLAW Full Stack Start Script
# Starts: ChromeDriver (optional) -> Tauri Desktop
# Starts: PostgreSQL (Docker) -> SaaS Backend -> ChromeDriver (optional) -> Tauri Desktop
#
# NOTE: ZCLAW now uses internal Kernel (zclaw-kernel) for all operations.
# No external ZCLAW runtime is required.
@@ -9,7 +9,8 @@ param(
[switch]$Dev,
[switch]$Help,
[switch]$Stop,
[switch]$DesktopOnly
[switch]$DesktopOnly,
[switch]$NoSaas
)
$ErrorActionPreference = "Continue"
@@ -30,8 +31,9 @@ ZCLAW Full Stack Start Script
Usage: .\start-all.ps1 [options]
Options:
-DesktopOnly Start desktop only (skip ChromeDriver)
-DesktopOnly Start desktop only (skip ChromeDriver + SaaS + PostgreSQL)
-NoBrowser Skip ChromeDriver startup
-NoSaas Skip PostgreSQL + SaaS backend startup
-Dev Development mode (hot reload)
-Stop Stop all services
-Help Show this help
@@ -43,7 +45,7 @@ Note:
Quick Commands:
pnpm start # Start all services
pnpm start:dev # Start in dev mode
pnpm start:desktop # Start desktop only (no browser)
pnpm start:desktop # Start desktop only (no browser, no SaaS)
"@
exit 0
@@ -57,6 +59,17 @@ if ($Stop) {
Get-Process -Name "chromedriver" -ErrorAction SilentlyContinue | Stop-Process -Force
ok "ChromeDriver stopped"
# Stop SaaS backend
Get-Process -Name "zclaw-saas" -ErrorAction SilentlyContinue | Stop-Process -Force
$port8080 = netstat -ano | Select-String ":8080.*LISTENING"
if ($port8080) {
$pid8080 = ($port8080 -split '\s+')[-1]
if ($pid8080 -match '^\d+$') {
Stop-Process -Id $pid8080 -Force -ErrorAction SilentlyContinue
ok "Stopped SaaS backend on port 8080 (PID: $pid8080)"
}
}
# Stop any process on port 4200 (legacy, may still be in use)
$port4200 = netstat -ano | Select-String ":4200.*LISTENING"
if ($port4200) {
@@ -108,12 +121,89 @@ function Cleanup {
trap { Cleanup; break }
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action { Cleanup } | Out-Null
# Skip ChromeDriver if DesktopOnly
# Skip SaaS and ChromeDriver if DesktopOnly
if ($DesktopOnly) {
$NoBrowser = $true
$NoSaas = $true
}
# 1. ChromeDriver (optional - for Browser Hand automation)
# 1. PostgreSQL (Windows native) — required for SaaS backend
if (-not $NoSaas) {
info "Checking PostgreSQL..."
$port5432 = netstat -ano | Select-String ":5432.*LISTENING"
if ($port5432) {
ok "PostgreSQL is running on port 5432"
} else {
# Try to start the Windows PostgreSQL service
$pgService = Get-Service -Name "postgresql*" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($pgService) {
if ($pgService.Status -ne "Running") {
info "Starting PostgreSQL service: $($pgService.Name)..."
Start-Service -Name $pgService.Name -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
ok "PostgreSQL service started"
} else {
ok "PostgreSQL service is running"
}
} else {
warn "PostgreSQL not found on port 5432 and no Windows service detected."
warn "SaaS backend requires PostgreSQL. Please start it manually."
$NoSaas = $true
}
}
} else {
info "Skipping PostgreSQL"
}
Write-Host ""
# 2. SaaS Backend (for cloud features: account, relay, config sync)
if (-not $NoSaas) {
info "Checking SaaS backend..."
# Check if port 8080 is already in use
$port8080 = netstat -ano | Select-String ":8080.*LISTENING"
if ($port8080) {
$pid8080 = ($port8080 -split '\s+')[-1]
if ($pid8080 -match '^\d+$') {
ok "SaaS backend already running on port 8080 (PID: $pid8080)"
}
} else {
# Check if zclaw-saas binary exists
$saasBin = "$ScriptDir\target\debug\zclaw-saas.exe"
$saasBinRelease = "$ScriptDir\target\release\zclaw-saas.exe"
$saasExe = if (Test-Path $saasBinRelease) { $saasBinRelease } elseif (Test-Path $saasBin) { $saasBin } else { $null }
if ($saasExe) {
ok "SaaS backend binary found: $saasExe"
info "Starting SaaS backend on port 8080..."
if ($Dev) {
$env:ZCLAW_SAAS_DEV = "true"
}
$proc = Start-Process -FilePath $saasExe -PassThru -WindowStyle Minimized
$Jobs += $proc
Start-Sleep -Seconds 3
if ($proc.HasExited) {
err "SaaS backend exited unexpectedly. Run manually: cd $ScriptDir && ZCLAW_SAAS_DEV=true cargo run -p zclaw-saas"
} else {
ok "SaaS backend started (PID: $($proc.Id))"
}
} else {
warn "SaaS backend binary not found. Building..."
info "Run: cargo build -p zclaw-saas"
warn "SaaS cloud features will be unavailable until built."
}
}
} else {
info "Skipping SaaS backend"
}
Write-Host ""
# 3. ChromeDriver (optional - for Browser Hand automation)
if (-not $NoBrowser) {
info "Checking ChromeDriver..."
@@ -146,7 +236,7 @@ if (-not $NoBrowser) {
Write-Host ""
# 2. Start Tauri Desktop
# 4. Start Tauri Desktop
info "Starting ZCLAW Desktop..."
Set-Location "$ScriptDir/desktop"