=== Issue Triage for GitHub ===
Contributors: deusacc
Tags: github, issues, ai, developer tools, triage
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3.10
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Pull your GitHub repo's open issues into wp-admin and get an AI-drafted fix proposal for each one — bring your own GitHub token and AI key (BYOK).

== Description ==

Small and medium open-source repos accumulate bug reports and feature requests that sit open for months because nobody has time to triage them. This plugin gives you a wp-admin dashboard that lists a repository's open GitHub issues, and a one-click "Generate fix proposal" button that asks an AI model for a likely root cause, a concrete fix, and a suggested test — all read directly from the issue title and body.

Features:

* A dedicated "Issue Triage" admin page listing every open issue of a GitHub repository.
* Unlimited AI fix proposals, no quota.
* One-click AI fix proposal per issue: root cause, step-by-step fix, suggested test.
* Read-only in this free version: it never writes to GitHub, comments, or opens pull requests — it only reads issues and shows you a proposal to review and act on yourself (writing labels and comments is a feature of the full version, always one click away and never automatic).
* No cost for the plugin itself: you use your own GitHub token and your own AI API key.
* Works with any AI endpoint compatible with the OpenAI "chat completions" API.

BYOK (Bring Your Own Key): the plugin ships no API key of its own and does not act as a paid intermediary — a specific requirement of the WordPress.org policy on plugins that use external services, and the reason it costs less than subscription-based alternatives.

= Free vs Full version =

