SuperAPI AI Directory

update-opencode

General & other

View repository

Updated 10-16 01:37

About this skill

Update OpenCode and Oh-My-OpenCode

Overview

Keeping the OpenCode CLI and the oh-my-opencode plugin up to date is crucial for getting new features, bug fixes, and performance improvements. This document provides a complete guide to updating both components under different package manager environments.

Core Principles:

  • Use the correct package manager command to update OpenCode
  • Reinstall oh-my-opencode to get the latest version
  • Verify that the configuration is still valid after updating

When to Use

Scenarios for using this skill:

                      需要更新?
                          │
        ┌─────────────────┼─────────────────┐
        │                 │                 │
    检查新版本      更新 OpenCode    更新 oh-my-opencode
        │                 │                 │
        ▼                 ▼                 ▼
   运行命令检查    使用包管理器更新   重新运行安装命令

Use Cases

  • The user sees a version update prompt or wants to check whether a new version is available
  • Encountering feature issues and suspecting they are caused by an old version
  • Needing to use the latest features (such as new Agents or skills)
  • Installation failure or upgrade error: "seems to be managed by a package manager"
  • "opencode upgrade doesn't move to newest version"

When Not to Use

  • First-time installation of OpenCode → use the official installation guide
  • Configuration issues (unrelated to version) → check the configuration file
  • Authentication issues → use opencode auth login

Core Patterns

Update OpenCode CLI

❌ Wrong way: manually downloading a binary file to overwrite, which may cause version confusion

✅ Correct way: use the package manager's update command

Package Manager Update Command Description
Homebrew (recommended) brew install anomalyco/tap/opencode Always the latest version
Homebrew (official) brew install opencode Updates more slowly, but stable
npm/yarn/pnpm/bun npm i -g opencode-ai@latest Specify @latest to ensure the latest
Scoop (Windows) scoop update opencode Automatically updates to the latest
Chocolatey (Windows) choco upgrade opencode Automatically updates to the latest
Mise mise use -g opencode Automatically switches to the latest
Nix nix run nixpkgs#opencode Use the latest available version
Generic command opencode upgrade Automatically detects the package manager if available

Update the oh-my-opencode plugin

❌ Wrong way: manually editing opencode.json to change the version number

✅ Correct way: use the package manager's update command

# 使用 bun,如果有网络问题,需指定 registry
bun i -g oh-my-opencode@latest
# 或使用 npm,如果有网络问题,需指定 registry
npm i -g oh-my-opencode@latest

Quick Reference

Quick reference table of common update commands

Scenario Command Notes
Check how OpenCode is installed which opencode Determine which package manager to use
Check the OpenCode version opencode --version Should be ≥ 1.0.150
Check how oh-my-opencode is installed which oh-my-opencode Determine which package manager to use
Check the oh-my-opencode version oh-my-opencode version or -v Display the plugin version number

| Update the Homebrew index | brew update | If installed with Homebrew, this must be run first | | Update OpenCode (Homebrew) | brew install anomalyco/tap/opencode | Recommended, always the latest | | Update OpenCode (npm) | npm i -g opencode-ai@latest | Explicitly specify @latest | | Update OpenCode (Windows Scoop) | scoop update opencode | - | | Update oh-my-opencode (bun) | bun i -g oh-my-opencode@latest --registry=https://registry.npmmirror.com | Must specify the registry | | Update oh-my-opencode (npm) | npm i -g oh-my-opencode@latest --registry=https://registry.npmmirror.com | Must specify the registry | | View the plugin version | cat ~/.config/opencode/oh-my-opencode.json | Check the configuration information | | Verify configuration | opencode --version && oh-my-opencode version | Confirm versions match |

Troubleshooting quick reference

