From f9c9c7bd2f30f50c1cca96fef678bd0625e9981c Mon Sep 17 00:00:00 2001 From: nkdui Date: Wed, 15 Apr 2026 23:42:15 +0700 Subject: [PATCH 1/8] initial implementation --- AGENTS.md | 84 +++++++++++++++++++++ src/conan/devcontainer-feature.json | 23 ++++++ src/conan/install.sh | 109 ++++++++++++++++++++++++++++ test/conan/archlinux.sh | 13 ++++ test/conan/debian.sh | 13 ++++ test/conan/default.sh | 13 ++++ test/conan/fedora.sh | 13 ++++ test/conan/scenarios.json | 34 +++++++++ test/conan/specific_version.sh | 13 ++++ test/conan/test.sh | 19 +++++ 10 files changed, 334 insertions(+) create mode 100644 AGENTS.md create mode 100644 src/conan/devcontainer-feature.json create mode 100644 src/conan/install.sh create mode 100644 test/conan/archlinux.sh create mode 100644 test/conan/debian.sh create mode 100644 test/conan/default.sh create mode 100644 test/conan/fedora.sh create mode 100644 test/conan/scenarios.json create mode 100644 test/conan/specific_version.sh create mode 100644 test/conan/test.sh diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..076113c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,84 @@ +# Dev Container Features Repo + +Template for authoring and publishing [Dev Container Features](https://containers.dev/implementors/features/) to GitHub Container Registry. + +## Repository Structure + +``` +src// + devcontainer-feature.json # Feature metadata, options, version + install.sh # Entrypoint, runs as root during build +test// + scenarios.json # Test scenarios (optional) + test.sh # Auto-generated tests (runs against defaults) + .sh # Per-scenario test scripts +test/_global/ + scenarios.json # Multi-feature integration tests +``` + +## Required CLI + +Install the devcontainer CLI globally: + +```bash +npm install -g @devcontainers/cli +``` + +## Development Commands + +**Validate feature metadata:** +```bash +devcontainer features validate --base-path ./src +``` + +**Test a single feature (auto-generated):** +```bash +devcontainer features test -f --skip-scenarios -i mcr.microsoft.com/devcontainers/base:ubuntu . +``` + +**Test a single feature (scenarios only):** +```bash +devcontainer features test -f --skip-autogenerated . +``` + +**Test global scenarios:** +```bash +devcontainer features test --global-scenarios-only . +``` + +## Feature Implementation Notes + +- `install.sh` always runs as **root** during container build +- Options from `devcontainer-feature.json` are passed as **capitalized env vars** (e.g., `favorite` → `FAVORITE`) +- Use `$_REMOTE_USER` and `$_CONTAINER_USER` for user context if needed +- Feature version is defined in `devcontainer-feature.json` (semver) +- Declare dependencies via `installsAfter` in metadata + +## CI Workflows + +- `.github/workflows/validate.yml`: Validates `devcontainer-feature.json` on PR +- `.github/workflows/test.yaml`: Runs auto-generated + scenario tests on PR/push +- `.github/workflows/release.yaml`: Publishes to GHCR (manual trigger, main branch only) + +## Publishing + +- Namespace: `ghcr.io///:` +- Requires `package:write` permission and GITHUB_TOKEN +- Packages default to **private** in GHCR; must manually set to **public** in package settings +- README auto-generated per feature (merges `src//NOTES.md` if exists) + +## Test Library + +Tests can use the bundled test library: + +```bash +source dev-container-features-test-lib +check "