cli-standardization/CLAUDE.md
2026-04-23 12:40:21 -04:00

3.4 KiB

CLI Standardization

Ansible project to deploy a modern CLI environment (Fish + Starship + modern coreutils) to Arch and Ubuntu/Debian hosts. Includes optional Chezmoi dotfile orchestration.

What it installs

Phase 1 — packages and config templates:

  • Fish shell 4.x (PPA on Ubuntu, pacman on Arch)
  • Starship prompt (official binary installer)
  • fzf — fuzzy finder
  • zoxide — smarter cd
  • bat — cat with syntax highlighting
  • eza — modern ls
  • fd — modern find
  • ripgrep — fast grep
  • fastfetch — system info on login
  • Fisher plugin manager + plugins

Phase 2 — Chezmoi dotfile sync (opt-in):

  • Chezmoi — dotfile manager synced from Gitea
  • Manages: Fish config, Starship, Ghostty, Zellij
  • Machine-type aware: servers skip Ghostty/Zellij configs

Dev workflow

# Lint
ansible-lint playbook.yml

# Syntax check
ansible-playbook playbook.yml --syntax-check

# Dry run
ansible-playbook playbook.yml -i inventory.yml --check --diff

# Deploy (Phase 1 only — default)
ansible-playbook playbook.yml -i inventory.yml

# Deploy with Chezmoi (Phase 2)
ansible-playbook playbook.yml -i inventory.yml -e cli_modern_install_chezmoi=true -e cli_modern_chezmoi_repo=git@gitea:herbygitea/dotfiles.git

Role structure

roles/cli_modern/
├── defaults/main.yml          # All configurable variables
├── tasks/
│   ├── main.yml               # Task dispatcher
│   ├── packages-archlinux.yml # Arch/Manjaro packages
│   ├── packages-debian.yml    # Ubuntu/Debian packages + Fish PPA
│   ├── starship.yml           # Starship binary install
│   ├── fisher.yml             # Fisher + plugin sync
│   ├── config.yml             # Deploy config templates (Phase 1)
│   ├── default-shell.yml      # Set Fish as login shell
│   └── chezmoi.yml            # Chezmoi install + apply (Phase 2)
└── templates/
    ├── config.fish.j2         # Fish shell config
    ├── starship.toml.j2       # Starship prompt config
    └── fish_plugins.j2        # Fisher plugin list

Dotfiles repo (Phase 2)

Separate repo at /opt/projects/pbs-workshop/dotfiles/, to be pushed to Gitea. Contains placeholder configs — replace with real dotfiles before enabling Chezmoi.

dotfiles/
├── .chezmoi.toml.tmpl         # Prompted config (name, email, machine type)
├── .chezmoiignore             # Skips Ghostty/Zellij on servers
├── dot_config/
│   ├── fish/config.fish       # PLACEHOLDER
│   ├── fish/fish_plugins      # Fisher plugin list
│   ├── ghostty/config         # PLACEHOLDER (workstations only)
│   ├── starship.toml          # PLACEHOLDER
│   └── zellij/config.kdl      # PLACEHOLDER (workstations only)

Configuration

All options are in roles/cli_modern/defaults/main.yml. Override per-host in host_vars/ or per-group in group_vars/.

Phase 1 vs Phase 2 config management

Phase 1 deploys Fish/Starship configs via Ansible templates. Phase 2 uses Chezmoi from a Git repo. When enabling Chezmoi, set the Phase 1 template flags to false to avoid conflicts:

cli_modern_deploy_fish_config: false
cli_modern_deploy_starship_config: false
cli_modern_install_chezmoi: true
cli_modern_chezmoi_repo: "git@gitea:herbygitea/dotfiles.git"
cli_modern_chezmoi_machine_type: "workstation"  # or "server"