Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

cbp logo

Publish Build Codecov Lines of code License Documentation

cbp is a Cross-platform Binary Package manager that simplifies the distribution of CLI tools, with a focus on bioinformatics software. It ensures compatibility with older Linux systems ( glibc 2.17+), Windows (x86_64), and provides native support for Apple Silicon, using Zig for reliable cross-platform builds.

The name cbp draws inspiration from DNA’s constant base pairing - nature’s most precise pairing system where A pairs with T, and G pairs with C. Similarly, cbp ensures consistent binary compatibility across different platforms, making software distribution as reliable as DNA replication.

Features

  • Cross-platform compatibility
    • Linux (glibc 2.17+)
    • macOS (Apple Silicon)
    • Windows (x86_64)
  • Minimal dependencies
    • Only requires a terminal (Bash/PowerShell)
  • Package management
    • Pre-built binaries without dependencies
    • GitHub release integration
    • Local package support
    • Customizable installation paths

Quick Start

  • Linux/macOS
# Install cbp
curl -LO https://github.com/wang-q/cbp/releases/latest/download/cbp.linux
chmod +x cbp.linux
./cbp.linux init
source ~/.bashrc

# List available packages
cbp avail

# Install packages
cbp install fd jq

# Manage packages
cbp list                 # list installed packages
cbp list fd              # show package contents
cbp remove fd            # remove package

  • Windows
# Install cbp
iwr "https://github.com/wang-q/cbp/releases/latest/download/cbp.windows.exe" -OutFile cbp.windows.exe
.\cbp.windows.exe init

# Restart terminal
# The rest is the same as Linux/macOS

⚠️ Windows WSL is Linux.

cbp help

Current release: 0.4.0

$ cbp help
`cbp` is a Cross-platform Binary Package manager

Usage: cbp [COMMAND]

Commands:
  init     Initialize cbp environment
  install  Download and install packages from GitHub
  local    Install packages from local binaries
  list     List installed packages and their contents
  remove   Remove installed packages
  info     Display package information
  avail    List available packages from GitHub
  check    Check for unmanaged files
  tar      Create compressed archive
  prefix   Display cbp installation directories
  build    Build package commands
  collect  Collect and package files into a tar.gz archive
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version


Package Manager Features:
    * Linux/macOS/Windows
    * Pre-built binaries without dependencies
    * Customizable installation paths

Directory Structure:
    ~/.cbp/
    ├── bin/      - Executable files
    ├── cache/    - Downloaded packages
    ├── records/  - Package file lists
    └── include/, lib/, share/ - Installed files

Quick Start:
    cbp init                    # Initial setup
    cbp install <package>       # Install package
    cbp list                    # List installed packages
    cbp avail                   # List available packages

Supported Packages

Current supported packages can be viewed using cbp avail.

Or visit the Release page.

Python 3

cbp provides a minimal Python installation. To use Python effectively:

# Install Python 3
cbp install python3.11 uv

# Set up pip
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade pip setuptools wheel

# Available Python installations
uv python list

# Install Python packages
uv pip install --system numpy matplotlib

Architecture

  1. Package Management

    • Command-line interface
    • Package status tracking
    • Network proxy support
  2. Build System

    • Zig-based cross-compilation
    • Platform-specific optimizations
    • Static linking preferred
    • Reproducible builds
  3. Directory Layout

    • Runtime
      • ~/.cbp/ - User installation directory
      • bin/ - Executable files
      • cache/ - Downloaded packages
      • records/ - Package file lists
    • Packages
      • scripts/ - Build automation
      • sources/ - Upstream packages
      • binaries/ - Pre-built packages
    • src/, tests/ - Rust source code
  4. Core Components

    • Package manager (Rust)
      • Installation and removal
      • File tracking
      • Cache management
    • Build system (Zig cc)
      • Cross-compilation
      • Package creation
      • Testing framework

For detailed information about development and build process, see the Developer Guide.

Contributing

We welcome contributions! Here’s how you can help:

  1. Report issues
  2. Request new packages
  3. Submit pull requests
  4. Improve documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQ

Why use Zig for cross-compilation?

Zig provides a consistent cross-compilation experience across different platforms and targets specific glibc versions, which is essential for compatibility with older Linux distributions like CentOS 7.

How does this compare to Conda/Bioconda?

While Conda provides a comprehensive package management system, this project focuses specifically on:

  • Minimal dependencies (no Python required)
  • Static linking where possible
  • Specific glibc compatibility
  • Apple Silicon native support

Can I use these binaries in a Docker container?

Yes, these binaries are ideal for Docker containers as they have minimal dependencies and will work on any Linux system with glibc 2.17 or newer.

How do I request a new package?

Open an issue on GitHub with the package name, source URL, and any specific build requirements.

CBP’s logo conveys reliability and innovation through a clear, science‑forward motif. A dynamic DNA double helix reflects our bioinformatics focus and constant pairing, echoing consistent cross‑platform compatibility. A subtle packaging form symbolizes stewardship and delivery of binaries, tying the helix to practical distribution.

Developer Guide

This guide is intended for developers who want to contribute to the cbp project or understand its internal workings.

Development Environment

Requirements

  • Zig compiler (>= 0.13.0)
  • Rust toolchain (stable)
  • Git (with LFS support)
  • gh command (GitHub CLI)
  • Python 3 (>= 3.7) and uv
  • Build tools
    • cmake
    • ninja
    • jq
    • meson

Setup Build Environment

  • Zig
# Download and install Zig
mkdir -p $HOME/share
cd $HOME/share

# linux and macOS
# zvm
curl https://raw.githubusercontent.com/tristanisham/zvm/master/install.sh | bash
source $HOME/.bashrc

# need 0.14 for pthread on x86_64-windows-gnu
# https://github.com/ziglang/zig/issues/10989
zvm install 0.14.1
zvm install 0.13.0

zvm use 0.13.0

# # zigup
# curl -L https://github.com/marler8997/zigup/releases/download/v2025_01_02/zigup-x86_64-linux.tar.gz |
#     tar xz &&
#     mv zigup ~/bin/
# zigup fetch 0.14.0

# Verify Zig target
zig targets | jq .libc

# We use the following targets:
# x86_64-linux-gnu.2.17
# aarch64-macos-none
# x86_64-windows-gnu

  • Rust
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

if grep -q -i RUST_PATH $HOME/.bashrc; then
    echo "==> .bashrc already contains RUST_PATH"
