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
16 changes: 3 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,10 @@
- Initial OSS-safe `cortex-dots` snapshot.
- Generalized private paths and navigation defaults.
- Removed custom font binary and private brand assets.
- Added MIT license, security policy, third-party notices, release checklist, and automated installer tests.
- Added MIT license, security policy, third-party notices, and automated installer tests.

## 0.1.1 - 2026-07-04

### Breaking

- Renamed `pcsoft-helpers.zsh` → `pc-helpers.zsh` (generic name for broader reuse).

### Added

- `scripts/test-install.sh` — automated installer tests (copy, symlink, stale-opposite scenarios).
- `scripts/check-agent-state.sh` — agent-state validator for release checklist.
- Supply chain security rules — external tools must be pinned to specific versions, 15+ days old.

### Changed

- Renamed `pcsoft-helpers.zsh` → `pc-helpers.zsh`.
- Added `scripts/test-install.sh` — automated installer tests.
- CI — added installer integration tests step.
85 changes: 34 additions & 51 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,71 @@

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

## Repositorio
## Repository

Dotfiles para terminal: configuración de Ghostty + Zsh + Starship. El instalador crea symlinks desde el directorio del repo hacia las ubicaciones estándar del sistema.
Terminal dotfiles: configuration for Ghostty + Zsh + Starship. The installer creates symlinks from the repo directory to standard system locations.

## Instalación y testing
## Installation and testing

```bash
# Instalar dotfiles (crea symlinks + instala dependencias)
# Install dotfiles (creates symlinks + installs local dependencies)
./install.sh

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

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

# Validar sintaxis sin instalar
# Validate syntax without installing
bash install.sh --check
```

No hay tests automatizados. La validación es manual: recargar la shell con `source ~/.zshrc` o `reload` y verificar que los comandos funcionen.
Manually validate by reloading the shell with `source ~/.zshrc` or `reload` and checking that commands work.

## Estructura y arquitectura
## Directory structure

```
dotfiles/
├── zsh/
│ ├── zshrc # Profile principal → symlink a ~/.zshrc
│ └── scripts/ # Scripts sourced desde zshrc
│ ├── agent-state.sh # Local CLI para cortex.agent_state.v1
│ ├── claude-helpers.zsh # cc, ccb, ccx, ccd, ccclip
│ ├── git-helpers.zsh # git-workdev, git-personaldev, git-whoami, clone-*
│ ├── herdr-helpers.zsh # hhere, hfocus, hside, hscratch, hremote, hname, whereami
│ ├── pc-helpers.zsh # is-pc-forbidden, is-pc-editable
│ ├── screenshots.zsh # ss, last, ssd, imgclip
│ ├── ssh-helpers.zsh # sshx, moshx helpers
│ ├── worktree-helpers.zsh # wtadd, wtlist, wtremove
│ ├── memsave-nudge.sh # Hook UserPromptSubmit para recordar mem_save
│ └── postcompact-hook.sh # Hook PostCompact con orden explícito
│ ├── zshrc # Main profile → symlinked to ~/.zshrc
│ └── scripts/ # Scripts sourced from zshrc
│ ├── pc-helpers.zsh # is-pc-forbidden, is-pc-editable (PC file detection)
│ ├── screenshots.zsh # ss, last, ssd, imgclip (screenshot helpers)
│ └── ssh-helpers.zsh # sshx, moshx helpers (SSH/remote shortcuts)
├── starship/starship.toml # Prompt → ~/.config/starship.toml
├── ghostty/
│ ├── config # Terminal → ~/.config/ghostty/config
│ ├── muxy.conf # Muxy integration config
│ └── shaders/ # 4 cursor shaders (glsl)
├── herdr/config.toml # Multiplexor → ~/.config/herdr/config.toml
│ ├── config # Terminal config → ~/.config/ghostty/config
│ └── shaders/ # Cursor shaders (4 glsl files)
├── herdr/config.toml # Multiplexer → ~/.config/herdr/config.toml
├── lazygit/config.yml # LazyGit → ~/.config/lazygit/config.yml
├── local/
│ └── env.zsh.example # Template para ~/.config/cortex-dots/local/env.zsh
├── fonts/
│ └── FiraCodeNerdFontMonoBeard-Reg.ttf # Terminal font
├── scripts/
│ ├── oss-audit.sh # OSS safety audit
│ ├── test-install.sh # Installation tests
│ └── check-agent-state.sh # Agent state validator
├── local/
│ └── env.zsh.example # Template for ~/.config/cortex-dots/local/env.zsh
├── bun/bunfig.toml # Bun defaults
├── npm/npmrc # NPM defaults
├── pnpm/rc # PNPM defaults
├── uv/uv.toml # UV defaults
└── install.sh # Instalador
├── scripts/
│ ├── test-install.sh # Installation tests
│ └── oss-audit.sh # OSS safety audit
└── install.sh # Installer
```

