context-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstall Context
安装上下文
Announce: "Let me set up your context files."
告知用户:“我来为你设置上下文文件。”
Why Context Files Matter
上下文文件的重要性
Context files are project-specific standards that every AI agent loads before writing code. Without them:
- Code won't follow your team's naming conventions or architecture patterns
- Security and quality standards won't be applied automatically
- Every agent starts from scratch instead of building on established patterns
With context files, every agent — coder, reviewer, tester — follows the same standards without you repeating yourself.
上下文文件是项目专属的标准配置,所有AI agent在编写代码前都会加载这些文件。如果没有它们:
- 代码将无法遵循你的团队命名规范或架构模式
- 安全与质量标准无法自动应用
- 每个agent都要从零开始,而非基于已确立的模式构建
有了上下文文件后,无论是编码、评审还是测试agent,所有角色都会遵循相同的标准,无需你重复说明。
Quick Check
快速检查
Run this single command to see everything relevant at once:
bash
echo "=== Environment ===" && \
{ command -v git >/dev/null 2>&1 && echo "✓ git $(git --version | cut -d' ' -f3)" || echo "✗ git: not found — required"; } && \
{ command -v node >/dev/null 2>&1 && echo "✓ node $(node --version)" || echo " node: not found (bash installer works without it)"; } && \
echo "=== Context Status ===" && \
{ [ -f .claude/.context-manifest.json ] \
&& echo "Project: ✓ installed — $(grep -o '"profile": "[^"]*"' .claude/.context-manifest.json | head -1 | cut -d'"' -f4) profile" \
|| echo "Project: not installed"; } && \
{ [ -f ~/.claude/.context-manifest.json ] \
&& echo "Global: ✓ installed — $(grep -o '"profile": "[^"]*"' ~/.claude/.context-manifest.json | head -1 | cut -d'"' -f4) profile" \
|| echo "Global: not installed"; } && \
{ [ -f .oac.json ] && echo ".oac.json: ✓ exists" || echo ".oac.json: not found"; }If already installed: show the status, ask if they want to reinstall () or switch profiles.
--forceIf git is missing: stop and show the install instructions for git. Nothing else will work.
运行以下单个命令即可一次性查看所有相关信息:
bash
echo "=== Environment ===" && \
{ command -v git >/dev/null 2>&1 && echo "✓ git $(git --version | cut -d' ' -f3)" || echo "✗ git: not found — required"; } && \
{ command -v node >/dev/null 2>&1 && echo "✓ node $(node --version)" || echo " node: not found (bash installer works without it)"; } && \
echo "=== Context Status ===" && \
{ [ -f .claude/.context-manifest.json ] \
&& echo "Project: ✓ installed — $(grep -o '"profile": "[^"]*"' .claude/.context-manifest.json | head -1 | cut -d'"' -f4) profile" \
|| echo "Project: not installed"; } && \
{ [ -f ~/.claude/.context-manifest.json ] \
&& echo "Global: ✓ installed — $(grep -o '"profile": "[^"]*"' ~/.claude/.context-manifest.json | head -1 | cut -d'"' -f4) profile" \
|| echo "Global: not installed"; } && \
{ [ -f .oac.json ] && echo ".oac.json: ✓ exists" || echo ".oac.json: not found"; }**若已安装:**显示状态,询问用户是否要重新安装()或切换配置文件。
--force**若git缺失:**停止操作并显示git的安装说明。没有git的话其他操作都无法进行。
Ask Two Questions (then install)
询问两个问题(然后安装)
Present both together as one message:
Where do you want to install context?
1. This project only — .claude/context/ (just for this repo)
2. Globally — ~/.claude/context/ (shared by all your projects)
Which profile?
standard — Core coding standards, security patterns, dev workflows (recommended, ~30s)
extended — Everything above + UI, data, content, product domains (~1 min)
all — The full library (~2 min)Wait for answers before running anything.
将两个问题合并为一条消息呈现:
你想将上下文安装在哪里?
1. 仅当前项目 — .claude/context/ (仅适用于此仓库)
2. 全局安装 — ~/.claude/context/ (所有项目共享)
选择哪个配置文件?
standard — 核心编码标准、安全模式、开发工作流 (推荐,约30秒)
extended — 包含以上所有内容 + UI、数据、内容、产品领域 (约1分钟)
all — 完整库 (约2分钟)等待用户回复后再执行任何操作。
Run the Installer
运行安装程序
Read the Plugin Root from OAC System Paths in your session context. Use that literal path.
On Mac / Linux — prefer the bash installer (git only, no node needed):
bash
bash "{PLUGIN_ROOT}/scripts/install-context.sh" --profile={profile} [--global]On Windows (or if bash fails) — use the node installer:
bash
node "{PLUGIN_ROOT}/scripts/install-context.js" --profile={profile} [--global]Both accept to reinstall over an existing install.
--forceShow the installer output live as it runs.
从会话上下文的OAC System Paths中读取插件根目录,使用该路径的字面量。
在Mac / Linux系统上 — 优先使用bash安装程序(仅需git,无需node):
bash
bash "{PLUGIN_ROOT}/scripts/install-context.sh" --profile={profile} [--global]在Windows系统上(或bash安装失败时) — 使用node安装程序:
bash
node "{PLUGIN_ROOT}/scripts/install-context.js" --profile={profile} [--global]两种安装方式都支持参数,用于覆盖现有安装重新安装。
--force实时显示安装程序的输出内容。
Verify
验证
bash
{ [ -f .claude/.context-manifest.json ] && echo "Project: ✓" || echo "Project: not found"; } && \
{ [ -f ~/.claude/.context-manifest.json ] && echo "Global: ✓" || echo "Global: not found"; } && \
{ [ -f .oac.json ] && echo ".oac.json: ✓" || echo ".oac.json: missing (project installs need this)"; }For project installs: if is missing, create it:
.oac.jsonbash
printf '{\n "version": "1",\n "context": {\n "root": ".claude/context"\n }\n}\n' > .oac.jsonConfirm to the user: "You're ready. Every agent will now load these standards automatically."
bash
{ [ -f .claude/.context-manifest.json ] && echo "Project: ✓" || echo "Project: not found"; } && \
{ [ -f ~/.claude/.context-manifest.json ] && echo "Global: ✓" || echo "Global: not found"; } && \
{ [ -f .oac.json ] && echo ".oac.json: ✓" || echo ".oac.json: missing (project installs need this)"; }对于项目级安装:如果缺失,创建该文件:
.oac.jsonbash
printf '{\n "version": "1",\n "context": {\n "root": ".claude/context"\n }\n}\n' > .oac.json向用户确认:“已准备就绪。所有agent现在都会自动加载这些标准配置。”
Error Handling
错误处理
git: command not found✗ Git is required.
Mac: brew install git
Linux: sudo apt install git
Windows: https://git-scm.com/download/winCannot find module '...install-context.js'ls "{PLUGIN_ROOT}/scripts/"Network failure: Check internet connection and retry.
git: command not found✗ 需要安装Git。
Mac: brew install git
Linux: sudo apt install git
Windows: https://git-scm.com/download/winCannot find module '...install-context.js'ls "{PLUGIN_ROOT}/scripts/"**网络故障:**检查网络连接并重试。
Remember
注意事项
- Read Plugin Root from OAC System Paths in session context — never use as a shell variable
$CLAUDE_PLUGIN_ROOT - Ask scope + profile together — don't ask them as separate conversations
- Show the quick check output before asking questions
- Wait for confirmation before running the installer
- Global installs don't need — discovery chain finds
.oac.jsonautomatically~/.claude/context/
- 从会话上下文的OAC System Paths中读取插件根目录——切勿将作为shell变量使用
$CLAUDE_PLUGIN_ROOT - 同时询问安装范围和配置文件——不要分开展开对话
- 在询问问题前显示快速检查的输出结果
- 等待用户确认后再运行安装程序
- 全局安装不需要——发现链会自动找到
.oac.json~/.claude/context/