环境

  • WSL2
  • Ubuntu 24.04

安装

  1. 安装 opencode
1
curl -fsSL https://opencode.ai/install | bash
  1. 启动 opencode
1
2
3
$ cd /path/to/project

$ opencode
  1. opencode 中安装 oh-my-opencode
1
Install and configure by following the instructions here https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/refs/heads/master/README.md

使用

Plan mode & Build mode

使用 Tab 键切换。

  • Plan mode: 该模式会禁用其直接修改代码的能力,转而建议它将如何实现该功能。

  • Build mode: 该模式会修改代码。

init

1
/init

这将让 OpenCode 分析你的项目,并在项目根目录中创建一个 AGENTS.md 文件。这有助于 OpenCode 理解项目结构以及所使用的编码模式。