=== Cheraq ===
Contributors: cheraqai
Tags: ai, content, seo, woocommerce, chatbot
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.5.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Your site's AI content and SEO agent: articles, refreshes, product copy, SEO lines and alt text, each one approved by you and undoable.

== Description ==

Cheraq reads your site (and Google Search Console, if you connect it), finds what your customers search for, and prepares finished work for you to review:

* New articles with a featured image, written with live web search
* Refreshes of posts that lost traffic or went stale
* WooCommerce product descriptions
* SEO titles and descriptions (Rank Math, Yoast SEO, SEOPress) where they are missing
* Alt text for images that have none
* An optional support chat that answers visitors from your own content

You read each piece, edit it if you like, ask for a change in one sentence, then publish it. Every change can be undone in one click. An automatic mode is available for owners who prefer it.

The interface is in Persian on Persian sites and in English elsewhere.

مدیر محتوا و سئوی هوشمند سایتت. چراغ سایتت را می‌خواند، می‌فهمد مشتری‌هایت چه جست‌وجو می‌کنند و کار آماده تحویل می‌دهد: مقاله‌ی تازه، به‌روزرسانی مطالب افت‌کرده، توضیح محصول، عنوان و توضیحات سئو و متن جایگزین تصاویر. هر کدام را خودت می‌خوانی و تأیید می‌کنی و هر تغییر با یک کلیک برمی‌گردد.

= Safety =

* Nothing is published or changed without your approval, unless you switch on the automatic mode yourself.
* A new article is a new post (undo = trash). A refresh or product description keeps the previous version (undo restores it; WordPress revisions too). SEO fields and alt text are only filled where empty.
* The plugin never touches the theme, other plugins, prices, users or settings. Posts built with page builders are left alone.

== External services ==

