mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
Some checks are pending
check / typecheck (push) Waiting to run
deploy-files / deploy (push) Waiting to run
deploy-www / deploy (push) Waiting to run
deploy / deploy (push) Waiting to run
nix-eval / nix-eval (push) Waiting to run
publish / version (push) Waiting to run
publish / build-cli (push) Blocked by required conditions
publish / sign-cli-macos (push) Blocked by required conditions
publish / build-node-app-archive (push) Blocked by required conditions
publish / build-node-cli (map[bun_install_flags:--cpu=* host:blacksmith-4vcpu-windows-2025 target:windows-arm64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:blacksmith-4vcpu-ubuntu-2404 target:linux-x64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:blacksmith-4vcpu-ubuntu-2404-arm target:linux-arm64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:blacksmith-4vcpu-windows-2025 target:windows-x64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:macos-26 target:darwin-arm64]) (push) Blocked by required conditions
publish / sign-cli-windows (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--cpu=* host:windows-2025 platform_flag:--win --arm64 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--os=darwin --cpu=arm64 host:macos-26 platform_flag:--mac --arm64 target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--os=darwin --cpu=x64 host:macos-26-intel platform_flag:--mac --x64 target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404-arm platform_flag:--linux --arm64 target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-windows-2025 platform_flag:--win target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / publish (push) Blocked by required conditions
publish / notify-discord-v2 (push) Blocked by required conditions
test / affected packages (push) Waiting to run
test / unit (linux) (push) Waiting to run
test / unit (windows) (push) Waiting to run
test / build (linux) (push) Waiting to run
test / build (windows) (push) Waiting to run
test / e2e (linux, app-1) (push) Blocked by required conditions
test / e2e (linux, app-2) (push) Blocked by required conditions
test / e2e (linux, app-components) (push) Blocked by required conditions
test / e2e (linux, session-ui-components) (push) Blocked by required conditions
test / e2e (windows, app-1) (push) Blocked by required conditions
test / e2e (windows, app-2) (push) Blocked by required conditions
test / e2e (windows, app-components) (push) Blocked by required conditions
test / e2e (windows, session-ui-components) (push) Blocked by required conditions
test / e2e (linux) (push) Blocked by required conditions
test / e2e (windows) (push) Blocked by required conditions
124 lines
4.9 KiB
Markdown
124 lines
4.9 KiB
Markdown
<p align="center">
|
||
<a href="https://opencode.ai">
|
||
<picture>
|
||
<source srcset="packages/console/app/src/asset/logo-ornate-dark.svg" media="(prefers-color-scheme: dark)">
|
||
<source srcset="packages/console/app/src/asset/logo-ornate-light.svg" media="(prefers-color-scheme: light)">
|
||
<img src="packages/console/app/src/asset/logo-ornate-light.svg" alt="OpenCode logo">
|
||
</picture>
|
||
</a>
|
||
</p>
|
||
<p align="center">开源的 AI Coding Agent。</p>
|
||
<p align="center">
|
||
<a href="https://opencode.ai/discord"><img alt="Discord" src="https://img.shields.io/discord/1391832426048651334?style=flat-square&label=discord" /></a>
|
||
<a href="https://www.npmjs.com/package/@opencode/cli"><img alt="npm" src="https://img.shields.io/npm/v/@opencode/cli?style=flat-square" /></a>
|
||
<a href="https://github.com/anomalyco/opencode/actions/workflows/publish.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/anomalyco/opencode/publish.yml?style=flat-square&branch=dev" /></a>
|
||
</p>
|
||
|
||
<p align="center">
|
||
<a href="README.md">English</a> |
|
||
<a href="README.zh.md">简体中文</a> |
|
||
<a href="README.zht.md">繁體中文</a> |
|
||
<a href="README.ko.md">한국어</a> |
|
||
<a href="README.de.md">Deutsch</a> |
|
||
<a href="README.es.md">Español</a> |
|
||
<a href="README.fr.md">Français</a> |
|
||
<a href="README.it.md">Italiano</a> |
|
||
<a href="README.da.md">Dansk</a> |
|
||
<a href="README.ja.md">日本語</a> |
|
||
<a href="README.pl.md">Polski</a> |
|
||
<a href="README.ru.md">Русский</a> |
|
||
<a href="README.bs.md">Bosanski</a> |
|
||
<a href="README.ar.md">العربية</a> |
|
||
<a href="README.no.md">Norsk</a> |
|
||
<a href="README.br.md">Português (Brasil)</a> |
|
||
<a href="README.th.md">ไทย</a> |
|
||
<a href="README.tr.md">Türkçe</a> |
|
||
<a href="README.uk.md">Українська</a> |
|
||
<a href="README.bn.md">বাংলা</a> |
|
||
<a href="README.gr.md">Ελληνικά</a> |
|
||
<a href="README.vi.md">Tiếng Việt</a>
|
||
</p>
|
||
|
||
[](https://opencode.ai)
|
||
|
||
---
|
||
|
||
### 安装
|
||
|
||
```bash
|
||
# 直接安装 (YOLO)
|
||
curl -fsSL https://opencode.ai/v2/install | bash
|
||
|
||
# 软件包管理器
|
||
npm i -g @opencode/cli@latest # 也可使用 bun/pnpm/yarn
|
||
brew install anomalyco/tap/opencode-v2 # macOS 和 Linux(推荐,始终保持最新)
|
||
brew install opencode # macOS 和 Linux(官方 brew formula,更新频率较低)
|
||
sudo pacman -S opencode # Arch Linux (Stable)
|
||
paru -S opencode-beta # Arch Linux (Latest from AUR)
|
||
mise use -g opencode # 任意系统
|
||
nix run github:anomalyco/opencode # Nix
|
||
```
|
||
|
||
> [!TIP]
|
||
> 安装前请先移除 0.1.x 之前的旧版本。
|
||
|
||
### 桌面应用程序 (BETA)
|
||
|
||
OpenCode 也提供桌面版应用。可从 [opencode.ai/download](https://opencode.ai/download) 下载。
|
||
|
||
| 平台 | 下载文件 |
|
||
| --------------------- | ---------------------------------- |
|
||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
||
| Windows | `opencode-desktop-win-x64.exe` |
|
||
| Linux | `.deb`、`.rpm` 或 AppImage |
|
||
|
||
```bash
|
||
# macOS (Homebrew Cask)
|
||
brew install --cask opencode-desktop
|
||
```
|
||
|
||
#### 安装目录
|
||
|
||
安装脚本按照以下优先级决定安装路径:
|
||
|
||
1. `$OPENCODE_INSTALL_DIR` - 自定义安装目录
|
||
2. `$XDG_BIN_DIR` - 符合 XDG 基础目录规范的路径
|
||
3. `$HOME/bin` - 如果存在或可创建的用户二进制目录
|
||
4. `$HOME/.opencode/bin` - 默认备用路径
|
||
|
||
```bash
|
||
# 示例
|
||
OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/v2/install | bash
|
||
XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/v2/install | bash
|
||
```
|
||
|
||
### Agents
|
||
|
||
OpenCode 内置两种 Agent,可用 `Tab` 键快速切换:
|
||
|
||
- **build** - 默认模式,具备完整权限,适合开发工作
|
||
- **plan** - 只读模式,适合代码分析与探索
|
||
- 默认拒绝修改文件
|
||
- 运行 bash 命令前会询问
|
||
- 便于探索未知代码库或规划改动
|
||
|
||
另外还包含一个 **general** 子 Agent,用于复杂搜索和多步任务,内部使用,也可在消息中输入 `@general` 调用。
|
||
|
||
了解更多 [Agents](https://opencode.ai/docs/agents) 相关信息。
|
||
|
||
### 文档
|
||
|
||
更多配置说明请查看我们的 [**官方文档**](https://opencode.ai/docs)。
|
||
|
||
### 参与贡献
|
||
|
||
如有兴趣贡献代码,请在提交 PR 前阅读 [贡献指南 (Contributing Docs)](./CONTRIBUTING.md)。
|
||
|
||
### 基于 OpenCode 进行开发
|
||
|
||
如果你在项目名中使用了 “opencode”(如 “opencode-dashboard” 或 “opencode-mobile”),请在 README 里注明该项目不是 OpenCode 团队官方开发,且不存在隶属关系。
|
||
|
||
---
|
||
|
||
**加入我们的社区** [飞书](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=52ao9352-5623-4fa0-b7dd-3407c392c1af&qr_code=true) | [X.com](https://x.com/opencode)
|