Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# AGENTS.md

This file provides guidance to Codex (claude.ai/code) when working with code in this repository.

## Repositorio

Dotfiles para macOS: configuración de Ghostty + Zsh + Starship. El instalador crea symlinks desde el directorio del repo hacia las ubicaciones estándar del sistema.

## Instalación y testing

```bash
# Instalar dotfiles (crea symlinks + instala dependencias via Homebrew)
./install.sh

# Medir load time del profile zsh
time zsh -i -c exit

# Verificar que los symlinks están correctos
ls -la ~/.zshrc ~/.config/starship.toml ~/.config/ghostty/config
```

No hay tests automatizados. La validación es manual: recargar la shell con `source ~/.zshrc` o `reload` y verificar que los comandos funcionen.

## Estructura y arquitectura

```
dotfiles/
├── zsh/
│ ├── zshrc # Profile principal → symlink a ~/.zshrc
│ └── scripts/ # Scripts sourced desde zshrc
│ ├── claude-helpers.zsh # cc, ccx, ccd, ccclip
│ ├── git-helpers.zsh # git-workdev, git-personaldev, git-whoami, clone-*
│ ├── pcsoft-helpers.zsh # is-pcsoft-forbidden, is-pcsoft-editable
│ ├── screenshots.zsh # ss, last, ssd, imgclip
│ └── tmux-helpers.zsh # ta, tn, tk, tl, tdev
├── starship/starship.toml # Prompt Gruvbox Dark → symlink a ~/.config/starship.toml
├── ghostty/config # Terminal → symlink a ~/.config/ghostty/config
├── tmux/tmux.conf # Multiplexor → symlink a ~/.tmux.conf
├── local/
│ └── env.zsh.example # Template para local/env.zsh (gitignored)
└── install.sh # Instalador
```

**Flujo de carga del zshrc:** Las secciones están separadas por `#region`/`#endregion`. El orden importa: Brew → PATH → Zsh options → Editor → Env vars → Aliases → Source scripts → Local overrides → Starship → Welcome.

**`local/env.zsh`** está gitignored y contiene paths personales, tokens y overrides de variables de entorno (`SCREENSHOTS_DIR`, `WORKSPACE_DIR`, `WORK_PROJECTS_DIR`). Se genera desde `env.zsh.example` en la primera instalación.

## Múltiples identidades GitHub

El repositorio maneja dos cuentas de GitHub con SSH host aliases:
- `github-workdev` → cuenta de trabajo/empresa (configurar con tu email de empresa)
- `github-personaldev` → cuenta personal (configurar con tu email personal)

Los helpers en `git-helpers.zsh` configuran la identidad local del repo Y actualizan el remote URL para usar el alias SSH correcto. Cuando se agregan nuevas funciones relacionadas con identidades, seguir el mismo patrón.

## Convenciones al editar

- Los scripts `.zsh` usan `#region`/`#endregion` para agrupar secciones lógicas.
- Cada función pública en los scripts debe tener un comentario explicando su uso.
- Variables de entorno con defaults se definen como `${VAR:-default}` para permitir override desde `local/env.zsh`.
- `install.sh` usa `set -e` y hace backup de configs existentes antes de crear symlinks — mantener este comportamiento al agregar nuevas configs.

## Agregar una nueva configuración

