Skip to content

chore: dotfiles cleanup and portability fixes#19

Open
simonasr wants to merge 9 commits intomasterfrom
feature/dotfiles-cleanup
Open

chore: dotfiles cleanup and portability fixes#19
simonasr wants to merge 9 commits intomasterfrom
feature/dotfiles-cleanup

Conversation

@simonasr
Copy link
Owner

@simonasr simonasr commented Mar 9, 2026

Summary

  • Bug fixes: broken zsh syntax, wrong username in gitconfig safe.directory, hardcoded rbenv PATH
  • Portability: existence guards on all external source calls, $HOME/$USER instead of hardcoded paths in install scripts
  • Deprecated: removed EOL OpenSSL 1.1 workaround, deprecated homebrew/cask-fonts tap
  • Cleanup: removed dead check_overcommit() + precmd() code, commented-out tfenv/terragrunt lines, redundant f_hammerspoon_init.lua config.yaml entry, and orphan windows.lua_ / windows-bindings-defaults.lua_ files

Test plan

  • Open a new terminal — zsh should start without errors
  • Run dotdrop install -p <profile> — no conflicts from config.yaml changes
  • Confirm ~/.gitconfig has safe.directory = ~/.goenv
  • Verify bash -n install/brew-install.sh passes syntax check

Co-Authored-By: Claude AI

Bug fixes:
- zshrc: remove broken DEFAULT_USER=whoami`` syntax (unused var)
- zshrc: fix hardcoded rbenv PATH to use $HOME
- gitconfig: fix safe.directory wrong username (sirup -> ~/.goenv)

Portability:
- zshrc: add existence guards to all external source calls
  (fzf-tab, .zsh_env_vars, .zsh_vinted_aliases, dev-tools)
- zshrc: guard thefuck eval with command -v check
- mac-bootstrap.sh: replace hardcoded /Users/simonas.rupsys with $HOME
- git-clone-installs.sh: replace hardcoded username with $USER

Deprecated/outdated:
- brew-install.sh: remove deprecated homebrew/cask-fonts tap
- zshrc: remove EOL OpenSSL 1.1 workaround

Cleanup:
- zshrc: remove dead check_overcommit() function and empty precmd()
- zshrc: remove commented-out terragrunt/tfenv lines
- config.yaml: remove redundant f_hammerspoon_init.lua entry
- hammerspoon: delete orphan windows.lua_ and windows-bindings-defaults.lua_

Co-Authored-By: Claude AI
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to improve dotfiles portability and reduce setup friction by removing hardcoded user paths, adding guards around optional shell integrations, and cleaning up dotdrop configuration entries.

Changes:

  • Replace hardcoded usernames/paths in install scripts and shell config with $HOME / $USER.
  • Add file-existence checks before sourcing optional zsh plugins/scripts and guard thefuck initialization.
  • Clean up dotdrop config.yaml (remove redundant Hammerspoon init mapping) and adjust git safe.directory.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
install/mac-bootstrap.sh Uses $HOME for writing brew shellenv into the user’s zprofile.
install/git-clone-installs.sh Replaces hardcoded username in chown with $USER.
install/brew-install.sh Removes the homebrew/cask-fonts tap and installs Fira Code cask directly.
dotfiles/zshrc Adds guards around optional source calls and thefuck; updates rbenv PATH.
dotfiles/gitconfig Updates safe.directory to use ~/.goenv instead of a hardcoded home path.
config.yaml Removes redundant explicit mapping for ~/.hammerspoon/init.lua and profile reference.
Comments suppressed due to low confidence (1)

dotfiles/zshrc:147

  • rbinit/goinit are executed unconditionally, but the install scripts in this repo don't install rbenv or goenv (and goenv clone is commented out), so a fresh terminal session can error with "command not found". Consider guarding these initializations with command -v rbenv/goenv checks, similar to the thefuck guard.
# init all envs
alias init='pyinit;rbinit;goinit'
# pyinit
rbinit
goinit

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