else
    echo "==> Updating .bashrc with RUST_PATH..."
    RUST_PATH="export PATH=\"\$HOME/.cargo/bin:\$PATH\""
    echo '# RUST_PATH'       >> $HOME/.bashrc
    echo $RUST_PATH          >> $HOME/.bashrc
    echo >> $HOME/.bashrc
fi
source $HOME/.bashrc

# Install cargo-zigbuild
cargo install --locked cargo-zigbuild

rustup target list

rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl
rustup target add aarch64-apple-darwin
rustup target add x86_64-pc-windows-gnu

  • vcpkg
mkdir -p $HOME/share
cd $HOME/share

# Download and extract vcpkg
curl -L https://github.com/microsoft/vcpkg/archive/refs/tags/2025.10.17.tar.gz |
    tar xvz &&
    mv vcpkg-* vcpkg

cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics

# Set environment variables
if grep -q -i VCPKG_PATH $HOME/.bashrc; then
    echo "==> .bashrc already contains VCPKG_PATH"
else
    echo "==> Updating .bashrc with VCPKG_PATH..."
    VCPKG_ROOT=
    VCPKG_PATH=
    echo '# VCPKG_PATH'                         >> $HOME/.bashrc
    echo "export VCPKG_ROOT=\"\$HOME/share/vcpkg\"" >> $HOME/.bashrc
    echo "export PATH=\"\$VCPKG_ROOT:\$PATH\""  >> $HOME/.bashrc
    echo >> $HOME/.bashrc
fi
source $HOME/.bashrc

# List all available features for a package
vcpkg search bzip2

# Switch to the cbp building dir
# To install a vcpkg package
vcpkg install --debug --recurse \
    --clean-buildtrees-after-build --clean-packages-after-build \
    --overlay-ports=ports \
    --overlay-triplets="$(cbp prefix triplets)" \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    zlib:x64-linux-zig

# To remove a vcpkg package
vcpkg remove --debug --recurse \
    --overlay-ports=ports \
    --overlay-triplets="$(cbp prefix triplets)" \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    zlib:x64-linux-zig

# Install zlib with custom target
# vcpkg install zlib:x64-linux-zig \
#     --cmake-args="-DCMAKE_C_COMPILER_TARGET=aarch64-macos-none" \
#     --cmake-args="-DCMAKE_CXX_COMPILER_TARGET=aarch64-macos-none"

  • llvm
cd ~/share

# Download and install llvm
curl -o llvm.tar.xz -L https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-arm64-apple-macos11.tar.xz

tar xvf llvm.tar.xz
mv clang+llvm-* llvm

