Files
dotfiles/.chezmoiscripts/run_before_prepare.ps1
T
ddadmin 6d5ac4fb57 Add Windows support via chezmoi
- Add .chezmoiroot to preserve stow structure
- Add .chezmoiignore to exclude Linux-only packages on Windows
- Add PowerShell scripts for path conversion and skills symlinks
- Update README with Windows installation instructions
- Tested: vim, agents, codex, claude, opencode configs work on Windows
2026-02-28 00:20:30 +03:00

66 lines
3.1 KiB
PowerShell

# Подготавливаем структуру 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"
}
# codex → dot_codex (будет ~/.codex)
if ((Test-Path "codex") -and -not (Test-Path "dot_codex")) {
Rename-Item "codex" "dot_codex"
# Перемещаем содержимое .codex в корень и удаляем файлы skills
if (Test-Path "dot_codex/.codex") {
Move-Item "dot_codex/.codex/*" "dot_codex/" -ErrorAction SilentlyContinue
Remove-Item "dot_codex/.codex" -Recurse -Force -ErrorAction SilentlyContinue
}
# Удаляем старые файлы skills (будут созданы как симлинки)
Remove-Item "dot_codex/skills" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " [OK] codex -> dot_codex"
}
# 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"