Files
persistent-chat-plugin/cursor-config/deploy-cursor-config.sh
卡若AI ec540f6625 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>
2026-06-29 18:00:46 +08:00

37 lines
1.2 KiB
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.

#!/usr/bin/env bash
# 将 Gitea 仓库内 cursor-config 部署到本机 Cursorco-chat → pchat 唯一套)
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
WS="${1:-$PWD}"
echo "=== deploy cursor-config → $WS ==="
mkdir -p "$WS/.cursor/rules/_retired" "$WS/.cursor"
python3 -c "
import json, pathlib
src=pathlib.Path('$ROOT/cursor-config/mcp.project.json')
dst=pathlib.Path('$WS/.cursor/mcp.json')
data=json.loads(src.read_text())
pc=data.get('mcpServers',{}).get('persistent-chat',{})
if pc:
args=pc.get('args') or []
if args: args[0]='--workspace=$WS'
env=pc.get('env') or {}
env['PCHAT_WORKSPACE']='$WS'
pc['env']=env
pc['args']=args
dst.write_text(json.dumps(data, indent=2, ensure_ascii=False)+'\n')
"
cp -f "$ROOT/cursor-config/mcp.user.json" "$HOME/.cursor/mcp.json"
cp -f "$ROOT/cursor-config/rules/persistent-chat.mdc" "$WS/.cursor/rules/persistent-chat.mdc"
cp -f "$ROOT/cursor-config/rules/pchat-composer.mdc" "$WS/.cursor/rules/pchat-composer.mdc"
if [[ -f "$WS/.cursor/rules/co-chat.mdc" ]]; then
mv -f "$WS/.cursor/rules/co-chat.mdc" "$WS/.cursor/rules/_retired/co-chat.mdc"
echo "co-chat.mdc → _retired"
fi
bash "$ROOT/scripts/co-integration/sync_pchat_runtime.sh"
echo "完成。请 Cmd+Q 重启 Cursor。"