Files
persistent-chat-plugin/vendor/cochat-engine/scripts/cochat_fix_write_permission.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

47 lines
1.6 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
# co-chat 无额度模式 / workbench 补丁 — 写入权限修复
# 根因Cursor.app/out 下目录属 root 且不可写co-chat 无法在目录内创建探针文件 →「未获得写入权限」
set -euo pipefail
CURSOR_OUT="/Applications/Cursor.app/Contents/Resources/app/out"
CURSOR_APP="/Applications/Cursor.app/Contents/Resources/app"
echo "=== co-chat 写入权限修复 ==="
echo "将修复: $CURSOR_OUT"
echo "(需要管理员密码)"
echo
if [[ ! -d "$CURSOR_OUT" ]]; then
echo "错误: 未找到 Cursor: $CURSOR_OUT"
exit 1
fi
# 1. 让当前用户对 out 树有写权限co-chat 探针 + 补丁备份需要)
sudo chmod -R u+w "$CURSOR_OUT"
sudo chmod u+w "$CURSOR_APP/product.json" 2>/dev/null || true
# 2. 验证探针(与 co-chat PermissionManager 行为一致)
WB="$CURSOR_OUT/vs/workbench/workbench.desktop.main.js"
DIR="$(dirname "$WB")"
PROBE="$DIR/.__kc_write_probe_$$"
if echo ok >"$PROBE" 2>/dev/null; then
rm -f "$PROBE"
echo "✓ workbench 目录探针写入成功"
else
echo "✗ 探针仍失败,请检查 SIP / 完全磁盘访问权限"
exit 1
fi
# 3. 检查补丁标记
if rg -q "CO_NO_QUOTA_MCP_V1_START|CO_COMPOSER_BRIDGE_START|CO_ENDLESS_RETRIES_V1" "$WB" 2>/dev/null; then
echo "✓ workbench 补丁标记已存在"
else
echo "! workbench 尚无 CO 补丁标记 — 修复权限后请在 co-chat 里:"
echo " 1) 完全退出 Cursor (Cmd+Q) 后重开"
echo " 2) 设置 → 无额度模式 关→开(或点「修复」)"
echo " 3) 若弹出管理员/写入授权 → 点「允许」"
fi
echo
echo "=== 完成。请重启 Cursor再在 co-chat 打开「无额度模式」。 ==="