insteadOf = git://github.com/
[safe]
directory = /Users/sirup/.goenv
directory = ~/.goenv
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safe.directory expects an absolute path in many Git versions; ~ is not consistently expanded for this setting, which can leave the repo still treated as unsafe. To keep this portable, consider setting this value via an install step that writes the absolute $HOME/.goenv path (e.g., git config --global --add safe.directory ...) or use dotdrop templating to render an absolute path per machine.

Copilot uses AI. Check for mistakes.
echo 'Installing Homebrew'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/simonas.rupsys/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This append is not idempotent: re-running the bootstrap will keep adding another identical brew shellenv line to ~/.zprofile. Consider only adding it if it's not already present (e.g., grep check) or using a managed block.

Suggested change
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
if ! grep -q 'eval "$(/opt/homebrew/bin/brew shellenv)"' "$HOME/.zprofile" 2>/dev/null; then
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
fi

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +4
sudo chown -R "$USER" ~/.config/
sudo chown -R "$USER" ~/.local/share
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this script is ever executed under sudo, $USER will typically be root, so these chown calls would incorrectly change ownership to root. Prefer using ${SUDO_USER:-$USER} (or similar) to ensure ownership is set back to the invoking user.

Suggested change
sudo chown -R "$USER" ~/.config/
sudo chown -R "$USER" ~/.local/share
sudo chown -R "${SUDO_USER:-$USER}" ~/.config/
sudo chown -R "${SUDO_USER:-$USER}" ~/.local/share

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +86
[ -f ~/.zsh_env_vars ] && source ~/.zsh_env_vars
source ~/.zsh_git_aliases
source ~/.zsh_vinted_aliases
[ -f ~/.zsh_vinted_aliases ] && source ~/.zsh_vinted_aliases
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This source is still unconditional. In config.yaml, f_zsh_git_aliases is only installed for some profiles (e.g. Simonass-MacBook-Pro.local) and not for others (e.g. Simonass-Air.lan), so zsh can error on startup. Either guard it with -f like the other source calls, or ensure the dotfile is included in every profile that installs f_zshrc.

Copilot uses AI. Check for mistakes.
simonasr added 2 commits March 9, 2026 14:48
rbenv requires both shims and bin on PATH to intercept ruby commands.
Previously only bin was set, matching pyenv's pattern but missing shims.

Co-Authored-By: Claude AI
- brew-install.sh: install hammerspoon as --cask (GUI app, not formula)
- zshrc: simplify vi alias to use PATH-resolved nvim instead of hardcoded brew path
- zshrc: resolve nomad completion binary via command -v instead of hardcoded path
- install scripts: add set -e so failures abort rather than silently continue

Co-Authored-By: Claude AI
@simonasr simonasr force-pushed the feature/dotfiles-cleanup branch from 2a35cee to 91bbd55 Compare March 9, 2026 12:52
simonasr and others added 6 commits March 9, 2026 15:00
rbenv/goenv/pyenv shims are already on PATH so commands work without
full init. Removes ~200-300ms from shell startup. Use initenvs alias
when shell integration (rbenv shell, completions) is needed.

Co-Authored-By: Claude AI
- zshrc: add goenv shims to PATH (same fix as rbenv)
- zshrc: convert sr alias to function (supports $@), drop broken $@ from p2/ll
- zshrc: remove stale commented-out rbenv init line
- brew-install.sh: rename neovim -> pynvim (package renamed in 2019)

Co-Authored-By: Claude AI
- README: document correct install command requiring $PWD/config.yaml
  (dotdrop.sh changes cwd at runtime so relative paths don't resolve)
- README: fix typo in bootstrap command (.h -> .sh)
- README: add instructions for adding a new machine profile
- config.yaml: add instignore for .DS_Store to keep hammerspoon dir clean

Co-Authored-By: Claude AI
- Add TMPDIR fix for macOS (ensures kitty inherits correct temp dir)
- Add sj() SSH jump function via janitor1
- Add make=gmake alias
- Add ~/.local/bin to PATH
- Add opencode binary path

Co-Authored-By: Claude AI
gitconfig:
- Add GPG signing key and gpgSign = true
- Add /terraform-vault as safe directory

gitignore:
- Add .cursor to global gitignore

hammerspoon/init.lua:
- Restore VSCode on v, Cursor on r, add kitten quick-access-terminal on l

Co-Authored-By: Claude AI
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants