Skip to content

Instantly share code, notes, and snippets.

@zonca
Last active April 28, 2026 15:56
Show Gist options
  • Select an option

  • Save zonca/9a782adfefe29af8d68558b206517f64 to your computer and use it in GitHub Desktop.

Select an option

Save zonca/9a782adfefe29af8d68558b206517f64 to your computer and use it in GitHub Desktop.
AI Tools Updater - Shell function to update all AI coding assistants at once

AI Tools Updater

A shell function that updates all your AI coding assistants and tools in one command.

Features

  • Updates multiple AI coding tools via npm and native CLI commands
  • Shows before/after version comparison for all tools
  • Handles both npm packages and standalone CLI tools
  • Supports apt system package upgrades

Supported Tools

Tool Package Description
Qwen Code @qwen-code/qwen-code Alibaba's AI coding assistant
Cline cline Autonomous coding agent
Claude claude (CLI) Anthropic's Claude Code
Gemini CLI @google/gemini-cli Google's AI assistant
Codex @openai/codex OpenAI's code model
Crush @charmland/crush AI coding tool
OpenCode AI opencode-ai AI code generator
Bitwarden @bitwarden/cli Password manager CLI
GitHub Copilot @github/copilot GitHub AI pair programmer

Installation

Add the up() function to your ~/.bashrc or ~/.bash_aliases:

# Clone or copy the up.sh content
curl -o ~/.up.sh https://gist.githubusercontent.com/zonca/9a782adfefe29af8d68558b206517f64/raw/up.sh

# Add to your shell config
echo 'source ~/.up.sh' >> ~/.bashrc
source ~/.bashrc

Usage

Run the up command to update all tools:

up

Example Output

Checking current versions...
Fetching apt upgrade info...
Starting system and package updates...

--- Update Report ---
Package                        | Old             -> New            
------------------------------------------------------------------------
npm:@google/gemini-cli         | 0.39.1          -> 0.39.1         
npm:@openai/codex              | 0.125.0         -> 0.125.0        
npm:cline                      | 2.15.0          -> 2.17.0         
npm:@bitwarden/cli             |                 -> 2026.4.1       
npm:@github/copilot            | 1.0.11          -> 1.0.38         
claude                         | 2.1.121         -> 2.1.121        

Customization

Edit the npm_pkgs array in the function to add or remove packages:

local npm_pkgs=("@google/gemini-cli" "@openai/codex" "opencode-ai" "@charmland/crush" "@qwen-code/qwen-code" "cline" "@bitwarden/cli" "@github/copilot")

Requirements

  • Node.js/npm (for npm packages)
  • curl/wget (for installation)

License

MIT

up() {
local npm_pkgs=("@google/gemini-cli" "@openai/codex" "opencode-ai" "@charmland/crush" "@qwen-code/qwen-code" "cline" "@bitwarden/cli" "@github/copilot")
declare -A old_vers
echo "Checking current versions..."
# Track npm versions
for p in "${npm_pkgs[@]}"; do
old_vers["npm:$p"]=$(npm list -g $p --depth=0 2>/dev/null | grep $p | rev | cut -d@ -f1 | rev || echo "N/A")
done
# Track Claude CLI version
old_vers["claude"]=$(claude --version 2>/dev/null | head -1 || echo "N/A")
# Track apt upgradable versions
echo "Fetching apt upgrade info..."
sudo apt update > /dev/null
local apt_upgradable=$(apt list --upgradable 2>/dev/null | grep '/')
echo "Starting system and package updates..."
sudo apt upgrade -y && npm install -g "${npm_pkgs[@]}" --force
# Update Claude CLI
claude upgrade 2>/dev/null || true
# Update GitHub Copilot CLI
copilot extension upgrade 2>/dev/null || true
echo -e "\n--- Update Report ---"
printf "%-30s | %-15s -> %-15s\n" "Package" "Old" "New"
echo "------------------------------------------------------------------------"
# Report apt packages that were upgraded
if [ -n "$apt_upgradable" ]; then
while read -r line; do
local pkg_name=$(echo "$line" | cut -d/ -f1)
local old_v=$(echo "$line" | awk '{print $6}' | tr -d '[]')
local new_v=$(echo "$line" | awk '{print $2}')
printf "%-30s | %-15s -> %-15s\n" "apt:$pkg_name" "$old_v" "$new_v"
done <<< "$apt_upgradable"
fi
# Report npm packages
for p in "${npm_pkgs[@]}"; do
local new_v=$(npm list -g $p --depth=0 2>/dev/null | grep $p | rev | cut -d@ -f1 | rev || echo "N/A")
printf "%-30s | %-15s -> %-15s\n" "npm:$p" "${old_vers["npm:$p"]}" "$new_v"
done
# Report Claude CLI
local new_claude=$(claude --version 2>/dev/null | head -1 || echo "N/A")
printf "%-30s | %-15s -> %-15s\n" "claude" "${old_vers["claude"]}" "$new_claude"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment