batty-251/cbx

Open-source version control for projects of any size: snapshots, content-defined chunking, real merges, offline first. Format and sync protocol specified. Apache 2.0. Mirror: github.com/AlexC1991/cbx

By Batty 251 (@batty-251) · Licence: Apache-2.0 · 3 published versions · 248 files · 2.9 MB of source · Last published 2026-11-10

A public project on CodeRook. Browse it at https://coderook.com/batty-251/cbx.

Versions

Files in the latest version

README

CBX

CBX is version control for projects of any size: game projects, asset
libraries, datasets and model weights, as well as ordinary code. It keeps a
full history in your project folder and works entirely offline.
CodeRook is one place you can push that history, and
the protocol for doing so is published here too.

npm install -g @coderook/cli

cbx init
cbx save -m "First playable build"
cbx switch -c new-movement
cbx save -m "Try a double jump"
cbx switch main
cbx merge new-movement
cbx log

What it does

Commands

cbx initStart a history in this folder (.cbx/)
cbx save -m "…"Record the folder as it is
cbx status, cbx diffWhat changed since the last save
cbx logThe saves on this line
cbx switch [-c] <line>Move to another line, or start one
cbx merge <line>Bring another line's work into this one
cbx restore [paths] --from <save>Put files back the way a save had them
cbx push, cbx pullSync with CodeRook

cbx help <command> explains each one. The same binary also carries the
CodeRook account commands (submit, get, clone, projects, …); a folder
without a .cbx/ history behaves exactly as it always has.

Specifications

The format's test vectors are read out of the document by
cbx/test/spec_vectors.test.ts and checked against the code, so the two
cannot drift apart unnoticed.

In this repository

FolderWhat it is
[cbx/](cbx)The engine: storage, chunking, the local history, merging, push and pull. Node's standard library only.
[cbx/engine/](cbx/engine)The native byte engine (Rust): the same objects, faster, and the native cbx described below.
[cli/](cli)The cbx command line, published as @coderook/cli.

Build and test

Node 22.15 or later (it uses zlib's zstd, added in 22.15 and 23.8).

cd cbx && npm ci && npm test
cd ../cli && npm ci && npm test

A native cbx

Installed from npm, every cbx starts Node first: npm's launchers always do.
Built from this repository, the engine can be the cbx command itself. It
answers cbx status on its own when the history lets it (no Node at all) and
hands every other command to the command line.

cd cbx && npm ci && npm run build
cd ../cli && npm ci && npm run build
cd ../cbx/engine && cargo build --release
# Put the engine at the top of this checkout under the name cbx, and that folder on your PATH:
cp target/release/cbx-engine ../../cbx        # Windows: copy target\release\cbx-engine.exe ..\..\cbx.exe

Next to it, cli/dist/cli/src/bin.js is found on its own; elsewhere, set
CBX_CLI to that file (and CBX_NODE if Node is not on the PATH). The status
it answers is the one the full command line prints, byte for byte, and it
answers only where it can vouch for that: see
[cbx/engine/README.md](cbx/engine/README.md#as-the-cbx-command). On an
8,525-file folder a quiet status took 47 ms this way, against 57–68 ms for
git status, and 47 ms with a file edited, against 57–70 ms.

The cbx-local 2 history (preview)

CBX_LOCAL_FORMAT=2 cbx init makes a history that keeps the same objects
and save ids in solid blocks and deltas: over 20 saves of three real folders
it came to 13–14% less than Git after git gc --aggressive on two of them
and 5% less on the third. It is a preview, and is not the default yet. An
older cbx refuses such a history and asks to be updated. The design is in
[cbx/engine/V2-STORE.md](cbx/engine/V2-STORE.md). The native status above
answers only in these histories.

Licence

Copyright 2026 ACCA Gaming Productions. Licensed under the Apache License,
Version 2.0; see [LICENSE](LICENSE) and [NOTICE](NOTICE).

"CodeRook" is a name of ACCA Gaming Productions. The licence covers this code,
not the name, and not the CodeRook service.

PUBLIC REPOSITORY

Opening batty-251/cbx…

Loading the public version history and verified file tree.