AI 先读 AGENTS.md 自主完成安装/排错;install.sh 同步 Hub、部署 MCP、冒烟验收。 修复 sync_pchat_runtime 使用本仓库 lib/src/web 结构。 Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.2 KiB
Bash
Executable File
37 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# 将 Gitea 仓库内 cursor-config 部署到本机 Cursor(co-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。"
|