health-plugins
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/health:plugins
/health:plugins
Diagnose and fix issues with the Claude Code plugin registry. This command specifically addresses issue #14202 where project-scoped plugins incorrectly appear as globally installed.
诊断并修复Claude Code插件注册表的问题。此命令专门解决问题#14202:项目范围的插件错误地显示为全局安装。
When to Use This Skill
何时使用此技能
| Use this skill when... | Use another approach when... |
|---|---|
| Fixing plugin registry corruption (issue #14202) | Comprehensive health check (use |
| Diagnosing project-scope vs global plugin issues | Auditing plugins for relevance (use |
| Cleaning up orphaned plugin entries | Settings validation only needed |
| Resolving "plugin already installed" errors | Agentic optimization audit (use |
| Manually inspecting registry JSON | Just viewing installed plugins (read registry file) |
| 适合使用此技能的场景... | 适合使用其他方法的场景... |
|---|---|
| 修复插件注册表损坏(问题#14202) | 全面健康检查(使用 |
| 诊断项目范围与全局插件的问题 | 审核插件相关性(使用 |
| 清理孤立的插件条目 | 仅需验证设置 |
| 解决“插件已安装”错误 | 智能体优化审核(使用 |
| 手动检查注册表JSON | 仅查看已安装插件(直接读取注册表文件) |
Context
上下文
- Current project: !
pwd - Plugin registry exists: !
find ~/.claude/plugins -maxdepth 1 -name 'installed_plugins.json' 2>/dev/null - Project settings exists: !
find . -maxdepth 1 -name '.claude/settings.json' 2>/dev/null - Project plugins dir: !
find . -maxdepth 1 -type d -name \'.claude-plugin\' 2>/dev/null
- 当前项目: !
pwd - 插件注册表是否存在: !
find ~/.claude/plugins -maxdepth 1 -name 'installed_plugins.json' 2>/dev/null - 项目设置是否存在: !
find . -maxdepth 1 -name '.claude/settings.json' 2>/dev/null - 项目插件目录: !
find . -maxdepth 1 -type d -name \'.claude-plugin\' 2>/dev/null
Background: Issue #14202
背景:问题#14202
When a plugin is installed with in one project, other projects incorrectly show the plugin as "(installed)" in the Marketplaces view. This happens because:
--scope project- The plugin registry at stores
~/.claude/plugins/installed_plugins.jsonfor project-scoped installsprojectPath - The Marketplaces view only checks if a plugin key exists, not whether it's installed for the current project
- The install command refuses to install because it thinks the plugin already exists
Impact: Users cannot install the same plugin across multiple projects with project-scope isolation.
当在某个项目中使用参数安装插件时,其他项目会在市场视图中错误地显示该插件为“已安装”。原因如下:
--scope project- 位于的插件注册表会为项目范围的安装记录
~/.claude/plugins/installed_plugins.jsonprojectPath - 市场视图仅检查插件密钥是否存在,而不验证它是否为当前项目安装的
- 安装命令会拒绝安装,因为它认为插件已存在
影响: 用户无法在多个项目中以项目范围隔离的方式安装同一个插件。
Parameters
参数
| Parameter | Description |
|---|---|
| Apply fixes to the plugin registry |
| Show what would be fixed without making changes |
| Check/fix a specific plugin only |
| 参数 | 描述 |
|---|---|
| 对插件注册表应用修复 |
| 显示会修复的内容但不实际修改 |
| 仅检查/修复指定插件 |
Execution
执行步骤
Execute this plugin registry diagnostic:
执行此插件注册表诊断:
Step 1: Read the plugin registry
步骤1:读取插件注册表
- Read
~/.claude/plugins/installed_plugins.json - Parse each plugin entry to extract: plugin name and source, whether it has a (project-scoped), and the installation timestamp and version
projectPath
- 读取
~/.claude/plugins/installed_plugins.json - 解析每个插件条目,提取:插件名称和来源、是否包含(项目范围)、安装时间戳和版本
projectPath
Step 2: Identify issues in the registry
步骤2:识别注册表中的问题
Check for these issue types:
| Issue Type | Detection | Severity |
|---|---|---|
| Orphaned projectPath | | WARN |
| Missing from current project | Plugin has different | INFO |
| Duplicate scopes | Same plugin installed both globally and per-project | WARN |
| Invalid entry | Missing required fields or malformed data | ERROR |
检查以下问题类型:
| 问题类型 | 检测方式 | 严重程度 |
|---|---|---|
| 孤立的projectPath | | 警告 |
| 当前项目中缺失 | 插件的 | 信息 |
| 重复范围 | 同一插件同时安装了全局和项目版本 | 警告 |
| 无效条目 | 缺少必填字段或数据格式错误 | 错误 |
Step 3: Report findings
步骤3:报告检测结果
Print a structured diagnostic report listing all installed plugins with scope and status, followed by issues found with severity, details, and suggested fixes.
打印结构化诊断报告,列出所有已安装插件的范围和状态,然后按严重程度列出发现的问题、详细信息和建议修复方案。
Step 4: Apply fixes (if --fix flag)
步骤4:应用修复(如果使用--fix参数)
For each issue, apply the appropriate fix:
- Orphaned projectPath -- remove the orphaned entry from installed_plugins.json
- Plugin needed in current project -- ask user which plugins to install, add new entry with current , update
projectPathwith.claude/settings.jsonif neededenabledPlugins
Before making changes:
- Create backup:
~/.claude/plugins/installed_plugins.json.backup - Validate JSON after modifications
- Report what was changed
针对每个问题,应用相应的修复:
- 孤立的projectPath -- 从installed_plugins.json中删除孤立条目
- 当前项目需要的插件 -- 询问用户要安装哪些插件,添加带有当前的新条目,必要时更新
projectPath中的.claude/settings.jsonenabledPlugins
在进行修改前:
- 创建备份:
~/.claude/plugins/installed_plugins.json.backup - 修改后验证JSON格式
- 报告已修改的内容
Step 5: Verify the fix
步骤5:验证修复效果
After applying fixes:
- Re-read the registry
- Confirm issues are resolved
- Remind user to restart Claude Code for changes to take effect
应用修复后:
- 重新读取注册表
- 确认问题已解决
- 提醒用户重启Claude Code以使更改生效
Registry Structure Reference
注册表结构参考
json
{
"version": 2,
"plugins": {
"plugin-name@marketplace-name": [
{
"scope": "project",
"projectPath": "/path/to/project",
"installPath": "~/.claude/plugins/cache/marketplace/plugin-name/1.0.0",
"version": "1.0.0",
"installedAt": "2024-01-15T10:30:00Z",
"lastUpdated": "2024-01-15T10:30:00Z",
"gitCommitSha": "abc123"
}
]
}
}Scope types:
- — has
"scope": "project", only active in that projectprojectPath - — no
"scope": "user", active globallyprojectPath
json
{
"version": 2,
"plugins": {
"plugin-name@marketplace-name": [
{
"scope": "project",
"projectPath": "/path/to/project",
"installPath": "~/.claude/plugins/cache/marketplace/plugin-name/1.0.0",
"version": "1.0.0",
"installedAt": "2024-01-15T10:30:00Z",
"lastUpdated": "2024-01-15T10:30:00Z",
"gitCommitSha": "abc123"
}
]
}
}范围类型:
- — 包含
"scope": "project",仅在该项目中生效projectPath - — 无
"scope": "user",全局生效projectPath
Manual Workaround
手动解决方法
If automatic fix fails, users can manually edit :
~/.claude/plugins/installed_plugins.json- Open the file in an editor
- Find the plugin entry
- Either:
- Remove to make it global
projectPath - Change to current project path
projectPath - Add a new entry with different key for current project
- Remove
- Save and restart Claude Code
如果自动修复失败,用户可以手动编辑:
~/.claude/plugins/installed_plugins.json- 在编辑器中打开该文件
- 找到插件条目
- 选择以下操作之一:
- 删除使其变为全局插件
projectPath - 将修改为当前项目路径
projectPath - 为当前项目添加一个带有不同密钥的新条目
- 删除
- 保存并重启Claude Code
Agentic Optimizations
智能体优化建议
| Context | Command |
|---|---|
| Plugin registry diagnostics | |
| Fix registry issues | |
| Dry-run mode | |
| Inspect registry | |
| Check specific plugin | |
| List orphaned paths | |
| 场景 | 命令 |
|---|---|
| 插件注册表诊断 | |
| 修复注册表问题 | |
| 试运行模式 | |
| 检查注册表 | |
| 检查指定插件 | |
| 列出孤立路径 | |
Flags
标识
| Flag | Description |
|---|---|
| Apply fixes (with confirmation prompts) |
| Show what would be fixed without changes |
| Target a specific plugin |
| 标识 | 描述 |
|---|---|
| 应用修复(带确认提示) |
| 显示会修复的内容但不实际修改 |
| 目标为指定插件 |
See Also
另请参阅
- - Full diagnostic scan
/health:check - - Settings file validation
/health:settings - Issue #14202 - Upstream bug report
- - 完整诊断扫描
/health:check - - 设置文件验证
/health:settings - Issue #14202 - 上游Bug报告