_ _
| | | |
__| | _____ ________ ___ ___ __| | ___
/ _` |/ _ \ \ / /______/ __/ _ \ / _` |/ _ \
| (_| | __/\ V / | (_| (_) | (_| | __/
\__,_|\___| \_/ \___\___/ \__,_|\___|
project · editor · container — simplified
Reusable Dev Containers for any project — without modifying the repository.
devcode is a CLI that opens any project in VS Code Dev Containers using reusable, local templates.
Define your environment once and reuse it across projects.
Typical Dev Container workflows involve:
- Copying
.devcontainer/directories between projects - Recreating environments repeatedly
- Committing configuration to repositories you do not control
devcode separates environment configuration from project code:
- Templates are stored locally
- Projects remain unchanged
- Containers are launched with a single command
- VS Code with the Dev Containers extension
- Docker
pip install dev-code# Open a project (auto-detects template from container history, or uses default)
devcode open ~/projects/my-app
# Open with an explicit template
devcode open ~/projects/my-app dev-codedevcode new python-dev
devcode edit python-dev
devcode open ~/projects/my-app python-devdevcode ps -a -iLists containers and allows reopening projects interactively.
- Multiple template directories
- Template inheritance
- Verbose debugging (
-v) - Dry runs (
--dry-run) - Custom container paths
- Validate project path (must exist)
- Resolve template (explicit → container history → settings default)
- Launch VS Code Dev Container
- Apply file injection rules
Full reference for all devcode commands and flags.
-v, --verbose Enable debug outputdevcode open <path> [template] [options]Open a project in VS Code using a devcontainer template.
-
<path>— Project directory (must exist) -
[template](optional)- Template name, or
- Path to a
devcontainer.json, or - Path to a directory containing it
Paths must start with
./,../,/, or~/.If both a template name and a local directory match, the template takes precedence and a warning is shown.
If omitted, devcode auto-detects the template in this order:
- Most recently running container for this project path (uses its stored config)
- Most recently stopped container for this project path
default_templatefromsettings.json(error if not set)
| Option | Default | Description |
|---|---|---|
--dry-run |
— | Print resolved configuration and actions without executing |
--container-folder <path> |
/workspaces/<project> |
Container mount path |
--timeout <seconds> |
300 |
Time to wait for container startup |
devcode new <name> [base]Create a new template.
| Argument | Default | Description |
|---|---|---|
[base] |
dev-code |
Template to copy from |
Options:
--editOpen the template in VS Code after creation.
devcode edit [template]- With a name: opens that template
- Without arguments: opens the templates directory
devcode list [--long]| Option | Description |
|---|---|
--long |
Show full paths and grouped directories |
devcode ps [-a] [-i]| Flag | Description |
|---|---|
-a |
Include stopped containers |
-i |
Interactive reopen mode |
Interactive mode prompts:
Open [1-N]:
Selecting a number reopens the project in VS Code.
devcode completion bash
devcode completion zshEnable in shell:
eval "$(devcode completion bash)"devcode reads settings.json from:
~/.config/dev-code/settings.json
Override the config directory:
DEVCODE_CONF_DIR=/custom/path devcode open ~/projects/my-appThe file is created automatically with defaults on first run.
{
"template_sources": ["~/.local/share/dev-code/templates"],
"default_template": "dev-code"
}| Key | Description |
|---|---|
template_sources |
Ordered list of template directories. First is the write target; rest are read-only. |
default_template |
Template used when devcode open is called without a template argument and no container history is found. Error if unset. |
~/.local/share/dev-code/templates/
Configure additional paths via template_sources in settings.json (see Configuration).
Inject files from the host into the container at startup.
{
"customizations": {
"dev-code": {
"cp": [
{
"source": "${localEnv:HOME}/.config/myapp",
"target": "/home/vscode/.config/myapp"
}
]
}
}
}| Field | Required | Description |
|---|---|---|
source |
Yes | Host path |
target |
Yes | Container path |
override |
No | Skip if target exists (default: false) |
owner |
No | Requires group |
group |
No | Requires owner |
permissions |
No | chmod applied recursively |
- Supports
${localEnv:VAR} - Supports relative paths from
.devcontainer/ - Missing environment variables cause the entry to be skipped
Use /. suffix:
{
"source": "${localEnv:HOME}/.config/myapp/.",
"target": "/home/vscode/.config/myapp/"
}Copies directory contents instead of the directory itself.
target/copies into the directory- Without trailing
/copies as a file or directory override=falseskips existing files- Ownership and permissions are applied after copying
- PRs welcome. Open an issue first for significant changes.
- Run
tox(orpytestfor a single-interpreter run) before submitting.
Report bugs or request features in Issues.
MIT © Nasser Alansari (dacrystal)