**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. Scripts en `zsh/scripts/` que son hooks de Claude Code (memsave-nudge.sh, postcompact-hook.sh) no se sourced desde zshrc, se usan directamente como hooks en la config de Claude Code.

**`~/.config/cortex-dots/local/env.zsh`** contiene paths personales, tokens y overrides de variables de entorno (`SCREENSHOTS_DIR`, `WORKSPACE_DIR`, `WORK_PROJECTS_DIR`, `CORTEX_HOME`, `CORTEX_ROOT`, `CORTEX_CONFIG_HOME`, `CORTEX_MULTIPLEXER`). 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)
**zshrc loading order:** Sections are split by `#region`/`#endregion`. The order matters: Setup → PATH → zsh options → Editor → Env vars → Aliases → Source scripts → Local overrides → Starship → Welcome.

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.
**`~/.config/cortex-dots/local/env.zsh`** contains personal paths, tokens and environment variable overrides (`SCREENSHOTS_DIR`, `WORKSPACE_DIR`, `WORK_PROJECTS_DIR`, `CORTEX_HOME`, `CORTEX_ROOT`, `CORTEX_CONFIG_HOME`, `CORTEX_MULTIPLEXER`). Generated from `env.zsh.example` on first install.

## Convenciones al editar
## Editing conventions

- 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 `~/.config/cortex-dots/local/env.zsh`.
- `install.sh` usa `set -e` y hace backup de configs existentes antes de copiar o linkear configs — mantener este comportamiento al agregar nuevas configs.
- `.zsh` scripts use `#region`/`#endregion` for logical groups.
- Each public function should have a comment explaining its use.
- Environment variables with defaults use `${VAR:-default}` for overrides from `~/.config/cortex-dots/local/env.zsh`.
- `install.sh` uses `set -e` and backs up existing configs before copying or symlinking — maintain this pattern when adding new configs.

## Agregar una nueva configuración
## Adding a new config

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
1. Create the config file in its directory (`name/config`)
2. Add backup + symlink in `install.sh` following the existing pattern
3. Update the README.md with the new entry in the structure table
23 changes: 1 addition & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Thanks for helping improve `cortex-dots`. This repository is public, but changes are intentionally gated because these dotfiles affect local shells, developer tooling, package-manager defaults, and AI CLI behavior.
Thanks for helping improve `cortex-dots`. This repository is public, but changes are intentionally gated because these dotfiles affect local shells, developer tooling, and package-manager defaults.

## Contribution Flow

Expand All @@ -19,7 +19,6 @@ All changes to `main` require maintainer review. This is especially important fo
- Shell startup files and helper scripts.
- Installer behavior.
- Package-manager configuration.
- AI CLI configuration or permission flags.
- GitHub Actions and repository governance files.
- Any file that could expose private paths, hostnames, emails, tokens, or machine-specific data.

Expand All @@ -30,26 +29,6 @@ All changes to `main` require maintainer review. This is especially important fo
- Keep examples generic and placeholder-based.
- Run the validation commands listed in `README.md` when touching scripts or config formats.

## Supply Chain Security

Any external tool, CLI, or dependency installed by `install.sh` or referenced in scripts must be pinned to a specific version. Do not use `latest`, `^ SemVer` ranges, or unpinned references in installation commands. Versions must be at least 15 days old before adoption — supply chain attacks typically target newly published releases.

```bash
# Good — pinned version, 15+ days old
curl -fsSL https://starship.rs/install.sh | sh -s -- -b "$HOME/.local/bin" -y --commit abc123

# Good — pinned package manager version
npm install -g some-cli@2.4.1

# Bad — no version pinning
curl -fsSL https://example.com/install | bash

# Bad — latest tag
npm install -g some-cli@latest
```

For GitHub Actions in workflows, always use explicit commit SHAs (`@commit-sha`) or pinned minor versions (`@v4`). Avoid `${{ github.sha }}` or floating tags in production workflows.

## Pull Request Expectations

Every PR should include:
Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ bash install.sh --check
| Shell | `zsh/zshrc`, `zsh/scripts/` |
| Terminal | `ghostty/config`, `ghostty/shaders/` |
| Prompt | `starship/starship.toml` using the generic `cortex_warm_slate` palette |
| Multiplexer | `herdr/config.toml` plus session helpers |
| AI CLI UX | Herdr helpers, agent-state docs |
| Multiplexer | `herdr/config.toml` |
| Package guardrails | global defaults for `npm`, `pnpm`, `bun`, and `uv` |

## Navigation Defaults
Expand Down Expand Up @@ -136,13 +135,6 @@ PY
bash install.sh --check
```

## Docs

- [Agent State v1](docs/agent-state-v1.md)
- [Herdr workflow](docs/herdr-workflow.md)
- [Keymaps](docs/keymaps.md)
- [Release checklist](docs/release-checklist.md)

## License

MIT. See [LICENSE](LICENSE).
Loading
Loading