About sync-dotfiles
A skill for syncing dotfiles between the ai-env repository and a home directory. It maps requests such as checking drift, capturing local changes, deploying repository configs, and installing skills to `sync.sh` subcommands, with an explicit safe path for ambiguous sync requests.
Key features
- 01Compare repository and home files
- 02Show the tracked file registry
- 03Pull local changes into the repo
- 04Push repository configs to home
- 05Install skills from the lock file
Use cases
- 01Check for configuration drift
- 02Save local config edits to the repo
- 03Deploy repository configs on a machine
- 04Install global skills from the lock file
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ camacho/ ai-skills --skill sync-dotfilesAfter installing, type/sync-dotfilesin Claude Code to confirm it loaded.
Bundled filessync.sh
Details
From the project READMEWhen to invoke
- User says "sync dotfiles", "pull configs", "push configs", "check drift"
- After a session where permissions or hooks were modified
- On a new machine after cloning ai-env
Subcommands
Map user intent to sync.sh subcommand:
| Intent | Command | What it does |
|---|---|---|
| "check what's different" | sync.sh diff | Show drift between repo and home |
| "what's tracked" | sync.sh status | Show file registry |
| "capture my local changes" | sync.sh pull | Home → repo (home wins) |
| "deploy repo configs" | sync.sh push | Repo → home (repo wins) |
| "install skills" | sync.sh skills-push | Install global skills from dotfiles/skills-lock.json |
| "sync" (ambiguous) | Show diff first, then ask direction | Safe default |
Running sync.sh
The sync script is bundled with this skill at sync.sh (same directory as this SKILL.md).
Run it directly — the script discovers the ai-env repo automatically:
/path/to/skill/sync.sh <subcommand>
The script sets AI_ENV_ROOT automatically via the discovery chain below. To override:
AI_ENV_ROOT=/custom/path/to/ai-env /path/to/skill/sync.sh push
AI_ENV_ROOT discovery
The script discovers the ai-env repo (where dotfiles/ lives) automatically:
- If
$AI_ENV_ROOTis set and$AI_ENV_ROOT/dotfilesexists: use that - If the script is inside an ai-env git repo (e.g., running from a symlink): use that repo root
- If
~/projects/camacho/ai-envexists: use that - Clone
camacho/ai-envto a temp dir via GitHub - If clone fails: error with instructions to set
AI_ENV_ROOT
After pull
Show git diff dotfiles/ and offer to commit: chore: sync dotfiles
After push
Run sync.sh status to confirm, warn about any missing files.