diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4920903..ec39e30 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,6 +21,7 @@ jobs: - deno.com - feature-installer - nixos.org + - opencode.ai - pkgx.sh - smallstep.com - starship.rs @@ -54,6 +55,7 @@ jobs: - deno.com - feature-installer - nixos.org + - opencode.ai - pkgx.sh - smallstep.com - starship.rs diff --git a/src/opencode.ai/README.md b/src/opencode.ai/README.md new file mode 100644 index 0000000..75a5cb2 --- /dev/null +++ b/src/opencode.ai/README.md @@ -0,0 +1,34 @@ + +# opencode.ai (opencode.ai) + +Install "opencode.ai" binary + +## Example Usage + +```json +"features": { + "ghcr.io/devcontainer-community/devcontainer-features/opencode.ai:0": {} +} +``` + +## Options + +| Options Id | Description | Type | Default Value | +|-----|-----|-----|-----| +```json +"features": { + "ghcr.io/devcontainer-community/devcontainer-features/opencode.ai:0.0.1": {} +} +``` + +## Options + +| Options Id | Description | Type | Default Value | +|-----|-----|-----|-----| +| version | Version of "opencode.ai" to install. | string | latest | + + + +--- + +_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainer-community/devcontainer-features/blob/main/src/opencode.ai/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/src/opencode.ai/devcontainer-feature.json b/src/opencode.ai/devcontainer-feature.json new file mode 100644 index 0000000..2dade12 --- /dev/null +++ b/src/opencode.ai/devcontainer-feature.json @@ -0,0 +1,17 @@ +{ + "name": "opencode.ai", + "id": "opencode.ai", + "version": "0.0.1", + "description": "Install \"opencode\" binary", + "documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/opencode.ai", + "options": { + "version": { + "type": "string", + "default": "latest", + "proposals": [ + "latest" + ], + "description": "Version of \"opencode.ai\" to install." + } + } +} \ No newline at end of file diff --git a/src/opencode.ai/install.sh b/src/opencode.ai/install.sh new file mode 100755 index 0000000..7adaf53 --- /dev/null +++ b/src/opencode.ai/install.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -o errexit +set -o pipefail +set -o noclobber +set -o nounset +set -o allexport +readonly name="opencode.ai" +apt_get_update() { + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi +} +apt_get_checkinstall() { + if ! dpkg -s "$@" >/dev/null 2>&1; then + apt_get_update + DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@" + fi +} +apt_get_cleanup() { + apt-get clean + rm -rf /var/lib/apt/lists/* +} +echo_banner() { + local text="$1" + echo -e "\e[1m\e[97m\e[41m$text\e[0m" +} +install() { + apt_get_checkinstall curl ca-certificates + su $_REMOTE_USER -c "curl -fsSL https://opencode.ai/install | bash" + apt_get_cleanup +} +echo_banner "devcontainer.community" +echo "Installing $name..." +install "$@" +echo "(*) Done!" diff --git a/test/opencode.ai/test.sh b/test/opencode.ai/test.sh new file mode 100755 index 0000000..28d0002 --- /dev/null +++ b/test/opencode.ai/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + + +set -e + +# Optional: Import test library bundled with the devcontainer CLI +# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib +# Provides the 'check' and 'reportResults' commands. +source dev-container-features-test-lib + +# Feature-specific tests +# The 'check' command comes from the dev-container-features-test-lib. Syntax is... +# check