### CLI Installation and Quick Start Source: https://context7.com/automattic/studio/llms.txt Instructions on how to install and use the `wp-studio` CLI, including creating new sites interactively and non-interactively. ```APIDOC ## CLI Installation and Quick Start ### Description Installs and provides examples for using the `wp-studio` CLI, including creating new sites. ### Usage ```bash # Run without installing npx wp-studio@latest --help # Install globally npm install -g wp-studio studio --help # Create a new site (interactive wizard) studio site create # Create a site non-interactively studio site create \ --name "My Coffee Shop" \ --path ~/Studio/my-coffee-shop \ --wp latest \ --php 8.4 \ --admin-username admin \ --skip-browser ``` ### Expected output: ``` ✔ Site created at ~/Studio/my-coffee-shop URL: http://localhost:8881 Admin: http://localhost:8881/wp-admin (admin / ) ``` ``` -------------------------------- ### Install and Run wp-studio CLI Source: https://context7.com/automattic/studio/llms.txt Demonstrates how to run the wp-studio CLI without installation using npx, or install it globally for direct use. Includes a quick start for creating a new site interactively or non-interactively. ```bash # Run without installing npx wp-studio@latest --help ``` ```bash # Install globally npm install -g wp-studio studio --help ``` ```bash # Create a new site (interactive wizard) studio site create ``` ```bash # Create a site non-interactively studio site create \ --name "My Coffee Shop" \ --path ~/Studio/my-coffee-shop \ --wp latest \ --php 8.4 \ --admin-username admin \ --skip-browser ``` ```bash # Expected output: # ✔ Site created at ~/Studio/my-coffee-shop # URL: http://localhost:8881 # Admin: http://localhost:8881/wp-admin (admin / ) ``` -------------------------------- ### Install and Run Benchmark Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Navigate to the benchmark tool directory, install dependencies, and run the benchmark. ```bash cd tools/benchmark-site-editor npm install npm run benchmark ``` -------------------------------- ### Benchmark Example: Multiple Custom Sites Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Benchmark two custom sites, one bare and one with plugins installed, using specific environment names. ```bash npm run benchmark -- \ --custom=local-bare,http://localhost:10003 \ --custom=local-plugins,http://localhost:10004 \ --install-plugins=local-plugins ``` -------------------------------- ### Install and Activate Plugin with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Install and activate a plugin using the Studio CLI. This is the recommended method for adding plugins. ```bash studio wp plugin install X --activate ``` -------------------------------- ### Install Project Dependencies with Homebrew Source: https://github.com/automattic/studio/blob/trunk/docs/code-contributions.md Use this command to install Python and setuptools if you manage packages with Homebrew. ```bash brew install python3 python-setuptools ``` -------------------------------- ### Install WordPress Studio CLI Globally Source: https://github.com/automattic/studio/blob/trunk/apps/cli/README.md Installs the Studio CLI globally using npm. After installation, you can use the `studio` command directly. ```bash npm install -g wp-studio studio --help ``` -------------------------------- ### Benchmark Example: Quick Test Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Run a quick test comparing Studio bare vs Studio with plugins. ```bash npm run benchmark -- --only=studio,studio-plugins ``` -------------------------------- ### Build Installers Source: https://github.com/automattic/studio/blob/trunk/docs/code-contributions.md Install dependencies and build application installers for various platforms. Executables are placed in the 'out/' directory. ```bash npm install ``` ```bash npm run make ``` -------------------------------- ### Install and Activate WooCommerce Source: https://context7.com/automattic/studio/llms.txt Installs and activates the WooCommerce plugin on a specified Studio site. ```bash studio wp --path ~/Studio/my-site plugin install woocommerce --activate ``` -------------------------------- ### Start New UI Development Server Source: https://github.com/automattic/studio/blob/trunk/apps/ui/README.md Run this command to start the full Electron app with the new UI as the renderer. This is the primary command for local development. ```bash npm run start:new ``` -------------------------------- ### Start and Stop Studio CLI Managed Sites Source: https://github.com/automattic/studio/blob/trunk/skills/studio-cli/SKILL.md Commands to start or stop local WordPress sites. The start command can optionally open the site in a browser. ```bash studio site start --path ~/Studio/my-site # Start and open browser ``` ```bash studio site start --path ~/Studio/my-site --skip-browser # Start without opening browser ``` ```bash studio site start --path ~/Studio/my-site --skip-log-details # Start without printing credentials ``` ```bash studio site stop --path ~/Studio/my-site # Stop current site ``` ```bash studio site stop --all # Stop all sites ``` -------------------------------- ### Benchmark Example: Studio vs Custom Site Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Compare the performance of the Studio environment against a custom WordPress site over 3 rounds. ```bash npm run benchmark -- --only=studio,my-site --custom=my-site,http://localhost:10003 --rounds=3 ``` -------------------------------- ### Start and Stop WordPress Sites Source: https://context7.com/automattic/studio/llms.txt Commands to start or stop a site's local PHP WASM server. Starting a site boots WordPress quickly. Options include opening the browser automatically or skipping it. ```bash # Start and open browser studio site start --path ~/Studio/my-coffee-shop ``` ```bash # Start without opening browser (useful in CI or scripting) studio site start --path ~/Studio/my-coffee-shop --skip-browser ``` ```bash # Stop a specific site studio site stop --path ~/Studio/my-coffee-shop ``` ```bash # Stop all running sites studio site stop --all ``` -------------------------------- ### Benchmark Example: Single Environment Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Benchmark a single specific environment, 'studio-mw-plugins', for 5 rounds. ```bash npm run benchmark -- --only=studio-mw-plugins --rounds=5 ``` -------------------------------- ### Build Studio from Source on Linux Source: https://github.com/automattic/studio/blob/trunk/docs/code-contributions.md Use these commands to install dependencies and package the Studio application on Linux. The executable will be generated in `apps/studio/out/Studio-linux-x64/studio`. ```bash npm install npm run package ``` -------------------------------- ### Install and Activate Plugin with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Use this command to install a WordPress plugin and activate it in one step. Ensure the `studio` command is available in your terminal. ```bash studio wp plugin install woocommerce --activate ``` -------------------------------- ### Benchmark Example: Custom Site with Credentials Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Benchmark a custom site requiring specific username and password credentials. ```bash npm run benchmark -- --custom=my-site,http://localhost:10003,admin,secret ``` -------------------------------- ### Start MCP Server for External AI Assistants Source: https://context7.com/automattic/studio/llms.txt Starts an MCP (Model Context Protocol) stdio server that exposes all Studio tools to external AI assistants. This allows MCP-compatible assistants to manage local WordPress sites. ```bash # Start the MCP server (used by external assistants — not called directly) studio mcp ``` -------------------------------- ### Launch Studio Code AI Agent Source: https://github.com/automattic/studio/blob/trunk/apps/cli/README.md Starts the Studio Code AI agent, which assists in building and optimizing WordPress sites. It can autonomously perform tasks like theme creation and plugin installation. ```bash studio code ``` -------------------------------- ### Start Studio Desktop App Source: https://github.com/automattic/studio/blob/trunk/docs/testing-with-local-playground.md Launch the Studio desktop application to test CLI changes within the full application environment. ```bash npm start ``` -------------------------------- ### Install Arch Linux Dependencies for Studio Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Installs essential packages required for Studio on Arch Linux using pacman. ```bash sudo pacman -S gtk3 libnotify nss libxss libxtst xdg-utils at-spi2-core util-linux libsecret ``` -------------------------------- ### Start WordPress Server with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Initiates the WordPress development server. Use this command to make your local WordPress site accessible. ```bash studio site start ``` -------------------------------- ### `studio site start` / `studio site stop` Source: https://context7.com/automattic/studio/llms.txt Commands to start and stop the local PHP WASM server for a WordPress site. ```APIDOC ## `studio site start` / `studio site stop` — Start and Stop Sites ### Description Starts or stops a site's local PHP WASM server. A stopped site has no running process; starting it boots WordPress in under a second. ### Usage ```bash # Start and open browser studio site start --path ~/Studio/my-coffee-shop # Start without opening browser (useful in CI or scripting) studio site start --path ~/Studio/my-coffee-shop --skip-browser # Stop a specific site studio site stop --path ~/Studio/my-coffee-shop # Stop all running sites studio site stop --all ``` ``` -------------------------------- ### Benchmark Example: Full Comparison Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Perform a full comparison excluding Playground Web environments and running 3 rounds. ```bash npm run benchmark -- --skip-playground-web --rounds=3 ``` -------------------------------- ### Install Studio CLI Dependencies Source: https://github.com/automattic/studio/blob/trunk/docs/testing-with-local-playground.md Remove existing node_modules and install fresh dependencies for the Studio CLI after updating its package.json. ```bash cd /path/to/studio rm -rf apps/cli/node_modules npm --prefix apps/cli install npm install ``` -------------------------------- ### Benchmark Example: Playground CLI Only Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Run the benchmark focusing solely on Playground CLI environments. ```bash npm run benchmark -- --skip-studio --skip-playground-web ``` -------------------------------- ### Benchmark Example: Custom Site Source: https://github.com/automattic/studio/blob/trunk/tools/benchmark-site-editor/README.md Benchmark a single custom WordPress site accessible at http://localhost:10003. ```bash npm run benchmark -- --custom=my-site,http://localhost:10003 ``` -------------------------------- ### Install and Activate Jetpack Plugin Source: https://github.com/automattic/studio/blob/trunk/apps/cli/ai/skills/rank-me-up/SKILL.md Use WP-CLI commands to install and activate the Jetpack plugin. This is a prerequisite for enabling its SEO tools. ```bash wp_cli: plugin install jetpack --activate ``` ```bash wp_cli: jetpack module activate seo-tools ``` -------------------------------- ### Build Playground Packages Source: https://github.com/automattic/studio/blob/trunk/docs/testing-with-local-playground.md Install dependencies and build all packages within the WordPress Playground repository. ```bash cd /path/to/wordpress-playground npm install npm run build ``` -------------------------------- ### Set Node.js Version and Install Dependencies Source: https://github.com/automattic/studio/blob/trunk/docs/code-contributions.md Ensure you are using the correct Node.js version with nvm and install project dependencies using npm workspaces. ```bash nvm use npm install ``` -------------------------------- ### Install and Activate WP Super Cache Plugin Source: https://github.com/automattic/studio/blob/trunk/apps/cli/ai/skills/need-for-speed/SKILL.md Use WP-CLI to install and activate the WP Super Cache plugin for improving site performance. ```bash wp_cli: plugin install wp-super-cache --activate ``` -------------------------------- ### Create a New WordPress Site Source: https://github.com/automattic/studio/blob/trunk/apps/cli/README.md Initiates the creation of a new local WordPress site with a guided, step-by-step process. ```bash studio site create ``` -------------------------------- ### Install Common Linux Dependencies Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Install essential system dependencies for Studio on Debian/Ubuntu or Fedora. These packages are often required for graphical applications and system integration. ```bash # Debian/Ubuntu sudo apt-get install libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libsecret-1-0 # Fedora sudo dnf install gtk3 libnotify nss libXScrnSaver libXtst xdg-utils at-spi2-core libuuid libsecret ``` -------------------------------- ### Run the Studio App with Isolated Appdata Source: https://github.com/automattic/studio/blob/trunk/docs/code-contributions.md Starts the app with a clean, isolated appdata file, useful for testing without affecting your real sites. ```bash npm run start:test ``` -------------------------------- ### Start and Stop Local WordPress Sites Source: https://github.com/automattic/studio/blob/trunk/apps/cli/README.md Commands to manage the running state of a specific local WordPress site. Ensure you provide the correct path to your site. ```bash studio site start --path ~/Studio/my-site studio site stop --path ~/Studio/my-site ``` -------------------------------- ### Restart WordPress Site with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Stop and then start the WordPress site using Studio CLI commands. This is often necessary after making configuration changes. ```bash studio site stop && studio site start --skip-browser ``` -------------------------------- ### MCP Server for External AI Assistants Source: https://context7.com/automattic/studio/llms.txt Starts an MCP (Model Context Protocol) stdio server that exposes all Studio tools to external AI assistants, enabling them to manage local WordPress sites. ```APIDOC ## `studio mcp` ### Description Starts an MCP (Model Context Protocol) stdio server that exposes all Studio tools to external AI assistants such as Claude Desktop or Cursor. This allows any MCP-compatible assistant to manage local WordPress sites. ### Method `studio mcp` ### Description Starts the MCP server. This command is typically used by external assistants and not called directly by the user. ### Example ```bash studio mcp ``` ``` -------------------------------- ### Launch Studio Code AI Agent Source: https://context7.com/automattic/studio/llms.txt Launches an interactive AI coding agent specialized in WordPress development. It can perform tasks like creating themes, installing plugins, and pushing to WordPress.com autonomously. ```bash # Start a new Studio Code session studio code ``` ```bash # Inside the session, type natural language prompts: # > Create a new site called "Acme Studio" with a dark brutalist aesthetic # > Install WooCommerce and add 5 sample products # > Scaffold a new block theme called "Acme Theme" # > Push to my WordPress.com site at acme.wordpress.com ``` ```bash # Delete a saved session studio code sessions delete ``` ```bash # List all saved sessions studio code sessions list ``` ```bash # Resume a previous session studio code sessions resume ``` ```bash # In-session slash commands: # /login — Log in to WordPress.com # /logout — Log out # /model — Switch AI model (interactive picker) # /provider — Switch AI provider (WordPress.com / Anthropic / OpenAI) # /api-key — Set/update Anthropic API key # /preview — Push active site to WordPress.com as a preview # /clear — Start a fresh conversation # /browser — Open the active site in browser # /exit — Exit the chat ``` -------------------------------- ### Generate MCP Server Configuration for AI Assistants Source: https://context7.com/automattic/studio/llms.txt These functions generate the necessary configuration for integrating WordPress Studio tools with MCP-compatible AI coding assistants. The server name, launch command, configuration object, and JSON string can be obtained and used for setup. ```typescript import { getMcpServerConfig, getMcpServerConfigJson, getMcpServerLaunchCommand, MCP_SERVER_NAME, } from '@studio/common/lib/mcp-config'; // The server name used as the MCP identifier console.log( MCP_SERVER_NAME ); // → "wordpress-studio" // Get the launch command string console.log( getMcpServerLaunchCommand() ); // → "studio mcp" // Get config object const config = getMcpServerConfig(); // → { "wordpress-studio": { command: "studio", args: ["mcp"] } } // Get formatted JSON string to paste into claude_desktop_config.json const json = getMcpServerConfigJson(); // → '{ "wordpress-studio": { "command": "studio", "args": ["mcp"] } }' // Add to ~/.config/claude/claude_desktop_config.json: // { // "mcpServers": { // "wordpress-studio": { // "command": "studio", // "args": ["mcp"] // } // } // } ``` -------------------------------- ### Get daemon status poll Source: https://github.com/automattic/studio/blob/trunk/specs/studio-code-remote-session-spec.md A periodic poll started by the REPL to check the daemon's status, catching external changes or unexpected deaths. ```javascript getDaemonStatus() ``` -------------------------------- ### Create Cloud Preview Site with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Uploads your current local site to a temporary WordPress.com preview URL. Requires prior authentication using `studio auth login`. ```bash studio preview create ``` -------------------------------- ### Performance Metrics JSON Output Example Source: https://github.com/automattic/studio/blob/trunk/tools/metrics/README.md Example structure of the performance metrics JSON output. All measurements are in milliseconds. ```json { "siteCreation": 6150, "siteStartup": 3946 } ``` -------------------------------- ### Create Studio Desktop Entry Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Create a .desktop file to integrate Studio into your application launcher. This requires specifying the correct paths to the executable and icon. ```ini [Desktop Entry] Name=Studio by WordPress.com Icon=/assets/studio-app-icon.png Comment=Local WordPress development environment Exec=/apps/studio/out/Studio-linux-x64/studio %U Type=Application Terminal=false MimeType=x-scheme-handler/wp-studio; Categories=Development; ``` -------------------------------- ### Create and Activate a Child Theme with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Steps to create a new child theme, including setting up its `style.css` and `functions.php` files, and then activating it using the Studio CLI. Remember to build block themes using `theme.json`. ```bash mkdir -p wp-content/themes/my-child-theme # Create style.css with Template: twentytwentyfive header # Create functions.php to enqueue parent styles studio wp theme activate my-child-theme ``` -------------------------------- ### Install daemon child hooks Source: https://github.com/automattic/studio/blob/trunk/specs/studio-code-remote-session-spec.md Installs hooks in the daemon child process to write its PID file and register an exit handler for cleanup. SIGINT/SIGTERM are not intercepted here. ```javascript installDaemonChildHooks() ``` -------------------------------- ### Create a New WordPress Site with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/studio-cli/SKILL.md Use this command to create a new local WordPress site. Interactive prompts are available if flags are omitted in a TTY. Be cautious with sensitive information like passwords when using flags. ```bash studio site create --name "My Site" --path ~/Studio/my-site ``` -------------------------------- ### List Cloud Preview Sites with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Displays a list of all cloud preview sites that have been created for your account. Useful for managing deployed previews. ```bash studio preview list ``` -------------------------------- ### Build and Test Studio CLI Source: https://github.com/automattic/studio/blob/trunk/docs/testing-with-local-playground.md Build the Studio CLI and execute a test command to verify the local package integration. ```bash npm run cli:build node apps/cli/dist/cli/main.mjs site create --name test-site ``` -------------------------------- ### Run Studio Executable Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Navigate to the build output directory and execute the Studio application. Ensure you are in the correct folder before running. ```bash cd apps/studio/out/Studio-linux-x64 ./studio ``` -------------------------------- ### Start a detached remote session Source: https://github.com/automattic/studio/blob/trunk/specs/studio-code-remote-session-spec.md Use this command to start the remote session daemon in detached mode. It forks a child process and waits for the PID file to be created. ```bash studio code remote-session start [--no-detach] [--remote-chat-id ] [--remote-bot ] ``` -------------------------------- ### Build Studio Application Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Build the Studio application. This command generates an 'out/' folder containing the application binaries. ```bash npm run package ``` -------------------------------- ### Run WordPress Studio CLI Without Installation Source: https://github.com/automattic/studio/blob/trunk/apps/cli/README.md Executes the Studio CLI command with the latest version without a global installation. Useful for quick checks or one-off commands. ```bash npx wp-studio@latest --help ``` -------------------------------- ### Get Latest Rewind ID API Source: https://github.com/automattic/studio/blob/trunk/docs/design-docs/sync.md Use this GET request to fetch the latest rewind_id for displaying remote files in the sync modal. The rewind_id is not sent back to the backend. ```http GET https://public-api.wordpress.com/wpcom/v2/sites/234098253/studio-app/sync/get-latest-rewind-id ``` -------------------------------- ### Import Site Backup Source: https://context7.com/automattic/studio/llms.txt Imports a site backup from a file into a local Studio site. Supports various formats including .zip, .tar.gz, .sql, and .wpress. ```bash studio import ~/Backups/my-site-backup.zip --path ~/Studio/my-site ``` ```bash # Supported import formats: .zip, .tar.gz, .sql, .wpress # (WordPress.com, Jetpack, Playground, Local by Flywheel) ``` -------------------------------- ### Package Electron App Source: https://github.com/automattic/studio/blob/trunk/AGENTS.md Packages the built Electron application into installers for the current platform using electron-forge. ```bash electron-forge make --config apps/studio/forge.config.ts ``` -------------------------------- ### List Cloud Preview Sites Source: https://context7.com/automattic/studio/llms.txt Lists existing cloud preview sites associated with a local Studio site. The output can be formatted as JSON. ```bash studio preview list --path ~/Studio/my-site --format json ``` -------------------------------- ### Get and Update Site Options Source: https://context7.com/automattic/studio/llms.txt Retrieves or updates site-specific options using WP-CLI commands within Studio. ```bash studio wp --path ~/Studio/my-site option get blogname ``` ```bash studio wp --path ~/Studio/my-site option update blogname "My New Name" ``` -------------------------------- ### Get argument completions for slash command Source: https://github.com/automattic/studio/blob/trunk/specs/studio-code-remote-session-spec.md Provides 'attach' and 'detach' as possible completions when typing the /remote-session command in the REPL. ```javascript SlashCommandDef.getArgumentCompletions(prefix) ``` -------------------------------- ### Clone Studio Repository Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Clone the Studio repository to your local machine. Navigate into the cloned directory to proceed with the build. ```bash git clone https://github.com/Automattic/studio.git cd studio ``` -------------------------------- ### Run Performance Tests Source: https://github.com/automattic/studio/blob/trunk/tools/metrics/README.md Package the application and then run the performance tests. Results are saved to artifacts/performance-metrics.json. ```bash npm run package npm run test:metrics ``` -------------------------------- ### Build the CLI Source: https://github.com/automattic/studio/blob/trunk/docs/code-contributions.md Runs a one-time build for the CLI. The output is a `apps/cli/dist/cli/main.mjs` file. ```bash npm run cli:build ``` -------------------------------- ### Publish Preview Sites Source: https://github.com/automattic/studio/blob/trunk/apps/cli/README.md Creates and publishes a temporary preview site from your local development environment. This site is hosted on a temporary WordPress.com domain (wp.build) for sharing. ```bash studio preview create --path ~/Studio/my-site ``` -------------------------------- ### Restore Playground Node Modules Source: https://github.com/automattic/studio/blob/trunk/docs/testing-with-local-playground.md In the Playground repository, run 'npm install' to restore the original node_modules symlinks and revert to published packages. ```bash cd /path/to/wordpress-playground npm install ``` -------------------------------- ### Manage Preview Sites with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/studio-cli/SKILL.md Commands for creating, listing, updating, and deleting temporary preview sites on WordPress.com. Previews expire after 7 days and are limited to 2 GB. ```bash studio preview create # Create preview from site at --path ``` ```bash studio preview list # List previews (--format table|json) ``` ```bash studio preview update # Update existing preview ``` ```bash studio preview delete # Delete a preview site ``` -------------------------------- ### Local Backup and Restore Source: https://context7.com/automattic/studio/llms.txt Export local Studio sites to various backup formats (zip, tar.gz, SQL) and import backups from different sources including WordPress.com, Jetpack, and local files. ```APIDOC ## `studio export` / `studio import` ### Description Exports a site to a zip, tar.gz, or SQL file, and imports from WordPress.com backups, Jetpack exports, `.wpress`, `.zip`, or `.sql` files. ### Method `studio export` ### Description Exports the local site to a backup file. ### Parameters #### Query Parameters - `--path` (string) - Required - The local path to the Studio site. - `--output` (string) - Optional - The specific path and filename for the output backup file. - `--mode` (string) - Optional - Specifies what to export (e.g., `db` for database only). ### Example ```bash studio export --path ~/Studio/my-site studio export --path ~/Studio/my-site --output ~/Backups/my-site.zip studio export --path ~/Studio/my-site --mode db --output ~/Backups/my-site.sql ``` ### Method `studio import` ### Description Imports a backup file into the local Studio site. ### Parameters #### Path Parameters - `backup_file` (string) - Required - The path to the backup file to import. #### Query Parameters - `--path` (string) - Required - The local path to the Studio site. ### Example ```bash studio import ~/Backups/my-site-backup.zip --path ~/Studio/my-site ``` ### Supported Formats `.zip`, `.tar.gz`, `.sql`, `.wpress` (from WordPress.com, Jetpack, Playground, Local by Flywheel) ``` -------------------------------- ### Push Site Content Source: https://context7.com/automattic/studio/llms.txt Pushes a local Studio site to a remote WordPress.com or Pressable site. Supports selective push, for example, only plugins. ```bash # Authenticate first studio auth login ``` ```bash # Push the local site to a remote WordPress.com site studio push --path ~/Studio/my-site ``` ```bash # Selective push (plugins only) studio push --path ~/Studio/my-site # Sync options: all | sqls | uploads | plugins | themes | contents ``` -------------------------------- ### Update WordPress Version with Studio CLI Source: https://github.com/automattic/studio/blob/trunk/skills/STUDIO.md Updates your local WordPress installation to a specified version. Always back up your site before performing version updates. ```bash studio site set --wp 6.8 ``` -------------------------------- ### Launching Child Studio Code Process Source: https://github.com/automattic/studio/blob/trunk/specs/studio-code-remote-session-spec.md This code snippet demonstrates how to spawn a child process for 'studio code' using Node.js. It specifies the executable path, arguments including '--json', and standard I/O streams, ensuring secure execution without shell interpolation. ```javascript spawn(process.execPath, [process.argv[1], 'code', '--json', ...args], { stdio: ['ignore', 'pipe', 'pipe'], env: process.env, }) ``` -------------------------------- ### wp_cli Source: https://context7.com/automattic/studio/llms.txt Allows the AI agent or MCP client to run any WP-CLI command on a running site. The site must be started first via `site_start`. ```APIDOC ## `wp_cli` AI Tool — WP-CLI via the Agent ### Description The `wp_cli` tool allows the AI agent (or MCP client) to run any WP-CLI command on a running site. The site must be started first via `site_start`. ### Tool Name `wp_cli` ### Input `{ nameOrPath: string, command: string }` ### Example: install and activate a plugin ```json { "name": "wp_cli", "arguments": { "nameOrPath": "My Coffee Shop", "command": "plugin install woocommerce --activate" } } ``` ### Example: create a post with block content ```json { "name": "wp_cli", "arguments": { "nameOrPath": "My Coffee Shop", "command": "post create --post_type=page --post_status=publish --post_title=\"About Us\" --post_content=\n

