Skip to content

Commands

Every SOW command at a glance, plus the rules they share: workspace discovery, repository and Dist selection, locking, JSON output, and exit codes.

SOW commands fall into two groups. Commands for simple repositories, create and prune, work on one directory of packages and keep nothing else: no configuration, no database, no history. Workspace commands are everything else. They work on standard repositories, which live in a workspace that sow init creates and that the commands find through its sow.yml. They record which packages each Dist should contain (its desired membership), build that into a Generation, verify it, and publish it.

Day-to-day work on a standard repository is one loop:

sow add PATH... -r REPO -d DIST   # change desired membership (builds unless --skip)
sow build -r REPO                 # build pending changes into a new Generation
sow check -r REPO                 # verify the tree before clients see it
sow publish TARGET                # copy the verified Generation to a server or bucket

add and rm build the Dists they change, so a separate build is needed only after --skip or a sow.yml edit. The other workspace commands set things up (init, config, repo, dist), inspect state (ls, show, where, status, changes, log), or reclaim space (retain, gc). The rules that all commands share follow the table.

Command index

help and version run anywhere. Commands for simple repositories never look for a workspace; every workspace command except init needs an existing one.

Command Works on Purpose
sow create [DIR] simple repository Index a directory of RPM/DEB files in place
sow prune DIR simple repository Keep the newest RPM per name and architecture
sow init [DIR] workspace Create a workspace and the repositories and Dists it declares
sow config check|show workspace Validate or print the effective configuration
sow repo ls|new|show|migrate|rm workspace Create, inspect, upgrade, or remove standard repositories
sow dist ls|new|show|rm workspace Manage Dists
sow add PATH... workspace Add packages and rebuild indexes
sow rm PACKAGE... workspace Remove packages and rebuild indexes
sow ls workspace List desired packages and where they are built
sow show PACKAGE workspace Inspect one package
sow where PACKAGE workspace Find a package across the workspace
sow status workspace Show repository state and pending changes
sow build workspace Build a Generation from the desired state
sow check workspace Verify a repository before delivery
sow changes [BASE_GENERATION] workspace Compare files in two built Generations
sow publish TARGET workspace Publish a verified Generation to a configured target
sow retain add|ls|rm workspace Protect a Generation’s package files from local GC
sow gc [TARGET] workspace Reclaim unused local packages or maintain a publication target
sow export rpm-leaf workspace Export a standalone RPM repository
sow log [OPERATION] workspace Read, export, and prune operation records

Global syntax

sow [OPTIONS] COMMAND [ARGS]

sow with no arguments prints the command list and exits 0. sow help COMMAND and sow help COMMAND SUBCOMMAND print the usage built into the installed binary; sow version and sow --version print version and build information.

An option works only on the commands that list it. Any other option, including an unknown one, is a usage error (exit 2). A repeated single-value option keeps its last value. Repeat -d or --protect to accumulate names. Boolean switches such as --strict accept =true or =false. --help and --version take no value. Use -- before a positional argument that starts with -.

Signing passwords

Commands that can sign, or recover an interrupted signed operation, accept --passfile PATH: create (only together with -S), init, config check, repo new|migrate|rm, dist new|rm, add, rm, build, publish, gc, export rpm-leaf, and log prune. All other commands reject it, including prune, config show, check, and retain.

For each signing key, SOW uses the first source that is set: --passfile, the key’s configured passfile, the SOW_GPG_PASSFILE environment variable, and finally the existing key/GPG/RPM behavior. No default file is searched. Password files describes the file format, relative-path rules, and legacy passphrase compatibility.

Workspace discovery

Workspace commands look for the nearest directory that contains sow.yml or sow.yaml:

  1. With -C/--workdir DIR, search upward from DIR only, with no fallback to the current directory or SOW_DIR.
  2. Without -C, search upward from the current directory; if that finds nothing and SOW_DIR is set, search upward from SOW_DIR.
  3. Stop at the first directory that contains either file. If both exist there as regular files, exit 2. A legacy repository directory named sow.yaml next to sow.yml is accepted.
  4. If no workspace is found, exit 2.

--workdir moves only the search start. The process working directory does not change, so relative paths in arguments still resolve against the real current directory. sow create and sow prune never search for a workspace.

Repository selection

A command that works on one repository picks it in this order:

  1. -r/--repo NAME;
  2. the repository that contains the discovery start directory;
  3. the only repository in the workspace;
  4. otherwise, exit 2 and list the candidates.

repo new and repo rm take NAME as an argument and reject -r. sow where searches every repository unless -r narrows it. A publication target is bound to one repository, so publish TARGET and gc TARGET reject -r.

