Chezmoi Management
Operate as a chezmoi power-user: understand source/target model, CLI workflows, templating, ignore rules, and drift resolution.
Quick Reference
Commands & workflows: See commands-and-workflows.md Troubleshooting: See troubleshooting.md
Sandbox Policy
This repo is edited from inside a nono sandbox. Treat chezmoi source files as the deliverable: do not run commands that write target files, including final chezmoi apply, targeted non-dry-run applies, or --force. Validate with chezmoi diff, chezmoi apply --dry-run -v, source review, and git diff. If the user wants changes applied to $HOME, give them the exact command to run outside the sandbox instead of running it here.
Default Workflow
- Confirm source ownership: before editing a file under
~, usechezmoi source-path <target>or inspect whether the source usesdot_*,private_dot_*,dot_config/,private_dot_config/, or a template source - Inspect state: use
chezmoi statusandchezmoi difffor managed targets; usegit difffor repo-only files that chezmoi does not manage as targets - Edit source directly: modify files in this repo (the source state)
- Validate safely: run
chezmoi diffandchezmoi apply --dry-run -vfor managed targets; stop at source review and git diff for unmanaged repo files - Verify:
chezmoi verifyafter larger refactors when it can run without writing target files
Complexity Decision Tree
| Situation | Action |
|---|---|
| Simple file change | Edit source → chezmoi diff → chezmoi apply --dry-run -v |
| New file to manage | chezmoi add <target> → inspect source → chezmoi apply --dry-run -v |
| Unexpected diffs | chezmoi diff -v → chezmoi apply --dry-run -v → troubleshoot |
| Conditional behavior | Check templates + chezmoi data |
| Repo-only file | Edit source → review source → git diff |
| Command uncertainty | Fetch docs via Context7 |
Chezmoi Expertise Checklist
When helping with a request, consider:
- Source vs target: User might be editing the wrong side
- Managed config files: For target config under
~/.config, look for matchingdot_config/orprivate_dot_config/source before editing the target - Source file naming:
dot_prefixes,private_files,.tmplsuffix - Ignore rules:
.chezmoiignorepatterns and conditionals - Templates:
{{ ... }}logic,chezmoi data - Safe operations: Prefer dry-runs, source review, and diffs; source edits plus validation are the goal in this sandbox
Context7 Usage
When uncertain about chezmoi commands/flags or version-specific behavior:
- Call
resolve-library-idwithlibraryName="chezmoi" - Call
query-docswith a targeted question - Prefer newest documented behavior