Files
OpenQode/fix-profile.ps1
2025-12-14 00:40:14 +04:00

39 lines
1.4 KiB
PowerShell
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Fix PowerShell Profile - Remove broken opencode functions
$profilePath = $PROFILE
Write-Host "🔧 Fixing PowerShell profile..." -ForegroundColor Cyan
if (Test-Path $profilePath) {
# Backup current profile
$backupPath = "$profilePath.backup.$(Get-Date -Format 'yyyyMMdd-HHmmss')"
Copy-Item $profilePath $backupPath
Write-Host "✅ Backed up profile to: $backupPath" -ForegroundColor Green
# Remove broken opencode functions
$content = Get-Content $profilePath -Raw
$cleanContent = $content -replace '(?s)function opencode\s*\{.*?\}', ''
$cleanContent = $cleanContent -replace '(?s)function opencode\s*\{.*?$', ''
# Add clean OpenQode function
$openQodeFunction = @"
# OpenQode v1.01 Preview Edition
function OpenQode {
param([string]$Model = "")
& "E:\TRAE Playground\Test Ideas\OpenQode-v1.01-Preview\OpenQode.ps1" -Model $Model
}
function OpenQode-Menu {
param([string]$Model = "")
& "E:\TRAE Playground\Test Ideas\OpenQode-v1.01-Preview\OpenQode-Menu.ps1" -Model $Model
}
"@
Set-Content $profilePath $cleanContent
Add-Content $profilePath $openQodeFunction
Write-Host "✅ Fixed PowerShell profile" -ForegroundColor Green
Write-Host "🔄 Restart PowerShell to apply changes" -ForegroundColor Yellow
} else {
Write-Host " No PowerShell profile found" -ForegroundColor Yellow
}