#!/usr/bin/env bash
# Run a WP-CLI command on the live site over the jailed SSH connection.
# Pass the WordPress path for the target site and the wp args.
#   wp.sh /home/<user>/public_html plugin list
#   wp.sh /home/<user>/public_html option get siteurl
# (Or use the awesomate_run_wp_cli MCP tool, which is audited server-side.)
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
[ "$#" -ge 2 ] || { echo "Usage: wp.sh <wp-path> <wp args...>"; exit 1; }
WP_PATH="$1"; shift
# Delegate the connection to ssh-connect.sh; run wp in the given path.
exec "$here/ssh-connect.sh" "wp --path=$(printf %q "$WP_PATH") $*"
