Skip to content

fix(self-update): improve update UX on macOS#1872

Open
nadav-y wants to merge 1 commit into
microsoft:mainfrom
nadav-y:feat/default-registry-cli-routing
Open

fix(self-update): improve update UX on macOS#1872
nadav-y wants to merge 1 commit into
microsoft:mainfrom
nadav-y:feat/default-registry-cli-routing

Conversation

@nadav-y

@nadav-y nadav-y commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Two small quality-of-life fixes to the apm update flow on Unix.

Changes

Fix -e garbage output on macOS during self-update

_get_installer_run_command was invoking install.sh with /bin/sh. On macOS,
/bin/sh is bash 3.2 running in POSIX compatibility mode, where the echo builtin
does not recognize the -e flag and prints it literally — so every colored output
line printed with echo -e "..." appeared prefixed with -e in the terminal.
Switching to bash (via shutil.which("bash"), falling back to /bin/bash,
raising FileNotFoundError if neither exists) respects the script's own shebang
and fixes the output.

Show a progress bar during binary download

install.sh used curl --silent --show-error, which suppresses all output including the progress bar. Replacing --silent with --progress-bar gives users visual feedback during the download without adding verbose byte-count noise.

Notes

  • Windows (install.ps1) is unaffected — Invoke-WebRequest renders its own progress bar natively
  • Unit and integration tests for _get_installer_run_command updated to match new behavior

Copilot AI review requested due to automatic review settings June 21, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the Unix self-update experience by running the installer script under bash (to avoid macOS /bin/sh echo-flag behavior) and by showing a curl progress bar during downloads.

Changes:

  • Switch _get_installer_run_command() to prefer bash on Unix.
  • Update unit + integration tests to expect bash-based execution.
  • Replace curl --silent with curl --progress-bar for the public download path in install.sh.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/apm_cli/commands/self_update.py Updates the Unix installer runner to use bash.
tests/unit/test_update_command.py Adjusts helper tests for the new bash selection behavior.
tests/integration/test_commands_config_coverage.py Updates integration coverage assertion to require bash.
install.sh Enables a visible progress bar for the initial unauthenticated download.

Comment thread src/apm_cli/commands/self_update.py Outdated
Comment thread tests/unit/test_update_command.py
Comment thread install.sh
@nadav-y nadav-y force-pushed the feat/default-registry-cli-routing branch from 73a3727 to e25d228 Compare June 21, 2026 13:25
@nadav-y

nadav-y commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

This is how the old code looked like:

~ apm update
[!] 'apm update' refreshes APM dependencies. To update the CLI binary, use 'apm self-update'. Forwarding for back-compat (deprecated).
[i] Current version: 0.20.0
[>] Checking for updates...
[*] Latest version available: 0.21.0
[>] Downloading and installing update...
[*] Running installer...
-e
+--------------------------------------------------------------+
|                         APM Installer                        |
|              The NPM for AI-Native Development               |
+--------------------------------------------------------------+
-e
-e Detected platform: darwin-arm64
-e Target binary: apm-darwin-arm64.tar.gz
-e Note: Will need sudo permissions to install to /usr/local/bin
-e Fetching latest release information...
-e Latest version: v0.21.0
-e Download URL: https://github.com/microsoft/apm/releases/download/v0.21.0/apm-darwin-arm64.tar.gz
-e Downloading APM...
-e [+] Download successful
-e Extracting binary...
-e [+] Extraction successful
-e Testing binary...
-e [+] Binary test successful
-e Installing APM CLI to /usr/local/bin...
-e [+] APM installed successfully!
-e Version: Agent Package Manager (APM) CLI version 0.21.0 (975f8f0)
-e Location: /usr/local/bin/apm -> /usr/local/lib/apm/apm

-e Installation complete!

-e Quick start:
  apm init my-app          # Create a new APM project
  cd my-app && apm install # Install dependencies
  apm run                  # Run your first prompt

-e Documentation: https://github.com/microsoft/apm
-e Need help? Create an issue at https://github.com/microsoft/apm/issues
[*] Successfully updated to version 0.21.0!

New one doesn't have the -e prefix, plus (single line)

Downloading APM...
####################################################################################################################################################### 100.0%

Two QoL improvements to the Unix self-update flow:

- Invoke install.sh with bash instead of /bin/sh. On macOS, /bin/sh is
  bash 3.2 running in POSIX compatibility mode, where the echo builtin
  does not recognize the -e flag and prints it literally — prefixing
  every colored output line with `-e`. Using bash (via shutil.which with
  /bin/bash fallback, raising FileNotFoundError if neither exists) respects
  the script's shebang and produces clean output.

- Replace curl --silent with --progress-bar across all download paths in
  install.sh (unauthenticated, GitHub API, and direct URL with auth) so
  users get visual feedback during the binary download.

Windows (install.ps1) is unaffected: Invoke-WebRequest renders its own
progress bar natively and PowerShell is already invoked explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nadav-y nadav-y force-pushed the feat/default-registry-cli-routing branch from e25d228 to 9b93b2c Compare June 21, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants