=== PressCare Error Doctor with AI ===
Contributors: cleartel
Tags: error log, diagnostics, site health, ai, troubleshooting
Requires at least: 7.0
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.2.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find and fix WordPress errors before they become fatal.

== Description ==

PressCare Error Doctor with AI helps you find and fix WordPress errors before they become fatal by turning a confusing WordPress or PHP error log into a prioritized, plain-language action plan.

The local diagnostic scan is read-only and works without AI. It groups repeated events, separates current findings from older history, identifies the likely plugin, theme, or WordPress area involved, and redacts sensitive details before saving a report.

When an administrator wants more help, Error Doctor can send only the selected sanitized evidence to OpenAI, Anthropic Claude, or Google Gemini. The three official WordPress AI provider adapters are included, so users can choose a provider and connect its API key directly from Error Doctor without installing another provider plugin.

= What the local scan does =

* Reads a bounded portion of the configured WordPress or PHP error log.
* Reviews Today, the last 24 hours, 7 days, 30 days, or custom dates.
* Groups repeated events and ranks current actionable findings first.
* Detects likely plugin, theme, and WordPress core ownership from redacted paths.
* Shows a read-only WordPress, PHP, database, cache, transient, and autoload snapshot.
* Exports sanitized JSON and a printable report that can be saved as PDF.
* Lets each administrator mark findings handled without changing the site.
* Never edits files, changes settings, clears logs or caches, disables plugins, or repairs the database.

= Built-in AI guidance =

Error Doctor uses the provider-independent AI Client built into WordPress 7.0. Its setup panel lets an administrator:

1. Choose OpenAI, Anthropic, or Google.
2. Open the provider's official API-key page.
3. Paste an API key.
4. Test and connect it through WordPress's Connectors validation.
5. Select, change, or disconnect the provider used by Error Doctor.

API access is separate from consumer chat subscriptions:

* Google Gemini has a limited free API tier for supported models.
* OpenAI API usage requires separate API billing; ChatGPT Free, Plus, and Pro do not include it.
* Anthropic API usage requires separate credits; Claude Free, Pro, and Max do not include it.

Any working free-tier, promotional, or paid API key is supported. Paid access generally changes limits and availability, not the intelligence of the same model.

Error Doctor uses cost-controlled models and caps each AI response at 4,000 tokens. Local scans, reports, printing, and exports cost $0. A typical complete AI explanation is expected to cost less than 5 cents, while a focused single-finding request generally costs less. This is an estimate rather than a guarantee: provider pricing, report size, taxes, model availability, account tier, and free-tier limits can change the final charge. The provider bills the user directly; PressCare does not charge or receive API fees.

= Privacy and external services =

Local scans do not contact an external service.

AI analysis occurs only after an administrator checks the consent box and requests an explanation. Error Doctor sends WordPress and PHP versions, active theme details, plugin and update counts, severity counts, and selected grouped findings containing redacted samples, fingerprints, occurrence counts, and component slugs.

The plugin does not intentionally send raw logs, posts, visitor data, login credentials, database credentials, or API keys. PressCare never receives provider keys or AI requests. WordPress manages the key using its Connectors system and checks an environment variable, a PHP constant, then its database setting in that order. Database-stored keys are masked in the interface but are not encrypted by WordPress 7.0.

Provider data is processed under the provider's terms and privacy policy:

* OpenAI terms: https://openai.com/policies/terms-of-use/
* OpenAI privacy: https://openai.com/policies/privacy-policy/
* Anthropic commercial terms: https://www.anthropic.com/legal/commercial-terms
* Anthropic privacy: https://www.anthropic.com/legal/privacy
* Google API terms: https://developers.google.com/terms
* Google privacy: https://policies.google.com/privacy

Optional PressCare repair links open presscare.com only after an administrator clicks. A finding link includes only the sanitized finding ID, severity, and component slug—not the error sample or report.

== Installation ==

1. Install the ZIP through Plugins > Add New > Upload Plugin.
2. Activate PressCare Error Doctor with AI.
3. Open Tools > Error Doctor.
4. Run a private local scan.
5. Optional: choose an AI provider in the top setup panel, paste its API key, and select Test & Connect.

