feat: add chezmoi merge tools with VSCode integration and Fish helper

- Add VSCode-based merge helper with clear visual layout explanation
- Add Fish function for fzf-based interactive conflict selection
- Update CLAUDE.md with .tmpl file search patterns and tool usage guidelines
This commit is contained in:
2026-01-13 16:26:34 -06:00
parent ccc91142d2
commit 203666e720
5 changed files with 165 additions and 21 deletions
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Helper script for chezmoi merge with clear labels
# Arguments: $1=destination $2=target $3=source
destination="$1"
target="$2"
source="$3"
# Create base file (copy of target state)
base="${target}.base"
cp "$target" "$base"
# Show clear explanation before merge
cat << EOF
╔════════════════════════════════════════════════════════════════╗
║ CHEZMOI MERGE LAYOUT ║
╠════════════════════════════════════════════════════════════════╣
║ ║
║ LEFT (Current): DESTINATION - File in your home dir ║
║ ↓ External changes (e.g., app updates) ║
║ ║
║ RIGHT (Incoming): TARGET - What chezmoi wants to apply ║
║ ↓ Your chezmoi changes (templates, etc) ║
║ ║
║ BOTTOM (Result): SOURCE - Will be saved to chezmoi repo ║
║ ║
╠════════════════════════════════════════════════════════════════╣
║ File: $(basename "$destination")
╚════════════════════════════════════════════════════════════════╝
Press Enter to open merge editor...
EOF
read -r
# Launch VSCode merge
# Syntax: code --merge <current> <incoming> <base> <result>
code --new-window --wait --merge "$destination" "$target" "$base" "$source"
# Cleanup
rm -f "$base"