Dist selection

add, rm, and ls need a definite set of Dists and pick it in this order:

  1. one or more -d/--dist NAME;
  2. the Dist that contains the discovery start directory (anywhere under REPO/dists/DIST/);
  3. the only Dist in the selected repository;
  4. otherwise, exit 2 and list the candidates.

The other commands default to a wider scope:

  • build, check, and status cover all Dists when -d is absent.
  • show searches the whole selected repository; -d narrows it.
  • where searches all matching Dists in the workspace; -r and -d narrow it.
  • changes always covers the whole repository and rejects -d.

Locking

Locks stop two SOW processes from changing the same tree at once. create and prune briefly lock the parent while opening the target directory. They release the parent before waiting for a busy target and hold the target lock during the run, so sibling repositories can be processed in parallel. Workspace commands that make changes take a workspace lock and per-repository locks.

  • Write commands accept -T/--timeout DUR and -N/--no-wait, except init, which always waits. The default --timeout 0 (or 0s) waits indefinitely; positive Go durations include 500ms, 30s, and 1m30s. --no-wait fails at once when the lock is held and cannot be combined with a positive timeout. A lock that cannot be acquired returns exit 4.
  • Read-only workspace commands take shared locks, wait behind a conflicting writer, and accept no lock options. status normally only probes the repository lock, so it can report on a writer that is still running.
  • Ctrl-C cancels a command that is waiting for a lock.

Parallelism

-j/--jobs N exists only on commands that parse packages, hash bytes, render indexes, or verify state: create, prune, add, rm, build, check, and repo migrate. It defaults to the number of logical CPUs and must be at least 1.

JSON output

Use text output interactively and --json in scripts. With --json, a command prints one versioned envelope on stdout and keeps diagnostics on stderr:

{
  "schema": "sow.cli/v1",
  "command": "add",
  "ok": true,
  "repository": "demo",
  "operation": "1430722512865805553",
  "result": {},
  "errors": []
}

ok is false for every non-zero exit, and a partly successful batch still returns both its committed and its failed items. Two commands differ: config show prints YAML unless you pass --json, and log export writes JSONL directly and does not accept --json. JSON Output documents every result shape.

Exit codes

Code Meaning
0 Success or idempotent no-op
1 Runtime I/O, parser, renderer, signing, or transport error
2 Usage, workspace discovery, or configuration error
3 Partial batch success
4 Write lock unavailable
5 Integrity/recovery failure, or check ruling the tree not deliverable
6 Rejected operation: conflict, protected object, no match, or incompatible architecture
130 Command interrupted by SIGINT or SIGTERM

Each command page lists its own triggers; Exit Codes collects them in one place.

sow create

Turn a directory of RPM and DEB files into a YUM/APT repository: options, scan rules, Pigsty cleanup, RPM signing, and exit codes.

sow prune

Drop superseded RPM versions from a simple repository and rebuild its index: options, safety checks, and exit codes.

sow init

Create a workspace for standard repositories, or create the repositories and Dists that sow.yml declares but that do not exist yet.

sow config

Validate sow.yml against the schema and existing state, and print the configuration SOW actually applies.

sow repo

Create, list, inspect, migrate, and remove standard repositories, each with its own package pool, indexes, and build history.

sow dist

Create, list, inspect, and remove Dists, the RPM or DEB package sets that clients install from.

sow add

Add RPM and DEB packages to Dists: options, per-item results, policy outcomes, partial batches, and exit codes.

sow rm

Remove packages from Dists, preview the exact file changes first, or stage removals for one later build.

sow ls

List the packages Dists should contain, with exact references and where each one is built.

sow show

Look up one package: its exact identity, pool path, and which Dists list it.

sow where

Find which repositories and Dists include a package across the whole workspace.

sow status

Check from recorded state whether a repository needs a build, holds pending data, or is locked.

sow build

Turn desired state and current configuration into a new Generation, or finish an interrupted operation.

sow check

Verify package bytes, indexes, signatures, and state before you deliver a repository.

sow changes

List the files that differ between two Generations, in the order a safe update applies them.

sow publish

Deliver the current Generation to a filesystem or R2 target in an order that keeps clients working, with resume and abort.

sow retain

Keep the package files and manifest of a Generation so local GC cannot reclaim them, or release them again.

sow gc

Reclaim local package files nothing needs any more, and delete superseded target files once client caches have expired.

sow export

Export one RPM Dist and architecture as a self-contained repository directory.

sow log

Read the record of every repository write, archive it as JSONL, and prune old entries.

Table reader