This plugin is the WordPress side of the Cheraq service (https://cheraq.ai). The writing, the images and the planning are done on Cheraq's servers with AI models, so the plugin cannot work without a Cheraq account. A Cheraq account is free to open; the jobs you apply use prepaid Cheraq credits.

Nothing is sent until an administrator connects the site to a Cheraq account («Connect in one click», or by pasting an API key). After that the plugin sends to https://cheraq.ai/api/v1:

* On connect and then hourly: the site URL, name, tagline and locale; the WordPress, PHP and plugin versions; whether WooCommerce or a supported SEO plugin is active.
* Once in full, then hourly for what changed: the title, URL, status, date and text of published posts, pages and products, and the URL of images without alt text. Cheraq uses these to understand the business, to choose what to propose and to write.
* When you open the Cheraq page or act on it: your choices (plan, approvals, rejections with their reason, edits, titles you supply, files you upload to the business knowledge).
* Daily click counts for the call-to-action links Cheraq placed in articles (counts per day and page only; no cookies, nothing about the visitor).
* Only if you switch on the support chat: the messages visitors type in the chat widget, the page they are on, and a phone number they choose to leave.
* Only if you connect Google Search Console (on Cheraq, through Google's own consent screen): Cheraq reads the site's search statistics from Google, read-only.

User accounts, orders, passwords and WordPress settings are never sent. «Disconnect this site» in the plugin's settings stops everything.

Service terms: https://cheraq.ai/terms
Privacy policy: https://cheraq.ai/privacy

== Installation ==

1. Install and activate the plugin, then open the «Cheraq» menu (Dashboard, Smart articles, Smart products, Business memory, Support chat, Settings).
2. Click «Connect in one click», sign in to cheraq.ai and come back.
3. Confirm your business profile, pick how much work you want each week and how to work (review first, or automatic).

== Frequently Asked Questions ==

= Do I need an account? =

Yes. The AI work is done by the Cheraq service, so the plugin needs a Cheraq account. Opening one is free.

= What does it cost? =

There is no subscription. Each job you apply on your site uses Cheraq credits; rejecting a proposal is free. The last step of the setup shows what your plan costs per month.

= Can it break my site? =

It only creates posts and fills content, SEO fields and alt text that you approved, and each change has an undo. It does not touch your theme, plugins, prices, users or settings.

= Which SEO plugins are supported? =

Rank Math, Yoast SEO and SEOPress.

== Source code ==

Everything in this plugin is the hand-written source: there is no build step and nothing is minified or generated. `assets/app.js` draws the admin pages (plain JavaScript, no framework), `assets/chat.js` is the visitor chat widget, `assets/app.css` the styles, and `includes/*.php` the server side. Long lines in `app.js` are its bilingual word tables, not compiled output.

== Developers ==

`cheraq_chat( $prompt, $model = 'auto', $system = null )`, `cheraq_image( $prompt )`, `cheraq_job( $id )`. Registers as a provider of the WordPress AI Client.

== Changelog ==
= 1.5.1 =
* The plugin keeps its API key in its own option (it no longer touches the AI Client's connector key); every field the admin page sends is sanitised by its own rule; the PHP time limit is raised only for the few long actions.

= 1.5.0 =
* A page for each job under the Cheraq menu: Dashboard, Smart articles, Smart products, Business memory, Support chat, Settings.
* Smart articles shows the title queue: add your own titles (paste or file) or let Cheraq suggest more, right there.
* Every page has an activity log of what Cheraq wrote and what you decided; the dashboard gives a summary of each page with a link to it.

= 1.4.0 =
* Prepared for the WordPress.org directory: readable source, updates from WordPress.org in that build, an «External services» section in the readme, the dashboard widget takes its normal place.

= 1.3.3 =
* Sources found by web search are proper links in the article (they appeared as raw «[site](url)» text). The review window counts them.

= 1.3.2 =
* Every amount is shown in Cheraq credits, as in your Cheraq account; the plan's cost appears once, in the last setup step.
* Fix: new articles failed to be written («Web Search cannot be used with JSON mode»).

= 1.3.1 =
* The page leads with the work, not with money: what was made this month, words written, and for every draft its quality (length, headings, internal links, sales buttons, image). Costs are one quiet line that opens into the details.

= 1.3.0 =
* Article titles: let Cheraq find them, or give your own list — paste one per line or upload an Excel, text or CSV file.
* The plan tells you which AI model writes the texts and which one makes the images.
* Settings → «Article writer instructions (advanced)»: edit the instructions the writer follows, or go back to the default.

= 1.2.3 =
* The on/off switches are drawn so WordPress's own checkbox styles cannot bend them; grey when off, green when on.
* Automatic mode no longer asks for an amount: its weekly ceiling follows the plan you chose.

= 1.2.2 =
* The weekly plan is one calm box: no coloured frames per job, prices in the text colour, one small on/off switch.

= 1.2.1 =
* Fix: the setup wizard's «Next» button showed a block of text instead of its label.

= 1.2.0 =
* Three ready levels for the weekly plan (light, balanced, busy); new sites start on «light». The numbers stay adjustable.
* Review window: edit the text and the Google title/description before publishing, or ask for a change in one sentence instead of rejecting (up to 2 free revisions per job).
* Automatic mode has a weekly spending ceiling. The header says how far your credit goes with your plan.
* Settings: the plan on top, everything else folded with a summary, one save bar, a warning before leaving with unsaved changes.
* Results: the growth score shows which job wins how many points; history shows dates, edit links and your reasons.
* Fixes: typed text is no longer wiped while a job is being written; errors stay until closed; phone layout for the plan; keyboard focus.
* If you stay away for a week in review mode, new writing waits for you; a Telegram reminder tells you finished work is waiting.

= 1.1.7 =
* Settings → «This site's API key»: see which key the site uses and replace it with another Cheraq key (only keys Cheraq confirms are accepted). One-click connect uses your account's default key.

= 1.1.6 =
* Two ways to work: «write, I review and publish» or «write and publish automatically». Switches instead of ticks. Prices follow the models' real prices and today's rate.

= 1.1.5 =
* Fix: what you correct in the setup (your business, your buttons) is saved at each step, so the sample topics and everything after follow your words; the samples show which business and buttons they were made for.

= 1.1.4 =
* The plan's comparison reads right to left: the usual price first (grey), then Cheraq's; a note that nothing is paid now.

= 1.1.3 =
* Smaller, faster files.

= 1.1.2 =
* The weekly plan compares Cheraq and a writer/admin side by side, line by line; two sample article topics found for your site right in the plan; jobs are written automatically by default (you only press publish); more articles and refreshes per week by default; WooCommerce stores also get product copy updates; tidier business fields.

= 1.1.1 =
* The setup no longer asks what a customer is worth to you.

= 1.1.0 =
* A clear price for every job, charged only when you apply it — rejecting is free. A weekly plan: tick the article and refresh ideas you want and only those get written.
* The setup wizard: your business → your site's goal (shop, call, WhatsApp, Telegram, a link) → the weekly plan with a price table and the monthly total.
* Business knowledge: your facts (prices, shipping, warranty, contact, what never to say) and files (PDF, text, CSV); the support chat finds answers by meaning.
* Calls to action in articles, with click counting; a «what Cheraq did this month» report: value of the work, your cost, clicks, leads, Google clicks, growth score — in the plugin, on the WordPress dashboard and every Saturday on Telegram.

= 1.0.0 =
* Rebuilt from scratch: one page with Proposals, Results and Settings. One-click connect, a guided start (Cheraq reads the site, you confirm the business), and every piece of work arrives as a proposal you review — with a Google preview, before/after for refreshes — and approve, edit or reject.
* Google Search Console: connect once; real searches choose what to write and refresh, and the Results page shows Google clicks for the pages Cheraq touched.
* Every change undoes in one click; a monthly spending cap; pause any time.
* Support chat rebuilt: answers from your content, asks you on Telegram when unsure, sends you leads.
* Removed: the background task runner, scans, specialties, assistant chat, local memory store and price automation. Their old data stays in your database, unused.

= 0.7.3 =
* A passing hiccup (HTTP 502/503/504, a dropped connection while Cheraq updates) no longer fails a task: each call is retried, and a task that still hits one goes back in the queue in 5 minutes (up to 3 times).

= 0.7.2 =
* Assistant: knows your business profile, reads your business memory and your competitors' latest articles, and proposes article tasks you approve; uses the newest ChatGPT model; no raw Markdown asterisks.

= 0.7.1 =
* The support chat on your site uses your theme's own font.

= 0.7.0 =
* Done tasks get actions: regenerate (text + image), rewrite text, new image, make longer, refresh content, delete the post.
* The same Cheraq actions on Posts, Pages and Products: in each row's links and as bulk actions.
* Bulk orders in Tasks: «write 10 new articles», «refresh 10 articles», «improve 10 products», «refresh 10 pages» — each becomes a task, four minutes apart.

= 0.6.6 =
* Settings → Pro: «Newest ChatGPT» is the first and default choice for the writer and image models, showing which model it is right now.

= 0.6.5 =
* Articles, product copy and images are written with OpenAI's newest ChatGPT models (they follow new releases automatically).
* Writing rules: practical and specific, made for readers, Google and AI answers, no AI tells or filler, better than your competitors, no invented facts.
* When you save the writing automations, a short dialog asks: publish directly or draft for your approval, existing categories only or new ones when needed, English (translated) or Persian slugs.

= 0.6.4 =
* Assistant chat: the answer is prepared in the background and the chat shows what it is checking, so a long check no longer hangs or loses your message; «Try again» on a failed answer.
* Your messages on the right, the assistant's on the left.
* The assistant reads visits from WP Statistics, Koko Analytics, Burst or Jetpack Stats; without one it recommends installing WP Statistics (and likewise for other missing data).

= 0.6.3 =
* The plugin advisor is switched off (no recommendations card, no specialty, no install route).

= 0.6.2 =
* Competitors are searched from your business profile (what you really do), never from the literal meaning of the site name; the profile is built first if missing.
* «Refresh now» on an empty memory also builds the profile and finds competitors once.

= 0.6.1 =
* Business profile first: before writing, the agent works out what your business really is (from the tagline, your content, notes and competitors — never from the site name alone) and writes every article, product page and answer on it. The profile is in memory and you can edit it.
* Your business's own specialists (e.g. a chandelier and lighting expert for a chandelier shop) join the team and shape the writing.
* Specialties page is your team, one under the other, with you as the CEO.
* Memory sections are one under the other; the buttons on top scroll to each, and every section has its own add/edit.
* A cancelled task is not queued again the same week.

= 0.6.0 =
* The scan talks to you like an employee to its manager: what it already does comes first, then what it can do; «Write a sample article» shows the quality before you switch the writer on.
* Specialties page: content writer, SEO & AI search, shop, online support, business memory, technical, plugin advisor — switch each on or off.
* Plugin advisor: missing essentials (cache, SEO, security, backup, image compression…) and conflicting plugins; install from wordpress.org only on your click.
* Product pages: also rewrites existing copy to beat the competitors in your business memory (the old copy is kept).
* Telegram reports: a daily summary of the work done and the weekly technical check-up, through the Cheraq bot.
* Business memory is an offer of its own and stays light on big sites (newest 3000 items, only changed items re-read).
* The dollar price automation is removed.

= 0.5.2 =
* The last short names are Cheraq too (admin CSS classes and scripts, the visitor chat cookie). New API keys start with cq_live_; older hn_live_ keys keep working.

= 0.5.1 =
* The scan's progress bar stands still (full, green) once the scan is done.

= 0.5.0 =
* Internal names are Cheraq too (settings, tables, meta, scheduled jobs, the AI-client provider id). Updating from an earlier version moves the key, settings, memory, support chat, tasks and meta automatically.

= 0.4.3 =
* Everything is called Cheraq now: admin pages are admin.php?page=cheraq (old links redirect), the REST namespace is cheraq/v1, developer functions cheraq_chat / cheraq_image / cheraq_job.
* Long Cheraq answers (a content plan, an article) are no longer cut off after 85 seconds; only a connection that sends nothing for a minute is dropped. Saving the automation choices answers at once and builds the plan in the background.

= 0.4.2 =
* Competitor search (web search) also uses the home page SEO description (Rank Math / Yoast / SEOPress), the home and «about» page text and the store's city and country.

= 0.4.1 =
* The site scan no longer seems to hang when a step is interrupted: it shows what happened and continues from that step; requests the admin is waiting on stop after 85 seconds.

= 0.4.0 =
* Business memory (Cheraq → Business memory): products with price, stock and link, posts, pages, Q&A, files (Excel, Word, PDF, CSV, text), your own notes and competitors, all editable; refreshed hourly, daily or weekly; can also be part of your Cheraq account's business memory.
* The support chat answers from the business memory and gives the link of the product or article it talks about.
* Questions the support chat cannot answer go to you on the Cheraq Telegram bot (@cheraq_aibot); your reply reaches the visitor and is remembered. No own bot needed any more.
* Dashboard widget: what the agent did lately, news from Cheraq, a message box to the Cheraq team; notices are small and close with one click.
* Updates itself: new versions appear in Plugins → Updates and install automatically (can be switched off in Settings).
* Find competitors on the web and keep them in memory.

= 0.3.2 =
* Chat answers come back as a stream, so long articles no longer fail after 100 seconds (Cloudflare's limit).

= 0.3.1 =
* The service is «هوش مصنوعی چراغ» / Cheraq AI at https://cheraq.ai. Same API keys and credits. The plugin folder is now «cheraq»: after installing this version, deactivate and delete the older copy of the plugin; the key, settings, tasks and history are shared and carry over. The old address keeps answering API calls.
= 0.3.0 =
* «دستیار چراغ» / Cheraq assistant: chat with your site manager; it reads plugins, themes, the error log, site health, content and settings by itself and proposes changes (activate/deactivate plugins, switch/update themes and plugins, settings, cache, permalinks, Cheraq tasks and automations) as cards you approve one by one; every change is logged with undo.
= 0.2.4 =
* Dollar prices: markup now applied (was ignored), variations supported, batches with a lock, skips products being edited, holds changes above «max jump», keeps the sale ratio, logs every change with one-click undo; «convert current prices to dollar» button (preview → apply → undo); quiet-hour default 04:00.
= 0.2.3 =
* Settings → Pro: pick the writer and image models (searchable, with credit estimates); «Automatic» follows the Cheraq model manager's current pick, shown by name.
= 0.2.2 =
* SQLite-safe queries (WordPress Playground), tasks run while the admin page is open, stuck tasks time out, readable task results, opt-in error reports to the Cheraq team.
= 0.2.1 =
* Key also sent as X-Api-Key (proxies that drop Authorization, e.g. WordPress Playground), Persian name/description in the plugins list, Playground hint.
= 0.2.0 =
* Site scan with live progress, automation offers, task queue and scheduler, activity report, support chat, GEO tools, dollar pricing, core Connectors card, Persian/English.
= 0.1.0 =
* Connection and developer helpers.
