name: 安装上下文 description: 从注册表安装上下文文件。当用户提到"安装上下文"、"下载上下文"或上下文缺失时使用。 disable-model-invocation: true
安装上下文
概述
指导用户通过选择配置文件从OpenAgents Control注册表安装上下文文件。
开始时宣布: “我正在使用安装上下文技能来设置您的上下文文件。”
过程
步骤 1: 检查当前安装
cat ${CLAUDE_PLUGIN_ROOT}/.context-manifest.json 2>/dev/null
如果存在: 显示当前配置文件并询问是否要更改/重新安装。
如果缺失: 继续步骤 2。
步骤 2: 询问选择哪个配置文件
提供选项,请用户选择:
可用配置文件:
essential - 仅核心模式 (~4 组件, 30秒)
standard - 典型使用 (~12 组件, 2分钟) [推荐]
extended - 高级功能 (~30 组件, 5分钟)
specialized - 领域特定 (~50 组件, 10分钟)
all - 全部 (~191 组件, 20分钟)
选择哪个配置文件? [standard]
等待响应。
步骤 3: 运行安装器
cd ${CLAUDE_PLUGIN_ROOT}/scripts
bun run install-context.ts --profile={selected_profile}
如果 bun 不可用,回退到: node install-context.js --profile={selected_profile}
如果用户提供了 --force 或 --dry-run: 传递这些标志。
向用户显示输出。
步骤 4: 验证
cat ${CLAUDE_PLUGIN_ROOT}/.context-manifest.json
ls ${CLAUDE_PLUGIN_ROOT}/context/
报告: “✓ 已安装 {count} 组件。上下文准备就绪。”
CLI 选项
如果用户提供选项,跳过交互式提示:
/install-context --profile=essential
/install-context --force
/install-context --dry-run
/install-context --categories=core-standards,openagents-repo
错误处理
未安装 Git:
✗ 需要 Git。安装: brew install git
网络故障:
✗ 无法连接到 GitHub。检查连接并重试。
已安装(没有使用 --force):
⚠ 已安装。使用 --force 重新安装。
记住
- 保持简单 - 只需安装和验证
- 不要过度解释配置文件
- 显示安装器进度
- 验证清单存在
- 完成
相关
using-oac- 使用已安装的上下文context-discovery- 从已安装的上下文中发现