# Remove quarantine attribute if exists (ignore errors)
for d in bin lib libexec; do
    for f in llvm/${d}/*; do
        xattr -d com.apple.quarantine "$f" 2>/dev/null || true
    done
done

llvm/bin/lld --version

Other tools

cbp install cmake
cbp install ninja
cbp install uv
cbp install jq

cbp install python3.11
uv pip install --system meson

git lfs and gh

# linux
sudo apt install git-lfs
sudo apt install gh

# macos
brew install git-lfs

git lfs install
git lfs track "sources/*.tar.gz"

cbp itself

cargo install --path . --force # --offline

cargo test -- --test-threads=1

# build under WSL 2
mkdir -p /tmp/cargo
export CARGO_TARGET_DIR=/tmp/cargo
cargo build

cargo run --release --bin cbp init --dev

git log v0.3.13..HEAD > gitlog.txt
git diff v0.3.13 HEAD > gitdiff.txt

Project Structure

cbp/
|-- binaries/      # Build artifacts
|-- docs/          # Documentation
|-- scripts/       # Build scripts
|   |-- common.sh  # Shared build functions
|   |-- tools/     # Helper scripts
|   |-- *.sh       # Package-specific build scripts
|-- sources/       # Source packages
|-- src/           # Rust source code
|-- tests/         # Rust test code

Build Process

Building Binary Packages

Binary packages are built using shell scripts in the scripts/ directory. Each package has its own build script that sources common.sh for shared functionality.

Example build process:

  1. Source code is downloaded to sources/
  2. Build script extracts and compiles the source
  3. Binaries are collected and packaged
  4. Resulting tarball is placed in binaries/

Dynamic Library Dependencies

The binaries in this project have minimal dynamic library dependencies:

  1. Core System Libraries

    • linux-vdso.so.1 - Virtual dynamic shared object
    • libc.so.6 - GNU C Library (glibc)
    • libpthread.so.0 - POSIX threads library
    • libdl.so.2 - Dynamic linking library
    • /lib64/ld-linux-x86-64.so.2 - Dynamic linker/loader
  2. C/C++ Runtime Libraries

    • libstdc++.so.6 - GNU Standard C++ Library
    • libm.so.6 - Math library
    • libgcc_s.so.1 - GCC support library

Example of checking dependencies:

$ ldd ~/.cbp/bin/trimal
        linux-vdso.so.1 (0x00007ffff4599000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f796772c000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7967643000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7967615000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7967403000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f79679b6000)

$ bash scripts/tools/deps.sh trimal
==> Dependencies for package trimal:
  File: bin/readal
    No additional dependencies

  File: bin/statal
    No additional dependencies

  File: bin/trimal
    No additional dependencies

$ bash scripts/tools/deps.sh muscle
==> Dependencies for package muscle:
  File: bin/muscle
    Static executable

$ bash scripts/tools/deps.sh bwa
==> Dependencies for package bwa:
  File: bin/bwa
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007de17629d000)

Uploading Binaries

Binary packages are uploaded to a special “Binaries” release on GitHub, which is independent of cbp’s version releases.

Create the Binaries release on GitHub if it doesn’t exist

gh release view Binaries

gh release create Binaries \
    --title "Binary Packages" \
    --notes "This release contains pre-built binary packages for various platforms." \
    --prerelease

Upload Process

  1. Build the binary package using the build script

    bash scripts/zlib.sh linux
    
  2. The resulting tarball will be placed in binaries/

    ls -l binaries/zlib.*.tar.gz
    
  3. GitHub CLI should be installed and authenticated by the repository owner

    gh auth login
    
    # Verify authentication status
    gh auth status
    
  4. Upload to GitHub Release

    # Upload with cbp command (recommended), which:
    # 1. Calculate MD5 hash for each file
    # 2. Upload files to GitHub Release
    # 3. Update release notes with new hashes
    cbp build upload binaries/zlib.*.tar.gz
    
    
    # Or upload manually with gh command
    # Note: This method does not update MD5 hashes
    gh release upload Binaries binaries/zlib.*.tar.gz --clobber
    

Download URLs

The binary packages will be available at fixed URLs:

https://github.com/wang-q/cbp/releases/download/Binaries/zlib.linux.tar.gz

https://github.com/wang-q/cbp/releases/download/Binaries/zlib.macos.tar.gz

Packages

cargo run --bin cbp build test --dir ~/.cbp arial

Contributing

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make changes following the style guide
  4. Run tests and ensure they pass
  5. Submit a pull request

Adding a New Package

  1. Add source tarball to sources/
  2. Create build script in scripts/
  3. Test build on both Linux and macOS
  4. Add tests if applicable
  5. Update documentation
  6. Submit a pull request

Example build script templates:

  • Build from source:
#!/bin/bash

# Source common build environment
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

# Extract source code
extract_source

# Build with the specified target architecture
make \
    CC="zig cc -target ${TARGET_ARCH}" \
    || exit 1

# Collect binaries and create tarball
FN_TAR="${PROJ}.${OS_TYPE}.tar.gz"
cbp collect --mode bin -o "${FN_TAR}" program

Build Process

This document describes the build process for all packages in the cbp (Cross-platform Binary Packages) project.

Overview

Key points about the build process:

  1. Package definitions are stored in the packages/ directory as JSON files
  2. Source codes are downloaded (and optionally repackaged) to the sources/ directory
  3. Build artifacts are packaged into .tar.gz files and stored in the binaries/ directory
  4. Each build is performed in a temporary directory to avoid polluting the project’s directories
  5. Most builds use Zig as the cross-compiler targeting glibc 2.17 for Linux

Package Analysis

Commands for analyzing package configurations:

# Find packages with any rename field at any level in the JSON structure
fd -e json . packages -x sh -c 'jq -e ".. | objects | select(has(\"rename\"))" {} > /dev/null 2>&1 && echo {}'

# Find packages without tests field
fd -e json . packages -x jq -r 'select(.tests == null) | .name'

fd -e json . packages -x jq -r 'select(.tests == null) | .name' |
    grep -v -Fw -f <(fd -e sh . test-binaries -x basename {} .sh) |
    sort

# Find packages that are of type "vcpkg" but don't have a "source" field
# These packages typically use official vcpkg ports and don't need custom source downloads
# Used for identifying packages that rely on vcpkg's standard source acquisition
fd -e json . packages -x jq -r 'select(.type == "vcpkg" and ([.. | objects | has("source")] | any | not)) | .name'

fd -e json . packages -x jq -r 'select(.type == "prebuild" and ([.. | objects | has("binary")] | any | not)) | .name'

# Count all package types and sort by frequency
fd -e json . packages -x jq -r '.type // "undefined"' | sort | uniq -c | sort -rn
#  38 prebuild
#  30 vcpkg
#  20 make
#  18 autotools
#  17 rust
#  10 font
#   7 cmake
#   3 source

fd -e json . packages -x jq -r 'select(.type == "prebuild") | .name'

Package Status

bash scripts/tools/status.sh |
    rgr md stdin -c 3-5

find binaries -name "*.tar.gz" -type f |
    parallel -j 8 '
        [[ -f {} ]] || exit
        gzip -t {} 2>/dev/null || exit
        name=$(basename {})
        count=$(tar -tzf {} | wc -l | tr -d " ")
        echo -e "${name}\t${count}"
    ' |
    sort -k2 -nr |
    head -n 20

vcpkg libraries

bash scripts/vcpkg.sh zlib
bash scripts/vcpkg.sh "bzip2[tool]"
bash scripts/vcpkg.sh libdeflate
bash scripts/vcpkg.sh "liblzma[tools]"

cbp local zlib bzip2 libdeflate liblzma

bash scripts/vcpkg.sh ncurses
bash scripts/vcpkg.sh readline

bash scripts/vcpkg.sh libevent
bash scripts/vcpkg.sh utf8proc

bash scripts/vcpkg.sh argtable2
bash scripts/vcpkg.sh expat
bash scripts/vcpkg.sh "libxml2[core,zlib]"

CFLAGS="-Wno-language-extension-token" bash scripts/vcpkg.sh libxcrypt

bash scripts/vcpkg.sh gsl
bash scripts/vcpkg.sh simde

vcpkg utilities

# avoid icu from sqlite3[*]
bash scripts/vcpkg.sh "sqlite3[core,tool,dbstat,fts3,fts4,fts5,json1,math,rtree,soundex,zlib]"

bash scripts/vcpkg.sh "openssl[core,tools]"

bash scripts/vcpkg.sh "curl[core,tool,ssl,http2,websockets]"

bash scripts/vcpkg.sh pkgconf x64-linux-zig pkgconf=pkg-config

bash scripts/vcpkg.sh "lua[core,tools]"

bash scripts/vcpkg.sh "graphicsmagick"

My ports

cbp build source aragorn
bash scripts/vcpkg.sh aragorn

# Transform Makefile to CMakeLists.txt
cbp build source bwa
bash scripts/vcpkg.sh bwa

cbp build source consel
bash scripts/vcpkg.sh consel

cbp build source faops
bash scripts/vcpkg.sh faops

cbp build source minigraph
bash scripts/vcpkg.sh minigraph

cbp build source miniprot
bash scripts/vcpkg.sh miniprot

cbp build source multiz
bash scripts/vcpkg.sh multiz

cbp build source pigz
bash scripts/vcpkg.sh pigz

cbp build source sickle
bash scripts/vcpkg.sh sickle

cbp build source daligner
bash scripts/vcpkg.sh daligner

cbp build source dazzdb
bash scripts/vcpkg.sh dazzdb

cbp build source fastga
bash scripts/vcpkg.sh fastga

cbp build source merquryfk
bash scripts/vcpkg.sh merquryfk

cbp build source seqtk
bash scripts/vcpkg.sh seqtk

cbp build source usalign
bash scripts/vcpkg.sh usalign

# ./configure
cbp build source cabextract
bash scripts/vcpkg.sh cabextract

cbp build source datamash
bash scripts/vcpkg.sh datamash

cbp build source jellyfish
bash scripts/vcpkg.sh jellyfish

cbp build source trf
bash scripts/vcpkg.sh trf

# cmake
cbp build source chainnet
bash scripts/vcpkg.sh chainnet

cbp build source diamond
bash scripts/vcpkg.sh diamond

cbp build source libdivsufsort
bash scripts/vcpkg.sh libdivsufsort

make

cbp build source aster
bash scripts/aster.sh

cbp build source bedtools
cbp install zlib bzip2 libdeflate liblzma
cbp remove htslib # confuse bundled htslib
bash scripts/bedtools.sh

cbp build source fastk
cbp local zlib libdeflate htslib
bash scripts/fastk.sh

cbp build source lastz
bash scripts/lastz.sh

cbp build source mafft
bash scripts/mafft.sh

cbp build source minimap2
bash scripts/minimap2.sh

cbp build source paml
bash scripts/paml.sh

cbp build source phast
bash scripts/phast.sh # build without CLAPACK

cbp build source phylip
bash scripts/phylip.sh

cbp build source prodigal
bash scripts/prodigal.sh

cbp build source rush
cbp install gsl libdivsufsort
bash scripts/rush.sh

cbp build source trimal
bash scripts/trimal.sh

autotools

cbp build source bcftools
bash scripts/bcftools.sh    # bundled htslib

cbp build source clustalo
cbp local argtable2
bash scripts/clustalo.sh

cbp build source easel
bash scripts/easel.sh

cbp build srouce gdbm
bash scripts/gdbm.sh

cbp build source hmmer
bash scripts/hmmer.sh

cbp build source hmmer2
bash scripts/hmmer2.sh

cbp build source htslib
cbp local libdeflate
zvm use 0.13.0
bash scripts/htslib.sh  # --with-libdeflate

cbp build source mummer
bash scripts/mummer.sh

cbp build source parallel
bash scripts/parallel.sh

cbp build source pv
cbp local ncurses
bash scripts/pv.sh

cbp build source quorum
cbp local jellyfish
bash scripts/quorum.sh

cbp build source samtools
bash scripts/samtools.sh    # bundled htslib

cbp build source snp-sites
bash scripts/snp-sites.sh

cbp build source stow
bash scripts/stow.sh

cbp build source superreads
cbp local jellyfish
# sudo apt install yaggo
bash scripts/superreads.sh

# cbp build source tmux
# cbp local libevent ncurses utf8proc pkgconf
# bash scripts/tmux.sh

# mcl
curl -L https://micans.org/mcl/src/cimfomfa-22-273.tar.gz |
    tar xz &&
    mv cimfomfa-* cimfomfa &&
    curl -L https://micans.org/mcl/src/mcl-22-282.tar.gz |
    tar xz &&
    mv mcl-* mcl &&
    mv cimfomfa mcl/ &&
    tar -czf sources/mcl.tar.gz mcl/ &&
    rm -rf mcl
bash scripts/mcl.sh

# curl -o sources/MaSuRCA.tar.gz -L https://github.com/alekseyzimin/masurca/releases/download/v4.1.2/MaSuRCA-4.1.2.tar.gz

cmake

cbp build source bifrost
zvm use 0.13.0
bash scripts/bifrost.sh

cbp build source spoa
bash scripts/spoa.sh

# spades
# need gcc version 9.1 or later
cbp build source spades
cbp local bzip2
zvm use 0.14.1
bash scripts/spades.sh

# Remove large files
curl -L https://github.com/tjunier/newick_utils/archive/da121155a977197cab9fbb15953ca1b40b11eb87.tar.gz |
    tar xvfz - &&
    mv newick_utils-da121155a977197cab9fbb15953ca1b40b11eb87 newick-utils &&
    fd -t f -S +500k . newick-utils -X rm &&
    tar -czf sources/newick-utils.tar.gz newick-utils/ &&
    rm -rf newick-utils
bash scripts/newick-utils.sh # bison, flex

Source codes from Git Repositories

This section clones recursively and sets up all required git repo at specific commits.

# bcalm
REPO=bcalm
git clone --recursive https://github.com/GATB/${REPO}.git
cd ${REPO}
git checkout v2.2.3

rm -rf .git
rm -rf gatb-core/.git
cd ..
tar -cf - ${REPO}/ | gzip -9 > sources/${REPO}.tar.gz
rm -rf ${REPO}

bash scripts/bcalm.sh

Source codes from author’s website

bash scripts/ms.sh

Projects requiring specific build environments

  • Build on Ubuntu host using CentOS 7 container to utilize system libgomp
  • Use singularity container which automatically mounts host’s $HOME directory
  • Working directory constraints:
    • cbp/ must be a real directory, not a symbolic link
    • Do not place cbp/ under /mnt/c/ in WSL to avoid performance issues
singularity pull docker://wangq/vcpkg-centos:master

mv vcpkg-centos_master.sif vcpkg/vcpkg-centos.sif

# fasttree
cbp build source fasttree
bash scripts/fasttree.sh

# lapack-reference
singularity run \
    vcpkg/vcpkg-centos.sif \
/opt/vcpkg/vcpkg install --debug --recurse \
    --clean-buildtrees-after-build \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    lapack-reference[core,cblas]:x64-linux-release

cbp collect vcpkg/installed/vcpkg/info/lapack-reference_*_x64-linux-release.list

# gmp
singularity run \
    vcpkg/vcpkg-centos.sif \
/opt/vcpkg/vcpkg install --debug --recurse \
    --clean-buildtrees-after-build \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    gmp:x64-linux-release

cbp collect vcpkg/installed/vcpkg/info/gmp_*_x64-linux-release.list

# glib -Wno-missing-prototypes -Wno-strict-prototypes
# fontconfig[tools] -std=gnu99
# pkgconf -D_GNU_SOURCE
singularity run \
    --env CFLAGS="-D_GNU_SOURCE -std=gnu99 -Wno-missing-prototypes -Wno-strict-prototypes" \
    vcpkg/vcpkg-centos.sif \
/opt/vcpkg/vcpkg install --debug --recurse \
    --clean-buildtrees-after-build \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    graphviz:x64-linux-release

singularity run vcpkg/vcpkg-centos.sif \
    ldd -v vcpkg/installed/x64-linux-release/tools/graphviz/dot

singularity run vcpkg/vcpkg-centos.sif \
    ldd -v vcpkg/installed/x64-linux-release/tools/glib/gio

cbp collect --ignore tools/graphviz/graphviz/libgvplugin \
    vcpkg/installed/vcpkg/info/graphviz_*_x64-linux-release.list
mv graphviz.linux.tar.gz binaries/

# gnuplot
cbp build source gnuplot

singularity run \
    --env CFLAGS="-D_GNU_SOURCE -std=gnu99 -Wno-missing-prototypes -Wno-strict-prototypes" \
    vcpkg/vcpkg-centos.sif \
/opt/vcpkg/vcpkg install --debug --recurse \
    --clean-buildtrees-after-build \
    --overlay-ports=ports \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    gnuplot:x64-linux-release

cbp collect vcpkg/installed/vcpkg/info/gnuplot_*_x64-linux-release.list
mv gnuplot.linux.tar.gz binaries/

# python3
# sudo apt-get install autoconf automake autoconf-archive
singularity run \
    vcpkg/vcpkg-centos.sif \
/opt/vcpkg/vcpkg install --debug --recurse \
    --clean-buildtrees-after-build \
    --overlay-ports=ports \
    --x-buildtrees-root=vcpkg/buildtrees \
    --downloads-root=vcpkg/downloads \
    --x-install-root=vcpkg/installed \
    --x-packages-root=vcpkg/packages \
    python3[core,extensions]:x64-linux-release

cbp collect vcpkg/installed/vcpkg/info/python3_*_x64-linux-release.list --mode vcpkg --copy python3=python
mv python3.linux.tar.gz binaries/python3.11.linux.tar.gz

# static python can't load shared libraries
# zvm use 0.14.0
# CFLAGS="-Wno-date-time" \
#     bash scripts/vcpkg.sh python3

Prebuilt packages from the official repositories

Development Environments

cbp build prebuild cmake
cbp build prebuild nodejs
cbp build prebuild openjdk # version 17

Standalone Tools

cbp build prebuild jq yq
cbp build prebuild gh
cbp build prebuild ninja uv

cbp build prebuild aria2
cbp build prebuild bat
cbp build prebuild pandoc tectonic
cbp build prebuild pup tsv-utils

cbp build prebuild macchina
cbp build prebuild tmux
cbp build prebuild zenith

cbp build prebuild coreutils

Bioinformatics tools

cbp build prebuild blast

cbp build prebuild muscle reseek usearch
cbp build prebuild freebayes mosdepth megahit

cbp build prebuild bowtie2 stringtie
cbp build prebuild iqtree2
cbp build prebuild mash mmseqs raxml-ng

bash scripts/prebuilds/sratoolkit.sh linux
bash scripts/prebuilds/sratoolkit.sh macos
bash scripts/prebuilds/sratoolkit.sh windows

cbp build prebuild intspan
cbp build prebuild nwr
cbp build prebuild pgr
cbp build prebuild hnsm

Java

These packages require java environment. They are installed in libexec with symlinks or shims placed in bin/.

These packages might not be the latest versions due to the provided OpenJDK 17, but they provide similar functionalities.

cbp build prebuild aliview
cbp build prebuild bbtools
cbp build prebuild fastqc
cbp build prebuild figtree
cbp build prebuild gatk
cbp build prebuild igv
cbp build prebuild picard

Fonts

cbp install cabextract

cbp build font arial charter helvetica

# Open Source Fonts
cbp build font fira jetbrains-mono firacode-nf

cbp build font lxgw-wenkai
cbp build font source-han-sans
cbp build font source-han-serif
cbp build font maple-mono

cbp build font twemoji

HomeDir


Overview

While other CBP commands manage executables under ~/.cbp/, dot and snap manage configurations and documents under $HOME.

CommandResponsibilityGranularity
cbp dotSingle-file template pipeline: prefix parsing -> template rendering -> permission settingSingle file
cbp snapBatch snapshot/restore: save/load/list/delta relative to $HOMEBatch files/directories

Part 1: cbp dot

dot is essentially implemented. It originally handled both single-file templates and batch archives (switched via --tar), but archive operations never touched prefix parsing, template rendering, or permission setting — the two pipelines had zero intersection points. The archive functionality has now been split into snap.

Quick Start

# 1. Create source directory
mkdir ~/dotfiles

# 2. Create template from existing config
cbp dot ~/.bashrc --dir ~/dotfiles/
# -> ~/dotfiles/dot_bashrc.tmpl

# 3. Preview (default)
cbp dot ~/dotfiles/dot_bashrc.tmpl

# 4. Apply after confirmation
cbp dot -a ~/dotfiles/dot_bashrc.tmpl

# 5. Manage ~/dotfiles with your preferred version control

--dir mode automatically infers prefixes:

  • Hidden files (.bashrc) -> dot_ prefix
  • Located in .config/ or AppData/Roaming/ -> xdg_config/ prefix
  • Located in .local/share/ or AppData/Local/ -> xdg_data/ prefix
  • Located in .cache/ -> xdg_cache/ prefix
  • Executable permission on Unix -> executable_ prefix

You can manually adjust filenames after generation.

Filename Conventions

Processing is determined by filename prefixes, in order: attribute prefix -> path prefix -> suffix.

Complete Example:

Source: private_executable_dot_myscript.tmpl

Processing steps:
  1. private_      -> 0600 permissions
  2. executable_   -> 0755 permissions (takes precedence over private)
  3. dot_          -> target path ~/.myscript
  4. .tmpl         -> template rendering

Final result: ~/.myscript (permissions 0755, rendered template)

Combination Order Constraints:

Attribute prefixes must appear before directory prefixes:

  • executable_dot_script.sh
  • private_xdg_config/myapp/config.tmpl
  • dot_executable_bashrcdot_ is consumed as path prefix first

Attribute Prefixes (affect permissions)

  • private_ -> 0600 (sensitive files), example: private_dot_ssh_config -> ~/.ssh/config
  • executable_ -> 0755 (executable scripts), example: executable_script.sh -> ~/script.sh

private_/executable_ only take effect on Unix; silently ignored on Windows.

Path Prefixes (single-file mode, _ separated)

  • dot_ -> ~/.name, example: dot_bashrc -> ~/.bashrc

Directory Prefixes (directory mode, / separated)

dot_config/ -> Linux/Mac: ~/.config/{path} | Windows: ~/.config/{path} xdg_config/ -> Linux/Mac: ~/.config/{path} | Windows: %APPDATA%/{path} xdg_data/ -> Linux/Mac: ~/.local/share/{path} | Windows: %LOCALAPPDATA%/{path} xdg_cache/ -> Linux/Mac: ~/.cache/{path} | Windows: %LOCALAPPDATA%/Temp/{path}

dot_config/ does not follow Windows platform conventions; xdg_config/ follows native platform standards. The xdg_ series is recommended for cross-platform sharing.

Template Suffix

  • .tmpl -> Tera engine rendering (Jinja2 compatible syntax)

Files without .tmpl suffix skip rendering and are copied directly to the target location.

Command Format

# Apply template (default mode)
cbp dot [OPTIONS] <template_file...>

# Create template from existing config
cbp dot [OPTIONS] <source_file> --dir <template_dir>

-a, --apply Actually apply (default is preview only) -v, --verbose Verbose output -d, --dir <dir> Specify template storage directory

--apply and --dir are mutually exclusive. Apply mode supports multiple template files; --dir mode only accepts a single source file.

Usage Examples

# Add new file
cbp dot ~/.gitconfig --dir ~/dotfiles/
cbp dot -a ~/dotfiles/dot_gitconfig.tmpl

# Edit existing template
vim ~/dotfiles/dot_bashrc.tmpl
cbp dot -a ~/dotfiles/dot_bashrc.tmpl

# Batch apply
for f in ~/dotfiles/dot_* ~/dotfiles/dot_config/**/*; do
    [ -f "$f" ] && cbp dot -a "$f"
