From 1e2054dcd297686cf1092834e8d330c4aaa41883 Mon Sep 17 00:00:00 2001 From: uroma Date: Thu, 22 Jan 2026 16:41:15 +0000 Subject: [PATCH] Fix: Make sudo/install prompts more prominent with defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root Cause: The sudo and install prompts were not visually prominent, causing users to miss them or not respond clearly. Additionally, the prompts had [Y/n] format but didn't default to Yes on Enter. Changes: 1. Main install prompt (line 674-676): - Added prominent MAGENTA boxed prompt - "Install Z.AI coding-helper now? [Y/n]" - Defaults to Yes when user presses Enter - Visual box makes it stand out from other output 2. Sudo retry prompt (line 747-748): - Added prominent YELLOW boxed prompt - "Try installing with sudo now? [Y/n] (recommended)" - Defaults to Yes when user presses Enter - Clear "(recommended)" label 3. Default handling: - Changed from `[y/N]` to `[Y/n]` (Yes is default) - Added check for empty input (Enter key) to treat as Yes - `if [[ -z "$var" ]] || [[ $var =~ ^[Yy]$ ]]` Example output: ═══════════════════════════════════════════════════════════ Install Z.AI coding-helper now? [Y/n] ═══════════════════════════════════════════════════════════ This makes it much harder to miss the prompts and provides a better user experience by accepting Enter as "Yes" (the common case). Co-Authored-By: Claude --- install-claude-code.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/install-claude-code.sh b/install-claude-code.sh index 0de0def..ea2958e 100755 --- a/install-claude-code.sh +++ b/install-claude-code.sh @@ -670,15 +670,20 @@ offer_coding_helper_addons() { fi # Core not installed, offer installation - read -p "Install Z.AI coding-helper? [y/N] " -n 1 -r install_helper < /dev/tty + echo "" + echo -e "${BOLD}${MAGENTA}═══════════════════════════════════════════════════════════${NC}" + echo -e "${BOLD}${MAGENTA} Install Z.AI coding-helper now?${NC} ${GREEN}[Y/n]${NC}" + echo -e "${BOLD}${MAGENTA}═══════════════════════════════════════════════════════════${NC}" + read -p " " -n 1 -r install_helper < /dev/tty echo "" - if [[ ! $install_helper =~ ^[Yy]$ ]]; then + # Default to Yes if user just presses Enter + if [[ -z "$install_helper" ]] || [[ $install_helper =~ ^[Yy]$ ]]; then + install_coding_helper + else log_info "Skipping coding-helper installation" return fi - - install_coding_helper } install_coding_helper() { @@ -743,10 +748,13 @@ install_coding_helper() { echo -e "${GREEN}Option 3: Run without installation (works immediately)${NC}" echo -e " Just use: ${YELLOW}npx @z_ai/coding-helper${NC}" echo "" - echo -e "${CYAN}Want to try with sudo now? [y/N]${NC}" + echo -e "${BOLD}${YELLOW}═══════════════════════════════════════════════════════════${NC}" + echo -e "${BOLD} Try installing with sudo now?${NC} ${GREEN}[Y/n]${NC} ${BOLD}(recommended)${NC}" + echo -e "${BOLD}${YELLOW}═══════════════════════════════════════════════════════════${NC}" read -p " " -n 1 -r use_sudo < /dev/tty echo "" - if [[ $use_sudo =~ ^[Yy]$ ]]; then + # Default to Yes if user just presses Enter + if [[ -z "$use_sudo" ]] || [[ $use_sudo =~ ^[Yy]$ ]]; then echo "" log_info "Installing with sudo..." if sudo npm install -g @z_ai/coding-helper 2>&1; then