This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
If not specified, the request is for the xpm/ directory.
This is xpm (uniX Package Manager) - a universal package manager for Unix-like systems (Linux, BSD, macOS) with experimental Windows support. Written in Rust as a workspace with two crates.
- Repository: https://github.com/verseles/xpm
- License: BSD 4-Clause "Original"
- Migration: The original Dart implementation is preserved in the
old_dartbranch
# Build debug
cargo build
# Build release
cargo build --release
# Run tests
cargo test
# Format code
cargo fmt
# Lint
cargo clippy
# Full precommit check
make precommit# Complete workflow
make precommit
# Build release binary
make release
# Install locally
make install
# Run tests
make testThe project includes Podman containers for testing across different distributions:
# Test on Ubuntu
make test-ubuntu
# Test on Arch Linux
make test-arch
# Test on Fedora
make test-fedora
# Test on openSUSE
make test-opensuse
# Test on Clear Linux
make test-clearlinux
# Test on Homebrew (Linux)
make test-homebrew
# Test all distros
make test-allAvailable distros: ubuntu, arch, fedora, opensuse, clearlinux, homebrew
xpm/
├── Cargo.toml # Workspace definition
├── crates/
│ ├── xpm-cli/ # CLI frontend
│ │ └── src/
│ │ ├── main.rs # Entry point (Clap)
│ │ └── commands/ # CLI commands
│ └── xpm-core/ # Core library
│ └── src/
│ ├── db/ # Database (native_db/redb)
│ ├── native_pm/ # Package manager integrations
│ ├── os/ # OS utilities
│ ├── script/ # Bash script parsing
│ ├── repo/ # Git-based repositories
│ └── utils/ # Utilities
├── docker/ # Container test configs
└── Makefile # Build automation
- Command System: Uses
clapfor CLI argument parsing - Database:
native_dbwithredbbackend for package metadata - Bash Integration: Executes bash-based installer scripts following xpm spec
- OS Detection: Compile-time and runtime OS/architecture detection
- Method Selection: Chooses best installation method (native PM → xpm → any)
- apt (Debian/Ubuntu)
- pacman (Arch Linux, with AUR via paru/yay)
- dnf (Fedora/RHEL)
- zypper (openSUSE)
- brew (macOS/Linux)
- swupd (Clear Linux)
- snap (Universal)
- flatpak (Universal)
- termux/pkg (Android)
- choco/scoop (Windows)
XPM uses bash scripts for package installation following the xpm spec.
Required function: validate()
Optional functions: install_any(), remove_any(), install_apt(), remove_apt(), etc.
| Variable | Description |
|---|---|
XPM |
Path to xpm executable |
xSUDO |
Path to sudo (empty on Android) |
xCHANNEL |
stable/beta/nightly |
xOS |
linux/macos/windows/android |
xARCH |
Normalized architecture |
xBIN |
Binary install directory |
xHOME |
Home directory |
xTMP |
Temp directory |
xFLAGS |
Custom flags from --flags/-e |
isLinux, isMacOS, isWindows, isAndroid |
Boolean flags |
hasSnap, hasFlatpak |
Package manager availability |
Cargo.toml: Workspace and dependencies.github/workflows/global.yml: CI/CD pipeline (test, build, release)docker/podman-compose.yml: Container test orchestration
- Rust 2021 edition
- Formatted with
cargo fmt - Linted with
cargo clippy
- Unit tests via
cargo test - Container-based integration testing via
make test-* - CI runs on Linux and macOS (x86_64 + aarch64)
- Cargo: Rust build system
- Make: Common task automation
- GitHub Actions: CI/CD with cross-platform releases
- Fallback Mechanism: native PM → xpm method → generic "any" method
- Multiple PM Support: 10+ package managers
- Architecture Mapping: Normalizes arch names (amd64, x64, m1, m2, m3 → standard)
- Channel Support: stable, beta, nightly
- Non-interactive: Designed for automation
- Native mode:
--native/-nforces native PM only - Custom flags:
--flags/-epasses flags to scripts
Key dependencies:
clap: CLI parsingtokio: Async runtimenative_db: Embedded databasegit2: Git operationsreqwest: HTTP clientanyhow: Error handlingcolored: Terminal colors
Releases are automatically built via GitHub Actions when a tag matching v*.*.* is pushed. Binaries are created for:
- Linux x86_64
- Linux aarch64
- macOS x86_64
- macOS aarch64 (Apple Silicon)