Expert assistant for chezmoi dotfiles management. Use when: "add this file to chezmoi", "make this a template", "encrypt this secret", "apply on a new machine", "run script only once", "manage dotfiles across machines". Examples: - user: "Track my .zshrc with chezmoi" → chezmoi add ~/.zshrc - user: "Make my .gitconfig machine-specific" → convert to .tmpl, use {{ .chezmoi.hostname }} - user: "Run a script only on first apply" → once_ prefix - user: "Sync to a new laptop" → chezmoi init --apply $GITHUB_USERNAME - user: "Why isn't my file being applied?" → diagnose source attribute, diff, doctor
96
96%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
chezmoi uses Go's text/template with missingkey=error by default (missing keys raise an error).
{{ .chezmoi.hostname }} — machine hostname
{{ .chezmoi.os }} — "linux", "darwin", "windows"
{{ .chezmoi.arch }} — "amd64", "arm64"
{{ .chezmoi.username }} — current user
{{ .chezmoi.homeDir }} — home directory path
{{ .chezmoi.sourceDir }} — chezmoi source directory path
{{ .chezmoi.group }} — current user's primary group
{{ .chezmoi.kernel.osRelease.id }} — e.g. "ubuntu", "fedora" (Linux)Inspect all variables: chezmoi data
{{- if eq .chezmoi.os "darwin" }}
export BROWSER=open
{{- else if eq .chezmoi.os "linux" }}
export BROWSER=xdg-open
{{- end }}{{- if eq .chezmoi.hostname "work-laptop" }}
export HTTP_PROXY=http://proxy.corp:3128
{{- end }}Add to ~/.config/chezmoi/chezmoi.toml:
[data]
email = "alice@example.com"
workMachine = trueUse in templates: {{ .email }}, {{ .workMachine }}
# 1Password
{{ onepasswordRead "vault" "item" "field" }}
# Bitwarden
{{ bitwarden "item" "field" }}
# LastPass
{{ lastpass "item" "field" }}
# gopass
{{ gopass "path/to/secret" }}
# keyring (macOS Keychain / libsecret)
{{ keyring "service" "username" }}chezmoi includes the Sprig template library (see chezmoi.io/reference/templates/functions/ for the full list):
{{ "hello" | upper }} → HELLO
{{ list "a" "b" "c" | join "," }} → a,b,c
{{ env "HOME" }} → /home/alice
{{ include "other-file" . }} → render another template file# Preview rendered output without applying
chezmoi cat ~/.zshrc
# Render from stdin
echo '{{ .chezmoi.os }}' | chezmoi execute-template
# Render a specific source file
chezmoi execute-template < ~/.local/share/chezmoi/dot_zshrc.tmplOverride missingkey=error in chezmoi.toml:
[template]
options = ["missingkey=zero"]Use - to strip whitespace:
{{- if eq .chezmoi.os "darwin" -}}
...
{{- end -}}