Skip to content

Commit b0c90f6

Browse files
committed
feat: add CLAUDE.md
1 parent 321372d commit b0c90f6

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

CLAUDE.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
Personal dotfiles configuration using [Dotbot](https://github.com/anishathalye/dotbot) for installation and symlink management. Configures macOS development environment with terminal, shell, keyboard remappings, window management, and editor settings.
8+
9+
## Build & Development Commands
10+
11+
### Installation
12+
```bash
13+
make install # Run dotbot install script (./install)
14+
make link # Run dotbot link only (./install --only link)
15+
```
16+
17+
### Karabiner (Keyboard Remapping)
18+
```bash
19+
make karabiner # Build karabiner.json from TypeScript
20+
make karabiner-dev # Watch mode with auto-rebuild
21+
# Direct: deno run --allow-env --allow-read --allow-write karabiner/karabiner.ts
22+
```
23+
24+
### Phoenix (Window Manager)
25+
```bash
26+
make phoenix # Build ~/.phoenix.js from TypeScript
27+
make phoenix-dev # Watch mode with auto-rebuild
28+
# Direct: pnpm -C phoenix run build
29+
```
30+
31+
### VS Code Extensions
32+
```bash
33+
make vscode-install # Install extensions from vscode/extensions.txt
34+
make vscode-save # Save current extensions to extensions.txt
35+
```
36+
37+
### Homebrew
38+
```bash
39+
make brew # Save Brewfile snapshot + cleanup
40+
make brew-restore # Install Homebrew and restore from Brewfile
41+
```
42+
43+
### System Configuration
44+
```bash
45+
make macos # Apply macOS defaults from macos/set-defaults.sh
46+
make claude # Apply Claude Code defaults from claude/set-defaults.sh
47+
```
48+
49+
## Architecture
50+
51+
### Karabiner Configuration (`karabiner/`)
52+
TypeScript-based Karabiner-Elements config using Deno and [deno_karabiner](https://github.com/esamattis/deno_karabiner).
53+
54+
**Key files:**
55+
- `karabiner.ts`: Main config, builds JSON
56+
- `lib/hyper.ts`: Hyper key helpers (`hyper()`, `hyperCmd()`, `hyperFocusApp()`)
57+
- `lib/conditions.ts`: App-based conditions
58+
- `lib/apps.ts`: Application mappings
59+
- `lib/remap.ts`: Basic key remapping utilities
60+
61+
**Hyper key setup:**
62+
- CapsLock → `left_shift + left_control + left_option`
63+
- CapsLock alone → Escape
64+
- CapsLock+Cmd → `left_shift + left_control + left_option + left_command`
65+
66+
**Architecture pattern:** Export rule builders from `lib/`, compose in main `karabiner.ts` using `KarabinerComplexModifications` class.
67+
68+
### Phoenix Configuration (deprecated) (`phoenix/`)
69+
TypeScript window manager config compiled with `@vercel/ncc` to single-file `~/.phoenix.js`.
70+
71+
**Key files:**
72+
- `src/phoenix.ts`: Main config with all keybindings
73+
- `src/window-grid.ts`: Window positioning system (GridPosition 0-1 based)
74+
- `src/window-cache.ts`: Window history tracking
75+
- `src/screen.ts`: Multi-display management
76+
- `src/hyper.ts`: Key binding helpers matching Karabiner's hyper key
77+
- `src/utils/yabai.ts`: Yabai integration helpers
78+
79+
**Grid system:** All window positions defined as `GridPosition` with x/y/w/h on 0-1 scale. Supports split layouts (left66, right50, etc.) and centered positions (full, big, med, sm, xs).
80+
81+
**Binding pattern:**
82+
```typescript
83+
hyper('key', callback) // CapsLock+key
84+
hyperCmd('key', callback) // CapsLock+Cmd+key
85+
```
86+
87+
### ZSH Configuration (`zsh/`)
88+
**Main file:** `zshrc.zsh` (symlinked to `~/.zshrc`)
89+
90+
Uses [zgenom](https://github.com/jandamm/zgenom) plugin manager with:
91+
- oh-my-zsh base + plugins
92+
- [Powerlevel10k](https://github.com/romkatv/powerlevel10k) theme
93+
- Custom config: `p10k.customizations.zsh`
94+
- Aliases: `../aliases/*.aliases.sh` (sourced from `$DOTFILES/aliases`)
95+
- Functions: `../functions/*.sh` (sourced from `$DOTFILES/functions`)
96+
97+
**Loading order:** zgenom plugins → p10k theme → customizations → aliases → functions
98+
99+
### Shell Aliases & Functions
100+
**Aliases** (`aliases/`): Organized by tool (git, node, zsh, claude, vim)
101+
102+
**Functions** (`functions/`): fzf-based utilities, git helpers, Claude commands
103+
- `git.functions.sh`: Git workflow helpers
104+
- `claude.functions.sh`: Claude Code integration
105+
- `fpr.sh`, `fyr.sh`: fzf PR/year selectors
106+
- `gl.sh`: Enhanced git log
107+
108+
### Dotbot Installation (`install.conf.yaml`)
109+
Dotbot handles:
110+
1. Submodule init
111+
2. Homebrew setup via `macos/setup-homebrew.sh`
112+
3. vim-plug download
113+
4. Symlink creation (supports glob patterns, platform conditionals)
114+
5. asdf plugin installation
115+
6. Git config via `git/set-gitconfig.sh`
116+
117+
**Symlink pattern:** Uses `path:` for single files, `glob: true` for directories. `force: true` overwrites existing.
118+
119+
### macOS Defaults (`macos/set-defaults.sh`)
120+
Bash script setting macOS preferences via `defaults write`. Categories:
121+
- System (show hidden folders, keyboard backlight)
122+
- Keyboard/Mouse (key repeat, smart quotes off, tap-to-click)
123+
- Finder
124+
- Dock
125+
- Safari
126+
127+
Run after OS install or updates.
128+
129+
### Testing
130+
TypeScript hooks in `claude/hooks/` use Deno's built-in test runner:
131+
```bash
132+
deno test claude/hooks/git-guardrails.test.ts
133+
deno test claude/hooks/pure-md-prompt-rewriter.test.ts
134+
```
135+
136+
## TypeScript Build Patterns
137+
138+
**Karabiner:** Deno with no deps → single `karabiner.json` output
139+
**Claude hooks:** Deno with TypeScript → no compilation needed (executed directly)
140+
141+
Both Karabiner and Phoenix use function composition over classes. Export small utilities from `lib/`/`utils/` and compose in main file.

0 commit comments

Comments
 (0)