This document provides context and instructions for AI coding agents working with this repository.
This is a personal dotfiles repository for macOS, managed with chezmoi. It contains configuration files, shell scripts, and automation for setting up and maintaining a development environment.
The repository supports two profiles configured during initial setup:
-
personal: Personal machine setup- Excludes Docker configuration (
dot_config/docker/) - Uses personal Git configuration settings
- Installs personal Homebrew packages
- Excludes Docker configuration (
-
work: Work machine setup- Includes Docker configuration
- Includes work-specific encrypted aliases (
.work_aliases.age) - Runs work-specific setup script (
.work-before-setup.age) - Installs additional Homebrew packages (
.work-brew-packages.age)
The profile is selected during chezmoi init via an interactive prompt and stored in .chezmoi.json.tmpl. Template files use {{ if eq .profile "work" }} and {{ if eq .profile "personal" }} conditionals to customize configuration based on the selected profile.
.
├── dot_config/ # Application configurations (~/.config/)
│ ├── docker/
│ ├── ghostty/
│ ├── git/
│ ├── npm/
│ └── starship/
├── dot_dotfiles/ # Shell and environment configuration (~/.dotfiles/)
│ ├── .work_aliases.age # Work-specific aliases
│ ├── dot_aliases.tmpl # Shell aliases
│ ├── dot_exports # Environment variables
│ ├── dot_extra.tmpl # Extra configurations (templated)
│ └── dot_functions # Shell functions
├── dot_ssh/ # SSH configuration (~/.ssh/)
├── dot_zshrc # Zsh configuration (~/.zshrc)
├── run_once_*.sh.tmpl # One-time setup scripts
├── run_onchange_*.sh.tmpl # Scripts that run when files change
└── key.txt.age # Age key
dot_prefix: creates a.file (e.g.,dot_zshrc:~/.zshrc).tmplsuffix: template file processed with templates.agesuffix: encrypted file using age encryptionrun_once_prefix: scripts that run once during chezmoi applyrun_onchange_prefix: scripts that run when their content changesrun_once_after_: runs after other scriptsrun_once_before_: runs before other scripts
.chezmoi.json.tmpl: Chezmoi configuration.chezmoiignore.tmpl: Files to ignore by chezmoi.setup.sh: Installation scriptkey.txt.age: Encrypted age private key for decryption
Important: Do NOT attempt to decrypt or modify encrypted .age files directly. These require the age private key and should be handled through chezmoi's encryption workflow.
- Template Files: When editing
.tmplfiles, preserve Go template syntax (e.g.,{{ .chezmoi.* }}) - Shell Scripts: Follow existing shell script conventions (zsh compatible)
- Encrypted Files: Never attempt to read or modify
.agefiles - Testing: Use
chezmoi diffto preview changes before applying - Validation: Run
chezmoi apply --dry-runto test changes
- Preserve existing structure: Don't reorganize files without explicit request
- Maintain compatibility: Changes should work on macOS and unix systems
- Template variables: Use chezmoi template variables when appropriate
- Idempotency: Scripts should be safe to run multiple times
- Error handling: Fail gracefully when writing scripts
- Comments: Never add comments
When helping with this repository:
- Understand the change: Know if it's a config, script, or template
- Locate the correct file: Use chezmoi naming conventions
- Preserve templates: Keep
{{ }}syntax intact - Test safely: Use
--dry-runflags - Respect encryption: Don't touch
.agefiles