Sam's Simple Installer (ssi) is a lightweight bash script that simplifies installing binaries from GitHub releases. It automatically detects the user's operating system, downloads the appropriate release asset, and installs it to the user's local directory structure following XDG Base Directory conventions.
The script follows the pattern ssi owner/repository to install the latest release from any GitHub repository that provides binary releases.
# Install neovim
ssi neovim/neovim
# Install ripgrep
ssi BurntSushi/ripgrep
# Install any GitHub project with releases
ssi sharkdp/fd
ssi junegunn/fzf- curl: For downloading releases and API calls
- tar: For extracting tarballs
- Linux (x86_64, arm64, armv7)
- macOS (x86_64, arm64/Apple Silicon)
- Windows (via WSL or Git Bash)
Following XDG Base Directory specification:
~/.local/bin/ # Executable binaries (added to PATH)
~/.local/share/ # Shared data, documentation, man pages
~/.local/lib/ # Shared libraries and internal files
detect_platform() {
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="arm64" ;;
armv7l) ARCH="armv7" ;;
esac
}- Fetch latest release information using GitHub API v4
- Parse release assets to find matching platform binary
- Handle rate limiting and API errors gracefully
- Support for both public and private repositories (with token)
Priority order for selecting the correct asset:
- Exact OS and architecture match
- Generic patterns (e.g.,
linux,darwin,windows) - Common naming conventions across projects
- Fallback to manual selection if multiple matches
- Pre-installation checks:
- Verify dependencies are available
- Check internet connectivity
- Validate GitHub repository format
- Download and verification:
- Download to temporary directory
- Verify file integrity if checksums available
- Detect archive type (tar.gz, tar.bz2, zip, etc.)
- User confirmation:
- Display installation summary
- Show target directories
- Confirm before proceeding
- Installation:
- Create directory structure if needed
- Extract archive intelligently
- Place binaries in appropriate locations
- Handle overwriting existing installations
- Set proper permissions
extract_archive() {
local archive_file="$1"
local extract_dir="$2"
case "$archive_file" in
*.tar.gz|*.tgz) tar -xzf "$archive_file" -C "$extract_dir" ;;
*.tar.bz2|*.tbz2) tar -xjf "$archive_file" -C "$extract_dir" ;;
*.tar.xz) tar -xJf "$archive_file" -C "$extract_dir" ;;
*.zip) unzip -q "$archive_file" -d "$extract_dir" ;;
*) echo "Unsupported archive format: $archive_file" ;;
esac
}- Retry logic for failed downloads
- Graceful handling of GitHub API rate limits
- Offline detection and appropriate messaging
- Handle nested directories in archives
- Deal with single binary releases
- Support various compression formats
- Handle archives with multiple binaries
- Check write permissions before installation
- Handle existing file conflicts
- Projects without releases
- Pre-release vs stable release handling
- Missing platform-specific builds
SSI_INSTALL_DIR="${HOME}/.local" # Override installation directory
SSI_GITHUB_TOKEN="" # GitHub token for private repos/higher rate limits
SSI_TEMP_DIR="/tmp/ssi" # Temporary download directory
SSI_AUTO_CONFIRM="false" # Skip confirmation prompts
SSI_VERBOSE="false" # Enable verbose outputtests/
├── unit/
│ ├── test_platform_detection.py
│ ├── test_github_api.py
│ ├── test_archive_handling.py
│ └── test_installation.py
├── integration/
│ ├── test_full_installation.py
│ └── test_edge_cases.py
├── fixtures/
│ ├── sample_releases.json
│ └── sample_archives/
└── conftest.py
- Platform detection accuracy
- GitHub API response parsing
- Archive extraction logic
- File permission handling
- Configuration parsing
- Full installation workflow
- Multiple platform testing
- Real GitHub repository testing
- Network failure simulation
- Cleanup and rollback testing
- GitHub API responses
- File system operations
- Network requests
- User input simulation
SAMPLE_REPOSITORIES = [
"neovim/neovim", # Complex multi-platform releases
"BurntSushi/ripgrep", # Rust project with many targets
"sharkdp/fd", # Simple binary releases
"junegunn/fzf", # Go project with various formats
]
PLATFORM_MATRIX = [
("linux", "x86_64"),
("linux", "arm64"),
("darwin", "x86_64"),
("darwin", "arm64"),
]- Basic GitHub API integration
- Platform detection
- Simple archive extraction
- Basic installation to ~/.local/bin
- Smart asset selection
- User confirmation prompts
- Configuration file support
- Better error handling
- Rollback functionality
- Update checking
- Batch installation
- Shell completion
- Comprehensive test suite
- Documentation
- Performance optimization
- Security hardening
ssi/
├── ssi # Main bash script
├── README.md # User documentation
├── CLAUDE.md # This file
├── LICENSE # Project license
├── tests/ # Test suite
│ ├── conftest.py
│ ├── unit/
│ ├── integration/
│ └── fixtures/
├── docs/ # Additional documentation
│ ├── INSTALLATION.md
│ ├── CONFIGURATION.md
│ └── TROUBLESHOOTING.md
└── examples/ # Usage examples
└── common_packages.md
- Verify HTTPS connections
- Check file signatures when available
- Validate downloaded file integrity
- Use temporary directories with proper permissions
- Never run as root unless explicitly required
- Validate installation paths
- Check for path traversal attacks
- Set appropriate file permissions
- Secure token storage
- Rate limit handling
- Input validation for repository names
- Single command installation
- Minimal configuration required
- Clear, helpful error messages
- Intuitive command-line interface
- Robust error handling
- Graceful degradation
- Consistent behavior across platforms
- Proper cleanup on failures
- Show what will be installed where
- Provide installation progress feedback
- Log important actions
- Enable verbose mode for debugging
- Successfully install from 95% of repositories with binary releases
- Handle all major platforms (Linux, macOS, Windows/WSL)
- Complete installation in under 30 seconds for typical packages
- Zero configuration required for basic usage
- Clear error messages for all failure modes
- Consistent behavior across different projects
- Pass 100% of test suite
- Handle network failures gracefully
- Maintain backwards compatibility
- Integration with package managers
- Dependency resolution
- Version pinning and management
- Automatic updates
- Shell integration and completion
- Web interface for discovery
- User-contributed package definitions
- Installation analytics (opt-in)
- Community package recommendations
- Integration with dotfiles managers
This document serves as the comprehensive guide for developing the Sam's Simple Installer. It should be updated as the project evolves and new requirements are discovered.