anomalyco / opencode

anomalyco / opencode

The open source AI coding agent. 开源 AI 编程代理。

Installation

安装

# YOLO curl -fsSL https://opencode.ai/install | bash

# Package managers npm i -g opencode-ai@latest # or bun/pnpm/yarn scoop install opencode # Windows choco install opencode # Windows brew install anomalyco/tap/opencode # macOS and Linux (recommended, always up to date) brew install opencode # macOS and Linux (official brew formula, updated less) sudo pacman -S opencode # Arch Linux (Stable) paru -S opencode-bin # Arch Linux (Latest from AUR) mise use -g opencode # Any OS nix run nixpkgs#opencode # or github:anomalyco/opencode for latest dev branch

# 包管理器 npm i -g opencode-ai@latest # 或 bun/pnpm/yarn scoop install opencode # Windows choco install opencode # Windows brew install anomalyco/tap/opencode # macOS 和 Linux(推荐,始终保持最新) brew install opencode # macOS 和 Linux(官方 brew 公式,更新频率较低) sudo pacman -S opencode # Arch Linux(稳定版) paru -S opencode-bin # Arch Linux(AUR 最新版) mise use -g opencode # 任意操作系统 nix run nixpkgs#opencode # 或使用 github:anomalyco/opencode 获取最新开发分支

Tip: Remove versions older than 0.1.x before installing. 提示:安装前请先移除 0.1.x 之前的旧版本。

Desktop App (BETA)

桌面应用(测试版)

OpenCode is also available as a desktop application. Download directly from the releases page or opencode.ai/download. OpenCode 也提供桌面应用程序版本。请直接从发布页面或 opencode.ai/download 下载。

Platform Download 平台下载

  • macOS (Apple Silicon): opencode-desktop-mac-arm64.dmg
  • macOS (Intel): opencode-desktop-mac-x64.dmg
  • Windows: opencode-desktop-windows-x64.exe
  • Linux: .deb, .rpm, or .AppImage

brew install --cask opencode-desktop # macOS (Homebrew) scoop bucket add extras; scoop install extras/opencode-desktop # Windows (Scoop)

Installation Directory

安装目录

The install script respects the following priority order for the installation path: 安装脚本将按照以下优先级顺序确定安装路径:

  • $OPENCODE_INSTALL_DIR - Custom installation directory (自定义安装目录)
  • $XDG_BIN_DIR - XDG Base Directory Specification compliant path (符合 XDG 基础目录规范的路径)
  • $HOME/bin - Standard user binary directory (if it exists or can be created) (标准用户二进制目录,如果存在或可创建)
  • $HOME/.opencode/bin - Default fallback (默认回退路径)

# Examples # 示例 OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash

Agents

代理

OpenCode includes two built-in agents you can switch between with the Tab key. OpenCode 内置了两个代理,你可以通过 Tab 键在它们之间切换。

  • build - Default, full-access agent for development work (默认,拥有完全访问权限的开发工作代理)
  • plan - Read-only agent for analysis and code exploration (只读代理,用于分析和代码探索)
    • Denies file edits by default (默认拒绝文件编辑)
    • Asks permission before running bash commands (运行 bash 命令前会请求许可)
    • Ideal for exploring unfamiliar codebases or planning changes (非常适合探索陌生代码库或规划变更)

Also included is a general subagent for complex searches and multistep tasks. This is used internally and can be invoked using @general in messages. Learn more about agents. 此外还包含一个用于复杂搜索和多步骤任务的通用子代理。该代理在内部使用,可以通过在消息中使用 @general 来调用。了解更多关于代理的信息。

Documentation

文档

For more info on how to configure OpenCode, head over to our docs. 有关如何配置 OpenCode 的更多信息,请前往我们的文档页面。

Contributing

贡献

If you’re interested in contributing to OpenCode, please read our contributing docs before submitting a pull request. 如果你有兴趣为 OpenCode 做出贡献,请在提交 Pull Request 之前阅读我们的贡献文档。

Building on OpenCode

基于 OpenCode 构建

If you are working on a project that’s related to OpenCode and is using “opencode” as part of its name, for example “opencode-dashboard” or “opencode-mobile”, please add a note to your README to clarify that it is not built by the OpenCode team and is not affiliated with us in any way. 如果你正在开发与 OpenCode 相关的项目,并且在名称中使用了“opencode”(例如“opencode-dashboard”或“opencode-mobile”),请在 README 中添加说明,明确指出该项目并非由 OpenCode 团队构建,且与我们没有任何关联。

Join our community 加入我们的社区 Discord | X.com