| Crates.io | cairn |
| lib.rs | cairn |
| version | 0.0.0 |
| created_at | 2026-01-16 07:24:34.301088+00 |
| updated_at | 2026-01-16 07:24:34.301088+00 |
| description | Build-gated version control for Rust projects - EXPERIMENTAL, NOT PRODUCTION READY |
| homepage | https://github.com/nickspiker/cairn |
| repository | https://github.com/nickspiker/cairn |
| max_upload_size | |
| id | 2048095 |
| size | 201,774 |
Build-gated version control for Rust projects.
β οΈ EXPERIMENTAL - v0.0.0 - NOT PRODUCTION READY
Do not use on critical projects. While all data is hash-verified and should not corrupt, there are known issues:
- Random build hangs may occur
- Rollback may not properly roll forward on subsequent builds
- Snapshots may fail to save correctly in some cases
This release is for testing and claiming the crate name. Actively developed on Linux only. Windows/macOS untested.
Use at your own risk. Always have git backups.
You code for 3 hours. Run cargo build. 500 errors. Don't remember what changed.
Git shows 800 lines across 12 files. You spend 2 hours trying to undo changes. Finally git reset --hard, losing everything.
Cairn solves this: Every successful build auto-captures as a patch. Instant rollback to any working state.
# Install cargo-cairn (the build wrapper)
cargo install cairn
# Use it instead of cargo build
cargo cairn build
cargo cairn test
cargo cairn build --release
On first run, cairn auto-creates .cairn/ - no init needed.
$ cargo cairn build
πΈ Cairn: Snapshotting current state...
Compiling myproject v0.1.0
Finished dev [unoptimized + debuginfo] target(s) in 2.34s
β Cairn: Patch created
$ cairn list
Patches (newest first):
#2 maple-crane-forest-pixel-dance (CURRENT, NEWEST)
#1 cloud-river-stone-bright-moon
#0 swift-ocean-light-paper-wind
Key insight: cargo cairn snapshots your code BEFORE the build starts, then only commits the patch if the build succeeds. This guarantees the patch matches exactly what was compiled.
Automatic patches on successful builds:
Instant rollback:
$ cairn rollback cloud-river-stone-bright-moon
β Rolled back to patch cloud-river-stone-bright-moon
47 files updated
$ cargo build
Finished dev in 0.23s # Guaranteed to work
Mnemonic patch IDs:
cairn rollback maple worksVSCode Extension:
git clone https://github.com/nickspiker/cairn
cd cairn
cargo install --path .
This installs both cairn (CLI) and cargo-cairn (build wrapper).
Install from marketplace: search "Cairn" by nickspiker
Or install manually:
cd vscode-extension
npm install
npm run compile
vsce package
# Then: Extensions β Install from VSIX
cairn # Show help
cairn init # Initialize .cairn/ (optional - auto-inits on first build)
cairn list # List all patches
cairn show <patch-id> # Show patch details
cairn rollback <patch-id> # Rollback to a patch
cargo cairn build # Build with auto-snapshot
cargo cairn test # Test with auto-snapshot
cargo cairn build --release # Release build with auto-snapshot
Configure build commands in settings.json:
{
"cairn.buildCommands": [
{"label": "Build", "command": "build", "icon": "tools"},
{"label": "Release", "command": "build --release", "icon": "rocket"},
{"label": "Test", "command": "test", "icon": "beaker"},
{"label": "Check", "command": "check", "icon": "check"}
]
}
Repository structure:
.cairn/
βββ state.vsf # Current state + patch list
βββ patches/ # VSF-encoded patches (content-addressed)
βββ xiN2nO...lKI
βββ a3f8d9...e1b
Patch format (VSF-encoded):
Excluded from snapshots:
.cairn/, target/, .git/, node_modules/, out/, dist/*.vsix, *.wasm, Cargo.lock, package-lock.json.env, etc.)Cairn complements Gitβuse both:
Cairn doesn't replace Git. It solves a different problem: "give me the last state that compiled."
# Typical workflow
git checkout -b feature
cargo cairn build # Snapshot as you develop
cargo cairn build # Each successful build = new patch
cairn rollback ... # Oops, go back
cargo cairn build # Try again
git add -A && git commit # When ready, commit to git
Current stability issues:
Design limitations:
Recommendation: Use alongside Git. Cairn should complement, not replace, your version control.
MIT or Apache-2.0, your choice.
Nick Spiker - Building correct tools from first principles.
Cairn: Because every successful build deserves to be saved.