fix(scripts): use powershell instead of pwsh and add DesktopOnly mode
- Replace pwsh with powershell for Windows compatibility - Add -DesktopOnly flag to skip all external services - Add automatic port 1420 cleanup before starting - Improve stop command to kill all related processes - Update package.json scripts for easier access Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,11 +11,10 @@
|
|||||||
"gateway:start": "openfang gateway start",
|
"gateway:start": "openfang gateway start",
|
||||||
"gateway:status": "openfang gateway status",
|
"gateway:status": "openfang gateway status",
|
||||||
"gateway:doctor": "openfang doctor",
|
"gateway:doctor": "openfang doctor",
|
||||||
"start": "pwsh -File ./start-all.ps1",
|
"start": "powershell -ExecutionPolicy Bypass -File ./start-all.ps1",
|
||||||
"start:dev": "pwsh -File ./start-all.ps1 -Dev",
|
"start:dev": "powershell -ExecutionPolicy Bypass -File ./start-all.ps1 -Dev",
|
||||||
"start:no-browser": "pwsh -File ./start-all.ps1 -NoBrowser",
|
"start:desktop": "powershell -ExecutionPolicy Bypass -File ./start-all.ps1 -DesktopOnly",
|
||||||
"start:no-gateway": "pwsh -File ./start-all.ps1 -NoGateway",
|
"start:stop": "powershell -ExecutionPolicy Bypass -File ./start-all.ps1 -Stop",
|
||||||
"start:stop": "pwsh -File ./start-all.ps1 -Stop",
|
|
||||||
"desktop": "cd desktop && pnpm tauri dev",
|
"desktop": "cd desktop && pnpm tauri dev",
|
||||||
"desktop:build": "cd desktop && pnpm tauri build",
|
"desktop:build": "cd desktop && pnpm tauri build",
|
||||||
"chromedriver": "chromedriver --port=4444"
|
"chromedriver": "chromedriver --port=4444"
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
# ZCLAW Full Stack Start Script
|
# ZCLAW Full Stack Start Script
|
||||||
# Starts: ChromeDriver -> OpenFang Gateway -> Tauri Desktop
|
# Starts: ChromeDriver (optional) -> OpenFang Gateway (optional) -> Tauri Desktop
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[switch]$NoBrowser,
|
[switch]$NoBrowser,
|
||||||
[switch]$NoGateway,
|
[switch]$NoGateway,
|
||||||
[switch]$Dev,
|
[switch]$Dev,
|
||||||
[switch]$Help,
|
[switch]$Help,
|
||||||
[switch]$Stop
|
[switch]$Stop,
|
||||||
|
[switch]$DesktopOnly
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = "Continue"
|
$ErrorActionPreference = "Continue"
|
||||||
@@ -27,17 +28,16 @@ ZCLAW Full Stack Start Script
|
|||||||
Usage: .\start-all.ps1 [options]
|
Usage: .\start-all.ps1 [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-NoBrowser Skip ChromeDriver
|
-DesktopOnly Start desktop only (skip all external services)
|
||||||
-NoGateway Skip OpenFang Gateway
|
-NoBrowser Skip ChromeDriver
|
||||||
-Dev Development mode (hot reload)
|
-NoGateway Skip OpenFang Gateway
|
||||||
-Stop Stop all services
|
-Dev Development mode (hot reload)
|
||||||
-Help Show this help
|
-Stop Stop all services
|
||||||
|
-Help Show this help
|
||||||
|
|
||||||
Quick Commands:
|
Quick Commands:
|
||||||
pnpm start # Start all services
|
pnpm start # Start all services
|
||||||
pnpm start:dev # Start in dev mode
|
|
||||||
pnpm desktop # Start desktop only
|
pnpm desktop # Start desktop only
|
||||||
pnpm chromedriver # Start ChromeDriver only
|
|
||||||
|
|
||||||
"@
|
"@
|
||||||
exit 0
|
exit 0
|
||||||
@@ -59,16 +59,27 @@ if ($Stop) {
|
|||||||
|
|
||||||
# Stop Tauri/ZClaw
|
# Stop Tauri/ZClaw
|
||||||
Get-Process -Name "ZClaw" -ErrorAction SilentlyContinue | Stop-Process -Force
|
Get-Process -Name "ZClaw" -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||||
|
Get-Process -Name "desktop" -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||||
ok "ZCLAW Desktop stopped"
|
ok "ZCLAW Desktop stopped"
|
||||||
|
|
||||||
|
# Kill any process on port 1420
|
||||||
|
$port1420 = netstat -ano | Select-String ":1420.*LISTENING"
|
||||||
|
if ($port1420) {
|
||||||
|
$pid1420 = ($port1420 -split '\s+')[-1]
|
||||||
|
if ($pid1420 -match '^\d+$') {
|
||||||
|
Stop-Process -Id $pid1420 -Force -ErrorAction SilentlyContinue
|
||||||
|
ok "Killed process on port 1420 (PID: $pid1420)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ok "All services stopped"
|
ok "All services stopped"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "═══════════════════════════════════════════════════════════" -ForegroundColor Magenta
|
Write-Host "===============================================" -ForegroundColor Magenta
|
||||||
Write-Host " 🦞 ZCLAW - OpenFang Desktop Client" -ForegroundColor Magenta
|
Write-Host " ZCLAW - OpenFang Desktop Client" -ForegroundColor Magenta
|
||||||
Write-Host "═══════════════════════════════════════════════════════════" -ForegroundColor Magenta
|
Write-Host "===============================================" -ForegroundColor Magenta
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
# Track processes for cleanup
|
# Track processes for cleanup
|
||||||
@@ -87,7 +98,13 @@ function Cleanup {
|
|||||||
trap { Cleanup; break }
|
trap { Cleanup; break }
|
||||||
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action { Cleanup } | Out-Null
|
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action { Cleanup } | Out-Null
|
||||||
|
|
||||||
# 1. ChromeDriver
|
# Skip external services if DesktopOnly
|
||||||
|
if ($DesktopOnly) {
|
||||||
|
$NoBrowser = $true
|
||||||
|
$NoGateway = $true
|
||||||
|
}
|
||||||
|
|
||||||
|
# 1. ChromeDriver (optional)
|
||||||
if (-not $NoBrowser) {
|
if (-not $NoBrowser) {
|
||||||
info "Checking ChromeDriver..."
|
info "Checking ChromeDriver..."
|
||||||
|
|
||||||
@@ -114,11 +131,13 @@ if (-not $NoBrowser) {
|
|||||||
info "Download: https://chromedriver.chromium.org/downloads"
|
info "Download: https://chromedriver.chromium.org/downloads"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
info "Skipping ChromeDriver"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
# 2. OpenFang Gateway
|
# 2. OpenFang Gateway (optional)
|
||||||
if (-not $NoGateway) {
|
if (-not $NoGateway) {
|
||||||
info "Checking OpenFang Gateway..."
|
info "Checking OpenFang Gateway..."
|
||||||
|
|
||||||
@@ -156,10 +175,12 @@ if (-not $NoGateway) {
|
|||||||
warn "Gateway did not respond within 30s"
|
warn "Gateway did not respond within 30s"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn "OpenFang CLI not found"
|
warn "OpenFang CLI not found. Gateway not started."
|
||||||
info "Install: https://github.com/openfang/openfang"
|
info "The app will run in standalone mode."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
info "Skipping OpenFang Gateway"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
@@ -168,6 +189,17 @@ Write-Host ""
|
|||||||
info "Starting ZCLAW Desktop..."
|
info "Starting ZCLAW Desktop..."
|
||||||
Set-Location "$ScriptDir/desktop"
|
Set-Location "$ScriptDir/desktop"
|
||||||
|
|
||||||
|
# Check if port 1420 is in use
|
||||||
|
$port1420 = netstat -ano | Select-String ":1420.*LISTENING"
|
||||||
|
if ($port1420) {
|
||||||
|
$pid1420 = ($port1420 -split '\s+')[-1]
|
||||||
|
if ($pid1420 -match '^\d+$') {
|
||||||
|
warn "Port 1420 is in use by PID $pid1420. Killing..."
|
||||||
|
Stop-Process -Id $pid1420 -Force -ErrorAction SilentlyContinue
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($Dev) {
|
if ($Dev) {
|
||||||
info "Development mode enabled"
|
info "Development mode enabled"
|
||||||
pnpm tauri dev
|
pnpm tauri dev
|
||||||
|
|||||||
Reference in New Issue
Block a user