=== itdatex Blog-Bot ===
Contributors: itdatex
Tags: blog, ai, rss, drafts, automation
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.1.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fetches RSS items from a configurable list of sources, rewrites them into blog drafts via a local (Ollama-compatible) LLM endpoint you configure, and stores them as draft posts.

== Description ==

**itdatex Blog-Bot** is an editorial helper, not an auto-publisher. A cron job fetches items from a configurable list of RSS feeds, scores them for topical relevance, and asks an LLM endpoint (that YOU configure — by default `http://127.0.0.1:11434/api/chat`, i.e. a local Ollama server) to rewrite matching items into a draft post. The result is a WordPress draft with the source link, score and the exact prompt attached as post meta so an editor can review, adjust and publish.

= What the plugin does =

* **Feed fetcher** — configurable RSS/Atom sources, deduplication by feed item GUID.
* **Scorer** — rule-based scoring (keywords, recency, source weight) filters candidates.
* **Generator** — calls the LLM endpoint you configure. Default is `http://127.0.0.1:11434/api/chat` (a local Ollama server); you can also point it at any other endpoint that speaks the Ollama chat API. The source link is always included in the prompt so the model can reference it.
* **Publisher** — inserts the result as `draft`, sets category and tags, records the source URL, score and the full prompt in post meta.
* **WP-CLI** — `wp itdatex-blog-bot run` for manual runs.

= Privacy and traceability =

* No auto-publish. Every draft goes through the WordPress editorial workflow.
* The LLM endpoint is a plugin setting (`ollama_url`). If you keep the default `127.0.0.1`, nothing leaves the server.
* Post meta stores the full prompt and source URL so the rewrite is auditable.

== External Services ==

This plugin talks to two kinds of external services:

**1. RSS/Atom feed URLs (configurable list)**

The plugin fetches RSS/Atom feeds you configure under Settings -> Blog-Bot. Default feed list on activation includes a handful of German business/tax publications (Bundesministerium der Finanzen, KoSIT, FeRD, IHK, DATEV Magazin, Lexoffice Blog, Sage.com, Smartsteuer Blog). You can add, remove or replace any of them. Each fetched item is compared against the local `posts` meta by GUID before being processed.

- When: on cron (`itdatex_blog_bot_run_daily`) or on manual `wp itdatex-blog-bot run`.
- What is sent: nothing (plain GET request for the feed).
- What is received: the feed XML, only the item title, link, publish date and content are stored in memory during the run.

Each feed URL is a service run by a third party. Please consult that publisher's terms of service and privacy policy before adding a source.

**2. LLM endpoint you configure**

The plugin sends the item's title and content to whatever URL is set in the `ollama_url` setting (default `http://127.0.0.1:11434/api/chat`) so the model can produce a rewritten draft. The default is a local endpoint on the same server; if you change it to a remote URL, the item text is transmitted to that URL.

- When: after a matching RSS item is scored above the threshold and picked for rewriting.
- What is sent: the plugin's rewrite prompt, the item title, item link and the raw feed content of the item.
- What is received: JSON with the rewritten text, which is stored as a WordPress draft.

If you use the default local Ollama URL, no data leaves your server. If you point `ollama_url` at a remote service, please consult that provider's terms and privacy policy.

== Installation ==

1. Extract the plugin to `/wp-content/plugins/itdatex-blog-bot/`.
2. Activate — activation registers the daily cron `itdatex_blog_bot_run_daily`.
3. Under **Blog-Bot -> Settings**, configure the LLM endpoint (`ollama_url`), the feed list, the scoring threshold and the default category.
4. First manual run via **Blog-Bot -> Run now** or `wp itdatex-blog-bot run`.

== Frequently Asked Questions ==

= Does the plugin send anything to a hosted AI service by default? =

No. The default `ollama_url` is `http://127.0.0.1:11434/api/chat`, which points at a local Ollama server on the same host. If you leave the default and do not run Ollama locally, generation simply fails and no draft is created.

= Can I point it at OpenAI or another cloud LLM? =

Only if the target speaks the Ollama chat API. If you do that, add the endpoint URL to the "External Services" disclosure your privacy policy shows to users.

= Does it publish automatically? =

No. Everything ends up as a `draft` (or `pending`, configurable). A human editor reviews before publish.

== Changelog ==

= 0.1.1 =
* wp.org compliance pass: plugin header and readme translated to English, External Services section added, defensive $_POST sanitize in the settings handler, error_log gated behind WP_DEBUG. No functional change.

= 0.1.0 =
* Initial release: feed fetcher, scorer, LLM generator, draft publisher, WP-CLI command, daily cron.

== Upgrade Notice ==

= 0.1.1 =
Compliance and language pass, no behavior change. Safe to update.
