oh-my-opencode-update

oh-my-opencode-update

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "oh-my-opencode-update" with this command: npx skills add canyangliunian/agent-skills/canyangliunian-agent-skills-oh-my-opencode-update

oh-my-opencode-update

面向唯一长期用户:凌贵旺(Guiwang Ling)。

核心目标

  • 默认升级到最新版本(latest),并支持 指定版本(pinned version)。

  • 先检查环境(bun/权限),再备份,再清理缓存(可选,删除前交互确认),最后使用官方安装器安装并验证。

  • 关键步骤失败:立刻停止。例外:--force-cleanup 时不询问直接清理;doctor 失败不阻塞。

执行流程

脚本按以下顺序执行(共 4 步):

步骤 名称 说明

[1/4] Prerequisites check 检查 bun 版本及配置目录权限

[2/4] Baseline 记录当前环境信息

[3/4] Backup + Cache cleanup 备份配置文件并清理缓存

[4/4] Install/Upgrade 使用官方安装器安装并验证

[4/4] Install/Upgrade 详解

安装过程使用官方推荐的 bunx 安装器:

bunx oh-my-opencode@<version> install --no-tui

关键特性:

  • --no-tui :非交互式模式,适合脚本自动化

  • 官方安装器处理:插件注册、配置、认证步骤

  • @<version> :指定版本,@latest 表示最新版

适用环境(可通过环境变量自定义)

默认路径

以下路径为默认值,可通过环境变量覆盖:

环境变量 默认值 说明

OPENCODE_CONFIG_DIR

${HOME}/.config/opencode

opencode 配置目录

OPENCODE_CACHE_DIR

${HOME}/.cache

缓存目录根目录

OPENCODE_BIN

${HOME}/.opencode/bin/opencode

opencode 二进制文件路径

BUN_INSTALL_TIMEOUT

300

bunx 安装超时时间(秒),0 表示无超时

配置文件

  • opencode 配置:~/.config/opencode/opencode.json (环境变量:OPENCODE_CONFIG_DIR )

  • oh-my-opencode 配置:~/.config/opencode/oh-my-opencode.json

  • 缓存目录:~/.cache/oh-my-opencode

  • opencode 插件缓存(版本信息读取位置):~/.cache/opencode/node_modules/oh-my-opencode*

  • opencode package.json(依赖配置):~/.cache/opencode/package.json

自定义路径(可选)

export OPENCODE_CONFIG_DIR="/custom/config/opencode" export OPENCODE_CACHE_DIR="/custom/cache"

更多配置说明请参见 references/paths_config.md 。

使用方式

脚本位置:${SKILL_ROOT}/scripts/oh_my_opencode_update.sh

其中 ${SKILL_ROOT} 为 skill 根目录(包含 SKILL.md 的目录)。

  1. Dry-run(推荐先跑)

从 skill 根目录运行

bash scripts/oh_my_opencode_update.sh --dry-run --latest

  1. 实际执行:升级到 latest

bash scripts/oh_my_opencode_update.sh --apply --latest --claude yes --gemini no --copilot no

  1. 实际执行:升级到指定版本

bash scripts/oh_my_opencode_update.sh --apply --target-version 3.2.2 --claude max20 --gemini yes --copilot no

可选参数

参数 说明

--force-cleanup

强制清理缓存,不询问确认

--dry-run

仅显示将要执行的操作,不实际执行

--apply

实际执行升级操作

--latest

升级到最新版本

--target-version <version>

升级到指定版本

--claude <value>

Claude 订阅:no, yes, max20(至少提供一个)

--gemini <value>

Gemini 集成:no, yes(至少提供一个)

--copilot <value>

GitHub Copilot 订阅:no, yes(至少提供一个)

验收(bunx 安装后)

(bunx oh-my-opencode@latest install --no-tui --claude yes --gemini no --copilot no (bunx oh-my-opencode@latest install --no-tui --claude yes --gemini no --copilot no (cd "${OPENCODE_CONFIG_DIR}" && node node_modules/.bin/oh-my-opencode doctor)(cd "${OPENCODE_CONFIG_DIR}" && node node_modules/.bin/oh-my-opencode doctor) opencode doctor)

常见问题

前置检查失败

  • bun 未安装

  • 安装 bun:curl -fsSL https://bun.sh/install | bash

  • 配置目录无写权限

  • 检查权限:ls -ld "${OPENCODE_CONFIG_DIR}"

  • 修复权限:chmod u+w "${OPENCODE_CONFIG_DIR}"

bunx 相关问题

  • bunx 执行失败

  • 检查网络:curl -I https://registry.npmjs.org/

  • 检查 bunx:bunx --version

  • 验证版本:bun pm ls oh-my-opencode

历史说明

  • 本 skill 早期版本使用 npm 进行包管理,现已切换到 bunx 以与官方推荐方式保持一致。

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

pycli-color

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

abs-journal

No summary provided by upstream source.

Repository SourceNeeds Review
Research

academic-translate

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

stata-sep

No summary provided by upstream source.

Repository SourceNeeds Review