Command Line Interface (CLI)
Introduction
blunderDB ships a full command line interface (CLI) in the same executable as the graphical interface. The CLI is especially useful for:
bulk import of matches: import an entire directory of match files (XG, SGF, MAT, BGF…) in a single command,
automation: integrate blunderDB into shell scripts for regular backups, scheduled exports, or processing pipelines,
server usage: manage databases on machines without a graphical environment,
quick inspection: check the contents or integrity of a database without launching the graphical interface.
The CLI shares exactly the same database format as the graphical interface: both write the same file, there is nothing to synchronise.
Note
If the application is open while a script writes. The file is in WAL mode: a read never blocks a write, and the two programs work on the same database without getting in each other’s way. Two writes, however, queue up — the second waits for the write lock (ten seconds per statement, plus a few retries) and only fails once the wait is exhausted, with a message naming SQLite:
Error: failed to import match: sqlite: save match: database is locked (5) (SQLITE_BUSY)
The graphical interface does not watch the file: it keeps displaying what it had loaded until CTRL-R reloads the positions. Nothing is lost, but the screen lags behind the database.
General syntax
The mode is detected automatically: if the first argument is a CLI command, blunderDB launches in headless mode, otherwise it launches the graphical interface.
# GUI
./blunderdb
# CLI
./blunderdb <command> [options]
The examples on this page write ./blunderdb: the binary as downloaded, called from the folder it sits in. Installed by a package, or linked from a folder on the PATH (see Download and Installation), it is simply called blunderdb.
Boolean options announced “default: yes” are turned off with the --option=false form — --recursive=false, --analysis=false. The space-separated form does not exist: --recursive false leaves the option at its default value and treats false as a stray argument.
Available commands
Command |
Description |
|---|---|
create |
Create a new database. |
import |
Import data (match, position, batch). |
export |
Export data. |
transfer |
Copies part of a library into another, with no intermediate file. |
identity |
Show or move the issuer identity (the watermark signing key). |
open |
Turns a password-protected file (.dbx) into an ordinary database. |
search |
Search positions with filters. |
list |
Display database contents. |
match |
Display match positions and analysis. |
transcribe |
Replays a transcription and reports what the replay finds. |
duel |
Plays a Duel one Action per call (creation, move, cube, forfeit, stop). |
collection |
Manage collections (list, contents, creation, renaming, deletion, export). |
study |
The study queue: the reference player’s unprocessed blunders, and the “seen” mark. |
lesson |
Manages lessons (ordered steps showing collections and positions) and exports them. |
anki |
Spaced-repetition decks (list, statistics, forecast, synchronisation). |
stats |
Statistics computed separately from |
training |
The training log (sessions, missed positions). |
comment |
Reads and adds the comments of a position, attributed to their author. |
elsewhere |
What other databases know about a position, and its neighbours there. |
cubematrix |
A position’s cube verdict at each score of a match. |
rollout |
Plays a position out to the end to separate its moves or its cube decision (XGID or OGID). |
epc |
Computes the Effective Pip Count and the cube verdict of a bearoff position (XGID or OGID). |
gnubgid |
Writes the position ID and the match ID that GNU Backgammon gives a position (XGID or OGID). |
capture |
Reads the position shown by a screenshot of an eXtreme Gammon board. |
openingbook |
The opening move, or a game’s reply at a given score, drawn from the embedded opening book and judged against it. |
bearoff |
Builds, lists, verifies and deletes bearoff databases. |
analyze |
Writes a gammonNet analysis for every position that has none. |
tournament |
Reads a directed tournament (standings, brackets, pages) and confirms its proposals. |
players |
A player’s spellings (aliases), merging and swapping players. |
events |
An event’s spellings (aliases). |
trash |
The trash: list, restore, undoable deletion. |
info |
Display database metadata. |
edit |
Edit the database metadata and thresholds. |
verify |
Verify database integrity. |
vacuum |
Compacts the database file, reclaiming freed space. |
met |
Lists, imports and chooses the database’s match equity table. |
reencode |
Rewrites analyses in the compact format. |
repair |
Recomputes what the database derives from what it stores. |
maintenance |
The health of the database: counters, actions and latest runs. |
delete |
Delete data. |
healthcheck |
Asks a running |
mcp |
Offers the database tools to an AI assistant (Model Context Protocol). |
completion |
Print a shell completion script (bash, zsh, fish). |
help |
Show help. |
version |
Show version. |
serve, migrate, call |
Server mode and migration to PostgreSQL: see Headless mode (server). |
Each command accepts the --help option to display its detailed help.
- Import, export, transfer
- Library: search, lists, collections
- Matches, tournaments and games
- Analysis and engine
- Study, lessons and training
- Statistics
- Database administration
- info — Database metadata
- edit — Edit metadata
- verify — Verify integrity
- vacuum — Compacting the database
- met — The library match equity table
- reencode — Rewrite analyses in the compact format
- maintenance — The health of the database
- players — A player’s spellings
- events — An event’s spellings
- repair — Recompute what is derived
- delete — Delete data
- healthcheck — Probing a daemon
- mcp — Offer the database to an AI assistant
- completion — Shell completion
- version — Show the version
Workflow examples
Import a tournament directory
./blunderdb create --db tournoi_paris.db --user "Jean" --description "Open de Paris 2025"
./blunderdb import --db tournoi_paris.db --type batch --dir ./matchs_open_paris/
./blunderdb list --db tournoi_paris.db --type stats
Regular backup
./blunderdb export --db production.db --type database --file sauvegarde-$(date +%Y%m%d).db
Error analysis
# Les positions délicates, puis celles de videau
./blunderdb search --db production.db --error-min 0.1 --export blunders.db
./blunderdb search --db production.db --decision cube --error-min 0.05 --export cube_errors.db
# Les coups réellement fautifs : au moins 100 millièmes d'équité perdus
./blunderdb search --db production.db --move-error-min 100 --format json
Exit codes
0— Success.1— Error.
This makes the CLI suitable for use in scripts with error handling:
if ./blunderdb import --db base.db --type match --file match.xg; then
echo "OK"
else
echo "KO"
exit 1
fi