API / Minn\Cli

Minn\Cli

The wp verbs the engine answers itself. 18 classes, 78 public methods and 65 internals. This page is the public surface; each class name opens the whole class.

AssetUpdate final class

public/minn/src/Minn/Cli/AssetUpdate.php · 329 lines · Open the class →

Shared wording for `wp plugin update` and `wp theme update`. Captured from the reference: missing plugins warn and count as failed; a missing theme is a fatal Error and stops. json/csv print only the rows (empty stdout when nothing changed). `--exclude` always prints the skipped line in table/summary, even when the list is empty.

CacheCommand final class

public/minn/src/Minn/Cli/CacheCommand.php · 15 lines · Open the class →

`wp cache flush`: the engine has no object cache, so this is a no-op success.

methodflush(array $args, array $assocArgs): void

Flushes the object cache.

The engine does not run an object cache. The verb still succeeds so fleet scripts that call it after a write do not abort.

Commands final class

public/minn/src/Minn/Cli/Commands.php · 100 lines · Open the class →

The verbs the engine answers to. Every one is registered for the before_wp_load phase, which WP-CLI runs before it looks for WordPress, and each replaces the bundled subcommand of the same name (a deferred addition lands after the bundle and overrides its leaf).

staticregister(): void

Registers every engine verb with WP-CLI in the phase it runs in.

insideleaf(), replace()

CoreCommand final class

public/minn/src/Minn/Cli/CoreCommand.php · 112 lines · Open the class →

WP-CLI's core verbs where a host's automation meets a Minn site. A Minn site has none of WordPress's core files, so a WordPress core update neither applies nor may pretend to: `core update` says the site is up to date (Minn reports the latest release it speaks) and refuses outright when asked for a version or a package, and `core download` is held back over a Minn install, since it would put WordPress's files over the engine. `core verify-checksums` checks the engine's own files against its signed release. Minn's own updater is `wp minn update`.

staticupdate(array $args, array $assocArgs): void

Says whether WordPress core is up to date; on Minn it always is, and an asked-for version or package is refused.

## OPTIONS

[<zip>] : A WordPress package; refused on Minn.

[--minor] : Only a minor release.

[--version=<version>] : A WordPress version; refused on Minn.

[--force] : Refused on Minn.

[--locale=<locale>] : Ignored.

[--insecure] : Ignored.

@param list<string> $args
@param array<string, string|bool> $assocArgs
staticverifyChecksums(array $args, array $assocArgs): void

Checks the install's files against its signed Minn release, in WP-CLI's own words for the result.

## OPTIONS

[--include-root] : Ignored; the webroot's shape files are always checked.

[--version=<version>] : Ignored; the running Minn's release is the one checked.

[--locale=<locale>] : Ignored.

[--insecure] : Ignored.

[--exclude=<files>] : Comma-separated paths to leave out of the result.

@param list<string> $args
@param array<string, string|bool> $assocArgs
staticguardDownload(): void

Holds back `core download` over a Minn install unless MINN_ALLOW_CORE_DOWNLOAD is set; `wp minn eject` is the way back to WordPress.

insideroot(), runsMinn()

CronCommand final class

public/minn/src/Minn/Cli/CronCommand.php · 277 lines · Open the class →

`wp cron`: the events, schedules, and spawn test a host and a fleet ask for. Every verb boots the full runtime first, so a plugin's schedules and callbacks are registered before an event is listed, scheduled, or run. The wording and exit codes are the reference's, captured from `wp cron` on the oracle; the two time columns drift second to second and are never pinned.

methodevent_list(array $args, array $assocArgs): void

Lists the scheduled cron events.

## OPTIONS

[--hook=<name>] [--field=<field>] [--fields=<fields>] [--format=<format>] [--<field>=<value>] [--due-now]

methodevent_run(array $args, array $assocArgs): void

Runs the next scheduled cron event for the given hook.

## OPTIONS

[<hook>...] [--due-now] [--all]

methodevent_schedule(array $args, array $assocArgs): void

Schedules a new cron event.

