claude-code-updater
v1.0.3
Published
Auto-updater wrapper for Claude Code that checks for updates before execution
Maintainers
Readme
Claude Code Updater
A command-line tool that automatically manages and updates Claude Code installations with wrapper functionality.
Overview
Claude Code Updater solves the problem of manual Claude Code updates by automatically checking for and installing updates before each execution. It provides seamless auto-update functionality with cross-platform support and shell integration.
Features
- ✅ Auto-update Claude Code on each execution
- ✅ Cross-platform support (macOS, Linux, Windows)
- ✅ Automatic shell alias configuration (bash, zsh, fish, PowerShell)
- ✅ Smart update caching to avoid delays (1-hour cooldown)
- ✅ Version tracking and rollback capabilities
- ✅ Clean installation and uninstallation
- ✅ Error handling and logging
- ✅ Zero-configuration after installation
Installation
Via npm (Recommended)
npm install -g claude-code-updaterThe installation will automatically:
- Set up shell aliases for seamless integration
- Create configuration directories
- Initialize logging
Manual Installation
git clone https://github.com/0xRaghu/claude-code-updater.git
cd claude-code-updater
npm install
npm linkUsage
After installation, simply use claude as you normally would:
# Auto-updates and runs Claude Code
claude
# Pass any arguments to Claude
claude --resume
claude -p "Hello, world!"
# Skip update check for faster startup
claude --skip-updateHow It Works
- Update Check: When you run
claude, it first checks for Claude Code updates - Smart Caching: Updates are checked at most once per hour to avoid delays
- Auto-Update: If an update is available, it's installed automatically
- Execution: Your original command is passed through to the actual Claude Code
Configuration
Config File Location
- macOS/Linux:
~/.claude-code-updater/config.json - Windows:
%USERPROFILE%\.claude-code-updater\config.json
Settings
{
"settings": {
"updateCooldown": 3600000,
"maxVersionHistory": 10,
"enableLogging": true,
"autoUpdate": true
}
}Environment Variables
CLAUDE_UPDATER_DEBUG=true- Enable debug loggingCLAUDE_UPDATER_SKIP_UPDATE=true- Skip all update checks
Shell Integration
The installer automatically adds aliases to your shell configuration:
Bash/Zsh
alias claude='claude-code-updater'Fish
alias claude 'claude-code-updater'PowerShell
function claude { & claude-code-updater $args }Commands
Main Command
claude [arguments] # Auto-update and run Claude CodeUtility Commands
# Installation validation
npx claude-code-updater-install --validate
# Repair installation
npx claude-code-updater-install --repair
# Uninstall (preserve user data)
npm uninstall -g claude-code-updater
# Complete removal including user data
npx claude-code-updater-uninstall --cleanVersion Management
Rollback to Previous Version
const Updater = require('claude-code-updater/lib/updater');
const updater = new Updater('@anthropic-ai/claude-code', 'claude');
await updater.rollbackToPreviousVersion();Force Update
# Force update regardless of cooldown
CLAUDE_UPDATER_DEBUG=true claude --force-updateTroubleshooting
Common Issues
1. Claude not found after installation
# Check if Claude Code is installed
claude --version
# Install Claude Code if missing
npm install -g @anthropic-ai/claude-code2. Shell alias not working
# Restart terminal or reload shell config
source ~/.zshrc # or ~/.bashrc3. Permission errors
# Fix npm permissions (Unix-like systems)
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}Debug Mode
Enable debug logging to troubleshoot issues:
export CLAUDE_UPDATER_DEBUG=true
claude --helpLog Files
Check log files for detailed information:
# View recent logs
tail -f ~/.claude-code-updater/updater.log
# Clear logs
rm ~/.claude-code-updater/updater.logManual Shell Setup
If automatic shell integration fails, add this alias manually:
# Add to ~/.zshrc, ~/.bashrc, or equivalent
alias claude='claude-code-updater'Uninstallation
Method 1: Standard Uninstall (Recommended)
npm uninstall -g claude-code-updaterThis automatically removes:
- ✅ The npm package
- ✅ Shell aliases
- ✅ Binary files
- ⚠️ Preserves user data (
~/.claude-code-updater/)
Method 2: Complete Cleanup (If Standard Fails)
If the standard uninstall doesn't work completely, use our cleanup script:
# Download and run the cleanup script
curl -L https://raw.githubusercontent.com/0xRaghu/claude-code-updater/main/scripts/cleanup.js -o cleanup.js
node cleanup.js --clean
# Or if you have the package locally
npx claude-code-updater --cleanup --cleanMethod 3: Manual Cleanup
If both methods fail, manual cleanup:
# 1. Force remove npm package
npm uninstall -g claude-code-updater --force
# 2. Remove binary files
rm -f ~/.nvm/versions/node/*/bin/claude
rm -f ~/.nvm/versions/node/*/bin/claude-code-updater
sudo rm -f /usr/local/bin/claude
sudo rm -f /usr/local/bin/claude-code-updater
# 3. Remove shell aliases
# Edit ~/.bashrc, ~/.bash_profile, ~/.zshrc
# Remove lines containing "claude-code-updater" or "alias claude="
# 4. Remove user data (optional)
rm -rf ~/.claude-code-updater
# 5. Restart terminalVerification
After uninstallation, verify removal:
# Should show "command not found"
claude --version
# Should not list the package
npm list -g claude-code-updaterDevelopment
Setup Development Environment
git clone https://github.com/0xRaghu/claude-code-updater.git
cd claude-code-updater
npm install
npm linkRun Tests
npm testDebug Local Installation
CLAUDE_UPDATER_DEBUG=true node bin/claude-code-updater.js --helpContributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Requirements
- Node.js >= 14.0.0
- npm >= 6.0.0
- Internet connection for updates
License
MIT License - see LICENSE file for details.
Support
- Issues: GitHub Issues
- Documentation: GitHub Wiki
- Discussions: GitHub Discussions
Related Projects
- Claude Code - The official Claude Code
- npm-check-updates - Update package dependencies
Note: This tool is an unofficial wrapper for the Claude Code and is not affiliated with Anthropic.
