Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7c17a41
Merge pull request #27 from kujtimiihoxha/opencode
kujtimiihoxha Apr 21, 2025
47f7429
look for $HOME/.config for config in addition to $XDG_CONFIG_HOME/
shreyassanthu77 Apr 21, 2025
b3738b7
Merge pull request #34 from shreyassanthu77/main
kujtimiihoxha Apr 21, 2025
1f9c002
fix: set provider defaults correctly in AWS projects
rgodha24 Apr 22, 2025
293e5a6
Merge pull request #38 from rgodha24/fix-provider-defaults
kujtimiihoxha Apr 22, 2025
2824cb5
CI (#43)
thdxr Apr 23, 2025
e0693d4
attempt cache builds
thdxr Apr 23, 2025
5b6f316
sync
thdxr Apr 23, 2025
77cd80c
remove cache
thdxr Apr 23, 2025
4b1b1b8
sync
thdxr Apr 23, 2025
aeca8b6
remove edit/normal mode
kujtimiihoxha Apr 23, 2025
b4fec7e
small changes
kujtimiihoxha Apr 23, 2025
197b833
update mainter email
kujtimiihoxha Apr 23, 2025
37db4a2
small fixes
kujtimiihoxha Apr 24, 2025
2ad0a9d
change additions/removals
kujtimiihoxha Apr 24, 2025
02050ca
change package name
kujtimiihoxha Apr 24, 2025
59950e7
fix version ldflags
thdxr Apr 24, 2025
923a040
turn on cgo
thdxr Apr 24, 2025
933aca4
force CGO
thdxr Apr 24, 2025
467c13b
back to disablign cgo
thdxr Apr 24, 2025
d5eee13
fix kitty issues
kujtimiihoxha Apr 24, 2025
756595f
change db driver
kujtimiihoxha Apr 24, 2025
9cda65e
try fix
kujtimiihoxha Apr 24, 2025
00e193d
try fix
kujtimiihoxha Apr 24, 2025
12fff4d
add more installation options
thdxr Apr 24, 2025
42e25d5
remove tool timeout
kujtimiihoxha Apr 24, 2025
93765bb
feat(groq): add support for Groq using the OpenAI provider
enchantednatures Apr 25, 2025
a0da843
small fixes
kujtimiihoxha Apr 25, 2025
5134c9b
added file picker and enabled image processing
PhantomReactor Apr 25, 2025
8974d00
pull main branch
PhantomReactor Apr 25, 2025
3dd0e69
fix acc error
kujtimiihoxha Apr 25, 2025
959cd96
display attachment paths in messages page
PhantomReactor Apr 26, 2025
33d1149
display delete shortcuts on help
PhantomReactor Apr 26, 2025
533cef7
update filepicker width
PhantomReactor Apr 26, 2025
14f1d71
Fix nil pointer dereference in GetPersistentShell
AvicennaJr Apr 26, 2025
32e8660
use provided workingg dir
AvicennaJr Apr 27, 2025
d2a8513
use workingDir if shellInstance is nil otherwise use cwd if shellInst…
AvicennaJr Apr 27, 2025
ba8c82b
feat: simpler diff implementation
garrettladley Apr 27, 2025
70df494
fix retry warning
kujtimiihoxha Apr 27, 2025
7422fa3
Handle new Cursor rules format
ottenhoff Apr 25, 2025
18f217d
fix provider config
kujtimiihoxha Apr 27, 2025
a454874
[feature/ripgrep-glob] Add ripgrep-based file globbing to improve per…
isaac-scarrott Apr 27, 2025
0bc3a98
small glob fixes
kujtimiihoxha Apr 27, 2025
b7c125c
fix: gemini tool calling
loukotal Apr 27, 2025
5bfdb15
fix gemini provider
kujtimiihoxha Apr 27, 2025
7e85672
fix minor issue
kujtimiihoxha Apr 27, 2025
2b06649
feat: configure context paths (#86)
garrettladley Apr 27, 2025
208cc68
fix context
kujtimiihoxha Apr 27, 2025
58406e2
WIP: kitty graphics protocol and ascii image previews (breaks everyth…
PhantomReactor Apr 27, 2025
ffd6812
remove unnecessary var
kujtimiihoxha Apr 27, 2025
72280da
fix duplicate context
kujtimiihoxha Apr 27, 2025
2aa63bd
feat: add azure openai models (#74)
snipeship Apr 28, 2025
27a7bd4
feat: model selection for given provider (#57)
rekram1-node Apr 28, 2025
e610cf7
fix diagnostics for deleted files
kujtimiihoxha Apr 28, 2025
c6a5116
new filepicker and image preview
PhantomReactor Apr 29, 2025
2056b35
merge main
PhantomReactor Apr 29, 2025
0e34b80
feat: Add support for OpenRouter (#92)
isaac-scarrott Apr 29, 2025
6df4737
filepicker changes and model validation
PhantomReactor Apr 29, 2025
72a66bc
minor change
PhantomReactor Apr 29, 2025
23016bb
remove executable
PhantomReactor Apr 29, 2025
32756d9
add attachments when when external editor is used
PhantomReactor Apr 29, 2025
bad2259
added styles to attachment in messages
PhantomReactor Apr 30, 2025
7df5026
fix(openrouter): set api key from env (#129)
enchantednatures Apr 30, 2025
67fdc6d
fix: allow text selection (#127)
adamdotdevin Apr 30, 2025
cbca3ea
search, select and navigate with path to file or directory
PhantomReactor Apr 30, 2025
a97b7bd
feat: themes (#113)
adamdotdevin May 1, 2025
e81d685
fix: more intuitive keybinds (#121)
adamdotdevin May 1, 2025
eb4781b
feat: test for getContextFromPaths (#105)
garrettladley May 1, 2025
0d99f01
bug fixes
PhantomReactor May 1, 2025
5a279a1
fix: tweak the logic in config to ensure that env vs file configurati…
rekram1-node May 1, 2025
2c41a42
add xai support (#135)
kujtimiihoxha May 1, 2025
cfcdc39
bug fixes
PhantomReactor May 1, 2025
def4f0b
merge main and bug fixes
PhantomReactor May 1, 2025
9e673c7
list theme changs
PhantomReactor May 1, 2025
f6267f7
remove attachments when model is switched
PhantomReactor May 1, 2025
e73d359
remove attachments from messages history to reduce request size and t…
PhantomReactor May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: build

on:
workflow_dispatch:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: git fetch --force --tags

- uses: actions/setup-go@v5
with:
go-version: ">=1.23.2"
cache: true
cache-dependency-path: go.sum

- run: go mod download

- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: build --snapshot --clean
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: release

on:
workflow_dispatch:
push:
tags:
- "*"

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
packages: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: git fetch --force --tags

- uses: actions/setup-go@v5
with:
go-version: ">=1.23.2"
cache: true
cache-dependency-path: go.sum

- run: go mod download

- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
76 changes: 76 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: 2
project_name: opencode
before:
hooks:
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/opencode-ai/opencode/internal/version.Version={{.Version}}
main: ./main.go

archives:
- format: tar.gz
name_template: >-
opencode-
{{- if eq .Os "darwin" }}mac-
{{- else if eq .Os "windows" }}windows-
{{- else if eq .Os "linux" }}linux-{{end}}
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "#86" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "0.0.0-{{ .Timestamp }}"
aurs:
- name: opencode
homepage: "https://github.com/opencode-ai/opencode"
description: "terminal based agent that can build anything"
maintainers:
- "kujtimiihoxha <kujtimii.h@gmail.com>"
license: "MIT"
private_key: "{{ .Env.AUR_KEY }}"
git_url: "ssh://aur@aur.archlinux.org/opencode-bin.git"
provides:
- opencode
conflicts:
- opencode
package: |-
install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"
brews:
- repository:
owner: opencode-ai
name: homebrew-tap
nfpms:
- maintainer: kujtimiihoxha
description: terminal based agent that can build anything
formats:
- deb
- rpm
file_name_template: >-
{{ .ProjectName }}-
{{- if eq .Os "darwin" }}mac
{{- else }}{{ .Os }}{{ end }}-{{ .Arch }}

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^doc:"
- "^test:"
- "^ci:"
- "^ignore:"
- "^example:"
- "^wip:"
95 changes: 81 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenCode
# ⌬ OpenCode

> **⚠️ Early Development Notice:** This project is in early development and is not yet ready for production use. Features may change, break, or be incomplete. Use at your own risk.

Expand All @@ -11,7 +11,7 @@ OpenCode is a Go-based CLI application that brings AI assistance to your termina
## Features

- **Interactive TUI**: Built with [Bubble Tea](https://github.com/charmbracelet/bubbletea) for a smooth terminal experience
- **Multiple AI Providers**: Support for OpenAI, Anthropic Claude, Google Gemini, AWS Bedrock, and Groq
- **Multiple AI Providers**: Support for OpenAI, Anthropic Claude, Google Gemini, AWS Bedrock, Groq, Azure OpenAI, and OpenRouter
- **Session Management**: Save and manage multiple conversation sessions
- **Tool Integration**: AI can execute commands, search files, and modify code
- **Vim-like Editor**: Integrated editor with text input capabilities
Expand All @@ -22,9 +22,36 @@ OpenCode is a Go-based CLI application that brings AI assistance to your termina

## Installation

### Using the Install Script

```bash
# Coming soon
go install github.com/kujtimiihoxha/opencode@latest
# Install the latest version
curl -fsSL https://opencode.ai/install | bash

# Install a specific version
curl -fsSL https://opencode.ai/install | VERSION=0.1.0 bash
```

### Using Homebrew (macOS and Linux)

```bash
brew install opencode-ai/tap/opencode
```

### Using AUR (Arch Linux)

```bash
# Using yay
yay -S opencode-bin

# Using paru
paru -S opencode-bin
```

### Using Go

```bash
go install github.com/opencode-ai/opencode@latest
```

## Configuration
Expand All @@ -39,15 +66,19 @@ OpenCode looks for configuration in the following locations:

You can configure OpenCode using environment variables:

| Environment Variable | Purpose |
| ----------------------- | ------------------------ |
| `ANTHROPIC_API_KEY` | For Claude models |
| `OPENAI_API_KEY` | For OpenAI models |
| `GEMINI_API_KEY` | For Google Gemini models |
| `GROQ_API_KEY` | For Groq models |
| `AWS_ACCESS_KEY_ID` | For AWS Bedrock (Claude) |
| `AWS_SECRET_ACCESS_KEY` | For AWS Bedrock (Claude) |
| `AWS_REGION` | For AWS Bedrock (Claude) |
| Environment Variable | Purpose |
|----------------------------|--------------------------------------------------------|
| `ANTHROPIC_API_KEY` | For Claude models |
| `OPENAI_API_KEY` | For OpenAI models |
| `GEMINI_API_KEY` | For Google Gemini models |
| `GROQ_API_KEY` | For Groq models |
| `AWS_ACCESS_KEY_ID` | For AWS Bedrock (Claude) |
| `AWS_SECRET_ACCESS_KEY` | For AWS Bedrock (Claude) |
| `AWS_REGION` | For AWS Bedrock (Claude) |
| `AZURE_OPENAI_ENDPOINT` | For Azure OpenAI models |
| `AZURE_OPENAI_API_KEY` | For Azure OpenAI models (optional when using Entra ID) |
| `AZURE_OPENAI_API_VERSION` | For Azure OpenAI models |


### Configuration File Structure

Expand All @@ -64,6 +95,14 @@ You can configure OpenCode using environment variables:
"anthropic": {
"apiKey": "your-api-key",
"disabled": false
},
"groq": {
"apiKey": "your-api-key",
"disabled": false
},
"openrouter": {
"apiKey": "your-api-key",
"disabled": false
}
},
"agents": {
Expand Down Expand Up @@ -131,6 +170,23 @@ OpenCode supports a variety of AI models from different providers:

- Claude 3.7 Sonnet

### Groq

- Llama 4 Maverick (17b-128e-instruct)
- Llama 4 Scout (17b-16e-instruct)
- QWEN QWQ-32b
- Deepseek R1 distill Llama 70b
- Llama 3.3 70b Versatile

### Azure OpenAI

- GPT-4.1 family (gpt-4.1, gpt-4.1-mini, gpt-4.1-nano)
- GPT-4.5 Preview
- GPT-4o family (gpt-4o, gpt-4o-mini)
- O1 family (o1, o1-mini)
- O3 family (o3, o3-mini)
- O4 Mini

## Usage

```bash
Expand Down Expand Up @@ -164,6 +220,7 @@ opencode -c /path/to/project
| `Ctrl+L` | View logs |
| `Ctrl+A` | Switch session |
| `Ctrl+K` | Command dialog |
| `Ctrl+O` | Toggle model selection dialog |
| `Esc` | Close current overlay/dialog or return to previous mode |

### Chat Page Shortcuts
Expand Down Expand Up @@ -193,6 +250,16 @@ opencode -c /path/to/project
| `Enter` | Select session |
| `Esc` | Close dialog |

### Model Dialog Shortcuts

| Shortcut | Action |
| ---------- | ----------------- |
| `↑` or `k` | Move up |
| `↓` or `j` | Move down |
| `←` or `h` | Previous provider |
| `→` or `l` | Next provider |
| `Esc` | Close dialog |

### Permission Dialog Shortcuts

| Shortcut | Action |
Expand Down Expand Up @@ -341,7 +408,7 @@ While the LSP client implementation supports the full LSP protocol (including co

```bash
# Clone the repository
git clone https://github.com/kujtimiihoxha/opencode.git
git clone https://github.com/opencode-ai/opencode.git
cd opencode

# Build
Expand Down
21 changes: 13 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"time"

tea "github.com/charmbracelet/bubbletea"
"github.com/kujtimiihoxha/opencode/internal/app"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/db"
"github.com/kujtimiihoxha/opencode/internal/llm/agent"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
"github.com/kujtimiihoxha/opencode/internal/tui"
zone "github.com/lrstanley/bubblezone"
"github.com/opencode-ai/opencode/internal/app"
"github.com/opencode-ai/opencode/internal/config"
"github.com/opencode-ai/opencode/internal/db"
"github.com/opencode-ai/opencode/internal/llm/agent"
"github.com/opencode-ai/opencode/internal/logging"
"github.com/opencode-ai/opencode/internal/pubsub"
"github.com/opencode-ai/opencode/internal/tui"
"github.com/opencode-ai/opencode/internal/version"
"github.com/spf13/cobra"
)

Expand All @@ -31,6 +32,10 @@ to assist developers in writing, debugging, and understanding code directly from
cmd.Help()
return nil
}
if cmd.Flag("version").Changed {
fmt.Println(version.Version)
return nil
}

// Load the config
debug, _ := cmd.Flags().GetBool("debug")
Expand Down Expand Up @@ -74,7 +79,6 @@ to assist developers in writing, debugging, and understanding code directly from
program := tea.NewProgram(
tui.New(app),
tea.WithAltScreen(),
tea.WithMouseCellMotion(),
)

// Initialize MCP tools in the background
Expand Down Expand Up @@ -247,6 +251,7 @@ func Execute() {

func init() {
rootCmd.Flags().BoolP("help", "h", false, "Help")
rootCmd.Flags().BoolP("version", "v", false, "Version")
rootCmd.Flags().BoolP("debug", "d", false, "Debug")
rootCmd.Flags().StringP("cwd", "c", "", "Current working directory")
}
Loading