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 }