Skip to content

Commit 73c0618

Browse files
AI Assistantclaude
andcommitted
feat(auto-update): add comprehensive package manager auto-update system
Add intelligent auto-update feature that detects all installed package managers and uses their native built-in update/upgrade tools to keep packages current across the development environment. Features: - Automatic detection of 14+ package managers - Support for apt, brew, snap, flatpak, cargo, rustup, uv, pipx, pip, npm, pnpm, yarn, go, and gem - Dry-run mode for safe preview of updates - Verbose mode for detailed debugging output - Selective update capabilities (individual, system-only, skip-system) - Environment variable configuration (DRY_RUN, VERBOSE, SKIP_SYSTEM) Makefile Targets: - auto-update-detect: Show detected package managers - auto-update: Update all package managers and their packages - auto-update-dry-run: Preview updates without applying changes - auto-update-system-only: Update only system package managers - auto-update-skip-system: Update all except system package managers Usage: make auto-update-detect make auto-update-dry-run make auto-update ./scripts/auto_update.sh cargo DRY_RUN=1 ./scripts/auto_update.sh update Integration: Complements existing audit/upgrade workflow: make update → make audit → make upgrade → make auto-update → make audit Each package manager updates itself and all packages it manages using native commands (e.g., apt-get upgrade, brew upgrade, cargo install-update, uv tool upgrade, pipx upgrade-all). Documentation includes comprehensive README section with examples, workflow recommendations, and integration guidance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 41cd016 commit 73c0618

File tree

2 files changed

+735
-0
lines changed

2 files changed

+735
-0
lines changed