The plugin checks log locations in this order:

1. The path defined by the optional `PCAIED_LOG_PATH` constant.
2. The path configured in `WP_DEBUG_LOG`.
3. The local PHP `error_log` setting.

== Frequently Asked Questions ==

= Does Error Doctor repair or change my site? =

No. It is a read-only diagnostic and explanation tool.

= Is AI required? =

No. Parsing, grouping, redaction, component detection, the site snapshot, export, and printable reporting work locally without AI.

= Do I need another AI connector plugin? =

No. Error Doctor includes the official OpenAI, Anthropic, and Google provider adapters and uses the AI Client built into WordPress 7.0. If a standalone official provider plugin is already active, Error Doctor safely defers to it.

= Does ChatGPT Plus or Pro work as an API account? =

No. ChatGPT subscriptions and OpenAI Platform API billing are separate. Claude subscriptions and Anthropic Console API credits are also separate. Google currently offers a limited Gemini API free tier.

= Where is the API key stored? =

WordPress Connectors checks a server environment variable, then a `wp-config.php` constant, then a WordPress database option. PressCare does not receive or proxy the key. Advanced administrators can manage `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GOOGLE_API_KEY` outside the database.

= Is the complete error log sent to AI? =

No. The raw log remains on the server. A focused request includes one sanitized group; a complete-report request can include up to 25 sanitized groups and returns no more than eight prioritized explanations.

= Can I specify a log outside wp-content? =

Yes. Define an absolute readable path in `wp-config.php`:

`define( 'PCAIED_LOG_PATH', '/absolute/path/to/php-error.log' );`

= What is removed during uninstall? =

Error Doctor removes its saved reports, handled-finding state, and selected-provider preference. WordPress-owned Connector API keys are preserved because other plugins may use them; disconnect a database-stored key before uninstalling if it should also be removed.

== Screenshots ==

1. Error Doctor dashboard with the prominent built-in AI provider setup.
2. Date-range controls and compact local scan results.
3. Prioritized findings grouped by the responsible WordPress component.
4. Focused optional AI explanation based on sanitized evidence.
5. Read-only site snapshot and database context.

== Support ==

Documentation and source code: https://github.com/kevinkempeng/WP-AI-Doctor

Support and feature requests: https://presscare.com/contact/

Private security reports: https://presscare.com/contact/

Do not include production logs, API keys, passwords, or other credentials in a public report.

== Changelog ==

= 1.2.9 - August 2, 2026 =

* Updated the public display name to PressCare Error Doctor with AI so the built-in AI explanations are immediately clear.
* Adopted the preventive tagline: "Find and fix WordPress errors before they become fatal."
* Kept the permanent technical slug, folder, text domain, settings, and product URL as `presscare-error-doctor` for compatibility.
* Refreshed the WordPress.org and GitHub presentation around AI-assisted, read-only diagnostics.
* Removed the private-release Update URI so approved WordPress.org updates can be delivered normally.

= 1.2.8 - August 2, 2026 =

* Added AI cost estimates and disclaimers in the setup and request screens.
* Pinned cost-controlled OpenAI, Anthropic, and Google models with bounded fallbacks.
* Reduced the maximum AI response from 6,000 to 4,000 tokens.

= 1.2.7 - August 1, 2026 =

Initial public release.

* Added a one-plugin AI setup for OpenAI, Anthropic Claude, and Google Gemini using the WordPress 7.0 AI Client and Connectors credential validation.
* Added provider selection, connection testing, status, change-provider, and disconnect controls directly in Error Doctor.
* Clarified free-tier versus paid API access and the separation between chat subscriptions and API billing.
* Added read-only log diagnostics, prioritized findings, privacy redaction, site-health context, printable reports, and optional sanitized AI explanations.
* Added plugin-row links for Error Doctor, documentation, and support.
* Added a direct-release Update URI to protect private packages from unrelated WordPress.org updates.

For complete development history, see `CHANGELOG.md` in the source repository.

== Upgrade Notice ==

= 1.2.9 =

Makes the built-in AI assistance clear throughout the plugin and public listing without changing compatibility identifiers.

= 1.2.8 =

Adds cost-controlled models, a lower output cap, and clear AI price guidance.
