chezmoi-sync

Detect, validate, and push chezmoi-managed dotfile changes to a git remote.

1|Updated Aug 6, 2025
One-click install
npx skills add https://github.com/azaidrahman/zaid-sani-dotfiles --skill chezmoi-sync-azaidrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: chezmoi-sync
Source: https://github.com/azaidrahman/zaid-sani-dotfiles/tree/main/dot_claude/skills/chezmoi-sync
Command: npx skills add https://github.com/azaidrahman/zaid-sani-dotfiles --skill chezmoi-sync-azaidrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Dotfile edits made during a session often go uncommitted, leaving machines out of sync and risking accidental commits of secrets or template-destroying chezmoi add operations. This Skill detects pending chezmoi changes, scans them for secrets, reconciles diverged targets safely, and pushes a clean commit. ## Core Features & Use Cases - Read-only change detection: A bundled script combines git status on the chezmoi source dir with chezmoi diff on diverged targets, flagging secrets and private_/encrypted_ files via exit codes before anything is committed. - Safe reconciliation: Distinguishes plain files from modify_* scripts and .tmpl templates so chezmoi add never silently overwrites template logic; script/template sources are hand-edited and verified with an empty chezmoi diff. - Guarded commit and push: Stages only session-relevant files, matches the repo's existing commit style, and requires user confirmation before pushing. - Use Case: After tweaking your .zshrc and tmux config in a work session, ask the assistant to sync dotfiles; it detects the changes, warns about a token-like string in the diff, and pushes only the approved files. ## Quick Start Ask the assistant to sync your dotfiles and push any chezmoi-managed changes from this session.

Frequently Asked Questions about chezmoi-sync

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync chezmoi dotfiles after editing config files?

Run the detection script to combine git status on the chezmoi source directory with chezmoi diff on diverged targets. Then reconcile each changed target, stage only the relevant files, commit in the repo's existing style, and push to the remote.

Why should I avoid chezmoi add on modify_ scripts and templates?

Running chezmoi add on a target whose source is a modify_ script or .tmpl template replaces the script with a static file, silently discarding its logic. Instead, hand-edit the script or template so it renders the new output, then verify chezmoi diff is empty.

How does the skill detect secrets before pushing dotfiles?

The detection script scans added lines in both the source working diff and the chezmoi target diff for patterns like API keys, tokens, passwords, and private key headers. If matches or private_/encrypted_ files appear, it exits with code 11 and requires explicit user sign-off.

What do the chezmoi-detect.sh exit codes mean?

Exit 0 means everything is clean with nothing to sync, exit 10 means changes exist with no warnings, exit 11 means changes exist with secret or private_ file warnings requiring review, and exit 2 means a precondition failed such as chezmoi missing.

When should I not use chezmoi sync?

Skip it when changes are outside chezmoi-managed paths, when working in a project repo rather than dotfiles, or when the user plans to commit later. It also never runs chezmoi apply, since it syncs source to remote rather than applying source to targets.