feat: One-Click Installer for Heidi CLI#92
Conversation
🚀 Complete One-Click Installation System: • Single command installation: ./install • Automatic cloning from latest main branch • Dependency installation and virtual environment setup • Build and install Heidi CLI system-wide • Installation verification and cleanup 🖥️ Cross-Platform Support: • Linux/macOS: Bash script (install) • Windows: PowerShell script (install.ps1) • Automatic permission handling and PATH setup • User and system-wide installation options 📋 Comprehensive Installation Process: • System requirements validation (Python 3.10+, Git, pip) • Temporary directory creation and cleanup • Repository cloning from GitHub main branch • Virtual environment setup and activation • Dependency installation with pip • Heidi CLI build and installation • Installation verification and testing • Post-installation setup guidance 🎯 User Experience: • Beautiful colored output with progress indicators • Clear error messages and troubleshooting guidance • Automatic PATH configuration for user installations • Detailed installation logs and status updates • Success confirmation with next steps 📚 Complete Documentation: • INSTALL.md with comprehensive installation guide • System requirements and troubleshooting section • Post-installation quick start guide • Update and uninstallation instructions • Cross-platform compatibility notes 🔧 Features: • Permission detection and handling • Virtual environment isolation • Automatic cleanup of temporary files • Installation verification with heidi --version • Error handling with helpful messages • Force installation option for updates 🎉 Benefits: • Zero-configuration installation • Professional-grade installer experience • Works on all major platforms • No manual dependency management • Production-ready installation Users can now install Heidi CLI with a single command! curl -fsSL https://raw.githubusercontent.com/heidi-dang/heidi-cli/main/install | bash
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the user onboarding experience for Heidi CLI by introducing a robust, cross-platform one-click installer. The new system automates all necessary steps from dependency management to final installation and verification, making the CLI more accessible and easier to set up for new and existing users. This change aims to reduce friction and potential errors during the initial setup phase, allowing users to quickly get started with Heidi CLI's features. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a one-click installer for Heidi CLI on both Linux/macOS (bash) and Windows (PowerShell), along with comprehensive documentation. The scripts are well-structured and cover the main installation steps, from checking requirements to cleaning up. However, I've identified a few critical and high-severity issues in both scripts that need to be addressed. These include incorrect logic for system-wide installations in the bash script, flawed dependency checks, and broken error handling in the PowerShell script. I've also noted a documentation inconsistency. My feedback includes specific code suggestions to resolve these issues.
| if [[ $EUID -eq 0 ]]; then | ||
| print_warning "Running as root - installing system-wide" | ||
| INSTALL_PREFIX="/usr/local" | ||
| PIP_INSTALL_ARGS="--user" |
There was a problem hiding this comment.
When running as root for a system-wide installation, PIP_INSTALL_ARGS is incorrectly set to --user. The --user flag forces installation into the root user's home directory, which defeats the purpose of a system-wide installation to /usr/local. For a true system-wide installation as root, this variable should be empty.
| if [[ $EUID -eq 0 ]]; then | |
| print_warning "Running as root - installing system-wide" | |
| INSTALL_PREFIX="/usr/local" | |
| PIP_INSTALL_ARGS="--user" | |
| print_warning "Running as root - installing system-wide" | |
| INSTALL_PREFIX="/usr/local" | |
| PIP_INSTALL_ARGS="" |
| print_step "Building Heidi CLI..." | ||
|
|
||
| # Check if build tools are available | ||
| if command -v python3 -m build &> /dev/null; then |
There was a problem hiding this comment.
The check command -v python3 -m build is incorrect for verifying if the build module is available. command -v checks for an executable in the PATH, and python3 -m build is not a single command name. This check will always fail, causing the script to fall back to the legacy setup.py build method. A correct way to check for the module is to try executing it.
| if command -v python3 -m build &> /dev/null; then | |
| if python3 -m build --version &> /dev/null; then |
|
|
||
| try { | ||
| # Check if build tools are available | ||
| if (Get-Command "python -m build" -ErrorAction SilentlyContinue) { |
There was a problem hiding this comment.
The check Get-Command "python -m build" is incorrect for verifying if the build module is available. Get-Command looks for a command with that exact name, which doesn't exist. This will always cause the script to fall back to the legacy setup.py build method. A better approach is to try to execute python -m build --version and check its success.
if ($(try { & python -m build --version 2>$null; $true } catch { $false })) {
| if ($TempDir) { | ||
| Remove-TempFiles -TempDir $TempDir | ||
| } |
There was a problem hiding this comment.
The error handling logic is flawed due to variable scoping. The $TempDir variable is defined within the Main function's scope. When an error is caught by the top-level try/catch block, Handle-Error is called but cannot access $TempDir, so the cleanup of temporary files fails. To ensure cleanup always runs, $TempDir should be a script-scoped variable.
if ($script:TempDir) {
Remove-TempFiles -TempDir $script:TempDir
}
|
|
||
| # Run installation steps | ||
| Test-Requirements | ||
| $tempDir = New-TempDirectory |
| ### **User vs System Installation** | ||
|
|
||
| **User Installation (Default)** | ||
| - Installs to `~/.local/bin` (Linux/macOS) or `%USERPROFILE%\AppData\Local\Programs` (Windows) |
There was a problem hiding this comment.
The documentation states that the default user installation path for Windows is %USERPROFILE%\AppData\Local\Programs. However, the install.ps1 script defaults to installing in $env:USERPROFILE\heidi-cli. This discrepancy should be corrected to avoid confusing users.
| - Installs to `~/.local/bin` (Linux/macOS) or `%USERPROFILE%\AppData\Local\Programs` (Windows) | |
| - Installs to `~/.local/bin` (Linux/macOS) or `%USERPROFILE%\heidi-cli` (Windows) |
| # Add ~/.local/bin to PATH if not already there | ||
| if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then | ||
| export PATH="$HOME/.local/bin:$PATH" | ||
| echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc |
There was a problem hiding this comment.
This command appends the PATH export to ~/.bashrc every time the script is run, which can lead to duplicate entries. Additionally, it only targets bash, while many users (especially on macOS) now use other shells like zsh (~/.zshrc). A more robust approach would be to check if the line already exists before adding it and to inform the user about other shell configuration files.
| echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc | |
| grep -qF 'export PATH="$HOME/.local/bin:$PATH"' ~/.bashrc || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc |
🚀 One-Click Installer System
Users can now install Heidi CLI with a single command!
✅ Complete Installation System:
• Single command: ./install
• Automatic cloning from latest main branch
• Dependency installation and virtual environment setup
• Build and install Heidi CLI system-wide
• Installation verification and cleanup
🖥️ Cross-Platform Support:
• Linux/macOS: Bash script (install)
• Windows: PowerShell script (install.ps1)
• Automatic permission handling and PATH setup
• User and system-wide installation options
📋 Installation Process:
🎯 User Experience:
• Beautiful colored output with progress indicators
• Clear error messages and troubleshooting guidance
• Automatic PATH configuration for user installations
• Detailed installation logs and status updates
• Success confirmation with next steps
📚 Complete Documentation:
• INSTALL.md with comprehensive installation guide
• System requirements and troubleshooting section
• Post-installation quick start guide
• Update and uninstallation instructions
🔧 Usage Examples:
Quick install (Linux/macOS):
curl -fsSL https://raw.githubusercontent.com/heidi-dang/heidi-cli/main/install | bash
Download and run:
wget https://raw.githubusercontent.com/heidi-dang/heidi-cli/main/install
chmod +x install
./install
Windows PowerShell:
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/heidi-dang/heidi-cli/main/install.ps1' -OutFile 'install.ps1'
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\install.ps1
🎉 Benefits:
• Zero-configuration installation
• Professional-grade installer experience
• Works on all major platforms
• No manual dependency management
• Production-ready installation
This makes Heidi CLI accessible to everyone with a single command!