Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: syncing-chezmoi description: > "chezmoi update" "chezmoi pull" "chezmoi upgrade" "dotfiles sync" "chezmoi同期" "dotfiles更新" — Sync and upgrade chezmoi: pull dotfiles, resolve conflicts with user confirmation, and optionally upgrade chezmoi itself via Homebrew.
syncing-chezmoi
On activation, sync dotfiles from origin and apply them, resolving any conflicts with explicit user confirmation. Optionally upgrade chezmoi itself.
Steps
1. Upgrade chezmoi (if requested or outdated)
brew outdated chezmoi — if outdated, show the version diff and ask whether to upgrade. If yes: brew upgrade chezmoi.
2. Pull and apply
chezmoi update
If it finishes with no error, report the updated files and stop.
3. Resolve a destination-state conflict
Trigger: stderr says <file> has changed since chezmoi last wrote it? followed by could not open a new TTY. git pull succeeded but apply bailed at the first locally-modified target.
chezmoi diff
For each file in the diff:
- Real value differences: present with
-= local (this PC),+= remote (source). Ask local / remote / merge. - local wins → edit source to match local, commit/push to origin, re-run
chezmoi diffto confirm empty - remote wins →
chezmoi cat <target> > <target>(see Gotchas:--forceis blocked) - merge → edit source to include the local-only keys, commit/push, then
chezmoi cat <target> > <target> - No real value differences (file got skipped by the bailout):
chezmoi apply <path>
End with chezmoi diff returning empty.
4. Resolve a git merge conflict in source
Trigger: cd $(chezmoi source-path) && git status shows unmerged paths. Rare — only happens if source was manually edited and origin diverged.
For each unmerged file:
git diff <file>—-= local (this PC),+= remote (upstream)- Ask: local or remote?
- Edit to keep the chosen side, remove conflict markers
git add <file>
After all resolved: git stash drop only if a stash exists. Then re-run chezmoi apply and handle any destination-state conflicts via step 3.
Gotchas
- `chezmoi update` bails at the first conflicting target.
git pullsucceeds but apply stops — every later file in apply order is left unapplied, even non-conflicting ones. Always runchezmoi diffafter a TTY error and apply the unrelated leftovers viachezmoi apply <path> - `chezmoi apply --force` is blocked by `~/.claude/hooks/pre-tool-safety.sh`. To overwrite a locally-modified target after user approval, use
chezmoi cat <target> > <target>— chezmoi renders the source (handling templates) and the redirect overwrites the local file - chezmoi-managed targets are write-protected by a PreToolUse hook. Edit/Write to a target file is rejected. Find the source via
chezmoi source-path <file>and edit there; commit and push so other machines receive it on the nextchezmoi update - Never auto-resolve conflicts. Always show the diff and ask local/remote/merge
- Never `git stash drop` before every source conflict is resolved