Skip to content

Commit f3eef67

Browse files
committed
chore: add devcontainer support to ease developer workstation setup
Fixes #466
1 parent e3b456c commit f3eef67

File tree

4 files changed

+189
-0
lines changed

4 files changed

+189
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "SpecKitDevContainer",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
7+
"features": {
8+
"ghcr.io/devcontainers/features/common-utils:2": {
9+
"installZsh": true,
10+
"installOhMyZsh": true,
11+
"installOhMyZshConfig": true,
12+
"upgradePackages": true,
13+
"username": "devcontainer",
14+
"userUid": "automatic",
15+
"userGid": "automatic"
16+
},
17+
"ghcr.io/devcontainers/features/dotnet:2": {
18+
"version": "lts"
19+
},
20+
"ghcr.io/devcontainers/features/git:1": {
21+
"ppa": true,
22+
"version": "latest"
23+
}
24+
},
25+
26+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
27+
"forwardPorts": [
28+
8080 // for Spec-Kit documentation site
29+
],
30+
"containerUser": "devcontainer",
31+
"updateRemoteUserUID": true,
32+
"postCreateCommand": "chmod +x ./.devcontainer/post-create.sh && ./.devcontainer/post-create.sh",
33+
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
34+
"customizations": {
35+
"vscode": {
36+
"extensions": [
37+
"mhutchie.git-graph",
38+
"eamodio.gitlens",
39+
"anweber.reveal-button",
40+
"chrisdias.promptboost",
41+
// Github Copilot
42+
"GitHub.copilot",
43+
"GitHub.copilot-chat",
44+
// Codex
45+
"openai.chatgpt",
46+
// Kilo Code
47+
"kilocode.Kilo-Code",
48+
// Roo Code
49+
"RooVeterinaryInc.roo-cline"
50+
],
51+
"settings": {
52+
"debug.javascript.autoAttachFilter": "disabled" // fix running commands in integrated terminal
53+
}
54+
}
55+
}
56+
}

.devcontainer/post-create.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
# Function to run a command and show logs only on error
7+
run_command() {
8+
output=$(eval "$*" 2>&1)
9+
exit_code=$?
10+
if [ $exit_code -ne 0 ]; then
11+
echo "[ERROR] Command failed: $*"
12+
echo "$output"
13+
exit $exit_code
14+
fi
15+
}
16+
17+
# Note: We use Bun (instead of npm) as our package manager for its speed and overall efficiency
18+
# It is a drop-in replacement for Node.js, so we can install npm packages through it without issues
19+
echo "📦 Installing Bun Package Manager..."
20+
run_command "curl -fsSL https://bun.sh/install | bash"
21+
source ~/.bashrc
22+
23+
export BUN_INSTALL="$HOME/.bun"
24+
export PATH="$BUN_INSTALL/bin:$PATH"
25+
26+
# Installing CLI-based AI Agents
27+
28+
echo "🤖 Installing Copilot CLI..."
29+
run_command "bun add --global @github/copilot@latest"
30+
echo "✅ Done"
31+
32+
echo "🤖 Installing Claude CLI..."
33+
run_command "bun add --global @anthropic-ai/claude-code@latest"
34+
echo "✅ Done"
35+
36+
echo "🤖 Installing Codex CLI..."
37+
run_command "bun add --global @openai/codex@latest"
38+
echo "✅ Done"
39+
40+
echo "🤖 Installing Gemini CLI..."
41+
run_command "bun add --global @google/gemini-cli@latest"
42+
echo "✅ Done"
43+
44+
echo "🤖 Installing Augie CLI..."
45+
run_command "bun add --global @augmentcode/auggie@latest"
46+
echo "✅ Done"
47+
48+
echo "🤖 Installing Qwen Code CLI..."
49+
run_command "bun add --global @qwen-code/qwen-code@latest"
50+
echo "✅ Done"
51+
52+
echo "🤖 Installing OpenCode CLI..."
53+
run_command "bun add --global opencode-ai@latest"
54+
echo "✅ Done"
55+
56+
# Installing DocFx (for documentation site)
57+
echo "📚 Installing DocFx..."
58+
run_command "dotnet tool update -g docfx"
59+
echo "✅ Done"
60+
61+
# Installing UV (Python package manager)
62+
echo "🐍 Installing UV - Python Package Manager..."
63+
run_command "pip install uv"
64+
echo "✅ Done"
65+
66+
echo "🧹 Cleaning cache..."
67+
run_command "sudo apt-get autoclean"
68+
run_command "sudo apt-get clean"
69+
70+
71+
echo "✅ Setup completed. Happy coding! 🚀"

AGENTS.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,51 @@ elif selected_ai == "windsurf":
188188

189189
**Note**: Skip CLI checks for IDE-based agents (Copilot, Windsurf).
190190

191+
#### 7. Update Devcontainer files (Optional)
192+
193+
For agents that have VS Code extensions or require CLI installation, update the devcontainer configuration files:
194+
195+
##### VS Code Extension-based Agents
196+
197+
For agents available as VS Code extensions, add them to `.devcontainer/devcontainer.json`:
198+
199+
```json
200+
{
201+
"customizations": {
202+
"vscode": {
203+
"extensions": [
204+
"GitHub.copilot",
205+
"GitHub.copilot-chat",
206+
// [New Agent Name]
207+
"[Agent Extension ID]"
208+
]
209+
}
210+
}
211+
}
212+
```
213+
214+
##### CLI-based Agents
215+
216+
For agents that require CLI tools, add installation commands to `.devcontainer/post-create.sh`:
217+
218+
```bash
219+
#!/bin/bash
220+
221+
# Existing installations...
222+
223+
echo "🤖 Installing [New Agent Name] CLI..."
224+
# bun add --global [agent-cli-package]@latest # Example for node-based CLI
225+
# or other installation command...
226+
227+
```
228+
229+
**Quick Tips:**
230+
231+
- **Extension-based agents**: Add to the `extensions` array in `devcontainer.json`
232+
- **CLI-based agents**: Add installation scripts to `post-create.sh`
233+
- **Hybrid agents**: May require both extension and CLI installation
234+
- **Test thoroughly**: Ensure installations work in the devcontainer environment
235+
191236
## Agent Categories
192237

193238
### CLI-Based Agents

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@ These are one time installations required to be able to test your changes locall
1313
1. Install [Git](https://git-scm.com/downloads)
1414
1. Have an [AI coding agent available](README.md#-supported-ai-agents)
1515

16+
<details>
17+
<summary><b>💡 Hint if you are using <code>VSCode</code> or <code>Github Codespaces</code> as your IDE</b></summary>
18+
19+
<br>
20+
21+
Provided you have [Docker](https://docker.com) installed on your machine, you can leverage [Dev Containers](https://containers.dev) through this [VSCode extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), to easily set up your development environment, with aforementioned tools already installed and configured, thanks to the `.devcontainer/devcontainer.json` file (located at the root of the project).
22+
23+
To do so, simply:
24+
25+
- Checkout the repo
26+
- Open it with VSCode
27+
- Open the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and select "Dev Containers: Open Folder in Container..."
28+
29+
On [Github Codespaces](https://github.com/features/codespaces) it's even simpler, as it leverages the `.devcontainer/devcontainer.json` automatically upon opening the codespace.
30+
31+
</details>
32+
1633
## Submitting a pull request
1734

1835
>[!NOTE]

0 commit comments

Comments
 (0)