forked from agents/opencode
63 lines
1.9 KiB
Markdown
63 lines
1.9 KiB
Markdown
# opencode-config
|
||
|
||
个人 [OpenCode](https://opencode.ai) 配置文件。
|
||
|
||
## 使用
|
||
|
||
1. 安装 OpenCode
|
||
|
||
```bash
|
||
npm i -g opencode-ai
|
||
# 或
|
||
bun add -g opencode-ai
|
||
```
|
||
|
||
2. 克隆配置到 `~/.config/opencode`
|
||
|
||
```bash
|
||
git clone <repo-url> ~/.config/opencode
|
||
```
|
||
|
||
3. 参考 `.env.example` 将以下环境变量配置到系统中
|
||
|
||
| 变量 | 必填 | 说明 |
|
||
|------|------|------|
|
||
| `AI_GATEWAY_BASE_URL` | 是 | 模型服务端点 |
|
||
| `AI_GATEWAY_API_KEY` | 是 | 模型服务密钥 |
|
||
| `EXA_API_KEY` | 否 | [Exa](https://exa.ai) 搜索,提供联网能力,不配则使用默认额度 |
|
||
| `CONTEXT7_API_KEY` | 否 | [Context7](https://context7.com) 文档查询,提供库文档检索,不配则使用默认额度 |
|
||
| `OPENCODE_GIT_BASH_PATH` | 否 | Windows 用户需指定 Git Bash 路径,否则工具调用可能异常 |
|
||
|
||
4. 选择 oh-my-openagent 配置
|
||
|
||
项目提供了多套 [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) 预设配置,通过符号链接切换:
|
||
|
||
| 文件 | 说明 |
|
||
|------|------|
|
||
| `oh-my-openagent.claude.jsonc` | 主力 agent 使用 Claude 系列模型 |
|
||
| `oh-my-openagent.gpt.jsonc` | 主力 agent 使用 GPT 系列模型 |
|
||
|
||
```bash
|
||
# 使用 Claude 配置(默认)
|
||
ln -sf oh-my-openagent.claude.jsonc oh-my-openagent.jsonc
|
||
|
||
# 使用 GPT 配置
|
||
ln -sf oh-my-openagent.gpt.jsonc oh-my-openagent.jsonc
|
||
```
|
||
|
||
5. 运行 `opencode`
|
||
|
||
## 设计参考(DESIGN.md)
|
||
|
||
这个仓库也收录了来自 `VoltAgent/awesome-design-md` 的设计参考接入说明。
|
||
|
||
- 它们**不是** OpenCode skill,也不会被 `jr` 全局自动加载。
|
||
- 正确用法是:在具体项目根目录生成 `DESIGN.md`,再让 AI 在 UI 工作时参考它。
|
||
|
||
目前纳管了两套常用设计来源:
|
||
|
||
- `opencode.ai`
|
||
- `voltagent`
|
||
|
||
详细说明见 [`docs/design-md.md`](docs/design-md.md)。
|