<script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== ‘undefined’ && localStorage.getItem(‘starlight-theme’);
const theme =
storedTheme ||
(window.matchMedia(‘(prefers-color-scheme: light)’).matches ? ‘light’ : ‘dark’);
document.documentElement.dataset.theme = theme === ‘light’ ? ‘light’ : ‘dark’;
return {
updatePickers(theme = storedTheme || ‘auto’) {
document.querySelectorAll(‘starlight-theme-select’).forEach((picker) => {
const select = picker.querySelector(‘select’);
if (select) select.value = theme;
/** @type {HTMLTemplateElement | null} /
const tmpl = document.querySelector( Get started with OpenCode. OpenCode is an open source AI coding agent. It’s available as a terminal-based interface, desktop app, or IDE extension. Let’s get started. To use OpenCode in your terminal, you’ll need: A modern terminal emulator like: API keys for the LLM providers you want to use. The easiest way to install OpenCode 1 is through the install script. These installation methods provide the You can also install it with the following commands: Using Node.js Using Homebrew on macOS and Linux Use the OpenCode tap above for V1. Homebrew’s Installing on Arch Linux The official Arch package installs OpenCode 2. Use the AUR package to install OpenCode 1. Using Chocolatey Using Scoop Using NPM Using Mise Using Docker Support for installing OpenCode on Windows using Bun is currently in progress. You can also grab the binary from the Releases. 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.
It’s a curated list of models that have been tested and verified by the OpenCode
team. Run the Sign in, add your billing details, and copy your API key. Paste your API key. Alternatively, you can select one of the other providers. Learn more. Now that you’ve configured a provider, you can navigate to a project that
you want to work on. And run OpenCode. Next, initialize OpenCode for the project by running the following command. This will get OpenCode to analyze your project and create an This helps OpenCode understand the project structure and the coding patterns
used. You are now ready to use OpenCode to work on your project. Feel free to ask it
anything! If you are new to using an AI coding agent, here are some examples that might
help. You can ask OpenCode to explain the codebase to you. This is helpful if there’s a part of the codebase that you didn’t work on. You can ask OpenCode to add new features to your project. Though we first recommend asking it to create a plan. Create a plan OpenCode has a Plan mode that disables its ability to make changes and
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. Now let’s describe what we want it to do. 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. Iterate on the plan Once it gives you a plan, you can give it feedback or add more details. 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. Build the feature Once you feel comfortable with the plan, switch back to Build mode by
hitting the Tab key again. And asking it to make the changes. For more straightforward changes, you can ask OpenCode to directly build it
without having to review the plan first. You want to make sure you provide a good amount of detail so OpenCode makes the right
changes. Let’s say you ask OpenCode to make some changes. But you realize that it is not what you wanted. You can undo the changes
using the OpenCode will now revert the changes you made and show your original message
again. From here you can tweak the prompt and ask OpenCode to try again. Or you can redo the changes using the And that’s it! You are now a pro at using OpenCode. To make it your own, we recommend picking a theme, customizing the keybinds, configuring code formatters, creating custom commands, or playing around with the OpenCode config.#theme-icons);
const newIcon = tmpl && tmpl.content.querySelector(‘.’ + theme);
if (newIcon) {
const oldIcon = picker.querySelector(‘svg.label-icon’);
if (oldIcon) {
oldIcon.replaceChildren(…newIcon.cloneNode(true).childNodes);
}
}
});
},
};
})();
<style>@layer starlight.components{:root{–sl-badge-default-border: var(–sl-color-accent);–sl-badge-default-bg: var(–sl-color-accent-low);–sl-badge-default-text: #fff;–sl-badge-note-border: var(–sl-color-blue);–sl-badge-note-bg: var(–sl-color-blue-low);–sl-badge-note-text: #fff;–sl-badge-danger-border: var(–sl-color-red);–sl-badge-danger-bg: var(–sl-color-red-low);–sl-badge-danger-text: #fff;–sl-badge-success-border: var(–sl-color-green);–sl-badge-success-bg: var(–sl-color-green-low);–sl-badge-success-text: #fff;–sl-badge-caution-border: var(–sl-color-orange);–sl-badge-caution-bg: var(–sl-color-orange-low);–sl-badge-caution-text: #fff;–sl-badge-tip-border: var(–sl-color-purple);–sl-badge-tip-bg: var(–sl-color-purple-low);–sl-badge-tip-text: #fff}[data-theme=light]:root{–sl-badge-default-bg: var(–sl-color-accent-high);–sl-badge-note-bg: var(–sl-color-blue-high);–sl-badge-danger-bg: var(–sl-color-red-high);–sl-badge-success-bg: var(–sl-color-green-high);–sl-badge-caution-bg: var(–sl-color-orange-high);–sl-badge-tip-bg: var(–sl-color-purple-high)}.sl-badge:where(.astro-tpn2fck5){display:inline-block;border:1px solid var(–sl-color-border-badge);border-radius:.25rem;font-family:var(–sl-font-system-mono);line-height:normal;color:var(–sl-color-text-badge);background-color:var(–sl-color-bg-badge);overflow-wrap:anywhere}.sidebar-content .sl-badge:where(.astro-tpn2fck5){line-height:1;font-size:var(–sl-text-xs);padding:.125rem .375rem}.sidebar-content a[aria-current=page]>.sl-badge:where(.astro-tpn2fck5){–sl-color-bg-badge: transparent;–sl-color-border-badge: currentColor;color:inherit}.default:where(.astro-tpn2fck5){–sl-color-bg-badge: var(–sl-badge-default-bg);–sl-color-border-badge: var(–sl-badge-default-border);–sl-color-text-badge: var(–sl-badge-default-text)}.note:where(.astro-tpn2fck5){–sl-color-bg-badge: var(–sl-badge-note-bg);–sl-color-border-badge: var(–sl-badge-note-border);–sl-color-text-badge: var(–sl-badge-note-text)}.danger:where(.astro-tpn2fck5){–sl-color-bg-badge: var(–sl-badge-danger-bg);–sl-color-border-badge: var(–sl-badge-danger-border);–sl-color-text-badge: var(–sl-badge-danger-text)}.success:where(.astro-tpn2fck5){–sl-color-bg-badge: var(–sl-badge-success-bg);–sl-color-border-badge: var(–sl-badge-success-border);–sl-color-text-badge: var(–sl-badge-success-text)}.tip:where(.astro-tpn2fck5){–sl-color-bg-badge: var(–sl-badge-tip-bg);–sl-color-border-badge: var(–sl-badge-tip-border);–sl-color-text-badge: var(–sl-badge-tip-text)}.caution:where(.astro-tpn2fck5){–sl-color-bg-badge: var(–sl-badge-caution-bg);–sl-color-border-badge: var(–sl-badge-caution-border);–sl-color-text-badge: var(–sl-badge-caution-text)}.small:where(.astro-tpn2fck5){font-size:var(–sl-text-xs);padding:.125rem .25rem}.medium:where(.astro-tpn2fck5){font-size:var(–sl-text-sm);padding:.175rem .35rem}.large:where(.astro-tpn2fck5){font-size:var(–sl-text-base);padding:.225rem .45rem}.sl-markdown-content :is(h1,h2,h3,h4,h5,h6) .sl-badge:where(.astro-tpn2fck5){vertical-align:middle}}
@layer starlight.components{svg:where(.astro-7up7gym4){color:var(–sl-icon-color);font-size:var(–sl-icon-size, 1em);width:1em;height:1em}}
@layer starlight.components{starlight-tabs:where(.astro-4xvfjdjx){display:block}.tablist-wrapper:where(.astro-4xvfjdjx){overflow-x:auto}:where(.astro-4xvfjdjx)[role=tablist]{display:flex;list-style:none;border-bottom:2px solid var(–sl-color-gray-5);padding:0}.tab:where(.astro-4xvfjdjx){margin-bottom:-2px}.tab:where(.astro-4xvfjdjx)>:where(.astro-4xvfjdjx)[role=tab]{display:flex;align-items:center;gap:.5rem;padding:0 1.25rem;text-decoration:none;border-bottom:2px solid var(–sl-color-gray-5);color:var(–sl-color-gray-3);outline-offset:var(–sl-outline-offset-inside);overflow-wrap:initial}.tab:where(.astro-4xvfjdjx) :where(.astro-4xvfjdjx)[role=tab][aria-selected=true]{color:var(–sl-color-white);border-color:var(–sl-color-text-accent);font-weight:600}.tablist-wrapper:where(.astro-4xvfjdjx)~[role=tabpanel]{margin-top:1rem}}
@layer starlight.components{.sl-steps{–bullet-size: calc(var(–sl-line-height) * 1rem);–bullet-margin: .375rem;list-style:none;counter-reset:steps-counter var(–sl-steps-start, 0);padding-inline-start:0}.sl-steps>li{counter-increment:steps-counter;position:relative;padding-inline-start:calc(var(–bullet-size) + 1rem);padding-bottom:1px;min-height:calc(var(–bullet-size) + var(–bullet-margin))}.sl-steps>li+li{margin-top:0}.sl-steps>li:before{content:counter(steps-counter);position:absolute;top:0;inset-inline-start:0;width:var(–bullet-size);height:var(–bullet-size);line-height:var(–bullet-size);font-size:var(–sl-text-xs);font-weight:600;text-align:center;color:var(–sl-color-white);background-color:var(–sl-color-gray-6);border-radius:99rem;box-shadow:inset 0 0 0 1px var(–sl-color-gray-5)}.sl-steps>li:after{–guide-width: 1px;content:“”;position:absolute;top:calc(var(–bullet-size) + var(–bullet-margin));bottom:var(–bullet-margin);inset-inline-start:calc((var(–bullet-size) - var(–guide-width)) / 2);width:var(–guide-width);background-color:var(–sl-color-hairline-light)}}@layer starlight.content{.sl-steps>li>:first-child{–lh: calc(1em * var(–sl-line-height));–shift-y: calc(.5 * (var(–bullet-size) - var(–lh)));transform:translateY(var(–shift-y));margin-bottom:var(–shift-y)}.sl-steps>li>:first-child:where(h1,h2,h3,h4,h5,h6){–lh: calc(1em * var(–sl-line-height-headings))}@supports (–prop: 1lh){.sl-steps>li>:first-child{–lh: 1lh}}}
@layer starlight.components{.sl-link-button:where(.astro-wpoe35p5){align-items:center;border:1px solid transparent;border-radius:999rem;display:inline-flex;font-size:var(–sl-text-sm);gap:.5em;line-height:1.1875;outline-offset:.25rem;padding:.4375rem 1.125rem;text-decoration:none}.sl-link-button:where(.astro-wpoe35p5).primary{background:var(–sl-color-text-accent);border-color:var(–sl-color-text-accent);color:var(–sl-color-black)}.sl-link-button:where(.astro-wpoe35p5).primary:hover{color:var(–sl-color-black)}.sl-link-button:where(.astro-wpoe35p5).secondary{border-color:inherit;color:var(–sl-color-white)}.sl-link-button:where(.astro-wpoe35p5).minimal{color:var(–sl-color-white);padding-inline:0}.sl-link-button:where(.astro-wpoe35p5) svg{flex-shrink:0}@media(min-width:50rem){.sl-link-button:where(.astro-wpoe35p5){font-size:var(–sl-text-base);padding:.9375rem 1.25rem}}.sl-markdown-content .sl-link-button:where(.astro-wpoe35p5){margin-inline-end:1rem}.sl-markdown-content .sl-link-button:where(.astro-wpoe35p5):not(:where(p )){margin-block:1rem}}
Skip to content Intro

Prerequisites
\
\
Install
opencode
binary and can conflict with or replace an OpenCode 2 installation.
\
brew install opencode formula currently installs V2. See the V2 docs.Windows
\
\
Configure
\
/connect command in the TUI, select opencode, and head to opencode.ai/auth.
Initialize
AGENTS.md file in
the project root.
Usage
Ask questions
Add features
\
\
Make changes
Undo changes
/undo command./redo command.
Customize
Reference
tooling
Archived
62 min read
Updated
docs
curl -fsSL https://opencode.ai/install | bash
npm install -g opencode-ai
bun install -g opencode-ai
pnpm install -g opencode-ai
yarn global add opencode-ai
brew install anomalyco/tap/opencode
sudo pacman -S opencode # Arch Linux (OpenCode 2)
paru -S opencode-bin # Arch Linux (OpenCode 1, from AUR)
choco install opencode
scoop install opencode
npm install -g opencode-ai
mise use -g github:anomalyco/opencode
docker run -it --rm ghcr.io/anomalyco/opencode
/connect
┌ API key
│
│
└ enter
cd /path/to/project
opencode
/init
How is authentication handled in \@packages/functions/src/api/index.ts
<TAB>
When a user deletes a note, we'd like to flag it as deleted in the database.
Then create a screen that shows all the recently deleted notes.
From this screen, the user can undelete a note or permanently delete it.
We'd like to design this new screen using a design I've used before.
[Image #1] Take a look at this image and use it as a reference.
<TAB>
Sounds good! Go ahead and make the changes.
We need to add authentication to the /settings route. Take a look at how this is
handled in the /notes route in \@packages/functions/src/notes.ts and implement
the same logic in \@packages/functions/src/settings.ts
Can you refactor the function in \@packages/functions/src/api/index.ts?
/undo
Can you refactor the function in \@packages/functions/src/api/index.ts?
/redo