=== Amplest Autopilot — AI Search Optimization & Structured Data (JSON-LD) ===
Contributors: amplest, 2ndbrospec
Tags: structured-data, json-ld, ai-optimization, schema, aeo
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.3.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The on-site engine for Amplest — AI search optimization for WordPress. Get cited by ChatGPT, Gemini, Perplexity, Copilot, and Claude.

== Description ==

**Your WordPress site, continuously optimized for AI search.**

Search has changed. When someone asks an AI assistant "what's the best [X]?" or "how do I [Y]?", the answer comes from sites the AI chooses to trust. Structured data, authority signals, and answer-ready content are no longer optional — they're the new foundation.

Amplest Autopilot builds that foundation, and keeps building it.

This plugin is the on-site engine of [Amplest](https://amplest.cloud) — an AI search optimization platform. Install it and your WordPress site connects to Amplest's cloud intelligence: continuous LLM citation monitoring, AI-powered diagnosis, and automated fixes pushed directly to your site. The plugin handles the on-site layer; Amplest handles the strategy.

= What works on your site from day one (free, no account needed) =

* **Structured Data (JSON-LD)** — Automatically generates and injects Organization, WebSite, Article, FAQPage, and BreadcrumbList schemas into `<head>`. No configuration required.
* **Auto FAQ Detection** — Scans post content for question-pattern headings (English and Japanese) and converts them into FAQPage schema automatically.
* **AEO Metabox** — Add an AI summary, target keywords, and custom Q&A in the post editor to guide how AI reads and cites your content.
* **llms.txt** — Dynamically serves `/llms.txt` per the llmstxt.org standard — an always-current map of your key content for AI crawlers.
* **AI Score Widget** — See your AI visibility score directly in the WordPress dashboard.

= What the Amplest Cloud Service adds (optional SaaS integration) =

Connect a paid plan at [amplest.cloud](https://amplest.cloud) to unlock the cloud platform layer:

* **LLM Citation Monitoring** — Your site is tested across ChatGPT, Gemini, Perplexity, Copilot, and Claude to track whether and how they cite you.
* **AI-Powered Diagnosis** — Amplest scans your site, identifies what's limiting your AI visibility, and generates a prioritized improvement list.
* **Automated Fix Application** — Approved improvements are pushed to your site through the plugin's REST API — structured data, meta tags, and AEO fields updated without touching your theme or post content.
* **Snapshot & Rollback** — Every applied fix is snapshotted before it runs. Roll back any change at any time from the Amplest dashboard.
* **Monthly / Weekly Reports** — Track your AI visibility score over time with detailed diagnosis and improvement history.

= Plans =

**Free** — No account needed. Structured data injection, AEO metabox, llms.txt, and AI Score widget activate immediately after installing the plugin.

**Planner ($35/mo)** — Monthly LLM scan, improvement suggestions, and email reports. Connects your site to the Amplest diagnosis engine.

**Operator ($110/mo)** — Monthly automatic scan, up to 3 manual scan requests per month, full issue list, and human-approved automatic fix application. For site owners who want control with less manual work.

**Autopilot ($220/mo)** — Fully automated optimization with no approval required. Built for agencies and businesses running multiple sites.

[See full plan details →](https://amplest.cloud/pricing)

== Installation ==

1. In your WordPress admin, go to **Plugins > Add New**
2. Search for **Amplest Autopilot**
3. Click **Install Now**, then **Activate**
4. Go to **Settings > Amplest Autopilot** to configure the plugin
5. Enter your license key and click **Activate License**

= Manual Installation =

1. Upload the plugin folder to `/wp-content/plugins/amplest-autopilot/`
2. Activate the plugin from the **Plugins** screen in WordPress
3. Go to **Settings > Amplest Autopilot** to configure

== Frequently Asked Questions ==

= Where do I get a license key? =

Create an account at [amplest.cloud](https://amplest.cloud), choose a plan, and your license key will be issued immediately.

= What can I use on the Free plan? =

The Free plan automatically injects all structured data types (Organization, WebSite, Article, FAQPage, BreadcrumbList), enables the AEO metabox in the post editor, generates `/llms.txt` for AI crawlers, and shows the AI Score widget in your dashboard — no license key required. All on-site features are fully functional without an account.

= Can I use this alongside Yoast SEO or All in One SEO? =

Yes. Amplest Autopilot focuses on AI-optimized structured data and does not conflict with standard SEO plugins. Note that duplicate schema output may occur if both plugins generate the same schema type — you can disable individual schema types as needed.

= How does Auto FAQ Detection work? =

Amplest Autopilot scans your post content for H2/H3 headings that look like questions — headings ending with `?`, or starting with words like "What", "How", "Why", "Can", etc. (English) or containing patterns like「とは」「方法」（Japanese). Matching heading + paragraph pairs are automatically converted into FAQPage structured data.

= What is the AI Score? =

The AI Score reflects how well your site is positioned to be cited by the 5 major LLMs. Amplest scans your site across ChatGPT, Gemini, Perplexity, Copilot, and Claude and returns a score from 0–100. Higher scores mean better AI visibility.

= What is llms.txt? =

`llms.txt` is an emerging standard (llmstxt.org) that helps AI crawlers quickly understand a website's structure and key content — similar to `robots.txt` but designed for large language models. Amplest Autopilot generates this file dynamically, so it always reflects your latest pages and articles.

= Can I roll back an automatic fix? =

Yes. Before every automatic fix is applied, the plugin creates a snapshot of the existing data and saves a WordPress post revision. You can roll back any applied fix at any time from the Amplest dashboard.

== Screenshots ==

1. Settings screen — License management and Organization structured data settings
2. Feature settings — Toggle JSON-LD injection, FAQ detection, and AEO metabox
3. AEO metabox — Set AI summary, keywords, and FAQ in the post editor
4. Dashboard widget — AI Score display with scan request button

== External Services ==

This plugin functions as a fully standalone tool for local schema generation, llms.txt, and the AEO metabox — no external service is required for these features.

Optionally, the plugin integrates with the **Amplest cloud platform** to provide AI-powered diagnostics, improvement suggestions, and automated fix delivery. When this integration is active, the plugin communicates with Amplest as described below.

* Service: Amplest (https://amplest.cloud)
* Terms of Service: https://amplest.cloud/legal/terms
* Privacy Policy: https://amplest.cloud/legal/privacy

= Plugin → Amplest (outbound calls) =

* **License activation / deactivation** — When you click "Activate License" or "Deactivate License", your license key and site domain are sent to `https://amplest.cloud/api/wp-plugin/activate` or `.../deactivate`. Data sent: license key, site domain.
* **Daily license verification** — Once per day via WP-Cron, the plugin sends your license key and site domain to `https://amplest.cloud/api/wp-plugin/verify` to confirm subscription status. Data sent: license key, site domain.
* **AI Score retrieval** — When you click "Refresh Score", your site domain is sent to `https://amplest.cloud/api/wp-plugin/score` to fetch your current AI visibility score. Data sent: license key, site domain.
* **Scan request** — When you click "Request Scan" (Operator / Autopilot plans only), your site domain is sent to `https://amplest.cloud/api/wp-plugin/scan` to trigger an LLM citation scan. Data sent: license key, site domain.

= Amplest → Plugin (inbound webhook) =

* **Automated fix delivery** — When you approve an improvement in the Amplest dashboard, the Amplest service calls this plugin's REST endpoint (`/wp-json/amplest/v1/apply-fix`) and passes the generated content (structured data, meta tags, or FAQ items). The plugin writes that content to WordPress post meta locally. **No data from your site is transmitted outbound via this endpoint.**
* **Rollback** — Similarly, the Amplest service may call `/wp-json/amplest/v1/rollback` to restore a previously saved snapshot. All operations are local (post meta read/write only).

These inbound endpoints use **WordPress Application Passwords** (a WordPress core feature, WP 5.6+) for authentication. No custom auth protocol is required.

No personal user data is collected or transmitted. Only your site domain and license key are used for outbound calls.

== Changelog ==

= 1.3.1 =
* Security: Improved REST API endpoint permissions — /apply-fix and /rollback now require edit_others_posts capability (Editor or Administrator) instead of edit_posts, and additionally verify the authenticated user can edit the specific target post (current_user_can('edit_post', $post_id)).
* Fixed: Refresh Score no longer sends an HTTP request to Amplest when no license key is configured — returns an informational error message instead.
* Fixed: Dashboard widget footer link now uses a direct UTF-8 arrow character instead of an HTML entity inside esc_html_e(), correcting display on English-locale sites.
* Fixed: Custom JSON-LD injected via the apply-fix REST endpoint is now output via wp_json_encode(json_decode()) instead of wp_kses(), ensuring valid and safe JSON output in all cases.

= 1.3.0 =
* Fixed: /apply-fix and /rollback REST endpoints now use WordPress Application Passwords for authentication instead of requiring an active paid license.
* Fixed: Settings page upgrade CTA now references cloud-only features (LLM monitoring, AI diagnosis, automated fix delivery) — no longer implies that local features require a paid plan.
* Fixed: Removed "Planner plan or higher required" notices from the Auto FAQ Detection and AEO Metabox settings. Both features are fully functional on all plans including Free.
* Added: "Amplest Cloud Connection" section in settings explaining how to set up WordPress Application Passwords for the Amplest service.
* Updated: External Services section in readme now separately documents outbound (plugin → Amplest) and inbound (Amplest → plugin webhook) communication, with specific API endpoint URLs and data sent.

= 1.2.0 =
* Changed: JSON-LD structured data (Article, FAQPage, BreadcrumbList, AEO summary) now available for all plans including Free
* Changed: AEO metabox (AI summary, keywords, FAQ) now fully accessible for all plans including Free
* Fixed: Removed `JSON_UNESCAPED_SLASHES` from JSON-LD output to prevent potential XSS via `</script>` in content strings
* Removed: `load_plugin_textdomain()` call — WordPress auto-loads translations for plugins hosted on WordPress.org

= 1.1.0 =
* Added: llms.txt auto-generation — dynamically serves `/llms.txt` for AI crawlers (top 30 pages + 30 articles, with total count shown for larger sites)
* Added: Snapshot and rollback system — every automatic fix creates a WordPress revision and a meta snapshot; roll back any change from the Amplest dashboard
* Added: Custom JSON-LD and meta tags injected via the Amplest REST API are now correctly output in `<head>`
* Fixed: License authentication in the REST API (`apply-fix` endpoint was always returning 401 due to incorrect option key and field name)
* Fixed: `plan_tier` values from the Amplest API are now validated against a whitelist to prevent unexpected tier escalation
* Fixed: All hardcoded Japanese strings in `admin.js` replaced with localized `amplestAdmin.*` values
* Internationalization: all UI strings converted to English; Japanese .po/.mo files included
* Updated plan names to Free / Planner / Operator / Autopilot (aligned with amplest.cloud pricing)

= 1.0.0 =
* Initial release
* Auto JSON-LD injection (Organization, WebSite, Article, FAQPage, BreadcrumbList)
* Auto FAQ detection
* AEO metabox (AI summary, keywords, FAQ)
* AI Score dashboard widget
* License management system

== Upgrade Notice ==

= 1.1.0 =
UI language is now English. Japanese translations are included via the bundled .po/.mo files. Plan names have changed to Free / Planner / Operator / Autopilot — existing licenses are automatically mapped to the new tiers. A rollback system has been added; no action required on your part.
