fix(ps1): strip all non-ASCII Unicode from PowerShell scripts
Windows PowerShell 5.1 reads .ps1 files without BOM as Windows-1251 by default. Em-dashes (-) and other Unicode chars in string literals get mangled into invalid bytes (e.g. "session - no" becomes garbage that breaks the parser with "Unexpected token" errors. Replaced em-dash, en-dash, smart quotes, ellipsis, NBSP and arrows with their ASCII equivalents across all 12 .ps1 scripts (install/update/ uninstall for claude/gemini/codex/qwen). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Claude Code — Windows Installer
|
||||
# Claude Code - Windows Installer
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_install.ps1
|
||||
#
|
||||
# Installs Node.js (if needed), Claude Code via npm registry, configures env vars and settings.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Claude Code — Windows Uninstaller
|
||||
# Claude Code - Windows Uninstaller
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Claude Code — Windows Updater
|
||||
# Claude Code - Windows Updater
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_update.ps1
|
||||
#
|
||||
# Updates Claude Code via npm registry + re-applies config patches.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Codex CLI — Windows Installer
|
||||
# Codex CLI - Windows Installer
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_install.ps1
|
||||
#
|
||||
# Downloads Codex CLI binary from GitHub, applies config patches.
|
||||
@@ -25,7 +25,7 @@ function Refresh-Path {
|
||||
|
||||
# ---- Check prerequisites ----
|
||||
|
||||
# Python 3.11+ (for tomllib) — optional, fallback to PowerShell patching
|
||||
# Python 3.11+ (for tomllib) - optional, fallback to PowerShell patching
|
||||
$pyCmd = $null
|
||||
foreach ($candidate in @("python3", "python")) {
|
||||
if (Test-Command $candidate) {
|
||||
@@ -183,7 +183,7 @@ if (Test-Path $staleCatalog) {
|
||||
# ---- Apply patches ----
|
||||
|
||||
if ($pyCmd) {
|
||||
# Python available — use full patcher
|
||||
# Python available - use full patcher
|
||||
Write-Host " Downloading patcher..." -ForegroundColor Cyan
|
||||
$patchDir = Join-Path $env:TEMP "codex-patcher-$(Get-Random)"
|
||||
New-Item -ItemType Directory -Force -Path $patchDir | Out-Null
|
||||
@@ -221,7 +221,7 @@ if ($pyCmd) {
|
||||
}
|
||||
|
||||
if (-not $pyCmd) {
|
||||
# PowerShell fallback — generate config.toml directly
|
||||
# PowerShell fallback - generate config.toml directly
|
||||
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
|
||||
|
||||
# Codex reads config from ~/.codex/ (NOT %APPDATA%\codex\)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Codex CLI — Windows Uninstaller
|
||||
# Codex CLI - Windows Uninstaller
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_uninstall.ps1
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
@@ -31,7 +31,7 @@ if (Test-Path "$installDir\codex.exe") {
|
||||
# Check other common locations
|
||||
$altPath = (Get-Command codex -ErrorAction SilentlyContinue).Source
|
||||
if ($altPath) {
|
||||
Write-Host " Found at: $altPath — remove manually" -ForegroundColor Yellow
|
||||
Write-Host " Found at: $altPath - remove manually" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Codex CLI — Windows Updater
|
||||
# Codex CLI - Windows Updater
|
||||
# Downloads latest binary from GitHub + re-applies config patches.
|
||||
#
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_update.ps1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI — Windows Installer
|
||||
# Gemini CLI - Windows Installer
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_install.ps1
|
||||
#
|
||||
# Installs Node.js (if needed), Gemini CLI via npm registry, configures env vars and settings.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI — Windows Uninstaller
|
||||
# Gemini CLI - Windows Uninstaller
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_uninstall.ps1
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI — Windows Updater
|
||||
# Gemini CLI - Windows Updater
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_update.ps1
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
@@ -100,7 +100,7 @@ if ($pyCmd) {
|
||||
}
|
||||
|
||||
if (-not $pyCmd) {
|
||||
# PowerShell fallback — generate settings directly
|
||||
# PowerShell fallback - generate settings directly
|
||||
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
|
||||
|
||||
# Settings
|
||||
@@ -137,7 +137,7 @@ if (-not $pyCmd) {
|
||||
}
|
||||
|
||||
# ---- ALWAYS set env vars in BOTH User scope (persistent) and current session ----
|
||||
# Critical: gemini reads process.env.GEMINI_API_KEY — without setting $env:* here,
|
||||
# Critical: gemini reads process.env.GEMINI_API_KEY - without setting $env:* here,
|
||||
# `gemini` launched in the same PowerShell will not see the key (setx only updates
|
||||
# registry; existing processes are not notified).
|
||||
Write-Host " Ensuring env vars are set in current session..." -ForegroundColor Cyan
|
||||
@@ -151,5 +151,5 @@ Write-Host ""
|
||||
Write-Host " Update complete!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host " Now you can run: gemini -p `"Hello`"" -ForegroundColor Cyan
|
||||
Write-Host " (env vars active in this PowerShell session — no restart needed)" -ForegroundColor DarkGray
|
||||
Write-Host " (env vars active in this PowerShell session - no restart needed)" -ForegroundColor DarkGray
|
||||
Write-Host ""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Qwen Code — Windows Installer
|
||||
# Qwen Code - Windows Installer
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_install.ps1
|
||||
#
|
||||
# Installs Node.js (if needed), Qwen Code via npm registry, configures env vars and settings.
|
||||
@@ -32,7 +32,7 @@ function Get-NodeMajor {
|
||||
|
||||
# ---- Check prerequisites ----
|
||||
|
||||
# Python3 (optional — fallback to PowerShell patching)
|
||||
# Python3 (optional - fallback to PowerShell patching)
|
||||
$pyCmd = $null
|
||||
foreach ($candidate in @("python3", "python")) {
|
||||
if (Test-Command $candidate) {
|
||||
@@ -196,7 +196,7 @@ if ($pyCmd) {
|
||||
}
|
||||
|
||||
if (-not $pyCmd) {
|
||||
# PowerShell fallback — generate settings directly
|
||||
# PowerShell fallback - generate settings directly
|
||||
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
|
||||
|
||||
# Find qwen settings directory
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Qwen Code — Windows Uninstaller
|
||||
# Qwen Code - Windows Uninstaller
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_uninstall.ps1
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Qwen Code — Windows Updater
|
||||
# Qwen Code - Windows Updater
|
||||
# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_update.ps1
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
@@ -104,7 +104,7 @@ if ($pyCmd) {
|
||||
}
|
||||
|
||||
if (-not $pyCmd) {
|
||||
# PowerShell fallback — generate settings directly
|
||||
# PowerShell fallback - generate settings directly
|
||||
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
|
||||
|
||||
# Environment variables
|
||||
|
||||
Reference in New Issue
Block a user