Error message Cause Solution
"seems to be managed by a package manager" OpenCode installed by a package manager Use the corresponding package manager update command
"opencode upgrade doesn't move to newest version" Wrong Homebrew tap used Switch to anomalyco/tap/opencode, or first run brew update
oh-my-opencode version mismatch The local version does not match the version registered in opencode.json If the version in opencode.json is newer, no action is needed; if the version in opencode.json is older, update the version number in opencode.json to match the local version
Update failed due to network issues Unable to connect to the default registry Use the --registry=https://registry.npmmirror.com parameter
Plugin failed to load Configuration file is corrupted or the version is incompatible Check the JSON syntax and reinstall
Authentication expired You need to log in again after updating Run opencode auth login
which shows the wrong path Multiple package managers may be in use Use the corresponding package manager to update based on the path
Package manager index not updated The version is checked only after brew update; otherwise an old version is retrieved Run the package manager update command first

Implementation

Complete update process

Step 1: Check the current version and installation method

# 1.1 检查 OpenCode 安装方式
which opencode
# - /opt/homebrew/bin/opencode → Homebrew 安装
# - /usr/local/bin/opencode → Homebrew 或手动安装
# - ~/.npm-global/bin/opencode → npm 安装
# - ~/.bun/bin/opencode → Bun 安装
# - 其他路径 → 需根据路径判断

# 1.2 检查 OpenCode 当前版本
opencode --version

# 1.3 检查 oh-my-opencode 安装方式
which oh-my-opencode
# - /opt/homebrew/bin/oh-my-opencode → Homebrew 安装
# - ~/.bun/bin/oh-my-opencode → Bun 安装
# - ~/.npm-global/bin/oh-my-opencode → npm 安装
# - 其他路径 → 需根据路径判断

# 1.4 检查 oh-my-opencode 版本
oh-my-opencode version                    # 显示插件版本号

# 1.5 检查 opencode.json 中注册的插件版本
cat ~/.config/opencode/opencode.json | grep -A1 "oh-my-opencode"

# 1.6 检查 oh-my-opencode 配置
cat ~/.config/opencode/oh-my-opencode.json 

Version command description:

  • oh-my-opencode version (or -v, --version): Displays the plugin version number

Version matching description:

  • oh-my-opencode version Displays the plugin version number
  • ~/.config/opencode/opencode.json shows the plugin version loaded by OpenCode
  • oh-my-opencode version The actual installed version shown should match the version registered in opencode.json
  • If they do not match, the rule is as follows: if the version in opencode.json is newer, no action is needed; if the version in opencode.json is older, update the version number in opencode.json to match the plugin version

Step 2: Update the package manager index

Based on the result of which in Step 1, update the corresponding package manager:

# Homebrew(如果 opencode 或 oh-my-opencode 在 /opt/homebrew/ 或 /usr/local/bin/)
brew update

# npm(如果需要检查 npm 包的更新)
# npm 自身不需要更新索引,直接安装 @latest 即可

# Bun(如果需要检查 bun 包的更新)
# bun 自身不需要更新索引,直接安装 @latest 即可

# 其他包管理器:根据对应包管理器的命令更新索引

Important: You must update the package manager index first; otherwise the version information retrieved may be outdated.

Step 2: Update OpenCode

macOS/Linux (Homebrew recommended):

# 更新到最新版本(推荐)
brew install anomalyco/tap/opencode

# 或使用官方 Homebrew 公式(更新较慢)
brew install opencode

npm/bun/yarn/pnpm:

npm i -g opencode-ai@latest
# 或
bun i -g opencode-ai@latest
# 或
yarn global add opencode-ai@latest
# 或
pnpm add -g opencode-ai@latest

Windows:

# Scoop
scoop update opencode

# Chocolatey
choco upgrade opencode

# 其他包管理器:参考快速参考表

Verify the update:

opencode --version

Step 3: Update oh-my-opencode

Update using npm/bun

# 使用 npm 更新(需要指定 registry)
npm i -g oh-my-opencode@latest --registry=https://registry.npmmirror.com

# 或使用 bun 更新(需要指定 registry)
bun i -g oh-my-opencode@latest --registry=https://registry.npmmirror.com

Verify the plugin:

# 检查插件是否在 opencode.json 中
cat ~/.config/opencode/opencode.json | grep oh-my-opencode

# 检查插件配置
cat ~/.config/opencode/oh-my-opencode.json

Note: If there are network issues, you must specify the --registry=https://registry.npmmirror.com parameter for the update to work properly.

Step 4: Verify the update took effect