done

# Deploy on new machine
git clone https://github.com/username/dotfiles.git ~/dotfiles
for f in ~/dotfiles/dot_* ~/dotfiles/dot_config/**/*; do
    [ -f "$f" ] && cbp dot -a "$f"
done

Batch operations with ** recursive matching require globstar: shopt -s globstar (bash) or setopt globstar (zsh).

Template System

Uses Tera engine (Jinja2 compatible):

# dot_bashrc.tmpl
{% if os == "linux" %}
alias ls='ls --color=auto'
{% elif os == "macos" %}
alias ls='ls -G'
{% endif %}

{% if hostname == "work-laptop" %}
export HTTP_PROXY=http://proxy.company.com:8080
{% endif %}

Available Variables:

os Operating system (linux, macos, windows) arch Architecture (x86_64, aarch64) hostname Hostname user Username distro Distribution (Ubuntu) env.* Environment variables (env.HOME, env.PATH)

Rendering failures exit with error code, printing Tera error information (including line numbers), without writing any files.


Part 2: cbp snap

snap manages batch file snapshots for backup, migration, and sharing. It does not handle prefix parsing or template rendering — use dot for those.

dot vs snap Comparison

dot manages single files, doing prefix parsing, template rendering, and permission setting, using .tmpl suffix, suitable for daily editing and version control. snap manages batch files, only doing path packing and unpacking, using .snap.tar.gz suffix, suitable for backup, migration, and sharing.