## OPTIONS

<hook> [<next-run>] [<recurrence>] [--<field>=<value>]

methodevent_delete(array $args, array $assocArgs): void

Deletes all cron events for the given hook.

## OPTIONS

<hook>...

methodevent_unschedule(array $args, array $assocArgs): void

Unschedules all cron events for a given hook.

## OPTIONS

<hook>

methodschedule_list(array $args, array $assocArgs): void

Lists available cron schedules.

## OPTIONS

[--field=<field>] [--fields=<fields>] [--format=<format>]

methodtest(array $args, array $assocArgs): void

Tests the WP Cron spawning system and reports the results.

insidescheduled(), eventArgs(), duration(), relative()

DirectorySearch final class

public/minn/src/Minn/Cli/DirectorySearch.php · 37 lines · Open the class →

Shared wording for `wp theme search` and `wp plugin search`. The default table is name/slug/rating; Success prints before the rows and only for table/yaml. json/csv/count print the Formatter output alone.

staticrun(string $kind, array $args, array $assocArgs): void

Searches the directory (through the Minn update service) for one kind of asset and prints the page.

@param array<string, mixed> $assocArgs

Installer final class

public/minn/src/Minn/Cli/Installer.php · 324 lines · Open the class →

The swap, both ways. Install parks WordPress's own files beside the webroot, lays the engine and its shape files down, and leaves wp-config.php and wp-content untouched; eject puts every parked file back and removes what install wrote. The install record at the webroot (.minn-install.php) is what eject works from. Preflight says what the site will and will not get before anything moves.

staticmain(array $argv, string $engineDir): int

The bin entry: runs one command against a webroot and returns the exit code.

@param list<string> $argv
methodpreflight(string $root): string

What the site will and will not get; the worst light decides install. The report lands in the output.

methodupdate(array $options): int

Replaces this engine with the latest release from the Minn update service; --check only says whether there is one.

methodstatus(string $root): int

Prints what the webroot is running.

methodinstall(string $root, array $options): int

Installs the engine into a webroot when the preflight allows it.

@param array<string, string|true> $options
methodeject(string $root): int

Puts WordPress back and removes the engine's files.

staticstate(string $root): string

What a webroot is running: minn, wordpress, or unknown.

staticrecord(string $root): array

The install record for a webroot: its owner, when, the engine version, the park, what moved, what was laid down. Empty when there is none, or when the one found names another webroot (a site that was moved or copied keeps a record its own eject must not act on).

@return array<string, mixed>
insidehelp(), inside(), move(), copyTree(), version(), say()

MaintenanceCommand final class

public/minn/src/Minn/Cli/MaintenanceCommand.php · 65 lines · Open the class →

`wp maintenance-mode`: the `.maintenance` marker in the webroot. The engine does not take the public site down while the file is present; fleet scripts still need the verb to succeed so an update can bookend itself with activate/deactivate.

methodactivate(array $args, array $assocArgs): void

Activates maintenance mode.

methoddeactivate(array $args, array $assocArgs): void

Deactivates maintenance mode.

methodstatus(array $args, array $assocArgs): void

Displays maintenance mode status.

methodis_active(array $args, array $assocArgs): void

Detects maintenance mode status. Exit 0 when active, 1 when not.

insidefile()

MinnCommand final class

public/minn/src/Minn/Cli/MinnCommand.php · 319 lines · Open the class →

Identifies the engine.

## EXAMPLES

wp minn version wp minn info wp minn probe

methodversion(array $args, array $assocArgs): void

Prints the engine version.

methodprobe(array $args, array $assocArgs): void

Prints the inventory CaptainCore gathers from inside WordPress: plugins, themes, must-use plugins, core version, home. One `key:value` line per field; JSON values have no newlines. Split on the first colon only.

methodinfo(array $args, array $assocArgs): void

Prints the engine's version and where it runs from.

methodcron(array $args, array $assocArgs): void

Runs the engine's scheduled work: due posts go live, expired rows are swept.

methodmail(array $args, array $assocArgs): void

