Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
features:
- atlas
- starship
- opencode
baseImage:
- debian:latest
- ubuntu:latest
Expand All @@ -32,6 +33,7 @@ jobs:
features:
- atlas
- starship
- opencode
steps:
- uses: actions/checkout@v4
- name: "Install latest devcontainer CLI"
Expand Down
23 changes: 23 additions & 0 deletions src/opencode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# opencode

The open source coding agent.

## Example Usage

```json
"features": {
"ghcr.io/devcontainers-features/collection/opecode:1": {
"version": "latest"
}
}
```

## Options

| Options Id | Description | Type | Default Value |
| ---------- | ------------------------------ | ------ | ------------- |
| version | Select the version to install. | string | latest |

---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/feature-starter/blob/main/src/color/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
17 changes: 17 additions & 0 deletions src/opencode/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"id": "opencode",
"name": "OpenCode",
"version": "0.0.1",
"description": "The open source coding agent.",
"documentationURL": "https://github.com/devcontainers-features/collection/tree/main/src/opencode",
"options": {
"version": {
"description": "Select the version to install.",
"type": "string",
"default": "latest"
}
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
]
}
28 changes: 28 additions & 0 deletions src/opencode/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
set -e

apt_get_update() {
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}

# Checks if packages are installed and installs them if not
apt_get() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
apt-get -y install --no-install-recommends "$@"
fi
}

apt_get_update
apt_get ca-certificates
apt_get curl

[ "$VERSION" = "latest" ] && unset VERSION

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

# Make opencode available for everybody
mv "$HOME/.opencode/bin/opencode" /usr/local/bin/opencode
1 change: 1 addition & 0 deletions test/opencode/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
16 changes: 16 additions & 0 deletions test/opencode/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Provides the 'check' and 'reportResults' commands.
# shellcheck disable=SC1091
source dev-container-features-test-lib

# Feature-specific tests
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
# check <LABEL> <cmd> [args...]
check "execute command" bash -c "opencode -h | grep 'start opencode tui'"

# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
reportResults
Loading