Quick Start

# Backup nvim config
cbp snap save ~/.config/nvim
# -> nvim.snap.tar.gz

# Restore to current HOME
cbp snap load nvim.snap.tar.gz

# Restore to test directory
cbp snap load nvim.snap.tar.gz -t /tmp/test-home

# View snapshot contents
cbp snap list nvim.snap.tar.gz

# Compare snapshot with current disk differences
cbp snap delta nvim.snap.tar.gz

# Pack modified files into delta snapshot
cbp snap delta nvim.snap.tar.gz -p

# Multi-path backup
cbp snap save ~/.config/nvim ~/.bashrc ~/.gitconfig -o dev-env.snap.tar.gz

*.snap.tar.gz files are also recommended for version control, facilitating tracking configuration change history and cross-machine synchronization.

Core Concepts

snap stores not “files in a directory” but “where these files are in HOME” — the archive uses source paths as root, target paths are recorded by gzip comment, and load restores to corresponding locations based on the comment.

Path Conventions:

During save, the archive root is the source path itself, without parent directories, while internal directory structure is fully preserved:

Input: ~/.config/nvim/
Inside archive:
  nvim/
    init.vim

Input: ~/.bashrc
Inside archive:
  .bashrc

The complete target path is provided by the gzip comment — the comment records the source’s complete path (~/.config/nvim), and load uses this to restore nvim/ inside the archive to .config/nvim/ under the target directory.

