Test-ProfileSetup.ps1
|
function Test-ProfileSetup { if (Test-Path $PROFILE) { return } $markerFile = Join-Path ([System.Environment]::GetFolderPath('UserProfile')) '.pwrclaude-no-profile-prompt' if (Test-Path $markerFile) { return } Write-Host "" Write-Host "Your PowerShell profile does not exist yet." -ForegroundColor Yellow Write-Host "" Write-Host "Adding the following lines to your profile will make the 'claude' command available" -ForegroundColor White Write-Host "in any PowerShell terminal, from any repo, without manual imports each time:" -ForegroundColor White Write-Host "" Write-Host " Import-Module PwrClaude # provides Invoke-Claude / claude" -ForegroundColor Cyan Write-Host " Import-Module PwrDev # provides build, dpb, and other dev tools" -ForegroundColor Cyan Write-Host "" Write-Host "Profile path: $PROFILE" -ForegroundColor Gray Write-Host "" $choice = Read-Host "Add imports to your profile now? [Y]es / [S]how me how / [N]o / [D]on't ask again" switch ($choice.Trim().ToUpper()[0]) { 'Y' { $profileDir = Split-Path $PROFILE -Parent if (-not (Test-Path $profileDir)) { New-Item -ItemType Directory -Path $profileDir -Force | Out-Null } Add-Content -Path $PROFILE -Value @" # PwrClaude + PwrDev — enable the claude command from any terminal and repo Import-Module PwrClaude Import-Module PwrDev "@ Write-Host "" Write-Host "Profile updated: $PROFILE" -ForegroundColor Green Write-Host "Run '. `$PROFILE' or restart your terminal to apply." -ForegroundColor Gray } 'S' { Write-Host "" Write-Host "Run these commands to set up your profile manually:" -ForegroundColor White Write-Host "" Write-Host " New-Item -ItemType Directory -Path (Split-Path `$PROFILE -Parent) -Force | Out-Null" -ForegroundColor Cyan Write-Host " Add-Content -Path `$PROFILE -Value @'" -ForegroundColor Cyan Write-Host "" Write-Host " # PwrClaude + PwrDev — enable the claude command from any terminal and repo" -ForegroundColor Cyan Write-Host " Import-Module PwrClaude" -ForegroundColor Cyan Write-Host " Import-Module PwrDev" -ForegroundColor Cyan Write-Host " '@" -ForegroundColor Cyan Write-Host "" Write-Host "Then run '. `$PROFILE' or restart your terminal to apply." -ForegroundColor Gray } 'D' { New-Item -ItemType File -Path $markerFile -Force | Out-Null Write-Host "Won't ask again. Delete '$markerFile' to re-enable this prompt." -ForegroundColor Gray } } Write-Host "" } |