一键配置 OpenCode 环境,集成 oh-my-openagent、GSD 工作流和完整的 Agent 生态。
curl -fsSL https://raw.githubusercontent.com/Liber1917/opencode-setup/main/setup-opencode.sh | bash或克隆后运行:
git clone https://github.com/Liber1917/opencode-setup.git
cd opencode-setup
./setup-opencode.sh- Bun 运行时 — 无需预装 Node.js,自动安装 Bun,避免跨平台 PATH 问题
- oh-my-openagent — 10 个 Agent + 8 个 Category 的模型路由
- GSD 工作流 — 项目全生命周期管理
- 零假设 — 不依赖任何预装工具(除 curl 和 git)
~/.config/opencode/
├── opencode.json ← Provider + 插件配置(oh-my-openagent + superpowers)
├── oh-my-openagent.json ← Agent 模型路由
├── node_modules/ ← oh-my-openagent + superpowers 插件
├── get-shit-done/ ← GSD 工作流(自动克隆)
└── skills/ ← 技能链接库
~/.claude/
└── settings.json ← Hooks 配置
curl -fsSL https://raw.githubusercontent.com/Liber1917/opencode-setup/main/setup-opencode.sh | bash安装脚本会自动:
- 检测已有配置并备份
- 生成 opencode.json / oh-my-openagent.json / Claude settings
- 安装 Bun 运行时(如未安装)
- 通过 Bun 安装 OpenCode
- 安装 oh-my-openagent 插件
- 安装 GSD 工作流
export OPENCODE_CONFIG_DIR=/custom/path/opencode
export CLAUDE_CONFIG_DIR=/custom/path/claude
./setup-opencode.sh./backup-opencode-config.shnano ~/.config/opencode/opencode.json{
"provider": {
"anthropic": {
"options": {
"apiKey": "sk-your-key-here",
"baseURL": "https://api.anthropic.com"
}
}
}
}使用 DeepSeek(Anthropic 兼容接口):
{
"provider": {
"anthropic": {
"options": {
"apiKey": "sk-your-deepseek-key",
"baseURL": "https://api.deepseek.com/anthropic"
}
}
}
}oh-my-openagent 使用源码内置的默认模型 + 回退链,开箱即用。
如需自定义,编辑 ~/.config/opencode/oh-my-openagent.json,为 agent 添加 model 字段:
{
"agents": {
"oracle": {"model": "deepseek/deepseek-v4-flash"},
"explore": {"model": "deepseek/deepseek-v4-flash"},
"sisyphus-junior": {"model": "deepseek/deepseek-v4-flash"}
}
}不设 model = 使用内置默认,优先级:
agent model > category model > 用户 fallback_models > 源码内置回退链 > OpenCode 默认
| Agent | 职责 |
|---|---|
| hephaestus | 构建与实现 |
| oracle | 架构、调试、高难度推理 |
| librarian | 外部文档、OSS 代码搜索 |
| explore | 代码库模式发现 |
| multimodal-looker | PDF/图片分析 |
| prometheus | 规划与策略 |
| metis | 预规划顾问 |
| momus | 计划评审 |
| atlas | 知识管理 |
| sisyphus-junior | 专注任务执行 |
| Category | 适用场景 |
|---|---|
| visual-engineering | 前端、UI/UX、CSS |
| ultrabrain | 复杂逻辑、算法 |
| deep | 自主问题解决 |
| artistry | 创意/非常规方案 |
| quick | 单文件简单修改 |
| unspecified-low | 低难度杂项 |
| unspecified-high | 高难度杂项 |
| writing | 文档、写作 |
GSD (Get Shit Done) 提供完整的项目生命周期管理:
| 命令 | 功能 |
|---|---|
/gsd-new-project |
初始化项目 |
/gsd-plan-phase |
创建执行计划 |
/gsd-execute-phase |
带原子提交的执行 |
/gsd-progress |
进度跟踪 |
/gsd-help |
全部命令列表 |
原因:在 WSL 中运行了 Windows npm 安装的 opencode。
解决:用 Bun 在 WSL 内重新安装:
# 确保在 WSL 内执行
curl -fsSL https://bun.sh/install | bash
source ~/.bashrc
bun install -g opencode-ai重启 OpenCode 会话后生效。
git clone https://github.com/OpenAgentsInc/gsd.git ~/.config/opencode/get-shit-done在 OpenCode 终端会话内运行命令。
- curl(安装 Bun 用)
- git(安装 GSD 用)
- 网络连接
Bun 和 OpenCode 由脚本自动安装。
| 文件 | 说明 |
|---|---|
setup-opencode.sh |
统一安装脚本(推荐) |
backup-opencode-config.sh |
配置文件备份 |
MIT