Source paths are not limited to $HOME. Paths pointing outside HOME (e.g., /etc/fstab) are recorded in comments as ~/../../etc/fstab, and load restores using the same rule.

Snapshot Signature (gzip comment):

Embeds source path list, unified with HOME as base (~ notation), without additional version numbers, hostnames, or other metadata:

~/.config/nvim ~/../../etc/fstab

File Extension: Recommended .snap.tar.gz. load does not validate suffixes.

snap is pure file operations, does not preserve file permissions, ACLs, or extended attributes. For permission management, use cbp dot’s private_/executable_ prefixes.

Command Format

cbp snap save <paths...> [-o <output>] [-v]
cbp snap load <archive>  [-t <target>] [-v]
cbp snap list <archive>  [-v]
cbp snap delta <archive> [-p]

save

<paths...> Files or directories to save -o, --output <file> Output path. Defaults to <basename>.snap.tar.gz for single path, required for multiple paths -v, --verbose Verbose output

load

<archive> Snapshot archive to restore -t, --target <dir> Target root directory, default $HOME -v, --verbose Verbose output

When extracting, existing files at target paths are directly overwritten without preview or confirmation prompt.

list

<archive> Snapshot archive to inspect -v, --verbose Verbose output

Reads gzip comment and archive contents, displaying source paths and file lists under each path.

delta

<archive> Snapshot archive to compare -p, --pack Pack modified files into a delta snapshot

By default lists files modified since snapshot (files that exist in both snapshot and disk but have different content):

.config/nvim/init.vim
.config/nvim/lua/plugins.lua

With -p, packs modified files into output in the same directory as input file, default name <name>.delta.tar.gz (e.g., nvim.snap.tar.gz -> nvim.delta.tar.gz). Gzip comment reuses original paths. New files (on disk but not in snapshot) and deleted files are not included.


Appendix

Code Structure

src/
├── cmd_cbp/
│   ├── mod.rs
│   ├── dot.rs             # dot — single-file template pipeline
│   └── snap/              # snap — batch snapshot/restore
│       ├── mod.rs
│       ├── save.rs
│       ├── load.rs
│       ├── list.rs
│       └── delta.rs
├── libs/
│   ├── mod.rs
│   ├── dirs.rs            # directory management
│   ├── utils.rs           # utility functions, system detection
│   └── dot.rs             # system info + filename parsing + template rendering
└── ...

Tech Stack

FeatureImplementation
CLI parsingclap
Template enginetera
Compression/decompressionflate2 + tar
gzip commentflate2::GzBuilder::comment() / GzDecoder::header().comment()
Path handlingstd::path::Path + dunce
Directory traversalwalkdir

