From 2be1093b919c6814c7df715ed1e5c3b05c890681 Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 13 Nov 2026 21:11:18 +0800 Subject: [PATCH] fix(cli): explain how to configure the installer PATH --- CHANGELOG.md | 2 ++ apps/cli/README.md | 4 +++- scripts/install.sh | 9 ++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6cc461c..1031d25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Changed +- **cli**: Show copyable commands and shell configuration instructions when the standalone CLI installation directory is missing from PATH. + ## [0.6.6] - 2026-11-13 ### Added diff --git a/apps/cli/README.md b/apps/cli/README.md index 91acb103..26e12170 100644 --- a/apps/cli/README.md +++ b/apps/cli/README.md @@ -32,12 +32,14 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://github.com/s Native builds use Bun 1.4.4's runtime; x64 CPUs need SSE4.2. See [Bun's system requirements](https://bun.com/docs/installation). Alpine/musl is not included in these native downloads. Native downloads are available for releases containing the installer assets; use npm for earlier releases. -On macOS/Linux the default directory is `~/.local/bin`. Add it to your shell's PATH if needed: +On macOS/Linux the default directory is `~/.local/bin`. If it is missing from your current PATH, the installer prints a command to run in your current Bash/Zsh terminal: ```sh export PATH="$HOME/.local/bin:$PATH" ``` +To keep the CLI available in future terminals, add the same export line to `~/.bashrc` (Bash) or `~/.zshrc` (Zsh). For Bash login shells, use your existing login profile, such as `~/.bash_profile` or `~/.profile`. Open a new terminal after saving. If you already added it, you do not need to add it again. For a custom installation directory, use the exact command printed by the installer. + On Windows the installer uses `%LOCALAPPDATA%\Shumai\bin` and updates the user PATH. Open a new terminal afterward. Administrator access is not required. Re-run the installer to upgrade. To pin a version, roll back, or choose an installation directory, download the installer and pass its options (replace `X.Y.Z` with a release containing native binaries): diff --git a/scripts/install.sh b/scripts/install.sh index 21d833ab..faca6585 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -84,7 +84,14 @@ main() { printf 'Installed shumai-cli %s to %s\n' "$version" "$destination" case ":${PATH:-}:" in *":$install_dir:"*) ;; - *) printf 'Add this directory to PATH in your shell configuration: %s\n' "$install_dir" ;; + *) + escaped_install_dir=$(printf '%s' "$install_dir" | sed "s/'/'\\\\''/g") + printf '\nTo use shumai-cli in this terminal (Bash/Zsh), run:\n' + printf " export PATH='%s':\"\$PATH\"\n" "$escaped_install_dir" + printf '\nFor future terminals, add that line to ~/.bashrc (Bash) or ~/.zshrc (Zsh).\n' + printf 'For Bash login shells, use your existing login profile\n(e.g. ~/.bash_profile or ~/.profile).\n' + printf 'Open a new terminal after saving. If already configured, skip this step.\n' + ;; esac resolved=$(command -v shumai-cli || true) if [ -n "$resolved" ] && [ "$resolved" != "$destination" ]; then