`. * - The CLI's `configDisplay.js:15` / `configWriter.js` key format * `${siteSlug}-${serverId}` (which reads `site_slug` from `/health`). * * Consumed by: * - `Includes\REST\CliController::handle_health` — returns as `site_slug` * in the REST response so the CLI can build the config key. * - `Includes\MCPClients\AbstractMCPClient::derive_server_key` — prefixes * the last-URL-segment key so the admin-UI snippet renders the SAME key * the CLI would write. Fixes the historical mismatch where admin UI * showed `mcp-adapter-default-server` but the CLI wrote * `acrossai-mcp-adapter-default-server`. * * This class exposes only `static` methods — no singleton ceremony, no * instance state. Matches the `Utilities\AdminPageSlugs` pattern. */ final class SiteSlug { /** * Fallback when `get_bloginfo( 'name' )` returns an empty / whitespace * string. Matches the CLI's own fallback so the admin UI and CLI never * diverge on empty-site-name installs. */ public const EMPTY_FALLBACK = 'wordpress'; /** * Return the current site's slug. */ public static function get(): string { if ( ! function_exists( 'get_bloginfo' ) || ! function_exists( 'sanitize_title' ) ) { return self::EMPTY_FALLBACK; } $slug = sanitize_title( (string) get_bloginfo( 'name' ) ); return '' === $slug ? self::EMPTY_FALLBACK : $slug; } }