cli reference
Complete reference for the crate-seq command-line interface. Written for Rust developers publishing crates to the registry.
Synopsis
crate-seq [--no-color] <COMMAND>Global flags
| Flag | Type | Description |
|---|---|---|
--no-color |
boolean | Disables colored output by setting NO_COLOR=1 before any output is produced. Respected by anstream automatically. |
Commands
init
Initialises ledgers from git tags and crates.io state. Walks to the repository root, discovers workspace members (or a single crate), writes .crate-seq.toml ledger files, and prints each crate name with its version count.
crate-seq init [--crate <NAME>] [--path <DIR>]| Argument | Default | Description |
|---|---|---|
--crate <NAME> |
(none) | Restrict to a single named crate (workspace only) |
--path <DIR> |
. |
Path to the workspace or crate root |
Behaviour:
- Discovers workspace members, queries crates.io for existing versions, and writes
.crate-seq.tomlledger files - Prints each initialized crate name in green with its version count
Example output:
my-crate: 5 versions
my-other-crate: 3 versionsErrors: Propagates workspace discovery errors, registry errors, and ledger write failures.
check
Diffs local pending versions against crates.io state. For each crate, displays pending, skipped, and orphaned entries.
crate-seq check [--crate <NAME>] [--path <DIR>]| Argument | Default | Description |
|---|---|---|
--crate <NAME> |
(none) | Restrict to a single named crate |
--path <DIR> |
. |
Path to workspace or crate root |
Output format:
- Up to date — crate name in green with "up to date" and the registry latest version
- Pending — versions in yellow with their git ref
- Skipped — versions in dim text
- Orphaned — versions in red with "ref missing" (the git tag referenced by the ledger entry no longer exists)
Example output:
my-crate @ 0.2.0 — up to date
my-other-crate @ 0.1.0 (registry latest)
pending: 0.2.0 (my-other-crate-v0.2.0)
orphaned: 0.1.5 <- ref missingErrors: Returns early with a message if no ledger files are found ("No ledger files found. Run crate-seq init first."). Propagates check_crate errors.
publish
Publishes pending versions to crates.io. Dry-run by default — pass --execute for live publishing.
crate-seq publish [--execute] [--token <TOKEN>] [--crate <NAME>] [--path <DIR>]| Argument | Default | Description |
|---|---|---|
--execute |
false |
Run live publishes instead of a dry run |
--token <TOKEN> |
(none) | API token for crates.io (overrides ledger auth config) |
--crate <NAME> |
(none) | Restrict to a single named crate |
--path <DIR> |
. |
Path to workspace or crate root |
Dry-run mode (default)
Iterates each ledger and calls crate_seq_core::publish_dry_run(). For each pending version, reports one of:
ok— version is ready to publishFAIL — package failed—cargo packagefailed (first 5 lines of stderr shown)FAIL — path deps found— unresolved path dependencies detectedFAIL — cargo check failed— compilation errors (first 5 lines of stderr shown)
Concludes with: "Dry run complete — pass --execute to publish."
Execute mode (--execute)
Calls crate_seq_core::publish_workspace_ordered() which publishes crates in topological dependency order with exponential backoff. After each tier, index propagation is awaited before the next tier begins.
Shows an indicatif progress bar during publishing, then reports each version as:
- ✓ version (green) — successfully published
- → version (dim) — already on crates.io
- – version (dim) — skipped
- ✗ version (red) — failed with error message
Snapshot mode
When the ledger's settings.mode is "snapshot", the CLI resolves the snapshot store path (.crate-seq-snapshots/ adjacent to the ledger) and passes it to the pipeline.
Token resolution order
--tokenCLI flag (highest priority)auth.token_cmd— runs the shell command, uses stdoutauth.token_env— reads the named environment variable- Falls back to
cargo logincredentials
tag
Creates a git tag and a corresponding ledger entry for a new version.
crate-seq tag <VERSION> [--tag-name <TAG>] [--path <DIR>]| Argument | Default | Description |
|---|---|---|
<VERSION> |
(required) | SemVer version string, e.g. 0.2.0 |
--tag-name <TAG> |
(auto) | Explicit tag name (overrides the pattern-derived default) |
--path <DIR> |
. |
Path to crate root (must contain .crate-seq.toml) |
Behaviour:
- Parses the version string as strict SemVer
- Creates the git tag and appends a pending entry to the ledger
- Prints:
"created tag {tag_name} and ledger entry for {version}"
Errors: InvalidVersion if version string doesn't parse. LedgerNotFound if no .crate-seq.toml exists at the path. Git errors if tag creation fails.
skip
Marks a version as skipped so it will not be published.
crate-seq skip <VERSION> [--path <DIR>]| Argument | Default | Description |
|---|---|---|
<VERSION> |
(required) | SemVer version to skip |
--path <DIR> |
. |
Path to crate root |
Behaviour:
- Parses the version string as strict SemVer
- Loads the ledger, marks the version as skipped, and saves
- Prints:
"skipped {version}"
Errors: InvalidVersion if version string doesn't parse. InvalidTransition if the version is already published (cannot skip a published version).
status
Shows a full table of all ledger entries for every crate in the workspace.
crate-seq status [--crate <NAME>] [--path <DIR>]| Argument | Default | Description |
|---|---|---|
--crate <NAME> |
(none) | Restrict to a single named crate |
--path <DIR> |
. |
Path to workspace or crate root |
Output format:
crate-name
version source ref status
────────────────────────────────────────────────────────
0.1.0 git-tag crate-v0.1.0 published
0.2.0 git-tag crate-v0.2.0 pending
────────────────────────────────────────────────────────
2 total 1 published 1 pendingColor coding:
- Published — green version and status
- Pending — yellow version and status
- Skipped — dim text
- Yanked — red version and status
Summary line shows totals for published and pending counts.
snapshot
Captures the current crate directory as a versioned snapshot. Used when the ledger operates in "snapshot" mode instead of "git-tag" mode.
crate-seq snapshot <VERSION> [--dir <DIR>] [--path <DIR>]| Argument | Default | Description |
|---|---|---|
<VERSION> |
(required) | SemVer version to record |
--dir <DIR> |
(--path value) | Crate directory to snapshot (defaults to the --path value) |
--path <DIR> |
. |
Path to crate root (must contain .crate-seq.toml) |
Behaviour:
- Parses the version string as strict SemVer
- Captures the directory as a versioned snapshot and updates the ledger
- Prints:
"snapshot created: {sha256} (version {version})"
Error handling
All errors from crate_seq_core::Error are caught at the top level by display_error() and formatted as structured, actionable messages with recovery hints before exiting with code 1.
| Error type | Message | Recovery hint |
|---|---|---|
TokenResolution |
"token resolution failed" + detail | Run cargo login or set [auth] in .crate-seq.toml |
InvalidTransition |
"cannot transition {v} from {from} to {to}" | Check current status with crate-seq status |
PathDependencies |
Lists each path dep in the manifest | Publish path dependencies separately first |
CargoCheck |
"cargo check failed" + full stderr | Fix compilation errors before publishing |
Git |
"git error: {details}" | Use crate-seq skip <version> if a tag is missing |
LedgerNotFound |
"ledger not found at {path}" | Run crate-seq init to create the ledger |
| (other) | Displays via Display trait |
— |
Exit codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Any error (after printing the structured error message + hint) |
Configuration — .crate-seq.toml
Every crate tracked by crate-seq has a .crate-seq.toml ledger file at its root. This file is both configuration and state.
File structure
[crate]
name = "my-crate" # Crate name as in Cargo.toml (required)
registry = "crates-io" # Registry alias (optional, defaults to crates.io)
[settings]
mode = "git-tag" # "git-tag" or "snapshot" (optional)
tag-pattern = "my-crate-v*" # Glob for matching git tags (optional)
dry-run-default = false # Default dry-run behaviour (optional)
backoff-base-ms = 1000 # Base delay for exponential backoff (optional)
[auth]
token-env = "CARGO_REGISTRY_TOKEN" # Env var holding registry token (optional)
token-cmd = "op read ..." # Shell command to retrieve token (optional)
[[versions]]
version = "0.1.0"
source = "git-tag" # "git-tag" or "snapshot"
ref = "my-crate-v0.1.0" # Git tag or snapshot ref
status = "published" # "published", "pending", "skipped", or "yanked"Sections
| Section | Purpose |
|---|---|
[crate] |
Identity: crate name and optional registry target |
[settings] |
Publish behaviour: discovery mode, tag pattern, dry-run default, backoff timing |
[auth] |
Credentials: environment variable name or shell command for token resolution |
[[versions]] |
Ordered list of version entries with their source, ref, and lifecycle status |
Version lifecycle
| Status | Meaning | Transitions to |
|---|---|---|
pending |
Tagged or snapshotted, awaiting publish | published, skipped |
published |
Successfully published to registry | yanked |
skipped |
Explicitly skipped via crate-seq skip |
(terminal) |
yanked |
Yanked from the registry | (terminal) |
Typical workflows
First-time setup
cd my-workspace
crate-seq init
crate-seq statusPublishing a new version
crate-seq tag 0.3.0
crate-seq publish # dry-run first
crate-seq publish --execute # live publishSkipping a broken version
crate-seq skip 0.2.1
crate-seq status # verify it's marked skippedSnapshot mode (no git tags)
crate-seq snapshot 0.1.0 --dir ./my-crate
crate-seq publish --execute