This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository provides a Dev Container Feature that installs Jetify Devbox in development containers. Devbox is a command-line tool that creates isolated shells for development using Nix.
# Run all tests
devcontainer features test .
# Test specific feature
devcontainer features test -f jetify-devbox .
# Test specific scenario
devcontainer features test -f jetify-devbox --skip-autogenerated .
# Test with specific base image
devcontainer features test -f jetify-devbox --base-image ubuntu:focal .
# Run only global scenarios
devcontainer features test --global-scenarios-only .# Install devcontainer CLI (required for testing)
npm install -g @devcontainers/cli-
src/jetify-devbox/: Feature implementation
devcontainer-feature.json: Feature metadata defining options and dependenciesinstall.sh: Installation script that installs Devbox via NixReadMe.md: Feature-specific documentation
-
test/jetify-devbox/: Feature tests
test.sh: Basic functionality testsscenarios.json: Test scenarios configurationtest_*.sh: Scenario-specific test scriptsdevbox.json: Sample Devbox configuration for testing
- Nix dependency is installed automatically (via
dependsOn) install.shruns during container build:- Adds Nix unstable channel
- Installs Devbox using Nix profile
- Creates post-setup script at
/usr/local/share/devbox-post-setup.sh - Creates manual setup helper at
/usr/local/bin/devbox-setup
- Post-setup script runs on container creation via
onCreateCommand:- Checks for
devbox.jsonin workspace - Runs
devbox updateto initialize environment - Configures shell environment
- Checks for
autoUpdate(boolean, default: true): Controls whetherdevbox updateruns automatically
DEVBOX_FEATURE_INSTALLED: Set to "true" in container environmentWORKSPACE_FOLDER: Used to locatedevbox.json_REMOTE_USER: Used to run commands as non-root user
/usr/local/share/devbox-post-setup.sh: Runs on container creation/usr/local/bin/devbox-setup: Manual setup helper/usr/local/share/devbox-auto-update-enabled: Stores autoUpdate preference
The test suite verifies:
-
Basic functionality (
test.sh):- Devbox installation
- PATH configuration
- Basic commands (
devbox version,devbox init,devbox shell)
-
Scenario tests:
auto_update_enabled: Verifies automatic setup with devbox.jsonauto_update_disabled: Verifies manual setup workflowtest_vscode_integration: Tests VS Code terminal integrationtest_with_user_oncreate: Ensures compatibility with user onCreateCommandtest_different_base_images: Tests various base image compatibility
GitHub Actions workflow (.github/workflows/test.yaml):
- Tests against multiple base images (Alpine, Debian, Ubuntu, devcontainers/base)
- Runs autogenerated tests, scenario tests, and global tests
- Uploads test logs on failure for debugging
- Shell Script Safety: All scripts use
set -efor error handling - User Context: Scripts handle both root and non-root execution
- Logging: Post-setup script logs to
/tmp/devbox-setup.log - Idempotency: Scripts check for existing configurations before running
- Feature ID: The feature ID is
jetify-devbox(not justdevbox)