This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
rig is "The R Installation Manager" - a cross-platform CLI tool written in Rust that manages multiple R installations on macOS, Windows, and Linux. It allows users to install, remove, configure, and switch between different R versions.
# Development build
cargo build
# Release build
cargo build --release
# Run tests
cargo test
# Format code
cargo fmt
# Lint code
cargo clippymake macos # Build macOS packages (arm64 and x86_64)
make win # Build Windows installer
make linux # Build Linux packages (tar.gz, .deb, .rpm)
make linux-in-docker # Build Linux packages in Docker
make clean # Clean build artifacts# Rust integration tests
cargo test
# Platform-specific shell tests (BATS)
bats tests/test-macos.sh
bats tests/test-linux.sh
bats tests/test-windows.sh
# Docker-based Linux tests
make linux-test-all
make linux-test-ubuntu-22.04 # or other distro namesThe codebase uses #[cfg(target_os = "...")] for platform-specific code:
src/macos.rs- macOS implementationsrc/windows.rs- Windows implementationsrc/linux.rs- Linux implementation
src/main.rs- CLI entry pointsrc/lib.rs- C API for macOS menu bar app (builds aslibriglib.a)src/args.rs- Command-line argument parsing (clap)src/common.rs- Shared functionality across platforms
src/resolve.rs- R version resolution (symbolic names like "release", "devel")src/rversion.rs- R version parsingsrc/library.rs- Package library managementsrc/repos.rs- CRAN/PPM repository handlingsrc/download.rs- HTTP downloadssrc/alias.rs- R version alias managementsrc/proj.rs- Project dependency managementsrc/solver.rs- Dependency solver (pubgrub algorithm)src/dcf.rs- DCF (DESCRIPTION) file parsing
src/escalate.rs- Privilege escalation (sudo/admin)src/config.rs- Configuration managementsrc/run.rs- Running R scriptssrc/renv.rs- renv integration
The project produces two artifacts:
rigbinary - the main CLI toollibriglib.astatic library - used by the macOS menu bar app
Shell completions (bash, zsh, fish, elvish, PowerShell) are auto-generated during build via build.rs.
- clap - CLI argument parsing
- reqwest - HTTP client (with rustls-tls)
- tokio - Async runtime
- pubgrub - Dependency solver algorithm
- deb822-fast - DCF/DESCRIPTION file parsing
- duct - External command execution