# Setup script for GitHub Copilot SDK Development Environment (Windows) # Run this script in PowerShell with administrator privileges $ErrorActionPreference = "Stop" # Colors for output function Write-Header { param([string]$Message) Write-Host "`n======================================" -ForegroundColor Blue Write-Host $Message -ForegroundColor Blue Write-Host "======================================`n" -ForegroundColor Blue } function Write-Success { param([string]$Message) Write-Host "✓ $Message" -ForegroundColor Green } function Write-Warning { param([string]$Message) Write-Host "⚠ $Message" -ForegroundColor Yellow } function Write-Error { param([string]$Message) Write-Host "✗ $Message" -ForegroundColor Red } function Test-Command { param([string]$Command) try { Get-Command $Command -ErrorAction Stop | Out-Null return $true } catch { return $false } } # Main setup Write-Header "GitHub Copilot SDK - Development Environment Setup" Write-Host "Detected OS: Windows" # Check for winget Write-Header "Checking Prerequisites" if (-not (Test-Command "winget")) { Write-Error "winget not found. Please ensure you're running Windows 10 1809+ or Windows 11" Write-Host "Manual installation required from: https://github.com/microsoft/winget-cli" exit 1 } # Check for GitHub CLI if (Test-Command "gh") { Write-Success "GitHub CLI (gh) is installed" gh --version } else { Write-Warning "GitHub CLI (gh) not found" Write-Host "Installing GitHub CLI..." winget install --id GitHub.cli Write-Success "GitHub CLI installed" } # Check for Copilot CLI Write-Header "Checking Copilot CLI" if (Test-Command "copilot") { Write-Success "Copilot CLI is installed" try { copilot --version } catch {} } else { Write-Warning "Copilot CLI not found" Write-Host "Installing Copilot CLI extension..." try { gh extension install github/gh-copilot } catch { gh extension upgrade github/gh-copilot } Write-Success "Copilot CLI extension installed" } # Check authentication Write-Header "Checking GitHub Authentication" try { gh auth status 2>&1 | Out-Null Write-Success "GitHub CLI is authenticated" } catch { Write-Warning "GitHub CLI is not authenticated" Write-Host "Please authenticate now..." gh auth login } # Ask user which SDKs to set up Write-Header "SDK Selection" Write-Host "Which SDKs would you like to set up? (You can select multiple)" Write-Host "" $setup_nodejs = Read-Host "Set up Node.js/TypeScript SDK? (y/n)" $setup_python = Read-Host "Set up Python SDK? (y/n)" $setup_go = Read-Host "Set up Go SDK? (y/n)" $setup_dotnet = Read-Host "Set up .NET SDK? (y/n)" # Node.js Setup if ($setup_nodejs -match "^[Yy]$") { Write-Header "Setting up Node.js/TypeScript SDK" if (Test-Command "node") { $nodeVersion = node -v Write-Success "Node.js is installed: $nodeVersion" } else { Write-Warning "Node.js not found. Installing..." winget install --id OpenJS.NodeJS Write-Success "Node.js installed. You may need to restart your terminal." } if (Test-Command "npm") { $npmVersion = npm -v Write-Success "npm is installed: $npmVersion" } else { Write-Error "npm not found (should come with Node.js)" } } # Python Setup if ($setup_python -match "^[Yy]$") { Write-Header "Setting up Python SDK" if (Test-Command "python") { $pythonVersion = python --version Write-Success "Python is installed: $pythonVersion" } else { Write-Warning "Python not found. Installing..." winget install --id Python.Python.3.12 Write-Success "Python installed. You may need to restart your terminal." } if (Test-Command "pip") { $pipVersion = pip --version Write-Success "pip is installed: $pipVersion" } else { Write-Error "pip not found (should come with Python)" } } # Go Setup if ($setup_go -match "^[Yy]$") { Write-Header "Setting up Go SDK" if (Test-Command "go") { $goVersion = go version Write-Success "Go is installed: $goVersion" } else { Write-Warning "Go not found. Installing..." winget install --id GoLang.Go Write-Success "Go installed. You may need to restart your terminal." } } # .NET Setup if ($setup_dotnet -match "^[Yy]$") { Write-Header "Setting up .NET SDK" if (Test-Command "dotnet") { $dotnetVersion = dotnet --version Write-Success ".NET is installed: $dotnetVersion" } else { Write-Warning ".NET not found. Installing..." winget install --id Microsoft.DotNet.SDK.8 Write-Success ".NET installed. You may need to restart your terminal." } } # Additional tools Write-Header "Checking Additional Development Tools" if (Test-Command "git") { $gitVersion = git --version Write-Success "Git is installed: $gitVersion" } else { Write-Warning "Git not found. Installing..." winget install --id Git.Git } if (Test-Command "code") { Write-Success "VS Code is installed" } else { Write-Warning "VS Code not found. Recommended for development." $installVscode = Read-Host "Install VS Code? (y/n)" if ($installVscode -match "^[Yy]$") { winget install --id Microsoft.VisualStudioCode } } # Summary Write-Header "Setup Summary" Write-Host "Your development environment has been checked and configured!" Write-Host "" Write-Host "Next steps:" Write-Host "1. Restart your terminal to ensure all PATH changes take effect" Write-Host "2. Create a new project directory" Write-Host "3. Install the SDK for your chosen language" Write-Host "4. Follow the Getting Started guide: docs\getting-started.md" Write-Host "" Write-Host "Quick start examples:" if ($setup_nodejs -match "^[Yy]$") { Write-Host "" Write-Host "Node.js/TypeScript:" Write-Host " mkdir my-app; cd my-app" Write-Host " npm init -y" Write-Host " npm install @github/copilot-sdk tsx" } if ($setup_python -match "^[Yy]$") { Write-Host "" Write-Host "Python:" Write-Host " mkdir my-app; cd my-app" Write-Host " python -m venv venv" Write-Host " .\venv\Scripts\Activate.ps1" Write-Host " pip install github-copilot-sdk" } if ($setup_go -match "^[Yy]$") { Write-Host "" Write-Host "Go:" Write-Host " mkdir my-app; cd my-app" Write-Host " go mod init my-app" Write-Host " go get github.com/github/copilot-sdk/go" } if ($setup_dotnet -match "^[Yy]$") { Write-Host "" Write-Host ".NET:" Write-Host " dotnet new console -n MyApp" Write-Host " cd MyApp" Write-Host " dotnet add package GitHub.Copilot.SDK" } Write-Host "" Write-Success "Setup complete! Happy coding! 🚀" Write-Host "" Write-Host "Note: You may need to restart your terminal for PATH changes to take effect."