LibraLibra
LibraLibra
DocsBlogLibra
Getting Started
Architecture
Design
Commands
libra addlibra agentlibra alternateslibra applylibra archivelibra authlibra automationlibra bisectlibra blamelibra branchlibra bundlelibra cachelibra cat-filelibra check-attrlibra check-ignorelibra check-mailmaplibra checkoutlibra cherry-picklibra cleanlibra clonelibra cloudlibra code-controllibra codelibra commit-treelibra commitlibra completionslibra configlibra credentiallibra depslibra describelibra diff-fileslibra diff-indexlibra diff-treelibra difflibra dirtylibra fast-exportlibra fast-importlibra fetchlibra filelibra for-each-reflibra format-patchlibra fscklibra gclibra graphlibra greplibra hash-objectlibra hookslibra hydratelibra index-packlibra initlibra investigatelibra layerlibra lfslibra loglibra logfilelibra loginlibra logoutlibra ls-fileslibra ls-remotelibra ls-treelibra maintenancelibra medialibra merge-baselibra merge-filelibra mergelibra metadatalibra mvlibra noteslibra oplibra openlibra pack-objectslibra packagelibra prunelibra publishlibra pulllibra pushlibra read-treelibra rebaselibra refloglibra remotelibra repacklibra replacelibra rererelibra resetlibra restorelibra rev-listlibra rev-parselibra revertlibra reviewlibra revisionlibra rmlibra sandboxlibra servicelibra shortloglibra show-reflibra showlibra sparse-viewlibra stashlibra statslibra statuslibra switchlibra symbolic-reflibra taglibra update-indexlibra update-reflibra usagelibra verify-packlibra whoamilibra worktreelibra write-tree
API Reference
Policy

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.

Global Flags

Every Libra command accepts the following global flags:

FlagShortDescription
--json-JOutput as JSON (formats: pretty, compact, ndjson)
--machineStrict machine mode (implies --json=ndjson --no-pager --color=never --quiet)
--no-pagerDisable pager (less)
--colorWhen to use colors (auto, never, always)
--no-colorDisable colors; equivalent to --color=never
--quiet-qSuppress stdout
--exit-code-on-warningReturn exit code 9 on warnings
--progressControl progress output (json, text, none, auto)

Command Index

Repository Setup

CommandAliasDescriptionDoc
libra initCreate a new Libra repository with SQLite-backed metadata, vault signing, and optional Git importinit.md
libra cloneClone a remote repository with vault bootstrapping, shallow clone, and single-branch supportclone.md
libra configcfgManage repository-local and user-global configuration with vault-backed secret encryptionconfig.md
libra completionsGenerate a shell completion script (bash/zsh/fish/powershell/elvish) from the live CLIcompletions.md

Staging & Working Tree

CommandAliasDescriptionDoc
libra addStage file changes from the working tree into the indexadd.md
libra rmremove, deleteRemove files from the working tree and/or the indexrm.md
libra mvMove or rename files, directories, or symlinksmv.md
libra restoreunstageRestore working tree files or unstage changes from the indexrestore.md
libra cleanRemove untracked files from the working tree (requires -n or -f)clean.md
libra stashSave and restore temporary changes with push/pop/list/apply/drop subcommandsstash.md
libra statusstShow the state of the working tree, staging area, and upstream trackingstatus.md
libra dirtyAdvisory dirty-set marks for the status cache (Libra extension)dirty.md
libra revisionRevision ordinal index over first-parent chains (Libra extension)revision.md
libra commit-treegit commit-treeCreate a commit object from a tree (plumbing)commit-tree.md
libra authHost-scoped HTTP token auth (Libra extension)auth.md
libra serviceHeadless local service: notification bus + dirty-mark ingestion (Libra extension)service.md

Commits & History

CommandAliasDescriptionDoc
libra commitciRecord staged changes as a new commit with optional vault signing and conventional formatcommit.md
libra loghist, historyShow commit history with graph, patch, stat, and custom format supportlog.md
libra logfileInspect the tracing log-file configuration (path, rotation, filter, size)logfile.md
libra shortlogslogSummarize reachable commits grouped by authorshortlog.md
libra showDisplay a commit, tag, tree, blob, or REV:path contentshow.md
libra diffCompare differences between HEAD, index, working tree, or two revisionsdiff.md
libra diff-treeDiff between two trees (git diff-tree)diff-tree.md
libra diff-indexDiff a tree against the working tree (git diff-index)diff-index.md
libra diff-filesDiff the index against the working tree (git diff-files)diff-files.md
libra fast-exportEmit history as a git fast-import streamfast-export.md
libra fast-importImport a git fast-import streamfast-import.md
libra blameTrace each line of a file to its introducing commitblame.md
libra describedescFind the nearest reachable tag and format as tag-N-g<abbrev>describe.md
libra grepSearch for patterns in tracked files with regex, revision, and index supportgrep.md
libra reflogView, delete, or check existence of reference change logsreflog.md
libra rev-listList commit objects reachable from a revisionrev-list.md
libra rev-parseParse revision names, abbreviate refs, and print repository pathsrev-parse.md

Branching & Navigation

CommandAliasDescriptionDoc
libra branchbrCreate, delete, rename, list, and inspect branchesbranch.md
libra metadataBranch/repo metadata key-value store (protect/archive/lineage foundation)metadata.md
libra tagCreate, list, or delete lightweight and annotated tagstag.md
libra switchswSwitch branches, create new branches, or detach HEAD with fuzzy suggestionsswitch.md
libra checkoutBranch compatibility surface and explicit -- path-restore alias; prefer switch / restorecheckout.md

History Manipulation

