=== Gu&Co AI Blog Writer ===
Contributors: @krzysztofsarna, freemius
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Gu&Co AI Blog Writer manages blog topics, generates SEO briefs and article drafts using the native WordPress AI Client, runs automatic quality checks, and schedules WordPress draft posts.

== Description ==

Gu&Co AI Blog Writer is a fully featured, 100% free blog draft creation companion. Features include:

* Topic queue management with priority, keywords, category, risk level, and status.
* Test mode with local mock AI responses for risk-free workflow validation.
* Native SEO brief generation.
* Automated full-length article generation returned as structured JSON with HTML content.
* Multi-criteria AI quality check (score, risk level, issues list, and recommended action).
* Article preview screen before publishing.
* Automatic WordPress draft creation with tags, category, excerpt, slug, and custom SEO metadata.
* Comprehensive log tracker for all key operations.
* AI title suggestions based on analysis of published WordPress posts to help discover content gaps.
* Bulk CSV topic import.
* Optional WP-Cron automation for automated drafting.
* Automated publishing after quality checks.

== Installation ==

1. Copy the plugin folder to your `wp-content/plugins/` directory.
2. Activate "Gu&Co AI Blog Writer" in WordPress.
3. Ensure you have configured an active AI provider and connector under WordPress Settings -> Connectors (requires WordPress 7.0+).
4. (Optional) Enable "Test Mode" in Gu&Co AI Blog Writer -> Settings to test the workflow locally with sample responses without connecting to an external AI API.
5. Add or import topics, then generate briefs and articles from the admin panel.

== CSV Format ==

The CSV import file should have headers in this order:

`topic,primary_keyword,secondary_keywords,audience,search_intent,priority,risk_level,publish_mode`

Example:

`Jak wybrać telewizor do sportu?,telewizor do sportu,"OLED,QLED,120 Hz",Kupujący TV,poradnik,80,normal,draft_only`

== Privacy and External Services ==

This plugin utilizes the native **WordPress AI Client** to connect to generative AI services. No direct API connections are initiated by the plugin itself; all requests are routed through the AI provider and credentials configured globally by the site administrator on the WordPress **Settings > Connectors** screen.

Depending on the connector you enable in WordPress, the following external services may be utilized:

= OpenAI =
* **Purpose**: Used for generating article briefs, full article drafts, title suggestions, and executing quality checks.
* **Data Sent**: Topic title, primary & secondary keywords, target audience, intent, outline, and editorial notes.
* **When Sent**: Triggered only when the administrator initiates a brief, article, suggestion generation, or quality check manually, or when scheduled cron tasks run.
* **OpenAI Terms of Service**: https://openai.com/policies/terms-of-use
* **OpenAI Privacy Policy**: https://openai.com/policies/privacy-policy

= Google Gemini =
* **Purpose**: Used for generating article briefs, full article drafts, title suggestions, and executing quality checks.
* **Data Sent**: Topic title, primary & secondary keywords, target audience, intent, outline, and editorial notes.
* **When Sent**: Triggered only when the administrator initiates a brief, article, suggestion generation, or quality check manually, or when scheduled cron tasks run.
* **Google Terms of Service**: https://policies.google.com/terms
* **Google Privacy Policy**: https://policies.google.com/privacy

= Anthropic Claude =
* **Purpose**: Used for generating article briefs, full article drafts, title suggestions, and executing quality checks.
* **Data Sent**: Topic title, primary & secondary keywords, target audience, intent, outline, and editorial notes.
* **When Sent**: Triggered only when the administrator initiates a brief, article, suggestion generation, or quality check manually, or when scheduled cron tasks run.
* **Anthropic Terms of Service**: https://www.anthropic.com/legal/consumer-terms
* **Anthropic Privacy Policy**: https://www.anthropic.com/legal/privacy

== Security Notes ==

All generated HTML content is sanitized with `wp_kses_post()` before being saved to WordPress draft posts. Autopublishing requires explicit enablement in settings, a low-risk topic classification, a recommended action of 'publish', and a quality check score meeting the configured threshold (default 90).

== Changelog ==

= 1.1.3 =
* Added automatic AI_GENERATED labeling for both post text and featured images immediately after generation.
* Added label selector allowing users to choose from all available SVG badges in `assets/label_ai_generated` (12 variants: AI GENERATED, AI MODIFIED, AI in solid and transparent styles).
* Added ability for users to remove AI labels after reviewing and acknowledging the content (with mandatory confirmation checkbox and audit logging).
* Added mandatory AI label enforcement for automated publishing (Autopublish mode strictly requires active AI labels).
* Added AI labels management panel to the Generated Post Preview screen with live SVG previews and action buttons.
* Added dedicated WordPress Post Editor Meta Box ("Gu&Co AI - AI Labels") for managing badges directly on edit-post screens.
* Added global default AI label configuration for text and image in plugin Settings.
* Added new "AI Labels" status column in Generated Drafts list table.

= 1.1.2 =
* Added Featured Image AI Model selection setting with support for Google Gemini (`gemini-3.1-flash-image`, `gemini-3.0-flash-image`, `gemini-3-pro-image`, `imagen-3.0`) and OpenAI (`gpt-image-2`, `gpt-image-1.5`, `gpt-image-1-mini`, `gpt-image-1`, `chatgpt-image-latest`, `dall-e-3`).
* Removed explicit API Key input fields from Settings: API keys are now auto-detected from WordPress 7.0 Connectors (`connectors_ai_google_api_key`, `connectors_ai_openai_api_key`), WordPress AI Client Registry, PHP constants (`GOOGLE_API_KEY`, `OPENAI_API_KEY`), and environment variables.
* Added standalone Featured Image regeneration action and buttons in Generated Drafts list and preview toolbar.
* Updated settings page UI to clarify global AI Connector configuration and image model selection.

= 1.1.1 =
* Added support for OpenAI and Google Gemini image generation fallbacks.
* Added standalone Featured Image regeneration action.

= 1.1.0 =
* Added PRO Featured Image Generator for blog post titles with custom style selection, aspect ratios (16:9, 4:3, 1:1), and web optimization (WebP/JPEG).
* Improved UX: Replaced open text input for Search Intent with a predefined SEO select dropdown (informational, commercial, transactional, navigational).
* Bug fix: Expanded database search_intent column from VARCHAR(100) to TEXT to prevent database errors on long inputs.

= 1.0.0 =
* Initial release. Fully open-source and free, migrating all generative AI calls to the native WordPress AI Client. Removed Freemius integration.
