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:
ddadmin committed 2026-02-28 00:20:30 +03:00
1 parent 39d1d8636e
commit 6d5ac4fb57
6 files changed
+182 -1

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
# Windows: игнорируем Linux-only пакеты
{{ if eq .chezmoi.os "windows" }}
bash/**
tmux/**
zed/**
{{ end }}
# Игнорируем .env файлы везде
**/.env*
.env.example
# Служебные файлы
README.md
.gitignore
.chezmoiroot
+1
View File
@@ -0,0 +1 @@
.
+65
View File
@@ -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!"
+1
View File
@@ -1,4 +1,5 @@
.DS_Store
nul
# Secrets
.env.secrets
+50 -1
View File
@@ -99,7 +99,7 @@ mkdir -p ~/.claude
ln -snf ~/.agents/skills ~/.claude/skills
```
### Stow (рекомендуется)
### Stow (рекомендуется для Linux/WSL)
```bash
# Установка stow
@@ -115,13 +115,62 @@ stow bash tmux vim zed agents opencode codex claude
[ -f ~/.bash_custom ] && source ~/.bash_custom
```
### Windows (chezmoi)
Для Windows используется [chezmoi](https://www.chezmoi.io/) — кросс-платформенный менеджер dotfiles.
> 💡 **Примечание:** chezmoi также работает на Linux/WSL, но stow предпочтительнее для полной функциональности.
**⚠️ Требования:**
- Developer Mode должен быть включён (для создания симлинков)
- PowerShell 5.0+ или PowerShell Core
**Установка (два шага):**
```powershell
# 1. Установка chezmoi
winget install twpayne.chezmoi
# 2. Инициализация (клонирует репо)
chezmoi init ddmitry/dotfiles
# 3. Первое применение (подготавливает структуру)
chezmoi apply
# 4. Второе применение (копирует файлы в правильные места)
chezmoi apply
```
**Примечания:**
- После шага 4 все файлы будут на месте: `~/.vimrc`, `~/.agents/skills/`, `~/.config/opencode/`, и т.д.
- Симлинки для skills создаются автоматически только если включен Developer Mode
- Без Developer Mode AI-ассистенты будут работать с прямыми копиями skills
**Что доступно на Windows:**
- ✅ Vim
- ✅ Agents (shared skills)
- ✅ Codex (с симлинками на skills)
- ✅ Claude (с симлинками на skills)
- ✅ Opencode (с симлинками на skills)
**Что НЕ доступно на Windows:**
- ❌ Bash (Linux-only)
- ❌ Tmux (Linux-only)
- ❌ Zed (пути конфигурации отличаются)
## 🔧 Требования
### Linux/WSL
- Linux (протестировано на Ubuntu)
- Bash 4.0+
- Tmux 2.0+
- Vim 8.0+
### Windows
- Windows 10/11 с Developer Mode
- PowerShell 5.0+ или PowerShell Core
- [chezmoi](https://www.chezmoi.io/)
## 📝 Дополнительные файлы
Для полной настройки создайте: