Skip to content

Installer's shell_config step always re-appends to ~/.zshrc — no opt-out for managed shells #137

@presempathy-awb

Description

@presempathy-awb

The installer's shell-configuration step unconditionally appends # Pilot Shell + export PATH=... + alias pilot + alias ccp to every detected shell config file on every install/update, with no way to opt out for users whose shells are managed by a framework or templating system.

Where

installer/installer/steps/shell_config.pyShellConfigStep:

  • check() always returns False (line 145), so the step always runs.

  • run() (lines 160–186) iterates over each config file and writes the alias block:

    alias_existed = alias_exists_in_file(config_file)
    if alias_existed:
        remove_old_alias(config_file)
    ...
    with open(config_file, "a") as f:
        f.write(f"\n{alias_lines}\n")

    Even when remove_old_alias strips the matching lines, line 173 immediately re-appends them.

Impact

Users with managed/templated shell configs — where Pilot's PATH/aliases belong in a different file (e.g. a framework env.zsh / aliases.zsh sourced by the user's ~/.zshrc) — see the same four lines re-appended on every install or pilot self-update. They have to keep cleaning them up, which can interact badly with framework startup (in my case, the lines triggered an alias-vs-function parse-time collision).

Repro

  1. Install pilot-shell.
  2. Edit ~/.zshrc to remove the appended # Pilot Shell block (or move its contents elsewhere).
  3. Run pilot self-update (or re-run the installer).
  4. The four lines are appended again.

Suggested fixes (any one of these would solve it)

  1. Sentinel comment: skip a config file if it already contains a marker like # pilot-shell:managed-elsewhere (caller declares the install is handled by a framework).
  2. Config flag: honor ~/.pilot/config.json -> installer.skipShellConfig: true.
  3. Idempotency: skip if a working pilot is already on PATH and an active pilot alias/function/command resolves correctly — the step has nothing to do.

Happy to send a PR if option 1 or 2 sounds acceptable.

Environment

  • pilot-shell installer (current version per ~/.pilot/installer/installer/__init__.py)
  • Shell: zsh on Linux
  • Framework that owns ~/.zshrc: zshand

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions