Command-Line Interface (CLI) Reference
The libspec package installs a unified global command-line entry point: libspec. In project workspaces, always run using the uv run command runner to ensure the correct environment bindings are loaded.
Global Commands
init
Initializes a new libspec workspace context in the current working directory.
spec/ blueprint folder, .libspec/ metadata marker.
* Installs: Automated Git post-commit hooks for VCS snapshot linking.
diff
Diffs specification snapshots natively.
* No arguments: Compiles live spec files on-the-fly (PENDING) and diffs them against the latest recorded snapshot in the database (#0).
* One argument: Diffs the specified snapshot against #0.
* Two arguments: Diffs snapshot_a against snapshot_b.
link
Links a specification snapshot to a specific Version Control System (VCS) revision.
*--revision <text>: (Required) The unique revision identifier (e.g. Git commit SHA).
* --snapshot <text>: The 16-character hexadecimal target snapshot identifier. If omitted, links all unlinked snapshots in the store.
* --vcs <text>: The VCS type (defaults to git).
* --metadata <key=value>: Scoped context metadata. Can be provided multiple times.
* --only-on-changes: Only perform compilation and linking if the revision changed files within the spec/ path or implementation code.
list
List all specification components present in a target snapshot.
*-s, --snapshot <text>: Target snapshot ID or relative index prefix. Defaults to latest.
show
Displays full structured details of a target component.
*<component_ref>: (Required) The fully qualified name (FQN) of the component class (e.g. spec.app.App).
* -s, --snapshot <text>: Target snapshot ID. Defaults to latest.
search
Searches spec component names and class docstrings.
*<query>: (Required) The text search keyword.
* -s, --snapshot <text>: Target snapshot ID. Defaults to latest.
list-snapshots
Lists chronological snapshot build history recorded in the transaction store.
log
Displays the chronological SpecStore append-only event ledger.
compact
Compacts the specification database, squashing intermediate unlinked drafts and merging VCS links to reclaim storage space.
*--dry-run: Runs calculation of space savings without modifying files on disk.
declare-dependency
Declares a logical dependency between components.
*-s, --snapshot <text>: Scopes the link to a target snapshot or PENDING (default).
dependencies
Lists component dependencies recorded for the target snapshot.
*-s, --snapshot <text>: Defaults to PENDING.
agent-config (alias: mcp_agent)
Configures an LLM coding assistant agent for the local project.
*--list: Lists all supported agents.
* <agent_name>: Name of target agent (e.g. antigravity, claude).
* [project_root]: Path to local project directory. Defaults to CWD.
mcp
Launches the Model Context Protocol (MCP) server over standard input/output (stdio).
* Note: This command is usually invoked in the background by IDEs or agent runtimes rather than executed manually by human developers.repl
Launches the interactive prompt REPL console.
rm-snapshot
Permanently deletes (tombstones) a historical snapshot from the active list.
restore-snapshot
Restores a previously deleted/tombstoned historical snapshot back to the active log.