README.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,202 @@ make reconcile-node
534534
make reconcile-rust
535535
```
536536

537+
## Auto-Update: Package Manager Detection and Updates
538+
539+
The `auto-update` feature automatically detects all installed package managers and runs their built-in update/upgrade tools. This is a comprehensive way to keep your entire development environment up-to-date.
540+
541+
### Supported Package Managers
542+
543+
**System Package Managers:**
544+
- apt (Debian/Ubuntu)
545+
- Homebrew (macOS/Linux)
546+
- Snap
547+
- Flatpak
548+
549+
**Language-Specific Package Managers:**
550+
- Cargo (Rust) + Rustup
551+
- UV (Python)
552+
- Pipx (Python)
553+
- Pip (Python)
554+
- NPM (Node.js)
555+
- PNPM (Node.js)
556+
- Yarn (Node.js)
557+
- Go (binaries)
558+
- RubyGems
559+
560+
### Quick Start
561+
562+
```bash
563+
# Detect all installed package managers
564+
make auto-update-detect
565+
566+
# Update all package managers and their packages
567+
make auto-update
568+
569+
# Preview what would be updated (dry-run)
570+
make auto-update-dry-run
571+
572+
# Update only system package managers (apt, brew, snap, flatpak)
573+
make auto-update-system-only
574+
575+
# Update all except system package managers
576+
make auto-update-skip-system
577+
```
578+
579+
### Advanced Usage
580+
581+
The `scripts/auto_update.sh` script can be called directly for fine-grained control:
582+
583+
```bash
584+
# Show detected package managers
585+
./scripts/auto_update.sh detect
586+
587+
# Update all package managers
588+
./scripts/auto_update.sh update
589+
590+
# Update specific package manager only
591+
./scripts/auto_update.sh cargo
592+
./scripts/auto_update.sh npm
593+
./scripts/auto_update.sh brew
594+
595+
# Dry-run mode (show what would be updated)
596+
./scripts/auto_update.sh --dry-run update
597+
598+
# Verbose output
599+
./scripts/auto_update.sh --verbose update
600+
601+
# Skip system package managers
602+
./scripts/auto_update.sh --skip-system update
603+
604+
# Environment variable control
605+
DRY_RUN=1 ./scripts/auto_update.sh update
606+
VERBOSE=1 ./scripts/auto_update.sh update
607+
SKIP_SYSTEM=1 ./scripts/auto_update.sh update
608+
```
609+
610+
### What Gets Updated
611+
612+
Each package manager updates itself and all packages it manages:
613+
614+
**APT:** Updates package lists and upgrades all installed packages
615+
```bash
616+
sudo apt-get update && sudo apt-get upgrade -y
617+
```
618+
619+
**Homebrew:** Updates package index and upgrades all formulae/casks
620+
```bash
621+
brew update && brew upgrade && brew cleanup
622+
```
623+
624+
**Cargo:** Updates Rust toolchain via rustup and upgrades all cargo-installed binaries
625+
```bash
626+
rustup update
627+
cargo install-update -a # requires cargo-update
628+
```
629+
630+
**UV:** Self-updates UV and upgrades all UV-managed tools
631+
```bash
632+
uv self update
633+
uv tool upgrade <each-tool>
634+
```
635+
636+
**Pipx:** Updates pipx itself and all pipx-installed packages
637+
```bash
638+
pip3 install --user --upgrade pipx
639+
pipx upgrade-all
640+
```
641+
642+
**NPM:** Updates npm itself and all global packages
643+
```bash
644+
npm install -g npm@latest
645+
npm update -g
646+
```
647+
648+
**PNPM:** Updates pnpm (via corepack) and global packages
649+
```bash
650+
corepack prepare pnpm@latest --activate
651+
pnpm update -g
652+
```
653+
654+
**Yarn:** Updates yarn (via corepack)
655+
```bash
656+
corepack prepare yarn@stable --activate
657+
```
658+
659+
**RubyGems:** Updates gem system and all installed gems
660+
```bash
661+
gem update --system
662+
gem update
663+
gem cleanup
664+
```
665+
666+
### Workflow Recommendations
667+
668+
**Daily Development Workflow:**
669+
```bash
670+
# Quick check what's available
671+
make auto-update-detect
672+
673+
# Preview updates without making changes
674+
make auto-update-dry-run
675+
676+
# Apply updates to everything
677+
make auto-update
678+
```
679+
680+
**CI/CD or Scripting:**
681+
```bash
682+
# Silent updates with environment variables
683+
VERBOSE=0 ./scripts/auto_update.sh update
684+
685+
# Update only user-level tools (skip system packages)
686+
SKIP_SYSTEM=1 ./scripts/auto_update.sh update
687+
```
688+
689+
**Selective Updates:**
690+
```bash
691+
# Update only Rust ecosystem
692+
./scripts/auto_update.sh cargo
693+
694+
# Update only Node.js ecosystem
695+
./scripts/auto_update.sh npm
696+
./scripts/auto_update.sh pnpm
697+
./scripts/auto_update.sh yarn
698+
699+
# Update only Python ecosystem
700+
./scripts/auto_update.sh uv
701+
./scripts/auto_update.sh pipx
702+
```
703+
704+
### Integration with Existing Workflow
705+
706+
The auto-update feature complements the existing audit/upgrade workflow:
707+
708+
```bash
709+
# 1. Update version snapshot from upstream sources
710+
make update
711+
712+
# 2. Review what needs updating
713+
make audit
714+
715+
# 3. Run interactive upgrade for specific tools
716+
make upgrade
717+
718+
# 4. Auto-update all package managers and their packages
719+
make auto-update
720+
721+
# 5. Verify everything is up-to-date
722+
make audit
723+
```
724+
725+
### Notes
726+
727+
- System package managers (apt, brew, snap, flatpak) require appropriate permissions (sudo)
728+
- The auto-update process is designed to be safe and non-destructive
729+
- Use `--dry-run` to preview changes before applying them
730+
- Some package managers (like Go) don't have built-in bulk update mechanisms - manual updates are required
731+
- The script gracefully handles missing package managers (skips them)
732+
537733
## Caching
538734

539735
- Manual baseline (committed): `latest_versions.json` in this repo (override with `CLI_AUDIT_MANUAL_FILE`). Used as the primary source in offline mode; also used as a fallback when online lookups fail. Example content:

0 commit comments

Comments
 (0)