Skip to content

Commit ea90d02

Browse files
authored
Merge pull request #487 from tinesoft/main
chore: add `devcontainer` support to ease developer workstation setup
2 parents 3e85f46 + 71c2c63 commit ea90d02

File tree

4 files changed

+240
-0
lines changed

4 files changed

+240
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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:3.13-trixie", // based on Debian "Trixie" (13)
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+
"ghcr.io/devcontainers/features/node": {
25+
"version": "lts"
26+
}
27+
},
28+
29+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
30+
"forwardPorts": [
31+
8080 // for Spec-Kit documentation site
32+
],
33+
"containerUser": "devcontainer",
34+
"updateRemoteUserUID": true,
35+
"postCreateCommand": "chmod +x ./.devcontainer/post-create.sh && ./.devcontainer/post-create.sh",
36+
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
37+
"customizations": {
38+
"vscode": {
39+
"extensions": [
40+
"mhutchie.git-graph",
41+
"eamodio.gitlens",
42+
"anweber.reveal-button",
43+
"chrisdias.promptboost",
44+
// Github Copilot
45+
"GitHub.copilot",
46+
"GitHub.copilot-chat",
47+
// Codex
48+
"openai.chatgpt",
49+
// Kilo Code
50+
"kilocode.Kilo-Code",
51+
// Roo Code
52+
"RooVeterinaryInc.roo-cline",
53+
// Amazon Developer Q
54+
"AmazonWebServices.amazon-q-vscode",
55+
// Claude Code
56+
"anthropic.claude-code"
57+
],
58+
"settings": {
59+
"debug.javascript.autoAttachFilter": "disabled", // fix running commands in integrated terminal
60+
61+
// Specify settings for Github Copilot
62+
"git.autofetch": true,
63+
"chat.promptFilesRecommendations": {
64+
"speckit.constitution": true,
65+
"speckit.specify": true,
66+
"speckit.plan": true,
67+
"speckit.tasks": true,
68+
"speckit.implement": true
69+
},
70+
"chat.tools.terminal.autoApprove": {
71+
".specify/scripts/bash/": true,
72+
".specify/scripts/powershell/": true
73+
}
74+
}
75+
}
76+
}
77+
}

