Skip to content

Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.

restart.sh: stop only the server on this port

許元豪a043fec5e7f3
diff --git a/app/restart.sh b/app/restart.sh
index b3ed568..83c4d30 100644
--- a/app/restart.sh
+++ b/app/restart.sh
@@ -7,10 +7,14 @@ if [ "$1" != "--force" ]; then
BUSY=$(curl -s -m 2 localhost:${PORT:-4318}/api/projects | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{try{const W=['analyzing','styling','planning','replanning','producing','revising','critiquing'];console.log(JSON.parse(s).filter(p=>W.includes(p.stage)).map(p=>p.id+'('+p.stage+')').join(' '))}catch{}})")
if [ -n "$BUSY" ]; then echo "not restarting — still working: $BUSY (use --force to restart anyway)"; exit 2; fi
fi
+# stop only the server on this port (other checkouts / ports keep running)
+P=${PORT:-4318}
if command -v powershell >/dev/null 2>&1; then
- powershell -NoProfile -Command "Get-CimInstance Win32_Process | ? { \$_.CommandLine -match 'node.*server[\\\\/]index.mjs' } | % { Stop-Process -Id \$_.ProcessId -Force }" >/dev/null 2>&1 || true
+ powershell -NoProfile -Command "Get-NetTCPConnection -LocalPort $P -State Listen -ErrorAction SilentlyContinue | % { Stop-Process -Id \$_.OwningProcess -Force }" >/dev/null 2>&1 || true
+elif command -v lsof >/dev/null 2>&1; then
+ lsof -ti tcp:$P -sTCP:LISTEN | xargs kill 2>/dev/null || true
else
- pkill -f "node .*server/index.mjs" 2>/dev/null || true
+ fuser -k $P/tcp 2>/dev/null || true
fi
sleep 2
nohup node app/server/index.mjs > "$LOG" 2>&1 &