Sends a test email through the site's mail settings.

## OPTIONS

<to> : The address to send to.

methodpreflight(array $args, array $assocArgs): void

Says what a WordPress webroot will and will not get from the engine.

## OPTIONS

[<webroot>] : The webroot to inspect. Defaults to the current directory.

methodinstall(array $args, array $assocArgs): void

Parks WordPress and installs the engine into a webroot.

## OPTIONS

[<webroot>] : The webroot. Defaults to the current directory.

[--park=<dir>] : Where WordPress's own files go. Defaults to wp-parked beside the webroot.

[--force] : Install even when preflight is RED.

methodupdate(array $args, array $assocArgs): void

Replaces this engine with the latest Minn release from the update service, checked against its signature.

## OPTIONS

[--check] : Only say whether a newer release is out.

methodeject(array $args, array $assocArgs): void

Removes the engine and puts WordPress's files back.

## OPTIONS

[<webroot>] : The webroot. Defaults to the current directory.

methodstatus(array $args, array $assocArgs): void

Says whether a webroot runs WordPress or the engine.

## OPTIONS

[<webroot>] : The webroot. Defaults to the current directory.

methodscripts(array $args, array $assocArgs): void

The site's script pack: the GPL `wp-*` JavaScript packages the engine does not reimplement, which a few plugin front ends need (the WooCommerce block cart and checkout). The engine never ships them; this installs them into the site's own wp-content, from the WordPress the swap parked beside the webroot, or from any WordPress tree named with --from.

## OPTIONS

[<action>] : status (the default), install, or remove.

[--from=<path>] : A WordPress tree to take the packages from. Defaults to the parked copy the install recorded.

methodrecovery(array $args, array $assocArgs): void

The extensions recovery paused after they killed a request, and the way back. A plugin or theme that fatals is paused so the next request answers without it; nothing loads it again until it is resumed here.

## OPTIONS

[<action>] : status (the default), resume, or resume-all.

[<name>] : For resume: the plugin file or theme slug to let back in.

[--theme] : Treat the name as a theme rather than a plugin.

insideinstaller(), parkedTree(), engineVersion()

OptionCommand final class

public/minn/src/Minn/Cli/OptionCommand.php · 185 lines · Open the class →

Options, read and written straight to the options table. Serialized values are decoded by the engine's own reader, and arrays written back in the stored form.

methodget(array $args, array $assocArgs): void

Gets the value for an option.

## OPTIONS

<key> : Key for the option.

[--format=<format>] : Get value in a particular format. --- default: var_export options: - var_export - json - yaml ---

methodadd(array $args, array $assocArgs): void

Adds a new option value.

## OPTIONS

<key> : The name of the option to add.

[<value>] : The value of the option to add. If omitted, the value is read from STDIN.

[--format=<format>] : The serialization format for the value. --- default: plaintext options: - plaintext - json ---

[--autoload=<autoload>] : Should this option be automatically loaded. --- options: - 'on' - 'off' ---

methodupdate(array $args, array $assocArgs): void

Updates an option value.

## OPTIONS

<key> : The name of the option to update.

[<value>] : The new value. If omitted, the value is read from STDIN.

[--autoload=<autoload>] : Requires WP 4.2. Should this option be automatically loaded. --- options: - 'on' - 'off' ---

[--format=<format>] : The serialization format for the value. --- default: plaintext options: - plaintext - json ---

methoddelete(array $args, array $assocArgs): void

Deletes an option.

## OPTIONS

<key>... : Key for the option.

insidereadValue(), decode(), encode()

PackageInstaller final readonly class

public/minn/src/Minn/Cli/PackageInstaller.php · 142 lines · Open the class →

Puts a theme or a plugin on disk for `wp theme install` and `wp plugin install`: a directory slug, a local zip, or a zip URL, saying along the way what WP-CLI says. The two kinds differ only in their words, in where they live, and in a plugin being allowed to be a single file.

staticthemes(Minn\Ops\Packages $packages): self

The installer `wp theme install` uses.

staticplugins(Minn\Ops\Packages $packages): self