# 4.1 验证 OpenCode 版本
opencode --version

# 4.2 验证 oh-my-opencode 版本
oh-my-opencode version                    # 显示插件版本号

# 4.3 验证 opencode.json 中注册的插件版本
cat ~/.config/opencode/opencode.json | grep -A1 "oh-my-opencode"
# 应显示类似: "oh-my-opencode@3.5.0"

# 4.4 对比版本号,如果不一致则更新 opencode.json
# 规则如下:如果opencode.json的版本更加新一点,则不需要处理,如果opencode.json的版本更旧,则更新 opencode.json 中的版本号跟插件版本一样

# 4.5 验证配置文件完整性
cat ~/.config/opencode/oh-my-opencode.json

# 4.6 验证认证状态
opencode auth list  # 确认提供商已连接

Verification criteria:

  • ✅ OpenCode version is up to date
  • ✅ oh-my-opencode version Displays the latest version number
  • ✅ opencode.json The plugin version registered in oh-my-opencode version is newer than or matches
  • ✅ The configuration file has no syntax errors
  • ✅ Authentication status is normal
  • ✅ The test command executed successfully

Step 5: Output the update log (if there is an update)

After the update is complete, if there is a version update,you mustOutput the changelog from the old version to the new version so users can understand what this update includes.

Precondition check:

  • If neither OpenCode nor oh-my-opencode has a version update (the old and new version numbers are the same), thenskip this step
  • Only components with version changes need to output the corresponding changelog

Implementation method: Use two parallel subagents to separately query and summarize the changelogs of the two tools, then integrate and output them.Note: Only start the corresponding subagent for components whose version has changed.

Repository information:

  • OpenCode: https://github.com/anomalyco/opencode
  • oh-my-opencode: https://github.com/code-yeongyu/oh-my-openagent

Query command:

# 列出最近的 releases
gh release list --repo anomalyco/opencode --limit 20
gh release list --repo code-yeongyu/oh-my-openagent --limit 20

# 查看特定版本的 release notes
gh release view v<VERSION> --repo anomalyco/opencode
gh release view v<VERSION> --repo code-yeongyu/oh-my-openagent

Output requirements:

  1. Use two subagents to query in parallel:

    • Subagent 1: Query all release notes for OpenCode from the old version to the new version, and summarize the key points
    • Subagent 2: Query all release notes for oh-my-opencode from the old version to the new version, and summarize the key points
  2. Key content(by priority):

    • 🚀 New features: newly added commands, APIs, configuration options, platform support, etc.
    • ⚠️ Important changes: breaking changes, removed features, configuration migration requirements
    • 🐛 Key fixes: important bug fixes that affect stability
    • ⚡ Performance improvements: significant performance optimizations
    • 🖥️ Desktop improvements: UI/UX improvements for the desktop application
  3. Output format:

## 更新摘要

| 组件 | 旧版本 | 新版本 | 版本跨度 |
|------|--------|--------|----------|
| OpenCode | x.y.z | x.y.z | N 个版本 |
| oh-my-opencode | x.y.z | x.y.z | N 个版本 |

---

## OpenCode 更新日志 (vx.y.z → vX.Y.Z)

### vX.Y.Z (日期) 🎉 Latest
**🚀 新功能**
- [功能名]: [描述]
- [新增命令]: `/command` - [用途]

**⚠️ 重要变更**
- [变更描述]

**🐛 关键修复**
- [修复描述]

---

## oh-my-opencode 更新日志 (vx.y.z → vX.Y.Z)

### vX.Y.Z (日期) 🎉 Latest
**🚀 新功能**
- [功能名]: [描述]
- [新增命令]: `/command` - [用途]

**⚠️ 重要变更**
- [变更描述]

**🐛 关键修复**
- [修复描述]
  1. Notes:
    • Only output the changes between the old version (before the update) and the new version (after the update)
    • Sort by version number from old to new
    • If the version span is very large (more than 5 versions), only output detailed information for the most recent 5 versions, and use a brief list for the rest
    • Output in Chinese
    • For purely technical refactoring or internal improvements, they can be briefly mentioned or omitted