Skip to content

fix(installer): auto-install Oh-My-Zsh when dotfiles reference it#42

Merged
fullstackjam merged 3 commits intomainfrom
claude/vibrant-hellman-a01130
Apr 22, 2026
Merged

fix(installer): auto-install Oh-My-Zsh when dotfiles reference it#42
fullstackjam merged 3 commits intomainfrom
claude/vibrant-hellman-a01130

Conversation

@fullstackjam
Copy link
Copy Markdown
Collaborator

Summary

  • Detect Oh-My-Zsh dependency from cloned dotfiles (zsh/.zshrc or .zshrc containing oh-my-zsh) and install OMZ before linking if it's missing.
  • Fixes broken shells after installing from a remote config whose snapshot has shell.oh_my_zsh: false but whose linked dotfiles source $ZSH/oh-my-zsh.sh.

Why

Installing via curl openboot.dev/<user> | bash with a published config that captured the snapshot while ~/.oh-my-zsh was absent left the installed .zshrc pointing at a non-existent OMZ:

~/.zshrc:source:75: no such file or directory: ~/.oh-my-zsh/oh-my-zsh.sh

planFromRemoteConfig only flips InstallOhMyZsh on when rc.Shell.OhMyZsh is true, so the dotfiles step would happily symlink a zshrc that required OMZ without ensuring OMZ was present.

Changes

  • internal/dotfiles/dotfiles.go: new ReferencesOMZ() helper that inspects the cloned repo for a zshrc sourcing oh-my-zsh (both stow and flat layouts).
  • internal/installer/step_shell.go: in applyDotfiles, between clone and link, install OMZ if the dotfiles reference it and it isn't already installed. Failure is reported as a soft error, consistent with the surrounding step.

Test plan

  • make test-unit
  • Manual: remote config with shell.oh_my_zsh:false + dotfiles sourcing OMZ → OMZ is installed, new terminal starts cleanly
  • Manual: remote config whose dotfiles don't reference OMZ → behavior unchanged (no OMZ install)
  • Dry-run still skips OMZ installation (guarded by !plan.DryRun)

When installing from a remote config whose snapshot has oh_my_zsh:false
but whose linked dotfiles contain a .zshrc that sources oh-my-zsh.sh,
the previous flow left the shell broken (`.zshrc: source: ... no such
file or directory: ~/.oh-my-zsh/oh-my-zsh.sh`) on every new terminal.

Detect this after cloning dotfiles: if the cloned repo contains a
.zshrc referencing oh-my-zsh and OMZ is not installed, install it
before linking.
@github-actions
Copy link
Copy Markdown

👋 Thanks for opening this pull request!

Before merging:

  • Code follows existing patterns in the codebase
  • go build ./... and go vet ./... pass
  • Commit message is clear and descriptive

@fullstackjam will review this soon. Thanks for contributing! 🚀

@github-actions github-actions Bot added the installer Package installation logic label Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 76.92308% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/dotfiles/dotfiles.go 84.21% 2 Missing and 1 partial ⚠️
internal/installer/step_shell.go 57.14% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Review feedback on #42:

- Tighten ReferencesOMZ to match a live `source ... oh-my-zsh.sh` line
  instead of any substring. Comment-only mentions (e.g. `# alias
  ohmyzsh="..."`) no longer trigger an unwanted install.
- Take dotfilesPath as an argument so ReferencesOMZ is testable without
  setenv'ing HOME; add DefaultPath() for the production caller.
- Skip the fallback install when plan.InstallOhMyZsh is already true —
  the shell step attempted it and failed, retrying just fails again.
- Add installOhMyZshFunc var seam so applyDotfiles can be unit-tested
  without downloading and executing the upstream OMZ script.
- Add table-driven tests for ReferencesOMZ (stow/flat/commented/alias-
  only/missing) and behavioural tests for applyDotfiles covering the
  install, skip, no-retry, and dry-run branches.
@github-actions github-actions Bot added the tests Tests only label Apr 22, 2026
The old-cli compat job selected stable[1] (second-newest release) and
then downloaded its darwin binary. When the asset for the chosen tag
has been removed from the release (e.g. v0.55.1 was deleted), the
download 404s and the job fails.

Filter the release list to releases that still have the expected
darwin-<arch> asset, then pick the most recent one. This self-heals
when any single release's binary is later removed.
@github-actions github-actions Bot added the ci CI/CD changes label Apr 22, 2026
@fullstackjam fullstackjam merged commit 4cb94c7 into main Apr 22, 2026
8 checks passed
@fullstackjam fullstackjam deleted the claude/vibrant-hellman-a01130 branch April 22, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD changes installer Package installation logic tests Tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant