CodeVetter · Repo Unpack · Behavior traces
ohmyzsh/ohmyzsh
Three flows matter most. Startup: .zshrc -> oh-my-zsh.sh guards -> env defaults -> check_for_upgrade -> fpath/compinit -> lib -> plugins -> custom -> theme. Update: startup hook -> epoch/frequency gates -> GitHub API compare -> upgrade.sh git rebase -> epoch write -> optional exec. Config mutation: omz subcommand -> awk rewrite of .zshrc -> zsh -n validation -> rollback or reload. Install is a fourth boundary: curl|sh -> git init/fetch -> .zshrc template -> chsh -> exec zsh.
- Startup sequence in order: ZSH_VERSION guard with omz_ptree diagnostics -> `emulate` mode check -> ZSH/ZSH_CUSTOM/ZSH_CACHE_DIR defaults -> mkdir cache/completions + fpath -> source tools/check_for_upgrade.sh -> plugin dirs into fpath -> SHORT_HOST -> compinit/zcompdump -> _omz_source each lib/*.zsh -> each plugin -> each $ZSH_CUSTOM/*.zsh -> theme -> LS_COLORS zstyle.
- Auto-update trace: check_for_upgrade.sh resolves zstyle ':omz:update' mode (legacy DISABLE_UPDATE_PROMPT/DISABLE_AUTO_UPDATE mapped to auto/disabled) -> bails on disabled/unwritable/non-tty -> sources .zsh-update and returns early inside the frequency window (default 13 days) -> handle_update takes update.lock -> is_update_available -> prompt ('Would you like to update? [Y/n]') or silent modes -> update_ohmyzsh runs upgrade.sh.
- background-alpha update mode registers _omz_bg_update on precmd which forks handle_update and installs _omz_bg_update_status to report EXIT_STATUS/ERROR from .zsh-update on a later prompt.
- upgrade.sh execution order: re-exec under zsh if needed -> cd $ZSH -> parse -v/-i/-c flags -> rewrite legacy robbyrussell remotes -> set core.eol/autocrlf/fsck/rebase.autoStash git config -> checkout update branch -> git pull --rebase (or cooldown path: fetch + find first FETCH_HEAD commit older than cooldown days + merge --ff-only) -> run changelog.sh if interactive -> restore previous HEAD and autoStash.
- Insecure-completion handling: unless ZSH_DISABLE_COMPFIX=true, compfix.zsh is sourced, compinit runs with -i to skip insecure dirs, and handle_completion_insecurities lists `compaudit` output with a chmod g-w,o-w fix hint.
- `omz plugin disable git` trace: omz -> _omz::plugin -> _omz::plugin::disable validates names against $plugins -> builds gsub() awk program -> awk .zshrc > .zshrc.new -> cp .zshrc .zshrc.bck -> mv .zshrc.new .zshrc -> `zsh -n` check -> rollback mv on syntax error -> _omz::reload execs ${ZSH_ARGZERO:-zsh} (with -l for login shells).
- Git prompt render trace (async default on zsh >= 5.0.6): precmd -> _defer_async_git_register checks whether $(git_prompt_info)/$(git_prompt_status) appear in PS1/RPROMPT/etc -> _omz_register_handler -> _omz_async_request forks _omz_git_prompt_info -> _omz_async_callback fills _OMZ_ASYNC_OUTPUT -> zle reset-prompt -> git_prompt_info stub echoes the cached output.
- Install trace: main() detects non-tty stdin -> forces RUNZSH=no CHSH=no OVERWRITE_CONFIRMATION=no -> setup_ohmyzsh (umask g-w,o-w; git init; core.eol=lf, autocrlf=false, zeroPaddedFilemode ignores; fetch --depth=1; checkout $BRANCH) -> setup_zshrc (backup, sed template) -> setup_shell (locate zsh in /etc/shells, save old shell, sudo chsh) -> print_success -> exec zsh -l.
- `omz pr test 123` trace: URL basename normalized -> digit check -> git symbolic-ref saves current branch -> remote list scanned for ohmyzsh/ohmyzsh -> curl api.github.com/repos/ohmyzsh/ohmyzsh/pulls/123 -> 'testers needed' label check (jq or grep on node_id) -> typed 'yes' gate if unlabeled -> git fetch refs/pull/123/head:ohmyzsh/pull-123 -> rebase onto master with commit.gpgsign temporarily disabled -> `zsh -l` test shell -> optional checkout back.
- Uninstall trace: uninstall_oh_my_zsh -> tools/uninstall.sh restores shell from ~/.shell.pre-oh-my-zsh via chsh, confirms, rm -rf ~/.oh-my-zsh, renames ~/.zshrc to .zshrc.omz-uninstalled-<timestamp>, and restores .zshrc.pre-oh-my-zsh.