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
This commit is contained in:
1 parent
39d1d8636e
commit
6d5ac4fb57
6 files changed
+182
-1
No files matched your search
@@ -0,0 +1,65 @@
|
||||
# Подготавливаем структуру 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"
|
||||
@@ -0,0 +1,50 @@
|
||||
# Создаёт симлинки skills на Windows
|
||||
# Требует: Developer Mode или права администратора
|
||||
|
||||
$skillsSource = "$env:USERPROFILE\.agents\skills"
|
||||
|
||||
# Проверяем, скопированы ли агенты
|
||||
if (-not (Test-Path $skillsSource)) {
|
||||
Write-Warning "Source directory not found: $skillsSource"
|
||||
Write-Warning "Make sure 'agents' package is applied first"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Проверяем возможность создавать симлинки
|
||||
try {
|
||||
$testLink = "$env:TEMP\test_symlink_$(Get-Random)"
|
||||
New-Item -ItemType SymbolicLink -Path $testLink -Target $skillsSource -ErrorAction Stop | Out-Null
|
||||
Remove-Item $testLink -Force
|
||||
Write-Host "OK: Symlink permissions check passed"
|
||||
} catch {
|
||||
Write-Error "Cannot create symlinks. Please enable Developer Mode or run as Administrator."
|
||||
Write-Error "See: https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Claude
|
||||
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude" | Out-Null
|
||||
if (Test-Path "$env:USERPROFILE\.claude\skills") {
|
||||
Remove-Item "$env:USERPROFILE\.claude\skills" -Force
|
||||
}
|
||||
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.claude\skills" -Target $skillsSource
|
||||
Write-Host "Created: ~/.claude/skills -> ~/.agents/skills"
|
||||
|
||||
# Codex
|
||||
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.codex\skills" | Out-Null
|
||||
if (Test-Path "$env:USERPROFILE\.codex\skills\conventional-commits") {
|
||||
Remove-Item "$env:USERPROFILE\.codex\skills\conventional-commits" -Force
|
||||
}
|
||||
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.codex\skills\conventional-commits" -Target "$skillsSource\conventional-commits"
|
||||
Write-Host "Created: ~/.codex/skills/conventional-commits -> ~/.agents/skills/conventional-commits"
|
||||
|
||||
# Opencode
|
||||
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode" | Out-Null
|
||||
if (Test-Path "$env:USERPROFILE\.config\opencode\skills") {
|
||||
Remove-Item "$env:USERPROFILE\.config\opencode\skills" -Force
|
||||
}
|
||||
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.config\opencode\skills" -Target $skillsSource
|
||||
Write-Host "Created: ~/.config/opencode/skills -> ~/.agents/skills"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Skills symlinks created successfully!"
|
||||
Reference in new issue
Block a user