sow init
sow init creates the root sow.yml and the private .sow/ state directory that make a directory a
Workspace. It is also the convergence command for a config you wrote by hand: if sow.yml already
declares Repositories and Dists, init materializes the ones that don’t exist yet and leaves the
finished ones alone.
Synopsis
DIR defaults to the current directory. init takes no -C/--workdir — the positional argument
already names the target unambiguously.
Description
A fresh init writes a minimal config and the private state directory:
.sow/ holds workspace.lock, the workspace-ops/ durable file journal used by Workspace lifecycle
commands, repo-locks/, and later one SQLite database per Repository. It is mode 0700 and must
never be served over HTTP.
Options
| Flag | Description | Default |
|---|---|---|
--json |
Emit the versioned JSON envelope | false |
-h, --help |
Show help | — |
Idempotence rules
init is designed to be safe to run repeatedly, in a provisioning script or by hand:
-
It writes
schema: sow/v3and the defaultarchitectures: [x86_64, aarch64]when creating a new config. -
It never creates a Repository on its own. Use
sow repo new, or declare one insow.ymlfirst. -
It never overwrites an existing
sow.yml. A repeat run reports the current state and lists what it found: -
A non-empty directory can be initialized, but the run fails if an existing file collides with a SOW reserved path.
Converging a declared configuration
If sow.yml already describes Repositories and Dists, init creates the missing directory trees,
SQLite databases and empty indexes for them. Already-initialized objects are skipped, so the counters
tell you exactly what this run did.
Every Dist created this way has a protocol-complete empty surface: an RPM Dist gets an empty
repodata/ per architecture view, and a DEB Dist gets empty Packages/Packages.gz with
by-hash plus a Release.
Running it a second time changes nothing:
Locking and recovery
Workspace lifecycle commands — init, repo new, repo rm — run before the target Repository
database exists or after it is deleted, so they use .sow/workspace.lock plus the durable file
journal in .sow/workspace-ops/ rather than a SQLite Operation Journal. An interrupted init is
completed or rolled back by the next Workspace lifecycle command.
Examples
Bootstrap a Workspace and add Repositories by hand:
Initialize a directory other than the current one:
Provision from a config file under version control:
Exit codes
| Code | Trigger |
|---|---|
0 |
Workspace created, or already converged (no-op) |
1 |
Runtime I/O error writing the config or state directory |
2 |
Usage error, or an existing sow.yml that fails to parse or validate |
3 |
Partial success — some declared Repositories/Dists were committed and at least one failed |
5 |
The Workspace journal could not be recovered to a terminal state |
6 |
An existing file collides with a SOW reserved path |
See also
- First Workspace — the ten-minute guided version
- Managed Workspaces — the three-layer model
- sow.yml Reference — every configuration key
- sow repo and sow dist
- Repository Layout — what
.sow/contains