1. Crear el archivo de config en su directorio (`nombre-herramienta/config`)
2. Agregar backup + symlink en `install.sh` siguiendo el patrón existente
3. Actualizar el README.md con la nueva entrada en la tabla de estructura
44 changes: 34 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ GitHub Actions ejecuta un smoke check mínimo en pull requests y pushes a `main`
- **Keyboard remaps macOS**: [Karabiner-Elements](https://karabiner-elements.pqrs.org/) con profile `cortex`
- **Editor terminal**: Neovim basado en LazyVim/Gentleman.Dots; la config host selecciona `gentleman-kanagawa-blur` y no se encontró un overlay RefactorIA en la auditoría
- **Ls**: [eza](https://github.com/eza-community/eza)
- **AI CLI UX**: Claude Code statusline, OpenCode helpers y cmux local/remoto
- **Workflow docs**: [cmux workflow](docs/cmux-workflow.md), [Herdr workflow](docs/herdr-workflow.md) y [keymaps prácticos](docs/keymaps.md)
- **AI CLI UX**: Claude Code statusline, OpenCode helpers y herdr local/remoto
- **Workflow docs**: [Herdr workflow](docs/herdr-workflow.md) y [keymaps prácticos](docs/keymaps.md)
- **Supply-chain guardrails**: defaults globales para `uv`, `npm`, `pnpm` y `bun`
- **Fuente**: FiraCode Nerd Font + variante custom RefactorIA

Expand Down Expand Up @@ -46,14 +46,42 @@ bash install.sh --dry-run

El instalador macOS:

1. Instala dependencias via Homebrew (cmux, starship, tmux, lazygit, neovim, eza, sketchybar, Karabiner-Elements, FiraCode Nerd Font)
1. Instala dependencias via Homebrew (starship, tmux, lazygit, neovim, eza, sketchybar, Karabiner-Elements, FiraCode Nerd Font)
2. Hace backup de configs existentes con timestamp
3. Crea symlinks de los dotfiles y guardrails globales (`.npmrc`, `pnpm/rc`, `.bunfig.toml`, `uv.toml`)
4. Instala los themes y launchers Barbatdev/RefactorIA sin activarlos
5. Intenta seleccionar el profile `cortex` de Karabiner si `karabiner_cli` está disponible
6. Intenta arrancar/recargar `sketchybar` sin cortar la instalación si macOS requiere permisos
7. Crea `local/env.zsh` desde el template

### Backups y restore

Cada destino de symlink existente que no apunte ya al repo se respalda antes de
reescribirlo como `<destino>.bak_<YYYYMMDD_HHMMSS>`:

- Un symlink existente se respalda con `cp -P` (el link, sin seguir su destino).
- Un archivo o directorio real se respalda con `cp -R`.

Restore manual:

```bash
# 1. Quitá el symlink administrado
rm ~/.zshrc
# 2. Restaurá el backup más reciente (lista con ls -la ~/.zshrc.bak_*)
cp -R ~/.zshrc.bak_20260213_101500 ~/.zshrc
```

Para directorios completos (por ejemplo `~/.config/opencode/themes`), borrá el
symlink y usá `cp -R backup directorio`. Los backups no se limpian
automáticamente; revisalos periódicamente con:

```bash
find ~ -maxdepth 4 -name '*.bak_[0-9]*' -print
```

Si un destino es un directorio real (no symlink), el instalador aborta antes de
tocar nada: movelo o borralo y volvé a correr `install.sh`.

## Perfiles visuales opt-in

`./install.sh` instala estos assets mediante symlinks individuales. No cambia el theme activo de Pi, Herdr, Fish o Ghostty; tampoco modifica Starship ni las variables universales de Fish.
Expand Down Expand Up @@ -211,8 +239,7 @@ dotfiles/
│ ├── zshrc # Profile principal (~/.zshrc)
│ └── scripts/
│ ├── claude-helpers.zsh # Integración Claude Code
│ ├── cmux-sidebar-refresh.sh # Metadata Cortex para cmux
│ ├── ssh-helpers.zsh # cmux SSH y SSH convencional
│ ├── ssh-helpers.zsh # SSH con contexto de host
│ ├── git-helpers.zsh # Identidades Git y clone helpers
│ ├── tmux-helpers.zsh # Helpers tmux
│ ├── worktree-helpers.zsh # Helpers git worktree
Expand All @@ -230,8 +257,6 @@ dotfiles/
└── install.sh
```

> Nota migración cmux: el path legacy `~/Library/Application Support/com.cmuxterm.app/config.ghostty` ya no está gestionado por estos dotfiles. Si todavía existe en tu máquina, podés borrarlo manualmente sin afectar la configuración actual.

## Boundary con Cortex

Este repo sigue siendo standalone: `install.sh` no requiere tener el repo `cortex` disponible y estos dotfiles deben poder instalarse por sí solos.
Expand Down Expand Up @@ -269,7 +294,7 @@ Seguimiento: [cortex-dotfiles #31](https://github.com/barbatdev/cortex-dotfiles/
| `ccclip <files>` | Copiar código al clipboard |
| `tcc`, `tdev`, `ta`, `tn`, `tl`, `tk` | Helpers tmux (`tcc` abre Claude Code en tmux) |
| `wtadd`, `wtlist`, `wtremove` | Helpers de git worktrees |
| `sshx`, `sshc`, `sshx-doctor` | cmux SSH persistente, SSH convencional y diagnóstico |
| `sshc` | SSH con contexto de host en el prompt |
| `cortex.agent_state.v1`, `agent-state` | Reportar/listar estado local de agentes Cortex y, dentro de Herdr, actualizar el pane actual |
| `ss [n]` | Listar últimos screenshots |
| `last [-c\|-o]` | Último screenshot |
Expand Down Expand Up @@ -297,7 +322,7 @@ Editá `local/env.zsh` (gitignored) para configurar:

Referencia completa: [Herdr workflow](docs/herdr-workflow.md). Atajos prácticos: [keymaps](docs/keymaps.md).

El profile Fish también expone `h`, `hs`, `hl`, `hhere`, `hmain`, `hrole`, `hnew`, `hfocus`, `hside`, `hscratch`, `hname`, `whereami`, `sshc`, `sshx` y `sshx-doctor`; Home Manager mapea cada función de forma explícita.
El profile Fish también expone `h`, `hs`, `hl`, `hhere`, `hmain`, `hrole`, `hnew`, `hfocus`, `hside`, `hscratch`, `hname`, `whereami` y `sshc`; Home Manager mapea cada función de forma explícita.

Usá `hremote` desde tu terminal local en macOS. No hagas `ssh` primero y después intentes levantar `herdr` dentro de esa sesión remota.

Expand Down Expand Up @@ -428,7 +453,6 @@ No usarlo como banner automático del shell por defecto. En sesiones de trabajo
El setup instala estas protecciones globales para reducir riesgo de supply-chain:

- `~/.npmrc`
- `min-release-age=7`
- `ignore-scripts=true`
- `~/Library/Preferences/pnpm/rc`
- `minimum-release-age=10080` (7 días en minutos)
Expand Down
108 changes: 108 additions & 0 deletions aerospace/aerospace.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# AeroSpace — migración 1:1 desde yabai (ver ~/.local/backups/yabai-migration-*/).
# Sin SIP, sin scripting addition: los updates de macOS 27 no rompen el tiling.
# Los Spaces de macOS siguen existiendo: el indicador space.1..10 de SketchyBar
# y los atajos ctrl+N de Herdr siguen funcionando sin cambios.

# --- Global ---
start-at-login = true
after-startup-command = []

# Sin gaps: las ventanas usan todo el monitor disponible (igual que yabai).
[gaps]
inner.horizontal = 0
inner.vertical = 0
outer.left = 0
outer.bottom = 0
outer.top = 0
outer.right = 0

[mode.main.binding]

# --- Focus (flechas + vim, igual que skhd alt+cmd) ---
alt-cmd-left = 'focus left'
alt-cmd-down = 'focus down'
alt-cmd-up = 'focus up'
alt-cmd-right = 'focus right'
alt-cmd-h = 'focus left'
alt-cmd-j = 'focus down'
alt-cmd-k = 'focus up'
alt-cmd-l = 'focus right'

# --- Mover ventanas en el layout (swap) ---
alt-cmd-shift-left = 'move left'
alt-cmd-shift-down = 'move down'
alt-cmd-shift-up = 'move up'
alt-cmd-shift-right = 'move right'
alt-cmd-shift-h = 'move left'
alt-cmd-shift-j = 'move down'
alt-cmd-shift-k = 'move up'
alt-cmd-shift-l = 'move right'

# --- Workspaces 1..9 (mismos atajos que yabai) ---
alt-cmd-1 = 'workspace 1'
alt-cmd-2 = 'workspace 2'
alt-cmd-3 = 'workspace 3'
alt-cmd-4 = 'workspace 4'
alt-cmd-5 = 'workspace 5'
alt-cmd-6 = 'workspace 6'
alt-cmd-7 = 'workspace 7'
alt-cmd-8 = 'workspace 8'
alt-cmd-9 = 'workspace 9'

# Mover ventana al workspace y seguirla
alt-cmd-shift-1 = 'move-node-to-workspace 1'
alt-cmd-shift-2 = 'move-node-to-workspace 2'
alt-cmd-shift-3 = 'move-node-to-workspace 3'
alt-cmd-shift-4 = 'move-node-to-workspace 4'
alt-cmd-shift-5 = 'move-node-to-workspace 5'
alt-cmd-shift-6 = 'move-node-to-workspace 6'
alt-cmd-shift-7 = 'move-node-to-workspace 7'
alt-cmd-shift-8 = 'move-node-to-workspace 8'
alt-cmd-shift-9 = 'move-node-to-workspace 9'

# --- Layout ---
alt-cmd-f = ['layout floating tiling'] # era: toggle float
alt-cmd-b = 'balance-sizes' # era: space --balance
alt-cmd-o = ['join-with down'] # era: rotate 90 (aprox. i3: fusionar hacia abajo)
alt-cmd-x = 'resize smart +50' # era: mirror x (no existe; redimensionar)
alt-cmd-y = 'resize smart -50' # era: mirror y (no existe; redimensionar)
alt-cmd-e = 'layout tiles accordion' # era: toggle split (split no juega con normalización)
alt-cmd-shift-f = 'fullscreen' # era: toggle zoom-fullscreen
alt-cmd-tab = 'workspace-back-and-forth' # era: space --focus recent

# Ayuda de atajos de la barra (era 0x2C = coma)
alt-cmd-comma = 'exec-and-forget ~/.config/sketchybar/plugins/shortcuts_help.sh'

# Recargar config (era: restart yabai service)
alt-cmd-shift-r = 'reload-config'

[mode.resize.binding]
h = 'resize width -50'
j = 'resize height +50'
k = 'resize height -50'
l = 'resize width +50'
left = 'resize width -50'
down = 'resize height +50'
up = 'resize height -50'
right = 'resize width +50'
enter = 'mode main'
esc = 'mode main'

# --- Reglas float (equivalente de yabai manage=off) ---
[[on-window-detected]]
if.app-id = 'com.apple.systempreferences'
run = ['layout floating']

[[on-window-detected]]
if.app-id = 'com.apple.calculator'
run = ['layout floating']

[[on-window-detected]]
if.app-id = 'com.apple.ActivityMonitor'
run = ['layout floating']

[[on-window-detected]]
if.app-id = 'com.apple.finder'
if.window-title-regex-substring = '^(Copy|Move|Info|Preferences)'
check-further-callbacks = true
run = ['layout floating']
61 changes: 61 additions & 0 deletions archive/yabai-migration/skhdrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Leader = option + command.

# Focus ventanas
alt + cmd - left : yabai -m window --focus west || yabai -m window --focus prev || true
alt + cmd - down : yabai -m window --focus south || yabai -m window --focus next || true
alt + cmd - up : yabai -m window --focus north || yabai -m window --focus prev || true
alt + cmd - right : yabai -m window --focus east || yabai -m window --focus next || true

# Aliases Vim adaptados desde Gentleman.Dots; se conserva el leader Option+Command.
alt + cmd - h : yabai -m window --focus west || yabai -m window --focus prev || true
alt + cmd - j : yabai -m window --focus south || yabai -m window --focus next || true
alt + cmd - k : yabai -m window --focus north || yabai -m window --focus prev || true
alt + cmd - l : yabai -m window --focus east || yabai -m window --focus next || true

# Mover ventanas dentro del layout
alt + cmd + shift - left : yabai -m window --warp west || yabai -m window --swap west || true
alt + cmd + shift - down : yabai -m window --warp south || yabai -m window --swap south || true
alt + cmd + shift - up : yabai -m window --warp north || yabai -m window --swap north || true
alt + cmd + shift - right : yabai -m window --warp east || yabai -m window --swap east || true

alt + cmd + shift - h : yabai -m window --warp west || yabai -m window --swap west || true
alt + cmd + shift - j : yabai -m window --warp south || yabai -m window --swap south || true
alt + cmd + shift - k : yabai -m window --warp north || yabai -m window --swap north || true
alt + cmd + shift - l : yabai -m window --warp east || yabai -m window --swap east || true

# Spaces
alt + cmd - 1 : yabai -m space --focus 1 || true
alt + cmd - 2 : yabai -m space --focus 2 || true
alt + cmd - 3 : yabai -m space --focus 3 || true
alt + cmd - 4 : yabai -m space --focus 4 || true
alt + cmd - 5 : yabai -m space --focus 5 || true
alt + cmd - 6 : yabai -m space --focus 6 || true
alt + cmd - 7 : yabai -m space --focus 7 || true
alt + cmd - 8 : yabai -m space --focus 8 || true
alt + cmd - 9 : yabai -m space --focus 9 || true

# Mover ventana al space y seguirla
alt + cmd + shift - 1 : yabai -m window --space 1 && yabai -m space --focus 1 || true
alt + cmd + shift - 2 : yabai -m window --space 2 && yabai -m space --focus 2 || true
alt + cmd + shift - 3 : yabai -m window --space 3 && yabai -m space --focus 3 || true
alt + cmd + shift - 4 : yabai -m window --space 4 && yabai -m space --focus 4 || true
alt + cmd + shift - 5 : yabai -m window --space 5 && yabai -m space --focus 5 || true
alt + cmd + shift - 6 : yabai -m window --space 6 && yabai -m space --focus 6 || true
alt + cmd + shift - 7 : yabai -m window --space 7 && yabai -m space --focus 7 || true
alt + cmd + shift - 8 : yabai -m window --space 8 && yabai -m space --focus 8 || true
alt + cmd + shift - 9 : yabai -m window --space 9 && yabai -m space --focus 9 || true

# Layout
alt + cmd - f : yabai -m window --toggle float || true
alt + cmd - b : yabai -m space --balance || true
alt + cmd - r : yabai -m config --space window_gap 0; yabai -m space --balance || true; sketchybar --reload
alt + cmd - o : yabai -m space --rotate 90 || true
alt + cmd - x : yabai -m space --mirror x-axis || true
alt + cmd - y : yabai -m space --mirror y-axis || true
alt + cmd - e : yabai -m window --toggle split || true
alt + cmd + shift - f : yabai -m window --toggle zoom-fullscreen || true
alt + cmd - tab : yabai -m space --focus recent || true
alt + cmd - 0x2C : ~/.config/sketchybar/plugins/shortcuts_help.sh

# Servicios
alt + cmd + shift - r : yabai --restart-service; skhd --reload; sketchybar --reload
Loading
Loading