The installer `wp plugin install` uses.

methodinstall(string $source, bool $force, string $version): array

One source onto disk: the folder when it is there afterwards (put there now, or already there), null when it could not be installed, and whether this call put it there.

@return array{0: ?string, 1: bool}
insidefromDirectory(), archive(), present(), refuse()

PluginCommand final class

public/minn/src/Minn/Cli/PluginCommand.php · 406 lines · Open the class →

`wp plugin list|install|update|activate|deactivate|delete`: the inventory and the fleet's install/update/delete.

methodlist(array $args, array $assocArgs): void

Lists installed plugins, must-use plugins, and drop-ins.

## OPTIONS

[--status=<status>] : Filter to one status: active, inactive, must-use, or dropin.

[--field=<field>] : Prints the value of a single field for each plugin.

[--fields=<fields>] : Limit the output to specific object fields.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - count - yaml ---

methodactivate(array $args, array $assocArgs): void

Activates one or more plugins: a WordPress plugin joins active_plugins (its stored state; the engine runs none of its code), a Minn extension joins the engine's own list.

## OPTIONS

<plugin>... : One or more plugins to activate.

methoddeactivate(array $args, array $assocArgs): void

Deactivates one or more plugins.

## OPTIONS

<plugin>... : One or more plugins to deactivate.

methodinstall(array $args, array $assocArgs): void

Installs one or more plugins from the plugin directory, a zip, or a URL.

## OPTIONS

<plugin|zip|url>... : A plugin slug, a local zip path, or a zip URL.

[--version=<version>] : Install that version from the directory instead of the current one.

[--force] : Overwrite an installed copy of the same folder.

[--activate] : Activate the plugin after it is installed (or if it is already on disk).

methodupdate(array $args, array $assocArgs): void

Updates one or more plugins from the plugin directory.

## OPTIONS

[<plugin>...] : One or more plugins to update.

[--all] : If set, all plugins that have updates will be updated.

[--exclude=<name>] : Comma separated list of plugin names that should be excluded from updating.

[--minor] : Only perform updates for minor releases.

[--patch] : Only perform updates for patch releases.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - summary ---

[--version=<version>] : If set, the plugin will be updated to the specified version.

[--dry-run] : Preview which plugins would be updated.

methoddelete(array $args, array $assocArgs): void

Deletes plugin files without deactivating.

## OPTIONS

[<plugin>...] : One or more plugin folders to delete.

methodis_installed(array $args, array $assocArgs): void

Checks if a given plugin is installed. Exit 0 when it is, 1 when not.

## OPTIONS

<plugin> : The plugin folder to check.

methodis_active(array $args, array $assocArgs): void

Checks if a given plugin is active. Exit 0 when it is, 1 when not.

## OPTIONS

<plugin> : The plugin folder to check.

[--network] : Ignored on a single site.

methodsearch(array $args, array $assocArgs): void

Searches the plugin directory.

## OPTIONS

<search> : The string to search for.

[--page=<page>] : Optional page to display. --- default: 1 ---

[--per-page=<per-page>] : Optional number of results to display. --- default: 10 ---

[--field=<field>] : Prints the value of a single field for each plugin.

[--fields=<fields>] : Limit the output to specific object fields. Defaults to name,slug,rating.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - count - yaml ---

insideswitch(), pinVersion(), activateFolder(), plain()

Preflight final class

public/minn/src/Minn/Cli/Preflight.php · 417 lines · Open the class →

What a site will and will not get from the engine, before anything moves: the config it can read, the database it can reach, the theme's kind, the plugins the extensions cover, and the content survey (the shortcodes, third-party blocks, menus, extra tables, and extra post types in the database). Every finding is a light; the worst decides.

new__construct(string $engineDir = '')
methodlines(): array

The report, one line per finding. @return list<string>

@return list<string>
methodrun(string $root): string

Runs every check and returns the worst light: GREEN, AMBER, or RED.

staticthemeKind(string $dir, string $parentDir): string