Comparison with Similar Tools

FeatureHomeDirchezmoiYADM
PositioningExtremely simple CLI toolComplete managerGit wrapper
Git integrationExternalizedBuilt-inBuilt-in
TemplatesSupportedSupportedSupported
Batch snapshotssnap commandNoNo
EncryptionNot supportedSupportedSupported
Config filesNoneYesYes
Learning curveExtremely lowMediumLow

References

init

Initialize cbp environment and configure shell settings.

Operations:

  • Create ~/.cbp directory structure
  • Install cbp executable
  • Update $PATH on Bash, Zsh, or Windows

Configuration:

  • Default: Uses ~/.cbp for everything
  • Custom: Separates config and packages

Examples:

  1. Default installation: cbp init

  2. Custom package directory: cbp init /opt/cbp

install

Download and install pre-built binary packages from the GitHub release repository. Checks for existing installations to avoid duplicates and handles platform-specific package selection automatically.

Release page

Network proxy support (priority high to low):

  • --proxy argument
  • Environment variables: ALL_PROXY, HTTP_PROXY, all_proxy, http_proxy

Examples:

  1. Install a single package: cbp install zlib

  2. Install multiple packages: cbp install zlib bzip2

  3. Install fonts: cbp install -t font arial

  4. Use proxy: cbp install --proxy socks5://127.0.0.1:7890 zlib

local

Install packages from local binaries or downloaded cache.

Search locations:

  • ./binaries/ — Pre-built binary directory (primary)
  • ~/.cbp/cache/ — Downloaded packages (fallback)

Package format: <package_name>.<type>.tar.gz

Features:

  • Installation status checking
  • Automatic location selection
  • Package record management
  • File extraction to ~/.cbp

Examples:

  1. Install a single package: cbp local zlib

  2. Install multiple packages: cbp local zlib bzip2

  3. Install fonts: cbp local -t font arial

  4. List package contents without installing: cbp local -l zlib

  5. Cross-platform install (developer option): cbp local -t windows zlib

list

Display information about installed packages.

Operations:

  • Without arguments: Show all installed packages with alphabetical grouping
  • With package names: Show detailed file contents of specified packages

Examples:

  1. List all installed packages: cbp list

  2. Show package contents: cbp list zlib

  3. Show multiple package contents: cbp list zlib bzip2

remove

Remove installed packages and their associated files. The removal process is guided by package records to ensure only managed files are affected, leaving other files untouched.

Warning: This operation cannot be undone.

Examples:

  1. Remove a single package: cbp remove zlib

  2. Remove multiple packages: cbp remove zlib bzip2

info

Display detailed package information from the GitHub repository. Information is sourced from JSON files in the packages/ directory.

Network proxy support (priority high to low):

  • --proxy argument
  • Environment variables: ALL_PROXY, HTTP_PROXY, all_proxy, http_proxy

Examples:

  1. View package information: cbp info newick-utils

  2. Output in JSON format: cbp info bwa --json

  3. Use proxy: cbp info newick-utils --proxy socks5://127.0.0.1:7890

avail

Query and list available packages from the GitHub release repository. Results are displayed in a formatted table, grouped alphabetically for better readability.

Release page

Network proxy support (priority high to low):

  • --proxy argument
  • Environment variables: ALL_PROXY, HTTP_PROXY, all_proxy, http_proxy

Examples:

  1. List all packages: cbp avail

  2. Platform-specific filtering: cbp avail linux

  3. List fonts: cbp avail font

  4. Use proxy: cbp avail --proxy socks5://127.0.0.1:7890

check

Scan ~/.cbp directory for files not managed by any package. Helps identify and clean up redundant files.

Scan scope:

  • Files not listed in any package records
  • Files outside cbp system directories (records/, cache/)
  • Files not required by cbp itself

Auto-ignored files:

  • macOS: .DS_Store, __MACOSX/, .AppleDouble, ._* (resource fork files)
  • Linux: backup files (*~), Vim swap files (.swp)
  • Windows: Thumbs.db, desktop.ini

Examples:

  1. Check for unmanaged files: cbp check

tar

Create a compressed archive from a software package directory. This command is specifically designed for packaging software installations, not as a general-purpose tar replacement.

The command will:

  • Filter out system files (.DS_Store, etc.)
  • Preserve relative paths within archive
  • Preserve symbolic links with relative targets
  • Clean up documentation directories (optional)

Examples:

  1. Package current directory: cbp tar .

  2. Package specific directory: cbp tar path/to/dir

  3. Custom output: cbp tar path/to/dir -o output.tar.gz

  4. Clean up docs: cbp tar path/to/dir --cleanup

prefix

Display cbp installation directory paths.

Examples:

  1. Show home directory: cbp prefix

  2. Show binary directory: cbp prefix bin

  3. Show library directory: cbp prefix lib

  4. Show include directory: cbp prefix include

  5. Show cbp executable path: cbp prefix exe

collect

Collect and package files into a tar.gz archive. Supports multiple processing modes for different file organization strategies.

Mode options:

  • files — Collect files as-is (default)
  • list — Process a list file containing file paths
  • vcpkg — Process vcpkg-style list file
  • bin — Place files in bin/ directory
  • font — Place files in share/fonts/ directory

Examples:

  1. Process files (default mode): cbp collect program.exe

  2. Process list file: cbp collect list.txt --mode list

  3. Process vcpkg list: cbp collect pkg.list --mode vcpkg

  4. Create file aliases: cbp collect program.exe --copy libz.so=libz.so.1

  5. Ignore specific files: cbp collect src/ --ignore .dll --ignore .exe

  6. Specify output file: cbp collect program.exe -o output.tar.gz

  7. Collect binaries: cbp collect program.exe --mode bin

  8. Collect fonts: cbp collect font.ttf --mode font

dot

Manage dotfiles using filename conventions and templates.

Filename prefixes:

  • private_ — Set 0600 permissions (sensitive files)
  • executable_ — Set 0755 permissions (scripts)
  • dot_ — Convert to hidden file (~/.name)
  • dot_config/ — Config directory (~/.config/)
  • xdg_config/ — Cross-platform config
  • xdg_data/ — Cross-platform data
  • xdg_cache/ — Cross-platform cache
  • .tmpl — Template file (Tera/Jinja2 syntax)

Behavior:

  • Default mode is preview (dry-run), use --apply to make changes
  • --dir and --apply cannot be used together
  • Use --verbose to see detailed processing information

