feat: 根目录 AI 安装指引 AGENTS.md + install.sh 一键安装
AI 先读 AGENTS.md 自主完成安装/排错;install.sh 同步 Hub、部署 MCP、冒烟验收。 修复 sync_pchat_runtime 使用本仓库 lib/src/web 结构。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
27
scripts/co-integration/sync_pchat_runtime.sh
Normal file → Executable file
27
scripts/co-integration/sync_pchat_runtime.sh
Normal file → Executable file
@@ -1,25 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# 将 .persistent-chat-v1.1/lib 同步到 ~/.persistent-chat-local/lib 并重启 Hub
|
||||
# 将本仓库源码同步到 ~/.persistent-chat-local 并重启 Hub
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
REPO="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
DST="$HOME/.persistent-chat-local"
|
||||
SRC_LIB="$ROOT/.persistent-chat-v1.1/lib"
|
||||
PORT="${PCHAT_HTTP_PORT:-13458}"
|
||||
NODE="${PCHAT_NODE:-$(command -v node)}"
|
||||
|
||||
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
|
||||
mkdir -p "$DST/lib" "$DST/logs"
|
||||
rsync -a --delete "$REPO/lib/" "$DST/lib/"
|
||||
cp -f "$REPO/src/hub.js" "$DST/hub.js"
|
||||
cp -f "$REPO/src/server.js" "$DST/server.js"
|
||||
cp -f "$REPO/src/cursor-title.js" "$DST/cursor-title.js" 2>/dev/null || true
|
||||
cp -f "$REPO/scripts/ensure-hub.sh" "$DST/ensure-hub.sh"
|
||||
cp -f "$REPO/scripts/mongo_sync.py" "$DST/mongo_sync.py" 2>/dev/null || true
|
||||
cp -f "$REPO/web/panel.html" "$DST/panel.html"
|
||||
cp -f "$REPO/web/panel-enhance.html" "$DST/panel-enhance.html" 2>/dev/null || \
|
||||
cp -f "$REPO/web/panel.html" "$DST/panel-enhance.html"
|
||||
chmod +x "$DST/ensure-hub.sh" 2>/dev/null || true
|
||||
|
||||
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 &
|
||||
nohup "$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
|
||||
|
||||
Reference in New Issue
Block a user