Skip to content

fix: setup.zsh calls info before any file that defines it is sourced #165

@ooloth

Description

@ooloth

Why

On a fresh machine — the exact context where setup.zsh runs — the info helper is not yet in the shell environment, so the script can crash with command not found: info at the end of an otherwise successful run.

Current state

features/setup/setup.zsh calls info "🎉 Setup complete!" on line 129. The info function is defined in tools/zsh/utils.zsh and tools/bash/utils.bash, but setup.zsh never sources either file. The script also uses info indirectly via the files it sources (features/install/zsh/ssh.zsh line 16, features/install/zsh/github.zsh line 9, features/install/zsh/content.zsh line 15). On a machine where dotfiles are not yet symlinked and the full Zsh environment is not loaded, all of these calls fail with command not found: info.

Ideal state

  • setup.zsh sources tools/zsh/utils.zsh (or an equivalent helper) near the top, before any call to info, error, or other utilities from that file.
  • Running setup.zsh on a fresh machine with no prior dotfiles symlinks completes without a command not found error on info.
  • If sourcing the utils file is not feasible at that point in the script, the calls to info are replaced with plain printf statements as a fallback.

Out of scope

  • Adding a full fallback shim for every utility in utils.zsh — the minimal fix is either sourcing the file early or replacing only the info calls with printf.
  • Changes to the sourced install scripts (ssh.zsh, github.zsh, etc.) beyond what is necessary to make setup.zsh work on a fresh machine.

Starting points

  • features/setup/setup.zsh — line 4 sets $DOTFILES; line 129 calls info; no source of any utils file appears anywhere in the file.
  • tools/zsh/utils.zsh — defines info() at line 84; this is the canonical source for the function.
  • features/install/zsh/ssh.zsh, github.zsh, content.zsh — each calls info without sourcing the utils file, relying on the ambient shell environment to provide it.

QA plan

  1. Open a fresh zsh session with no dotfiles sourced (e.g. env -i HOME=$HOME zsh --no-rcs) and source setup.zsh — expect no command not found: info error at any point during execution.
  2. Confirm the "🎉 Setup complete!" message is visible in the terminal output.
  3. Run zsh -n features/setup/setup.zsh — expect no syntax errors.

Done when

setup.zsh runs to completion on a shell with no pre-loaded dotfiles environment without producing a command not found: info error.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions