Skip to content

Commit 9e95b4e

Browse files
feat: add ccc (co-config) dev container feature (#84)
Add new dev container feature for the ccc CLI tool from jsburckhardt/co-config. Includes installer, tests, CI matrix entry, and documentation. Co-authored-by: Copilot <[email protected]>
1 parent 7a04c1b commit 9e95b4e

8 files changed

Lines changed: 166 additions & 1 deletion

File tree

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
- bat
3131
- just
3232
- opencode
33+
- ccc
3334
baseImage:
3435
- debian:latest
3536
- ubuntu:latest

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This repository contains a _collection_ of Features.
2828
| Ruff | https://docs.astral.sh/ruff/ | An extremely fast Python linter and code formatter, written in Rust. |
2929
| OpenCode | https://opencode.ai/ | AI coding agent, built for the terminal. An open-source alternative to Claude Code with support for multiple LLM providers. |
3030
| Codex-cli | https://github.com/openai/codex | Codex CLI is an experimental project under active development. |
31+
| ccc | https://github.com/jsburckhardt/co-config | A TUI tool to interactively configure and view GitHub Copilot CLI settings. |
3132

3233

3334

@@ -337,3 +338,20 @@ Running `just` inside the built container will print the help menu of just.
337338
```bash
338339
just --version
339340
```
341+
342+
### `ccc`
343+
344+
Running `ccc` inside the built container will print the version of ccc (Copilot Config CLI).
345+
346+
```jsonc
347+
{
348+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
349+
"features": {
350+
"ghcr.io/jsburckhardt/devcontainer-features/ccc:1": {}
351+
}
352+
}
353+
```
354+
355+
```bash
356+
ccc --version
357+
```

src/ccc/devcontainer-feature.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "ccc",
3+
"id": "ccc",
4+
"version": "1.0.0",
5+
"description": "A TUI tool to interactively configure and view GitHub Copilot CLI settings.",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"default": "latest",
10+
"description": "Version of ccc to install from GitHub releases e.g. v0.1.5"
11+
}
12+
}
13+
}

src/ccc/install.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env bash
2+
3+
# Variables
4+
REPO_OWNER="jsburckhardt"
5+
REPO_NAME="co-config"
6+
BINARY_NAME="ccc"
7+
CCC_VERSION="${VERSION:-"latest"}"
8+
GITHUB_API_REPO_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"
9+
10+
set -e
11+
12+
if [ "$(id -u)" -ne 0 ]; then
13+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
14+
exit 1
15+
fi
16+
17+
# Clean up
18+
rm -rf /var/lib/apt/lists/*
19+
20+
# Checks if packages are installed and installs them if not
21+
check_packages() {
22+
if ! dpkg -s "$@" >/dev/null 2>&1; then
23+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
24+
echo "Running apt-get update..."
25+
apt-get update -y
26+
fi
27+
apt-get -y install --no-install-recommends "$@"
28+
fi
29+
}
30+
31+
# Make sure we have curl and jq
32+
check_packages curl jq ca-certificates tar
33+
34+
# Function to get the latest version from GitHub API
35+
get_latest_version() {
36+
curl -s "${GITHUB_API_REPO_URL}/latest" | jq -r ".tag_name"
37+
}
38+
39+
# Check if a version is passed as an argument
40+
if [ -z "$CCC_VERSION" ] || [ "$CCC_VERSION" == "latest" ]; then
41+
# No version provided, get the latest version
42+
CCC_VERSION=$(get_latest_version)
43+
echo "No version provided or 'latest' specified, installing the latest version: $CCC_VERSION"
44+
else
45+
echo "Installing version from environment variable: $CCC_VERSION"
46+
fi
47+
48+
# Determine the OS and architecture
49+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
50+
ARCH=$(uname -m)
51+
52+
case "$ARCH" in
53+
x86_64)
54+
ARCH="amd64"
55+
;;
56+
aarch64)
57+
ARCH="arm64"
58+
;;
59+
*)
60+
echo "Unsupported architecture: $ARCH"
61+
exit 1
62+
;;
63+
esac
64+
65+
case "$OS" in
66+
linux)
67+
OS="linux"
68+
;;
69+
darwin)
70+
OS="darwin"
71+
;;
72+
*)
73+
echo "Unsupported OS: $OS"
74+
exit 1
75+
;;
76+
esac
77+
78+
# Construct the download URL
79+
# Asset pattern: co-config_{os}_{arch}.tar.gz
80+
DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${CCC_VERSION}/${REPO_NAME}_${OS}_${ARCH}.tar.gz"
81+
82+
# Create a temporary directory for the download
83+
TMP_DIR=$(mktemp -d)
84+
cd "$TMP_DIR" || exit
85+
86+
echo "Downloading $BINARY_NAME from $DOWNLOAD_URL"
87+
curl -sSL "$DOWNLOAD_URL" -o "${BINARY_NAME}.tar.gz"
88+
89+
# Extract the tarball
90+
echo "Extracting $BINARY_NAME..."
91+
tar -xzf "${BINARY_NAME}.tar.gz"
92+
93+
# Move the binary to /usr/local/bin
94+
echo "Installing $BINARY_NAME..."
95+
mv "$BINARY_NAME" /usr/local/bin/
96+
chmod +x /usr/local/bin/$BINARY_NAME
97+
98+
# Cleanup
99+
cd - || exit
100+
rm -rf "$TMP_DIR"
101+
102+
# Clean up
103+
rm -rf /var/lib/apt/lists/*
104+
105+
# Verify installation
106+
echo "Verifying installation..."
107+
$BINARY_NAME --version
108+
109+
echo "Done!"

test/_global/all-tools.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ check "zarf" zarf version
1818
check "codex" codex --version
1919
check "just" just --version
2020
check "opencode" opencode --version
21+
check "ccc" ccc --version
2122

2223
reportResults
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e
4+
source dev-container-features-test-lib
5+
check "ccc with specific version" /bin/bash -c "ccc --version | grep '0.1.5'"
6+
7+
reportResults

test/_global/scenarios.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"zarf": {},
2020
"codex": {},
2121
"just": {},
22-
"opencode": {}
22+
"opencode": {},
23+
"ccc": {}
2324
}
2425
},
2526
"flux-specific-version": {
@@ -147,5 +148,13 @@
147148
"version": "1.0.107"
148149
}
149150
}
151+
},
152+
"ccc-specific-version": {
153+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
154+
"features": {
155+
"ccc": {
156+
"version": "v0.1.5"
157+
}
158+
}
150159
}
151160
}

test/ccc/test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
source dev-container-features-test-lib
6+
check "ccc" ccc --version
7+
reportResults

0 commit comments

Comments
 (0)