From 8a1723746520d68b45eadf02b90b73f0ba540178 Mon Sep 17 00:00:00 2001 From: Svetlin Ralchev Date: Thu, 11 Dec 2025 08:14:28 +0400 Subject: [PATCH] feat(opencode): add devcontainer feature support introduce opencode feature with metadata, docs, and install script to bundle the open source coding agent. add scenario and CLI smoke test to validate opencode usage. extend CI matrices so opencode builds alongside atlas and starship. Signed-off-by: Svetlin Ralchev --- .github/workflows/ci.yaml | 2 ++ src/opencode/README.md | 23 +++++++++++++++++++++ src/opencode/devcontainer-feature.json | 17 ++++++++++++++++ src/opencode/install.sh | 28 ++++++++++++++++++++++++++ test/opencode/scenarios.json | 1 + test/opencode/test.sh | 16 +++++++++++++++ 6 files changed, 87 insertions(+) create mode 100644 src/opencode/README.md create mode 100644 src/opencode/devcontainer-feature.json create mode 100644 src/opencode/install.sh create mode 100644 test/opencode/scenarios.json create mode 100644 test/opencode/test.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ebe0dd9..f686bef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,6 +14,7 @@ jobs: features: - atlas - starship + - opencode baseImage: - debian:latest - ubuntu:latest @@ -32,6 +33,7 @@ jobs: features: - atlas - starship + - opencode steps: - uses: actions/checkout@v4 - name: "Install latest devcontainer CLI" diff --git a/src/opencode/README.md b/src/opencode/README.md new file mode 100644 index 0000000..217c23a --- /dev/null +++ b/src/opencode/README.md @@ -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`._ diff --git a/src/opencode/devcontainer-feature.json b/src/opencode/devcontainer-feature.json new file mode 100644 index 0000000..038e958 --- /dev/null +++ b/src/opencode/devcontainer-feature.json @@ -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" + ] +} diff --git a/src/opencode/install.sh b/src/opencode/install.sh new file mode 100644 index 0000000..49a755a --- /dev/null +++ b/src/opencode/install.sh @@ -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 diff --git a/test/opencode/scenarios.json b/test/opencode/scenarios.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/test/opencode/scenarios.json @@ -0,0 +1 @@ +{} diff --git a/test/opencode/test.sh b/test/opencode/test.sh new file mode 100644 index 0000000..95bbe95 --- /dev/null +++ b/test/opencode/test.sh @@ -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