|
@@ -1,15 +1,15 @@
|
|
|
---
|
|
---
|
|
|
title: Intro
|
|
title: Intro
|
|
|
-description: Get started with opencode.
|
|
|
|
|
|
|
+description: Get started with OpenCode.
|
|
|
---
|
|
---
|
|
|
|
|
|
|
|
import { Tabs, TabItem } from "@astrojs/starlight/components"
|
|
import { Tabs, TabItem } from "@astrojs/starlight/components"
|
|
|
import config from "../../../config.mjs"
|
|
import config from "../../../config.mjs"
|
|
|
export const console = config.console
|
|
export const console = config.console
|
|
|
|
|
|
|
|
-[**opencode**](/) is an AI coding agent built for the terminal.
|
|
|
|
|
|
|
+[**OpenCode**](/) is an AI coding agent built for the terminal.
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
Let's get started.
|
|
Let's get started.
|
|
|
|
|
|
|
@@ -17,7 +17,7 @@ Let's get started.
|
|
|
|
|
|
|
|
#### Prerequisites
|
|
#### Prerequisites
|
|
|
|
|
|
|
|
-To use opencode, you'll need:
|
|
|
|
|
|
|
+To use OpenCode, you'll need:
|
|
|
|
|
|
|
|
1. A modern terminal emulator like:
|
|
1. A modern terminal emulator like:
|
|
|
- [WezTerm](https://wezterm.org), cross-platform
|
|
- [WezTerm](https://wezterm.org), cross-platform
|
|
@@ -31,7 +31,7 @@ To use opencode, you'll need:
|
|
|
|
|
|
|
|
## Install
|
|
## Install
|
|
|
|
|
|
|
|
-The easiest way to install opencode is through the install script.
|
|
|
|
|
|
|
+The easiest way to install OpenCode is through the install script.
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
@@ -103,7 +103,7 @@ You can also install it with the following commands:
|
|
|
npm install -g opencode-ai
|
|
npm install -g opencode-ai
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Support for installing opencode on Windows using Bun is currently in progress.
|
|
|
|
|
|
|
+Support for installing OpenCode on Windows using Bun is currently in progress.
|
|
|
|
|
|
|
|
You can also grab the binary from the [Releases](https://github.com/sst/opencode/releases).
|
|
You can also grab the binary from the [Releases](https://github.com/sst/opencode/releases).
|
|
|
|
|
|
|
@@ -111,10 +111,10 @@ You can also grab the binary from the [Releases](https://github.com/sst/opencode
|
|
|
|
|
|
|
|
## Configure
|
|
## Configure
|
|
|
|
|
|
|
|
-With opencode you can use any LLM provider by configuring their API keys.
|
|
|
|
|
|
|
+With OpenCode you can use any LLM provider by configuring their API keys.
|
|
|
|
|
|
|
|
-If you are new to using LLM providers, we recommend using [opencode zen](/docs/zen).
|
|
|
|
|
-It's a curated list of models that have been tested and verified by the opencode
|
|
|
|
|
|
|
+If you are new to using LLM providers, we recommend using [OpenCode Zen](/docs/zen).
|
|
|
|
|
+It's a curated list of models that have been tested and verified by the OpenCode
|
|
|
team.
|
|
team.
|
|
|
|
|
|
|
|
1. Run `opencode auth login`, select opencode, and head to [opencode.ai/auth](https://opencode.ai/auth).
|
|
1. Run `opencode auth login`, select opencode, and head to [opencode.ai/auth](https://opencode.ai/auth).
|
|
@@ -149,33 +149,33 @@ you want to work on.
|
|
|
cd /path/to/project
|
|
cd /path/to/project
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-And run opencode.
|
|
|
|
|
|
|
+And run OpenCode.
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
opencode
|
|
opencode
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Next, initialize opencode for the project by running the following command.
|
|
|
|
|
|
|
+Next, initialize OpenCode for the project by running the following command.
|
|
|
|
|
|
|
|
```bash frame="none"
|
|
```bash frame="none"
|
|
|
/init
|
|
/init
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-This will get opencode to analyze your project and create an `AGENTS.md` file in
|
|
|
|
|
|
|
+This will get OpenCode to analyze your project and create an `AGENTS.md` file in
|
|
|
the project root.
|
|
the project root.
|
|
|
|
|
|
|
|
:::tip
|
|
:::tip
|
|
|
You should commit your project's `AGENTS.md` file to Git.
|
|
You should commit your project's `AGENTS.md` file to Git.
|
|
|
:::
|
|
:::
|
|
|
|
|
|
|
|
-This helps opencode understand the project structure and the coding patterns
|
|
|
|
|
|
|
+This helps OpenCode understand the project structure and the coding patterns
|
|
|
used.
|
|
used.
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
|
|
## Usage
|
|
## Usage
|
|
|
|
|
|
|
|
-You are now ready to use opencode to work on your project. Feel free to ask it
|
|
|
|
|
|
|
+You are now ready to use OpenCode to work on your project. Feel free to ask it
|
|
|
anything!
|
|
anything!
|
|
|
|
|
|
|
|
If you are new to using an AI coding agent, here are some examples that might
|
|
If you are new to using an AI coding agent, here are some examples that might
|
|
@@ -185,7 +185,7 @@ help.
|
|
|
|
|
|
|
|
### Ask questions
|
|
### Ask questions
|
|
|
|
|
|
|
|
-You can ask opencode to explain the codebase to you.
|
|
|
|
|
|
|
+You can ask OpenCode to explain the codebase to you.
|
|
|
|
|
|
|
|
:::tip
|
|
:::tip
|
|
|
Use the `@` key to fuzzy search for files in the project.
|
|
Use the `@` key to fuzzy search for files in the project.
|
|
@@ -201,11 +201,11 @@ This is helpful if there's a part of the codebase that you didn't work on.
|
|
|
|
|
|
|
|
### Add features
|
|
### Add features
|
|
|
|
|
|
|
|
-You can ask opencode to add new features to your project. Though we first recommend asking it to create a plan.
|
|
|
|
|
|
|
+You can ask OpenCode to add new features to your project. Though we first recommend asking it to create a plan.
|
|
|
|
|
|
|
|
1. **Create a plan**
|
|
1. **Create a plan**
|
|
|
|
|
|
|
|
- opencode has a _Plan mode_ that disables its ability to make changes and
|
|
|
|
|
|
|
+ OpenCode has a _Plan mode_ that disables its ability to make changes and
|
|
|
instead suggest _how_ it'll implement the feature.
|
|
instead suggest _how_ it'll implement the feature.
|
|
|
|
|
|
|
|
Switch to it using the **Tab** key. You'll see an indicator for this in the lower right corner.
|
|
Switch to it using the **Tab** key. You'll see an indicator for this in the lower right corner.
|
|
@@ -222,11 +222,11 @@ You can ask opencode to add new features to your project. Though we first recomm
|
|
|
From this screen, the user can undelete a note or permanently delete it.
|
|
From this screen, the user can undelete a note or permanently delete it.
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
- You want to give opencode enough details to understand what you want. It helps
|
|
|
|
|
|
|
+ You want to give OpenCode enough details to understand what you want. It helps
|
|
|
to talk to it like you are talking to a junior developer on your team.
|
|
to talk to it like you are talking to a junior developer on your team.
|
|
|
|
|
|
|
|
:::tip
|
|
:::tip
|
|
|
- Give opencode plenty of context and examples to help it understand what you
|
|
|
|
|
|
|
+ Give OpenCode plenty of context and examples to help it understand what you
|
|
|
want.
|
|
want.
|
|
|
:::
|
|
:::
|
|
|
|
|
|
|
@@ -243,7 +243,7 @@ You can ask opencode to add new features to your project. Though we first recomm
|
|
|
Drag and drop images into the terminal to add them to the prompt.
|
|
Drag and drop images into the terminal to add them to the prompt.
|
|
|
:::
|
|
:::
|
|
|
|
|
|
|
|
- opencode can scan any images you give it and add them to the prompt. You can
|
|
|
|
|
|
|
+ OpenCode can scan any images you give it and add them to the prompt. You can
|
|
|
do this by dragging and dropping an image into the terminal.
|
|
do this by dragging and dropping an image into the terminal.
|
|
|
|
|
|
|
|
3. **Build the feature**
|
|
3. **Build the feature**
|
|
@@ -265,7 +265,7 @@ You can ask opencode to add new features to your project. Though we first recomm
|
|
|
|
|
|
|
|
### Make changes
|
|
### Make changes
|
|
|
|
|
|
|
|
-For more straightforward changes, you can ask opencode to directly build it
|
|
|
|
|
|
|
+For more straightforward changes, you can ask OpenCode to directly build it
|
|
|
without having to review the plan first.
|
|
without having to review the plan first.
|
|
|
|
|
|
|
|
```txt frame="none" "@packages/functions/src/settings.ts" "@packages/functions/src/notes.ts"
|
|
```txt frame="none" "@packages/functions/src/settings.ts" "@packages/functions/src/notes.ts"
|
|
@@ -274,14 +274,14 @@ handled in the /notes route in @packages/functions/src/notes.ts and implement
|
|
|
the same logic in @packages/functions/src/settings.ts
|
|
the same logic in @packages/functions/src/settings.ts
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-You want to make sure you provide a good amount of detail so opencode makes the right
|
|
|
|
|
|
|
+You want to make sure you provide a good amount of detail so OpenCode makes the right
|
|
|
changes.
|
|
changes.
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
|
|
### Undo changes
|
|
### Undo changes
|
|
|
|
|
|
|
|
-Let's say you ask opencode to make some changes.
|
|
|
|
|
|
|
+Let's say you ask OpenCode to make some changes.
|
|
|
|
|
|
|
|
```txt frame="none" "@packages/functions/src/api/index.ts"
|
|
```txt frame="none" "@packages/functions/src/api/index.ts"
|
|
|
Can you refactor the function in @packages/functions/src/api/index.ts?
|
|
Can you refactor the function in @packages/functions/src/api/index.ts?
|
|
@@ -294,14 +294,14 @@ using the `/undo` command.
|
|
|
/undo
|
|
/undo
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-opencode will now revert the changes you made and show your original message
|
|
|
|
|
|
|
+OpenCode will now revert the changes you made and show your original message
|
|
|
again.
|
|
again.
|
|
|
|
|
|
|
|
```txt frame="none" "@packages/functions/src/api/index.ts"
|
|
```txt frame="none" "@packages/functions/src/api/index.ts"
|
|
|
Can you refactor the function in @packages/functions/src/api/index.ts?
|
|
Can you refactor the function in @packages/functions/src/api/index.ts?
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-From here you can tweak the prompt and ask opencode to try again.
|
|
|
|
|
|
|
+From here you can tweak the prompt and ask OpenCode to try again.
|
|
|
|
|
|
|
|
:::tip
|
|
:::tip
|
|
|
You can run `/undo` multiple times to undo multiple changes.
|
|
You can run `/undo` multiple times to undo multiple changes.
|
|
@@ -317,7 +317,7 @@ Or you **can redo** the changes using the `/redo` command.
|
|
|
|
|
|
|
|
## Share
|
|
## Share
|
|
|
|
|
|
|
|
-The conversations that you have with opencode can be [shared with your
|
|
|
|
|
|
|
+The conversations that you have with OpenCode can be [shared with your
|
|
|
team](/docs/share).
|
|
team](/docs/share).
|
|
|
|
|
|
|
|
```bash frame="none"
|
|
```bash frame="none"
|
|
@@ -330,12 +330,12 @@ This will create a link to the current conversation and copy it to your clipboar
|
|
|
Conversations are not shared by default.
|
|
Conversations are not shared by default.
|
|
|
:::
|
|
:::
|
|
|
|
|
|
|
|
-Here's an [example conversation](https://opencode.ai/s/4XP1fce5) with opencode.
|
|
|
|
|
|
|
+Here's an [example conversation](https://opencode.ai/s/4XP1fce5) with OpenCode.
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
|
|
## Customize
|
|
## Customize
|
|
|
|
|
|
|
|
-And that's it! You are now a pro at using opencode.
|
|
|
|
|
|
|
+And that's it! You are now a pro at using OpenCode.
|
|
|
|
|
|
|
|
-To make it your own, we recommend [picking a theme](/docs/themes), [customizing the keybinds](/docs/keybinds), [configuring code formatters](/docs/formatters), [creating custom commands](/docs/commands), or playing around with the [opencode config](/docs/config).
|
|
|
|
|
|
|
+To make it your own, we recommend [picking a theme](/docs/themes), [customizing the keybinds](/docs/keybinds), [configuring code formatters](/docs/formatters), [creating custom commands](/docs/commands), or playing around with the [OpenCode config](/docs/config).
|