SuperAPI AI 工具集

opencode-env-setup

部署与运维

查看项目

更新于 10-15 23:41

技能介绍

用途:这是一份可整段交给 AI agent 执行的环境搭建流程(懒人包 #00),目标是在 Windows、macOS 或 Linux 上装好 OpenCode 桌面版与 CLI、Git、GitHub CLI(gh)、Node.js 与 uv,并逐一验证。全部完成后 OpenCode 仍未接入模型,还需要执行 #01 连接模型才会真正响应。

执行原则:先检测再安装,已安装则跳过;每步安装后必须跑验证命令;某项失败就记录并继续;需管理员权限或浏览器确认时停下来等使用者;Windows 一律用 PowerShell,命令行用 ; 而不是 &&,不对原生命令加 2>$null 或 2>&1。

主要步骤:步骤 1 用循环脚本检测 opencode、git、gh、node、npm、uv 是否存在;步骤 2 装桌面版(Windows 用 winget install --id SST.OpenCodeDesktop --exact --accept-source-agreements --accept-package-agreements,macOS 用 brew install --cask opencode-desktop,Linux 到 https://opencode.ai/download 下载 .deb 或 .rpm);步骤 3 装 CLI(winget install --id SST.opencode --exact,brew install opencode,或 curl -fsSL https://opencode.ai/install | bash),并警告不要混装 npm 版;步骤 4 装 Git;步骤 5 装 gh,不在此登录;步骤 6 装 Node.js 当前 LTS(macOS 用 brew,Linux 用 https://deb.nodesource.com/setup_lts.x);步骤 7 装 uv(Windows winget install --id astral-sh.uv,macOS brew install uv,通用 curl -LsSf https://astral.sh/uv/install.sh | sh);步骤 8 重开终端后统一验证版本;步骤 9 打开桌面版确认不闪退。

结果判定:输出 === OPENCODE_ENV_SETUP === 区块,git/gh/node/npm/uv 均有版本号且桌面版或 CLI 至少之一成功为 PASS;OpenCode 有但其他工具缺为 PARTIAL;桌面版与 CLI 都失败为 FAIL。

适用场景:第一次接触 OpenCode 的教师研习、需要批量部署开发环境的课堂,或想把安装流程交给 agent 自动完成的用户。

限制:本包不连接模型、不填 API 密钥、不登录 GitHub、不设置 git 用户信息、不选付费方案,这些属于 #01 或其他包;桌面版目前标为 beta;uv 安装以本文为唯一权威版本;Linux 的 curl | bash 属于信任官方域名的安装方式;非 ASCII 用户名路径下少数工具可能报错,可改用纯英文路径。