.devcontainer/post-create.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/bash
2+
3+
# Exit immediately on error, treat unset variables as an error, and fail if any command in a pipeline fails.
4+
set -euo pipefail
5+
6+
# Function to run a command and show logs only on error
7+
run_command() {
8+
local command_to_run="$*"
9+
local output
10+
local exit_code
11+
12+
# Capture all output (stdout and stderr)
13+
output=$(eval "$command_to_run" 2>&1) || exit_code=$?
14+
exit_code=${exit_code:-0}
15+
16+
if [ $exit_code -ne 0 ]; then
17+
echo -e "\033[0;31m[ERROR] Command failed (Exit Code $exit_code): $command_to_run\033[0m" >&2
18+
echo -e "\033[0;31m$output\033[0m" >&2
19+
20+
exit $exit_code
21+
fi
22+
}
23+
24+
# Installing CLI-based AI Agents
25+
26+
echo -e "\n🤖 Installing Copilot CLI..."
27+
run_command "npm install -g @github/copilot@latest"
28+
echo "✅ Done"
29+
30+
echo -e "\n🤖 Installing Claude CLI..."
31+
run_command "npm install -g @anthropic-ai/claude-code@latest"
32+
echo "✅ Done"
33+
34+
echo -e "\n🤖 Installing Codex CLI..."
35+
run_command "npm install -g @openai/codex@latest"
36+
echo "✅ Done"
37+
38+
echo -e "\n🤖 Installing Gemini CLI..."
39+
run_command "npm install -g @google/gemini-cli@latest"
40+
echo "✅ Done"
41+
42+
echo -e "\n🤖 Installing Augie CLI..."
43+
run_command "npm install -g @augmentcode/auggie@latest"
44+
echo "✅ Done"
45+
46+
echo -e "\n🤖 Installing Qwen Code CLI..."
47+
run_command "npm install -g @qwen-code/qwen-code@latest"
48+
echo "✅ Done"
49+
50+
echo -e "\n🤖 Installing OpenCode CLI..."
51+
run_command "npm install -g opencode-ai@latest"
52+
echo "✅ Done"
53+
54+
echo -e "\n🤖 Installing Amazon Q CLI..."
55+
# 👉🏾 https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-verify-download.html
56+
57+
run_command "curl --proto '=https' --tlsv1.2 -sSf 'https://desktop-release.q.us-east-1.amazonaws.com/latest/q-x86_64-linux.zip' -o 'q.zip'"
58+
run_command "curl --proto '=https' --tlsv1.2 -sSf 'https://desktop-release.q.us-east-1.amazonaws.com/latest/q-x86_64-linux.zip.sig' -o 'q.zip.sig'"
59+
cat > amazonq-public-key.asc << 'EOF'
60+
-----BEGIN PGP PUBLIC KEY BLOCK-----
61+
62+
mDMEZig60RYJKwYBBAHaRw8BAQdAy/+G05U5/EOA72WlcD4WkYn5SInri8pc4Z6D
63+
BKNNGOm0JEFtYXpvbiBRIENMSSBUZWFtIDxxLWNsaUBhbWF6b24uY29tPoiZBBMW
64+
CgBBFiEEmvYEF+gnQskUPgPsUNx6jcJMVmcFAmYoOtECGwMFCQPCZwAFCwkIBwIC
65+
IgIGFQoJCAsCBBYCAwECHgcCF4AACgkQUNx6jcJMVmef5QD/QWWEGG/cOnbDnp68
66+
SJXuFkwiNwlH2rPw9ZRIQMnfAS0A/0V6ZsGB4kOylBfc7CNfzRFGtovdBBgHqA6P
67+
zQ/PNscGuDgEZig60RIKKwYBBAGXVQEFAQEHQC4qleONMBCq3+wJwbZSr0vbuRba
68+
D1xr4wUPn4Avn4AnAwEIB4h+BBgWCgAmFiEEmvYEF+gnQskUPgPsUNx6jcJMVmcF
69+
AmYoOtECGwwFCQPCZwAACgkQUNx6jcJMVmchMgEA6l3RveCM0YHAGQaSFMkguoAo
70+
vK6FgOkDawgP0NPIP2oA/jIAO4gsAntuQgMOsPunEdDeji2t+AhV02+DQIsXZpoB
71+
=f8yY
72+
-----END PGP PUBLIC KEY BLOCK-----
73+
EOF
74+
run_command "gpg --batch --import amazonq-public-key.asc"
75+
run_command "gpg --verify q.zip.sig q.zip"
76+
run_command "unzip -q q.zip"
77+
run_command "chmod +x ./q/install.sh"
78+
run_command "./q/install.sh --no-confirm"
79+
run_command "rm -rf ./q q.zip q.zip.sig amazonq-public-key.asc"
80+
echo "✅ Done"
81+
82+
echo -e "\n🤖 Installing CodeBuddy CLI..."
83+
run_command "npm install -g @tencent-ai/codebuddy-code@latest"
84+
echo "✅ Done"
85+
86+
# Installing UV (Python package manager)
87+
echo -e "\n🐍 Installing UV - Python Package Manager..."
88+
run_command "pipx install uv"
89+
echo "✅ Done"
90+
91+
# Installing DocFx (for documentation site)
92+
echo -e "\n📚 Installing DocFx..."
93+
run_command "dotnet tool update -g docfx"
94+
echo "✅ Done"
95+
96+
echo -e "\n🧹 Cleaning cache..."
97+
run_command "sudo apt-get autoclean"
98+
run_command "sudo apt-get clean"
99+
100+
echo "✅ Setup completed. Happy coding! 🚀"

AGENTS.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,51 @@ AGENT_CONFIG = {
239239
- Reduces the chance of bugs when adding new agents
240240
- Tool checking "just works" without additional mappings
241241

242+
#### 7. Update Devcontainer files (Optional)
243+
244+
For agents that have VS Code extensions or require CLI installation, update the devcontainer configuration files:
245+
246+
##### VS Code Extension-based Agents
247+
248+
For agents available as VS Code extensions, add them to `.devcontainer/devcontainer.json`:
249+
250+
```json
251+
{
252+
"customizations": {
253+
"vscode": {
254+
"extensions": [
255+
// ... existing extensions ...
256+
// [New Agent Name]
257+
"[New Agent Extension ID]"
258+
]
259+
}
260+
}
261+
}
262+
```
263+
264+
##### CLI-based Agents
265+
266+
For agents that require CLI tools, add installation commands to `.devcontainer/post-create.sh`:
267+
268+
```bash
269+
#!/bin/bash
270+
271+
# Existing installations...
272+
273+
echo -e "\n🤖 Installing [New Agent Name] CLI..."
274+
# run_command "npm install -g [agent-cli-package]@latest" # Example for node-based CLI
275+
# or other installation instructions (must be non-interactive and compatible with Linux Debian "Trixie" or later)...
276+
echo "✅ Done"
277+
278+
```
279+
280+
**Quick Tips:**
281+
282+
- **Extension-based agents**: Add to the `extensions` array in `devcontainer.json`
283+
- **CLI-based agents**: Add installation scripts to `post-create.sh`
284+
- **Hybrid agents**: May require both extension and CLI installation
285+
- **Test thoroughly**: Ensure installations work in the devcontainer environment
286+
242287
## Agent Categories
243288

244289
### CLI-Based Agents
@@ -249,6 +294,7 @@ Require a command-line tool to be installed:
249294
- **Cursor**: `cursor-agent` CLI
250295
- **Qwen Code**: `qwen` CLI
251296
- **opencode**: `opencode` CLI
297+
- **Amazon Q Developer CLI**: `q` CLI
252298
- **CodeBuddy CLI**: `codebuddy` CLI
253299

254300
### IDE-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)