Skip to content

cwp agent

shipped 2.0.0
cwp agent [flags]

cwp agent groups the commands below and takes no action of its own; run it alone and it prints its help.

FlagWhat it doesDefault
--with-agentwith —dry-run on a host with no shell: install and remove the PHP agent so the plan is realoff
SubcommandWhat it does
cwp agent installLeave an agent on an environment until it is removed
cwp agent removeTake the resident agent off an environment

What it does

Shared hosting gives an account that moves files and runs nothing. The only thing that executes PHP there is the web server, so cwp uploads one PHP file into the docroot, calls it over HTTPS and removes it when the run ends. That file is the agent, and providers describes the capability behind it.

You do not normally run these commands. Every command that needs WordPress on such a host installs an agent, uses it and takes it away, however the run ends. Two cases want one that stays:

  • A slow link. The upload and the removal are two transfers per command, and on a slow account that is most of what a command costs.
  • An environment in mode: source. cwp refuses to write to one at all, so it refuses to install an agent there. Its owner may still put the file in place, and cwp agent install from a checkout that owns the site is how cwp learns where it is.

The agent expires. Past its expiry it answers 404 to everything and deletes itself on the first request, so a run that crashed leaves nothing that works.

What it does not do

It does not give the host a shell. There is nothing to attach to and no WP-CLI to pass through to, so cwp shell, cwp logs and cwp wp still refuse. Everything cwp wraps keeps working.

It does not store anything in the project. The record of where the agent is and what signs a request to it lives in ~/.config/cwp/agents.yml on this machine, readable by you alone.