Commands
Detailed command reference for the Libra CLI
This directory contains detailed documentation for all Libra CLI commands. Each document includes a synopsis, option reference, human and structured (JSON) output examples, design rationale, and a parameter comparison with Git and jj.
Compatibility is tracked at two levels: each command page describes the
user-facing behavior of that command, while
COMPATIBILITY.md
grades the P0/P1 command surface by sub-face (common-user-flow,
porcelain-machine, conflict-aware, config-aware, and
plumbing-compatible). Use the sub-face table when a script depends on a
specific Git-compatible surface such as porcelain output, conflict handling, or
plumbing syntax.
Repository-local VCS hooks are documented separately in
Repository hooks; the hidden libra hooks command is an
unrelated AI-agent event ingestion surface.
Global Flags
Every Libra command accepts the following global flags:
| Flag | Short | Description |
|------|-------|-------------|
| --json | -J | Output as JSON (formats: pretty, compact, ndjson) |
| --machine | | Strict machine mode (implies --json=ndjson --no-pager --color=never --quiet) |
| --no-pager | | Disable pager (less) |
| --color | | When to use colors (auto, never, always) |
| --no-color | | Disable colors; equivalent to --color=never |
| --quiet | -q | Suppress stdout |
| --exit-code-on-warning | | Return exit code 9 on warnings |
| --progress | | Control progress output (json, text, none, auto) |
| --sync-data | | fsync object writes and parent directories; also LIBRA_SYNC_DATA=1, with additional write cost. |
| --offline | | Read objects only from local storage; never fetch missing objects from the durable tier. |
| --max-connections <N> | | Bound remote connections/requests (default 16; 0 means 1); also LIBRA_MAX_CONNECTIONS. |
| --literal-pathspecs | | Treat pathspecs as literal (no glob, no :(magic)). Also GIT_LITERAL_PATHSPECS=1. An unrecognized GIT_LITERAL_PATHSPECS value warns once and is treated as disabled (Git refuses to run; ADR-AU-06 §3). |
| --no-literal-pathspecs | | Cancel --literal-pathspecs / GIT_LITERAL_PATHSPECS (last flag wins). |
Command Index
Repository Setup
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra init | | Create a new Libra repository with SQLite-backed metadata, vault signing, and optional Git import | init.md |
| libra clone | | Clone a remote repository with vault bootstrapping, shallow clone, and single-branch support | clone.md |
| libra config | cfg | Manage repository-local and user-global configuration with vault-backed secret encryption | config.md |
| libra completions | | Generate a shell completion script (bash/zsh/fish/powershell/elvish) from the live CLI | completions.md |
Staging & Working Tree
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra add | | Stage file changes from the working tree into the index | add.md |
| libra rm | remove, delete | Remove files from the working tree and/or the index | rm.md |
| libra mv | | Move or rename files, directories, or symlinks | mv.md |
| libra restore | unstage | Restore working tree files or unstage changes from the index | restore.md |
| libra clean | | Remove untracked files from the working tree (requires -n or -f) | clean.md |
| libra stash | | Save and restore temporary changes with push/pop/list/apply/drop subcommands | stash.md |
| libra status | st | Show the state of the working tree, staging area, and upstream tracking | status.md |
| libra dirty | | Advisory dirty-set marks for the status cache (Libra extension) | dirty.md |
| libra revision | | Revision ordinal index over first-parent chains (Libra extension) | revision.md |
| libra commit-tree | git commit-tree | Create a commit object from a tree (plumbing) | commit-tree.md |
| libra auth | | Host-scoped HTTP token auth (Libra extension) | auth.md |
| libra service | | Headless local service: notification bus + dirty-mark ingestion (Libra extension) | service.md |
Commits & History
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra commit | ci | Record staged changes as a new commit with optional vault signing and conventional format | commit.md |
| libra am | | Apply plain-text format-patch mails with continue/skip/abort recovery | am.md |
| libra format-patch | | Generate Git-consumable plain or MIME mbox patch series | format-patch.md |
| libra log | hist, history | Show commit history with graph, patch, stat, and custom format support | log.md |
| libra logfile | | Inspect the tracing log-file configuration (path, rotation, filter, size) | logfile.md |
| libra shortlog | slog | Summarize reachable commits grouped by author | shortlog.md |
| libra show | | Display a commit, tag, tree, blob, or REV:path content | show.md |
| libra diff | | Compare differences between HEAD, index, working tree, or two revisions | diff.md |
| libra diff-tree | | Diff between two trees (git diff-tree) | diff-tree.md |
| libra diff-index | | Diff a tree against the working tree (git diff-index) | diff-index.md |
| libra diff-files | | Diff the index against the working tree (git diff-files) | diff-files.md |
| libra fast-export | | Emit multi-ref/range history, tags, and notes as a Git fast-import stream | fast-export.md |
| libra fast-import | | Import quoted/inline/tag/notes fast-import streams with atomic ref publication | fast-import.md |
| libra blame | | Trace each line of a file to its introducing commit | blame.md |
| libra describe | desc | Find the nearest reachable tag and format as tag-N-g<abbrev> | describe.md |
| libra grep | | Search for patterns in tracked files with regex, revision, and index support | grep.md |
| libra reflog | | View, delete, or check existence of reference change logs | reflog.md |
| libra rev-list | | List commit objects reachable from a revision | rev-list.md |
| libra rev-parse | | Parse revision names, abbreviate refs, and print repository paths | rev-parse.md |
Branching & Navigation
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra branch | br | Create, delete, rename, list, and inspect branches | branch.md |
| libra metadata | | Branch/repo metadata key-value store (protect/archive/lineage foundation) | metadata.md |
| libra tag | | Create, list, or delete lightweight and annotated tags | tag.md |
| libra switch | sw | Switch branches, create new branches, or detach HEAD with fuzzy suggestions | switch.md |
| libra checkout | | Branch compatibility surface and explicit -- path-restore alias; prefer switch / restore | checkout.md |
History Manipulation
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra reset | | Move HEAD and optionally reset index or working directory | reset.md |
| libra merge | | Fast-forward merge a branch into the current branch | merge.md |
| libra mergetool | | Resolve ordinary content conflicts using a configured external tool | mergetool.md |
| libra merge-file | | Three-way merge of three files (git merge-file) | merge-file.md |
| libra merge-base | | Find the best common ancestor(s) of two commits | merge-base.md |
| libra rebase | rb | Reapply commits on top of another base tip with conflict resolution | rebase.md |
| libra cherry-pick | cp | Apply changes from existing commits onto the current branch | cherry-pick.md |
| libra revert | | Create a new commit that undoes changes from a specified commit | revert.md |
| libra replace | | Substitute one object for another on read (refs/replace) | replace.md |
| libra rerere | | Reuse recorded conflict resolutions | rerere.md |
| libra bisect | | Binary search to find the commit that introduced a bug; supports start / bad / good / reset / skip / log / run / view | bisect.md |
| libra bundle | | Create, verify, inspect, and unbundle Git v2 bundles | bundle.md |
Remote Operations
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra remote | | Manage remote repositories: add, remove, rename, inspect URLs, prune stale refs | remote.md |
| libra fetch | | Download objects and update remote-tracking refs from one or all remotes | fetch.md |
| libra ls-remote | | List references advertised by a remote repository without fetching objects | ls-remote.md |
| libra push | | Send local commits and objects to a remote with LFS integration | push.md |
| libra pull | | Fetch and fast-forward merge into the current branch | pull.md |
| libra open | | Open the repository's remote URL in the system browser | open.md |
| libra lfs | | Manage Large File Storage: track, lock, unlock, list LFS files | lfs.md |
| libra credential | | Vault-backed Git credential helper (fill/store/erase) | credential.md |
| libra login | | Authenticate to a Libra host (/api/cli/*) and store a host-scoped session token | login.md |
| libra logout | | Clear stored Libra host session tokens (--all / --local-only) | logout.md |
| libra whoami | | Report the identity for a stored Libra host session token | whoami.md |
Cloud & Storage
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra cloud | | Cloud backup and restore operations via Cloudflare D1/R2 | cloud.md |
| libra cache | | Inspect the tiered-storage / LRU cache configuration (type, threshold, budget) | cache.md |
| libra publish | | Removed. Use libra cloud for repository backup | publish.md |
| libra worktree | wt | Manage multiple working trees attached to the repository | worktree.md |
AI & Development
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra code | | Removed. Capture external agents with libra agent | code.md |
| libra code-control | | Removed with libra code. Use libra agent | code-control.md |
| libra automation | | List, run, and inspect AI automation rules | automation.md |
| libra usage | | Removed. Usage stats only served the deleted developer agent | usage.md |
| libra graph | | Removed. Use libra --json agent graph <session> for the capture graph | graph.md |
| libra sandbox | | Inspect AI sandbox diagnostics, including OS backend availability and downgrade warnings | sandbox.md |
| libra memory | | Inspect / rebuild the deterministic Agent development-history projection (read-only) | memory.md |
| libra agent | | Manage external-agent capture, checkpoints, hooks, and RPC adapters | agent.md |
Low-Level & Inspection
| Command | Alias | Description | Doc |
|---------|-------|-------------|-----|
| libra apply | | Check whether a unified-diff patch applies (--check) | apply.md |
| libra mailinfo | | Extract metadata, message body, and patch text from one email patch | mailinfo.md |
| libra cat-file | | Inspect Git objects and AI objects by type, size, or pretty-printed content | cat-file.md |
| libra check-attr | | Report Git/Libra attributes (e.g. filter, diff, export-ignore) for pathnames | check-attr.md |
| libra check-mailmap | | Resolve Name <email> contacts through .mailmap | check-mailmap.md |
| libra check-ignore | | Report which pathnames are excluded by Git/Libra ignore rules | check-ignore.md |
| libra fsck | | Verify the integrity of objects, refs, and index in a Libra repository | fsck.md |
| libra hash-object | | Compute Git-compatible blob object IDs from files or standard input | hash-object.md |
| libra write-tree | | Write the current index out as a tree object | write-tree.md |
| libra read-tree | | Read a tree object into the index (index-only) | read-tree.md |
| libra update-index | | Modify the index directly (add/remove/cacheinfo) | update-index.md |
| libra update-ref | | Safely update, create, or delete a refs/heads/<branch> ref | update-ref.md |
| libra verify-pack | | Validate pack index files against their pack archives | verify-pack.md |
| libra count-objects | | Count unpacked objects and their disk consumption (-v, -H) | count-objects.md |
| libra show-ref | | List local refs (branches, tags, HEAD) and their object IDs | show-ref.md |
| libra symbolic-ref | | Read or update the symbolic HEAD ref | symbolic-ref.md |
| libra index-pack | | Build a .idx pack index file for an existing .pack archive (hidden) | index-pack.md |
| libra hooks | | Claude Code / Codex hook entry point, with a legacy Gemini entry (hidden); OpenCode uses libra agent hooks opencode | hooks.md |
Unsupported Git Transport Commands
| Git command | Libra status | Safe workflow | Doc |
|-------------|--------------|---------------|-----|
| git send-email | No libra send-email; Libra performs no SMTP delivery | Generate with libra format-patch, then validate/send with stock Git or another mailer | send-email.md |
Additional registered commands
These entries complete the current CLI index. media requires a build with the fastcdc feature; hidden plumbing entries are not ordinary user commands.
| Command | Availability | Description | Doc |
|---|---|---|---|
| libra alternates | public | Manage alternate object stores | alternates.md |
| libra archive | public | Create an archive from a tree | archive.md |
| libra deps | public | Manage the file dependency graph | deps.md |
| libra file | public | Inspect object-level operations and payload erasure | file.md |
| libra for-each-ref | public | Format and filter references | for-each-ref.md |
| libra gc | public | Clean up repository objects and refs | gc.md |
| libra hydrate | public | Hydrate working-tree content on demand | hydrate.md |
| libra investigate | public | Run read-only external-agent investigations | investigate.md |
| libra layer | public | Manage never-committed local working-tree overlays | layer.md |
| libra ls-files | public | List index and working-tree paths | ls-files.md |
| libra ls-tree | public | List tree object contents | ls-tree.md |
| libra maintenance | public | Run repository maintenance tasks | maintenance.md |
| libra media | fastcdc feature only | FastCDC LFS media chunking | media.md |
| libra mega2 | public | Browse a Mega2 remote repository | mega2.md |
| libra notes | public | Manage commit notes | notes.md |
| libra op | public | Inspect and restore command-level operation history | op.md |
| libra pack-objects | hidden plumbing | Create a pack from object IDs on stdin | pack-objects.md |
| libra repack | public | Combine repository objects into a pack | repack.md |
| libra review | public | Run read-only external-agent code reviews | review.md |
| libra sparse-view | public | Manage read-only sparse view filters | sparse-view.md |
| libra ui | public command; the desktop window is always built | Open the desktop window | ui.md |
| libra upgrade | public | Check the signed stable channel and upgrade the installation | upgrade.md |
Structured Output Envelope
All commands that support --json / --machine return a consistent JSON envelope:
{
"ok": true,
"command": "<command-name>",
"data": { ... }
}
On error:
{
"ok": false,
"command": "<command-name>",
"error": {
"code": "LBR-XXX-NNN",
"message": "Human-readable error description",
"hint": "Suggested fix or next step"
}
}
Error Code Namespaces
| Prefix | Domain |
|--------|--------|
| LBR-REPO-* | Repository state errors (not a repo, corrupt objects, missing refs) |
| LBR-CLI-* | CLI argument validation errors (invalid flags, missing required args) |
| LBR-NET-* | Network and transport errors (timeout, DNS, protocol failure) |
| LBR-AUTH-* | Authentication, authorization, and credential errors |
| LBR-FS-* | Filesystem errors (permission denied, disk full, path encoding) |
| LBR-IDX-* | Index/staging area errors (corrupt index, lock contention) |
| LBR-OBJ-* | Object storage errors (missing object, hash mismatch) |
| LBR-VAULT-* | Vault and encryption errors (unseal failure, key generation) |
Design Philosophy
Libra's command-line interface is designed with these principles:
- Git compatibility where it makes sense — Most commands mirror Git's flag names and behavior so existing muscle memory transfers directly.
- Structured output as a first-class citizen —
--jsonand--machineare global flags, and structured output is enabled command-by-command as each surface is modernised. Individual command pages document the currently stable machine-readable contract. - SQLite over flat files — Refs, config, and metadata are stored in SQLite for transactional consistency and atomic updates.
- Security by default — Vault-backed signing and secret encryption are enabled by default, not opt-in.
- Explicit over implicit — Commands like
cleanrequire-for-n;status --exit-codeis an explicit opt-in rather than Git's ambiguous exit code behavior. - Actionable errors — Every error includes a stable code (
LBR-*), a human-readable message, and a hint for resolution. - AI-native development — External-agent capture (
libra agent) observes Claude/Codex/OpenCode sessions into versioned checkpoints; read-onlyreview/investigaterun supervised agents (thelibra codeWeb UI was removed in 0.23.0). - Cloud-native storage — Built-in tiered storage (S3/R2) and cloud backup (D1/R2) for distributed monorepo workflows.