mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 22:15:33 +00:00
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
This commit is contained in:
1 parent
ff357f188f
commit
0065a69fad
2 files changed
+27
-1
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -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 ""
|
||||
|
||||
|
||||
Reference in new issue
Block a user