Overview
Theupdate command checks for the latest version of Ahh CLI and updates it automatically. It fetches the latest release from GitHub and runs the installation script.
Syntax
Parameters
This command takes no parameters.Usage Examples
Output
Already Up to Date
If you’re running the latest version:Update Available
If a newer version exists:Manual Update Instructions
If the automatic update fails:How It Works
Update Process
-
Check Latest Release
- Fetches GitHub releases page
- Follows redirect to latest release
- Extracts version number from URL
-
Version Comparison
- Compares current version with latest
- Uses semantic versioning (semver) comparison
- Determines if update is needed
-
Installation
- Downloads installation script if update needed
- Executes script with bash
- Replaces current binary
Version Detection
The command uses GitHub’s redirect behavior:ahh_v{version}
Semantic Versioning
Version Format
Comparison Rules
- Compares major version first
- Then minor version
- Finally patch version
1.0.6<1.0.7(patch update)1.0.6<1.1.0(minor update)1.0.6<2.0.0(major update)1.0.6=1.0.6(no update)
Installation Script
The update runs the official installation script:What the Script Does
- Detects your operating system and architecture
- Downloads the appropriate binary
- Installs to
/usr/local/bin/ahh(or platform equivalent) - Sets executable permissions
- Verifies installation
The installation script may require sudo permissions depending on your system configuration.
Error Handling
Network Errors
If the update check fails due to network issues:Invalid Response
If GitHub returns an unexpected response:- Missing redirect (not 302)
- Missing location header
- Invalid version format
- Non-semver version
Installation Failure
If the installation script fails:- Permission denied (need sudo)
- Network interruption
- Disk space issues
Manual Update
If automatic update fails, update manually:Version Checking
Check Current Version
The
--version flag is hidden in the help output but still functional.Release Page
View all releases:Update Frequency
It’s recommended to update regularly to get:
- New features
- Bug fixes
- Security patches
- Performance improvements
Checking for Updates
Runahh update periodically:
- After seeing a new release announcement
- When encountering bugs (may be fixed in newer version)
- Before starting a new project
- As part of your tool maintenance routine
Technical Details
HTTP Redirect Handling
The update check uses:Location header.
Version Regex
tag/ahh_v1.0.6✓tag/ahh_v2.1.0✓tag/v1.0.6✗ (missingahh_prefix)
Installation Script Execution
-f: Fail silently on HTTP errors-s: Silent mode (no progress bar)-S: Show errors even in silent mode-L: Follow redirects
Exit Codes
0: Success (updated or already latest version)Non-zero: Update failed
Notes
The update command preserves your configuration file (
~/.ahh/config.json). Your webhooks, workspaces, and settings are not affected.Troubleshooting
Permission Denied
Network Issues
Version Not Detected
If the version check fails:- Check internet connection
- Verify GitHub is accessible
- Try manual update
Related Commands
- workspace - Workspace templates may be updated in new versions
