docs · pre-release
Menu
Reference / CLI reference

CLI reference

Every verb shep 0.25.2 understands, generated from the binary's own --help. Nothing below is hand-typed.

note
--home, --format table|json and -q/--quiet work on every verb on this page. A verb's help names the global flags it takes; Global flags has the full text. --home takes an absolute path, and so does $SHEP_HOME. A relative one would mean a different flock from every directory, so shep refuses it and prints the absolute form instead. It also has to be valid UTF-8: shep carries the home path into the {{SHEP_HOME}} template, the log paths it reports and the control socket's own name, all of which are text, so a byte that is not UTF-8 would be replaced and shep would use a directory you did not name. That is refused too, rather than quietly substituted.
note
--host DEST runs shep flock, describe, fold, bleats, stop, restart, reset, reload, delete, stock, enable, disable, signal, whisper, attach, trigger, muster and lookout remotely. A destination is anything ssh accepts: amp2, user@amp2 or an ~/.ssh/config alias. --home names this machine's. describe shows no secrets over --host. Every other verb exits 2 on --host.
note
Windows runs every verb on this page except shep attach, with two differences. shep startup registers a logon task, so the flock returns at sign-in rather than boot, and shep stop has no graceful signal to send unless your app reads the shepherd channel. Windows sets no HOME, so the default flock home comes from %USERPROFILE%, then %HOMEDRIVE%%HOMEPATH%.

Aliases at a glance

Five aliases are permanent, not shorthand that might go away: the theme never costs a straight verb its plain name.

shep flock
list, ls
shep bleats
logs
shep lookout
dash
shep stock
scale
shep whisper
sendline

Every verb, at a glance

The exact output of shep --help against this build: every verb with its description, the help topics, the global flags.

$ shep --help
A process manager for your flock

Usage: shep [OPTIONS] <COMMAND>

Getting started
  shep start server.js    start it and keep it alive
  shep flock              see what's running
  shep bleats server      follow its output
  shep startup            bring it back after a reboot

Run things
  start              Start a sheep from a script, a Flockfile, or stdin
  add                Register a sheep without starting it
  serve              Serve a directory over plain HTTP, as a managed sheep
  stop               Stop one or more sheep
  restart            Restart one or more sheep
  reset              Zero the restart counters of one or more sheep
  reload             Reload one or more sheep, one instance at a time
  delete             Delete one or more sheep or dogs, for good
  stock, scale       Set how many instances one app runs
  enable             Turn a sheep or a dog back on
  disable            Turn a sheep or a dog off, until `shep enable`

See what's up
  flock, list, ls    List the flock
  describe           Describe one sheep in detail
  bleats, logs       Show or follow bleats (log output) for one or more sheep
  lookout, dash      Watch the flock on a live dashboard
  fold               List one fold
  barks              Show the alert history: `barks.jsonl`, newest last
  hints              List the hints, and turn each off or on

Survive reboots
  save               Write the muster roll now and say where it landed
  muster             Assemble the flock from the muster roll
  startup            Install an init unit so the shepherd starts at boot
  unstartup          Remove the unit `startup` installed

Talk to a sheep
  trigger            Send a named action to matched sheep
  signal             Send a unix signal to matched sheep
  whisper, sendline  Write one line to matched sheep's stdin
  attach             Show a pty sheep's live terminal and type into it

The shepherd
  ping               Check whether the shepherd answers
  kill               Shut the shepherd down
  reopen             Reopen log files after an external rotator has renamed them
  flush              Empty the log files of sheep, or the shepherd's own
  kv                 Read and write the key/value store
  get                Print a sheep's or a dog's settings as TOML
  set                Change one setting of a sheep or a dog
  unset              Drop an override, or remove a dog's key
  copy               Copy settings from one sheep onto another
  secret             Store the values a Flockfile refers to and never carries
  host               Keep the list of machines whose shepherds this CLI reaches

Dogs and agents
  dogs               List the dogs, and nothing else
  install            Install a dog from the community index
  upgrade            Upgrade an installed dog, with a way back
  adopt              Vet a binary and register it as a dog
  whistle            Serve the MCP interface on stdin/stdout for an AI agent

Foreground runs
  runtime            Run one Flockfile's flock in the foreground
  dev                Run one Flockfile's flock in a throwaway session

Coming from pm2
  import             Read somebody else's config into shep

Help
  welcome            Print the welcome and the quick start
  init               Write a commented Flockfile to start from
  help               Show a verb's or a topic's help
  completions        Print a shell completion script
  style              Show or set how much shep dresses up its output

Help topics
  flags              every global flag, in full
  selectors          names, globs, /regex/ and fold:<name>
  exit-codes         what each exit code means

Global flags: --format, --quiet, --style, --host, --home, -h, -V. See shep help flags
Run `shep help <command>` for one command, or `shep welcome` for the tour.

Global flags

The exact output of shep help flags.

$ shep help flags
Global flags, valid on every verb:

      --format <FORMAT>
          Output format

          Possible values:
          - table: Human-readable columns (the default)
          - json:  A versioned JSON envelope, one object per invocation
          
          [default: table]

  -q, --quiet
          Suppress non-essential output
          
          Currently narrows `bleats`' own notices (a dropped-events count, a daemon-shutdown notice,
          ...): diagnostics distinct from a sheep's own line or a real error, both of which still
          print regardless.

      --style <STYLE>
          How much this invocation dresses up its output: `full`, `plain`, or `bare`
          
          Wins over `$SHEP_STYLE` and `shep.toml`'s `[style] level`. Omit to let those decide; `shep
          style` reports which one answered.

          Possible values:
          - full:  Sheep, boxes and colour
          - plain: Boxes and colour, no sheep
          - bare:  Exactly what shep printed before any of this, and exactly what a pipe gets

      --host <DEST>
          Reach another host's shepherd over ssh
          
          DEST is an ssh destination: `amp2`, `user@amp2`, or an alias from ~/.ssh/config. A verb
          that takes it names it in the global flags line at the foot of its help; any other verb
          refuses it rather than act on this machine. `describe` shows no secrets over it, and
          `enable` takes no hidden `--exec` form over it. `--home` still names this machine's home,
          never the host's.

      --home <HOME>
          Talk to a different shepherd
          
          Mostly plumbing: `shep dev` sessions, a system-wide flock, tests. You almost certainly
          want the default, ~/.shep. Must be an absolute path: a relative one would name a different
          flock from every directory.
          
          [env: SHEP_HOME=]

Help topics

Shared prose, printed once.

$ shep help selectors
Selectors, for every verb that acts on part of the flock:

  name           one sheep, exact: web.1 is the sheep called web.1
  id             one sheep, by its id
  name:slot      one slot of a sheep with several instances
  all            every sheep
  api-*          a glob, anchored
  /regex/        a regular expression
  fold:<name>    every sheep in that fold

A pattern carrying *, ?, [ or { is a glob, anchored: api-* selects api-auth
and not my-api-auth. Quote it. Your shell expands api-* against filenames
first, and zsh refuses outright when none match. A name with no such
character is exact.

Give several and they are applied in turn, not atomically: shep stop a b c,
where b matches nothing, still stops a and c, and the exit code is the first
failure.
$ shep help exit-codes
Exit codes, the same on every verb:

  0  The command did what it was asked.
  1  An error with no more specific code.
  2  Bad arguments. clap's own convention.
  3  A selector matched no registered sheep.
  4  A Flockfile or daemon config failed validation.
  5  No daemon answered, and none could be started.
  6  The daemon refused this client's handshake: its protocol version is below the daemon's `MIN_SUPPORTED` floor.
  7  The daemon could not spawn a sheep.
  8  The request outlived its deadline.
  9  An unexpected daemon-side failure.
  10 Another daemon already holds this `$SHEP_HOME`.
  11 The flock emptied and something in it had failed.
  12 This binary and the shepherd it reached disagree about shep.
  13 The daemon understood the handshake but not the request itself.

Managing a sheep

shep start
shep start [OPTIONS] [TARGETS]...

Start a sheep from a script, a Flockfile, or stdin

full --help output
$ shep start --help
Start a sheep from a script, a Flockfile, or stdin

Usage: shep start [OPTIONS] [TARGETS]...

Arguments:
  [TARGETS]...
          Selectors, script paths, Flockfiles, or `-` to read Flockfile JSON from stdin
          
          A target is resolved in four tiers and the first one that matches wins: a sheep the flock
          already has, by id or by name; then a fold, written either as `fold:<name>` or as the bare
          fold name; then a Flockfile, by its extension; then a path on disk, started as a script.
          
          So `shep start backed` starts the fold `backed` even when a file called `backed` is
          sitting in the current directory. Write `./backed` to mean the file: a sheep name may
          never contain a path separator, so a target carrying one is always a path.
          
          The wildcard selectors work here too, and mean what they mean everywhere else: `all`,
          `/regex/`, and glob patterns such as `web-*`. They reach only sheep the flock already has,
          since there is nothing to register. A sheep already running is reported and left alone;
          `restart` is the verb that replaces one, and `add` never starts anything in the first
          place.
          
          Omit the targets to read the Flockfile in the current directory. With no Flockfile there,
          `shep start` brings a shepherd up with nothing running yet, and `shep add` has nothing it
          could register.
          
          A target may be preceded by `NAME=VALUE` assignments, read the way a shell reads them:
          `shep start KOJI_TOKEN=secret ./koji` registers koji with that variable set and records
          it, so a later `shep start koji` needs no assignment. A name takes a letter or `_` and
          then letters, digits or `_`, which is what makes `./A=1` a path and `1A=1` a target. Quote
          the value and never the pair: `shep start "A=x y" ./koji`.
          
          Assignments take one target, and it must be a script path or a sheep the flock already
          has. A Flockfile or a fold can name several sheep, and an assignment names none of them.
          The value passes through this command line, so it reaches `ps` and your shell history;
          write `{{secret:NAME}}` to read a credential from `shep secret` instead.
          
          Several are handled in turn, not atomically: if the second fails the first has already
          landed, and the exit code is the first failure. `--name` is refused with more than one,
          since a name is unique to one sheep.

Options:
  -n, --name <NAME>
          Name for this sheep (script form only)

  -F, --fold <FOLD>
          Fold to place this sheep in

  -c, --cwd <CWD>
          Working directory to run in (default: where you ran `shep start`)

      --interpreter <INTERPRETER>
          Interpreter to run the script with, overriding both shep.toml's extension mapping and a
          Flockfile app's own interpreter field.
          
          The precedence, lowest to highest: shep.toml's interpreters table (matched against the
          script's extension), then a Flockfile's own interpreter for that app, then this flag. shep
          never guesses an interpreter on its own; every one of those three is something an operator
          wrote down. Pass "none" to run the script directly, overriding a mapping or a Flockfile
          that would otherwise pick one.

      --flockfile
          Read TARGET as a Flockfile rather than as a script path.
          
          Required for a `.js` Flockfile and the only way to reach one: shep reads a `.js` config by
          running it through node, which is arbitrary code execution, so it never happens because a
          file merely has that extension. Without this flag `shep start server.js` starts
          `server.js` as a script, which is what it has always meant.

      --no-log-timestamps
          Write this sheep's log lines without the timestamp shep puts in front of each one.
          
          The flag form of a Flockfile's `log_timestamps = false`, and it wins over a Flockfile's
          own value. `shep bleats` shows the same lines either way; only the files on disk differ.

      --reset[=<RESET>]
          Widen a Flockfile load past its additive default: append nothing, overwrite instead. A
          mode touches only what its name says; see the four below. Refused when the target supplies
          no template to reset to: a sheep name reads no file, and a bare script path is a command
          line rather than a file.
          
          The value is required, with an equals sign: `--reset=file`, never `--reset file`.
          `targets` is a greedy variadic positional, and a space-separated value next to one of
          those is where argument parsing gets ambiguous.

          Possible values:
          - file:   Put back what the template declares, `env` kept
          - policy: Put back every setting but `env`, declared or not
          - env:    Put back only `env`
          - all:    Put back everything, `env` included, and drop the override record

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep start server.js --name api
  $ shep start Flockfile.toml
  $ shep start api

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep add
shep add [OPTIONS] [TARGETS]...

Register a sheep without starting it.

The same targets shep start takes and the same load path. The one difference is that nothing spawns: the app lands registered and stopped, and shep start <name> is what brings it up.

It is here for the Flockfile a project commits with its secrets left blank: env = { DB_HOST = "", DB_PASSWORD = "" }, the .env.example convention. Starting that file spawns a process against an empty database URL, which crashes, spends its restart budget, and has to be stopped before anyone can configure it. This registers it instead, so the order becomes register, fill in, start.

An app the flock already has is merged into and left exactly as it is, running or not.

full --help output
$ shep add --help
Register a sheep without starting it.

The same targets `shep start` takes and the same load path. The one difference is that nothing
spawns: the app lands registered and stopped, and `shep start <name>` is what brings it up.

It is here for the Flockfile a project commits with its secrets left blank: `env = { DB_HOST = "",
DB_PASSWORD = "" }`, the `.env.example` convention. Starting that file spawns a process against an
empty database URL, which crashes, spends its restart budget, and has to be stopped before anyone
can configure it. This registers it instead, so the order becomes register, fill in, start.

An app the flock already has is merged into and left exactly as it is, running or not.

Usage: shep add [OPTIONS] [TARGETS]...

Arguments:
  [TARGETS]...
          Selectors, script paths, Flockfiles, or `-` to read Flockfile JSON from stdin
          
          A target is resolved in four tiers and the first one that matches wins: a sheep the flock
          already has, by id or by name; then a fold, written either as `fold:<name>` or as the bare
          fold name; then a Flockfile, by its extension; then a path on disk, started as a script.
          
          So `shep start backed` starts the fold `backed` even when a file called `backed` is
          sitting in the current directory. Write `./backed` to mean the file: a sheep name may
          never contain a path separator, so a target carrying one is always a path.
          
          The wildcard selectors work here too, and mean what they mean everywhere else: `all`,
          `/regex/`, and glob patterns such as `web-*`. They reach only sheep the flock already has,
          since there is nothing to register. A sheep already running is reported and left alone;
          `restart` is the verb that replaces one, and `add` never starts anything in the first
          place.
          
          Omit the targets to read the Flockfile in the current directory. With no Flockfile there,
          `shep start` brings a shepherd up with nothing running yet, and `shep add` has nothing it
          could register.
          
          A target may be preceded by `NAME=VALUE` assignments, read the way a shell reads them:
          `shep start KOJI_TOKEN=secret ./koji` registers koji with that variable set and records
          it, so a later `shep start koji` needs no assignment. A name takes a letter or `_` and
          then letters, digits or `_`, which is what makes `./A=1` a path and `1A=1` a target. Quote
          the value and never the pair: `shep start "A=x y" ./koji`.
          
          Assignments take one target, and it must be a script path or a sheep the flock already
          has. A Flockfile or a fold can name several sheep, and an assignment names none of them.
          The value passes through this command line, so it reaches `ps` and your shell history;
          write `{{secret:NAME}}` to read a credential from `shep secret` instead.
          
          Several are handled in turn, not atomically: if the second fails the first has already
          landed, and the exit code is the first failure. `--name` is refused with more than one,
          since a name is unique to one sheep.

Options:
  -n, --name <NAME>
          Name for this sheep (script form only)

  -F, --fold <FOLD>
          Fold to place this sheep in

  -c, --cwd <CWD>
          Working directory to run in (default: where you ran `shep start`)

      --interpreter <INTERPRETER>
          Interpreter to run the script with, overriding both shep.toml's extension mapping and a
          Flockfile app's own interpreter field.
          
          The precedence, lowest to highest: shep.toml's interpreters table (matched against the
          script's extension), then a Flockfile's own interpreter for that app, then this flag. shep
          never guesses an interpreter on its own; every one of those three is something an operator
          wrote down. Pass "none" to run the script directly, overriding a mapping or a Flockfile
          that would otherwise pick one.

      --flockfile
          Read TARGET as a Flockfile rather than as a script path.
          
          Required for a `.js` Flockfile and the only way to reach one: shep reads a `.js` config by
          running it through node, which is arbitrary code execution, so it never happens because a
          file merely has that extension. Without this flag `shep start server.js` starts
          `server.js` as a script, which is what it has always meant.

      --no-log-timestamps
          Write this sheep's log lines without the timestamp shep puts in front of each one.
          
          The flag form of a Flockfile's `log_timestamps = false`, and it wins over a Flockfile's
          own value. `shep bleats` shows the same lines either way; only the files on disk differ.

      --reset[=<RESET>]
          Widen a Flockfile load past its additive default: append nothing, overwrite instead. A
          mode touches only what its name says; see the four below. Refused when the target supplies
          no template to reset to: a sheep name reads no file, and a bare script path is a command
          line rather than a file.
          
          The value is required, with an equals sign: `--reset=file`, never `--reset file`.
          `targets` is a greedy variadic positional, and a space-separated value next to one of
          those is where argument parsing gets ambiguous.

          Possible values:
          - file:   Put back what the template declares, `env` kept
          - policy: Put back every setting but `env`, declared or not
          - env:    Put back only `env`
          - all:    Put back everything, `env` included, and drop the override record

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep add worker.py --name worker
  $ shep add Flockfile.toml

Global flags: --format, --quiet, --style, --home. See shep help flags
shep serve
shep serve [OPTIONS] <ROOT>

Serve a directory over plain HTTP, as a managed sheep.

Registers a sheep whose command line is this invocation, canonicalized and with --foreground appended — the same worker that answers every request also IS the registered sheep, so shep describe shows exactly what will run again on a restart.

Binds loopback (127.0.0.1:8080) by default. A wider --bind is allowed, not refused, and gets a stderr notice naming what it exposes — the docroot is published to anything that can reach the port, and unencrypted unless the operator puts a proxy in front. --auth narrows that to anyone who also has the password, still sent as plain HTTP basic auth.

Dotfiles, directory listings, and any symlink under the docroot are all refused by default — --hidden, --listing, and --follow-symlinks opt back in, each with its own reason a repo checkout or a deploy layout might need it.

--foreground runs the worker directly in this terminal instead of registering a sheep — also how the registered sheep runs; the flag on the end of its own command line is the only difference.

full --help output
$ shep serve --help
Serve a directory over plain HTTP, as a managed sheep.

Registers a sheep whose command line is this invocation, canonicalized and with `--foreground`
appended — the same worker that answers every request also IS the registered sheep, so `shep
describe` shows exactly what will run again on a restart.

Binds loopback (`127.0.0.1:8080`) by default. A wider `--bind` is allowed, not refused, and gets a
stderr notice naming what it exposes — the docroot is published to anything that can reach the port,
and unencrypted unless the operator puts a proxy in front. `--auth` narrows that to anyone who also
has the password, still sent as plain HTTP basic auth.

Dotfiles, directory listings, and any symlink under the docroot are all refused by default —
`--hidden`, `--listing`, and `--follow-symlinks` opt back in, each with its own reason a repo
checkout or a deploy layout might need it.

`--foreground` runs the worker directly in this terminal instead of registering a sheep — also how
the registered sheep runs; the flag on the end of its own command line is the only difference.

Usage: shep serve [OPTIONS] <ROOT>

Arguments:
  <ROOT>
          Directory to serve

Options:
  -p, --port <PORT>
          Port to listen on
          
          [default: 8080]

  -b, --bind <BIND>
          Address to bind. Loopback unless you say otherwise — a wider bind publishes every file
          under the directory to anything that can reach the port
          
          [default: 127.0.0.1]

  -n, --name <NAME>
          Name for this sheep (default: the directory's own name)

  -F, --fold <FOLD>
          Fold to place this sheep in

  -S, --spa
          Serve index.html for paths that do not exist, for a single-page app. Only for requests
          that accept HTML, so a missing script still 404s

      --listing
          List a directory that has no index.html. Off by default: a listing publishes every
          filename under it

      --hidden
          Serve files and directories whose names begin with a dot. Off by default: serving a
          project directory would otherwise publish `.env` and the whole `.git` history. The one
          real use is `.well-known/acme-challenge`

      --follow-symlinks
          Follow symlinks under the docroot, reopening the check-then-open race refused by default.
          Needed for deploy layouts like `current -> releases/2026-08-15`; off unless you ask for it

      --auth <AUTH>
          File holding one `user:password` line, mode 0600, required on every request. Sent over
          plain HTTP — base64, not encryption

      --foreground
          Serve in this terminal instead of registering a sheep.
          
          This is also how the registered sheep runs: the command line in `shep describe` is this
          one with the flag on the end.

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep serve ./public
  $ shep serve ./dist --port 3000 --spa

Global flags: --format, --quiet, --style, --home. See shep help flags
shep stop
shep stop [OPTIONS] <SELECTORS>...

Stop one or more sheep

full --help output
$ shep stop --help
Stop one or more sheep

Usage: shep stop [OPTIONS] <SELECTORS>...

Arguments:
  <SELECTORS>...
          One or more: name, id, `name:slot`, `all`, `api-*`, `/regex/`, `fold:<name>`
          
          See shep help selectors

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep stop api
  $ shep stop 'api-*'
  $ shep stop fold:web

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep restart
shep restart [OPTIONS] <SELECTORS>...

Restart one or more sheep.

The running process is killed and a new one spawned in its place, so there is a window with nothing serving. shep reload is the verb that closes that window, at the cost of caring how the app is configured.

A selector matching one sheep is answered as soon as the respawn is issued, printing the flock as it stood at that moment.

A selector matching two or more is walked in dependency order instead, and the reply waits: each stage is held until the apps a later stage depends on are back, so a fold comes back in the order its depends_on lines describe rather than all at once. The wait is the sum of the stages.

That walk asks the shepherd once per app, so an app it could not restart is refused on its own and the rest of the fold restarts anyway. The rows printed are what the walk finished with, the app it went around is named on stderr, and the exit is non-zero. Under --format json the same names come back under refused in the one envelope.

A sheep that came back errored is a different failure and is reported separately: that one was reached, and it is the child that could not start. That failure empties stdout, the way every verb's does, so a restart that BOTH refused an app and brought one back errored prints no envelope at all. The refused names ride the stderr sentence in that case, which is the only place left for them.

full --help output
$ shep restart --help
Restart one or more sheep.

The running process is killed and a new one spawned in its place, so there is a window with nothing
serving. `shep reload` is the verb that closes that window, at the cost of caring how the app is
configured.

A selector matching one sheep is answered as soon as the respawn is issued, printing the flock as it
stood at that moment.

A selector matching two or more is walked in dependency order instead, and the reply waits: each
stage is held until the apps a later stage depends on are back, so a fold comes back in the order
its depends_on lines describe rather than all at once. The wait is the sum of the stages.

That walk asks the shepherd once per app, so an app it could not restart is refused on its own and
the rest of the fold restarts anyway. The rows printed are what the walk finished with, the app it
went around is named on stderr, and the exit is non-zero. Under `--format json` the same names come
back under refused in the one envelope.

A sheep that came back errored is a different failure and is reported separately: that one was
reached, and it is the child that could not start. That failure empties stdout, the way every verb's
does, so a restart that BOTH refused an app and brought one back errored prints no envelope at all.
The refused names ride the stderr sentence in that case, which is the only place left for them.

Usage: shep restart [OPTIONS] <SELECTORS>...

Arguments:
  <SELECTORS>...
          One or more: name, id, `name:slot`, `all`, `api-*`, `/regex/`, `fold:<name>`
          
          See shep help selectors

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep restart api
  $ shep restart all

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep reset
shep reset [OPTIONS] <SELECTORS>...

Zero the restart counters of one or more sheep.

Changes counters only: nothing is signalled, started or stopped, so a running process keeps running. shep start --reset=<mode> is about config, not counters.

full --help output
$ shep reset --help
Zero the restart counters of one or more sheep.

Changes counters only: nothing is signalled, started or stopped, so a running process keeps running.
`shep start --reset=<mode>` is about config, not counters.

Usage: shep reset [OPTIONS] <SELECTORS>...

Arguments:
  <SELECTORS>...
          One or more: name, id, `name:slot`, `all`, `api-*`, `/regex/`, `fold:<name>`
          
          See shep help selectors

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep reset api
  $ shep reset all

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep reload
shep reload [OPTIONS] <SELECTORS>...

Reload one or more sheep, one instance at a time.

Each instance is replaced by a fresh one that has to become ready before the reload moves on, so a release that never comes up is reported as a failure rather than as a success.

What that failure COSTS depends on the order, and the order depends on the app.

A probed app with no reuse_port or listen table is replaced serially: the old instance drains first, then the new one starts in its place. A probe asks an address, and an address cannot say which process answered it. Run both at once and the outgoing instance answers for the incoming one, so shep would call a release ready that never bound anything.

The old instance is gone by the time the new one is judged, so there is nothing to go back to. A replacement that never becomes ready is left running and NOT marked online, and the reload is abandoned, which for a one-instance app means the gap lasts until you act on it. A rollback that points the app back at working code and reloads again is what ends it; that reload can reach the instance this one left behind.

Everything else overlaps, old and new running together: an app with no probe, an app using wait_ready (its channel belongs to one instance, so nothing else can answer it), and a probed app with reuse_port or listen.

An overlap asks the same of all of them. Both instances are bound at once, so an app that binds an address must share the socket itself, with SO_REUSEPORT set before it binds, unless it has a listen table: then shep binds once and every instance inherits the sockets. Otherwise the replacement takes EADDRINUSE and the reload is abandoned, with the old instance left serving. This command has exited 0 by then, so process.reload_abandoned on the bus is the only report.

reuse_port neither creates that requirement nor satisfies it. It is how a probed app says it is already handling the sharing, and so asks for the overlap back.

An overlap is not zero downtime either. The old listener's queue of connections it has not accepted yet is dropped when it closes, so an app that does not stop accepting and finish what it has in hand before graceful_timeout runs out loses whatever was waiting there.

A selector matching one app exits as soon as the shepherd accepts the reload, printing the flock as it stood at that moment. A clustered app takes longer to swap than any answer can wait for.

A selector matching two or more apps is walked in dependency order instead, and the reply waits: each stage is held until the apps a later stage depends on are back and ready, so the wait is the sum of the stages rather than the longest swap in the fold. The rows printed are what the walk finished with, and an app it could not reload is named, with a non-zero exit.

The swaps themselves are reported on the bus either way, under process.reload, process.reloaded and process.reload_abandoned.

full --help output
$ shep reload --help
Reload one or more sheep, one instance at a time.

Each instance is replaced by a fresh one that has to become ready before the reload moves on, so a
release that never comes up is reported as a failure rather than as a success.

What that failure COSTS depends on the order, and the order depends on the app.

A probed app with no reuse_port or listen table is replaced serially: the old instance drains first,
then the new one starts in its place. A probe asks an address, and an address cannot say which
process answered it. Run both at once and the outgoing instance answers for the incoming one, so
shep would call a release ready that never bound anything.

The old instance is gone by the time the new one is judged, so there is nothing to go back to. A
replacement that never becomes ready is left running and NOT marked online, and the reload is
abandoned, which for a one-instance app means the gap lasts until you act on it. A rollback that
points the app back at working code and reloads again is what ends it; that reload can reach the
instance this one left behind.

Everything else overlaps, old and new running together: an app with no probe, an app using
wait_ready (its channel belongs to one instance, so nothing else can answer it), and a probed app
with reuse_port or listen.

An overlap asks the same of all of them. Both instances are bound at once, so an app that binds an
address must share the socket itself, with SO_REUSEPORT set before it binds, unless it has a listen
table: then shep binds once and every instance inherits the sockets. Otherwise the replacement takes
EADDRINUSE and the reload is abandoned, with the old instance left serving. This command has exited
0 by then, so process.reload_abandoned on the bus is the only report.

reuse_port neither creates that requirement nor satisfies it. It is how a probed app says it is
already handling the sharing, and so asks for the overlap back.

An overlap is not zero downtime either. The old listener's queue of connections it has not accepted
yet is dropped when it closes, so an app that does not stop accepting and finish what it has in hand
before graceful_timeout runs out loses whatever was waiting there.

A selector matching one app exits as soon as the shepherd accepts the reload, printing the flock as
it stood at that moment. A clustered app takes longer to swap than any answer can wait for.

A selector matching two or more apps is walked in dependency order instead, and the reply waits:
each stage is held until the apps a later stage depends on are back and ready, so the wait is the
sum of the stages rather than the longest swap in the fold. The rows printed are what the walk
finished with, and an app it could not reload is named, with a non-zero exit.

The swaps themselves are reported on the bus either way, under process.reload, process.reloaded and
process.reload_abandoned.

Usage: shep reload [OPTIONS] <SELECTORS>...

Arguments:
  <SELECTORS>...
          One or more: name, id, `name:slot`, `all`, `api-*`, `/regex/`, `fold:<name>`
          
          See shep help selectors

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep reload api
  $ shep reload fold:web

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep delete
shep delete [OPTIONS] <SELECTORS>...

Delete one or more sheep or dogs, for good

A dog's name takes the dog's path: it is stopped, deregistered, and struck from [daemon] enabled_dogs, [daemon] adopted_dogs and [daemon] channel_dogs in shep.toml, so the next boot does not bring it back. Its [<name>] table in dogs.toml stays, as it does through shep disable, and the verb says so. A dog shep install put on disk also loses $SHEP_HOME/dogs/<name>/; an adopted dog's file stays. A built-in dog is refused by the shepherd: use shep disable. A sweep (all, a fold, a /regex/) is the flock, not a dog.

A name is judged against shep.toml, so a shep.toml that exists and cannot be read or parsed refuses a name selector instead of guessing at it: the shepherd would delete the live entry while the adoption survived in the file the next boot reads. A sweep needs no such judgement and runs regardless.

Over --host, the name of an adopted dog is refused, because the adoption lives in the host's shep.toml and would bring the dog back at the next boot. The refusal names the ssh line that runs shep delete on the host. A built-in dog is left to the host's shepherd, which refuses it as above.

full --help output
$ shep delete --help
Delete one or more sheep or dogs, for good

A dog's name takes the dog's path: it is stopped, deregistered, and struck from `[daemon]
enabled_dogs`, `[daemon] adopted_dogs` and `[daemon] channel_dogs` in `shep.toml`, so the next boot
does not bring it back. Its `[<name>]` table in `dogs.toml` stays, as it does through `shep
disable`, and the verb says so. A dog `shep install` put on disk also loses
`$SHEP_HOME/dogs/<name>/`; an adopted dog's file stays. A built-in dog is refused by the shepherd:
use `shep disable`. A sweep (`all`, a fold, a `/regex/`) is the flock, not a dog.

A name is judged against `shep.toml`, so a `shep.toml` that exists and cannot be read or parsed
refuses a name selector instead of guessing at it: the shepherd would delete the live entry while
the adoption survived in the file the next boot reads. A sweep needs no such judgement and runs
regardless.

Over `--host`, the name of an adopted dog is refused, because the adoption lives in the host's
`shep.toml` and would bring the dog back at the next boot. The refusal names the `ssh` line that
runs `shep delete` on the host. A built-in dog is left to the host's shepherd, which refuses it as
above.

Usage: shep delete [OPTIONS] <SELECTORS>...

Arguments:
  <SELECTORS>...
          One or more: name, id, `name:slot`, `all`, `api-*`, `/regex/`, `fold:<name>`
          
          See shep help selectors

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep delete api
  $ shep delete '/^tmp-/'

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep stockscale
shep stock [OPTIONS] <NAME> <COUNT>

Set how many instances one app runs

The stocking rate. An absolute count, not a change: shep stock web 4 means web has four instances afterwards, whatever it had before. There is no +N/-N form — run it twice and get the same flock.

Stocking up fills the lowest free instance slots; stocking down releases the highest, so stocking out and back returns the same slot numbers, the same SHEP_INSTANCE values and the same log files it started with.

Exits as soon as the shepherd accepts, printing the instances that remain. On a stock-down the departing instances are still running their stop ladders at that point; they report themselves on the bus, under process.delete.

The new count is written to the muster roll, so a reboot keeps it.

full --help output
$ shep stock --help
Set how many instances one app runs

The stocking rate. An absolute count, not a change: `shep stock web 4` means web has four instances
afterwards, whatever it had before. There is no +N/-N form — run it twice and get the same flock.

Stocking up fills the lowest free instance slots; stocking down releases the highest, so stocking
out and back returns the same slot numbers, the same SHEP_INSTANCE values and the same log files it
started with.

Exits as soon as the shepherd accepts, printing the instances that remain. On a stock-down the
departing instances are still running their stop ladders at that point; they report themselves on
the bus, under process.delete.

The new count is written to the muster roll, so a reboot keeps it.

Usage: shep stock [OPTIONS] <NAME> <COUNT>

Arguments:
  <NAME>
          The app's name

  <COUNT>
          How many instances it runs afterwards

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep stock api 4

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep copy
shep copy [OPTIONS] <FROM> <TO>

Copy settings from one sheep onto another

Copies one setting, one dog's table, or a sheep's env.

Each side is an address: a sheep name, then a path in its config.

shep copy web.restart_delay api.restart_delay copies one field. shep copy web.dogs.kelpie api.dogs.kelpie copies a dog's whole table. shep copy web.dogs.kelpie.rulings api.dogs.kelpie.rulings copies one key or sub-table inside it. shep copy web.env api.env copies every env key.

A dog name and a key inside a table may each contain a dot, and each is read as the longest name the copy's tables actually hold: web.dogs.foo.bar is the dog foo.bar when a side has a table under that name, and the dog foo with the key bar when neither does, even in a flock that runs a dog named foo.bar with no table for it.

The path is the same on both sides: a copy moves values, and web.restart_delay onto api.kill_timeout is two different settings.

A dog table and an env merge by default. Keys the source has overwrite the target's, and keys only the target has stay. --replace makes the target exactly the source at that path. --except <key> leaves one key out, named under the path you are copying: a dog's git.checkout names one project's repo, and shep cannot tell which of a dog's keys belong to a sheep. A copy refuses when one side holds something that is not a table where the copy has to write through one.

The shepherd copies env, so no value reaches this client. A {{secret:NAME}} value is copied as the reference and never resolved. The change list and the JSON envelope show a reference as itself and every other value as <redacted>. The copied keys wait for the target's next spawn. name, instances and the whole dogs map are refused for the same reason the shepherd refuses them.

Nothing is written until you confirm. The change list prints first, naming every key added, changed or removed with its old and new value (an env value is redacted). With --format json that list prints on stderr, so stdout stays the one envelope the run writes after the answer. --yes skips the question, --dry-run prints the list and writes nothing, and with no terminal to ask on the run refuses instead of writing.

full --help output
$ shep copy --help
Copy settings from one sheep onto another

Copies one setting, one dog's table, or a sheep's env.

Each side is an address: a sheep name, then a path in its config.

`shep copy web.restart_delay api.restart_delay` copies one field. `shep copy web.dogs.kelpie
api.dogs.kelpie` copies a dog's whole table. `shep copy web.dogs.kelpie.rulings
api.dogs.kelpie.rulings` copies one key or sub-table inside it. `shep copy web.env api.env` copies
every env key.

A dog name and a key inside a table may each contain a dot, and each is read as the longest name the
copy's tables actually hold: `web.dogs.foo.bar` is the dog `foo.bar` when a side has a table under
that name, and the dog `foo` with the key `bar` when neither does, even in a flock that runs a dog
named `foo.bar` with no table for it.

The path is the same on both sides: a copy moves values, and `web.restart_delay` onto
`api.kill_timeout` is two different settings.

A dog table and an env merge by default. Keys the source has overwrite the target's, and keys only
the target has stay. `--replace` makes the target exactly the source at that path. `--except <key>`
leaves one key out, named under the path you are copying: a dog's `git.checkout` names one project's
repo, and shep cannot tell which of a dog's keys belong to a sheep. A copy refuses when one side
holds something that is not a table where the copy has to write through one.

The shepherd copies `env`, so no value reaches this client. A `{{secret:NAME}}` value is copied as
the reference and never resolved. The change list and the JSON envelope show a reference as itself
and every other value as `<redacted>`. The copied keys wait for the target's next spawn. `name`,
`instances` and the whole `dogs` map are refused for the same reason the shepherd refuses them.

Nothing is written until you confirm. The change list prints first, naming every key added, changed
or removed with its old and new value (an env value is redacted). With `--format json` that list
prints on stderr, so stdout stays the one envelope the run writes after the answer. `--yes` skips
the question, `--dry-run` prints the list and writes nothing, and with no terminal to ask on the run
refuses instead of writing.

Usage: shep copy [OPTIONS] <FROM> <TO>

Arguments:
  <FROM>
          The sheep and the path to copy from, such as `web.restart_delay`, `web.dogs.kelpie`,
          `web.dogs.kelpie.rulings`, or `web.env`

  <TO>
          The sheep and the same path to copy onto, such as `api.restart_delay` or `api.env`

Options:
      --replace
          Make the target exactly the source at that path, instead of merging into it

      --except <KEY>
          Leave this key out, named under the path you are copying; repeat it for more than one

  -d, --dry-run
          Print what would change and write nothing

  -y, --yes
          Write without asking

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep copy web.restart_delay api.restart_delay
  $ shep copy web.env api.env --except SESSION_SECRET

Global flags: --format, --quiet, --style, --home. See shep help flags
shep set
shep set [OPTIONS] <ADDRESS> <VALUE>

Change one setting of a sheep or a dog

The address is shep get's and shep copy's: a sheep's own field, a dog's table on that sheep, or the dog's own section of dogs.toml. <dog>.defaults[.<key>] is retired: a dog's own section, <dog>.<key>, is the value for every sheep. The value is TOML, and text that is not TOML is the string as typed: 5 is a number, true a toggle, 3s stays 3s. TOML's nan and inf are refused: the flock's JSON has no cell.

A write that carries a dog's table is checked against the schema that dog published, and a value it turns down is refused with the key path it sits at. env, secrets, name, instances and the whole dogs map are refused for the same reason the shepherd refuses them.

Nothing is written until you confirm, and the change list prints first, naming every key the write touches with its old and new value. Under --format json that list prints on stderr, so stdout stays the one envelope the run writes after the answer. --yes skips the question and --dry-run prints the list and writes nothing. A write that replaces a whole section or a whole dog table re-reads it after your answer, and is refused if it changed while you were answering.

The key/value store this verb used to write lives at shep kv set.

full --help output
$ shep set --help
Change one setting of a sheep or a dog

The address is `shep get`'s and `shep copy`'s: a sheep's own field, a dog's table on that sheep, or
the dog's own section of `dogs.toml`. `<dog>.defaults[.<key>]` is retired: a dog's own section,
`<dog>.<key>`, is the value for every sheep. The value is TOML, and text that is not TOML is the
string as typed: `5` is a number, `true` a toggle, `3s` stays `3s`. TOML's `nan` and `inf` are
refused: the flock's JSON has no cell.

A write that carries a dog's table is checked against the schema that dog published, and a value it
turns down is refused with the key path it sits at. `env`, secrets, `name`, `instances` and the
whole `dogs` map are refused for the same reason the shepherd refuses them.

Nothing is written until you confirm, and the change list prints first, naming every key the write
touches with its old and new value. Under `--format json` that list prints on stderr, so stdout
stays the one envelope the run writes after the answer. `--yes` skips the question and `--dry-run`
prints the list and writes nothing. A write that replaces a whole section or a whole dog table
re-reads it after your answer, and is refused if it changed while you were answering.

The key/value store this verb used to write lives at `shep kv set`.

Usage: shep set [OPTIONS] <ADDRESS> <VALUE>

Arguments:
  <ADDRESS>
          A sheep or a dog, and the path inside its settings, such as `api.max_memory`,
          `api.dogs.kelpie.git`, or `kelpie.worker`

  <VALUE>
          The new value, as TOML: `5`, `true`, `["a", "b"]`, `{ keep = 1 }`. Text that is not TOML
          is the string as typed, such as `3s`

Options:
  -d, --dry-run
          Print what would change and write nothing

  -y, --yes
          Write without asking

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep set api.restart_delay 3s
  $ shep set api.max_memory 512M --dry-run

Global flags: --format, --quiet, --style, --home. See shep help flags
shep unset
shep unset [OPTIONS] <ADDRESS>

Drop an override, or remove a dog's key

What was there before then applies. The address is shep set's, and <dog>.defaults[.<key>] is refused as it is there. On a sheep's field it drops the override you set, so the Flockfile's value returns in shep get and the running config. A field with no override is refused: it already holds the Flockfile's value. On a key of a dog's settings, whether its table on a sheep or its section of dogs.toml, it removes the key, so the dog's own default applies. A sheep's whole dogs.<dog> table can be removed too; a whole dogs.toml section, env, name, instances and the whole dogs map are refused.

The flow and the flags are shep set's: the change list prints first, --yes skips the question, --dry-run writes nothing, and --format json prints one envelope after the answer. A key dropped from a field the sheep only reads at spawn waits for the next one, and shep reload promotes it.

The key/value store this verb used to remove from lives at shep kv unset.

full --help output
$ shep unset --help
Drop an override, or remove a dog's key

What was there before then applies. The address is `shep set`'s, and `<dog>.defaults[.<key>]` is
refused as it is there. On a sheep's field it drops the override you set, so the Flockfile's value
returns in `shep get` and the running config. A field with no override is refused: it already holds
the Flockfile's value. On a key of a dog's settings, whether its table on a sheep or its section of
`dogs.toml`, it removes the key, so the dog's own default applies. A sheep's whole `dogs.<dog>`
table can be removed too; a whole `dogs.toml` section, `env`, `name`, `instances` and the whole
`dogs` map are refused.

The flow and the flags are `shep set`'s: the change list prints first, `--yes` skips the question,
`--dry-run` writes nothing, and `--format json` prints one envelope after the answer. A key dropped
from a field the sheep only reads at spawn waits for the next one, and `shep reload` promotes it.

The key/value store this verb used to remove from lives at `shep kv unset`.

Usage: shep unset [OPTIONS] <ADDRESS>

Arguments:
  <ADDRESS>
          A sheep's field, or a key inside a dog's settings, such as `api.max_memory`,
          `api.dogs.kelpie.git`, or `kelpie.worker.timeout`

Options:
  -d, --dry-run
          Print what would change and write nothing

  -y, --yes
          Write without asking

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep unset api.max_memory

Global flags: --format, --quiet, --style, --home. See shep help flags

Inspecting the flock

shep flocklistls
shep flock [OPTIONS]

List the flock.

With a hosts list in shep.toml (shep host add edits it), lists this machine's flock and then each listed host's, all asked at once. Each table is headed by the host's name as listed, local for this machine.

A host that does not answer prints one line on stderr instead of a table and does not hide the others. The exit code is 0 only when every host answered, otherwise the first failing host's, this machine first. Listed hosts are dialled without prompts, so their keys must be in ssh-agent. --host <name> lists one host and may prompt; --follow follows this machine, or the --host one, and dials no other. --format json with a hosts list needs --host.

full --help output
$ shep flock --help
List the flock.

With a `hosts` list in shep.toml (`shep host add` edits it), lists this machine's flock and then
each listed host's, all asked at once. Each table is headed by the host's name as listed, `local`
for this machine.

A host that does not answer prints one line on stderr instead of a table and does not hide the
others. The exit code is 0 only when every host answered, otherwise the first failing host's, this
machine first. Listed hosts are dialled without prompts, so their keys must be in ssh-agent. `--host
<name>` lists one host and may prompt; `--follow` follows this machine, or the `--host` one, and
dials no other. `--format json` with a hosts list needs `--host`.

Usage: shep flock [OPTIONS]

Options:
  -f, --follow
          Keep the listing current: redraw it in place until Ctrl+C
          
          One listing to start, then a fresh one every `--interval` seconds while the shepherd stays
          reachable, each one painted over the last. A summary of the machine rides above the
          tables. Ctrl+C leaves an exit of zero, a stopped shepherd leaves the code its refusal
          carries: an interrupted follow and a dead shepherd must not read as the same thing.
          
          Needs a live shepherd: a saved roll is a single moment, and a follow's whole reason is the
          moments after it. Needs a terminal too, and refuses `--format json`, since neither has
          anywhere to put a redraw.

  -i, --interval <SECONDS>
          Seconds between redraws, with `--follow`
          
          The floor is one second, which is also the default. Below it the listing costs the
          shepherd more than it tells the operator, and `sysinfo` reports no CPU at all over a
          window that short.
          
          [default: 1]

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep flock
  $ shep flock --follow --interval 2
  $ shep flock --format json

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep describe
shep describe [OPTIONS] <SELECTORS>...

Describe one sheep in detail.

Includes the sheep's lambs: the processes the OS reports as descendants of its pid. That is not the same set the stop ladder kills, which acts on the process group — a double-forked descendant leaves this list and is still killed, and a setsid() one stays in it and survives.

Lamb names are executable names, never command lines.

With the vcs feature, the revision the sheep's cwd is checked out on now is shown under the table, not necessarily the one it started from.

full --help output
$ shep describe --help
Describe one sheep in detail.

Includes the sheep's lambs: the processes the OS reports as descendants of its pid. That is not the
same set the stop ladder kills, which acts on the process group — a double-forked descendant leaves
this list and is still killed, and a setsid() one stays in it and survives.

Lamb names are executable names, never command lines.

With the `vcs` feature, the revision the sheep's `cwd` is checked out on now is shown under the
table, not necessarily the one it started from.

Usage: shep describe [OPTIONS] <SELECTORS>...

Arguments:
  <SELECTORS>...
          One or more: name, id, `name:slot`, `all`, `api-*`, `/regex/`, `fold:<name>`
          
          See shep help selectors

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep describe api
  $ shep describe 'api-*'

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep fold
shep fold [OPTIONS] <NAME>

List one fold

full --help output
$ shep fold --help
List one fold

Usage: shep fold [OPTIONS] <NAME>

Arguments:
  <NAME>
          The fold to list

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep fold web

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep dogs
shep dogs [OPTIONS] [FILTER]

List the dogs, and nothing else

--available lists the community index of dogs you could adopt instead of the ones this shepherd is running. The listing shows each dog's SOURCE (built-in, installed, installed, community or adopted) and VERSION, with → <new> when the cached index holds a newer one; the index is never fetched for it. grant and revoke change one permission of a dog.

full --help output
$ shep dogs --help
List the dogs, and nothing else

`--available` lists the community index of dogs you could adopt instead of the ones this shepherd is
running. The listing shows each dog's SOURCE (`built-in`, `installed`, `installed, community` or
`adopted`) and VERSION, with `→ <new>` when the cached index holds a newer one; the index is never
fetched for it. `grant` and `revoke` change one permission of a dog.

Usage: shep dogs [OPTIONS] [FILTER]
       shep dogs <COMMAND>

Commands:
  grant   Grant a dog one permission it declared
  revoke  Revoke one permission from a dog
  help    Print this message or the help of the given subcommand(s)

Arguments:
  [FILTER]
          Narrow the listing to entries whose name, package or description contains this text,
          case-insensitively

Options:
  -A, --available
          List the dogs published in the community index instead of the ones this shepherd is
          running. Needs no shepherd

  -r, --refresh
          Fetch the community index even when the copy cached in the last day is still fresh

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep dogs
  $ shep dogs --available
  $ shep dogs grant kelpie flock.read

Global flags: --format, --quiet, --style, --home. See shep help flags
shep hints
shep hints [OPTIONS] [COMMAND]

List the hints, and turn each off or on

A hint is the one line shep flock prints under its listing when a log has grown large or a sheep keeps restarting, suggesting a dog. Each is on until turned off, and the choice is kept in hints.json under $SHEP_HOME. shep hints off and shep hints on take a hint's name, or turn every hint off or on with none. Needs no shepherd.

full --help output
$ shep hints --help
List the hints, and turn each off or on

A hint is the one line `shep flock` prints under its listing when a log has grown large or a sheep
keeps restarting, suggesting a dog. Each is on until turned off, and the choice is kept in
`hints.json` under `$SHEP_HOME`. `shep hints off` and `shep hints on` take a hint's name, or turn
every hint off or on with none. Needs no shepherd.

Usage: shep hints [OPTIONS] [COMMAND]

Commands:
  off   Turn a hint off, or every hint with no name
  on    Turn a hint back on, or every hint with no name
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep hints
  $ shep hints off logs
  $ shep hints on

Global flags: --format, --quiet, --style, --home. See shep help flags
shep hints off
shep hints off [OPTIONS] [HINT]

Turn a hint off, or every hint with no name

full --help output
$ shep hints off --help
Turn a hint off, or every hint with no name

Usage: shep hints off [OPTIONS] [HINT]

Arguments:
  [HINT]
          The hint to turn off, as `shep hints` lists it

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep hints on
shep hints on [OPTIONS] [HINT]

Turn a hint back on, or every hint with no name

full --help output
$ shep hints on --help
Turn a hint back on, or every hint with no name

Usage: shep hints on [OPTIONS] [HINT]

Arguments:
  [HINT]
          The hint to turn on, as `shep hints` lists it

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep get
shep get [OPTIONS] <ADDRESS>

Print a sheep's or a dog's settings as TOML.

The address is shep copy's: a name, then a path inside the settings that name holds. A sheep's name addresses its config and its dogs.<dog> tables; a dog's name addresses its own section of dogs.toml. A sheep is looked for first, among the names the running flock carries, and anything no sheep is is read as a dog's section.

shep get api prints a sheep's whole config, shep get api.max_memory one field, shep get api.dogs.kelpie.git one dog's table inside a sheep, and shep get kelpie.worker one table inside a dog's own section. A path that ends at a value prints that value under the header of the table that holds it.

The answer is the TOML the address names, spelled as the file it lives in spells it: a sheep's fragment carries its dogs.<dog> headers, a dog's carries [<name>]. --format json wraps the same text in the one envelope every other verb prints.

A sheep's env values are never read: a client is never sent them. shep describe api lists the keys, and shep import env writes them.

A name that is neither a sheep nor a dog is refused by name: the key/value store that shep get used to read lives at shep kv get.

full --help output
$ shep get --help
Print a sheep's or a dog's settings as TOML.

The address is `shep copy`'s: a name, then a path inside the settings that name holds. A sheep's
name addresses its config and its `dogs.<dog>` tables; a dog's name addresses its own section of
`dogs.toml`. A sheep is looked for first, among the names the running flock carries, and anything no
sheep is is read as a dog's section.

`shep get api` prints a sheep's whole config, `shep get api.max_memory` one field, `shep get
api.dogs.kelpie.git` one dog's table inside a sheep, and `shep get kelpie.worker` one table inside a
dog's own section. A path that ends at a value prints that value under the header of the table that
holds it.

The answer is the TOML the address names, spelled as the file it lives in spells it: a sheep's
fragment carries its `dogs.<dog>` headers, a dog's carries `[<name>]`. `--format json` wraps the
same text in the one envelope every other verb prints.

A sheep's `env` values are never read: a client is never sent them. `shep describe api` lists the
keys, and `shep import env` writes them.

A name that is neither a sheep nor a dog is refused by name: the key/value store that `shep get`
used to read lives at `shep kv get`.

Usage: shep get [OPTIONS] <ADDRESS>

Arguments:
  <ADDRESS>
          A sheep or a dog, and the path inside its settings, such as `api.max_memory`,
          `api.dogs.kelpie.git`, or `kelpie.worker`

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep get api.max_memory
  $ shep get api.dogs.kelpie.git

Global flags: --format, --quiet, --style, --home. See shep help flags

Dogs

shep enable
shep enable [OPTIONS] <NAME>

Turn a sheep or a dog back on

A sheep named here has its disabled mark cleared and is started; a dog is written into [daemon] enabled_dogs in shep.toml and started now if a shepherd is running.

A sheep needs a running shepherd, and takes a name, a fold:, a /regex/ or all. A sweep reaches only disabled sheep and never a dog, so shep enable all undoes a batch of disables. An id or name:slot is refused, since the mark belongs to the whole app. A sheep that is not disabled is left alone and the verb says so. A dog is named, and writes the config either way and exits 0 with no shepherd running -- it comes up with the next one. shep muster is the only verb that autostarts a shepherd; this is not it. A name that is neither a sheep nor a dog exits 3 and lists the dogs, or 5 with no shepherd running.

full --help output
$ shep enable --help
Turn a sheep or a dog back on

A sheep named here has its disabled mark cleared and is started; a dog is written into `[daemon]
enabled_dogs` in `shep.toml` and started now if a shepherd is running.

A sheep needs a running shepherd, and takes a name, a `fold:`, a `/regex/` or `all`. A sweep reaches
only disabled sheep and never a dog, so `shep enable all` undoes a batch of disables. An id or
`name:slot` is refused, since the mark belongs to the whole app. A sheep that is not disabled is
left alone and the verb says so. A dog is named, and writes the config either way and exits 0 with
no shepherd running -- it comes up with the next one. `shep muster` is the only verb that autostarts
a shepherd; this is not it. A name that is neither a sheep nor a dog exits 3 and lists the dogs, or
5 with no shepherd running.

Usage: shep enable [OPTIONS] <NAME>

Arguments:
  <NAME>
          A sheep's name, `fold:<fold>`, `/<regex>/` or `all`, or a dog's name (the `[<name>]`
          config key in `dogs.toml`)

Options:
  -y, --yes
          Grant a dog everything it declares without asking; a dog's first enable asks, and with no
          terminal and no `--yes` refuses

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep enable api
  $ shep enable kelpie --yes

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep disable
shep disable [OPTIONS] <NAME>

Turn a sheep or a dog off, until shep enable

A sheep is stopped and refused a start. A dog is removed from [daemon] enabled_dogs and stopped now if a shepherd is running, and shep flock still lists it, disabled.

A sheep needs a running shepherd, and takes a name, a fold:, a /regex/ or all; a sweep never reaches a dog. An id or name:slot is refused, since the mark belongs to the whole app. While it is set, start, restart and stock refuse the sheep by name and exit 2 naming shep enable, and all, a fold or a regex pass it by. Naming it still reaches stop, delete, describe and signal. A dog's own configuration in dogs.toml survives a disable/enable cycle; shep delete forgets the adoption as well.

full --help output
$ shep disable --help
Turn a sheep or a dog off, until `shep enable`

A sheep is stopped and refused a start. A dog is removed from `[daemon] enabled_dogs` and stopped
now if a shepherd is running, and `shep flock` still lists it, disabled.

A sheep needs a running shepherd, and takes a name, a `fold:`, a `/regex/` or `all`; a sweep never
reaches a dog. An id or `name:slot` is refused, since the mark belongs to the whole app. While it is
set, `start`, `restart` and `stock` refuse the sheep by name and exit 2 naming `shep enable`, and
`all`, a fold or a regex pass it by. Naming it still reaches `stop`, `delete`, `describe` and
`signal`. A dog's own configuration in `dogs.toml` survives a disable/enable cycle; `shep delete`
forgets the adoption as well.

Usage: shep disable [OPTIONS] <NAME>

Arguments:
  <NAME>
          A sheep's name, `fold:<fold>`, `/<regex>/` or `all`, or a dog's name (the `[<name>]`
          config key in `dogs.toml`)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep disable api
  $ shep disable fold:web

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep install
shep install [OPTIONS] [DOG]

Install a dog from the community index

Adopts and enables it. With no name, lists the index. Downloads the prebuilt binary the index hashes for this target, and refuses it on a sha256 mismatch. Otherwise, or with --cargo, builds the approved version with cargo install --locked. Then it asks shep adopt's grant question. Any other row exits 1.

full --help output
$ shep install --help
Install a dog from the community index

Adopts and enables it. With no name, lists the index. Downloads the prebuilt binary the index hashes
for this target, and refuses it on a sha256 mismatch. Otherwise, or with `--cargo`, builds the
approved version with `cargo install --locked`. Then it asks `shep adopt`'s grant question. Any
other row exits 1.

Usage: shep install [OPTIONS] [DOG]

Arguments:
  [DOG]
          The dog to install: its `adopt_as` name in the community index, as `shep install` with no
          name lists it. With none, lists what `shep dogs --available` lists, with the install line
          under each dog that can be installed. A dog adopted from a path, with no receipt, is
          swapped for the catalogue build after a question naming the path. It keeps its name,
          `[dog.<name>]` table and enabled state, and the old file stays on disk

Options:
  -y, --yes
          Grant the dog everything it declares without asking, and replace an adopted dog without
          asking. With no terminal and no `--yes`, install refuses before it replaces an adopted
          dog, and fetches the dog and then refuses at the grant question otherwise

      --no-enable
          Stop after adopting: the dog is installed, recorded and granted, and left disabled until
          `shep enable`

  -r, --refresh
          Fetch the community index even when the copy cached in the last day is still fresh

      --cargo
          Build the index's version with cargo, even when the index hashes a prebuilt binary for
          this target

      --ref <REF>
          Build the dog from this branch, tag or commit of its own repository instead of the version
          the index approves. A 7 to 40 character hex string is a commit; anything else is tried as
          a tag, then a branch. The index has not reviewed it, and the grant question says so

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep install
  $ shep install kelpie --yes

Global flags: --format, --quiet, --style, --home. See shep help flags
shep upgrade
shep upgrade [OPTIONS] [DOG]

Upgrade an installed dog, with a way back

An index install moves to the index's version and a ref install rebuilds its ref at the newest commit. --ref switches ref, --release returns to the index's version and --rollback puts back the install the last upgrade replaced. Each upgrade restarts the dog, and a permission the new build declares waits for review.

full --help output
$ shep upgrade --help
Upgrade an installed dog, with a way back

An index install moves to the index's version and a ref install rebuilds its ref at the newest
commit. `--ref` switches ref, `--release` returns to the index's version and `--rollback` puts back
the install the last upgrade replaced. Each upgrade restarts the dog, and a permission the new build
declares waits for review.

Usage: shep upgrade [OPTIONS] [DOG]

Arguments:
  [DOG]
          The installed dog to upgrade. With none and no `--dogs`, `shep upgrade` upgrades shep
          through the channel it came from, then every installed dog the index has a newer version
          of

Options:
  -D, --dogs
          Upgrade every installed dog in turn. A dog adopted from a path has no receipt and is
          skipped, with a line saying so

      --ref <REF>
          Switch to this branch, tag or commit of the dog's own repository, which the index has not
          reviewed. Needs a dog name

      --release
          Return a dog installed from a ref to the version the index approves

      --rollback
          Put back the install the last upgrade replaced, and its receipt. The upgrade it undoes
          becomes the one to roll back to

  -r, --refresh
          Fetch the community index even when the copy cached in the last day is still fresh

      --reload
          Reload the shepherd onto the new shep without asking. Only a bare `shep upgrade` that
          upgraded shep has a reload to do

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep upgrade kelpie
  $ shep upgrade --dogs
  $ shep upgrade kelpie --rollback

Global flags: --format, --quiet, --style, --home. See shep help flags
shep adopt
shep adopt [OPTIONS] <PATH>

Vet a binary and register it as a dog

Writes [daemon] adopted_dogs and [daemon] enabled_dogs in shep.toml, and starts it now if a shepherd is running.

A binary whose --version answer carries shep-channel: true is also written to [daemon] channel_dogs, and runs with the shepherd channel: shep trigger reaches it, and a stop is a message rather than a signal. The dog asks; there is no flag for it.

The path can be given as-is, with a leading ~/, or as a bare name already on $PATH (cargo install puts one there). Refuses, before touching the config at all, a path that resolves to nothing that exists, is not a file, has no execute bit set, or that this kernel will not exec — and refuses a name that already names a built-in verb or alias, since such a dog could never be reached. An adopted dog runs at the shepherd's own trust level, with no sandboxing beyond it. Once adopted, shep <name> [args...] runs it directly, passing args through untouched — a second invocation mode from the one the shepherd itself uses to supervise it.

full --help output
$ shep adopt --help
Vet a binary and register it as a dog

Writes `[daemon] adopted_dogs` and `[daemon] enabled_dogs` in `shep.toml`, and starts it now if a
shepherd is running.

A binary whose `--version` answer carries `shep-channel: true` is also written to `[daemon]
channel_dogs`, and runs with the shepherd channel: `shep trigger` reaches it, and a stop is a
message rather than a signal. The dog asks; there is no flag for it.

The path can be given as-is, with a leading `~/`, or as a bare name already on `$PATH` (`cargo
install` puts one there). Refuses, before touching the config at all, a path that resolves to
nothing that exists, is not a file, has no execute bit set, or that this kernel will not exec — and
refuses a name that already names a built-in verb or alias, since such a dog could never be reached.
An adopted dog runs at the shepherd's own trust level, with no sandboxing beyond it. Once adopted,
`shep <name> [args...]` runs it directly, passing `args` through untouched — a second invocation
mode from the one the shepherd itself uses to supervise it.

Usage: shep adopt [OPTIONS] <PATH>

Arguments:
  <PATH>
          Path to the dog's binary, vetted before `shep.toml` is touched. Resolved before vetting:
          as given, with a leading `~/` expanded, or looked up on `$PATH` if it names no directory —
          first hit wins

Options:
  -n, --name <NAME>
          The dog's name, the `[<name>]` config key in `dogs.toml`. Defaults to the binary's file
          stem with a leading `shep-` stripped

  -y, --yes
          Grant the dog everything it declares without asking. With no terminal and no `--yes`,
          adopt refuses rather than granting

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep adopt ./shep-kelpie
  $ shep adopt ./target/release/mydog --name watcher

Global flags: --format, --quiet, --style, --home. See shep help flags
shep dogs grant
shep dogs grant [OPTIONS] <NAME> <PERMISSION>

Grant a dog one permission it declared.

Writes [daemon.dog_grants.<dog>] in shep.toml and tells a running shepherd, which judges the dog's next request by the new grants with no restart. Only a permission the dog's manifest declares can be granted; shep adopt and the first shep enable ask about the whole list.

Grants keep a dog's requests in bounds and do not confine it: it runs as you and can do anything you can.

full --help output
$ shep dogs grant --help
Grant a dog one permission it declared.

Writes `[daemon.dog_grants.<dog>]` in `shep.toml` and tells a running shepherd, which judges the
dog's next request by the new grants with no restart. Only a permission the dog's manifest declares
can be granted; `shep adopt` and the first `shep enable` ask about the whole list.

Grants keep a dog's requests in bounds and do not confine it: it runs as you and can do anything you
can.

Usage: shep dogs grant [OPTIONS] <NAME> <PERMISSION>

Arguments:
  <NAME>
          The dog's name, as `shep adopt` registered it

  <PERMISSION>
          The permission, as the dog's manifest spells it: `flock.read`, `events:process.`,
          `secrets.read:staging`

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep dogs revoke
shep dogs revoke [OPTIONS] <NAME> <PERMISSION>

Revoke one permission from a dog.

Writes [daemon.dog_grants.<dog>] in shep.toml and tells a running shepherd, which refuses the dog's next request that needs it with no restart.

full --help output
$ shep dogs revoke --help
Revoke one permission from a dog.

Writes `[daemon.dog_grants.<dog>]` in `shep.toml` and tells a running shepherd, which refuses the
dog's next request that needs it with no restart.

Usage: shep dogs revoke [OPTIONS] <NAME> <PERMISSION>

Arguments:
  <NAME>
          The dog's name, as `shep adopt` registered it

  <PERMISSION>
          The permission, as the dog's manifest spells it: `flock.read`, `events:process.`,
          `secrets.read:staging`

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags

Talking to a sheep

shep trigger
shep trigger [OPTIONS] <SELECTOR> [ACTION] [PARAMS]

Send a named action to matched sheep

Reports what each app answers. Reaches an app over its shepherd channel — the fd-3 pipe the daemon opens when the app's Flockfile sets channel = true. wait_ready and shutdown_with_message both imply the same channel, so either one of the three is enough; a sheep with none of them answers a no_channel row instead of a reply, naming the same fields.

action and any params are free-form and unvalidated here — sent to the app verbatim, for the app itself to recognize or refuse. A shep. action name is refused: shep sends those itself, as the operator.

full --help output
$ shep trigger --help
Send a named action to matched sheep

Reports what each app answers. Reaches an app over its shepherd channel — the fd-3 pipe the daemon
opens when the app's Flockfile sets `channel = true`. `wait_ready` and `shutdown_with_message` both
imply the same channel, so either one of the three is enough; a sheep with none of them answers a
`no_channel` row instead of a reply, naming the same fields.

`action` and any `params` are free-form and unvalidated here — sent to the app verbatim, for the app
itself to recognize or refuse. A `shep.` action name is refused: shep sends those itself, as the
operator.

Usage: shep trigger [OPTIONS] <SELECTOR> [ACTION] [PARAMS]

Arguments:
  <SELECTOR>
          name, id, `name:slot`, `all`, `/regex/`, or `fold:<name>`. With no action, the name of a
          dog, whose declared actions are listed

  [ACTION]
          Action name — free-form, defined by the app. A `shep.` name is shep's own to send, and is
          refused

  [PARAMS]
          Argument text for the action, passed through to the app verbatim

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep trigger api reindex
  $ shep trigger api warm-cache /products
  $ shep trigger kelpie

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep signal
shep signal [OPTIONS] <SELECTOR> <SIGNAL>

Send a unix signal to matched sheep.

Delivered to each sheep's own process, not to its process group — its lambs are signalled only with --lamb. This nudges the application (SIGHUP to re-read config, SIGUSR1 to dump state); shep stop is what runs the stop ladder, and shep reload is what swaps instances.

Accepted: SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2, SIGWINCH, SIGCONT, SIGKILL. The SIG prefix and the case are both optional. SIGSTOP is refused: a stopped sheep still reads online in every listing shep can produce.

Delivery is not action. A signal the app blocks or ignores is reported delivered, because the kernel took it and there is nothing further shep can see.

full --help output
$ shep signal --help
Send a unix signal to matched sheep.

Delivered to each sheep's own process, not to its process group — its lambs are signalled only with
`--lamb`. This nudges the application (SIGHUP to re-read config, SIGUSR1 to dump state); `shep stop`
is what runs the stop ladder, and `shep reload` is what swaps instances.

Accepted: SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2, SIGWINCH, SIGCONT, SIGKILL. The SIG
prefix and the case are both optional. SIGSTOP is refused: a stopped sheep still reads online in
every listing shep can produce.

Delivery is not action. A signal the app blocks or ignores is reported delivered, because the kernel
took it and there is nothing further shep can see.

Usage: shep signal [OPTIONS] <SELECTOR> <SIGNAL>

Arguments:
  <SELECTOR>
          name, id, `name:slot`, `all`, `/regex/`, or `fold:<name>`

  <SIGNAL>
          Signal name, e.g. `SIGHUP` or `hup`

Options:
      --lamb <PID>
          Signal this lamb of the sheep instead of the sheep itself. The selector must match exactly
          one sheep, and the pid one of its lambs

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep signal api SIGHUP
  $ shep signal 'worker-*' usr1

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep whispersendline
shep whisper [OPTIONS] <SELECTOR> <LINE>

Write one line to matched sheep's stdin.

Only reaches an app whose Flockfile sets stdin = true or pty = true. A sheep with neither answers a no_stdin row naming the fields. A pty sheep gets the line as typed keys, so its terminal echoes it into its bleats.

One line, and the terminator is shep's to add: a line containing a newline or a carriage return is a usage error rather than two commands.

sent means the bytes were written and flushed, not that the app read them. A pipe holds 64 KiB before it blocks, so a short line to an app that never reads its stdin is still sent.

full --help output
$ shep whisper --help
Write one line to matched sheep's stdin.

Only reaches an app whose Flockfile sets `stdin = true` or `pty = true`. A sheep with neither
answers a `no_stdin` row naming the fields. A pty sheep gets the line as typed keys, so its terminal
echoes it into its bleats.

One line, and the terminator is shep's to add: a line containing a newline or a carriage return is a
usage error rather than two commands.

`sent` means the bytes were written and flushed, not that the app read them. A pipe holds 64 KiB
before it blocks, so a short line to an app that never reads its stdin is still `sent`.

Usage: shep whisper [OPTIONS] <SELECTOR> <LINE>

Arguments:
  <SELECTOR>
          name, id, `name:slot`, `all`, `/regex/`, or `fold:<name>`

  <LINE>
          The line, without a trailing newline — shep adds exactly one

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep whisper repl 'reload config'

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep attach
shep attach [OPTIONS] <NAME>

Show a pty sheep's live terminal and type into it.

Only a pty = true sheep has a terminal; any other is refused. Your keys go to the sheep as typed; ctrl-] detaches and is not sent. Shows what the sheep draws from now on. Needs the same permission as whisper.

full --help output
$ shep attach --help
Show a pty sheep's live terminal and type into it.

Only a `pty = true` sheep has a terminal; any other is refused. Your keys go to the sheep as typed;
ctrl-] detaches and is not sent. Shows what the sheep draws from now on. Needs the same permission
as `whisper`.

Usage: shep attach [OPTIONS] <NAME>

Arguments:
  <NAME>
          The sheep's name

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep attach claude

Global flags: --format, --quiet, --style, --host, --home. See shep help flags

Logs and alerts

shep bleatslogs
shep bleats [OPTIONS] [SELECTOR]

Show or follow bleats (log output) for one or more sheep.

Works under --host: the host's shepherd reads its own log files and sends back each tail, so this machine opens none of them.

full --help output
$ shep bleats --help
Show or follow bleats (log output) for one or more sheep.

Works under `--host`: the host's shepherd reads its own log files and sends back each tail, so this
machine opens none of them.

Usage: shep bleats [OPTIONS] [SELECTOR]

Arguments:
  [SELECTOR]
          Which sheep (default: all)
          
          [default: all]

Options:
  -N, --no-follow
          Print the tail of each sheep's log file and exit, instead of following

  -l, --lines <N>
          How many existing lines of each stream to print before following
          
          A sheep that already crashed has said everything it is going to say, so following alone
          shows an empty screen while the reason sits in the file. This prints that much history
          first, then follows.
          
          Counted per stream, so the default prints up to this many lines of stdout and up to this
          many of stderr for each matched sheep. Narrow it with `--out` or `--err`.
          
          `0` prints no history at all, following only what arrives next.
          
          [default: 15]

  -e, --err
          Only stderr

  -o, --out
          Only stdout

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep bleats api
  $ shep bleats api --no-follow --lines 100
  $ shep bleats --err

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep reopen
shep reopen [OPTIONS] [SELECTOR]

Reopen log files after an external rotator has renamed them

full --help output
$ shep reopen --help
Reopen log files after an external rotator has renamed them

Usage: shep reopen [OPTIONS] [SELECTOR]

Arguments:
  [SELECTOR]
          Which sheep (default: all)
          
          [default: all]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep reopen
  $ shep reopen api

Global flags: --format, --quiet, --style, --home. See shep help flags
shep flush
shep flush [OPTIONS] [SELECTOR]

Empty the log files of sheep, or the shepherd's own

full --help output
$ shep flush --help
Empty the log files of sheep, or the shepherd's own

Usage: shep flush [OPTIONS] [SELECTOR]

Arguments:
  [SELECTOR]
          name, id, `name:slot`, `all`, `/regex/`, `fold:<name>` (required unless --daemon)

Options:
      --daemon
          Empty the shepherd's own logs instead of any sheep's

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep flush api
  $ shep flush --daemon

Global flags: --format, --quiet, --style, --home. See shep help flags
shep barks
shep barks [OPTIONS]

Show the alert history: barks.jsonl, newest last.

Reads the file directly and never connects to the shepherd — the history is on disk precisely so it survives the shepherd, and the case this verb exists for is an operator reading it after a crash. Same precedent as shep flush --daemon, which also works on files rather than through the socket.

full --help output
$ shep barks --help
Show the alert history: `barks.jsonl`, newest last.

Reads the file directly and never connects to the shepherd — the history is on disk precisely so it
survives the shepherd, and the case this verb exists for is an operator reading it after a crash.
Same precedent as `shep flush --daemon`, which also works on files rather than through the socket.

Usage: shep barks [OPTIONS]

Options:
  -t, --tail <TAIL>
          Show only the last N barks

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep barks
  $ shep barks --tail 20

Global flags: --format, --quiet, --style, --home. See shep help flags

The KV store

shep kv
shep kv [OPTIONS] <COMMAND>

Read and write the key/value store

The verbs are shep kv get, shep kv set and shep kv unset. Reads and writes $SHEP_HOME/kv.json directly and never connects to the shepherd: the store is for ad-hoc notes and dog settings, and it has to work while nothing is running, exactly as shep enable does.

Keys are flat: letters, digits, ., _ and -, up to 128 bytes, not starting with a dot. A dot is part of the name. bark.cooldown is one key, not a path into anything.

full --help output
$ shep kv --help
Read and write the key/value store

The verbs are `shep kv get`, `shep kv set` and `shep kv unset`. Reads and writes
`$SHEP_HOME/kv.json` directly and never connects to the shepherd: the store is for ad-hoc notes and
dog settings, and it has to work while nothing is running, exactly as `shep enable` does.

Keys are flat: letters, digits, `.`, `_` and `-`, up to 128 bytes, not starting with a dot. A dot is
part of the name. `bark.cooldown` is one key, not a path into anything.

Usage: shep kv [OPTIONS] <COMMAND>

Commands:
  get    Read one value from the store, or list the whole store with no key
  set    Store a value in the shepherd's key/value store
  unset  Remove one key from the store, or every key with --all
  help   Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep kv set deploy-id 4821
  $ shep kv get deploy-id
  $ shep kv unset deploy-id

Global flags: --format, --quiet, --style, --home. See shep help flags
shep kv get
shep kv get [OPTIONS] [KEY]

Read one value from the store, or list the whole store with no key

full --help output
$ shep kv get --help
Read one value from the store, or list the whole store with no key

Usage: shep kv get [OPTIONS] [KEY]

Arguments:
  [KEY]
          The key; omit to list every key

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep kv set
shep kv set [OPTIONS] <KEY> <VALUE>

Store a value in the shepherd's key/value store.

Reads and writes $SHEP_HOME/kv.json directly and never connects to the shepherd: the store is for ad-hoc notes and dog settings, and it has to work while nothing is running, exactly as shep enable does.

Keys are flat: letters, digits, ., _ and -, up to 128 bytes, not starting with a dot. A dot is part of the name. bark.cooldown is one key, not a path into anything.

full --help output
$ shep kv set --help
Store a value in the shepherd's key/value store.

Reads and writes `$SHEP_HOME/kv.json` directly and never connects to the shepherd: the store is for
ad-hoc notes and dog settings, and it has to work while nothing is running, exactly as `shep enable`
does.

Keys are flat: letters, digits, `.`, `_` and `-`, up to 128 bytes, not starting with a dot. A dot is
part of the name. `bark.cooldown` is one key, not a path into anything.

Usage: shep kv set [OPTIONS] <KEY> <VALUE>

Arguments:
  <KEY>
          The key

  <VALUE>
          The value

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep kv unset
shep kv unset [OPTIONS] [KEY]

Remove one key from the store, or every key with --all

full --help output
$ shep kv unset --help
Remove one key from the store, or every key with --all

Usage: shep kv unset [OPTIONS] [KEY]

Arguments:
  [KEY]
          The key to remove

Options:
  -a, --all
          Remove every key

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags

Secrets

shep secret
shep secret [OPTIONS] <COMMAND>

Store the values a Flockfile refers to and never carries.

Reads and writes $SHEP_HOME/secrets.json directly and never connects to the shepherd, exactly as shep kv set does: filling the store before the first shep start is the ordinary first run.

A key holds one value per environment, so production and staging differ without two config files. A {{secret:NAME}} reference in a Flockfile resolves against the sheep's own environment and then the all slot, never another named environment.

Keys and environment names are letters, digits, ., _ and -, up to 128 bytes, not starting with a dot.

Reading a value back is off until [secrets] allow_read = true is in $SHEP_HOME/shep.toml. secret list needs nothing: it names keys and the environments each has a value for, never a value.

full --help output
$ shep secret --help
Store the values a Flockfile refers to and never carries.

Reads and writes `$SHEP_HOME/secrets.json` directly and never connects to the shepherd, exactly as
`shep kv set` does: filling the store before the first `shep start` is the ordinary first run.

A key holds one value per environment, so production and staging differ without two config files. A
`{{secret:NAME}}` reference in a Flockfile resolves against the sheep's own environment and then the
`all` slot, never another named environment.

Keys and environment names are letters, digits, `.`, `_` and `-`, up to 128 bytes, not starting with
a dot.

Reading a value back is off until `[secrets] allow_read = true` is in `$SHEP_HOME/shep.toml`.
`secret list` needs nothing: it names keys and the environments each has a value for, never a value.

Usage: shep secret [OPTIONS] <COMMAND>

Commands:
  set    Store a value
  get    Print a value back, if `[secrets] allow_read` is on
  unset  Remove a value
  list   List keys and the environments each has a value for
  help   Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep secret set DATABASE_URL --stdin
  $ shep secret set API_TOKEN --stdin --env staging
  $ shep secret list

Global flags: --format, --quiet, --style, --home. See shep help flags
shep secret set
shep secret set [OPTIONS] <KEY> [VALUE]

Store a value

The value is a positional argument by default, so it is visible in ps and in this shell's history for as long as the command runs. Pass --stdin to keep it out of both.

full --help output
$ shep secret set --help
Store a value

The value is a positional argument by default, so it is visible in `ps` and in this shell's history
for as long as the command runs. Pass `--stdin` to keep it out of both.

Usage: shep secret set [OPTIONS] <KEY> [VALUE]

Arguments:
  <KEY>
          The key

  [VALUE]
          The value; required unless --stdin is given

Options:
  -E, --env <ENV>
          Which environment; omit for every environment

  -s, --stdin
          Read the value from stdin; the positional form is visible in `ps` and in shell history

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep secret get
shep secret get [OPTIONS] <KEY>

Print a value back, if [secrets] allow_read is on

full --help output
$ shep secret get --help
Print a value back, if `[secrets] allow_read` is on

Usage: shep secret get [OPTIONS] <KEY>

Arguments:
  <KEY>
          The key

Options:
  -E, --env <ENV>
          Which environment; omit to use `[daemon] environment`'s default, which an app's own
          environment may override

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep secret unset
shep secret unset [OPTIONS] <KEY>

Remove a value

full --help output
$ shep secret unset --help
Remove a value

Usage: shep secret unset [OPTIONS] <KEY>

Arguments:
  <KEY>
          The key

Options:
  -E, --env <ENV>
          Which environment; omit for the every-environment slot

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep secret list
shep secret list [OPTIONS]

List keys and the environments each has a value for

full --help output
$ shep secret list --help
List keys and the environments each has a value for

Usage: shep secret list [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags

Other machines

shep host
shep host [OPTIONS] <COMMAND>

Keep the list of machines whose shepherds this CLI reaches.

The list is a top-level hosts = ["amp2", ...] array in $SHEP_HOME/shep.toml. Each entry is an ssh destination, so ~/.ssh/config aliases, users, ports and ProxyJump all apply. Reads and writes that file directly and never connects to a machine.

full --help output
$ shep host --help
Keep the list of machines whose shepherds this CLI reaches.

The list is a top-level `hosts = ["amp2", ...]` array in `$SHEP_HOME/shep.toml`. Each entry is an
ssh destination, so `~/.ssh/config` aliases, users, ports and ProxyJump all apply. Reads and writes
that file directly and never connects to a machine.

Usage: shep host [OPTIONS] <COMMAND>

Commands:
  add     Add a machine to the list
  remove  Remove a machine from the list
  list    List the machines, in the order `shep.toml` holds them
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep host add [email protected]
  $ shep host list
  $ shep host remove amp2

Global flags: --format, --quiet, --style, --home. See shep help flags
shep host add
shep host add [OPTIONS] <DESTINATION>

Add a machine to the list

A destination is what you would hand to ssh: a host name or an ~/.ssh/config alias, optionally with a user@ in front. Letters, digits, ., _ and - only, and neither part may start with -. Ports, jump hosts and IPv6 literals go in ~/.ssh/config, where Port and ProxyJump already apply.

The remote shep must be on the PATH that a non-interactive ssh session sees. Adding a host that is already listed changes nothing to the list.

add dials the host once, whether or not it was already listed, without prompts and giving up after 5 seconds, and warns on stderr if no shepherd answers. The entry stays and the exit is 0 either way.

full --help output
$ shep host add --help
Add a machine to the list

A destination is what you would hand to `ssh`: a host name or an `~/.ssh/config` alias, optionally
with a `user@` in front. Letters, digits, `.`, `_` and `-` only, and neither part may start with
`-`. Ports, jump hosts and IPv6 literals go in `~/.ssh/config`, where `Port` and `ProxyJump` already
apply.

The remote `shep` must be on the PATH that a non-interactive ssh session sees. Adding a host that is
already listed changes nothing to the list.

`add` dials the host once, whether or not it was already listed, without prompts and giving up after
5 seconds, and warns on stderr if no shepherd answers. The entry stays and the exit is 0 either way.

Usage: shep host add [OPTIONS] <DESTINATION>

Arguments:
  <DESTINATION>
          The ssh destination, such as `amp2` or `[email protected]`

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep host remove
shep host remove [OPTIONS] <DESTINATION>

Remove a machine from the list

The destination is compared as written. Exits 3 when it is not listed.

full --help output
$ shep host remove --help
Remove a machine from the list

The destination is compared as written. Exits 3 when it is not listed.

Usage: shep host remove [OPTIONS] <DESTINATION>

Arguments:
  <DESTINATION>
          The ssh destination, exactly as listed

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep host list
shep host list [OPTIONS]

List the machines, in the order shep.toml holds them

Reads shep.toml only and never connects to a machine.

full --help output
$ shep host list --help
List the machines, in the order `shep.toml` holds them

Reads `shep.toml` only and never connects to a machine.

Usage: shep host list [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags

Interfaces

shep lookoutdash
shep lookout [OPTIONS] [SHEEP] [TAB] [DOG]

Watch the flock on a live dashboard.

Reads the shepherd two ways at once: it subscribes to the event bus so the screen moves as things happen, and it re-lists the flock every two seconds so a dropped event cannot leave the screen quietly wrong.

If the shepherd stops answering, lookout re-dials a few times and then says so and stops updating. The values on screen stay exactly as they were, and it does not exit — you do.

Needs a terminal: with stdout redirected it refuses rather than writing escape sequences into a file.

full --help output
$ shep lookout --help
Watch the flock on a live dashboard.

Reads the shepherd two ways at once: it subscribes to the event bus so the screen moves as things
happen, and it re-lists the flock every two seconds so a dropped event cannot leave the screen
quietly wrong.

If the shepherd stops answering, lookout re-dials a few times and then says so and stops updating.
The values on screen stay exactly as they were, and it does not exit — you do.

Needs a terminal: with stdout redirected it refuses rather than writing escape sequences into a
file.

Usage: shep lookout [OPTIONS] [SHEEP] [TAB] [DOG]
       shep lookout <COMMAND>

Commands:
  catalogue  Open on the dog catalogue

Arguments:
  [SHEEP]
          Open on one sheep's own screen
          
          The name is the one `shep describe` takes. A fold, a fold selector or a `fold/app`
          selector is not one sheep and is not accepted here. With no tab, lookout opens that
          sheep's status page, the screen Enter opens from the dashboard.

  [TAB]
          Open that sheep's config pane on one tab
          
          The tabs are the ones the pane itself draws, in the order it draws them. With a tab,
          lookout opens the config pane `e` opens, already sitting on it.
          
          [possible values: process, logging, inputs, restart, readiness, shutdown, watch, cron,
          dogs]

  [DOG]
          Open one dog's table, on the dogs tab
          
          The dog is one this shepherd lists, or one the sheep already carries a table for. Refused
          unless the tab before it is `dogs`: a dog's table is that tab's own, and no other tab has
          one.

Options:
  -R, --read-only
          Close the dashboard's action gate. Actions are permitted by default.
          
          With the gate open, `x` (stop), `R` (restart) and `L` (reload) each arm a confirm instead
          of acting on the keypress that pressed it; Enter sends the request, any other key cancels,
          and an unanswered confirm expires after ten seconds. Closed, all three refuse outright.
          
          A guard against a keystroke in a window you were reading, not a security boundary: lookout
          runs as you, so anything it could do you can already do with `shep stop`. Can also be
          closed with `shep kv set lookout.allow_control false`.

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep lookout
  $ shep lookout api
  $ shep lookout api restart --read-only

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep lookout catalogue
shep lookout catalogue [OPTIONS]

Open on the dog catalogue.

The same screen the i key opens, reached the same way: lookout sends itself that keypress before it draws, so Esc leaves to the dashboard and every key the catalogue binds is the key it already binds. A sheep, tab or dog named catalogue is reached with --, the way a name beside any other subcommand is: shep lookout -- web dogs catalogue.

full --help output
$ shep lookout catalogue --help
Open on the dog catalogue.

The same screen the `i` key opens, reached the same way: lookout sends itself that keypress before
it draws, so `Esc` leaves to the dashboard and every key the catalogue binds is the key it already
binds. A sheep, tab or dog named `catalogue` is reached with `--`, the way a name beside any other
subcommand is: `shep lookout -- web dogs catalogue`.

Usage: shep lookout catalogue [OPTIONS]

Options:
  -R, --read-only
          Close the dashboard's action gate. Actions are permitted by default.
          
          The same gate `shep lookout --read-only` closes and the same one `shep kv set
          lookout.allow_control false` closes: `x` (stop), `R` (restart) and `L` (reload) each
          refuse outright with it closed.

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --host, --home. See shep help flags
shep whistle
shep whistle [OPTIONS]

Serve the MCP interface on stdin/stdout for an AI agent.

Speaks the Model Context Protocol over stdio: an agent host launches this process and talks JSON-RPC to it on the pipe. It writes nothing else to stdout, because stdout is the wire.

Five read-only tools are always offered. The four that act — start_sheep, stop_sheep, restart_sheep, reload_sheep — exist only when [whistle] allow_control = true in $SHEP_HOME/shep.toml.

That gate is a guard against an agent acting on its own reading of your flock, not a security boundary: whistle runs as you, so anything it could do you can already do with shep stop. There is deliberately no flag for it — legibility, not containment: a boolean in shep.toml has a diff and an mtime an operator can audit, and --home/SHEP_HOME already choose which shep.toml that is, so a flag would open nothing those don't already.

full --help output
$ shep whistle --help
Serve the MCP interface on stdin/stdout for an AI agent.

Speaks the Model Context Protocol over stdio: an agent host launches this process and talks JSON-RPC
to it on the pipe. It writes nothing else to stdout, because stdout is the wire.

Five read-only tools are always offered. The four that act — start_sheep, stop_sheep, restart_sheep,
reload_sheep — exist only when `[whistle] allow_control = true` in `$SHEP_HOME/shep.toml`.

That gate is a guard against an agent acting on its own reading of your flock, not a security
boundary: whistle runs as you, so anything it could do you can already do with `shep stop`. There is
deliberately no flag for it — legibility, not containment: a boolean in `shep.toml` has a diff and
an mtime an operator can audit, and `--home`/`SHEP_HOME` already choose which `shep.toml` that is,
so a flag would open nothing those don't already.

Usage: shep whistle [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep whistle

Global flags: --format, --quiet, --style, --home. See shep help flags

The shepherd itself

shep ping
shep ping [OPTIONS]

Check whether the shepherd answers

full --help output
$ shep ping --help
Check whether the shepherd answers

Usage: shep ping [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep ping

Global flags: --format, --quiet, --style, --home. See shep help flags
shep kill
shep kill [OPTIONS]

Shut the shepherd down

full --help output
$ shep kill --help
Shut the shepherd down

Usage: shep kill [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep kill

Global flags: --format, --quiet, --style, --home. See shep help flags
shep save
shep save [OPTIONS]

Write the muster roll now and say where it landed.

The shepherd already rewrites the roll after every change. This is for seeing it on disk before a reboot rather than trusting that it is.

full --help output
$ shep save --help
Write the muster roll now and say where it landed.

The shepherd already rewrites the roll after every change. This is for seeing it on disk before a
reboot rather than trusting that it is.

Usage: shep save [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep save

Global flags: --format, --quiet, --style, --home. See shep help flags
shep muster
shep muster [OPTIONS]

Assemble the flock from the muster roll

Starts the shepherd first if none is running.

full --help output
$ shep muster --help
Assemble the flock from the muster roll

Starts the shepherd first if none is running.

Usage: shep muster [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep muster

Global flags: --format, --quiet, --style, --host, --home. See shep help flags

Containers and dev sessions

shep runtime
shep runtime [OPTIONS] [TARGET]

Run one Flockfile's flock in the foreground

Boots a shepherd in this process and exits once nothing is left online. Meant for a container: no daemonization, no re-exec, no saved muster roll — --no-restore is always on, because a container starts from its Flockfile every time, never from a roll left on the image by a previous run.

Bleats stream to this process's own stdout/stderr while it runs, so docker logs is the flock's log without any extra plumbing. The shepherd is still reachable over its own socket the whole time — shep flock from a second terminal, or docker exec, works exactly as it would against a daemonized one.

Exits 0 once the flock has been empty and clean (every sheep stopped, none errored) for three consecutive two-second polls — a batch job finishing its work. Exits 11 (flock_empty) instead when the flock emptied with at least one sheep errored — a restart budget exhausted, or a spawn that never came up — so an orchestrator reading the exit status can tell "finished" from "died" and restart the container only for the second.

full --help output
$ shep runtime --help
Run one Flockfile's flock in the foreground

Boots a shepherd in this process and exits once nothing is left online. Meant for a container: no
daemonization, no re-exec, no saved muster roll — `--no-restore` is always on, because a container
starts from its Flockfile every time, never from a roll left on the image by a previous run.

Bleats stream to this process's own stdout/stderr while it runs, so `docker logs` is the flock's log
without any extra plumbing. The shepherd is still reachable over its own socket the whole time —
`shep flock` from a second terminal, or `docker exec`, works exactly as it would against a
daemonized one.

Exits 0 once the flock has been empty and clean (every sheep `stopped`, none `errored`) for three
consecutive two-second polls — a batch job finishing its work. Exits 11 (`flock_empty`) instead when
the flock emptied with at least one sheep `errored` — a restart budget exhausted, or a spawn that
never came up — so an orchestrator reading the exit status can tell "finished" from "died" and
restart the container only for the second.

Usage: shep runtime [OPTIONS] [TARGET]

Arguments:
  [TARGET]
          Flockfile to run (default: discovered in the current directory)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep runtime
  $ shep runtime Flockfile.toml

Global flags: --format, --quiet, --style, --home. See shep help flags
shep dev
shep dev [OPTIONS] [TARGET]

Run one Flockfile's flock in a throwaway session

The session is isolated: $SHEP_DEV_HOME (default ~/.shep-dev), forced watch = true on every app, and a full stop-and-delete teardown when it ends.

--home and $SHEP_HOME are ignored. Isolation is the whole feature: an operator who exports $SHEP_HOME for their real flock gets a stderr notice rather than a dev session that shares it and silently forces watch = true onto production apps.

Ends the moment the flock empties or this process is signalled — whichever comes first — and either way leaves nothing running and no shepherd behind. A shep dev that leaked a supervisor would stop being trusted.

full --help output
$ shep dev --help
Run one Flockfile's flock in a throwaway session

The session is isolated: `$SHEP_DEV_HOME` (default `~/.shep-dev`), forced `watch = true` on every
app, and a full stop-and-delete teardown when it ends.

**`--home` and `$SHEP_HOME` are ignored.** Isolation is the whole feature: an operator who exports
`$SHEP_HOME` for their real flock gets a stderr notice rather than a `dev` session that shares it
and silently forces `watch = true` onto production apps.

Ends the moment the flock empties or this process is signalled — whichever comes first — and either
way leaves nothing running and no shepherd behind. A `shep dev` that leaked a supervisor would stop
being trusted.

Usage: shep dev [OPTIONS] [TARGET]

Arguments:
  [TARGET]
          Script or Flockfile to run (default: discovered in this directory)

Options:
  -n, --name <NAME>
          Name for this sheep (script form only)

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep dev
  $ shep dev server.js --name api

Global flags: --format, --quiet, --style, --home. See shep help flags

Migrating and deploying

shep import
shep import [OPTIONS] <COMMAND>

Read somebody else's config into shep

Takes a pm2 dump, or a .env.

full --help output
$ shep import --help
Read somebody else's config into shep

Takes a pm2 dump, or a `.env`.

Usage: shep import [OPTIONS] <COMMAND>

Commands:
  pm2   Write a Flockfile from a pm2 dump. Starts nothing
  env   Read a `.env` into the secret store and one sheep's own env
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep import pm2 --dry-run
  $ shep import env .env --app api --secret DATABASE_URL

Global flags: --format, --quiet, --style, --home. See shep help flags
shep import pm2
shep import pm2 [OPTIONS]

Write a Flockfile from a pm2 dump. Starts nothing.

Reads --from, or ~/.pm2/dump.pm2 if it names nothing — whichever pm2 save last wrote. Every clustered app is named on stderr: shep binds nothing, so N instances on one port need the app to set SO_REUSEPORT itself, or the second instance hits EADDRINUSE at start. Every env key the dump carried that was neither declared nor recognizable session junk is named on stderr too, and left out of the Flockfile, for the operator to decide.

full --help output
$ shep import pm2 --help
Write a Flockfile from a pm2 dump. Starts nothing.

Reads `--from`, or `~/.pm2/dump.pm2` if it names nothing — whichever `pm2 save` last wrote. Every
clustered app is named on stderr: shep binds nothing, so N instances on one port need the app to set
`SO_REUSEPORT` itself, or the second instance hits EADDRINUSE at start. Every env key the dump
carried that was neither declared nor recognizable session junk is named on stderr too, and left out
of the Flockfile, for the operator to decide.

Usage: shep import pm2 [OPTIONS]

Options:
      --from <FROM>
          Read this pm2 dump instead of `~/.pm2/dump.pm2`

  -o, --out <OUT>
          Write the Flockfile here instead of `./Flockfile.toml`

  -d, --dry-run
          Print the Flockfile that would be written, and write nothing

      --force
          Overwrite an existing Flockfile

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep import env
shep import env [OPTIONS] --app <APP> <FILE>

Read a .env into the secret store and one sheep's own env.

Every key the file holds goes to the named sheep's env, where it reaches the app at its next spawn. A key named by --secret has its value stored in $SHEP_HOME/secrets.json instead, and the sheep's env gets {{secret:KEY}}, so the value never reaches flock.json or the handover blob.

A key that is not marked secret is stored in the clear, and is copied into both of those snapshots along with the rest of the sheep's config.

The sheep has to exist already: this records an operator override, which is per sheep. Run shep start first.

Any collision, any pattern that matches nothing, and any line the grammar does not accept refuses the whole import. A refusal reached before the secret store is written leaves both stores alone; one reached after counts the keys it left there, which nothing references until the import is re-run.

full --help output
$ shep import env --help
Read a `.env` into the secret store and one sheep's own env.

Every key the file holds goes to the named sheep's env, where it reaches the app at its next spawn.
A key named by `--secret` has its value stored in `$SHEP_HOME/secrets.json` instead, and the sheep's
env gets `{{secret:KEY}}`, so the value never reaches `flock.json` or the handover blob.

A key that is not marked secret is stored in the clear, and is copied into both of those snapshots
along with the rest of the sheep's config.

The sheep has to exist already: this records an operator override, which is per sheep. Run `shep
start` first.

Any collision, any pattern that matches nothing, and any line the grammar does not accept refuses
the whole import. A refusal reached before the secret store is written leaves both stores alone; one
reached after counts the keys it left there, which nothing references until the import is re-run.

Usage: shep import env [OPTIONS] --app <APP> <FILE>

Arguments:
  <FILE>
          The `.env` to read
          
          A `{{...}}` in a plain value reaches the app as the literal text the file wrote, not as a
          shep template reference.

Options:
      --app <APP>
          The sheep whose env these keys belong to

      --secret <SECRET>
          Store this key's value as a secret, and reference it from the env.
          
          An exact key, or a glob when it holds a metacharacter, the same rule a sheep-name selector
          takes. Repeatable. A pattern matching no key in the file refuses the import.

      --only <ONLY>
          Import only these keys; the default is all of them.
          
          Same grammar as `--secret`, and the same refusal.

  -E, --env <ENV>
          Which environment's slot the secrets go in.
          
          The default is the sheep's own environment, which is its `environment` field, or `[daemon]
          environment` when it has none, and so is never the `all` slot that every environment
          reads. Naming `all` here writes that slot, as `shep secret set --env all` does.

  -d, --dry-run
          Print what would be written, and write nothing

      --force
          Overwrite keys that already hold a different value

  -h, --help
          Print help (see a summary with '-h')

Global flags: --format, --quiet, --style, --home. See shep help flags
shep startup
shep startup [OPTIONS]

Install an init unit so the shepherd starts at boot.

Writes an init unit for the target user — a systemd unit (Type=notify), a launchd plist, an openrc script, or a FreeBSD or OpenBSD rc.d script, picked automatically for the running target or named explicitly with --init below. Every unit carries this binary's own path, that user's $SHEP_HOME, and the PATH of this invocation — which is what makes an interpreter installed under ~/.bun or ~/.cargo findable after a reboot.

The openrc and BSD scripts are rendered and pinned by exact-string tests; nobody on this project has run them on their own init system.

On Unix this needs root, and never asks for it: without it this prints the exact command to run and exits non-zero, so a script notices. Under sudo the unit is built for $SUDO_USER rather than root, so it supervises the flock the operator actually has.

Under sudo this also warns that PATH may have been replaced by sudo's own secure_path before shep ever saw it, and shows the exact PATH about to go into the unit so you can check it yourself.

If a shepherd already holds that $SHEP_HOME, the unit is enabled but not started, and a notice names the commands that hand the flock over.

full --help output
$ shep startup --help
Install an init unit so the shepherd starts at boot.

Writes an init unit for the target user — a systemd unit (`Type=notify`), a launchd plist, an openrc
script, or a FreeBSD or OpenBSD `rc.d` script, picked automatically for the running target or named
explicitly with `--init` below. Every unit carries this binary's own path, that user's $SHEP_HOME,
and the PATH of this invocation — which is what makes an interpreter installed under ~/.bun or
~/.cargo findable after a reboot.

The openrc and BSD scripts are rendered and pinned by exact-string tests; nobody on this project has
run them on their own init system.

On Unix this needs root, and never asks for it: without it this prints the exact command to run and
exits non-zero, so a script notices. Under sudo the unit is built for $SUDO_USER rather than root,
so it supervises the flock the operator actually has.

Under sudo this also warns that PATH may have been replaced by sudo's own secure_path before shep
ever saw it, and shows the exact PATH about to go into the unit so you can check it yourself.

If a shepherd already holds that $SHEP_HOME, the unit is enabled but not started, and a notice names
the commands that hand the flock over.

Usage: shep startup [OPTIONS]

Options:
  -u, --user <USER>
          The user the unit runs the shepherd as (default: $SUDO_USER, else the invoking user)

      --init <INIT>
          Write a unit for this init system instead of the detected one.
          
          `unstartup` takes it too: a unit installed under one init has to be removable after the
          host has changed to another.

          Possible values:
          - systemd:    Linux + systemd: a unit file, `Type=notify`
          - openrc:     Linux + openrc: an `openrc-run` script. No readiness protocol — see the
            renderer's own doc
          - launchd:    macOS: a `LaunchDaemon` plist
          - freebsd-rc: FreeBSD: an `/etc/rc.subr` script under `/usr/local/etc/rc.d`
          - openbsd-rc: OpenBSD: an `/etc/rc.d/rc.subr` script under `/etc/rc.d`

  -h, --help
          Print help (see a summary with '-h')

On Windows this registers a per-user Scheduled Task with a logon trigger instead: the flock comes
back at sign-in, not at boot. It runs as you, stores no password and needs no elevation. `--user`
naming anyone else, and `--init`, are refused there.

Examples:
  $ shep startup
  $ shep startup --init systemd --user deploy

Global flags: --format, --quiet, --style, --home. See shep help flags
shep unstartup
shep unstartup [OPTIONS]

Remove the unit startup installed

Disables and removes whichever one: systemd, openrc, launchd, or a BSD rc.d script. On Unix this needs root under the same rule: without it, prints the command to run and exits non-zero. A unit that is not there is reported absent rather than failing.

full --help output
$ shep unstartup --help
Remove the unit `startup` installed

Disables and removes whichever one: systemd, openrc, launchd, or a BSD `rc.d` script. On Unix this
needs root under the same rule: without it, prints the command to run and exits non-zero. A unit
that is not there is reported absent rather than failing.

Usage: shep unstartup [OPTIONS]

Options:
  -u, --user <USER>
          The user the unit runs the shepherd as (default: $SUDO_USER, else the invoking user)

      --init <INIT>
          Write a unit for this init system instead of the detected one.
          
          `unstartup` takes it too: a unit installed under one init has to be removable after the
          host has changed to another.

          Possible values:
          - systemd:    Linux + systemd: a unit file, `Type=notify`
          - openrc:     Linux + openrc: an `openrc-run` script. No readiness protocol — see the
            renderer's own doc
          - launchd:    macOS: a `LaunchDaemon` plist
          - freebsd-rc: FreeBSD: an `/etc/rc.subr` script under `/usr/local/etc/rc.d`
          - openbsd-rc: OpenBSD: an `/etc/rc.d/rc.subr` script under `/etc/rc.d`

  -h, --help
          Print help (see a summary with '-h')

On Windows this removes the logon task. A running shepherd keeps running; `shep kill` stops it.
`--user` naming anyone else, and `--init`, are refused there.

Examples:
  $ shep unstartup

Global flags: --format, --quiet, --style, --home. See shep help flags

Getting oriented

shep welcome
shep welcome [OPTIONS]

Print the welcome and the quick start

It shows the sheep, the quick start, and three dogs to install. The same text a fresh $SHEP_HOME prints once on its own. Here it is the command's output rather than a diagnostic, so it goes to stdout.

full --help output
$ shep welcome --help
Print the welcome and the quick start

It shows the sheep, the quick start, and three dogs to install. The same text a fresh `$SHEP_HOME`
prints once on its own. Here it is the command's output rather than a diagnostic, so it goes to
stdout.

Usage: shep welcome [OPTIONS]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep welcome

Global flags: --format, --quiet, --style, --home. See shep help flags
shep init
shep init [OPTIONS] [PATH]

Write a commented Flockfile to start from

full --help output
$ shep init --help
Write a commented Flockfile to start from

Usage: shep init [OPTIONS] [PATH]

Arguments:
  [PATH]
          Where to write it. The extension picks the format: toml, yaml, yml, json or json5.
          Defaults to Flockfile.toml in this directory

Options:
  -a, --all
          Show every option the grammar has, not just the common ones

      --force
          Overwrite the Flockfile that is already here, keeping its own format

  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep init
  $ shep init Flockfile.yaml
  $ shep init --all

Global flags: --format, --quiet, --style, --home. See shep help flags

Your shell and terminal

shep completions
shep completions [OPTIONS] <SHELL>

Print a shell completion script.

Static only: sheep names, fold names and other daemon-side identifiers are never completed.

full --help output
$ shep completions --help
Print a shell completion script.

Static only: sheep names, fold names and other daemon-side identifiers are never completed.

Usage: shep completions [OPTIONS] <SHELL>

Arguments:
  <SHELL>
          Shell to generate a completion script for
          
          [possible values: bash, elvish, fish, powershell, zsh]

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep completions zsh
  $ shep completions bash

Global flags: --format, --quiet, --style, --home. See shep help flags
shep style
shep style [OPTIONS] [LEVEL]

Show or set how much shep dresses up its output

full is sheep, boxes and colour; plain drops the sheep; bare is plain text. With no level, prints the one in force and where it came from.

full --help output
$ shep style --help
Show or set how much shep dresses up its output

`full` is sheep, boxes and colour; `plain` drops the sheep; `bare` is plain text. With no level,
prints the one in force and where it came from.

Usage: shep style [OPTIONS] [LEVEL]

Arguments:
  [LEVEL]
          `full`, `plain`, or `bare`
          
          Sets `shep.toml`'s `[style] level`. Omit to report the level currently in force instead of
          changing it.

          Possible values:
          - full:  Sheep, boxes and colour
          - plain: Boxes and colour, no sheep
          - bare:  Exactly what shep printed before any of this, and exactly what a pipe gets

Options:
  -h, --help
          Print help (see a summary with '-h')

Examples:
  $ shep style
  $ shep style plain

Global flags: --format, --quiet, --style, --home. See shep help flags