From 0312e600f205f068702d3d812ac1d95419a3b16f Mon Sep 17 00:00:00 2001 From: uroma Date: Thu, 22 Jan 2026 16:31:03 +0000 Subject: [PATCH] Fix: coding-helper detection and installation feedback Fixed 3 bugs related to coding-helper detection and installation: 1. Detection Bug: Wizard and bilingual checks only looked for 'chelper' command, but the npm package @z_ai/coding-helper doesn't create this command - it's run via 'npx @z_ai/coding-helper'. Fixed by adding 'npm list -g @z_ai/coding-helper' check to both: - wizard detection (line 505) - bilingual detection (line 542) 2. Misleading Success Message: When npm install failed, the script said "Installation completed. You can run manually with:" which sounded like it succeeded. Fixed by: - Capturing both stdout and stderr - Checking actual exit code - Showing "Installation failed!" with error output - Providing clearer manual installation instructions 3. No Installation Verification: After npm install appeared to succeed, there was no verification that the package was actually installed. Fixed by: - Adding npm list -g verification after install - Showing "installed and verified!" on success - Warning if installation appeared to succeed but verification failed Changes: - detect_coding_helper_components(): Added npm list check to wizard and bilingual detection - install_coding_helper(): Added error capture, exit code checking, verification step, and proper error messages - Removed misleading "chelper" command from success message (it's npx @z_ai/coding-helper, not chelper) Co-Authored-By: Claude --- install-claude-code.sh | 47 +++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/install-claude-code.sh b/install-claude-code.sh index b868b20..98cfcfd 100755 --- a/install-claude-code.sh +++ b/install-claude-code.sh @@ -502,7 +502,7 @@ detect_coding_helper_components() { fi # 2. Interactive wizard (part of core, but check if wizard can run) - if command -v chelper &> /dev/null; then + if command -v chelper &> /dev/null || npm list -g @z_ai/coding-helper &> /dev/null 2>&1; then status_json+='"wizard":true,' else status_json+='"wizard":false,' @@ -539,7 +539,7 @@ detect_coding_helper_components() { fi # 6. Bilingual interface (inherent to coding-helper) - if command -v chelper &> /dev/null; then + if command -v chelper &> /dev/null || npm list -g @z_ai/coding-helper &> /dev/null 2>&1; then status_json+='"bilingual":true,' else status_json+='"bilingual":false,' @@ -697,18 +697,41 @@ install_coding_helper() { fi # Install the helper - if npm install -g @z_ai/coding-helper 2>/dev/null; then - log_success "coding-helper installed successfully" - echo "" - echo -e "${CYAN}You can now run:${NC} ${YELLOW}chelper${NC} ${CYAN}or${NC} ${YELLOW}npx @z_ai/coding-helper${NC}" - echo "" - read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty - echo "" - if [[ $launch_helper =~ ^[Yy]$ ]]; then - launch_coding_helper + local install_output + install_output=$(npm install -g @z_ai/coding-helper 2>&1) + local install_exit_code=$? + + if [ $install_exit_code -eq 0 ]; then + # Verify installation + if npm list -g @z_ai/coding-helper &> /dev/null 2>&1; then + log_success "coding-helper installed and verified!" + echo "" + echo -e "${CYAN}You can now run:${NC} ${YELLOW}npx @z_ai/coding-helper${NC}" + echo "" + read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty + echo "" + if [[ $launch_helper =~ ^[Yy]$ ]]; then + launch_coding_helper + fi + else + log_warn "Installation appeared to succeed but verification failed" + echo "" + echo -e "${YELLOW}Installation output:${NC}" + echo "$install_output" + echo "" + echo -e "${CYAN}You can try running manually:${NC}" + echo -e " ${YELLOW}npx @z_ai/coding-helper${NC}" fi else - log_warn "Installation completed. You can run manually with:" + log_error "Installation failed!" + echo "" + echo -e "${YELLOW}Error output:${NC}" + echo "$install_output" + echo "" + echo -e "${CYAN}You can try installing manually:${NC}" + echo -e " ${YELLOW}npm install -g @z_ai/coding-helper${NC}" + echo "" + echo -e "${CYAN}Or run without installation:${NC}" echo -e " ${YELLOW}npx @z_ai/coding-helper${NC}" fi }