CommandAliasDescriptionDoc
libra resetMove HEAD and optionally reset index or working directoryreset.md
libra mergeFast-forward merge a branch into the current branchmerge.md
libra merge-fileThree-way merge of three files (git merge-file)merge-file.md
libra merge-baseFind the best common ancestor(s) of two commitsmerge-base.md
libra rebaserbReapply commits on top of another base tip with conflict resolutionrebase.md
libra cherry-pickcpApply changes from existing commits onto the current branchcherry-pick.md
libra revertCreate a new commit that undoes changes from a specified commitrevert.md
libra replaceSubstitute one object for another on read (refs/replace)replace.md
libra rerereReuse recorded conflict resolutionsrerere.md
libra bisectBinary search to find the commit that introduced a bug; supports start / bad / good / reset / skip / log / run / viewbisect.md
libra bundleCreate and inspect Git v2 bundle files (create / verify / list-heads)bundle.md

Remote Operations

CommandAliasDescriptionDoc
libra remoteManage remote repositories: add, remove, rename, inspect URLs, prune stale refsremote.md
libra fetchDownload objects and update remote-tracking refs from one or all remotesfetch.md
libra ls-remoteList references advertised by a remote repository without fetching objectsls-remote.md
libra pushSend local commits and objects to a remote with LFS integrationpush.md
libra pullFetch and fast-forward merge into the current branchpull.md
libra openOpen the repository's remote URL in the system browseropen.md
libra lfsManage Large File Storage: track, lock, unlock, list LFS fileslfs.md
libra credentialVault-backed Git credential helper (fill/store/erase)credential.md
libra loginAuthenticate to a Libra host (/api/cli/*) and store a host-scoped session tokenlogin.md
libra logoutClear stored Libra host session tokens (--all / --local-only)logout.md
libra whoamiReport the identity for a stored Libra host session tokenwhoami.md

Cloud & Storage

CommandAliasDescriptionDoc
libra cloudCloud backup and restore operations via Cloudflare D1/R2cloud.md
libra cacheInspect the tiered-storage / LRU cache configuration (type, threshold, budget)cache.md
libra publishManage read-only Cloudflare Worker publishingpublish.md
libra worktreewtManage multiple working trees attached to the repositoryworktree.md

AI & Development

CommandAliasDescriptionDoc
libra codeInteractive TUI with AI agent, web server, and MCP integrationcode.md
libra code-controlDrive a local Libra Code TUI automation control sessioncode-control.md
Codex data storageLink libra code --provider codex to Codex app-server and persist Codex session datacodex-data-storage.md
libra automationList, run, and inspect AI automation rulesautomation.md
libra usageReport and prune AI provider/model usage aggregatesusage.md
libra graphInspect a Libra Code thread version graph in a dedicated TUIgraph.md
libra sandboxInspect AI sandbox diagnostics, including OS backend availability and downgrade warningssandbox.md
libra agentManage external-agent capture, checkpoints, hooks, and RPC adaptersagent.md

Low-Level & Inspection

CommandAliasDescriptionDoc
libra applyCheck whether a unified-diff patch applies (--check)apply.md
libra cat-fileInspect Git objects and AI objects by type, size, or pretty-printed contentcat-file.md
libra check-attrReport .libra_attributes attributes (e.g. filter) for pathnamescheck-attr.md
libra check-mailmapResolve Name <email> contacts through .mailmapcheck-mailmap.md
libra check-ignoreReport which pathnames are excluded by .libraignore rulescheck-ignore.md
libra fsckVerify the integrity of objects, refs, and index in a Libra repositoryfsck.md
libra hash-objectCompute Git-compatible blob object IDs from files or standard inputhash-object.md
libra write-treeWrite the current index out as a tree objectwrite-tree.md
libra read-treeRead a tree object into the index (index-only)read-tree.md
libra update-indexModify the index directly (add/remove/cacheinfo)update-index.md
libra update-refSafely update, create, or delete a branch ref under refs/heads/update-ref.md
libra verify-packValidate pack index files against their pack archivesverify-pack.md
libra show-refList local refs (branches, tags, HEAD) and their object IDsshow-ref.md
libra symbolic-refRead or update the symbolic HEAD refsymbolic-ref.md
libra index-packBuild a .idx pack index file for an existing .pack archive (hidden)index-pack.md
libra hooksExternal AI agent (Claude Code / Gemini) hook entry point; called by configs installed by libra agent enable (hidden)hooks.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

PrefixDomain
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 (auth failure, timeout, DNS)
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:

  1. Git compatibility where it makes sense — Most commands mirror Git's flag names and behavior so existing muscle memory transfers directly.
  2. Structured output as a first-class citizen — --json and --machine are 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.
  3. SQLite over flat files — Refs, config, and metadata are stored in SQLite for transactional consistency and atomic updates.
  4. Security by default — Vault-backed signing and secret encryption are enabled by default, not opt-in.
  5. Explicit over implicit — Commands like clean require -f or -n; status --exit-code is an explicit opt-in rather than Git's ambiguous exit code behavior.
  6. Actionable errors — Every error includes a stable code (LBR-*), a human-readable message, and a hint for resolution.
  7. AI-native development — The libra code command integrates AI agents directly into the version control workflow with multi-provider support and MCP protocol.
  8. Cloud-native storage — Built-in tiered storage (S3/R2) and cloud backup (D1/R2) for distributed monorepo workflows.

AI Object Model Reference

Consolidated reference for Libra Agent object model and boundaries

libra add

Command reference for `libra add`

On this page

Global FlagsCommand IndexRepository SetupStaging & Working TreeCommits & HistoryBranching & NavigationHistory ManipulationRemote OperationsCloud & StorageAI & DevelopmentLow-Level & InspectionStructured Output EnvelopeError Code NamespacesDesign Philosophy