wp_init_config
Detect your WordPress environment and write a wp-cli configuration file. First call probes Docker, Pantheon, or SSH; second call writes config with user-supplied missing values.
Instructions
Create the server's configuration file (/.serena/wp-cli.conf) for a WordPress project. Call it FIRST when no config exists yet. Two phases: (1) DETECT — call with no arguments (write=false); it probes the environment (running Docker containers, the WordPress path inside them, and any authenticated Pantheon Terminus site) and returns what it found plus a missing list of values it could NOT determine. Ask the user for those, then (2) WRITE — call again with write=true and a complete site object to save the config. It refuses to overwrite an existing config unless overwrite=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | Required when write=true. Fields: name (section id), LOCAL_CONTAINER (docker container with WP-CLI), LOCAL_PATH (WordPress path inside it). Optional: LOCAL_WORKDIR, LOCAL_URL, and for production EITHER TERMINUS_SITE(+TERMINUS_ENV) OR REMOTE_SSH (not both; omit both for local-only). | |
| write | No | false (default) = detect and report; true = write the config from `site`. | |
| overwrite | No | Allow replacing an existing wp-cli.conf. Default false. | |
| prod_guard | No | Block destructive/production writes without confirm=true. Default true. | |
| default_site | No | DEFAULT_SITE value; defaults to the site name. |