From 0065a69fad90257b1c27504c66837d23f4e5e1a0 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Sun, 2 Nov 2025 03:00:22 -0500 Subject: [PATCH] fix(windows): ensure default profile settings file exists Changes: - install.ps1: Create ~/.claude/settings.json with empty env if it doesn't exist - ccs.ps1: Improve error messages for missing/invalid settings files with actionable solutions Fixes: - Error: Settings file not found: C:\Users\kaidu\.claude\settings.json Now provides helpful solutions: 1. Command to create missing file 2. Config update suggestion 3. Reinstall option --- ccs.ps1 | 18 +++++++++++++++++- install.ps1 | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ccs.ps1 b/ccs.ps1 index cdd5ef31..3e058ebd 100644 --- a/ccs.ps1 +++ b/ccs.ps1 @@ -79,7 +79,14 @@ $SettingsPath = $SettingsPath -replace '/', '\' if (-not (Test-Path $SettingsPath)) { Write-Host "Error: Settings file not found: $SettingsPath" -ForegroundColor Red Write-Host "" - Write-Host "Create the settings file or update the path in $ConfigFile" + Write-Host "Solutions:" -ForegroundColor Yellow + Write-Host " 1. Create the settings file with empty env:" + Write-Host " New-Item -ItemType File -Force -Path '$SettingsPath'" + Write-Host " Set-Content -Path '$SettingsPath' -Value '{`"env`":{}}`'" + Write-Host "" + Write-Host " 2. Or update profile path in $ConfigFile" + Write-Host "" + Write-Host " 3. Or reinstall: irm ccs.kaitran.ca/install.ps1 | iex" exit 1 } @@ -89,6 +96,15 @@ try { $Settings = $SettingsContent | ConvertFrom-Json -ErrorAction Stop } catch { Write-Host "Error: Invalid JSON in $SettingsPath" -ForegroundColor Red + Write-Host "" + Write-Host "Details: $_" -ForegroundColor Yellow + Write-Host "" + Write-Host "Solutions:" -ForegroundColor Yellow + Write-Host " 1. Validate JSON at https://jsonlint.com" + Write-Host " 2. Or reset to template:" + Write-Host " Set-Content -Path '$SettingsPath' -Value '{`"env`":{}}`'" + Write-Host "" + Write-Host " 3. Or reinstall: irm ccs.kaitran.ca/install.ps1 | iex" exit 1 } diff --git a/install.ps1 b/install.ps1 index 7e7b21bd..e32b4bb1 100644 --- a/install.ps1 +++ b/install.ps1 @@ -232,6 +232,16 @@ if (-not (Test-Path $SonnetSettings)) { Write-Host "| [OK] Sonnet profile exists: $SonnetSettings" } +# Ensure default profile settings file exists +$DefaultSettings = "$ClaudeDir\settings.json" +if (-not (Test-Path $DefaultSettings)) { + New-Item -ItemType Directory -Force -Path $ClaudeDir | Out-Null + @{ env = @{} } | ConvertTo-Json -Depth 10 | Set-Content $DefaultSettings + Write-Host "| [OK] Created default settings: $DefaultSettings" +} else { + Write-Host "| [OK] Default profile exists: $DefaultSettings" +} + Write-Host "└─" Write-Host ""