Examples:

  1. Create template from existing config: cbp dot ~/.bashrc --dir ~/dotfiles/

  2. Preview template: cbp dot ~/dotfiles/dot_bashrc.tmpl

  3. Apply template: cbp dot -a ~/dotfiles/dot_bashrc.tmpl

  4. Apply all templates:

    for f in ~/dotfiles/dot_*; do cbp dot -a "$f"; done
    
  5. Preview with verbose output: cbp dot -v ~/dotfiles/dot_bashrc.tmpl

build

Build package commands for cbp development.

Subcommands:

  • font — Build font packages
  • prebuild — Build prebuilt binary packages
  • source — Download package source archives
  • test — Execute test cases defined in package configuration files
  • upload — Upload package files to GitHub release
  • validate — Validate package configuration files against JSON schema

build font

Build font packages from source distributions.

Downloads font files from GitHub releases and packages them into font-specific cbp archives for distribution.

Examples:

  1. Build a font package: cbp build font arial

  2. Build multiple font packages: cbp build font arial courier

  3. Specify base directory: cbp build font arial --base /path/to/project

build prebuild

Build prebuilt binary packages from source distributions.

The command downloads pre-compiled binaries from GitHub releases, extracts them, and packages them into platform-specific cbp archives.

Examples:

  1. Build for current platform: cbp build prebuild zlib

  2. Build for specific platform: cbp build prebuild zlib -t linux

  3. Build multiple packages: cbp build prebuild zlib bzip2

  4. Specify base directory: cbp build prebuild zlib --base /path/to/project

build source

Download package source archives for offline building.

Downloads source tarballs from GitHub releases and packages them into reproducible source archives.

Examples:

  1. Download a source package: cbp build source zlib

  2. Download multiple source packages: cbp build source zlib bzip2

  3. Specify base directory: cbp build source zlib --base /path/to/project

build test

Execute test cases defined in package configuration files.

Test cases are defined in package configuration files under the "tests" section:

{
  "tests": [
    {
      "name": "test name",
      "command": "command",
      "args": ["arg1", "arg2"],
      "pattern": "regex",
      "ignore_exit_code": false
    }
  ]
}

Test case fields:

  • name — Optional, defaults to “test #N”
  • command — Required, command to execute
  • args — Optional, command arguments
  • pattern — Optional, regex pattern to match in output
  • ignore_exit_code — Optional, ignore command exit code

Examples:

  1. Test specified packages: cbp build test zlib bzip2

build upload

Upload package files to GitHub release and update checksums.

Requirements:

  • GitHub CLI (gh) must be installed and authenticated
  • For proxy support, use HTTPS_PROXY environment variable

The command will:

  • Calculate MD5 checksums
  • Upload files to GitHub release
  • Update release notes with checksums

Examples:

  1. Upload a single file: cbp build upload binaries/zlib.macos.tar.gz

  2. Upload multiple files: cbp build upload binaries/*.tar.gz

  3. Force upload (skip MD5 check): cbp build upload --force binaries/*.tar.gz

build validate

Validate package configuration files against JSON schema.

Checks that package JSON files conform to the expected schema, ensuring all required fields are present and correctly typed.

Examples:

  1. Validate packages: cbp build validate zlib

  2. Validate multiple packages: cbp build validate zlib bzip2

  3. Use custom schema: cbp build validate zlib --schema custom-schema.json

  4. Specify base directory: cbp build validate zlib --base /path/to/project

snap

Manage file snapshots for backup and restore.

Snapshots store the original file paths in the gzip comment, allowing files to be restored to their correct locations.

Behavior:

  • Snapshots are stored as .snap.tar.gz files
  • Source paths are saved relative to HOME when possible
  • Files outside HOME are stored with absolute paths
  • Delta snapshots capture only modified files

Path handling:

  • ~ expands to the user’s home directory ($HOME on Unix, %USERPROFILE% on Windows)
  • In PowerShell, ~ works natively; in CMD, use %USERPROFILE% directly

Windows directory mapping:

  • ~/AppData/Roaming/ — Roaming application data (%APPDATA%)
  • ~/AppData/Local/ — Local application data (%LOCALAPPDATA%)
  • ~/AppData/Local/Temp/ — Temporary files (%TEMP%)

Subcommands:

  • save — Save files and directories as a snapshot archive
  • load — Restore files from a snapshot archive
  • list — List contents of a snapshot archive
  • delta — Show files modified since a snapshot was taken

snap delta

Show files modified since a snapshot was taken.

Compares files on disk against a snapshot archive and lists files that have changed.

Examples:

  1. Show modified files: cbp snap delta dotfiles.snap.tar.gz

  2. Pack modified files into a delta snapshot: cbp snap delta dotfiles.snap.tar.gz -p

snap list

List contents of a snapshot archive.

Displays source paths (from gzip comment) and the files stored in the archive.

Examples:

  1. List snapshot contents: cbp snap list dotfiles.snap.tar.gz

  2. Verbose listing with file sizes: cbp snap list -v dotfiles.snap.tar.gz

snap load

Restore files from a snapshot archive.

Extracts files from the archive to their original locations using the source path information stored in the gzip comment.

Examples:

  1. Restore to HOME: cbp snap load configs.snap.tar.gz

  2. Restore to a custom directory: cbp snap load configs.snap.tar.gz -t /tmp/restore

  3. Verbose output: cbp snap load -v configs.snap.tar.gz

  4. Windows (PowerShell): cbp snap load alacritty.snap.tar.gz -t ~/Desktop/backup

  5. Windows (CMD): cbp snap load alacritty.snap.tar.gz -t %USERPROFILE%\Desktop\backup

snap save

Save files and directories as a snapshot archive.

Creates a .snap.tar.gz file containing the specified paths. Source paths are stored in the gzip comment for reliable restoration.

Examples:

  1. Save a directory: cbp snap save ~/.config/nvim

  2. Save multiple directories to a named archive: cbp snap save ~/.config/nvim ~/.config/alacritty -o configs.snap.tar.gz

  3. Exclude patterns with glob: cbp snap save ~/.config/nvim -x "**/plugged/**" -x "*.swp"

  4. Save a single file: cbp snap save ~/.bashrc

  5. Verbose output: cbp snap save -v ~/.config/nvim

  6. Windows (PowerShell): cbp snap save $env:APPDATA/alacritty -o alacritty.snap.tar.gz

  7. Windows (CMD): cbp snap save %APPDATA%\alacritty -o alacritty.snap.tar.gz