Welcome to our shop.

" } } ``` ### Error case — site not running: ``` throws: "Site \"My Coffee Shop\" is not running. Start it first using site_start." ``` ``` -------------------------------- ### Make Desktop File Executable Source: https://github.com/automattic/studio/blob/trunk/docs/linux.md Ensure the created desktop entry file has execute permissions. This step might be necessary for the file to be recognized by the system. ```bash chmod +x ~/.local/share/applications/studio.desktop ``` -------------------------------- ### Build and Run CLI Command Source: https://github.com/automattic/studio/blob/trunk/AGENTS.md Before testing CLI commands, you must build the CLI. This command first builds the CLI and then executes a specified command. ```bash npm run cli:build && node apps/cli/dist/cli/main.mjs ``` -------------------------------- ### Show error message for configuration issues Source: https://github.com/automattic/studio/blob/trunk/specs/studio-code-remote-session-spec.md Displays a user-friendly error message when remote session configuration is invalid, suggesting authentication or token setup. ```javascript ui.showError ``` -------------------------------- ### site_create Source: https://context7.com/automattic/studio/llms.txt Creates a full WordPress site and returns its URL and credentials as JSON. This tool is callable by Studio Code or any MCP client. ```APIDOC ## `site_create` AI Tool — Programmatic Site Creation ### Description The `site_create` tool is one of the AI agent's built-in tools, callable by Studio Code or any MCP client. It creates a full WordPress site and returns its URL and credentials as JSON. ### Tool Name `site_create` ### Input `{ name: string }` ### Example MCP tool call (JSON): ```json { "name": "site_create", "arguments": { "name": "My Coffee Shop" } } ``` ### Expected output (JSON text): ```json { "name": "My Coffee Shop", "path": "/Users/you/Studio/my-coffee-shop", "url": "http://localhost:8881", "adminUrl": "http://localhost:8881/wp-admin", "username": "admin", "password": "s3cur3P@ss", "phpVersion": "8.4" } ``` ```