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 <noreply@anthropic.com>
This commit is contained in:
@@ -502,7 +502,7 @@ detect_coding_helper_components() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 2. Interactive wizard (part of core, but check if wizard can run)
|
# 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,'
|
status_json+='"wizard":true,'
|
||||||
else
|
else
|
||||||
status_json+='"wizard":false,'
|
status_json+='"wizard":false,'
|
||||||
@@ -539,7 +539,7 @@ detect_coding_helper_components() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 6. Bilingual interface (inherent to coding-helper)
|
# 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,'
|
status_json+='"bilingual":true,'
|
||||||
else
|
else
|
||||||
status_json+='"bilingual":false,'
|
status_json+='"bilingual":false,'
|
||||||
@@ -697,18 +697,41 @@ install_coding_helper() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Install the helper
|
# Install the helper
|
||||||
if npm install -g @z_ai/coding-helper 2>/dev/null; then
|
local install_output
|
||||||
log_success "coding-helper installed successfully"
|
install_output=$(npm install -g @z_ai/coding-helper 2>&1)
|
||||||
echo ""
|
local install_exit_code=$?
|
||||||
echo -e "${CYAN}You can now run:${NC} ${YELLOW}chelper${NC} ${CYAN}or${NC} ${YELLOW}npx @z_ai/coding-helper${NC}"
|
|
||||||
echo ""
|
if [ $install_exit_code -eq 0 ]; then
|
||||||
read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty
|
# Verify installation
|
||||||
echo ""
|
if npm list -g @z_ai/coding-helper &> /dev/null 2>&1; then
|
||||||
if [[ $launch_helper =~ ^[Yy]$ ]]; then
|
log_success "coding-helper installed and verified!"
|
||||||
launch_coding_helper
|
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
|
fi
|
||||||
else
|
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}"
|
echo -e " ${YELLOW}npx @z_ai/coding-helper${NC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user