Files
cursor2api/dev-stealth.sh
BaskDuan e6e15c86d1 fix: dev:stealth 等待 stealth-proxy 就绪后再启动 cursor2api
避免请求到达时 stealth-proxy 还未 ready 导致 fetch failed。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 23:04:35 +08:00

23 lines
630 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# 本地开发:先启动 stealth-proxy等就绪后再启动 cursor2api
# 启动 stealth-proxy后台
node stealth-proxy/index.js &
STEALTH_PID=$!
# 等待就绪
echo "[dev-stealth] Waiting for stealth-proxy to be ready..."
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:3011/health 2>/dev/null | grep -q '"ok"'; then
echo "[dev-stealth] stealth-proxy is ready!"
break
fi
sleep 2
done
# 捕获退出信号,同时杀掉 stealth-proxy
trap "kill $STEALTH_PID 2>/dev/null; exit 0" TERM INT
# 启动 cursor2api
STEALTH_PROXY=http://127.0.0.1:3011 npx tsx watch src/index.ts