Same line Theme::active / ClassicTheme::active draw: a block template index (child or parent) is a block theme; otherwise a parent index.php is a classic theme.

insidereadConfig(), env(), optionReader(), preflightTheme(), preflightPlugins(), preflightPlugin(), some(), surveyContent(), surveyMarkup(), surveyMenus(), surveyTables(), surveyTypes(), light(), say()

RewriteCommand final class

public/minn/src/Minn/Cli/RewriteCommand.php · 52 lines · Open the class →

`wp rewrite flush|structure`: permalink_structure is the engine's resolver input; there is no .htaccess rewrite file to regenerate.

methodflush(array $args, array $assocArgs): void

Flushes rewrite rules. The engine resolves URLs from options, so this is a success no-op the way `cache flush` is.

## OPTIONS

[--hard] : Ignored: the engine does not write .htaccess.

methodstructure(array $args, array $assocArgs): void

Updates the permalink structure.

## OPTIONS

<permastruct> : The new permalink structure, stored as permalink_structure.

[--category-base=<base>] : Stored as category_base.

[--tag-base=<base>] : Stored as tag_base.

[--hard] : Ignored: the engine does not write .htaccess.

Runtime final class

public/minn/src/Minn/Cli/Runtime.php · 80 lines · Open the class →

The engine, booted for a command: reads the site's wp-config.php (which ends in wp-settings.php, whose engine boot stops short of serving under WP-CLI) so the database constants and table prefix are known.

propreadonly Minn\Db $db
propreadonly Minn\Content\Site $site
propreadonly Minn\Content\Users $users
propreadonly Minn\Auth\Capabilities $capabilities
propreadonly Minn\Front\Permalinks $permalinks
staticboot(): self

The engine's runtime for a CLI process, booted once.

staticbootEngine(): Minn\Runtime\Runtime

The full WordPress runtime for a command, booted once: the facade is defined, the site's plugins load as code, and the lifecycle actions fire, so a verb can fire a scheduled hook whose callback a plugin registered. The lighter boot() does none of this; only a command that needs the runtime (cron) asks for this, since it loads every plugin.

staticstandIn(): void

The runtime for a command WP-CLI loads WordPress for: WP-CLI has already run wp-config.php, so the engine boots from the constants it defined, loads the site's plugins as code (their commands register as they load), and hands control back for WP-CLI to run the command.

insideloadConfig()

SearchReplaceCommand final class

public/minn/src/Minn/Cli/SearchReplaceCommand.php · 143 lines · Open the class →

`wp search-replace`: walks every string column, including serialized PHP arrays, and reports replacements the way the reference does.

method__invoke(array $args, array $assocArgs): void

Searches/replaces strings in the database.

## OPTIONS

<old> : A string to search for.

<new> : Replace instances of the first string with this new string.

[<table>...] : Restrict the replacement to these tables.

[--dry-run] : Report without writing.

[--all-tables] : Search every table in the database, not only those with the site prefix.

[--report-changed-only] : Only print tables/columns that changed.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - json ---

insidelistTables(), stringColumns(), replaceColumn()

ThemeCommand final class

public/minn/src/Minn/Cli/ThemeCommand.php · 332 lines · Open the class →

`wp theme list|install|update|activate|delete`: the inventory CaptainCore reads, and the install/update the fleet's `wp theme` verbs run.

methodlist(array $args, array $assocArgs): void

Lists installed themes.

## OPTIONS

[--status=<status>] : Filter to one status: active, inactive, or parent.

[--field=<field>] : Prints the value of a single field for each theme.

[--fields=<fields>] : Limit the output to specific object fields.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - count - yaml ---

methodinstall(array $args, array $assocArgs): void

Installs one or more themes from the theme directory, a zip, or a URL.

## OPTIONS

<theme|zip|url>... : A theme slug, a local zip path, or a zip URL.

[--version=<version>] : Install that version from the directory instead of the current one.

[--force] : Overwrite an installed copy of the same folder.

[--activate] : Activate the theme after it is installed (or if it is already on disk).

methodupdate(array $args, array $assocArgs): void

