Skip to content

Add cross-shell auto-install for copilot_here integrations (--install-shells) #37

@GordonBeeming

Description

@GordonBeeming

Problem / Background:
Users install copilot_here from one shell (e.g., zsh), but switching to other shells (bash) or Windows environments (PowerShell vs pwsh vs cmd) often results in the commands not being available
because profiles/wrappers aren’t installed everywhere and/or the user bin folder isn’t on PATH.

Objective / User Story:
As a developer using copilot_here across multiple shells, I want a fast, built-in way for the native CLI to detect missing shell integrations and install them into all applicable startup
locations so that copilot_here/copilot_yolo work consistently in bash, zsh, fish, PowerShell, and cmd.

Scope:

  • Add a native CLI option to install shell integrations into all applicable locations (cross-platform).
  • Ensure the user bin directory is on PATH so the installed binary/wrappers are discoverable.
  • Provide a lightweight startup warning when integrations are missing.

Out of Scope:

  • Supporting additional shells beyond bash/zsh/fish on macOS/Linux.
  • Git Bash / WSL integration on Windows (unless explicitly added later).
  • System-wide installs requiring admin permissions.

Acceptance Criteria

  • New CLI option exists: Running copilot_here --install-shells installs shell integrations.
  • Fast startup detection: On normal runs, the native CLI performs a quick check and, if integrations are missing, prints a short warning with the exact command to run (--install-shells).
    • Must not noticeably slow down startup (no long network calls).
  • macOS/Linux integrations installed:
    • Ensures ~/.local/bin is present in PATH via shell startup config (only if missing).
    • Ensures bash startup loads integration (e.g., .bashrc/.bash_profile/.profile as appropriate).
    • Ensures zsh startup loads integration (e.g., .zshrc/.zprofile as appropriate).
    • Ensures fish integration exists under ~/.config/fish/conf.d/ and provides copilot_here/copilot_yolo.
  • Windows integrations installed:
    • Ensures both Windows PowerShell and PowerShell 7+ profiles dot-source the copilot PowerShell script.
    • Ensures %USERPROFILE%.local\bin is present in user PATH (best-effort, non-admin).
    • Installs copilot_here.cmd and copilot_yolo.cmd wrappers that proxy into PowerShell logic (preferring pwsh if available, else powershell).
  • Idempotent: Re-running --install-shells does not duplicate blocks/lines in profiles.
  • User messaging is minimal: Warning and success messages are brief and actionable.
  • Documentation updated: README includes the --install-shells workflow and clarifies expected behavior.

Implementation Notes

  • Use explicit marker blocks in profiles to detect and avoid duplicate installs.
  • Prefer a shared base implementation (PowerShell script for Windows logic; .copilot_here.sh for bash/zsh base) and have fish/cmd proxy into those to avoid duplicated logic.

Tasks

  • Add --install-shells option to the native CLI and wire it into the default command.
  • Implement platform-specific installer:
    • Unix: profile edits + fish conf.d file
    • Windows: profile edits + user PATH update + cmd wrappers
  • Add startup “missing integration” detection and warning.
  • Update README with the new install path.
  • Add/adjust unit tests validating the new option appears in help output.

Definition of Done

  • All acceptance criteria met.
  • Version bumped consistently across required files.
  • Build passes locally.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions