=== M7tawa LLMS.txt Manager ===
Contributors: aymanabdullahdev
Tags: llms.txt, robots.txt, ai, seo, content discovery
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.4.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage llms.txt, robots.txt, and optional AI-assisted LLMS.txt and sitemap drafts through the official WordPress AI Client.

== Description ==

M7tawa LLMS.txt Manager is a local management and safety tool for llms.txt and robots.txt. It generates an editable llms.txt file from WordPress site data and provides a separate Robots.txt manager plus a consistency and safety audit.

The plugin supports automatic and manual llms.txt modes, public post types, exclusions, custom text, SEO descriptions, file checks, and Arabic/English administration screens. It can create a physical llms.txt file when the site root is writable and falls back to a WordPress virtual route when needed.

The Robots.txt tab reviews the current robots.txt file, suggests a safe WordPress baseline, detects physical-file conflicts, and prevents saving an exact full-site blocking rule such as `Disallow: /`. The Safety Audit checks public llms.txt availability, physical versus virtual delivery, write/read status, physical robots.txt conflicts, full-site blocking, and explicit `/llms.txt` blocking without modifying files or settings.

== Features ==

* Automatic or manual llms.txt generation.
* Fast physical llms.txt file with a virtual WordPress fallback.
* Automatic refresh when published content changes.
* Pages, categories, posts, products, and public custom post types.
* Search and exclude individual content items.
* Custom text before or after generated content.
* Rank Math and Yoast descriptions and noindex support.
* Separate Robots.txt review and management tab.
* LLMS.txt and Robots.txt Safety Audit with Healthy, Warning, and Action Required status.
* Checks public llms.txt availability and physical versus virtual delivery.
* Detects physical robots.txt conflicts, full-site blocking, and explicit `/llms.txt` blocking.
* Full-site robots.txt block protection for an exact `Disallow: /` rule.
* Physical robots.txt conflict detection without overwriting the existing file.
* English is the source language. The plugin is fully internationalized and ready for community translations through WordPress.org.
* Human-readable JavaScript source is included directly in the plugin; no build process is required.
* No telemetry or bundled third-party AI SDK. Optional AI requests use the official WordPress AI Client and the provider configured by the administrator.

== Optional AI Features ==

Version 1.4.0 adds an optional AI Workspace. The existing LLMS.txt, Robots.txt, and Safety Audit features continue to work without AI.

* Uses the official WordPress AI Client available in WordPress 7.0 and newer.
* Uses the AI provider configured by the site administrator under Settings > Connectors.
* Does not store provider API keys.
* Makes no automatic or background AI requests.
* Generates an editable LLMS.txt draft that must be reviewed before it is applied. AI receives opaque URL IDs; PHP restores the original WordPress URLs after validating those IDs.
* Generates an XML sitemap preview using opaque entry IDs only. AI selects IDs and priorities; PHP keeps the real WordPress URLs and constructs the XML itself.
* Publishes the optional AI sitemap at `/m7tawa-ai-sitemap.xml` only after explicit administrator approval. The default WordPress sitemap remains unchanged.

== External Services ==

The optional AI Workspace sends data to the AI provider that the site administrator has configured through the WordPress Connectors screen. The provider is selected and managed by WordPress, not by this plugin.

Data is sent only after an administrator explicitly clicks Test AI Setup, Generate LLMS.txt with AI, or Generate AI Sitemap. Depending on the requested action, the request can include the site name, site description, content titles, descriptive LLMS.txt context, and opaque entry identifiers. Real website URLs are kept by PHP and restored locally after the AI response is validated.

M7tawa LLMS.txt Manager does not store provider API keys and does not maintain its own history of prompts or AI responses. Provider terms and privacy policies depend on the provider chosen by the site administrator in Settings > Connectors.

== Installation ==

1. Upload the plugin ZIP from Plugins > Add New > Upload Plugin.
2. If upgrading from Simple LLMS.txt Generator, deactivate the old plugin before activating M7tawa LLMS.txt Manager. Existing settings are migrated automatically.
3. Activate M7tawa LLMS.txt Manager.
4. Open Settings > M7tawa LLMS.txt.

== Frequently Asked Questions ==

= Will I lose settings from Simple LLMS.txt Generator? =

No. Version 1.3.0 migrates the existing llms.txt and robots.txt settings to the new M7tawa-prefixed option keys and keeps a legacy fallback during the transition.

= Does the plugin overwrite an existing physical robots.txt file? =

No. If a physical robots.txt file already exists, the plugin reviews it but does not overwrite it.

= Does robots.txt need to be regenerated after every new post? =

No. A normal robots.txt file points crawlers to general rules and a sitemap. WordPress updates its sitemap as content changes.

== Source Code ==

