| name | add-dev-environment-setup |
| description | Use when bash/git/jq/gh CLI are missing or VS Code terminal is not WSL โ detects OS, diagnoses gaps, installs missing tools. |
Dev Environment Setup
Overview
Detect OS โ diagnose silently โ confirm โ install โ configure VS Code.
Never assume what's installed. Never install without confirmation. Never overwrite settings.json.
When to Use
- User asks about environment setup or "how do I run the scripts"
bash, git, jq, or gh not found
status.sh fails due to missing tool
- VS Code terminal opens PowerShell/Git Bash instead of WSL
When NOT to Use
- All tools already installed and verified
- User is on Linux with working environment
- Container or CI environment (ephemeral; tools provisioned by image/workflow)
โ ABSOLUTE PROHIBITIONS
โ NEVER use Bash tool for sudo/apt/dnf/pacman/brew/curl|bash/wsl --install/gh auth login (hangs on password or interactive prompt)
โ NEVER overwrite .vscode/settings.json, reinstall WSL when a real distro exists, suggest Git Bash, use `apt-get install gh`, or proceed after user says N
โ
ALWAYS show install commands in code blocks โ user runs manually โ verify with non-sudo `--version` checks
STEP 1: DETECT OS (MANDATORY FIRST)
uname -s
$env:OS
โ DO NOT proceed without TARGET_OS = windows | macos | linux.
STEP 2: DIAGNOSE (silent โ no prompts yet)
| Tool | Check | Windows note |
|---|
| WSL | wsl -l -v | docker-desktop only = NOT ready |
| bash | bash --version | Must be inside WSL, not Git Bash |
| git | git --version | Inside WSL |
| gh | gh --version | Inside WSL |
WSL check logic:
wsl -l -v shows a real distro (Ubuntu, Debian, etc.) โ WSL is ready, use existing distro
wsl -l -v shows only docker-desktop or nothing โ WSL NOT ready, install Debian
โ DO NOT reinstall WSL if a real distro already exists โ use whatever is installed.
STEP 3: REPORT
Show what is missing vs already installed:
โ
WSL2: Debian installed
โ git: not found inside WSL
โ
gh: installed
STEP 4: CONFIRM
SAY: "I'll show you the commands to install. You run them in the terminal and let me know when you're done."
โ IF user says N โ STOP.
Windows only โ admin check:
โ IF wsl --install is needed โ SAY first:
"To install WSL you need a terminal with Administrator privileges. Open PowerShell as Administrator and run the command I'll show you."
โ DO NOT USE Bash tool to run wsl --install.
STEP 5: INSTRUCT USER TO INSTALL
โ DO NOT USE Bash tool for ANY command in this step.
โ ALL commands below are SHOWN to the user in code blocks โ user copies and runs manually.
โ AFTER each sub-step, WAIT for user confirmation before proceeding to the next.
โ
AFTER user confirms execution โ proceed to STEP 6 (VERIFY) using non-sudo checks.
Windows
5.1 โ WSL2 + Debian (only if no real distro found in STEP 2)
โ IF user already has Ubuntu, Debian, or any real distro โ SKIP this step, use existing distro.
SAY: "Run in PowerShell as Administrator:"
wsl --install -d Debian
SAY: "Restart Windows. Open the Debian terminal to complete the setup and let me know."
5.2 โ Tools inside WSL
SAY: "Run in the WSL terminal:"
sudo apt update && sudo apt install -y git curl
5.3 โ gh CLI (official repo โ NOT apt-get install gh)
SAY: "Run these commands in the WSL terminal, one block at a time:"
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] \
https://cli.github.com/packages stable main" \
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install -y gh
5.4 โ gh auth login
SAY: "Run in the WSL terminal:"
gh auth login
SAY: "Select: GitHub.com โ HTTPS โ Login with a web browser. Paste the code in the browser."
5.5 โ VS Code settings.json (mandatory)
READ .vscode/settings.json. MERGE WSL profile. WRITE back.
โ DO NOT overwrite โ preserve all existing profiles (Git Bash, PowerShell, Cmder, etc.).
Use the distro name detected in STEP 2 (e.g., Debian, Ubuntu, Ubuntu-24.04):
{
"terminal.integrated.defaultProfile.windows": "WSL",
"terminal.integrated.profiles.windows": {
"WSL": {
"path": "C:\\WINDOWS\\System32\\wsl.exe",
"args": ["-d", "<DETECTED_DISTRO>"],
"icon": "terminal-linux"
}
}
}
Result: user opens VS Code normally (shortcut/taskbar/recent files) โ new terminal opens WSL automatically. No workflow change needed.
Unix (macOS + Linux)
โ DO NOT USE Bash tool. SHOW all commands to user.
Pick the package manager that matches the user's OS:
| OS | Install command |
|---|
| macOS (Homebrew) | brew install git gh (install Homebrew first if missing โ see below) |
| Debian/Ubuntu | sudo apt update && sudo apt install -y git curl then official gh repo (same flow as Windows 5.3) |
| Fedora/RHEL | sudo dnf install -y git gh |
| Arch | sudo pacman -S git github-cli |
SAY: "Run in the terminal:"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
bash --version
brew install bash
After install, in all cases:
gh auth login
STEP 6: VERIFY
โ
This step CAN use Bash tool โ verification commands are non-sudo, non-interactive.
git --version && gh --version && echo "โ
All tools ready"
โ IF any tool still missing โ diagnose installation error. DO NOT declare success.
Common Mistakes
| Mistake | Fix |
|---|
wsl --install without admin | Confirm admin first โ "Run as Administrator" |
sudo apt-get install gh | Use official gh CLI repo โ apt version is outdated |
wsl -l -v shows only docker-desktop or empty | Install Debian: wsl --install -d Debian |
| Ubuntu already installed | Use it โ do NOT reinstall with Debian |
| Overwriting settings.json | Always READ โ MERGE โ WRITE |
| Suggesting Git Bash as bash | Git Bash is NOT supported โ WSL only |
| Skipping settings.json | It's mandatory โ user won't change VS Code workflow |
| Proceeding after user says N | Stop immediately, show manual commands only |
| Declaring success before verifying | Run STEP 6 first |
| Running sudo/apt/brew via Bash tool | Agent hangs โ sudo requires password. SHOW commands, user runs manually |
Running gh auth login via Bash tool | Agent hangs โ interactive prompt. SHOW command, guide user step by step |
Running curl | bash via Bash tool | Agent hangs โ interactive installer. SHOW command, user runs manually |