diff --git a/CLAUDE.md b/CLAUDE.md index 8a3806a..c8460e5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,7 +20,14 @@ This is a **chezmoi source directory** for managing dotfiles across multiple mac **Template System:** - Uses Go templates with platform detection -- Variables: `.chezmoi.os`, `.chezmoi.homeDir`, `.data.*` +- Two types of templates with different variable access patterns: + - **Regular templates** (e.g., `home/dot_bashrc.tmpl`): Direct access to Chezmoi context + - Built-in: `.chezmoi.os`, `.chezmoi.homeDir` + - Custom data: `.wsl`, `.chassis` + - **Partials** (reusable templates in `home/.chezmoitemplates/`): Must receive context via explicit parameter + - Partials don't have automatic access to Chezmoi's context + - Context passed as parameter (commonly `data`) when calling the partial + - Access everything through parameter: `.data.chezmoi.os`, `.data.wsl`, `.data.chassis` - Conditional rendering for Windows/Linux/macOS/WSL **Secret Management:** @@ -82,9 +89,11 @@ This is a **chezmoi source directory** for managing dotfiles across multiple mac - `chezmoi status` - see what's changed 4. **Use templates correctly** - - Platform detection: `.chezmoi.os`, `.data.wsl`, `.data.chassis` + - Platform detection in regular templates: `.chezmoi.os`, `.wsl`, `.chassis` + - Platform detection in partials: `.data.chezmoi.os`, `.data.wsl`, `.data.chassis` - Doppler secrets: `{{ dopplerProjectJson.SECRET_NAME }}` - Conditional logic: `{{ if }}...{{ else }}...{{ end }}` + - Example partial call: `{{ template "commonrc.sh.tmpl" . }}` (passes entire context as `data`) 5. **Suggest TODO list updates** (but DO NOT modify automatically) - When a task is completed, check if `TODO.md` exists in the repository diff --git a/home/dot_claude/CLAUDE.md b/home/dot_claude/CLAUDE.md.tmpl similarity index 89% rename from home/dot_claude/CLAUDE.md rename to home/dot_claude/CLAUDE.md.tmpl index eb07fcd..d103a2f 100644 --- a/home/dot_claude/CLAUDE.md +++ b/home/dot_claude/CLAUDE.md.tmpl @@ -1,4 +1,6 @@ - **Note**: Project-specific CLAUDE.md files take precedence for project-specific patterns. +**Note**: Project-specific CLAUDE.md files take precedence for project-specific patterns. + +{{- if and (eq .chezmoi.os "windows") (not .wsl) }} ## Shell Environment (Windows) @@ -7,6 +9,25 @@ - ❌ Do NOT use CMD commands (`dir`, `copy`, `del`) - ✅ Use standard Bash/Unix commands (`ls`, `cp`, `mv`, `rm`, `grep`) - Prefer relative paths for simplicity +{{- else if .wsl }} + +## Shell Environment (WSL) + +- **You are in WSL (Windows Subsystem for Linux)** +- ✅ Use standard Linux/Bash commands (`ls`, `cp`, `mv`, `rm`, `grep`) +- ✅ Full access to Linux tooling and package managers +- ⚠️ Can access Windows filesystem via `/mnt/c/`, but prefer Linux paths +- ⚠️ Can call Windows executables (`.exe`), but prefer native Linux tools +- Prefer relative paths for simplicity +{{- else if eq .chezmoi.os "linux" }} + +## Shell Environment (Linux) + +- **You are in a standard Linux environment** +- ✅ Use standard Bash/Unix commands (`ls`, `cp`, `mv`, `rm`, `grep`) +- ✅ Full access to Linux tooling and package managers +- Prefer relative paths for simplicity +{{- end }} ## Build & Package Management