Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,45 @@ try {
exit 1
}

# Find usable WSL distros (skip docker-desktop* distros which are minimal)
$WslDistro = $null
$distroLines = (wsl -l -q 2>&1) -replace "`0", "" | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
$usableDistros = @($distroLines | Where-Object { $_ -notmatch '^docker-desktop' })

if ($usableDistros.Count -eq 0) {
Write-Host ""
Write-Host "Error: No usable WSL distro found (docker-desktop is not supported)." -ForegroundColor Red
Write-Host ""
Write-Host "Install a Linux distro with: wsl --install Ubuntu" -ForegroundColor Yellow
exit 1
} elseif ($usableDistros.Count -eq 1) {
$WslDistro = $usableDistros[0]
} else {
Write-Host ""
Write-Host "Available WSL distros:" -ForegroundColor Cyan
for ($i = 0; $i -lt $usableDistros.Count; $i++) {
Write-Host " [$($i + 1)] $($usableDistros[$i])"
}
Write-Host ""
$choice = Read-Host "Select a distro (1-$($usableDistros.Count))"
$idx = [int]$choice - 1
if ($idx -lt 0 -or $idx -ge $usableDistros.Count) {
Write-Host "Invalid selection." -ForegroundColor Red
exit 1
}
$WslDistro = $usableDistros[$idx]
}

Write-Ok "Using WSL distro: $WslDistro"

# ---------------------------------------------------------------------------
# 2. Install binary inside WSL (reuse install.sh)
# 2. Install binary inside WSL
# ---------------------------------------------------------------------------

Write-Step "Installing devcontainer-mcp binary inside WSL..."

$installUrl = "https://raw.githubusercontent.com/$Repo/main/install.sh"
$wslResult = wsl bash -c "curl -fsSL '$installUrl' | bash -s -- --skip-mcp-config" 2>&1
$wslResult = wsl -d $WslDistro bash -c "curl -fsSL '$installUrl' | bash -s -- --skip-mcp-config" 2>&1
$wslResult | ForEach-Object { Write-Host " $_" }

if ($LASTEXITCODE -ne 0) {
Expand All @@ -62,7 +93,7 @@ if ($LASTEXITCODE -ne 0) {
}

# Verify the binary works
$versionCheck = wsl bash -lc "$WslBinaryPath --version" 2>&1
$versionCheck = wsl -d $WslDistro bash -lc "$WslBinaryPath --version" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Ok "Installed: $($versionCheck.Trim())"
} else {
Expand Down Expand Up @@ -101,12 +132,12 @@ Write-Host "Backend CLIs detected in WSL (install as needed — MCP server gives

$backends = @(
@{ Name = "devpod"; Url = "https://devpod.sh/docs/getting-started/install" }
@{ Name = "devcontainer"; Url = "npm install -g @devcontainers/cli" }
@{ Name = "devcontainer"; Url = "https://github.com/devcontainers/cli#install-script" }
@{ Name = "gh"; Url = "https://cli.github.com/" }
)

foreach ($b in $backends) {
$check = wsl bash -lc "command -v $($b.Name)" 2>&1
$check = wsl -d $WslDistro bash -lc "command -v $($b.Name)" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Ok "$($b.Name)"
} else {
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ done
echo ""
echo "Backend CLIs detected (install as needed — MCP server gives helpful errors if missing):"
command -v devpod >/dev/null 2>&1 && echo " ✓ devpod" || echo " ✗ devpod — https://devpod.sh/docs/getting-started/install"
command -v devcontainer >/dev/null 2>&1 && echo " ✓ devcontainer" || echo " ✗ devcontainer — npm install -g @devcontainers/cli"
command -v devcontainer >/dev/null 2>&1 && echo " ✓ devcontainer" || echo " ✗ devcontainer — https://github.com/devcontainers/cli#install-script"
command -v gh >/dev/null 2>&1 && echo " ✓ gh (codespaces)" || echo " ✗ gh (codespaces) — https://cli.github.com/"

# ---------------------------------------------------------------------------
Expand Down