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
54 changes: 54 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Release features"

on:
workflow_dispatch:

permissions:
contents: write
packages: write
pull-requests: write

jobs:
publish:
name: "Publish to GHCR"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: "Publish features"
uses: devcontainers/action@v1
with:
publish-features: "true"
base-path-to-features: "./src"
generate-docs: "true"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Publish per-feature releases"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
for manifest in src/*/devcontainer-feature.json; do
dir=$(dirname "$manifest")
id=$(jq -r '.id' "$manifest")
version=$(jq -r '.version' "$manifest")
tag="${id}-v${version}"

if gh release view "$tag" >/dev/null 2>&1; then
echo "Release $tag already exists, skipping."
continue
fi

readme="${dir}/README.md"
if [[ ! -f "$readme" ]]; then
echo "No README for $id, skipping."
continue
fi

gh release create "$tag" \
--target "$GITHUB_SHA" \
--title "${id} v${version}" \
--notes-file "$readme" \
"$readme#${id}-README.md"
done
153 changes: 153 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: "Test features"

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
test-autogenerated:
name: "Autogenerated tests / ${{ matrix.feature }} on ${{ matrix.base-image }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# pnpm requires Node — only typescript-node:24 has it.
- feature: pnpm
base-image: mcr.microsoft.com/devcontainers/typescript-node:24-trixie
- feature: pnpm
base-image: mcr.microsoft.com/devcontainers/typescript-node:24-bookworm
- feature: pnpm
base-image: mcr.microsoft.com/devcontainers/typescript-node:24-bullseye

# claude / gitbutler / opencode are Node-less — test on the bare base
# across all current Debian + Ubuntu LTS releases.
- feature: claude
base-image: mcr.microsoft.com/devcontainers/base:trixie
- feature: claude
base-image: mcr.microsoft.com/devcontainers/base:bookworm
- feature: claude
base-image: mcr.microsoft.com/devcontainers/base:bullseye
- feature: claude
base-image: mcr.microsoft.com/devcontainers/base:noble
- feature: claude
base-image: mcr.microsoft.com/devcontainers/base:jammy
- feature: claude
base-image: mcr.microsoft.com/devcontainers/base:focal

# gitbutler's upstream binary needs glibc >= 2.32, so bullseye
# (Debian 11, glibc 2.31) and focal (Ubuntu 20.04, glibc 2.31) are
# excluded.
- feature: gitbutler
base-image: mcr.microsoft.com/devcontainers/base:trixie
- feature: gitbutler
base-image: mcr.microsoft.com/devcontainers/base:bookworm
- feature: gitbutler
base-image: mcr.microsoft.com/devcontainers/base:noble
- feature: gitbutler
base-image: mcr.microsoft.com/devcontainers/base:jammy

- feature: opencode
base-image: mcr.microsoft.com/devcontainers/base:trixie
- feature: opencode
base-image: mcr.microsoft.com/devcontainers/base:bookworm
- feature: opencode
base-image: mcr.microsoft.com/devcontainers/base:bullseye
- feature: opencode
base-image: mcr.microsoft.com/devcontainers/base:noble
- feature: opencode
base-image: mcr.microsoft.com/devcontainers/base:jammy
- feature: opencode
base-image: mcr.microsoft.com/devcontainers/base:focal
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: pnpm/action-setup@v6
with:
version: 11
- name: Get pnpm store path
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v5
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('.github/workflows/test.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install @devcontainers/cli
run: pnpm add -g @devcontainers/cli
- name: Run autogenerated tests
run: |
devcontainer features test \
--features "${{ matrix.feature }}" \
--base-image "${{ matrix.base-image }}" \
--skip-scenarios \
--project-folder .

test-scenarios:
name: "Scenario tests / ${{ matrix.feature }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature: [claude, gitbutler, opencode, pnpm]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: pnpm/action-setup@v6
with:
version: 11
- name: Get pnpm store path
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v5
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('.github/workflows/test.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install @devcontainers/cli
run: pnpm add -g @devcontainers/cli
- name: Run scenario tests
run: |
devcontainer features test \
--features "${{ matrix.feature }}" \
--skip-autogenerated \
--project-folder .

test-global:
name: "Global scenarios"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: pnpm/action-setup@v6
with:
version: 11
- name: Get pnpm store path
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v5
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('.github/workflows/test.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install @devcontainers/cli
run: pnpm add -g @devcontainers/cli
- name: Run global scenarios
run: |
devcontainer features test \
--global-scenarios-only \
--project-folder .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.devcontainer/
plans/
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FEATURES ?= claude,gitbutler,opencode,pnpm
BASE_IMAGE ?= mcr.microsoft.com/devcontainers/typescript-node:24-trixie

.PHONY: help test test-auto test-scenarios test-global

help:
@echo "Targets:"
@echo " test auto + scenario + global tests"
@echo " test-auto autogenerated tests"
@echo " test-scenarios scenario tests"
@echo " test-global global scenario tests"
@echo ""
@echo "Vars:"
@echo " FEATURES='$(FEATURES)' (comma-separated; e.g. FEATURES=claude)"
@echo " BASE_IMAGE='$(BASE_IMAGE)'"

test: test-auto test-scenarios test-global

test-auto:
devcontainer features test \
--features "$(FEATURES)" \
--base-image "$(BASE_IMAGE)" \
--skip-scenarios \
--project-folder .

test-scenarios:
devcontainer features test \
--features "$(FEATURES)" \
--skip-autogenerated \
--project-folder .

test-global:
devcontainer features test \
--global-scenarios-only \
--project-folder .
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Synergy Shock Dev Container Features

A collection of [Dev Container Features](https://containers.dev/features) published to GHCR. Drop any of them into a `devcontainer.json` to get the same tooling we use internally.

## Features

| ID | Name | Description | Reference |
|----|------|-------------|-----------|
| [`claude`](./src/claude) | Claude Code | Installs the Claude Code CLI (`@anthropic-ai/claude-code`). | `ghcr.io/synergy-shock/devcontainer/claude` |
| [`gitbutler`](./src/gitbutler) | GitButler CLI | Installs the GitButler CLI (`but`). | `ghcr.io/synergy-shock/devcontainer/gitbutler` |
| [`opencode`](./src/opencode) | OpenCode | Installs the OpenCode AI CLI and `rtk`. | `ghcr.io/synergy-shock/devcontainer/opencode` |
| [`pnpm`](./src/pnpm) | pnpm | Installs pnpm globally and configures the store and npm prefix. | `ghcr.io/synergy-shock/devcontainer/pnpm` |

## Usage

Reference a feature from any `devcontainer.json` by its GHCR URL and version tag:

```jsonc
{
"image": "mcr.microsoft.com/devcontainers/typescript-node:24-trixie",
"features": {
"ghcr.io/synergy-shock/devcontainer/pnpm:1": {},
"ghcr.io/synergy-shock/devcontainer/claude:2": {},
"ghcr.io/synergy-shock/devcontainer/opencode:2": {
"installRtk": true
},
"ghcr.io/synergy-shock/devcontainer/gitbutler:1": {}
}
}
```

Version tags follow the `MAJOR`, `MAJOR.MINOR`, and `MAJOR.MINOR.PATCH` aliases that `devcontainers/action` publishes automatically.

## Local development

This repo's own `.devcontainer/devcontainer.json` composes all four features from `../src/<id>` so contributors can iterate on the install scripts in-place. Open the repo in VS Code Dev Containers, or run:

```bash
devcontainer up --workspace-folder .
```

Then inside the container verify the binaries you touched:

```bash
claude --version
but --version
opencode --version
pnpm --version
```

## Testing

Tests use the official `@devcontainers/cli`. Install it once:

```bash
npm install -g @devcontainers/cli
```

Then from the repo root:

```bash
# Autogenerated checks for a single feature
devcontainer features test -f pnpm \
-i mcr.microsoft.com/devcontainers/typescript-node:24-trixie \
-p .

# Custom scenarios for a single feature
devcontainer features test -f opencode --skip-autogenerated -p .

# Cross-feature combinations
devcontainer features test --global-scenarios-only -p .
```

Each per-feature test lives at `test/<id>/test.sh`; scenario tests at `test/<id>/<scenario>.sh` with the matching `test/<id>/scenarios.json`; cross-feature tests in `test/_global/`.

CI runs all three of these in `.github/workflows/test.yaml` on every push and PR.

## Releasing

1. Bump `version` in `src/<id>/devcontainer-feature.json` for any feature you changed. Follow SemVer.
2. Merge the PR to `main`.
3. From the **Actions** tab, run the **Release features** workflow (`workflow_dispatch`). It will:
- publish each feature to `ghcr.io/synergy-shock/devcontainer/<id>` with the new version tag
- open a follow-up PR with auto-generated `src/<id>/README.md` updates
4. **First-time only**, visit <https://github.com/orgs/Synergy-Shock/packages> (or your account `?tab=packages` if published under a user namespace), open each new package, and change its visibility to **public**. GHCR publishes private by default.

## Contributing

- Author hand-written context in `src/<id>/NOTES.md` — it gets concatenated into the auto-generated `README.md` so consumers see it.
- Don't edit `src/<id>/README.md` by hand; the release workflow regenerates it.
- Run the relevant `devcontainer features test` locally before opening a PR.

## License

MIT — see [LICENSE](./LICENSE).
14 changes: 14 additions & 0 deletions features/opencode/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## OS support

Debian/Ubuntu-based images. The feature is self-contained — it fetches the
official opencode installer via `curl` and does not require Node.js or `npm`
on the host image.

## What gets installed

- **opencode** — installed under `/usr/local/share/opencode` via the official installer (`https://opencode.ai/install`), symlinked to `/usr/local/bin/opencode`.
- **rtk** *(optional, default on)* — fetched from the latest GitHub release of `rtk-ai/rtk` and placed at `/usr/local/bin/rtk`.

## Architectures

`x86_64` and `aarch64` (`arm64` is mapped to `aarch64`) for `rtk`.
20 changes: 20 additions & 0 deletions features/opencode/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "opencode",
"version": "2.0.0",
"name": "OpenCode",
"description": "Installs the OpenCode AI CLI and (optionally) rtk.",
"documentationURL": "https://github.com/Synergy-Shock/devcontainer/tree/main/features/opencode",
"options": {
"version": {
"type": "string",
"default": "latest",
"description": "Version selector (currently unused by the curl installer).",
"proposals": ["latest"]
},
"installRtk": {
"type": "boolean",
"default": true,
"description": "Install the rtk CLI."
}
}
}
Loading