Command Palette

Search for a command to run...

OpenCode 使用指南

OpenCode 是一个开源 AI 编程助手,可在终端、桌面或 IDE 中使用。

安装

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

也可以使用包管理器安装:

$ pnpm add -g opencode-ai
pnpm install -g opencode-ai
yarn global add opencode-ai

快速开始

配置

运行 /connect 命令选择 AI 提供商并配置 API 密钥。

/opencode
/connect

初始化项目

在项目目录中运行以下命令初始化 OpenCode:

/opencode
/init

这会分析项目并创建 AGENTS.md 文件,帮助 OpenCode 理解项目结构和编码规范。

使用方式

提问

使用 @ 键搜索项目中的文件:

How is authentication handled in @packages/functions/src/api/index.ts

添加功能

  1. Tab 键切换到 Plan 模式
  2. 描述你想要的功能
  3. 再次按 Tab 键切换回 Build 模式执行

撤销更改

使用 /undo 撤销更改:

/undo

使用 /redo 重做:

/redo

分享对话

/share

创建当前对话的分享链接。

常用命令

命令描述
/init初始化项目分析
/connect连接 AI 提供商
/undo撤销更改
/redo重做更改
/share分享对话

配置

参考 OpenCode 官方文档 了解:

Please log in to leave a comment.

Comments (1)
tillicofess

test