The WP-CLI commands of Leitvia Studio for work across many client sites: token sets, patterns, content models, audits, change packages and recipes, with the same checks as the admin.
For agencies and developers · Leitvia Studio · Checked with Leitvia Studio 1.3.65 and Leitvia Pro 0.8.55
How the commands work
WP-CLI is the command line of WordPress. The commands of Leitvia Studio start with wp leitvia.
- Add
--user. Most commands act as a WordPress user, for example--user=admin. Without it they stop with “This command acts as a user; run with –user=<agent or admin>.” before anything happens. The table below says which commands need it. - Every write runs through the same abilities as REST and MCP, with their checks, a snapshot and a change package.
- Lists take
--format=table|json|yaml. - A rejection exits with 1; with
--format=jsonit prints code, message and data.
Commands
| Command | Does | --user |
|---|---|---|
wp leitvia tokens list | Lists the token sets | No |
wp leitvia tokens export <id> | Prints a token set as JSON: { "title", "document" }, the document in DTCG format | Yes |
wp leitvia tokens import <file> | Creates a token set from such an export, with the contrast check | Yes |
wp leitvia tokens activate <id> [--base-hash=<hash>] | Activates a token set | Yes |
wp leitvia patterns list [--status=<status>] | Lists the patterns of the theme and Studio | No |
wp leitvia patterns export [<slug>…] | Prints patterns with markup, all without a slug | No |
wp leitvia patterns import <file> | Creates Lab patterns from a JSON list of title and content | Yes |
wp leitvia model get | Prints the content model | No |
wp leitvia model apply <file> [--dry-run] [--base-hash=<hash>] | Adds or replaces content model entries; --dry-run only checks | Yes, not for --dry-run |
wp leitvia audit [--after=<cursor>] [--limit=<n>] | Audits the published content page by page and sums the findings per check | Yes |
wp leitvia package list [--state=<state>] [--page=<n>] | Lists change packages, 100 per page | Yes |
wp leitvia package show|reject|rollback <id> | Shows, rejects or rolls back a change package | Yes |
wp leitvia package apply <id> [--ops=<ids>] | Applies the open steps, or only the listed ones | Yes |
wp leitvia package export <id> | Prints a package with the hashes of its targets and its media | Yes |
wp leitvia package import <file> | Imports a package as an open package; refuses when a target changed | Yes |
wp leitvia recipe list | Lists the recipes, with Pro also the kits, such as leitvia-pro/saas | No |
wp leitvia recipe apply <name> | Applies a recipe | Yes |
A hash is a fingerprint of the current state. With --base-hash a write is refused if someone changed the target in the meantime. --after and --limit page through a long audit; without them the audit runs to the end, 20 posts per step.
Examples for many sites
Copy a token set to every site of a multisite network:
wp --user=admin leitvia tokens export 12 > brand.json
wp site list --field=url | xargs -I{} sh -c \
'wp --url={} --user=admin leitvia tokens import brand.json'
The import creates the token set on each site; activate it there with tokens activate or in the admin. For releases with one site first, the network screen is easier.
Audit a list of client sites over SSH aliases and keep the results:
for site in @tidepost @larkspoon @kestrelgate; do
wp $site --user=admin leitvia audit --format=json > "audit-${site#@}.json"
done
Move a reviewed change from a stage to live as a file:
wp @stage --user=admin leitvia package export 34 > change.json
wp @live --user=admin leitvia package import change.json
wp @live --user=admin leitvia package apply 51
The import prints the number of the new package (here 51). Apply that one.
MCP over WP-CLI
With the plugin MCP Adapter active, an AI agent on the same machine can talk to the site over standard input and output, without HTTP. Its default server finds and runs the Leitvia abilities with the same checks; the MCP server leitvia of Studio itself runs over HTTP only.
wp mcp-adapter serve --server=mcp-adapter-default-server --user=admin
Read next: Developer guide, Stage to live and Network and releases.