Environment::has_woocommerce() ? __( 'Store map', 'addsynapse-store-assistant' ) : __( 'Site map', 'addsynapse-store-assistant' ), 'description' => Environment::has_woocommerce() ? 'Returns how this WooCommerce store structures product data (read-only, cached): active plugins, product taxonomies with top terms, global pa_* attributes with terms, local attribute names, where brands are stored, product meta keys with frequency/type/safe sample, and ACF field groups for products. Pass refresh=true to rebuild the cache.' : 'Returns how this WordPress site (no WooCommerce) is built (read-only): theme, pages and posts counts, front page, newest pages with their builder, SEO plugin, menus and locations, languages, active plugins.', 'category' => AbilitiesRegistrar::CATEGORY, 'input_schema' => array( 'type' => 'object', 'additionalProperties' => false, 'properties' => array( 'refresh' => array( 'type' => 'boolean', 'description' => 'Rebuild the cached map.', ), ), ), 'output_schema' => array( 'type' => 'object', 'required' => Environment::has_woocommerce() ? array( 'taxonomies', 'attributes', 'brand', 'meta_keys' ) : array( 'site_type', 'content', 'menus' ), ), 'execute_callback' => array( $this, 'execute' ), 'permission_callback' => array( AbilitiesRegistrar::class, 'can_manage' ), 'meta' => Shared::readonly_meta(), ) ); } /** * Execute callback. * * @param array $input Input. * @return array */ public function execute( $input = null ): array { $input = is_array( $input ) ? $input : array(); if ( ! Environment::has_woocommerce() ) { // Plain WordPress site: the site map (no products, no product meta). return SiteMap::build(); } return StoreMap::get( ! empty( $input['refresh'] ) ); } }