OpenCode 是一个 AI 驱动的命令行编码助手,能够在终端中直接理解上下文、执行命令、编辑代码和管理 Git 操作,帮助开发者更高效地完成日常开发任务。
1. Setup
还没有装opencode
1 2
| git clone https://github.com/yandy/agent-config.git ~/.config/opencode bun add -g opencode-ai
|
已经装了opencode
1 2 3 4 5 6 7
| cd ~/.config/opencode
git init git branch -M main git remote add origin https://github.com/yandy/agent-config.git git fetch -p origin git reset --hard origin/main
|
add a fish abbr
~/.config/fish/conf.d/opencode.fish
1 2 3 4 5
| function opencode_ext echo "env OPENCODE_ENABLE_EXA=1 OPENCODE_EXPERIMENTAL_LSP_TOOL=1 opencode --port" end
abbr -a opencode -f opencode_ext
|
2. Plugins
为项目开启
1 2 3 4 5 6 7 8 9 10
| mkdir -p .opencode cat > .opencode/opencode.json <<- 'EOM' { "$schema": "https://opencode.ai/config.json", "plugin": [ "superpowers@git+https://github.com/obra/superpowers.git" ] } EOM
|
前置条件
1 2
| uv tool install graphifyy
|
为项目开启
1
| graphify opencode install
|
3. Skills Management
3.1 Add skill
1 2 3
| bunx skills add <package> --skill <skills> -a opencode -y # eg. bunx skills add anthropics/skills --skill pdf docx -a opencode -y
|
3.2 Update skills
3.3 Current skills
1 2 3
| bun add -g playwright @playwright/cli playwright install chromium firefox
|