# Подготавливаем структуру source state для правильного mapping # Это позволяет сохранить структуру stow без изменений $sourceDir = "$env:USERPROFILE\.local\share\chezmoi" Set-Location $sourceDir Write-Host "Preparing source state for stow-compatible mapping..." # agents → dot_agents (будет ~/.agents) if ((Test-Path "agents") -and -not (Test-Path "dot_agents")) { Rename-Item "agents" "dot_agents" # Перемещаем содержимое .agents в корень if (Test-Path "dot_agents/.agents") { Move-Item "dot_agents/.agents/*" "dot_agents/" -ErrorAction SilentlyContinue Remove-Item "dot_agents/.agents" -Recurse -Force -ErrorAction SilentlyContinue } Write-Host " [OK] agents -> dot_agents" } # claude → dot_claude (будет ~/.claude) if ((Test-Path "claude") -and -not (Test-Path "dot_claude")) { Rename-Item "claude" "dot_claude" # Перемещаем содержимое .claude в корень и удаляем файлы skills if (Test-Path "dot_claude/.claude") { Move-Item "dot_claude/.claude/*" "dot_claude/" -ErrorAction SilentlyContinue Remove-Item "dot_claude/.claude" -Recurse -Force -ErrorAction SilentlyContinue } # Удаляем старые файлы skills (будут созданы как симлинки) Remove-Item "dot_claude/skills" -Recurse -Force -ErrorAction SilentlyContinue Write-Host " [OK] claude -> dot_claude" } # vim/.vimrc → dot_vimrc (будет ~/.vimrc) if ((Test-Path "vim/.vimrc") -and -not (Test-Path "dot_vimrc")) { Move-Item "vim/.vimrc" "dot_vimrc" Remove-Item "vim" -Recurse -Force -ErrorAction SilentlyContinue Write-Host " [OK] vim/.vimrc -> dot_vimrc" } # opencode → dot_config/opencode (будет ~/.config/opencode) if ((Test-Path "opencode/.config/opencode") -and -not (Test-Path "dot_config/opencode")) { New-Item -ItemType Directory -Force -Path "dot_config" | Out-Null Move-Item "opencode/.config/opencode" "dot_config/" Remove-Item "opencode" -Recurse -Force -ErrorAction SilentlyContinue # Удаляем старые файлы skills (будут созданы как симлинки) Remove-Item "dot_config/opencode/skills" -Recurse -Force -ErrorAction SilentlyContinue Write-Host " [OK] opencode -> dot_config/opencode" } Write-Host "Done! Source state prepared." Write-Host "" Write-Host "Now run: chezmoi apply"