CLI reference
The full surface of the warden command, grouped by subject.
What this is
A reference index for warden, the single binary that ships with
purge-warden. It covers every top-level subcommand, the flags each
accepts, and the exit codes a script can rely on. Per-entity verbs
(warden device …, warden blocklist …, warden profile …) are
documented inline in their own configure pages; this page collects the
global and config-tree verbs that don’t fit a single entity.
The shape is intentional. Warden does not expose a generic
config get <key> / config set <key> <value> grammar. The supported
ways to mutate state are:
warden config editfor fields under[server]and[upstream]— the master TOML, opened in$EDITOR, validated at save.- Per-entity CRUD verbs for everything else (
warden device add,warden blocklist set,warden profile remove,warden subnet add,warden local-dns add,warden schedule add,warden category …). Each of these triggers an automatic hot-reload of the running daemon. warden config restore <archive>for restoring a known-good config tree as a single operation.
Conventions
- Privilege. Anything that mutates the on-disk config requires write
access to the master TOML. On a default install (
/etc/purge-warden/) that meanssudo. Read-only verbs (show,list,lint,diff) do not. - Discovery. With no
--configflag, Warden resolves the master in this order:./config.toml→$XDG_CONFIG_HOME/purge-warden/config.toml→/etc/purge-warden/config.toml→/var/lib/purge-warden/config.toml(legacy). Source:src/cli/config_discovery.rs:49-65. - Atomicity. Every write goes through
atomic_write_and_validate: temp file in the same directory, validation, then a POSIX rename. The live file is untouched on failure. Source:src/config/atomic_write.rs. - Hot reload. Per-entity CRUD verbs reload the daemon automatically
via authenticated IPC.
warden config editdoes not — you reload deliberately withwarden reload. - Output. Most read verbs print to stdout in their natural format
(TOML for
config show, plaintext tables fordevice list). The--jsonflag is supported on a subset of read verbs (status,device list,stats *,logs --format json) but not on anywarden configsubcommand.
warden config
The whole config-tree surface lives under warden config. There are
seven verbs and only seven — set and get do not exist.
Source: src/cli/mod.rs:322-364, src/main.rs:189-227.
| Command | Purpose |
|---|---|
warden config show | Print the on-disk or effective config. |
warden config edit | Open the master in $EDITOR; validate at save. |
warden config lint | Validate without modifying. |
warden config validate | Alias for lint (kept for backwards compatibility). |
warden config diff | Compare two configs. |
warden config backup | Snapshot the config tree to tar.gz. |
warden config restore | Replace the live tree from an archive, then SIGHUP. |
warden config show
warden config show [--resolved] [--annotate] [--section <name>]
Prints the master TOML to stdout.
| Flag | Default | Effect |
|---|---|---|
--resolved | off | Print the effective config after include resolution and default fill-in. |
--annotate | off | Annotate each value with its source file and line. |
--section <name> | full file | Print only the named top-level section (e.g. server, upstream). |
Output is always TOML; there is no --json. To machine-parse, pipe
through tomlq, taplo, or yq -p toml. Source:
src/cli/commands/config/show.rs.
warden config edit
warden config edit
No flags. Opens the master in $EDITOR (or $VISUAL, falling back to
vi). On editor exit, the handler runs the full v1 validator
(loader::load_config); if validation fails, the live file is unchanged
and the error is printed with file:line.
Does not auto-reload. Run warden reload afterwards to apply.
Source: src/cli/commands/config/edit.rs.
warden config lint
warden config lint
warden config validate # alias
Validates the on-disk config without changing anything.
| Exit | Meaning |
|---|---|
0 | Clean. |
1 | Validation errors. Each is printed with file:line. |
2 | Reserved for warnings (currently same surface as 0). |
Source: src/cli/commands/config/lint.rs.
warden config diff
warden config diff <other>
Compares the live master against <other>. The argument may be a
file path, an extracted backup directory, or any TOML readable by the
v1 loader.
| Exit | Meaning |
|---|---|
0 | Identical. |
1 | Differences printed. |
2 | One side failed to load (typo, wrong schema, unreachable file). |
Source: src/cli/commands/config/diff.rs.
warden config backup
warden config backup [--out <dir>]
Writes a tar.gz archive of the config tree (master + every existing
*.d/ sibling) to <config-parent>/backups/config-<UTC-timestamp>.tar.gz.
With --out <dir>, writes to <dir>/config-<UTC-timestamp>.tar.gz
instead. The directory must exist.
The filename always uses YYYYMMDDTHHMMSSZ; only the parent directory
is configurable. No --json, no encryption, no manifest.
For the included/excluded contents and a deeper walkthrough, see backup & restore.
Source: src/cli/commands/config/backup.rs.
warden config restore
warden config restore <archive>
Validates <archive> against the v1 loader, then atomically replaces
the live master, recursively replaces every *.d/ sibling that the
archive contains, and signals the daemon with SIGHUP if a PID file is
present.
| Exit | Meaning |
|---|---|
0 | Restored successfully. SIGHUP delivered if applicable. |
1 | Validation failed. Live tree unchanged. |
2 | I/O error: archive missing, malformed, or write-failed. |
The pre-restore master is preserved as <live>.pre-restore-<UTC-timestamp>
as a rollback path (master only — .d/ siblings are replaced, not
backed up).
For semantics and recovery flows, see backup & restore.
Source: src/cli/commands/config/restore.rs.
warden reload
warden reload
Sends the daemon an authenticated IPC reload command. Use after
warden config edit to apply the new master without a restart. Per-entity
CRUD verbs already do this automatically — calling warden reload after
them is a no-op but harmless.
Source: src/cli/commands/ipc_reload.rs.
See also
- Backup & restore — operational guide for the two
configverbs. - Server globals — what to put in the master TOML and how to edit it.
- TOML reference — every field that the validator enforces.
- File paths — where Warden reads and writes on disk.
- Environment variables —
$EDITOR,$XDG_CONFIG_HOME, and friends.