Plugin marketplace installation flow needs improvement
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code Plugin Marketplace Installation Issue Report
## 问题描述
当前 /plugin marketplace add 命令的安装流程存在以下问题:
### 1. 缺少预检查机制
- 命令直接执行
git clone,不检查目标文件夹是否已存在 - 即使插件已经部分或完全下载,也会强制删除并重新克隆
### 2. 网络超时问题
- 固定 120 秒超时时间对网络较慢的用户不友好
- 没有重试机制,第一次失败后需要手动重试
### 3. 资源管理问题
- 部分下载失败时会创建空目录,导致后续操作失败(EBUSY 错误)
- 清理逻辑不够健壮
What Should Happen?
用户建议
- 改进安装流程
# 建议的检查逻辑
if [ -d "$PLUGIN_DIR/$PLUGIN_NAME" ]; then
if [ -d "$PLUGIN_DIR/$PLUGIN_NAME/.git" ]; then
echo "Plugin already exists. Update? (y/n)"
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
cd "$PLUGIN_DIR/$PLUGIN_NAME" && git pull
else
exit 0
fi
else
echo "Incomplete installation found. Cleaning up..."
rm -rf "$PLUGIN_DIR/$PLUGIN_NAME"
fi
fi
- 增加网络容错机制
- 设置可配置的超时时间(环境变量 CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS)
- 增加重试机制(默认 2-3 次)
- 提供网络状态检测
- 提供更好的用户体验
- 显示下载进度
- 在失败时提供手动安装选项
- 保留已下载的部分文件供恢复
- 文档改进
- 在安装前检查系统网络状态
- 提供详细的错误说明和解决方案
- 支持离线安装模式
影响范围
- 网络条件较差的用户
- 大型插件仓库(如包含大量依赖的插件)
- CI/CD 环境中的自动化安装
Error Messages/Logs
## 具体错误示例
/plugin marketplace add milla-jovovich/mempalace
# 第一次:git clone 超时
Error: Failed to clone marketplace repository: Git clone timed out after 120s
# 第二次:文件夹已存在但内容不完整
Error: EBUSY: resource busy or locked, rm 'C:\Users\sjlia\.claude\plugins\marketplaces\milla-jovovich\mempalace'
Steps to Reproduce
临时解决方案
对于受影响的用户,建议:
- 设置环境变量增加超时时间:
export CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS=300000 # 5分钟
- 使用手动安装方式:
- 手动下载仓库
- 解压到插件目录
- 初始化 git 仓库
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.110
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