Updates one or more themes from the theme directory.

## OPTIONS

[<theme>...] : One or more themes to update.

[--all] : If set, all themes that have updates will be updated.

[--exclude=<theme-names>] : Comma separated list of theme names that should be excluded from updating.

[--minor] : Only perform updates for minor releases.

[--patch] : Only perform updates for patch releases.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - summary ---

[--version=<version>] : If set, the theme will be updated to the specified version.

[--dry-run] : Preview which themes would be updated.

methodactivate(array $args, array $assocArgs): void

Activates a theme.

## OPTIONS

<theme> : The theme folder to activate.

methoddelete(array $args, array $assocArgs): void

Deletes one or more themes from disk.

## OPTIONS

[<theme>...] : One or more theme folders to delete.

[--force] : Allow deleting the active theme.

methodis_installed(array $args, array $assocArgs): void

Checks if a given theme is installed. Exit 0 when it is, 1 when not.

## OPTIONS

<theme> : The theme folder to check.

methodis_active(array $args, array $assocArgs): void

Checks if a given theme is active. Exit 0 when it is, 1 when not.

## OPTIONS

<theme> : The theme folder to check.

methodsearch(array $args, array $assocArgs): void

Searches the theme directory.

## OPTIONS

<search> : The string to search for.

[--page=<page>] : Optional page to display. --- default: 1 ---

[--per-page=<per-page>] : Optional number of results to display. Defaults to 10.

[--field=<field>] : Prints the value of a single field for each theme.

[--fields=<fields>] : Limit the output to specific object fields. Defaults to name,slug,rating.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - count - yaml ---

insidepinVersion(), switchTo()

UserCommand final class

public/minn/src/Minn/Cli/UserCommand.php · 367 lines · Open the class →

Users: the list and get views, and the one-time login link.

methodlist(array $args, array $assocArgs): void

Lists users.

## OPTIONS

[--role=<role>] : Only display users with a certain role.

[--field=<field>] : Prints the value of a single field for each user.

[--fields=<fields>] : Limit the output to specific object fields.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - ids - json - count - yaml ---

methodget(array $args, array $assocArgs): void

Gets details about a user.

## OPTIONS

<user> : User ID, user email, or user login.

[--field=<field>] : Instead of returning the whole user, returns the value of a single field.

[--fields=<fields>] : Get a specific subset of the user's fields.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - json - yaml ---

methodlogin(array $args, array $assocArgs): void

Prints a one-time login link for a user.

The link signs the user in at wp-login.php once, within fifteen minutes, and then expires (the contract of the captaincore helper).

## OPTIONS

<user> : User ID, user email, or user login.

methodcreate(array $args, array $assocArgs): void

Creates a new user.

## OPTIONS

<user-login> : The login of the user to create.

<user-email> : The email address of the user to create.

[--role=<role>] : The role of the user to create. Default: the site's default role.

[--user_pass=<password>] : The user password. Default: randomly generated.

[--display_name=<name>] : The display name.

[--user_nicename=<nice_name>] : A URL-friendly name. Default: the login.

[--user_url=<url>] : The user's URL.

[--nickname=<nickname>] : The nickname. Default: the login.

[--first_name=<first_name>] : The first name.

[--last_name=<last_name>] : The last name.

[--description=<description>] : A description.

[--send-email] : Send the new user a password-reset email.

[--porcelain] : Output just the new user id.

methodupdate(array $args, array $assocArgs): void

Updates an existing user.

## OPTIONS

<user> : User ID, email, or login.

[--user_pass=<password>] : A new password.

[--user_email=<email>] : A new email.

[--display_name=<name>] : A new display name.

[--first_name=<first_name>] : A new first name.

[--last_name=<last_name>] : A new last name.

[--role=<role>] : A new role.

methoddelete(array $args, array $assocArgs): void

Deletes a user.

## OPTIONS

<user> : User ID, email, or login.

[--reassign=<id>] : User ID to reassign posts to.

[--yes] : Answer yes to the confirmation.

insiderandomPassword(), find(), item()