Files
karuo-ai/01_卡资(金)/金仓_存储备份/脚本/cursor_bisect_fix.sh
2026-07-19 00:21:46 +08:00

59 lines
2.3 KiB
Bash
Executable File
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.

#!/bin/bash
# Cursor Extension Bisect 一键修复co-chat 残留 + persistent-chat 冲突)
# 卡若AI 2026-07-03 · 由 Cursor 复盘沉淀
# 用法bash cursor_bisect_fix.sh
set -e
echo "=========================================="
echo " Cursor Extension Bisect 一键修复"
echo "=========================================="
# 1. 备份并清理 extensions.json 中的 co-chat 注册
EXT_JSON="/Users/karuo/.cursor/extensions/extensions.json"
if [ -f "$EXT_JSON" ]; then
TS=$(date +%s)
cp "$EXT_JSON" "${EXT_JSON}.bak.bisect-fix-$TS"
echo "[1/4] 备份 extensions.json → ${EXT_JSON}.bak.bisect-fix-$TS"
python3 -c "
import json, sys
with open('$EXT_JSON','r') as f: data = json.load(f)
before = len(data)
filtered = [e for e in data if e.get('identifier',{}).get('id') != 'co-chat.co-chat-panel']
removed = [e.get('identifier',{}).get('id') for e in data if e.get('identifier',{}).get('id') == 'co-chat.co-chat-panel']
with open('$EXT_JSON','w') as f: json.dump(filtered, f, indent=2, ensure_ascii=False)
print(f' - 移除 {len(removed)} 条: {removed}')
print(f' - {before} → {len(filtered)} 条')
"
fi
# 2. 备份并清理 globalStorage 中 co-chat 残留状态
GLOBAL="/Users/karuo/Library/Application Support/Cursor/User/globalStorage/co-chat.co-chat-panel"
if [ -d "$GLOBAL" ]; then
TS=$(date +%Y%m%d_%H%M%S)
BK="/Users/karuo/.cursor/_cochat_globalStorage_backup_$TS"
mv "$GLOBAL" "$BK"
echo "[2/4] 备份 co-chat globalStorage → $BK"
else
echo "[2/4] ✅ co-chat globalStorage 已不存在"
fi
# 3. 验证 extensions/ 目录里没有 co-chat 实体
if [ -d "/Users/karuo/.cursor/extensions/co-chat.co-chat-panel-3.3.34" ]; then
echo "[3/4] ⚠️ 发现 co-chat 实体目录,请手动删除:"
echo " rm -rf /Users/karuo/.cursor/extensions/co-chat.co-chat-panel-3.3.34"
else
echo "[3/4] ✅ co-chat 实体目录已不存在"
fi
# 4. 退出 Bisect 提示
echo ""
echo "=========================================="
echo " ✅ 修复完成!请:"
echo " 1) 完全退出 CursorCmd+Q"
echo " 2) 重新打开 Cursor"
echo " 3) Bisect 弹窗应消失;按 I can't reproduce 退出"
echo ""
echo " 🔍 根本原因co-chat(破解版) 与 persistent-chat 冲突"
echo " 卡若铁律:严禁 co-chat 破解版,请用合法 Cursor Pro 账户"
echo "=========================================="