This free version (the one hosted on WordPress.org) is complete for one repository: unlimited issue syncing and unlimited AI fix proposals, no quota and nothing locked. If you maintain several repositories, [the full version](https://shop.lumnika.com/gh-issue-triage-byok.html) adds Bulk triage (one AI pass over all open issues that suggests labels, a P0-P3 priority and likely duplicates, then applies them to GitHub with one click per issue or "Apply all" — only labels that already exist in the repo, plus priority:P0-P3), a "Post as comment on GitHub" button that posts the fix proposal on the issue in one click, and more repositories in the same dashboard, one tab each — a one-time payment (no subscription), a drop-in replacement with the same settings, and a license key already inside the zip that enables updates in wp-admin (up to 3 sites).

== External services ==

This plugin connects to two external services that you configure yourself:

1. The GitHub REST API (api.github.com), to read the open issues of the repository you specify. A personal access token is optional for public repositories and required for private ones; the free version only performs read (GET) requests and never writes to GitHub. The full version also writes to GitHub, and only when you click "Apply", "Apply all" or "Post as comment on GitHub": it adds labels or posts a comment on that issue with the token you configured (which then needs write access to issues). See GitHub's terms (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) and privacy statement (https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement).
2. The AI endpoint you configure in the settings (API base URL, API key and model), to which the plugin sends the title and body of the issue you click "Generate fix proposal" on. No request is sent anywhere until you enter your own credentials. By default the plugin points at the OpenAI chat completions API (https://openai.com/policies/terms-of-use, https://openai.com/policies/privacy-policy); any OpenAI-compatible provider can be used instead. On WordPress 7.0+ you can instead pick "WordPress AI": the request then goes through the AI client built into WordPress to the provider you connected in Settings > Connectors, under that provider's terms.

Full version only — license check: the full version sends its license key and your site address (home_url) to shop.lumnika.com (https://shop.lumnika.com/) about once a week, to validate the license and offer updates in wp-admin. Nothing else is sent; the free version never contacts the shop for this.

Optional setup tips: only if you tick "Send me setup tips" in the settings, the email address you enter is sent once to shop.lumnika.com (the plugin author's shop, https://shop.lumnika.com/) together with the plugin name, to send you a few setup tips by email. The box is unticked by default and nothing is sent otherwise.

== Installation ==

1. Upload the `issue-triage-byok` folder to `/wp-content/plugins/`.
2. Activate the plugin from the WordPress Plugins menu.
3. Go to Settings > Issue Triage BYOK and enter the GitHub owner/repo, an optional GitHub token, and your AI API key.
4. Go to the "Issue Triage" menu to sync issues and generate fix proposals.

== Frequently Asked Questions ==

= Does this plugin change anything on GitHub? =
No. It only reads issues via the GitHub API. Fix proposals are shown in wp-admin for you to copy, adapt, and post yourself — the plugin never comments, labels, or opens pull requests. The full version writes to GitHub only when you click: labels via "Apply" in Bulk triage, a comment via "Post as comment on GitHub".

= Do I need a GitHub token? =
Only for private repositories, or to raise the GitHub API's low unauthenticated rate limit. Public repos work without a token for light use.

= Can I use it without an API key? =
Yes, on WordPress 7.0 or newer. Connect a provider once in Settings > Connectors, then pick "WordPress AI" in this plugin's "AI provider" list and save: no key is pasted here. Leave the model on "auto" to let WordPress choose, or type a model name you prefer. On older WordPress versions this option is simply not shown.

= Do I need an OpenAI key specifically? =
No. Any endpoint compatible with the OpenAI "chat completions" API works: change "API base URL" and "Model" in the settings.

= How many fix proposals can I generate for free? =
As many as you like: there is no quota. You only pay your AI provider for the tokens you use.

= Can I triage more than one repository? =
The free version triages one repository at a time (you can switch it in Settings whenever you want). The full version (one-time payment, see shop.lumnika.com) lists several repositories in the same dashboard, one tab each.

= How do I move my full-version license to another site? =

On the old site open Settings > Issue Triage BYOK and click "Deactivate on this site": its seat is freed and the key works on the new domain. Staging and local sites do not use a seat.

== Screenshots ==

1. Issue Triage dashboard listing open GitHub issues with a "Generate fix proposal" button.
2. AI-drafted fix proposal shown inline under an issue.
3. Settings page: GitHub repo, GitHub token, and AI provider configuration.

== Changelog ==

= 1.3.10 =
* Saved GitHub token and AI key are no longer printed in the settings page source: the fields show only the last 4 characters, and saving keeps the stored key.
* When your AI provider account runs out of credit (or its daily quota) you get a clear "top up billing" message instead of a generic API error. Bulk triage stops at that point and shows the issues already triaged, and long bulk runs no longer hit the PHP time limit.

= 1.3.9 =
* Reasoning models work: OpenAI o-series and GPT-5 get max_completion_tokens instead of the rejected max_tokens, and thinking models (Gemini 2.5/3, DeepSeek R1, QwQ...) get room to think before answering. A reply cut at the token limit is never shown as a fix proposal: one retry with a larger budget, then a clear error.
* Gemini errors show the provider's real message instead of raw JSON.

= 1.3.8 =
* Full version: "Deactivate on this site" button next to the license key frees this site's seat, so you can move the license to another domain without writing to support. The site-limit notice explains how.

= 1.3.7 =
* New: on WordPress 7.0+ you can pick "WordPress AI" as the AI provider: fix proposals (and Bulk triage in the full version) go through the AI client built into WordPress, using the connectors already set up in Settings > Connectors, so no API key is pasted into this plugin.

= 1.3.6 =
* Security: the "Sync now" link is protected by a nonce.

= 1.3.5 =
* Full version: the 3-site license limit now also applies to the paid features, not only to updates.
* Readme: clarified what the free and full versions do.

= 1.3.4 =
* After 10 and 50 issues triaged one by one, a dismissible notice points to the full version (bulk triage across all your repositories).
* Settings: optional, unticked "Send me setup tips" email opt-in; the email is sent to shop.lumnika.com only if you tick it.

= 1.3.3 =
* After 10 drafted proposals, a dismissible notice on the dashboard/plugin screens invites a WordPress.org review.

= 1.3.2 =
* Settings page: links to the other BYOK plugins from Lumnika (static links, no remote calls).

= 1.3.1 =
* Full version: the license key is checked with the shop once a week (14 days of tolerance if the shop is unreachable); a refunded or invalid key turns the full-version features off, with a notice in the admin.

= 1.3.0 =
* No monthly quota: unlimited AI fix proposals in the free version.
* Full version: Bulk triage — labels, P0-P3 priority and likely duplicates for every open issue in one pass, copyable as a Markdown table.
* Full version: "Post as comment on GitHub" posts the fix proposal on the issue in one click (token with Issues: Read and write).
* Full version: several repositories in one dashboard, one tab each (paste owner/repo or the github.com URL, one per line).

= 1.2.0 =
* Syncs up to 300 open issues (was the first 30 results, pull requests included: on busy repos that meant few or no issues).
* A wrong owner, repository or token now shows GitHub's own error on the dashboard instead of "No open issues found".
* Saved fix proposals are kept per repository: switching repo no longer shows another repo's proposal under an issue with the same number.

= 1.1.1 =
* The AI provider's own error (wrong model name, invalid key) is now shown under the issue instead of a generic "Network error".

= 1.1.0 =
* "Copy as GitHub comment" and "Open issue to reply" buttons on each proposal, with an optional signature link (Settings > Reply signature).

= 1.0.0 =
* First release: GitHub issue sync, AI fix proposals (BYOK), free/Pro monthly limit.
