Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

Commit 80af1b5

Browse files
committed
Update README
1 parent aed2240 commit 80af1b5

1 file changed

Lines changed: 137 additions & 104 deletions

File tree

README.md

Lines changed: 137 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -7,207 +7,240 @@
77
/ _` |/ _ \ \ / /______/ __/ _ \ / _` |/ _ \
88
| (_| | __/\ V / | (_| (_) | (_| | __/
99
\__,_|\___| \_/ \___\___/ \__,_|\___|
10-
project · editor · container — simplified
11-
12-
usage: devcode [-h] [-v] {open,new,edit,init,list,ps,completion} ...
13-
14-
positional arguments:
15-
{open,new,edit,init,list,ps,completion}
16-
17-
options:
18-
-h, --help show this help message and exit
19-
-v, --verbose
20-
10+
project · editor · container — simplified
2111
```
2212

23-
2413
[![Coverage](https://codecov.io/gh/dacrystal/dev-code/branch/main/graph/badge.svg)](https://codecov.io/gh/dacrystal/dev-code)
2514
[![PyPI version](https://img.shields.io/pypi/v/dev-code)](https://pypi.org/project/dev-code/)
2615
[![Python 3.10+](https://img.shields.io/pypi/pyversions/dev-code)](https://pypi.org/project/dev-code/)
2716
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
2817

18+
**One command. Any project. The right devcontainer.**
2919

30-
*One command. Any project. The right devcontainer.*
20+
---
21+
22+
## Why devcode?
23+
24+
If you’ve ever:
3125

32-
Devcode is a CLI that opens any project in VS Code inside a devcontainer — instantly, using reusable templates you define once. No more hunting config files. No more copy-pasting devcontainer configurations.
26+
* Copied `.devcontainer/` folders between projects
27+
* Avoided committing devcontainer configs to repos you don’t control
28+
* Reconfigured VS Code containers again and again
3329

34-
Use any template on any project — even repos you don't control or where you'd rather keep the devcontainer out of the repository.
30+
**devcode fixes this.**
31+
32+
Define your devcontainer once. Reuse it everywhere. Keep your repos clean.
33+
34+
---
35+
36+
## What it does
37+
38+
`devcode` is a CLI that opens any project in VS Code inside a devcontainer—instantly—using reusable templates.
3539

3640
```bash
3741
# Before devcode
38-
code ~/projects/myhellopy
39-
#use Dev Containers extension to configure .devcontainer/
40-
# (or copy-paste devcontainer configurations from another project)
41-
#"Reopen in Container" → wait for build
42-
#remember: don't commit .devcontainer to this repo
42+
code ~/projects/my-app
43+
#configure .devcontainer manually (or copy-paste from another project)
44+
# → reopen in container
45+
#remember to not commit .devcontainer to this repo
46+
#repeat for every project
4347

4448
# After devcode
45-
devcode open py-dev ~/projects/myhellopy
49+
devcode open py-dev ~/projects/my-app
4650
```
4751

52+
VS Code opens. The container builds. You're ready to go.
53+
4854
---
4955

5056
## Install
5157

58+
Install the `dev-code` package, which provides the `devcode` CLI.
59+
60+
### Option 1 — Install globally (recommended)
61+
5262
```bash
5363
pip install dev-code
5464
```
5565

56-
Or run without installing via **uvx**:
66+
### Option 2 — Run without installing
5767

5868
```bash
5969
uvx --from dev-code devcode
6070
```
6171

62-
**Tip:** Add an alias for the fastest workflow:
72+
### Optional — Add alias
6373

6474
```bash
6575
alias devcode="uvx --from dev-code devcode"
6676
```
6777

68-
> Requires: VS Code with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) + Docker
78+
### Requirements
6979

70-
> **Optional:** Install the [`devcontainer` CLI](https://github.com/devcontainers/cli) for automatic resolution of all `devcontainer.json` variables (e.g. `${localEnv:VAR}`). Without it, devcode uses a Python-based parser that handles `${localEnv:VAR}` only. Install `jq` to improve parsing of `devcontainer.json` files that use comments or non-standard syntax (`jq` does not add variable resolution).
80+
* VS Code with Dev Containers extension
81+
* Docker
7182

7283
---
7384

74-
## Shell Completion
75-
76-
Add tab-completion for `devcode` subcommands, template names, and flags.
85+
## Quick start
7786

78-
### Bash
87+
```bash
88+
# 1. Seed your first template (one-time)
89+
devcode init
7990

80-
Add to `~/.bashrc`:
91+
# 2. Open any project in a container
92+
devcode open dev-code ~/projects/my-app
8193

82-
```bash
83-
eval "$(devcode completion bash)"
94+
# 3. Later: reopen any project instantly
95+
devcode ps -a -i
8496
```
8597

86-
> Requires bash 4.0+. macOS ships bash 3.2 — install bash 5 via Homebrew first.
98+
Select a project from the list to reopen it in VS Code.
8799

88-
### Zsh
100+
---
89101

90-
Add to `~/.zshrc` **after** `compinit`:
102+
## Core concepts
91103

92-
```zsh
93-
eval "$(devcode completion zsh)"
104+
### Templates
105+
106+
Reusable devcontainer definitions stored locally—not in your repos.
107+
108+
Default location:
109+
110+
```
111+
~/.local/share/dev-code/templates/
94112
```
95113

96-
Completes subcommand names, template names (for `open`, `new`, `edit`), flags, and shell names.
114+
Override with:
97115

98-
> **Note:** Shell completion requires `devcode` to be on your `PATH` as a real executable (e.g. `pip install dev-code`). It will not work if you are using the `alias devcode="uvx --from dev-code devcode"` shortcut, because shell completion scripts call `devcode` as a subprocess and aliases are not visible to subprocesses.
116+
```
117+
$DEVCODE_TEMPLATE_DIR
118+
```
99119

100120
---
101121

102-
## Quick-start
122+
## Features
103123

104-
```bash
105-
# 1. Seed your first template
106-
devcode init
124+
### Core workflow
107125

108-
# 2. Open any project in a devcontainer
109-
devcode open dev-code ~/projects/my-app
126+
* **One-command open** — launch any project instantly
127+
* **Reusable templates** — define once, use everywhere
128+
* **Works with any repo** — no config changes required
110129

111-
# That's it. VS Code opens, container spins up.
112-
```
130+
### Project switching (power feature)
113131

114-
---
132+
* **Reopen any project instantly** — use `devcode ps -a -i` to list all containers (running and stopped) and interactively reopen one
133+
* **Container dashboard** — inspect running environments with `devcode ps`
115134

116-
## Features
135+
### Customization
136+
137+
* **Custom templates**
138+
* **File sync on launch** — inject configs, credentials, and secrets safely
139+
140+
### Environment support
117141

118-
- **One-command open**`devcode open <template> <path>` launches VS Code in a devcontainer instantly
119-
- **Reusable templates** — define your devcontainer once, reuse it across every project
120-
- **Built-in template** — ships with the `dev-code` template out of the box
121-
- **Custom templates** — create and manage your own with `devcode new`
122-
- **File sync on launch** — copy credentials, configs, and secrets into the container via a `dev-code` customization block in `devcontainer.json`
123-
- **WSL support** — works natively on Windows Subsystem for Linux
124-
- **Container dashboard** — see all running devcontainers with `devcode ps`
125-
- **Works with existing config** — no new format, just standard `devcontainer.json`
142+
* **WSL support**
143+
* **Standard devcontainer format**
126144

127145
---
128146

129147
## Commands
130148

131-
| Command | Description |
132-
|---|---|
133-
| `devcode init` | Seed the built-in `dev-code` template into your template directory |
134-
| `devcode open <template> <path>` | Open a project in VS Code using a devcontainer template |
135-
| `devcode new <name> [base]` | Create a new template (optionally based on an existing one) |
136-
| `devcode edit [template]` | Open a template for editing in VS Code |
137-
| `devcode list [--long]` | List available templates |
138-
| `devcode ps` | Show running devcontainers |
139-
| `devcode completion <shell>` | Print shell completion script (`bash` or `zsh`) |
140-
141-
### Options
142-
143-
| Flag | Command | Description |
144-
|---|---|---|
145-
| `--dry-run` | `open` | Print the devcontainer URI and copy plan without executing |
146-
| `--container-folder` | `open` | Override the in-container workspace path |
147-
| `--timeout` | `open` | Seconds to wait for container to start (default: 300) |
148-
| `--edit` | `new` | Open the new template for editing immediately after creation |
149-
| `--long` | `list` | Show full paths alongside template names |
150-
| `-v, --verbose` | all | Enable debug logging |
149+
| Command | Description |
150+
| -------------------------------- | -------------------------------------------------------------- |
151+
| `devcode open <template> <path>` | Open a project using a template |
152+
| `devcode init` | Seed the default template |
153+
| `devcode new <name> [base]` | Create a new template |
154+
| `devcode edit [template]` | Edit a template |
155+
| `devcode list [--long]` | List templates |
156+
| `devcode ps [-a] [-i]` | List containers (`-a` includes stopped, `-i` interactive mode) |
157+
| `devcode completion <shell>` | Generate shell completion |
151158

152-
---
159+
### Examples
153160

154-
## Templates
161+
```bash
162+
# Show running containers
163+
devcode ps
155164

156-
Templates are directories containing a `.devcontainer/devcontainer.json` file. They live in `~/.local/share/dev-code/templates/` by default (XDG-compliant), or wherever `$DEVCODE_TEMPLATE_DIR` points.
165+
# Show all containers (including stopped)
166+
devcode ps -a
157167

158-
### Get started
168+
# Interactive project switcher
169+
devcode ps -a -i
170+
```
171+
172+
Select a container to reopen its project in VS Code.
173+
174+
---
175+
176+
## Templates in practice
159177

160178
```bash
161-
devcode init # copies the built-in dev-code template
162-
devcode new my-python # creates a new template from the default base
163-
devcode new my-node dev-code # creates a new template based on dev-code
164-
devcode edit my-python # open the template in VS Code to customise it
179+
devcode init
180+
devcode new my-python
181+
devcode edit my-python
182+
devcode open my-python ~/projects/app
165183
```
166184

167-
### File sync — copy files into the container on launch
185+
---
168186

169-
Add a `customizations.dev-code.cp` section to your `devcontainer.json` to copy files from your host into the running container:
187+
## File Copy (inject files into container)
170188

171189
```json
172190
{
173191
"customizations": {
174192
"dev-code": {
175193
"cp": [
176194
{
177-
"source": "${localEnv:HOME}/.claude/credentials.json",
178-
"target": "/home/vscode/.claude/credentials.json"
195+
"source": "${localEnv:HOME}/.config/myapp",
196+
"target": "/home/vscode/.config/myapp"
179197
}
180198
]
181199
}
182200
}
183201
}
184202
```
185203

186-
| Field | Type | Default | Description |
187-
|---|---|---|---|
188-
| `source` | string | required | Host path. Supports `${localEnv:VAR}` and relative paths. Use trailing `/.` to copy directory contents. |
189-
| `target` | string | required | Container path. Trailing `/` places the source inside the directory. |
190-
| `override` | bool | `false` | When `true`, overwrite an existing target. When `false` (default), skip if target already exists. |
191-
| `owner` | string || User for `chown -R owner:group` after copy. Both `owner` and `group` must be set; silently skipped if either is omitted. |
192-
| `group` | string || Group for `chown`. Both `owner` and `group` must be set; silently skipped if either is omitted. |
193-
| `permissions` | string || Mode for `chmod -R` after copy (e.g. `"600"`). |
204+
Perfect for:
194205

195-
All field names are lowercase.
206+
* Credentials
207+
* Config files
208+
* Local development secrets
196209

197210
---
198211

199-
## Contributing
212+
## Shell completion
200213

201-
Contributions are welcome! To get started:
214+
### Bash
202215

203216
```bash
204-
git clone https://github.com/dacrystal/dev-code
205-
devcode open dev-code ./dev-code
217+
eval "$(devcode completion bash)"
206218
```
207219

208-
The repo includes a `dev-code` devcontainer — open it with itself.
220+
### Zsh
221+
222+
```zsh
223+
eval "$(devcode completion zsh)"
224+
```
225+
226+
> Requires `devcode` to be installed (not via alias).
227+
228+
---
229+
230+
## How it works
209231

210-
Please open an issue before submitting large changes.
232+
* Resolve a template
233+
* Launch VS Code with a devcontainer
234+
* Apply optional file sync rules
235+
236+
---
237+
238+
## Contributing
239+
240+
```bash
241+
git clone https://github.com/dacrystal/dev-code
242+
devcode open dev-code ./dev-code
243+
```
211244

212245
---
213246

0 commit comments

Comments
 (0)