OpenCode 使用指南
OpenCode 是一个开源 AI 编程助手,可在终端、桌面或 IDE 中使用。
安装
curl -fsSL https://opencode.ai/install | bash也可以使用包管理器安装:
$ pnpm add -g opencode-ai
pnpm install -g opencode-aiyarn 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添加功能
- 按 Tab 键切换到 Plan 模式
- 描述你想要的功能
- 再次按 Tab 键切换回 Build 模式执行
撤销更改
使用 /undo 撤销更改:
/undo使用 /redo 重做:
/redo分享对话
/share创建当前对话的分享链接。
常用命令
| 命令 | 描述 |
|---|---|
/init | 初始化项目分析 |
/connect | 连接 AI 提供商 |
/undo | 撤销更改 |
/redo | 重做更改 |
/share | 分享对话 |
配置
参考 OpenCode 官方文档 了解:
Please log in to leave a comment.
Comments (0)
Loading comments...