Files
persistent-chat-plugin/scripts/co-integration/sync_pchat_runtime.sh
卡若AI ba786b3700 feat: Persistent Chat v1.1 CO-Chat 整合上传 Gitea
同步 enhance/bridge/smoke/retire 模块、vendor 3.3.34、增强面板与 PRD 文档,
Hub 接入 hub-routes-prd,含安装/经验/模块说明与 co-integration 运维脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 17:42:16 +08:00

28 lines
988 B
Bash
Raw 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.

#!/usr/bin/env bash
# 将 .persistent-chat-v1.1/lib 同步到 ~/.persistent-chat-local/lib 并重启 Hub
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
DST="$HOME/.persistent-chat-local"
SRC_LIB="$ROOT/.persistent-chat-v1.1/lib"
PORT="${PCHAT_HTTP_PORT:-13458}"
mkdir -p "$DST/lib"
rsync -a --delete "$SRC_LIB/" "$DST/lib/"
cp -f "$ROOT/.persistent-chat-v1.1/panel.html" "$DST/panel-enhance.html" 2>/dev/null || true
# hub.js 需已 patch 引入 lib/hub-routes-prd.js
if ! grep -q 'hub-routes-prd' "$DST/hub.js" 2>/dev/null; then
echo "WARN: hub.js 尚未引入 hub-routes-prd请手动 patch 或更新 hub.js"
fi
if lsof -ti ":$PORT" >/dev/null 2>&1; then
lsof -ti ":$PORT" | xargs kill 2>/dev/null || true
sleep 1
fi
nohup "${PCHAT_NODE:-node}" "$DST/hub.js" >> "$DST/logs/hub.stdout.log" 2>&1 &
for i in $(seq 1 40); do
curl -sf -m 2 "http://127.0.0.1:$PORT/api/health" >/dev/null && break
sleep 0.2
done
echo "sync ok → http://127.0.0.1:$PORT/enhance"