opencode工具及相关插件安装笔记

1.安装OpenCode

1.1 nodejs安装

1
2
3
4
5
6
7
8
# 1.下载并安装 n 和 Node.js:
>> curl -fsSL https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-install | bash -s 24
# 2.Node.js 已在 n 安装时安装,但是你也可以手动安装它:
# n install 24
# 验证 Node.js 版本:
>> node -v # Should print "v24.16.0".
# 3.验证 npm 版本:
>> npm -v # Should print "11.13.0".

1.2 安装opencode

1
>> npm install -g opencode-ai

2.superpowers插件

2.1 安装superpowers

1
2
3
4
5
6
7
# 1.下载插件
>> git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers
# 2.创建目录
>> mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills
# 3.软链接:插件+技能
>> ln -s ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js ~/.config/opencode/plugins/superpowers.js
>> ln -s ~/.config/opencode/superpowers/skills ~/.config/opencode/skills/superpowers

2.2 更新superpowers

1
2
# 进入插件工程路径,拉取最新代码即可
>> cd ~/.config/opencode/superpowers && git pull

2.3 卸载superpowers

1
2
3
>> rm -rf ~/.config/opencode/superpowers
>> rm -f ~/.config/opencode/plugins/superpowers.js
>> rm -rf ~/.config/opencode/skills/superpowers

3.xiaomi mimo配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 1.编辑配置文件
>> vim ~/.config/opencode/opencode.json
# 2.替换如下配置内容:注意替换你自己的api_key
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"mimo": {
"npm": "@ai-sdk/openai-compatible",
"name": "MiMo",
"options": {
"baseURL": "https://token-plan-cn.xiaomimimo.com/v1",
"apiKey": "YOUR_KEY"
},
"models": {
"mimo-v2.5-pro": {
"name": "mimo-v2.5-pro",
"limit": {
"context": 1048576,
"output": 131072
},
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
}
},
"mimo-v2.5": {
"name": "mimo-v2.5",
"limit": {
"context": 1048576,
"output": 131072
},
"modalities": {
"input": [
"text", "image"
],
"output": [
"text"
]
}
}
}
}
}
}

4.rtk插件

4.1 安装cargo工具

1
2
3
4
5
6
7
8
# 1.安装rust,自带cargo
>> curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# 2.添加环境变量
>> echo 'source "$HOME/.cargo/env"' >> ~/.zshrc
>> source ~/.zshrc
# 3.查看版本
>> cargo --version
cargo 1.96.0 (30a34c682 2026-05-25)

4.2 安装rtk插件

1
2
3
4
5
# 1.安装插件
>> cargo install --git https://github.com/rtk-ai/rtk
# 2.引入工具
>> rtk init -g --opencode # opencode
>> rtk init -g --codex # codex

5.CodeGraph插件

1
2
3
4
# 1.安装插件
>> npm install -g @colbymchenry/codegraph
# 2.当前项目运行
>> codegraph install

6.页面无法粘贴

  • (1) 显示服务
1
2
>> echo $XDG_SESSION_TYPE
x11
  • (2) 安装工具
1
>> sudo apt update && sudo apt install -y xclip

参考资料