The JavaScript source used by this plugin is included directly in `assets/admin.js` in human-readable form. The plugin does not require npm, webpack, transpilation, minification, or another build process to regenerate its distributed JavaScript.

== Changelog ==

= 1.4.2 =
* Reworked AI LLMS.txt generation so the model receives opaque URL IDs instead of authoring URLs; PHP validates the IDs and restores the original WordPress URLs.
* Reworked AI sitemap generation so the model returns only entry IDs and priorities; PHP owns the URLs and builds the XML.
* Removed fragile URL-string comparison and JSON sitemap parsing that could reject valid AI responses.
* Preserved the WordPress AI Client transport, nonce/capability protections, settings, LLMS.txt, Robots.txt, Safety Audit, and migration behavior from version 1.4.1.

= 1.4.1 =
* Matched the WordPress AI Client transport used by M7tawa FAQ Manager, including the same model preferences, scoped timeout, capability check, retry behavior, and friendly provider errors.
* Fixed the Settings > Connectors admin URL.
* Added direct nonce and capability verification in every AI AJAX action for WordPress Plugin Check compatibility.
* Kept all existing LLMS.txt, Robots.txt, Safety Audit, migration, and non-AI behavior unchanged.

= 1.4.0 =
* Added an optional AI Workspace powered by the official WordPress AI Client and Settings > Connectors.
* Added Test AI Setup with explicit administrator action and text-generation capability checks.
* Added AI-assisted LLMS.txt draft generation with preview, editing, copy, and explicit Apply before switching to manual mode.
* Added AI-assisted XML sitemap generation using only WordPress-supplied URLs; PHP validates the AI selection and constructs the XML.
* Added an optional dedicated `/m7tawa-ai-sitemap.xml` endpoint that does not replace the WordPress core sitemap.
* Added AI privacy and external-service documentation.
* Preserved all LLMS.txt, Robots.txt, Safety Audit, legacy migration, and existing settings behavior from version 1.3.5.

= 1.3.5 =
* Added a local LLMS.txt and Robots.txt Safety Audit with Healthy, Warning, and Action Required status.
* Added checks for public llms.txt availability, physical or virtual delivery, file readability/writability, physical robots.txt conflicts, full-site blocking, and explicit /llms.txt blocking.
* Replaced the compressed admin JavaScript with the human-readable source version included directly in the plugin package. No build process or external source repository is required.
* Preserved existing settings, legacy migration, generation behavior, robots.txt management, and external-service-free operation.

= 1.3.4 =
* Removed the obsolete Domain Path header after bundled translation files were removed.
* Keeps WordPress.org translation readiness through the plugin text domain.
* No functional changes to LLMS.txt or robots.txt management.

= 1.3.3 =
* Removed bundled translation files in preparation for WordPress.org translation packs.
* Prepared the plugin for community translations through translate.wordpress.org.
* No functional changes to llms.txt or robots.txt management.

= 1.3.2 =
* Updated WordPress.org compatibility metadata for WordPress 7.1.
* Reviewed the package for repository readiness without changing plugin behavior or stored settings.
* Preserved the large-site settings-page performance fix from version 1.3.1 and all legacy migration behavior.

= 1.3.1 =
* Fixed a settings-page performance issue on large sites when no content exclusions are configured.
* The exclusions list now loads only the specifically excluded content items instead of risking an unbounded query.
* Preserved all settings, migration behavior, llms.txt generation, and robots.txt management from version 1.3.0.

= 1.3.0 =
* Renamed the plugin to M7tawa LLMS.txt Manager.
* Changed the folder, main file, and Text Domain to `m7tawa-llms-txt-manager`.
* Added the unique `m7lm_` / `M7LM_` code identity required for WordPress.org readiness.
* Added one-time migration from all legacy Simple LLMS.txt Generator settings, robots.txt settings, cache, timestamps, and file-delivery status.
* Added legacy read fallback so existing settings remain available during the transition.
* Removed legacy inline Arabic source strings and prepared all interface text for standard WordPress translation.
* Preserved the stable llms.txt and robots.txt behavior from version 1.2.2, including the exact `Disallow: /` safety check.
* Removed the obsolete htaccess marker from the previous plugin identity before adding the new marker.
* Updated readme metadata and package identity for WordPress.org submission.

= 1.2.2 =
* Plugin Check compliance update for the previous Simple LLMS.txt Generator identity.
* Fixed translator comments, sanitized request handling, and performance warnings.

= 1.2.1 =
* Fixed the Robots.txt save button and exact full-site blocking detection.

= 1.2.0 =
* Added Robots.txt review and safe management.

= 1.1.5 =
* Fixed UTF-8 display for physical llms.txt files.

= 1.0.0 =
* Initial release as Simple LLMS.txt Generator.
